@orbitcommerce/constellation-docs 0.0.0-stage → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +6 -2
  3. package/dist/docs.css +20787 -0
  4. package/dist/index.d.ts +33 -0
  5. package/dist/index.js +308 -0
  6. package/dist/pages/Playground-Mk1yIWXb.js +129 -0
  7. package/dist/pages/_address-data-L9BR499w.js +161 -0
  8. package/dist/pages/_builder-demo-C0eJUmPU.js +282 -0
  9. package/dist/pages/_card-art-0be5ncyV.js +18 -0
  10. package/dist/pages/_conversation-samples-Bq7cn-4d.js +70 -0
  11. package/dist/pages/_figures-data-DaDvB7Nm.js +606 -0
  12. package/dist/pages/_foundations-blXWyYh8.js +30 -0
  13. package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
  14. package/dist/pages/_overlays-specimens-bawR331Z.js +320 -0
  15. package/dist/pages/_preview-specimens-DKQC9HAo.js +153 -0
  16. package/dist/pages/accordion-Sg0TUqxB.js +1036 -0
  17. package/dist/pages/address-autocomplete-DP0PUOlK.js +360 -0
  18. package/dist/pages/address-block-BZOOOPA9.js +368 -0
  19. package/dist/pages/address-fields-CwSqro3W.js +277 -0
  20. package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
  21. package/dist/pages/alert-D3i7xZTU.js +914 -0
  22. package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
  23. package/dist/pages/app-shell-D4hdlHps.js +1558 -0
  24. package/dist/pages/area-chart-BEWFwiB2.js +718 -0
  25. package/dist/pages/avatar-BFEqQViw.js +895 -0
  26. package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
  27. package/dist/pages/badge-0-PyMrih.js +1035 -0
  28. package/dist/pages/bar-chart-DkLogYlt.js +1060 -0
  29. package/dist/pages/bar-fold-B-3XeIDZ.js +360 -0
  30. package/dist/pages/board-card-D2tZY_mU.js +415 -0
  31. package/dist/pages/brand-mark-BqiLvFSR.js +417 -0
  32. package/dist/pages/button-DAyfssDY.js +715 -0
  33. package/dist/pages/calendar-Ds7KsgSI.js +682 -0
  34. package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
  35. package/dist/pages/card-CQEM1_wc.js +1567 -0
  36. package/dist/pages/caret-suggestions-oHI6QvqW.js +526 -0
  37. package/dist/pages/chart-legend-B20AbakD.js +724 -0
  38. package/dist/pages/chat-composer-CwzUJYIa.js +437 -0
  39. package/dist/pages/checkbox-BG9Zkb6j.js +1581 -0
  40. package/dist/pages/checklist-card-DEyykVFS.js +783 -0
  41. package/dist/pages/chip-Ck-o3Ui6.js +839 -0
  42. package/dist/pages/chip-list-k1LxXuCi.js +414 -0
  43. package/dist/pages/clamp-text-n-iE8RDR.js +203 -0
  44. package/dist/pages/coachmark-Be2ghobT.js +366 -0
  45. package/dist/pages/code-block-Dv_Y5GYq.js +622 -0
  46. package/dist/pages/collab-field-CfqqK7d2.js +696 -0
  47. package/dist/pages/color-field-CZpfcA-A.js +1127 -0
  48. package/dist/pages/colour-q2ntvI0w.js +1974 -0
  49. package/dist/pages/column-mapper-TsTG39cl.js +502 -0
  50. package/dist/pages/combobox-DvK2j5tI.js +1334 -0
  51. package/dist/pages/command-palette-CJ7uBA04.js +1386 -0
  52. package/dist/pages/comment-box-CDSGYhr5.js +346 -0
  53. package/dist/pages/composer-D4B0NgpA.js +689 -0
  54. package/dist/pages/condition-builder-BZy2ZGXe.js +715 -0
  55. package/dist/pages/conflict-chooser-C--_9UIS.js +210 -0
  56. package/dist/pages/context-menu-F9DV30ia.js +487 -0
  57. package/dist/pages/copy-button-Cn7WiKRF.js +568 -0
  58. package/dist/pages/copy-field-D3Xt3Jq6.js +511 -0
  59. package/dist/pages/danger-zone-Db_UUeiP.js +564 -0
  60. package/dist/pages/date-input-GOW067EB.js +956 -0
  61. package/dist/pages/date-picker-GdBciR99.js +1569 -0
  62. package/dist/pages/date-time-BLKCXtVZ.js +678 -0
  63. package/dist/pages/delta-CNAGv8JY.js +779 -0
  64. package/dist/pages/description-list-BPeXn1eW.js +1268 -0
  65. package/dist/pages/device-switcher-BCaN99c1.js +554 -0
  66. package/dist/pages/dialog-CRpkRC98.js +3164 -0
  67. package/dist/pages/docs-lM2UBSir.js +520 -0
  68. package/dist/pages/doodle-nzkqi2UI.js +201 -0
  69. package/dist/pages/drag-ghost-B6kpzC3O.js +426 -0
  70. package/dist/pages/drill-menu-cskH5mol.js +490 -0
  71. package/dist/pages/dropzone-DOY_Rhw0.js +1069 -0
  72. package/dist/pages/element-toolbar-DZIhXlCJ.js +498 -0
  73. package/dist/pages/emoji-picker-CqaWaffD.js +235 -0
  74. package/dist/pages/empty-state-4U2txFpI.js +1113 -0
  75. package/dist/pages/facet-filters-McbBeY9e.js +353 -0
  76. package/dist/pages/figure-D-HF5vCj.js +563 -0
  77. package/dist/pages/figure-strip-BB3mNl7D.js +1364 -0
  78. package/dist/pages/figure-tabs-QOeQMY6N.js +578 -0
  79. package/dist/pages/file-chip-DMDjtlqQ.js +738 -0
  80. package/dist/pages/filter-pill-DzqNOsD4.js +1295 -0
  81. package/dist/pages/font-picker-Bqhu0QMh.js +416 -0
  82. package/dist/pages/form-grid-BfWCVlie.js +692 -0
  83. package/dist/pages/gallery-BBk2EOri.js +453 -0
  84. package/dist/pages/gif-picker-CnoDTCaL.js +270 -0
  85. package/dist/pages/gradient-editor-Bqxp7Fxj.js +378 -0
  86. package/dist/pages/grouped-checklist-gNZ0tBKU.js +477 -0
  87. package/dist/pages/heatmap-BohgIcNk.js +507 -0
  88. package/dist/pages/highlight-text-BfxzfmvS.js +287 -0
  89. package/dist/pages/home-dashboard-CxPmvduE.js +962 -0
  90. package/dist/pages/host-B6znjEgQ.js +109 -0
  91. package/dist/pages/hosted-embed-Jef3aIMP.js +163 -0
  92. package/dist/pages/hosted-field-BLh-53AE.js +208 -0
  93. package/dist/pages/hosted-field-DEpI4lVS.js +514 -0
  94. package/dist/pages/icon-button-Bu4Gj5sy.js +1200 -0
  95. package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
  96. package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
  97. package/dist/pages/icons-CJ9Aar3d.js +736 -0
  98. package/dist/pages/image-cropper-NyougqLH.js +466 -0
  99. package/dist/pages/image-field-7knBv4mJ.js +567 -0
  100. package/dist/pages/import-result-CmTtGXW_.js +486 -0
  101. package/dist/pages/inline-confirm-CEcI5Lxo.js +327 -0
  102. package/dist/pages/inline-edit-Ba39SzhM.js +1125 -0
  103. package/dist/pages/input-CzLCzfyx.js +2372 -0
  104. package/dist/pages/installation-C3UcpQJT.js +528 -0
  105. package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
  106. package/dist/pages/kanban-Dy9sPAI0.js +740 -0
  107. package/dist/pages/kbd-UNj4zqxn.js +545 -0
  108. package/dist/pages/layout-primitives-CPRaZeyt.js +483 -0
  109. package/dist/pages/line-chart-CntWxeMF.js +1117 -0
  110. package/dist/pages/link-CXqvAg9z.js +689 -0
  111. package/dist/pages/link-picker-BMFGCC67.js +478 -0
  112. package/dist/pages/link-row-x8yaUuWc.js +595 -0
  113. package/dist/pages/live-globe-95ROMhGQ.js +715 -0
  114. package/dist/pages/loading-overlay-BeGuXM9G.js +456 -0
  115. package/dist/pages/loading-state-BNbCo51C.js +556 -0
  116. package/dist/pages/log-viewer-BQz8I_a2.js +503 -0
  117. package/dist/pages/logo-B38rnzoq.js +571 -0
  118. package/dist/pages/lottie_light-CxEH8eiR.js +9116 -0
  119. package/dist/pages/markdown-Ied72vMT.js +237 -0
  120. package/dist/pages/markdown-field-BfnIEKZH.js +193 -0
  121. package/dist/pages/media-banner-DkStCia0.js +233 -0
  122. package/dist/pages/menu-NrLYKqKp.js +2132 -0
  123. package/dist/pages/message-thread-Bo4zbxqu.js +731 -0
  124. package/dist/pages/meta-line-D5p2TycR.js +371 -0
  125. package/dist/pages/model-viewer-BfokvHoc.js +60288 -0
  126. package/dist/pages/model-viewer-C8PFO8wk.js +577 -0
  127. package/dist/pages/month-calendar-T1vw9Rup.js +457 -0
  128. package/dist/pages/motion-CrXtiBvA.js +865 -0
  129. package/dist/pages/number-input-CuyMZg18.js +968 -0
  130. package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
  131. package/dist/pages/orbit-spinner-Dxv5qAhr.js +348 -0
  132. package/dist/pages/otp-input-CVRoX1mw.js +591 -0
  133. package/dist/pages/overview-LA9XRhZc.js +130 -0
  134. package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
  135. package/dist/pages/pagination-C1EgVtW4.js +294 -0
  136. package/dist/pages/palette-tile-X9ZXu2Z0.js +414 -0
  137. package/dist/pages/password-field-DHEQKyUC.js +912 -0
  138. package/dist/pages/person-cell-BmjbADBz.js +564 -0
  139. package/dist/pages/phone-input-B3G7Qpb2.js +747 -0
  140. package/dist/pages/plan-card-DRaA6RuB.js +621 -0
  141. package/dist/pages/plan-card-DtloWvMh.js +258 -0
  142. package/dist/pages/plan-comparison-BVIGTtbd.js +559 -0
  143. package/dist/pages/plan-grid-cfPVTB5V.js +251 -0
  144. package/dist/pages/point-list-BbPmZjsm.js +222 -0
  145. package/dist/pages/popover-C3Oar9D5.js +1198 -0
  146. package/dist/pages/presence-avatars-CRZIk8n9.js +328 -0
  147. package/dist/pages/preview-frame-Bcwk0y_Q.js +1631 -0
  148. package/dist/pages/price-CRBLoa9h.js +604 -0
  149. package/dist/pages/principles-pnDyfHpK.js +483 -0
  150. package/dist/pages/print-page-BkLv6bW8.js +513 -0
  151. package/dist/pages/profile-hero-CC9dUzuN.js +498 -0
  152. package/dist/pages/progress-CP_awmo4.js +904 -0
  153. package/dist/pages/progress-ring-JuOAwk2T.js +576 -0
  154. package/dist/pages/radio-group-C-4tg6FS.js +1639 -0
  155. package/dist/pages/radius-control-B2kRA2Ch.js +441 -0
  156. package/dist/pages/rating-CweKN2SX.js +471 -0
  157. package/dist/pages/record-layout-DUP_X0RL.js +719 -0
  158. package/dist/pages/record-pager-y9D7JFgb.js +278 -0
  159. package/dist/pages/registry-BZg-xAbi.js +594 -0
  160. package/dist/pages/release-Cs6tl16C.js +16 -0
  161. package/dist/pages/repeater-BRZYKRQa.js +1351 -0
  162. package/dist/pages/reply-feedback-BDnHprla.js +192 -0
  163. package/dist/pages/reveal-BygENBbL.js +460 -0
  164. package/dist/pages/rich-text-DOFQZEpT.js +156 -0
  165. package/dist/pages/rich-text-editor-BhIM20JI.js +1265 -0
  166. package/dist/pages/rolldown-runtime-CbKu08Hx.js +25 -0
  167. package/dist/pages/rolling-number-GR3Cyfpz.js +529 -0
  168. package/dist/pages/row-list-Dl6CYhC-.js +1565 -0
  169. package/dist/pages/rule-list-DTCmIMpT.js +648 -0
  170. package/dist/pages/save-status-B5KkyMZP.js +378 -0
  171. package/dist/pages/schedule-YycI95O1.js +243 -0
  172. package/dist/pages/scroll-area-B2sGm23Q.js +423 -0
  173. package/dist/pages/search-field-D1uG7R6A.js +693 -0
  174. package/dist/pages/search-menu-DMuXyUUW.js +580 -0
  175. package/dist/pages/secret-field-Dj9x3LL8.js +337 -0
  176. package/dist/pages/section-rail-BtTCETS5.js +637 -0
  177. package/dist/pages/section-v2Pubup9.js +639 -0
  178. package/dist/pages/segmented-control-D-FB1K1T.js +1190 -0
  179. package/dist/pages/select-DZ43NpOm.js +1434 -0
  180. package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
  181. package/dist/pages/separator-CFwqRvfO.js +428 -0
  182. package/dist/pages/serp-preview-BGwORjmo.js +346 -0
  183. package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
  184. package/dist/pages/shape-DzniHAVT.js +627 -0
  185. package/dist/pages/share-list-D4wgBxKN.js +926 -0
  186. package/dist/pages/side-panel-CCtkrZjs.js +811 -0
  187. package/dist/pages/site-preview-Dj1hM2Yo.js +353 -0
  188. package/dist/pages/skeleton-C1F5HkAu.js +1325 -0
  189. package/dist/pages/skip-link-BxznhSkz.js +252 -0
  190. package/dist/pages/slider-CAoPURKD.js +774 -0
  191. package/dist/pages/sortable-card-Sr44uCpI.js +424 -0
  192. package/dist/pages/sortable-list-DUAleYE1.js +1298 -0
  193. package/dist/pages/sortable-tree-BLzK-hTE.js +737 -0
  194. package/dist/pages/spacing-box-CtuvzxQu.js +550 -0
  195. package/dist/pages/sparkline-D3aavCly.js +947 -0
  196. package/dist/pages/split-bar-DYgZnFID.js +414 -0
  197. package/dist/pages/split-button-Be08-VI-.js +335 -0
  198. package/dist/pages/split-pane-lSNZgTKt.js +523 -0
  199. package/dist/pages/status-badge-DOdNhmzn.js +1074 -0
  200. package/dist/pages/status-checklist-CWkjCZIC.js +1152 -0
  201. package/dist/pages/status-dot-D99gAGsV.js +567 -0
  202. package/dist/pages/stepper-CxKTbEA-.js +1093 -0
  203. package/dist/pages/success-mark-CqFTOBEu.js +142 -0
  204. package/dist/pages/swatch-H_kNvHuC.js +565 -0
  205. package/dist/pages/switch-C93K6j9h.js +617 -0
  206. package/dist/pages/table-CL0vomno.js +3225 -0
  207. package/dist/pages/tabs-Dh0mUsLw.js +1690 -0
  208. package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
  209. package/dist/pages/task-card-Dv0sR1-w.js +295 -0
  210. package/dist/pages/textarea-CCM-SnGN.js +949 -0
  211. package/dist/pages/thumbnail-DwFJL_k1.js +1147 -0
  212. package/dist/pages/time-input-CA9-uZAa.js +442 -0
  213. package/dist/pages/time-zone-select-CEtMXVYO.js +296 -0
  214. package/dist/pages/timeline-BsMUTlpR.js +1798 -0
  215. package/dist/pages/toast-zXLRiMRT.js +1391 -0
  216. package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
  217. package/dist/pages/toolbar-B9l_fHKy.js +754 -0
  218. package/dist/pages/tooltip-LHtCUkF-.js +826 -0
  219. package/dist/pages/translation-field-CTRXiF2N.js +251 -0
  220. package/dist/pages/tree-checklist-CJj3OcLg.js +451 -0
  221. package/dist/pages/tree-select-DU1qXHy_.js +492 -0
  222. package/dist/pages/tree-view-g_RjLtAb.js +739 -0
  223. package/dist/pages/typography-BSijtiRl.js +876 -0
  224. package/dist/pages/unit-input-Dml4fjmK.js +659 -0
  225. package/dist/pages/upload-rules-yozEzSah.js +419 -0
  226. package/dist/pages/url-upload-input-SSnMgfpA.js +307 -0
  227. package/dist/pages/value-change-CnubDKyO.js +489 -0
  228. package/dist/pages/weekly-hours-i2EpsmTx.js +287 -0
  229. package/dist/pages/widget-preview-CUJMyZ_k.js +625 -0
  230. package/dist/pages/working-status-CENemSsw.js +389 -0
  231. package/manifest.json +13001 -0
  232. package/package.json +35 -4
