Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -1,20 +1,69 @@
|
||||
import { Toaster as Sonner, ToasterProps } from "sonner"
|
||||
import type { CSSProperties } from "react";
|
||||
import { Toaster as Sonner, type ToasterProps } from "sonner";
|
||||
|
||||
const Toaster = ({ ...props }: ToasterProps) => {
|
||||
export const GLOBAL_TOAST_DURATION_MS = 4000;
|
||||
|
||||
/**
|
||||
* One feedback contract for every runtime surface.
|
||||
*
|
||||
* Feature code may still choose a longer duration for a message that genuinely
|
||||
* needs reading time, but it must not move individual toasts around the screen.
|
||||
* The notification centre's live notification cards are a separate shell
|
||||
* surface and deliberately remain top-right.
|
||||
*/
|
||||
const Toaster = ({
|
||||
style,
|
||||
position = "top-center",
|
||||
duration = GLOBAL_TOAST_DURATION_MS,
|
||||
toastOptions,
|
||||
...props
|
||||
}: ToasterProps) => {
|
||||
return (
|
||||
<Sonner
|
||||
theme="system"
|
||||
className="toaster group"
|
||||
position={position}
|
||||
duration={duration}
|
||||
toastOptions={{
|
||||
...toastOptions,
|
||||
classNames: {
|
||||
toast:
|
||||
"rounded-md! border! border-border-default! bg-surface-neutral-primary! px-4! py-3! text-text-neutral-primary! shadow-lg!",
|
||||
title: "text-body-default-medium-0! font-body-default-medium-0!",
|
||||
description:
|
||||
"text-body-small-regular-150! font-body-small-regular-150! text-text-neutral-secondary!",
|
||||
success:
|
||||
"border-border-positive-subtle! bg-surface-feedback-subtle-positive! text-text-feedback-positive!",
|
||||
error:
|
||||
"border-border-negative-subtle! bg-surface-feedback-subtle-negative! text-text-feedback-negative!",
|
||||
warning:
|
||||
"border-border-warning-subtle! bg-surface-feedback-subtle-warning! text-text-feedback-warning!",
|
||||
info:
|
||||
"border-border-information-subtle! bg-surface-feedback-subtle-information! text-text-feedback-information!",
|
||||
actionButton:
|
||||
"rounded-md! bg-brand-primary! px-2.5! py-1.5! text-body-small-medium-0! font-body-small-medium-0! text-text-neutral-primary!",
|
||||
cancelButton:
|
||||
"rounded-md! bg-surface-neutral-tertiary! px-2.5! py-1.5! text-body-small-medium-0! font-body-small-medium-0! text-text-neutral-primary!",
|
||||
...toastOptions?.classNames,
|
||||
},
|
||||
}}
|
||||
style={
|
||||
{
|
||||
"--normal-bg": "var(--popover)",
|
||||
"--normal-text": "var(--popover-foreground)",
|
||||
"--normal-border": "var(--border)",
|
||||
} as React.CSSProperties
|
||||
// A centred toaster is centred on the viewport, which puts it off to
|
||||
// the left of what the reader is looking at whenever a sidebar takes
|
||||
// part of the width. Nudging by half the sidebar centres it over the
|
||||
// content instead. The app shell publishes the width; surfaces
|
||||
// without a sidebar leave the variable unset and are unaffected.
|
||||
marginInlineStart: "calc(var(--app-content-inset-left, 0px) / 2)",
|
||||
...style,
|
||||
} as CSSProperties
|
||||
}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export { Toaster }
|
||||
export { Toaster };
|
||||
Reference in new issue
Block a user