viewkitjs 0.32.0 → 0.34.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 (285) hide show
  1. package/CHANGELOG.md +98 -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 +46 -11
  37. package/views/dist/contract.js +157 -0
  38. package/views/dist/controls/alert/alert.js +2 -1
  39. package/views/dist/controls/alert-dialog/alert-dialog.js +3 -2
  40. package/views/dist/controls/bulk-bar/bulk-bar.js +25 -22
  41. package/views/dist/controls/button/map-button.js +2 -0
  42. package/views/dist/controls/checkbox/checkbox.d.ts +3 -2
  43. package/views/dist/controls/checkbox/checkbox.js +2 -2
  44. package/views/dist/controls/compound-editor/compound-editor.d.ts +1 -1
  45. package/views/dist/controls/compound-editor/name-parts.js +4 -4
  46. package/views/dist/controls/compound-editor/place-parts.js +19 -19
  47. package/views/dist/controls/compound-editor/range-parts.js +14 -14
  48. package/views/dist/controls/compound-editor/row.d.ts +3 -1
  49. package/views/dist/controls/compound-editor/row.js +2 -2
  50. package/views/dist/controls/controls.d.ts +4 -0
  51. package/views/dist/controls/controls.js +4 -0
  52. package/views/dist/controls/customize/customize.js +43 -39
  53. package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
  54. package/views/dist/controls/customize/map-customize-body.js +7 -2
  55. package/views/dist/controls/date-editor/date-days.js +2 -2
  56. package/views/dist/controls/date-editor/date-editor.d.ts +3 -0
  57. package/views/dist/controls/date-editor/date-editor.js +27 -21
  58. package/views/dist/controls/date-editor/date-parts.js +6 -6
  59. package/views/dist/controls/date-editor/map-calendar.js +3 -1
  60. package/views/dist/controls/date-editor/map-date-body.d.ts +1 -1
  61. package/views/dist/controls/date-editor/map-date-body.js +7 -3
  62. package/views/dist/controls/date-editor.css +2 -2
  63. package/views/dist/controls/field/field.d.ts +3 -0
  64. package/views/dist/controls/field/field.js +6 -6
  65. package/views/dist/controls/filter-editor/block.d.ts +2 -2
  66. package/views/dist/controls/filter-editor/block.js +5 -5
  67. package/views/dist/controls/filter-editor/filter-editor.js +31 -33
  68. package/views/dist/controls/filter-editor/how.d.ts +3 -1
  69. package/views/dist/controls/filter-editor/map-filter-body.d.ts +3 -0
  70. package/views/dist/controls/filter-editor/map-filter-body.js +11 -4
  71. package/views/dist/controls/filter-editor/map-rules.js +1 -1
  72. package/views/dist/controls/filter-editor/parts.d.ts +3 -1
  73. package/views/dist/controls/filter-editor/parts.js +8 -6
  74. package/views/dist/controls/group-editor/group-editor.js +17 -14
  75. package/views/dist/controls/group-editor/map-group-body.d.ts +1 -0
  76. package/views/dist/controls/group-editor/map-group-body.js +5 -1
  77. package/views/dist/controls/index.d.ts +2 -0
  78. package/views/dist/controls/index.js +1 -0
  79. package/views/dist/controls/input/input.js +4 -3
  80. package/views/dist/controls/input/map-input.js +2 -0
  81. package/views/dist/controls/internal/editor-parts.js +1 -1
  82. package/views/dist/controls/internal/head-button.d.ts +9 -0
  83. package/views/dist/controls/internal/head-button.js +13 -0
  84. package/views/dist/controls/internal/map-panel-controls.d.ts +8 -0
  85. package/views/dist/controls/internal/map-panel-controls.js +20 -0
  86. package/views/dist/controls/internal/panel-controls.d.ts +58 -0
  87. package/views/dist/controls/internal/panel-controls.js +240 -0
  88. package/views/dist/controls/internal/part-slot.d.ts +12 -0
  89. package/views/dist/controls/internal/part-slot.js +5 -0
  90. package/views/dist/controls/links-editor/links-editor.d.ts +1 -1
  91. package/views/dist/controls/links-editor/links-editor.js +27 -27
  92. package/views/dist/controls/menu/map-menu.d.ts +2 -2
  93. package/views/dist/controls/menu/map-menu.js +15 -12
  94. package/views/dist/controls/menu/menu.d.ts +3 -0
  95. package/views/dist/controls/menu/menu.js +5 -5
  96. package/views/dist/controls/menu-list/menu-list.d.ts +14 -4
  97. package/views/dist/controls/menu-list/menu-list.js +23 -22
  98. package/views/dist/controls/modal/modal.js +5 -3
  99. package/views/dist/controls/notice/notice.d.ts +3 -1
  100. package/views/dist/controls/notice/notice.js +2 -2
  101. package/views/dist/controls/number-editor/map-number-body.js +5 -1
  102. package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
  103. package/views/dist/controls/number-editor/number-editor.js +16 -16
  104. package/views/dist/controls/number-field/number-field.js +5 -3
  105. package/views/dist/controls/pane/map-pane.d.ts +3 -0
  106. package/views/dist/controls/pane/map-pane.js +5 -0
  107. package/views/dist/controls/pane/pane.d.ts +4 -2
  108. package/views/dist/controls/pane/pane.js +4 -4
  109. package/views/dist/controls/picker/map-fields-body.js +25 -1
  110. package/views/dist/controls/picker/picker.d.ts +2 -0
  111. package/views/dist/controls/picker/picker.js +37 -36
  112. package/views/dist/controls/picker/rows.d.ts +4 -0
  113. package/views/dist/controls/picker.css +10 -1
  114. package/views/dist/controls/popover/map-popover.d.ts +1 -1
  115. package/views/dist/controls/popover/map-popover.js +4 -2
  116. package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +2 -1
  117. package/views/dist/controls/quick-filters/map-quick-filters-body.js +7 -3
  118. package/views/dist/controls/quick-filters/quick-filters.js +8 -6
  119. package/views/dist/controls/radio/radio.d.ts +3 -0
  120. package/views/dist/controls/radio/radio.js +4 -3
  121. package/views/dist/controls/select/map-select.d.ts +3 -0
  122. package/views/dist/controls/select/map-select.js +8 -0
  123. package/views/dist/controls/select/select.d.ts +3 -0
  124. package/views/dist/controls/select/select.js +3 -3
  125. package/views/dist/controls/setting-row/looks.js +5 -5
  126. package/views/dist/controls/setting-row/setting-row.d.ts +3 -1
  127. package/views/dist/controls/setting-row/setting-row.js +3 -1
  128. package/views/dist/controls/setting-row.css +3 -2
  129. package/views/dist/controls/sheet/bottom-sheet.d.ts +8 -2
  130. package/views/dist/controls/sheet/bottom-sheet.js +4 -4
  131. package/views/dist/controls/sheet/map-sheet.js +1 -1
  132. package/views/dist/controls/sort-editor/map-sort-body.d.ts +1 -0
  133. package/views/dist/controls/sort-editor/map-sort-body.js +8 -4
  134. package/views/dist/controls/sort-editor/sort-editor.js +24 -26
  135. package/views/dist/controls/sort-editor.css +5 -0
  136. package/views/dist/controls/text-editor/map-text-body.js +5 -1
  137. package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
  138. package/views/dist/controls/text-editor/text-editor.js +11 -10
  139. package/views/dist/controls/toolbar/toolbar.d.ts +4 -2
  140. package/views/dist/controls/toolbar/toolbar.js +2 -2
  141. package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +3 -3
  142. package/views/dist/controls/toolbar-button/atom-toolbar-button.js +7 -6
  143. package/views/dist/controls/values-editor/values-editor.d.ts +1 -1
  144. package/views/dist/controls/values-editor/values-editor.js +22 -22
  145. package/views/dist/controls/views-list/map-view-menu.d.ts +3 -2
  146. package/views/dist/controls/views-list/map-view-menu.js +7 -3
  147. package/views/dist/controls/views-list/map-views-list-body.d.ts +2 -1
  148. package/views/dist/controls/views-list/map-views-list-body.js +6 -5
  149. package/views/dist/controls/views-list/view-menu.js +9 -10
  150. package/views/dist/controls/views-list/views-list.js +6 -6
  151. package/views/dist/editors/EditorPanel.js +4 -4
  152. package/views/dist/field-row/FieldRow.js +13 -0
  153. package/views/dist/fields/money.d.ts +5 -2
  154. package/views/dist/fields/money.js +14 -2
  155. package/views/dist/grid/chrome/GridTable.js +4 -1
  156. package/views/dist/grid/chrome/cell-clipboard.d.ts +4 -2
  157. package/views/dist/grid/chrome/cell-clipboard.js +2 -2
  158. package/views/dist/grid/chrome/cells.js +3 -1
  159. package/views/dist/grid/chrome/grid-row-menu-items.js +1 -1
  160. package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
  161. package/views/dist/grid/chrome/useGridKeyboard.js +29 -6
  162. package/views/dist/grid/chrome/useGridTableInteractionModel.js +9 -2
  163. package/views/dist/grid/core/clipboard-model.d.ts +3 -1
  164. package/views/dist/grid/core/clipboard-model.js +9 -8
  165. package/views/dist/grid/core/editing-controller.d.ts +3 -0
  166. package/views/dist/grid/core/editing-controller.js +6 -0
  167. package/views/dist/grid/core/edits-sink.d.ts +19 -0
  168. package/views/dist/grid/core/edits-sink.js +2 -0
  169. package/views/dist/grid/core/spreadsheet-operations.js +1 -1
  170. package/views/dist/grid/core/useGridEditing.d.ts +5 -0
  171. package/views/dist/grid/core/useGridEditing.js +6 -0
  172. package/views/dist/list/answer.d.ts +40 -0
  173. package/views/dist/list/answer.js +43 -0
  174. package/views/dist/list/bulk-bar.d.ts +7 -0
  175. package/views/dist/list/bulk-bar.js +10 -0
  176. package/views/dist/list/columns.d.ts +24 -0
  177. package/views/dist/list/columns.js +27 -0
  178. package/views/dist/list/edits.d.ts +19 -0
  179. package/views/dist/list/edits.js +56 -0
  180. package/views/dist/list/grid.d.ts +11 -0
  181. package/views/dist/list/grid.js +76 -0
  182. package/views/dist/list/index.d.ts +14 -1
  183. package/views/dist/list/index.js +4 -1
  184. package/views/dist/list/link.d.ts +8 -0
  185. package/views/dist/list/link.js +78 -0
  186. package/views/dist/list/list.d.ts +74 -0
  187. package/views/dist/list/list.js +18 -0
  188. package/views/dist/list/parts.js +11 -3
  189. package/views/dist/list/root-base.d.ts +46 -0
  190. package/views/dist/list/root-base.js +137 -0
  191. package/views/dist/list/root.d.ts +35 -34
  192. package/views/dist/list/root.js +153 -113
  193. package/views/dist/list/source-answers.d.ts +39 -0
  194. package/views/dist/list/source-answers.js +225 -0
  195. package/views/dist/list/store.d.ts +37 -5
  196. package/views/dist/list/store.js +31 -0
  197. package/views/dist/list/toolbar.d.ts +3 -2
  198. package/views/dist/list/toolbar.js +23 -5
  199. package/views/dist/list/views-axis.js +4 -2
  200. package/views/dist/list/views.d.ts +7 -2
  201. package/views/dist/list/views.js +16 -5
  202. package/views/dist/model/column-capabilities.d.ts +13 -0
  203. package/views/dist/model/column-capabilities.js +23 -2
  204. package/views/dist/model/column-schema.d.ts +11 -1
  205. package/views/dist/model/view-rules.js +1 -0
  206. package/views/dist/panels/model.d.ts +2 -0
  207. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +21 -2
  208. package/views/dist/panels/react/toolbar/ReadyToolbar.js +2 -2
  209. package/views/dist/panels/react/toolbar/Toolbar.d.ts +12 -1
  210. package/views/dist/panels/react/toolbar/Toolbar.js +20 -6
  211. package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +4 -3
  212. package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
  213. package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -4
  214. package/views/dist/panels/react/toolbar/ToolbarButton.js +4 -1
  215. package/views/dist/panels/react/toolbar/ToolbarFilter.js +1 -1
  216. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +4 -3
  217. package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
  218. package/views/dist/panels/react/toolbar/ToolbarFilters.js +5 -4
  219. package/views/dist/panels/react/toolbar/ToolbarNew.js +1 -1
  220. package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
  221. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
  222. package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
  223. package/views/dist/panels/react/toolbar/ToolbarSort.js +2 -2
  224. package/views/dist/panels/react/toolbar/ToolbarSortPill.js +8 -5
  225. package/views/dist/panels/react/toolbar/context.d.ts +31 -1
  226. package/views/dist/panels/react/toolbar/context.js +4 -0
  227. package/views/dist/panels/react/toolbar/pane-host.d.ts +6 -0
  228. package/views/dist/panels/react/toolbar/pane-host.js +17 -0
  229. package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
  230. package/views/dist/panels/react/toolbar/panel-part.js +7 -4
  231. package/views/dist/panels/react.d.ts +1 -1
  232. package/views/dist/panels/settings/filter-groups.js +6 -1
  233. package/views/dist/provider/ViewsProvider.d.ts +7 -2
  234. package/views/dist/provider/ViewsProvider.js +18 -1
  235. package/views/dist/provider/components.d.ts +90 -2
  236. package/views/dist/provider/components.js +1 -1
  237. package/views/dist/provider/context.d.ts +4 -1
  238. package/views/dist/provider/own-control.d.ts +4 -0
  239. package/views/dist/provider/own-control.js +7 -0
  240. package/views/dist/provider/select-items.d.ts +3 -0
  241. package/views/dist/provider/select-items.js +6 -0
  242. package/views/dist/react.d.ts +4 -2
  243. package/views/dist/react.js +2 -0
  244. package/views/dist/styles.css +107 -80
  245. package/views/dist/styles.unlayered.css +107 -80
  246. package/views/docs/contract.md +310 -7
  247. package/views/docs/controls/alert-dialog.md +4 -0
  248. package/views/docs/controls/alert.md +4 -0
  249. package/views/docs/controls/bulk-bar.md +4 -0
  250. package/views/docs/controls/compound-editor.md +4 -0
  251. package/views/docs/controls/customize.md +8 -0
  252. package/views/docs/controls/date-editor.md +6 -0
  253. package/views/docs/controls/field.md +4 -0
  254. package/views/docs/controls/filter-editor.md +8 -0
  255. package/views/docs/controls/group-editor.md +8 -0
  256. package/views/docs/controls/input.md +4 -0
  257. package/views/docs/controls/links-editor.md +4 -0
  258. package/views/docs/controls/menu-list.md +8 -0
  259. package/views/docs/controls/menu.md +6 -0
  260. package/views/docs/controls/modal.md +4 -0
  261. package/views/docs/controls/notice.md +4 -0
  262. package/views/docs/controls/number-editor.md +6 -0
  263. package/views/docs/controls/pane.md +4 -0
  264. package/views/docs/controls/picker.md +8 -0
  265. package/views/docs/controls/quick-filters.md +8 -0
  266. package/views/docs/controls/radio.md +4 -0
  267. package/views/docs/controls/select.md +8 -0
  268. package/views/docs/controls/sheet.md +4 -0
  269. package/views/docs/controls/sort-editor.md +8 -0
  270. package/views/docs/controls/text-editor.md +6 -0
  271. package/views/docs/controls/toolbar.md +4 -0
  272. package/views/docs/controls/values-editor.md +4 -0
  273. package/views/docs/controls/views-list.md +8 -0
  274. package/views/docs/guides/the-grid.md +2 -2
  275. package/views/docs/guides/the-provider.md +19 -2
  276. package/views/docs/reference/controls.md +11 -7
  277. package/views/docs/reference/field-row.md +1 -1
  278. package/views/docs/reference/grid.md +1 -1
  279. package/views/docs/reference/list.md +143 -11
  280. package/views/docs/reference/looks.md +1 -1
  281. package/views/docs/reference/panels-react.md +6 -5
  282. package/views/docs/reference/react.md +19 -12
  283. package/views/docs/reference/views.md +11 -5
  284. package/views/docs/reshaping.md +17 -1
  285. package/views/skills/views/SKILL.md +1 -1
