@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,1198 @@
1
+ "use client";
2
+ import { t as DocLink } from "./host-B6znjEgQ.js";
3
+ import { a as DocTable, d as Section$1, i as DocPage, l as Note, m as ThemePair, o as Example, p as SubSection, r as DoDont, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
4
+ import { c as SpecimenFrame, s as PopoverSheet } from "./_overlays-specimens-bawR331Z.js";
5
+ import { useId, useRef, useState } from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+ import { Avatar, Button, Field, IconButton, Input, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, SearchField, SegmentedControl } from "@orbitcommerce/constellation";
8
+ import { CheckIcon, CopySimpleIcon, FunnelIcon, InfoIcon, LinkIcon, NotePencilIcon, PencilSimpleIcon, UserIcon, WarehouseIcon, XIcon } from "@orbitcommerce/constellation/icons";
9
+ //#region src/pages/components/popover.tsx
10
+ function Preview() {
11
+ return /* @__PURE__ */ jsx(PopoverSheet, {
12
+ padding: "sm",
13
+ width: 216,
14
+ children: /* @__PURE__ */ jsxs("div", {
15
+ className: "popover-form",
16
+ style: { gap: 10 },
17
+ children: [
18
+ /* @__PURE__ */ jsx("p", {
19
+ className: "popover-title",
20
+ children: "Adjust stock"
21
+ }),
22
+ /* @__PURE__ */ jsx(Input, {
23
+ size: "sm",
24
+ defaultValue: "3",
25
+ "aria-label": "Change by",
26
+ tabIndex: -1
27
+ }),
28
+ /* @__PURE__ */ jsxs("div", {
29
+ className: "popover-actions",
30
+ children: [/* @__PURE__ */ jsx(Button, {
31
+ size: "xs",
32
+ variant: "ghost",
33
+ tabIndex: -1,
34
+ children: "Cancel"
35
+ }), /* @__PURE__ */ jsx(Button, {
36
+ size: "xs",
37
+ variant: "primary",
38
+ tabIndex: -1,
39
+ children: "Save"
40
+ })]
41
+ })
42
+ ]
43
+ })
44
+ });
45
+ }
46
+ var REASONS = [
47
+ {
48
+ value: "received",
49
+ label: "Received"
50
+ },
51
+ {
52
+ value: "damaged",
53
+ label: "Damaged"
54
+ },
55
+ {
56
+ value: "recount",
57
+ label: "Recount"
58
+ }
59
+ ];
60
+ function AdjustStockPopover({ stock, onSave }) {
61
+ const titleId = useId();
62
+ const [open, setOpen] = useState(false);
63
+ const [change, setChange] = useState("3");
64
+ const [reason, setReason] = useState("received");
65
+ const [error, setError] = useState();
66
+ const delta = /^[+-]?\d+$/.test(change.trim()) ? Number.parseInt(change, 10) : NaN;
67
+ const after = Number.isNaN(delta) ? stock : stock + delta;
68
+ const save = (event) => {
69
+ event.preventDefault();
70
+ if (Number.isNaN(delta) || delta === 0) {
71
+ setError("Enter a whole number, like 5 or -2");
72
+ return;
73
+ }
74
+ if (after < 0) {
75
+ setError(`You can take away ${stock} at most`);
76
+ return;
77
+ }
78
+ onSave(after);
79
+ setOpen(false);
80
+ };
81
+ return /* @__PURE__ */ jsxs(Popover, {
82
+ open,
83
+ onOpenChange: (next) => {
84
+ setOpen(next);
85
+ if (next) {
86
+ setChange("3");
87
+ setReason("received");
88
+ setError(void 0);
89
+ }
90
+ },
91
+ children: [/* @__PURE__ */ jsx(PopoverTrigger, {
92
+ asChild: true,
93
+ children: /* @__PURE__ */ jsx(Button, {
94
+ size: "sm",
95
+ children: "Adjust stock"
96
+ })
97
+ }), /* @__PURE__ */ jsx(PopoverContent, {
98
+ align: "end",
99
+ width: 300,
100
+ "aria-labelledby": titleId,
101
+ children: /* @__PURE__ */ jsxs("form", {
102
+ className: "popover-form",
103
+ onSubmit: save,
104
+ noValidate: true,
105
+ children: [
106
+ /* @__PURE__ */ jsxs("div", {
107
+ className: "popover-heading",
108
+ children: [/* @__PURE__ */ jsx("h2", {
109
+ id: titleId,
110
+ className: "popover-title",
111
+ children: "Adjust stock"
112
+ }), /* @__PURE__ */ jsxs("p", {
113
+ className: "popover-meta",
114
+ children: [
115
+ "Arden ergonomic chair · ",
116
+ stock,
117
+ " in stock"
118
+ ]
119
+ })]
120
+ }),
121
+ /* @__PURE__ */ jsx(Field, {
122
+ label: "Change by",
123
+ hint: "Add a minus sign to take stock away",
124
+ error,
125
+ children: /* @__PURE__ */ jsx(Input, {
126
+ size: "sm",
127
+ inputMode: "numeric",
128
+ value: change,
129
+ onChange: (e) => {
130
+ setChange(e.target.value);
131
+ setError(void 0);
132
+ }
133
+ })
134
+ }),
135
+ /* @__PURE__ */ jsxs("div", {
136
+ className: "popover-group",
137
+ children: [/* @__PURE__ */ jsx("span", {
138
+ className: "popover-group__label",
139
+ "aria-hidden": "true",
140
+ children: "Reason"
141
+ }), /* @__PURE__ */ jsx(SegmentedControl, {
142
+ "aria-label": "Reason",
143
+ size: "sm",
144
+ fullWidth: true,
145
+ value: reason,
146
+ onValueChange: setReason,
147
+ options: REASONS
148
+ })]
149
+ }),
150
+ /* @__PURE__ */ jsxs("p", {
151
+ className: "popover-after",
152
+ children: ["Stock after this change: ", /* @__PURE__ */ jsx("strong", { children: after })]
153
+ }),
154
+ /* @__PURE__ */ jsxs("div", {
155
+ className: "popover-actions",
156
+ children: [/* @__PURE__ */ jsx(PopoverClose, {
157
+ asChild: true,
158
+ children: /* @__PURE__ */ jsx(Button, {
159
+ size: "sm",
160
+ variant: "ghost",
161
+ children: "Cancel"
162
+ })
163
+ }), /* @__PURE__ */ jsx(Button, {
164
+ size: "sm",
165
+ variant: "primary",
166
+ type: "submit",
167
+ children: "Save"
168
+ })]
169
+ })
170
+ ]
171
+ })
172
+ })]
173
+ });
174
+ }
175
+ function ProductRow() {
176
+ const [stock, setStock] = useState(12);
177
+ return /* @__PURE__ */ jsxs("div", {
178
+ className: "popover-product",
179
+ children: [
180
+ /* @__PURE__ */ jsx(Avatar, {
181
+ name: "Arden ergonomic chair",
182
+ shape: "square"
183
+ }),
184
+ /* @__PURE__ */ jsxs("span", {
185
+ className: "popover-product__name",
186
+ children: [/* @__PURE__ */ jsx("span", { children: "Arden ergonomic chair" }), /* @__PURE__ */ jsx("span", {
187
+ className: "popover-product__sku",
188
+ children: "CHR-ARD-01"
189
+ })]
190
+ }),
191
+ /* @__PURE__ */ jsxs("span", {
192
+ className: "popover-product__stock",
193
+ children: [stock, " in stock"]
194
+ }),
195
+ /* @__PURE__ */ jsx(AdjustStockPopover, {
196
+ stock,
197
+ onSave: setStock
198
+ })
199
+ ]
200
+ });
201
+ }
202
+ function AdjustStockAlone() {
203
+ const [stock, setStock] = useState(12);
204
+ return /* @__PURE__ */ jsx(AdjustStockPopover, {
205
+ stock,
206
+ onSave: setStock
207
+ });
208
+ }
209
+ function NotePopover() {
210
+ const titleId = useId();
211
+ return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
212
+ asChild: true,
213
+ children: /* @__PURE__ */ jsx(Button, {
214
+ icon: /* @__PURE__ */ jsx(NotePencilIcon, {}),
215
+ children: "Add a note"
216
+ })
217
+ }), /* @__PURE__ */ jsx(PopoverContent, {
218
+ width: 300,
219
+ "aria-labelledby": titleId,
220
+ children: /* @__PURE__ */ jsxs("div", {
221
+ className: "popover-form",
222
+ children: [
223
+ /* @__PURE__ */ jsx("h2", {
224
+ id: titleId,
225
+ className: "popover-title",
226
+ children: "Note on order #1043"
227
+ }),
228
+ /* @__PURE__ */ jsx(Field, {
229
+ label: "Note",
230
+ hint: "Only your staff can see it",
231
+ children: /* @__PURE__ */ jsx(Input, {
232
+ size: "sm",
233
+ placeholder: "e.g. Leave with the neighbour at 14"
234
+ })
235
+ }),
236
+ /* @__PURE__ */ jsxs("div", {
237
+ className: "popover-actions",
238
+ children: [/* @__PURE__ */ jsx(PopoverClose, {
239
+ asChild: true,
240
+ children: /* @__PURE__ */ jsx(Button, {
241
+ size: "sm",
242
+ variant: "ghost",
243
+ children: "Cancel"
244
+ })
245
+ }), /* @__PURE__ */ jsx(PopoverClose, {
246
+ asChild: true,
247
+ children: /* @__PURE__ */ jsx(Button, {
248
+ size: "sm",
249
+ variant: "primary",
250
+ children: "Save note"
251
+ })
252
+ })]
253
+ })
254
+ ]
255
+ })
256
+ })] });
257
+ }
258
+ function CustomerPopover() {
259
+ return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
260
+ asChild: true,
261
+ children: /* @__PURE__ */ jsx(Button, {
262
+ icon: /* @__PURE__ */ jsx(UserIcon, {}),
263
+ children: "Sarah Whitfield"
264
+ })
265
+ }), /* @__PURE__ */ jsx(PopoverContent, {
266
+ padding: "sm",
267
+ "aria-label": "Sarah Whitfield",
268
+ children: /* @__PURE__ */ jsxs("div", {
269
+ className: "popover-customer",
270
+ children: [
271
+ /* @__PURE__ */ jsxs("div", {
272
+ className: "popover-customer__who",
273
+ children: [/* @__PURE__ */ jsx(Avatar, { name: "Sarah Whitfield" }), /* @__PURE__ */ jsxs("span", {
274
+ className: "popover-heading",
275
+ children: [/* @__PURE__ */ jsx("span", {
276
+ className: "popover-title",
277
+ children: "Sarah Whitfield"
278
+ }), /* @__PURE__ */ jsx("span", {
279
+ className: "popover-meta",
280
+ children: "sarah.whitfield@example.co.uk"
281
+ })]
282
+ })]
283
+ }),
284
+ /* @__PURE__ */ jsxs("dl", {
285
+ className: "popover-figures",
286
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Orders" }), /* @__PURE__ */ jsx("dd", { children: "6" })] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Spent" }), /* @__PURE__ */ jsx("dd", { children: "£1,420.50" })] })]
287
+ }),
288
+ /* @__PURE__ */ jsx(Button, {
289
+ size: "sm",
290
+ fullWidth: true,
291
+ children: "View customer"
292
+ })
293
+ ]
294
+ })
295
+ })] });
296
+ }
297
+ function StockPopover() {
298
+ const titleId = useId();
299
+ return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
300
+ asChild: true,
301
+ children: /* @__PURE__ */ jsx(Button, {
302
+ icon: /* @__PURE__ */ jsx(WarehouseIcon, {}),
303
+ children: "12 in stock"
304
+ })
305
+ }), /* @__PURE__ */ jsxs(PopoverContent, {
306
+ padding: "none",
307
+ "aria-labelledby": titleId,
308
+ children: [/* @__PURE__ */ jsx("p", {
309
+ id: titleId,
310
+ className: "popover-list__title",
311
+ children: "Stock by location"
312
+ }), /* @__PURE__ */ jsxs("ul", {
313
+ className: "popover-list",
314
+ children: [
315
+ /* @__PURE__ */ jsxs("li", { children: ["Leeds warehouse ", /* @__PURE__ */ jsx("strong", { children: "8" })] }),
316
+ /* @__PURE__ */ jsxs("li", { children: ["Harrogate shop ", /* @__PURE__ */ jsx("strong", { children: "3" })] }),
317
+ /* @__PURE__ */ jsxs("li", { children: ["In transit ", /* @__PURE__ */ jsx("strong", { children: "1" })] }),
318
+ /* @__PURE__ */ jsxs("li", {
319
+ "data-total": "",
320
+ children: ["Total ", /* @__PURE__ */ jsx("span", { children: "12" })]
321
+ })
322
+ ]
323
+ })]
324
+ })] });
325
+ }
326
+ function FiltersPopover() {
327
+ const titleId = useId();
328
+ const [payment, setPayment] = useState("all");
329
+ return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
330
+ asChild: true,
331
+ children: /* @__PURE__ */ jsx(Button, {
332
+ icon: /* @__PURE__ */ jsx(FunnelIcon, {}),
333
+ children: "Filters"
334
+ })
335
+ }), /* @__PURE__ */ jsx(PopoverContent, {
336
+ align: "start",
337
+ width: 320,
338
+ "aria-labelledby": titleId,
339
+ children: /* @__PURE__ */ jsxs("div", {
340
+ className: "popover-form",
341
+ style: { gap: 16 },
342
+ children: [
343
+ /* @__PURE__ */ jsx("h2", {
344
+ id: titleId,
345
+ className: "popover-title",
346
+ children: "Filter orders"
347
+ }),
348
+ /* @__PURE__ */ jsx(Field, {
349
+ label: "Customer",
350
+ children: /* @__PURE__ */ jsx(SearchField, {
351
+ size: "sm",
352
+ placeholder: "Name or email"
353
+ })
354
+ }),
355
+ /* @__PURE__ */ jsxs("div", {
356
+ className: "popover-group",
357
+ children: [/* @__PURE__ */ jsx("span", {
358
+ className: "popover-group__label",
359
+ "aria-hidden": "true",
360
+ children: "Payment"
361
+ }), /* @__PURE__ */ jsx(SegmentedControl, {
362
+ "aria-label": "Payment",
363
+ size: "sm",
364
+ fullWidth: true,
365
+ value: payment,
366
+ onValueChange: setPayment,
367
+ options: [
368
+ {
369
+ value: "all",
370
+ label: "All"
371
+ },
372
+ {
373
+ value: "paid",
374
+ label: "Paid"
375
+ },
376
+ {
377
+ value: "unpaid",
378
+ label: "Unpaid"
379
+ },
380
+ {
381
+ value: "refunded",
382
+ label: "Refunded"
383
+ }
384
+ ]
385
+ })]
386
+ }),
387
+ /* @__PURE__ */ jsx(Field, {
388
+ label: "Order total over",
389
+ hint: "Includes VAT at 20%",
390
+ children: /* @__PURE__ */ jsx(Input, {
391
+ size: "sm",
392
+ prefix: "£",
393
+ inputMode: "decimal",
394
+ defaultValue: "50.00"
395
+ })
396
+ }),
397
+ /* @__PURE__ */ jsxs("div", {
398
+ className: "popover-actions",
399
+ children: [/* @__PURE__ */ jsx(Button, {
400
+ size: "sm",
401
+ variant: "ghost",
402
+ onClick: () => setPayment("all"),
403
+ children: "Reset"
404
+ }), /* @__PURE__ */ jsx(PopoverClose, {
405
+ asChild: true,
406
+ children: /* @__PURE__ */ jsx(Button, {
407
+ size: "sm",
408
+ variant: "primary",
409
+ children: "Show 42 orders"
410
+ })
411
+ })]
412
+ })
413
+ ]
414
+ })
415
+ })] });
416
+ }
417
+ function SharePopover() {
418
+ const titleId = useId();
419
+ const [copied, setCopied] = useState(false);
420
+ const timer = useRef(0);
421
+ const link = "harbourdesk.orbit.store/preview/7kq2";
422
+ const copy = () => {
423
+ navigator.clipboard?.writeText(`https://${link}`).catch(() => {});
424
+ setCopied(true);
425
+ window.clearTimeout(timer.current);
426
+ timer.current = window.setTimeout(() => setCopied(false), 1600);
427
+ };
428
+ return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
429
+ asChild: true,
430
+ children: /* @__PURE__ */ jsx(Button, {
431
+ icon: /* @__PURE__ */ jsx(LinkIcon, {}),
432
+ children: "Share preview"
433
+ })
434
+ }), /* @__PURE__ */ jsx(PopoverContent, {
435
+ width: 320,
436
+ "aria-labelledby": titleId,
437
+ children: /* @__PURE__ */ jsxs("div", {
438
+ className: "popover-form",
439
+ children: [
440
+ /* @__PURE__ */ jsxs("div", {
441
+ className: "popover-row-head",
442
+ children: [/* @__PURE__ */ jsxs("div", {
443
+ className: "popover-heading",
444
+ children: [/* @__PURE__ */ jsx("h2", {
445
+ id: titleId,
446
+ className: "popover-title",
447
+ children: "Share a preview"
448
+ }), /* @__PURE__ */ jsx("p", {
449
+ className: "popover-meta",
450
+ children: "Anyone with the link can see your unpublished theme for 7 days."
451
+ })]
452
+ }), /* @__PURE__ */ jsx(PopoverClose, {
453
+ asChild: true,
454
+ children: /* @__PURE__ */ jsx(IconButton, {
455
+ label: "Close",
456
+ size: "sm",
457
+ children: /* @__PURE__ */ jsx(XIcon, {})
458
+ })
459
+ })]
460
+ }),
461
+ /* @__PURE__ */ jsx(Input, {
462
+ size: "sm",
463
+ readOnly: true,
464
+ value: link,
465
+ "aria-label": "Preview link",
466
+ onFocus: (e) => e.currentTarget.select()
467
+ }),
468
+ /* @__PURE__ */ jsx("div", {
469
+ className: "popover-actions",
470
+ children: /* @__PURE__ */ jsx(Button, {
471
+ size: "sm",
472
+ variant: "primary",
473
+ icon: copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopySimpleIcon, {}),
474
+ onClick: copy,
475
+ children: copied ? "Copied" : "Copy link"
476
+ })
477
+ })
478
+ ]
479
+ })
480
+ })] });
481
+ }
482
+ function PricePopover() {
483
+ const titleId = useId();
484
+ const [open, setOpen] = useState(false);
485
+ const [price, setPrice] = useState("229.00");
486
+ const [draft, setDraft] = useState(price);
487
+ const value = Number.parseFloat(draft);
488
+ const exVat = Number.isFinite(value) ? (value / 1.2).toFixed(2) : null;
489
+ return /* @__PURE__ */ jsxs(Popover, {
490
+ open,
491
+ onOpenChange: (next) => {
492
+ setOpen(next);
493
+ if (next) setDraft(price);
494
+ },
495
+ children: [/* @__PURE__ */ jsx(PopoverAnchor, {
496
+ asChild: true,
497
+ children: /* @__PURE__ */ jsxs("div", {
498
+ className: "popover-price",
499
+ children: [
500
+ /* @__PURE__ */ jsx("span", {
501
+ className: "popover-price__label",
502
+ children: "Price, including VAT"
503
+ }),
504
+ /* @__PURE__ */ jsxs("span", {
505
+ className: "popover-price__value",
506
+ children: ["£", price]
507
+ }),
508
+ /* @__PURE__ */ jsx(PopoverTrigger, {
509
+ asChild: true,
510
+ children: /* @__PURE__ */ jsx(IconButton, {
511
+ label: "Edit price",
512
+ size: "sm",
513
+ children: /* @__PURE__ */ jsx(PencilSimpleIcon, {})
514
+ })
515
+ })
516
+ ]
517
+ })
518
+ }), /* @__PURE__ */ jsx(PopoverContent, {
519
+ width: "trigger",
520
+ align: "start",
521
+ "aria-labelledby": titleId,
522
+ children: /* @__PURE__ */ jsxs("form", {
523
+ className: "popover-form",
524
+ onSubmit: (event) => {
525
+ event.preventDefault();
526
+ if (exVat === null) return;
527
+ setPrice(value.toFixed(2));
528
+ setOpen(false);
529
+ },
530
+ children: [
531
+ /* @__PURE__ */ jsx("h2", {
532
+ id: titleId,
533
+ className: "popover-title",
534
+ children: "Edit price"
535
+ }),
536
+ /* @__PURE__ */ jsx(Field, {
537
+ label: "Price",
538
+ hint: exVat ? `£${exVat} before VAT at 20%` : "Enter a price, like 229.00",
539
+ children: /* @__PURE__ */ jsx(Input, {
540
+ size: "sm",
541
+ prefix: "£",
542
+ inputMode: "decimal",
543
+ value: draft,
544
+ onChange: (e) => setDraft(e.target.value)
545
+ })
546
+ }),
547
+ /* @__PURE__ */ jsxs("div", {
548
+ className: "popover-actions",
549
+ children: [/* @__PURE__ */ jsx(PopoverClose, {
550
+ asChild: true,
551
+ children: /* @__PURE__ */ jsx(Button, {
552
+ size: "sm",
553
+ variant: "ghost",
554
+ children: "Cancel"
555
+ })
556
+ }), /* @__PURE__ */ jsx(Button, {
557
+ size: "sm",
558
+ variant: "primary",
559
+ type: "submit",
560
+ children: "Save price"
561
+ })]
562
+ })
563
+ ]
564
+ })
565
+ })]
566
+ });
567
+ }
568
+ function HeldOpen() {
569
+ return /* @__PURE__ */ jsxs(SpecimenFrame, {
570
+ className: "popover-still",
571
+ children: [/* @__PURE__ */ jsx(Button, {
572
+ size: "sm",
573
+ "aria-haspopup": "dialog",
574
+ "aria-expanded": "true",
575
+ children: "Adjust stock"
576
+ }), /* @__PURE__ */ jsx(PopoverSheet, {
577
+ width: 300,
578
+ children: /* @__PURE__ */ jsxs("div", {
579
+ className: "popover-form",
580
+ children: [
581
+ /* @__PURE__ */ jsxs("div", {
582
+ className: "popover-heading",
583
+ children: [/* @__PURE__ */ jsx("p", {
584
+ className: "popover-title",
585
+ children: "Adjust stock"
586
+ }), /* @__PURE__ */ jsx("p", {
587
+ className: "popover-meta",
588
+ children: "Arden ergonomic chair · 12 in stock"
589
+ })]
590
+ }),
591
+ /* @__PURE__ */ jsx(Field, {
592
+ label: "Change by",
593
+ hint: "Add a minus sign to take stock away",
594
+ children: /* @__PURE__ */ jsx(Input, {
595
+ size: "sm",
596
+ defaultValue: "3"
597
+ })
598
+ }),
599
+ /* @__PURE__ */ jsxs("div", {
600
+ className: "popover-group",
601
+ children: [/* @__PURE__ */ jsx("span", {
602
+ className: "popover-group__label",
603
+ children: "Reason"
604
+ }), /* @__PURE__ */ jsx(SegmentedControl, {
605
+ "aria-label": "Reason",
606
+ size: "sm",
607
+ fullWidth: true,
608
+ defaultValue: "received",
609
+ options: REASONS
610
+ })]
611
+ }),
612
+ /* @__PURE__ */ jsxs("p", {
613
+ className: "popover-after",
614
+ children: ["Stock after this change: ", /* @__PURE__ */ jsx("strong", { children: "15" })]
615
+ }),
616
+ /* @__PURE__ */ jsxs("div", {
617
+ className: "popover-actions",
618
+ children: [/* @__PURE__ */ jsx(Button, {
619
+ size: "sm",
620
+ variant: "ghost",
621
+ children: "Cancel"
622
+ }), /* @__PURE__ */ jsx(Button, {
623
+ size: "sm",
624
+ variant: "primary",
625
+ children: "Save"
626
+ })]
627
+ })
628
+ ]
629
+ })
630
+ })]
631
+ });
632
+ }
633
+ function ArrowHint() {
634
+ return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
635
+ asChild: true,
636
+ children: /* @__PURE__ */ jsx(IconButton, {
637
+ label: "What is the reorder point?",
638
+ variant: "secondary",
639
+ children: /* @__PURE__ */ jsx(InfoIcon, {})
640
+ })
641
+ }), /* @__PURE__ */ jsxs(PopoverContent, {
642
+ arrow: true,
643
+ side: "top",
644
+ sideOffset: 12,
645
+ width: 260,
646
+ "aria-label": "Reorder point",
647
+ children: [/* @__PURE__ */ jsx("p", {
648
+ className: "popover-title",
649
+ children: "Reorder point"
650
+ }), /* @__PURE__ */ jsx("p", {
651
+ className: "popover-arrow-text",
652
+ children: "When stock falls to this many, the product shows in Low stock and its supplier is emailed."
653
+ })]
654
+ })] });
655
+ }
656
+ function Page() {
657
+ return /* @__PURE__ */ jsxs(DocPage, {
658
+ title: "Popover",
659
+ status: "stable",
660
+ importNames: [
661
+ "Popover",
662
+ "PopoverTrigger",
663
+ "PopoverContent",
664
+ "PopoverClose"
665
+ ],
666
+ lead: "A raised sheet of free-form content anchored to a trigger: a quick edit, a few filters, or the details behind a value. It sits beside what it changes and the page stays live around it.",
667
+ children: [
668
+ /* @__PURE__ */ jsx(Section$1, {
669
+ id: "basics",
670
+ title: "Basics",
671
+ description: /* @__PURE__ */ jsxs("p", { children: [
672
+ "Wrap the button in ",
673
+ /* @__PURE__ */ jsx("code", { children: "PopoverTrigger asChild" }),
674
+ " and put anything in ",
675
+ /* @__PURE__ */ jsx("code", { children: "PopoverContent" }),
676
+ ". It shares the menu's sheet (14px corners, the floating shadow) and its motion: it grows out of its trigger on a spring and leaves faster than it came. Here, adjusting stock from a product row."
677
+ ] }),
678
+ children: /* @__PURE__ */ jsx(Example, {
679
+ align: "fill",
680
+ minHeight: 470,
681
+ code: `
682
+ const [open, setOpen] = useState(false)
683
+
684
+ <Popover open={open} onOpenChange={setOpen}>
685
+ <PopoverTrigger asChild>
686
+ <Button size="sm">Adjust stock</Button>
687
+ </PopoverTrigger>
688
+ <PopoverContent align="end" width={300} aria-labelledby="adjust-stock-title">
689
+ <form onSubmit={save}>
690
+ <h2 id="adjust-stock-title">Adjust stock</h2>
691
+ <p>Arden ergonomic chair · {stock} in stock</p>
692
+ <Field label="Change by" hint="Add a minus sign to take stock away" error={error}>
693
+ <Input size="sm" inputMode="numeric" value={change} onChange={…} />
694
+ </Field>
695
+ <SegmentedControl aria-label="Reason" size="sm" fullWidth options={reasons} … />
696
+ <p>Stock after this change: {after}</p>
697
+ <PopoverClose asChild>
698
+ <Button size="sm" variant="ghost">Cancel</Button>
699
+ </PopoverClose>
700
+ <Button size="sm" variant="primary" type="submit">Save</Button>
701
+ </form>
702
+ </PopoverContent>
703
+ </Popover>`,
704
+ children: /* @__PURE__ */ jsx(ProductRow, {})
705
+ })
706
+ }),
707
+ /* @__PURE__ */ jsxs(Section$1, {
708
+ id: "both-themes",
709
+ title: "In both themes",
710
+ description: /* @__PURE__ */ jsx("p", { children: "Held open for review, light beside dark. In light the sheet is white on the floating shadow; in dark it lifts to graphite with a faint ring so its edge holds on a dark page. Fields inside it keep their own wells." }),
711
+ children: [/* @__PURE__ */ jsx(ThemePair, {
712
+ caption: "A still of the open popover, drawn with its own classes so both themes sit side by side. The popovers on the rest of this page are live.",
713
+ children: /* @__PURE__ */ jsx(HeldOpen, {})
714
+ }), /* @__PURE__ */ jsx(SubSection, {
715
+ title: "Open them for real",
716
+ description: /* @__PURE__ */ jsx("p", { children: "Each trigger opens its popover in the theme of its own side." }),
717
+ children: /* @__PURE__ */ jsxs(ThemePair, {
718
+ minHeight: 160,
719
+ children: [/* @__PURE__ */ jsx(AdjustStockAlone, {}), /* @__PURE__ */ jsx(CustomerPopover, {})]
720
+ })
721
+ })]
722
+ }),
723
+ /* @__PURE__ */ jsx(Section$1, {
724
+ id: "padding",
725
+ title: "Padding",
726
+ description: /* @__PURE__ */ jsxs("p", { children: [
727
+ "The content decides. ",
728
+ /* @__PURE__ */ jsx("code", { children: "md" }),
729
+ " (16px, the default) suits forms. ",
730
+ /* @__PURE__ */ jsx("code", { children: "sm" }),
731
+ " (12px) suits compact details like a customer card. ",
732
+ /* @__PURE__ */ jsx("code", { children: "none" }),
733
+ " is for lists and tables that bring their own padding, so their rows and dividers run edge to edge."
734
+ ] }),
735
+ children: /* @__PURE__ */ jsx(Example, {
736
+ align: "fill",
737
+ minHeight: 300,
738
+ code: `
739
+ <PopoverContent width={300}>…</PopoverContent> {/* md: a form */}
740
+ <PopoverContent padding="sm">…</PopoverContent> {/* sm: a customer card */}
741
+ <PopoverContent padding="none"> {/* none: a list with its own rows */}
742
+ <p id="stock-title">Stock by location</p>
743
+ <ul>…</ul>
744
+ </PopoverContent>`,
745
+ children: /* @__PURE__ */ jsxs("div", {
746
+ className: "overlays-top",
747
+ children: [
748
+ /* @__PURE__ */ jsx(NotePopover, {}),
749
+ /* @__PURE__ */ jsx(CustomerPopover, {}),
750
+ /* @__PURE__ */ jsx(StockPopover, {})
751
+ ]
752
+ })
753
+ })
754
+ }),
755
+ /* @__PURE__ */ jsx(Section$1, {
756
+ id: "width",
757
+ title: "Width",
758
+ description: /* @__PURE__ */ jsxs("p", { children: [
759
+ "By default the sheet fits its content. Pass ",
760
+ /* @__PURE__ */ jsx("code", { children: "width" }),
761
+ " in pixels (or any CSS length) when the content would otherwise jump about as it changes, as a form does. ",
762
+ /* @__PURE__ */ jsx("code", { children: "'trigger'" }),
763
+ " matches the trigger, or the anchor when there is one (see ",
764
+ /* @__PURE__ */ jsx("a", {
765
+ href: "#anchor",
766
+ children: "Anchor"
767
+ }),
768
+ "). On a small screen the sheet never grows wider than the space it has."
769
+ ] }),
770
+ children: /* @__PURE__ */ jsx(Example, {
771
+ align: "fill",
772
+ minHeight: 460,
773
+ code: `
774
+ <Popover>
775
+ <PopoverTrigger asChild>
776
+ <Button icon={<FunnelIcon />}>Filters</Button>
777
+ </PopoverTrigger>
778
+ <PopoverContent align="start" width={320} aria-labelledby="filters-title">
779
+ <h2 id="filters-title">Filter orders</h2>
780
+ <Field label="Customer">
781
+ <SearchField size="sm" placeholder="Name or email" />
782
+ </Field>
783
+ <SegmentedControl aria-label="Payment" size="sm" fullWidth options={payments} … />
784
+ <Field label="Order total over" hint="Includes VAT at 20%">
785
+ <Input size="sm" prefix="£" inputMode="decimal" defaultValue="50.00" />
786
+ </Field>
787
+ <Button size="sm" variant="ghost">Reset</Button>
788
+ <PopoverClose asChild>
789
+ <Button size="sm" variant="primary">Show 42 orders</Button>
790
+ </PopoverClose>
791
+ </PopoverContent>
792
+ </Popover>`,
793
+ children: /* @__PURE__ */ jsx("div", {
794
+ className: "overlays-top",
795
+ children: /* @__PURE__ */ jsx(FiltersPopover, {})
796
+ })
797
+ })
798
+ }),
799
+ /* @__PURE__ */ jsx(Section$1, {
800
+ id: "closing",
801
+ title: "Closing",
802
+ description: /* @__PURE__ */ jsxs("p", { children: [
803
+ "A popover closes when you click outside it, press Escape, or press its trigger again. Inside, wrap any button that should close it in ",
804
+ /* @__PURE__ */ jsx("code", { children: "PopoverClose asChild" }),
805
+ ": a Cancel, a Done, or a close button in the corner. To close it after an action, control ",
806
+ /* @__PURE__ */ jsx("code", { children: "open" }),
807
+ ", as the stock example does after saving."
808
+ ] }),
809
+ children: /* @__PURE__ */ jsx(Example, {
810
+ align: "fill",
811
+ minHeight: 280,
812
+ code: `
813
+ <Popover>
814
+ <PopoverTrigger asChild>
815
+ <Button icon={<LinkIcon />}>Share preview</Button>
816
+ </PopoverTrigger>
817
+ <PopoverContent width={320} aria-labelledby="share-title">
818
+ <h2 id="share-title">Share a preview</h2>
819
+ <p>Anyone with the link can see your unpublished theme for 7 days.</p>
820
+ <PopoverClose asChild>
821
+ <IconButton label="Close" size="sm"><XIcon /></IconButton>
822
+ </PopoverClose>
823
+ <Input size="sm" readOnly value={link} aria-label="Preview link" />
824
+ <Button size="sm" variant="primary" icon={<CopySimpleIcon />} onClick={copy}>Copy link</Button>
825
+ </PopoverContent>
826
+ </Popover>`,
827
+ children: /* @__PURE__ */ jsx("div", {
828
+ className: "overlays-top",
829
+ children: /* @__PURE__ */ jsx(SharePopover, {})
830
+ })
831
+ })
832
+ }),
833
+ /* @__PURE__ */ jsx(Section$1, {
834
+ id: "anchor",
835
+ title: "Anchor",
836
+ description: /* @__PURE__ */ jsxs("p", { children: [
837
+ /* @__PURE__ */ jsx("code", { children: "PopoverAnchor" }),
838
+ " positions the sheet against something other than the trigger. Here the pencil opens it, but it lines up with the whole price row, and ",
839
+ /* @__PURE__ */ jsx("code", { children: "width=\"trigger\"" }),
840
+ " makes it as wide as the row."
841
+ ] }),
842
+ children: /* @__PURE__ */ jsx(Example, {
843
+ align: "fill",
844
+ minHeight: 330,
845
+ code: `
846
+ <Popover open={open} onOpenChange={setOpen}>
847
+ <PopoverAnchor asChild>
848
+ <div className="price-row">
849
+ <span>Price, including VAT</span>
850
+ <span>£{price}</span>
851
+ <PopoverTrigger asChild>
852
+ <IconButton label="Edit price" size="sm"><PencilSimpleIcon /></IconButton>
853
+ </PopoverTrigger>
854
+ </div>
855
+ </PopoverAnchor>
856
+ <PopoverContent width="trigger" align="start" aria-labelledby="price-title">
857
+ <h2 id="price-title">Edit price</h2>
858
+ <Field label="Price" hint={\`£\${exVat} before VAT at 20%\`}>
859
+ <Input size="sm" prefix="£" inputMode="decimal" value={draft} onChange={…} />
860
+ </Field>
861
+ <PopoverClose asChild>
862
+ <Button size="sm" variant="ghost">Cancel</Button>
863
+ </PopoverClose>
864
+ <Button size="sm" variant="primary" type="submit">Save price</Button>
865
+ </PopoverContent>
866
+ </Popover>`,
867
+ children: /* @__PURE__ */ jsx(PricePopover, {})
868
+ })
869
+ }),
870
+ /* @__PURE__ */ jsx(Section$1, {
871
+ id: "arrow",
872
+ title: "Arrow",
873
+ description: /* @__PURE__ */ jsxs("p", { children: [
874
+ /* @__PURE__ */ jsx("code", { children: "arrow" }),
875
+ " puts an arrow on the edge facing the trigger or anchor, pointing at it, in the sheet's colour (with its faint ring in dark). Use it for a hint about one control, where the link between the two must be plain, as the",
876
+ " ",
877
+ /* @__PURE__ */ jsx(DocLink, {
878
+ to: "/components/coachmark",
879
+ children: "Coachmark"
880
+ }),
881
+ " does. The sheet then does not scroll, since its arrow sits outside it, so keep what it holds short; give it a ",
882
+ /* @__PURE__ */ jsx("code", { children: "sideOffset" }),
883
+ " of about 12 for the arrow's room."
884
+ ] }),
885
+ children: /* @__PURE__ */ jsx(Example, {
886
+ minHeight: 240,
887
+ code: `
888
+ <Popover>
889
+ <PopoverTrigger asChild>
890
+ <IconButton label="What is the reorder point?" variant="secondary"><InfoIcon /></IconButton>
891
+ </PopoverTrigger>
892
+ <PopoverContent arrow side="top" sideOffset={12} width={260} aria-label="Reorder point">
893
+ <p>Reorder point</p>
894
+ <p>When stock falls to this many, the product shows in Low stock and its supplier is emailed.</p>
895
+ </PopoverContent>
896
+ </Popover>`,
897
+ children: /* @__PURE__ */ jsx("div", {
898
+ className: "popover-arrow-stage",
899
+ children: /* @__PURE__ */ jsx(ArrowHint, {})
900
+ })
901
+ })
902
+ }),
903
+ /* @__PURE__ */ jsxs(Section$1, {
904
+ id: "choosing",
905
+ title: "Popover, menu or dialog",
906
+ description: /* @__PURE__ */ jsx("p", { children: "Four overlays, four jobs. Pick by what is inside and how much the moment matters." }),
907
+ children: [
908
+ /* @__PURE__ */ jsx(DocTable, {
909
+ columns: [
910
+ "Use",
911
+ "For",
912
+ "How it behaves"
913
+ ],
914
+ rows: [
915
+ [
916
+ /* @__PURE__ */ jsx(DocLink, {
917
+ to: "/components/menu",
918
+ children: "Menu"
919
+ }),
920
+ "A list of actions, or one quick choice such as a sort order.",
921
+ "Rows only. Arrow keys and typing move between rows; choosing one closes it."
922
+ ],
923
+ [
924
+ "Popover",
925
+ "A small amount of free-form content beside what it changes: a quick edit, a few filters, the details behind a value.",
926
+ "The page stays live. Clicking outside or Escape closes it, and unsaved input goes with it."
927
+ ],
928
+ [
929
+ /* @__PURE__ */ jsx(DocLink, {
930
+ to: "/components/dialog",
931
+ children: "Dialog"
932
+ }),
933
+ "A task that must be finished or dismissed before carrying on: several fields, a question before something that matters.",
934
+ "Dims the page, traps focus and locks scrolling until it closes."
935
+ ],
936
+ [
937
+ /* @__PURE__ */ jsx(DocLink, {
938
+ to: "/components/tooltip",
939
+ children: "Tooltip"
940
+ }),
941
+ "A short label for a control, on hover or focus.",
942
+ "Never holds anything to press or type into."
943
+ ]
944
+ ]
945
+ }),
946
+ /* @__PURE__ */ jsx(DoDont, {
947
+ do: {
948
+ children: /* @__PURE__ */ jsx(SpecimenFrame, { children: /* @__PURE__ */ jsx(PopoverSheet, {
949
+ padding: "sm",
950
+ width: 236,
951
+ children: /* @__PURE__ */ jsxs("div", {
952
+ className: "popover-form",
953
+ style: { gap: 10 },
954
+ children: [
955
+ /* @__PURE__ */ jsx("p", {
956
+ className: "popover-title",
957
+ children: "Edit price"
958
+ }),
959
+ /* @__PURE__ */ jsx(Input, {
960
+ size: "sm",
961
+ prefix: "£",
962
+ defaultValue: "229.00"
963
+ }),
964
+ /* @__PURE__ */ jsxs("div", {
965
+ className: "popover-actions",
966
+ children: [/* @__PURE__ */ jsx(Button, {
967
+ size: "xs",
968
+ variant: "ghost",
969
+ children: "Cancel"
970
+ }), /* @__PURE__ */ jsx(Button, {
971
+ size: "xs",
972
+ variant: "primary",
973
+ children: "Save price"
974
+ })]
975
+ })
976
+ ]
977
+ })
978
+ }) }),
979
+ caption: "A quick edit beside the value it changes, with an explicit Save."
980
+ },
981
+ dont: {
982
+ children: /* @__PURE__ */ jsx(SpecimenFrame, { children: /* @__PURE__ */ jsx(PopoverSheet, {
983
+ padding: "sm",
984
+ width: 200,
985
+ children: /* @__PURE__ */ jsxs("div", {
986
+ style: {
987
+ display: "grid",
988
+ gap: 4
989
+ },
990
+ children: [
991
+ /* @__PURE__ */ jsx(Button, {
992
+ size: "sm",
993
+ variant: "ghost",
994
+ children: "Duplicate"
995
+ }),
996
+ /* @__PURE__ */ jsx(Button, {
997
+ size: "sm",
998
+ variant: "ghost",
999
+ children: "Archive"
1000
+ }),
1001
+ /* @__PURE__ */ jsx(Button, {
1002
+ size: "sm",
1003
+ variant: "ghost",
1004
+ children: "Delete"
1005
+ })
1006
+ ]
1007
+ })
1008
+ }) }),
1009
+ caption: "A column of action buttons is a menu without the keyboard support. Use a Menu."
1010
+ }
1011
+ }),
1012
+ /* @__PURE__ */ jsx(Guidelines, { items: [
1013
+ "Keep it small: one short task or a few details. If it needs to scroll, or more than three or four fields, use a Dialog.",
1014
+ "Save with a button when the change matters. A click outside closes the popover and loses what was typed.",
1015
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1016
+ "Give it a heading and point ",
1017
+ /* @__PURE__ */ jsx("code", { children: "aria-labelledby" }),
1018
+ " at it, or pass ",
1019
+ /* @__PURE__ */ jsx("code", { children: "aria-label" }),
1020
+ "."
1021
+ ] }),
1022
+ "Open one popover at a time, and never one from inside another.",
1023
+ "Keep it next to the thing it changes. For an edit to a row, open it from that row."
1024
+ ] })
1025
+ ]
1026
+ }),
1027
+ /* @__PURE__ */ jsxs(Section$1, {
1028
+ id: "accessibility",
1029
+ title: "Accessibility",
1030
+ children: [/* @__PURE__ */ jsx(Guidelines, { items: [
1031
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1032
+ "Built on Radix Popover. The trigger carries ",
1033
+ /* @__PURE__ */ jsx("code", { children: "aria-haspopup=\"dialog\"" }),
1034
+ " and",
1035
+ " ",
1036
+ /* @__PURE__ */ jsx("code", { children: "aria-expanded" }),
1037
+ ", and the sheet is a ",
1038
+ /* @__PURE__ */ jsx("code", { children: "dialog" }),
1039
+ ". It has no name of its own: label it with ",
1040
+ /* @__PURE__ */ jsx("code", { children: "aria-labelledby" }),
1041
+ " or ",
1042
+ /* @__PURE__ */ jsx("code", { children: "aria-label" }),
1043
+ "."
1044
+ ] }),
1045
+ "When it opens, focus moves to the first thing inside that takes focus. Tab moves through it and on to the page after it.",
1046
+ "Escape closes it and hands focus back to the trigger. A click outside closes it and leaves focus where you clicked.",
1047
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
1048
+ "Pass ",
1049
+ /* @__PURE__ */ jsx("code", { children: "modal" }),
1050
+ " to the root to keep focus inside, block the page behind and hide it from screen readers while the popover is open."
1051
+ ] }),
1052
+ "With reduced motion the sheet fades in and out without growing."
1053
+ ] }), /* @__PURE__ */ jsxs(Note, {
1054
+ title: "Not for hover",
1055
+ children: [
1056
+ "A popover opens on a press, never on hover, so it works the same with a mouse, a keyboard and a finger. For a label that appears on hover, use a ",
1057
+ /* @__PURE__ */ jsx(DocLink, {
1058
+ to: "/components/tooltip",
1059
+ children: "Tooltip"
1060
+ }),
1061
+ "."
1062
+ ]
1063
+ })]
1064
+ }),
1065
+ /* @__PURE__ */ jsxs(Section$1, {
1066
+ id: "props",
1067
+ title: "Props",
1068
+ description: /* @__PURE__ */ jsx("p", { children: "Every part also accepts the matching Radix Popover props." }),
1069
+ children: [
1070
+ /* @__PURE__ */ jsx(PropsTable, {
1071
+ title: "Popover",
1072
+ rows: [
1073
+ {
1074
+ name: "open",
1075
+ type: "boolean",
1076
+ description: "Controlled open state."
1077
+ },
1078
+ {
1079
+ name: "defaultOpen",
1080
+ type: "boolean",
1081
+ default: "false",
1082
+ description: "Starting state when uncontrolled."
1083
+ },
1084
+ {
1085
+ name: "onOpenChange",
1086
+ type: "(open: boolean) => void",
1087
+ description: "Called when it opens or closes."
1088
+ },
1089
+ {
1090
+ name: "modal",
1091
+ type: "boolean",
1092
+ default: "false",
1093
+ description: "Keep focus inside and block the page behind while open."
1094
+ }
1095
+ ]
1096
+ }),
1097
+ /* @__PURE__ */ jsx(PropsTable, {
1098
+ title: "PopoverTrigger",
1099
+ rows: [{
1100
+ name: "asChild",
1101
+ type: "boolean",
1102
+ default: "false",
1103
+ description: "Render your Button as the trigger. Almost always on."
1104
+ }]
1105
+ }),
1106
+ /* @__PURE__ */ jsx(PropsTable, {
1107
+ title: "PopoverContent",
1108
+ rows: [
1109
+ {
1110
+ name: "padding",
1111
+ type: "'none' | 'sm' | 'md'",
1112
+ default: "'md'",
1113
+ description: "Inner padding: 0 for lists that bring their own, 12px, or 16px."
1114
+ },
1115
+ {
1116
+ name: "width",
1117
+ type: "number | string | 'trigger'",
1118
+ description: "Fixed width in px, any CSS length, or 'trigger' to match the trigger (or the anchor). By default it fits its content."
1119
+ },
1120
+ {
1121
+ name: "side",
1122
+ type: "'top' | 'right' | 'bottom' | 'left'",
1123
+ default: "'bottom'",
1124
+ description: "Preferred side. Flips when there is no room."
1125
+ },
1126
+ {
1127
+ name: "align",
1128
+ type: "'start' | 'center' | 'end'",
1129
+ default: "'center'",
1130
+ description: "Which part of the trigger it lines up with."
1131
+ },
1132
+ {
1133
+ name: "arrow",
1134
+ type: "boolean",
1135
+ default: "false",
1136
+ description: "An arrow on the edge facing the trigger, pointing at it. The sheet then does not scroll."
1137
+ },
1138
+ {
1139
+ name: "sideOffset",
1140
+ type: "number",
1141
+ default: "8",
1142
+ description: "Gap from the trigger in px."
1143
+ },
1144
+ {
1145
+ name: "alignOffset",
1146
+ type: "number",
1147
+ default: "0",
1148
+ description: "Nudge along the aligned edge in px."
1149
+ },
1150
+ {
1151
+ name: "collisionPadding",
1152
+ type: "number",
1153
+ default: "8",
1154
+ description: "Space kept from the edges of the window."
1155
+ },
1156
+ {
1157
+ name: "container",
1158
+ type: "HTMLElement | null",
1159
+ default: "document.body",
1160
+ description: "Where the sheet is portalled. Inside a dialog it opens in the dialog's layer; null keeps it on the page."
1161
+ },
1162
+ {
1163
+ name: "onOpenAutoFocus",
1164
+ type: "(event: Event) => void",
1165
+ description: "Runs as focus moves in. Prevent it to keep focus on the trigger."
1166
+ },
1167
+ {
1168
+ name: "onCloseAutoFocus",
1169
+ type: "(event: Event) => void",
1170
+ description: "Runs as focus goes back to the trigger. Prevent it to send focus elsewhere."
1171
+ }
1172
+ ]
1173
+ }),
1174
+ /* @__PURE__ */ jsx(PropsTable, {
1175
+ title: "PopoverClose",
1176
+ rows: [{
1177
+ name: "asChild",
1178
+ type: "boolean",
1179
+ default: "false",
1180
+ description: "Render your button as the close control."
1181
+ }]
1182
+ }),
1183
+ /* @__PURE__ */ jsx(PropsTable, {
1184
+ title: "PopoverAnchor",
1185
+ rows: [{
1186
+ name: "asChild",
1187
+ type: "boolean",
1188
+ default: "false",
1189
+ description: "Render your element as the anchor the sheet is positioned against."
1190
+ }]
1191
+ })
1192
+ ]
1193
+ })
1194
+ ]
1195
+ });
1196
+ }
1197
+ //#endregion
1198
+ export { Page, Preview };