@gridui/toast 1.0.9 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,8 +3,23 @@
3
3
  Core family. Public API: `ToastAction`, `ToastOptions`, `ToastProvider`, `ToastProviderProps`, `ToastTone`, `ToastUpdate`, `Toaster`, `ToasterProps`, `useToast`.
4
4
 
5
5
  Import components from `@gridui/toast` and load `@gridui/toast/styles.css` after Theme.
6
- Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
6
+ Applications own routes, labels, state persistence, and branding.
7
+
8
+ ## Styles
9
+
10
+ Load Theme once. Use `@gridui/toast/styled` for automatic component CSS in
11
+ CSS-aware bundlers, or keep the CSS-free root import and load `@gridui/toast/styles.css`.
12
+ Both entries expose the same root API. The standalone stylesheet includes component
13
+ dependency styles; Theme/reset remain separate. See the
14
+ [integration guide](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/usage/integration.md)
15
+ for static HTML loading, SSR limits, and avoiding duplicate CSS.
16
+
7
17
 
8
18
  See [component ownership](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md) and [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-core/toast/.changeset/history).
9
19
 
10
20
  [Component reference](docs/reference/README.md) contains focused API pages for each public component.
21
+
22
+ Shared animation policy and tempo come from `MotionConfig` in `@gridui/motion`.
23
+ Disabled or reduced-motion policy settles decoration without disabling interaction.
24
+ See the [motion guide](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-core/motion)
25
+ for CSS scopes, portal behavior, and specialized timing contracts.
package/dist/index.js CHANGED
@@ -137,6 +137,9 @@ var useToastState = () => {
137
137
  return state;
138
138
  };
139
139
 
140
+ // src/toaster/toast-item.tsx
141
+ import { useMotionStyle } from "@gridui/motion/policy";
142
+
140
143
  // src/toaster/use-toast.ts
141
144
  import { useContext as useContext2 } from "react";