@@ -0,0 +1,1391 @@
1
+ "use client";
2
+ import { a as DocTable, d as Section$1, i as DocPage, l as Note, m as ThemePair, n as CodeBlock$1, o as Example, p as SubSection, r as DoDont, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
3
+ import { c as SpecimenFrame } from "./_overlays-specimens-bawR331Z.js";
4
+ import { useEffect, useId, useRef, useState } from "react";
5
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
+ import { Button, IconButton, Input, OrbitSpinner, SegmentedControl, Switch, ToastPositionScope, Toaster, createToastBatch, cx, isChimeEnabled, playChime, setChimeEnabled, toast, useThemeScope } from "@orbitcommerce/constellation";
7
+ import { ArrowsClockwiseIcon, BellIcon, CheckCircleIcon, InfoIcon, PaintBrushIcon, PaperPlaneTiltIcon, ShoppingBagIcon, TrashIcon, TruckIcon, UploadSimpleIcon, WarningCircleIcon, WarningIcon } from "@orbitcommerce/constellation/icons";
8
+ //#region src/pages/components/toast.tsx
9
+ var wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
10
+ var failAfter = (ms, message) => new Promise((_, reject) => setTimeout(() => reject(new Error(message)), ms));
11
+ var TONE_ICONS = {
12
+ success: /* @__PURE__ */ jsx(CheckCircleIcon, {
13
+ weight: "fill",
14
+ "aria-hidden": "true"
15
+ }),
16
+ error: /* @__PURE__ */ jsx(WarningCircleIcon, {
17
+ weight: "fill",
18
+ "aria-hidden": "true"
19
+ }),
20
+ warning: /* @__PURE__ */ jsx(WarningIcon, {
21
+ weight: "fill",
22
+ "aria-hidden": "true"
23
+ }),
24
+ info: /* @__PURE__ */ jsx(InfoIcon, {
25
+ weight: "fill",
26
+ "aria-hidden": "true"
27
+ }),
28
+ loading: /* @__PURE__ */ jsx(OrbitSpinner, { size: 16 })
29
+ };
30
+ function CloseGlyph() {
31
+ return /* @__PURE__ */ jsx("svg", {
32
+ viewBox: "0 0 16 16",
33
+ fill: "none",
34
+ stroke: "currentColor",
35
+ strokeWidth: 1.6,
36
+ strokeLinecap: "round",
37
+ children: /* @__PURE__ */ jsx("path", { d: "M4.75 4.75l6.5 6.5M11.25 4.75l-6.5 6.5" })
38
+ });
39
+ }
40
+ function ToastStill({ tone = "message", title, description, action, closable = tone !== "loading", className, style }) {
41
+ return /* @__PURE__ */ jsxs("div", {
42
+ className: cx("o-toast", className),
43
+ "data-type": tone === "message" ? void 0 : tone,
44
+ style,
45
+ children: [
46
+ tone === "message" ? null : /* @__PURE__ */ jsx("div", {
47
+ className: "o-toast__icon",
48
+ children: TONE_ICONS[tone]
49
+ }),
50
+ /* @__PURE__ */ jsxs("div", {
51
+ className: "o-toast__content",
52
+ children: [/* @__PURE__ */ jsx("div", {
53
+ className: "o-toast__title",
54
+ children: title
55
+ }), description ? /* @__PURE__ */ jsx("div", {
56
+ className: "o-toast__description",
57
+ children: description
58
+ }) : null]
59
+ }),
60
+ /* @__PURE__ */ jsxs("div", {
61
+ className: "o-toast__controls",
62
+ children: [action ? /* @__PURE__ */ jsx(Button, {
63
+ size: "sm",
64
+ className: "o-toast__action",
65
+ tabIndex: -1,
66
+ children: action
67
+ }) : null, closable ? /* @__PURE__ */ jsx(IconButton, {
68
+ label: "Dismiss",
69
+ size: "sm",
70
+ className: "o-toast__close",
71
+ tabIndex: -1,
72
+ children: /* @__PURE__ */ jsx(CloseGlyph, {})
73
+ }) : null]
74
+ })
75
+ ]
76
+ });
77
+ }
78
+ function Preview() {
79
+ return /* @__PURE__ */ jsxs("div", {
80
+ className: "toast-preview",
81
+ children: [/* @__PURE__ */ jsx("div", { className: "o-toast toast-preview__back" }), /* @__PURE__ */ jsx(ToastStill, {
82
+ tone: "success",
83
+ title: "Order #1042 fulfilled",
84
+ description: "Tracking sent to James.",
85
+ closable: false
86
+ })]
87
+ });
88
+ }
89
+ function AllTonesStill() {
90
+ return /* @__PURE__ */ jsxs(SpecimenFrame, {
91
+ className: "toast-stills",
92
+ children: [
93
+ /* @__PURE__ */ jsx(ToastStill, {
94
+ tone: "success",
95
+ title: "Order #1042 marked as fulfilled",
96
+ description: "We emailed James Okafor his tracking link.",
97
+ action: "Undo"
98
+ }),
99
+ /* @__PURE__ */ jsx(ToastStill, {
100
+ tone: "error",
101
+ title: "Could not capture £89.50",
102
+ description: "The card issuer declined the payment for order #1043. Ask the customer for another card."
103
+ }),
104
+ /* @__PURE__ */ jsx(ToastStill, {
105
+ tone: "warning",
106
+ title: "Only 3 Walnut desk risers left"
107
+ }),
108
+ /* @__PURE__ */ jsx(ToastStill, {
109
+ tone: "info",
110
+ title: "Export on its way",
111
+ description: "We will email you the CSV of 318 orders when it is ready."
112
+ }),
113
+ /* @__PURE__ */ jsx(ToastStill, {
114
+ tone: "loading",
115
+ title: "Importing 248 products",
116
+ description: "From Northgate Supply. You can keep working."
117
+ }),
118
+ /* @__PURE__ */ jsx(ToastStill, { title: "Order link copied" })
119
+ ]
120
+ });
121
+ }
122
+ function LongStill() {
123
+ return /* @__PURE__ */ jsx(SpecimenFrame, {
124
+ className: "toast-stills",
125
+ children: /* @__PURE__ */ jsx(ToastStill, {
126
+ tone: "warning",
127
+ title: "Imported 245 of 248 products from Northgate Supply",
128
+ description: "3 were skipped because their SKUs are already in use: CHR-ARD-01, DSK-WAL-60 and LMP-BRS-01. Rename them in the file and import it again.",
129
+ action: "Download skipped rows"
130
+ })
131
+ });
132
+ }
133
+ function StackStill() {
134
+ return /* @__PURE__ */ jsxs(SpecimenFrame, {
135
+ className: "toast-stack-still",
136
+ children: [
137
+ /* @__PURE__ */ jsx("div", {
138
+ className: "o-toast",
139
+ "data-depth": "2"
140
+ }),
141
+ /* @__PURE__ */ jsx("div", {
142
+ className: "o-toast",
143
+ "data-depth": "1"
144
+ }),
145
+ /* @__PURE__ */ jsx(ToastStill, {
146
+ tone: "info",
147
+ title: "New order #1053",
148
+ description: "£312.00 from Priya Shah."
149
+ })
150
+ ]
151
+ });
152
+ }
153
+ function BasicsDemo() {
154
+ return /* @__PURE__ */ jsx(Button, {
155
+ variant: "primary",
156
+ icon: /* @__PURE__ */ jsx(TruckIcon, {}),
157
+ onClick: () => toast.success("Order #1042 marked as fulfilled", { description: "We emailed James Okafor his tracking link." }),
158
+ children: "Mark as fulfilled"
159
+ });
160
+ }
161
+ function importProducts() {
162
+ const id = toast.loading("Importing 248 products", { description: "From Northgate Supply. You can keep working." });
163
+ window.setTimeout(() => toast.success("Imported 248 products", {
164
+ id,
165
+ description: "231 new and 17 updated."
166
+ }), 2600);
167
+ }
168
+ function TonesDemo() {
169
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
170
+ /* @__PURE__ */ jsx(Button, {
171
+ onClick: () => toast.success("Order #1042 marked as fulfilled", { description: "We emailed James Okafor his tracking link." }),
172
+ children: "Success"
173
+ }),
174
+ /* @__PURE__ */ jsx(Button, {
175
+ onClick: () => toast.error("Could not capture £89.50", { description: "The card issuer declined the payment for order #1043. Ask the customer for another card." }),
176
+ children: "Error"
177
+ }),
178
+ /* @__PURE__ */ jsx(Button, {
179
+ onClick: () => toast.warning("Only 3 Walnut desk risers left", { description: "Reorder from Northgate Supply to keep it on sale." }),
180
+ children: "Warning"
181
+ }),
182
+ /* @__PURE__ */ jsx(Button, {
183
+ onClick: () => toast.info("Export on its way", { description: "We will email you the CSV of 318 orders when it is ready." }),
184
+ children: "Info"
185
+ }),
186
+ /* @__PURE__ */ jsx(Button, {
187
+ onClick: importProducts,
188
+ children: "Loading"
189
+ }),
190
+ /* @__PURE__ */ jsx(Button, {
191
+ onClick: () => toast("Order link copied"),
192
+ children: "Message"
193
+ })
194
+ ] });
195
+ }
196
+ function DescriptionDemo() {
197
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
198
+ onClick: () => toast.success("Discount code saved"),
199
+ children: "Title only"
200
+ }), /* @__PURE__ */ jsx(Button, {
201
+ onClick: () => toast.success("Discount code saved", { description: "SUMMER15 takes 15% off orders over £50 until 31 August." }),
202
+ children: "With a description"
203
+ })] });
204
+ }
205
+ function UndoDemo() {
206
+ const [status, setStatus] = useState("");
207
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
208
+ variant: "critical",
209
+ icon: /* @__PURE__ */ jsx(TrashIcon, {}),
210
+ onClick: () => {
211
+ setStatus("");
212
+ toast("Deleted Walnut desk riser", {
213
+ description: "It has left your catalogue.",
214
+ action: {
215
+ label: "Undo",
216
+ altText: "Undo deleting Walnut desk riser",
217
+ onClick: () => setStatus("Walnut desk riser is back in your catalogue.")
218
+ }
219
+ });
220
+ },
221
+ children: "Delete product"
222
+ }), /* @__PURE__ */ jsx("p", {
223
+ className: "toast-status",
224
+ "aria-live": "polite",
225
+ children: status
226
+ })] });
227
+ }
228
+ function RetryDemo() {
229
+ return /* @__PURE__ */ jsx(Button, {
230
+ icon: /* @__PURE__ */ jsx(PaperPlaneTiltIcon, {}),
231
+ onClick: () => toast.error("Could not send invoice INV-2207", {
232
+ description: "The email server did not answer.",
233
+ action: {
234
+ label: "Try again",
235
+ altText: "Try again to send invoice INV-2207",
236
+ onClick: async () => {
237
+ await wait(1400);
238
+ toast.success("Sent invoice INV-2207", { description: "Ella Brooks has it by email, as a PDF." });
239
+ }
240
+ }
241
+ }),
242
+ children: "Send invoice"
243
+ });
244
+ }
245
+ function PromiseDemo() {
246
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
247
+ variant: "inverse",
248
+ icon: /* @__PURE__ */ jsx(PaintBrushIcon, {}),
249
+ onClick: () => toast.promise(wait(1800), {
250
+ loading: "Publishing the Harbour theme",
251
+ success: {
252
+ title: "Harbour is live",
253
+ description: "Your store switched themes. You can switch back from Themes."
254
+ },
255
+ error: "Could not publish the theme"
256
+ }),
257
+ children: "Publish theme"
258
+ }), /* @__PURE__ */ jsx(Button, {
259
+ icon: /* @__PURE__ */ jsx(ArrowsClockwiseIcon, {}),
260
+ onClick: () => toast.promise(failAfter(2e3, "Northgate Supply did not answer. Try again in a few minutes."), {
261
+ loading: {
262
+ title: "Syncing stock",
263
+ description: "Checking 1,284 products against Northgate Supply."
264
+ },
265
+ success: (count) => `Updated stock for ${count} products`,
266
+ error: (error) => ({
267
+ title: "Stock sync failed",
268
+ description: error instanceof Error ? error.message : void 0
269
+ })
270
+ }),
271
+ children: "Sync stock"
272
+ })] });
273
+ }
274
+ function ImportDemo() {
275
+ const run = useRef({});
276
+ useEffect(() => () => {
277
+ window.clearInterval(run.current.timer);
278
+ if (run.current.id !== void 0) toast.dismiss(run.current.id);
279
+ }, []);
280
+ const start = () => {
281
+ window.clearInterval(run.current.timer);
282
+ const total = 248;
283
+ let done = 0;
284
+ const id = toast.loading(`Importing ${total} products`, { description: `0 of ${total} done` });
285
+ run.current.id = id;
286
+ run.current.timer = window.setInterval(() => {
287
+ done = Math.min(total, done + 31);
288
+ if (done < total) {
289
+ toast.loading(`Importing ${total} products`, {
290
+ id,
291
+ description: `${done} of ${total} done`
292
+ });
293
+ return;
294
+ }
295
+ window.clearInterval(run.current.timer);
296
+ run.current.id = void 0;
297
+ toast.success(`Imported ${total} products`, {
298
+ id,
299
+ description: "231 new and 17 updated.",
300
+ action: {
301
+ label: "View products",
302
+ onClick: () => {}
303
+ }
304
+ });
305
+ }, 450);
306
+ };
307
+ return /* @__PURE__ */ jsx(Button, {
308
+ icon: /* @__PURE__ */ jsx(UploadSimpleIcon, {}),
309
+ onClick: start,
310
+ children: "Import products"
311
+ });
312
+ }
313
+ var ORDERS = [
314
+ [
315
+ "#1051",
316
+ "£129.00",
317
+ "Ella Brooks"
318
+ ],
319
+ [
320
+ "#1052",
321
+ "£64.50",
322
+ "Sam Patel"
323
+ ],
324
+ [
325
+ "#1053",
326
+ "£312.00",
327
+ "Priya Shah"
328
+ ]
329
+ ];
330
+ function OrdersDemo() {
331
+ return /* @__PURE__ */ jsx(Button, {
332
+ icon: /* @__PURE__ */ jsx(ShoppingBagIcon, {}),
333
+ onClick: () => ORDERS.forEach(([order, total, name], i) => window.setTimeout(() => toast.info(`New order ${order}`, { description: `${total} from ${name}.` }), i * 350)),
334
+ children: "Three orders arrive"
335
+ });
336
+ }
337
+ /** A Toaster of its own inside each side of a theme pair: its toasts take that side's theme. */
338
+ function ScopedToasts() {
339
+ const theme = useThemeScope() ?? "light";
340
+ const [stage, setStage] = useState(null);
341
+ const toasterId = `toast-docs-${theme}`;
342
+ return /* @__PURE__ */ jsxs("div", {
343
+ ref: setStage,
344
+ className: "toast-scoped",
345
+ children: [/* @__PURE__ */ jsx(Button, {
346
+ icon: /* @__PURE__ */ jsx(ArrowsClockwiseIcon, {}),
347
+ onClick: () => toast.success("Stock synced", {
348
+ description: "1,284 products checked against Northgate Supply.",
349
+ toasterId
350
+ }),
351
+ children: "Sync stock"
352
+ }), stage ? /* @__PURE__ */ jsx(Toaster, {
353
+ id: toasterId,
354
+ container: stage,
355
+ hotkey: [],
356
+ offset: 16
357
+ }) : null]
358
+ });
359
+ }
360
+ /** An editor whose Save and Publish sit where toasts land holds the bottom centre for every toast raised while it is open. */
361
+ function HeldPositionDemo() {
362
+ const [editing, setEditing] = useState(true);
363
+ const insert = () => toast.success("Template inserted", { description: "Two columns, from the Harbour Desk Co library." });
364
+ const button = /* @__PURE__ */ jsx(Button, {
365
+ icon: /* @__PURE__ */ jsx(PaintBrushIcon, {}),
366
+ onClick: insert,
367
+ children: "Insert a template"
368
+ });
369
+ return /* @__PURE__ */ jsxs("div", {
370
+ className: "toast-held",
371
+ children: [/* @__PURE__ */ jsx(Switch, {
372
+ label: "The page editor is open",
373
+ checked: editing,
374
+ onCheckedChange: setEditing
375
+ }), editing ? /* @__PURE__ */ jsx(ToastPositionScope, {
376
+ position: "bottom-center",
377
+ children: button
378
+ }) : button]
379
+ });
380
+ }
381
+ var RESET_ELEMENTS = [
382
+ "Hero banner",
383
+ "Product grid",
384
+ "Testimonials",
385
+ "Footer"
386
+ ];
387
+ function BurstDemo() {
388
+ const [batch] = useState(() => createToastBatch({ flush: (names) => {
389
+ const shown = names.slice(0, 3).join(", ");
390
+ const more = names.length - 3;
391
+ toast.warning(names.length === 1 ? `${names[0]} had settings reset` : `${names.length} elements had settings reset`, { description: more > 0 ? `${shown} and ${more} more. Check them before you publish.` : `${shown}. Check them before you publish.` });
392
+ } }));
393
+ useEffect(() => () => batch.cancel(), [batch]);
394
+ return /* @__PURE__ */ jsx(Button, {
395
+ icon: /* @__PURE__ */ jsx(WarningIcon, {}),
396
+ onClick: () => RESET_ELEMENTS.forEach((name, index) => setTimeout(() => batch.add(name), index * 60)),
397
+ children: "Open a page with four reset elements"
398
+ });
399
+ }
400
+ function ChimeDemo() {
401
+ const [on, setOn] = useState(isChimeEnabled);
402
+ return /* @__PURE__ */ jsxs("div", {
403
+ className: "toast-held",
404
+ children: [/* @__PURE__ */ jsx(Switch, {
405
+ label: "Play a sound for new messages",
406
+ checked: on,
407
+ onCheckedChange: (next) => {
408
+ setChimeEnabled(next);
409
+ setOn(next);
410
+ }
411
+ }), /* @__PURE__ */ jsx(Button, {
412
+ icon: /* @__PURE__ */ jsx(BellIcon, {}),
413
+ onClick: () => {
414
+ playChime();
415
+ toast.info("New message from Priya Shah", { description: "\"Is the Arden chair back in stock?\"" });
416
+ },
417
+ children: "A customer writes in"
418
+ })]
419
+ });
420
+ }
421
+ var TONES = [
422
+ "message",
423
+ "success",
424
+ "info",
425
+ "warning",
426
+ "error",
427
+ "loading"
428
+ ];
429
+ var POSITIONS = [
430
+ "top-left",
431
+ "top-center",
432
+ "top-right",
433
+ "bottom-left",
434
+ "bottom-center",
435
+ "bottom-right"
436
+ ];
437
+ var quote = (text) => `'${text.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
438
+ function Control({ label, text, children }) {
439
+ const id = useId();
440
+ return /* @__PURE__ */ jsxs("div", {
441
+ className: "doc-playground__control",
442
+ "data-type": text ? "text" : void 0,
443
+ children: [/* @__PURE__ */ jsx("span", {
444
+ className: "doc-playground__label",
445
+ id,
446
+ children: label
447
+ }), children(id)]
448
+ });
449
+ }
450
+ function ToastPlayground() {
451
+ const [tone, setTone] = useState("success");
452
+ const [title, setTitle] = useState("Order #1042 marked as fulfilled");
453
+ const [description, setDescription] = useState("We emailed James Okafor his tracking link.");
454
+ const [action, setAction] = useState(true);
455
+ const [dismissable, setDismissable] = useState(true);
456
+ const [position, setPosition] = useState("bottom-right");
457
+ const lines = [
458
+ description ? `description: ${quote(description)},` : null,
459
+ action ? `action: { label: 'Undo', onClick: undo },` : null,
460
+ position !== "bottom-right" ? `position: ${quote(position)},` : null,
461
+ !dismissable && tone !== "loading" ? "dismissable: false," : null
462
+ ].filter((line) => line !== null);
463
+ const call = tone === "message" ? "toast" : `toast.${tone}`;
464
+ const code = lines.length ? `${call}(${quote(title)}, {\n${lines.map((line) => ` ${line}`).join("\n")}\n})` : `${call}(${quote(title)})`;
465
+ const show = () => {
466
+ const options = {
467
+ description: description || void 0,
468
+ action: action ? {
469
+ label: "Undo",
470
+ onClick: () => {}
471
+ } : void 0,
472
+ position,
473
+ dismissable
474
+ };
475
+ if (tone === "message") toast(title, options);
476
+ else toast[tone](title, options);
477
+ };
478
+ return /* @__PURE__ */ jsxs("figure", {
479
+ className: "doc-playground",
480
+ children: [
481
+ /* @__PURE__ */ jsxs("div", {
482
+ className: "doc-playground__stage",
483
+ children: [/* @__PURE__ */ jsx(Button, {
484
+ variant: "primary",
485
+ disabled: !title.trim(),
486
+ onClick: show,
487
+ children: "Show toast"
488
+ }), /* @__PURE__ */ jsx(Button, {
489
+ onClick: () => toast.dismiss(),
490
+ children: "Dismiss all"
491
+ })]
492
+ }),
493
+ /* @__PURE__ */ jsxs("div", {
494
+ className: "doc-playground__controls",
495
+ role: "group",
496
+ "aria-label": "Toast options",
497
+ children: [
498
+ /* @__PURE__ */ jsx(Control, {
499
+ label: "tone",
500
+ children: () => /* @__PURE__ */ jsx("div", {
501
+ className: "doc-playground__scroll",
502
+ children: /* @__PURE__ */ jsx(SegmentedControl, {
503
+ "aria-label": "tone",
504
+ size: "sm",
505
+ value: tone,
506
+ onValueChange: setTone,
507
+ options: TONES.map((t) => ({
508
+ value: t,
509
+ label: t
510
+ }))
511
+ })
512
+ })
513
+ }),
514
+ /* @__PURE__ */ jsx(Control, {
515
+ label: "title",
516
+ text: true,
517
+ children: (id) => /* @__PURE__ */ jsx(Input, {
518
+ size: "sm",
519
+ "aria-labelledby": id,
520
+ value: title,
521
+ onChange: (e) => setTitle(e.target.value)
522
+ })
523
+ }),
524
+ /* @__PURE__ */ jsx(Control, {
525
+ label: "description",
526
+ text: true,
527
+ children: (id) => /* @__PURE__ */ jsx(Input, {
528
+ size: "sm",
529
+ "aria-labelledby": id,
530
+ value: description,
531
+ onChange: (e) => setDescription(e.target.value)
532
+ })
533
+ }),
534
+ /* @__PURE__ */ jsx(Control, {
535
+ label: "action",
536
+ children: (id) => /* @__PURE__ */ jsx(Switch, {
537
+ size: "sm",
538
+ "aria-labelledby": id,
539
+ checked: action,
540
+ onCheckedChange: setAction
541
+ })
542
+ }),
543
+ /* @__PURE__ */ jsx(Control, {
544
+ label: "dismissable",
545
+ children: (id) => /* @__PURE__ */ jsx(Switch, {
546
+ size: "sm",
547
+ "aria-labelledby": id,
548
+ checked: dismissable,
549
+ onCheckedChange: setDismissable
550
+ })
551
+ }),
552
+ /* @__PURE__ */ jsx(Control, {
553
+ label: "position",
554
+ children: () => /* @__PURE__ */ jsx("div", {
555
+ className: "doc-playground__scroll",
556
+ children: /* @__PURE__ */ jsx(SegmentedControl, {
557
+ "aria-label": "position",
558
+ size: "sm",
559
+ value: position,
560
+ onValueChange: setPosition,
561
+ options: POSITIONS.map((p) => ({
562
+ value: p,
563
+ label: p
564
+ }))
565
+ })
566
+ })
567
+ })
568
+ ]
569
+ }),
570
+ /* @__PURE__ */ jsx(CodeBlock$1, { code })
571
+ ]
572
+ });
573
+ }
574
+ function Tone({ tone, children }) {
575
+ const colour = {
576
+ success: "var(--o-positive)",
577
+ error: "var(--o-negative)",
578
+ warning: "var(--o-warning)",
579
+ info: "var(--o-info)",
580
+ loading: "var(--o-accent)"
581
+ }[tone];
582
+ return /* @__PURE__ */ jsxs("span", {
583
+ className: "toast-tone",
584
+ style: { color: colour },
585
+ children: [TONE_ICONS[tone], /* @__PURE__ */ jsx("span", {
586
+ style: { color: "var(--o-fg-1)" },
587
+ children
588
+ })]
589
+ });
590
+ }
591
+ function DoDontToast(props) {
592
+ return /* @__PURE__ */ jsx(SpecimenFrame, {
593
+ className: "toast-stills",
594
+ children: /* @__PURE__ */ jsx(ToastStill, { ...props })
595
+ });
596
+ }
597
+ function Page() {
598
+ useEffect(() => () => toast.dismiss(), []);
599
+ return /* @__PURE__ */ jsxs(DocPage, {
600
+ title: "Toast",
601
+ status: "new",
602
+ importNames: ["Toaster", "toast"],
603
+ lead: "A short message at the edge of the window about something that just happened: an order fulfilled, an export started, a payment that failed. It leaves on its own, so it never carries anything the merchant has to act on.",
604
+ children: [
605
+ /* @__PURE__ */ jsxs(Section$1, {
606
+ id: "basics",
607
+ title: "Basics",
608
+ description: /* @__PURE__ */ jsxs("p", { children: [
609
+ "Mount one ",
610
+ /* @__PURE__ */ jsx("code", { children: "Toaster" }),
611
+ " near the root of the app, then call ",
612
+ /* @__PURE__ */ jsx("code", { children: "toast" }),
613
+ " from anywhere: an event handler, a mutation's ",
614
+ /* @__PURE__ */ jsx("code", { children: "onSuccess" }),
615
+ ", a hook. The Toaster draws nothing until a toast arrives. Each toast rises in from the bottom right on the Orbit spring, stays a few seconds and slips back out."
616
+ ] }),
617
+ children: [/* @__PURE__ */ jsx(Example, {
618
+ code: `
619
+ // Once, near the root of the app
620
+ <Toaster />
621
+
622
+ // Anywhere
623
+ toast.success('Order #1042 marked as fulfilled', {
624
+ description: 'We emailed James Okafor his tracking link.',
625
+ })`,
626
+ children: /* @__PURE__ */ jsx(BasicsDemo, {})
627
+ }), /* @__PURE__ */ jsxs(Note, {
628
+ title: "One Toaster",
629
+ children: [
630
+ "Two Toasters on a page show every toast twice. To have more than one, give each an ",
631
+ /* @__PURE__ */ jsx("code", { children: "id" }),
632
+ " and send toasts to it with ",
633
+ /* @__PURE__ */ jsx("code", { children: "toasterId" }),
634
+ ", as the theme demo below does."
635
+ ]
636
+ })]
637
+ }),
638
+ /* @__PURE__ */ jsxs(Section$1, {
639
+ id: "tones",
640
+ title: "Tones",
641
+ description: /* @__PURE__ */ jsxs("p", { children: [
642
+ "Five tones and a plain message. The surface never changes: only the icon carries the tone, in its status colour. A loading toast shows the orbit spinner and stays until you update it with the same ",
643
+ /* @__PURE__ */ jsx("code", { children: "id" }),
644
+ ", as the Loading button does after a moment."
645
+ ] }),
646
+ children: [/* @__PURE__ */ jsx(Example, {
647
+ code: `
648
+ toast.success('Order #1042 marked as fulfilled', { description: 'We emailed James Okafor his tracking link.' })
649
+ toast.error('Could not capture £89.50', {
650
+ description: 'The card issuer declined the payment for order #1043. Ask the customer for another card.',
651
+ })
652
+ toast.warning('Only 3 Walnut desk risers left', { description: 'Reorder from Northgate Supply to keep it on sale.' })
653
+ toast.info('Export on its way', { description: 'We will email you the CSV of 318 orders when it is ready.' })
654
+
655
+ const id = toast.loading('Importing 248 products', { description: 'From Northgate Supply. You can keep working.' })
656
+ // later, the same id turns it into the outcome
657
+ toast.success('Imported 248 products', { id, description: '231 new and 17 updated.' })
658
+
659
+ toast('Order link copied')`,
660
+ children: /* @__PURE__ */ jsx(TonesDemo, {})
661
+ }), /* @__PURE__ */ jsx(DocTable, {
662
+ columns: [
663
+ "Tone",
664
+ "Call",
665
+ "Stays for",
666
+ "Use it for"
667
+ ],
668
+ rows: [
669
+ [
670
+ /* @__PURE__ */ jsx(Tone, {
671
+ tone: "success",
672
+ children: "Success"
673
+ }),
674
+ /* @__PURE__ */ jsx("code", { children: "toast.success" }),
675
+ "4 seconds",
676
+ "Something the merchant did worked."
677
+ ],
678
+ [
679
+ /* @__PURE__ */ jsx(Tone, {
680
+ tone: "error",
681
+ children: "Error"
682
+ }),
683
+ /* @__PURE__ */ jsx("code", { children: "toast.error" }),
684
+ "8 seconds",
685
+ "Something did not work. Say what failed and what to do next."
686
+ ],
687
+ [
688
+ /* @__PURE__ */ jsx(Tone, {
689
+ tone: "warning",
690
+ children: "Warning"
691
+ }),
692
+ /* @__PURE__ */ jsx("code", { children: "toast.warning" }),
693
+ "6 seconds",
694
+ "It worked, with a catch worth knowing about."
695
+ ],
696
+ [
697
+ /* @__PURE__ */ jsx(Tone, {
698
+ tone: "info",
699
+ children: "Info"
700
+ }),
701
+ /* @__PURE__ */ jsx("code", { children: "toast.info" }),
702
+ "5 seconds",
703
+ "Something happened that the merchant did not do here: an export started, a new order came in."
704
+ ],
705
+ [
706
+ /* @__PURE__ */ jsx(Tone, {
707
+ tone: "loading",
708
+ children: "Loading"
709
+ }),
710
+ /* @__PURE__ */ jsx("code", { children: "toast.loading" }),
711
+ "Until it ends",
712
+ "Work that finishes on its own. Turn it into its outcome, or use toast.promise."
713
+ ],
714
+ [
715
+ /* @__PURE__ */ jsx("span", {
716
+ className: "toast-tone",
717
+ children: "Message"
718
+ }),
719
+ /* @__PURE__ */ jsx("code", { children: "toast" }),
720
+ "4 seconds",
721
+ "A quiet confirmation with no tone: a link copied, a draft saved."
722
+ ]
723
+ ]
724
+ })]
725
+ }),
726
+ /* @__PURE__ */ jsxs(Section$1, {
727
+ id: "both-themes",
728
+ title: "In both themes",
729
+ description: /* @__PURE__ */ jsx("p", { children: "Held still for review, light beside dark. The surface matches the popover's (raised, 14px corners, the floating shadow) and adds a hairline ring, so its edge holds over any page. The title is in the UI weight and the description is muted. In dark the surface lifts to graphite and the status colours brighten to stay readable." }),
730
+ children: [
731
+ /* @__PURE__ */ jsx(ThemePair, {
732
+ align: "fill",
733
+ caption: "Stills drawn with the toast's own classes. Every toast fired on this page is live.",
734
+ children: /* @__PURE__ */ jsx(AllTonesStill, {})
735
+ }),
736
+ /* @__PURE__ */ jsx(SubSection, {
737
+ title: "Long content",
738
+ description: /* @__PURE__ */ jsx("p", { children: "Titles and descriptions wrap; the icon and close button stay with the first line." }),
739
+ children: /* @__PURE__ */ jsx(ThemePair, {
740
+ align: "fill",
741
+ children: /* @__PURE__ */ jsx(LongStill, {})
742
+ })
743
+ }),
744
+ /* @__PURE__ */ jsx(SubSection, {
745
+ title: "Inside a ThemeScope",
746
+ description: /* @__PURE__ */ jsxs("p", { children: [
747
+ "A Toaster inside a ",
748
+ /* @__PURE__ */ jsx("code", { children: "ThemeScope" }),
749
+ " takes the scope's theme, as the kit's other overlays do; anywhere else it follows the page. Each side here has a Toaster of its own, framed to its panel."
750
+ ] }),
751
+ children: /* @__PURE__ */ jsx(ThemePair, { children: /* @__PURE__ */ jsx(ScopedToasts, {}) })
752
+ })
753
+ ]
754
+ }),
755
+ /* @__PURE__ */ jsx(Section$1, {
756
+ id: "descriptions",
757
+ title: "With and without a description",
758
+ description: /* @__PURE__ */ jsxs("p", { children: [
759
+ "The title says what happened. Add a ",
760
+ /* @__PURE__ */ jsx("code", { children: "description" }),
761
+ " only when the merchant needs one more fact: what happens next, or what changed."
762
+ ] }),
763
+ children: /* @__PURE__ */ jsx(Example, {
764
+ code: `
765
+ toast.success('Discount code saved')
766
+
767
+ toast.success('Discount code saved', {
768
+ description: 'SUMMER15 takes 15% off orders over £50 until 31 August.',
769
+ })`,
770
+ children: /* @__PURE__ */ jsx(DescriptionDemo, {})
771
+ })
772
+ }),
773
+ /* @__PURE__ */ jsxs(Section$1, {
774
+ id: "actions",
775
+ title: "Actions",
776
+ description: /* @__PURE__ */ jsxs("p", { children: [
777
+ "One follow-up, as a small button under the text: Undo, Try again, View order. The toast closes once the action has run. Call ",
778
+ /* @__PURE__ */ jsx("code", { children: "event.preventDefault()" }),
779
+ " in ",
780
+ /* @__PURE__ */ jsx("code", { children: "onClick" }),
781
+ " to keep it open; an action on a loading toast never closes it."
782
+ ] }),
783
+ children: [/* @__PURE__ */ jsx(SubSection, {
784
+ title: "Undo",
785
+ description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "altText" }), " is the button's accessible name, for when the label alone would be unclear out of context. Keep the label's words in it: if they are missing, the label is put in front."] }),
786
+ children: /* @__PURE__ */ jsx(Example, {
787
+ code: `
788
+ toast('Deleted Walnut desk riser', {
789
+ description: 'It has left your catalogue.',
790
+ action: {
791
+ label: 'Undo',
792
+ altText: 'Undo deleting Walnut desk riser',
793
+ onClick: () => restore(product),
794
+ },
795
+ })`,
796
+ children: /* @__PURE__ */ jsx(UndoDemo, {})
797
+ })
798
+ }), /* @__PURE__ */ jsx(SubSection, {
799
+ title: "Waiting for the action",
800
+ description: /* @__PURE__ */ jsxs("p", { children: [
801
+ "Return a promise from ",
802
+ /* @__PURE__ */ jsx("code", { children: "onClick" }),
803
+ " and the button keeps the comet in orbit until it settles. The toast closes when it resolves and stays when it rejects. This one tries again for a moment, then reports back."
804
+ ] }),
805
+ children: /* @__PURE__ */ jsx(Example, {
806
+ code: `
807
+ toast.error('Could not send invoice INV-2207', {
808
+ description: 'The email server did not answer.',
809
+ action: {
810
+ label: 'Try again',
811
+ altText: 'Try again to send invoice INV-2207',
812
+ onClick: async () => {
813
+ await sendInvoice(invoice)
814
+ toast.success('Sent invoice INV-2207', { description: 'Ella Brooks has it by email, as a PDF.' })
815
+ },
816
+ },
817
+ })`,
818
+ children: /* @__PURE__ */ jsx(RetryDemo, {})
819
+ })
820
+ })]
821
+ }),
822
+ /* @__PURE__ */ jsxs(Section$1, {
823
+ id: "loading",
824
+ title: "Loading and promises",
825
+ description: /* @__PURE__ */ jsxs("p", { children: [
826
+ /* @__PURE__ */ jsx("code", { children: "toast.promise" }),
827
+ " shows a loading toast while the work runs, then turns it into the outcome in place: the spinner gives way to the tone icon, which lands with a small settle. Each state is a title, or a",
828
+ " ",
829
+ /* @__PURE__ */ jsx("code", { children: "{ title, description }" }),
830
+ "; ",
831
+ /* @__PURE__ */ jsx("code", { children: "success" }),
832
+ " and ",
833
+ /* @__PURE__ */ jsx("code", { children: "error" }),
834
+ " can also be functions of the result or the error. Leave one out and the toast simply closes. It returns the toast's id straight away."
835
+ ] }),
836
+ children: [/* @__PURE__ */ jsx(Example, {
837
+ code: `
838
+ toast.promise(publishTheme(harbour), {
839
+ loading: 'Publishing the Harbour theme',
840
+ success: { title: 'Harbour is live', description: 'Your store switched themes. You can switch back from Themes.' },
841
+ error: 'Could not publish the theme',
842
+ })
843
+
844
+ toast.promise(syncStock(), {
845
+ loading: { title: 'Syncing stock', description: 'Checking 1,284 products against Northgate Supply.' },
846
+ success: (count) => \`Updated stock for \${count} products\`,
847
+ error: (error) => ({ title: 'Stock sync failed', description: error.message }),
848
+ })`,
849
+ caption: "Sync stock fails on purpose, to show the error state.",
850
+ children: /* @__PURE__ */ jsx(PromiseDemo, {})
851
+ }), /* @__PURE__ */ jsx(SubSection, {
852
+ title: "Progress, updated in place",
853
+ description: /* @__PURE__ */ jsxs("p", { children: [
854
+ "Call ",
855
+ /* @__PURE__ */ jsx("code", { children: "toast.loading" }),
856
+ " again with the same ",
857
+ /* @__PURE__ */ jsx("code", { children: "id" }),
858
+ " to update it, and finish with",
859
+ " ",
860
+ /* @__PURE__ */ jsx("code", { children: "toast.success" }),
861
+ " or ",
862
+ /* @__PURE__ */ jsx("code", { children: "toast.error" }),
863
+ " on that id. The toast keeps its place in the stack throughout. Dismiss it yourself if the work is abandoned."
864
+ ] }),
865
+ children: /* @__PURE__ */ jsx(Example, {
866
+ code: `
867
+ const id = toast.loading('Importing 248 products', { description: '0 of 248 done' })
868
+
869
+ onProgress((done) => toast.loading('Importing 248 products', { id, description: \`\${done} of 248 done\` }))
870
+
871
+ onDone(() =>
872
+ toast.success('Imported 248 products', {
873
+ id,
874
+ description: '231 new and 17 updated.',
875
+ action: { label: 'View products', onClick: openProducts },
876
+ }),
877
+ )`,
878
+ children: /* @__PURE__ */ jsx(ImportDemo, {})
879
+ })
880
+ })]
881
+ }),
882
+ /* @__PURE__ */ jsxs(Section$1, {
883
+ id: "timing",
884
+ title: "How long they stay",
885
+ description: /* @__PURE__ */ jsxs("p", { children: [
886
+ "Each tone has its own time on screen, longest for errors because they say what went wrong and what to do about it. A loading toast stays until it is updated or dismissed. Pass ",
887
+ /* @__PURE__ */ jsx("code", { children: "duration" }),
888
+ " in milliseconds to change one, or ",
889
+ /* @__PURE__ */ jsx("code", { children: "Infinity" }),
890
+ " to keep it until it is closed."
891
+ ] }),
892
+ children: [/* @__PURE__ */ jsx(DocTable, {
893
+ columns: ["Tone", "Default duration"],
894
+ rows: [
895
+ [/* @__PURE__ */ jsx("code", { children: "toast" }), "4,000ms"],
896
+ [/* @__PURE__ */ jsx("code", { children: "toast.success" }), "4,000ms"],
897
+ [/* @__PURE__ */ jsx("code", { children: "toast.info" }), "5,000ms"],
898
+ [/* @__PURE__ */ jsx("code", { children: "toast.warning" }), "6,000ms"],
899
+ [/* @__PURE__ */ jsx("code", { children: "toast.error" }), "8,000ms"],
900
+ [/* @__PURE__ */ jsx("code", { children: "toast.loading" }), "Infinity"]
901
+ ]
902
+ }), /* @__PURE__ */ jsx(Guidelines, { items: ["Every timer pauses while the pointer is over the toasts, while the stack is fanned out, and while the browser tab is in the background.", "An update by id restarts the timer, so a loading toast that turns into its outcome gets the outcome tone's full time."] })]
903
+ }),
904
+ /* @__PURE__ */ jsxs(Section$1, {
905
+ id: "stacking",
906
+ title: "Stacking and position",
907
+ description: /* @__PURE__ */ jsx("p", { children: "The newest toast sits in front. Up to two more fold behind it, each 12px further back and 5% smaller, with their content hidden. Hover the stack (or press Alt+T) and it fans out, 12px apart, with their timers paused. Tabbing into it fans it out too, so a folded toast is never focused unseen. Swipe a toast towards the edge it sits against to dismiss it." }),
908
+ children: [
909
+ /* @__PURE__ */ jsx(ThemePair, {
910
+ align: "fill",
911
+ caption: "The folded stack, held still.",
912
+ children: /* @__PURE__ */ jsx(StackStill, {})
913
+ }),
914
+ /* @__PURE__ */ jsx(Example, {
915
+ code: `
916
+ toast.info('New order #1051', { description: '£129.00 from Ella Brooks.' })
917
+ toast.info('New order #1052', { description: '£64.50 from Sam Patel.' })
918
+ toast.info('New order #1053', { description: '£312.00 from Priya Shah.' })`,
919
+ caption: "Then hover the stack at the bottom right.",
920
+ children: /* @__PURE__ */ jsx(OrdersDemo, {})
921
+ }),
922
+ /* @__PURE__ */ jsx(SubSection, {
923
+ title: "Position",
924
+ description: /* @__PURE__ */ jsxs("p", { children: [
925
+ "Toasts appear at the Toaster's ",
926
+ /* @__PURE__ */ jsx("code", { children: "position" }),
927
+ ", the bottom right by default, 24px in from the edges. A toast can choose its own with ",
928
+ /* @__PURE__ */ jsx("code", { children: "position" }),
929
+ ", for a screen where that corner is busy; try it in the playground. On screens up to 600px wide they span the width, 16px in from each side."
930
+ ] })
931
+ }),
932
+ /* @__PURE__ */ jsx(SubSection, {
933
+ title: "Holding a position for a part of the app",
934
+ description: /* @__PURE__ */ jsxs("p", { children: [
935
+ "An editor whose Save and Publish sit where toasts land can hold a position for them while it is open: wrap it in ",
936
+ /* @__PURE__ */ jsx("code", { children: "ToastPositionScope" }),
937
+ ", and every toast raised meanwhile that names no",
938
+ " ",
939
+ /* @__PURE__ */ jsx("code", { children: "position" }),
940
+ " of its own goes there, the ones shared code raises included. Outside a component,",
941
+ " ",
942
+ /* @__PURE__ */ jsx("code", { children: "toast.setDefaultPosition(position)" }),
943
+ " does the same and returns the function that lets it go. Holds stack, so the newest wins. A toast already showing stays where it is, and the outcome of a",
944
+ " ",
945
+ /* @__PURE__ */ jsx("code", { children: "toast.promise" }),
946
+ " lands where its work started."
947
+ ] }),
948
+ children: /* @__PURE__ */ jsx(Example, {
949
+ code: `
950
+ <ToastPositionScope position="bottom-center">
951
+ <PageEditor /> {/* toast.success('Template inserted') lands at the bottom centre */}
952
+ </ToastPositionScope>
953
+
954
+ // Or, outside React
955
+ const release = toast.setDefaultPosition('bottom-center')
956
+ …
957
+ release()`,
958
+ caption: "Insert a template with the editor open, then with it closed.",
959
+ children: /* @__PURE__ */ jsx(HeldPositionDemo, {})
960
+ })
961
+ })
962
+ ]
963
+ }),
964
+ /* @__PURE__ */ jsx(Section$1, {
965
+ id: "bursts",
966
+ title: "One toast for a burst",
967
+ description: /* @__PURE__ */ jsxs("p", { children: [
968
+ "When something reports one event per item (each element of a page whose settings were reset as it loaded), gather them with ",
969
+ /* @__PURE__ */ jsx("code", { children: "createToastBatch" }),
970
+ " and raise one toast for the lot. Items added within",
971
+ " ",
972
+ /* @__PURE__ */ jsx("code", { children: "wait" }),
973
+ " (500ms by default) of the first are handed to ",
974
+ /* @__PURE__ */ jsx("code", { children: "flush" }),
975
+ " together; ",
976
+ /* @__PURE__ */ jsx("code", { children: "key" }),
977
+ " ",
978
+ "leaves out one already gathered, and ",
979
+ /* @__PURE__ */ jsx("code", { children: "cancel" }),
980
+ " drops the lot when the page it was about goes away."
981
+ ] }),
982
+ children: /* @__PURE__ */ jsx(Example, {
983
+ code: `
984
+ const reset = createToastBatch<string>({
985
+ flush: (names) =>
986
+ toast.warning(\`\${names.length} elements had settings reset\`, {
987
+ description: \`\${names.slice(0, 3).join(', ')} and \${names.length - 3} more. Check them before you publish.\`,
988
+ }),
989
+ })
990
+
991
+ window.addEventListener('props-salvaged', (event) => reset.add(event.detail.element))
992
+ // In the effect's cleanup
993
+ reset.cancel()`,
994
+ children: /* @__PURE__ */ jsx(BurstDemo, {})
995
+ })
996
+ }),
997
+ /* @__PURE__ */ jsxs(Section$1, {
998
+ id: "sound",
999
+ title: "Sound",
1000
+ description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "playChime()" }), " plays the kit's notification sound, a short rising pop, for something that arrives while the person may be looking elsewhere: a customer's chat message, an assistant's reply. A burst within 1.5 seconds chimes once. A page whose audio the browser has suspended (no click yet, a tab in the background) is woken first, and a chime that would land over 2 seconds late is dropped. It never throws, and plays nothing without Web Audio."] }),
1001
+ children: [/* @__PURE__ */ jsx(Example, {
1002
+ code: `
1003
+ // The person's own setting, when it loads and whenever it changes
1004
+ setChimeEnabled(profile.notificationSound)
1005
+
1006
+ socket.on('message', (message) => {
1007
+ playChime()
1008
+ toast.info(\`New message from \${message.from}\`)
1009
+ })`,
1010
+ children: /* @__PURE__ */ jsx(ChimeDemo, {})
1011
+ }), /* @__PURE__ */ jsx(Guidelines, { items: [
1012
+ "Sound is an extra, never the only signal: raise a toast, a badge or a status with it.",
1013
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1014
+ "Give people a way to turn it off, keep their choice, and pass it to ",
1015
+ /* @__PURE__ */ jsx("code", { children: "setChimeEnabled" }),
1016
+ ". Off, the chime asks the browser for no audio at all."
1017
+ ] }),
1018
+ "Chime for what someone is waiting on from another person or a long job, not for what they just did themselves."
1019
+ ] })]
1020
+ }),
1021
+ /* @__PURE__ */ jsx(Section$1, {
1022
+ id: "playground",
1023
+ title: "Playground",
1024
+ description: /* @__PURE__ */ jsx("p", { children: "Build a toast, show it, and copy the call. Toasts follow the site theme: switch it in the header." }),
1025
+ children: /* @__PURE__ */ jsx(ToastPlayground, {})
1026
+ }),
1027
+ /* @__PURE__ */ jsxs(Section$1, {
1028
+ id: "guidelines",
1029
+ title: "Guidelines",
1030
+ children: [
1031
+ /* @__PURE__ */ jsx(DoDont, {
1032
+ do: {
1033
+ children: /* @__PURE__ */ jsx(DoDontToast, {
1034
+ tone: "success",
1035
+ title: "Refunded £89.50 to James Okafor",
1036
+ description: "It reaches his card in 5 to 10 working days."
1037
+ }),
1038
+ caption: "Say what happened and to what, in the merchant's words. The description adds the one fact they need next."
1039
+ },
1040
+ dont: {
1041
+ children: /* @__PURE__ */ jsx(DoDontToast, {
1042
+ tone: "success",
1043
+ title: "Success!",
1044
+ description: "The operation completed successfully."
1045
+ }),
1046
+ caption: "A cheer with no subject sends them back to the page to find out what worked."
1047
+ }
1048
+ }),
1049
+ /* @__PURE__ */ jsx(DoDont, {
1050
+ do: {
1051
+ children: /* @__PURE__ */ jsx(DoDontToast, {
1052
+ tone: "error",
1053
+ title: "Could not capture £89.50",
1054
+ description: "The card issuer declined it. Ask the customer for another card."
1055
+ }),
1056
+ caption: "Name what failed and the way forward. Make the title clear without the icon."
1057
+ },
1058
+ dont: {
1059
+ children: /* @__PURE__ */ jsx(DoDontToast, {
1060
+ tone: "error",
1061
+ title: "Error",
1062
+ description: "Something went wrong. Please try again."
1063
+ }),
1064
+ caption: "\"Something went wrong\" tells the merchant nothing they can act on."
1065
+ }
1066
+ }),
1067
+ /* @__PURE__ */ jsx(Guidelines, { items: [
1068
+ "Use a toast to confirm something the merchant just did, or to report work that finished in the background.",
1069
+ "A toast leaves on its own, so it is never the only place something important is said. Errors the merchant has to fix belong next to the problem: an error on the Field, or an Alert at the top of the form.",
1070
+ "Never ask a question in a toast. A decision wants a dialog.",
1071
+ "Title it with what happened, in a few words and sentence case, with no full stop. Screen readers read the title without the icon, so it has to carry the tone itself.",
1072
+ "One action at most, and never the only way to do something: an Undo should also be possible from the page or its history.",
1073
+ "Do not toast every autosave or every row of a bulk change. When several things finish together, say so once: \"Updated 12 products\".",
1074
+ "Never raise a toast as a page loads. Toasts answer something that just happened."
1075
+ ] })
1076
+ ]
1077
+ }),
1078
+ /* @__PURE__ */ jsxs(Section$1, {
1079
+ id: "accessibility",
1080
+ title: "Accessibility",
1081
+ children: [/* @__PURE__ */ jsx(Guidelines, { items: [
1082
+ "The Toaster is a polite live region: screen readers read each toast as it arrives, without moving focus.",
1083
+ "Alt+T (Option+T on a Mac) moves focus to the toasts and fans the stack out, and so does tabbing into them. Tab reaches each toast, its action and its close button. The stack stays fanned out while focus is in it, so no folded toast is focused unseen, and folds again when focus leaves.",
1084
+ "Closing a toast from the keyboard, with its close button or its action, moves focus to the next toast, or the one before. When it was the last, focus goes back to where it was before the toasts.",
1085
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1086
+ "The close button is named \"Dismiss\" (",
1087
+ /* @__PURE__ */ jsx("code", { children: "closeLabel" }),
1088
+ " on the Toaster changes it, for example in another language), and the region that holds the toasts \"Notifications\", before its hotkey (",
1089
+ /* @__PURE__ */ jsx("code", { children: "containerAriaLabel" }),
1090
+ "). An action's ",
1091
+ /* @__PURE__ */ jsx("code", { children: "altText" }),
1092
+ " becomes its accessible name."
1093
+ ] }),
1094
+ "Timers pause while the pointer is over the toasts and while Alt+T holds the stack open, so there is time to read and reach them.",
1095
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1096
+ "On touch screens a swipe towards the edge dismisses a toast. Loading toasts end with their work, so they cannot be dismissed unless they pass ",
1097
+ /* @__PURE__ */ jsx("code", { children: "dismissable: true" }),
1098
+ " (for work that runs for minutes)."
1099
+ ] }),
1100
+ "While a modal dialog is open, the page behind it takes no clicks, toasts included. They still appear and are read out.",
1101
+ "With reduced motion, toasts fade in and out where they stand, and the stack rearranges without sliding."
1102
+ ] }), /* @__PURE__ */ jsx(Fragment$1, {})]
1103
+ }),
1104
+ /* @__PURE__ */ jsx(Fragment$1, {}),
1105
+ /* @__PURE__ */ jsxs(Section$1, {
1106
+ id: "props",
1107
+ title: "Props",
1108
+ children: [
1109
+ /* @__PURE__ */ jsx(DocTable, {
1110
+ columns: [
1111
+ "Call",
1112
+ "Returns",
1113
+ "What it does"
1114
+ ],
1115
+ rows: [
1116
+ [
1117
+ /* @__PURE__ */ jsx("code", { children: "toast(title, options?)" }),
1118
+ /* @__PURE__ */ jsx("code", { children: "ToastId" }),
1119
+ "A plain message, with no tone icon."
1120
+ ],
1121
+ [
1122
+ /* @__PURE__ */ jsx("code", { children: "toast.success / error / warning / info (title, options?)" }),
1123
+ /* @__PURE__ */ jsx("code", { children: "ToastId" }),
1124
+ "A toast in that tone."
1125
+ ],
1126
+ [
1127
+ /* @__PURE__ */ jsx("code", { children: "toast.loading(title, options?)" }),
1128
+ /* @__PURE__ */ jsx("code", { children: "ToastId" }),
1129
+ "Stays until updated with its id, or dismissed."
1130
+ ],
1131
+ [
1132
+ /* @__PURE__ */ jsx("code", { children: "toast.promise(work, options)" }),
1133
+ /* @__PURE__ */ jsx("code", { children: "ToastId" }),
1134
+ "Loading while the work runs, then its outcome."
1135
+ ],
1136
+ [
1137
+ /* @__PURE__ */ jsx("code", { children: "toast.dismiss(id?)" }),
1138
+ /* @__PURE__ */ jsx("code", { children: "void" }),
1139
+ "Closes one toast, or every toast without an id."
1140
+ ],
1141
+ [
1142
+ /* @__PURE__ */ jsx("code", { children: "toast.setDefaultPosition(position)" }),
1143
+ /* @__PURE__ */ jsx("code", { children: "() => void" }),
1144
+ "Sends the toasts raised from now on that name no position there, until the returned function is called."
1145
+ ],
1146
+ [
1147
+ /* @__PURE__ */ jsx("code", { children: "createToastBatch(options)" }),
1148
+ /* @__PURE__ */ jsx("code", { children: "{ add, flush, cancel }" }),
1149
+ "Gathers a burst of items and raises one toast for them."
1150
+ ],
1151
+ [
1152
+ /* @__PURE__ */ jsx("code", { children: "playChime()" }),
1153
+ /* @__PURE__ */ jsx("code", { children: "void" }),
1154
+ "Plays the notification chime, unless it is turned off."
1155
+ ],
1156
+ [
1157
+ /* @__PURE__ */ jsx("code", { children: "setChimeEnabled(on)" }),
1158
+ /* @__PURE__ */ jsx("code", { children: "void" }),
1159
+ "Turns the chime off or on: the person's own setting. On by default."
1160
+ ],
1161
+ [
1162
+ /* @__PURE__ */ jsx("code", { children: "isChimeEnabled()" }),
1163
+ /* @__PURE__ */ jsx("code", { children: "boolean" }),
1164
+ "Whether the chime is on."
1165
+ ]
1166
+ ]
1167
+ }),
1168
+ /* @__PURE__ */ jsx(PropsTable, {
1169
+ title: "ToastPositionScope",
1170
+ rows: [{
1171
+ name: "position",
1172
+ type: "ToastPosition",
1173
+ required: true,
1174
+ description: "Where the toasts that name no position of their own go while it is mounted."
1175
+ }, {
1176
+ name: "children",
1177
+ type: "ReactNode",
1178
+ description: "The part of the app it holds the position for. Drawn as it is."
1179
+ }]
1180
+ }),
1181
+ /* @__PURE__ */ jsx(PropsTable, {
1182
+ title: "createToastBatch options",
1183
+ rows: [
1184
+ {
1185
+ name: "flush",
1186
+ type: "(items: T[]) => void",
1187
+ required: true,
1188
+ description: "Raises the one toast for what was gathered, in order. Never called with nothing."
1189
+ },
1190
+ {
1191
+ name: "wait",
1192
+ type: "number",
1193
+ default: "500",
1194
+ description: "How long to gather after the first item, in milliseconds."
1195
+ },
1196
+ {
1197
+ name: "key",
1198
+ type: "(item: T) => unknown",
1199
+ description: "Tells items apart, so one already gathered is left out."
1200
+ }
1201
+ ]
1202
+ }),
1203
+ /* @__PURE__ */ jsx(PropsTable, {
1204
+ title: "Toast options",
1205
+ rows: [
1206
+ {
1207
+ name: "description",
1208
+ type: "ReactNode",
1209
+ description: "One more fact, under the title."
1210
+ },
1211
+ {
1212
+ name: "action",
1213
+ type: "ToastAction",
1214
+ description: "One follow-up, as a small button under the text. See below."
1215
+ },
1216
+ {
1217
+ name: "duration",
1218
+ type: "number",
1219
+ default: "by tone",
1220
+ description: "Time on screen in milliseconds. Infinity keeps it until it is closed."
1221
+ },
1222
+ {
1223
+ name: "id",
1224
+ type: "string | number",
1225
+ description: "Reuse the id of a toast that is showing to update it in place."
1226
+ },
1227
+ {
1228
+ name: "dismissable",
1229
+ type: "boolean",
1230
+ default: "true",
1231
+ description: "false hides the close button and turns off swipe to dismiss. Also accepted as dismissible."
1232
+ },
1233
+ {
1234
+ name: "position",
1235
+ type: "ToastPosition",
1236
+ description: "This toast's corner, instead of the Toaster's."
1237
+ },
1238
+ {
1239
+ name: "icon",
1240
+ type: "ReactNode",
1241
+ description: "Replaces the tone's icon. null shows none."
1242
+ },
1243
+ {
1244
+ name: "onDismiss",
1245
+ type: "(id) => void",
1246
+ description: "Runs when it is closed: its close button, a swipe or toast.dismiss."
1247
+ },
1248
+ {
1249
+ name: "onAutoClose",
1250
+ type: "(id) => void",
1251
+ description: "Runs when its time runs out."
1252
+ },
1253
+ {
1254
+ name: "toasterId",
1255
+ type: "string",
1256
+ description: "Sends it to the Toaster with this id, on a page with more than one."
1257
+ }
1258
+ ]
1259
+ }),
1260
+ /* @__PURE__ */ jsx(PropsTable, {
1261
+ title: "ToastAction",
1262
+ rows: [
1263
+ {
1264
+ name: "label",
1265
+ type: "ReactNode",
1266
+ required: true,
1267
+ description: "The button's words: a verb, like \"Undo\"."
1268
+ },
1269
+ {
1270
+ name: "onClick",
1271
+ type: "(event) => void | Promise<unknown>",
1272
+ required: true,
1273
+ description: "Runs on click, then the toast closes. Call event.preventDefault() to keep it. Return a promise to show the busy state until it settles."
1274
+ },
1275
+ {
1276
+ name: "altText",
1277
+ type: "string",
1278
+ description: "The accessible name, when the label needs context. Keep the label's words in it."
1279
+ },
1280
+ {
1281
+ name: "variant",
1282
+ type: "'default' | 'destructive'",
1283
+ default: "'default'",
1284
+ description: "destructive turns the button red."
1285
+ }
1286
+ ]
1287
+ }),
1288
+ /* @__PURE__ */ jsx(PropsTable, {
1289
+ title: "toast.promise options",
1290
+ rows: [
1291
+ {
1292
+ name: "loading",
1293
+ type: "ReactNode | { title, description? }",
1294
+ required: true,
1295
+ description: "Shown while the work runs."
1296
+ },
1297
+ {
1298
+ name: "success",
1299
+ type: "ReactNode | { title, description? } | (result) => …",
1300
+ description: "Shown when it resolves. Leave it out and the toast closes."
1301
+ },
1302
+ {
1303
+ name: "error",
1304
+ type: "ReactNode | { title, description? } | (error) => …",
1305
+ description: "Shown when it fails. Leave it out and the toast closes."
1306
+ },
1307
+ {
1308
+ name: "…",
1309
+ type: "Toast options",
1310
+ description: "Every toast option except description and icon. duration applies to the outcome."
1311
+ }
1312
+ ]
1313
+ }),
1314
+ /* @__PURE__ */ jsx(PropsTable, {
1315
+ title: "Toaster",
1316
+ rows: [
1317
+ {
1318
+ name: "position",
1319
+ type: "'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'",
1320
+ default: "'bottom-right'",
1321
+ description: "Where toasts appear."
1322
+ },
1323
+ {
1324
+ name: "gap",
1325
+ type: "number",
1326
+ default: "12",
1327
+ description: "Space between toasts when the stack fans out, and how far each folded toast peeks out."
1328
+ },
1329
+ {
1330
+ name: "offset",
1331
+ type: "number | string | { top, right, bottom, left }",
1332
+ default: "24px",
1333
+ description: "Distance from the window's edges."
1334
+ },
1335
+ {
1336
+ name: "mobileOffset",
1337
+ type: "number | string | { top, right, bottom, left }",
1338
+ default: "16px",
1339
+ description: "The same on screens up to 600px wide, where toasts span the width."
1340
+ },
1341
+ {
1342
+ name: "visibleToasts",
1343
+ type: "number",
1344
+ default: "3",
1345
+ description: "How many show in the stack at once."
1346
+ },
1347
+ {
1348
+ name: "expand",
1349
+ type: "boolean",
1350
+ default: "false",
1351
+ description: "Keep the stack fanned out instead of folded."
1352
+ },
1353
+ {
1354
+ name: "closeLabel",
1355
+ type: "string",
1356
+ default: "'Dismiss'",
1357
+ description: "Accessible name of each toast's close button."
1358
+ },
1359
+ {
1360
+ name: "hotkey",
1361
+ type: "string[]",
1362
+ default: "['altKey', 'KeyT']",
1363
+ description: "Keys that focus the toasts and fan them out. An empty array turns it off."
1364
+ },
1365
+ {
1366
+ name: "containerAriaLabel",
1367
+ type: "string",
1368
+ default: "'Notifications'",
1369
+ description: "Name of the region that holds the toasts, said before the hotkey (\"Notifications alt+T\"). Give it in the page's language."
1370
+ },
1371
+ {
1372
+ name: "container",
1373
+ type: "HTMLElement | null",
1374
+ default: "document.body",
1375
+ description: "Where the toasts are portalled."
1376
+ },
1377
+ {
1378
+ name: "id",
1379
+ type: "string",
1380
+ description: "Names this Toaster, for toasts sent with toasterId."
1381
+ }
1382
+ ]
1383
+ })
1384
+ ]
1385
+ }),
1386
+ /* @__PURE__ */ jsx(Toaster, {})
1387
+ ]
1388
+ });
1389
+ }
1390
+ //#endregion
1391
+ export { Page, Preview };