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
@@ -0,0 +1,106 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { resolveViewsMessage } from "../../contract.js";
5
+ import { ViewsContext } from "../../provider/context.js";
6
+ import { useToldStep } from "../internal/told-step.js";
7
+ import { pickerWordsOf } from "../picker/map-picker.js";
8
+ import { useGroupEditor } from "./group-editor.js";
9
+ const VIEWKIT = { field: "lifecycle", name: "name", count: "count", own: "manual" };
10
+ const KIT = { lifecycle: "field", name: "name", count: "count", manual: "own" };
11
+ const KIT_WAY = { asc: "ascending", desc: "descending" };
12
+ const VIEWKIT_WAY = { ascending: "asc", descending: "desc" };
13
+ export function groupEditorWordsOf(say) {
14
+ return {
15
+ groupBy: say({ key: "views.panels.group-by" }),
16
+ order: say({ key: "views.panels.group-order" }),
17
+ direction: say({ key: "views.panels.sort-direction" }),
18
+ dateStep: say({ key: "views.panels.group-date-step" }),
19
+ ascending: say({ key: "views.panels.sort-ascending" }),
20
+ descending: say({ key: "views.panels.sort-descending" }),
21
+ name: say({ key: "views.panels.group-order-name" }),
22
+ count: say({ key: "views.panels.group-order-count" }),
23
+ own: say({ key: "views.panels.group-order-own" }),
24
+ ownNoDirection: say({ key: "views.panels.group-own-no-direction" }),
25
+ hideEmpty: say({ key: "views.panels.hide-empty-groups" }),
26
+ groups: say({ key: "views.panels.groups" }),
27
+ hideAll: say({ key: "views.panels.groups-hide-all" }),
28
+ showAll: say({ key: "views.panels.groups-show-all" }),
29
+ remove: say({ key: "views.panels.group-remove" }),
30
+ none: say({ key: "views.panels.group-none" }),
31
+ search: say({ key: "views.panels.sort-search" }),
32
+ noValue: say({ key: "views.panels.group-no-value" }),
33
+ picker: pickerWordsOf(say),
34
+ list: {
35
+ move: (label) => say({ key: "views.panels.sort-move", values: { label } }),
36
+ howKeys: say({ key: "views.panels.list-move-keys" }),
37
+ howHold: say({ key: "views.panels.list-move-hold" }),
38
+ movedTo: (label, at, of) => say({ key: "views.panels.list-moved", values: { label, at, of } }),
39
+ on: say({ key: "views.panels.toggle-on" }),
40
+ off: say({ key: "views.panels.toggle-off" }),
41
+ },
42
+ };
43
+ }
44
+ const kitOrderOf = (mode, dated) => (dated && mode === "name" ? "field" : KIT[mode]);
45
+ const viewKitOrderOf = (order, dated) => (dated && order === "field" ? "name" : VIEWKIT[order]);
46
+ const datedIn = (dimensions, value) => !!dimensions.find((d) => d.value === value)?.granularities?.length;
47
+ export function kitGroupOf(group, dated = false) {
48
+ if (group.value === "none")
49
+ return null;
50
+ const order = group.order ?? { mode: "name", dir: "asc" }, groups = group.groups ?? [];
51
+ return { field: group.value, order: kitOrderOf(order.mode, dated), direction: KIT_WAY[order.dir], hideEmpty: group.hideEmpty ?? false,
52
+ placed: order.mode === "manual" ? groups.map((g) => g.key) : [], hidden: groups.filter((g) => g.hidden).map((g) => g.key),
53
+ ...(group.granularity !== undefined && { step: group.granularity }) };
54
+ }
55
+ export function kitGroupValuesOf(group, noValue, dated = false) {
56
+ const groups = group.groups ?? [];
57
+ const fieldOwn = group.order?.mode === "lifecycle" || (dated && group.order?.mode === "name");
58
+ const own = fieldOwn && group.order?.dir === "desc" ? [...groups].reverse() : groups;
59
+ return own.map((g) => ({ value: g.key, label: g.label || noValue, count: g.count ?? 0 }));
60
+ }
61
+ export function viewKitGroupOf(next, now, dated = false) {
62
+ if (!next)
63
+ return { value: "none" };
64
+ const order = { mode: viewKitOrderOf(next.order, dated), dir: VIEWKIT_WAY[next.direction] };
65
+ if (next.field !== now.value)
66
+ return { value: next.field };
67
+ const groups = now.groups ?? [];
68
+ if (next.order === "own" && next.placed.length && next.placed.join("\u0000") !== groups.map((g) => g.key).join("\u0000")) {
69
+ const at = new Map(groups.map((g) => [g.key, g]));
70
+ return { ...now, groups: [...next.placed.flatMap((k) => at.get(k) ?? []), ...groups.filter((g) => !next.placed.includes(g.key))] };
71
+ }
72
+ if (order.mode !== now.order?.mode || order.dir !== now.order?.dir)
73
+ return { ...now, order };
74
+ if (next.step !== undefined && next.step !== now.granularity)
75
+ return { ...now, granularity: next.step };
76
+ if (next.hideEmpty !== (now.hideEmpty ?? false))
77
+ return { ...now, hideEmpty: next.hideEmpty };
78
+ return { ...now, groups: groups.map((g) => ({ ...g, hidden: next.hidden.includes(g.key) })) };
79
+ }
80
+ export function groupEditorPropsOf(p, words) {
81
+ const { dimensions, group } = p, dated = datedIn(dimensions, group.value);
82
+ return {
83
+ label: p.label,
84
+ fields: dimensions.map((d) => ({ value: d.value, label: d.label })),
85
+ ownOrders: Object.fromEntries(dimensions.flatMap((d) => {
86
+ const own = d.orderOptions.find((o) => o.value === (d.granularities?.length ? "name" : "lifecycle"));
87
+ return own ? [[d.value, own.label]] : [];
88
+ })),
89
+ orders: Object.fromEntries(dimensions.map((d) => [d.value, d.orderOptions.map((o) => kitOrderOf(o.value, !!d.granularities?.length))])),
90
+ manualOrder: p.manualOrder,
91
+ steps: Object.fromEntries(dimensions.flatMap((d) => (d.granularities?.length ? [[d.value, [...d.granularities]]] : []))),
92
+ group: kitGroupOf(group, dated),
93
+ values: kitGroupValuesOf(group, words.noValue, dated),
94
+ onGroupChange: (next) => p.onGroupChange(viewKitGroupOf(next, group, dated)),
95
+ form: p.form,
96
+ words,
97
+ };
98
+ }
99
+ export function MapGroupBody(props) {
100
+ const views = React.useContext(ViewsContext);
101
+ const messages = views?.messages ?? resolveViewsMessage;
102
+ const words = React.useMemo(() => groupEditorWordsOf(messages), [messages]);
103
+ const parts = useGroupEditor(groupEditorPropsOf(props, words));
104
+ useToldStep({ head: { onBack: parts.level?.back }, title: parts.level?.name }, props.onStepChange);
105
+ return _jsx(_Fragment, { children: parts.body });
106
+ }
@@ -0,0 +1,48 @@
1
+ import { type PickerItem } from "../picker/rows.js";
2
+ import { type GroupEditorWords } from "./words.js";
3
+ export type GroupOrder = "field" | "name" | "count" | "own";
4
+ export type GroupDirection = "ascending" | "descending";
5
+ /** A list's group: the field it groups by (one level in, its path: company.industry), its order and direction, whether its empty
6
+ * groups are hidden, the groups in your own order (`placed`) and those hidden by their Switch, and a date field's step (`step`:
7
+ * Relative, Month…), absent for a field with none. */
8
+ export interface ListGroup {
9
+ field: string;
10
+ order: GroupOrder;
11
+ direction: GroupDirection;
12
+ hideEmpty: boolean;
13
+ placed: string[];
14
+ hidden: string[];
15
+ step?: string;
16
+ }
17
+ /** A group: a value of the field, its name, how many records it holds (never drawn; Count orders by it). */
18
+ export interface GroupValue {
19
+ value: string;
20
+ label: string;
21
+ count: number;
22
+ }
23
+ /** A new group by `field`: in its own order when its values have one, else by name; ascending; every group shown, none placed;
24
+ * a date's `step` held where handed. */
25
+ export declare function startGroup(field: string, ownOrder: boolean, hideEmpty?: boolean, step?: string): ListGroup;
26
+ /** The orders a field offers: its own first, named by `ownOrder` ("The stages' order"), where its values have one; then Name,
27
+ * Count and Your own; only those in `offered`, where its holder hands which it offers. */
28
+ export declare function groupOrders(ownOrder?: string, offered?: readonly GroupOrder[], words?: Pick<GroupEditorWords, "name" | "count" | "own">): {
29
+ value: GroupOrder;
30
+ label: string;
31
+ }[];
32
+ /** The groups in the order the list shows them. */
33
+ export declare function orderedGroups<V extends GroupValue>(values: V[], group: ListGroup): V[];
34
+ /** A group moved from its place to another, among the groups as the list shows them: the order becomes your own. A place off the
35
+ * list moves nothing (internal/reorder.ts' `moved`, written here so the rules load no React). */
36
+ export declare function moveGroup(group: ListGroup, values: GroupValue[], from: number, to: number): ListGroup;
37
+ /** A group shown or hidden by its Switch. */
38
+ export declare function setGroupShown(group: ListGroup, value: string, shown: boolean): ListGroup;
39
+ /** Every group hidden. */
40
+ export declare const hideAllGroups: (group: ListGroup, values: GroupValue[]) => ListGroup;
41
+ /** Every group shown. */
42
+ export declare const showAllGroups: (group: ListGroup) => ListGroup;
43
+ /** Whether no group shows. */
44
+ export declare const noneShown: (group: ListGroup, values: GroupValue[]) => boolean;
45
+ /** Whether Direction turns the order: every order but your own. */
46
+ export declare const directionTurns: (group: ListGroup) => boolean;
47
+ /** The group as its row and Customize's Group name it: its field, one level in by its path ("Company › Industry"); none, None. */
48
+ export declare function groupLabel(group: ListGroup | null, fields: PickerItem[], none?: string): string;
@@ -0,0 +1,41 @@
1
+ import { itemLabel } from "../picker/rows.js";
2
+ import { GROUP_EDITOR_WORDS } from "./words.js";
3
+ export function startGroup(field, ownOrder, hideEmpty = false, step) {
4
+ return { field, order: ownOrder ? "field" : "name", direction: "ascending", hideEmpty, placed: [], hidden: [], ...(step !== undefined && { step }) };
5
+ }
6
+ export function groupOrders(ownOrder, offered, words = GROUP_EDITOR_WORDS) {
7
+ const all = [...(ownOrder ? [{ value: "field", label: ownOrder }] : []), { value: "name", label: words.name }, { value: "count", label: words.count }, { value: "own", label: words.own }];
8
+ return offered ? all.filter((o) => offered.includes(o.value)) : all;
9
+ }
10
+ const byName = (a, b) => a.label.localeCompare(b.label, undefined, { sensitivity: "base" }) || (a.value < b.value ? -1 : a.value > b.value ? 1 : 0);
11
+ export function orderedGroups(values, group) {
12
+ if (group.order === "own") {
13
+ const at = new Map(values.map((v) => [v.value, v]));
14
+ const placed = [...new Set(group.placed)].flatMap((p) => { const v = at.get(p); return v ? [v] : []; });
15
+ const kept = new Set(placed.map((v) => v.value));
16
+ return [...placed, ...values.filter((v) => !kept.has(v.value)).sort(byName)];
17
+ }
18
+ const sign = group.direction === "descending" ? -1 : 1;
19
+ if (group.order === "field")
20
+ return sign > 0 ? [...values] : [...values].reverse();
21
+ if (group.order === "count")
22
+ return [...values].sort((a, b) => (a.count - b.count) * sign || byName(a, b));
23
+ return [...values].sort((a, b) => byName(a, b) * sign);
24
+ }
25
+ export function moveGroup(group, values, from, to) {
26
+ const shown = orderedGroups(values, group).map((v) => v.value);
27
+ if (from !== to && from >= 0 && to >= 0 && from < shown.length && to < shown.length)
28
+ shown.splice(to, 0, ...shown.splice(from, 1));
29
+ return { ...group, order: "own", placed: shown };
30
+ }
31
+ export function setGroupShown(group, value, shown) {
32
+ const hidden = group.hidden.filter((h) => h !== value);
33
+ return { ...group, hidden: shown ? hidden : [...hidden, value] };
34
+ }
35
+ export const hideAllGroups = (group, values) => ({ ...group, hidden: values.map((v) => v.value) });
36
+ export const showAllGroups = (group) => ({ ...group, hidden: [] });
37
+ export const noneShown = (group, values) => values.every((v) => group.hidden.includes(v.value));
38
+ export const directionTurns = (group) => group.order !== "own";
39
+ export function groupLabel(group, fields, none = GROUP_EDITOR_WORDS.none) {
40
+ return group ? itemLabel(fields, group.field) : none;
41
+ }
@@ -0,0 +1,15 @@
1
+ export declare const GROUP_EDITOR_TOKENS: readonly [{
2
+ readonly name: "--vk-font-size-sm";
3
+ readonly kind: "size";
4
+ readonly outright: "--text-sm";
5
+ }, {
6
+ readonly name: "--vk-line-height-sm";
7
+ readonly kind: "size";
8
+ readonly outright: "--text-sm--line-height";
9
+ }, {
10
+ readonly name: "--vk-spacing";
11
+ readonly kind: "size";
12
+ readonly outright: "--spacing";
13
+ }];
14
+ /** The prefixes of the group editor's own machinery, set and read by it alone: none. */
15
+ export declare const GROUP_EDITOR_PRIVATE: readonly [];
@@ -0,0 +1,6 @@
1
+ export const GROUP_EDITOR_TOKENS = [
2
+ { name: "--vk-font-size-sm", kind: "size", outright: "--text-sm" },
3
+ { name: "--vk-line-height-sm", kind: "size", outright: "--text-sm--line-height" },
4
+ { name: "--vk-spacing", kind: "size", outright: "--spacing" },
5
+ ];
6
+ export const GROUP_EDITOR_PRIVATE = [];
@@ -0,0 +1,39 @@
1
+ import type { MenuListWords } from "../menu-list/menu-list.js";
2
+ import type { PickerWords } from "../picker/picker.js";
3
+ export interface GroupEditorWords {
4
+ /** The setting that picks the field grouped by, and its level's name. */
5
+ groupBy: string;
6
+ /** The setting that picks the order, and its level's name. */
7
+ order: string;
8
+ /** The setting that turns the order, and its level's name. */
9
+ direction: string;
10
+ /** A date field's setting that picks its step (Relative, Month…), and its level's name. */
11
+ dateStep: string;
12
+ ascending: string;
13
+ descending: string;
14
+ /** The orders: by name, by count, your own. A field's own order is named by its holder. */
15
+ name: string;
16
+ count: string;
17
+ own: string;
18
+ /** Why Direction is greyed under your own order. */
19
+ ownNoDirection: string;
20
+ hideEmpty: string;
21
+ /** The groups' heading, and their list's name. */
22
+ groups: string;
23
+ hideAll: string;
24
+ showAll: string;
25
+ remove: string;
26
+ /** What Group by says ungrouped. */
27
+ none: string;
28
+ /** The fields' search, before anything is typed. */
29
+ search: string;
30
+ /** The empty group's name. */
31
+ noValue: string;
32
+ /** The lists' own words (the Picker's). */
33
+ picker?: Partial<PickerWords>;
34
+ /** The rows' own words (the Menu list's: a group's grip, how the groups move, a Switch's two words). */
35
+ list?: Partial<MenuListWords>;
36
+ }
37
+ export declare const GROUP_EDITOR_WORDS: GroupEditorWords;
38
+ /** The group editor's words: the handed ones over the English. */
39
+ export declare const groupWords: (given?: Partial<GroupEditorWords>) => GroupEditorWords;
@@ -0,0 +1,21 @@
1
+ export const GROUP_EDITOR_WORDS = {
2
+ groupBy: "Group by",
3
+ order: "Order",
4
+ direction: "Direction",
5
+ dateStep: "Date step",
6
+ ascending: "Ascending",
7
+ descending: "Descending",
8
+ name: "Name",
9
+ count: "Count",
10
+ own: "Your own",
11
+ ownNoDirection: "Your own order has no direction",
12
+ hideEmpty: "Hide empty groups",
13
+ groups: "Groups",
14
+ hideAll: "Hide all",
15
+ showAll: "Show all",
16
+ remove: "Remove grouping",
17
+ none: "None",
18
+ search: "Search fields",
19
+ noValue: "No value",
20
+ };
21
+ export const groupWords = (given) => (given ? { ...GROUP_EDITOR_WORDS, ...given } : GROUP_EDITOR_WORDS);
@@ -0,0 +1,20 @@
1
+ /* The group editor: a body (KIT-671; ViewKit's since VK-839), as the toolbar's map draws it (step 3, parts 57 and 58) on the canvas's round 12. Every value
2
+ is a public --vk-* name (group-editor/tokens.ts); this file only lays out its own parts: its blocks one under another, and the groups' heading with Hide
3
+ all at its end. The kit's components inside it (the Menu list's rows, the Picker, the Button) are drawn by their own files, as they
4
+ are. On a computer it stands in the Pane's body; on a phone (data-group-form="phone") in the Sheet's body, a step of it.
5
+ The rules sit in the components layer, so a utility class still wins. */
6
+ @layer components {
7
+
8
+ /* ── What it holds, one under another ── */
9
+ .o-group-editor, .o-group-editor-step { display: flex; flex-direction: column; gap: calc(var(--vk-spacing) * 1); min-width: 0; }
10
+ .o-group-editor[data-group-form="phone"], .o-group-editor[data-group-form="phone"] .o-group-editor-step { gap: calc(var(--vk-spacing) * 3); }
11
+
12
+ /* ── The groups' heading, Hide all at its end ── */
13
+ .o-group-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: calc(var(--vk-spacing) * 2); margin-top: calc(var(--vk-spacing) * 1); padding-right: calc(var(--vk-spacing) * 2); }
14
+ .o-group-editor-heading > .o-list-heading { flex: 1; min-width: 0; }
15
+ [data-group-form="phone"] .o-group-editor-heading { margin-top: calc(var(--vk-spacing) * 2); padding: 0 calc(var(--vk-spacing) * 1); }
16
+ [data-group-form="phone"] .o-group-editor-heading > .o-list-heading { padding: 0; font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); }
17
+
18
+ /* ── Group by's fields, the Picker standing in its place ── */
19
+ .o-group-editor-fields { display: flex; flex-direction: column; min-width: 0; }
20
+ }
@@ -40,7 +40,7 @@ export { GRIP, GRIP_LOOK, Grip } from "./grip/grip.js";
40
40
  export { useHoldDrag, type HoldDragProps, type HoldReads } from "./internal/hold.js";
