@namroodinc/liquid-editorial 0.13.4 → 0.13.5
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 +17 -5
- package/UPGRADING.md +30 -0
- package/dist/chunks/{Message-DNaudg1u.js → Message-d6lqiMQ6.js} +2 -2
- package/dist/chunks/{Message-DNaudg1u.js.map → Message-d6lqiMQ6.js.map} +1 -1
- package/dist/chunks/{Message-Ce2zjtfz.cjs → Message-yhdaBpaz.cjs} +2 -2
- package/dist/chunks/{Message-Ce2zjtfz.cjs.map → Message-yhdaBpaz.cjs.map} +1 -1
- package/dist/components/Banner/index.cjs +1 -1
- package/dist/components/Banner/index.js +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.cjs.map +1 -1
- package/dist/components/Toast/index.d.cts +16 -3
- package/dist/components/Toast/index.d.cts.map +1 -1
- package/dist/components/Toast/index.d.ts +16 -3
- package/dist/components/Toast/index.d.ts.map +1 -1
- package/dist/components/Toast/index.js +65 -31
- package/dist/components/Toast/index.js.map +1 -1
- package/dist/internal/Message.d.cts.map +1 -1
- package/dist/internal/Message.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -417,7 +417,9 @@ parent removes the banner. The button is named "Dismiss" by default; pass
|
|
|
417
417
|
can be dismissed. Empty slots reserve no space: `false`, `null`, `""`, `true`,
|
|
418
418
|
empty arrays and empty fragments render no body or action row, and neither
|
|
419
419
|
does a `0` in `actions` (from `count && <Button />`). A `0` body still renders.
|
|
420
|
-
|
|
420
|
+
A component element counts as content even if it renders `null`, so decide
|
|
421
|
+
whether there is anything to show before passing it. An icon name outside the
|
|
422
|
+
curated set renders no icon.
|
|
421
423
|
|
|
422
424
|
Warning and danger default to `role="alert"`; the other tones use
|
|
423
425
|
`role="status"`. The default comes from the tone a banner mounts with and stays
|
|
@@ -430,13 +432,15 @@ render is not reliably announced by live regions, so keep the message visible.
|
|
|
430
432
|
Style parts through `.ds-banner__icon`, `__body`, `__title`, `__description`,
|
|
431
433
|
`__actions` and `__dismiss`. The `ds-message__*` classes belong to the internal
|
|
432
434
|
renderer that Banner and Toast share with their tone styles, icons and dismiss
|
|
433
|
-
control, and also match toasts. Use Banner for persistent content and actions
|
|
434
|
-
Toast
|
|
435
|
+
control, and also match toasts. Use Banner for persistent content and actions.
|
|
436
|
+
Toast is a brief notification.
|
|
435
437
|
|
|
436
438
|
### Toast
|
|
437
439
|
|
|
438
440
|
Mount ToastProvider once, then call `useToast()` inside its descendants. The returned `toast` function accepts a title, optional description, tone, and duration in milliseconds. Tones are `neutral`, `info`, `success`, `warning`, and `danger`.
|
|
439
441
|
|
|
442
|
+
Both `toast()` and standalone `Toast` accept a React node as the description. Use it for formatted text, such as an emphasised article title. Keep links and actions out of it: a toast disappears on its own, so put anything a reader must act on in a Banner or on the page.
|
|
443
|
+
|
|
440
444
|
```tsx
|
|
441
445
|
import { Button, Toast, ToastProvider, useToast } from "@namroodinc/liquid-editorial";
|
|
442
446
|
|
|
@@ -460,12 +464,20 @@ export function Notifications() {
|
|
|
460
464
|
// Standalone display, with dismissal/timing managed by its parent:
|
|
461
465
|
<Toast
|
|
462
466
|
title="Upload complete"
|
|
463
|
-
description=
|
|
467
|
+
description={
|
|
468
|
+
<>
|
|
469
|
+
The cover for <strong>Morning edition</strong> is ready.
|
|
470
|
+
</>
|
|
471
|
+
}
|
|
464
472
|
tone="success"
|
|
465
473
|
/>;
|
|
466
474
|
```
|
|
467
475
|
|
|
468
|
-
Provider notifications dismiss automatically after five seconds unless `duration` overrides it. Standalone Toast renders a status message; pass `onDismiss` to show its dismiss control.
|
|
476
|
+
Provider notifications dismiss automatically after five seconds unless `duration` overrides it. The countdown pauses while the pointer is over a toast or focus is inside it, then resumes with the time that was left. Standalone Toast renders a status message; pass `onDismiss` to show its dismiss control. Its parent owns timing.
|
|
477
|
+
|
|
478
|
+
Provider descriptions render inside ToastProvider, not where `toast()` was called. They see only context provided above ToastProvider, and they show the node as it was when `toast()` ran, so later state changes in the caller do not update them. Mount ToastProvider inside any router, i18n, data or theme providers your descriptions read, or pass plain values. If a description throws, its toast shows the title alone and the rest of the app keeps rendering. While a description suspends, the toast shows its title until the content is ready.
|
|
479
|
+
|
|
480
|
+
Descriptions follow Banner's empty-slot rules. Strings and numbers render in a `<span>`; other nodes render in a `<div>` that can hold block elements. Both carry `.ds-toast__description`. Toasts set `aria-atomic="false"`, like banners, so an update to a standalone toast announces only the text that changed.
|
|
469
481
|
|
|
470
482
|
### Badge
|
|
471
483
|
|
package/UPGRADING.md
CHANGED
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.13.5
|
|
6
|
+
|
|
7
|
+
### Changes
|
|
8
|
+
|
|
9
|
+
- `description` accepts a React node in both standalone `Toast` and `useToast().toast()`.
|
|
10
|
+
- Provider toasts pause their countdown while the pointer is over them or focus is inside them, then resume with the time that was left.
|
|
11
|
+
- If a provider toast's description throws, that toast shows its title alone. The tree below `ToastProvider` no longer unmounts. While a description suspends, the toast shows its title until the content is ready.
|
|
12
|
+
- Toasts set `aria-atomic="false"`, as banners do, so updates announce only the changed text. An `aria-atomic` prop still overrides it.
|
|
13
|
+
|
|
14
|
+
### Adoption
|
|
15
|
+
|
|
16
|
+
Pass JSX to `description` for formatted text, such as an emphasised article title. Keep links and actions out of it; use a `Banner` for anything a reader must act on. Existing string descriptions need no edits.
|
|
17
|
+
|
|
18
|
+
Provider descriptions render inside `ToastProvider`, not where `toast()` was called. If a description reads context (router links, translations, query data, a scoped theme), make sure `ToastProvider` is mounted inside those providers, or resolve the values before calling `toast()` and pass plain content.
|
|
19
|
+
|
|
20
|
+
### Compatibility
|
|
21
|
+
|
|
22
|
+
- `ToastProps["description"]` and `ToastOptions["description"]` widen from `string` to `ReactNode`. Code that treats `description` as a string, such as `options.description?.slice(0, 80)` or `aria-label={options.description}`, no longer type-checks. Narrow it with `typeof description === "string"` or keep the plain text in a separate value.
|
|
23
|
+
- Strings and numbers keep the `<span>` wrapper. Other nodes use a `<div>` that can contain block elements. Both carry `.ds-toast__description`. A description that switches between text and JSX replaces its wrapper element.
|
|
24
|
+
- A component element counts as a description even if it renders `null`, so it keeps the empty wrapper and its spacing. Pass `undefined`, `null` or `false` when there is nothing to show.
|
|
25
|
+
- Provider descriptions see only context provided above `ToastProvider`. They keep the node passed to `toast()`, so later changes in the caller's state do not update them.
|
|
26
|
+
- Tests that hover or focus a provider toast and then advance timers must move the pointer away and blur it before expecting it to dismiss.
|
|
27
|
+
|
|
28
|
+
### Verification
|
|
29
|
+
|
|
30
|
+
1. Run the project's typecheck and fix any code that reads `description` as a string.
|
|
31
|
+
2. Render a toast with a JSX description and check that the nested markup sits inside `div.ds-toast__description`.
|
|
32
|
+
3. Trigger a provider toast and check that it dismisses on schedule. Hover it past its duration and check that it stays, then move the pointer away and check that it dismisses.
|
|
33
|
+
4. If a provider description uses context (for example a router `Link`), trigger it and check that it renders.
|
|
34
|
+
|
|
5
35
|
## 0.13.4
|
|
6
36
|
|
|
7
37
|
### Changes
|
|
@@ -21,7 +21,7 @@ function m(t, n) {
|
|
|
21
21
|
return Object.hasOwn(e, r) ? r : void 0;
|
|
22
22
|
}
|
|
23
23
|
var h = (e) => e === "danger" || e === "warning" ? "alert" : "status", g = i(function({ tone: e = "neutral", appearance: r = "inline", title: i, icon: a, actions: l, onDismiss: u, dismissLabel: d = "Dismiss", classPrefix: g, role: _, className: v, children: y, ...b }, x) {
|
|
24
|
-
let [S] = o(() => h(e)), C = m(a, e), w = (e) => [`ds-message__${e}`, g && `${g}__${e}`].filter(Boolean).join(" "), T = r === "floating" ? "span" : "div";
|
|
24
|
+
let [S] = o(() => h(e)), C = m(a, e), w = (e) => [`ds-message__${e}`, g && `${g}__${e}`].filter(Boolean).join(" "), T = r === "floating" && (typeof y == "string" || typeof y == "number") ? "span" : "div";
|
|
25
25
|
return /* @__PURE__ */ c("div", {
|
|
26
26
|
ref: x,
|
|
27
27
|
role: _ ?? S,
|
|
@@ -67,4 +67,4 @@ var h = (e) => e === "danger" || e === "warning" ? "alert" : "status", g = i(fun
|
|
|
67
67
|
//#endregion
|
|
68
68
|
export { g as t };
|
|
69
69
|
|
|
70
|
-
//# sourceMappingURL=Message-
|
|
70
|
+
//# sourceMappingURL=Message-d6lqiMQ6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message-
|
|
1
|
+
{"version":3,"file":"Message-d6lqiMQ6.js","names":["icons","TONE_ICON","isBlank","node","someLeaf","child","test","isValidElement","Fragment","hasBody","leaf","hasActions","resolveIcon","icon","name","tone","toneRole","Message","forwardRef","rest","defaultRole","useState","iconName","slotClass","slot","classPrefix","Description","appearance","children","role","className","Icon","title","actions","onDismiss","Button","dismissLabel"],"sources":["../../src/internal/Message.tsx"],"sourcesContent":["import {\n forwardRef,\n Fragment,\n isValidElement,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../components/Button\";\nimport { Icon } from \"../components/Icon\";\nimport { icons, type IconName } from \"../components/Icon/icons\";\nimport \"../styles/message.css\";\n\nexport type MessageTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"review\";\n\nconst TONE_ICON: Record<MessageTone, IconName> = {\n neutral: \"info\",\n info: \"info\",\n success: \"check\",\n warning: \"alert-triangle\",\n danger: \"alert-triangle\",\n review: \"eye\",\n};\n\nexport interface MessageProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n tone?: MessageTone;\n appearance?: \"inline\" | \"floating\";\n title: string;\n /**\n * Omitted or `none` hides the icon; `auto` uses the tone's default glyph. A\n * name outside the curated icon set renders no icon rather than throwing.\n */\n icon?: IconName | \"auto\" | \"none\";\n actions?: ReactNode;\n /** Renders a dismiss control. The parent owns visibility. */\n onDismiss?: () => void;\n /** Accessible name of the dismiss control. Defaults to \"Dismiss\". */\n dismissLabel?: string;\n /** The public wrapper's block class, added beside each `ds-message__*` slot class. */\n classPrefix?: string;\n}\n\n/** Leftovers of conditional rendering: nothing visible, so no slot is reserved. */\nconst isBlank = (node: unknown) => node == null || typeof node === \"boolean\" || node === \"\";\n\n/** Whether `test` holds for any leaf, looking through arrays and fragments. */\nfunction someLeaf(node: ReactNode, test: (leaf: ReactNode) => boolean): boolean {\n if (Array.isArray(node)) {\n return node.some((child: ReactNode) => someLeaf(child, test));\n }\n if (isValidElement<{ children?: ReactNode }>(node) && node.type === Fragment) {\n return someLeaf(node.props.children, test);\n }\n return test(node);\n}\n\n// Numbers are content in the body (`0` items) but never an action: a `0` in the\n// actions slot comes from `count && <Button />`, so it reserves no row.\nconst hasBody = (node: ReactNode) => someLeaf(node, (leaf) => !isBlank(leaf));\nconst hasActions = (node: ReactNode) =>\n someLeaf(node, (leaf) => !isBlank(leaf) && typeof leaf !== \"number\");\n\nfunction resolveIcon(icon: MessageProps[\"icon\"], tone: MessageTone): IconName | undefined {\n if (icon === undefined || icon === \"none\") {\n return undefined;\n }\n const name = icon === \"auto\" ? TONE_ICON[tone] : icon;\n // Own keys only, so values such as \"constructor\" never reach Icon.\n return Object.hasOwn(icons, name) ? name : undefined;\n}\n\nconst toneRole = (tone: MessageTone) =>\n tone === \"danger\" || tone === \"warning\" ? \"alert\" : \"status\";\n\n/** Shared notification structure. Public wrappers own delivery and content policy. */\nexport const Message = forwardRef<HTMLDivElement, MessageProps>(function Message(\n {\n tone = \"neutral\",\n appearance = \"inline\",\n title,\n icon,\n actions,\n onDismiss,\n dismissLabel = \"Dismiss\",\n classPrefix,\n role,\n className,\n children,\n ...rest\n },\n ref,\n) {\n // A live region must exist before its content changes, so the default role\n // comes from the tone the message mounts with and survives later tone changes.\n const [defaultRole] = useState(() => toneRole(tone));\n const iconName = resolveIcon(icon, tone);\n const slotClass = (slot: string) =>\n [`ds-message__${slot}`, classPrefix && `${classPrefix}__${slot}`].filter(Boolean).join(\" \");\n // Plain-text toasts keep their span; JSX descriptions get a div that can hold blocks.\n const isText = typeof children === \"string\" || typeof children === \"number\";\n const Description = appearance === \"floating\" && isText ? \"span\" : \"div\";\n\n return (\n <div\n ref={ref}\n role={role ?? defaultRole}\n data-tone={tone === \"neutral\" ? undefined : tone}\n data-appearance={appearance}\n className={[\"ds-message\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {iconName && (\n <Icon\n name={iconName}\n size={20}\n className={slotClass(\"icon\")}\n />\n )}\n <div className={`${slotClass(\"body\")} ds-field-surface`}>\n <span className={slotClass(\"title\")}>{title}</span>\n {hasBody(children) && (\n <Description className={slotClass(\"description\")}>{children}</Description>\n )}\n {hasActions(actions) && <div className={slotClass(\"actions\")}>{actions}</div>}\n </div>\n {onDismiss && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"x\"\n className={`${slotClass(\"dismiss\")} ds-field-surface`}\n aria-label={dismissLabel}\n onClick={onDismiss}\n />\n )}\n </div>\n );\n});\n"],"mappings":";;;;;AAeA,IAAMC,IAA2C;CAC/C,SAAS;CACT,MAAM;CACN,SAAS;CACT,SAAS;CACT,QAAQ;CACR,QAAQ;AACV,GAqBMC,KAAW,MAAkBC,KAAQ,QAAQ,OAAOA,KAAS,aAAaA,MAAS;AAGzF,SAASC,EAAS,GAAiB,GAA6C;CAO9E,OANI,MAAM,QAAQD,CAAI,IACbA,EAAK,MAAM,MAAqBC,EAASC,GAAOC,CAAI,CAAC,IAE1DC,EAAyCJ,CAAI,KAAKA,EAAK,SAASK,IAC3DJ,EAASD,EAAK,MAAM,UAAUG,CAAI,IAEpCA,EAAKH,CAAI;AAClB;AAIA,IAAMM,KAAW,MAAoBL,EAASD,IAAO,MAAS,CAACD,EAAQQ,CAAI,CAAC,GACtEC,KAAc,MAClBP,EAASD,IAAO,MAAS,CAACD,EAAQQ,CAAI,KAAK,OAAOA,KAAS,QAAQ;AAErE,SAASE,EAAY,GAA4B,GAAyC;CACxF,IAAIC,MAAS,KAAA,KAAaA,MAAS,QACjC;CAEF,I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;IACL,YAAA;IACA,WAAU;IACV,WAAW,GAAGZ,EAAU,SAAS,EAAE;IACnC,cAAYa;IACZ,SAASF;GACV,CAAA;EAEA;;AAET,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./Icon-3ucBRgrd.cjs"),t=require("../components/Button/index.cjs");let n=require("react"),r=require("react/jsx-runtime");var i={neutral:`info`,info:`info`,success:`check`,warning:`alert-triangle`,danger:`alert-triangle`,review:`eye`},a=e=>e==null||typeof e==`boolean`||e===``;function o(e,t){return Array.isArray(e)?e.some(e=>o(e,t)):(0,n.isValidElement)(e)&&e.type===n.Fragment?o(e.props.children,t):t(e)}var s=e=>o(e,e=>!a(e)),c=e=>o(e,e=>!a(e)&&typeof e!=`number`);function l(t,n){if(t===void 0||t===`none`)return;let r=t===`auto`?i[n]:t;return Object.hasOwn(e.r,r)?r:void 0}var u=e=>e===`danger`||e===`warning`?`alert`:`status`,d=(0,n.forwardRef)(function({tone:i=`neutral`,appearance:a=`inline`,title:o,icon:d,actions:f,onDismiss:p,dismissLabel:m=`Dismiss`,classPrefix:h,role:g,className:_,children:v,...y},b){let[x]=(0,n.useState)(()=>u(i)),S=l(d,i),C=e=>[`ds-message__${e}`,h&&`${h}__${e}`].filter(Boolean).join(` `),w=a===`floating
|
|
2
|
-
//# sourceMappingURL=Message-
|
|
1
|
+
const e=require("./Icon-3ucBRgrd.cjs"),t=require("../components/Button/index.cjs");let n=require("react"),r=require("react/jsx-runtime");var i={neutral:`info`,info:`info`,success:`check`,warning:`alert-triangle`,danger:`alert-triangle`,review:`eye`},a=e=>e==null||typeof e==`boolean`||e===``;function o(e,t){return Array.isArray(e)?e.some(e=>o(e,t)):(0,n.isValidElement)(e)&&e.type===n.Fragment?o(e.props.children,t):t(e)}var s=e=>o(e,e=>!a(e)),c=e=>o(e,e=>!a(e)&&typeof e!=`number`);function l(t,n){if(t===void 0||t===`none`)return;let r=t===`auto`?i[n]:t;return Object.hasOwn(e.r,r)?r:void 0}var u=e=>e===`danger`||e===`warning`?`alert`:`status`,d=(0,n.forwardRef)(function({tone:i=`neutral`,appearance:a=`inline`,title:o,icon:d,actions:f,onDismiss:p,dismissLabel:m=`Dismiss`,classPrefix:h,role:g,className:_,children:v,...y},b){let[x]=(0,n.useState)(()=>u(i)),S=l(d,i),C=e=>[`ds-message__${e}`,h&&`${h}__${e}`].filter(Boolean).join(` `),w=a===`floating`&&(typeof v==`string`||typeof v==`number`)?`span`:`div`;return(0,r.jsxs)(`div`,{ref:b,role:g??x,"data-tone":i===`neutral`?void 0:i,"data-appearance":a,className:[`ds-message`,_].filter(Boolean).join(` `),...y,children:[S&&(0,r.jsx)(e.t,{name:S,size:20,className:C(`icon`)}),(0,r.jsxs)(`div`,{className:`${C(`body`)} ds-field-surface`,children:[(0,r.jsx)(`span`,{className:C(`title`),children:o}),s(v)&&(0,r.jsx)(w,{className:C(`description`),children:v}),c(f)&&(0,r.jsx)(`div`,{className:C(`actions`),children:f})]}),p&&(0,r.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`x`,className:`${C(`dismiss`)} ds-field-surface`,"aria-label":m,onClick:p})]})});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return d}});
|
|
2
|
+
//# sourceMappingURL=Message-yhdaBpaz.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message-
|
|
1
|
+
{"version":3,"file":"Message-yhdaBpaz.cjs","names":["isValidElement","Fragment","icons","forwardRef","useState","Icon","Button","require_Icon","require_components_Button_index","react","react_jsx_runtime","TONE_ICON","isBlank","node","someLeaf","child","test","hasBody","leaf","hasActions","resolveIcon","icon","name","tone","toneRole","Message","rest","defaultRole","iconName","slotClass","slot","classPrefix","Description","appearance","children","role","className","title","actions","onDismiss","dismissLabel"],"sources":["../../src/internal/Message.tsx"],"sourcesContent":["import {\n forwardRef,\n Fragment,\n isValidElement,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../components/Button\";\nimport { Icon } from \"../components/Icon\";\nimport { icons, type IconName } from \"../components/Icon/icons\";\nimport \"../styles/message.css\";\n\nexport type MessageTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"review\";\n\nconst TONE_ICON: Record<MessageTone, IconName> = {\n neutral: \"info\",\n info: \"info\",\n success: \"check\",\n warning: \"alert-triangle\",\n danger: \"alert-triangle\",\n review: \"eye\",\n};\n\nexport interface MessageProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n tone?: MessageTone;\n appearance?: \"inline\" | \"floating\";\n title: string;\n /**\n * Omitted or `none` hides the icon; `auto` uses the tone's default glyph. A\n * name outside the curated icon set renders no icon rather than throwing.\n */\n icon?: IconName | \"auto\" | \"none\";\n actions?: ReactNode;\n /** Renders a dismiss control. The parent owns visibility. */\n onDismiss?: () => void;\n /** Accessible name of the dismiss control. Defaults to \"Dismiss\". */\n dismissLabel?: string;\n /** The public wrapper's block class, added beside each `ds-message__*` slot class. */\n classPrefix?: string;\n}\n\n/** Leftovers of conditional rendering: nothing visible, so no slot is reserved. */\nconst isBlank = (node: unknown) => node == null || typeof node === \"boolean\" || node === \"\";\n\n/** Whether `test` holds for any leaf, looking through arrays and fragments. */\nfunction someLeaf(node: ReactNode, test: (leaf: ReactNode) => boolean): boolean {\n if (Array.isArray(node)) {\n return node.some((child: ReactNode) => someLeaf(child, test));\n }\n if (isValidElement<{ children?: ReactNode }>(node) && node.type === Fragment) {\n return someLeaf(node.props.children, test);\n }\n return test(node);\n}\n\n// Numbers are content in the body (`0` items) but never an action: a `0` in the\n// actions slot comes from `count && <Button />`, so it reserves no row.\nconst hasBody = (node: ReactNode) => someLeaf(node, (leaf) => !isBlank(leaf));\nconst hasActions = (node: ReactNode) =>\n someLeaf(node, (leaf) => !isBlank(leaf) && typeof leaf !== \"number\");\n\nfunction resolveIcon(icon: MessageProps[\"icon\"], tone: MessageTone): IconName | undefined {\n if (icon === undefined || icon === \"none\") {\n return undefined;\n }\n const name = icon === \"auto\" ? TONE_ICON[tone] : icon;\n // Own keys only, so values such as \"constructor\" never reach Icon.\n return Object.hasOwn(icons, name) ? name : undefined;\n}\n\nconst toneRole = (tone: MessageTone) =>\n tone === \"danger\" || tone === \"warning\" ? \"alert\" : \"status\";\n\n/** Shared notification structure. Public wrappers own delivery and content policy. */\nexport const Message = forwardRef<HTMLDivElement, MessageProps>(function Message(\n {\n tone = \"neutral\",\n appearance = \"inline\",\n title,\n icon,\n actions,\n onDismiss,\n dismissLabel = \"Dismiss\",\n classPrefix,\n role,\n className,\n children,\n ...rest\n },\n ref,\n) {\n // A live region must exist before its content changes, so the default role\n // comes from the tone the message mounts with and survives later tone changes.\n const [defaultRole] = useState(() => toneRole(tone));\n const iconName = resolveIcon(icon, tone);\n const slotClass = (slot: string) =>\n [`ds-message__${slot}`, classPrefix && `${classPrefix}__${slot}`].filter(Boolean).join(\" \");\n // Plain-text toasts keep their span; JSX descriptions get a div that can hold blocks.\n const isText = typeof children === \"string\" || typeof children === \"number\";\n const Description = appearance === \"floating\" && isText ? \"span\" : \"div\";\n\n return (\n <div\n ref={ref}\n role={role ?? defaultRole}\n data-tone={tone === \"neutral\" ? undefined : tone}\n data-appearance={appearance}\n className={[\"ds-message\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {iconName && (\n <Icon\n name={iconName}\n size={20}\n className={slotClass(\"icon\")}\n />\n )}\n <div className={`${slotClass(\"body\")} ds-field-surface`}>\n <span className={slotClass(\"title\")}>{title}</span>\n {hasBody(children) && (\n <Description className={slotClass(\"description\")}>{children}</Description>\n )}\n {hasActions(actions) && <div className={slotClass(\"actions\")}>{actions}</div>}\n </div>\n {onDismiss && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"x\"\n className={`${slotClass(\"dismiss\")} ds-field-surface`}\n aria-label={dismissLabel}\n onClick={onDismiss}\n />\n )}\n </div>\n );\n});\n"],"mappings":"A,yIAeA,IAAMW,EAA2C,C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A,GAAa,UACT,OAAS,MAEnE,OACE,EAAAxB,EAAA,KAAA,CAAC,MAAD,CACO,MACL,KAAMyB,GAAQR,EACd,YAAWJ,IAAS,UAAY,IAAA,GAAYA,EAC5C,kBAAiBU,EACjB,UAAW,CAAC,aAAcG,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAC7D,GAAIV,EANN,SAAA,CAQGE,IACC,EAAAlB,EAAA,IAAA,CAACL,EAAAA,EAAD,CACE,KAAMuB,EACN,KAAM,GACN,UAAWC,EAAU,MAAM,CAC5B,CAAA,GAEH,EAAAnB,EAAA,KAAA,CAAC,MAAD,CAAK,UAAW,GAAGmB,EAAU,MAAM,EAAE,mBAArC,SAAA,EACE,EAAAnB,EAAA,IAAA,CAAC,OAAD,CAAM,UAAWmB,EAAU,OAAO,EAAI,SAAAQ,CAAY,CAAA,EACjDpB,EAAQiB,CAAQ,IACf,EAAAxB,EAAA,IAAA,CAACsB,EAAD,CAAa,UAAWH,EAAU,aAAa,EAAI,UAAsB,CAAA,EAE1EV,EAAWmB,CAAO,IAAK,EAAA5B,EAAA,IAAA,CAAC,MAAD,CAAK,UAAWmB,EAAU,SAAS,EAAI,SAAAS,CAAa,CAAA,CACzE,C,GACJC,IACC,EAAA7B,EAAA,IAAA,CAACJ,EAAAA,OAAD,CACE,QAAQ,SACR,KAAK,KACL,WAAA,GACA,UAAU,IACV,UAAW,GAAGuB,EAAU,SAAS,EAAE,mBACnC,aAAYW,EACZ,QAASD,CACV,CAAA,CAEA,C,EAET,CAAC,E"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Message-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Message-yhdaBpaz.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)(function({className:t,...r},i){return(0,n.jsx)(e.t,{"aria-atomic":!1,...r,ref:i,appearance:`inline`,classPrefix:`ds-banner`,className:[`ds-banner`,t].filter(Boolean).join(` `)})});exports.Banner=r;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Message-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Message-yhdaBpaz.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)(function({tone:t=`neutral`,title:r,description:i,onDismiss:a,role:o=`status`,className:s,...c},l){return(0,n.jsx)(e.t,{"aria-atomic":!1,...c,ref:l,role:o,tone:t,title:r,appearance:`floating`,icon:`auto`,onDismiss:a,classPrefix:`ds-toast`,dismissLabel:`Dismiss notification`,className:[`ds-toast`,s].filter(Boolean).join(` `),children:i})}),i=(0,t.createContext)(null);function a({children:e}){let[r,a]=(0,t.useState)([]),s=(0,t.useRef)(0),c=(0,t.useCallback)(e=>{a(t=>t.filter(t=>t.id!==e))},[]),l=(0,t.useCallback)(e=>{a(t=>[...t,{...e,id:s.current++}])},[]),u=(0,t.useMemo)(()=>({toast:l,dismiss:c}),[l,c]);return(0,n.jsxs)(i.Provider,{value:u,children:[e,(0,n.jsx)(o,{items:r,onDismiss:c})]})}function o({items:e,onDismiss:t}){return e.length===0?null:(0,n.jsx)(`div`,{className:`ds-toast-region`,role:`region`,"aria-label":`Notifications`,children:e.map(e=>(0,n.jsx)(c,{item:e,onDismiss:t},e.id))})}var s=class extends t.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}};function c({item:e,onDismiss:i}){let[a,o]=(0,t.useState)(!1),[c,l]=(0,t.useState)(!1),u=(0,t.useRef)(e.duration??5e3),d=a||c;(0,t.useEffect)(()=>{if(d)return;let t=u.current,n=Date.now(),r=window.setTimeout(()=>i(e.id),t);return()=>{window.clearTimeout(r),u.current=t-(Date.now()-n)}},[d,e.id,i]);let f={tone:e.tone,title:e.title,onDismiss:()=>i(e.id),onPointerEnter:()=>o(!0),onPointerLeave:()=>o(!1),onFocus:()=>l(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||l(!1)}},p=(0,n.jsx)(r,{...f});return(0,n.jsx)(s,{fallback:p,children:(0,n.jsx)(t.Suspense,{fallback:p,children:(0,n.jsx)(r,{...f,description:e.description})})})}function l(){let e=(0,t.useContext)(i);if(!e)throw Error(`useToast must be used inside a <ToastProvider>.`);return e}exports.Toast=r,exports.ToastProvider=a,exports.useToast=l;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","Message","createContext","useState","useRef","useCallback","useMemo","useContext","require_Message","react","react_jsx_runtime","Toast","rest","className","description","ToastContext","ToastProvider","items","setItems","nextId","dismiss","current","item","id","toast","options","value","children","ToastRegion","TimedToast","timer","onDismiss","useToast","context"],"sources":["../../../src/components/Toast/index.tsx"],"sourcesContent":["import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Message } from \"../../internal/Message\";\nimport \"./style.css\";\n\nexport type ToastTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface ToastProps extends HTMLAttributes<HTMLDivElement> {\n tone?: ToastTone;\n title: string;\n description?:
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","Message","createContext","useState","useRef","useCallback","useMemo","Component","Suspense","useContext","require_Message","react","react_jsx_runtime","Toast","rest","className","description","ToastContext","ToastProvider","items","setItems","nextId","dismiss","current","item","id","toast","options","value","children","ToastRegion","TimedToast","DescriptionBoundary","hovered","setHovered","focused","setFocused","remaining","paused","left","started","timer","onDismiss","shared","event","titleOnly","useToast","context"],"sources":["../../../src/components/Toast/index.tsx"],"sourcesContent":["import {\n Component,\n createContext,\n forwardRef,\n Suspense,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Message } from \"../../internal/Message\";\nimport \"./style.css\";\n\nexport type ToastTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface ToastProps extends HTMLAttributes<HTMLDivElement> {\n tone?: ToastTone;\n title: string;\n /**\n * Formatted text, such as an emphasised article title. Keep links and\n * actions out: the toast disappears on its own, so use a Banner for those.\n */\n description?: ReactNode;\n /** Renders a dismiss button. Omit for a toast that only times out. */\n onDismiss?: () => void;\n}\n\n/** One fact about something that already happened. Never a question. */\nexport const Toast = forwardRef<HTMLDivElement, ToastProps>(function Toast(\n { tone = \"neutral\", title, description, onDismiss, role = \"status\", className, ...rest },\n ref,\n) {\n return (\n <Message\n // Later changes announce only the text that changed, not the whole\n // toast with its dismiss label.\n aria-atomic={false}\n {...rest}\n ref={ref}\n role={role}\n tone={tone}\n title={title}\n appearance=\"floating\"\n icon=\"auto\"\n onDismiss={onDismiss}\n classPrefix=\"ds-toast\"\n dismissLabel=\"Dismiss notification\"\n className={[\"ds-toast\", className].filter(Boolean).join(\" \")}\n >\n {description}\n </Message>\n );\n});\n\nexport interface ToastOptions {\n tone?: ToastTone;\n title: string;\n /**\n * Formatted text; keep links and actions out. It renders inside\n * `ToastProvider`, not where `toast()` was called: it sees only context\n * above the provider and stays as passed. If it throws or suspends, the\n * toast shows its title alone.\n */\n description?: ReactNode;\n /**\n * Milliseconds before it dismisses itself. Defaults to `--toast-duration`.\n * The countdown pauses while the toast is hovered or holds focus.\n */\n duration?: number;\n}\n\ninterface ToastRecord extends ToastOptions {\n id: number;\n}\n\ninterface ToastContextValue {\n toast: (options: ToastOptions) => void;\n dismiss: (id: number) => void;\n}\n\nconst ToastContext = createContext<ToastContextValue | null>(null);\n\nexport interface ToastProviderProps {\n children: ReactNode;\n}\n\n/** Mount once, near the root. Everything below it can call `useToast()`. */\nexport function ToastProvider({ children }: ToastProviderProps) {\n const [items, setItems] = useState<ToastRecord[]>([]);\n const nextId = useRef(0);\n\n const dismiss = useCallback((id: number) => {\n setItems((current) => current.filter((item) => item.id !== id));\n }, []);\n\n const toast = useCallback((options: ToastOptions) => {\n setItems((current) => [...current, { ...options, id: nextId.current++ }]);\n }, []);\n\n const value = useMemo(() => ({ toast, dismiss }), [toast, dismiss]);\n\n return (\n <ToastContext.Provider value={value}>\n {children}\n <ToastRegion\n items={items}\n onDismiss={dismiss}\n />\n </ToastContext.Provider>\n );\n}\n\nfunction ToastRegion({\n items,\n onDismiss,\n}: {\n items: ToastRecord[];\n onDismiss: (id: number) => void;\n}) {\n if (items.length === 0) {\n return null;\n }\n return (\n <div\n className=\"ds-toast-region\"\n role=\"region\"\n aria-label=\"Notifications\"\n >\n {items.map((item) => (\n <TimedToast\n key={item.id}\n item={item}\n onDismiss={onDismiss}\n />\n ))}\n </div>\n );\n}\n\n/**\n * Provider descriptions render away from the code that called `toast()`. If\n * one throws, this keeps the failure inside its toast instead of unmounting\n * everything below the provider.\n */\nclass DescriptionBoundary extends Component<\n { fallback: ReactNode; children: ReactNode },\n { failed: boolean }\n> {\n state = { failed: false };\n\n static getDerivedStateFromError() {\n return { failed: true };\n }\n\n render() {\n return this.state.failed ? this.props.fallback : this.props.children;\n }\n}\n\nfunction TimedToast({ item, onDismiss }: { item: ToastRecord; onDismiss: (id: number) => void }) {\n const [hovered, setHovered] = useState(false);\n const [focused, setFocused] = useState(false);\n const remaining = useRef(item.duration ?? 5000);\n const paused = hovered || focused;\n\n // A toast never disappears under the pointer or from under focus. The\n // countdown resumes with the time that was left.\n useEffect(() => {\n if (paused) {\n return;\n }\n const left = remaining.current;\n const started = Date.now();\n const timer = window.setTimeout(() => onDismiss(item.id), left);\n return () => {\n window.clearTimeout(timer);\n remaining.current = left - (Date.now() - started);\n };\n }, [paused, item.id, onDismiss]);\n\n const shared: ToastProps = {\n tone: item.tone,\n title: item.title,\n onDismiss: () => onDismiss(item.id),\n onPointerEnter: () => setHovered(true),\n onPointerLeave: () => setHovered(false),\n onFocus: () => setFocused(true),\n onBlur: (event) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) {\n setFocused(false);\n }\n },\n };\n // Shown while the description suspends, or after it throws.\n const titleOnly = <Toast {...shared} />;\n\n return (\n <DescriptionBoundary fallback={titleOnly}>\n <Suspense fallback={titleOnly}>\n <Toast\n {...shared}\n description={item.description}\n />\n </Suspense>\n </DescriptionBoundary>\n );\n}\n\nexport function useToast(): ToastContextValue {\n const context = useContext(ToastContext);\n if (!context) {\n throw new Error(\"useToast must be used inside a <ToastProvider>.\");\n }\n return context;\n}\n"],"mappings":"A,8KAgCA,IAAaa,GAAA,EAAQb,EAAAA,WAAAA,CAAuC,SAC1D,CAAE,OAAO,UAAW,QAAO,cAAa,YAAW,OAAO,SAAU,YAAW,GAAGc,GAClF,EACA,CACA,OACE,EAAAF,EAAA,IAAA,CAACX,EAAAA,EAAD,CAGE,cAAa,GACb,GAAIa,EACC,MACC,OACA,OACC,QACP,WAAW,WACX,KAAK,OACM,YACX,YAAY,WACZ,aAAa,uBACb,UAAW,CAAC,WAAYC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAE1D,SAAAC,CACM,CAAA,CAEb,CAAC,EA4BKC,GAAA,EAAef,EAAAA,cAAAA,CAAwC,IAAI,EAOjE,SAAgBgB,EAAc,CAAE,YAAgC,CAC9D,GAAM,CAACC,EAAOC,IAAA,EAAYjB,EAAAA,SAAAA,CAAwB,CAAC,CAAC,EAC9CkB,GAAA,EAASjB,EAAAA,OAAAA,CAAO,CAAC,EAEjBkB,GAAA,EAAUjB,EAAAA,YAAAA,CAAa,GAAe,CAC1Ce,EAAU,GAAYG,EAAQ,OAAQ,GAASC,EAAK,KAAOC,CAAE,CAAC,CAChE,EAAG,CAAC,CAAC,EAECC,GAAA,EAAQrB,EAAAA,YAAAA,CA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,EAAUlB,EAAK,EAAE,EAAGe,CAAI,EAC9D,UAAa,CACX,OAAO,aAAaE,CAAK,EACzB,EAAU,QAAUF,GAAQ,KAAK,IAAI,EAAIC,EAC3C,CACF,EAAG,CAACF,EAAQd,EAAK,GAAIkB,CAAS,CAAC,EAE/B,IAAMC,EAAqB,CACzB,KAAMnB,EAAK,KACX,MAAOA,EAAK,MACZ,cAAiBkB,EAAUlB,EAAK,EAAE,EAClC,mBAAsBU,EAAW,EAAI,EACrC,mBAAsBA,EAAW,EAAK,EACtC,YAAeE,EAAW,EAAI,EAC9B,OAAS,GAAU,CACZQ,EAAM,cAAc,SAASA,EAAM,aAA4B,GAClER,EAAW,EAAK,CAEpB,CACF,EAEMS,GAAY,EAAAjC,EAAA,IAAA,CAACC,EAAD,CAAO,GAAI8B,CAAS,CAAA,EAEtC,OACE,EAAA/B,EAAA,IAAA,CAACoB,EAAD,CAAqB,SAAUa,EAC7B,UAAA,EAAAjC,EAAA,IAAA,CAACJ,EAAAA,SAAD,CAAU,SAAUqC,EAClB,UAAA,EAAAjC,EAAA,IAAA,CAACC,EAAD,CACE,GAAI8B,EACJ,YAAanB,EAAK,WACnB,CAAA,CACO,CAAA,CACS,CAAA,CAEzB,CAEA,SAAgBsB,GAA8B,CAC5C,IAAMC,GAAA,EAAUtC,EAAAA,WAAAA,CAAWQ,CAAY,EACvC,GAAI,CAAC8B,EACH,MAAU,MAAM,iDAAiD,EAEnE,OAAOA,CACT,C"}
|
|
@@ -3,7 +3,11 @@ export type ToastTone = "neutral" | "info" | "success" | "warning" | "danger";
|
|
|
3
3
|
export interface ToastProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
tone?: ToastTone;
|
|
5
5
|
title: string;
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Formatted text, such as an emphasised article title. Keep links and
|
|
8
|
+
* actions out: the toast disappears on its own, so use a Banner for those.
|
|
9
|
+
*/
|
|
10
|
+
description?: ReactNode;
|
|
7
11
|
/** Renders a dismiss button. Omit for a toast that only times out. */
|
|
8
12
|
onDismiss?: () => void;
|
|
9
13
|
}
|
|
@@ -12,8 +16,17 @@ export declare const Toast: import("react").ForwardRefExoticComponent<ToastProps
|
|
|
12
16
|
export interface ToastOptions {
|
|
13
17
|
tone?: ToastTone;
|
|
14
18
|
title: string;
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Formatted text; keep links and actions out. It renders inside
|
|
21
|
+
* `ToastProvider`, not where `toast()` was called: it sees only context
|
|
22
|
+
* above the provider and stays as passed. If it throws or suspends, the
|
|
23
|
+
* toast shows its title alone.
|
|
24
|
+
*/
|
|
25
|
+
description?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Milliseconds before it dismisses itself. Defaults to `--toast-duration`.
|
|
28
|
+
* The countdown pauses while the toast is hovered or holds focus.
|
|
29
|
+
*/
|
|
17
30
|
duration?: number;
|
|
18
31
|
}
|
|
19
32
|
interface ToastContextValue {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Toast/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Toast/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAWL,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE9E,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,cAAc,CAAC;IAChE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,wEAAwE;AACxE,eAAO,MAAM,KAAK,uGAwBhB,CAAC;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,UAAU,iBAAiB;IACzB,KAAK,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IACvC,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,+BAuB7D;AAkGD,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C"}
|
|
@@ -3,7 +3,11 @@ export type ToastTone = "neutral" | "info" | "success" | "warning" | "danger";
|
|
|
3
3
|
export interface ToastProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
tone?: ToastTone;
|
|
5
5
|
title: string;
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Formatted text, such as an emphasised article title. Keep links and
|
|
8
|
+
* actions out: the toast disappears on its own, so use a Banner for those.
|
|
9
|
+
*/
|
|
10
|
+
description?: ReactNode;
|
|
7
11
|
/** Renders a dismiss button. Omit for a toast that only times out. */
|
|
8
12
|
onDismiss?: () => void;
|
|
9
13
|
}
|
|
@@ -12,8 +16,17 @@ export declare const Toast: import("react").ForwardRefExoticComponent<ToastProps
|
|
|
12
16
|
export interface ToastOptions {
|
|
13
17
|
tone?: ToastTone;
|
|
14
18
|
title: string;
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Formatted text; keep links and actions out. It renders inside
|
|
21
|
+
* `ToastProvider`, not where `toast()` was called: it sees only context
|
|
22
|
+
* above the provider and stays as passed. If it throws or suspends, the
|
|
23
|
+
* toast shows its title alone.
|
|
24
|
+
*/
|
|
25
|
+
description?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Milliseconds before it dismisses itself. Defaults to `--toast-duration`.
|
|
28
|
+
* The countdown pauses while the toast is hovered or holds focus.
|
|
29
|
+
*/
|
|
17
30
|
duration?: number;
|
|
18
31
|
}
|
|
19
32
|
interface ToastContextValue {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAWL,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE9E,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,cAAc,CAAC;IAChE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,wEAAwE;AACxE,eAAO,MAAM,KAAK,uGAwBhB,CAAC;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,UAAU,iBAAiB;IACzB,KAAK,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IACvC,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,+BAuB7D;AAkGD,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/Message-
|
|
2
|
-
import {
|
|
3
|
-
import { jsx as
|
|
1
|
+
import { t as e } from "../../chunks/Message-d6lqiMQ6.js";
|
|
2
|
+
import { Component as t, Suspense as n, createContext as r, forwardRef as i, useCallback as a, useContext as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
3
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/Toast/index.tsx
|
|
5
|
-
var
|
|
6
|
-
return /* @__PURE__ */
|
|
5
|
+
var p = i(function({ tone: t = "neutral", title: n, description: r, onDismiss: i, role: a = "status", className: o, ...s }, c) {
|
|
6
|
+
return /* @__PURE__ */ d(e, {
|
|
7
|
+
"aria-atomic": !1,
|
|
7
8
|
...s,
|
|
8
9
|
ref: c,
|
|
9
10
|
role: a,
|
|
@@ -17,55 +18,88 @@ var d = n(function({ tone: t = "neutral", title: n, description: r, onDismiss: i
|
|
|
17
18
|
className: ["ds-toast", o].filter(Boolean).join(" "),
|
|
18
19
|
children: r
|
|
19
20
|
});
|
|
20
|
-
}),
|
|
21
|
-
function
|
|
22
|
-
let [t, n] =
|
|
21
|
+
}), m = r(null);
|
|
22
|
+
function h({ children: e }) {
|
|
23
|
+
let [t, n] = u([]), r = l(0), i = a((e) => {
|
|
23
24
|
n((t) => t.filter((t) => t.id !== e));
|
|
24
|
-
}, []),
|
|
25
|
+
}, []), o = a((e) => {
|
|
25
26
|
n((t) => [...t, {
|
|
26
27
|
...e,
|
|
27
|
-
id:
|
|
28
|
+
id: r.current++
|
|
28
29
|
}]);
|
|
29
|
-
}, []),
|
|
30
|
-
toast:
|
|
31
|
-
dismiss:
|
|
32
|
-
}), [
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
value:
|
|
35
|
-
children: [e, /* @__PURE__ */
|
|
30
|
+
}, []), s = c(() => ({
|
|
31
|
+
toast: o,
|
|
32
|
+
dismiss: i
|
|
33
|
+
}), [o, i]);
|
|
34
|
+
return /* @__PURE__ */ f(m.Provider, {
|
|
35
|
+
value: s,
|
|
36
|
+
children: [e, /* @__PURE__ */ d(g, {
|
|
36
37
|
items: t,
|
|
37
|
-
onDismiss:
|
|
38
|
+
onDismiss: i
|
|
38
39
|
})]
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
return e.length === 0 ? null : /* @__PURE__ */
|
|
42
|
+
function g({ items: e, onDismiss: t }) {
|
|
43
|
+
return e.length === 0 ? null : /* @__PURE__ */ d("div", {
|
|
43
44
|
className: "ds-toast-region",
|
|
44
45
|
role: "region",
|
|
45
46
|
"aria-label": "Notifications",
|
|
46
|
-
children: e.map((e) => /* @__PURE__ */
|
|
47
|
+
children: e.map((e) => /* @__PURE__ */ d(v, {
|
|
47
48
|
item: e,
|
|
48
49
|
onDismiss: t
|
|
49
50
|
}, e.id))
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return
|
|
56
|
-
}
|
|
53
|
+
var _ = class extends t {
|
|
54
|
+
state = { failed: !1 };
|
|
55
|
+
static getDerivedStateFromError() {
|
|
56
|
+
return { failed: !0 };
|
|
57
|
+
}
|
|
58
|
+
render() {
|
|
59
|
+
return this.state.failed ? this.props.fallback : this.props.children;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
function v({ item: e, onDismiss: t }) {
|
|
63
|
+
let [r, i] = u(!1), [a, o] = u(!1), c = l(e.duration ?? 5e3), f = r || a;
|
|
64
|
+
s(() => {
|
|
65
|
+
if (f) return;
|
|
66
|
+
let n = c.current, r = Date.now(), i = window.setTimeout(() => t(e.id), n);
|
|
67
|
+
return () => {
|
|
68
|
+
window.clearTimeout(i), c.current = n - (Date.now() - r);
|
|
69
|
+
};
|
|
70
|
+
}, [
|
|
71
|
+
f,
|
|
72
|
+
e.id,
|
|
73
|
+
t
|
|
74
|
+
]);
|
|
75
|
+
let m = {
|
|
57
76
|
tone: e.tone,
|
|
58
77
|
title: e.title,
|
|
59
|
-
|
|
60
|
-
|
|
78
|
+
onDismiss: () => t(e.id),
|
|
79
|
+
onPointerEnter: () => i(!0),
|
|
80
|
+
onPointerLeave: () => i(!1),
|
|
81
|
+
onFocus: () => o(!0),
|
|
82
|
+
onBlur: (e) => {
|
|
83
|
+
e.currentTarget.contains(e.relatedTarget) || o(!1);
|
|
84
|
+
}
|
|
85
|
+
}, h = /* @__PURE__ */ d(p, { ...m });
|
|
86
|
+
return /* @__PURE__ */ d(_, {
|
|
87
|
+
fallback: h,
|
|
88
|
+
children: /* @__PURE__ */ d(n, {
|
|
89
|
+
fallback: h,
|
|
90
|
+
children: /* @__PURE__ */ d(p, {
|
|
91
|
+
...m,
|
|
92
|
+
description: e.description
|
|
93
|
+
})
|
|
94
|
+
})
|
|
61
95
|
});
|
|
62
96
|
}
|
|
63
|
-
function
|
|
64
|
-
let e =
|
|
97
|
+
function y() {
|
|
98
|
+
let e = o(m);
|
|
65
99
|
if (!e) throw Error("useToast must be used inside a <ToastProvider>.");
|
|
66
100
|
return e;
|
|
67
101
|
}
|
|
68
102
|
//#endregion
|
|
69
|
-
export {
|
|
103
|
+
export { p as Toast, h as ToastProvider, y as useToast };
|
|
70
104
|
|
|
71
105
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Message","Toast","forwardRef","rest","className","description","ToastContext","createContext","ToastProvider","items","setItems","useState","nextId","useRef","dismiss","useCallback","current","item","id","toast","options","value","useMemo","children","ToastRegion","TimedToast","
|
|
1
|
+
{"version":3,"file":"index.js","names":["Message","Toast","forwardRef","rest","className","description","ToastContext","createContext","ToastProvider","items","setItems","useState","nextId","useRef","dismiss","useCallback","current","item","id","toast","options","value","useMemo","children","ToastRegion","TimedToast","DescriptionBoundary","Component","hovered","setHovered","focused","setFocused","remaining","paused","left","started","timer","onDismiss","shared","event","titleOnly","Suspense","useToast","context","useContext"],"sources":["../../../src/components/Toast/index.tsx"],"sourcesContent":["import {\n Component,\n createContext,\n forwardRef,\n Suspense,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Message } from \"../../internal/Message\";\nimport \"./style.css\";\n\nexport type ToastTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface ToastProps extends HTMLAttributes<HTMLDivElement> {\n tone?: ToastTone;\n title: string;\n /**\n * Formatted text, such as an emphasised article title. Keep links and\n * actions out: the toast disappears on its own, so use a Banner for those.\n */\n description?: ReactNode;\n /** Renders a dismiss button. Omit for a toast that only times out. */\n onDismiss?: () => void;\n}\n\n/** One fact about something that already happened. Never a question. */\nexport const Toast = forwardRef<HTMLDivElement, ToastProps>(function Toast(\n { tone = \"neutral\", title, description, onDismiss, role = \"status\", className, ...rest },\n ref,\n) {\n return (\n <Message\n // Later changes announce only the text that changed, not the whole\n // toast with its dismiss label.\n aria-atomic={false}\n {...rest}\n ref={ref}\n role={role}\n tone={tone}\n title={title}\n appearance=\"floating\"\n icon=\"auto\"\n onDismiss={onDismiss}\n classPrefix=\"ds-toast\"\n dismissLabel=\"Dismiss notification\"\n className={[\"ds-toast\", className].filter(Boolean).join(\" \")}\n >\n {description}\n </Message>\n );\n});\n\nexport interface ToastOptions {\n tone?: ToastTone;\n title: string;\n /**\n * Formatted text; keep links and actions out. It renders inside\n * `ToastProvider`, not where `toast()` was called: it sees only context\n * above the provider and stays as passed. If it throws or suspends, the\n * toast shows its title alone.\n */\n description?: ReactNode;\n /**\n * Milliseconds before it dismisses itself. Defaults to `--toast-duration`.\n * The countdown pauses while the toast is hovered or holds focus.\n */\n duration?: number;\n}\n\ninterface ToastRecord extends ToastOptions {\n id: number;\n}\n\ninterface ToastContextValue {\n toast: (options: ToastOptions) => void;\n dismiss: (id: number) => void;\n}\n\nconst ToastContext = createContext<ToastContextValue | null>(null);\n\nexport interface ToastProviderProps {\n children: ReactNode;\n}\n\n/** Mount once, near the root. Everything below it can call `useToast()`. */\nexport function ToastProvider({ children }: ToastProviderProps) {\n const [items, setItems] = useState<ToastRecord[]>([]);\n const nextId = useRef(0);\n\n const dismiss = useCallback((id: number) => {\n setItems((current) => current.filter((item) => item.id !== id));\n }, []);\n\n const toast = useCallback((options: ToastOptions) => {\n setItems((current) => [...current, { ...options, id: nextId.current++ }]);\n }, []);\n\n const value = useMemo(() => ({ toast, dismiss }), [toast, dismiss]);\n\n return (\n <ToastContext.Provider value={value}>\n {children}\n <ToastRegion\n items={items}\n onDismiss={dismiss}\n />\n </ToastContext.Provider>\n );\n}\n\nfunction ToastRegion({\n items,\n onDismiss,\n}: {\n items: ToastRecord[];\n onDismiss: (id: number) => void;\n}) {\n if (items.length === 0) {\n return null;\n }\n return (\n <div\n className=\"ds-toast-region\"\n role=\"region\"\n aria-label=\"Notifications\"\n >\n {items.map((item) => (\n <TimedToast\n key={item.id}\n item={item}\n onDismiss={onDismiss}\n />\n ))}\n </div>\n );\n}\n\n/**\n * Provider descriptions render away from the code that called `toast()`. If\n * one throws, this keeps the failure inside its toast instead of unmounting\n * everything below the provider.\n */\nclass DescriptionBoundary extends Component<\n { fallback: ReactNode; children: ReactNode },\n { failed: boolean }\n> {\n state = { failed: false };\n\n static getDerivedStateFromError() {\n return { failed: true };\n }\n\n render() {\n return this.state.failed ? this.props.fallback : this.props.children;\n }\n}\n\nfunction TimedToast({ item, onDismiss }: { item: ToastRecord; onDismiss: (id: number) => void }) {\n const [hovered, setHovered] = useState(false);\n const [focused, setFocused] = useState(false);\n const remaining = useRef(item.duration ?? 5000);\n const paused = hovered || focused;\n\n // A toast never disappears under the pointer or from under focus. The\n // countdown resumes with the time that was left.\n useEffect(() => {\n if (paused) {\n return;\n }\n const left = remaining.current;\n const started = Date.now();\n const timer = window.setTimeout(() => onDismiss(item.id), left);\n return () => {\n window.clearTimeout(timer);\n remaining.current = left - (Date.now() - started);\n };\n }, [paused, item.id, onDismiss]);\n\n const shared: ToastProps = {\n tone: item.tone,\n title: item.title,\n onDismiss: () => onDismiss(item.id),\n onPointerEnter: () => setHovered(true),\n onPointerLeave: () => setHovered(false),\n onFocus: () => setFocused(true),\n onBlur: (event) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) {\n setFocused(false);\n }\n },\n };\n // Shown while the description suspends, or after it throws.\n const titleOnly = <Toast {...shared} />;\n\n return (\n <DescriptionBoundary fallback={titleOnly}>\n <Suspense fallback={titleOnly}>\n <Toast\n {...shared}\n description={item.description}\n />\n </Suspense>\n </DescriptionBoundary>\n );\n}\n\nexport function useToast(): ToastContextValue {\n const context = useContext(ToastContext);\n if (!context) {\n throw new Error(\"useToast must be used inside a <ToastProvider>.\");\n }\n return context;\n}\n"],"mappings":";;;;AAgCA,IAAaC,IAAQC,EAAuC,SAC1D,EAAE,UAAO,WAAW,UAAO,gBAAa,cAAW,UAAO,UAAU,cAAW,GAAGC,KAClF,GACA;CACA,OACE,kBAACH,GAAD;EAGE,eAAa;EACb,GAAIG;EACC;EACC;EACA;EACC;EACP,YAAW;EACX,MAAK;EACM;EACX,aAAY;EACZ,cAAa;EACb,WAAW,CAAC,YAAYC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAE1D,UAAAC;CACM,CAAA;AAEb,CAAC,GA4BKC,IAAeC,EAAwC,IAAI;AAOjE,SAAgBC,EAAc,EAAE,eAAgC;CAC9D,IAAM,CAACC,GAAOC,KAAYC,EAAwB,CAAC,CAAC,GAC9CC,IA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CACtB;AAkCD,sFAAsF;AACtF,eAAO,MAAM,OAAO,yGA+DlB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../src/internal/Message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,uBAAuB,CAAC;AAE/B,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAW3F,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IACjF,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,UAAU,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAkCD,sFAAsF;AACtF,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../src/internal/Message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,uBAAuB,CAAC;AAE/B,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,GA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