viewkitjs 0.27.0 → 0.28.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 (229) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/MIGRATION.md +40 -3
  3. package/package.json +1 -1
  4. package/views/dist/cells/cell-format.d.ts +3 -1
  5. package/views/dist/cells/cell-format.js +2 -2
  6. package/views/dist/cells/use-cell-format.d.ts +8 -1
  7. package/views/dist/cells/use-cell-format.js +13 -2
  8. package/views/dist/contract.d.ts +70 -3
  9. package/views/dist/contract.js +76 -0
  10. package/views/dist/controls/alert/alert.d.ts +46 -0
  11. package/views/dist/controls/alert/alert.js +11 -0
  12. package/views/dist/controls/alert/looks.d.ts +4 -0
  13. package/views/dist/controls/alert/looks.js +19 -0
  14. package/views/dist/controls/alert/tokens.d.ts +92 -0
  15. package/views/dist/controls/alert/tokens.js +25 -0
  16. package/views/dist/controls/alert-dialog/alert-dialog.d.ts +50 -0
  17. package/views/dist/controls/alert-dialog/alert-dialog.js +67 -0
  18. package/views/dist/controls/alert-dialog/confirm.d.ts +13 -0
  19. package/views/dist/controls/alert-dialog/confirm.js +11 -0
  20. package/views/dist/controls/alert-dialog/looks.d.ts +4 -0
  21. package/views/dist/controls/alert-dialog/looks.js +17 -0
  22. package/views/dist/controls/alert-dialog/tokens.d.ts +119 -0
  23. package/views/dist/controls/alert-dialog/tokens.js +32 -0
  24. package/views/dist/controls/alert-dialog.css +95 -0
  25. package/views/dist/controls/alert.css +51 -0
  26. package/views/dist/controls/collapsible/collapsible.d.ts +39 -0
  27. package/views/dist/controls/collapsible/collapsible.js +18 -0
  28. package/views/dist/controls/collapsible/looks.d.ts +4 -0
  29. package/views/dist/controls/collapsible/looks.js +5 -0
  30. package/views/dist/controls/collapsible/map-collapse.d.ts +2 -0
  31. package/views/dist/controls/collapsible/map-collapse.js +6 -0
  32. package/views/dist/controls/collapsible/tokens.d.ts +68 -0
  33. package/views/dist/controls/collapsible/tokens.js +19 -0
  34. package/views/dist/controls/collapsible.css +83 -0
  35. package/views/dist/controls/compound-editor/place-parts.js +5 -1
  36. package/views/dist/controls/controls.d.ts +9 -0
  37. package/views/dist/controls/controls.js +9 -0
  38. package/views/dist/controls/date-editor/date-editor.d.ts +2 -1
  39. package/views/dist/controls/date-editor/map-calendar.js +3 -1
  40. package/views/dist/controls/filter-editor/filter-editor.d.ts +56 -0
  41. package/views/dist/controls/filter-editor/filter-editor.js +208 -0
  42. package/views/dist/controls/filter-editor/how.d.ts +23 -0
  43. package/views/dist/controls/filter-editor/how.js +13 -0
  44. package/views/dist/controls/filter-editor/map-filter-body.d.ts +18 -0
  45. package/views/dist/controls/filter-editor/map-filter-body.js +164 -0
  46. package/views/dist/controls/filter-editor/map-rules.d.ts +85 -0
  47. package/views/dist/controls/filter-editor/map-rules.js +273 -0
  48. package/views/dist/controls/filter-editor/parts.d.ts +46 -0
  49. package/views/dist/controls/filter-editor/parts.js +75 -0
  50. package/views/dist/controls/filter-editor/rules.d.ts +104 -0
  51. package/views/dist/controls/filter-editor/rules.js +148 -0
  52. package/views/dist/controls/filter-editor/tokens.d.ts +83 -0
  53. package/views/dist/controls/filter-editor/tokens.js +23 -0
  54. package/views/dist/controls/filter-editor/words.d.ts +59 -0
  55. package/views/dist/controls/filter-editor/words.js +40 -0
  56. package/views/dist/controls/filter-editor.css +124 -0
  57. package/views/dist/controls/group-editor/group-editor.d.ts +56 -0
  58. package/views/dist/controls/group-editor/group-editor.js +126 -0
  59. package/views/dist/controls/group-editor/map-group-body.d.ts +19 -0
  60. package/views/dist/controls/group-editor/map-group-body.js +106 -0
  61. package/views/dist/controls/group-editor/rules.d.ts +48 -0
  62. package/views/dist/controls/group-editor/rules.js +41 -0
  63. package/views/dist/controls/group-editor/tokens.d.ts +15 -0
  64. package/views/dist/controls/group-editor/tokens.js +6 -0
  65. package/views/dist/controls/group-editor/words.d.ts +39 -0
  66. package/views/dist/controls/group-editor/words.js +21 -0
  67. package/views/dist/controls/group-editor.css +20 -0
  68. package/views/dist/controls/index.d.ts +19 -1
  69. package/views/dist/controls/index.js +19 -1
  70. package/views/dist/controls/internal/editor-parts.d.ts +8 -1
  71. package/views/dist/controls/internal/editor-parts.js +5 -0
  72. package/views/dist/controls/internal/step-return.d.ts +9 -0
  73. package/views/dist/controls/internal/step-return.js +27 -0
  74. package/views/dist/controls/links-editor/links-editor.d.ts +5 -3
  75. package/views/dist/controls/links-editor/links-editor.js +38 -17
  76. package/views/dist/controls/links-editor/map-links-body.js +4 -1
  77. package/views/dist/controls/links-editor.css +1 -1
  78. package/views/dist/controls/menu-list/menu-list.d.ts +17 -2
  79. package/views/dist/controls/menu-list/menu-list.js +25 -16
  80. package/views/dist/controls/modal/looks.d.ts +4 -0
  81. package/views/dist/controls/modal/looks.js +25 -0
  82. package/views/dist/controls/modal/modal.d.ts +69 -0
  83. package/views/dist/controls/modal/modal.js +62 -0
  84. package/views/dist/controls/modal/tokens.d.ts +192 -0
  85. package/views/dist/controls/modal/tokens.js +50 -0
  86. package/views/dist/controls/modal.css +130 -0
  87. package/views/dist/controls/notice/notice.d.ts +49 -0
  88. package/views/dist/controls/notice/notice.js +35 -0
  89. package/views/dist/controls/notice/tokens.d.ts +99 -0
  90. package/views/dist/controls/notice/tokens.js +27 -0
  91. package/views/dist/controls/notice.css +100 -0
  92. package/views/dist/controls/number-editor/number-editor.js +1 -1
  93. package/views/dist/controls/pane/looks.d.ts +4 -0
  94. package/views/dist/controls/pane/looks.js +11 -0
  95. package/views/dist/controls/pane/pane.d.ts +63 -0
  96. package/views/dist/controls/pane/pane.js +98 -0
  97. package/views/dist/controls/pane/state.d.ts +14 -0
  98. package/views/dist/controls/pane/state.js +7 -0
  99. package/views/dist/controls/pane/tokens.d.ts +79 -0
  100. package/views/dist/controls/pane/tokens.js +22 -0
  101. package/views/dist/controls/pane.css +104 -0
  102. package/views/dist/controls/picker/rows.d.ts +4 -2
  103. package/views/dist/controls/picker/rows.js +4 -3
  104. package/views/dist/controls/sort-editor/map-sort-body.d.ts +9 -0
  105. package/views/dist/controls/sort-editor/map-sort-body.js +81 -0
  106. package/views/dist/controls/sort-editor/rules.d.ts +48 -0
  107. package/views/dist/controls/sort-editor/rules.js +24 -0
  108. package/views/dist/controls/sort-editor/sort-editor.d.ts +58 -0
  109. package/views/dist/controls/sort-editor/sort-editor.js +180 -0
  110. package/views/dist/controls/sort-editor/tokens.d.ts +79 -0
  111. package/views/dist/controls/sort-editor/tokens.js +22 -0
  112. package/views/dist/controls/sort-editor/words.d.ts +48 -0
  113. package/views/dist/controls/sort-editor/words.js +25 -0
  114. package/views/dist/controls/sort-editor.css +96 -0
  115. package/views/dist/controls/toast/toast.d.ts +75 -0
  116. package/views/dist/controls/toast/toast.js +99 -0
  117. package/views/dist/controls/toast/tokens.d.ts +100 -0
  118. package/views/dist/controls/toast/tokens.js +27 -0
  119. package/views/dist/controls/toast.css +93 -0
  120. package/views/dist/controls/tokens.js +20 -0
  121. package/views/dist/controls/values-editor/values-editor.js +7 -1
  122. package/views/dist/display/date.js +2 -2
  123. package/views/dist/display/format.js +10 -2
  124. package/views/dist/display/options.d.ts +3 -1
  125. package/views/dist/display/use-display-options.d.ts +3 -0
  126. package/views/dist/display/use-display-options.js +10 -2
  127. package/views/dist/display/viewer.d.ts +1 -1
  128. package/views/dist/display/viewer.js +1 -1
  129. package/views/dist/editors/DateEditor.js +11 -9
  130. package/views/dist/editors/relation-panel.js +7 -1
  131. package/views/dist/editors/relation-picker.d.ts +2 -1
  132. package/views/dist/editors/relation-picker.js +4 -3
  133. package/views/dist/editors/relation-source.d.ts +4 -1
  134. package/views/dist/editors/relation-source.js +5 -2
  135. package/views/dist/field-row/editors/RowNumberEditor.js +2 -2
  136. package/views/dist/fields/number-edit.d.ts +6 -0
  137. package/views/dist/fields/number-edit.js +8 -1
  138. package/views/dist/grid/chrome/GridCellEditors.js +2 -2
  139. package/views/dist/grid/chrome/GridColumnDateSection.d.ts +4 -3
  140. package/views/dist/grid/chrome/GridColumnDateSection.js +4 -4
  141. package/views/dist/grid/chrome/GridColumnDurationSection.js +2 -2
  142. package/views/dist/grid/chrome/GridColumnMenu.js +6 -4
  143. package/views/dist/grid/chrome/GridFooter.js +2 -2
  144. package/views/dist/grid/chrome/grid-column-menu-items.js +4 -2
  145. package/views/dist/grid/chrome/useGridBandFigures.js +2 -2
  146. package/views/dist/grid/chrome/useGridFittedWidths.d.ts +3 -0
  147. package/views/dist/grid/chrome/useGridFittedWidths.js +9 -3
  148. package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
  149. package/views/dist/grid/chrome/useGridKeyboard.js +5 -2
  150. package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -1
  151. package/views/dist/grid/core/commit-model.d.ts +7 -0
  152. package/views/dist/grid/core/commit-model.js +5 -1
  153. package/views/dist/grid/core/editing-controller.js +10 -2
  154. package/views/dist/grid/core/editing-model.js +3 -7
  155. package/views/dist/grid/core/undo-owner.d.ts +6 -0
  156. package/views/dist/grid/core/undo-owner.js +13 -0
  157. package/views/dist/grid/core/useGridEditing.d.ts +2 -0
  158. package/views/dist/grid/core/useGridEditing.js +4 -0
  159. package/views/dist/looks/index.d.ts +5 -0
  160. package/views/dist/looks/index.js +5 -0
  161. package/views/dist/looks/pieces.js +10 -0
  162. package/views/dist/panels/model.d.ts +6 -1
  163. package/views/dist/panels/react/customize-body.d.ts +4 -2
  164. package/views/dist/panels/react/customize-body.js +3 -3
  165. package/views/dist/panels/react/customize.js +4 -2
  166. package/views/dist/panels/react/filter/FilterEditor.js +2 -2
  167. package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +8 -2
  168. package/views/dist/panels/react/filter/PhoneFilterEditor.js +9 -6
  169. package/views/dist/panels/react/filter/filter-body.d.ts +8 -5
  170. package/views/dist/panels/react/filter/filter-body.js +17 -6
  171. package/views/dist/panels/react/filter/filter-part-body.d.ts +4 -1
  172. package/views/dist/panels/react/filter/filter-part-body.js +3 -1
  173. package/views/dist/panels/react/panel-sheet.d.ts +5 -1
  174. package/views/dist/panels/react/panel-sheet.js +6 -2
  175. package/views/dist/panels/react/panel-step.d.ts +12 -0
  176. package/views/dist/panels/react/panel-step.js +26 -0
  177. package/views/dist/panels/react/sort/SortEditor.d.ts +4 -0
  178. package/views/dist/panels/react/sort/SortEditor.js +5 -2
  179. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +8 -0
  180. package/views/dist/panels/react/toolbar/ReadyToolbar.js +84 -2
  181. package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +2 -2
  182. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +16 -0
  183. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +49 -0
  184. package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +3 -1
  185. package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +4 -1
  186. package/views/dist/panels/react/toolbar/ToolbarFilters.js +36 -21
  187. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +4 -1
  188. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +2 -2
  189. package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +5 -0
  190. package/views/dist/panels/react/toolbar/ToolbarSortPill.js +15 -6
  191. package/views/dist/panels/react/toolbar/panel-part.d.ts +5 -1
  192. package/views/dist/panels/react/toolbar/panel-part.js +2 -2
  193. package/views/dist/panels/react/toolbar/use-filter-add.d.ts +16 -0
  194. package/views/dist/panels/react/toolbar/use-filter-add.js +32 -0
  195. package/views/dist/panels/react.d.ts +1 -0
  196. package/views/dist/panels/react.js +1 -0
  197. package/views/dist/panels/settings/filter-groups.js +35 -1
  198. package/views/dist/panels/settings/group-buckets.js +1 -0
  199. package/views/dist/provider/ViewsProvider.d.ts +7 -1
  200. package/views/dist/provider/ViewsProvider.js +23 -3
  201. package/views/dist/provider/components.d.ts +30 -4
  202. package/views/dist/provider/moment.d.ts +6 -0
  203. package/views/dist/provider/moment.js +10 -0
  204. package/views/dist/styles.css +847 -52
  205. package/views/dist/styles.unlayered.css +848 -52
  206. package/views/docs/contract.md +15 -9
  207. package/views/docs/controls/alert-dialog.md +37 -0
  208. package/views/docs/controls/alert.md +30 -0
  209. package/views/docs/controls/collapsible.md +22 -0
  210. package/views/docs/controls/filter-editor.md +28 -0
  211. package/views/docs/controls/group-editor.md +11 -0
  212. package/views/docs/controls/modal.md +55 -0
  213. package/views/docs/controls/notice.md +32 -0
  214. package/views/docs/controls/pane.md +25 -0
  215. package/views/docs/controls/sort-editor.md +27 -0
  216. package/views/docs/controls/toast.md +32 -0
  217. package/views/docs/guides/cells.md +1 -1
  218. package/views/docs/guides/display.md +1 -1
  219. package/views/docs/guides/the-grid.md +1 -1
  220. package/views/docs/guides/the-provider.md +19 -0
  221. package/views/docs/reference/cells.md +2 -2
  222. package/views/docs/reference/controls.md +213 -7
  223. package/views/docs/reference/display.md +2 -2
  224. package/views/docs/reference/editors-relation.md +1 -1
  225. package/views/docs/reference/looks.md +10 -0
  226. package/views/docs/reference/panels-react.md +7 -6
  227. package/views/docs/reference/panels.md +1 -1
  228. package/views/docs/reference/react.md +7 -7
  229. package/views/docs/reference/views.md +1 -0