41
41
  export { dragAt, gapOf, moved, useReorder, type ReorderDrag, type RowEdges } from "./internal/reorder.js";
42
42
  export { rowFor, rowStarting } from "./menu-list/keys.js";
43
- export { MenuList, MenuListPanelRows, MenuListRow, MenuListRows, MenuListShown, MenuScroll, menuListCloseOf, menuListRowsOf, sheetFormOf, tilesOf, useMenuListOption, useMenuListRows, type MenuChoice, type MenuEntry, type MenuListEntry, type MenuListPanelRowsProps, type MenuListProps, type MenuListTile, } from "./menu-list/menu-list.js";
43
+ export { MENU_LIST_WORDS, MenuList, MenuListPanelRows, MenuListRow, MenuListRows, MenuListShown, MenuScroll, menuListCloseOf, menuListRowsOf, sheetFormOf, tilesOf, useMenuListOption, useMenuListRows, type MenuChoice, type MenuEntry, type MenuListEntry, type MenuListPanelRowsProps, type MenuListProps, type MenuListTile, type MenuListWords, } from "./menu-list/menu-list.js";
44
44
  export { COMPUTER_HOST, ComputerHost, PHONE_MARK, PhoneHost, PhoneLine, phoneMark, usePhone, usePhoneForm } from "./internal/phone.js";
