@gridui/toast 1.1.0 → 1.3.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 +21 -4
- package/dist/index.js +2 -1
- package/dist/index.js.map +2 -2
- package/dist/styled.js +4 -0
- package/dist/styles.css +594 -2
- package/dist/styles.local.css +97 -0
- package/dist/toaster/toast-item.d.ts +6 -0
- package/dist/toaster/toaster.d.ts +2 -0
- package/docs/catalog.json +7 -6
- package/docs/reference/toast-provider.md +2 -2
- package/docs/reference/toaster.md +8 -2
- package/package.json +14 -9
package/README.md
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
# @gridui/toast
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Feedback 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
|
-
|
|
6
|
+
Applications own routes, labels, state persistence, and branding.
|
|
7
7
|
|
|
8
|
-
|
|
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
|
+
|
|
17
|
+
|
|
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-feedback/toast/.changeset/history).
|
|
9
19
|
|
|
10
20
|
[Component reference](docs/reference/README.md) contains focused API pages for each public component.
|
|
11
21
|
|
|
12
22
|
Shared animation policy and tempo come from `MotionConfig` in `@gridui/motion`.
|
|
13
23
|
Disabled or reduced-motion policy settles decoration without disabling interaction.
|
|
14
|
-
See the [motion guide](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-
|
|
24
|
+
See the [motion guide](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-foundation/motion)
|
|
15
25
|
for CSS scopes, portal behavior, and specialized timing contracts.
|
|
26
|
+
|
|
27
|
+
## Sizing and density
|
|
28
|
+
|
|
29
|
+
Toaster density compact/comfortable controls notification padding and viewport gaps; comfortable is the default. It does not change notification text size, priority, timers or action state. Owned action/dismiss controls choose their sizes independently.
|
|
30
|
+
|
|
31
|
+
See the [shared sizing contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/usage/sizing.md)
|
|
32
|
+
for native attributes, scope precedence, tokens and target behavior.
|
package/dist/index.js
CHANGED
|
@@ -271,7 +271,7 @@ import { useEffect, useState as useState2 } from "react";
|
|
|
271
271
|
import { createPortal } from "react-dom";
|
|
272
272
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
273
273
|
var Toaster = (props) => {
|
|
274
|
-
const { ref: forwardedRef, label, closeLabel, container, className, ...restProps } = props;
|
|
274
|
+
const { ref: forwardedRef, label, closeLabel, density = "comfortable", container, className, ...restProps } = props;
|
|
275
275
|
const scrollbarRef = useScrollbars({ ref: forwardedRef });
|
|
276
276
|
const ref = useInteractionOutline({ ref: scrollbarRef });
|
|
277
277
|
const { records, timeout } = useToastState();
|
|
@@ -310,6 +310,7 @@ var Toaster = (props) => {
|
|
|
310
310
|
...restProps,
|
|
311
311
|
ref,
|
|
312
312
|
label,
|
|
313
|
+
"data-density": density,
|
|
313
314
|
className: cn("gridui-toast-viewport", className)
|
|
314
315
|
}
|
|
315
316
|
)
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
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", "import { 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,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;AAC1D,YAAQ,UAAU;AAClB,eAAW,IAAI;AAAA,EACnB,GAAG,CAAC,CAAC;AACL,QAAM,MAAM,YAAY,CAAC,YAAkC;AACvD,yBAAqB,OAAO;AAC5B,UAAM,KAAK,QAAQ,MAAM,GAAG,MAAM,IAAI,EAAE,SAAS,OAAO;AACxD,UAAM,WAAW,QAAQ,QAAQ,KAAK,YAAU;AAC5C,aAAO,OAAO,OAAO;AAAA,IACzB,CAAC;AACD,UAAM,SAAS,QAAQ,QAAQ,OAAO,YAAU;AAC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,IACR,CAAC,CAAC;AACF,YAAQ,QAAQ,YAAU;AACtB,aAAO,UAAU;AAAA,IACrB,CAAC;AAAA,EACL,GAAG,CAAC,OAAO,CAAC;AACZ,QAAM,SAAS,YAAY,CAAC,IAAY,aAAqB;AACzD,UAAM,OAAO,QAAQ,QAAQ,OAAO,YAAU;AAC1C,aAAO,OAAO,OAAO,MAAM,OAAO,aAAa,YAAY,OAAO;AAAA,IACtE,CAAC;AACD,QAAI,KAAK,WAAW,QAAQ,QAAQ,QAAQ;AACxC,cAAQ,IAAI;AAAA,IAChB;AAAA,EACJ,GAAG,CAAC,OAAO,CAAC;AACZ,QAAM,UAAU,QAAQ,MAAM;AAC1B,WAAO;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ,GAAG;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAC;AACD,SAAQ;AAAA,IAAC,cAAc;AAAA,IAAd;AAAA,MACL,OAAO;AAAA,MAEP;AAAA,QAAC,kBAAkB;AAAA,QAAlB;AAAA,UACG,OAAO;AAAA,YACH;AAAA,YACA;AAAA,YACA;AAAA,UACJ;AAAA,UAEC;AAAA;AAAA,MACL;AAAA;AAAA,EACJ;AACJ;;;ACtHA,SAAS,kBAAkB;AAEpB,IAAM,gBAAgB,MAAkB;AAC3C,QAAM,QAAQ,WAAW,iBAAiB;AAC1C,MAAI,CAAC,OAAO;AACR,UAAM,IAAI,MAAM,wCAAwC;AAAA,EAC5D;AACA,SAAO;AACX;;;
|
|
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 { Density } from \"@gridui/theme\";\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 density?: Density;\n readonly label: string;\n readonly container?: HTMLElement | undefined;\n};\n\nexport const Toaster: FC<ToasterProps> = (props: ToasterProps) => {\n const { ref: forwardedRef, label, closeLabel, density = \"comfortable\", 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 data-density={density}\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,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AA,UAAV;AAAA,YACI,GAAG;AAAA,YACH,GAAG;AAAA,YACJ;AAAA,YACA;AAAA,YACA,gBAAc;AAAA,YACd,WAAW,GAAG,yBAAyB,SAAS;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
package/dist/styles.css
CHANGED
|
@@ -1,3 +1,587 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties;
|
|
3
|
+
@layer theme, base, components, utilities;
|
|
4
|
+
@layer utilities {
|
|
5
|
+
.gridui-u-button--pointer-events-none {
|
|
6
|
+
pointer-events: none;
|
|
7
|
+
}
|
|
8
|
+
.gridui-u-button--inline-flex {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
}
|
|
11
|
+
.gridui-u-button--size-\(--_gridui-button-min\) {
|
|
12
|
+
width: var(--_gridui-button-min);
|
|
13
|
+
height: var(--_gridui-button-min);
|
|
14
|
+
}
|
|
15
|
+
.gridui-u-button--h-full {
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
.gridui-u-button--w-fit {
|
|
19
|
+
width: fit-content;
|
|
20
|
+
}
|
|
21
|
+
.gridui-u-button--w-full {
|
|
22
|
+
width: 100%;
|
|
23
|
+
}
|
|
24
|
+
.gridui-u-button--w-gridui-64 {
|
|
25
|
+
width: var(--gridui-space-64);
|
|
26
|
+
}
|
|
27
|
+
.gridui-u-button--w-gridui-control-large {
|
|
28
|
+
width: max(var(--gridui-control-min-height-large), var(--gridui-target-min-size));
|
|
29
|
+
}
|
|
30
|
+
.gridui-u-button--w-gridui-control-medium {
|
|
31
|
+
width: max(var(--gridui-control-min-height-medium), var(--gridui-target-min-size));
|
|
32
|
+
}
|
|
33
|
+
.gridui-u-button--w-gridui-control-small {
|
|
34
|
+
width: max(var(--gridui-control-min-height-small), var(--gridui-target-min-size));
|
|
35
|
+
}
|
|
36
|
+
.gridui-u-button--max-w-full {
|
|
37
|
+
max-width: 100%;
|
|
38
|
+
}
|
|
39
|
+
.gridui-u-button--min-w-0 {
|
|
40
|
+
min-width: 0px;
|
|
41
|
+
}
|
|
42
|
+
.gridui-u-button--min-w-gridui-24 {
|
|
43
|
+
min-width: var(--gridui-space-24);
|
|
44
|
+
}
|
|
45
|
+
.gridui-u-button--flex-1 {
|
|
46
|
+
flex: 1;
|
|
47
|
+
}
|
|
48
|
+
.gridui-u-button--shrink-0 {
|
|
49
|
+
flex-shrink: 0;
|
|
50
|
+
}
|
|
51
|
+
.gridui-u-button--cursor-pointer {
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
.gridui-u-button--flex-col {
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
}
|
|
57
|
+
.gridui-u-button--items-center {
|
|
58
|
+
align-items: center;
|
|
59
|
+
}
|
|
60
|
+
.gridui-u-button--items-stretch {
|
|
61
|
+
align-items: stretch;
|
|
62
|
+
}
|
|
63
|
+
.gridui-u-button--justify-between {
|
|
64
|
+
justify-content: space-between;
|
|
65
|
+
}
|
|
66
|
+
.gridui-u-button--justify-center {
|
|
67
|
+
justify-content: center;
|
|
68
|
+
}
|
|
69
|
+
.gridui-u-button--justify-start {
|
|
70
|
+
justify-content: flex-start;
|
|
71
|
+
}
|
|
72
|
+
.gridui-u-button--gap-0 {
|
|
73
|
+
gap: 0px;
|
|
74
|
+
}
|
|
75
|
+
.gridui-u-button--gap-gridui-8 {
|
|
76
|
+
gap: var(--gridui-space-8);
|
|
77
|
+
}
|
|
78
|
+
.gridui-u-button--gap-gridui-32 {
|
|
79
|
+
gap: var(--gridui-space-32);
|
|
80
|
+
}
|
|
81
|
+
.gridui-u-button--self-stretch {
|
|
82
|
+
align-self: stretch;
|
|
83
|
+
}
|
|
84
|
+
.gridui-u-button--rounded-control {
|
|
85
|
+
border-radius: var(--gridui-control-radius);
|
|
86
|
+
}
|
|
87
|
+
.gridui-u-button--rounded-none {
|
|
88
|
+
border-radius: 0;
|
|
89
|
+
}
|
|
90
|
+
.gridui-u-button--border-0 {
|
|
91
|
+
border-style: var(--tw-border-style);
|
|
92
|
+
border-width: 0px;
|
|
93
|
+
}
|
|
94
|
+
.gridui-u-button--border-b {
|
|
95
|
+
border-bottom-style: var(--tw-border-style);
|
|
96
|
+
border-bottom-width: 1px;
|
|
97
|
+
}
|
|
98
|
+
.gridui-u-button--border-accent-background {
|
|
99
|
+
border-color: var(--gridui-accent-background);
|
|
100
|
+
}
|
|
101
|
+
.gridui-u-button--border-control-border {
|
|
102
|
+
border-color: var(--gridui-control-border);
|
|
103
|
+
}
|
|
104
|
+
.gridui-u-button--border-foreground {
|
|
105
|
+
border-color: var(--gridui-foreground);
|
|
106
|
+
}
|
|
107
|
+
.gridui-u-button--bg-accent-background {
|
|
108
|
+
background-color: var(--gridui-accent-background);
|
|
109
|
+
}
|
|
110
|
+
.gridui-u-button--bg-selection-background {
|
|
111
|
+
background-color: var(--gridui-selection-background);
|
|
112
|
+
}
|
|
113
|
+
.gridui-u-button--bg-transparent {
|
|
114
|
+
background-color: transparent;
|
|
115
|
+
}
|
|
116
|
+
.gridui-u-button--p-0 {
|
|
117
|
+
padding: 0px;
|
|
118
|
+
}
|
|
119
|
+
.gridui-u-button--px-0 {
|
|
120
|
+
padding-inline: 0px;
|
|
121
|
+
}
|
|
122
|
+
.gridui-u-button--px-gridui-8 {
|
|
123
|
+
padding-inline: var(--gridui-space-8);
|
|
124
|
+
}
|
|
125
|
+
.gridui-u-button--px-gridui-16 {
|
|
126
|
+
padding-inline: var(--gridui-space-16);
|
|
127
|
+
}
|
|
128
|
+
.gridui-u-button--px-gridui-24 {
|
|
129
|
+
padding-inline: var(--gridui-space-24);
|
|
130
|
+
}
|
|
131
|
+
.gridui-u-button--py-gridui-4 {
|
|
132
|
+
padding-block: var(--gridui-space-4);
|
|
133
|
+
}
|
|
134
|
+
.gridui-u-button--py-gridui-8 {
|
|
135
|
+
padding-block: var(--gridui-space-8);
|
|
136
|
+
}
|
|
137
|
+
.gridui-u-button--py-gridui-16 {
|
|
138
|
+
padding-block: var(--gridui-space-16);
|
|
139
|
+
}
|
|
140
|
+
.gridui-u-button--text-center {
|
|
141
|
+
text-align: center;
|
|
142
|
+
}
|
|
143
|
+
.gridui-u-button--text-left {
|
|
144
|
+
text-align: left;
|
|
145
|
+
}
|
|
146
|
+
.gridui-u-button--text-start {
|
|
147
|
+
text-align: start;
|
|
148
|
+
}
|
|
149
|
+
.gridui-u-button--type-supporting {
|
|
150
|
+
font: var(--gridui-type-supporting);
|
|
151
|
+
font-family: var(--gridui-font-body);
|
|
152
|
+
letter-spacing: normal;
|
|
153
|
+
}
|
|
154
|
+
.gridui-u-button--type-ui {
|
|
155
|
+
font: var(--gridui-type-ui);
|
|
156
|
+
font-family: var(--gridui-font-body);
|
|
157
|
+
letter-spacing: normal;
|
|
158
|
+
}
|
|
159
|
+
.gridui-u-button--wrap-anywhere {
|
|
160
|
+
overflow-wrap: anywhere;
|
|
161
|
+
}
|
|
162
|
+
.gridui-u-button--text-accent-foreground {
|
|
163
|
+
color: var(--gridui-accent-foreground);
|
|
164
|
+
}
|
|
165
|
+
.gridui-u-button--text-foreground {
|
|
166
|
+
color: var(--gridui-foreground);
|
|
167
|
+
}
|
|
168
|
+
.gridui-u-button--no-underline {
|
|
169
|
+
text-decoration-line: none;
|
|
170
|
+
}
|
|
171
|
+
.gridui-u-button--\[transition-property\:var\(--gridui-motion-transition\,color\,background-color\,border-color\,text-decoration-color\,fill\,stroke\)\] {
|
|
172
|
+
transition-property: var(--gridui-motion-transition,color,background-color,border-color,text-decoration-color,fill,stroke);
|
|
173
|
+
}
|
|
174
|
+
.gridui-u-button--duration-\[calc\(var\(--gridui-motion-duration-quick\)\*var\(--gridui-motion-factor\,1\)\)\] {
|
|
175
|
+
--tw-duration: calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor,1));
|
|
176
|
+
transition-duration: calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor,1));
|
|
177
|
+
}
|
|
178
|
+
.gridui-u-button--ease-\(--gridui-motion-ease-out\) {
|
|
179
|
+
--tw-ease: var(--gridui-motion-ease-out);
|
|
180
|
+
transition-timing-function: var(--gridui-motion-ease-out);
|
|
181
|
+
}
|
|
182
|
+
.gridui-u-button--\[--gridui-button-icon-size\:var\(--gridui-icon-size\)\] {
|
|
183
|
+
--gridui-button-icon-size: var(--gridui-icon-size);
|
|
184
|
+
}
|
|
185
|
+
.gridui-u-button--\[--gridui-button-icon-size\:var\(--gridui-icon-size-large\)\] {
|
|
186
|
+
--gridui-button-icon-size: var(--gridui-icon-size-large);
|
|
187
|
+
}
|
|
188
|
+
.gridui-u-button--\[--gridui-button-icon-size\:var\(--gridui-space-32\)\] {
|
|
189
|
+
--gridui-button-icon-size: var(--gridui-space-32);
|
|
190
|
+
}
|
|
191
|
+
.gridui-u-button--\[--gridui-button-icon-size\:var\(--gridui-space-48\)\] {
|
|
192
|
+
--gridui-button-icon-size: var(--gridui-space-48);
|
|
193
|
+
}
|
|
194
|
+
@media (hover: hover) {
|
|
195
|
+
.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 {
|
|
196
|
+
background-color: var(--gridui-accent-hover);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
.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 {
|
|
200
|
+
background-color: var(--gridui-accent-pressed);
|
|
201
|
+
}
|
|
202
|
+
.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 {
|
|
203
|
+
background-color: var(--gridui-surface-pressed);
|
|
204
|
+
}
|
|
205
|
+
.gridui-u-button--disabled\:cursor-not-allowed:disabled {
|
|
206
|
+
cursor: not-allowed;
|
|
207
|
+
}
|
|
208
|
+
.gridui-u-button--aria-disabled\:cursor-not-allowed[aria-disabled="true"] {
|
|
209
|
+
cursor: not-allowed;
|
|
210
|
+
}
|
|
211
|
+
.gridui-u-button--data-disabled\:cursor-not-allowed[data-disabled] {
|
|
212
|
+
cursor: not-allowed;
|
|
213
|
+
}
|
|
214
|
+
.gridui-u-button--data-gridui-busy\:cursor-wait[data-gridui-busy] {
|
|
215
|
+
cursor: wait;
|
|
216
|
+
}
|
|
217
|
+
@media (prefers-reduced-motion: reduce) {
|
|
218
|
+
.gridui-u-button--motion-reduce\:transition-none {
|
|
219
|
+
transition-property: none;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
.gridui-u-button--\[\&_\>_span\]\:whitespace-nowrap > span {
|
|
223
|
+
white-space: nowrap;
|
|
224
|
+
}
|
|
225
|
+
.gridui-u-button--\[\&_\>_span\]\:\[writing-mode\:vertical-rl\] > span {
|
|
226
|
+
writing-mode: vertical-rl;
|
|
227
|
+
}
|
|
228
|
+
.gridui-u-button--\[\&_svg\]\:pointer-events-none svg {
|
|
229
|
+
pointer-events: none;
|
|
230
|
+
}
|
|
231
|
+
.gridui-u-button--\[\&_svg\]\:h-\(--gridui-button-icon-size\) svg {
|
|
232
|
+
height: var(--gridui-button-icon-size);
|
|
233
|
+
}
|
|
234
|
+
.gridui-u-button--\[\&_svg\]\:w-\(--gridui-button-icon-size\) svg {
|
|
235
|
+
width: var(--gridui-button-icon-size);
|
|
236
|
+
}
|
|
237
|
+
.gridui-u-button--\[\&_svg\]\:shrink-0 svg {
|
|
238
|
+
flex-shrink: 0;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
@layer components {
|
|
242
|
+
.gridui-button {
|
|
243
|
+
min-height: var(--_gridui-button-min);
|
|
244
|
+
border: 1px solid transparent;
|
|
245
|
+
}
|
|
246
|
+
.gridui-button-cell {
|
|
247
|
+
border: 0;
|
|
248
|
+
}
|
|
249
|
+
.gridui-button-label-content {
|
|
250
|
+
display: inline-flex;
|
|
251
|
+
min-width: 0;
|
|
252
|
+
flex-direction: inherit;
|
|
253
|
+
align-items: inherit;
|
|
254
|
+
justify-content: inherit;
|
|
255
|
+
gap: inherit;
|
|
256
|
+
}
|
|
257
|
+
.gridui-button-body {
|
|
258
|
+
display: inline-flex;
|
|
259
|
+
flex: 1;
|
|
260
|
+
min-width: 0;
|
|
261
|
+
flex-direction: inherit;
|
|
262
|
+
align-items: inherit;
|
|
263
|
+
justify-content: inherit;
|
|
264
|
+
gap: inherit;
|
|
265
|
+
}
|
|
266
|
+
.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 {
|
|
267
|
+
opacity: 0.5;
|
|
268
|
+
}
|
|
269
|
+
.gridui-button-start-region {
|
|
270
|
+
min-width: calc(var(--gridui-button-icon-size) + var(--gridui-space-16));
|
|
271
|
+
border-inline-end: 1px solid;
|
|
272
|
+
border-color: inherit;
|
|
273
|
+
}
|
|
274
|
+
.gridui-button-end-region {
|
|
275
|
+
border-inline-start: 1px solid;
|
|
276
|
+
border-color: inherit;
|
|
277
|
+
}
|
|
278
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
279
|
+
.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 {
|
|
280
|
+
transition: var(--gridui-motion-transition, transform calc(var(--gridui-motion-duration-quick) * var(--gridui-motion-factor, 1)) var(--gridui-motion-ease-out));
|
|
281
|
+
}
|
|
282
|
+
.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 {
|
|
283
|
+
transform: var(--gridui-motion-transform, translate(var(--gridui-space-4), calc(-1 * var(--gridui-space-4))));
|
|
284
|
+
}
|
|
285
|
+
.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 {
|
|
286
|
+
transform: var(--gridui-motion-transform, translate(calc(-1 * var(--gridui-space-4)), calc(-1 * var(--gridui-space-4))));
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
.gridui-button-medium {
|
|
290
|
+
--_gridui-button-min: max(var(--gridui-control-min-height-medium), var(--gridui-target-min-size));
|
|
291
|
+
padding-block: var(--gridui-space-8);
|
|
292
|
+
padding-inline: var(--gridui-space-16);
|
|
293
|
+
}
|
|
294
|
+
.gridui-button-small {
|
|
295
|
+
--_gridui-button-min: max(var(--gridui-control-min-height-small), var(--gridui-target-min-size));
|
|
296
|
+
padding-block: var(--gridui-space-4);
|
|
297
|
+
padding-inline: var(--gridui-space-8);
|
|
298
|
+
}
|
|
299
|
+
.gridui-button-large {
|
|
300
|
+
--_gridui-button-min: max(var(--gridui-control-min-height-large), var(--gridui-target-min-size));
|
|
301
|
+
padding-block: var(--gridui-space-8);
|
|
302
|
+
padding-inline: var(--gridui-space-24);
|
|
303
|
+
}
|
|
304
|
+
.gridui-button-extra-large {
|
|
305
|
+
--_gridui-button-min: max(var(--gridui-control-min-height-extra-large), var(--gridui-target-min-size));
|
|
306
|
+
padding-block: var(--gridui-space-16);
|
|
307
|
+
padding-inline: var(--gridui-space-24);
|
|
308
|
+
}
|
|
309
|
+
.gridui-button-group {
|
|
310
|
+
container: gridui-button-group / inline-size;
|
|
311
|
+
min-width: 0;
|
|
312
|
+
}
|
|
313
|
+
.gridui-button-group-items {
|
|
314
|
+
display: grid;
|
|
315
|
+
grid-auto-flow: column;
|
|
316
|
+
grid-auto-columns: minmax(0, 1fr);
|
|
317
|
+
align-items: stretch;
|
|
318
|
+
}
|
|
319
|
+
.gridui-button-group-items[data-layout="standard"] {
|
|
320
|
+
gap: var(--gridui-space-8);
|
|
321
|
+
}
|
|
322
|
+
.gridui-button-group-items[data-layout="cells"] > [data-gridui-button-group-item]:not([hidden]) ~ [data-gridui-button-group-item]:not([hidden])::before {
|
|
323
|
+
position: absolute;
|
|
324
|
+
inset-block: 0;
|
|
325
|
+
inset-inline-start: 0;
|
|
326
|
+
width: 1px;
|
|
327
|
+
background: var(--gridui-button-group-border, var(--gridui-border));
|
|
328
|
+
pointer-events: none;
|
|
329
|
+
content: "";
|
|
330
|
+
}
|
|
331
|
+
@container gridui-button-group (max-width: 20rem) {
|
|
332
|
+
.gridui-button-group-items {
|
|
333
|
+
grid-auto-flow: row;
|
|
334
|
+
grid-auto-rows: 1fr;
|
|
335
|
+
}
|
|
336
|
+
.gridui-button-group-items[data-layout="cells"] > [data-gridui-button-group-item]:not([hidden]) ~ [data-gridui-button-group-item]:not([hidden])::before {
|
|
337
|
+
inset-block: 0 auto;
|
|
338
|
+
inset-inline: 0;
|
|
339
|
+
width: auto;
|
|
340
|
+
height: 1px;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
@layer utilities {
|
|
345
|
+
.gridui-button-group-items > [data-gridui-button-group-item] {
|
|
346
|
+
position: relative;
|
|
347
|
+
width: 100%;
|
|
348
|
+
height: 100%;
|
|
349
|
+
min-width: 0;
|
|
350
|
+
}
|
|
351
|
+
.gridui-button-group-items[data-layout="cells"] > [data-gridui-button-group-item] {
|
|
352
|
+
padding-block: var(--gridui-button-group-padding-block, var(--_gridui-button-group-block, var(--gridui-space-8)));
|
|
353
|
+
border: 0;
|
|
354
|
+
border-radius: 0;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
@layer components {
|
|
358
|
+
.gridui-button-group-items > [data-size="small"] {
|
|
359
|
+
--_gridui-button-group-block: var(--gridui-space-4);
|
|
360
|
+
}
|
|
361
|
+
.gridui-button-group-items > [data-size="extra-large"] {
|
|
362
|
+
--_gridui-button-group-block: var(--gridui-space-16);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
@property --tw-border-style {
|
|
366
|
+
syntax: "*";
|
|
367
|
+
inherits: false;
|
|
368
|
+
initial-value: solid;
|
|
369
|
+
}
|
|
370
|
+
@property --tw-duration {
|
|
371
|
+
syntax: "*";
|
|
372
|
+
inherits: false;
|
|
373
|
+
}
|
|
374
|
+
@property --tw-ease {
|
|
375
|
+
syntax: "*";
|
|
376
|
+
inherits: false;
|
|
377
|
+
}
|
|
378
|
+
@layer properties {
|
|
379
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: block))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
380
|
+
*, ::before, ::after, ::backdrop {
|
|
381
|
+
--tw-border-style: solid;
|
|
382
|
+
--tw-duration: initial;
|
|
383
|
+
--tw-ease: initial;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
389
|
+
@layer properties;
|
|
390
|
+
@layer theme, base, components, utilities;
|
|
391
|
+
@layer utilities {
|
|
392
|
+
.gridui-u-overlay--z-\(--gridui-z-popover\) {
|
|
393
|
+
z-index: var(--gridui-z-popover);
|
|
394
|
+
}
|
|
395
|
+
.gridui-u-overlay--flex {
|
|
396
|
+
display: flex;
|
|
397
|
+
}
|
|
398
|
+
.gridui-u-overlay--inline-flex {
|
|
399
|
+
display: inline-flex;
|
|
400
|
+
}
|
|
401
|
+
.gridui-u-overlay--size-gridui-16 {
|
|
402
|
+
width: var(--gridui-space-16);
|
|
403
|
+
height: var(--gridui-space-16);
|
|
404
|
+
}
|
|
405
|
+
.gridui-u-overlay--min-w-0 {
|
|
406
|
+
min-width: 0px;
|
|
407
|
+
}
|
|
408
|
+
.gridui-u-overlay--shrink-0 {
|
|
409
|
+
flex-shrink: 0;
|
|
410
|
+
}
|
|
411
|
+
.gridui-u-overlay--cursor-pointer {
|
|
412
|
+
cursor: pointer;
|
|
413
|
+
}
|
|
414
|
+
.gridui-u-overlay--items-center {
|
|
415
|
+
align-items: center;
|
|
416
|
+
}
|
|
417
|
+
.gridui-u-overlay--justify-center {
|
|
418
|
+
justify-content: center;
|
|
419
|
+
}
|
|
420
|
+
.gridui-u-overlay--gap-gridui-8 {
|
|
421
|
+
gap: var(--gridui-space-8);
|
|
422
|
+
}
|
|
423
|
+
.gridui-u-overlay--rounded-control {
|
|
424
|
+
border-radius: var(--gridui-control-radius);
|
|
425
|
+
}
|
|
426
|
+
.gridui-u-overlay--border {
|
|
427
|
+
border-style: var(--tw-border-style);
|
|
428
|
+
border-width: 1px;
|
|
429
|
+
}
|
|
430
|
+
.gridui-u-overlay--border-solid {
|
|
431
|
+
--tw-border-style: solid;
|
|
432
|
+
border-style: solid;
|
|
433
|
+
}
|
|
434
|
+
.gridui-u-overlay--border-border {
|
|
435
|
+
border-color: var(--gridui-border);
|
|
436
|
+
}
|
|
437
|
+
.gridui-u-overlay--bg-background {
|
|
438
|
+
background-color: var(--gridui-background);
|
|
439
|
+
}
|
|
440
|
+
.gridui-u-overlay--p-0 {
|
|
441
|
+
padding: 0px;
|
|
442
|
+
}
|
|
443
|
+
.gridui-u-overlay--px-gridui-8 {
|
|
444
|
+
padding-inline: var(--gridui-space-8);
|
|
445
|
+
}
|
|
446
|
+
.gridui-u-overlay--type-data {
|
|
447
|
+
font: var(--gridui-type-data);
|
|
448
|
+
font-family: var(--gridui-font-body);
|
|
449
|
+
letter-spacing: normal;
|
|
450
|
+
font-variant-numeric: tabular-nums;
|
|
451
|
+
}
|
|
452
|
+
.gridui-u-overlay--type-caption {
|
|
453
|
+
font: var(--gridui-type-caption);
|
|
454
|
+
font-family: var(--gridui-font-body);
|
|
455
|
+
letter-spacing: normal;
|
|
456
|
+
}
|
|
457
|
+
.gridui-u-overlay--wrap-anywhere {
|
|
458
|
+
overflow-wrap: anywhere;
|
|
459
|
+
}
|
|
460
|
+
.gridui-u-overlay--whitespace-normal {
|
|
461
|
+
white-space: normal;
|
|
462
|
+
}
|
|
463
|
+
.gridui-u-overlay--text-foreground {
|
|
464
|
+
color: var(--gridui-foreground);
|
|
465
|
+
}
|
|
466
|
+
.gridui-u-overlay--text-inherit {
|
|
467
|
+
color: inherit;
|
|
468
|
+
}
|
|
469
|
+
.gridui-u-overlay--text-muted {
|
|
470
|
+
color: var(--gridui-muted);
|
|
471
|
+
}
|
|
472
|
+
.gridui-u-overlay--no-underline {
|
|
473
|
+
text-decoration-line: none;
|
|
474
|
+
}
|
|
475
|
+
.gridui-u-overlay--aria-selected\:bg-selection-background[aria-selected="true"] {
|
|
476
|
+
background-color: var(--gridui-selection-background);
|
|
477
|
+
}
|
|
478
|
+
.gridui-u-overlay--aria-\[current\=page\]\:bg-selection-background[aria-current="page"] {
|
|
479
|
+
background-color: var(--gridui-selection-background);
|
|
480
|
+
}
|
|
481
|
+
.gridui-u-overlay--data-disabled\:pointer-events-none[data-disabled] {
|
|
482
|
+
pointer-events: none;
|
|
483
|
+
}
|
|
484
|
+
.gridui-u-overlay--data-disabled\:opacity-50[data-disabled] {
|
|
485
|
+
opacity: 50%;
|
|
486
|
+
}
|
|
487
|
+
.gridui-u-overlay--data-\[state\=checked\]\:bg-selection-background[data-state="checked"] {
|
|
488
|
+
background-color: var(--gridui-selection-background);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
@layer components {
|
|
492
|
+
.gridui-overlay-surface {
|
|
493
|
+
--gridui-surface-offset-x: 0px;
|
|
494
|
+
--gridui-surface-offset-y: 0px;
|
|
495
|
+
--gridui-overlay-enter-duration: var(--gridui-motion-duration-normal);
|
|
496
|
+
--gridui-overlay-fill-mode: both;
|
|
497
|
+
transform-origin: var(--gridui-overlay-origin, center);
|
|
498
|
+
}
|
|
499
|
+
.gridui-overlay-dialog {
|
|
500
|
+
--gridui-overlay-fill-mode: none;
|
|
501
|
+
transform-origin: center;
|
|
502
|
+
}
|
|
503
|
+
.gridui-overlay-tooltip {
|
|
504
|
+
--gridui-overlay-enter-duration: var(--gridui-motion-duration-quick);
|
|
505
|
+
}
|
|
506
|
+
.gridui-overlay-floating[data-side="bottom"] {
|
|
507
|
+
--gridui-surface-offset-y: calc(-1 * var(--gridui-motion-distance));
|
|
508
|
+
}
|
|
509
|
+
.gridui-overlay-floating[data-side="top"] {
|
|
510
|
+
--gridui-surface-offset-y: var(--gridui-motion-distance);
|
|
511
|
+
}
|
|
512
|
+
.gridui-overlay-floating[data-side="left"] {
|
|
513
|
+
--gridui-surface-offset-x: var(--gridui-motion-distance);
|
|
514
|
+
}
|
|
515
|
+
.gridui-overlay-floating[data-side="right"] {
|
|
516
|
+
--gridui-surface-offset-x: calc(-1 * var(--gridui-motion-distance));
|
|
517
|
+
}
|
|
518
|
+
.gridui-overlay-surface[data-state="closed"] {
|
|
519
|
+
pointer-events: none;
|
|
520
|
+
}
|
|
521
|
+
.gridui-overlay-surface:not([data-side="none"]):is([data-state="open"], [data-state="delayed-open"], [data-state="instant-open"]) {
|
|
522
|
+
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));
|
|
523
|
+
}
|
|
524
|
+
.gridui-overlay-surface:not([data-side="none"])[data-state="closed"] {
|
|
525
|
+
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));
|
|
526
|
+
}
|
|
527
|
+
.gridui-overlay-backdrop {
|
|
528
|
+
background: var(--gridui-backdrop);
|
|
529
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
530
|
+
background: color-mix(in srgb, var(--gridui-backdrop) var(--gridui-backdrop-opacity), transparent);
|
|
531
|
+
}
|
|
532
|
+
--gridui-overlay-enter-duration: var(--gridui-motion-duration-normal);
|
|
533
|
+
--gridui-overlay-exit-duration: var(--gridui-motion-duration-quick);
|
|
534
|
+
--gridui-overlay-fill-mode: none;
|
|
535
|
+
}
|
|
536
|
+
.gridui-overlay-backdrop-deliberate {
|
|
537
|
+
--gridui-overlay-enter-duration: var(--gridui-motion-duration-deliberate);
|
|
538
|
+
--gridui-overlay-exit-duration: var(--gridui-motion-duration-normal);
|
|
539
|
+
--gridui-overlay-fill-mode: both;
|
|
540
|
+
}
|
|
541
|
+
.gridui-overlay-backdrop[data-state="open"] {
|
|
542
|
+
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));
|
|
543
|
+
}
|
|
544
|
+
.gridui-overlay-backdrop[data-state="closed"] {
|
|
545
|
+
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));
|
|
546
|
+
}
|
|
547
|
+
@media (prefers-reduced-motion: reduce) {
|
|
548
|
+
.gridui-overlay-surface:not([data-side="none"])[data-state], .gridui-overlay-backdrop[data-state] {
|
|
549
|
+
animation: none;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
.gridui-overlay-list {
|
|
553
|
+
--gridui-overlay-row-min: var(--gridui-control-min-height-medium);
|
|
554
|
+
--gridui-overlay-row-padding: var(--gridui-space-8);
|
|
555
|
+
}
|
|
556
|
+
.gridui-overlay-density-compact {
|
|
557
|
+
--gridui-overlay-row-min: var(--gridui-control-min-height-small);
|
|
558
|
+
--gridui-overlay-row-padding: var(--gridui-space-4);
|
|
559
|
+
}
|
|
560
|
+
.gridui-overlay-density-comfortable {
|
|
561
|
+
--gridui-overlay-row-min: var(--gridui-control-min-height-medium);
|
|
562
|
+
--gridui-overlay-row-padding: var(--gridui-space-8);
|
|
563
|
+
}
|
|
564
|
+
.gridui-overlay-list-item {
|
|
565
|
+
min-block-size: max(var(--gridui-overlay-row-min, var(--gridui-control-min-height-medium)), var(--gridui-target-min-size));
|
|
566
|
+
padding-block: var(--gridui-overlay-row-padding, var(--gridui-space-8));
|
|
567
|
+
}
|
|
568
|
+
.gridui-overlay-list-label {
|
|
569
|
+
padding-block: var(--gridui-overlay-row-padding, var(--gridui-space-8));
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
@property --tw-border-style {
|
|
573
|
+
syntax: "*";
|
|
574
|
+
inherits: false;
|
|
575
|
+
initial-value: solid;
|
|
576
|
+
}
|
|
577
|
+
@layer properties {
|
|
578
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: block))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
579
|
+
*, ::before, ::after, ::backdrop {
|
|
580
|
+
--tw-border-style: solid;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
1
585
|
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
2
586
|
@layer theme, base, components, utilities;
|
|
3
587
|
@layer utilities;
|
|
@@ -12,7 +596,7 @@
|
|
|
12
596
|
bottom: max(var(--gridui-space-16), env(safe-area-inset-bottom));
|
|
13
597
|
display: flex;
|
|
14
598
|
flex-direction: column-reverse;
|
|
15
|
-
gap: var(--gridui-
|
|
599
|
+
gap: var(--gridui-toast-gap);
|
|
16
600
|
width: min(26rem, calc(100% - 2 * var(--gridui-space-16)));
|
|
17
601
|
max-height: calc(100dvh - 2 * var(--gridui-space-16));
|
|
18
602
|
overflow: auto;
|
|
@@ -56,7 +640,7 @@
|
|
|
56
640
|
grid-template-columns: minmax(0, 1fr) auto auto;
|
|
57
641
|
align-items: center;
|
|
58
642
|
gap: var(--gridui-space-8);
|
|
59
|
-
padding: var(--gridui-
|
|
643
|
+
padding: var(--gridui-toast-padding);
|
|
60
644
|
}
|
|
61
645
|
.gridui-toast-message {
|
|
62
646
|
min-width: 0;
|
|
@@ -86,4 +670,12 @@
|
|
|
86
670
|
transition: none;
|
|
87
671
|
}
|
|
88
672
|
}
|
|
673
|
+
.gridui-toast-viewport {
|
|
674
|
+
--gridui-toast-gap: var(--gridui-space-8);
|
|
675
|
+
--gridui-toast-padding: var(--gridui-space-16);
|
|
676
|
+
}
|
|
677
|
+
.gridui-toast-viewport[data-density="compact"] {
|
|
678
|
+
--gridui-toast-gap: var(--gridui-space-4);
|
|
679
|
+
--gridui-toast-padding: var(--gridui-space-8);
|
|
680
|
+
}
|
|
89
681
|
}
|
|
@@ -0,0 +1,97 @@
|
|
|
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-toast-gap);
|
|
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-toast-padding);
|
|
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
|
+
.gridui-toast-viewport {
|
|
90
|
+
--gridui-toast-gap: var(--gridui-space-8);
|
|
91
|
+
--gridui-toast-padding: var(--gridui-space-16);
|
|
92
|
+
}
|
|
93
|
+
.gridui-toast-viewport[data-density="compact"] {
|
|
94
|
+
--gridui-toast-gap: var(--gridui-space-4);
|
|
95
|
+
--gridui-toast-padding: var(--gridui-space-8);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* @namespace Toaster
|
|
5
5
|
* @description Toaster
|
|
6
6
|
*/
|
|
7
|
+
import type { Density } from "@gridui/theme";
|
|
7
8
|
import type { ToastDismissOptions } from "../shared/types";
|
|
8
9
|
import { type ComponentPropsWithRef, type FC } from "react";
|
|
9
10
|
export type ToasterProps = Omit<ComponentPropsWithRef<"ol">, "children" | "aria-label"> & ToastDismissOptions & {
|
|
11
|
+
readonly density?: Density;
|
|
10
12
|
readonly label: string;
|
|
11
13
|
readonly container?: HTMLElement | undefined;
|
|
12
14
|
};
|
package/docs/catalog.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "@gridui/toast",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"category": "
|
|
4
|
+
"version": "1.3.0",
|
|
5
|
+
"category": "feedback",
|
|
6
6
|
"description": "GridUI React toast",
|
|
7
7
|
"usage": "Component reference contains focused API pages for each public component.",
|
|
8
8
|
"documentation": [
|
|
@@ -64,10 +64,11 @@
|
|
|
64
64
|
"@gridui/overlay/styles.css",
|
|
65
65
|
"@gridui/toast/styles.css"
|
|
66
66
|
],
|
|
67
|
+
"styledImport": "@gridui/toast/styled",
|
|
67
68
|
"examples": [
|
|
68
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
69
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
70
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
71
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
69
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-feedback/toast/stories/getting-started.mdx",
|
|
70
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-feedback/toast/stories/notifications.mdx",
|
|
71
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-feedback/toast/stories/ongoing-notifications.mdx",
|
|
72
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-feedback/toast/stories/toast.stories.tsx"
|
|
72
73
|
]
|
|
73
74
|
}
|
|
@@ -11,9 +11,9 @@ import "@gridui/theme/styles.css";
|
|
|
11
11
|
import "@gridui/toast/styles.css";
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-feedback/toast/README.md) for shared behavior and stylesheet dependencies.
|
|
15
15
|
|
|
16
|
-
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-feedback/toast/stories/toast.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
17
|
|
|
18
18
|
## API
|
|
19
19
|
|
|
@@ -11,9 +11,9 @@ import "@gridui/theme/styles.css";
|
|
|
11
11
|
import "@gridui/toast/styles.css";
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-feedback/toast/README.md) for shared behavior and stylesheet dependencies.
|
|
15
15
|
|
|
16
|
-
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-feedback/toast/stories/toast.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
17
|
|
|
18
18
|
## API
|
|
19
19
|
|
|
@@ -53,6 +53,12 @@ Called when the corresponding interaction occurs; inspect the arguments in Actio
|
|
|
53
53
|
|
|
54
54
|
``string`` · Required
|
|
55
55
|
|
|
56
|
+
### density
|
|
57
|
+
|
|
58
|
+
``Density | undefined`` · Optional
|
|
59
|
+
|
|
60
|
+
Default: ``"comfortable"``
|
|
61
|
+
|
|
56
62
|
### label
|
|
57
63
|
|
|
58
64
|
``string`` · Required
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/toast",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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,13 +32,13 @@
|
|
|
27
32
|
"react-dom": "^19.2.0"
|
|
28
33
|
},
|
|
29
34
|
"dependencies": {
|
|
30
|
-
"@gridui/button": "^
|
|
31
|
-
"@gridui/
|
|
32
|
-
"@gridui/
|
|
33
|
-
"@gridui/
|
|
35
|
+
"@gridui/button": "^6.0.0",
|
|
36
|
+
"@gridui/motion": "^1.0.3",
|
|
37
|
+
"@gridui/overlay": "^2.5.0",
|
|
38
|
+
"@gridui/style-utils": "^4.1.0",
|
|
39
|
+
"@gridui/theme": "^5.0.0",
|
|
34
40
|
"@radix-ui/react-toast": "1.3.1",
|
|
35
|
-
"lucide-react": "1.
|
|
36
|
-
"@gridui/motion": "^1.0.1"
|
|
41
|
+
"lucide-react": "1.73.0"
|
|
37
42
|
},
|
|
38
43
|
"devDependencies": {
|
|
39
44
|
"@gridui-internal/configuration": "0.0.0-internal",
|