@@ -1,27 +1,29 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { Avatar } from "../avatar/avatar.js";
5
5
  import { Button } from "../button/button.js";
6
6
  import { FieldRows, FieldRowsRow as FieldRow } from "../field/field.js";
7
7
  import { Input, InputGroup, InputGroupAddon } from "../input/input.js";
8
- import { DOTS, DOTS_LOOK, glyph, OnTop, PLUS, TICK, useDecide, useStandingRoom, X } from "../internal/editor-parts.js";
8
+ import { DOTS, DOTS_LOOK, glyph, PLUS, useDecide, useStandingRoom, X } from "../internal/editor-parts.js";
9
9
  import { Icon } from "../internal/icons.js";
10
10
  import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
11
- import { usePopupHost } from "../internal/popup-host.js";
12
11
  import { spacingPx } from "../internal/read-token.js";
13
12
  import { drawnAt, scrollInList } from "../internal/scroll.js";
13
+ import { openerAt, useStepReturn } from "../internal/step-return.js";
14
14
  import { Menu } from "../menu/menu.js";
15
- import { Picker } from "../picker/picker.js";
15
+ import { Picker, usePicker } from "../picker/picker.js";
16
16
  import { Popover } from "../popover/popover.js";
17
17
  import { Radio, RadioGroup } from "../radio/radio.js";
18
18
  import { Select } from "../select/select.js";
19
- import { Sheet, SheetBody, SheetButton, SheetHead } from "../sheet/bottom-sheet.js";
20
19
  import { Spinner } from "../spinner/spinner.js";
21
20
  import { Switch } from "../switch/switch.js";
22
21
  import { midWord } from "../text-editor/check.js";
23
22
  import { added, found, heldOf, leadAfter, offered, removed, said, saidShort, setValue, ticked } from "./links.js";
24
23
  import { linksWords } from "./words.js";
24
+ function StepList(props) {
25
+ return _jsx(_Fragment, { children: usePicker(props).body });
26
+ }
25
27
  const SEARCH = ["M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0", "M21 21l-6 -6"], BACK = ["M15 6l-6 6l6 6"];
26
28
  const END_LOOK = { radius: "sm", corner: "round", edge: "none", words: "inherit", colour: "faint", icon: "16" };
27
29
  const MORE = ["M9 6l6 6l-6 6"];
@@ -59,9 +61,10 @@ export function useLinksEditor(props) {
59
61
  return; leading.current = value; lead.onLead(value); };
60
62
  const [query, setQuery] = React.useState(props.typed ?? "");
61
63
  const [lit, setLit] = React.useState(props.typed?.trim() ? 0 : null);
62
- const { linked, rest } = found(records, links, query, !!onSearch);
64
+ const { linked, rest: toAdd } = found(records, links, query, !!onSearch);
65
+ const rest = doing ? [] : toAdd;
63
66
  const lights = rest.length + actions.length;
64
- const litAt = lit == null || !lights ? null : Math.min(lit, lights - 1);
67
+ const litAt = lit == null || !lights || doing === "searching" ? null : Math.min(lit, lights - 1);
65
68
  const typeQuery = (v) => { setQuery(v); onSearch?.(v); };
