@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
package/README.md CHANGED
@@ -77,7 +77,7 @@ Field supplies labels and validation relationships. Button supplies action styli
77
77
 
78
78
  ## Component catalogue
79
79
 
80
- All **51 families** and **103 runtime exports** are listed below, including compound components, hooks and helpers. Each family links to a practical guide and its source stories. Run Storybook locally for interactive examples; this README does not assume a hosted Storybook. Exported TypeScript declarations provide the detailed prop reference.
80
+ All **52 families** and **104 runtime exports** are listed below, including compound components, hooks and helpers. Each family links to a practical guide and its source stories. Run Storybook locally for interactive examples; this README does not assume a hosted Storybook. Exported TypeScript declarations provide the detailed prop reference.
81
81
 
82
82
  ### Collection and editing catalogue
83
83
 
@@ -106,6 +106,7 @@ All **51 families** and **103 runtime exports** are listed below, including comp
106
106
  | [Icon](#icon) | `Icon`, `icons`, `iconNames` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Icon/Icon.stories.tsx) |
107
107
  | [Avatar](#avatar) | `Avatar`, `AvatarGroup` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Avatar/Avatar.stories.tsx) |
108
108
  | [Skeleton](#skeleton) | `Skeleton`, `SkeletonText` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Skeleton/Skeleton.stories.tsx) |
109
+ | [ProgressBar](#progressbar) | `ProgressBar` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/ProgressBar/ProgressBar.stories.tsx) |
109
110
  | [Time](#time) | `Time`, `formatRelativeTime`, `formatAbsoluteDate`, `formatAbsoluteTime` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Time/Time.stories.tsx) |
110
111
 
111
112
  ### Fields and editors catalogue
@@ -416,7 +417,9 @@ parent removes the banner. The button is named "Dismiss" by default; pass
416
417
  can be dismissed. Empty slots reserve no space: `false`, `null`, `""`, `true`,
417
418
  empty arrays and empty fragments render no body or action row, and neither
418
419
  does a `0` in `actions` (from `count && <Button />`). A `0` body still renders.
419
- An icon name outside the curated set renders no icon.
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.
420
423
 
421
424
  Warning and danger default to `role="alert"`; the other tones use
422
425
  `role="status"`. The default comes from the tone a banner mounts with and stays
@@ -429,13 +432,15 @@ render is not reliably announced by live regions, so keep the message visible.
429
432
  Style parts through `.ds-banner__icon`, `__body`, `__title`, `__description`,
430
433
  `__actions` and `__dismiss`. The `ds-message__*` classes belong to the internal
431
434
  renderer that Banner and Toast share with their tone styles, icons and dismiss
432
- control, and also match toasts. Use Banner for persistent content and actions;
433
- Toast remains a brief, text-only notification.
435
+ control, and also match toasts. Use Banner for persistent content and actions.
436
+ Toast is a brief notification.
434
437
 
435
438
  ### Toast
436
439
 
437
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`.
438
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
+
439
444
  ```tsx
440
445
  import { Button, Toast, ToastProvider, useToast } from "@namroodinc/liquid-editorial";
441
446
 
@@ -459,12 +464,20 @@ export function Notifications() {
459
464
  // Standalone display, with dismissal/timing managed by its parent:
460
465
  <Toast
461
466
  title="Upload complete"
462
- description="The cover is ready."
467
+ description={
468
+ <>
469
+ The cover for <strong>Morning edition</strong> is ready.
470
+ </>
471
+ }
463
472
  tone="success"
464
473
  />;
465
474
  ```
466
475
 
467
- 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.
468
481
 
469
482
  ### Badge
470
483
 
@@ -584,6 +597,26 @@ import { Skeleton, SkeletonText } from "@namroodinc/liquid-editorial";
584
597
 
585
598
  Individual Skeleton placeholders are hidden from assistive technology. SkeletonText provides a busy status named “Loading”; its label can be overridden. The containing UI owns loading state and the switch to real content.
586
599
 
600
+ ### ProgressBar
601
+
602
+ Show progress for a task or usage for a quota. Import `ProgressBar` and its `ProgressBarProps`, `ProgressBarSize`, and `ProgressBarTone` types from the package root or `components/ProgressBar`.
603
+
604
+ ```tsx
605
+ import { ProgressBar } from "@namroodinc/liquid-editorial";
606
+
607
+ <ProgressBar label="Uploading images" value={12} max={20} hint="12 of 20 uploaded" />;
608
+ <ProgressBar label="Processing video" />;
609
+ <ProgressBar label="Storage used" value={7.2} max={10} tone="usage" valueText="7.2 of 10 GB" />;
610
+ ```
611
+
612
+ The default size is `md` and the default tone is `primary`. Choose `sm` for compact rows or `lg` for page-level tasks. Pair `success`, `warning`, and `danger` with status wording in `valueText` or `hint`. `usage` follows LimitReading’s scale. Its fill mixes from success through warning to danger, and its reading takes warning ink from 85% and danger at the limit. A usage reading also shows an overage, such as 120%, while the fill and `aria-valuenow` stop at `max`.
613
+
614
+ The range starts at zero and `max` defaults to 100. The bar clamps finite values to the range. Omit `value` when progress is unknown. Non-finite values and negative or non-finite maxima also render an indeterminate bar. A `max` of 0 is an empty task and reads as complete. The visual reading defaults to a percentage beside the label. It shows at least 1% once work starts and at most 99% until it finishes. Use `showValue` to control its visibility and `valueText` to supply a custom visual and accessible reading. Blank `valueText` falls back to the percentage. Pass `aria-label` or `aria-labelledby` when the label is visually absent.
615
+
616
+ `className`, `style`, and `hidden` apply to the whole component. The ref and other HTML attributes belong to the track. The hint is linked to it as an accessible description. The owning application handles live announcements, cancellation, and retry.
617
+
618
+ The fill and sweep start at the inline edge for the current text direction. With reduced motion, an indeterminate bar shows a still, centred segment. In forced-colours mode, the track is outlined and the fill uses the system highlight colour.
619
+
587
620
  ### Time
588
621
 
589
622
  A semantic time element with relative text and an absolute tooltip on hover/focus, sharing Avatar's tooltip behaviour (pointer transfer, keyboard focus, Escape). `format` defaults to `"auto"`; `"absolute"` always displays the date. Relative formatting ages to an absolute date after a week, and future dates display as absolute dates.
package/UPGRADING.md CHANGED
@@ -2,6 +2,54 @@
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
+
35
+ ## 0.13.4
36
+
37
+ ### Changes
38
+
39
+ `ProgressBar` displays task progress and quota usage with three track heights, five tones, and determinate and indeterminate states. It follows the active theme, text direction, reduced-motion preference, and forced-colours mode. The `usage` tone shares LimitReading’s fill scale and reading colours, and shows an overage beyond `max`.
40
+
41
+ ### Adoption
42
+
43
+ Import `ProgressBar` from the package root or `@namroodinc/liquid-editorial/components/ProgressBar` and load the package stylesheet. Supply a visible `label` or an ARIA name. Set `value` and, for a range other than 0–100, `max`. Omit `value` while the total is unknown. A `max` of 0 reads as complete, so `value={done} max={total}` needs no special case for an empty task. Use `valueText` for custom units or status wording and `hint` for supporting details. Blank `valueText` falls back to the percentage. Put layout `className`, `style`, and `hidden` on the component; they apply to the label, track and hint together. The ref, `id`, ARIA and data attributes go to the track. The application owns any live announcements.
44
+
45
+ ### Compatibility
46
+
47
+ The component and the `--progress-height-sm`, `--progress-height-lg`, and `--progress-sweep-width` tokens are additive. The heights are 4px, 6px, and 8px at any root font size. Wherever a bar renders, including theme and subtree overrides, the `md` height follows `--slider-track-height` and the sweep duration follows `--skeleton-duration`. Set `--progress-height-md` or `--progress-sweep-duration` to override either one.
48
+
49
+ ### Verification
50
+
51
+ Check the accessible name, value, and optional hint in your rendered task UI. Check the fill at zero, at a partial value, and at completion in both themes. Check that a nearly finished task reads 99% rather than 100%. In RTL, check that the fill and sweep start at the inline start. With reduced motion emulated, check that an indeterminate bar shows a still, centred segment. With forced colours emulated, check that the track is outlined and the fill is visible.
52
+
5
53
  ## 0.13.3
6
54
 
7
55
  ## 0.13.2
@@ -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-DNaudg1u.js.map
70
+ //# sourceMappingURL=Message-d6lqiMQ6.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Message-DNaudg1u.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","role","className","Icon","title","children","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 // Floating notifications retain Toast's text-only span; banners support rich blocks.\n const Description = appearance === \"floating\" ? \"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,IAAMC,IAAOD,MAAS,SAASZ,EAAUc,KAAQF;CAEjD,OAAO,OAAO,OAAOb,GAAOc,CAAI,IAAIA,IAAO,KAAA;AAC7C;AAEA,IAAME,KAAY,MAChBD,MAAS,YAAYA,MAAS,YAAY,UAAU,UAGzCE,IAAUC,EAAyC,SAC9D,EACE,UAAO,WACP,gBAAa,UACb,UACA,SACA,YACA,cACA,kBAAe,WACf,gBACA,SACA,cACA,aACA,GAAGC,KAEL,GACA;CAGA,IAAM,CAACC,KAAeC,QAAeL,EAASD,CAAI,CAAC,GAC7CO,IAAWV,EAAYC,GAAME,CAAI,GACjCQ,KAAa,MACjB,CAAC,eAAeC,KAAQC,KAAe,GAAGA,EAAY,IAAID,GAAM,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,GAEtFE,IAAcC,MAAe,aAAa,SAAS;CAEzD,OACE,kBAAC,OAAD;EACO;EACL,MAAMC,KAAQR;EACd,aAAWL,MAAS,YAAY,KAAA,IAAYA;EAC5C,mBAAiBY;EACjB,WAAW,CAAC,cAAcE,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAC7D,GAAIV;EANN,UAAA;GAQGG,KACC,kBAACQ,GAAD;IACE,MAAMR;IACN,MAAM;IACN,WAAWC,EAAU,MAAM;GAC5B,CAAA;GAEH,kBAAC,OAAD;IAAK,WAAW,GAAGA,EAAU,MAAM,EAAE;IAArC,UAAA;KACE,kBAAC,QAAD;MAAM,WAAWA,EAAU,OAAO;MAAI,UAAAQ;KAAY,CAAA;KACjDtB,EAAQuB,CAAQ,KACf,kBAACN,GAAD;MAAa,WAAWH,EAAU,aAAa;MAAI;KAAsB,CAAA;KAE1EZ,EAAWsB,CAAO,KAAK,kBAAC,OAAD;MAAK,WAAWV,EAAU,SAAS;MAAI,UAAAU;KAAa,CAAA;IACzE;;GACJC,KACC,kBAACC,GAAD;IACE,SAAQ;IACR,MAAK;IACL,YAAA;IACA,WAAU;IACV,WAAW,GAAGZ,EAAU,SAAS,EAAE;IACnC,cAAYa;IACZ,SAASF;GACV,CAAA;EAEA;;AAET,CAAC"}
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,IAAMC,IAAOD,MAAS,SAASZ,EAAUc,KAAQF;CAEjD,OAAO,OAAO,OAAOb,GAAOc,CAAI,IAAIA,IAAO,KAAA;AAC7C;AAEA,IAAME,KAAY,MAChBD,MAAS,YAAYA,MAAS,YAAY,UAAU,UAGzCE,IAAUC,EAAyC,SAC9D,EACE,UAAO,WACP,gBAAa,UACb,UACA,SACA,YACA,cACA,kBAAe,WACf,gBACA,SACA,cACA,aACA,GAAGC,KAEL,GACA;CAGA,IAAM,CAACC,KAAeC,QAAeL,EAASD,CAAI,CAAC,GAC7CO,IAAWV,EAAYC,GAAME,CAAI,GACjCQ,KAAa,MACjB,CAAC,eAAeC,KAAQC,KAAe,GAAGA,EAAY,IAAID,GAAM,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,GAGtFE,IAAcC,MAAe,eADpB,OAAOC,KAAa,YAAY,OAAOA,KAAa,YACT,SAAS;CAEnE,OACE,kBAAC,OAAD;EACO;EACL,MAAMC,KAAQT;EACd,aAAWL,MAAS,YAAY,KAAA,IAAYA;EAC5C,mBAAiBY;EACjB,WAAW,CAAC,cAAcG,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAC7D,GAAIX;EANN,UAAA;GAQGG,KACC,kBAACS,GAAD;IACE,MAAMT;IACN,MAAM;IACN,WAAWC,EAAU,MAAM;GAC5B,CAAA;GAEH,kBAAC,OAAD;IAAK,WAAW,GAAGA,EAAU,MAAM,EAAE;IAArC,UAAA;KACE,kBAAC,QAAD;MAAM,WAAWA,EAAU,OAAO;MAAI,UAAAS;KAAY,CAAA;KACjDvB,EAAQmB,CAAQ,KACf,kBAACF,GAAD;MAAa,WAAWH,EAAU,aAAa;MAAI;KAAsB,CAAA;KAE1EZ,EAAWsB,CAAO,KAAK,kBAAC,OAAD;MAAK,WAAWV,EAAU,SAAS;MAAI,UAAAU;KAAa,CAAA;IACzE;;GACJC,KACC,kBAACC,GAAD;IACE,SAAQ;IACR,MAAK;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`?`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-Ce2zjtfz.cjs.map
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-Ce2zjtfz.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","role","className","title","children","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 // Floating notifications retain Toast's text-only span; banners support rich blocks.\n const Description = appearance === \"floating\" ? \"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,CAC/C,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A,KAAA,CAAC,MAAD,CACO,MACL,KAAMwB,GAAQP,EACd,YAAWJ,IAAS,UAAY,IAAA,GAAYA,EAC5C,kBAAiBU,EACjB,UAAW,CAAC,aAAcE,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAC7D,GAAIT,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,SAAAO,CAAY,CAAA,EACjDnB,EAAQoB,CAAQ,IACf,EAAA3B,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
+ {"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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AAG,EAGtFE,EAAcC,IAAe,aADpB,OAAOC,GAAa,UAAY,OAAOA,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"}
@@ -0,0 +1,120 @@
1
+ import { n as e } from "./limit-s9zfxIMC.js";
2
+ import { Stack as t } from "../components/Grid/index.js";
3
+ import { forwardRef as n, useId as r } from "react";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ //#region src/components/ProgressBar/progress.ts
6
+ function o(e, t) {
7
+ if (e === void 0 || !Number.isFinite(e) || !Number.isFinite(t) || t < 0) return;
8
+ if (t === 0) return {
9
+ current: 0,
10
+ percent: 100,
11
+ ratio: 1
12
+ };
13
+ let n = Math.min(Math.max(e, 0), t);
14
+ return {
15
+ current: n,
16
+ percent: n / t * 100,
17
+ ratio: e / t
18
+ };
19
+ }
20
+ function s(e) {
21
+ let t = Math.round(e);
22
+ return e > 100 ? `${Math.max(t, 101)}%` : `${e > 0 && e < 100 ? Math.min(Math.max(t, 1), 99) : t}%`;
23
+ }
24
+ function c(t, { max: n, usesUsageTone: r, valueText: i }) {
25
+ let a = i?.trim() ? i : void 0;
26
+ if (!t) return {
27
+ reading: a,
28
+ valueText: a,
29
+ usage: void 0
30
+ };
31
+ let o = s(r ? Math.max(t.percent, t.ratio * 100) : t.percent), c = n === 0 || r && t.ratio > 1;
32
+ return {
33
+ reading: a ?? o,
34
+ valueText: a ?? (c ? o : void 0),
35
+ usage: r ? e({
36
+ count: t.ratio,
37
+ max: 1
38
+ }) : void 0
39
+ };
40
+ }
41
+ function l(e, t) {
42
+ let n = { "--progress-width": `${e}%` };
43
+ if (!t) return n;
44
+ let r = e <= 60;
45
+ return {
46
+ ...n,
47
+ "--progress-mix": `${r ? e / 60 * 100 : (e - 60) / 40 * 100}%`,
48
+ "--progress-from": r ? "var(--color-success)" : "var(--color-warning)",
49
+ "--progress-to": r ? "var(--color-warning)" : "var(--color-danger)"
50
+ };
51
+ }
52
+ //#endregion
53
+ //#region src/components/ProgressBar/index.tsx
54
+ function u(e) {
55
+ return typeof e == "string" ? e.trim() !== "" : e != null && typeof e != "boolean";
56
+ }
57
+ function d({ label: e, labelId: t, reading: n, showValue: r = !!t }) {
58
+ let o = r && u(n);
59
+ return !t && !o ? null : /* @__PURE__ */ a("div", {
60
+ className: "ds-progress__header",
61
+ children: [t && /* @__PURE__ */ i("span", {
62
+ className: "ds-progress__label",
63
+ id: t,
64
+ children: e
65
+ }), o && /* @__PURE__ */ i("span", {
66
+ className: "ds-progress__reading",
67
+ "aria-hidden": "true",
68
+ children: n
69
+ })]
70
+ });
71
+ }
72
+ var f = n(function({ value: e, max: n = 100, label: s, showValue: f, valueText: p, hint: m, size: h = "md", tone: g = "primary", className: _, style: v, hidden: y, "aria-label": b, "aria-labelledby": x, "aria-describedby": S, ...C }, w) {
73
+ let T = r(), E = u(s) ? `${T}-label` : void 0, D = u(m) ? `${T}-hint` : void 0, O = g === "usage", k = o(e, n), A = c(k, {
74
+ max: n,
75
+ usesUsageTone: O,
76
+ valueText: p
77
+ });
78
+ return /* @__PURE__ */ a(t, {
79
+ className: ["ds-progress", _].filter(Boolean).join(" "),
80
+ style: v,
81
+ hidden: y,
82
+ gap: "sm",
83
+ "data-size": h,
84
+ "data-tone": g,
85
+ "data-usage": A.usage,
86
+ children: [
87
+ /* @__PURE__ */ i(d, {
88
+ label: s,
89
+ labelId: E,
90
+ reading: A.reading,
91
+ showValue: f
92
+ }),
93
+ /* @__PURE__ */ i("div", {
94
+ ...C,
95
+ ref: w,
96
+ className: "ds-progress__track",
97
+ style: k && l(k.percent, O),
98
+ "data-indeterminate": !k || void 0,
99
+ role: "progressbar",
100
+ "aria-label": b,
101
+ "aria-labelledby": x || (b ? void 0 : E),
102
+ "aria-describedby": [S, D].filter(Boolean).join(" ") || void 0,
103
+ "aria-valuemin": k && 0,
104
+ "aria-valuemax": k && n,
105
+ "aria-valuenow": k?.current,
106
+ "aria-valuetext": A.valueText,
107
+ children: /* @__PURE__ */ i("span", { className: "ds-progress__fill" })
108
+ }),
109
+ D && /* @__PURE__ */ i("div", {
110
+ className: "ds-progress__hint",
111
+ id: D,
112
+ children: m
113
+ })
114
+ ]
115
+ });
116
+ });
117
+ //#endregion
118
+ export { f as t };
119
+
120
+ //# sourceMappingURL=ProgressBar-BzdsY7oR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressBar-BzdsY7oR.js","names":["limitTone","readProgress","value","max","current","formatPercent","rounded","percent","describeProgress","customText","valueText","progress","percentText","usesUsageTone","derivesWrongPercent","progressStyle","width","isBelowWarning","hasContent","node","ProgressHeader","labelId","showsReading","showValue","reading","label","ProgressBar","forwardRef","ariaLabel","labelledBy","describedBy","rest","id","useId","hintId","hint","tone","Stack","className","size"],"sources":["../../src/components/ProgressBar/progress.ts","../../src/components/ProgressBar/index.tsx"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport { limitTone } from \"../LimitReading/limit\";\n\nexport interface Progress {\n /** The value clamped to the range, for `aria-valuenow`. */\n current: number;\n /** The clamped fill, from 0 to 100. */\n percent: number;\n /** The unclamped share of the range, so usage can show an overage. */\n ratio: number;\n}\n\n/** A zero range is an empty task, so it is complete. Other unusable input is indeterminate. */\nexport function readProgress(value: number | undefined, max: number): Progress | undefined {\n if (value === undefined || !Number.isFinite(value) || !Number.isFinite(max) || max < 0) {\n return undefined;\n }\n if (max === 0) {\n return { current: 0, percent: 100, ratio: 1 };\n }\n\n const current = Math.min(Math.max(value, 0), max);\n return { current, percent: (current / max) * 100, ratio: value / max };\n}\n\n/** Rounds without reporting a started task as 0%, an unfinished one as 100%, or an overage as 100%. */\nfunction formatPercent(percent: number) {\n const rounded = Math.round(percent);\n if (percent > 100) {\n return `${Math.max(rounded, 101)}%`;\n }\n return `${percent > 0 && percent < 100 ? Math.min(Math.max(rounded, 1), 99) : rounded}%`;\n}\n\ninterface ReadingOptions {\n max: number;\n usesUsageTone: boolean;\n valueText: string | undefined;\n}\n\n/** The visible reading, the accessible value text, and the usage level. Blank text is ignored. */\nexport function describeProgress(\n progress: Progress | undefined,\n { max, usesUsageTone, valueText }: ReadingOptions,\n) {\n const customText = valueText?.trim() ? valueText : undefined;\n if (!progress) {\n return { reading: customText, valueText: customText, usage: undefined };\n }\n\n // Usage shows an overage; the fill and aria-valuenow stay within the range.\n const percentText = formatPercent(\n usesUsageTone ? Math.max(progress.percent, progress.ratio * 100) : progress.percent,\n );\n // Assistive technology derives a percentage from the range unless value text replaces it.\n const derivesWrongPercent = max === 0 || (usesUsageTone && progress.ratio > 1);\n return {\n reading: customText ?? percentText,\n valueText: customText ?? (derivesWrongPercent ? percentText : undefined),\n // LimitReading's thresholds: warning from 85% and danger at or above the limit.\n usage: usesUsageTone ? limitTone({ count: progress.ratio, max: 1 }) : undefined,\n };\n}\n\nexport function progressStyle(percent: number, usesUsageTone: boolean): CSSProperties {\n const width = { \"--progress-width\": `${percent}%` };\n if (!usesUsageTone) {\n return width as CSSProperties;\n }\n\n const isBelowWarning = percent <= 60;\n return {\n ...width,\n \"--progress-mix\": `${isBelowWarning ? (percent / 60) * 100 : ((percent - 60) / 40) * 100}%`,\n \"--progress-from\": isBelowWarning ? \"var(--color-success)\" : \"var(--color-warning)\",\n \"--progress-to\": isBelowWarning ? \"var(--color-warning)\" : \"var(--color-danger)\",\n } as CSSProperties;\n}\n","import { forwardRef, useId, type ReactNode } from \"react\";\nimport { Stack } from \"../Grid\";\nimport { describeProgress, progressStyle, readProgress } from \"./progress\";\nimport type { ProgressBarProps } from \"./types\";\nimport \"./style.css\";\n\nexport type { ProgressBarProps, ProgressBarSize, ProgressBarTone } from \"./types\";\n\nfunction hasContent(node: ReactNode) {\n return typeof node === \"string\" ? node.trim() !== \"\" : node != null && typeof node !== \"boolean\";\n}\n\ninterface ProgressHeaderProps extends Pick<ProgressBarProps, \"label\" | \"showValue\"> {\n labelId: string | undefined;\n reading: string | undefined;\n}\n\nfunction ProgressHeader({\n label,\n labelId,\n reading,\n showValue = Boolean(labelId),\n}: ProgressHeaderProps) {\n const showsReading = showValue && hasContent(reading);\n if (!labelId && !showsReading) {\n return null;\n }\n\n return (\n <div className=\"ds-progress__header\">\n {labelId && (\n <span\n className=\"ds-progress__label\"\n id={labelId}\n >\n {label}\n </span>\n )}\n {showsReading && (\n <span\n className=\"ds-progress__reading\"\n aria-hidden=\"true\"\n >\n {reading}\n </span>\n )}\n </div>\n );\n}\n\n/** A passive reading of task progress. The owning application manages announcements. */\nexport const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(function ProgressBar(\n {\n value,\n max = 100,\n label,\n showValue,\n valueText,\n hint,\n size = \"md\",\n tone = \"primary\",\n className,\n style,\n hidden,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": labelledBy,\n \"aria-describedby\": describedBy,\n ...rest\n },\n ref,\n) {\n const id = useId();\n const labelId = hasContent(label) ? `${id}-label` : undefined;\n const hintId = hasContent(hint) ? `${id}-hint` : undefined;\n const usesUsageTone = tone === \"usage\";\n const progress = readProgress(value, max);\n const reading = describeProgress(progress, { max, usesUsageTone, valueText });\n\n return (\n <Stack\n className={[\"ds-progress\", className].filter(Boolean).join(\" \")}\n style={style}\n hidden={hidden}\n gap=\"sm\"\n data-size={size}\n data-tone={tone}\n data-usage={reading.usage}\n >\n <ProgressHeader\n label={label}\n labelId={labelId}\n reading={reading.reading}\n showValue={showValue}\n />\n <div\n {...rest}\n ref={ref}\n className=\"ds-progress__track\"\n style={progress && progressStyle(progress.percent, usesUsageTone)}\n data-indeterminate={!progress || undefined}\n role=\"progressbar\"\n aria-label={ariaLabel}\n aria-labelledby={labelledBy || (ariaLabel ? undefined : labelId)}\n aria-describedby={[describedBy, hintId].filter(Boolean).join(\" \") || undefined}\n aria-valuemin={progress && 0}\n aria-valuemax={progress && max}\n aria-valuenow={progress?.current}\n aria-valuetext={reading.valueText}\n >\n <span className=\"ds-progress__fill\" />\n </div>\n {hintId && (\n <div\n className=\"ds-progress__hint\"\n id={hintId}\n >\n {hint}\n </div>\n )}\n </Stack>\n );\n});\n"],"mappings":";;;;;AAaA,SAAgBC,EAAa,GAA2B,GAAmC;CACzF,IAAIC,MAAU,KAAA,KAAa,CAAC,OAAO,SAASA,CAAK,KAAK,CAAC,OAAO,SAASC,CAAG,KAAKA,IAAM,GACnF;CAEF,IAAIA,MAAQ,GACV,OAAO;EAAE,SAAS;EAAG,SAAS;EAAK,OAAO;CAAE;CAG9C,IAAMC,IAAU,KAAK,IAAI,KAAK,IAAIF,GAAO,CAAC,GAAGC,CAAG;CAChD,OAAO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B,CAACS,GAAaI,CAAM,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;IACrE,iBAAevB,KAAY;IAC3B,iBAAeA,KAAYR;IAC3B,iBAAeQ,GAAU;IACzB,kBAAgBa,EAAQ;IAExB,UAAA,kBAAC,QAAD,EAAM,WAAU,oBAAqB,CAAA;GAClC,CAAA;GACJU,KACC,kBAAC,OAAD;IACE,WAAU;IACV,IAAIA;IAEH,UAAAC;GACE,CAAA;EAEF;;AAEX,CAAC"}
@@ -0,0 +1,2 @@
1
+ const e=require("./limit-BNo4dlRj.cjs"),t=require("../components/Grid/index.cjs");let n=require("react"),r=require("react/jsx-runtime");function i(e,t){if(e===void 0||!Number.isFinite(e)||!Number.isFinite(t)||t<0)return;if(t===0)return{current:0,percent:100,ratio:1};let n=Math.min(Math.max(e,0),t);return{current:n,percent:n/t*100,ratio:e/t}}function a(e){let t=Math.round(e);return e>100?`${Math.max(t,101)}%`:`${e>0&&e<100?Math.min(Math.max(t,1),99):t}%`}function o(t,{max:n,usesUsageTone:r,valueText:i}){let o=i?.trim()?i:void 0;if(!t)return{reading:o,valueText:o,usage:void 0};let s=a(r?Math.max(t.percent,t.ratio*100):t.percent),c=n===0||r&&t.ratio>1;return{reading:o??s,valueText:o??(c?s:void 0),usage:r?e.n({count:t.ratio,max:1}):void 0}}function s(e,t){let n={"--progress-width":`${e}%`};if(!t)return n;let r=e<=60;return{...n,"--progress-mix":`${r?e/60*100:(e-60)/40*100}%`,"--progress-from":r?`var(--color-success)`:`var(--color-warning)`,"--progress-to":r?`var(--color-warning)`:`var(--color-danger)`}}function c(e){return typeof e==`string`?e.trim()!==``:e!=null&&typeof e!=`boolean`}function l({label:e,labelId:t,reading:n,showValue:i=!!t}){let a=i&&c(n);return!t&&!a?null:(0,r.jsxs)(`div`,{className:`ds-progress__header`,children:[t&&(0,r.jsx)(`span`,{className:`ds-progress__label`,id:t,children:e}),a&&(0,r.jsx)(`span`,{className:`ds-progress__reading`,"aria-hidden":`true`,children:n})]})}var u=(0,n.forwardRef)(function({value:e,max:a=100,label:u,showValue:d,valueText:f,hint:p,size:m=`md`,tone:h=`primary`,className:g,style:_,hidden:v,"aria-label":y,"aria-labelledby":b,"aria-describedby":x,...S},C){let w=(0,n.useId)(),T=c(u)?`${w}-label`:void 0,E=c(p)?`${w}-hint`:void 0,D=h===`usage`,O=i(e,a),k=o(O,{max:a,usesUsageTone:D,valueText:f});return(0,r.jsxs)(t.Stack,{className:[`ds-progress`,g].filter(Boolean).join(` `),style:_,hidden:v,gap:`sm`,"data-size":m,"data-tone":h,"data-usage":k.usage,children:[(0,r.jsx)(l,{label:u,labelId:T,reading:k.reading,showValue:d}),(0,r.jsx)(`div`,{...S,ref:C,className:`ds-progress__track`,style:O&&s(O.percent,D),"data-indeterminate":!O||void 0,role:`progressbar`,"aria-label":y,"aria-labelledby":b||(y?void 0:T),"aria-describedby":[x,E].filter(Boolean).join(` `)||void 0,"aria-valuemin":O&&0,"aria-valuemax":O&&a,"aria-valuenow":O?.current,"aria-valuetext":k.valueText,children:(0,r.jsx)(`span`,{className:`ds-progress__fill`})}),E&&(0,r.jsx)(`div`,{className:`ds-progress__hint`,id:E,children:p})]})});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
2
+ //# sourceMappingURL=ProgressBar-C3F4HPIQ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressBar-C3F4HPIQ.cjs","names":["limitTone","forwardRef","useId","Stack","require_limit","require_components_Grid_index","react","react_jsx_runtime","readProgress","value","max","current","formatPercent","rounded","percent","describeProgress","customText","valueText","progress","percentText","usesUsageTone","derivesWrongPercent","progressStyle","width","isBelowWarning","hasContent","node","ProgressHeader","labelId","showsReading","showValue","reading","label","ProgressBar","ariaLabel","labelledBy","describedBy","rest","id","hintId","hint","tone","className","size"],"sources":["../../src/components/ProgressBar/progress.ts","../../src/components/ProgressBar/index.tsx"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport { limitTone } from \"../LimitReading/limit\";\n\nexport interface Progress {\n /** The value clamped to the range, for `aria-valuenow`. */\n current: number;\n /** The clamped fill, from 0 to 100. */\n percent: number;\n /** The unclamped share of the range, so usage can show an overage. */\n ratio: number;\n}\n\n/** A zero range is an empty task, so it is complete. Other unusable input is indeterminate. */\nexport function readProgress(value: number | undefined, max: number): Progress | undefined {\n if (value === undefined || !Number.isFinite(value) || !Number.isFinite(max) || max < 0) {\n return undefined;\n }\n if (max === 0) {\n return { current: 0, percent: 100, ratio: 1 };\n }\n\n const current = Math.min(Math.max(value, 0), max);\n return { current, percent: (current / max) * 100, ratio: value / max };\n}\n\n/** Rounds without reporting a started task as 0%, an unfinished one as 100%, or an overage as 100%. */\nfunction formatPercent(percent: number) {\n const rounded = Math.round(percent);\n if (percent > 100) {\n return `${Math.max(rounded, 101)}%`;\n }\n return `${percent > 0 && percent < 100 ? Math.min(Math.max(rounded, 1), 99) : rounded}%`;\n}\n\ninterface ReadingOptions {\n max: number;\n usesUsageTone: boolean;\n valueText: string | undefined;\n}\n\n/** The visible reading, the accessible value text, and the usage level. Blank text is ignored. */\nexport function describeProgress(\n progress: Progress | undefined,\n { max, usesUsageTone, valueText }: ReadingOptions,\n) {\n const customText = valueText?.trim() ? valueText : undefined;\n if (!progress) {\n return { reading: customText, valueText: customText, usage: undefined };\n }\n\n // Usage shows an overage; the fill and aria-valuenow stay within the range.\n const percentText = formatPercent(\n usesUsageTone ? Math.max(progress.percent, progress.ratio * 100) : progress.percent,\n );\n // Assistive technology derives a percentage from the range unless value text replaces it.\n const derivesWrongPercent = max === 0 || (usesUsageTone && progress.ratio > 1);\n return {\n reading: customText ?? percentText,\n valueText: customText ?? (derivesWrongPercent ? percentText : undefined),\n // LimitReading's thresholds: warning from 85% and danger at or above the limit.\n usage: usesUsageTone ? limitTone({ count: progress.ratio, max: 1 }) : undefined,\n };\n}\n\nexport function progressStyle(percent: number, usesUsageTone: boolean): CSSProperties {\n const width = { \"--progress-width\": `${percent}%` };\n if (!usesUsageTone) {\n return width as CSSProperties;\n }\n\n const isBelowWarning = percent <= 60;\n return {\n ...width,\n \"--progress-mix\": `${isBelowWarning ? (percent / 60) * 100 : ((percent - 60) / 40) * 100}%`,\n \"--progress-from\": isBelowWarning ? \"var(--color-success)\" : \"var(--color-warning)\",\n \"--progress-to\": isBelowWarning ? \"var(--color-warning)\" : \"var(--color-danger)\",\n } as CSSProperties;\n}\n","import { forwardRef, useId, type ReactNode } from \"react\";\nimport { Stack } from \"../Grid\";\nimport { describeProgress, progressStyle, readProgress } from \"./progress\";\nimport type { ProgressBarProps } from \"./types\";\nimport \"./style.css\";\n\nexport type { ProgressBarProps, ProgressBarSize, ProgressBarTone } from \"./types\";\n\nfunction hasContent(node: ReactNode) {\n return typeof node === \"string\" ? node.trim() !== \"\" : node != null && typeof node !== \"boolean\";\n}\n\ninterface ProgressHeaderProps extends Pick<ProgressBarProps, \"label\" | \"showValue\"> {\n labelId: string | undefined;\n reading: string | undefined;\n}\n\nfunction ProgressHeader({\n label,\n labelId,\n reading,\n showValue = Boolean(labelId),\n}: ProgressHeaderProps) {\n const showsReading = showValue && hasContent(reading);\n if (!labelId && !showsReading) {\n return null;\n }\n\n return (\n <div className=\"ds-progress__header\">\n {labelId && (\n <span\n className=\"ds-progress__label\"\n id={labelId}\n >\n {label}\n </span>\n )}\n {showsReading && (\n <span\n className=\"ds-progress__reading\"\n aria-hidden=\"true\"\n >\n {reading}\n </span>\n )}\n </div>\n );\n}\n\n/** A passive reading of task progress. The owning application manages announcements. */\nexport const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(function ProgressBar(\n {\n value,\n max = 100,\n label,\n showValue,\n valueText,\n hint,\n size = \"md\",\n tone = \"primary\",\n className,\n style,\n hidden,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": labelledBy,\n \"aria-describedby\": describedBy,\n ...rest\n },\n ref,\n) {\n const id = useId();\n const labelId = hasContent(label) ? `${id}-label` : undefined;\n const hintId = hasContent(hint) ? `${id}-hint` : undefined;\n const usesUsageTone = tone === \"usage\";\n const progress = readProgress(value, max);\n const reading = describeProgress(progress, { max, usesUsageTone, valueText });\n\n return (\n <Stack\n className={[\"ds-progress\", className].filter(Boolean).join(\" \")}\n style={style}\n hidden={hidden}\n gap=\"sm\"\n data-size={size}\n data-tone={tone}\n data-usage={reading.usage}\n >\n <ProgressHeader\n label={label}\n labelId={labelId}\n reading={reading.reading}\n showValue={showValue}\n />\n <div\n {...rest}\n ref={ref}\n className=\"ds-progress__track\"\n style={progress && progressStyle(progress.percent, usesUsageTone)}\n data-indeterminate={!progress || undefined}\n role=\"progressbar\"\n aria-label={ariaLabel}\n aria-labelledby={labelledBy || (ariaLabel ? undefined : labelId)}\n aria-describedby={[describedBy, hintId].filter(Boolean).join(\" \") || undefined}\n aria-valuemin={progress && 0}\n aria-valuemax={progress && max}\n aria-valuenow={progress?.current}\n aria-valuetext={reading.valueText}\n >\n <span className=\"ds-progress__fill\" />\n </div>\n {hintId && (\n <div\n className=\"ds-progress__hint\"\n id={hintId}\n >\n {hint}\n </div>\n )}\n </Stack>\n );\n});\n"],"mappings":"A,wIAaA,SAAgBQ,EAAa,EAA2B,EAAmC,CACzF,GAAIC,IAAU,IAAA,IAAa,CAAC,OAAO,SAASA,CAAK,GAAK,CAAC,OAAO,SAASC,CAAG,GAAKA,EAAM,EACnF,OAEF,GAAIA,IAAQ,EACV,MAAO,CAAE,QAAS,EAAG,QAAS,IAAK,MAAO,CAAE,EAG9C,IAAMC,EAAU,KAAK,IAAI,KAAK,IAAIF,EAAO,CAAC,EAAGC,CAAG,EAChD,MAAO,CAAE,UAAS,QAAUC,EAAUD,EAAO,IAAK,MAAOD,EAAQC,CAAI,CACvE,CAGA,SAASE,EAAc,EAAiB,CACtC,IAAMC,EAAU,KAAK,MAAMC,CAAO,EAIlC,OAHIA,EAAU,IACL,GAAG,KAAK,IAAID,EAAS,GAAG,EAAE,GAE5B,GAAGC,EAAU,GAAKA,EAAU,IAAM,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,CAAC,KAAK,GAAG,GAAK,IAAA,GACrE,gBAAerB,GAAY,EAC3B,gBAAeA,GAAYR,EAC3B,gBAAeQ,GAAU,QACzB,iBAAgBa,EAAQ,UAExB,UAAA,EAAAxB,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,mBAAqB,CAAA,CAClC,CAAA,EACJgC,IACC,EAAAhC,EAAA,IAAA,CAAC,MAAD,CACE,UAAU,oBACV,GAAIgC,EAEH,SAAAC,CACE,CAAA,CAEF,C,EAEX,CAAC,E"}
@@ -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({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;
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,4 +1,4 @@
1
- import { t as e } from "../../chunks/Message-DNaudg1u.js";
1
+ import { t as e } from "../../chunks/Message-d6lqiMQ6.js";
2
2
  import { forwardRef as t } from "react";
3
3
  import { jsx as n } from "react/jsx-runtime";
4
4
  //#region src/components/Banner/index.tsx
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/ProgressBar-C3F4HPIQ.cjs");exports.ProgressBar=e.t;
@@ -0,0 +1,5 @@
1
+ import type { ProgressBarProps } from "./types.cjs";
2
+ export type { ProgressBarProps, ProgressBarSize, ProgressBarTone } from "./types.cjs";
3
+ /** A passive reading of task progress. The owning application manages announcements. */
4
+ export declare const ProgressBar: import("react").ForwardRefExoticComponent<ProgressBarProps & import("react").RefAttributes<HTMLDivElement>>;
5
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/ProgressBar/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,aAAa,CAAC;AAErB,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA4ClF,wFAAwF;AACxF,eAAO,MAAM,WAAW,6GAsEtB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { ProgressBarProps } from "./types.js";
2
+ export type { ProgressBarProps, ProgressBarSize, ProgressBarTone } from "./types.js";
3
+ /** A passive reading of task progress. The owning application manages announcements. */
4
+ export declare const ProgressBar: import("react").ForwardRefExoticComponent<ProgressBarProps & import("react").RefAttributes<HTMLDivElement>>;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressBar/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,aAAa,CAAC;AAErB,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA4ClF,wFAAwF;AACxF,eAAO,MAAM,WAAW,6GAsEtB,CAAC"}
@@ -0,0 +1 @@
1
+ export { t as ProgressBar } from "../../chunks/ProgressBar-BzdsY7oR.js";
@@ -0,0 +1,29 @@
1
+ import type { CSSProperties } from "react";
2
+ export interface Progress {
3
+ /** The value clamped to the range, for `aria-valuenow`. */
4
+ current: number;
5
+ /** The clamped fill, from 0 to 100. */
6
+ percent: number;
7
+ /** The unclamped share of the range, so usage can show an overage. */
8
+ ratio: number;
9
+ }
10
+ /** A zero range is an empty task, so it is complete. Other unusable input is indeterminate. */
11
+ export declare function readProgress(value: number | undefined, max: number): Progress | undefined;
12
+ interface ReadingOptions {
13
+ max: number;
14
+ usesUsageTone: boolean;
15
+ valueText: string | undefined;
16
+ }
17
+ /** The visible reading, the accessible value text, and the usage level. Blank text is ignored. */
18
+ export declare function describeProgress(progress: Progress | undefined, { max, usesUsageTone, valueText }: ReadingOptions): {
19
+ reading: string | undefined;
20
+ valueText: string | undefined;
21
+ usage: undefined;
22
+ } | {
23
+ reading: string;
24
+ valueText: string | undefined;
25
+ usage: string | undefined;
26
+ };
27
+ export declare function progressStyle(percent: number, usesUsageTone: boolean): CSSProperties;
28
+ export {};
29
+ //# sourceMappingURL=progress.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress.d.cts","sourceRoot":"","sources":["../../../src/components/ProgressBar/progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3C,MAAM,WAAW,QAAQ;IACvB,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,+FAA+F;AAC/F,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAUzF;AAWD,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,kGAAkG;AAClG,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,EAAE,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,cAAc;;;;;;;;EAmBlD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,GAAG,aAAa,CAapF"}
@@ -0,0 +1,29 @@
1
+ import type { CSSProperties } from "react";
2
+ export interface Progress {
3
+ /** The value clamped to the range, for `aria-valuenow`. */
4
+ current: number;
5
+ /** The clamped fill, from 0 to 100. */
6
+ percent: number;
7
+ /** The unclamped share of the range, so usage can show an overage. */
8
+ ratio: number;
9
+ }
10
+ /** A zero range is an empty task, so it is complete. Other unusable input is indeterminate. */
11
+ export declare function readProgress(value: number | undefined, max: number): Progress | undefined;
12
+ interface ReadingOptions {
13
+ max: number;
14
+ usesUsageTone: boolean;
15
+ valueText: string | undefined;
16
+ }
17
+ /** The visible reading, the accessible value text, and the usage level. Blank text is ignored. */
18
+ export declare function describeProgress(progress: Progress | undefined, { max, usesUsageTone, valueText }: ReadingOptions): {
19
+ reading: string | undefined;
20
+ valueText: string | undefined;
21
+ usage: undefined;
22
+ } | {
23
+ reading: string;
24
+ valueText: string | undefined;
25
+ usage: string | undefined;
26
+ };
27
+ export declare function progressStyle(percent: number, usesUsageTone: boolean): CSSProperties;
28
+ export {};
29
+ //# sourceMappingURL=progress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressBar/progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3C,MAAM,WAAW,QAAQ;IACvB,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,+FAA+F;AAC/F,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAUzF;AAWD,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,kGAAkG;AAClG,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,EAAE,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,cAAc;;;;;;;;EAmBlD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,GAAG,aAAa,CAapF"}