viewkitjs 0.34.0 → 0.36.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 (272) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/MIGRATION.md +7 -0
  3. package/package.json +1 -1
  4. package/views/README.md +1 -1
  5. package/views/dist/atoms/Avatar.js +2 -1
  6. package/views/dist/atoms/RelationChip.d.ts +2 -0
  7. package/views/dist/atoms/RelationChip.js +5 -0
  8. package/views/dist/atoms/RowMenu.d.ts +1 -1
  9. package/views/dist/atoms/RowMenu.js +15 -3
  10. package/views/dist/atoms/defaults.js +2 -0
  11. package/views/dist/atoms/types.d.ts +40 -4
  12. package/views/dist/cells/relation-wrap.js +9 -2
  13. package/views/dist/contract.d.ts +27 -7
  14. package/views/dist/contract.js +25 -2
  15. package/views/dist/controls/avatar/avatar-mark.d.ts +4 -0
  16. package/views/dist/controls/avatar/avatar-mark.js +5 -0
  17. package/views/dist/controls/avatar/avatar.d.ts +10 -5
  18. package/views/dist/controls/avatar/avatar.js +12 -6
  19. package/views/dist/controls/avatar/looks.d.ts +1 -1
  20. package/views/dist/controls/avatar/looks.js +3 -0
  21. package/views/dist/controls/avatar/record-mark.d.ts +16 -0
  22. package/views/dist/controls/avatar/record-mark.js +13 -0
  23. package/views/dist/controls/avatar/tokens.d.ts +12 -0
  24. package/views/dist/controls/avatar/tokens.js +3 -0
  25. package/views/dist/controls/avatar.css +54 -17
  26. package/views/dist/controls/bulk-bar/bulk-bar.js +4 -5
  27. package/views/dist/controls/bulk-bar/map-selection-bar.js +2 -1
  28. package/views/dist/controls/compound-editor/compound-editor.d.ts +3 -0
  29. package/views/dist/controls/compound-editor/map-parts-body.d.ts +1 -1
  30. package/views/dist/controls/compound-editor/map-parts-body.js +8 -1
  31. package/views/dist/controls/compound-editor/name-parts.js +3 -2
  32. package/views/dist/controls/compound-editor/place-parts.js +3 -3
  33. package/views/dist/controls/compound-editor/range-parts.js +11 -10
  34. package/views/dist/controls/compound-editor/words.d.ts +3 -0
  35. package/views/dist/controls/compound-editor/words.js +2 -0
  36. package/views/dist/controls/customize/customize.d.ts +22 -6
  37. package/views/dist/controls/customize/customize.js +154 -73
  38. package/views/dist/controls/customize/items.d.ts +49 -0
  39. package/views/dist/controls/customize/items.js +104 -0
  40. package/views/dist/controls/customize/map-customize-body.js +19 -15
  41. package/views/dist/controls/customize/words.d.ts +5 -3
  42. package/views/dist/controls/customize/words.js +1 -0
  43. package/views/dist/controls/filter-editor/block.js +5 -2
  44. package/views/dist/controls/filter-editor/filter-editor.d.ts +16 -1
  45. package/views/dist/controls/filter-editor/filter-editor.js +22 -16
  46. package/views/dist/controls/filter-editor/map-filter-body.d.ts +3 -2
  47. package/views/dist/controls/filter-editor/map-filter-body.js +16 -2
  48. package/views/dist/controls/filter-editor/map-rules.d.ts +9 -2
  49. package/views/dist/controls/filter-editor/map-rules.js +18 -13
  50. package/views/dist/controls/filter-editor/parts.d.ts +1 -1
  51. package/views/dist/controls/filter-editor/parts.js +16 -15
  52. package/views/dist/controls/filter-editor/rules.d.ts +4 -4
  53. package/views/dist/controls/filter-editor/rules.js +6 -3
  54. package/views/dist/controls/filter-editor/words.d.ts +2 -0
  55. package/views/dist/controls/filter-editor/words.js +1 -0
  56. package/views/dist/controls/group-editor/group-editor.d.ts +3 -0
  57. package/views/dist/controls/group-editor/group-editor.js +21 -15
  58. package/views/dist/controls/group-editor/map-group-body.js +1 -0
  59. package/views/dist/controls/index.d.ts +1 -1
  60. package/views/dist/controls/internal/kit-words.d.ts +11 -0
  61. package/views/dist/controls/internal/kit-words.js +7 -0
  62. package/views/dist/controls/internal/map-panel-controls.d.ts +4 -1
  63. package/views/dist/controls/internal/map-panel-controls.js +23 -6
  64. package/views/dist/controls/internal/menu-items.d.ts +9 -0
  65. package/views/dist/controls/internal/menu-items.js +97 -0
  66. package/views/dist/controls/internal/panel-controls.d.ts +27 -3
  67. package/views/dist/controls/internal/panel-controls.js +142 -13
  68. package/views/dist/controls/links-editor/links-editor.js +5 -7
  69. package/views/dist/controls/links-editor/map-links-body.d.ts +1 -1
  70. package/views/dist/controls/links-editor/map-links-body.js +5 -1
  71. package/views/dist/controls/menu/menu.d.ts +4 -1
  72. package/views/dist/controls/menu/menu.js +3 -2
  73. package/views/dist/controls/number-editor/map-number-body.js +2 -0
  74. package/views/dist/controls/number-editor/number-editor.js +1 -1
  75. package/views/dist/controls/number-editor/words.d.ts +3 -0
  76. package/views/dist/controls/number-editor/words.js +2 -0
  77. package/views/dist/controls/picker/fields-frame.d.ts +5 -0
  78. package/views/dist/controls/picker/fields-frame.js +30 -0
  79. package/views/dist/controls/picker/map-fields-body.d.ts +2 -2
  80. package/views/dist/controls/picker/map-fields-body.js +7 -26
  81. package/views/dist/controls/picker/map-picker.d.ts +9 -3
  82. package/views/dist/controls/picker/map-picker.js +16 -3
  83. package/views/dist/controls/picker/picker.js +20 -10
  84. package/views/dist/controls/picker/rows.d.ts +9 -2
  85. package/views/dist/controls/picker.css +2 -0
  86. package/views/dist/controls/quick-filters/map-quick-filters-body.js +2 -1
  87. package/views/dist/controls/quick-filters/quick-filters.js +4 -4
  88. package/views/dist/controls/quick-filters/reminder.js +2 -2
  89. package/views/dist/controls/quick-filters/rules.d.ts +4 -1
  90. package/views/dist/controls/quick-filters/words.d.ts +2 -0
  91. package/views/dist/controls/quick-filters/words.js +1 -0
  92. package/views/dist/controls/select/map-select.d.ts +1 -1
  93. package/views/dist/controls/select/map-select.js +4 -1
  94. package/views/dist/controls/select/select.d.ts +5 -0
  95. package/views/dist/controls/select/select.js +11 -3
  96. package/views/dist/controls/sheet/bottom-sheet.d.ts +6 -1
  97. package/views/dist/controls/sheet/bottom-sheet.js +3 -3
  98. package/views/dist/controls/sort-editor/map-sort-body.js +1 -0
  99. package/views/dist/controls/sort-editor/sort-editor.d.ts +5 -1
  100. package/views/dist/controls/sort-editor/sort-editor.js +9 -8
  101. package/views/dist/controls/tag/tag.js +4 -2
  102. package/views/dist/controls/text-editor/map-text-body.js +4 -1
  103. package/views/dist/controls/text-editor/text-editor.js +2 -2
  104. package/views/dist/controls/text-editor/words.d.ts +3 -0
  105. package/views/dist/controls/text-editor/words.js +1 -1
  106. package/views/dist/controls/toolbar/toolbar.d.ts +31 -12
  107. package/views/dist/controls/toolbar/toolbar.js +15 -20
  108. package/views/dist/controls/toolbar.css +0 -5
  109. package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
  110. package/views/dist/controls/tooltip/map-tooltip.js +4 -2
  111. package/views/dist/controls/values-editor/map-values-body.d.ts +1 -2
  112. package/views/dist/controls/values-editor/map-values-body.js +5 -1
  113. package/views/dist/controls/values-editor/values-editor.js +8 -7
  114. package/views/dist/controls/views-list/map-views-list-body.js +9 -1
  115. package/views/dist/controls/views-list/rules.d.ts +1 -0
  116. package/views/dist/controls/views-list/rules.js +2 -2
  117. package/views/dist/controls/views-list/view-menu.js +2 -2
  118. package/views/dist/controls/views-list/words.d.ts +4 -0
  119. package/views/dist/controls/views-list/words.js +2 -1
  120. package/views/dist/display/option-badges.d.ts +17 -0
  121. package/views/dist/display/option-badges.js +11 -0
  122. package/views/dist/display/relation-link.d.ts +12 -0
  123. package/views/dist/display/relation-link.js +17 -0
  124. package/views/dist/display/relation.d.ts +1 -1
  125. package/views/dist/display/relation.js +10 -3
  126. package/views/dist/display/select.js +1 -8
  127. package/views/dist/editors/EditorPanel.js +1 -1
  128. package/views/dist/editors/RangeEditor.d.ts +3 -0
  129. package/views/dist/editors/RangeEditor.js +2 -2
  130. package/views/dist/editors/SelectEditor.d.ts +2 -2
  131. package/views/dist/editors/SelectEditor.js +1 -1
  132. package/views/dist/editors/TextEditor.js +4 -2
  133. package/views/dist/editors/ValueListEditor.js +2 -1
  134. package/views/dist/field-row/FieldRow.js +32 -5
  135. package/views/dist/field-row/editors/RowRangeEditor.js +2 -1
  136. package/views/dist/grid/chrome/GridAddColumn.d.ts +7 -2
  137. package/views/dist/grid/chrome/GridAddColumn.js +13 -9
  138. package/views/dist/grid/chrome/GridCellEditors.js +1 -1
  139. package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -1
  140. package/views/dist/grid/chrome/GridCellOutline.js +16 -6
  141. package/views/dist/grid/chrome/GridChipsEditor.js +3 -2
  142. package/views/dist/grid/chrome/GridColumnMenu.js +7 -4
  143. package/views/dist/grid/chrome/GridFooter.d.ts +4 -1
  144. package/views/dist/grid/chrome/GridFooter.js +4 -4
  145. package/views/dist/grid/chrome/GridGroupMenu.js +39 -14
  146. package/views/dist/grid/chrome/GridHeader.d.ts +1 -1
  147. package/views/dist/grid/chrome/GridHeader.js +4 -3
  148. package/views/dist/grid/chrome/GridNumberEditor.js +1 -1
  149. package/views/dist/grid/chrome/GridRangeEditor.d.ts +4 -1
  150. package/views/dist/grid/chrome/GridRangeEditor.js +2 -2
  151. package/views/dist/grid/chrome/GridRow.js +11 -3
  152. package/views/dist/grid/chrome/GridRowActions.d.ts +4 -1
  153. package/views/dist/grid/chrome/GridRowActions.js +2 -2
  154. package/views/dist/grid/chrome/GridRowCells.js +3 -2
  155. package/views/dist/grid/chrome/GridStructure.js +1 -1
  156. package/views/dist/grid/chrome/GridTable.js +32 -20
  157. package/views/dist/grid/chrome/GridTableSurface.js +2 -1
  158. package/views/dist/grid/chrome/checks.d.ts +1 -1
  159. package/views/dist/grid/chrome/checks.js +4 -1
  160. package/views/dist/grid/chrome/grid-cell-classes.d.ts +6 -2
  161. package/views/dist/grid/chrome/grid-cell-classes.js +10 -5
  162. package/views/dist/grid/chrome/grid-fitted-box.d.ts +5 -2
  163. package/views/dist/grid/chrome/grid-fitted-box.js +14 -4
  164. package/views/dist/grid/chrome/grid-hover.d.ts +10 -2
  165. package/views/dist/grid/chrome/grid-hover.js +14 -4
  166. package/views/dist/grid/chrome/grid-row-props.d.ts +4 -0
  167. package/views/dist/grid/chrome/grid-rows-menu.js +9 -4
  168. package/views/dist/grid/chrome/grid-table-props.d.ts +16 -4
  169. package/views/dist/grid/chrome/useGridScaleStyles.d.ts +9 -1
  170. package/views/dist/grid/chrome/useGridScaleStyles.js +1 -4
  171. package/views/dist/grid/grid-format-props.d.ts +1 -1
  172. package/views/dist/grid/grid-format-props.js +18 -5
  173. package/views/dist/grid/grid.css +11 -1
  174. package/views/dist/grid/looks.d.ts +3 -1
  175. package/views/dist/grid/looks.js +10 -4
  176. package/views/dist/grid/useGridTablePrefs.d.ts +1 -1
  177. package/views/dist/grid/useGridTableSettings.d.ts +1 -1
  178. package/views/dist/list/layer.d.ts +8 -0
  179. package/views/dist/list/layer.js +7 -0
  180. package/views/dist/list/list.js +2 -2
  181. package/views/dist/list/menu.d.ts +5 -4
  182. package/views/dist/list/store.d.ts +1 -1
  183. package/views/dist/list/toolbar.js +47 -20
  184. package/views/dist/list/views.js +1 -0
  185. package/views/dist/panels/availability.d.ts +5 -0
  186. package/views/dist/panels/availability.js +4 -5
  187. package/views/dist/panels/customize-body.d.ts +5 -1
  188. package/views/dist/panels/customize-body.js +21 -12
  189. package/views/dist/panels/model.d.ts +14 -4
  190. package/views/dist/panels/react/customize-body.js +15 -3
  191. package/views/dist/panels/react/customize.d.ts +8 -0
  192. package/views/dist/panels/react/filter/FilterEditor.d.ts +6 -0
  193. package/views/dist/panels/react/filter/FilterEditor.js +7 -0
  194. package/views/dist/panels/react/filter/FilterFieldList.d.ts +3 -1
  195. package/views/dist/panels/react/filter/FilterFieldList.js +2 -2
  196. package/views/dist/panels/react/filter/filter-body.js +3 -1
  197. package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -1
  198. package/views/dist/panels/react/filter/filter-part-body.js +2 -2
  199. package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +3 -1
  200. package/views/dist/panels/react/quick/QuickFiltersPanel.js +7 -3
  201. package/views/dist/panels/react/sort/SortEditor.js +3 -1
  202. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -2
  203. package/views/dist/panels/react/toolbar/Toolbar.d.ts +11 -1
  204. package/views/dist/panels/react/toolbar/Toolbar.js +16 -6
  205. package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +5 -3
  206. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +6 -1
  207. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +12 -5
  208. package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +7 -3
  209. package/views/dist/panels/react/toolbar/ToolbarFilters.js +18 -8
  210. package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +9 -1
  211. package/views/dist/panels/react/toolbar/ToolbarOptions.js +2 -2
  212. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
  213. package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
  214. package/views/dist/panels/react/toolbar/ToolbarSave.js +5 -4
  215. package/views/dist/panels/react/toolbar/ToolbarSort.d.ts +7 -1
  216. package/views/dist/panels/react/toolbar/ToolbarSort.js +6 -3
  217. package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +3 -0
  218. package/views/dist/panels/react/toolbar/ToolbarSortPill.js +4 -4
  219. package/views/dist/panels/react/toolbar/editor-menus.d.ts +8 -0
  220. package/views/dist/panels/react/toolbar/editor-menus.js +3 -0
  221. package/views/dist/panels/react/views-row/FoldingViewRow.js +3 -5
  222. package/views/dist/panels/react/views-row/HScrollRow.d.ts +4 -2
  223. package/views/dist/panels/react/views-row/HScrollRow.js +6 -2
  224. package/views/dist/panels/react/views-row/ViewAxes.js +6 -1
  225. package/views/dist/panels/react/views-row/ViewPicker.js +8 -3
  226. package/views/dist/panels/react/views-row/new-view.d.ts +11 -0
  227. package/views/dist/panels/react/views-row/new-view.js +21 -0
  228. package/views/dist/panels/react.d.ts +1 -1
  229. package/views/dist/panels/settings/layout.js +6 -38
  230. package/views/dist/panels/toolbar/page-resets.d.ts +17 -0
  231. package/views/dist/panels/toolbar/page-resets.js +62 -0
  232. package/views/dist/panels/toolbar/same-item.d.ts +7 -0
  233. package/views/dist/panels/toolbar/same-item.js +9 -0
  234. package/views/dist/panels/view-state.d.ts +4 -0
  235. package/views/dist/provider/ViewsProvider.d.ts +9 -4
  236. package/views/dist/provider/ViewsProvider.js +13 -2
  237. package/views/dist/provider/components.d.ts +109 -7
  238. package/views/dist/provider/components.js +1 -1
  239. package/views/dist/react.d.ts +2 -2
  240. package/views/dist/styles.css +115 -27
  241. package/views/dist/styles.unlayered.css +115 -27
  242. package/views/docs/contract.md +55 -35
  243. package/views/docs/controls/avatar.md +3 -0
  244. package/views/docs/controls/bulk-bar.md +3 -1
  245. package/views/docs/controls/compound-editor.md +2 -0
  246. package/views/docs/controls/customize.md +1 -1
  247. package/views/docs/controls/filter-editor.md +1 -1
  248. package/views/docs/controls/links-editor.md +2 -0
  249. package/views/docs/controls/pane.md +1 -1
  250. package/views/docs/controls/picker.md +2 -0
  251. package/views/docs/controls/quick-filters.md +1 -1
  252. package/views/docs/controls/text-editor.md +1 -1
  253. package/views/docs/controls/values-editor.md +2 -0
  254. package/views/docs/guides/atoms.md +54 -3
  255. package/views/docs/guides/display.md +1 -1
  256. package/views/docs/guides/looks.md +1 -1
  257. package/views/docs/guides/the-grid.md +4 -2
  258. package/views/docs/guides/the-provider.md +2 -2
  259. package/views/docs/index.md +2 -2
  260. package/views/docs/install.md +198 -104
  261. package/views/docs/reference/controls.md +27 -24
  262. package/views/docs/reference/editors-range.md +1 -1
  263. package/views/docs/reference/field-row.md +1 -1
  264. package/views/docs/reference/grid.md +6 -5
  265. package/views/docs/reference/list.md +27 -7
  266. package/views/docs/reference/looks.md +5 -5
  267. package/views/docs/reference/panels-react.md +15 -14
  268. package/views/docs/reference/panels.md +5 -5
  269. package/views/docs/reference/react.md +25 -11
  270. package/views/docs/reference/views.md +2 -2
  271. package/views/docs/reshaping.md +22 -6
  272. package/views/skills/views/SKILL.md +2 -2
