@namroodinc/liquid-editorial 0.13.3 → 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.
Files changed (46) hide show
  1. package/README.md +39 -6
  2. package/UPGRADING.md +48 -0
  3. package/dist/chunks/{Message-DNaudg1u.js → Message-d6lqiMQ6.js} +2 -2
  4. package/dist/chunks/{Message-DNaudg1u.js.map → Message-d6lqiMQ6.js.map} +1 -1
  5. package/dist/chunks/{Message-Ce2zjtfz.cjs → Message-yhdaBpaz.cjs} +2 -2
  6. package/dist/chunks/{Message-Ce2zjtfz.cjs.map → Message-yhdaBpaz.cjs.map} +1 -1
  7. package/dist/chunks/ProgressBar-BzdsY7oR.js +120 -0
  8. package/dist/chunks/ProgressBar-BzdsY7oR.js.map +1 -0
  9. package/dist/chunks/ProgressBar-C3F4HPIQ.cjs +2 -0
  10. package/dist/chunks/ProgressBar-C3F4HPIQ.cjs.map +1 -0
  11. package/dist/components/Banner/index.cjs +1 -1
  12. package/dist/components/Banner/index.js +1 -1
  13. package/dist/components/ProgressBar/index.cjs +1 -0
  14. package/dist/components/ProgressBar/index.d.cts +5 -0
  15. package/dist/components/ProgressBar/index.d.cts.map +1 -0
  16. package/dist/components/ProgressBar/index.d.ts +5 -0
  17. package/dist/components/ProgressBar/index.d.ts.map +1 -0
  18. package/dist/components/ProgressBar/index.js +1 -0
  19. package/dist/components/ProgressBar/progress.d.cts +29 -0
  20. package/dist/components/ProgressBar/progress.d.cts.map +1 -0
  21. package/dist/components/ProgressBar/progress.d.ts +29 -0
  22. package/dist/components/ProgressBar/progress.d.ts.map +1 -0
  23. package/dist/components/ProgressBar/style.css +171 -0
  24. package/dist/components/ProgressBar/types.d.cts +35 -0
  25. package/dist/components/ProgressBar/types.d.cts.map +1 -0
  26. package/dist/components/ProgressBar/types.d.ts +35 -0
  27. package/dist/components/ProgressBar/types.d.ts.map +1 -0
  28. package/dist/components/Toast/index.cjs +1 -1
  29. package/dist/components/Toast/index.cjs.map +1 -1
  30. package/dist/components/Toast/index.d.cts +16 -3
  31. package/dist/components/Toast/index.d.cts.map +1 -1
  32. package/dist/components/Toast/index.d.ts +16 -3
  33. package/dist/components/Toast/index.d.ts.map +1 -1
  34. package/dist/components/Toast/index.js +65 -31
  35. package/dist/components/Toast/index.js.map +1 -1
  36. package/dist/index.cjs +1 -1
  37. package/dist/index.d.cts +2 -0
  38. package/dist/index.d.cts.map +1 -1
  39. package/dist/index.d.ts +2 -0
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +17 -16
  42. package/dist/internal/Message.d.cts.map +1 -1
  43. package/dist/internal/Message.d.ts.map +1 -1
  44. package/dist/styles.css +1 -0
  45. package/dist/tokens.css +9 -0
  46. package/package.json +1 -1