@@ -4,17 +4,19 @@ import { resolveViewsMessage } from "../../contract.js";
4
4
  import { ViewsContext } from "../../provider/context.js";
5
5
  import { menuWordsOf } from "../picker/map-picker.js";
6
6
  import { Menu } from "./menu.js";
7
+ import { markOwnControl } from "../../provider/own-control.js";
7
8
  const NO_REASON = "Not now";
8
9
  const closingTick = (item) => item.checked !== undefined && !item.keepOpen && !item.children && !item.href && !item.disabled;
9
- function choiceOf(run) {
10
+ function choiceOf(run, rowSlot) {
10
11
  return {
11
12
  value: run.find((i) => i.checked)?.key ?? "",
12
- choices: run.map((i) => ({ value: i.key, label: i.label, mark: i.icon, ...(i.detail != null && { detail: i.detail }) })),
13
+ choices: run.map((i) => ({ value: i.key, label: i.label, mark: i.icon, ...(i.detail != null && { detail: i.detail }), ...named(rowSlot, i.key, i.slot) })),
13
14
  onChoose: (key) => run.find((i) => i.key === key)?.onSelect?.(),
14
15
  };
15
16
  }
17
+ const named = (rowSlot, key, own) => (own ? { slot: { slot: own, key } } : rowSlot ? { slot: { slot: rowSlot, key } } : {});
16
18
  const onlyTicks = (items) => (items.length > 0 && items.every(closingTick) && !items.slice(1).some((i) => i.separatorBefore) ? items : null);
17
- export function menuEntries(items, notNow = NO_REASON) {
19
+ export function menuEntries(items, notNow = NO_REASON, rowSlot) {
18
20
  const out = [];
19
21
  for (let at = 0; at < items.length;) {
20
22
  const item = items[at];
@@ -24,7 +26,7 @@ export function menuEntries(items, notNow = NO_REASON) {
24
26
  const run = [item];
25
27
  while (at + run.length < items.length && closingTick(items[at + run.length]) && !items[at + run.length].separatorBefore)
26
28
  run.push(items[at + run.length]);
27
- out.push({ kind: "pick", ...choiceOf(run) });
29
+ out.push({ kind: "pick", ...choiceOf(run, rowSlot) });
28
30
  at += run.length;
29
31
  continue;
30
32
  }
@@ -32,22 +34,23 @@ export function menuEntries(items, notNow = NO_REASON) {
32
34
  const ticks = item.children ? onlyTicks(item.children) : null;
33
35
  if (item.children && item.beside)
34
36
  out.push(ticks
35
- ? { kind: "choices", icon: item.icon ?? null, label: item.label, ...choiceOf(ticks), ...(item.detail != null && { detail: item.detail }) }
36
- : { kind: "actions", icon: item.icon ?? null, label: item.label, entries: menuEntries(item.children, notNow), ...(item.detail != null && { detail: item.detail }) });
37
+ ? { kind: "choices", icon: item.icon ?? null, label: item.label, ...choiceOf(ticks, rowSlot), ...(item.detail != null && { detail: item.detail }), ...named(rowSlot, item.key, item.slot) }
38
+ : { kind: "actions", icon: item.icon ?? null, label: item.label, entries: menuEntries(item.children, notNow, rowSlot), ...(item.detail != null && { detail: item.detail }), ...named(rowSlot, item.key, item.slot) });
37
39
  else if (item.children)
38
- out.push(ticks ? { kind: "pick", heading: item.label, ...choiceOf(ticks) } : { kind: "group", heading: item.label, entries: menuEntries(item.children, notNow) });
40
+ out.push(ticks ? { kind: "pick", heading: item.label, ...choiceOf(ticks, rowSlot) } : { kind: "group", heading: item.label, entries: menuEntries(item.children, notNow, rowSlot) });
39
41
  else if (item.checked !== undefined)
40
- out.push({ kind: "check", label: item.label, ...(item.icon != null && { icon: item.icon }), checked: item.checked, onCheckedChange: () => item.onSelect?.(), disabled: item.disabled ? item.disabledReason ?? notNow : undefined });
42
+ out.push({ kind: "check", label: item.label, ...(item.icon != null && { icon: item.icon }), checked: item.checked, onCheckedChange: () => item.onSelect?.(), disabled: item.disabled ? item.disabledReason ?? notNow : undefined, ...named(rowSlot, item.key, item.slot) });
41
43
  else if (item.href)
42
- out.push({ kind: "link", icon: item.icon ?? null, label: item.label, href: item.href, onSelect: () => item.onSelect?.() });
44
+ out.push({ kind: "link", icon: item.icon ?? null, label: item.label, href: item.href, onSelect: () => item.onSelect?.(), ...named(rowSlot, item.key, item.slot) });
43
45
  else
44
46
  out.push({ icon: item.icon ?? null, label: item.label, onSelect: item.onSelect, danger: item.destructive, disabled: item.disabled ? item.disabledReason ?? notNow : undefined,
45
- keys: item.shortcut ? [item.shortcut] : undefined, ...(item.render && { body: item.render() }) });
47
+ keys: item.shortcut ? [item.shortcut] : undefined, ...(item.render && { body: item.render() }), ...named(rowSlot, item.key, item.slot) });
46
48
  }
47
49
  return out;
48
50
  }