@@ -1,17 +1,23 @@
1
1
  "use client";
2
2
  import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
+ import { useLabelableContext, useLabelableId } from "@base-ui/react/internals/labelable-provider";
5
+ import { NOOP } from "@base-ui/react/internals/noop";
4
6
  import { Button } from "../button/button.js";
7
+ import { GlassButton } from "../glass-button/glass-button.js";
5
8
  import { useAutofill } from "../input/autofill.js";
6
9
  import { Input, InputGroupButton, InputGroupContext } from "../input/input.js";
7
10
  import { Menu } from "../menu/menu.js";
11
+ import { NumberField } from "../number-field/number-field.js";
8
12
  import { Popover } from "../popover/popover.js";
9
13
  import { Select } from "../select/select.js";
14
+ import { Tooltip } from "../tooltip/tooltip.js";
10
15
  export const NO_APP_CONTROLS = Object.freeze({});
11
16
  export const PanelControlsContext = React.createContext(NO_APP_CONTROLS);
12
17
  const OWN = {
13
18
  Button: Button, Select, Menu, Popover, Input: Input,
14
- GroupButton: InputGroupButton, Calendar: null,
19
+ GroupButton: InputGroupButton, Calendar: null, RoundButton: GlassButton,
20
+ Tooltip, NumberBox: NumberField,
15
21
  };