@@ -0,0 +1,171 @@
1
+ @layer components {
2
+ .ds-progress {
3
+ /* Resolved per bar, so scoped Slider and Skeleton overrides reach it. */
4
+ --progress-height: var(--progress-height-md, var(--slider-track-height));
5
+ --progress-fill: var(--color-primary);
6
+ --progress-ink: var(--color-text-muted);
7
+ --progress-weight: var(--font-weight-regular);
8
+ --progress-sign: 1;
9
+
10
+ min-inline-size: 0;
11
+ }
12
+
13
+ /* Transforms are physical, so the fill and sweep turn with the text direction. */
14
+ .ds-progress:dir(rtl) {
15
+ --progress-sign: -1;
16
+ }
17
+
18
+ .ds-progress[data-size="sm"] {
19
+ --progress-height: var(--progress-height-sm);
20
+ }
21
+
22
+ .ds-progress[data-size="lg"] {
23
+ --progress-height: var(--progress-height-lg);
24
+ }
25
+
26
+ .ds-progress[data-tone="success"] {
27
+ --progress-fill: var(--color-success);
28
+ --progress-ink: var(--color-success-text);
29
+ --progress-weight: var(--font-weight-semibold);
30
+ }
31
+
32
+ .ds-progress[data-tone="warning"] {
33
+ --progress-fill: var(--color-warning);
34
+ --progress-ink: var(--color-warning-text);
35
+ --progress-weight: var(--font-weight-semibold);
36
+ }
37
+
38
+ .ds-progress[data-tone="danger"] {
39
+ --progress-fill: var(--color-danger);
40
+ --progress-ink: var(--color-danger-text);
41
+ --progress-weight: var(--font-weight-semibold);
42
+ }
43
+
44
+ /* Usage readings match LimitReading's text: warning from 85%, danger at the limit. */
45
+ .ds-progress[data-usage="warning"] {
46
+ --progress-ink: var(--color-warning-text);
47
+ }
48
+
49
+ .ds-progress[data-usage="danger"] {
50
+ --progress-ink: var(--color-danger-text);
51
+ --progress-weight: var(--font-weight-semibold);
52
+ }
53
+
54
+ .ds-progress__header {
55
+ display: flex;
56
+ align-items: baseline;
57
+ gap: var(--space-3);
58
+ }
59
+
60
+ .ds-progress__label {
61
+ min-inline-size: 0;
62
+ color: var(--color-text);
63
+ font-size: var(--font-size-sm);
64
+ font-weight: var(--font-weight-semibold);
65
+ overflow-wrap: break-word;
66
+ }
67
+
68
+ .ds-progress__reading {
69
+ flex: none;
70
+ margin-inline-start: auto;
71
+ color: var(--progress-ink);
72
+ font-family: var(--font-mono);
73
+ font-size: var(--font-size-xs);
74
+ font-variant-numeric: tabular-nums;
75
+ font-weight: var(--progress-weight);
76
+ text-align: end;
77
+ white-space: nowrap;
78
+ }
79
+
80
+ .ds-progress__track {
81
+ --field-paint: var(--field-hover);
82
+
83
+ position: relative;
84
+ overflow: hidden;
85
+ block-size: var(--progress-height);
86
+ border-radius: var(--radius-pill);
87
+ background: var(--field-hover);
88
+ }
89
+
90
+ /* The fill spans the track and moves only by transform, which keeps it off
91
+ * the main thread. A determinate bar slides it back by the unfilled share,
92
+ * and the track clips the rest. */
93
+ .ds-progress__fill {
94
+ position: absolute;
95
+ inset: 0;
96
+ border-radius: inherit;
97
+ transform: translateX(calc(var(--progress-sign) * (var(--progress-width, 0%) - 100%)));
98
+ transition: transform var(--duration-base) var(--ease-standard);
99
+ }
100
+
101
+ .ds-progress__fill::before {
102
+ content: "";
103
+ position: absolute;
104
+ inset-block: 0;
105
+ inset-inline-start: 0;
106
+ inline-size: 100%;
107
+ border-radius: inherit;
108
+ background: var(--progress-fill);
109
+ }
110
+
111
+ .ds-progress[data-tone="usage"] > .ds-progress__track:not([data-indeterminate]) {
112
+ --progress-fill: color-mix(
113
+ in oklch,
114
+ var(--progress-to) var(--progress-mix),
115
+ var(--progress-from)
116
+ );
117
+ }
118
+
119
+ /* An indeterminate bar paints one segment and carries it from just before
120
+ * the inline start to just past the inline end. */
121
+ .ds-progress__track[data-indeterminate] > .ds-progress__fill {
122
+ transition: none;
123
+ animation: ds-progress-sweep var(--progress-sweep-duration, var(--skeleton-duration))
124
+ var(--ease-panel) infinite;
125
+ }
126
+
127
+ .ds-progress__track[data-indeterminate] > .ds-progress__fill::before {
128
+ inline-size: var(--progress-sweep-width);
129
+ }
130
+
131
+ .ds-progress__hint {
132
+ color: var(--color-text-muted);
133
+ font-size: var(--font-size-xs);
134
+ line-height: var(--line-height-body);
135
+ }
136
+
137
+ @keyframes ds-progress-sweep {
138
+ from {
139
+ transform: translateX(calc(var(--progress-sign) * -1 * var(--progress-sweep-width)));
140
+ }
141
+
142
+ to {
143
+ transform: translateX(calc(var(--progress-sign) * 100%));
144
+ }
145
+ }
146
+
147
+ @media (prefers-reduced-motion: reduce) {
148
+ .ds-progress__fill {
149
+ transition: none;
150
+ }
151
+
152
+ /* A still, centred segment reads neither as a value nor as completion. */
153
+ .ds-progress__track[data-indeterminate] > .ds-progress__fill {
154
+ animation: none;
155
+ transform: translateX(calc(var(--progress-sign) * (50% - var(--progress-sweep-width) / 2)));
156
+ }
157
+ }
158
+
159
+ /* Forced colours replace backgrounds with Canvas, so outline the track and
160
+ * paint the fill in the system highlight. */
161
+ @media (forced-colors: active) {
162
+ .ds-progress__track {
163
+ outline: 1px solid canvastext;
164
+ }
165
+
166
+ .ds-progress__fill::before {
167
+ background: highlight;
168
+ forced-color-adjust: none;
169
+ }
170
+ }
171
+ }
@@ -0,0 +1,35 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+ export type ProgressBarSize = "sm" | "md" | "lg";
3
+ export type ProgressBarTone = "primary" | "success" | "warning" | "danger" | "usage";
4
+ /**
5
+ * `className`, `style` and `hidden` apply to the whole component. The ref and
6
+ * every other HTML attribute belong to the progress track.
7
+ */
8
+ export interface ProgressBarProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "role" | "aria-valuemin" | "aria-valuemax" | "aria-valuenow" | "aria-valuetext"> {
9
+ /** Omit for indeterminate progress. Finite values are clamped to the range. */
10
+ value?: number;
11
+ /**
12
+ * Defaults to 100. A maximum of 0 is an empty task and reads as complete. A
13
+ * negative or non-finite maximum makes progress indeterminate.
14
+ */
15
+ max?: number;
16
+ /** Use `aria-label` or `aria-labelledby` when omitting the visible label. */
17
+ label?: ReactNode;
18
+ /** Show the reading in the header. Defaults to whether a visible label is present. */
19
+ showValue?: boolean;
20
+ /**
21
+ * Replaces the visible percentage and supplies `aria-valuetext`. Blank text
22
+ * falls back to the percentage.
23
+ */
24
+ valueText?: string;
25
+ /** Supporting content displayed below the track and linked through `aria-describedby`. */
26
+ hint?: ReactNode;
27
+ /** Defaults to `md`, the Slider track height. */
28
+ size?: ProgressBarSize;
29
+ /**
30
+ * Defaults to `primary`. Use words alongside status tones. `usage` follows
31
+ * LimitReading's colour scale and shows an overage beyond `max`.
32
+ */
33
+ tone?: ProgressBarTone;
34
+ }
35
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../src/components/ProgressBar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACjD,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAErF;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAC5C,cAAc,CAAC,cAAc,CAAC,EAC9B,UAAU,GAAG,MAAM,GAAG,eAAe,GAAG,eAAe,GAAG,eAAe,GAAG,gBAAgB,CAC7F;IACC,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,sFAAsF;IACtF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0FAA0F;IAC1F,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,iDAAiD;IACjD,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB"}
@@ -0,0 +1,35 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+ export type ProgressBarSize = "sm" | "md" | "lg";
3
+ export type ProgressBarTone = "primary" | "success" | "warning" | "danger" | "usage";
4
+ /**
5
+ * `className`, `style` and `hidden` apply to the whole component. The ref and
6
+ * every other HTML attribute belong to the progress track.
7
+ */
8
+ export interface ProgressBarProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "role" | "aria-valuemin" | "aria-valuemax" | "aria-valuenow" | "aria-valuetext"> {
9
+ /** Omit for indeterminate progress. Finite values are clamped to the range. */
10
+ value?: number;
11
+ /**
12
+ * Defaults to 100. A maximum of 0 is an empty task and reads as complete. A
13
+ * negative or non-finite maximum makes progress indeterminate.
14
+ */
15
+ max?: number;
16
+ /** Use `aria-label` or `aria-labelledby` when omitting the visible label. */
17
+ label?: ReactNode;
18
+ /** Show the reading in the header. Defaults to whether a visible label is present. */
19
+ showValue?: boolean;
20
+ /**
21
+ * Replaces the visible percentage and supplies `aria-valuetext`. Blank text
22
+ * falls back to the percentage.
23
+ */
24
+ valueText?: string;
25
+ /** Supporting content displayed below the track and linked through `aria-describedby`. */
26
+ hint?: ReactNode;
27
+ /** Defaults to `md`, the Slider track height. */
28
+ size?: ProgressBarSize;
29
+ /**
30
+ * Defaults to `primary`. Use words alongside status tones. `usage` follows
31
+ * LimitReading's colour scale and shows an overage beyond `max`.
32
+ */
33
+ tone?: ProgressBarTone;
34
+ }
35
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressBar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACjD,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAErF;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAC5C,cAAc,CAAC,cAAc,CAAC,EAC9B,UAAU,GAAG,MAAM,GAAG,eAAe,GAAG,eAAe,GAAG,eAAe,GAAG,gBAAgB,CAC7F;IACC,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,sFAAsF;IACtF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0FAA0F;IAC1F,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,iDAAiD;IACjD,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Message-Ce2zjtfz.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,{...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)(s,{item:e,onDismiss:t},e.id))})}function s({item:e,onDismiss:i}){return(0,t.useEffect)(()=>{let t=window.setTimeout(()=>i(e.id),e.duration??5e3);return()=>window.clearTimeout(t)},[e,i]),(0,n.jsx)(r,{tone:e.tone,title:e.title,description:e.description,onDismiss:()=>i(e.id)})}function c(){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=c;
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?: string;\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 {...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 description?: string;\n /** Milliseconds before it dismisses itself. Defaults to `--toast-duration`. */\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\nfunction TimedToast({ item, onDismiss }: { item: ToastRecord; onDismiss: (id: number) => void }) {\n useEffect(() => {\n const timer = window.setTimeout(() => onDismiss(item.id), item.duration ?? 5000);\n return () => window.clearTimeout(timer);\n }, [item, onDismiss]);\n\n return (\n <Toast\n tone={item.tone}\n title={item.title}\n description={item.description}\n onDismiss={() => onDismiss(item.id)}\n />\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,8KA0BA,IAAaW,GAAA,EAAQX,EAAAA,WAAAA,CAAuC,SAC1D,CAAE,OAAO,UAAW,QAAO,cAAa,YAAW,OAAO,SAAU,YAAW,GAAGY,GAClF,EACA,CACA,OACE,EAAAF,EAAA,IAAA,CAACT,EAAAA,EAAD,CACE,GAAIW,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,EAmBKC,GAAA,EAAeb,EAAAA,cAAAA,CAAwC,IAAI,EAOjE,SAAgBc,EAAc,CAAE,YAAgC,CAC9D,GAAM,CAACC,EAAOC,IAAA,EAAYf,EAAAA,SAAAA,CAAwB,CAAC,CAAC,EAC9CgB,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AgBU,GAA8B,CAC5C,IAAMC,GAAA,EAAU1B,EAAAA,WAAAA,CAAWQ,CAAY,EACvC,GAAI,CAACkB,EACH,MAAU,MAAM,iDAAiD,EAEnE,OAAOA,CACT,C"}
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,GA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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
- description?: string;
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
- description?: string;
16
- /** Milliseconds before it dismisses itself. Defaults to `--toast-duration`. */
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,EASL,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,K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,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
- description?: string;
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
- description?: string;
16
- /** Milliseconds before it dismisses itself. Defaults to `--toast-duration`. */
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,EASL,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,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,wEAAwE;AACxE,eAAO,MAAM,KAAK,uGAqBhB,CAAC;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,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;AA6CD,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C"}
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-DNaudg1u.js";
2
- import { createContext as t, forwardRef as n, useCallback as r, useContext as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
3
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
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 d = n(function({ tone: t = "neutral", title: n, description: r, onDismiss: i, role: a = "status", className: o, ...s }, c) {
6
- return /* @__PURE__ */ l(e, {
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
- }), f = t(null);
21
- function p({ children: e }) {
22
- let [t, n] = c([]), i = s(0), a = r((e) => {
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
- }, []), d = r((e) => {
25
+ }, []), o = a((e) => {
25
26
  n((t) => [...t, {
26
27
  ...e,
27
- id: i.current++
28
+ id: r.current++
28
29
  }]);
29
- }, []), p = o(() => ({
30
- toast: d,
31
- dismiss: a
32
- }), [d, a]);
33
- return /* @__PURE__ */ u(f.Provider, {
34
- value: p,
35
- children: [e, /* @__PURE__ */ l(m, {
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: a
38
+ onDismiss: i
38
39
  })]
39
40
  });
40
41
  }
41
- function m({ items: e, onDismiss: t }) {
42
- return e.length === 0 ? null : /* @__PURE__ */ l("div", {
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__ */ l(h, {
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
- function h({ item: e, onDismiss: t }) {
53
- return a(() => {
54
- let n = window.setTimeout(() => t(e.id), e.duration ?? 5e3);
55
- return () => window.clearTimeout(n);
56
- }, [e, t]), /* @__PURE__ */ l(d, {
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
- description: e.description,
60
- onDismiss: () => t(e.id)
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 g() {
64
- let e = i(f);
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 { d as Toast, p as ToastProvider, g as useToast };
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","useEffect","timer","onDismiss","useToast","context","useContext"],"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?: string;\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 {...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 description?: string;\n /** Milliseconds before it dismisses itself. Defaults to `--toast-duration`. */\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\nfunction TimedToast({ item, onDismiss }: { item: ToastRecord; onDismiss: (id: number) => void }) {\n useEffect(() => {\n const timer = window.setTimeout(() => onDismiss(item.id), item.duration ?? 5000);\n return () => window.clearTimeout(timer);\n }, [item, onDismiss]);\n\n return (\n <Toast\n tone={item.tone}\n title={item.title}\n description={item.description}\n onDismiss={() => onDismiss(item.id)}\n />\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":";;;;AA0BA,IAAaC,IAAQC,EAAuC,SAC1D,EAAE,UAAO,WAAW,UAAO,gBAAa,cAAW,UAAO,UAAU,cAAW,GAAGC,KAClF,GACA;CACA,OACE,kBAACH,GAAD;EACE,GAAIG;EACC;EACC;EACA;EACC;EACP,YAAW;EACX,MAAK;EACM;EACX,aAAY;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iBAAiBW,EAAUX,EAAK,EAAE;CACnC,CAAA;AAEL;AAEA,SAAgBY,IAA8B;CAC5C,IAAMC,IAAUC,EAAWzB,CAAY;CACvC,IAAI,CAACwB,GACH,MAAU,MAAM,iDAAiD;CAEnE,OAAOA;AACT"}
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,CA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,GACF;EAEF,IAAMC,IAAOF,EAAU,SACjBG,IAAU,KAAK,IAAI,GACnBC,IAAQ,OAAO,iBAAiBC,EAAUpB,EAAK,EAAE,GAAGiB,CAAI;EAC9D,aAAa;GAEX,AADA,OAAO,aAAaE,CAAK,GACzB,EAAU,UAAUF,KAAQ,KAAK,IAAI,IAAIC;EAC3C;CACF,GAAG;EAACF;EAAQhB,EAAK;EAAIoB;CAAS,CAAC;CAE/B,IAAMC,IAAqB;EACzB,MAAMrB,EAAK;EACX,OAAOA,EAAK;EACZ,iBAAiBoB,EAAUpB,EAAK,EAAE;EAClC,sBAAsBY,EAAW,EAAI;EACrC,sBAAsBA,EAAW,EAAK;EACtC,eAAeE,EAAW,EAAI;EAC9B,SAAS,MAAU;GACjB,AAAKQ,EAAM,cAAc,SAASA,EAAM,aAA4B,KAClER,EAAW,EAAK;EAEpB;CACF,GAEMS,IAAY,kBAACvC,GAAD,EAAO,GAAIqC,EAAS,CAAA;CAEtC,OACE,kBAACZ,GAAD;EAAqB,UAAUc;EAC7B,UAAA,kBAACC,GAAD;GAAU,UAAUD;GAClB,UAAA,kBAACvC,GAAD;IACE,GAAIqC;IACJ,aAAarB,EAAK;GACnB,CAAA;EACO,CAAA;CACS,CAAA;AAEzB;AAEA,SAAgByB,IAA8B;CAC5C,IAAMC,IAAUC,EAAWtC,CAAY;CACvC,IAAI,CAACqC,GACH,MAAU,MAAM,iDAAiD;CAEnE,OAAOA;AACT"}
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/Icon-3ucBRgrd.cjs"),t=require("./components/Button/index.cjs"),n=require("./chunks/Drawer-DdIH9jpe.cjs"),r=require("./chunks/overlayLayer-iGhuAByk.cjs"),i=require("./components/SideNav/index.cjs"),a=require("./components/TopNav/index.cjs"),o=require("./components/AppShell/index.cjs"),s=require("./components/ButtonGroup/index.cjs"),c=require("./components/Badge/index.cjs"),l=require("./components/LimitReading/index.cjs"),u=require("./components/Field/index.cjs"),d=require("./components/Modal/index.cjs"),f=require("./components/TextField/index.cjs"),p=require("./chunks/RichTextEditor-DU9CVeRD.cjs"),m=require("./components/Popover/index.cjs"),h=require("./components/Menu/index.cjs"),g=require("./components/Skeleton/index.cjs"),_=require("./components/Banner/index.cjs"),v=require("./chunks/LoadState-BXLG-SkQ.cjs"),y=require("./components/FieldAffix/index.cjs"),b=require("./components/SearchField/index.cjs"),x=require("./components/Grid/index.cjs"),S=require("./components/Choice/index.cjs"),C=require("./components/Container/index.cjs"),w=require("./components/SortableList/index.cjs"),T=require("./chunks/EntryPicker-B4dAsObz.cjs"),E=require("./chunks/NumberField-BrWFmPkW.cjs"),D=require("./components/Select/index.cjs"),O=require("./components/Switch/index.cjs"),k=require("./chunks/Slider-BfvNPjRJ.cjs"),A=require("./chunks/ColourField-DFvRASVe.cjs"),j=require("./chunks/DatePicker-ClOqS6oH.cjs"),M=require("./components/TagsInput/index.cjs"),N=require("./components/SelectionCard/index.cjs"),P=require("./chunks/FormEditor-BGzE-rqk.cjs"),F=require("./chunks/Board-CQ1GTuRB.cjs"),I=require("./chunks/Avatar-BY0dAItT.cjs"),L=require("./components/Table/index.cjs"),R=require("./components/Toast/index.cjs"),z=require("./components/SubNav/index.cjs"),B=require("./components/Stepper/index.cjs"),V=require("./components/AssetCard/index.cjs"),H=require("./components/AssetGrid/index.cjs"),U=require("./components/ImageCropper/index.cjs"),W=require("./components/Time/index.cjs"),G=require("./components/Pagination/index.cjs"),K=require("./components/EditLayout/index.cjs"),q=require("./chunks/CollectionView-CIJdNwcq.cjs"),J=require("./components/EditSection/index.cjs"),Y=require("./components/PageHeader/index.cjs"),X=require("./components/MetaList/index.cjs"),Z=require("./chunks/Wizard-B_CPW1V6.cjs");exports.AppShell=o.AppShell,exports.AssetCard=V.AssetCard,exports.AssetCardSkeleton=V.AssetCardSkeleton,exports.AssetGrid=H.AssetGrid,exports.AssetGridEmpty=H.AssetGridEmpty,exports.Avatar=I.t,exports.AvatarGroup=I.n,exports.Badge=c.Badge,exports.Banner=_.Banner,exports.Board=F.t,exports.BoardCard=F.n,exports.BoardColumn=F.r,exports.Button=t.Button,exports.ButtonGroup=s.ButtonGroup,exports.Calendar=j.t,exports.Checkbox=S.Checkbox,exports.CheckboxCard=N.CheckboxCard,exports.ChoiceGroup=S.ChoiceGroup,exports.CollectionEmpty=q.n,exports.CollectionView=q.t,exports.ColourField=A.t,exports.ColourPanel=A.n,exports.Container=C.Container,exports.DateField=j.n,exports.DateRangeField=j.r,exports.Drawer=n.t,exports.EditLayout=K.EditLayout,exports.EditSection=J.EditSection,exports.EntryPicker=T.t,exports.Field=u.Field,exports.FieldAffix=y.FieldAffix,exports.FormEditor=P.t,exports.Grid=x.Grid,exports.GridItem=x.GridItem,exports.Icon=e.t,exports.ImageCropper=U.ImageCropper,exports.LimitReading=l.LimitReading,exports.LoadError=v.r,exports.LoadState=v.t,exports.Menu=h.Menu,exports.MenuItem=h.MenuItem,exports.MenuLabel=h.MenuLabel,exports.MenuSeparator=h.MenuSeparator,exports.MetaList=X.MetaList,exports.Modal=d.Modal,exports.NumberField=E.t,exports.NumberRangeField=E.n,exports.OverlayLayer=r.n,exports.PageHeader=Y.PageHeader,exports.Pagination=G.Pagination,exports.Popover=m.Popover,exports.Radio=S.Radio,exports.RadioCard=N.RadioCard,exports.RangeSlider=k.t,exports.ReviewTable=Z.n,exports.RichTextEditor=p.t,exports.SearchField=b.SearchField,exports.Select=D.Select,exports.SelectionCardGroup=N.SelectionCardGroup,exports.SideNav=i.SideNav,exports.SideNavFooter=i.SideNavFooter,exports.SideNavHeader=i.SideNavHeader,exports.SideNavItem=i.SideNavItem,exports.SideNavSection=i.SideNavSection,exports.Skeleton=g.Skeleton,exports.SkeletonText=g.SkeletonText,exports.Slider=k.n,exports.SortableList=w.SortableList,exports.SortableListItem=w.SortableListItem,exports.Stack=x.Stack,exports.Stepper=B.Stepper,exports.SubNav=z.SubNav,exports.SubNavButton=z.SubNavButton,exports.SubNavItem=z.SubNavItem,exports.Switch=O.Switch,exports.Table=L.Table,exports.TableBody=L.TableBody,exports.TableCell=L.TableCell,exports.TableEmpty=L.TableEmpty,exports.TableFrame=L.TableFrame,exports.TableHead=L.TableHead,exports.TableHeaderCell=L.TableHeaderCell,exports.TableRow=L.TableRow,exports.TableToolbar=L.TableToolbar,exports.TagsInput=M.TagsInput,exports.TextArea=f.TextArea,exports.TextField=f.TextField,exports.Time=W.Time,exports.Toast=R.Toast,exports.ToastProvider=R.ToastProvider,exports.TopNav=a.TopNav,exports.TopNavItem=a.TopNavItem,exports.Wizard=Z.t,exports.cropToBlob=U.cropToBlob,exports.formatAbsoluteDate=W.formatAbsoluteDate,exports.formatAbsoluteTime=W.formatAbsoluteTime,exports.formatIsoDate=j.i,exports.formatRelativeTime=W.formatRelativeTime,exports.iconNames=e.n,exports.icons=e.r,exports.useSideNavCollapsed=i.useSideNavCollapsed,exports.useToast=R.useToast,exports.validateFormValues=P.n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/Icon-3ucBRgrd.cjs"),t=require("./components/Button/index.cjs"),n=require("./chunks/Drawer-DdIH9jpe.cjs"),r=require("./chunks/overlayLayer-iGhuAByk.cjs"),i=require("./components/SideNav/index.cjs"),a=require("./components/TopNav/index.cjs"),o=require("./components/AppShell/index.cjs"),s=require("./components/ButtonGroup/index.cjs"),c=require("./components/Badge/index.cjs"),l=require("./components/LimitReading/index.cjs"),u=require("./components/Field/index.cjs"),d=require("./components/Modal/index.cjs"),f=require("./components/TextField/index.cjs"),p=require("./chunks/RichTextEditor-DU9CVeRD.cjs"),m=require("./components/Popover/index.cjs"),h=require("./components/Menu/index.cjs"),g=require("./components/Skeleton/index.cjs"),_=require("./components/Banner/index.cjs"),v=require("./chunks/LoadState-BXLG-SkQ.cjs"),y=require("./components/FieldAffix/index.cjs"),b=require("./components/SearchField/index.cjs"),x=require("./components/Grid/index.cjs"),S=require("./components/Choice/index.cjs"),C=require("./components/Container/index.cjs"),w=require("./components/SortableList/index.cjs"),T=require("./chunks/EntryPicker-B4dAsObz.cjs"),E=require("./chunks/NumberField-BrWFmPkW.cjs"),D=require("./components/Select/index.cjs"),O=require("./components/Switch/index.cjs"),k=require("./chunks/Slider-BfvNPjRJ.cjs"),A=require("./chunks/ColourField-DFvRASVe.cjs"),j=require("./chunks/DatePicker-ClOqS6oH.cjs"),M=require("./components/TagsInput/index.cjs"),N=require("./components/SelectionCard/index.cjs"),P=require("./chunks/FormEditor-BGzE-rqk.cjs"),F=require("./chunks/Board-CQ1GTuRB.cjs"),I=require("./chunks/Avatar-BY0dAItT.cjs"),L=require("./chunks/ProgressBar-C3F4HPIQ.cjs"),R=require("./components/Table/index.cjs"),z=require("./components/Toast/index.cjs"),B=require("./components/SubNav/index.cjs"),V=require("./components/Stepper/index.cjs"),H=require("./components/AssetCard/index.cjs"),U=require("./components/AssetGrid/index.cjs"),W=require("./components/ImageCropper/index.cjs"),G=require("./components/Time/index.cjs"),K=require("./components/Pagination/index.cjs"),q=require("./components/EditLayout/index.cjs"),J=require("./chunks/CollectionView-CIJdNwcq.cjs"),Y=require("./components/EditSection/index.cjs"),X=require("./components/PageHeader/index.cjs"),Z=require("./components/MetaList/index.cjs"),Q=require("./chunks/Wizard-B_CPW1V6.cjs");exports.AppShell=o.AppShell,exports.AssetCard=H.AssetCard,exports.AssetCardSkeleton=H.AssetCardSkeleton,exports.AssetGrid=U.AssetGrid,exports.AssetGridEmpty=U.AssetGridEmpty,exports.Avatar=I.t,exports.AvatarGroup=I.n,exports.Badge=c.Badge,exports.Banner=_.Banner,exports.Board=F.t,exports.BoardCard=F.n,exports.BoardColumn=F.r,exports.Button=t.Button,exports.ButtonGroup=s.ButtonGroup,exports.Calendar=j.t,exports.Checkbox=S.Checkbox,exports.CheckboxCard=N.CheckboxCard,exports.ChoiceGroup=S.ChoiceGroup,exports.CollectionEmpty=J.n,exports.CollectionView=J.t,exports.ColourField=A.t,exports.ColourPanel=A.n,exports.Container=C.Container,exports.DateField=j.n,exports.DateRangeField=j.r,exports.Drawer=n.t,exports.EditLayout=q.EditLayout,exports.EditSection=Y.EditSection,exports.EntryPicker=T.t,exports.Field=u.Field,exports.FieldAffix=y.FieldAffix,exports.FormEditor=P.t,exports.Grid=x.Grid,exports.GridItem=x.GridItem,exports.Icon=e.t,exports.ImageCropper=W.ImageCropper,exports.LimitReading=l.LimitReading,exports.LoadError=v.r,exports.LoadState=v.t,exports.Menu=h.Menu,exports.MenuItem=h.MenuItem,exports.MenuLabel=h.MenuLabel,exports.MenuSeparator=h.MenuSeparator,exports.MetaList=Z.MetaList,exports.Modal=d.Modal,exports.NumberField=E.t,exports.NumberRangeField=E.n,exports.OverlayLayer=r.n,exports.PageHeader=X.PageHeader,exports.Pagination=K.Pagination,exports.Popover=m.Popover,exports.ProgressBar=L.t,exports.Radio=S.Radio,exports.RadioCard=N.RadioCard,exports.RangeSlider=k.t,exports.ReviewTable=Q.n,exports.RichTextEditor=p.t,exports.SearchField=b.SearchField,exports.Select=D.Select,exports.SelectionCardGroup=N.SelectionCardGroup,exports.SideNav=i.SideNav,exports.SideNavFooter=i.SideNavFooter,exports.SideNavHeader=i.SideNavHeader,exports.SideNavItem=i.SideNavItem,exports.SideNavSection=i.SideNavSection,exports.Skeleton=g.Skeleton,exports.SkeletonText=g.SkeletonText,exports.Slider=k.n,exports.SortableList=w.SortableList,exports.SortableListItem=w.SortableListItem,exports.Stack=x.Stack,exports.Stepper=V.Stepper,exports.SubNav=B.SubNav,exports.SubNavButton=B.SubNavButton,exports.SubNavItem=B.SubNavItem,exports.Switch=O.Switch,exports.Table=R.Table,exports.TableBody=R.TableBody,exports.TableCell=R.TableCell,exports.TableEmpty=R.TableEmpty,exports.TableFrame=R.TableFrame,exports.TableHead=R.TableHead,exports.TableHeaderCell=R.TableHeaderCell,exports.TableRow=R.TableRow,exports.TableToolbar=R.TableToolbar,exports.TagsInput=M.TagsInput,exports.TextArea=f.TextArea,exports.TextField=f.TextField,exports.Time=G.Time,exports.Toast=z.Toast,exports.ToastProvider=z.ToastProvider,exports.TopNav=a.TopNav,exports.TopNavItem=a.TopNavItem,exports.Wizard=Q.t,exports.cropToBlob=W.cropToBlob,exports.formatAbsoluteDate=G.formatAbsoluteDate,exports.formatAbsoluteTime=G.formatAbsoluteTime,exports.formatIsoDate=j.i,exports.formatRelativeTime=G.formatRelativeTime,exports.iconNames=e.n,exports.icons=e.r,exports.useSideNavCollapsed=i.useSideNavCollapsed,exports.useToast=z.useToast,exports.validateFormValues=P.n;
package/dist/index.d.cts CHANGED
@@ -26,6 +26,8 @@ export { Field } from "./components/Field/index.cjs";
26
26
  export type { FieldBinding, FieldLimit, FieldLimitOptions, FieldProps, FieldRenderProps, FieldSize, } from "./components/Field/index.cjs";
27
27
  export { LimitReading } from "./components/LimitReading/index.cjs";
28
28
  export type { LimitReadingProps, LimitReadingSize, LimitReadingDisplay, LimitReadingTone, } from "./components/LimitReading/index.cjs";
29
+ export { ProgressBar } from "./components/ProgressBar/index.cjs";
30
+ export type { ProgressBarProps, ProgressBarSize, ProgressBarTone } from "./components/ProgressBar/index.cjs";
29
31
  export { TextField, TextArea } from "./components/TextField/index.cjs";
30
32
  export type { TextFieldProps, TextAreaProps } from "./components/TextField/index.cjs";
31
33
  export { Checkbox, Radio, ChoiceGroup } from "./components/Choice/index.cjs";