66
69
  const asked = React.useRef(onMore);
67
70
  asked.current = onMore;
@@ -184,9 +187,20 @@ export function useLinksEditor(props) {
184
187
  typedFirst.current = props.typed ?? "";
185
188
  const placeRoot = React.useCallback((el) => { setRoot(el); placed(el); if (!el)
186
189
  setQuery(typedFirst.current); }, [placed]);
187
- const [top, setTop] = React.useState(() => (phone && opens && "list" in opens ? { link: opens.link, field: opens.list, open: true } : null));
190
+ const [top, setTop] = React.useState(() => (phone && opens && "list" in opens ? { link: opens.link, field: opens.list } : null));
188
191
  const [fieldsOf, setFieldsOf] = React.useState(() => (phone && opens && "config" in opens ? opens.config : null));
189
- const host = usePopupHost(searchBox);
192
+ React.useEffect(() => {
193
+ if (top && !links.some((l) => l.value === top.link))
194
+ setTop(null);
195
+ if (fieldsOf && !links.some((l) => l.value === fieldsOf))
196
+ setFieldsOf(null);
197
+ }, [links, top, fieldsOf]);
198
+ const fieldsOpen = several && fieldsOf ? fieldsOf : null;
199
+ useStepReturn(root, phone ? [
200
+ ...(fieldsOpen ? [openerAt(() => `.o-links-editor-card[data-link="${CSS.escape(fieldsOpen)}"] .o-links-editor-config`)] : []),
201
+ ...(top ? [openerAt(() => (fieldsOpen ? `.o-links-editor-fields .o-links-editor-open[data-field="${CSS.escape(top.field)}"]`
202
+ : `.o-links-editor-card[data-link="${CSS.escape(top.link)}"] .o-links-editor-open[data-field="${CSS.escape(top.field)}"]`))] : []),
203
+ ] : []);
190
204
  const [sheetRoom, setSheetRoom] = React.useState(null);
191
205
  React.useLayoutEffect(() => {
192
206
  const scroller = root?.parentElement?.closest(".o-sheet-body");
@@ -208,7 +222,7 @@ export function useLinksEditor(props) {
208
222
  const holds = (l) => fields.map((f) => (f.kind === "yes-no" ? (l.values[f.id] === true ? f.label : "") : said(f, l.values[f.id], w.yes) === "–" ? "" : said(f, l.values[f.id], w.yes)))
209
223
  .filter(Boolean).join(" · ");
210
224
  const rowWords = (f, v) => { const s = said(f, v, w.yes); return f.kind === "yes-no" ? (v === true ? w.yes : w.no) : s === "–" ? w.none : s; };
211
- const openList = (value, field) => setTop({ link: value, field, open: true });
225
+ const openList = (value, field) => setTop({ link: value, field });
212
226
  const fieldRow = (l, name, f) => (f.kind === "yes-no" ? (_jsxs(FieldRow, { className: "o-links-editor-open", "data-field": f.id, children: [_jsx("span", { className: "o-links-editor-open-name", children: f.label }), _jsx(Switch, { size: "lg", className: "o-links-editor-switch", checked: l.values[f.id] === true, "aria-label": w.fieldAt(f.label, name), onCheckedChange: (c) => setField(l.value, f.id, c) })] }, f.id)) : (_jsxs(FieldRow, { as: "button", className: "o-links-editor-open", "data-field": f.id, "aria-label": w.fieldAt(f.label, name), onClick: () => openList(l.value, f.id), children: [_jsx("span", { className: "o-links-editor-open-name", children: f.label }), _jsx("span", { className: "o-links-editor-open-value", children: rowWords(f, l.values[f.id]) }), glyph(MORE, "o-links-editor-open-mark")] }, f.id)));
213
227
  const card = (r) => {
214
228
  const l = links.find((x) => x.value === r.value), name = r.label, leads = lead != null && lead.value === r.value;
@@ -220,11 +234,16 @@ export function useLinksEditor(props) {
220
234
  const topLink = top ? links.find((l) => l.value === top.link) : undefined, topField = top ? fields.find((f) => f.id === top.field) : undefined;
221
235
  const fieldsLink = fieldsOf ? links.find((l) => l.value === fieldsOf) : undefined;
222
236
  const fieldsName = fieldsOf ? byValue(fieldsOf).label : "";
223
- const body = (_jsxs("div", { ref: placeRoot, className: "o-links-editor", "data-kit": "links-editor", ...mark, "data-links-form": "phone", "data-links-shape": "table", "data-links-fields": several ? "several" : "one", tabIndex: -1, style: sheetRoom ? { "--links-room": `${sheetRoom.height}px`, "--links-under": `${sheetRoom.under}px` } : undefined, children: [linked.length > 0 && _jsx("div", { className: "o-links-editor-cards", role: "list", "aria-label": label, children: linked.map(card) }), (rest.length > 0 || actions.length > 0) && _jsxs(_Fragment, { children: [_jsx("div", { className: "o-links-editor-label", children: addWords }), _jsxs(FieldRows, { look: ADDS, className: "o-links-editor-adds", role: "list", "aria-label": addWords, children: [rest.map((r) => (_jsxs(FieldRow, { as: "button", className: "o-links-editor-add", "data-record": r.value, role: "listitem", "aria-label": w.linkName(r.label), onClick: () => link(r.value), children: [_jsx(Face, { record: r, size: 40 }), _jsx("span", { className: "o-links-editor-add-name", children: r.label }), glyph(PLUS, "o-links-editor-add-mark")] }, r.value))), actions.map((a) => (_jsxs(FieldRow, { as: "button", className: "o-links-editor-add o-links-editor-action", role: "listitem", onClick: a.onSelect, children: [a.icon != null && _jsx("span", { className: "o-links-editor-action-mark", children: a.icon }), _jsx("span", { className: "o-links-editor-add-name", children: a.label })] }, a.key)))] }), more] }), doingNote ? _jsx("div", { className: "o-links-editor-note", children: doingNote }) : _jsxs(_Fragment, { children: [!rest.length && query.trim() && !linked.length && _jsx("div", { className: "o-links-editor-note", children: w.nothingMatchesTyped(query.trim()) }), !rest.length && !query.trim() && linked.length > 0 && _jsx("div", { className: "o-links-editor-note", children: w.everythingLinked })] }), _jsx("div", { className: "o-links-editor-bar", children: _jsxs(InputGroup, { size: "lg", className: "o-links-editor-pill", children: [_jsx(InputGroupAddon, { side: "start", children: glyph(SEARCH) }), _jsx(Input, { autofill: false, ref: searchBox, className: "o-links-editor-input", placeholder: search, "aria-label": search, value: query, onValueChange: (v) => typeQuery(v) })] }) }), top && topField && topLink && _jsx(OnTop, { open: top.open, onOpenChange: (o) => setTop((t) => (t ? { ...t, open: o } : t)), onGone: () => setTop((t) => (t && !t.open ? null : t)), container: screen ?? host, standing: !!screen, title: topField.label, words: { close: w.close }, picker: { ...listOf(topLink, topField), draft: "shell" } }, `${top.link}-${top.field}`), several && (_jsxs(_Fragment, { children: [_jsx("span", { hidden: true }), _jsxs(Sheet, { open: !!fieldsLink, onOpenChange: (o) => { if (!o)
224
- setFieldsOf(null); }, label: fieldsName, form: "full", container: screen ?? host, standing: !!screen, children: [_jsx(SheetHead, { title: fieldsName, left: _jsx(SheetButton, { "aria-label": w.close, icon: glyph(X), onClick: () => setFieldsOf(null) }), right: _jsx(SheetButton, { kind: "primary", "aria-label": w.done, icon: glyph(TICK), onClick: () => setFieldsOf(null) }) }), _jsx(SheetBody, { children: fieldsLink && _jsxs(_Fragment, { children: [_jsxs(FieldRows, { look: FIELDS, className: "o-links-editor-fields", "data-link": fieldsLink.value, children: [fields.map((f) => f.kind === "yes-no"
225
- ? _jsx(FieldRow, { label: f.label, "data-field": f.id, children: _jsx(Switch, { size: "lg", className: "o-links-editor-switch", checked: fieldsLink.values[f.id] === true, "aria-label": w.fieldAt(f.label, fieldsName), onCheckedChange: (c) => setField(fieldsLink.value, f.id, c) }) }, f.id)
226
- : _jsxs(FieldRow, { as: "button", label: f.label, className: "o-links-editor-open", "data-field": f.id, "aria-label": w.fieldAt(f.label, fieldsName), onClick: () => openList(fieldsLink.value, f.id), children: [_jsx("span", { className: "o-links-editor-open-value", children: rowWords(f, fieldsLink.values[f.id]) }), glyph(MORE, "o-links-editor-open-mark")] }, f.id)), lead && _jsx(FieldRow, { label: lead.label, "data-field": "lead", children: _jsx(Switch, { size: "lg", className: "o-links-editor-switch", checked: lead.value === fieldsLink.value, "aria-label": w.isLead(fieldsName, lead.label), onCheckedChange: (c) => { if (c)
227
- setLead(fieldsLink.value); } }) })] }), _jsx(FieldRows, { look: FIELDS, className: "o-links-editor-fields-foot", children: _jsx(FieldRow, { as: "button", className: "o-links-editor-unlink", onClick: () => { const v = fieldsLink.value; setFieldsOf(null); unlink(v); }, children: w.unlink }) })] }) })] })] }))] }));
237
+ const listStep = top && topLink && topField ? top : null;
238
+ const fieldsStep = several ? fieldsLink ?? null : null;
239
+ const body = (_jsx("div", { ref: placeRoot, className: "o-links-editor", "data-kit": "links-editor", ...mark, "data-links-form": "phone", "data-links-shape": "table", "data-links-fields": several ? "several" : "one", tabIndex: -1, "data-links-step": listStep ? "list" : fieldsStep ? "fields" : undefined, style: sheetRoom ? { "--links-room": `${sheetRoom.height}px`, "--links-under": `${sheetRoom.under}px` } : undefined, children: listStep && topLink && topField ? (_jsx(StepList, { ...listOf(topLink, topField), draft: "shell", form: "phone", onDone: () => setTop(null) }, `${listStep.link}-${listStep.field}`)) : fieldsStep ? _jsxs(_Fragment, { children: [_jsxs(FieldRows, { look: FIELDS, className: "o-links-editor-fields", "data-link": fieldsStep.value, children: [fields.map((f) => f.kind === "yes-no"
240
+ ? _jsx(FieldRow, { label: f.label, "data-field": f.id, children: _jsx(Switch, { size: "lg", className: "o-links-editor-switch", checked: fieldsStep.values[f.id] === true, "aria-label": w.fieldAt(f.label, fieldsName), onCheckedChange: (c) => setField(fieldsStep.value, f.id, c) }) }, f.id)
241
+ : _jsxs(FieldRow, { as: "button", label: f.label, className: "o-links-editor-open", "data-field": f.id, "aria-label": w.fieldAt(f.label, fieldsName), onClick: () => openList(fieldsStep.value, f.id), children: [_jsx("span", { className: "o-links-editor-open-value", children: rowWords(f, fieldsStep.values[f.id]) }), glyph(MORE, "o-links-editor-open-mark")] }, f.id)), lead && _jsx(FieldRow, { label: lead.label, "data-field": "lead", children: _jsx(Switch, { size: "lg", className: "o-links-editor-switch", checked: lead.value === fieldsStep.value, "aria-label": w.isLead(fieldsName, lead.label), onCheckedChange: (c) => { if (c)
242
+ setLead(fieldsStep.value); } }) })] }), _jsx(FieldRows, { look: FIELDS, className: "o-links-editor-fields-foot", children: _jsx(FieldRow, { as: "button", className: "o-links-editor-unlink", onClick: () => { const v = fieldsStep.value; setFieldsOf(null); unlink(v); }, children: w.unlink }) })] }) : _jsxs(_Fragment, { children: [linked.length > 0 && _jsx("div", { className: "o-links-editor-cards", role: "list", "aria-label": label, children: linked.map(card) }), (rest.length > 0 || actions.length > 0) && _jsxs(_Fragment, { children: [_jsx("div", { className: "o-links-editor-label", children: addWords }), _jsxs(FieldRows, { look: ADDS, className: "o-links-editor-adds", role: "list", "aria-label": addWords, children: [rest.map((r) => (_jsxs(FieldRow, { as: "button", className: "o-links-editor-add", "data-record": r.value, role: "listitem", "aria-label": w.linkName(r.label), onClick: () => link(r.value), children: [_jsx(Face, { record: r, size: 40 }), _jsx("span", { className: "o-links-editor-add-name", children: r.label }), glyph(PLUS, "o-links-editor-add-mark")] }, r.value))), actions.map((a) => (_jsxs(FieldRow, { as: "button", className: "o-links-editor-add o-links-editor-action", role: "listitem", onClick: a.onSelect, children: [a.icon != null && _jsx("span", { className: "o-links-editor-action-mark", children: a.icon }), _jsx("span", { className: "o-links-editor-add-name", children: a.label })] }, a.key)))] }), more] }), doingNote ? _jsx("div", { className: "o-links-editor-note", children: doingNote }) : _jsxs(_Fragment, { children: [!rest.length && query.trim() && !linked.length && _jsx("div", { className: "o-links-editor-note", children: w.nothingMatchesTyped(query.trim()) }), !rest.length && !query.trim() && linked.length > 0 && _jsx("div", { className: "o-links-editor-note", children: w.everythingLinked })] }), _jsx("div", { className: "o-links-editor-bar", children: _jsxs(InputGroup, { size: "lg", className: "o-links-editor-pill", children: [_jsx(InputGroupAddon, { side: "start", children: glyph(SEARCH) }), _jsx(Input, { autofill: false, ref: searchBox, className: "o-links-editor-input", placeholder: search, "aria-label": search, value: query, onValueChange: (v) => typeQuery(v) })] }) })] }) }));
243
+ if (listStep && topField)
244
+ return { body, head: { onBack: () => setTop(null), close: false }, title: topField.label };
245
+ if (fieldsStep)
246
+ return { body, head: { onBack: () => setFieldsOf(null), close: false }, title: fieldsName };
228
247
  return { body, head: decide.head };
229
248
  }
230
249
  const stepLink = step ? links.find((l) => l.value === step) : undefined;
@@ -253,6 +272,8 @@ export function useLinksEditor(props) {
253
272
  const keys = (e) => {
254
273
  if ((e.key === "ArrowDown" || e.key === "ArrowUp") && lights) {
255
274
  e.preventDefault();
275
+ if (doing === "searching")
276
+ return;
256
277
  const next = litAt == null ? (e.key === "ArrowDown" ? 0 : lights - 1) : (litAt + (e.key === "ArrowDown" ? 1 : lights - 1)) % lights;
257
278
  setLit(next);
258
279
  const row = list.current?.querySelector(`#${CSS.escape(`${ids}-add-${next}`)}`);
@@ -295,10 +316,10 @@ export function useLinksEditor(props) {
295
316
  })() : null;
296
317
  const body = (_jsxs("div", { ref: setRoot, className: "o-links-editor", "data-kit": "links-editor", ...mark, "data-links-form": "computer", "data-links-shape": "table", "data-links-fields": several ? "several" : "one", role: "group", "aria-label": label, tabIndex: -1, style: room ? { paddingBottom: room } : undefined, children: [_jsxs("div", { className: "o-links-editor-search o-popup-line", children: [glyph(SEARCH), _jsx(Input, { chrome: "bare", autofill: false, ref: searchBox, className: "o-links-editor-input", placeholder: search, "aria-label": search, role: "combobox", "aria-expanded": lights > 0, "aria-autocomplete": "list", "aria-controls": lights ? `${ids}-add` : undefined, "aria-activedescendant": litAt != null ? `${ids}-add-${litAt}` : undefined, value: query, onValueChange: (v) => { typeQuery(v); setLit(v.trim() ? 0 : null); }, onKeyDown: keys })] }), _jsxs("div", { ref: placeList, className: "o-links-editor-list", "data-head": linked.length ? "" : undefined, "data-held": open ? "" : undefined, children: [linked.length > 0 && _jsxs(_Fragment, { children: [_jsxs("div", { className: "o-links-editor-head", "aria-hidden": "true", children: [_jsx("span", { className: "o-links-editor-who", children: kind }), fields.map((f) => _jsx("span", { className: "o-links-editor-cell", "data-field": f.id, "data-kind": f.kind, children: f.label }, f.id)), lead && _jsx("span", { className: "o-links-editor-lead", children: lead.label }), _jsx("span", { className: "o-links-editor-end" })] }), lead
297
318
  ? _jsx(RadioGroup, { className: "o-links-editor-rows", "aria-label": lead.label, value: lead.value, onValueChange: (v) => setLead(v), children: rows })
298
- : _jsx("div", { className: "o-links-editor-rows", children: rows })] }), linked.length > 0 && lights > 0 && _jsx("div", { className: "o-list-sep", role: "presentation" }), lights > 0 && _jsxs("div", { id: `${ids}-add`, role: "listbox", "aria-label": w.addTo(label), className: "o-links-editor-adds", onPointerLeave: () => setLit(query.trim() ? 0 : null), children: [linked.length > 0 && _jsx("div", { className: "o-list-heading", "aria-hidden": "true", children: w.add }), rest.map((r, i) => (_jsxs("div", { id: `${ids}-add-${i}`, role: "option", "aria-selected": i === litAt, className: "o-list-row o-smooth o-smooth-ease o-links-editor-add", "data-record": r.value, ...phoneMark(small), "data-highlighted": i === litAt ? "" : undefined, onPointerMove: () => { if (!open && i !== litAt)
319
+ : _jsx("div", { className: "o-links-editor-rows", children: rows })] }), linked.length > 0 && lights > 0 && _jsx("div", { className: "o-list-sep", role: "presentation" }), lights > 0 && _jsxs("div", { id: `${ids}-add`, role: "listbox", "aria-label": w.addTo(label), className: "o-links-editor-adds", onPointerLeave: () => setLit(query.trim() ? 0 : null), children: [linked.length > 0 && _jsx("div", { className: "o-list-heading", "aria-hidden": "true", children: w.add }), rest.map((r, i) => (_jsxs("div", { id: `${ids}-add-${i}`, role: "option", "aria-selected": i === litAt, className: "o-list-row o-smooth o-smooth-ease o-links-editor-add", "data-record": r.value, ...phoneMark(small), "data-highlighted": i === litAt ? "" : undefined, onPointerMove: () => { if (!open && doing !== "searching" && i !== litAt)
299
320
  setLit(i); }, onMouseDown: (e) => e.preventDefault(), onClick: () => link(r.value), children: [_jsx(Face, { record: r, size: 20 }), _jsx("span", { className: "o-list-text", children: _jsx("span", { className: "o-list-main", children: r.label }) })] }, r.value))), actions.map((a, j) => {
300
321
  const i = rest.length + j;
301
- return (_jsxs("div", { id: `${ids}-add-${i}`, role: "option", "aria-selected": i === litAt, className: "o-list-row o-smooth o-smooth-ease o-links-editor-add o-links-editor-action", ...phoneMark(small), "data-highlighted": i === litAt ? "" : undefined, onPointerMove: () => { if (!open && i !== litAt)
322
+ return (_jsxs("div", { id: `${ids}-add-${i}`, role: "option", "aria-selected": i === litAt, className: "o-list-row o-smooth o-smooth-ease o-links-editor-add o-links-editor-action", ...phoneMark(small), "data-highlighted": i === litAt ? "" : undefined, onPointerMove: () => { if (!open && doing !== "searching" && i !== litAt)
302
323
  setLit(i); }, onMouseDown: (e) => e.preventDefault(), onClick: a.onSelect, children: [a.icon != null && _jsx("span", { className: "o-links-editor-action-mark", children: a.icon }), _jsx("span", { className: "o-list-text", children: _jsx("span", { className: "o-list-main", children: a.label }) })] }, a.key));
303
324
  })] }), more, message && _jsx("div", { className: "o-links-editor-message", children: message })] }), shown] }));
304
325
  return { body, head: {} };
@@ -5,6 +5,7 @@ import { resolveViewsMessage } from "../../contract.js";
5
5
  import { EDITOR_INNER_ESCAPE } from "../../editors/inner-escape.js";
6
6
  import { ViewsContext } from "../../provider/context.js";
7
7
  import { pickerItemsOf, pickerWordsOf } from "../picker/map-picker.js";
8
+ import { useToldStep } from "../internal/told-step.js";
8
9
  import { useLinksEditor } from "./links-editor.js";
9
10
  import { heldOf } from "./links.js";
10
11
  const ROLES = "roles";
@@ -67,5 +68,7 @@ export function MapLinksBody(props) {
67
68
  const makeLead = props.lead?.makeLabel;
68
69
  const words = React.useMemo(() => linksEditorWordsOf(messages, makeLead), [messages, makeLead]);
69
70
  const rolesWord = messages({ key: "views.editors.links-roles" });
70
- return _jsx(_Fragment, { children: useLinksEditor(linksEditorPropsOf(props, words, rolesWord, views?.components.AppIcon)).body });
71
+ const parts = useLinksEditor(linksEditorPropsOf(props, words, rolesWord, views?.components.AppIcon));
72
+ useToldStep(parts, props.onStepChange);
73
+ return _jsx(_Fragment, { children: parts.body });
71
74
  }
@@ -120,7 +120,7 @@
120
120
  background-image: linear-gradient(to bottom, transparent, var(--vk-overlay) calc(var(--vk-spacing) * 8));
121
121
  }
122
122
  .o-links-editor-pill { flex: 1; }
123
- /* A link's fields, in the Modal's full Sheet: a field's words at its row's end; a switch at its end; Unlink its own card, in red. */
123
+ /* A link's fields, a step of the phone's Sheet: a field's words at its row's end; a switch at its end; Unlink its own card, in red. */
124
124
  .o-links-editor-fields .o-links-editor-open-value { flex: 1; }
125
125
  .o-links-editor-switch { flex: none; margin-left: auto; }
126
126
  .o-links-editor-fields-foot { margin-top: calc(var(--vk-spacing) * 6); }
@@ -100,6 +100,17 @@ export declare const menuListCloseOf: (el: Element | null) => boolean;
100
100
  export declare function useMenuListOption(frame: HTMLElement | null, id: MenuListLookOptionId): string;
101
101
  /** What its rows stand on, as worn around `frame`, kept up to date as an app changes it. */
102
102
  export declare const useMenuListRows: (frame: HTMLElement | null) => string;
103
+ /** The words its rows with a grip and its Switches say: a grip's name, how the rows move on a computer and on a phone, each move as
104
+ * it is said, and the Switch's two words. English unless handed (the group editor hands the app's, VK-839). */
105
+ export interface MenuListWords {
106
+ move: (label: string) => string;
107
+ howKeys: string;
108
+ howHold: string;
109
+ movedTo: (label: string, at: number, of: number) => string;
110
+ on: string;
111
+ off: string;
112
+ }
113
+ export declare const MENU_LIST_WORDS: MenuListWords;
103
114
  /** What scrolls in a menu's panel: its rows, alone, when the panel is taller than the room on screen, the Scrollbar over
104
115
  * them: the menu's panel and each level in. Not the menu list's rows in a panel that is no menu (`.o-menu-rows`). */
105
116
  export declare const MenuScroll: ({ children }: {
@@ -133,6 +144,8 @@ export interface MenuListPanelRowsProps {
133
144
  ticks?: "box" | "switch" | "eye";
134
145
  /** A row with a grip moved, handed on as it is made: its place and the place it moved to, counted among the rows with a grip. */
135
146
  onMove?: (from: number, to: number) => void;
147
+ /** Its grips' and Switches' words; English unless handed. */
148
+ words?: Partial<MenuListWords>;
136
149
  className?: string;
137
150
  }
138
151
  /** A menu's rows on a computer standing in a panel that is no menu (the Pane, a Popover): the same rows, pressed and keyed by
@@ -140,7 +153,7 @@ export interface MenuListPanelRowsProps {
140
153
  * a row one level in handed to its holder, which shows what it opens in place. It draws no panel: its holder's is round it.
141
154
  * Its rows are one tab stop, as a menu's are; the pointer lights the row under it, and moves the focus there only while the
142
155
  * focus is already in it, so it never takes the focus from its holder's other controls. */
143
- export declare function MenuListPanelRows({ label, entries, onOpen, ticks, onMove, className }: MenuListPanelRowsProps): import("react/jsx-runtime").JSX.Element;
156
+ export declare function MenuListPanelRows({ label, entries, onOpen, ticks, onMove, className, words: given }: MenuListPanelRowsProps): import("react/jsx-runtime").JSX.Element;
144
157
  export declare function tilesOf(entries: MenuEntry[], allRows?: boolean): {
145
158
  tiles?: MenuListTile[];
146
159
  entries: MenuEntry[];
@@ -190,9 +203,11 @@ export interface MenuListProps {
190
203
  onMove?: (from: number, to: number) => void;
191
204
  /** How a tick is drawn: the Switch (the default), or an eye at its end, crossed while it is off. */
192
205
  ticks?: "switch" | "eye";
206
+ /** Its grips' and Switches' words; English unless handed. */
207
+ words?: Partial<MenuListWords>;
193
208
  className?: string;
194
209
  }
195
210
  /** What you can do with something, as rows you press: tiles if it has them, then its rows in sections. Pour it into a Sheet; it owns
196
211
  * no way of opening or closing. No search: a menu long enough to need one is a wrong menu. */
197
- export declare function MenuList({ label, entries, tiles, onOpen, onClose, closeWord, onMove, ticks, className }: MenuListProps): import("react/jsx-runtime").JSX.Element;
212
+ export declare function MenuList({ label, entries, tiles, onOpen, onClose, closeWord, onMove, ticks, className, words: given }: MenuListProps): import("react/jsx-runtime").JSX.Element;
198
213
  export {};
@@ -49,10 +49,17 @@ const linkBody = (e, id) => _jsxs(_Fragment, { children: [e.icon, _jsx("span", {
49
49
  const checkBody = (e, id) => _jsxs(_Fragment, { children: [_jsx(CheckboxMark, {}), _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label })] });
50
50
  const actionsBody = (e, id) => _jsxs(_Fragment, { children: [e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), e.detail != null && _jsx("span", { className: "o-menu-value", id: part(id, "v"), "data-on": e.inForce ? "" : undefined, children: e.detail }), strokeGlyph(MORE, "o-menu-more")] });
51
51
  const choicesBody = (e, id) => (_jsxs(_Fragment, { children: [e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), _jsx("span", { className: "o-menu-value", id: part(id, "v"), children: e.detail ?? e.choices.find((c) => c.value === e.value)?.label }), strokeGlyph(MORE, "o-menu-more")] }));
52
- const HOW_KEYS = "Left arrow for its grip, then up or down arrow to move it";
53
- const HOW_HOLD = "Hold, then drag to move it";
52
+ export const MENU_LIST_WORDS = {
53
+ move: (label) => `Move ${label}`,
54
+ howKeys: "Left arrow for its grip, then up or down arrow to move it",
55
+ howHold: "Hold, then drag to move it",
56
+ movedTo: (label, at, of) => `${label}, ${at} of ${of}`,
57
+ on: "On",
58
+ off: "Off",
59
+ };
60
+ const listWords = (given) => (given ? { ...MENU_LIST_WORDS, ...given } : MENU_LIST_WORDS);
54
61
  const HOLD = { delay: (row) => msOf(row, "--menu-list-hold"), swipe: (row) => spacingPx(2, row) };
55
- const movedTo = (list, from, to) => `${"label" in list[from] ? list[from].label : ""}, ${to + 1} of ${list.length}`;
62
+ const movedTo = (list, from, to, w = MENU_LIST_WORDS) => w.movedTo("label" in list[from] ? list[from].label : "", to + 1, list.length);
56
63
  function Says({ id, how, said }) {
57
64
  return _jsxs(_Fragment, { children: [_jsx("span", { id: id, hidden: true, children: how }), _jsx("span", { role: "status", className: "o-menu-said", children: said })] });
58
65
  }
@@ -116,16 +123,17 @@ export function MenuListShown({ entries, label, open, on = [], className }) {
116
123
  }
117
124
  const grippedOf = (list) => list.flatMap((e) => (e.kind === "group" ? grippedOf(e.entries) : e.kind !== "separator" && e.kind !== "pick" && e.grip && !("disabled" in e && e.disabled) ? [e] : []));
118
125
  const disabledProps = (why) => (why ? { "aria-disabled": true, "data-disabled": "", title: why } : {});
119
- function PanelCheck({ e, item, ticks, grip, id }) {
126
+ function PanelCheck({ e, item, ticks, grip, id, words = MENU_LIST_WORDS }) {
120
127
  const [own, setOwn] = React.useState(!!e.defaultChecked), on = e.checked ?? own;
121
128
  const press = () => { if (e.disabled)
122
129
  return; const next = !on; if (e.checked === undefined)
123
130
  setOwn(next); e.onCheckedChange?.(next); };
124
131
  if (ticks === "eye")
125
132
  return (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...disabledProps(e.disabled), ...item, onClick: press, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-eyed", children: [grip, e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), eyeOf(on, "o-menu-eye")] }));
126
- return ticks === "switch" ? (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...disabledProps(e.disabled), ...item, onClick: press, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-switch", children: [grip, e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), _jsx(Switch, { size: "sm", checked: on, onCheckedChange: () => { }, disabled: !!e.disabled, tabIndex: -1, "aria-hidden": true, onMouseDown: (ev) => { ev.preventDefault(); ev.currentTarget.closest("[data-item]")?.focus({ preventScroll: true }); } })] })) : (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...disabledProps(e.disabled), ...item, onClick: press, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-check", children: [grip, checkBody(e, id)] }));
133
+ return ticks === "switch" ? (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...disabledProps(e.disabled), ...item, onClick: press, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-switch", children: [grip, e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), _jsx(Switch, { size: "sm", checked: on, onCheckedChange: () => { }, disabled: !!e.disabled, tabIndex: -1, "aria-hidden": true, words: [words.on, words.off], onMouseDown: (ev) => { ev.preventDefault(); ev.currentTarget.closest("[data-item]")?.focus({ preventScroll: true }); } })] })) : (_jsxs("div", { role: "menuitemcheckbox", "aria-checked": on, ...disabledProps(e.disabled), ...item, onClick: press, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-check", children: [grip, checkBody(e, id)] }));
127
134
  }
128
- export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMove, className }) {
135
+ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMove, className, words: given }) {
136
+ const w = listWords(given);
129
137
  const root = React.useRef(null), mark = phoneMark(usePhoneForm());
130
138
  const [lit, setLit] = React.useState(null), [stop, setStop] = React.useState(0);
131
139
  const typed = React.useRef({ text: "", at: 0 });
@@ -143,7 +151,7 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
143
151
  };
144
152
  setLit((l) => (l == null ? l : at(l)));
145
153
  setStop(at);
146
- setSaid(movedTo(gripped, from, to));
154
+ setSaid(movedTo(gripped, from, to, w));
147
155
  onMove?.(from, to);
148
156
  } });
149
157
  const rowsNow = () => [...(root.current?.querySelectorAll("[data-item]") ?? [])];
@@ -229,7 +237,7 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
229
237
  if (g < 0 || !("label" in e))
230
238
  return null;
231
239
  const own = gripProps(g);
232
- return (_jsx(Grip, { label: `Move ${e.label}`, className: "o-menu-grip", tabIndex: -1, ...own, onClick: (ev) => ev.stopPropagation(), onKeyDown: (ev) => {
240
+ return (_jsx(Grip, { label: w.move(e.label), className: "o-menu-grip", tabIndex: -1, ...own, onClick: (ev) => ev.stopPropagation(), onKeyDown: (ev) => {
233
241
  if (ev.key === "ArrowRight" || ev.key === "Escape") {
234
242
  ev.preventDefault();
235
243
  ev.stopPropagation();
@@ -252,7 +260,7 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
252
260
  if (e.kind === "pick")
253
261
  return (_jsxs("div", { role: "group", "aria-label": e.heading, children: [e.heading && _jsx("p", { className: "o-list-heading", children: e.heading }), e.choices.map((c) => _jsx("div", { role: "menuitemradio", "aria-checked": c.value === e.value, ...item(), onClick: () => e.onChoose?.(c.value), className: ROW, children: choiceBody(c) }, c.value))] }, k));
254
262
  if (e.kind === "check")
255
- return _jsx(PanelCheck, { e: e, item: item(e), ticks: ticks, grip: gripFor(e), id: idOf(e) }, k);
263
+ return _jsx(PanelCheck, { e: e, item: item(e), ticks: ticks, grip: gripFor(e), id: idOf(e), words: w }, k);
256
264
  if (e.kind === "link") {
257
265
  const attrs = { role: "menuitem", ...item(e), className: ROW, onClick: e.onSelect, ...(e.external ? { target: "_blank", rel: "noreferrer" } : {}) };
258
266
  return e.render ? React.cloneElement(e.render, { key: k, ...attrs }, gripFor(e), linkBody(e, idOf(e))) : _jsxs("a", { href: e.href, ...attrs, children: [gripFor(e), linkBody(e, idOf(e))] }, k);
@@ -262,7 +270,7 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
262
270
  return _jsxs("div", { role: "menuitem", ...disabledProps(e.disabled), ...item(e), onClick: () => { if (!e.disabled)
263
271
  e.onSelect?.(); }, className: rowClass(e), children: [gripFor(e), actionBody(e, idOf(e))] }, k);
264
272
  });
265
- return (_jsxs("div", { ref: root, role: "menu", "aria-label": label, className: cx("o-menu-rows", className), "data-kit": "menu-list", ...mark, onKeyDown: onKeyDown, onPointerLeave: onPointerLeave, onBlur: onBlur, children: [rows(entries), gripped.length > 0 && _jsx(Says, { id: `${ids}how`, how: HOW_KEYS, said: said })] }));
273
+ return (_jsxs("div", { ref: root, role: "menu", "aria-label": label, className: cx("o-menu-rows", className), "data-kit": "menu-list", ...mark, onKeyDown: onKeyDown, onPointerLeave: onPointerLeave, onBlur: onBlur, children: [rows(entries), gripped.length > 0 && _jsx(Says, { id: `${ids}how`, how: w.howKeys, said: said })] }));
266
274
  }
267
275
  export function tilesOf(entries, allRows) {
268
276
  if (allRows)
@@ -302,14 +310,14 @@ const endOf = (r) => {
302
310
  const end = r.end ?? (r.kind === "actions" ? r.detail : r.kind === undefined || r.kind === "action" ? r.count : undefined);
303
311
  return end != null ? _jsx("span", { className: "o-menu-list-end", "data-on": r.kind === "actions" && r.inForce ? "" : undefined, children: end }) : null;
304
312
  };
305
- function PhoneRow({ row, onOpen, move, room, ticks = "switch" }) {
313
+ function PhoneRow({ row, onOpen, move, room, ticks = "switch", words = MENU_LIST_WORDS }) {
306
314
  const mv = move ? { "data-row": move.at, ...(move.lifted ? { "data-lifted": "" } : {}), style: move.style, ...move.drag } : {};
307
315
  const how = move ? { "aria-describedby": move.how } : {};
308
316
  const lead = move ? glyph(GRIP, "o-menu-list-grip") : room ? React.cloneElement(glyph(GRIP, "o-menu-list-grip"), { "data-room": "" }) : null;
309
317
  if (row.kind === "check" && ticks === "eye")
310
318
  return _jsx(PhoneEye, { row: row, lead: lead, mv: mv, how: how });
311
319
  if (row.kind === "check")
312
- return (_jsxs("label", { className: "o-menu-list-row", ...mv, children: [lead, row.icon && _jsx("span", { className: "o-menu-list-mark", children: row.icon }), _jsxs("span", { className: "o-menu-list-name", children: [_jsx("span", { children: row.label }), (row.disabled ?? row.note) != null && _jsx("span", { className: "o-menu-list-note", children: row.disabled ?? row.note })] }), _jsx(Switch, { size: "lg", checked: row.checked, defaultChecked: row.defaultChecked, onCheckedChange: (c) => row.onCheckedChange?.(c), disabled: !!row.disabled, ...how })] }));
320
+ return (_jsxs("label", { className: "o-menu-list-row", ...mv, children: [lead, row.icon && _jsx("span", { className: "o-menu-list-mark", children: row.icon }), _jsxs("span", { className: "o-menu-list-name", children: [_jsx("span", { children: row.label }), (row.disabled ?? row.note) != null && _jsx("span", { className: "o-menu-list-note", children: row.disabled ?? row.note })] }), _jsx(Switch, { size: "lg", checked: row.checked, defaultChecked: row.defaultChecked, onCheckedChange: (c) => row.onCheckedChange?.(c), disabled: !!row.disabled, words: [words.on, words.off], ...how })] }));
313
321
  if (row.kind === "link") {
314
322
  const attrs = { className: "o-menu-list-row", ...mv, ...how, ...(row.external ? { target: "_blank", rel: "noreferrer" } : {}) };
315
323
  const inside = _jsxs(_Fragment, { children: [lead, body(row), endOf(row), row.external ? glyph(AWAY, "o-menu-list-more") : glyph(MORE, "o-menu-list-more")] });
@@ -332,18 +340,19 @@ function PhoneEye({ row, lead, mv, how }) {
332
340
  setOwn(next); row.onCheckedChange?.(next); };
333
341
  return (_jsxs(BaseButton, { className: "o-menu-list-row", ...mv, ...how, role: "switch", "aria-checked": on, disabled: !!row.disabled, focusableWhenDisabled: true, onClick: press, children: [lead, row.icon && _jsx("span", { className: "o-menu-list-mark", children: row.icon }), _jsxs("span", { className: "o-menu-list-name", children: [_jsx("span", { children: row.label }), (row.disabled ?? row.note) != null && _jsx("span", { className: "o-menu-list-note", children: row.disabled ?? row.note })] }), eyeOf(on, "o-menu-list-eye")] }));
334
342
  }
335
- export function MenuList({ label, entries, tiles, onOpen, onClose, closeWord = "Close", onMove, ticks, className }) {
343
+ export function MenuList({ label, entries, tiles, onOpen, onClose, closeWord = "Close", onMove, ticks, className, words: given }) {
344
+ const w = listWords(given);
336
345
  const sections = React.useMemo(() => sectionsOf(entries).filter((s) => s.rows.length), [entries]);
337
346
  const root = React.useRef(null), gripped = grippedOf(entries);
338
347
  const ids = React.useId(), [said, setSaid] = React.useState("");
339
- const { gripProps, lift, dragging } = useReorder({ count: gripped.length, grip: "[data-drag-start]", onMove: (from, to) => { setSaid(movedTo(gripped, from, to)); onMove?.(from, to); } });
348
+ const { gripProps, lift, dragging } = useReorder({ count: gripped.length, grip: "[data-drag-start]", onMove: (from, to) => { setSaid(movedTo(gripped, from, to, w)); onMove?.(from, to); } });
340
349
  const phoneDrag = useHoldDrag(root, gripProps, HOLD, gripped.length > 0);
341
350
  const moveOf = (r) => {
342
351
  const at = gripped.indexOf(r);
343
352
  return at < 0 ? undefined : { at, lifted: dragging === at, style: lift(at), drag: phoneDrag(at), how: `${ids}how` };
344
353
  };
345
354
  return (_jsxs("div", { ref: root, role: "group", "aria-label": label, className: cx("o-menu-list", className), "data-kit": "menu-list", children: [onClose && _jsx("div", { className: "o-menu-list-section", children: _jsx(PhoneRow, { row: { icon: _jsx(Icon, { name: "x", size: 22 }), label: closeWord, onSelect: onClose } }) }), tiles && (_jsx("div", { className: "o-menu-list-tiles", children: tiles.map((t) => _jsxs(BaseButton, { className: "o-menu-list-tile", disabled: t.disabled, onClick: t.onSelect, children: [_jsx("span", { className: "o-menu-list-mark", children: t.icon }), _jsx("span", { className: "o-menu-list-tile-name", children: t.label })] }, t.label)) })), sections.map((s, i) => {
346
- const card = (_jsx("div", { role: s.name ? "group" : undefined, "aria-labelledby": s.name ? `${ids}h${i}` : undefined, className: "o-menu-list-section", children: s.rows.map((r) => _jsx(PhoneRow, { row: r, onOpen: onOpen, move: moveOf(r), room: gripped.length > 0, ticks: ticks }, r.label)) }, s.name ?? i));
355
+ const card = (_jsx("div", { role: s.name ? "group" : undefined, "aria-labelledby": s.name ? `${ids}h${i}` : undefined, className: "o-menu-list-section", children: s.rows.map((r) => _jsx(PhoneRow, { row: r, onOpen: onOpen, move: moveOf(r), room: gripped.length > 0, ticks: ticks, words: w }, r.label)) }, s.name ?? i));
347
356
  return s.name ? _jsxs("div", { className: "o-menu-list-group", children: [_jsx("p", { id: `${ids}h${i}`, className: "o-list-heading", children: s.name }), card] }, `${i}${s.name}`) : card;
348
- }), gripped.length > 0 && _jsx(Says, { id: `${ids}how`, how: HOW_HOLD, said: said })] }));
357
+ }), gripped.length > 0 && _jsx(Says, { id: `${ids}how`, how: w.howHold, said: said })] }));
349
358
  }
@@ -0,0 +1,4 @@
1
+ import type { PieceLooks } from "../../looks/looks.js";
2
+ export type ModalOptionId = "edge" | "lines" | "buttons" | "head" | "size" | "corners" | "smoothing" | "padding" | "behind" | "strength" | "blur" | "shadow";
3
+ /** The Modal's options and its looks: Framed is Attio's, Outlined Linear's. */
4
+ export declare const MODAL_LOOKS: PieceLooks<ModalOptionId>;
@@ -0,0 +1,25 @@
1
+ const steps = (ids) => ids.map((id) => ({ id, name: id }));
2
+ const options = [
3
+ { id: "edge", name: "Edge", device: "desktop", def: "ring", values: [{ id: "ring", name: "Ring" }, { id: "outline", name: "Outline" }] },
4
+ { id: "lines", name: "Lines", device: "desktop", def: "shown", values: [{ id: "shown", name: "Head and foot" }, { id: "none", name: "None" }] },
5
+ { id: "buttons", name: "Buttons", device: "desktop", def: "own", values: [{ id: "own", name: "The Button's" }, { id: "pill", name: "Pill" }] },
6
+ { id: "head", name: "Head and foot", device: "desktop", def: "bar", values: [{ id: "bar", name: "Bar" }, { id: "margin", name: "Margin" }] },
7
+ { id: "size", name: "Button size", device: "desktop", def: "28", kind: "steps", values: steps(["28", "32", "36"]) },
8
+ { id: "corners", name: "Corners", device: "desktop", def: "xl", kind: "steps", values: steps(["lg", "xl", "2xl"]) },
9
+ { id: "smoothing", name: "Corner smoothing", device: "desktop", def: "smooth", values: [{ id: "round", name: "Round" }, { id: "smooth", name: "Smooth" }] },
10
+ { id: "padding", name: "Padding", device: "desktop", def: "20", kind: "steps", values: steps(["16", "20", "24"]) },
11
+ { id: "behind", name: "What's behind", device: "desktop", def: "dim", values: [{ id: "dim", name: "Dim" }, { id: "veil", name: "Veil" }] },
12
+ { id: "strength", name: "Strength", device: "desktop", def: "light", kind: "steps", values: [{ id: "light", name: "Light" }, { id: "medium", name: "Medium" }, { id: "deep", name: "Deep" }] },
13
+ { id: "blur", name: "Blur", device: "desktop", def: "0", kind: "steps", values: [{ id: "0", name: "None" }, ...steps(["4", "8", "12", "24"])] },
14
+ { id: "shadow", name: "Shadow", device: "desktop", def: "2xl", kind: "steps", values: [{ id: "none", name: "None" }, { id: "lg", name: "Large" }, { id: "xl", name: "Extra large" }, { id: "2xl", name: "Largest" }] },
15
+ ];
16
+ const shared = { size: "28", corners: "xl", smoothing: "smooth", padding: "20", behind: "dim", strength: "light", blur: "0", shadow: "2xl" };
17
+ export const MODAL_LOOKS = {
18
+ id: "modal",
19
+ name: "Modal",
20
+ options,
21
+ looks: [
22
+ { id: "framed", name: "Framed", device: "desktop", picks: { ...shared, edge: "ring", lines: "shown", buttons: "own", head: "bar" } },
23
+ { id: "outlined", name: "Outlined", device: "desktop", picks: { ...shared, edge: "outline", lines: "none", buttons: "pill", head: "margin" } },
24
+ ],
25
+ };
@@ -0,0 +1,69 @@
1
+ import * as React from "react";
2
+ /** How wide it stands: 512, 672, 896 or 1024, from the kit's containers. */
3
+ export type ModalSize = "sm" | "md" | "lg" | "xl";
4
+ /** What its foot holds: Cancel and the action, the action alone, or nothing, for a long read. */
5
+ export type ModalFoot = "both" | "action" | "none";
6
+ /** At rest; saving, when nothing closes it; or not saved, when it stays open and says why. */
7
+ export type ModalState = "rest" | "saving" | "failed";
8
+ /** What its foot confirms. */
9
+ export interface ModalAction {
10
+ /** The verb that happens: "Save changes", "Create deal". */
11
+ label: string;
12
+ /** Primary unless it takes something away. */
13
+ kind?: "primary" | "danger";
14
+ disabled?: boolean;
15
+ /** The work it starts. It shows it's saving until this is done, then closes; if it throws, it stays open with what went wrong. */
16
+ run?: () => void | Promise<void>;
17
+ }
18
+ /** The words a Modal draws of its own: its head's buttons, what a failure says when its work threw no words, and the question
19
+ * every way out asks while something typed is unsaved. Its way out's word is its `cancel`. */
20
+ export type ModalWords = {
21
+ close: string;
22
+ openAsPage: string;
23
+ failed: string;
24
+ discardTitle: string;
25
+ discardLine: string;
26
+ discard: string;
27
+ keepEditing: string;
28
+ };
29
+ /** Its words in English. */
30
+ export declare const MODAL_WORDS: ModalWords;
31
+ export interface ModalProps {
32
+ open: boolean;
33
+ /** Told when it closes: by any way out, once unsaved changes are let go, or by its action once its work is done. */
34
+ onOpenChange: (open: boolean) => void;
35
+ /** What it is: "Edit company", "New deal". */
36
+ title: string;
37
+ /** Its head's mark: an icon, in a tile on a bar, quieter in the margin. */
38
+ mark?: React.ReactNode;
39
+ /** Where it was opened: a chip before its title. */
40
+ path?: {
41
+ label: string;
42
+ icon?: React.ReactNode;
43
+ };
44
+ /** Open as a page, beside the X. */
45
+ onOpenAsPage?: () => void;
46
+ size?: ModalSize;
47
+ foot?: ModalFoot;
48
+ action?: ModalAction;
49
+ /** The way out's word: "Cancel" unless said. */
50
+ cancel?: string;
51
+ /** What stands at its foot's start: an attach, a Create more. */
52
+ footStart?: React.ReactNode;
53
+ /** Something typed is unsaved: every way out asks "Discard your changes?" first. */
54
+ dirty?: boolean;
55
+ /** Shown as it stands, on a page that shows one. Left out, its own. */
56
+ state?: ModalState;
57
+ /** What went wrong, on a page that shows one. Left out, what its action threw. */
58
+ failed?: React.ReactNode;
59
+ /** Where it is drawn: over the whole page, or inside an element that holds it as a window holds a page. */
60
+ container?: HTMLElement | null;
61
+ /** It stands in `container`, a screen on a page that shows it: what's round that screen stays live. */
62
+ standing?: boolean;
63
+ /** Its body. */
64
+ children: React.ReactNode;
65
+ /** Its own words, over the English. */
66
+ words?: Partial<ModalWords>;
67
+ }
68
+ /** Holds a form, a quick create or a long read over the page: its own shell on a computer, the Sheet on the phone. */
69
+ export declare function Modal({ open, onOpenChange, title, mark, path, onOpenAsPage, size, foot, action, cancel, footStart, dirty, state, failed, container, standing, children, words }: ModalProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { Dialog as BaseDialog } from "@base-ui/react/dialog";
4
+ import { AlertDialog } from "../alert-dialog/alert-dialog.js";
5
+ import { Button } from "../button/button.js";
6
+ import { PhoneHost, usePhone } from "../internal/phone.js";
7
+ import { usePopupHost } from "../internal/popup-host.js";
8
+ import { Notice } from "../notice/notice.js";
9
+ import { Scrollbar } from "../scrollbar/scrollbar.js";
10
+ import { Sheet, SheetBody, SheetButton, SheetHead } from "../sheet/bottom-sheet.js";
11
+ const glyph = (paths) => _jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths.map((d) => _jsx("path", { d: d }, d)) });
12
+ const X = ["M18 6l-12 12", "M6 6l12 12"], CHECK = ["M5 12l5 5l10 -10"], NEXT = ["M9 6l6 6l-6 6"];
13
+ const EXPAND = ["M16 4l4 0l0 4", "M14 10l6 -6", "M8 20l-4 0l0 -4", "M4 20l6 -6"];
14
+ export const MODAL_WORDS = {
15
+ close: "Close",
16
+ openAsPage: "Open as a page",
17
+ failed: "That didn't save: the server didn't answer. Your changes are still here.",
18
+ discardTitle: "Discard your changes?",
19
+ discardLine: "What you typed isn't saved yet.",
20
+ discard: "Discard",
21
+ keepEditing: "Keep editing",
22
+ };
23
+ export function Modal({ open, onOpenChange, title, mark, path, onOpenAsPage, size = "md", foot = "both", action, cancel = "Cancel", footStart, dirty, state, failed, container, standing, children, words }) {
24
+ const said = { ...MODAL_WORDS, ...words };
25
+ const ref = React.useRef(null), host = usePopupHost(ref), body = React.useRef(null);
26
+ const small = usePhone(), screen = React.useContext(PhoneHost), phone = small || !!screen;
27
+ const [own, setOwn] = React.useState("rest"), [why, setWhy] = React.useState(null), [asking, setAsking] = React.useState(false);
28
+ const [wasOpen, setWasOpen] = React.useState(open);
29
+ if (open !== wasOpen) {
30
+ setWasOpen(open);
31
+ if (open) {
32
+ setOwn("rest");
33
+ setWhy(null);
34
+ setAsking(false);
35
+ }
36
+ }
37
+ const now = state ?? own, saving = now === "saving", wrong = now === "failed", where = container ?? screen ?? host;
38
+ const [overPopup, setOverPopup] = React.useState(false);
39
+ React.useLayoutEffect(() => { setOverPopup(!!ref.current?.closest('[data-kit="popover"]')); }, []);
40
+ const over = overPopup ? "" : undefined;
41
+ const leave = () => { if (saving)
42
+ return; if (dirty)
43
+ setAsking(true);
44
+ else
45
+ onOpenChange(false); };
46
+ const act = () => {
47
+ if (saving || action?.disabled)
48
+ return;
49
+ if (!action?.run)
50
+ return onOpenChange(false);
51
+ setOwn("saving");
52
+ Promise.resolve().then(action.run).then(() => { setOwn("rest"); onOpenChange(false); }, (e) => { setWhy(e instanceof Error && e.message ? e.message : said.failed); setOwn("failed"); });
53
+ };
54
+ const notice = wrong ? _jsx(Notice, { meaning: "danger", urgent: true, className: "o-modal-failed", children: failed ?? why }) : null;
55
+ const guard = (_jsx(AlertDialog, { open: asking, onAnswer: (yes) => { setAsking(false); if (yes)
56
+ onOpenChange(false); }, title: said.discardTitle, line: said.discardLine, action: said.discard, kind: "danger", cancel: said.keepEditing, container: where, standing: standing }));
57
+ if (phone)
58
+ return (_jsxs(_Fragment, { children: [_jsx("span", { ref: ref, hidden: true }), _jsxs(Sheet, { open: open, onOpenChange: (o) => { if (!o)
59
+ leave(); }, label: title, form: "full", container: where, standing: standing, children: [_jsx(SheetHead, { title: title, left: _jsx(SheetButton, { "aria-label": cancel, icon: glyph(X), onClick: leave, disabled: saving }), right: foot !== "none" && action ? _jsx(SheetButton, { kind: "primary", "aria-label": action.label, icon: glyph(CHECK), onClick: act, disabled: saving || action.disabled }) : _jsx("span", {}) }), _jsxs(SheetBody, { children: [notice, children] }), guard] })] }));
60
+ return (_jsxs(_Fragment, { children: [_jsx("span", { ref: ref, hidden: true }), _jsx(BaseDialog.Root, { open: open, onOpenChange: (o) => { if (!o)
61
+ leave(); }, ...(standing ? { modal: false, disablePointerDismissal: true } : {}), children: _jsxs(BaseDialog.Portal, { container: where, children: [_jsx(BaseDialog.Backdrop, { className: "o-modal-backdrop", "data-over-popup": over }), _jsx(BaseDialog.Viewport, { className: "o-modal-viewport", "data-over-popup": over, children: _jsxs(BaseDialog.Popup, { className: "o-modal", "data-kit": "modal", "data-width": size, "aria-busy": saving || undefined, initialFocus: standing ? false : () => body.current?.querySelector("input:not([type=hidden]), textarea, [role='combobox'], .o-select-field") ?? true, children: [_jsxs("div", { className: "o-modal-cut o-smooth", children: [_jsxs("header", { className: "o-modal-head", children: [mark != null && _jsx("span", { className: "o-modal-mark", "aria-hidden": "true", children: mark }), path && _jsxs("span", { className: "o-modal-path", children: [_jsxs("span", { className: "o-modal-chip", children: [path.icon, _jsx("span", { className: "o-modal-chip-word", children: path.label })] }), glyph(NEXT)] }), _jsx(BaseDialog.Title, { className: "o-modal-title", children: title }), _jsxs("span", { className: "o-modal-tools", children: [onOpenAsPage && _jsx(Button, { kind: "quiet", shape: "icon", size: "xs", "aria-label": said.openAsPage, icon: glyph(EXPAND), onClick: onOpenAsPage }), _jsx(Button, { kind: "quiet", shape: "icon", size: "xs", "aria-label": said.close, icon: glyph(X), disabled: saving, onClick: leave })] })] }), _jsxs("div", { ref: body, className: "o-modal-body", children: [notice, children] }), _jsx(Scrollbar, { drawn: true }), foot !== "none" && (_jsxs("footer", { className: "o-modal-foot", children: [footStart != null && _jsx("span", { className: "o-modal-start", children: footStart }), _jsxs("span", { className: "o-modal-end", children: [foot === "both" && _jsx(Button, { className: "o-modal-cancel", disabled: saving, onClick: leave, children: cancel }), action && _jsx(Button, { kind: action.kind ?? "primary", loading: saving, disabled: action.disabled, onClick: act, children: action.label })] })] }))] }), guard] }) })] }) })] }));
62
+ }