16
22
  export function usePanelControls() {
17
23
  const app = React.useContext(PanelControlsContext);
@@ -19,10 +25,13 @@ export function usePanelControls() {
19
25
  Button: app.Button ? AppButton : OWN.Button,
20
26
  Select: app.Select ? AppSelect : Select,
21
27
  Menu: app.Menu || app.Button ? OpenedMenu : Menu,
22
- Popover: app.Popover ? AppPopover : Popover,
28
+ Popover: app.Popover || app.Button ? OpenedPopover : Popover,
23
29
  Input: app.Input ? AppInput : OWN.Input,
24
30
  GroupButton: app.Button ? AppGroupButton : OWN.GroupButton,
25
31
  Calendar: app.Calendar ?? null,
32
+ RoundButton: app.Button ? AppRoundButton : OWN.RoundButton,
33
+ Tooltip: app.Tooltip ? AppTooltip : Tooltip,
34
+ NumberBox: app.Input ? AppNumberBox : NumberField,
26
35
  }), [app]);
27
36
  }
28
37
  const VARIANT = {
@@ -31,12 +40,13 @@ const VARIANT = {
31
40
  };
32
41
  const SMALL = new Set(["2xs", "xs", "sm", "20", "22", "26", "20x24", "line"]);
33
42
  export function buttonPropsOf(p) {
34
- const { kind, size, shape, look: _look, loading: _loading, render: _render, nativeButton: _native, icon, iconEnd, children, focusableWhenDisabled, disabled, onClick, ...rest } = p;
43
+ const { kind, size, shape, look: _look, loading, render: _render, nativeButton: _native, icon, iconEnd, children, focusableWhenDisabled, disabled, onClick, ...rest } = p;
35
44
  const words = children != null && children !== false;
36
45
  const inside = icon != null && !words && iconEnd == null ? icon : _jsxs(_Fragment, { children: [icon, children, iconEnd] });
37
- const held = !!disabled && !!focusableWhenDisabled;
46
+ const held = (!!disabled && !!focusableWhenDisabled) || (!!loading && !disabled);
38
47
  return {
39
48
  ...rest,
49
+ ...(loading ? { "aria-busy": true } : {}),
40
50
  type: rest.type ?? "button",
41
51
  variant: VARIANT[kind ?? "outline"],
42
52
  size: shape === "icon" || shape === "round" ? "icon" : SMALL.has(size ?? "md") ? "sm" : "default",
@@ -46,37 +56,99 @@ export function buttonPropsOf(p) {
46
56
  }
47
57
  function AppButton(p) {
48
58
  const Own = React.useContext(PanelControlsContext).Button;
49
- if (!Own)
59
+ if (!Own || p.render)
50
60
  return _jsx(Button, { ...p });
51
61
  return _jsx(Own, { ...buttonPropsOf(p) });
52
62
  }
63
+ export const isAppButton = (type) => type === AppButton;
53
64
  function AppGroupButton(p) {
54
65
  return _jsx(AppButton, { kind: "quiet", size: "sm", ...p });
55
66
  }
67
+ function AppRoundButton({ icon, children, kind, pressed, count, dot, size, render, ...p }) {
68
+ if (render)
69
+ return _jsx(GlassButton, { icon, children, kind, pressed, count, dot, size, render, ...p });
70
+ if (count != null || dot)
71
+ warnUnsaid("Button", [...(count != null ? ["count"] : []), ...(dot ? ["dot"] : [])], named(p) ?? "");
72
+ return _jsx(AppButton, { kind: kind === "primary" ? "primary" : kind === "danger" ? "danger" : "quiet", ...(children == null ? { shape: "icon" } : {}), icon: icon, ...(pressed !== undefined ? { "aria-pressed": pressed } : {}), ...p, children: children });
73
+ }
74
+ function useFieldControlId(id) {
75
+ const inField = useLabelableContext().registerControlId !== NOOP;
76
+ const named = useLabelableId({ id });
77
+ return inField && named ? { id: named } : {};
78
+ }
79
+ function AppTooltip({ label, keys, reason, side, align, disabled, delay, children }) {
80
+ const Own = React.useContext(PanelControlsContext).Tooltip;
81
+ if (!Own)
82
+ return _jsx(Tooltip, { label, keys, reason, side, align, disabled, delay, children: children });
83
+ if (disabled)
84
+ return children;
85
+ if (keys?.length)
86
+ warnUnsaid("Tooltip", ["keys"], typeof label === "string" ? label : "");
87
+ return _jsx(Own, { content: label, ...(reason ? { reason } : {}), ...(side ? { side } : {}), ...(align ? { align } : {}), ...(delay != null ? { delayMs: delay } : {}), children: children });
88
+ }
89
+ const plainNumber = (typed) => {
90
+ const t = typed.trim();
91
+ if (!t)
92
+ return null;
93
+ const n = Number(t.replace(",", "."));
94
+ return Number.isFinite(n) ? n : null;
95
+ };
96
+ function AppNumberBox(p) {
97
+ const read = React.useContext(PanelControlsContext).parseNumber ?? plainNumber;
98
+ const { value, onValueChange, format, onKeyDown, onBlur, onFocus, placeholder, size, disabled, readOnly, autoFocus, id, name } = p;
99
+ const whole = format?.maximumFractionDigits === 0;
100
+ const numberOf = (typed) => { const n = read(typed); return n == null ? null : whole ? Math.round(n) : n; };
101
+ const textOf = (n) => (n == null ? "" : String(n));
102
+ const [typed, setTyped] = React.useState(() => textOf(value));
103
+ const [held, setHeld] = React.useState(value ?? null);
104
+ if ((value ?? null) !== held) {
105
+ setHeld(value ?? null);
106
+ if (numberOf(typed) !== (value ?? null))
107
+ setTyped(textOf(value));
108
+ }
109
+ const hand = (n) => {
110
+ setHeld(n);
111
+ onValueChange?.(n);
112
+ };
113
+ const named = Object.fromEntries(Object.entries(p).filter(([k]) => k.startsWith("aria-") || k.startsWith("data-")));
114
+ return (_jsx(AppInput, { ...named, id, name, placeholder, disabled, readOnly, autoFocus, onFocus, size: size, type: "text", inputMode: "decimal", value: typed, onChange: (e) => { setTyped(e.target.value); hand(numberOf(e.target.value)); }, onKeyDown: (e) => {
115
+ onKeyDown?.(e);
116
+ if (e.defaultPrevented || (e.key !== "ArrowUp" && e.key !== "ArrowDown") || disabled || readOnly)
117
+ return;
118
+ e.preventDefault();
119
+ const n = (numberOf(typed) ?? 0) + (e.key === "ArrowUp" ? 1 : -1) * (e.shiftKey ? 10 : 1);
120
+ setTyped(textOf(n));
121
+ hand(n);
122
+ }, onBlur: (e) => { onBlur?.(e); setTyped(textOf(numberOf(typed))); } }));
123
+ }
56
124
  const selectItemsOf = (items) => items.map(({ value, label, line, group, disabled, mark, level }) => ({
57
125
  value, label, ...(mark != null ? { icon: mark } : {}), ...(line != null ? { line } : {}), ...(group != null ? { group } : {}),
58
126
  ...(disabled ? { disabled } : {}), ...(level ? { level: selectItemsOf(level) } : {}),
59
127
  }));
60
128
  export function selectPropsOf(p) {
61
- const { items, value, onValueChange, multiple, placeholder, disabled, open, onOpenChange, search, size, className, opens: _opens, defaultValue: _defaultValue, label: _label, labelAt: _labelAt, note: _note, error: _error, name: _name, required: _required, readOnly: _readOnly, autoComplete: _autoComplete, side: _side, align: _align, listWidth: _listWidth, chips: _chips, clear: _clear, pickerWords: _pickerWords, searchIn: _searchIn, onSearch: _onSearch, loading: _loading, none: _none, create: _create, footer: _footer, empty: _empty, ...rest } = p;
129
+ const { items, value, onValueChange, multiple, placeholder, disabled, open, onOpenChange, search, size, className, opens: _opens, defaultValue: _defaultValue, label: _label, labelAt: _labelAt, note: _note, error: _error, name: _name, required: _required, readOnly: _readOnly, autoComplete: _autoComplete, side: _side, align: _align, listWidth: _listWidth, chips: _chips, clear: _clear, clearLabel: _clearLabel, pickerWords: _pickerWords, searchIn: _searchIn, onSearch: _onSearch, loading: _loading, none: _none, create: _create, footer: _footer, empty: _empty, ...rest } = p;
62
130
  const { "data-force": _force, saving: _saving, ...passed } = rest;
63
- const unsaid = Object.entries({ onSearch: _onSearch, loading: _loading, none: _none, create: _create, footer: _footer, empty: _empty, clear: _clear })
131
+ const unsaid = Object.entries({ onSearch: _onSearch, loading: _loading, none: _none, create: _create, footer: _footer, empty: _empty, ...(multiple ? { clear: _clear } : {}) })
64
132
  .filter(([, v]) => v != null && v !== false).map(([k]) => k);
65
133
  if (unsaid.length)
66
134
  warnUnsaid("Select", unsaid, named(p) ?? "");
135
+ const clears = !multiple && typeof _clear === "string" && _clear !== "";
67
136
  return {
68
137
  ...passed,
69
- items: selectItemsOf(items), value: value ?? null, onValueChange: (v) => onValueChange?.(v), size: size === "md" || size === "lg" ? "default" : "sm",
138
+ items: clears ? [{ value: NO_VALUE, label: _clear }, ...selectItemsOf(items)] : selectItemsOf(items), value: value ?? null,
139
+ onValueChange: (v) => onValueChange?.(clears && v === NO_VALUE ? null : v), size: size === "md" || size === "lg" ? "default" : "sm",
70
140
  ...(multiple ? { multiple } : {}), ...(placeholder != null ? { placeholder } : {}), ...(disabled ? { disabled } : {}),
71
141
  ...(open !== undefined ? { open } : {}), ...(onOpenChange ? { onOpenChange } : {}), ...(search != null ? { search } : {}),
72
142
  ...(className ? { className } : {}),
73
143
  };
74
144
  }
145
+ const NO_VALUE = "\u0000vk-none";
75
146
  function AppSelect(p) {
76
147
  const Own = React.useContext(PanelControlsContext).Select;
148
+ const field = useFieldControlId(p.id);
77
149
  if (!Own || p.opens)
78
150
  return _jsx(Select, { ...p });
79
- return _jsx(Own, { ...selectPropsOf(p) });
151
+ return _jsx(Own, { ...selectPropsOf(p), ...field });
80
152
  }
81
153
  const named = (p) => p["aria-label"] ?? p["data-slot"];
82
154
  const warned = new Set();
@@ -93,7 +165,7 @@ function warnLeftOut(kind, label) {
93
165
  warned.add(`${kind}:${label}`);
94
166
  console.warn(`ViewKit: the menu "${label}" holds a "${kind}" row the components map's Menu can't be handed, so your Menu doesn't draw it.`);
95
167
  }
96
- export function menuItemsOf(entries, label) {
168
+ export function menuItemsOf(entries, label, within = "") {
97
169
  const out = [];
98
170
  let line = false;
99
171
  const push = (item) => { out.push(line ? { ...item, separatorBefore: true } : item); line = false; };
@@ -102,7 +174,7 @@ export function menuItemsOf(entries, label) {
102
174
  line = out.length > 0;
103
175
  return;
104
176
  }
105
- const slot = e.slot?.slot, key = e.slot?.key ?? String(at);
177
+ const slot = e.slot?.slot, key = e.slot?.key ?? `${within}${at}`;
106
178
  if (e.kind === undefined || e.kind === "action") {
107
179
  push({ key, label: e.label, ...(e.icon != null ? { icon: e.icon } : {}), ...(e.onSelect ? { onSelect: e.onSelect } : {}), ...(e.danger ? { destructive: true } : {}),
108
180
  ...(e.disabled ? { disabled: true, disabledReason: e.disabled } : {}), ...(slot ? { slot } : {}) });
@@ -123,6 +195,30 @@ export function menuItemsOf(entries, label) {
123
195
  else
124
196
  rows.forEach(push);
125
197
  }
198
+ else if (e.kind === "group") {
199
+ push({ key, label: e.heading, children: menuItemsOf(e.entries, label, `${key}.`), ...(slot ? { slot } : {}) });
200
+ }
201
+ else if (e.kind === "actions") {
202
+ push({ key, label: e.label, ...(e.icon != null ? { icon: e.icon } : {}), children: menuItemsOf(e.entries, label, `${key}.`), beside: true,
203
+ ...(e.detail ? { detail: e.detail } : {}), ...(slot ? { slot } : {}) });
204
+ }
205
+ else if (e.kind === "choices") {
206
+ const rows = e.choices.map((c) => {
207
+ const named = c.slot?.slot ?? slot;
208
+ return { key: c.slot?.key ?? c.value, label: c.label, ...(c.mark != null ? { icon: c.mark } : {}), checked: c.value === e.value,
209
+ onSelect: () => e.onChoose?.(c.value), ...(named ? { slot: named } : {}) };
210
+ });
211
+ const said = e.detail ?? e.choices.find((c) => c.value === e.value)?.label;
212
+ push({ key, label: e.label, ...(e.icon != null ? { icon: e.icon } : {}), beside: true, children: rows, ...(said ? { detail: said } : {}), ...(slot ? { slot } : {}) });
213
+ }
214
+ else if (e.kind === "link") {
215
+ const unsaid = [...(e.render ? ["render"] : []), ...(e.external ? ["external"] : [])];
216
+ if (unsaid.length)
217
+ warnUnsaid("Menu", unsaid, label);
218
+ const go = e.onSelect;
219
+ push({ key, label: e.label, ...(e.icon != null ? { icon: e.icon } : {}), ...(e.href ? { href: e.href } : {}),
220
+ ...(go ? { onSelect: () => go(undefined) } : {}), ...(slot ? { slot } : {}) });
221
+ }
126
222
  else
127
223
  warnLeftOut(e.kind, label);
128
224
  });
@@ -220,6 +316,39 @@ function AppPopover(p) {
220
316
  why.current = "outside-press"; return kept; };
221
317
  return _jsx(Own, { ...handed, onOutsidePress: onOutsidePress, onOpenChange: (o, d) => { why.current = o ? null : d?.reason ?? why.current; handed.onOpenChange(o, d); } });
222
318
  }
319
+ function OpenedPopover(p) {
320
+ return p.trigger ? _jsx(TriggeredPopover, { ...p }) : _jsx(AppPopover, { ...p });
321
+ }
322
+ function TriggeredPopover(p) {
323
+ const [ownOpen, setOwnOpen] = React.useState(!!p.defaultOpen), open = p.open ?? ownOpen;
324
+ const [at, setAt] = React.useState(null);
325
+ const back = React.useRef(null);
326
+ const openNow = React.useRef(open), pressedOpen = React.useRef(null);
327
+ React.useLayoutEffect(() => { openNow.current = open; });
328
+ const set = (next, reason = "trigger-press") => {
329
+ openNow.current = next;
330
+ setOwnOpen(next);
331
+ p.onOpenChange?.(next, { reason });
332
+ };
333
+ const trigger = p.trigger;
334
+ const own = trigger.props.ref;
335
+ const placed = (el) => { if (el) {
336
+ back.current = el;
337
+ setAt(el);
338
+ } fillRef(own, el); };
339
+ function onPointerDown(e) { pressedOpen.current = openNow.current; trigger.props.onPointerDown?.(e); }
340
+ function onClick(e) {
341
+ trigger.props.onClick?.(e);
342
+ back.current = e.currentTarget;
343
+ setAt(e.currentTarget);
344
+ const was = pressedOpen.current ?? openNow.current;
345
+ pressedOpen.current = null;
346
+ set(!was);
347
+ }
348
+ const opener = React.cloneElement(trigger, { ref: placed, "aria-haspopup": "dialog", "aria-expanded": open, "data-state": open ? "open" : "closed", onPointerDown, onClick });
349
+ const finalFocus = p.finalFocus === false ? false : p.finalFocus && typeof p.finalFocus !== "boolean" ? p.finalFocus : back;
350
+ return (_jsxs(_Fragment, { children: [opener, _jsx(AppPopover, { ...p, trigger: undefined, defaultOpen: undefined, anchor: p.anchor ?? at, open: open, finalFocus: finalFocus, onOpenChange: (o, d) => set(o, d.reason) })] }));
351
+ }
223
352
  export function inputPropsOf(p, bare = false) {
224
353
  const { size: _size, chrome: _chrome, look: _look, numeric: _numeric, multiline: _multiline, grow: _grow, maxLines: _maxLines, minLines: _minLines, lines: _lines, autofill: _autofill, fills: _fills, saving: _saving, saved: _saved, combobox: _combobox, onValueChange, onChange, ...rest } = p;
225
354
  return {
@@ -233,8 +362,8 @@ export function inputPropsOf(p, bare = false) {
233
362
  }
234
363
  function AppInput(p) {
235
364
  const Own = React.useContext(PanelControlsContext).Input;
236
- const grouped = React.useContext(InputGroupContext) != null, fill = useAutofill();
365
+ const grouped = React.useContext(InputGroupContext) != null, fill = useAutofill(), field = useFieldControlId(p.id);
237
366
  if (!Own || p.multiline || p.combobox)
238
367
  return _jsx(Input, { ...p });
239
- return _jsx(Own, { ...fill(p.autofill !== false), ...inputPropsOf(p, p.chrome === "bare" || grouped) });
368
+ return _jsx(Own, { ...fill(p.autofill !== false), ...inputPropsOf(p, p.chrome === "bare" || grouped), ...field });
240
369
  }
@@ -1,21 +1,18 @@
1
1
  "use client";
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
- import { Avatar } from "../avatar/avatar.js";
5
- import { Button } from "../button/button.js";
4
+ import { RecordMark } from "../avatar/record-mark.js";
6
5
  import { FieldRows, FieldRowsRow as FieldRow } from "../field/field.js";
7
- import { Input, InputGroup, InputGroupAddon } from "../input/input.js";
6
+ import { InputGroup, InputGroupAddon } from "../input/input.js";
7
+ import { usePanelControls } from "../internal/panel-controls.js";
8
8
  import { DOTS, DOTS_LOOK, glyph, PLUS, useDecide, useStandingRoom, X } from "../internal/editor-parts.js";
9
9
  import { Icon } from "../internal/icons.js";
10
10
  import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
11
11
  import { spacingPx } from "../internal/read-token.js";
12
12
  import { drawnAt, scrollInList } from "../internal/scroll.js";
13
13
  import { openerAt, useStepReturn } from "../internal/step-return.js";
14
- import { Menu } from "../menu/menu.js";
15
14
  import { Picker, usePicker } from "../picker/picker.js";
16
- import { Popover } from "../popover/popover.js";
17
15
  import { Radio, RadioGroup } from "../radio/radio.js";
18
- import { Select } from "../select/select.js";
19
16
  import { Spinner } from "../spinner/spinner.js";
20
17
  import { Switch } from "../switch/switch.js";
21
18
  import { midWord } from "../text-editor/check.js";
@@ -34,9 +31,10 @@ const FIELDS = { cards: "one", edge: "on", height: "52", label: "104", lines: "w
34
31
  function Face({ record, size }) {
35
32
  const as = record.as;
36
33
  const avatar = as && "avatar" in as ? as : null;
37
- return _jsx(Avatar, { name: record.label, kind: avatar?.avatar === "person" ? "person" : "thing", id: avatar?.id, src: avatar?.src, size: size });
34
+ return _jsx(RecordMark, { label: record.label, shape: avatar?.avatar === "person" ? "person" : "thing", id: avatar?.id, src: avatar?.src, kind: avatar?.kind, size: size });
38
35
  }
39
36
  export function useLinksEditor(props) {
37
+ const { Button, Input, Menu, Popover, Select } = usePanelControls();
40
38
  const { label, kind, records, fields, links, onLinksChange, lead, autoFocus = true, opens, onSearch, doing, onRetry, onMore, actions = [] } = props;
41
39
  const w = linksWords(props.words), search = props.search ?? w.search;
42
40
  const screen = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (screen || small ? "phone" : "computer")) === "phone";
@@ -6,5 +6,5 @@ import type { LinksEditorWords } from "./words.js";
6
6
  export declare function linksEditorWordsOf(say: ViewsMessageResolver, makeLead?: string): LinksEditorWords;
7
7
  /** ViewKit's links body's props as the Links editor's, its roles' column named `rolesWord`. */
8
8
  export declare function linksEditorPropsOf(p: ViewsLinksBodyProps, words: LinksEditorWords, rolesWord: string, AppIcon?: ViewsResolvedComponents["AppIcon"]): LinksEditorProps;
9
- /** ViewKit's links body, drawn as the Links editor. */
9
+ /** ViewKit's links body, its controls the app's where the provider's `panelControls` names them (VK-1022). */
10
10
  export declare function MapLinksBody(props: ViewsLinksBodyProps): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,12 @@
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";
6
6
  import { ViewsContext } from "../../provider/context.js";
7
7
  import { pickerItemsOf, pickerWordsOf } from "../picker/map-picker.js";
8
8
  import { useToldStep } from "../internal/told-step.js";
9
+ import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
9
10
  import { useLinksEditor } from "./links-editor.js";
10
11
  import { heldOf } from "./links.js";
11
12
  const ROLES = "roles";
@@ -63,6 +64,9 @@ export function linksEditorPropsOf(p, words, rolesWord, AppIcon) {
63
64
  };
64
65
  }
65
66
  export function MapLinksBody(props) {
67
+ return _jsx(PanelControlsFromViews, { children: _jsx(LinksBodyInner, { ...props }) });
68
+ }
69
+ function LinksBodyInner(props) {
66
70
  const views = React.useContext(ViewsContext);
67
71
  const messages = views?.messages ?? resolveViewsMessage;
68
72
  const makeLead = props.lead?.makeLabel;
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { type MenuChoice, type MenuEntry } from "../menu-list/menu-list.js";
3
+ import { type ButtonProps } from "../button/button.js";
3
4
  import { type Anchor } from "../internal/anchor.js";
4
5
  import { type CloseReason } from "../internal/close-reason.js";
5
6
  import { type PickerWords } from "../picker/picker.js";
@@ -23,7 +24,7 @@ export interface MenuProps {
23
24
  /** What opens it: the ⋯ button by default (MenuDots), named "Actions for <label>". */
24
25
  trigger?: React.ReactElement;
25
26
  /** 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),
26
- * as the Popover's anchor; set from outside with open. Given at all (null while it is shut), it draws no trigger. */
27
+ * as the Popover's anchor; set from outside with open. Given at all (null while it is shut), it draws no trigger to press. */
27
28
  anchor?: Anchor;
28
29
  /** Where it sits: under a ⋯, its right edge on the button's ("end"); under a crumb, its left edge on it ("start"); over
29
30
  * what stands in the middle of the screen, its middle on it ("center"). */
@@ -87,3 +88,5 @@ export declare const MenuDots: React.ForwardRefExoticComponent<{
87
88
  className?: string;
88
89
  "data-force"?: string;
89
90
  } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
91
+ /** The ⋯ button's own props, for a part that draws it through another Button (the Picker's phone row, under `panelControls`). */
92
+ export declare const menuDotsProps: (label: string, className?: string) => ButtonProps;
@@ -87,7 +87,7 @@ export const useSheetMenus = () => { const phone = usePhone(), screen = React.us
87
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-slot": slot, "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, { nativeButton: false, render: (props) => _jsx("span", { ...props, hidden: true, tabIndex: undefined, "aria-label": label }) })) : (_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 });
@@ -103,5 +103,6 @@ function ContextMenuPopup({ entries, label, children, className, open, onOpenCha
103
103
  return (_jsxs(BaseContextMenu.Root, { open: open, onOpenChange: onOpenChange ? (o) => onOpenChange(o) : undefined, children: [_jsxs(BaseContextMenu.Trigger, { className: className, children: [_jsx("span", { ref: ref, hidden: true }), children] }), _jsx(BaseContextMenu.Portal, { container: host, className: "o-menu-portal", children: _jsx(BaseContextMenu.Positioner, { ref: setAt, className: "o-list-positioner", collisionPadding: spacingPx(2, at ?? host), children: _jsx(BaseContextMenu.Popup, { className: "o-list o-menu o-smooth o-smooth-ease", "aria-label": label, "data-kit": "menu", ...mark, children: _jsx(MenuScroll, { children: _jsx(MenuListRows, { entries: entries, host: host }) }) }) }) })] }));
104
104
  }
105
105
  export const MenuDots = React.forwardRef(function MenuDots({ label, className, ...props }, ref) {
106
- return _jsx(Button, { ref: ref, kind: "quiet", shape: "icon", size: "sm", "aria-label": label, className: cx("o-menu-dots", className), icon: glyph(DOTS, ""), ...props });
106
+ return _jsx(Button, { ref: ref, ...menuDotsProps(label, className), ...props });
107
107
  });
108
+ export const menuDotsProps = (label, className) => ({ kind: "quiet", shape: "icon", size: "sm", "aria-label": label, className: cx("o-menu-dots", className), icon: glyph(DOTS, "") });
@@ -37,6 +37,8 @@ export function numberEditorWordsOf(say) {
37
37
  increase: say({ key: "views.editors.number-increase" }),
38
38
  decrease: say({ key: "views.editors.number-decrease" }),
39
39
  numberField: say({ key: "views.editors.number-field" }),
40
+ close: say({ key: "views.panels.close" }),
41
+ save: say({ key: "views.editors.save" }),
40
42
  picker: pickerWordsOf(say),
41
43
  };
42
44
  }
@@ -174,7 +174,7 @@ export function useNumberEditor(props) {
174
174
  return { body, head: { onBack: () => setChoosing(false), backSlot: "vk-editor-back", close: false }, title: words.name };
175
175
  if (shell)
176
176
  return { body, head: {} };
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 }) } };
177
+ return { body, 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: keep }) } };
178
178
  }