45
45
  export { drawnAt, focusWhereItStands, focusesInPlace, holdsThePage, keepsToItsList, overflows, scaleOf, scrollInList, scrollTopFor, scrollTopForDrag, staysInView, tapsInPlace, typesInto, } from "./internal/scroll.js";
46
46
  export { ContextMenu, Menu, MenuDots, useSheetMenus, type MenuChangeDetails, type MenuProps, type MenuWords, } from "./menu/menu.js";
@@ -53,11 +53,29 @@ export { Select, SelectShown, toPickerItems, type SelectAloneProps, type SelectI
53
53
  export { listSide, type ListSide } from "./select/side.js";
54
54
  export { chipsThatFit } from "./select/fit.js";
55
55
  export { filledMatch } from "./select/filled.js";
56
+ export { Pane, PaneBody, PaneClose, PaneFoot, PaneHead, PaneTitle, paneAfter, usePane, type PaneChangeDetails, type PaneCloseReason, type PanePress, type PaneProps, type PaneState } from "./pane/pane.js";
56
57
  export { Radio, RadioGroup, type RadioGroupProps, type RadioProps } from "./radio/radio.js";
58
+ export { sortableFields, useSortEditor as useSortEditorParts, type SortEditorOpens, type SortEditorParts, type SortEditorProps } from "./sort-editor/sort-editor.js";
59
+ export { SORT_MAX, addSort, canAddSort, dropAside, openPlaces, putBack, repoint, sortLabel, sortedFields, takenBy, type FieldOf, type SortAside } from "./sort-editor/rules.js";
60
+ export { SORT_EDITOR_WORDS, sortWords, type SortEditorWords } from "./sort-editor/words.js";
57
61
  export { LOCK, useViewsList, useViewsListWorn, ViewsList, type ViewsListParts } from "./views-list/views-list.js";
58
62
  export { JUST_ME, listed, SHARED, type ListView, type ViewsListChange, type ViewsListLayout } from "./views-list/rules.js";
59
63
  export { VIEWS_LIST_ATTRS, viewsListWornOf, type ViewsListWorn } from "./views-list/looks.js";
60
64
  export { VIEWS_LIST_WORDS, viewsListWords, type ViewsListWords } from "./views-list/words.js";
65
+ export { useFilterEditor as useFilterEditorParts, type FilterEditorParts, type FilterEditorProps, type FilterOwn } from "./filter-editor/filter-editor.js";
66
+ export { FILTER_SEARCH, FilterPartBody, PairValue, valuePlaceholder, type FilterPart, type FilterPartProps } from "./filter-editor/parts.js";
67
+ export { CHECKED, HOW, wayOf, type FilterField, type FilterWay, type Takes } from "./filter-editor/how.js";
68
+ export { FILTER_DEPTH, NO_FILTER, OWN_WAY, addRule, barOf, canGroup, changeRule, clearAll, depthOf, fieldOf, idsOf, isAdvanced, isGroup, isOwnWay, isPair, isSetAside, isWhole, itemOf, removeRule, ruleText, rulesOf, setGroup, setJoin, takesOf, toAdvanced, toGroup, valueText, type BarFilter, type FilterAside } from "./filter-editor/rules.js";
69
+ export { FILTER_EDITOR_WORDS, filterWords, type FilterEditorWords } from "./filter-editor/words.js";
70
+ export { useGroupEditor, type GroupEditorLevel, type GroupEditorParts, type GroupEditorProps, type GroupEditorValue } from "./group-editor/group-editor.js";
71
+ export { directionTurns, groupLabel, groupOrders, hideAllGroups, moveGroup, noneShown, orderedGroups, setGroupShown, showAllGroups, startGroup, type GroupDirection, type GroupOrder, type GroupValue } from "./group-editor/rules.js";
72
+ export { GROUP_EDITOR_WORDS, groupWords, type GroupEditorWords } from "./group-editor/words.js";
73
+ export { MODAL_WORDS, Modal, type ModalAction, type ModalFoot, type ModalProps, type ModalSize, type ModalState, type ModalWords } from "./modal/modal.js";
74
+ export { ALERT_DIALOG_WORDS, AlertDialog, AlertDialogHost, AlertDialogPanel, confirm, type AlertDialogPanelProps, type AlertDialogProps, type AlertDialogWords } from "./alert-dialog/alert-dialog.js";
75
+ export { TOAST_WORDS, Toast, ToastShown, createToastManager, useToast, type ToastManager, type ToastOptions, type ToastWords } from "./toast/toast.js";
76
+ export { Collapsible, CollapsiblePanel, CollapsibleTrigger, type CollapsiblePanelProps, type CollapsibleProps, type CollapsibleTriggerProps } from "./collapsible/collapsible.js";
77
+ export { ALERT_WORDS, Alert, type AlertAsk, type AlertKind, type AlertProps, type AlertState, type AlertWords } from "./alert/alert.js";
78
+ export { NOTICE_ICONS, NOTICE_WORDS, Notice, type NoticeAction, type NoticeMeaning, type NoticeProps, type NoticeWords } from "./notice/notice.js";
61
79
  export { useTextEditor, type TextEditorParts } from "./text-editor/text-editor.js";
62
80
  export { TEXT_KEYS, enterDoes, kept, lineOf, midWord, ownChange, textRefusal, tidy, type TextKeys, type TextKind } from "./text-editor/check.js";
63
81
  export { DIALS, countryName, dialOf, exampleOf, patternOf, phoneHanded, phoneOf, phoneParts, type Dial } from "./text-editor/phone-number.js";
@@ -34,7 +34,7 @@ export { GRIP, GRIP_LOOK, Grip } from "./grip/grip.js";
34
34
  export { useHoldDrag } from "./internal/hold.js";
35
35
  export { dragAt, gapOf, moved, useReorder } from "./internal/reorder.js";
36
36
  export { rowFor, rowStarting } from "./menu-list/keys.js";
37
- export { MenuList, MenuListPanelRows, MenuListRow, MenuListRows, MenuListShown, MenuScroll, menuListCloseOf, menuListRowsOf, sheetFormOf, tilesOf, useMenuListOption, useMenuListRows, } from "./menu-list/menu-list.js";
37
+ export { MENU_LIST_WORDS, MenuList, MenuListPanelRows, MenuListRow, MenuListRows, MenuListShown, MenuScroll, menuListCloseOf, menuListRowsOf, sheetFormOf, tilesOf, useMenuListOption, useMenuListRows, } from "./menu-list/menu-list.js";
38
38
  export { COMPUTER_HOST, ComputerHost, PHONE_MARK, PhoneHost, PhoneLine, phoneMark, usePhone, usePhoneForm } from "./internal/phone.js";
39
39
  export { drawnAt, focusWhereItStands, focusesInPlace, holdsThePage, keepsToItsList, overflows, scaleOf, scrollInList, scrollTopFor, scrollTopForDrag, staysInView, tapsInPlace, typesInto, } from "./internal/scroll.js";
40
40
  export { ContextMenu, Menu, MenuDots, useSheetMenus, } from "./menu/menu.js";
@@ -47,11 +47,29 @@ export { Select, SelectShown, toPickerItems, } from "./select/select.js";
47
47
  export { listSide } from "./select/side.js";
48
48
  export { chipsThatFit } from "./select/fit.js";
49
49
  export { filledMatch } from "./select/filled.js";
50
+ export { Pane, PaneBody, PaneClose, PaneFoot, PaneHead, PaneTitle, paneAfter, usePane } from "./pane/pane.js";
50
51
  export { Radio, RadioGroup } from "./radio/radio.js";
52
+ export { sortableFields, useSortEditor as useSortEditorParts } from "./sort-editor/sort-editor.js";
53
+ export { SORT_MAX, addSort, canAddSort, dropAside, openPlaces, putBack, repoint, sortLabel, sortedFields, takenBy } from "./sort-editor/rules.js";
54
+ export { SORT_EDITOR_WORDS, sortWords } from "./sort-editor/words.js";
51
55
  export { LOCK, useViewsList, useViewsListWorn, ViewsList } from "./views-list/views-list.js";
52
56
  export { JUST_ME, listed, SHARED } from "./views-list/rules.js";
53
57
  export { VIEWS_LIST_ATTRS, viewsListWornOf } from "./views-list/looks.js";
54
58
  export { VIEWS_LIST_WORDS, viewsListWords } from "./views-list/words.js";
59
+ export { useFilterEditor as useFilterEditorParts } from "./filter-editor/filter-editor.js";
60
+ export { FILTER_SEARCH, FilterPartBody, PairValue, valuePlaceholder } from "./filter-editor/parts.js";
61
+ export { CHECKED, HOW, wayOf } from "./filter-editor/how.js";
62
+ export { FILTER_DEPTH, NO_FILTER, OWN_WAY, addRule, barOf, canGroup, changeRule, clearAll, depthOf, fieldOf, idsOf, isAdvanced, isGroup, isOwnWay, isPair, isSetAside, isWhole, itemOf, removeRule, ruleText, rulesOf, setGroup, setJoin, takesOf, toAdvanced, toGroup, valueText } from "./filter-editor/rules.js";
63
+ export { FILTER_EDITOR_WORDS, filterWords } from "./filter-editor/words.js";
64
+ export { useGroupEditor } from "./group-editor/group-editor.js";
65
+ export { directionTurns, groupLabel, groupOrders, hideAllGroups, moveGroup, noneShown, orderedGroups, setGroupShown, showAllGroups, startGroup } from "./group-editor/rules.js";
66
+ export { GROUP_EDITOR_WORDS, groupWords } from "./group-editor/words.js";
67
+ export { MODAL_WORDS, Modal } from "./modal/modal.js";
68
+ export { ALERT_DIALOG_WORDS, AlertDialog, AlertDialogHost, AlertDialogPanel, confirm } from "./alert-dialog/alert-dialog.js";
69
+ export { TOAST_WORDS, Toast, ToastShown, createToastManager, useToast } from "./toast/toast.js";
70
+ export { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "./collapsible/collapsible.js";
71
+ export { ALERT_WORDS, Alert } from "./alert/alert.js";
72
+ export { NOTICE_ICONS, NOTICE_WORDS, Notice } from "./notice/notice.js";
55
73
  export { useTextEditor } from "./text-editor/text-editor.js";
56
74
  export { TEXT_KEYS, enterDoes, kept, lineOf, midWord, ownChange, textRefusal, tidy } from "./text-editor/check.js";
57
75
  export { DIALS, countryName, dialOf, exampleOf, patternOf, phoneHanded, phoneOf, phoneParts } from "./text-editor/phone-number.js";
@@ -1,5 +1,6 @@
1
1
  import type { ButtonOwnLook } from "../button/own-look.js";
2
- import { type PickerProps } from "../picker/picker.js";
2
+ import { type PickerItem, type PickerProps } from "../picker/picker.js";
3
+ import type { SelectItem } from "../select/select.js";
3
4
  import { type SheetHeadProps } from "../sheet/bottom-sheet.js";
4
5
  /** A mark as the editors draw it: its paths on a 24 grid, in the words' colour. */
5
6
  export declare const glyph: (paths: string[], className?: string) => import("react/jsx-runtime").JSX.Element;
@@ -7,8 +8,14 @@ export declare const glyph: (paths: string[], className?: string) => import("rea
7
8
  export declare const dots: (x: number, y: number) => string;
8
9
  export declare const X: string[], PLUS: string[], TICK: string[];
9
10
  export declare const DOTS: string[];
11
+ export declare const TRASH: string[];
10
12
  /** ⋯ on a phone, 40 × 44, the Button: no edge, its press the card's. */
11
13
  export declare const DOTS_LOOK: ButtonOwnLook;
14
+ /** ⋮ in a narrow place (a rule's row in the Pane), 28, quiet and faint. */
15
+ export declare const DOTS_UP: string[];
16
+ export declare const MORE_LOOK: ButtonOwnLook;
17
+ /** A list's rows as the Select takes them: each its mark, its line, "you", greyed where it can't be picked, one level in too. */
18
+ export declare const asSelect: (items: PickerItem[]) => SelectItem[];
12
19
  /** A Picker in a full Sheet on top of the editor's, its name the title: a link's field. `onGone` once its Sheet has gone, so what
13
20
  * holds it can drop it then. The Picker's words come in its props (`picker.words`), its head's ✕ and ‹ names in `words`. */
14
21
  export declare function OnTop({ open, onOpenChange, onGone, title, picker, container, standing, words }: {
@@ -8,7 +8,12 @@ export const glyph = (paths, className) => (_jsx("svg", { className: className,
8
8
  export const dots = (x, y) => `M${x} ${y}m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`;
9
9
  export const X = ["M18 6l-12 12", "M6 6l12 12"], PLUS = ["M12 5l0 14", "M5 12l14 0"], TICK = ["M5 12l5 5l10 -10"];
10
10
  export const DOTS = [dots(5, 12), dots(12, 12), dots(19, 12)];
11
+ export const TRASH = ["M4 7l16 0", "M10 11l0 6", "M14 11l0 6", "M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12", "M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"];
11
12
  export const DOTS_LOOK = { radius: "md", corner: "round", edge: "none", words: "inherit", icon: "20", hover: "none", press: "card" };
13
+ export const DOTS_UP = [dots(12, 5), dots(12, 12), dots(12, 19)];
14
+ export const MORE_LOOK = { radius: "md", corner: "round", edge: "none", words: "inherit", colour: "faint", icon: "16" };
15
+ export const asSelect = (items) => items.map((i) => ({ value: i.value, label: i.label, line: i.line, disabled: i.disabled, you: i.you,
16
+ mark: i.as && "mark" in i.as ? i.as.mark : undefined, ...(i.level ? { level: asSelect(i.level) } : {}) }));
12
17
  export function OnTop({ open, onOpenChange, onGone, title, picker, container, standing, words }) {
13
18
  const parts = usePicker({ ...picker, form: "phone", onDone: () => onOpenChange(false) });
14
19
  return (_jsxs(Sheet, { open: open, onOpenChange: (o) => onOpenChange(o), onOpenChangeComplete: (o) => { if (!o)
@@ -0,0 +1,9 @@
1
+ /** A step's opener in its editor's root: a selector, or a finder for one no selector names (a row by its words). */
2
+ export type StepOpener = string | ((root: HTMLElement) => HTMLElement | null);
3
+ /** An opener whose selector is built as the step goes, inside the frame, so nothing (CSS.escape) runs while a server draws. */
4
+ export declare const openerAt: (selector: () => string) => StepOpener;
5
+ /** On a phone, the open steps' openers, the outermost first ([] at rest and on a computer). When the list grows shorter, the
6
+ * opener of the outermost step that went takes the focus on the next frame, found again in `root` as redrawn. */
7
+ export declare function useStepReturn(root: HTMLElement | null | {
8
+ readonly current: HTMLElement | null;
9
+ }, openers: readonly StepOpener[]): void;
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ const inOwnHead = (now, root) => !!now.closest(".o-sheet-head") && !!root.closest(".o-sheet")?.contains(now);
4
+ export const openerAt = (selector) => (root) => root.querySelector(selector());
5
+ export function useStepReturn(root, openers) {
6
+ const was = React.useRef(openers);
7
+ React.useLayoutEffect(() => {
8
+ const before = was.current;
9
+ was.current = openers;
10
+ if (openers.length >= before.length)
11
+ return;
12
+ const opener = before[openers.length];
13
+ requestAnimationFrame(() => {
14
+ const el = root == null ? null : "current" in root ? root.current : root;
15
+ if (!el?.isConnected)
16
+ return;
17
+ const now = document.activeElement;
18
+ if (now && now !== document.body && now.isConnected && !now.contains(el) && !now.classList.contains("o-sheet-step") && !inOwnHead(now, el))
19
+ return;
20
+ const to = typeof opener === "string" ? el.querySelector(opener) : opener(el);
21
+ if (!to?.isConnected)
22
+ return;
23
+ to.focus({ preventScroll: true });
24
+ to.scrollIntoView?.({ block: "nearest" });
25
+ });
26
+ });
27
+ }
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { type PickerItem } from "../picker/picker.js";
3
- import { type SheetHeadProps } from "../sheet/bottom-sheet.js";
3
+ import type { SheetHeadProps } from "../sheet/bottom-sheet.js";
4
4
  import { type Link, type LinkField } from "./links.js";
5
5
  import { type LinksEditorWords } from "./words.js";
6
6
  export type { Link, LinkField, LinkFieldKind, LinkValue } from "./links.js";
@@ -69,8 +69,10 @@ export interface LinksEditorAction {
69
69
  }
70
70
  export interface LinksEditorParts {
71
71
  body: React.ReactNode;
72
- /** On a phone, the Sheet head's ✕ and ✓; {} on a computer. */
73
- head: Pick<SheetHeadProps, "close" | "left" | "right">;
72
+ /** On a phone, the Sheet head's ✕ and ✓, or on a step its Back (`onBack`, `close: false`); {} on a computer. */
73
+ head: Pick<SheetHeadProps, "close" | "left" | "right" | "onBack">;
74
+ /** On a phone, the Sheet's title while it stands on a step: a link's field, or a link's fields by the record's name. */
75
+ title?: string;
74
76
  }
75
77
  /** The Links editor's state and the parts a shell pours in. */
76
78
  export declare function useLinksEditor(props: LinksEditorProps): LinksEditorParts;