viewkitjs 0.32.0 → 0.33.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 (245) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/fields/dist/index.d.ts +1 -1
  3. package/fields/dist/index.js +1 -1
  4. package/fields/dist/query/evaluate.d.ts +7 -0
  5. package/fields/dist/query/exact-number.d.ts +8 -2
  6. package/fields/dist/query/exact-number.js +14 -1
  7. package/fields/dist/query/sort.js +13 -10
  8. package/fields/dist/registry.js +5 -1
  9. package/fields/dist/types.d.ts +4 -1
  10. package/fields/dist/zod.d.ts +5 -0
  11. package/fields/dist/zod.js +10 -1
  12. package/fields/docs/guides/contact-values.md +12 -0
  13. package/fields/docs/guides/field-types.md +1 -1
  14. package/fields/docs/guides/queries.md +3 -1
  15. package/fields/docs/reference/fields.md +1 -0
  16. package/package.json +1 -1
  17. package/postgres/dist/check.js +4 -1
  18. package/postgres/dist/definitions/formula-forms.js +3 -1
  19. package/postgres/dist/definitions/money.js +2 -1
  20. package/postgres/dist/page.js +6 -3
  21. package/postgres/dist/rules.d.ts +15 -1
  22. package/postgres/dist/rules.js +16 -0
  23. package/postgres/dist/sort.js +7 -2
  24. package/postgres/docs/guides/definitions.md +1 -1
  25. package/postgres/docs/guides/field-map.md +1 -1
  26. package/postgres/docs/reference/definitions.md +1 -1
  27. package/postgres/docs/reference/postgres.md +1 -1
  28. package/views/dist/atoms/ToolbarButton.d.ts +1 -1
  29. package/views/dist/atoms/ToolbarButton.js +4 -3
  30. package/views/dist/atoms/frame-parts.d.ts +6 -0
  31. package/views/dist/atoms/frame-parts.js +15 -0
  32. package/views/dist/atoms/types.d.ts +16 -7
  33. package/views/dist/cells/cell-title.d.ts +3 -1
  34. package/views/dist/cells/cell-title.js +2 -2
  35. package/views/dist/cells/cell-values.js +2 -2
  36. package/views/dist/contract.d.ts +31 -6
  37. package/views/dist/contract.js +123 -0
  38. package/views/dist/controls/button/map-button.js +2 -0
  39. package/views/dist/controls/checkbox/checkbox.d.ts +3 -2
  40. package/views/dist/controls/checkbox/checkbox.js +2 -2
  41. package/views/dist/controls/compound-editor/compound-editor.d.ts +1 -1
  42. package/views/dist/controls/compound-editor/name-parts.js +4 -4
  43. package/views/dist/controls/compound-editor/place-parts.js +19 -19
  44. package/views/dist/controls/compound-editor/range-parts.js +14 -14
  45. package/views/dist/controls/compound-editor/row.d.ts +3 -1
  46. package/views/dist/controls/compound-editor/row.js +2 -2
  47. package/views/dist/controls/controls.d.ts +2 -0
  48. package/views/dist/controls/controls.js +2 -0
  49. package/views/dist/controls/customize/customize.js +37 -35
  50. package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
  51. package/views/dist/controls/customize/map-customize-body.js +4 -0
  52. package/views/dist/controls/date-editor/date-days.js +2 -2
  53. package/views/dist/controls/date-editor/date-editor.js +18 -18
  54. package/views/dist/controls/date-editor/date-parts.js +6 -6
  55. package/views/dist/controls/date-editor/map-calendar.js +1 -1
  56. package/views/dist/controls/date-editor.css +2 -2
  57. package/views/dist/controls/field/field.d.ts +3 -0
  58. package/views/dist/controls/field/field.js +6 -6
  59. package/views/dist/controls/filter-editor/block.d.ts +2 -2
  60. package/views/dist/controls/filter-editor/block.js +5 -5
  61. package/views/dist/controls/filter-editor/filter-editor.js +31 -33
  62. package/views/dist/controls/filter-editor/how.d.ts +3 -1
  63. package/views/dist/controls/filter-editor/map-filter-body.d.ts +1 -0
  64. package/views/dist/controls/filter-editor/map-filter-body.js +7 -3
  65. package/views/dist/controls/filter-editor/map-rules.js +1 -1
  66. package/views/dist/controls/filter-editor/parts.js +2 -1
  67. package/views/dist/controls/group-editor/group-editor.js +15 -13
  68. package/views/dist/controls/index.d.ts +2 -0
  69. package/views/dist/controls/index.js +1 -0
  70. package/views/dist/controls/input/input.js +2 -2
  71. package/views/dist/controls/input/map-input.js +2 -0
  72. package/views/dist/controls/internal/editor-parts.js +1 -1
  73. package/views/dist/controls/internal/map-panel-controls.d.ts +8 -0
  74. package/views/dist/controls/internal/map-panel-controls.js +20 -0
  75. package/views/dist/controls/internal/panel-controls.d.ts +50 -0
  76. package/views/dist/controls/internal/panel-controls.js +197 -0
  77. package/views/dist/controls/internal/part-slot.d.ts +12 -0
  78. package/views/dist/controls/internal/part-slot.js +5 -0
  79. package/views/dist/controls/links-editor/links-editor.d.ts +1 -1
  80. package/views/dist/controls/links-editor/links-editor.js +27 -27
  81. package/views/dist/controls/menu/map-menu.d.ts +2 -2
  82. package/views/dist/controls/menu/map-menu.js +15 -12
  83. package/views/dist/controls/menu/menu.d.ts +2 -0
  84. package/views/dist/controls/menu/menu.js +3 -3
  85. package/views/dist/controls/menu-list/menu-list.d.ts +14 -4
  86. package/views/dist/controls/menu-list/menu-list.js +23 -22
  87. package/views/dist/controls/notice/notice.d.ts +3 -1
  88. package/views/dist/controls/notice/notice.js +2 -2
  89. package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
  90. package/views/dist/controls/number-editor/number-editor.js +13 -13
  91. package/views/dist/controls/number-field/number-field.js +5 -3
  92. package/views/dist/controls/pane/pane.d.ts +4 -2
  93. package/views/dist/controls/pane/pane.js +4 -4
  94. package/views/dist/controls/picker/picker.d.ts +2 -0
  95. package/views/dist/controls/picker/picker.js +37 -36
  96. package/views/dist/controls/picker/rows.d.ts +4 -0
  97. package/views/dist/controls/popover/map-popover.d.ts +1 -1
  98. package/views/dist/controls/popover/map-popover.js +4 -2
  99. package/views/dist/controls/quick-filters/quick-filters.js +4 -4
  100. package/views/dist/controls/radio/radio.d.ts +3 -0
  101. package/views/dist/controls/radio/radio.js +4 -3
  102. package/views/dist/controls/select/map-select.d.ts +3 -0
  103. package/views/dist/controls/select/map-select.js +8 -0
  104. package/views/dist/controls/select/select.d.ts +3 -0
  105. package/views/dist/controls/select/select.js +3 -3
  106. package/views/dist/controls/sheet/bottom-sheet.d.ts +5 -1
  107. package/views/dist/controls/sheet/bottom-sheet.js +2 -2
  108. package/views/dist/controls/sheet/map-sheet.js +1 -1
  109. package/views/dist/controls/sort-editor/map-sort-body.d.ts +1 -0
  110. package/views/dist/controls/sort-editor/map-sort-body.js +7 -3
  111. package/views/dist/controls/sort-editor/sort-editor.js +24 -26
  112. package/views/dist/controls/sort-editor.css +5 -0
  113. package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
  114. package/views/dist/controls/text-editor/text-editor.js +8 -8
  115. package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +3 -3
  116. package/views/dist/controls/toolbar-button/atom-toolbar-button.js +7 -6
  117. package/views/dist/controls/values-editor/values-editor.d.ts +1 -1
  118. package/views/dist/controls/values-editor/values-editor.js +22 -22
  119. package/views/dist/controls/views-list/map-view-menu.js +1 -1
  120. package/views/dist/controls/views-list/view-menu.js +6 -6
  121. package/views/dist/controls/views-list/views-list.js +4 -4
  122. package/views/dist/editors/EditorPanel.js +1 -1
  123. package/views/dist/field-row/FieldRow.js +13 -0
  124. package/views/dist/fields/money.d.ts +5 -2
  125. package/views/dist/fields/money.js +14 -2
  126. package/views/dist/grid/chrome/GridTable.js +4 -1
  127. package/views/dist/grid/chrome/cell-clipboard.d.ts +4 -2
  128. package/views/dist/grid/chrome/cell-clipboard.js +2 -2
  129. package/views/dist/grid/chrome/cells.js +3 -1
  130. package/views/dist/grid/chrome/grid-row-menu-items.js +1 -1
  131. package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
  132. package/views/dist/grid/chrome/useGridKeyboard.js +29 -6
  133. package/views/dist/grid/chrome/useGridTableInteractionModel.js +9 -2
  134. package/views/dist/grid/core/clipboard-model.d.ts +3 -1
  135. package/views/dist/grid/core/clipboard-model.js +9 -8
  136. package/views/dist/grid/core/editing-controller.d.ts +3 -0
  137. package/views/dist/grid/core/editing-controller.js +6 -0
  138. package/views/dist/grid/core/edits-sink.d.ts +19 -0
  139. package/views/dist/grid/core/edits-sink.js +2 -0
  140. package/views/dist/grid/core/spreadsheet-operations.js +1 -1
  141. package/views/dist/grid/core/useGridEditing.d.ts +5 -0
  142. package/views/dist/grid/core/useGridEditing.js +6 -0
  143. package/views/dist/list/answer.d.ts +40 -0
  144. package/views/dist/list/answer.js +43 -0
  145. package/views/dist/list/bulk-bar.d.ts +7 -0
  146. package/views/dist/list/bulk-bar.js +10 -0
  147. package/views/dist/list/columns.d.ts +24 -0
  148. package/views/dist/list/columns.js +27 -0
  149. package/views/dist/list/edits.d.ts +19 -0
  150. package/views/dist/list/edits.js +56 -0
  151. package/views/dist/list/grid.d.ts +11 -0
  152. package/views/dist/list/grid.js +76 -0
  153. package/views/dist/list/index.d.ts +14 -1
  154. package/views/dist/list/index.js +4 -1
  155. package/views/dist/list/link.d.ts +8 -0
  156. package/views/dist/list/link.js +78 -0
  157. package/views/dist/list/list.d.ts +70 -0
  158. package/views/dist/list/list.js +14 -0
  159. package/views/dist/list/parts.js +10 -3
  160. package/views/dist/list/root-base.d.ts +46 -0
  161. package/views/dist/list/root-base.js +137 -0
  162. package/views/dist/list/root.d.ts +35 -34
  163. package/views/dist/list/root.js +153 -113
  164. package/views/dist/list/source-answers.d.ts +39 -0
  165. package/views/dist/list/source-answers.js +225 -0
  166. package/views/dist/list/store.d.ts +37 -5
  167. package/views/dist/list/store.js +31 -0
  168. package/views/dist/list/toolbar.d.ts +3 -2
  169. package/views/dist/list/toolbar.js +14 -2
  170. package/views/dist/list/views-axis.js +4 -2
  171. package/views/dist/list/views.d.ts +7 -2
  172. package/views/dist/list/views.js +16 -5
  173. package/views/dist/model/column-capabilities.d.ts +13 -0
  174. package/views/dist/model/column-capabilities.js +23 -2
  175. package/views/dist/model/column-schema.d.ts +11 -1
  176. package/views/dist/model/view-rules.js +1 -0
  177. package/views/dist/panels/model.d.ts +2 -0
  178. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +8 -2
  179. package/views/dist/panels/react/toolbar/ReadyToolbar.js +2 -2
  180. package/views/dist/panels/react/toolbar/Toolbar.d.ts +8 -1
  181. package/views/dist/panels/react/toolbar/Toolbar.js +12 -3
  182. package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
  183. package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
  184. package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -4
  185. package/views/dist/panels/react/toolbar/ToolbarButton.js +4 -1
  186. package/views/dist/panels/react/toolbar/ToolbarFilter.js +1 -1
  187. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -1
  188. package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
  189. package/views/dist/panels/react/toolbar/ToolbarFilters.js +2 -2
  190. package/views/dist/panels/react/toolbar/ToolbarNew.js +1 -1
  191. package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
  192. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
  193. package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
  194. package/views/dist/panels/react/toolbar/ToolbarSort.js +2 -2
  195. package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
  196. package/views/dist/panels/react/toolbar/context.d.ts +10 -1
  197. package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
  198. package/views/dist/panels/react/toolbar/panel-part.js +5 -3
  199. package/views/dist/panels/settings/filter-groups.js +6 -1
  200. package/views/dist/provider/ViewsProvider.d.ts +6 -2
  201. package/views/dist/provider/ViewsProvider.js +18 -1
  202. package/views/dist/provider/components.d.ts +59 -0
  203. package/views/dist/provider/components.js +1 -1
  204. package/views/dist/provider/context.d.ts +4 -1
  205. package/views/dist/provider/own-control.d.ts +4 -0
  206. package/views/dist/provider/own-control.js +7 -0
  207. package/views/dist/provider/select-items.d.ts +3 -0
  208. package/views/dist/provider/select-items.js +6 -0
  209. package/views/dist/react.d.ts +4 -2
  210. package/views/dist/react.js +2 -0
  211. package/views/dist/styles.css +86 -78
  212. package/views/dist/styles.unlayered.css +86 -78
  213. package/views/docs/contract.md +252 -5
  214. package/views/docs/controls/compound-editor.md +4 -0
  215. package/views/docs/controls/customize.md +6 -0
  216. package/views/docs/controls/date-editor.md +4 -0
  217. package/views/docs/controls/field.md +4 -0
  218. package/views/docs/controls/filter-editor.md +8 -0
  219. package/views/docs/controls/group-editor.md +6 -0
  220. package/views/docs/controls/input.md +4 -0
  221. package/views/docs/controls/links-editor.md +4 -0
  222. package/views/docs/controls/menu-list.md +8 -0
  223. package/views/docs/controls/menu.md +4 -0
  224. package/views/docs/controls/notice.md +4 -0
  225. package/views/docs/controls/number-editor.md +4 -0
  226. package/views/docs/controls/pane.md +4 -0
  227. package/views/docs/controls/picker.md +8 -0
  228. package/views/docs/controls/quick-filters.md +6 -0
  229. package/views/docs/controls/radio.md +4 -0
  230. package/views/docs/controls/select.md +8 -0
  231. package/views/docs/controls/sheet.md +4 -0
  232. package/views/docs/controls/sort-editor.md +8 -0
  233. package/views/docs/controls/text-editor.md +4 -0
  234. package/views/docs/controls/values-editor.md +4 -0
  235. package/views/docs/controls/views-list.md +6 -0
  236. package/views/docs/guides/the-grid.md +2 -2
  237. package/views/docs/guides/the-provider.md +19 -2
  238. package/views/docs/reference/controls.md +7 -5
  239. package/views/docs/reference/field-row.md +1 -1
  240. package/views/docs/reference/grid.md +1 -1
  241. package/views/docs/reference/list.md +141 -11
  242. package/views/docs/reference/panels-react.md +2 -2
  243. package/views/docs/reference/react.md +15 -9
  244. package/views/docs/reference/views.md +8 -4
  245. package/views/docs/reshaping.md +6 -1