179
179
  const onBlur = (e) => {
180
180
  if (shell || settled.current || choosing || (e.relatedTarget instanceof Node && e.currentTarget.contains(e.relatedTarget)))
@@ -15,6 +15,9 @@ export interface NumberEditorWords {
15
15
  increase: string;
16
16
  decrease: string;
17
17
  numberField: string;
18
+ /** A phone's head where no holder keeps the draft: its ✕ and ✓ (VK-997). */
19
+ close: string;
20
+ save: string;
18
21
  /** The words of its lists. */
19
22
  picker?: Partial<PickerWords>;
20
23
  }
@@ -9,5 +9,7 @@ export const NUMBER_EDITOR_WORDS = {
9
9
  increase: "Increase",
10
10
  decrease: "Decrease",
11
11
  numberField: "Number field",
12
+ close: "Close",
13
+ save: "Save",
12
14
  };
13
15
  export const numberWords = (given) => (given ? { ...NUMBER_EDITOR_WORDS, ...given } : NUMBER_EDITOR_WORDS);
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ /** A field list's Picker, framed to stand as wide as its rows. */
3
+ export declare function FieldsFrame({ children }: {
4
+ children: React.ReactNode;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ export function FieldsFrame({ children }) {
5
+ const box = React.useRef(null);
6
+ React.useLayoutEffect(() => {
7
+ const at = box.current;
8
+ let gone = false;
9
+ const hold = () => {
10
+ const list = at?.querySelector('.o-picker[data-picker-form="computer"]'), input = list?.querySelector(".o-picker-search input");
11
+ if (gone || !at || !list || !input)
12
+ return;
13
+ at.style.removeProperty("--picker-floor");
14
+ const s = getComputedStyle(input), line = input.closest(".o-picker-search"), pen = document.createElement("canvas").getContext("2d");
15
+ const px = (v) => parseFloat(v) || 0, edge = list.getBoundingClientRect(), field = input.getBoundingClientRect();
16
+ const round = field.left + px(s.borderLeftWidth) + px(s.paddingLeft) - edge.left
17
+ + px(s.paddingRight) + px(s.borderRightWidth) + px(getComputedStyle(line).paddingRight) + (edge.right - line.getBoundingClientRect().right);
18
+ let words = 0;
19
+ if (pen && input.placeholder) {
20
+ pen.font = `${s.fontStyle} ${s.fontWeight} ${s.fontSize} ${s.fontFamily}`;
21
+ words = pen.measureText(input.placeholder).width;
22
+ }
23
+ at.style.setProperty("--picker-floor", `${Math.ceil(Math.max(edge.width, round + words))}px`);
24
+ };
25
+ hold();
26
+ void document.fonts?.ready.then(hold);
27
+ return () => { gone = true; };
28
+ }, []);
29
+ return _jsx("span", { ref: box, className: "o-fields-body", children: children });
30
+ }
@@ -14,5 +14,5 @@ export declare function fieldsBodyHandlers({ onPick, onDone }: Pick<ViewsFieldsB
14
14
  onValueChange(v: string | string[] | null): void;
15
15
  onDone(): void;
16
16
  };
17
- /** ViewKit's field list, drawn as the Picker. */
18
- export declare function MapFieldsBody({ label, search, fields, own, form, onPick, onDone }: ViewsFieldsBodyProps): import("react/jsx-runtime").JSX.Element;
17
+ /** ViewKit's field list, its controls the app's where the provider's `panelControls` names them (VK-1022). */
18
+ export declare function MapFieldsBody(props: ViewsFieldsBodyProps): import("react/jsx-runtime").JSX.Element;
@@ -2,8 +2,10 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { useViews } from "../../provider/context.js";
5
+ import { FieldsFrame } from "./fields-frame.js";
5
6
  import { Picker } from "./picker.js";
6
7
  import { pickerWordsOf } from "./map-picker.js";
8
+ import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
7
9
  const SEP = "\u0000";
8
10
  export const farValue = (relation, key) => `${relation}${SEP}${key}`;
9
11
  export const pickOf = (value) => {
@@ -35,33 +37,12 @@ export function fieldsBodyHandlers({ onPick, onDone }, held = { current: false }
35
37
  },
36
38
  };
37
39
  }
38
- export function MapFieldsBody({ label, search, fields, own, form, onPick, onDone }) {
40
+ export function MapFieldsBody(props) {
41
+ return _jsx(PanelControlsFromViews, { children: _jsx(FieldsBodyInner, { ...props }) });
42
+ }
43
+ function FieldsBodyInner({ label, search, fields, own, ownRelation, form, onPick, onDone }) {
39
44
  const { messages } = useViews();
40
45
  const picked = React.useRef(false);
41
46
  const on = () => fieldsBodyHandlers({ onPick, onDone }, picked);
42
- const box = React.useRef(null);
43
- React.useLayoutEffect(() => {
44
- const at = box.current;
45
- let gone = false;
46
- const hold = () => {
47
- const list = at?.querySelector('.o-picker[data-picker-form="computer"]'), input = list?.querySelector(".o-picker-search input");
48
- if (gone || !at || !list || !input)
49
- return;
50
- at.style.removeProperty("--picker-floor");
51
- const s = getComputedStyle(input), line = input.closest(".o-picker-search"), pen = document.createElement("canvas").getContext("2d");
52
- const px = (v) => parseFloat(v) || 0, edge = list.getBoundingClientRect(), field = input.getBoundingClientRect();
53
- const round = field.left + px(s.borderLeftWidth) + px(s.paddingLeft) - edge.left
54
- + px(s.paddingRight) + px(s.borderRightWidth) + px(getComputedStyle(line).paddingRight) + (edge.right - line.getBoundingClientRect().right);
55
- let words = 0;
56
- if (pen && input.placeholder) {
57
- pen.font = `${s.fontStyle} ${s.fontWeight} ${s.fontSize} ${s.fontFamily}`;
58
- words = pen.measureText(input.placeholder).width;
59
- }
60
- at.style.setProperty("--picker-floor", `${Math.ceil(Math.max(edge.width, round + words))}px`);
61
- };
62
- hold();
63
- void document.fonts?.ready.then(hold);
64
- return () => { gone = true; };
65
- }, []);
66
- return _jsx("span", { ref: box, className: "o-fields-body", children: _jsx(Picker, { label: label, items: fieldItemsOf(fields, messages({ key: "views.panels.related-records" })), value: own ?? null, search: search, searchShown: true, form: form, words: pickerWordsOf(messages), onValueChange: (v) => on().onValueChange(v), onDone: () => on().onDone() }) });
47
+ return _jsx(FieldsFrame, { children: _jsx(Picker, { label: label, items: fieldItemsOf(fields, messages({ key: "views.panels.related-records" })), value: own === undefined ? null : ownRelation !== undefined ? farValue(ownRelation, own) : own, search: search, searchShown: true, form: form, words: pickerWordsOf(messages), onValueChange: (v) => on().onValueChange(v), onDone: () => on().onDone() }) });
67
48
  }
@@ -10,14 +10,20 @@ type AppIcon = ComponentType<{
10
10
  /**
11
11
  * ViewKit's rows as the Picker's (the public rule; the editors' own `pickerItemOf` is another, internal one). The words, the
12
12
  * second line, the group and whether it can be picked stay as they are; the kind's word comes from the badge; then how its name
13
- * draws, the first that applies: an avatar where ViewKit hands one (a person, or a company by its kind), the record's own glyph,
13
+ * draws, the first that applies: an avatar where ViewKit hands one (a person, or a company by its kind; the kind itself carried
14
+ * for the app's Avatar atom, so a deal stays a deal, VK-1044), the record's own glyph,
14
15
  * a status step, an option, the app's icon (`AppIcon`; without it, none). A step between stands at its quarters among the steps
15
16
  * between: the status's active steps when `steps` names them, so one that isn't a step (an archived option held) stands nowhere,
16
17
  * as its cell does; else every row on a step between. A category's colour isn't drawn: the Option in the list has one look.
18
+ * With `cells` (ViewKit's Picker, VK-1056), a status and a category are drawn as their cells draw them instead: the app's
19
+ * StatusBadge at its place among the steps and the app's Tag in its colour (the colour the editor resolved, an undeclared
20
+ * option's derived one included), each with its icon; this needs a provider, which the Picker always stands in. Held among the
21
+ * search's chips (the look Chips), a category stands as the app's Tag with its remove (VK-1059).
17
22
  */
18
- export declare function pickerItemsOf(items: readonly ViewsPickerItem[], { AppIcon, steps }?: {
23
+ export declare function pickerItemsOf(items: readonly ViewsPickerItem[], { AppIcon, steps, cells }?: {
19
24
  AppIcon?: AppIcon;
20
25
  steps?: readonly string[];
26
+ cells?: boolean;
21
27
  }): PickerItem[];
22
28
  /** The Picker's words in the app's: each from its `views.picker.*` message. */
23
29
  export declare function pickerWordsOf(say: ViewsMessageResolver): PickerWords;
@@ -26,6 +32,6 @@ export declare function pickerWordsOf(say: ViewsMessageResolver): PickerWords;
26
32
  export declare const menuWordsOf: (say: ViewsMessageResolver) => MenuWords;
27
33
  /** What the Picker is handed for ViewKit's props: its rows read as the Picker's, an action's key its id, the shell's draft, its words and its menus'. */
28
34
  export declare function pickerPropsOf({ items, actions, steps, ...rest }: ViewsPickerProps, AppIcon?: AppIcon, words?: PickerWords, menuWords?: MenuWords): PickerProps;
29
- /** ViewKit's pick list, drawn as the Picker. */
35
+ /** ViewKit's pick list, its controls the app's where the provider's `panelControls` names them, wherever it stands (VK-1022). */
30
36
  export declare function MapPicker(props: ViewsPickerProps): import("react/jsx-runtime").JSX.Element;
31
37
  export {};
@@ -2,10 +2,14 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useViews } from "../../provider/context.js";
4
4
  import { quartersOf, statusPlaceOf } from "../status/atom-status-badge.js";
5
+ import { OptionCategory, OptionStatus } from "../../display/option-badges.js";
6
+ import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
5
7
  import { Picker } from "./picker.js";
6
- export function pickerItemsOf(items, { AppIcon, steps } = {}) {
8
+ export function pickerItemsOf(items, { AppIcon, steps, cells } = {}) {
7
9
  const between = (i) => i.avatarUrl === undefined && !i.glyph && !!i.slot && statusPlaceOf(i.slot) === "between";
8
10
  const onSteps = items.filter((i) => between(i) && (!steps || steps.includes(i.value)));
11
+ const stepOptions = items.filter((i) => i.avatarUrl === undefined && !i.glyph && !!i.slot && (!steps || steps.includes(i.value))).map((i) => ({ value: i.value, label: i.label, slot: i.slot }));
12
+ const placeOf = (value) => { const index = stepOptions.findIndex((o) => o.value === value); return index < 0 ? undefined : { index, options: stepOptions }; };
9
13
  return items.map((i) => {
10
14
  const item = { value: i.value, label: i.label };
11
15
  if (i.line !== undefined)
@@ -17,9 +21,15 @@ export function pickerItemsOf(items, { AppIcon, steps } = {}) {
17
21
  if (i.badge !== undefined)
18
22
  item.kind = i.badge;
19
23
  if (i.avatarUrl !== undefined)
20
- item.as = { avatar: i.kind === "company" ? "company" : "person", id: i.value, ...(i.avatarUrl ? { src: i.avatarUrl } : {}) };
24
+ item.as = { avatar: i.kind === "company" ? "company" : "person", id: i.value, ...(i.avatarUrl ? { src: i.avatarUrl } : {}), ...(i.kind !== undefined ? { kind: i.kind } : {}) };
21
25
  else if (i.glyph)
22
26
  item.as = { mark: i.glyph };
27
+ else if (i.slot && cells)
28
+ item.as = { chip: _jsx(OptionStatus, { slot: i.slot, label: i.label, icon: i.icon, place: placeOf(i.value) }) };
29
+ else if (i.color && cells) {
30
+ const { label, color, icon } = i;
31
+ item.as = { chip: _jsx(OptionCategory, { label: label, color: color, icon: icon }), removable: (onRemove) => _jsx(OptionCategory, { label: label, color: color, icon: icon, onRemove: onRemove }) };
32
+ }
23
33
  else if (i.slot) {
24
34
  const status = statusPlaceOf(i.slot);
25
35
  item.as = status !== "between" ? { status } : { status, quarters: onSteps.includes(i) ? quartersOf(onSteps, i) : 2 };
@@ -65,12 +75,15 @@ export function pickerPropsOf({ items, actions, steps, ...rest }, AppIcon, words
65
75
  ...rest,
66
76
  ...(words ? { words } : {}),
67
77
  ...(menuWords ? { menuWords } : {}),
68
- items: pickerItemsOf(items, { ...(AppIcon ? { AppIcon } : {}), ...(steps ? { steps } : {}) }),
78
+ items: pickerItemsOf(items, { ...(AppIcon ? { AppIcon } : {}), ...(steps ? { steps } : {}), cells: true }),
69
79
  ...(actions ? { actions: actions.map((a) => ({ id: a.key, label: a.label, icon: a.icon ?? null, onSelect: a.onSelect })) } : {}),
70
80
  draft: "shell",
71
81
  };
72
82
  }
73
83
  export function MapPicker(props) {
84
+ return _jsx(PanelControlsFromViews, { children: _jsx(PickerInner, { ...props }) });
85
+ }
86
+ function PickerInner(props) {
74
87
  const { components, messages } = useViews();
75
88
  return _jsx(Picker, { ...pickerPropsOf(props, components.AppIcon, pickerWordsOf(messages), menuWordsOf(messages)) });
76
89
  }