142
145
  var useToast = () => {
@@ -154,6 +157,7 @@ import { X } from "lucide-react";
154
157
  import { useCallback as useCallback2 } from "react";
155
158
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
156
159
  var ToastItem = (props) => {
160
+ const motionStyle = useMotionStyle();
157
161
  const { record, closeLabel } = props;
158
162
  const { close } = useToast();
159
163
  const { remove, timeout } = useToastState();
@@ -184,6 +188,7 @@ var ToastItem = (props) => {
184
188
  className: "gridui-toast",
185
189
  "data-tone": record.tone ?? "neutral",
186
190
  inert: !record.open,
191
+ style: motionStyle,
187
192
  children: /* @__PURE__ */ jsxs(
188
193
  "div",
189
194
  {
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/shared/context.ts", "../src/toast-provider/model.ts", "../src/toast-provider/toast-provider.tsx", "../src/toaster/context.ts", "../src/toaster/use-toast.ts", "../src/toaster/toast-item.tsx", "../src/toaster/toaster.tsx"],
4
- "sourcesContent": ["/**\n * @author WMXPY\n * @package Toast\n * @namespace Shared\n * @description Context\n */\n\nimport type { ToastManager, ToastRecord } from \"./types\";\nimport { createContext } from \"react\";\n\nexport type ToastState = {\n readonly records: readonly ToastRecord[];\n readonly timeout: number;\n readonly remove: (id: string, revision: number) => void;\n};\n\nexport const ToastCommands = createContext<ToastManager | null>(null);\n\nexport const ToastStateContext = createContext<ToastState | null>(null);\n", "/**\n * @author WMXPY\n * @package Toast\n * @namespace ToastProvider\n * @description Model\n */\n\nimport type { ToastUpdate } from \"../shared/types\";\n\nexport const validateToastOptions = (options: ToastUpdate): void => {\n if (options.timeout !== undefined && (!Number.isFinite(options.timeout) || options.timeout < 0)) {\n throw new RangeError(\"Toast timeout must be a finite non-negative number.\");\n }\n};\n", "/**\n * @author WMXPY\n * @package Toast\n * @namespace ToastProvider\n * @description Toast Provider\n */\n\nimport { ToastCommands, ToastStateContext } from \"../shared/context\";\nimport type { ToastOptions, ToastRecord, ToastUpdate } from \"../shared/types\";\nimport { validateToastOptions } from \"./model\";\nimport { type FC, type ReactNode, useCallback, useId, useMemo, useRef, useState } from \"react\";\n\nexport type ToastProviderProps = {\n readonly children?: ReactNode;\n readonly timeout?: number;\n readonly limit?: number;\n};\n\nexport const ToastProvider: FC<ToastProviderProps> = (props: ToastProviderProps) => {\n const { children, timeout = 5000, limit = 3 } = props;\n if (!Number.isFinite(timeout) || timeout < 0 || !Number.isInteger(limit) || limit < 1) {\n throw new RangeError(\"ToastProvider needs a non-negative timeout and a positive integer limit.\");\n }\n const [\n records,\n setRecords,\n ] = useState<readonly ToastRecord[]>([]);\n const current = useRef(records);\n const sequence = useRef(0);\n const prefix = useId();\n const publish = useCallback((next: readonly ToastRecord[]) => {\n current.current = next;\n setRecords(next);\n }, []);\n const add = useCallback((options: ToastOptions): string => {\n validateToastOptions(options);\n const id = options.id ?? `${prefix}-${++sequence.current}`;\n const replaced = current.current.find(record => {\n return record.id === id;\n });\n const others = current.current.filter(record => {\n return record.open && record.id !== id;\n });\n const evicted = others.slice(0, Math.max(0, others.length - limit + 1));\n publish([\n ...others.slice(Math.max(0, others.length - limit + 1)),\n {\n ...options,\n id,\n open: true,\n revision: (replaced?.revision ?? 0) + 1,\n },\n ]);\n evicted.forEach(record => {\n record.onClose?.();\n });\n return id;\n }, [\n prefix,\n limit,\n publish,\n ]);\n const update = useCallback((id: string, options: ToastUpdate) => {\n validateToastOptions(options);\n if (!current.current.some(record => {\n return record.id === id && record.open;\n })) {\n return;\n }\n publish(current.current.map(record => {\n return record.id === id && record.open ? {\n ...record,\n ...options,\n revision: record.revision + 1,\n } : record;\n }));\n }, [publish]);\n const close = useCallback((id?: string) => {\n const closing = current.current.filter(record => {\n return record.open && (id === undefined || record.id === id);\n });\n if (closing.length === 0) {\n return;\n }\n publish(current.current.map(record => {\n return closing.includes(record) ? {\n ...record,\n open: false,\n } : record;\n }));\n closing.forEach(record => {\n record.onClose?.();\n });\n }, [publish]);\n const remove = useCallback((id: string, revision: number) => {\n const next = current.current.filter(record => {\n return record.id !== id || record.revision !== revision || record.open;\n });\n if (next.length !== current.current.length) {\n publish(next);\n }\n }, [publish]);\n const manager = useMemo(() => {\n return {\n add,\n update,\n close,\n };\n }, [\n add,\n update,\n close,\n ]);\n return (<ToastCommands.Provider\n value={manager}\n >\n <ToastStateContext.Provider\n value={{\n records,\n timeout,\n remove,\n }}\n >\n {children}\n </ToastStateContext.Provider>\n </ToastCommands.Provider>);\n};\n", "/**\n * @author WMXPY\n * @package Toast\n * @namespace Toaster\n * @description Context\n */\n\nimport { type ToastState, ToastStateContext } from \"../shared/context\";\nimport { useContext } from \"react\";\n\nexport const useToastState = (): ToastState => {\n const state = useContext(ToastStateContext);\n if (!state) {\n throw new Error(\"Toasts require a ToastProvider parent.\");\n }\n return state;\n};\n", "/**\n * @author WMXPY\n * @package Toast\n * @namespace Toaster\n * @description Use Toast\n */\n\nimport { ToastCommands } from \"../shared/context\";\nimport type { ToastManager } from \"../shared/types\";\nimport { useContext } from \"react\";\n\nexport const useToast = (): ToastManager => {\n const manager = useContext(ToastCommands);\n if (!manager) {\n throw new Error(\"Toasts require a ToastProvider parent.\");\n }\n return manager;\n};\n", "/**\n * @author WMXPY\n * @package Toast\n * @namespace Toaster\n * @description Toast Item\n */\n\nimport type { ToastDismissOptions, ToastRecord } from \"../shared/types\";\nimport { useToastState } from \"./context\";\nimport { useToast } from \"./use-toast\";\nimport { Button } from \"@gridui/button\";\nimport * as Primitive from \"@radix-ui/react-toast\";\nimport { X } from \"lucide-react\";\nimport { type FC, useCallback } from \"react\";\n\nexport type ToastItemProps = ToastDismissOptions & {\n readonly record: ToastRecord;\n};\n\nexport const ToastItem: FC<ToastItemProps> = (props: ToastItemProps) => {\n const { record, closeLabel } = props;\n const { close } = useToast();\n const { remove, timeout } = useToastState();\n const ref = useCallback((node: HTMLLIElement | null) => {\n if (!node) {\n queueMicrotask(() => {\n remove(record.id, record.revision);\n });\n }\n }, [\n remove,\n record.id,\n record.revision,\n ]);\n const duration = record.timeout ?? timeout;\n return (<Primitive.Root\n ref={ref}\n open={record.open}\n onOpenChange={(open) => {\n if (!open) {\n close(record.id);\n }\n }}\n duration={duration === 0 ? Infinity : duration}\n type={record.priority === \"high\" ? \"foreground\" : \"background\"}\n className=\"gridui-toast\"\n data-tone={record.tone ?? \"neutral\"}\n inert={!record.open}\n >\n <div\n className=\"gridui-toast-content\"\n >\n <div\n className=\"gridui-toast-message\"\n >\n <Primitive.Title\n className=\"gridui-toast-title\"\n >\n {record.title}\n </Primitive.Title>\n {record.description && (<Primitive.Description\n className=\"gridui-toast-description\"\n >\n {record.description}\n </Primitive.Description>)}\n </div>\n {record.action && (<Primitive.Action\n asChild\n altText={record.action.altText}\n >\n <Button\n variant=\"secondary\"\n className=\"gridui-toast-action\"\n size=\"small\"\n disabled={record.action.disabled}\n onClick={record.action.onClick}\n >\n {record.action.label}\n </Button>\n </Primitive.Action>)}\n <Primitive.Close\n asChild\n aria-label={closeLabel}\n >\n <Button\n variant=\"quiet\"\n className=\"gridui-toast-close\"\n layout=\"icon\"\n size=\"small\"\n >\n <X\n aria-hidden=\"true\"\n />\n </Button>\n </Primitive.Close>\n </div>\n </Primitive.Root>);\n};\n", "/**\n * @author WMXPY\n * @package Toast\n * @namespace Toaster\n * @description Toaster\n */\n\nimport type { ToastDismissOptions } from \"../shared/types\";\nimport { useToastState } from \"./context\";\nimport { ToastItem } from \"./toast-item\";\nimport { interactionLayerProps, useInteractionOutline, useScrollbars } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-toast\";\nimport { type ComponentPropsWithRef, type FC, useEffect, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\nexport type ToasterProps = Omit<ComponentPropsWithRef<\"ol\">, \"children\" | \"aria-label\"> & ToastDismissOptions & {\n readonly label: string;\n readonly container?: HTMLElement | undefined;\n};\n\nexport const Toaster: FC<ToasterProps> = (props: ToasterProps) => {\n const { ref: forwardedRef, label, closeLabel, container, className, ...restProps } = props;\n const scrollbarRef = useScrollbars({ ref: forwardedRef });\n const ref = useInteractionOutline({ ref: scrollbarRef });\n const { records, timeout } = useToastState();\n const [\n mounted,\n setMounted,\n ] = useState(false);\n useEffect(() => {\n setMounted(true);\n }, []);\n if (!mounted) {\n return null;\n }\n return createPortal((<Primitive.Provider\n label={label}\n duration={timeout === 0 ? Infinity : timeout}\n swipeDirection=\"down\"\n announcerContainer={container}\n >\n {records.map(record => {\n return (<ToastItem\n key={`${record.id}:${record.revision}`}\n record={record}\n closeLabel={closeLabel}\n />);\n })}\n <Primitive.Viewport\n {...interactionLayerProps}\n {...restProps}\n ref={ref}\n label={label}\n className={cn(\"gridui-toast-viewport\", className)}\n />\n </Primitive.Provider>), container ?? document.body);\n};\n"],
5
- "mappings": ";AAQA,SAAS,qBAAqB;AAQvB,IAAM,gBAAgB,cAAmC,IAAI;AAE7D,IAAM,oBAAoB,cAAiC,IAAI;;;ACT/D,IAAM,uBAAuB,CAAC,YAA+B;AAChE,MAAI,QAAQ,YAAY,WAAc,CAAC,OAAO,SAAS,QAAQ,OAAO,KAAK,QAAQ,UAAU,IAAI;AAC7F,UAAM,IAAI,WAAW,qDAAqD;AAAA,EAC9E;AACJ;;;ACHA,SAAkC,aAAa,OAAO,SAAS,QAAQ,gBAAgB;AA0G/E;AAlGD,IAAM,gBAAwC,CAAC,UAA8B;AAChF,QAAM,EAAE,UAAU,UAAU,KAAM,QAAQ,EAAE,IAAI;AAChD,MAAI,CAAC,OAAO,SAAS,OAAO,KAAK,UAAU,KAAK,CAAC,OAAO,UAAU,KAAK,KAAK,QAAQ,GAAG;AACnF,UAAM,IAAI,WAAW,0EAA0E;AAAA,EACnG;AACA,QAAM;AAAA,IACF;AAAA,IACA;AAAA,EACJ,IAAI,SAAiC,CAAC,CAAC;AACvC,QAAM,UAAU,OAAO,OAAO;AAC9B,QAAM,WAAW,OAAO,CAAC;AACzB,QAAM,SAAS,MAAM;AACrB,QAAM,UAAU,YAAY,CAAC,SAAiC;A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B,EAAE,KAAK,aAAa,CAAC;AACvD,QAAM,EAAE,SAAS,QAAQ,IAAI,cAAc;AAC3C,QAAM;AAAA,IACF;AAAA,IACA;AAAA,EACJ,IAAIF,UAAS,KAAK;AAClB,YAAU,MAAM;AACZ,eAAW,IAAI;AAAA,EACnB,GAAG,CAAC,CAAC;AACL,MAAI,CAAC,SAAS;AACV,WAAO;AAAA,EACX;AACA,SAAO,aAAc,gBAAAE;AAAA,IAAW;AAAA,IAAV;AAAA,MAClB;AAAA,MACA,UAAU,YAAY,IAAI,WAAW;AAAA,MACrC,gBAAe;AAAA,MACf,oBAAoB;AAAA,MAEnB;AAAA,gBAAQ,IAAI,YAAU;AACnB,iBAAQ,gBAAAD;AAAA,YAAC;AAAA;AAAA,cAEL;AAAA,cACA;AAAA;AAAA,YAFK,GAAG,OAAO,EAAE,IAAI,OAAO,QAAQ;AAAA,UAGxC;AAAA,QACJ,CAAC;AAAA,QACD,gBAAAA;AAAA,UAAW;AAAA,UAAV;AAAA,YACI,GAAG;AAAA,YACH,GAAG;AAAA,YACJ;AAAA,YACA;AAAA,YACA,WAAW,GAAG,yBAAyB,SAAS;AAAA;AAAA,QACpD;AAAA;AAAA;AAAA,EACJ,GAAwB,aAAa,SAAS,IAAI;AACtD;",
3
+ "sources": ["../src/shared/context.ts", "../src/toast-provider/model.ts", "../src/toast-provider/toast-provider.tsx", "../src/toaster/context.ts", "../src/toaster/toast-item.tsx", "../src/toaster/use-toast.ts", "../src/toaster/toaster.tsx"],
4
+ "sourcesContent": ["/**\n * @author WMXPY\n * @package Toast\n * @namespace Shared\n * @description Context\n */\n\nimport type { ToastManager, ToastRecord } from \"./types\";\nimport { createContext } from \"react\";\n\nexport type ToastState = {\n readonly records: readonly ToastRecord[];\n readonly timeout: number;\n readonly remove: (id: string, revision: number) => void;\n};\n\nexport const ToastCommands = createContext<ToastManager | null>(null);\n\nexport const ToastStateContext = createContext<ToastState | null>(null);\n", "/**\n * @author WMXPY\n * @package Toast\n * @namespace ToastProvider\n * @description Model\n */\n\nimport type { ToastUpdate } from \"../shared/types\";\n\nexport const validateToastOptions = (options: ToastUpdate): void => {\n if (options.timeout !== undefined && (!Number.isFinite(options.timeout) || options.timeout < 0)) {\n throw new RangeError(\"Toast timeout must be a finite non-negative number.\");\n }\n};\n", "/**\n * @author WMXPY\n * @package Toast\n * @namespace ToastProvider\n * @description Toast Provider\n */\n\nimport { ToastCommands, ToastStateContext } from \"../shared/context\";\nimport type { ToastOptions, ToastRecord, ToastUpdate } from \"../shared/types\";\nimport { validateToastOptions } from \"./model\";\nimport { type FC, type ReactNode, useCallback, useId, useMemo, useRef, useState } from \"react\";\n\nexport type ToastProviderProps = {\n readonly children?: ReactNode;\n readonly timeout?: number;\n readonly limit?: number;\n};\n\nexport const ToastProvider: FC<ToastProviderProps> = (props: ToastProviderProps) => {\n const { children, timeout = 5000, limit = 3 } = props;\n if (!Number.isFinite(timeout) || timeout < 0 || !Number.isInteger(limit) || limit < 1) {\n throw new RangeError(\"ToastProvider needs a non-negative timeout and a positive integer limit.\");\n }\n const [\n records,\n setRecords,\n ] = useState<readonly ToastRecord[]>([]);\n const current = useRef(records);\n const sequence = useRef(0);\n const prefix = useId();\n const publish = useCallback((next: readonly ToastRecord[]) => {\n current.current = next;\n setRecords(next);\n }, []);\n const add = useCallback((options: ToastOptions): string => {\n validateToastOptions(options);\n const id = options.id ?? `${prefix}-${++sequence.current}`;\n const replaced = current.current.find(record => {\n return record.id === id;\n });\n const others = current.current.filter(record => {\n return record.open && record.id !== id;\n });\n const evicted = others.slice(0, Math.max(0, others.length - limit + 1));\n publish([\n ...others.slice(Math.max(0, others.length - limit + 1)),\n {\n ...options,\n id,\n open: true,\n revision: (replaced?.revision ?? 0) + 1,\n },\n ]);\n evicted.forEach(record => {\n record.onClose?.();\n });\n return id;\n }, [\n prefix,\n limit,\n publish,\n ]);\n const update = useCallback((id: string, options: ToastUpdate) => {\n validateToastOptions(options);\n if (!current.current.some(record => {\n return record.id === id && record.open;\n })) {\n return;\n }\n publish(current.current.map(record => {\n return record.id === id && record.open ? {\n ...record,\n ...options,\n revision: record.revision + 1,\n } : record;\n }));\n }, [publish]);\n const close = useCallback((id?: string) => {\n const closing = current.current.filter(record => {\n return record.open && (id === undefined || record.id === id);\n });\n if (closing.length === 0) {\n return;\n }\n publish(current.current.map(record => {\n return closing.includes(record) ? {\n ...record,\n open: false,\n } : record;\n }));\n closing.forEach(record => {\n record.onClose?.();\n });\n }, [publish]);\n const remove = useCallback((id: string, revision: number) => {\n const next = current.current.filter(record => {\n return record.id !== id || record.revision !== revision || record.open;\n });\n if (next.length !== current.current.length) {\n publish(next);\n }\n }, [publish]);\n const manager = useMemo(() => {\n return {\n add,\n update,\n close,\n };\n }, [\n add,\n update,\n close,\n ]);\n return (<ToastCommands.Provider\n value={manager}\n >\n <ToastStateContext.Provider\n value={{\n records,\n timeout,\n remove,\n }}\n >\n {children}\n </ToastStateContext.Provider>\n </ToastCommands.Provider>);\n};\n", "/**\n * @author WMXPY\n * @package Toast\n * @namespace Toaster\n * @description Context\n */\n\nimport { type ToastState, ToastStateContext } from \"../shared/context\";\nimport { useContext } from \"react\";\n\nexport const useToastState = (): ToastState => {\n const state = useContext(ToastStateContext);\n if (!state) {\n throw new Error(\"Toasts require a ToastProvider parent.\");\n }\n return state;\n};\n", "/**\n * @author WMXPY\n * @package Toast\n * @namespace Toaster\n * @description Toast Item\n */\n\nimport { useMotionStyle } from \"@gridui/motion/policy\";\n/**\n * @author WMXPY\n * @package Toast\n * @namespace Toaster\n * @description Toast Item\n */\n\nimport type { ToastDismissOptions, ToastRecord } from \"../shared/types\";\nimport { useToastState } from \"./context\";\nimport { useToast } from \"./use-toast\";\nimport { Button } from \"@gridui/button\";\nimport * as Primitive from \"@radix-ui/react-toast\";\nimport { X } from \"lucide-react\";\nimport { type FC, useCallback } from \"react\";\n\nexport type ToastItemProps = ToastDismissOptions & {\n readonly record: ToastRecord;\n};\n\nexport const ToastItem: FC<ToastItemProps> = (props: ToastItemProps) => {\n const motionStyle = useMotionStyle();\n const { record, closeLabel } = props;\n const { close } = useToast();\n const { remove, timeout } = useToastState();\n const ref = useCallback((node: HTMLLIElement | null) => {\n if (!node) {\n queueMicrotask(() => {\n remove(record.id, record.revision);\n });\n }\n }, [\n remove,\n record.id,\n record.revision,\n ]);\n const duration = record.timeout ?? timeout;\n return (<Primitive.Root\n ref={ref}\n open={record.open}\n onOpenChange={(open) => {\n if (!open) {\n close(record.id);\n }\n }}\n duration={duration === 0 ? Infinity : duration}\n type={record.priority === \"high\" ? \"foreground\" : \"background\"}\n className=\"gridui-toast\"\n data-tone={record.tone ?? \"neutral\"}\n inert={!record.open}\n style={motionStyle}\n >\n <div\n className=\"gridui-toast-content\"\n >\n <div\n className=\"gridui-toast-message\"\n >\n <Primitive.Title\n className=\"gridui-toast-title\"\n >\n {record.title}\n </Primitive.Title>\n {record.description && (<Primitive.Description\n className=\"gridui-toast-description\"\n >\n {record.description}\n </Primitive.Description>)}\n </div>\n {record.action && (<Primitive.Action\n asChild\n altText={record.action.altText}\n >\n <Button\n variant=\"secondary\"\n className=\"gridui-toast-action\"\n size=\"small\"\n disabled={record.action.disabled}\n onClick={record.action.onClick}\n >\n {record.action.label}\n </Button>\n </Primitive.Action>)}\n <Primitive.Close\n asChild\n aria-label={closeLabel}\n >\n <Button\n variant=\"quiet\"\n className=\"gridui-toast-close\"\n layout=\"icon\"\n size=\"small\"\n >\n <X\n aria-hidden=\"true\"\n />\n </Button>\n </Primitive.Close>\n </div>\n </Primitive.Root>);\n};\n", "/**\n * @author WMXPY\n * @package Toast\n * @namespace Toaster\n * @description Use Toast\n */\n\nimport { ToastCommands } from \"../shared/context\";\nimport type { ToastManager } from \"../shared/types\";\nimport { useContext } from \"react\";\n\nexport const useToast = (): ToastManager => {\n const manager = useContext(ToastCommands);\n if (!manager) {\n throw new Error(\"Toasts require a ToastProvider parent.\");\n }\n return manager;\n};\n", "/**\n * @author WMXPY\n * @package Toast\n * @namespace Toaster\n * @description Toaster\n */\n\nimport type { ToastDismissOptions } from \"../shared/types\";\nimport { useToastState } from \"./context\";\nimport { ToastItem } from \"./toast-item\";\nimport { interactionLayerProps, useInteractionOutline, useScrollbars } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-toast\";\nimport { type ComponentPropsWithRef, type FC, useEffect, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\nexport type ToasterProps = Omit<ComponentPropsWithRef<\"ol\">, \"children\" | \"aria-label\"> & ToastDismissOptions & {\n readonly label: string;\n readonly container?: HTMLElement | undefined;\n};\n\nexport const Toaster: FC<ToasterProps> = (props: ToasterProps) => {\n const { ref: forwardedRef, label, closeLabel, container, className, ...restProps } = props;\n const scrollbarRef = useScrollbars({ ref: forwardedRef });\n const ref = useInteractionOutline({ ref: scrollbarRef });\n const { records, timeout } = useToastState();\n const [\n mounted,\n setMounted,\n ] = useState(false);\n useEffect(() => {\n setMounted(true);\n }, []);\n if (!mounted) {\n return null;\n }\n return createPortal((<Primitive.Provider\n label={label}\n duration={timeout === 0 ? Infinity : timeout}\n swipeDirection=\"down\"\n announcerContainer={container}\n >\n {records.map(record => {\n return (<ToastItem\n key={`${record.id}:${record.revision}`}\n record={record}\n closeLabel={closeLabel}\n />);\n })}\n <Primitive.Viewport\n {...interactionLayerProps}\n {...restProps}\n ref={ref}\n label={label}\n className={cn(\"gridui-toast-viewport\", className)}\n />\n </Primitive.Provider>), container ?? document.body);\n};\n"],
5
+ "mappings": ";AAQA,SAAS,qBAAqB;AAQvB,IAAM,gBAAgB,cAAmC,IAAI;AAE7D,IAAM,oBAAoB,cAAiC,IAAI;;;ACT/D,IAAM,uBAAuB,CAAC,YAA+B;AAChE,MAAI,QAAQ,YAAY,WAAc,CAAC,OAAO,SAAS,QAAQ,OAAO,KAAK,QAAQ,UAAU,IAAI;AAC7F,UAAM,IAAI,WAAW,qDAAqD;AAAA,EAC9E;AACJ;;;ACHA,SAAkC,aAAa,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AS;AAAA;AAAA,QACpD;AAAA;AAAA;AAAA,EACJ,GAAwB,aAAa,SAAS,IAAI;AACtD;",
6
6
  "names": ["useContext", "useCallback", "jsx", "Primitive", "useState", "jsx", "jsxs"]
7
7
  }
package/dist/styled.js ADDED
@@ -0,0 +1,4 @@
1
+ import "@gridui/button/styled";
2
+ import "@gridui/overlay/styled";
3
+ import "./styles.local.css";
4
+ export * from "./index.js";
package/dist/styles.css CHANGED
@@ -1,3 +1,597 @@
1
+ /*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
2
+ @layer properties;
3
+ @layer theme, base, components, utilities;
4
+ @layer theme {
5
+ :root, :host {
6
+ --spacing: 0.25rem;
7
+ }
8
+ }
9
+ @layer utilities {
10
+ .gridui-u-button--pointer-events-none {
11
+ pointer-events: none;
12
+ }
13
+ .gridui-u-button--inline-flex {
14
+ display: inline-flex;
15
+ }
16
+ .gridui-u-button--h-full {
17
+ height: 100%;
18
+ }
19
+ .gridui-u-button--h-gridui-control {
20
+ height: var(--gridui-control-min-height);
21
+ }
22
+ .gridui-u-button--min-h-18 {
23
+ min-height: calc(var(--spacing) * 18);
24
+ }
25
+ .gridui-u-button--min-h-gridui-control {
26
+ min-height: var(--gridui-control-min-height);
27
+ }
28
+ .gridui-u-button--min-h-gridui-control-large {
29
+ min-height: var(--gridui-control-min-height-large);
30
+ }
31
+ .gridui-u-button--min-h-gridui-control-small {
32
+ min-height: var(--gridui-control-min-height-small);
33
+ }
34
+ .gridui-u-button--w-fit {
35
+ width: fit-content;
36
+ }
37
+ .gridui-u-button--w-full {
38
+ width: 100%;
39
+ }
40
+ .gridui-u-button--w-gridui-64 {
41
+ width: var(--gridui-space-64);
42
+ }
43
+ .gridui-u-button--w-gridui-control {
44
+ width: var(--gridui-control-min-height);
45
+ }
46
+ .gridui-u-button--w-gridui-control-large {
47
+ width: var(--gridui-control-min-height-large);
48
+ }
49
+ .gridui-u-button--w-gridui-control-small {
50
+ width: var(--gridui-control-min-height-small);
51
+ }
52
+ .gridui-u-button--max-w-full {
53
+ max-width: 100%;
54
+ }
55
+ .gridui-u-button--min-w-0 {
56
+ min-width: 0px;
57
+ }
58
+ .gridui-u-button--min-w-gridui-24 {
59
+ min-width: var(--gridui-space-24);
60
+ }
61
+ .gridui-u-button--flex-1 {
62
+ flex: 1;
63
+ }
64
+ .gridui-u-button--shrink-0 {
65
+ flex-shrink: 0;
66
+ }
67
+ .gridui-u-button--cursor-pointer {
68
+ cursor: pointer;
69
+ }
70
+ .gridui-u-button--flex-col {
71
+ flex-direction: column;
72
+ }
73
+ .gridui-u-button--items-center {
74
+ align-items: center;
75
+ }
76
+ .gridui-u-button--items-stretch {
77
+ align-items: stretch;
78
+ }
79
+ .gridui-u-button--justify-between {
80
+ justify-content: space-between;
81
+ }
82
+ .gridui-u-button--justify-center {
83
+ justify-content: center;
84
+ }
85
+ .gridui-u-button--justify-start {
86
+ justify-content: flex-start;
87
+ }
88
+ .gridui-u-button--gap-0 {
89
+ gap: 0px;
90
+ }
91
+ .gridui-u-button--gap-gridui-8 {
92
+ gap: var(--gridui-space-8);
93
+ }
94
+ .gridui-u-button--gap-gridui-32 {
95
+ gap: var(--gridui-space-32);
96
+ }
97
+ .gridui-u-button--self-stretch {
98
+ align-self: stretch;
99
+ }
100
+ .gridui-u-button--rounded-control {
101
+ border-radius: var(--gridui-control-radius);
102
+ }
103
+ .gridui-u-button--rounded-none {
104
+ border-radius: 0;
105
+ }
106
+ .gridui-u-button--border-0 {
107
+ border-style: var(--tw-border-style);
108
+ border-width: 0px;
109
+ }
110
+ .gridui-u-button--border-b {
111
+ border-bottom-style: var(--tw-border-style);
112
+ border-bottom-width: 1px;
113
+ }
114
+ .gridui-u-button--border-accent-background {
115
+ border-color: var(--gridui-accent-background);
116
+ }
117
+ .gridui-u-button--border-control-border {
118
+ border-color: var(--gridui-control-border);
119
+ }
120
+ .gridui-u-button--border-foreground {
121
+ border-color: var(--gridui-foreground);
122
+ }
123
+ .gridui-u-button--bg-accent-background {
124
+ background-color: var(--gridui-accent-background);
125
+ }
126
+ .gridui-u-button--bg-selection-background {
127
+ background-color: var(--gridui-selection-background);
128
+ }
129
+ .gridui-u-button--bg-transparent {
130
+ background-color: transparent;
131
+ }
132
+ .gridui-u-button--p-0 {
133
+ padding: 0px;
134
+ }
135
+ .gridui-u-button--px-0 {
136
+ padding-inline: 0px;
137
+ }
138
+ .gridui-u-button--px-gridui-8 {
139
+ padding-inline: var(--gridui-space-8);
140
+ }
141
+ .gridui-u-button--px-gridui-16 {
142
+ padding-inline: var(--gridui-space-16);
143
+ }
144
+ .gridui-u-button--px-gridui-24 {
145
+ padding-inline: var(--gridui-space-24);
146
+ }
147
+ .gridui-u-button--py-gridui-4 {
148
+ padding-block: var(--gridui-space-4);
149
+ }
150
+ .gridui-u-button--py-gridui-8 {
151
+ padding-block: var(--gridui-space-8);
152
+ }
153
+ .gridui-u-button--py-gridui-16 {
154
+ padding-block: var(--gridui-space-16);
155
+ }
156
+ .gridui-u-button--text-center {
157
+ text-align: center;
158
+ }
159
+ .gridui-u-button--text-left {
160
+ text-align: left;
161
+ }
162
+ .gridui-u-button--text-start {
163
+ text-align: start;
164
+ }
165
+ .gridui-u-button--type-supporting {
166
+ font: var(--gridui-type-supporting);
167
+ font-family: var(--gridui-font-body);
168
+ letter-spacing: normal;
169
+ }
170
+ .gridui-u-button--type-ui {
171
+ font: var(--gridui-type-ui);
172
+ font-family: var(--gridui-font-body);
173
+ letter-spacing: normal;
174
+ }
175
+ .gridui-u-button--wrap-anywhere {
176
+ overflow-wrap: anywhere;
177
+ }
178
+ .gridui-u-button--text-accent-foreground {
179
+ color: var(--gridui-accent-foreground);
180
+ }
181
+ .gridui-u-button--text-foreground {
182
+ color: var(--gridui-foreground);
183
+ }
184
+ .gridui-u-button--no-underline {
185
+ text-decoration-line: none;
186
+ }
187
+ .gridui-u-button--\[transition-property\:var\(--gridui-motion-transition\,color\,background-color\,border-color\,text-decoration-color\,fill\,stroke\)\] {
188
+ transition-property: var(--gridui-motion-transition,color,background-color,border-color,text-decoration-color,fill,stroke);
189
+ }
190
+ .gridui-u-button--duration-\[calc\(var\(--gridui-motion-duration-quick\)\*var\(--gridui-motion-factor\,1\)\)\] {
191
+ --tw-duration: calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor,1));
192
+ transition-duration: calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor,1));
193
+ }
194
+ .gridui-u-button--ease-\(--gridui-motion-ease-out\) {
195
+ --tw-ease: var(--gridui-motion-ease-out);
196
+ transition-timing-function: var(--gridui-motion-ease-out);
197
+ }
198
+ .gridui-u-button--\[--gridui-button-icon-size\:var\(--gridui-icon-size\)\] {
199
+ --gridui-button-icon-size: var(--gridui-icon-size);
200
+ }
201
+ .gridui-u-button--\[--gridui-button-icon-size\:var\(--gridui-icon-size-large\)\] {
202
+ --gridui-button-icon-size: var(--gridui-icon-size-large);
203
+ }
204
+ .gridui-u-button--\[--gridui-button-icon-size\:var\(--gridui-space-32\)\] {
205
+ --gridui-button-icon-size: var(--gridui-space-32);
206
+ }
207
+ .gridui-u-button--\[--gridui-button-icon-size\:var\(--gridui-space-48\)\] {
208
+ --gridui-button-icon-size: var(--gridui-space-48);
209
+ }
210
+ @media (hover: hover) {
211
+ .gridui-u-button--not-disabled\:not-aria-disabled\:not-data-disabled\:hover\:bg-accent-hover:not(:disabled):not([aria-disabled="true"]):not([data-disabled]):hover {
212
+ background-color: var(--gridui-accent-hover);
213
+ }
214
+ }
215
+ .gridui-u-button--not-disabled\:not-aria-disabled\:not-data-disabled\:active\:bg-accent-pressed:not(:disabled):not([aria-disabled="true"]):not([data-disabled]):active {
216
+ background-color: var(--gridui-accent-pressed);
217
+ }
218
+ .gridui-u-button--not-disabled\:not-aria-disabled\:not-data-disabled\:active\:bg-surface-pressed:not(:disabled):not([aria-disabled="true"]):not([data-disabled]):active {
219
+ background-color: var(--gridui-surface-pressed);
220
+ }
221
+ .gridui-u-button--disabled\:cursor-not-allowed:disabled {
222
+ cursor: not-allowed;
223
+ }
224
+ .gridui-u-button--aria-disabled\:cursor-not-allowed[aria-disabled="true"] {
225
+ cursor: not-allowed;
226
+ }
227
+ .gridui-u-button--data-disabled\:cursor-not-allowed[data-disabled] {
228
+ cursor: not-allowed;
229
+ }
230
+ .gridui-u-button--data-gridui-busy\:cursor-wait[data-gridui-busy] {
231
+ cursor: wait;
232
+ }
233
+ @media (prefers-reduced-motion: reduce) {
234
+ .gridui-u-button--motion-reduce\:transition-none {
235
+ transition-property: none;
236
+ }
237
+ }
238
+ .gridui-u-button--\[\&_\>_span\]\:whitespace-nowrap > span {
239
+ white-space: nowrap;
240
+ }
241
+ .gridui-u-button--\[\&_\>_span\]\:\[writing-mode\:vertical-rl\] > span {
242
+ writing-mode: vertical-rl;
243
+ }
244
+ .gridui-u-button--\[\&_svg\]\:pointer-events-none svg {
245
+ pointer-events: none;
246
+ }
247
+ .gridui-u-button--\[\&_svg\]\:h-\(--gridui-button-icon-size\) svg {
248
+ height: var(--gridui-button-icon-size);
249
+ }
250
+ .gridui-u-button--\[\&_svg\]\:w-\(--gridui-button-icon-size\) svg {
251
+ width: var(--gridui-button-icon-size);
252
+ }
253
+ .gridui-u-button--\[\&_svg\]\:shrink-0 svg {
254
+ flex-shrink: 0;
255
+ }
256
+ .gridui-u-button--\[\&\.gridui-button-extra-large\]\:h-18.gridui-button-extra-large {
257
+ height: calc(var(--spacing) * 18);
258
+ }
259
+ .gridui-u-button--\[\&\.gridui-button-extra-large\]\:w-18.gridui-button-extra-large {
260
+ width: calc(var(--spacing) * 18);
261
+ }
262
+ .gridui-u-button--\[\&\.gridui-button-large\]\:h-gridui-control-large.gridui-button-large {
263
+ height: var(--gridui-control-min-height-large);
264
+ }
265
+ .gridui-u-button--\[\&\.gridui-button-large\]\:w-gridui-control-large.gridui-button-large {
266
+ width: var(--gridui-control-min-height-large);
267
+ }
268
+ .gridui-u-button--\[\&\.gridui-button-small\]\:h-gridui-control-small.gridui-button-small {
269
+ height: var(--gridui-control-min-height-small);
270
+ }
271
+ .gridui-u-button--\[\&\.gridui-button-small\]\:w-gridui-control-small.gridui-button-small {
272
+ width: var(--gridui-control-min-height-small);
273
+ }
274
+ @media (pointer: coarse) {
275
+ .gridui-u-button--pointer-coarse\:\[\&\.gridui-button-small\]\:h-gridui-control.gridui-button-small {
276
+ height: var(--gridui-control-min-height);
277
+ }
278
+ .gridui-u-button--pointer-coarse\:\[\&\.gridui-button-small\]\:w-gridui-control.gridui-button-small {
279
+ width: var(--gridui-control-min-height);
280
+ }
281
+ }
282
+ }
283
+ @layer components {
284
+ .gridui-button {
285
+ border: 1px solid transparent;
286
+ }
287
+ .gridui-button-cell {
288
+ border: 0;
289
+ }
290
+ .gridui-button-label-content {
291
+ display: inline-flex;
292
+ min-width: 0;
293
+ flex-direction: inherit;
294
+ align-items: inherit;
295
+ justify-content: inherit;
296
+ gap: inherit;
297
+ }
298
+ .gridui-button-body {
299
+ display: inline-flex;
300
+ flex: 1;
301
+ min-width: 0;
302
+ flex-direction: inherit;
303
+ align-items: inherit;
304
+ justify-content: inherit;
305
+ gap: inherit;
306
+ }
307
+ .gridui-button:is(:disabled, [aria-disabled="true"]:not([data-gridui-busy]), [data-disabled]) > .gridui-button-content, .gridui-button:is(:disabled, [aria-disabled="true"]:not([data-gridui-busy]), [data-disabled]) > .gridui-button-start-region > .gridui-button-content, .gridui-button:is(:disabled, [aria-disabled="true"]:not([data-gridui-busy]), [data-disabled]) > .gridui-button-end-region > .gridui-button-content {
308
+ opacity: 0.5;
309
+ }
310
+ .gridui-button-start-region {
311
+ min-width: calc(var(--gridui-button-icon-size) + var(--gridui-space-16));
312
+ border-inline-end: 1px solid;
313
+ border-color: inherit;
314
+ }
315
+ .gridui-button-end-region {
316
+ border-inline-start: 1px solid;
317
+ border-color: inherit;
318
+ }
319
+ @media (prefers-reduced-motion: no-preference) {
320
+ .gridui-button-icon-motion-outward:not(:disabled, [aria-disabled="true"]:not([data-gridui-busy]), [data-disabled], [aria-readonly="true"], [data-readonly], [readonly]) .gridui-button-end-icon {
321
+ transition: var(--gridui-motion-transition, transform calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-out));
322
+ }
323
+ .gridui-button-icon-motion-outward:not(:disabled, [aria-disabled="true"]:not([data-gridui-busy]), [data-disabled], [aria-readonly="true"], [data-readonly], [readonly]):hover .gridui-button-end-icon {
324
+ transform: var(--gridui-motion-transform, translate(var(--gridui-space-4), calc(-1 * var(--gridui-space-4))));
325
+ }
326
+ .gridui-button-icon-motion-outward:not(:disabled, [aria-disabled="true"]:not([data-gridui-busy]), [data-disabled], [aria-readonly="true"], [data-readonly], [readonly]):dir(rtl):hover .gridui-button-end-icon {
327
+ transform: var(--gridui-motion-transform, translate(calc(-1 * var(--gridui-space-4)), calc(-1 * var(--gridui-space-4))));
328
+ }
329
+ }
330
+ .gridui-button-group {
331
+ --gridui-button-group-padding-block: var(--gridui-space-24);
332
+ container: gridui-button-group / inline-size;
333
+ min-width: 0;
334
+ }
335
+ .gridui-button-group-items {
336
+ display: grid;
337
+ grid-auto-flow: column;
338
+ grid-auto-columns: minmax(0, 1fr);
339
+ align-items: stretch;
340
+ }
341
+ .gridui-button-group-items[data-layout="standard"] {
342
+ gap: var(--gridui-space-8);
343
+ }
344
+ .gridui-button-group-items[data-layout="cells"] > [data-gridui-button-group-item]:not([hidden]) ~ [data-gridui-button-group-item]:not([hidden])::before {
345
+ position: absolute;
346
+ inset-block: 0;
347
+ inset-inline-start: 0;
348
+ width: 1px;
349
+ background: var(--gridui-button-group-border, var(--gridui-border));
350
+ pointer-events: none;
351
+ content: "";
352
+ }
353
+ @container gridui-button-group (max-width: 20rem) {
354
+ .gridui-button-group-items {
355
+ grid-auto-flow: row;
356
+ grid-auto-rows: 1fr;
357
+ }
358
+ .gridui-button-group-items[data-layout="cells"] > [data-gridui-button-group-item]:not([hidden]) ~ [data-gridui-button-group-item]:not([hidden])::before {
359
+ inset-block: 0 auto;
360
+ inset-inline: 0;
361
+ width: auto;
362
+ height: 1px;
363
+ }
364
+ }
365
+ }
366
+ @layer utilities {
367
+ .gridui-button-group-items > [data-gridui-button-group-item] {
368
+ position: relative;
369
+ width: 100%;
370
+ height: 100%;
371
+ min-width: 0;
372
+ }
373
+ .gridui-button-group-items[data-layout="cells"] > [data-gridui-button-group-item] {
374
+ min-height: 2.75rem;
375
+ padding: var(--gridui-button-group-padding-block) var(--gridui-space-24);
376
+ border: 0;
377
+ border-radius: 0;
378
+ }
379
+ }
380
+ @property --tw-border-style {
381
+ syntax: "*";
382
+ inherits: false;
383
+ initial-value: solid;
384
+ }
385
+ @property --tw-duration {
386
+ syntax: "*";
387
+ inherits: false;
388
+ }
389
+ @property --tw-ease {
390
+ syntax: "*";
391
+ inherits: false;
392
+ }
393
+ @layer properties {
394
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: block))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
395
+ *, ::before, ::after, ::backdrop {
396
+ --tw-border-style: solid;
397
+ --tw-duration: initial;
398
+ --tw-ease: initial;
399
+ }
400
+ }
401
+ }
402
+
403
+ /*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
404
+ @layer properties;
405
+ @layer theme, base, components, utilities;
406
+ @layer theme {
407
+ :root, :host {
408
+ --spacing: 0.25rem;
409
+ }
410
+ }
411
+ @layer utilities {
412
+ .gridui-u-overlay--z-\(--gridui-z-popover\) {
413
+ z-index: var(--gridui-z-popover);
414
+ }
415
+ .gridui-u-overlay--flex {
416
+ display: flex;
417
+ }
418
+ .gridui-u-overlay--inline-flex {
419
+ display: inline-flex;
420
+ }
421
+ .gridui-u-overlay--size-gridui-16 {
422
+ width: var(--gridui-space-16);
423
+ height: var(--gridui-space-16);
424
+ }
425
+ .gridui-u-overlay--min-h-10 {
426
+ min-height: calc(var(--spacing) * 10);
427
+ }
428
+ .gridui-u-overlay--min-w-0 {
429
+ min-width: 0px;
430
+ }
431
+ .gridui-u-overlay--shrink-0 {
432
+ flex-shrink: 0;
433
+ }
434
+ .gridui-u-overlay--cursor-pointer {
435
+ cursor: pointer;
436
+ }
437
+ .gridui-u-overlay--items-center {
438
+ align-items: center;
439
+ }
440
+ .gridui-u-overlay--justify-center {
441
+ justify-content: center;
442
+ }
443
+ .gridui-u-overlay--gap-gridui-8 {
444
+ gap: var(--gridui-space-8);
445
+ }
446
+ .gridui-u-overlay--rounded-control {
447
+ border-radius: var(--gridui-control-radius);
448
+ }
449
+ .gridui-u-overlay--border {
450
+ border-style: var(--tw-border-style);
451
+ border-width: 1px;
452
+ }
453
+ .gridui-u-overlay--border-solid {
454
+ --tw-border-style: solid;
455
+ border-style: solid;
456
+ }
457
+ .gridui-u-overlay--border-border {
458
+ border-color: var(--gridui-border);
459
+ }
460
+ .gridui-u-overlay--bg-background {
461
+ background-color: var(--gridui-background);
462
+ }
463
+ .gridui-u-overlay--p-0 {
464
+ padding: 0px;
465
+ }
466
+ .gridui-u-overlay--p-gridui-8 {
467
+ padding: var(--gridui-space-8);
468
+ }
469
+ .gridui-u-overlay--px-gridui-8 {
470
+ padding-inline: var(--gridui-space-8);
471
+ }
472
+ .gridui-u-overlay--py-gridui-8 {
473
+ padding-block: var(--gridui-space-8);
474
+ }
475
+ .gridui-u-overlay--type-data {
476
+ font: var(--gridui-type-data);
477
+ font-family: var(--gridui-font-body);
478
+ letter-spacing: normal;
479
+ font-variant-numeric: tabular-nums;
480
+ }
481
+ .gridui-u-overlay--type-caption {
482
+ font: var(--gridui-type-caption);
483
+ font-family: var(--gridui-font-body);
484
+ letter-spacing: normal;
485
+ }
486
+ .gridui-u-overlay--wrap-anywhere {
487
+ overflow-wrap: anywhere;
488
+ }
489
+ .gridui-u-overlay--whitespace-normal {
490
+ white-space: normal;
491
+ }
492
+ .gridui-u-overlay--text-foreground {
493
+ color: var(--gridui-foreground);
494
+ }
495
+ .gridui-u-overlay--text-inherit {
496
+ color: inherit;
497
+ }
498
+ .gridui-u-overlay--text-muted {
499
+ color: var(--gridui-muted);
500
+ }
501
+ .gridui-u-overlay--no-underline {
502
+ text-decoration-line: none;
503
+ }
504
+ .gridui-u-overlay--aria-selected\:bg-selection-background[aria-selected="true"] {
505
+ background-color: var(--gridui-selection-background);
506
+ }
507
+ .gridui-u-overlay--aria-\[current\=page\]\:bg-selection-background[aria-current="page"] {
508
+ background-color: var(--gridui-selection-background);
509
+ }
510
+ .gridui-u-overlay--data-disabled\:pointer-events-none[data-disabled] {
511
+ pointer-events: none;
512
+ }
513
+ .gridui-u-overlay--data-disabled\:opacity-50[data-disabled] {
514
+ opacity: 50%;
515
+ }
516
+ .gridui-u-overlay--data-\[state\=checked\]\:bg-selection-background[data-state="checked"] {
517
+ background-color: var(--gridui-selection-background);
518
+ }
519
+ }
520
+ @layer components {
521
+ .gridui-overlay-surface {
522
+ --gridui-surface-offset-x: 0px;
523
+ --gridui-surface-offset-y: 0px;
524
+ --gridui-overlay-enter-duration: var(--gridui-motion-duration-normal);
525
+ --gridui-overlay-fill-mode: both;
526
+ transform-origin: var(--gridui-overlay-origin, center);
527
+ }
528
+ .gridui-overlay-dialog {
529
+ --gridui-overlay-fill-mode: none;
530
+ transform-origin: center;
531
+ }
532
+ .gridui-overlay-tooltip {
533
+ --gridui-overlay-enter-duration: var(--gridui-motion-duration-quick);
534
+ }
535
+ .gridui-overlay-floating[data-side="bottom"] {
536
+ --gridui-surface-offset-y: calc(-1 * var(--gridui-motion-distance));
537
+ }
538
+ .gridui-overlay-floating[data-side="top"] {
539
+ --gridui-surface-offset-y: var(--gridui-motion-distance);
540
+ }
541
+ .gridui-overlay-floating[data-side="left"] {
542
+ --gridui-surface-offset-x: var(--gridui-motion-distance);
543
+ }
544
+ .gridui-overlay-floating[data-side="right"] {
545
+ --gridui-surface-offset-x: calc(-1 * var(--gridui-motion-distance));
546
+ }
547
+ .gridui-overlay-surface[data-state="closed"] {
548
+ pointer-events: none;
549
+ }
550
+ .gridui-overlay-surface:not([data-side="none"]):is([data-state="open"], [data-state="delayed-open"], [data-state="instant-open"]) {
551
+ animation: var(--gridui-motion-animation, gridui-surface-enter calc(var(--gridui-overlay-enter-duration) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-out) var(--gridui-overlay-fill-mode));
552
+ }
553
+ .gridui-overlay-surface:not([data-side="none"])[data-state="closed"] {
554
+ animation: var(--gridui-motion-animation, gridui-surface-exit calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-in) var(--gridui-overlay-fill-mode));
555
+ }
556
+ .gridui-overlay-backdrop {
557
+ background: var(--gridui-backdrop);
558
+ @supports (color: color-mix(in lab, red, red)) {
559
+ background: color-mix(in srgb, var(--gridui-backdrop) var(--gridui-backdrop-opacity), transparent);
560
+ }
561
+ --gridui-overlay-enter-duration: var(--gridui-motion-duration-normal);
562
+ --gridui-overlay-exit-duration: var(--gridui-motion-duration-quick);
563
+ --gridui-overlay-fill-mode: none;
564
+ }
565
+ .gridui-overlay-backdrop-deliberate {
566
+ --gridui-overlay-enter-duration: var(--gridui-motion-duration-deliberate);
567
+ --gridui-overlay-exit-duration: var(--gridui-motion-duration-normal);
568
+ --gridui-overlay-fill-mode: both;
569
+ }
570
+ .gridui-overlay-backdrop[data-state="open"] {
571
+ animation: var(--gridui-motion-animation, gridui-fade-enter calc(var(--gridui-overlay-enter-duration) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-out) var(--gridui-overlay-fill-mode));
572
+ }
573
+ .gridui-overlay-backdrop[data-state="closed"] {
574
+ animation: var(--gridui-motion-animation, gridui-fade-exit calc(var(--gridui-overlay-exit-duration) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-in) var(--gridui-overlay-fill-mode));
575
+ }
576
+ @media (prefers-reduced-motion: reduce) {
577
+ .gridui-overlay-surface:not([data-side="none"])[data-state], .gridui-overlay-backdrop[data-state] {
578
+ animation: none;
579
+ }
580
+ }
581
+ }
582
+ @property --tw-border-style {
583
+ syntax: "*";
584
+ inherits: false;
585
+ initial-value: solid;
586
+ }
587
+ @layer properties {
588
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: block))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
589
+ *, ::before, ::after, ::backdrop {
590
+ --tw-border-style: solid;
591
+ }
592
+ }
593
+ }
594
+
1
595
  /*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
2
596
  @layer theme, base, components, utilities;
3
597
  @layer utilities;
@@ -24,31 +618,32 @@
24
618
  background: var(--gridui-background);
25
619
  color: var(--gridui-foreground);
26
620
  font: var(--gridui-type-supporting);
621
+ font-family: var(--gridui-font-body);
27
622
  letter-spacing: normal;
28
623
  pointer-events: auto;
29
624
  }
30
625
  .gridui-toast[data-state="open"] {
31
- animation: gridui-surface-enter var(--gridui-motion-duration-normal) var(--gridui-motion-ease-out);
626
+ animation: var(--gridui-motion-animation, gridui-surface-enter calc(var(--gridui-motion-duration-normal) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-out));
32
627
  }
33
628
  .gridui-toast[data-state="closed"] {
34
629
  pointer-events: none;
35
- animation: gridui-surface-exit var(--gridui-motion-duration-quick) var(--gridui-motion-ease-in);
630
+ animation: var(--gridui-motion-animation, gridui-surface-exit calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-in));
36
631
  }
37
632
  .gridui-toast[data-swipe="move"] {
38
633
  transform: translateY(var(--radix-toast-swipe-move-y));
39
634
  }
40
635
  .gridui-toast[data-swipe="cancel"] {
41
636
  transform: translateY(0);
42
- transition: transform var(--gridui-motion-duration-quick) var(--gridui-motion-ease-out);
637
+ transition: var(--gridui-motion-transition, transform calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-out));
43
638
  }
44
639
  .gridui-toast[data-tone="success"] {
45
- border-inline-start: 4px solid var(--gridui-accent-background);
640
+ border-inline-start: 4px solid var(--gridui-status-success-border);
46
641
  }
47
642
  .gridui-toast[data-tone="warning"] {
48
- border-inline-start: 4px solid var(--gridui-warning-foreground);
643
+ border-inline-start: 4px solid var(--gridui-status-warning-border);
49
644
  }
50
645
  .gridui-toast[data-tone="danger"] {
51
- border-inline-start: 4px solid var(--gridui-danger-foreground);
646
+ border-inline-start: 4px solid var(--gridui-status-danger-border);
52
647
  }
53
648
  .gridui-toast-content {
54
649
  display: grid;
@@ -70,10 +665,12 @@
70
665
  }
71
666
  .gridui-toast-title {
72
667
  font: var(--gridui-type-ui);
668
+ font-family: var(--gridui-font-body);
73
669
  letter-spacing: normal;
74
670
  }
75
671
  .gridui-toast-description {
76
672
  font: var(--gridui-type-supporting);
673
+ font-family: var(--gridui-font-body);
77
674
  letter-spacing: normal;
78
675
  color: var(--gridui-muted);
79
676
  }
@@ -0,0 +1,89 @@
1
+ /*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
2
+ @layer theme, base, components, utilities;
3
+ @layer utilities;
4
+ @layer components {
5
+ .gridui-toast-viewport {
6
+ padding: 0;
7
+ margin: 0;
8
+ list-style: none;
9
+ position: fixed;
10
+ z-index: var(--gridui-z-toast);
11
+ inset-inline-end: max(var(--gridui-space-16), env(safe-area-inset-right));
12
+ bottom: max(var(--gridui-space-16), env(safe-area-inset-bottom));
13
+ display: flex;
14
+ flex-direction: column-reverse;
15
+ gap: var(--gridui-space-8);
16
+ width: min(26rem, calc(100% - 2 * var(--gridui-space-16)));
17
+ max-height: calc(100dvh - 2 * var(--gridui-space-16));
18
+ overflow: auto;
19
+ pointer-events: none;
20
+ }
21
+ .gridui-toast {
22
+ flex-shrink: 0;
23
+ border: 1px solid var(--gridui-border);
24
+ background: var(--gridui-background);
25
+ color: var(--gridui-foreground);
26
+ font: var(--gridui-type-supporting);
27
+ font-family: var(--gridui-font-body);
28
+ letter-spacing: normal;
29
+ pointer-events: auto;
30
+ }
31
+ .gridui-toast[data-state="open"] {
32
+ animation: var(--gridui-motion-animation, gridui-surface-enter calc(var(--gridui-motion-duration-normal) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-out));
33
+ }
34
+ .gridui-toast[data-state="closed"] {
35
+ pointer-events: none;
36
+ animation: var(--gridui-motion-animation, gridui-surface-exit calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-in));
37
+ }
38
+ .gridui-toast[data-swipe="move"] {
39
+ transform: translateY(var(--radix-toast-swipe-move-y));
40
+ }
41
+ .gridui-toast[data-swipe="cancel"] {
42
+ transform: translateY(0);
43
+ transition: var(--gridui-motion-transition, transform calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-out));
44
+ }
45
+ .gridui-toast[data-tone="success"] {
46
+ border-inline-start: 4px solid var(--gridui-status-success-border);
47
+ }
48
+ .gridui-toast[data-tone="warning"] {
49
+ border-inline-start: 4px solid var(--gridui-status-warning-border);
50
+ }
51
+ .gridui-toast[data-tone="danger"] {
52
+ border-inline-start: 4px solid var(--gridui-status-danger-border);
53
+ }
54
+ .gridui-toast-content {
55
+ display: grid;
56
+ grid-template-columns: minmax(0, 1fr) auto auto;
57
+ align-items: center;
58
+ gap: var(--gridui-space-8);
59
+ padding: var(--gridui-space-16);
60
+ }
61
+ .gridui-toast-message {
62
+ min-width: 0;
63
+ overflow-wrap: anywhere;
64
+ }
65
+ .gridui-toast-close {
66
+ grid-column: 3;
67
+ }
68
+ .gridui-toast-action {
69
+ max-width: 8rem;
70
+ overflow-wrap: anywhere;
71
+ }
72
+ .gridui-toast-title {
73
+ font: var(--gridui-type-ui);
74
+ font-family: var(--gridui-font-body);
75
+ letter-spacing: normal;
76
+ }
77
+ .gridui-toast-description {
78
+ font: var(--gridui-type-supporting);
79
+ font-family: var(--gridui-font-body);
80
+ letter-spacing: normal;
81
+ color: var(--gridui-muted);
82
+ }
83
+ @media (prefers-reduced-motion: reduce) {
84
+ .gridui-toast[data-state] {
85
+ animation: none;
86
+ transition: none;
87
+ }
88
+ }
89
+ }
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Toast
4
+ * @namespace Toaster
5
+ * @description Toast Item
6
+ */
1
7
  /**
2
8
  * @author WMXPY
3
9
  * @package Toast
package/docs/catalog.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "name": "@gridui/toast",
4
- "version": "1.0.9",
4
+ "version": "1.2.0",
5
5
  "category": "core",
6
6
  "description": "GridUI React toast",
7
7
  "usage": "Component reference contains focused API pages for each public component.",
@@ -64,6 +64,7 @@
64
64
  "@gridui/overlay/styles.css",
65
65
  "@gridui/toast/styles.css"
66
66
  ],
67
+ "styledImport": "@gridui/toast/styled",
67
68
  "examples": [
68
69
  "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/toast/stories/getting-started.mdx",
69
70
  "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/toast/stories/notifications.mdx",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridui/toast",
3
- "version": "1.0.9",
3
+ "version": "1.2.0",
4
4
  "description": "GridUI React toast",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -10,14 +10,19 @@
10
10
  "docs"
11
11
  ],
12
12
  "sideEffects": [
13
- "**/*.css"
13
+ "**/*.css",
14
+ "./dist/styled.js"
14
15
  ],
15
16
  "exports": {
16
17
  ".": {
17
18
  "types": "./dist/index.d.ts",
18
19
  "import": "./dist/index.js"
19
20
  },
20
- "./styles.css": "./dist/styles.css"
21
+ "./styles.css": "./dist/styles.css",
22
+ "./styled": {
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/styled.js"
25
+ }
21
26
  },
22
27
  "publishConfig": {
23
28
  "access": "public"
@@ -27,17 +32,18 @@
27
32
  "react-dom": "^19.2.0"
28
33
  },
29
34
  "dependencies": {
30
- "@gridui/button": "^5.0.0",
31
- "@gridui/overlay": "^2.1.0",
35
+ "@gridui/button": "^5.2.0",
36
+ "@gridui/motion": "^1.0.2",
37
+ "@gridui/overlay": "^2.4.0",
32
38
  "@gridui/style-utils": "^4.0.0",
33
- "@gridui/theme": "^2.5.4",
39
+ "@gridui/theme": "^4.0.0",
34
40
  "@radix-ui/react-toast": "1.3.1",
35
- "lucide-react": "1.70.0"
41
+ "lucide-react": "1.72.0"
36
42
  },
37
43
  "devDependencies": {
38
44
  "@gridui-internal/configuration": "0.0.0-internal",
39
45
  "@jest/globals": "30.5.2",
40
- "@storybook/react-vite": "10.6.6",
46
+ "@storybook/react-vite": "10.6.7",
41
47
  "@types/jest": "30.0.0",
42
48
  "@types/node": "26.6.6",
43
49
  "@types/react": "19.3.0",
@@ -50,7 +56,6 @@
50
56
  "scripts": {
51
57
  "build": "node ../../scripts/compilation/package.ts",
52
58
  "compile": "tsc --project tsconfig.json",
53
- "test": "jest",
54
- "coverage": "jest --coverage"
59
+ "test": "jest"
55
60
  }
56
61
  }