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,83 @@
1
+ export declare const FILTER_EDITOR_TOKENS: readonly [{
2
+ readonly name: "--vk-border";
3
+ readonly kind: "colour";
4
+ readonly outright: "--border";
5
+ }, {
6
+ readonly name: "--vk-border-input";
7
+ readonly kind: "colour";
8
+ readonly outright: "--border-input";
9
+ }, {
10
+ readonly name: "--vk-border-warning";
11
+ readonly kind: "colour";
12
+ readonly outright: "--border-warning";
13
+ }, {
14
+ readonly name: "--vk-border-width";
15
+ readonly kind: "size";
16
+ readonly outright: "--border-width";
17
+ }, {
18
+ readonly name: "--vk-fg";
19
+ readonly kind: "colour";
20
+ readonly outright: "--text";
21
+ }, {
22
+ readonly name: "--vk-fg-subtle";
23
+ readonly kind: "colour";
24
+ readonly outright: "--text-subtle";
25
+ }, {
26
+ readonly name: "--vk-font-size-base";
27
+ readonly kind: "size";
28
+ readonly outright: "--text-base";
29
+ }, {
30
+ readonly name: "--vk-font-size-sm";
31
+ readonly kind: "size";
32
+ readonly outright: "--text-sm";
33
+ }, {
34
+ readonly name: "--vk-font-size-xs";
35
+ readonly kind: "size";
36
+ readonly outright: "--text-xs";
37
+ }, {
38
+ readonly name: "--vk-font-weight-medium";
39
+ readonly kind: "size";
40
+ readonly outright: "--font-weight-medium";
41
+ }, {
42
+ readonly name: "--vk-layer-popup";
43
+ readonly kind: "size";
44
+ readonly outright: "--layer-popup";
45
+ }, {
46
+ readonly name: "--vk-line-height-base";
47
+ readonly kind: "size";
48
+ readonly outright: "--text-base--line-height";
49
+ }, {
50
+ readonly name: "--vk-line-height-sm";
51
+ readonly kind: "size";
52
+ readonly outright: "--text-sm--line-height";
53
+ }, {
54
+ readonly name: "--vk-line-height-xs";
55
+ readonly kind: "size";
56
+ readonly outright: "--text-xs--line-height";
57
+ }, {
58
+ readonly name: "--vk-overlay";
59
+ readonly kind: "colour";
60
+ readonly outright: "--surface-overlay";
61
+ }, {
62
+ readonly name: "--vk-radius-lg";
63
+ readonly kind: "size";
64
+ readonly outright: "--radius-lg";
65
+ }, {
66
+ readonly name: "--vk-radius-xl";
67
+ readonly kind: "size";
68
+ readonly outright: "--radius-xl";
69
+ }, {
70
+ readonly name: "--vk-spacing";
71
+ readonly kind: "size";
72
+ readonly outright: "--spacing";
73
+ }, {
74
+ readonly name: "--vk-sunken";
75
+ readonly kind: "colour";
76
+ readonly outright: "--surface-sunken";
77
+ }, {
78
+ readonly name: "--vk-warning";
79
+ readonly kind: "colour";
80
+ readonly outright: "--text-warning";
81
+ }];
82
+ /** The prefixes of the filter editor's own machinery, set and read by it alone: none. */
83
+ export declare const FILTER_EDITOR_PRIVATE: readonly [];
@@ -0,0 +1,23 @@
1
+ export const FILTER_EDITOR_TOKENS = [
2
+ { name: "--vk-border", kind: "colour", outright: "--border" },
3
+ { name: "--vk-border-input", kind: "colour", outright: "--border-input" },
4
+ { name: "--vk-border-warning", kind: "colour", outright: "--border-warning" },
5
+ { name: "--vk-border-width", kind: "size", outright: "--border-width" },
6
+ { name: "--vk-fg", kind: "colour", outright: "--text" },
7
+ { name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
8
+ { name: "--vk-font-size-base", kind: "size", outright: "--text-base" },
9
+ { name: "--vk-font-size-sm", kind: "size", outright: "--text-sm" },
10
+ { name: "--vk-font-size-xs", kind: "size", outright: "--text-xs" },
11
+ { name: "--vk-font-weight-medium", kind: "size", outright: "--font-weight-medium" },
12
+ { name: "--vk-layer-popup", kind: "size", outright: "--layer-popup" },
13
+ { name: "--vk-line-height-base", kind: "size", outright: "--text-base--line-height" },
14
+ { name: "--vk-line-height-sm", kind: "size", outright: "--text-sm--line-height" },
15
+ { name: "--vk-line-height-xs", kind: "size", outright: "--text-xs--line-height" },
16
+ { name: "--vk-overlay", kind: "colour", outright: "--surface-overlay" },
17
+ { name: "--vk-radius-lg", kind: "size", outright: "--radius-lg" },
18
+ { name: "--vk-radius-xl", kind: "size", outright: "--radius-xl" },
19
+ { name: "--vk-spacing", kind: "size", outright: "--spacing" },
20
+ { name: "--vk-sunken", kind: "colour", outright: "--surface-sunken" },
21
+ { name: "--vk-warning", kind: "colour", outright: "--text-warning" },
22
+ ];
23
+ export const FILTER_EDITOR_PRIVATE = [];
@@ -0,0 +1,59 @@
1
+ import type { PickerWords } from "../picker/picker.js";
2
+ export interface FilterEditorWords {
3
+ /** What stands before a level's first rule. */
4
+ where: string;
5
+ /** A level's join, as its second rule's Button and the rest's lead say it. */
6
+ join: (join: "and" | "or") => string;
7
+ /** Add filter, and its list's name and step's title. */
8
+ add: string;
9
+ /** A computer's Clear all, at the foot. */
10
+ clearAllFilters: string;
11
+ /** A phone's and the narrow form's Clear all. */
12
+ clearAll: string;
13
+ /** A rule's menu rows. */
14
+ toGroup: string;
15
+ deleteRule: string;
16
+ /** A group's Delete. */
17
+ deleteGroup: string;
18
+ /** What the body says with nothing filtered, and its line under it. */
19
+ none: string;
20
+ noneLine: string;
21
+ /** A rule's field box and way box, to a screen reader; the field box's step's title on a phone. */
22
+ field: string;
23
+ how: string;
24
+ /** A group's level of rules, to a screen reader. */
25
+ group: string;
26
+ /** A rule's ⋮ and its menu, by its field. */
27
+ ruleOf: (label: string) => string;
28
+ /** A rule's ways, as a list's name and a way's step's title, by its field. */
29
+ howOf: (label: string) => string;
30
+ /** A value's placeholders: a date's, a number's, words', a choice's. */
31
+ chooseDate: string;
32
+ typeNumber: string;
33
+ typeValue: string;
34
+ choose: string;
35
+ /** A range's two ends, and each one's name by its field. */
36
+ from: string;
37
+ to: string;
38
+ fromOf: (label: string) => string;
39
+ toOf: (label: string) => string;
40
+ /** The fields' search, before anything is typed. */
41
+ search: string;
42
+ /** A yes/no's two values. */
43
+ checked: string;
44
+ unchecked: string;
45
+ /** A way's words, by its value (`is-any-of`): the kit's of 17 Nov 2026. */
46
+ way: (value: string) => string;
47
+ /** A step's ‹, back to the rules. */
48
+ back: string;
49
+ /** The phone's ✕ and ✓, round an editor whose holder draws no head of its own (useDecide). */
50
+ close: string;
51
+ save: string;
52
+ /** A set-aside rule's menu row putting it back. */
53
+ putBack: string;
54
+ /** The lists' own words (the Picker's). */
55
+ picker?: Partial<PickerWords>;
56
+ }
57
+ export declare const FILTER_EDITOR_WORDS: FilterEditorWords;
58
+ /** The filter editor's words: the handed ones over the English. */
59
+ export declare const filterWords: (given?: Partial<FilterEditorWords>) => FilterEditorWords;
@@ -0,0 +1,40 @@
1
+ const WAYS = {
2
+ is: "is", "is-not": "is not", "is-any-of": "is any of", "is-none-of": "is none of", empty: "empty", "not-empty": "not empty",
3
+ "less-than": "less than", "greater-than": "greater than", contains: "contains", "does-not-contain": "does not contain",
4
+ "starts-with": "starts with", "ends-with": "ends with", before: "before", after: "after",
5
+ "any-part-between": "any part between", "entirely-within": "entirely within", includes: "includes", "at-least": "at least", "at-most": "at most",
6
+ };
7
+ export const FILTER_EDITOR_WORDS = {
8
+ where: "Where",
9
+ join: (join) => (join === "or" ? "Or" : "And"),
10
+ add: "Add filter",
11
+ clearAllFilters: "Clear all filters",
12
+ clearAll: "Clear all",
13
+ toGroup: "Convert to group",
14
+ deleteRule: "Delete condition",
15
+ deleteGroup: "Delete group",
16
+ none: "No filtering set up yet",
17
+ noneLine: "Choose a field to filter by",
18
+ field: "Field",
19
+ how: "How it compares",
20
+ group: "Group",
21
+ ruleOf: (label) => `${label}'s rule`,
22
+ howOf: (label) => `How ${label} compares`,
23
+ chooseDate: "Choose a date",
24
+ typeNumber: "Type a number",
25
+ typeValue: "Type a value",
26
+ choose: "Choose",
27
+ from: "From",
28
+ to: "To",
29
+ fromOf: (label) => `${label} from`,
30
+ toOf: (label) => `${label} to`,
31
+ search: "Filter by…",
32
+ checked: "Checked",
33
+ unchecked: "Unchecked",
34
+ way: (value) => WAYS[value] ?? value.replace(/-/g, " "),
35
+ back: "Back",
36
+ close: "Close",
37
+ save: "Save",
38
+ putBack: "Put back",
39
+ };
40
+ export const filterWords = (given) => (given ? { ...FILTER_EDITOR_WORDS, ...given } : FILTER_EDITOR_WORDS);
@@ -0,0 +1,124 @@
1
+ /* The filter editor: what a list's Filter opens (KIT-624), after Attio's (the toolbar canvas's round 3 Advanced board and round 11
2
+ PhoneFilter board). Every value is a token (tokens.json). On a computer, what the Popover holds: the rules, 8 apart, each its lead
3
+ (Where in a dashed box, or the join) 72 wide, then its boxes, each as wide as what it holds, as Attio's (Mihai, 17 Nov 2026): the
4
+ field's and how it compares' their mark, words and arrow, a name past 240 ending in "…"; a choice's value its words too ("Choose"),
5
+ several on one line cut past 240; a typed value 208, a range's From and To sharing 208; a date's 160; a way that takes no value no box at all; and ⋮ at each row's
6
+ end, the ends in line, the editor one width, 688, whatever its rows hold, room left before ⋮; every box 32 high; a group its
7
+ well, 10 round its rules, with its own foot; then Add filter and Clear all filters 4 under them. With nothing in it, the fields' Picker alone. On a phone, what the Sheet holds: each rule its lead over its boxes, which
8
+ wrap, ⋯ beside them, a line between rules; a group its well; with none, what it says; then Add filter and Clear all,
9
+ the whole width. Its narrow form (KIT-672), what Customize's Filter holds in the Pane on a computer: the phone's structure at a
10
+ computer's sizes (Mihai, 19 Nov 2026): text-sm, every box 32, ⋮ 28, items 12 round their line, a group its well; Add filter
11
+ and Clear all at 32, the whole width. A group's well is one in every form, Attio's (Mihai's pick, 20 Nov 2026; KIT-818): the
12
+ sunken ground, a hairline edge at radius xl, its fields on the panel's own ground, Delete group quiet.
13
+
14
+ The rules sit in the components layer, so a utility class still wins. */
15
+ @layer components {
16
+
17
+ .o-filter-editor { position: relative; display: flex; flex-direction: column; min-width: 0; color: var(--vk-fg); font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); }
18
+ .o-filter-editor:focus { outline: none; }
19
+ .o-filter-editor-rules { display: flex; flex-direction: column; gap: calc(var(--vk-spacing) * 2); min-width: 0; }
20
+ .o-filter-editor-item { display: flex; align-items: flex-start; gap: calc(var(--vk-spacing) * 2); min-width: 0; }
21
+ .o-filter-editor-where, .o-filter-editor-joined {
22
+ display: inline-flex; flex: none; align-items: center; justify-content: center; box-sizing: border-box;
23
+ height: calc(var(--vk-spacing) * 8); color: var(--vk-fg-subtle); white-space: nowrap;
24
+ }
25
+ .o-filter-editor-where { border: var(--vk-border-width) dashed var(--vk-border-input); border-radius: var(--vk-radius-lg); }
26
+ .o-filter-editor-join { flex: none; }
27
+ .o-filter-editor-rule { display: flex; flex: 1; align-items: center; gap: calc(var(--vk-spacing) * 2); min-width: 0; }
28
+ .o-filter-editor-boxes { display: flex; align-items: center; gap: calc(var(--vk-spacing) * 2); min-width: 0; }
29
+ .o-filter-editor-field, .o-filter-editor-how, .o-filter-editor-value { position: relative; flex: none; min-width: 0; }
30
+ .o-filter-editor-field > .o-select, .o-filter-editor-how > .o-select, .o-filter-editor-value > .o-select, .o-filter-editor-date > .o-select { width: 100%; }
31
+ .o-filter-editor-date { width: 100%; }
32
+ /* Several chosen stay on the box's one line, the last cut at its end, as a cell's are. */
33
+ .o-filter-editor-value .o-options { flex-wrap: nowrap; min-width: 0; overflow: hidden; }
34
+ .o-filter-editor-more { flex: none; margin-left: auto; }
35
+ /* A range's From and To (Mihai, 22 Nov 2026): two Number fields sharing the value's box, an en dash between, as ViewKit draws them. */
36
+ .o-filter-editor-pair { display: flex; align-items: center; gap: calc(var(--vk-spacing) * 2); min-width: 0; }
37
+ .o-filter-editor-pair > [data-kit="number-field"] { flex: 1 1 0; min-width: 0; }
38
+ .o-filter-editor-dash { flex: none; color: var(--vk-fg-subtle); }
39
+ /* A sample field's mark the page's own samples draw (samples.ts), as the sort editor's samples draw theirs. */
40
+ .o-filter-editor-mark { display: inline-flex; flex: none; align-items: center; color: var(--vk-fg-subtle); }
41
+ .o-filter-editor-mark svg { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); }
42
+ /* A group, in every form: a faint well, Attio's (Mihai's pick, 20 Nov 2026; KIT-818): the sunken ground, a hairline edge at
43
+ radius-xl; inside it the fields on the panel's own ground, as they stand outside it, and Delete group the quiet Button as it is.
44
+ Each form gives it only its padding. */
45
+ .o-filter-editor-group {
46
+ display: flex; flex: 1; flex-direction: column; gap: calc(var(--vk-spacing) * 2); min-width: 0;
47
+ border: var(--vk-border-width) solid var(--vk-border); border-radius: var(--vk-radius-xl); background-color: var(--vk-sunken);
48
+ }
49
+ /* A field's own ground is none at rest, so the ground behind it shows: in a group the panel's is painted under it, its own over
50
+ that, so a filled field, its hover and its focus keep theirs. A field inside a field (a group's own Input) is left to its group.
51
+ No token is re-pointed here: no component declares one. */
52
+ .o-filter-editor-group .o-input:not(.o-input *) {
53
+ background-image: linear-gradient(var(--input-ground), var(--input-ground)); background-color: var(--vk-overlay);
54
+ }
55
+ .o-filter-editor-foot { display: flex; align-items: center; gap: calc(var(--vk-spacing) * 2); }
56
+ .o-filter-editor-clear, .o-filter-editor-delete { margin-left: auto; }
57
+
58
+ /* ── On a computer: the rules in their columns, a group its well, then the foot ─────────────────────────────────────── */
59
+ /* One width, 688, Attio's panel's, whatever its rows hold: only its boxes follow what they hold, and room is left before ⋮ (Mihai, 17 Nov 2026). */
60
+ .o-filter-editor[data-filter-form="computer"] { width: calc(var(--vk-spacing) * 172); max-width: 100%; gap: calc(var(--vk-spacing) * 3); }
61
+ .o-filter-editor[data-filter-form="computer"][data-filter-fields] { width: auto; }
62
+ [data-filter-form="computer"] .o-filter-editor-where, [data-filter-form="computer"] .o-filter-editor-joined,
63
+ [data-filter-form="computer"] .o-filter-editor-join { width: calc(var(--vk-spacing) * 18); }
64
+ /* Each box as wide as what it holds (Attio's; Mihai, 17 Nov 2026): a Select's its mark, words and arrow, never past 240, a longer
65
+ name then ending in "…" (the Select's own words cut); a typed value 208, a date's 160. Where the Popover is narrower than the
66
+ editor the field's and the value's give way, to 80 at least; how it compares, a few words, keeps its own. */
67
+ [data-filter-form="computer"] .o-filter-editor-boxes { flex: 1 1 auto; }
68
+ [data-filter-form="computer"] :is(.o-filter-editor-field, .o-filter-editor-value) { flex: 0 1 auto; min-width: calc(var(--vk-spacing) * 20); }
69
+ [data-filter-form="computer"] :is(.o-filter-editor-field, .o-filter-editor-how, .o-filter-editor-value) { max-width: calc(var(--vk-spacing) * 60); }
70
+ [data-filter-form="computer"] .o-filter-editor-value:is([data-value-box="typed"], [data-value-box="pair"]) { width: calc(var(--vk-spacing) * 52); }
71
+ [data-filter-form="computer"] .o-filter-editor-value[data-value-box="date"] { width: calc(var(--vk-spacing) * 40); }
72
+ [data-filter-form="computer"] .o-filter-editor-group { padding: calc(var(--vk-spacing) * 2.5); }
73
+ [data-filter-form="computer"] .o-filter-editor-group > .o-filter-editor-foot { padding-top: var(--vk-spacing); }
74
+
75
+ /* A list a page shows standing open: under its box, over the rules, as wide as the Select's list asked for its rows (select.css). */
76
+ .o-filter-editor .o-filter-editor-shown[data-filter-shown] {
77
+ position: absolute; z-index: var(--vk-layer-popup); top: calc(100% + var(--vk-spacing)); left: 0; display: flex; flex-direction: column;
78
+ width: max-content; min-width: max(100%, calc(var(--vk-spacing) * 48)); max-width: calc(var(--vk-spacing) * 72);
79
+ }
80
+
81
+ /* ── On a phone, and in the narrow form: each rule its lead over its boxes, a line between rules; a group its well ─────── */
82
+ .o-filter-editor[data-filter-form="phone"] { gap: calc(var(--vk-spacing) * 4); font-size: var(--vk-font-size-base); line-height: calc(var(--vk-font-size-base) * var(--vk-line-height-base)); }
83
+ :is([data-filter-form="phone"], [data-filter-form="narrow"]) .o-filter-editor-rules { gap: 0; }
84
+ :is([data-filter-form="phone"], [data-filter-form="narrow"]) .o-filter-editor-item {
85
+ flex-direction: column; gap: calc(var(--vk-spacing) * 2.5); padding: calc(var(--vk-spacing) * 3.5) 0;
86
+ border-bottom: var(--vk-border-width) solid var(--vk-border);
87
+ }
88
+ :is([data-filter-form="phone"], [data-filter-form="narrow"]) .o-filter-editor-item:last-child { border-bottom: 0; }
89
+ :is([data-filter-form="phone"], [data-filter-form="narrow"]) :is(.o-filter-editor-where, .o-filter-editor-joined) { padding: 0 calc(var(--vk-spacing) * 3); font-size: var(--vk-font-size-sm); }
90
+ /* The join's pressing area, 44 high round its 32, on a phone. */
91
+ [data-filter-form="phone"] .o-filter-editor-join::before { content: ""; position: absolute; inset: calc(var(--vk-spacing) * -1.5) 0; }
92
+ :is([data-filter-form="phone"], [data-filter-form="narrow"]) .o-filter-editor-rule { align-items: flex-start; align-self: stretch; }
93
+ :is([data-filter-form="phone"], [data-filter-form="narrow"]) .o-filter-editor-boxes { flex: 1; flex-wrap: wrap; }
94
+ :is([data-filter-form="phone"], [data-filter-form="narrow"]) :is(.o-filter-editor-field, .o-filter-editor-how) { max-width: 100%; }
95
+ :is([data-filter-form="phone"], [data-filter-form="narrow"]) :is(.o-filter-editor-field, .o-filter-editor-how) .o-select-field { width: max-content; max-width: 100%; }
96
+ :is([data-filter-form="phone"], [data-filter-form="narrow"]) .o-filter-editor-value { flex: 1 1 100%; }
97
+ :is([data-filter-form="phone"], [data-filter-form="narrow"]) .o-filter-editor-group {
98
+ align-self: stretch; padding: var(--vk-spacing) calc(var(--vk-spacing) * 3) calc(var(--vk-spacing) * 2);
99
+ }
100
+
101
+ /* The narrow form's own sizes, a computer's: its items 12 apart round their line, a group's room smaller. */
102
+ .o-filter-editor[data-filter-form="narrow"] { gap: calc(var(--vk-spacing) * 3); }
103
+ [data-filter-form="narrow"] .o-filter-editor-item { gap: calc(var(--vk-spacing) * 2); padding: calc(var(--vk-spacing) * 3) 0; }
104
+ [data-filter-form="narrow"] .o-filter-editor-group { padding: var(--vk-spacing) calc(var(--vk-spacing) * 2.5) calc(var(--vk-spacing) * 2); }
105
+ [data-filter-form="narrow"] .o-filter-editor-none { padding: 0 calc(var(--vk-spacing) * 2); }
106
+ /* A list a page shows standing open, under its box: never wider than the Pane's column. */
107
+ .o-filter-editor[data-filter-form="narrow"] .o-filter-editor-shown[data-filter-shown] { min-width: min(100%, calc(var(--vk-spacing) * 48)); max-width: 100%; }
108
+ [data-filter-form="narrow"] .o-filter-editor-none-line { font-size: var(--vk-font-size-xs); line-height: calc(var(--vk-font-size-xs) * var(--vk-line-height-xs)); }
109
+ .o-filter-editor-none { display: grid; gap: calc(var(--vk-spacing) * 0.5); padding: 0 calc(var(--vk-spacing) * 1); }
110
+ .o-filter-editor-none p { margin: 0; }
111
+ .o-filter-editor-none-head { font-weight: var(--vk-font-weight-medium); }
112
+ .o-filter-editor-none-line { color: var(--vk-fg-subtle); font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); }
113
+ .o-filter-editor-acts { display: grid; gap: calc(var(--vk-spacing) * 2); }
114
+ .o-filter-editor-acts .o-button { width: 100%; }
115
+
116
+ /* ── A rule ViewKit set aside, its field's box dashed in the warning colour (Mihai, 27 Nov 2026, as the sort's set-aside sorts),
117
+ and a value ViewKit draws: a read-only box as wide as a typed one (VK-720) ─────────────────────────────────────────────── */
118
+ .o-filter-editor-rule[data-aside] .o-filter-editor-field .o-select-field { --input-edge: var(--vk-border-warning); border-style: dashed; color: var(--vk-warning); }
119
+ .o-filter-editor-rule[data-aside] .o-filter-editor-field .o-select-placeholder { color: var(--vk-warning); }
120
+ .o-filter-editor-own { width: 100%; }
121
+ .o-filter-editor-why { display: flex; width: 100%; }
122
+ .o-filter-editor-why > .o-select { width: 100%; }
123
+ [data-filter-form="computer"] .o-filter-editor-value[data-value-box="own"] { width: calc(var(--vk-spacing) * 52); }
124
+ }
@@ -0,0 +1,56 @@
1
+ import * as React from "react";
2
+ import { type PickerItem } from "../picker/picker.js";
3
+ import { type GroupOrder, type GroupValue, type ListGroup } from "./rules.js";
4
+ import { type GroupEditorWords } from "./words.js";
5
+ export type { GroupOrder, GroupDirection, ListGroup, GroupValue } from "./rules.js";
6
+ /** A group as the editor draws it: a value of the field grouped by, its mark, and how many records it holds (never drawn). */
7
+ export interface GroupEditorValue extends GroupValue {
8
+ mark?: React.ReactNode;
9
+ }
10
+ /** A setting's choices: Group by's fields, Order's, Direction's or a date's steps. */
11
+ export type GroupEditorLevel = "field" | "order" | "direction" | "step";
12
+ export interface GroupEditorProps {
13
+ /** What it sets, as its holder names it ("Group"): the settings' name to a screen reader. */
14
+ label: string;
15
+ /** The fields a list can be grouped by; one leading one level in (a deal's Company) holds its own. */
16
+ fields: PickerItem[];
17
+ /** The fields whose values have an order of their own, and its words ("The stages' order"). */
18
+ ownOrders?: Record<string, string>;
19
+ /** The list's group, or none. */
20
+ group: ListGroup | null;
21
+ /** The groups of the field grouped by, in the field's own order. */
22
+ values: GroupEditorValue[];
23
+ /** Each change, as it is made; null once the group is taken off. */
24
+ onGroupChange: (group: ListGroup | null) => void;
25
+ /** What the fields' search says before anything is typed ("Search deal fields"); "Search fields" unless said. */
26
+ search?: string;
27
+ /** Which form; by default the phone's in a phone's window or in a PhoneHost screen, else the computer's. */
28
+ form?: "computer" | "phone";
29
+ /** For a page that shows a state: a setting's choices standing open; nothing takes the focus. */
30
+ opens?: GroupEditorLevel;
31
+ /** For a page that shows a state, with opens "field": Group by's fields standing open one level in, by its row's value ("company"). */
32
+ opensLevel?: string;
33
+ /** The orders each field offers, besides Your own; a field not named offers them all. */
34
+ orders?: Record<string, GroupOrder[]>;
35
+ /** Whether Your own may be picked; true unless said. */
36
+ manualOrder?: boolean;
37
+ /** Each date field's steps (Relative, Month…), in order: such a field's group holds one, picked in the Date step row. */
38
+ steps?: Record<string, {
39
+ value: string;
40
+ label: string;
41
+ }[]>;
42
+ /** Its words; English unless handed. A `search` handed wins over `words.search`. */
43
+ words?: Partial<GroupEditorWords>;
44
+ }
45
+ export interface GroupEditorParts {
46
+ body: React.ReactNode;
47
+ /** A setting's choices standing open in its place: their name for the holder's head, and the way back. Null at the settings. */
48
+ level: {
49
+ name: string;
50
+ back: () => void;
51
+ } | null;
52
+ }
53
+ /** The group editor's state and the parts a shell pours in. */
54
+ export declare function useGroupEditor(props: GroupEditorProps): GroupEditorParts;
55
+ /** The body alone, for a shell that holds only a body. */
56
+ export declare function GroupEditor(props: GroupEditorProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,126 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { Button } from "../button/button.js";
5
+ import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
6
+ import { useStepReturn } from "../internal/step-return.js";
7
+ import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
8
+ import { MenuList, MenuListPanelRows } from "../menu-list/menu-list.js";
9
+ import { Picker, usePicker } from "../picker/picker.js";
10
+ import { openLevels } from "../picker/rows.js";
11
+ import { SheetStep } from "../sheet/bottom-sheet.js";
12
+ import { directionTurns, groupLabel, groupOrders, hideAllGroups, moveGroup, noneShown, orderedGroups, setGroupShown, showAllGroups, startGroup } from "./rules.js";
13
+ import { groupWords } from "./words.js";
14
+ function FieldsOnPhone(props) {
15
+ return _jsx(_Fragment, { children: usePicker({ label: props.label, items: props.items, value: props.value, search: props.search, searchShown: true, form: "phone", words: props.words,
16
+ levels: props.levels, onLevelsChange: props.onLevelsChange, onValueChange: (v) => { if (typeof v === "string")
17
+ props.onPick(v); } }).body });
18
+ }
19
+ export function useGroupEditor(props) {
20
+ const { label, fields, ownOrders = {}, group, values, onGroupChange, opens, orders = {}, manualOrder = true, steps = {} } = props;
21
+ const w = groupWords(props.words), search = props.search ?? w.search;
22
+ const NAMES = { field: w.groupBy, order: w.order, direction: w.direction, step: w.dateStep };
23
+ const LEVEL_OF = Object.fromEntries(Object.entries(NAMES).map(([k, v]) => [v, k]));
24
+ const DIRECTIONS = [{ value: "ascending", label: w.ascending }, { value: "descending", label: w.descending }];
25
+ const ordersOf = (field) => {
26
+ const named = orders[field];
27
+ const offered = [...(named ?? ["field", "name", "count"]).filter((o) => o !== "own"), ...(manualOrder ? ["own"] : [])];
28
+ return groupOrders(ownOrders[field], offered, w);
29
+ };
30
+ const stepsOf = (field) => steps[field] ?? [];
31
+ const screen = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (screen || small ? "phone" : "computer")) === "phone";
32
+ const now = React.useRef(group);
33
+ React.useLayoutEffect(() => { now.current = group; });
34
+ const change = (next) => { now.current = next; onGroupChange(next); };
35
+ const [level, setLevel] = React.useState(opens ?? null), [wentBack, setWentBack] = React.useState(false);
36
+ const [fieldLevels, setFieldLevels] = React.useState(opens === "field" && props.opensLevel ? [props.opensLevel] : []);
37
+ const [focusTo, setFocusTo] = React.useState(null), root = React.useRef(null);
38
+ const placeRoot = React.useCallback((el) => { root.current = el; if (!el && !opens) {
39
+ setLevel(null);
40
+ setFieldLevels([]);
41
+ } }, [opens]);
42
+ React.useLayoutEffect(() => {
43
+ if (!focusTo || phone)
44
+ return;
45
+ setFocusTo(null);
46
+ const rows = [...(root.current?.querySelectorAll("[data-item]") ?? [])];
47
+ const to = focusTo === "ticked" ? rows.find((r) => r.getAttribute("aria-checked") === "true") : rows.find((r) => r.querySelector(".o-menu-name")?.textContent === focusTo);
48
+ to?.focus({ preventScroll: true });
49
+ }, [focusTo, phone]);
50
+ const open = (to) => { setWentBack(false); setLevel(to); setFieldLevels([]); if (to !== "field")
51
+ setFocusTo("ticked"); };
52
+ const back = () => { const from = level; setWentBack(true); setLevel(null); setFieldLevels([]); if (from)
53
+ setFocusTo(NAMES[from]); };
54
+ const levelName = level && (level === "field" || group) ? NAMES[level] : null;
55
+ useStepReturn(root, phone && levelName ? [(r) => [...r.querySelectorAll(".o-menu-list-row, [data-item]")].find((x) => x.querySelector(".o-menu-list-name, .o-menu-name")?.textContent === levelName) ?? null] : []);
56
+ const onFieldLevels = (next) => { setWentBack(next.length < fieldLevels.length); setFieldLevels(next); };
57
+ const backField = () => { setWentBack(true); setFieldLevels((l) => l.slice(0, -1)); };
58
+ const dateSteps = group ? stepsOf(group.field) : [], heldStep = group?.step ?? dateSteps[0]?.value ?? "";
59
+ const hideEmptyTo = (on) => { if (now.current)
60
+ change({ ...now.current, hideEmpty: on }); };
61
+ const settings = [
62
+ { kind: "choices", icon: null, label: NAMES.field, value: group?.field ?? "", choices: [], detail: groupLabel(group, fields, w.none) },
63
+ ...(group ? [
64
+ { kind: "choices", icon: null, label: NAMES.order, value: group.order, choices: ordersOf(group.field) },
65
+ directionTurns(group)
66
+ ? { kind: "choices", icon: null, label: NAMES.direction, value: group.direction, choices: DIRECTIONS }
67
+ : { icon: null, label: NAMES.direction, disabled: w.ownNoDirection },
68
+ ...(dateSteps.length ? [{ kind: "choices", icon: null, label: NAMES.step, value: heldStep, choices: dateSteps }] : []),
69
+ { kind: "check", label: w.hideEmpty, checked: group.hideEmpty, onCheckedChange: hideEmptyTo },
70
+ ] : []),
71
+ ];
72
+ const opened = (e) => { if ("label" in e && LEVEL_OF[e.label])
73
+ open(LEVEL_OF[e.label]); };
74
+ const groups = group ? orderedGroups(values, group).map((v) => ({ kind: "check", label: v.label, icon: v.mark, checked: !group.hidden.includes(v.value), grip: true,
75
+ onCheckedChange: (on) => { if (now.current)
76
+ change(setGroupShown(now.current, v.value, on)); } })) : [];
77
+ const move = (from, to) => { if (now.current)
78
+ change(moveGroup(now.current, values, from, to)); };
79
+ const none = !!group && noneShown(group, values);
80
+ const heading = (_jsxs("div", { className: "o-group-editor-heading", children: [_jsx("p", { className: "o-list-heading", children: w.groups }), _jsx(Button, { kind: "link", size: "line", onClick: () => { if (now.current)
81
+ change(none ? showAllGroups(now.current) : hideAllGroups(now.current, values)); }, children: none ? w.showAll : w.hideAll })] }));
82
+ const removeRow = { icon: null, label: w.remove, danger: true, onSelect: () => { change(null); setLevel(null); setFocusTo(NAMES.field); } };
83
+ const foot = [{ kind: "separator" }, removeRow];
84
+ const pickField = (v) => {
85
+ if (v !== now.current?.field)
86
+ change(startGroup(v, v in ownOrders, now.current?.hideEmpty ?? false, stepsOf(v)[0]?.value));
87
+ back();
88
+ };
89
+ const pick = (which) => (v) => {
90
+ const g = now.current;
91
+ if (g && which === "order" && v !== g.order)
92
+ change({ ...g, order: v });
93
+ else if (g && which === "direction" && v !== g.direction)
94
+ change({ ...g, direction: v });
95
+ else if (g && which === "step" && v !== (g.step ?? stepsOf(g.field)[0]?.value))
96
+ change({ ...g, step: v });
97
+ back();
98
+ };
99
+ const choices = (which) => group
100
+ ? [which === "order" ? { kind: "pick", value: group.order, choices: ordersOf(group.field), onChoose: pick(which) }
101
+ : which === "direction" ? { kind: "pick", value: group.direction, choices: DIRECTIONS, onChoose: pick(which) }
102
+ : { kind: "pick", value: heldStep, choices: dateSteps, onChoose: pick(which) }]
103
+ : [];
104
+ const at = level && (level === "field" || group) ? level : null;
105
+ const form = phone ? "phone" : "computer";
106
+ let content;
107
+ if (at === "field") {
108
+ content = phone
109
+ ? _jsx(FieldsOnPhone, { label: NAMES.field, items: fields, value: group?.field ?? null, search: search, onPick: pickField, words: w.picker, levels: fieldLevels, onLevelsChange: onFieldLevels })
110
+ : _jsx("div", { className: "o-group-editor-fields", children: _jsx(Picker, { label: NAMES.field, items: fields, value: group?.field ?? null, search: search, words: w.picker, searchShown: true, form: "computer", autoFocus: !opens, standing: !!opens, searchLook: "soft", levels: fieldLevels, onLevelsChange: onFieldLevels, onValueChange: (v) => { if (typeof v === "string")
111
+ pickField(v); } }) });
112
+ }
113
+ else if (at) {
114
+ content = phone ? _jsx(MenuList, { words: w.list, label: NAMES[at], entries: choices(at) }) : _jsx(MenuListPanelRows, { words: w.list, label: NAMES[at], entries: choices(at) });
115
+ }
116
+ else {
117
+ content = phone ? (_jsxs(_Fragment, { children: [_jsx(MenuList, { words: w.list, label: label, entries: settings, onOpen: opened }), group && _jsxs(_Fragment, { children: [values.length > 0 && _jsxs(_Fragment, { children: [heading, _jsx(MenuList, { words: w.list, label: w.groups, entries: groups, onMove: move })] }), _jsx(MenuList, { words: w.list, label: w.remove, entries: [removeRow] })] })] })) : (_jsxs(_Fragment, { children: [_jsx(MenuListPanelRows, { words: w.list, label: label, entries: settings, ticks: "switch", onOpen: opened }), group && _jsxs(_Fragment, { children: [values.length > 0 && _jsxs(_Fragment, { children: [heading, _jsx(MenuListPanelRows, { words: w.list, label: w.groups, entries: groups, ticks: "switch", onMove: move })] }), _jsx(MenuListPanelRows, { words: w.list, label: w.remove, entries: foot })] })] }));
118
+ }
119
+ const fieldLevel = at === "field" ? openLevels(fields, fieldLevels).slice(-1)[0] : undefined;
120
+ const step = fieldLevel ? `field:${fieldLevels.join(">")}` : at ?? "settings";
121
+ const body = (_jsx("div", { ref: placeRoot, className: "o-group-editor", "data-kit": "group-editor", "data-group-form": form, "data-group-level": at ?? "settings", ...phoneMark(!!screen || small), ...MENU_LIST_CARD_FRAME, children: phone ? _jsx(SheetStep, { step: step, back: wentBack, children: _jsx("div", { className: "o-group-editor-step", children: content }) }) : content }));
122
+ return { body, level: fieldLevel ? { name: fieldLevel.label, back: backField } : at ? { name: NAMES[at], back } : null };
123
+ }
124
+ export function GroupEditor(props) {
125
+ return _jsx(_Fragment, { children: useGroupEditor(props).body });
126
+ }
@@ -0,0 +1,19 @@
1
+ import { type ViewsMessageResolver } from "../../contract.js";
2
+ import type { ViewsGroupBodyProps, ViewsGroupValue } from "../../provider/components.js";
3
+ import { type GroupEditorProps, type GroupEditorValue } from "./group-editor.js";
4
+ import type { ListGroup } from "./rules.js";
5
+ import type { GroupEditorWords } from "./words.js";
6
+ /** The group editor's words in the app's messages. */
7
+ export declare function groupEditorWordsOf(say: ViewsMessageResolver): GroupEditorWords;
8
+ /** ViewKit's group as the editor takes it; null ungrouped. Your own order's groups stand placed as the list shows them. */
9
+ export declare function kitGroupOf(group: ViewsGroupValue, dated?: boolean): ListGroup | null;
10
+ /** ViewKit's groups as the editor's values, in the field's own order (ViewKit hands them as the list shows them: a field's own
11
+ * order turned comes back the right way round), each with its count; the empty group named `noValue`. */
12
+ export declare function kitGroupValuesOf(group: ViewsGroupValue, noValue: string, dated?: boolean): GroupEditorValue[];
13
+ /** The editor's group, changed once, as the one change ViewKit writes: a new Group by, the field alone, so ViewKit opens it in the
14
+ * field's own order, direction and step, as its own pages do; else the groups' new places (a drag); else the order or its
15
+ * direction; else a date's step; else Hide empty groups; else which groups show. */
16
+ export declare function viewKitGroupOf(next: ListGroup | null, now: ViewsGroupValue, dated?: boolean): ViewsGroupValue;
17
+ /** ViewKit's group body's props as the group editor's. */
18
+ export declare function groupEditorPropsOf(p: ViewsGroupBodyProps, words: GroupEditorWords): GroupEditorProps;
19
+ export declare function MapGroupBody(props: ViewsGroupBodyProps): import("react/jsx-runtime").JSX.Element;