49
- export function MapMenu({ open, onOpenChange, anchor, items, side, align, label }) {
51
+ export function MapMenu({ open, onOpenChange, anchor, items, side, align, label, "data-slot": slot }) {
50
52
  const say = React.useContext(ViewsContext)?.messages ?? resolveViewsMessage;
51
53
  const words = React.useMemo(() => menuWordsOf(say), [say]);
52
- return _jsx(Menu, { words: words, entries: menuEntries(items, say({ key: "views.menus.not-now" })), label: label ?? "", open: open, onOpenChange: (next, d) => onOpenChange(next, { reason: d.reason }), anchor: anchor, side: side, align: align === "center" || align === undefined ? "start" : align });
54
+ return _jsx(Menu, { words: words, entries: menuEntries(items, say({ key: "views.menus.not-now" }), slot ? `${slot}-row` : undefined), "data-slot": slot, label: label ?? "", open: open, onOpenChange: (next, d) => onOpenChange(next, { reason: d.reason }), anchor: anchor, side: side, align: align === "center" || align === undefined ? "start" : align });
53
55
  }
56
+ markOwnControl(MapMenu);
@@ -17,6 +17,9 @@ export interface MenuProps {
17
17
  words?: MenuWords;
18
18
  /** What the menu is for, to screen readers ("Acme Robotics — service portal redesign"). */
19
19
  label: string;
20
+ /** Its public name where a part names it (VK-988: `vk-view-menu`; VK-1023: the bulk bar's `vk-bulk-menu`), on its popup on a
21
+ * computer and on its Sheet on a phone. */
22
+ "data-slot"?: string;
20
23
  /** What opens it: the ⋯ button by default (MenuDots), named "Actions for <label>". */
21
24
  trigger?: React.ReactElement;
22
25
  /** Where it opens when nothing of its own opens it: an element, a ref to one, or a point on the page (a right-click's),
@@ -44,7 +44,7 @@ function levelOf(entries, label) {
44
44
  }
45
45
  return undefined;
46
46
  }
47
- const pickerItems = (choices) => choices.map((c) => ({ value: c.value, label: c.label, line: c.detail, as: c.mark ? { mark: c.mark } : undefined }));
47
+ const pickerItems = (choices) => choices.map((c) => ({ value: c.value, label: c.label, line: c.detail, as: c.mark ? { mark: c.mark } : undefined, ...(c.slot ? { slot: c.slot } : {}) }));
48
48
  const NO_WORDS = {};
49
49
  const MenuWordsContext = React.createContext(NO_WORDS);
50
50
  function LevelPicker({ entry }) {
@@ -63,7 +63,7 @@ function LevelSheet({ index, at }) {
63
63
  at.shut(index); }, onOpenChangeComplete: (o) => { if (!o)
64
64
  at.gone(index); }, label: entry.label, form: entry.kind === "choices" ? "full" : at.form, container: at.container, standing: at.standing, children: [entry.kind === "choices" ? _jsx(LevelPicker, { entry: entry }) : _jsx(LevelActions, { entry: entry, index: index, at: at }), index + 1 < at.levels.length && _jsx(LevelSheet, { index: index + 1, at: at })] }));
65
65
  }
66
- function MenuSheet({ entries, label, trigger, anchor, open, defaultOpen, onOpenChange, defaultLevel, allRows, frame, words: said = NO_WORDS }) {
66
+ function MenuSheet({ entries, label, trigger, anchor, open, defaultOpen, onOpenChange, defaultLevel, allRows, frame, words: said = NO_WORDS, "data-slot": slot }) {
67
67
  const { ref, host } = usePickHost(), screen = React.useContext(PhoneHost), [mark, setMark] = React.useState(null);
68
68
  const first = () => { const l = levelOf(entries, defaultLevel); return l ? [{ entry: l, open: true }] : []; };
69
69
  const rows = useMenuListRows(mark), words = rows === "words", closeRow = useMenuListOption(mark, "close") === "shown" && !words;
@@ -78,16 +78,16 @@ function MenuSheet({ entries, label, trigger, anchor, open, defaultOpen, onOpenC
78
78
  const rowsList = _jsx(MenuList, { label: label, ...(words ? { entries: shutting } : tilesOf(shutting, allRows)), onOpen: at.openFrom(-1), onClose: closeRow ? () => set(false, "close-press") : undefined, closeWord: said.close });
79
79
  const list = frame ? _jsx("div", { ...frame, style: { display: "contents" }, children: rowsList }) : rowsList;
80
80
  return (_jsxs(_Fragment, { children: [_jsx("span", { ref: (el) => { ref.current = el; setMark(el); }, hidden: true, ...frame }), opener && React.cloneElement(opener, mergeProps({ "aria-haspopup": "dialog", "aria-expanded": shown, onClick: () => set(!shown, "trigger-press") }, opener.props)), _jsx(MenuWordsContext.Provider, { value: said, children: _jsxs(Sheet, { open: shown, onOpenChange: (o, d) => set(o, d.reason), onOpenChangeComplete: (o) => { if (!o)
81
- setLevels(first()); }, label: label, form: at.form, container: at.container, standing: at.standing, children: [_jsx(SheetBody, { children: list }), levels.length > 0 && _jsx(LevelSheet, { index: 0, at: at })] }, at.form) })] }));
81
+ setLevels(first()); }, label: label, form: at.form, container: at.container, standing: at.standing, "data-slot": slot, children: [_jsx(SheetBody, { children: list }), levels.length > 0 && _jsx(LevelSheet, { index: 0, at: at })] }, at.form) })] }));
82
82
  }
83
83
  export function Menu(props) {
84
84
  return useSheetMenus() && !props.popup ? _jsx(MenuSheet, { ...props }) : _jsx(MenuPopup, { ...props });
85
85
  }
86
86
  export const useSheetMenus = () => { const phone = usePhone(), screen = React.useContext(PhoneHost); return phone || !!screen; };
87
- function MenuPopup({ entries, label, trigger, anchor, align = "end", side, open, defaultOpen, onOpenChange, finalFocus, standing }) {
87
+ function MenuPopup({ entries, label, trigger, anchor, align = "end", side, open, defaultOpen, onOpenChange, finalFocus, standing, "data-slot": slot }) {
88
88
  const { ref, host } = usePickHost(), anchored = anchor !== undefined, point = !!anchor && !isElement(anchor) && !("current" in anchor);
89
89
  const [at, setAt] = React.useState(null), mark = phoneMark(usePhoneForm());
90
- return (_jsxs(BaseMenu.Root, { open: open, defaultOpen: defaultOpen, modal: !standing, onOpenChange: onOpenChange ? (o, d) => onOpenChange(o, { reason: closeReasonOf(d.reason) }) : undefined, children: [_jsx("span", { ref: ref, hidden: true }), !anchored && _jsx(BaseMenu.Trigger, { render: trigger ?? _jsx(MenuDots, { label: `Actions for ${label}` }) }), _jsx(BaseMenu.Portal, { container: host, className: "o-menu-portal", children: _jsx(BaseMenu.Positioner, { ref: setAt, className: "o-list-positioner", sideOffset: point ? 0 : spacingPx(1, at ?? host), side: side, align: align, collisionPadding: spacingPx(2, at ?? host), anchor: anchored ? positionerAnchor(anchor) : undefined, children: _jsx(BaseMenu.Popup, { className: "o-list o-menu o-smooth o-smooth-ease", "aria-label": label, "data-kit": "menu", ...mark, finalFocus: finalFocus, children: _jsx(MenuScroll, { children: _jsx(MenuListRows, { entries: entries, host: host }) }) }) }) })] }));
90
+ return (_jsxs(BaseMenu.Root, { open: open, defaultOpen: defaultOpen, modal: !standing, onOpenChange: onOpenChange ? (o, d) => onOpenChange(o, { reason: closeReasonOf(d.reason) }) : undefined, children: [_jsx("span", { ref: ref, hidden: true }), !anchored && _jsx(BaseMenu.Trigger, { render: trigger ?? _jsx(MenuDots, { label: `Actions for ${label}` }) }), _jsx(BaseMenu.Portal, { container: host, className: "o-menu-portal", children: _jsx(BaseMenu.Positioner, { ref: setAt, className: "o-list-positioner", sideOffset: point ? 0 : spacingPx(1, at ?? host), side: side, align: align, collisionPadding: spacingPx(2, at ?? host), anchor: anchored ? positionerAnchor(anchor) : undefined, children: _jsx(BaseMenu.Popup, { className: "o-list o-menu o-smooth o-smooth-ease", "aria-label": label, "data-slot": slot, "data-kit": "menu", ...mark, finalFocus: finalFocus, children: _jsx(MenuScroll, { children: _jsx(MenuListRows, { entries: entries, host: host }) }) }) }) })] }));
91
91
  }
92
92
  export function ContextMenu(props) {
93
93
  return useSheetMenus() ? _jsx(ContextMenuSheet, { ...props }) : _jsx(ContextMenuPopup, { ...props });
@@ -1,16 +1,22 @@
1
1
  import * as React from "react";
2
+ import { type PartSlot } from "../internal/part-slot.js";
2
3
  import { type MenuListLookOptionId } from "./looks.js";
3
4
  /** A choice: its value, its name, and its mark (a stage's glyph, a person's face, an icon). */
4
5
  export interface MenuChoice {
5
6
  value: string;
6
7
  label: string;
7
8
  mark?: React.ReactNode;
9
+ /** Its public name and which one it is (VK-988): drawn on its row as `data-slot` and `data-key`. */
10
+ slot?: PartSlot;
8
11
  /** What it reads as, in words, quiet at its end before its tick: a date style's sample ("14/11/2026"). */
9
12
  detail?: string;
10
13
  }
11
14
  /** A row of the menu, in the order it shows: what's done most first, related rows between lines, the one
12
- * that takes something away last. */
13
- export type MenuEntry =
15
+ * that takes something away last. `slot`, its public name and which one it is (VK-988), drawn on its row in every form as
16
+ * `data-slot`, `data-key` and `data-index`; a `pick` or a `group` names its rows through its choices or its entries. */
17
+ export type MenuEntry = ({
18
+ slot?: PartSlot;
19
+ } & (
14
20
  /** An action: its icon and name, its keys when a shortcut works (["⌘", "L"]); `danger` when it takes
15
21
  * something away; `disabled` says why it can't be used, as its tooltip. A name that opens something
16
22
  * else before it acts ends in "…". */
@@ -88,7 +94,7 @@ MenuAction
88
94
  kind: "group";
89
95
  heading: string;
90
96
  entries: MenuEntry[];
91
- } | {
97
+ })) | {
92
98
  kind: "separator";
93
99
  };
94
100
  type MenuAction = {
@@ -192,15 +198,19 @@ export interface MenuListTile {
192
198
  label: string;
193
199
  disabled?: boolean;
194
200
  onSelect?: () => void;
201
+ slot?: PartSlot;
195
202
  }
196
203
  /** A name and its value, as one row standing alone: the choices row with no arrow and no list round it, at the list's own
197
204
  * height and inset (menu-list.css), which what holds it may set (`--menu-list-row`, `--menu-list-inset`). Pressing it is its
198
205
  * holder's: the Date editor's time row on a phone opens the time's wheels. */
199
- export declare function MenuListRow({ label, value, onSelect, className }: {
206
+ export declare function MenuListRow({ label, value, onSelect, className, ...part }: {
200
207
  label: string;
201
208
  value: React.ReactNode;
202
209
  onSelect?: () => void;
203
210
  className?: string;
211
+ /** Its public name and which one it is (VK-989): a field editor's row (the date's time on a phone). */
212
+ "data-slot"?: string;
213
+ "data-key"?: string;
204
214
  }): import("react/jsx-runtime").JSX.Element;
205
215
  export interface MenuListProps {
206
216
  /** What it acts on, to a screen reader. */
@@ -7,6 +7,7 @@ import { CheckboxMark } from "../checkbox/checkbox.js";
7
7
  import { GRIP, Grip } from "../grip/grip.js";
8
8
  import { useHoldDrag } from "../internal/hold.js";
9
9
  import { Icon, iconPaths } from "../internal/icons.js";
10
+ import { partAttrs } from "../internal/part-slot.js";
10
11
  import { phoneMark, usePhoneForm } from "../internal/phone.js";
11
12
  import { msOf, pxOf, spacingPx } from "../internal/read-token.js";
12
13
  import { useReorder } from "../internal/reorder.js";
@@ -75,7 +76,7 @@ function Says({ id, how, said }) {
75
76
  const choiceBody = (c) => _jsxs(_Fragment, { children: [c.mark, _jsx("span", { className: "o-menu-name", children: c.label }), c.detail != null && _jsx("span", { className: "o-menu-detail", children: c.detail }), strokeGlyph(TICK, "o-list-tick", 2.25)] });
76
77
  const rowClass = (e) => cx("o-list-row o-smooth o-smooth-ease o-menu-row", e.danger && "o-menu-danger");
77
78
  export const MenuScroll = ({ children }) => _jsxs(_Fragment, { children: [_jsx("div", { className: "o-menu-list-scroll", children: children }), _jsx(Scrollbar, {})] });
78
- function Sub({ trigger, host, children }) {
79
+ function Sub({ trigger, host, slot, children }) {
79
80
  const row = React.useRef(null), mark = phoneMark(usePhoneForm());
80
81
  const [at, setAt] = React.useState({ delay: 0, step: 0, edge: 0 });
81
82
  React.useLayoutEffect(() => {
@@ -85,7 +86,7 @@ function Sub({ trigger, host, children }) {
85
86
  if (el)
86
87
  setAt({ delay: msOf(el, "--menu-sub-wait"), step: Number.isNaN(pad) ? spacingPx(1, el) : pad, edge: pxOf(el, "--vk-border-width") });
87
88
  }, []);
88
- return (_jsxs(BaseMenu.SubmenuRoot, { children: [_jsx(BaseMenu.SubmenuTrigger, { ref: row, delay: at.delay, className: "o-list-row o-smooth o-smooth-ease o-menu-row", children: trigger }), _jsx(BaseMenu.Portal, { container: host, className: "o-menu-portal", children: _jsx(BaseMenu.Positioner, { className: "o-list-positioner", side: "right", align: "start", sideOffset: at.step, alignOffset: -(at.step + at.edge), children: _jsx(BaseMenu.Popup, { className: "o-list o-menu o-smooth o-smooth-ease", "data-kit": "menu", ...mark, children: _jsx(MenuScroll, { children: children }) }) }) })] }));
89
+ return (_jsxs(BaseMenu.SubmenuRoot, { children: [_jsx(BaseMenu.SubmenuTrigger, { ref: row, delay: at.delay, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...partAttrs(slot), children: trigger }), _jsx(BaseMenu.Portal, { container: host, className: "o-menu-portal", children: _jsx(BaseMenu.Positioner, { className: "o-list-positioner", side: "right", align: "start", sideOffset: at.step, alignOffset: -(at.step + at.edge), children: _jsx(BaseMenu.Popup, { className: "o-list o-menu o-smooth o-smooth-ease", "data-kit": "menu", ...mark, children: _jsx(MenuScroll, { children: children }) }) }) })] }));
89
90
  }
90
91
  export function MenuListRows({ entries, host }) {
91
92
  return _jsx(_Fragment, { children: entries.map((e, i) => {
@@ -94,22 +95,22 @@ export function MenuListRows({ entries, host }) {
94
95
  if (e.kind === "group")
95
96
  return (_jsxs(BaseMenu.Group, { children: [_jsx(BaseMenu.GroupLabel, { className: "o-list-heading", children: e.heading }), _jsx(MenuListRows, { entries: e.entries, host: host })] }, i));
96
97
  if (e.kind === "check")
97
- return (_jsx(BaseMenu.CheckboxItem, { label: e.label, checked: e.checked, defaultChecked: e.defaultChecked, onCheckedChange: (c) => e.onCheckedChange?.(c), disabled: !!e.disabled, title: e.disabled, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-check", children: checkBody(e) }, i));
98
+ return (_jsx(BaseMenu.CheckboxItem, { label: e.label, checked: e.checked, defaultChecked: e.defaultChecked, onCheckedChange: (c) => e.onCheckedChange?.(c), disabled: !!e.disabled, title: e.disabled, className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-check", ...partAttrs(e.slot), children: checkBody(e) }, i));
98
99
  if (e.kind === "link")
99
- return (_jsx(BaseMenu.LinkItem, { href: e.href, render: e.render, label: e.label, onClick: e.onSelect, closeOnClick: true, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...(e.external ? { target: "_blank", rel: "noreferrer" } : {}), children: linkBody(e) }, i));
100
+ return (_jsx(BaseMenu.LinkItem, { href: e.href, render: e.render, label: e.label, onClick: e.onSelect, closeOnClick: true, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...partAttrs(e.slot), ...(e.external ? { target: "_blank", rel: "noreferrer" } : {}), children: linkBody(e) }, i));
100
101
  if (e.kind === "actions")
101
- return _jsx(Sub, { trigger: actionsBody(e), host: host, children: _jsx(MenuListRows, { entries: e.entries, host: host }) }, i);
102
+ return _jsx(Sub, { trigger: actionsBody(e), host: host, slot: e.slot, children: _jsx(MenuListRows, { entries: e.entries, host: host }) }, i);
102
103
  if (e.kind === "pick")
103
- return (_jsxs(BaseMenu.Group, { children: [e.heading && _jsx(BaseMenu.GroupLabel, { className: "o-list-heading", children: e.heading }), _jsx(BaseMenu.RadioGroup, { value: e.value, onValueChange: (v) => e.onChoose?.(v), children: e.choices.map((c) => _jsx(BaseMenu.RadioItem, { value: c.value, closeOnClick: true, className: "o-list-row o-smooth o-smooth-ease o-menu-row", children: choiceBody(c) }, c.value)) })] }, i));
104
+ return (_jsxs(BaseMenu.Group, { children: [e.heading && _jsx(BaseMenu.GroupLabel, { className: "o-list-heading", children: e.heading }), _jsx(BaseMenu.RadioGroup, { value: e.value, onValueChange: (v) => e.onChoose?.(v), children: e.choices.map((c) => _jsx(BaseMenu.RadioItem, { value: c.value, closeOnClick: true, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...partAttrs(c.slot), children: choiceBody(c) }, c.value)) })] }, i));
104
105
  if (e.kind === "choices")
105
- return (_jsx(Sub, { trigger: choicesBody(e), host: host, children: _jsx(BaseMenu.RadioGroup, { value: e.value, onValueChange: (v) => e.onChoose?.(v), children: e.choices.map((c) => _jsx(BaseMenu.RadioItem, { value: c.value, label: c.label, closeOnClick: true, className: "o-list-row o-smooth o-smooth-ease o-menu-row", children: choiceBody(c) }, c.value)) }) }, i));
106
- return _jsx(BaseMenu.Item, { label: e.label, "aria-label": e.body !== undefined ? e.label : undefined, className: rowClass(e), disabled: !!e.disabled, title: e.disabled, onClick: e.onSelect, children: actionBody(e) }, i);
106
+ return (_jsx(Sub, { trigger: choicesBody(e), host: host, slot: e.slot, children: _jsx(BaseMenu.RadioGroup, { value: e.value, onValueChange: (v) => e.onChoose?.(v), children: e.choices.map((c) => _jsx(BaseMenu.RadioItem, { value: c.value, label: c.label, closeOnClick: true, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...partAttrs(c.slot), children: choiceBody(c) }, c.value)) }) }, i));
107
+ return _jsx(BaseMenu.Item, { label: e.label, "aria-label": e.body !== undefined ? e.label : undefined, className: rowClass(e), disabled: !!e.disabled, title: e.disabled, onClick: e.onSelect, ...partAttrs(e.slot), children: actionBody(e) }, i);
107
108
  }) });
108
109
  }
109
110
  export function MenuListShown({ entries, label, open, on = [], className }) {
110
111
  const lit = (name) => (on.includes(name) ? { "data-force": "hover" } : {}), mark = phoneMark(usePhoneForm());
111
112
  const panel = (rows, cls = "") => _jsx("div", { className: cx("o-list o-menu o-smooth o-smooth-ease", cls), role: "menu", "aria-label": label, "data-kit": "menu", ...mark, children: rows });
112
- const choiceRows = (e, prefix = "") => e.choices.map((c) => (_jsx("div", { role: "menuitemradio", "aria-checked": c.value === e.value, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...lit(prefix + c.label), children: choiceBody(c) }, c.value)));
113
+ const choiceRows = (e, prefix = "") => e.choices.map((c) => (_jsx("div", { role: "menuitemradio", "aria-checked": c.value === e.value, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...partAttrs(c.slot), ...lit(prefix + c.label), children: choiceBody(c) }, c.value)));
113
114
  const rows = (list, prefix = "") => list.map((e, i) => {
114
115
  if (e.kind === "separator")
115
116
  return _jsx("div", { role: "separator", className: "o-list-sep" }, i);
@@ -119,13 +120,13 @@ export function MenuListShown({ entries, label, open, on = [], className }) {
119
120
  return _jsxs(React.Fragment, { children: [_jsx("p", { className: "o-list-heading", children: e.heading }), rows(e.entries, prefix)] }, i);
120
121
  if (e.kind === "check") {
121
122
  const ticked = !!(e.checked ?? e.defaultChecked);
122
- return _jsx("div", { role: "menuitemcheckbox", "aria-checked": ticked, "aria-disabled": e.disabled ? true : undefined, title: e.disabled, ...(e.disabled ? { "data-disabled": "" } : {}), className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-check", ...lit(prefix + e.label), children: checkBody(e) }, i);
123
+ return _jsx("div", { role: "menuitemcheckbox", "aria-checked": ticked, "aria-disabled": e.disabled ? true : undefined, title: e.disabled, ...(e.disabled ? { "data-disabled": "" } : {}), className: "o-list-row o-smooth o-smooth-ease o-menu-row o-menu-check", ...partAttrs(e.slot), ...lit(prefix + e.label), children: checkBody(e) }, i);
123
124
  }
124
125
  if (e.kind === "link")
125
- return _jsx("div", { role: "menuitem", className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...lit(prefix + e.label), children: linkBody(e) }, i);
126
+ return _jsx("div", { role: "menuitem", className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...partAttrs(e.slot), ...lit(prefix + e.label), children: linkBody(e) }, i);
126
127
  if (e.kind === "choices" || e.kind === "actions")
127
- return (_jsxs("div", { className: "o-menu-subwrap", children: [_jsx("div", { role: "menuitem", "aria-haspopup": "menu", "aria-expanded": open === e.label, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...(open === e.label ? { "data-popup-open": "" } : lit(prefix + e.label)), children: e.kind === "choices" ? choicesBody(e) : actionsBody(e) }), open === e.label && panel(e.kind === "choices" ? choiceRows(e, `${e.label}/`) : rows(e.entries, `${e.label}/`), "o-menu-sub")] }, i));
128
- return _jsx("div", { role: "menuitem", "aria-disabled": e.disabled ? true : undefined, title: e.disabled, ...(e.disabled ? { "data-disabled": "" } : {}), className: rowClass(e), ...lit(prefix + e.label), children: actionBody(e) }, i);
128
+ return (_jsxs("div", { className: "o-menu-subwrap", children: [_jsx("div", { role: "menuitem", "aria-haspopup": "menu", "aria-expanded": open === e.label, className: "o-list-row o-smooth o-smooth-ease o-menu-row", ...partAttrs(e.slot), ...(open === e.label ? { "data-popup-open": "" } : lit(prefix + e.label)), children: e.kind === "choices" ? choicesBody(e) : actionsBody(e) }), open === e.label && panel(e.kind === "choices" ? choiceRows(e, `${e.label}/`) : rows(e.entries, `${e.label}/`), "o-menu-sub")] }, i));
129
+ return _jsx("div", { role: "menuitem", "aria-disabled": e.disabled ? true : undefined, title: e.disabled, ...(e.disabled ? { "data-disabled": "" } : {}), className: rowClass(e), ...partAttrs(e.slot), ...lit(prefix + e.label), children: actionBody(e) }, i);
129
130
  });
130
131
  const menu = panel(rows(entries), className);
131
132
  return open ? _jsx("div", { className: "o-menu-pair", children: menu }) : menu;
@@ -236,7 +237,7 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
236
237
  firstGrip.current = i;
237
238
  return {
238
239
  ...(g >= 0 ? { "data-row": g, ...(dragging === g ? { "data-lifted": "" } : {}), style: lift(g), "aria-labelledby": named(`${ids}r${g}`), "aria-describedby": `${ids}how` } : {}),
239
- "data-item": "", tabIndex: i === stop ? 0 : -1, ...(lit === i ? { "data-highlighted": "" } : {}),
240
+ ...partAttrs(e && "slot" in e ? e.slot : undefined), "data-item": "", tabIndex: i === stop ? 0 : -1, ...(lit === i ? { "data-highlighted": "" } : {}),
240
241
  onFocus: () => { setStop(i); setLit(i); focusIn.current = true; },
241
242
  onPointerMove: (ev) => {
242
243
  if (lit !== i)
@@ -275,7 +276,7 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
275
276
  if (e.kind === "group")
276
277
  return _jsxs("div", { role: "group", "aria-label": e.heading, children: [_jsx("p", { className: "o-list-heading", children: e.heading }), rows(e.entries)] }, k);
277
278
  if (e.kind === "pick")
278
- return (_jsxs("div", { role: "group", "aria-label": e.heading, children: [e.heading && _jsx("p", { className: "o-list-heading", children: e.heading }), e.choices.map((c) => _jsx("div", { role: "menuitemradio", "aria-checked": c.value === e.value, ...item(), onClick: () => e.onChoose?.(c.value), className: ROW, children: choiceBody(c) }, c.value))] }, k));
279
+ return (_jsxs("div", { role: "group", "aria-label": e.heading, children: [e.heading && _jsx("p", { className: "o-list-heading", children: e.heading }), e.choices.map((c) => _jsx("div", { role: "menuitemradio", "aria-checked": c.value === e.value, ...item(), ...partAttrs(c.slot), onClick: () => e.onChoose?.(c.value), className: ROW, children: choiceBody(c) }, c.value))] }, k));
279
280
  if (e.kind === "check")
280
281
  return _jsx(PanelCheck, { e: e, item: item(e), ticks: ticks, grip: gripFor(e), id: idOf(e), words: w, onOpen: () => onOpen?.(e) }, k);
281
282
  if (e.kind === "link") {
@@ -295,7 +296,7 @@ export function tilesOf(entries, allRows) {
295
296
  const plain = entries.filter((e) => (e.kind === undefined || e.kind === "action") && !e.danger && !e.disabled && e.count == null && e.body === undefined).slice(0, 4);
296
297
  if (plain.length < 3)
297
298
  return { entries };
298
- return { tiles: plain.map((e) => ({ icon: e.icon, label: e.label, onSelect: e.onSelect })), entries: entries.filter((e) => !plain.includes(e)) };
299
+ return { tiles: plain.map((e) => ({ icon: e.icon, label: e.label, onSelect: e.onSelect, ...(e.slot ? { slot: e.slot } : {}) })), entries: entries.filter((e) => !plain.includes(e)) };
299
300
  }
300
301
  function sectionsOf(entries) {
301
302
  const out = [];
@@ -314,7 +315,7 @@ function sectionsOf(entries) {
314
315
  }
315
316
  if (e.kind === "pick") {
316
317
  end();
317
- out.push({ name: e.heading, rows: e.choices.map((c) => ({ kind: "picked", label: c.label, icon: c.mark, chosen: c.value === e.value, onSelect: () => e.onChoose?.(c.value), end: c.detail })) });
318
+ out.push({ name: e.heading, rows: e.choices.map((c) => ({ kind: "picked", label: c.label, icon: c.mark, chosen: c.value === e.value, onSelect: () => e.onChoose?.(c.value), end: c.detail, ...(c.slot ? { slot: c.slot } : {}) })) });
318
319
  continue;
319
320
  }
320
321
  now.push(e);
@@ -328,7 +329,7 @@ const endOf = (r) => {
328
329
  return end != null ? _jsx("span", { className: "o-menu-list-end", "data-on": r.kind === "actions" && r.inForce ? "" : undefined, children: end }) : null;
329
330
  };
330
331
  function PhoneRow({ row, onOpen, move, room, ticks = "switch", words = MENU_LIST_WORDS }) {
331
- const mv = move ? { "data-row": move.at, ...(move.lifted ? { "data-lifted": "" } : {}), style: move.style, ...move.drag } : {};
332
+ const mv = { ...partAttrs(row.slot), ...(move ? { "data-row": move.at, ...(move.lifted ? { "data-lifted": "" } : {}), style: move.style, ...move.drag } : {}) };
332
333
  const how = move ? { "aria-describedby": move.how } : {};
333
334
  const lead = move ? glyph(GRIP, "o-menu-list-grip") : room ? React.cloneElement(glyph(GRIP, "o-menu-list-grip"), { "data-room": "" }) : null;
334
335
  const tickId = React.useId(), named = row.kind === "check" && row.toggle ? { label: { htmlFor: tickId }, tick: { id: tickId } } : { label: {}, tick: {} };
@@ -342,7 +343,7 @@ function PhoneRow({ row, onOpen, move, room, ticks = "switch", words = MENU_LIST
342
343
  return row.render ? React.cloneElement(row.render, attrs, inside) : _jsx("a", { href: row.href, ...attrs, children: inside });
343
344
  }
344
345
  if (row.kind === "picked")
345
- return _jsxs(BaseButton, { className: "o-menu-list-row", "aria-pressed": row.chosen, onClick: row.onSelect, children: [body(row), endOf(row), row.chosen && glyph(TICK, "o-menu-list-tick")] });
346
+ return _jsxs(BaseButton, { className: "o-menu-list-row", ...partAttrs(row.slot), "aria-pressed": row.chosen, onClick: row.onSelect, children: [body(row), endOf(row), row.chosen && glyph(TICK, "o-menu-list-tick")] });
346
347
  if (row.kind === "actions")
347
348
  return _jsxs(BaseButton, { className: "o-menu-list-row", ...mv, ...how, onClick: () => onOpen?.(row), children: [lead, body(row), endOf(row), glyph(MORE, "o-menu-list-more")] });
348
349
  if (row.kind === "choices")
@@ -350,8 +351,8 @@ function PhoneRow({ row, onOpen, move, room, ticks = "switch", words = MENU_LIST
350
351
  const own = "body" in row && row.body !== undefined ? _jsxs("span", { className: "o-menu-list-name", children: [row.body, row.disabled != null && _jsx("span", { className: "o-menu-list-note", children: row.disabled })] }) : null;
351
352
  return _jsxs(BaseButton, { className: cx("o-menu-list-row", row.danger && "o-menu-list-danger"), ...mv, ...how, disabled: !!row.disabled, onClick: row.onSelect, "aria-label": own ? row.label : undefined, children: [lead, own ?? body(row, row.disabled), own ? null : endOf(row)] });
352
353
  }
353
- export function MenuListRow({ label, value, onSelect, className }) {
354
- return _jsxs(BaseButton, { className: cx("o-menu-list-row", className), onClick: onSelect, children: [_jsx("span", { className: "o-menu-list-name", children: _jsx("span", { children: label }) }), _jsx("span", { className: "o-menu-list-value", children: value })] });
354
+ export function MenuListRow({ label, value, onSelect, className, ...part }) {
355
+ return _jsxs(BaseButton, { className: cx("o-menu-list-row", className), ...part, onClick: onSelect, children: [_jsx("span", { className: "o-menu-list-name", children: _jsx("span", { children: label }) }), _jsx("span", { className: "o-menu-list-value", children: value })] });
355
356
  }
356
357
  function PhoneEye({ row, lead, mv, how, onOpen }) {
357
358
  const [own, setOwn] = React.useState(!!row.defaultChecked), on = row.checked ?? own;
@@ -370,7 +371,7 @@ export function MenuList({ label, entries, tiles, onOpen, onClose, closeWord = "
370
371
  const at = gripped.indexOf(r);
371
372
  return at < 0 ? undefined : { at, lifted: dragging === at, style: lift(at), drag: phoneDrag(at), how: `${ids}how` };
372
373
  };
373
- return (_jsxs("div", { ref: root, role: "group", "aria-label": label, className: cx("o-menu-list", className), "data-kit": "menu-list", children: [onClose && _jsx("div", { className: "o-menu-list-section", children: _jsx(PhoneRow, { row: { icon: _jsx(Icon, { name: "x", size: 22 }), label: closeWord, onSelect: onClose } }) }), tiles && (_jsx("div", { className: "o-menu-list-tiles", children: tiles.map((t) => _jsxs(BaseButton, { className: "o-menu-list-tile", disabled: t.disabled, onClick: t.onSelect, children: [_jsx("span", { className: "o-menu-list-mark", children: t.icon }), _jsx("span", { className: "o-menu-list-tile-name", children: t.label })] }, t.label)) })), sections.map((s, i) => {
374
+ return (_jsxs("div", { ref: root, role: "group", "aria-label": label, className: cx("o-menu-list", className), "data-kit": "menu-list", children: [onClose && _jsx("div", { className: "o-menu-list-section", children: _jsx(PhoneRow, { row: { icon: _jsx(Icon, { name: "x", size: 22 }), label: closeWord, onSelect: onClose } }) }), tiles && (_jsx("div", { className: "o-menu-list-tiles", children: tiles.map((t) => _jsxs(BaseButton, { className: "o-menu-list-tile", ...partAttrs(t.slot), disabled: t.disabled, onClick: t.onSelect, children: [_jsx("span", { className: "o-menu-list-mark", children: t.icon }), _jsx("span", { className: "o-menu-list-tile-name", children: t.label })] }, t.label)) })), sections.map((s, i) => {
374
375
  const card = (_jsx("div", { role: s.name ? "group" : undefined, "aria-labelledby": s.name ? `${ids}h${i}` : undefined, className: "o-menu-list-section", children: s.rows.map((r) => _jsx(PhoneRow, { row: r, onOpen: onOpen, move: moveOf(r), room: gripped.length > 0, ticks: ticks, words: w }, r.label)) }, s.name ?? i));
375
376
  return s.name ? _jsxs("div", { className: "o-menu-list-group", children: [_jsx("p", { id: `${ids}h${i}`, className: "o-list-heading", children: s.name }), card] }, `${i}${s.name}`) : card;
376
377
  }), gripped.length > 0 && _jsx(Says, { id: `${ids}how`, how: w.howHold, said: said })] }));
@@ -2,14 +2,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import * as React from "react";
3
3
  import { Dialog as BaseDialog } from "@base-ui/react/dialog";
4
4
  import { AlertDialog } from "../alert-dialog/alert-dialog.js";
5
- import { Button } from "../button/button.js";
5
+ import { PanelHeadButton } from "../internal/head-button.js";
6
6
  import { useKeptFocus } from "../internal/keep-focus.js";
7
+ import { usePanelControls } from "../internal/panel-controls.js";
7
8
  import { PhoneHost, usePhone } from "../internal/phone.js";
8
9
  import { OutOfFieldRows } from "../../internal/field-rows.js";
9
10
  import { usePopupHost } from "../internal/popup-host.js";
10
11
  import { Notice } from "../notice/notice.js";
11
12
  import { Scrollbar } from "../scrollbar/scrollbar.js";
12
- import { Sheet, SheetBody, SheetButton, SheetHead } from "../sheet/bottom-sheet.js";
13
+ import { Sheet, SheetBody, SheetHead } from "../sheet/bottom-sheet.js";
13
14
  const glyph = (paths) => _jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths.map((d) => _jsx("path", { d: d }, d)) });
14
15
  const X = ["M18 6l-12 12", "M6 6l12 12"], CHECK = ["M5 12l5 5l10 -10"], NEXT = ["M9 6l6 6l-6 6"];
15
16
  const EXPAND = ["M16 4l4 0l0 4", "M14 10l6 -6", "M8 20l-4 0l0 -4", "M4 20l6 -6"];
@@ -24,6 +25,7 @@ export const MODAL_WORDS = {
24
25
  };
25
26
  export function Modal({ open, onOpenChange, title, mark, path, onOpenAsPage, size = "md", foot = "both", action, cancel = "Cancel", footStart, dirty, state, failed, container, standing, children, words }) {
26
27
  const said = { ...MODAL_WORDS, ...words };
28
+ const { Button } = usePanelControls();
27
29
  const ref = React.useRef(null), host = usePopupHost(ref), body = React.useRef(null);
28
30
  const small = usePhone(), screen = React.useContext(PhoneHost), phone = small || !!screen;
29
31
  const [own, setOwn] = React.useState("rest"), [why, setWhy] = React.useState(null), [asking, setAsking] = React.useState(false);
@@ -60,7 +62,7 @@ export function Modal({ open, onOpenChange, title, mark, path, onOpenAsPage, siz
60
62
  onOpenChange(false); }, title: said.discardTitle, line: said.discardLine, action: said.discard, kind: "danger", cancel: said.keepEditing, container: where, standing: standing }));
61
63
  if (phone)
62
64
  return (_jsxs(_Fragment, { children: [_jsx("span", { ref: ref, hidden: true }), _jsxs(Sheet, { open: open, onOpenChange: (o) => { if (!o)
63
- leave(); }, label: title, form: "full", container: where, standing: standing, children: [_jsx(SheetHead, { title: title, left: _jsx(SheetButton, { "aria-label": cancel, icon: glyph(X), onClick: leave, disabled: saving }), right: foot !== "none" && action ? _jsx(SheetButton, { kind: "primary", "aria-label": action.label, icon: glyph(CHECK), onClick: act, disabled: saving || action.disabled }) : _jsx("span", {}) }), _jsxs(SheetBody, { children: [notice, children] }), guard] })] }));
65
+ leave(); }, label: title, form: "full", container: where, standing: standing, children: [_jsx(SheetHead, { title: title, left: _jsx(PanelHeadButton, { "aria-label": cancel, icon: glyph(X), onClick: leave, disabled: saving }), right: foot !== "none" && action ? _jsx(PanelHeadButton, { kind: "primary", "aria-label": action.label, icon: glyph(CHECK), onClick: act, disabled: saving || action.disabled }) : _jsx("span", {}) }), _jsxs(SheetBody, { children: [notice, children] }), guard] })] }));
64
66
  return (_jsxs(_Fragment, { children: [_jsx("span", { ref: ref, hidden: true }), _jsx(BaseDialog.Root, { open: open, onOpenChange: (o) => { if (!o)
65
67
  leave(); }, ...(standing ? { modal: false, disablePointerDismissal: true } : {}), children: _jsxs(BaseDialog.Portal, { container: where, children: [_jsx(BaseDialog.Backdrop, { className: "o-modal-backdrop", "data-over-popup": over }), _jsx(BaseDialog.Viewport, { className: "o-modal-viewport", "data-over-popup": over, children: _jsxs(BaseDialog.Popup, { ref: setPopup, className: "o-modal", "data-kit": "modal", "data-width": size, "aria-busy": saving || undefined, initialFocus: standing ? false : () => body.current?.querySelector("input:not([type=hidden]), textarea, [role='combobox'], .o-select-field") ?? true, children: [_jsxs("div", { className: "o-modal-cut o-smooth", children: [_jsxs("header", { className: "o-modal-head", children: [mark != null && _jsx("span", { className: "o-modal-mark", "aria-hidden": "true", children: mark }), path && _jsxs("span", { className: "o-modal-path", children: [_jsxs("span", { className: "o-modal-chip", children: [path.icon, _jsx("span", { className: "o-modal-chip-word", children: path.label })] }), glyph(NEXT)] }), _jsx(BaseDialog.Title, { className: "o-modal-title", children: title }), _jsxs("span", { className: "o-modal-tools", children: [onOpenAsPage && _jsx(Button, { kind: "quiet", shape: "icon", size: "xs", "aria-label": said.openAsPage, icon: glyph(EXPAND), onClick: onOpenAsPage }), _jsx(Button, { kind: "quiet", shape: "icon", size: "xs", "aria-label": said.close, icon: glyph(X), disabled: saving, onClick: leave })] })] }), _jsx("div", { ref: body, className: "o-modal-body", children: _jsxs(OutOfFieldRows, { children: [notice, children] }) }), _jsx(Scrollbar, { drawn: true }), foot !== "none" && (_jsxs("footer", { className: "o-modal-foot", children: [footStart != null && _jsx("span", { className: "o-modal-start", children: footStart }), _jsxs("span", { className: "o-modal-end", children: [foot === "both" && _jsx(Button, { className: "o-modal-cancel", disabled: saving, onClick: leave, children: cancel }), action && _jsx(Button, { kind: action.kind ?? "primary", loading: saving, disabled: action.disabled, onClick: act, children: action.label })] })] }))] }), guard] }) })] }) })] }));
66
68
  }
@@ -41,9 +41,11 @@ export interface NoticeProps {
41
41
  className?: string;
42
42
  /** Its × drawn as under the pointer or in focus, as a page that shows it draws it. */
43
43
  "data-force"?: "hover" | "focus";
44
+ /** Its public name where a panel names it (VK-988): `vk-customize-stale`, say. */
45
+ "data-slot"?: string;
44
46
  /** Its own words, over the English: Retry, Retrying…, and the ×'s name. */
45
47
  words?: Partial<NoticeWords>;
46
48
  }
47
49
  /** A sentence set into the page on its meaning's ground: worth knowing, done, careful, wrong or a plain fact (neutral). It can
48
50
  * carry what to do about it, a title, or a way to put it away. */
49
- export declare function Notice({ meaning, icon, title, children, actions, onRetry, dismissible, onDismiss, urgent, arrived, className, "data-force": force, words }: NoticeProps): import("react/jsx-runtime").JSX.Element | null;
51
+ export declare function Notice({ meaning, icon, title, children, actions, onRetry, dismissible, onDismiss, urgent, arrived, className, "data-force": force, "data-slot": slot, words }: NoticeProps): import("react/jsx-runtime").JSX.Element | null;
@@ -13,7 +13,7 @@ const X = ["M18 6l-12 12", "M6 6l12 12"];
13
13
  const glyph = (paths, className, strokeWidth = 2) => (_jsx("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: strokeWidth, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths.map((d) => _jsx("path", { d: d }, d)) }));
14
14
  const still = () => typeof matchMedia !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches;
15
15
  export const NOTICE_WORDS = { retry: "Retry", retrying: "Retrying…", dismiss: "Dismiss" };
16
- export function Notice({ meaning = "information", icon, title, children, actions = [], onRetry, dismissible, onDismiss, urgent, arrived, className, "data-force": force, words }) {
16
+ export function Notice({ meaning = "information", icon, title, children, actions = [], onRetry, dismissible, onDismiss, urgent, arrived, className, "data-force": force, "data-slot": slot, words }) {
17
17
  const said = { ...NOTICE_WORDS, ...words }, phone = usePhoneForm();
18
18
  const [phase, setPhase] = React.useState("here"), [retrying, setRetrying] = React.useState(false);
19
19
  const away = () => { if (still()) {
@@ -28,7 +28,7 @@ export function Notice({ meaning = "information", icon, title, children, actions
28
28
  return null;
29
29
  const acts = (onRetry || actions.length > 0) && (_jsxs(_Fragment, { children: [onRetry && _jsx(Button, { kind: "text", size: "xs", "aria-busy": retrying || undefined, onClick: retry, children: retrying ? said.retrying : said.retry }), actions.map((a, i) => !React.isValidElement(a) ? _jsx(Button, { kind: "text", size: "xs", onClick: a.onClick, children: a.label }, a.label)
30
30
  : React.cloneElement(a, { key: a.key ?? i, ...(a.type === Button ? { size: "xs" } : {}) }))] }));
31
- return (_jsxs("div", { role: urgent ? "alert" : "status", "data-meaning": meaning, "data-kit": "notice", ...phoneMark(phone), className: cx("o-notice o-smooth o-smooth-ease", title != null && "o-notice-titled", arrived && "o-notice-arrived", phase === "going" && "o-notice-going", className), onTransitionEnd: (e) => { if (phase === "going" && e.target === e.currentTarget && e.propertyName === "opacity") {
31
+ return (_jsxs("div", { role: urgent ? "alert" : "status", "data-meaning": meaning, "data-slot": slot, "data-kit": "notice", ...phoneMark(phone), className: cx("o-notice o-smooth o-smooth-ease", title != null && "o-notice-titled", arrived && "o-notice-arrived", phase === "going" && "o-notice-going", className), onTransitionEnd: (e) => { if (phase === "going" && e.target === e.currentTarget && e.propertyName === "opacity") {
32
32
  setPhase("gone");
33
33
  onDismiss?.();
34
34
  } }, children: [icon === false ? null : icon != null ? _jsx("span", { className: "o-notice-icon", "aria-hidden": "true", children: icon }) : glyph(NOTICE_ICONS[meaning === "neutral" ? "information" : meaning], "o-notice-icon"), _jsxs("div", { className: "o-notice-body", children: [title != null && _jsx("p", { className: "o-notice-title", children: title }), _jsx("div", { className: "o-notice-text", children: children }), title != null && acts && _jsx("div", { className: "o-notice-below", children: acts })] }), title == null && acts && _jsx("div", { className: "o-notice-acts", children: acts }), dismissible && _jsx(Button, { kind: "quiet", size: "xs", shape: "icon", className: "o-notice-x", "aria-label": said.dismiss, "data-force": force, icon: glyph(X, "", 2.25), onClick: away })] }));
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { resolveViewsMessage } from "../../contract.js";
5
5
  import { EDITOR_INNER_ESCAPE } from "../../editors/inner-escape.js";
@@ -7,6 +7,7 @@ import { ViewsContext } from "../../provider/context.js";
7
7
  import { pickerWordsOf } from "../picker/map-picker.js";
8
8
  import { useToldStep } from "../internal/told-step.js";
9
9
  import { useNumberEditor } from "./number-editor.js";
10
+ import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
10
11
  const signs = new Map();
11
12
  export function currencyOf(code, locale, language = locale) {
12
13
  const key = `${locale}␟${language}␟${code}`;
@@ -49,6 +50,9 @@ export function numberEditorPropsOf({ label, kind, value, unit, units, onValueCh
49
50
  return { ...props, ...(min !== undefined && { min }), ...(max !== undefined && { max }), ...(decimal && { decimal }), ...(typed !== undefined && { typed }) };
50
51
  }
51
52
  export function MapNumberBody(props) {
53
+ return _jsx(PanelControlsFromViews, { children: _jsx(NumberBodyInner, { ...props }) });
54
+ }
55
+ function NumberBodyInner(props) {
52
56
  const views = React.useContext(ViewsContext), messages = views?.messages ?? resolveViewsMessage;
53
57
  const words = React.useMemo(() => numberEditorWordsOf(messages), [messages]);
54
58
  const parts = useNumberEditor(numberEditorPropsOf(props, words, views?.conventions.language));
@@ -8,7 +8,7 @@ export type { Currency, NumberKind, Unit } from "./format.js";
8
8
  * its own (money's currencies). */
9
9
  export interface NumberEditorParts {
10
10
  body: React.ReactNode;
11
- head: Pick<SheetHeadProps, "left" | "right" | "onBack" | "close">;
11
+ head: Pick<SheetHeadProps, "left" | "right" | "onBack" | "backSlot" | "close">;
12
12
  title?: string;
13
13
  }
14
14
  interface Common {
@@ -1,12 +1,10 @@
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
- import { InputGroupButton } from "../input/input.js";
6
4
  import { PhoneHost, phoneMark, usePhone, usePhoneForm } from "../internal/phone.js";
5
+ import { usePanelControls } from "../internal/panel-controls.js";
7
6
  import { NumberField } from "../number-field/number-field.js";
8
7
  import { Picker, usePicker } from "../picker/picker.js";
9
- import { Popover } from "../popover/popover.js";
10
8
  import { SheetButton } from "../sheet/bottom-sheet.js";
11
9
  import { boxLocale, readTyped } from "./format.js";
12
10
  import { NUMBER_EDITOR_ATTRS, numberEditorWornOf } from "./looks.js";
@@ -56,6 +54,7 @@ function homeOrEnd(e) {
56
54
  }
57
55
  export function useNumberEditor(props) {
58
56
  const { label, kind = "number", value, currency, currencies = [], unit, units = [], onValueChange, onDone, min, max, step = 1, decimals = 2, locale, decimal, align = "end", typed, popupData } = props;
57
+ const { Button, GroupButton, Popover } = usePanelControls();
59
58
  const shell = props.draft === "shell";
60
59
  const { phone, box } = useKeeping(props);
61
60
  const settled = React.useRef(false);
@@ -162,31 +161,32 @@ export function useNumberEditor(props) {
162
161
  } };
163
162
  const sign = now?.sign ?? now?.code;
164
163
  const fieldStart = now ? (pickable
165
- ? _jsx(InputGroupButton, { "aria-label": named, iconEnd: glyph(DOWN), onClick: choose, children: codes || !now.sign ? now.code : `${now.sign} ${now.code}` })
166
- : codes ? _jsx("span", { className: "o-number-editor-code", children: now.code }) : _jsx("span", { className: "o-number-editor-sign", children: sign })) : undefined;
164
+ ? _jsx(GroupButton, { "data-slot": "vk-number-currency", "aria-label": named, iconEnd: glyph(DOWN), onClick: choose, children: codes || !now.sign ? now.code : `${now.sign} ${now.code}` })
165
+ : codes ? _jsx("span", { className: "o-number-editor-code", "data-slot": "vk-number-unit", "data-key": "code", children: now.code }) : _jsx("span", { className: "o-number-editor-sign", "data-slot": "vk-number-unit", "data-key": "sign", children: sign })) : undefined;
167
166
  const boxStart = now ? (pickable
168
- ? _jsx(Button, { kind: "quiet", size: "sm", className: "o-number-editor-code", look: SHEET_CODE, "aria-label": named, iconEnd: glyph(DOWN), onClick: choose, children: codes || !now.sign ? now.code : `${now.sign} ${now.code}` })
169
- : _jsx("span", { className: codes ? "o-number-editor-code" : "o-number-editor-sign", children: codes ? now.code : sign })) : undefined;
167
+ ? _jsx(Button, { kind: "quiet", size: "sm", className: "o-number-editor-code", "data-slot": "vk-number-currency", look: SHEET_CODE, "aria-label": named, iconEnd: glyph(DOWN), onClick: choose, children: codes || !now.sign ? now.code : `${now.sign} ${now.code}` })
168
+ : _jsx("span", { className: codes ? "o-number-editor-code" : "o-number-editor-sign", "data-slot": "vk-number-unit", "data-key": codes ? "code" : "sign", children: codes ? now.code : sign })) : undefined;
170
169
  const amount = worn.sheet === "field"
171
- ? _jsx(PhoneField, { ...shared, words: steps, label: label, before: fieldStart, after: kind === "percent" ? "%" : undefined, onKeyDown: enter, box: refs })
172
- : _jsx(NumberField, { ref: field, size: "lg", steppers: false, words: steps, className: "o-number-editor-sheet", before: boxStart, after: kind === "percent" ? _jsx("span", { className: "o-number-editor-unit", children: "%" }) : undefined, ...shared, "aria-label": label, autofill: false, onKeyDown: enter });
173
- const body = (_jsx("div", { ref: placeRoot, className: "o-number-editor", "data-kit": "number-editor", ...device, "data-number-form": "phone", onChange: readChange, "data-number-kind": kind, "data-number-step": choosing ? "currency" : undefined, children: choosing ? picker.body : amount }));
170
+ ? _jsx(PhoneField, { ...shared, "data-slot": "vk-number-box", words: steps, label: label, before: fieldStart, after: kind === "percent" ? "%" : undefined, onKeyDown: enter, box: refs })
171
+ : _jsx(NumberField, { ref: field, size: "lg", steppers: false, words: steps, className: "o-number-editor-sheet", "data-slot": "vk-number-box", before: boxStart, after: kind === "percent" ? _jsx("span", { className: "o-number-editor-unit", "data-slot": "vk-number-unit", "data-key": "percent", children: "%" }) : undefined, ...shared, "aria-label": label, autofill: false, onKeyDown: enter });
172
+ const body = (_jsx("div", { ref: placeRoot, className: "o-number-editor", "data-slot": "vk-number", "data-kit": "number-editor", ...device, "data-number-form": "phone", onChange: readChange, "data-number-kind": kind, "data-number-step": choosing ? "currency" : undefined, children: choosing ? picker.body : amount }));
174
173
  if (choosing)
175
- return { body, head: { onBack: () => setChoosing(false), close: false }, title: words.name };
174
+ return { body, head: { onBack: () => setChoosing(false), backSlot: "vk-editor-back", close: false }, title: words.name };
176
175
  if (shell)
177
176
  return { body, head: {} };
178
- return { body, head: { left: _jsx(SheetButton, { "aria-label": "Close", icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { kind: "primary", "aria-label": "Save", icon: glyph(TICK), onClick: keep }) } };
177
+ return { body, head: { left: _jsx(SheetButton, { "data-slot": "vk-editor-close", "aria-label": "Close", icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": "Save", icon: glyph(TICK), onClick: keep }) } };
179
178
  }
180
179
  const onBlur = (e) => {
181
180
  if (shell || settled.current || choosing || (e.relatedTarget instanceof Node && e.currentTarget.contains(e.relatedTarget)))
182
181
  return;
183
182
  keep();
184
183
  };
184
+ const openAt = (e) => { setChip(e.currentTarget); setChoosing(true); };
185
185
  const start = !now ? null : worn.units === "code"
186
- ? (pickable ? _jsx(Button, { ref: setChip, kind: "quiet", size: "xs", className: "o-number-editor-code", "aria-label": named, "aria-expanded": choosing, iconEnd: glyph(DOWN), onClick: () => setChoosing(true), children: now.code }) : null)
187
- : (pickable ? _jsx(Button, { ref: setChip, kind: "soft", size: "2xs", className: "o-number-editor-currency", "aria-label": named, iconEnd: glyph(DOWN), onClick: () => setChoosing(true), children: now.sign ?? now.code })
188
- : _jsx("span", { className: "o-number-editor-sign", children: now.sign ?? now.code }));
189
- const body = (_jsxs("div", { ref: wornAt, className: "o-number-editor", "data-kit": "number-editor", ...device, "data-number-form": "computer", "data-number-kind": kind, onChange: readChange, onBlur: onBlur, onFocus: () => { settled.current = false; }, children: [_jsx(NumberField, { ref: field, chrome: "inline", align: align, words: steps, steppers: worn.arrows === "editing" ? "arrows" : false, before: start ?? undefined, after: kind === "percent" ? _jsx("span", { className: "o-number-editor-unit", children: "%" }) : undefined, ...shared, "aria-label": label, autofill: false, onKeyDown: onKeyDown, className: "o-number-editor-field" }), pickable && chip && (_jsx(Popover, { open: choosing, onOpenChange: (o) => { if (!o)
186
+ ? (pickable ? _jsx(Button, { ref: setChip, kind: "quiet", size: "xs", className: "o-number-editor-code", "data-slot": "vk-number-currency", "aria-label": named, "aria-expanded": choosing, iconEnd: glyph(DOWN), onClick: openAt, children: now.code }) : null)
187
+ : (pickable ? _jsx(Button, { ref: setChip, kind: "soft", size: "2xs", className: "o-number-editor-currency", "data-slot": "vk-number-currency", "aria-label": named, iconEnd: glyph(DOWN), onClick: openAt, children: now.sign ?? now.code })
188
+ : _jsx("span", { className: "o-number-editor-sign", "data-slot": "vk-number-unit", "data-key": "sign", children: now.sign ?? now.code }));
189
+ const body = (_jsxs("div", { ref: wornAt, className: "o-number-editor", "data-slot": "vk-number", "data-kit": "number-editor", ...device, "data-number-form": "computer", "data-number-kind": kind, onChange: readChange, onBlur: onBlur, onFocus: () => { settled.current = false; }, children: [_jsx(NumberField, { ref: field, chrome: "inline", align: align, words: steps, steppers: worn.arrows === "editing" ? "arrows" : false, before: start ?? undefined, after: kind === "percent" ? _jsx("span", { className: "o-number-editor-unit", "data-slot": "vk-number-unit", "data-key": "percent", children: "%" }) : undefined, ...shared, "aria-label": label, autofill: false, onKeyDown: onKeyDown, className: "o-number-editor-field", "data-slot": "vk-number-box" }), pickable && chip && (_jsx(Popover, { open: choosing, onOpenChange: (o) => { if (!o)
190
190
  back(); }, anchor: chip, "aria-label": words.name, popupData: popupData, children: _jsx(Picker, { label: words.name, items: items, value: code ?? null, onValueChange: (c) => { if (typeof c === "string")
191
191
  pick(c); }, onDone: back, search: words.find, form: "computer", fromHeld: true, ...(w.picker ? { words: w.picker } : {}) }) }))] }));
192
192
  return { body, head: {} };
@@ -81,7 +81,9 @@ export const NumberField = React.forwardRef(function NumberField({ size = "md",
81
81
  pageKeys(e, !disabled && !readOnly); }, onFocus: (e) => { typed.focus(); onFocus?.(e); }, onBlur: (e) => { typed.leave(); onBlur?.(e); } }));
82
82
  if (chrome === "bare")
83
83
  return (_jsx(BaseNumberField.Root, { ref: ref, className: cx("o-number o-number-bare", className), style: style, disabled: disabled, readOnly: readOnly, "data-kit": "number-field", ...phoneMark(phone), ...root, ...values, children: input }));
84
- return (_jsx(BaseNumberField.Root, { ref: ref, className: cx("o-number", className), style: style, disabled: disabled, readOnly: readOnly, "data-kit": "number-field", ...phoneMark(phone), ...root, ...values, children: _jsxs(BaseNumberField.Group, { render: (props) => chrome === "inline"
85
- ? _jsx(InlineInputGroup, { ...props, children: props.children })
86
- : _jsx(InputGroup, { size: size, look: look, chrome: chrome === "soft" ? "soft" : undefined, ...props, children: props.children }), children: [side("start", before), input, side("end", after), stepped && (_jsxs(InputGroupAddon, { side: "end", className: "o-number-steps", children: [_jsx(BaseNumberField.Decrement, { ...(words?.decrease ? { "aria-label": words.decrease } : {}), render: _jsx(InputGroupButton, { icon: _jsx(Mark, { paths: MINUS }) }) }), _jsx(BaseNumberField.Increment, { ...(words?.increase ? { "aria-label": words.increase } : {}), render: _jsx(InputGroupButton, { icon: _jsx(Mark, { paths: PLUS }) }) })] })), arrows && (_jsxs(InputGroupAddon, { side: "end", className: "o-number-arrows", children: [_jsx(BaseNumberField.Increment, { className: "o-number-arrow", "aria-label": words?.increase ?? "Increase", children: UP_MARK }), _jsx(BaseNumberField.Decrement, { className: "o-number-arrow", "aria-label": words?.decrease ?? "Decrease", children: DOWN_MARK })] }))] }) }));
84
+ const { "data-slot": slot, "data-key": key, ...rest } = root;
85
+ const part = { ...(slot != null ? { "data-slot": slot } : {}), ...(key != null ? { "data-key": key } : {}) };
86
+ return (_jsx(BaseNumberField.Root, { ref: ref, className: cx("o-number", className), style: style, disabled: disabled, readOnly: readOnly, "data-kit": "number-field", ...phoneMark(phone), ...rest, ...values, children: _jsxs(BaseNumberField.Group, { render: (props) => chrome === "inline"
87
+ ? _jsx(InlineInputGroup, { ...props, ...part, children: props.children })
88
+ : _jsx(InputGroup, { size: size, look: look, chrome: chrome === "soft" ? "soft" : undefined, ...props, ...part, children: props.children }), children: [side("start", before), input, side("end", after), stepped && (_jsxs(InputGroupAddon, { side: "end", className: "o-number-steps", children: [_jsx(BaseNumberField.Decrement, { ...(words?.decrease ? { "aria-label": words.decrease } : {}), render: _jsx(InputGroupButton, { icon: _jsx(Mark, { paths: MINUS }) }) }), _jsx(BaseNumberField.Increment, { ...(words?.increase ? { "aria-label": words.increase } : {}), render: _jsx(InputGroupButton, { icon: _jsx(Mark, { paths: PLUS }) }) })] })), arrows && (_jsxs(InputGroupAddon, { side: "end", className: "o-number-arrows", children: [_jsx(BaseNumberField.Increment, { className: "o-number-arrow", "aria-label": words?.increase ?? "Increase", children: UP_MARK }), _jsx(BaseNumberField.Decrement, { className: "o-number-arrow", "aria-label": words?.decrease ?? "Decrease", children: DOWN_MARK })] }))] }) }));
87
89
  });
@@ -0,0 +1,3 @@
1
+ import type { ViewsPaneProps } from "../../provider/components.js";
2
+ /** ViewKit's panel host at the list's edge, drawn as the controls' Pane. */
3
+ export declare function MapPane({ open, onOpenChange, container, opener, label, children }: ViewsPaneProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Pane } from "./pane.js";
3
+ export function MapPane({ open, onOpenChange, container, opener, label, children }) {
4
+ return (_jsx(Pane, { open: open, onOpenChange: (next) => onOpenChange(next), container: container, opener: opener, "aria-label": label, children: children }));
5
+ }
@@ -32,16 +32,18 @@ export declare function Pane({ open, onOpenChange, container, opener, initialFoc
32
32
  * popover) draws plain instead (Customize, VK-840). A Popover opened from inside a Pane sets it back to false round what it holds.
33
33
  * The package's own; no entry point exports it. */
34
34
  export declare const InPane: React.Context<boolean>;
35
+ /** A part of the Pane: what it holds, its class, and the public name a panel gives it (VK-988). */
35
36
  type Slot = {
36
37
  children: React.ReactNode;
37
38
  className?: string;
39
+ "data-slot"?: string;
38
40
  };
39
41
  /** Its head, which what stands in it fills: its title, its ✕. It stays at its top. */
40
- export declare function PaneHead({ children, className }: Slot): import("react/jsx-runtime").JSX.Element;
42
+ export declare function PaneHead({ children, className, "data-slot": slot }: Slot): import("react/jsx-runtime").JSX.Element;
41
43
  /** What it holds, scrolling between its head and its foot. */
42
44
  export declare function PaneBody({ children, className }: Slot): import("react/jsx-runtime").JSX.Element;
43
45
  /** Its foot, under a line across the whole Pane, always at its foot. */
44
- export declare function PaneFoot({ children, className }: Slot): import("react/jsx-runtime").JSX.Element;
46
+ export declare function PaneFoot({ children, className, "data-slot": slot }: Slot): import("react/jsx-runtime").JSX.Element;
45
47
  /** Its title, which names it to a screen reader too. */
46
48
  export declare function PaneTitle({ children, className }: Slot): import("react/jsx-runtime").JSX.Element;
47
49
  /** What closes it from inside (a Button: `render`), with the reason close-press: what stands in it draws its own ✕. */