@@ -187,26 +187,26 @@ export function useDateEditor(props) {
187
187
  const dayGrid = (big, weekdays) => (_jsx(DateDays, { year: sy, month: sm, keyDay: shownKey, picked: date, today: today, names: names, weekdays: weekdays, big: big, off: off, reads: reading && "date" in reading ? reading.date : null, onPick: pick, onKeyMove: setKey, onEnter: (day) => { pick(day); if (phone || time)
188
188
  keep(day, clock); } }));
189
189
  const row = phone ? worn.calendar === "plain" : worn.picks === "row";
190
- const quick = (_jsx("div", { className: "o-date-editor-picks", children: picks.map((p) => (_jsx(Button, { kind: "quiet", size: phone ? "lg" : row ? "2xs" : "sm", className: "o-date-editor-pick", look: phone ? (row ? PICK_PLAIN : PICK_CARDS) : row ? PICK_ROW : PICK_TWO, icon: glyph(row ? ROW_PICKS[p] : PICKS[p].icon), onClick: () => pick(p === "none" ? null : quickPick(p, today)), children: w[PICK_WORD[p]] }, p))) }));
190
+ const quick = (_jsx("div", { className: "o-date-editor-picks", "data-slot": "vk-date-picks", children: picks.map((p) => (_jsx(Button, { kind: "quiet", size: phone ? "lg" : row ? "2xs" : "sm", className: "o-date-editor-pick", "data-slot": "vk-date-pick", "data-key": p, look: phone ? (row ? PICK_PLAIN : PICK_CARDS) : row ? PICK_ROW : PICK_TWO, icon: glyph(row ? ROW_PICKS[p] : PICKS[p].icon), onClick: () => pick(p === "none" ? null : quickPick(p, today)), children: w[PICK_WORD[p]] }, p))) }));
191
191
  if (phone) {
192
192
  const months = names.months.map((name, i) => ({ value: String(i), label: name }));
193
193
  const years = Array.from({ length: 41 }, (_, i) => String(sy - 20 + i)).map((v) => ({ value: v, label: v }));
194
194
  const hours = Array.from({ length: 24 }, (_, i) => String(i).padStart(2, "0")).map((v) => ({ value: v, label: v }));
195
195
  const mins = ["00", "15", "30", "45"].map((v) => ({ value: v, label: v }));
196
196
  const [hh, mm] = (clock ?? "09:00").split(":");
197
- const head = { left: _jsx(SheetButton, { "aria-label": w.close, icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { kind: "primary", "aria-label": w.save, icon: glyph(TICK), onClick: () => { if (take())
197
+ const head = { left: _jsx(SheetButton, { "data-slot": "vk-editor-close", "aria-label": w.close, icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": w.save, icon: glyph(TICK), onClick: () => { if (take())
198
198
  keep(dayOfLine(), clock); } }) };
199
- const wheels = wheel === "date" ? (_jsxs("div", { className: "o-date-editor-wheels", children: [_jsx(Wheel, { label: w.month, items: months, value: String(sm), onChange: (v) => setKey(addMonths(shownKey, Number(v) - sm)) }, "month"), _jsx(Wheel, { label: w.year, items: years, value: String(sy), onChange: (v) => setKey(addMonths(shownKey, (Number(v) - sy) * 12)) }, "year")] })) : wheel === "time" ? (_jsxs("div", { className: "o-date-editor-wheels", children: [_jsx(Wheel, { label: w.hour, items: hours, value: hh, onChange: (v) => setTime(`${v}:${mm}`) }, "hour"), _jsx(Wheel, { label: w.minute, items: mins, value: mm, onChange: (v) => setTime(`${hh}:${v}`) }, "minute")] })) : null;
199
+ const wheels = wheel === "date" ? (_jsxs("div", { className: "o-date-editor-wheels", "data-slot": "vk-date-wheels", children: [_jsx(Wheel, { name: "month", label: w.month, items: months, value: String(sm), onChange: (v) => setKey(addMonths(shownKey, Number(v) - sm)) }, "month"), _jsx(Wheel, { name: "year", label: w.year, items: years, value: String(sy), onChange: (v) => setKey(addMonths(shownKey, (Number(v) - sy) * 12)) }, "year")] })) : wheel === "time" ? (_jsxs("div", { className: "o-date-editor-wheels", "data-slot": "vk-date-wheels", children: [_jsx(Wheel, { name: "hour", label: w.hour, items: hours, value: hh, onChange: (v) => setTime(`${v}:${mm}`) }, "hour"), _jsx(Wheel, { name: "minute", label: w.minute, items: mins, value: mm, onChange: (v) => setTime(`${hh}:${v}`) }, "minute")] })) : null;
200
200
  if (worn.calendar === "plain") {
201
201
  const toggle = (w) => { if (w === "time" && !clock)
202
202
  setTime("09:00"); setWheel(wheel === w ? "none" : w); };
203
- const plain = (_jsxs("div", { ref: placeRoot, className: "o-date-editor", "data-kit": "date-editor", "data-date-form": "phone", ...phoneMark(!!host || small), ...wornAttrs(worn), children: [_jsxs(InputGroup, { size: "lg", className: "o-date-editor-line", "data-bad": error ? "" : undefined, children: [_jsx(Input, { ref: line, className: "o-date-editor-input", "aria-label": label, placeholder: `${w.type}…`, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? "", enterKeyHint: "done", onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onKeyDown: (e) => { if (e.key !== "Enter" || e.nativeEvent.isComposing)
203
+ const plain = (_jsxs("div", { ref: placeRoot, className: "o-date-editor", "data-slot": "vk-date", "data-kit": "date-editor", "data-date-form": "phone", ...phoneMark(!!host || small), ...wornAttrs(worn), children: [_jsxs(InputGroup, { size: "lg", className: "o-date-editor-line", "data-slot": "vk-date-line", "data-bad": error ? "" : undefined, children: [_jsx(Input, { ref: line, className: "o-date-editor-input", "aria-label": label, placeholder: `${w.type}…`, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? "", enterKeyHint: "done", onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onKeyDown: (e) => { if (e.key !== "Enter" || e.nativeEvent.isComposing)
204
204
  return; e.preventDefault(); if (take())
205
- keep(dayOfLine(), clock); } }), reading && "date" in reading && _jsx(InputGroupAddon, { side: "end", children: _jsx("span", { className: "o-date-editor-reads", children: lineText(reading.date, names) }) })] }), error && _jsx("p", { className: "o-date-editor-error", role: "alert", children: error }), _jsxs("div", { className: "o-date-editor-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => setKey(addMonths(shownKey, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => setKey(addMonths(shownKey, 1)) }), _jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-heading", look: PLAIN_HEADING, "aria-expanded": wheel === "date", onClick: () => toggle("date"), children: names.months[sm] }), _jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-year", look: PLAIN_YEAR, "aria-expanded": wheel === "date", onClick: () => toggle("date"), children: String(sy) })] }), wheels ?? _jsx(_Fragment, { children: dayGrid(true, names.week) }), time && _jsx(DateParts, { form: "phone", words: w, onEnter: () => { if (take())
205
+ keep(dayOfLine(), clock); } }), reading && "date" in reading && _jsx(InputGroupAddon, { side: "end", children: _jsx("span", { className: "o-date-editor-reads", "data-slot": "vk-date-reads", children: lineText(reading.date, names) }) })] }), error && _jsx("p", { className: "o-date-editor-error", "data-slot": "vk-date-error", role: "alert", children: error }), _jsxs("div", { className: "o-date-editor-head", "data-slot": "vk-date-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-prev", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => setKey(addMonths(shownKey, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => setKey(addMonths(shownKey, 1)) }), _jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-heading", "data-slot": "vk-date-month", look: PLAIN_HEADING, "aria-expanded": wheel === "date", onClick: () => toggle("date"), children: names.months[sm] }), _jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-year", "data-slot": "vk-date-year", look: PLAIN_YEAR, "aria-expanded": wheel === "date", onClick: () => toggle("date"), children: String(sy) })] }), wheels ?? _jsx(_Fragment, { children: dayGrid(true, names.week) }), time && _jsx(DateParts, { form: "phone", words: w, onEnter: () => { if (take())
206
206
  keep(dayOfLine(), clock); }, date: date, clock: clock, today: today, wheel: wheel, onWheel: toggle, onDate: (d) => { setDate(d); setKey(d); hand(d, clock); }, onClock: setTime }), quick] }));
207
207
  return { body: plain, head: shell ? {} : head };
208
208
  }
209
- const body = (_jsxs("div", { ref: placeRoot, className: "o-date-editor", "data-kit": "date-editor", "data-date-form": "phone", ...phoneMark(!!host || small), ...wornAttrs(worn), children: [_jsxs("div", { className: "o-date-editor-card", children: [_jsxs("div", { className: "o-date-editor-card-head", children: [_jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-heading", look: CARD_HEADING, "aria-expanded": wheel === "date", iconEnd: glyph(wheel === "date" ? DOWN : RIGHT), onClick: () => setWheel(wheel === "date" ? "none" : "date"), children: `${names.months[sm]} ${sy}` }), wheel !== "date" && _jsxs("span", { className: "o-date-editor-arrows", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => setKey(addMonths(shownKey, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => setKey(addMonths(shownKey, 1)) })] })] }), wheel === "date" ? (_jsxs("div", { className: "o-date-editor-wheels", children: [_jsx(Wheel, { label: w.month, items: months, value: String(sm), onChange: (v) => setKey(addMonths(shownKey, Number(v) - sm)) }, "month"), _jsx(Wheel, { label: w.year, items: years, value: String(sy), onChange: (v) => setKey(addMonths(shownKey, (Number(v) - sy) * 12)) }, "year")] })) : (_jsx(_Fragment, { children: dayGrid(true, names.weekUpper) }))] }), time && (_jsx("div", { className: "o-date-editor-card", children: wheel === "time" ? (_jsxs("div", { className: "o-date-editor-wheels", children: [_jsx(Wheel, { label: w.hour, items: hours, value: hh, onChange: (v) => setTime(`${v}:${mm}`) }, "hour"), _jsx(Wheel, { label: w.minute, items: mins, value: mm, onChange: (v) => setTime(`${hh}:${v}`) }, "minute")] })) : (_jsx(MenuListRow, { label: w.time, value: clock ?? w.addTime, onSelect: () => { if (!clock)
209
+ const body = (_jsxs("div", { ref: placeRoot, className: "o-date-editor", "data-slot": "vk-date", "data-kit": "date-editor", "data-date-form": "phone", ...phoneMark(!!host || small), ...wornAttrs(worn), children: [_jsxs("div", { className: "o-date-editor-card", "data-slot": "vk-date-card", "data-key": "date", children: [_jsxs("div", { className: "o-date-editor-card-head", "data-slot": "vk-date-head", children: [_jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-heading", "data-slot": "vk-date-month", look: CARD_HEADING, "aria-expanded": wheel === "date", iconEnd: glyph(wheel === "date" ? DOWN : RIGHT), onClick: () => setWheel(wheel === "date" ? "none" : "date"), children: `${names.months[sm]} ${sy}` }), wheel !== "date" && _jsxs("span", { className: "o-date-editor-arrows", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-prev", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => setKey(addMonths(shownKey, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => setKey(addMonths(shownKey, 1)) })] })] }), wheel === "date" ? (_jsxs("div", { className: "o-date-editor-wheels", "data-slot": "vk-date-wheels", children: [_jsx(Wheel, { name: "month", label: w.month, items: months, value: String(sm), onChange: (v) => setKey(addMonths(shownKey, Number(v) - sm)) }, "month"), _jsx(Wheel, { name: "year", label: w.year, items: years, value: String(sy), onChange: (v) => setKey(addMonths(shownKey, (Number(v) - sy) * 12)) }, "year")] })) : (_jsx(_Fragment, { children: dayGrid(true, names.weekUpper) }))] }), time && (_jsx("div", { className: "o-date-editor-card", "data-slot": "vk-date-card", "data-key": "time", children: wheel === "time" ? (_jsxs("div", { className: "o-date-editor-wheels", "data-slot": "vk-date-wheels", children: [_jsx(Wheel, { name: "hour", label: w.hour, items: hours, value: hh, onChange: (v) => setTime(`${v}:${mm}`) }, "hour"), _jsx(Wheel, { name: "minute", label: w.minute, items: mins, value: mm, onChange: (v) => setTime(`${hh}:${v}`) }, "minute")] })) : (_jsx(MenuListRow, { "data-slot": "vk-date-time", label: w.time, value: clock ?? w.addTime, onSelect: () => { if (!clock)
210
210
  setTime("09:00"); setWheel("time"); } })) })), quick] }));
211
211
  return { body, head: shell ? {} : head };
212
212
  }
@@ -239,17 +239,17 @@ export function useDateEditor(props) {
239
239
  el.focus({ preventScroll: true });
240
240
  el.select();
241
241
  } };
242
- const timeButton = _jsx(Button, { kind: "quiet", size: lineBox ? "2xs" : "xs", className: "o-date-editor-time", look: TIME, "aria-pressed": view === "time", "data-empty": clock ? undefined : "", icon: glyph(CLOCK), onClick: () => setView(view === "time" ? "days" : "time"), children: clock ?? w.addTime });
243
- const boxLine = (_jsxs(InputGroup, { size: "sm", className: "o-date-editor-line", "data-bad": error ? "" : undefined, children: [_jsx(Input, { ref: lineRef, className: "o-date-editor-input", "aria-label": label, placeholder: `${w.type}…`, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? "", onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onKeyDown: (e) => { if (blank(typed) && (e.key === "Backspace" || e.key === "Delete")) {
242
+ const timeButton = _jsx(Button, { kind: "quiet", size: lineBox ? "2xs" : "xs", className: "o-date-editor-time", "data-slot": "vk-date-time", look: TIME, "aria-pressed": view === "time", "data-empty": clock ? undefined : "", icon: glyph(CLOCK), onClick: () => setView(view === "time" ? "days" : "time"), children: clock ?? w.addTime });
243
+ const boxLine = (_jsxs(InputGroup, { size: "sm", className: "o-date-editor-line", "data-slot": "vk-date-line", "data-bad": error ? "" : undefined, children: [_jsx(Input, { ref: lineRef, className: "o-date-editor-input", "aria-label": label, placeholder: `${w.type}…`, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? "", onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onKeyDown: (e) => { if (blank(typed) && (e.key === "Backspace" || e.key === "Delete")) {
244
244
  e.preventDefault();
245
245
  return;
246
- } lineKeys(e); } }), reading && "date" in reading && _jsx(InputGroupAddon, { side: "end", children: _jsx("span", { className: "o-date-editor-reads", children: lineText(reading.date, names) }) }), time && !inParts && _jsx(InputGroupAddon, { side: "end", flush: true, children: timeButton })] }));
246
+ } lineKeys(e); } }), reading && "date" in reading && _jsx(InputGroupAddon, { side: "end", children: _jsx("span", { className: "o-date-editor-reads", "data-slot": "vk-date-reads", children: lineText(reading.date, names) }) }), time && !inParts && _jsx(InputGroupAddon, { side: "end", flush: true, children: timeButton })] }));
247
247
  const refocus = (sel) => requestAnimationFrame(() => root.current?.querySelector(sel)?.focus({ preventScroll: true }));
248
- const body = (_jsxs("div", { ref: rootRef, className: "o-date-editor", "data-kit": "date-editor", "data-date-form": "computer", ...phoneMark(!!host || small), ...wornAttrs(worn), onBlur: onBlur, onFocus: () => { settled.current = false; }, onKeyDown: shell ? undefined : (e) => { if (e.key === "Escape") {
248
+ const body = (_jsxs("div", { ref: rootRef, className: "o-date-editor", "data-slot": "vk-date", "data-kit": "date-editor", "data-date-form": "computer", ...phoneMark(!!host || small), ...wornAttrs(worn), onBlur: onBlur, onFocus: () => { settled.current = false; }, onKeyDown: shell ? undefined : (e) => { if (e.key === "Escape") {
249
249
  e.preventDefault();
250
250
  e.stopPropagation();
251
251
  escape();
252
- } }, children: [lineBox ? boxLine : _jsxs("div", { className: "o-date-editor-line o-popup-line", "data-bad": error ? "" : undefined, children: [glyph(CAL), _jsx(Input, { chrome: "bare", ref: (el) => { line.current = el; first(el); }, className: "o-date-editor-input", "aria-label": label, placeholder: w.type, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? (date ? lineText(date, names) : ""), onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onBeforeInput: (e) => { if (typed == null) {
252
+ } }, children: [lineBox ? boxLine : _jsxs("div", { className: "o-date-editor-line o-popup-line", "data-slot": "vk-date-line", "data-bad": error ? "" : undefined, children: [glyph(CAL), _jsx(Input, { chrome: "bare", ref: (el) => { line.current = el; first(el); }, className: "o-date-editor-input", "aria-label": label, placeholder: w.type, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? (date ? lineText(date, names) : ""), onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onBeforeInput: (e) => { if (typed == null) {
253
253
  e.preventDefault();
254
254
  const d = e.nativeEvent.data ?? "";
255
255
  setTyped(d);
@@ -260,8 +260,8 @@ export function useDateEditor(props) {
260
260
  setTyped("");
261
261
  handTyped("");
262
262
  return;
263
- } lineKeys(e); } }), reading && "date" in reading && _jsx("span", { className: "o-date-editor-reads", children: lineText(reading.date, names) }), time && !inParts && _jsxs(_Fragment, { children: [_jsx("span", { className: "o-date-editor-bar", "aria-hidden": "true" }), timeButton] })] }), error && _jsx("p", { className: "o-date-editor-error", role: "alert", children: error }), _jsxs("div", { className: "o-date-editor-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => moveMonth(-1) }), _jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => moveMonth(1) }), _jsx(Button, { kind: "quiet", size: "xs", className: "o-date-editor-month", look: STANDS_PRESSED, "aria-pressed": view === "months", onClick: () => setView(view === "months" ? "days" : "months"), children: names.months[sm] }), _jsx("span", { className: "o-date-editor-space" }), worn.year === "typed" && view === "years"
264
- ? _jsx(Input, { ref: yearRef, size: "xs", numeric: true, className: "o-date-editor-year-box", "aria-label": w.year, inputMode: "numeric", maxLength: 4, autofill: false, value: yearText ?? String(sy), onChange: (e) => { const t = e.target.value.replace(/\D/g, "").slice(0, 4), yr = yearTyped(t); setYearText(t); if (yr)
263
+ } lineKeys(e); } }), reading && "date" in reading && _jsx("span", { className: "o-date-editor-reads", "data-slot": "vk-date-reads", children: lineText(reading.date, names) }), time && !inParts && _jsxs(_Fragment, { children: [_jsx("span", { className: "o-date-editor-bar", "aria-hidden": "true" }), timeButton] })] }), error && _jsx("p", { className: "o-date-editor-error", "data-slot": "vk-date-error", role: "alert", children: error }), _jsxs("div", { className: "o-date-editor-head", "data-slot": "vk-date-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "data-slot": "vk-date-prev", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => moveMonth(-1) }), _jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => moveMonth(1) }), _jsx(Button, { kind: "quiet", size: "xs", className: "o-date-editor-month", "data-slot": "vk-date-month", look: STANDS_PRESSED, "aria-pressed": view === "months", onClick: () => setView(view === "months" ? "days" : "months"), children: names.months[sm] }), _jsx("span", { className: "o-date-editor-space" }), worn.year === "typed" && view === "years"
264
+ ? _jsx(Input, { ref: yearRef, size: "xs", numeric: true, className: "o-date-editor-year-box", "data-slot": "vk-date-year", "aria-label": w.year, inputMode: "numeric", maxLength: 4, autofill: false, value: yearText ?? String(sy), onChange: (e) => { const t = e.target.value.replace(/\D/g, "").slice(0, 4), yr = yearTyped(t); setYearText(t); if (yr)
265
265
  setKey(addMonths(shownKey, (yr - sy) * 12)); }, onKeyDown: (e) => { if (e.key === "Enter") {
266
266
  e.preventDefault();
267
267
  leaveYear();
@@ -269,15 +269,15 @@ export function useDateEditor(props) {
269
269
  setView("months");
270
270
  refocus(".o-date-editor-choice[data-picked]");
271
271
  } } })
272
- : _jsx(Button, { kind: "quiet", size: "xs", className: "o-date-editor-year", look: STANDS_PRESSED, "aria-pressed": view === "years", onMouseDown: worn.year === "typed" ? hold : undefined, onClick: () => { if (view !== "years") {
272
+ : _jsx(Button, { kind: "quiet", size: "xs", className: "o-date-editor-year", "data-slot": "vk-date-year", look: STANDS_PRESSED, "aria-pressed": view === "years", onMouseDown: worn.year === "typed" ? hold : undefined, onClick: () => { if (view !== "years") {
273
273
  setYearText(null);
274
274
  yearFocus.current = worn.year === "typed";
275
- } setView(view === "years" ? "days" : "years"); }, children: String(sy) })] }), (view === "days" || (inParts && view === "time")) && _jsx(_Fragment, { children: dayGrid(false, names.week) }), view === "months" && (_jsx("div", { className: "o-date-editor-choices", role: "group", "aria-label": w.months, children: names.monthsShort.map((name, i) => _jsx("button", { type: "button", className: "o-date-editor-choice", onMouseDown: hold, "data-picked": i === sm ? "" : undefined, onClick: () => { setKey(addMonths(shownKey, i - sm)); setView("days"); refocus(".o-date-editor-day[data-key]"); }, children: name }, i)) })), view === "years" && (_jsx("div", { className: "o-date-editor-choices", role: "group", "aria-label": w.years, children: Array.from({ length: 12 }, (_, i) => sy - 5 + i).map((yr) => (_jsx("button", { type: "button", className: "o-date-editor-choice", onMouseDown: hold, "data-picked": yr === sy ? "" : undefined, "data-today": yr === parts(today)[0] ? "" : undefined, onClick: () => { leaveYear(); setYearText(null); setKey(addMonths(shownKey, (yr - sy) * 12)); setView("months"); refocus(".o-date-editor-choice[data-picked]"); }, children: yr }, yr))) })), view === "time" && !inParts && (_jsx("div", { className: "o-date-editor-quarters", role: "group", "aria-label": w.time, children: QUARTERS.map((q) => _jsx("button", { type: "button", className: "o-date-editor-quarter", onMouseDown: hold, "data-picked": q === clock ? "" : undefined, ref: q === (clock ?? "09:00") ? (el) => { if (el)
275
+ } setView(view === "years" ? "days" : "years"); }, children: String(sy) })] }), (view === "days" || (inParts && view === "time")) && _jsx(_Fragment, { children: dayGrid(false, names.week) }), view === "months" && (_jsx("div", { className: "o-date-editor-choices", "data-slot": "vk-date-choices", "data-key": "months", role: "group", "aria-label": w.months, children: names.monthsShort.map((name, i) => _jsx("button", { type: "button", className: "o-date-editor-choice", "data-slot": "vk-date-choice", "data-key": String(i), onMouseDown: hold, "data-picked": i === sm ? "" : undefined, onClick: () => { setKey(addMonths(shownKey, i - sm)); setView("days"); refocus(".o-date-editor-day[data-stop]"); }, children: name }, i)) })), view === "years" && (_jsx("div", { className: "o-date-editor-choices", "data-slot": "vk-date-choices", "data-key": "years", role: "group", "aria-label": w.years, children: Array.from({ length: 12 }, (_, i) => sy - 5 + i).map((yr) => (_jsx("button", { type: "button", className: "o-date-editor-choice", "data-slot": "vk-date-choice", "data-key": String(yr), onMouseDown: hold, "data-picked": yr === sy ? "" : undefined, "data-today": yr === parts(today)[0] ? "" : undefined, onClick: () => { leaveYear(); setYearText(null); setKey(addMonths(shownKey, (yr - sy) * 12)); setView("months"); refocus(".o-date-editor-choice[data-picked]"); }, children: yr }, yr))) })), view === "time" && !inParts && (_jsx("div", { className: "o-date-editor-quarters", "data-slot": "vk-date-quarters", role: "group", "aria-label": w.time, children: QUARTERS.map((q) => _jsx("button", { type: "button", className: "o-date-editor-quarter", "data-slot": "vk-date-quarter", "data-key": q, onMouseDown: hold, "data-picked": q === clock ? "" : undefined, ref: q === (clock ?? "09:00") ? (el) => { if (el)
276
276
  scrollInList(el, { block: "center" }); } : undefined, onClick: () => { setTime(q); setView("days"); refocus(".o-date-editor-time"); }, children: q }, q)) })), inParts && _jsx(DateParts, { form: "computer", words: w, onEnter: () => { if (take())
277
- keep(dayOfLine(), clock); }, date: date, clock: clock, today: today, shownTyping: props.opens === "time", onDate: (d) => { setDate(d); setKey(d); setTyped(null); setError(null); hand(d, clock); }, onClock: setTime }), worn.picks === "two" && _jsx("div", { className: "o-date-editor-sep" }), quick] }));
277
+ keep(dayOfLine(), clock); }, date: date, clock: clock, today: today, shownTyping: props.opens === "time", onDate: (d) => { setDate(d); setKey(d); setTyped(null); setError(null); hand(d, clock); }, onClock: setTime }), worn.picks === "two" && _jsx("div", { className: "o-date-editor-sep", "data-slot": "vk-date-sep" }), quick] }));
278
278
  return { body, head: {} };
279
279
  }
280
- function Wheel({ label, items, value, onChange }) {
280
+ function Wheel({ name, label, items, value, onChange }) {
281
281
  const col = React.useRef(null), timer = React.useRef(0);
282
282
  const at = Math.max(0, items.findIndex((i) => i.value === value));
283
283
  React.useLayoutEffect(() => { const el = col.current; if (el)
@@ -293,7 +293,7 @@ function Wheel({ label, items, value, onChange }) {
293
293
  onChange(items[i].value);
294
294
  }, 120);
295
295
  };
296
- return (_jsx("div", { ref: col, className: "o-date-editor-wheel", role: "listbox", "aria-label": label, tabIndex: 0, onScroll: settle, children: items.map((it) => _jsx("div", { role: "option", "aria-selected": it.value === value, className: cx("o-date-editor-wheel-row", it.value === value && "o-date-editor-wheel-on"), onClick: (e) => { scrollInList(e.currentTarget, { block: "center", behavior: "smooth" }); onChange(it.value); }, children: it.label }, it.value)) }));
296
+ return (_jsx("div", { ref: col, className: "o-date-editor-wheel", "data-slot": "vk-date-wheel", "data-key": name, role: "listbox", "aria-label": label, tabIndex: 0, onScroll: settle, children: items.map((it) => _jsx("div", { role: "option", "data-slot": "vk-date-wheel-row", "data-key": it.value, "aria-selected": it.value === value, className: cx("o-date-editor-wheel-row", it.value === value && "o-date-editor-wheel-on"), onClick: (e) => { scrollInList(e.currentTarget, { block: "center", behavior: "smooth" }); onChange(it.value); }, children: it.label }, it.value)) }));
297
297
  }
298
298
  export function DateEditor(props) {
299
299
  return _jsx(_Fragment, { children: useDateEditor(props).body });
@@ -87,15 +87,15 @@ export function DateParts({ date, clock, today, form, onDate, onClock, shownTypi
87
87
  const slash = (c) => _jsx("span", { className: "o-date-editor-slash", "aria-hidden": "true", children: c });
88
88
  const joined = (list, c, each) => list.flatMap((s, i) => (i ? [_jsx(React.Fragment, { children: slash(c) }, `${s}-sep`), _jsx(React.Fragment, { children: each(s) }, s)] : [_jsx(React.Fragment, { children: each(s) }, s)]));
89
89
  if (form === "phone") {
90
- const shown = (s) => _jsx("span", { className: "o-date-editor-seg", "data-waiting": segs[s] == null ? "" : undefined, children: segmentText(s, segs[s]) });
91
- const box = (which, list, c) => (_jsx(Select, { opens: "dialog", size: "lg", arrow: "none", "aria-label": which === "date" ? w.date : w.time, className: "o-date-editor-part", shown: _jsx("span", { className: "o-date-editor-shown", children: joined(list, c, shown) }), open: wheel === which, onOpenChange: (o) => { if (o !== (wheel === which))
90
+ const shown = (s) => _jsx("span", { className: "o-date-editor-seg", "data-slot": "vk-date-segment", "data-key": s, "data-waiting": segs[s] == null ? "" : undefined, children: segmentText(s, segs[s]) });
91
+ const box = (which, list, c) => (_jsx(Select, { opens: "dialog", size: "lg", arrow: "none", "aria-label": which === "date" ? w.date : w.time, className: "o-date-editor-part", "data-slot": "vk-date-part", "data-key": which, shown: _jsx("span", { className: "o-date-editor-shown", children: joined(list, c, shown) }), open: wheel === which, onOpenChange: (o) => { if (o !== (wheel === which))
92
92
  onWheel?.(which); } }));
93
- return _jsxs("div", { className: "o-date-editor-parts", children: [box("date", DATE, "/"), box("time", TIME, ":")] });
93
+ return _jsxs("div", { className: "o-date-editor-parts", "data-slot": "vk-date-parts", children: [box("date", DATE, "/"), box("time", TIME, ":")] });
94
94
  }
95
95
  const seg = (s) => {
96
96
  const [min, max] = segmentRange(s, segs), v = segs[s];
97
- return (_jsx(InputGroupSegment, { "data-seg": s, className: "o-date-editor-seg", "aria-label": NAMES[s], "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": v ?? undefined, "aria-valuetext": segmentText(s, v), on: on === s || (shownTyping && s === "hour"), "data-waiting": v == null && !(shownTyped.seg === s && shownTyped.text) ? "" : undefined, onKeyDown: keys(s), onFocus: () => setOn(s), onBlur: () => { setOn(null); setTyped({ seg: null, text: "" }); }, children: shownTyped.seg === s && shownTyped.text && v == null ? shownTyped.text : segmentText(s, v) }));
97
+ return (_jsx(InputGroupSegment, { "data-seg": s, "data-slot": "vk-date-segment", "data-key": s, className: "o-date-editor-seg", "aria-label": NAMES[s], "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": v ?? undefined, "aria-valuetext": segmentText(s, v), on: on === s || (shownTyping && s === "hour"), "data-waiting": v == null && !(shownTyped.seg === s && shownTyped.text) ? "" : undefined, onKeyDown: keys(s), onFocus: () => setOn(s), onBlur: () => { setOn(null); setTyped({ seg: null, text: "" }); }, children: shownTyped.seg === s && shownTyped.text && v == null ? shownTyped.text : segmentText(s, v) }));
98
98
  };
99
- const box = (which, list, c) => (_jsx(InputGroup, { size: "sm", className: "o-date-editor-part", "aria-label": which === "Date" ? w.date : w.time, "data-force": shownTyping && which === "Time" ? "focus" : undefined, children: joined(list, c, seg) }));
100
- return _jsxs("div", { ref: own, className: "o-date-editor-parts", children: [box("Date", DATE, "/"), box("Time", TIME, ":")] });
99
+ const box = (which, list, c) => (_jsx(InputGroup, { size: "sm", className: "o-date-editor-part", "data-slot": "vk-date-part", "data-key": which.toLowerCase(), "aria-label": which === "Date" ? w.date : w.time, "data-force": shownTyping && which === "Time" ? "focus" : undefined, children: joined(list, c, seg) }));
100
+ return _jsxs("div", { ref: own, className: "o-date-editor-parts", "data-slot": "vk-date-parts", children: [box("Date", DATE, "/"), box("Time", TIME, ":")] });
101
101
  }
@@ -36,5 +36,5 @@ export function MapCalendar({ value, onChange, min, max, month, onMonthChange, c
36
36
  const off = (day) => (min != null && day < min) || (max != null && day > max);
37
37
  const [y, m] = parts(key);
38
38
  const arrows = phone ? "lg" : worn.days === "outlined" ? "2xs" : "xs";
39
- return (_jsxs("div", { ref: wornRef, className: cx("o-date-editor o-date-calendar", className), "data-kit": "date-editor", "data-date-form": phone ? "phone" : "computer", ...phoneMark(phone), "data-date-days": worn.days, "data-date-year": worn.year, "data-date-calendar": worn.calendar, children: [_jsxs("div", { className: "o-date-editor-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => moveTo(addMonths(key, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => moveTo(addMonths(key, 1)) }), _jsx("span", { className: "o-date-editor-caption", children: names.months[m] }), _jsx("span", { className: "o-date-editor-space" }), _jsx("span", { className: "o-date-editor-caption o-date-editor-year", children: String(y) })] }), _jsx(DateDays, { year: y, month: m, keyDay: key, picked: value, today: today, names: names, weekdays: phone && worn.calendar === "cards" ? names.weekUpper : names.week, big: phone, off: off, onPick: onChange, onKeyMove: moveTo })] }));
39
+ return (_jsxs("div", { ref: wornRef, className: cx("o-date-editor o-date-calendar", className), "data-slot": "vk-calendar", "data-kit": "date-editor", "data-date-form": phone ? "phone" : "computer", ...phoneMark(phone), "data-date-days": worn.days, "data-date-year": worn.year, "data-date-calendar": worn.calendar, children: [_jsxs("div", { className: "o-date-editor-head", "data-slot": "vk-date-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "data-slot": "vk-date-prev", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => moveTo(addMonths(key, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => moveTo(addMonths(key, 1)) }), _jsx("span", { className: "o-date-editor-caption", "data-slot": "vk-date-month", children: names.months[m] }), _jsx("span", { className: "o-date-editor-space" }), _jsx("span", { className: "o-date-editor-caption o-date-editor-year", "data-slot": "vk-date-year", children: String(y) })] }), _jsx(DateDays, { year: y, month: m, keyDay: key, picked: value, today: today, names: names, weekdays: phone && worn.calendar === "cards" ? names.weekUpper : names.week, big: phone, off: off, onPick: onChange, onKeyMove: moveTo })] }));
40
40
  }
@@ -47,7 +47,7 @@
47
47
  }
48
48
  @media (hover: hover) { .o-date-editor-day:hover:not(:disabled) { background-color: var(--vk-overlay-hovered); } }
49
49
  .o-date-editor-day[data-today] { color: var(--vk-fg-accent); font-weight: var(--vk-font-weight-semibold); }
50
- .o-date-editor-day[data-key]:focus-visible { outline: none; box-shadow: inset 0 0 0 calc(var(--vk-border-width) * 1.5) var(--vk-border-brand); }
50
+ .o-date-editor-day[data-stop]:focus-visible { outline: none; box-shadow: inset 0 0 0 calc(var(--vk-border-width) * 1.5) var(--vk-border-brand); }
51
51
  .o-date-editor-day[data-picked] { background-color: var(--vk-brand); color: var(--vk-fg-on-brand); font-weight: var(--vk-font-weight-semibold); box-shadow: none; }
52
52
  .o-date-editor-day:disabled { color: var(--vk-fg-disabled); cursor: not-allowed; }
53
53
 
@@ -103,7 +103,7 @@
103
103
  }
104
104
  .o-date-editor[data-date-form="computer"][data-date-days="outlined"] .o-date-editor-day[data-picked],
105
105
  .o-date-editor[data-date-form="computer"][data-date-days="outlined"] .o-date-editor-choice[data-picked] { background-color: var(--vk-brand); font-weight: var(--vk-font-weight-medium); box-shadow: none; }
106
- .o-date-editor[data-date-form="computer"][data-date-days="outlined"] .o-date-editor-day[data-key]:focus-visible { box-shadow: inset 0 0 0 var(--vk-focus-width) var(--vk-border-brand); }
106
+ .o-date-editor[data-date-form="computer"][data-date-days="outlined"] .o-date-editor-day[data-stop]:focus-visible { box-shadow: inset 0 0 0 var(--vk-focus-width) var(--vk-border-brand); }
107
107
  .o-date-editor[data-date-form="computer"][data-date-days="outlined"] .o-date-editor-choice[data-today] { font-weight: var(--vk-font-weight-normal); }
108
108
 
109
109
  /* The year, typed into: the year in the text's colour; while its twelve stand, a box to type it in. */
@@ -35,6 +35,9 @@ export interface FieldProps {
35
35
  /** Which form its quiet label takes: the device's unless said (the phone's below the app's line or in a PhoneHost screen).
36
36
  * Its responsive layout and sizes are always the device's. */
37
37
  form?: "computer" | "phone";
38
+ /** Its public name and which one it is (VK-989), drawn on the field's root in every form: a field editor's part. */
39
+ "data-slot"?: string;
40
+ "data-key"?: string;
38
41
  className?: string;
39
42
  children: React.ReactNode;
40
43
  }
@@ -19,23 +19,23 @@ export function Field(props) {
19
19
  const card = React.useContext(FieldRowsCardContext), settingRow = React.useContext(SettingRowField);
20
20
  return card ? _jsx(FieldAsRow, { ...props, card: card }) : settingRow ? _jsx(FieldAsSettingRow, { ...props }) : _jsx(FieldBox, { ...props });
21
21
  }
22
- function FieldAsSettingRow({ label, required = false, note, error, keepNote = false, disabled, nativeLabel = true, labelId, className, children }) {
22
+ function FieldAsSettingRow({ label, required = false, note, error, keepNote = false, disabled, nativeLabel = true, labelId, className, children, "data-slot": partSlot, "data-key": partKey }) {
23
23
  const errors = errorsOf(error), invalid = errors.length > 0, name = typeof label === "string" ? label : undefined;
24
24
  const end = React.useMemo(() => ({ name }), [name]);
25
- return (_jsxs(BaseField.Root, { className: cx("o-setting-row o-setting-row-field", className), "data-setting-row-kind": "field", invalid: invalid, disabled: disabled, "data-kit": "field", children: [_jsxs("span", { className: "o-choice-text", children: [label != null && _jsxs(BaseField.Label, { className: "o-choice-label", id: labelId, ...(nativeLabel ? {} : { nativeLabel: false, render: _jsx("span", {}) }), children: [label, required && _jsx("span", { className: "o-field-req", "aria-hidden": "true", children: "*" })] }), note != null && (!invalid || keepNote) && _jsx(BaseField.Description, { className: "o-choice-note", children: note }), invalid && _jsx(BaseField.Error, { className: "o-choice-note o-setting-row-error", match: true, children: _jsx(ErrorWords, { errors: errors }) })] }), _jsx("span", { className: "o-setting-row-end", children: _jsx(SettingRowField.Provider, { value: false, children: _jsx(AtSettingRowEnd.Provider, { value: end, children: children }) }) })] }));
25
+ return (_jsxs(BaseField.Root, { className: cx("o-setting-row o-setting-row-field", className), "data-slot": partSlot, "data-key": partKey, "data-setting-row-kind": "field", invalid: invalid, disabled: disabled, "data-kit": "field", children: [_jsxs("span", { className: "o-choice-text", children: [label != null && _jsxs(BaseField.Label, { className: "o-choice-label", id: labelId, ...(nativeLabel ? {} : { nativeLabel: false, render: _jsx("span", {}) }), children: [label, required && _jsx("span", { className: "o-field-req", "aria-hidden": "true", children: "*" })] }), note != null && (!invalid || keepNote) && _jsx(BaseField.Description, { className: "o-choice-note", children: note }), invalid && _jsx(BaseField.Error, { className: "o-choice-note o-setting-row-error", match: true, children: _jsx(ErrorWords, { errors: errors }) })] }), _jsx("span", { className: "o-setting-row-end", children: _jsx(SettingRowField.Provider, { value: false, children: _jsx(AtSettingRowEnd.Provider, { value: end, children: children }) }) })] }));
26
26
  }
27
27
  const useBeforePaint = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect;
28
- function FieldAsRow({ card, label, required = false, note, error, disabled, nativeLabel = true, labelId, className, children }) {
28
+ function FieldAsRow({ card, label, required = false, note, error, disabled, nativeLabel = true, labelId, className, children, "data-slot": partSlot, "data-key": partKey }) {
29
29
  const errors = errorsOf(error), invalid = errors.length > 0, device = usePhoneForm();
30
30
  const id = React.useId(), noted = note != null && !invalid, wants = noted || invalid, { enter, need, slot } = card, at = slot(id);
31
31
  useBeforePaint(() => enter(id), [enter, id]);
32
32
  useBeforePaint(() => { need(id, wants); return () => need(id, false); }, [need, id, wants]);
33
- return (_jsxs(BaseField.Root, { className: cx("o-field o-field-row", className), "data-field-in": "rows", ...phoneMark(device), invalid: invalid, disabled: disabled, "data-kit": "field", children: [label != null && _jsxs(BaseField.Label, { className: "o-field-row-label", id: labelId, ...(nativeLabel ? {} : { nativeLabel: false, render: _jsx("span", {}) }), children: [label, required && _jsx("span", { className: "o-field-req", "aria-hidden": "true", children: "*" })] }), _jsx(FieldRowsCardContext.Provider, { value: null, children: _jsx(InFieldRow.Provider, { value: true, children: children }) }), at && wants && createPortal(_jsxs(_Fragment, { children: [noted && _jsx(BaseField.Description, { className: "o-field-note", children: note }), invalid && _jsx(BaseField.Error, { className: "o-field-error", match: true, children: _jsx(ErrorWords, { errors: errors }) })] }), at)] }));
33
+ return (_jsxs(BaseField.Root, { className: cx("o-field o-field-row", className), "data-slot": partSlot, "data-key": partKey, "data-field-in": "rows", ...phoneMark(device), invalid: invalid, disabled: disabled, "data-kit": "field", children: [label != null && _jsxs(BaseField.Label, { className: "o-field-row-label", id: labelId, ...(nativeLabel ? {} : { nativeLabel: false, render: _jsx("span", {}) }), children: [label, required && _jsx("span", { className: "o-field-req", "aria-hidden": "true", children: "*" })] }), _jsx(FieldRowsCardContext.Provider, { value: null, children: _jsx(InFieldRow.Provider, { value: true, children: children }) }), at && wants && createPortal(_jsxs(_Fragment, { children: [noted && _jsx(BaseField.Description, { className: "o-field-note", children: note }), invalid && _jsx(BaseField.Error, { className: "o-field-error", match: true, children: _jsx(ErrorWords, { errors: errors }) })] }), at)] }));
34
34
  }
35
- function FieldBox({ label, required = false, note, error, keepNote = false, orientation = "vertical", disabled, nativeLabel = true, labelId, quietLabel = false, form, className, children }) {
35
+ function FieldBox({ label, required = false, note, error, keepNote = false, orientation = "vertical", disabled, nativeLabel = true, labelId, quietLabel = false, form, className, children, "data-slot": partSlot, "data-key": partKey }) {
36
36
  const errors = errorsOf(error), invalid = errors.length > 0;
37
37
  const phone = usePhoneForm(form), device = usePhoneForm(), inRow = React.useContext(InFieldRow);
38
- return (_jsxs(BaseField.Root, { className: cx("o-field", className), "data-orientation": orientation === "vertical" ? undefined : orientation, "data-field-label": quietLabel ? "quiet" : undefined, "data-field-form": quietLabel && phone ? "phone" : undefined, ...phoneMark(device), invalid: invalid, disabled: disabled, "data-kit": "field", children: [label != null && _jsxs(BaseField.Label, { className: "o-field-label", id: labelId, ...(nativeLabel ? {} : { nativeLabel: false, render: _jsx("span", {}) }), children: [label, required && _jsx("span", { className: "o-field-req", "aria-hidden": "true", children: "*" })] }), inRow ? _jsx(InFieldRow.Provider, { value: false, children: children }) : children, note != null && (!invalid || keepNote) && _jsx(BaseField.Description, { className: "o-field-note", children: note }), invalid && _jsx(BaseField.Error, { className: "o-field-error", match: true, children: _jsx(ErrorWords, { errors: errors }) })] }));
38
+ return (_jsxs(BaseField.Root, { className: cx("o-field", className), "data-slot": partSlot, "data-key": partKey, "data-orientation": orientation === "vertical" ? undefined : orientation, "data-field-label": quietLabel ? "quiet" : undefined, "data-field-form": quietLabel && phone ? "phone" : undefined, ...phoneMark(device), invalid: invalid, disabled: disabled, "data-kit": "field", children: [label != null && _jsxs(BaseField.Label, { className: "o-field-label", id: labelId, ...(nativeLabel ? {} : { nativeLabel: false, render: _jsx("span", {}) }), children: [label, required && _jsx("span", { className: "o-field-req", "aria-hidden": "true", children: "*" })] }), inRow ? _jsx(InFieldRow.Provider, { value: false, children: children }) : children, note != null && (!invalid || keepNote) && _jsx(BaseField.Description, { className: "o-field-note", children: note }), invalid && _jsx(BaseField.Error, { className: "o-field-error", match: true, children: _jsx(ErrorWords, { errors: errors }) })] }));
39
39
  }
40
40
  function SetDisabled({ disabled, children }) {
41
41
  const outer = useFieldRootContext();
@@ -1,5 +1,5 @@
1
- import { type MenuEntry } from "../menu/menu.js";
2
- import { type SelectItem } from "../select/select.js";
1
+ import type { MenuEntry } from "../menu/menu.js";
2
+ import type { SelectItem } from "../select/select.js";
3
3
  import type { Quantifier } from "./rules.js";
4
4
  import type { FilterEditorWords } from "./words.js";
5
5
  /** A block's head: its relation's name and its quantifier's box. On a phone the box's press turns the sheet to its step (`step`). */
@@ -1,17 +1,17 @@
1
1
  "use client";
2
2
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
- import { Button } from "../button/button.js";
4
3
  import { DOTS_UP, glyph, MORE_LOOK } from "../internal/editor-parts.js";
5
- import { Menu } from "../menu/menu.js";
4
+ import { usePanelControls } from "../internal/panel-controls.js";
6
5
  import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
7
6
  import { MenuList } from "../menu-list/menu-list.js";
8
- import { Select } from "../select/select.js";
9
7
  export function BlockHead({ id, label, items, value, onPick, size, step }) {
10
- return (_jsxs("div", { className: "o-filter-editor-block-head", "data-block-head": id, children: [_jsxs("span", { className: "o-filter-editor-relation", children: [label, ":"] }), _jsx(Select, { size: size, listWidth: "rows", "aria-label": label, items: items, value: value, ...(step ?? {}), onValueChange: (v) => { if (typeof v === "string" && v !== value)
8
+ const { Select } = usePanelControls();
9
+ return (_jsxs("div", { className: "o-filter-editor-block-head", "data-slot": "vk-filter-group-head", "data-block-head": id, children: [_jsxs("span", { className: "o-filter-editor-relation", children: [label, ":"] }), _jsx(Select, { size: size, listWidth: "rows", "aria-label": label, "data-slot": "vk-filter-quantifier", items: items, value: value, ...(step ?? {}), onValueChange: (v) => { if (typeof v === "string" && v !== value)
11
10
  onPick(v); } })] }));
12
11
  }
13
12
  export function GroupMenu({ entries, words }) {
14
- return _jsx(Menu, { label: words.groupActions, align: "end", entries: entries, trigger: _jsx(Button, { kind: "quiet", shape: "icon", size: "xs", look: MORE_LOOK, className: "o-filter-editor-more", "aria-label": words.groupActions, icon: glyph(DOTS_UP) }) });
13
+ const { Button, Menu } = usePanelControls();
14
+ return _jsx(Menu, { label: words.groupActions, align: "end", entries: entries, trigger: _jsx(Button, { kind: "quiet", shape: "icon", size: "xs", look: MORE_LOOK, className: "o-filter-editor-more", "data-slot": "vk-filter-group-more", "aria-label": words.groupActions, icon: glyph(DOTS_UP) }) });
15
15
  }
16
16
  export function MenuStep({ label, entries, onClose, words }) {
17
17
  const rows = entries.map((e) => {
@@ -1,19 +1,15 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
- import { Button } from "../button/button.js";
5
4
  import { cellText } from "../date-editor/calendar.js";
6
5
  import { DateEditor, useDateEditor } from "../date-editor/date-editor.js";
7
6
  import { asSelect, DOTS, DOTS_LOOK, DOTS_UP, glyph, MORE_LOOK, PLUS, TRASH, useDecide, useStandingRoom } from "../internal/editor-parts.js";
8
7
  import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
8
+ import { usePanelControls } from "../internal/panel-controls.js";
9
9
  import { openerAt, useStepReturn } from "../internal/step-return.js";
10
- import { Input } from "../input/input.js";
11
- import { Menu } from "../menu/menu.js";
12
10
  import { NumberField } from "../number-field/number-field.js";
13
11
  import { Picker, usePicker } from "../picker/picker.js";
14
12
  import { itemLabel } from "../picker/rows.js";
15
- import { Popover } from "../popover/popover.js";
16
- import { Select } from "../select/select.js";
17
13
  import { Tooltip } from "../tooltip/tooltip.js";
18
14
  import { HOW, wayOf } from "./how.js";
19
15
  import { PairValue } from "./parts.js";
@@ -23,7 +19,7 @@ import { filterWords } from "./words.js";
23
19
  const GROUP = ["M4 7a3 3 0 0 1 3 -3h10a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-10a3 3 0 0 1 -3 -3z", "M8 9h8", "M8 13h5"];
24
20
  const TURNS = ["M7 4l-3 3l3 3", "M4 7h13", "M17 20l3 -3l-3 -3", "M20 17h-13"];
25
21
  function DateValue({ name, value, onValue, open, onOpenChange, phone, size, placeholder }) {
26
- const box = React.useRef(null);
22
+ const box = React.useRef(null), { Input, Popover } = usePanelControls();
27
23
  return (_jsxs("div", { ref: box, className: "o-filter-editor-date", children: [_jsx(Input, { readOnly: true, size: size, "aria-label": name, "aria-haspopup": "dialog", "aria-expanded": open, placeholder: placeholder, value: value ? cellText(value, value) : "", className: "o-filter-editor-date-box", onClick: () => onOpenChange(!open), onKeyDown: (e) => { if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
28
24
  e.preventDefault();
29
25
  onOpenChange(true);
@@ -33,7 +29,7 @@ function DateStep({ name, value, onValue, onDone }) {
33
29
  return _jsx(_Fragment, { children: useDateEditor({ label: name, value, onValueChange: onValue, onDone, form: "phone", draft: "shell" }).body });
34
30
  }
35
31
  function OwnValue({ name, own, open, onOpenChange, phone, size, placeholder }) {
36
- const box = React.useRef(null), takes = own.body != null;
32
+ const box = React.useRef(null), takes = own.body != null, { Input, Popover } = usePanelControls();
37
33
  return (_jsxs("div", { ref: box, className: "o-filter-editor-own", children: [_jsx(Input, { readOnly: true, size: size, "aria-label": name, "aria-haspopup": takes ? "dialog" : undefined, "aria-expanded": takes ? open : undefined, placeholder: placeholder, value: own.value ?? "", disabled: !takes, className: "o-filter-editor-own-box", onClick: () => { if (takes)
38
34
  onOpenChange(!open); }, onKeyDown: (e) => { if (takes && (e.key === "Enter" || e.key === " " || e.key === "ArrowDown")) {
39
35
  e.preventDefault();
@@ -43,6 +39,7 @@ function OwnValue({ name, own, open, onOpenChange, phone, size, placeholder }) {
43
39
  export function useFilterEditor(props) {
44
40
  const { label, fields, filter, onFilterChange, onDone, standing = false, ids, levels } = props;
45
41
  const w = filterWords(props.words), words = w.picker ? { words: w.picker } : {};
42
+ const { Button, Select, Menu, Popover, Input } = usePanelControls();
46
43
  const screen = React.useContext(PhoneHost), small = usePhone(), way = props.form ?? (screen || small ? "phone" : "computer");
47
44
  const phone = way === "phone", stacked = phone || way === "narrow";
48
45
  const now = React.useRef(filter);
@@ -76,17 +73,17 @@ export function useFilterEditor(props) {
76
73
  if (!r || !field || !takes || takes === "none")
77
74
  return void setOpen(null);
78
75
  if (field.choices || field.type === "date")
79
- return void box?.querySelector(".o-select-field")?.focus({ preventScroll: true });
76
+ return void (box?.querySelector(".o-select-field") ?? box?.querySelector("button, select, [role='combobox']"))?.focus({ preventScroll: true });
80
77
  box?.querySelector("input")?.focus({ preventScroll: true });
81
78
  setOpen(null);
82
79
  }, [open, root, standing]);
83
80
  const opener = (id) => (o) => setOpen((x) => (o ? id : x === id ? null : x));
84
81
  const back = () => setStep(null);
85
82
  useStepReturn(root, !phone || !step ? [] : [step.list === "add" ? ((group) => openerAt(() => `[data-add-to="${CSS.escape(group)}"]`))(step.group)
86
- : step.list === "quantifier" ? ((group) => openerAt(() => `[data-block-head="${CSS.escape(group)}"] .o-select-field`))(step.group)
83
+ : step.list === "quantifier" ? ((group) => openerAt(() => `[data-block-head="${CSS.escape(group)}"] [data-slot="vk-filter-quantifier"]`))(step.group)
87
84
  : step.list === "menu" ? ((item) => openerAt(() => `[data-more-of="${CSS.escape(item)}"]`))(step.item)
88
- : ((id, list) => openerAt(() => (list === "value" ? `[data-value-of="${CSS.escape(id)}"] :is(.o-select-field, input, button)`
89
- : `.o-filter-editor-rule[data-rule="${CSS.escape(id)}"] .o-filter-editor-${list} .o-select-field`)))(step.rule, step.list)]);
85
+ : ((id, list) => openerAt(() => (list === "value" ? `[data-value-of="${CSS.escape(id)}"] :is(.o-select-field, input, button, select, [role='combobox'])`
86
+ : `.o-filter-editor-rule[data-rule="${CSS.escape(id)}"] .o-filter-editor-${list} [data-slot="vk-filter-${list}"]`)))(step.rule, step.list)]);
90
87
  const add = (group, field) => {
91
88
  if (typeof field !== "string")
92
89
  return;
@@ -114,7 +111,7 @@ export function useFilterEditor(props) {
114
111
  const [adding, setAdding] = React.useState(null);
115
112
  const gone = filter.relation?.gone;
116
113
  const addButton = (group, kind, size) => {
117
- const add = (_jsx(Button, { kind: kind, size: size, icon: glyph(PLUS), className: "o-filter-editor-add", "data-add-to": group, "aria-haspopup": "dialog", "aria-disabled": gone ? true : undefined, "aria-expanded": phone ? step?.list === "add" && step.group === group : adding?.group === group, onClick: (e) => { if (gone)
114
+ const add = (_jsx(Button, { kind: kind, size: size, icon: glyph(PLUS), className: "o-filter-editor-add", "data-slot": "vk-filter-add", "data-add-to": group, "aria-haspopup": "dialog", "aria-disabled": gone ? true : undefined, "aria-expanded": phone ? step?.list === "add" && step.group === group : adding?.group === group, onClick: (e) => { if (gone)
118
115
  return; const at = e.currentTarget; if (phone)
119
116
  setStep({ list: "add", group });
120
117
  else
@@ -175,7 +172,7 @@ export function useFilterEditor(props) {
175
172
  : stepDate && stepRule ? _jsx(DateStep, { name: labelOf(stepRule), value: typeof stepRule.value === "string" ? stepRule.value : null, onValue: set(stepRule.id), onDone: back })
176
173
  : stepList.body;
177
174
  const size = phone ? "lg" : "sm";
178
- const moreStep = (id, label) => (_jsx(Button, { kind: "quiet", shape: "icon", size: "40x44", look: DOTS_LOOK, className: "o-filter-editor-more", "data-more-of": id, "aria-label": label, "aria-haspopup": "dialog", icon: glyph(DOTS), onClick: () => setStep({ list: "menu", item: id }) }));
175
+ const moreStep = (id, label, slot) => (_jsx(Button, { kind: "quiet", shape: "icon", size: "40x44", look: DOTS_LOOK, className: "o-filter-editor-more", "data-slot": slot, "data-more-of": id, "aria-label": label, "aria-haspopup": "dialog", icon: glyph(DOTS), onClick: () => setStep({ list: "menu", item: id }) }));
179
176
  const stepOf = (s) => (phone ? { open: false, onOpenChange: (o) => { if (o)
180
177
  setStep(s); } } : {});
181
178
  const valueBox = (r, field, takes, own) => {
@@ -199,20 +196,21 @@ export function useFilterEditor(props) {
199
196
  };
200
197
  function groupEntries(g) {
201
198
  const can = canExclude(filter, g.id);
202
- return [{ kind: "check", label: w.exclude, checked: !!g.exclude, ...(can ? {} : { disabled: w.excludeNeedsAnd }),
199
+ return [{ kind: "check", label: w.exclude, checked: !!g.exclude, slot: { slot: "vk-filter-group-action", key: "exclude" }, ...(can ? {} : { disabled: w.excludeNeedsAnd }),
203
200
  onCheckedChange: (on) => change(setExclude(now.current, g.id, on)) }];
204
201
  }
205
202
  function ruleEntries(r) {
206
203
  const aside = r.aside;
204
+ const act = (key) => ({ slot: { slot: "vk-filter-rule-action", key } });
207
205
  if (aside)
208
- return [{ icon: null, label: aside.why, disabled: aside.why },
209
- ...(aside.putBack ? [{ icon: null, label: w.putBack, onSelect: () => change(putBack(now.current, r.id)) }] : []),
210
- { icon: glyph(TRASH), label: w.deleteRule, danger: true, onSelect: () => remove(r.id) }];
206
+ return [{ icon: null, label: aside.why, disabled: aside.why, ...act("why") },
207
+ ...(aside.putBack ? [{ icon: null, label: w.putBack, onSelect: () => change(putBack(now.current, r.id)), ...act("put-back") }] : []),
208
+ { icon: glyph(TRASH), label: w.deleteRule, danger: true, onSelect: () => remove(r.id), ...act("delete") }];
211
209
  const blockable = !!relationOf(fields, r.field) && !blockAround(filter, r.id) && canGroup(filter, r.id, levels);
212
- return [...(canGroup(filter, r.id, levels) ? [{ icon: glyph(GROUP), label: w.toGroup, onSelect: () => change(toGroup(now.current, r.id, ids, levels)) }] : []),
213
- ...(blockable ? [{ kind: "separator" }, { kind: "pick", value: "any", choices: QUANTIFIERS.filter((q) => q !== "every" || isWhole(r, fields)).map((q) => ({ value: q, label: w.quantifier(q) })),
210
+ return [...(canGroup(filter, r.id, levels) ? [{ icon: glyph(GROUP), label: w.toGroup, onSelect: () => change(toGroup(now.current, r.id, ids, levels)), ...act("convert") }] : []),
211
+ ...(blockable ? [{ kind: "separator" }, { kind: "pick", value: "any", choices: QUANTIFIERS.filter((q) => q !== "every" || isWhole(r, fields)).map((q) => ({ value: q, label: w.quantifier(q), ...act(q) })),
214
212
  onChoose: (q) => change(toBlock(now.current, r.id, q, fields, ids, levels)) }, { kind: "separator" }] : []),
215
- { icon: glyph(TRASH), label: w.deleteRule, danger: true, onSelect: () => remove(r.id) }];
213
+ { icon: glyph(TRASH), label: w.deleteRule, danger: true, onSelect: () => remove(r.id), ...act("delete") }];
216
214
  }
217
215
  const ruleRow = (r) => {
218
216
  const field = fieldOf(fields, r.field), own = ownOf(r), aside = r.aside, name = labelOf(r);
@@ -221,28 +219,28 @@ export function useFilterEditor(props) {
221
219
  const entries = ruleEntries(r), fieldItems = asSelect(fieldsIn(filter, r.id, fields));
222
220
  const why = (node) => (aside ? _jsx(Tooltip, { label: aside.why, reason: true, side: "bottom", children: _jsx("span", { className: "o-filter-editor-why", children: node }) }) : node);
223
221
  const wayPlaceholder = own && !kitWay ? own.way : w.way(r.how);
224
- return (_jsxs("div", { className: "o-filter-editor-rule", "data-rule": r.id, "data-whole": (field || own) && isWhole(r, fields) ? "" : undefined, "data-set-aside": aside || (!field && !own) ? "" : undefined, "data-aside": aside ? "" : undefined, children: [_jsxs("div", { className: "o-filter-editor-boxes", children: [_jsx("div", { className: "o-filter-editor-field", children: why(_jsx(Select, { size: size, listWidth: "rows", "aria-label": w.field, items: fieldItems, value: field && !aside ? r.field : null, placeholder: name, search: w.search, ...stepOf({ list: "field", rule: r.id }), onValueChange: (v) => { if (typeof v === "string" && (v !== r.field || aside))
225
- pointAt(r.id, v); } })) }), _jsx("div", { className: "o-filter-editor-how", children: why(_jsx(Select, { size: size, listWidth: "rows", "aria-label": w.how, items: ways, value: field && kitWay && !aside ? r.how : null, placeholder: wayPlaceholder, disabled: !!aside || (!field && !!own), ...(field || !own ? stepOf({ list: "how", rule: r.id }) : {}), onValueChange: (v) => { if (typeof v === "string" && v !== r.how)
226
- change(changeRule(now.current, r.id, { how: v }, fields)); } })) }), aside && own?.value != null && (_jsx("div", { className: "o-filter-editor-value", "data-value-of": r.id, "data-value-box": "own", children: why(_jsx(Input, { readOnly: true, disabled: true, size: size, "aria-label": name, value: own.value, className: "o-filter-editor-own-box" })) })), !aside && takes && takes !== "none" && (field || own) && (_jsx("div", { className: "o-filter-editor-value", "data-value-of": r.id, "data-value-box": own ? "own" : field?.choices ? "choice" : takes === "two" ? "pair" : field?.type === "date" ? "date" : "typed", children: valueBox(r, field ?? { value: r.field, label: name, type: "text" }, takes, own) }))] }), phone ? moreStep(r.id, w.ruleOf(name))
227
- : _jsx(Menu, { label: w.ruleOf(name), align: "end", entries: entries, trigger: _jsx(Button, { kind: "quiet", shape: "icon", size: "xs", look: MORE_LOOK, className: "o-filter-editor-more", "aria-label": w.ruleOf(name), icon: glyph(DOTS_UP) }) })] }));
222
+ return (_jsxs("div", { className: "o-filter-editor-rule", "data-slot": "vk-filter-rule", "data-key": r.field, "data-rule": r.id, "data-whole": (field || own) && isWhole(r, fields) ? "" : undefined, "data-set-aside": aside || (!field && !own) ? "" : undefined, "data-aside": aside ? "" : undefined, children: [_jsxs("div", { className: "o-filter-editor-boxes", children: [_jsx("div", { className: "o-filter-editor-field", children: why(_jsx(Select, { size: size, listWidth: "rows", "aria-label": w.field, "data-slot": "vk-filter-field", items: fieldItems, value: field && !aside ? r.field : null, placeholder: name, search: w.search, ...stepOf({ list: "field", rule: r.id }), onValueChange: (v) => { if (typeof v === "string" && (v !== r.field || aside))
223
+ pointAt(r.id, v); } })) }), _jsx("div", { className: "o-filter-editor-how", children: why(_jsx(Select, { size: size, listWidth: "rows", "aria-label": w.how, "data-slot": "vk-filter-how", items: ways, value: field && kitWay && !aside ? r.how : null, placeholder: wayPlaceholder, disabled: !!aside || (!field && !!own), ...(field || !own ? stepOf({ list: "how", rule: r.id }) : {}), onValueChange: (v) => { if (typeof v === "string" && v !== r.how)
224
+ change(changeRule(now.current, r.id, { how: v }, fields)); } })) }), aside && own?.value != null && (_jsx("div", { className: "o-filter-editor-value", "data-slot": "vk-filter-value", "data-value-of": r.id, "data-value-box": "own", children: why(_jsx(Input, { readOnly: true, disabled: true, size: size, "aria-label": name, value: own.value, className: "o-filter-editor-own-box" })) })), !aside && takes && takes !== "none" && (field || own) && (_jsx("div", { className: "o-filter-editor-value", "data-slot": "vk-filter-value", "data-value-of": r.id, "data-value-box": own ? "own" : field?.choices ? "choice" : takes === "two" ? "pair" : field?.type === "date" ? "date" : "typed", children: valueBox(r, field ?? { value: r.field, label: name, type: "text" }, takes, own) }))] }), phone ? moreStep(r.id, w.ruleOf(name), "vk-filter-rule-more")
225
+ : _jsx(Menu, { label: w.ruleOf(name), align: "end", entries: entries, trigger: _jsx(Button, { kind: "quiet", shape: "icon", size: "xs", look: MORE_LOOK, className: "o-filter-editor-more", "data-slot": "vk-filter-rule-more", "aria-label": w.ruleOf(name), icon: glyph(DOTS_UP) }) })] }));
228
226
  };
229
- const lead = (g, i) => i === 0 ? _jsx("span", { className: "o-filter-editor-where", children: w.where })
230
- : i === 1 && !g.exclude ? _jsx(Button, { kind: "outline", size: "sm", className: "o-filter-editor-join", iconEnd: glyph(TURNS), onClick: () => change(setJoin(now.current, g.id, g.join === "and" ? "or" : "and")), children: w.join(g.join) })
231
- : _jsx("span", { className: "o-filter-editor-joined", children: w.join(g.join) });
227
+ const lead = (g, i) => i === 0 ? _jsx("span", { className: "o-filter-editor-where", "data-slot": "vk-filter-where", children: w.where })
228
+ : i === 1 && !g.exclude ? _jsx(Button, { kind: "outline", size: "sm", className: "o-filter-editor-join", "data-slot": "vk-filter-join", iconEnd: glyph(TURNS), onClick: () => change(setJoin(now.current, g.id, g.join === "and" ? "or" : "and")), children: w.join(g.join) })
229
+ : _jsx("span", { className: "o-filter-editor-joined", "data-slot": "vk-filter-joined", children: w.join(g.join) });
232
230
  const blockHead = (g) => g.relation && (_jsx(BlockHead, { id: g.id, label: blockLabel(g), items: quantifiersOf(g), value: g.relation.quantifier, size: size, onPick: (q) => change(setQuantifier(now.current, g.id, q)), ...(phone ? { step: { open: false, onOpenChange: (o) => { if (o)
233
231
  setStep({ list: "quantifier", group: g.id }); } } } : {}) }));
234
- const groupMore = (g) => (phone ? moreStep(g.id, w.groupActions) : _jsx(GroupMenu, { entries: groupEntries(g), words: w }));
235
- const top = _jsxs(_Fragment, { children: [filter.exclude && _jsx("p", { className: "o-filter-editor-excluded", children: w.excluded }), blockHead(filter)] });
236
- const level = (g, depth) => (_jsx("div", { className: "o-filter-editor-rules", role: "list", "aria-label": depth ? w.group : label, children: g.rules.map((item, i) => (_jsxs("div", { role: "listitem", className: "o-filter-editor-item", children: [lead(g, i), isBlock(item) ? (_jsxs("div", { className: "o-filter-editor-group o-filter-editor-block", "data-group": item.id, "data-block": item.id, children: [blockHead(item), level(item, depth + 1), _jsxs("div", { className: "o-filter-editor-foot", children: [addButton(item.id, stacked ? "quiet" : "outline", phone ? "44" : "sm"), _jsx(Button, { kind: "quiet", size: phone ? "44" : "sm", className: "o-filter-editor-delete", onClick: () => remove(item.id), children: w.deleteRule })] })] })) : isGroup(item) ? (_jsxs("div", { className: "o-filter-editor-group", "data-group": item.id, children: [item.exclude && _jsx("p", { className: "o-filter-editor-excluded", children: w.excluded }), level(item, depth + 1), _jsxs("div", { className: "o-filter-editor-foot", children: [addButton(item.id, stacked ? "quiet" : "outline", phone ? "44" : "sm"), _jsx(Button, { kind: "quiet", size: phone ? "44" : "sm", className: "o-filter-editor-delete", onClick: () => remove(item.id), children: w.deleteGroup }), groupMore(item)] })] })) : ruleRow(item)] }, item.id))) }));
232
+ const groupMore = (g) => (phone ? moreStep(g.id, w.groupActions, "vk-filter-group-more") : _jsx(GroupMenu, { entries: groupEntries(g), words: w }));
233
+ const top = _jsxs(_Fragment, { children: [filter.exclude && _jsx("p", { className: "o-filter-editor-excluded", "data-slot": "vk-filter-excluded", children: w.excluded }), blockHead(filter)] });
234
+ const level = (g, depth) => (_jsx("div", { className: "o-filter-editor-rules", "data-slot": "vk-filter-rules", role: "list", "aria-label": depth ? w.group : label, children: g.rules.map((item, i) => (_jsxs("div", { role: "listitem", className: "o-filter-editor-item", "data-slot": "vk-filter-item", "data-index": i, children: [lead(g, i), isBlock(item) ? (_jsxs("div", { className: "o-filter-editor-group o-filter-editor-block", "data-slot": "vk-filter-group", "data-group": item.id, "data-block": item.id, children: [blockHead(item), level(item, depth + 1), _jsxs("div", { className: "o-filter-editor-foot", "data-slot": "vk-filter-foot", children: [addButton(item.id, stacked ? "quiet" : "outline", phone ? "44" : "sm"), _jsx(Button, { kind: "quiet", size: phone ? "44" : "sm", className: "o-filter-editor-delete", "data-slot": "vk-filter-delete", onClick: () => remove(item.id), children: w.deleteRule })] })] })) : isGroup(item) ? (_jsxs("div", { className: "o-filter-editor-group", "data-slot": "vk-filter-group", "data-group": item.id, children: [item.exclude && _jsx("p", { className: "o-filter-editor-excluded", "data-slot": "vk-filter-excluded", children: w.excluded }), level(item, depth + 1), _jsxs("div", { className: "o-filter-editor-foot", "data-slot": "vk-filter-foot", children: [addButton(item.id, stacked ? "quiet" : "outline", phone ? "44" : "sm"), _jsx(Button, { kind: "quiet", size: phone ? "44" : "sm", className: "o-filter-editor-delete", "data-slot": "vk-filter-delete", onClick: () => remove(item.id), children: w.deleteGroup }), groupMore(item)] })] })) : ruleRow(item)] }, item.id))) }));
237
235
  const addingPopover = !standing && (_jsx(Popover, { open: !!adding, onOpenChange: (o) => { if (!o)
238
236
  setAdding(null); }, anchor: adding?.at, className: "w-fit min-w-[calc(var(--vk-spacing,var(--spacing))*48)]", "aria-label": w.add, children: adding && _jsx(Picker, { label: w.add, items: fieldsIn(filter, adding.group, fields), value: null, onValueChange: (v) => add(adding.group, v), onDone: () => setAdding(null), search: w.search, searchShown: true, form: "computer", ...words }) }));
239
237
  if (stacked) {
240
- const body = (_jsx("div", { ref: placeRoot, className: "o-filter-editor", "data-kit": "filter-editor", "data-filter-form": way, role: phone ? undefined : "group", "aria-label": phone ? undefined : label, tabIndex: -1, style: room ? { paddingBottom: room } : undefined, ...phoneMark(!!screen || small), "data-filter-step": stepTitle !== undefined ? step?.list : undefined, children: stepTitle !== undefined ? stepBody : _jsxs(_Fragment, { children: [top, filter.rules.length ? level(filter, 0)
241
- : _jsxs("div", { className: "o-filter-editor-none", children: [_jsx("p", { className: "o-filter-editor-none-head", children: w.none }), _jsx("p", { className: "o-filter-editor-none-line", children: w.noneLine })] }), _jsxs("div", { className: "o-filter-editor-acts", children: [addButton(filter.id, filter.rules.length ? "outline" : "primary", phone ? "44" : "sm"), filter.rules.length > 0 && _jsx(Button, { kind: "quiet", size: phone ? "44" : "sm", className: "o-filter-editor-clear", onClick: clear, children: w.clearAll }), props.excludable && groupMore(filter)] }), !phone && addingPopover] }) }));
238
+ const body = (_jsx("div", { ref: placeRoot, className: "o-filter-editor", "data-slot": "vk-filter", "data-kit": "filter-editor", "data-filter-form": way, role: phone ? undefined : "group", "aria-label": phone ? undefined : label, tabIndex: -1, style: room ? { paddingBottom: room } : undefined, ...phoneMark(!!screen || small), "data-filter-step": stepTitle !== undefined ? step?.list : undefined, children: stepTitle !== undefined ? stepBody : _jsxs(_Fragment, { children: [top, filter.rules.length ? level(filter, 0)
239
+ : _jsxs("div", { className: "o-filter-editor-none", "data-slot": "vk-filter-none", children: [_jsx("p", { className: "o-filter-editor-none-head", children: w.none }), _jsx("p", { className: "o-filter-editor-none-line", children: w.noneLine })] }), _jsxs("div", { className: "o-filter-editor-acts", "data-slot": "vk-filter-foot", children: [addButton(filter.id, filter.rules.length ? "outline" : "primary", phone ? "44" : "sm"), filter.rules.length > 0 && _jsx(Button, { kind: "quiet", size: phone ? "44" : "sm", className: "o-filter-editor-clear", "data-slot": "vk-filter-clear", onClick: clear, children: w.clearAll }), props.excludable && groupMore(filter)] }), !phone && addingPopover] }) }));
242
240
  return { body, head: !phone ? {} : stepTitle !== undefined ? { onBack: back } : decide.head, ...(stepTitle !== undefined ? { title: stepTitle } : {}) };
243
241
  }
244
242
  const fieldsAlone = !filter.rules.length && !filter.relation;
245
- const body = (_jsx("div", { ref: placeRoot, className: "o-filter-editor", "data-kit": "filter-editor", "data-filter-form": "computer", role: "group", "aria-label": label, tabIndex: -1, "data-filter-fields": fieldsAlone ? "" : undefined, style: room ? { paddingBottom: room } : undefined, ...phoneMark(!!screen || small), children: !fieldsAlone ? _jsxs(_Fragment, { children: [top, level(filter, 0), _jsxs("div", { className: "o-filter-editor-foot", children: [addButton(filter.id, "outline", "sm"), _jsx(Button, { kind: "quiet", size: "sm", className: "o-filter-editor-clear", onClick: clear, children: w.clearAllFilters }), props.excludable && groupMore(filter)] }), addingPopover] }) : (_jsx(Picker, { label: label, items: fields, value: null, onValueChange: (v) => add(filter.id, v), search: w.search, searchShown: true, form: "computer", ...words })) }));
243
+ const body = (_jsx("div", { ref: placeRoot, className: "o-filter-editor", "data-slot": "vk-filter", "data-kit": "filter-editor", "data-filter-form": "computer", role: "group", "aria-label": label, tabIndex: -1, "data-filter-fields": fieldsAlone ? "" : undefined, style: room ? { paddingBottom: room } : undefined, ...phoneMark(!!screen || small), children: !fieldsAlone ? _jsxs(_Fragment, { children: [top, level(filter, 0), _jsxs("div", { className: "o-filter-editor-foot", "data-slot": "vk-filter-foot", children: [addButton(filter.id, "outline", "sm"), _jsx(Button, { kind: "quiet", size: "sm", className: "o-filter-editor-clear", "data-slot": "vk-filter-clear", onClick: clear, children: w.clearAllFilters }), props.excludable && groupMore(filter)] }), addingPopover] }) : (_jsx(Picker, { label: label, items: fields, value: null, onValueChange: (v) => add(filter.id, v), search: w.search, searchShown: true, form: "computer", ...words })) }));
246
244
  return { body, head: {} };
247
245
  }
248
246
  export const useFilterEditorParts = useFilterEditor;
@@ -9,11 +9,13 @@ export interface FilterWay {
9
9
  takes: Takes;
10
10
  }
11
11
  /** A field a list filters by: the Picker's item, with its type; a choice's values (a stage's, a person's, a record's), each a
12
- * Picker's item with its mark; a related record's fields one level in (a deal's Company), each typed too. */
12
+ * Picker's item with its mark; a related record's fields one level in (a deal's Company), each typed too; a number that
13
+ * holds whole numbers only (`integer`), whose box rounds what is typed. */
13
14
  export interface FilterField extends PickerItem {
14
15
  type: FieldType;
15
16
  choices?: PickerItem[];
16
17
  level?: FilterField[];
18
+ integer?: boolean;
17
19
  }
18
20
  /** Each type's ways, in the order they are offered; the first is a new rule's. */
19
21
  export declare const HOW: Record<FieldType, FilterWay[]>;
@@ -20,6 +20,7 @@ export declare function useMapFilterBody(p: ViewsFilterBodyProps, words: FilterE
20
20
  change: (next: KitGroup) => void;
21
21
  own: (rule: KitRule) => FilterOwn | null;
22
22
  };
23
+ /** ViewKit's filter body, its controls the app's where the provider's `panelControls` names them (VK-1013). */
23
24
  export declare function MapFilterBody(props: ViewsFilterBodyProps): import("react/jsx-runtime").JSX.Element;
24
25
  /** The rule as a one-rule kit filter, with the kit's fields for it; null where the kit draws no rule of it, or where a choice has no
25
26
  * values to offer, which ViewKit's own body then draws. */
@@ -13,6 +13,7 @@ import { useFilterEditor } from "./filter-editor.js";
13
13
  import { kitFieldsOf, kitFilterOf, rulesFor, viewKitFilterOf, writeRules, CHOICE, RELATION_WAY } from "./map-rules.js";
14
14
  import { FilterPartBody } from "./parts.js";
15
15
  import { changeRule, fieldOf, isOwnWay, rulesOf } from "./rules.js";
16
+ import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
16
17
  const BACK = ["M5 12l14 0", "M5 12l6 6", "M5 12l6 -6"];
17
18
  export function filterWordsOf(say) {
18
19
  return {
@@ -137,6 +138,9 @@ export function useMapFilterBody(p, words, say, AppIcon, wayWord) {
137
138
  return { kit, filter: read.filter, change: (next) => write(next), own: ownOf };
138
139
  }
139
140
  export function MapFilterBody(props) {
141
+ return _jsx(PanelControlsFromViews, { children: _jsx(FilterBodyInner, { ...props }) });
142
+ }
143
+ function FilterBodyInner(props) {
140
144
  const views = React.useContext(ViewsContext);
141
145
  const say = views?.messages ?? resolveViewsMessage;
142
146
  const words = React.useMemo(() => filterWordsOf(say), [say]);
@@ -148,10 +152,10 @@ export function MapFilterBody(props) {
148
152
  const { actions } = props;
149
153
  if (!actions)
150
154
  return _jsx(_Fragment, { children: parts.body });
151
- const done = actions.done && _jsx(SheetButton, { kind: "primary", "aria-label": actions.done.label, icon: glyph(TICK), onClick: actions.done.onPress });
155
+ const done = actions.done && _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": actions.done.label, icon: glyph(TICK), onClick: actions.done.onPress });
152
156
  return (_jsxs(_Fragment, { children: [parts.title !== undefined
153
- ? _jsx(BodyHead, { title: parts.title, left: _jsx(SheetButton, { "aria-label": words.back, className: "o-sheet-back", icon: glyph(BACK), onClick: parts.head.onBack }), right: done || _jsx("span", {}) })
154
- : _jsx(BodyHead, { title: props.label, left: _jsx(SheetButton, { "aria-label": actions.close.label, icon: glyph(X), onClick: actions.close.onPress }), right: done || _jsx("span", {}) }), parts.body] }));
157
+ ? _jsx(BodyHead, { title: parts.title, left: _jsx(SheetButton, { "data-slot": "vk-editor-back", "aria-label": words.back, className: "o-sheet-back", icon: glyph(BACK), onClick: parts.head.onBack }), right: done || _jsx("span", {}) })
158
+ : _jsx(BodyHead, { title: props.label, left: _jsx(SheetButton, { "data-slot": "vk-editor-close", "aria-label": actions.close.label, icon: glyph(X), onClick: actions.close.onPress }), right: done || _jsx("span", {}) }), parts.body] }));
155
159
  }
156
160
  export function partOf(rule, field, choices) {
157
161
  const kit = kitFieldsOf([field], choices), [f] = kit.fields, { filter } = kitFilterOf({ op: "and", items: [rule] }, kit);
@@ -39,7 +39,7 @@ export function kitFieldsOf(fields, choices, relation) {
39
39
  }
40
40
  const values = type === "checkbox" ? CHECKED : CHOICE.has(type) ? choices(f.fieldKey, from, f.part) : undefined;
41
41
  at.set(value, place);
42
- return [{ value, label: f.label, type, ...(values ? { choices: values } : {}) }];
42
+ return [{ value, label: f.label, type, ...(values ? { choices: values } : {}), ...(f.integer ? { integer: true } : {}) }];
43
43
  };
44
44
  const own = (f, from) => field(f, f.key, { fieldKey: f.fieldKey, ...(f.part !== undefined ? { part: f.part } : {}) }, from);
45
45
  const relations = new Map();
@@ -64,12 +64,13 @@ export function PairValue({ name, value, onValue, size, onKeyDown, words: given
64
64
  const w = filterWords(given), [from, to] = value;
65
65
  return (_jsxs("div", { className: "o-filter-editor-pair", children: [_jsx(NumberField, { size: size, steppers: false, "aria-label": w.fromOf(name), placeholder: w.from, value: from, onValueChange: (v) => onValue([v ?? null, to]), onKeyDown: onKeyDown }), _jsx("span", { className: "o-filter-editor-dash", "aria-hidden": "true", children: "\u2013" }), _jsx(NumberField, { size: size, steppers: false, "aria-label": w.toOf(name), placeholder: w.to, value: to, onValueChange: (v) => onValue([from, v ?? null]), onKeyDown: onKeyDown })] }));
66
66
  }
67
+ const WHOLE = { maximumFractionDigits: 0 };
67
68
  function TypedValue({ rule: r, field, name, set, onDone, w }) {
68
69
  const enter = (e) => { if (e.key === "Enter") {
69
70
  e.preventDefault();
70
71
  onDone();
71
72
  } };
72
73
  return field.type === "number" || field.type === "range"
73
- ? _jsx(NumberField, { "aria-label": name, placeholder: valuePlaceholder(field, w), value: typeof r.value === "number" ? r.value : null, onValueChange: (v) => set({ value: v ?? null }), onKeyDown: enter })
74
+ ? _jsx(NumberField, { "aria-label": name, placeholder: valuePlaceholder(field, w), value: typeof r.value === "number" ? r.value : null, format: field.integer ? WHOLE : undefined, onValueChange: (v) => set({ value: v ?? null }), onKeyDown: enter })
74
75
  : _jsx(Input, { "aria-label": name, placeholder: valuePlaceholder(field, w), value: typeof r.value === "string" ? r.value : "", onChange: (e) => set({ value: e.target.value }), onKeyDown: enter });
75
76
  }