viewkitjs 0.34.0 → 0.35.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 (198) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/package.json +1 -1
  3. package/views/README.md +1 -1
  4. package/views/dist/atoms/Avatar.js +2 -1
  5. package/views/dist/atoms/RelationChip.d.ts +2 -0
  6. package/views/dist/atoms/RelationChip.js +5 -0
  7. package/views/dist/atoms/RowMenu.d.ts +1 -1
  8. package/views/dist/atoms/RowMenu.js +15 -3
  9. package/views/dist/atoms/defaults.js +2 -0
  10. package/views/dist/atoms/types.d.ts +40 -4
  11. package/views/dist/cells/relation-wrap.js +9 -2
  12. package/views/dist/contract.d.ts +9 -6
  13. package/views/dist/contract.js +4 -2
  14. package/views/dist/controls/avatar/avatar-mark.d.ts +4 -0
  15. package/views/dist/controls/avatar/avatar-mark.js +5 -0
  16. package/views/dist/controls/avatar/avatar.d.ts +7 -4
  17. package/views/dist/controls/avatar/avatar.js +10 -4
  18. package/views/dist/controls/avatar/looks.d.ts +1 -1
  19. package/views/dist/controls/avatar/looks.js +3 -0
  20. package/views/dist/controls/avatar/record-mark.d.ts +16 -0
  21. package/views/dist/controls/avatar/record-mark.js +13 -0
  22. package/views/dist/controls/avatar/tokens.d.ts +12 -0
  23. package/views/dist/controls/avatar/tokens.js +3 -0
  24. package/views/dist/controls/avatar.css +54 -17
  25. package/views/dist/controls/bulk-bar/bulk-bar.js +4 -5
  26. package/views/dist/controls/bulk-bar/map-selection-bar.js +2 -1
  27. package/views/dist/controls/compound-editor/compound-editor.d.ts +3 -0
  28. package/views/dist/controls/compound-editor/map-parts-body.d.ts +1 -1
  29. package/views/dist/controls/compound-editor/map-parts-body.js +6 -1
  30. package/views/dist/controls/compound-editor/name-parts.js +2 -1
  31. package/views/dist/controls/compound-editor/place-parts.js +2 -2
  32. package/views/dist/controls/compound-editor/range-parts.js +10 -9
  33. package/views/dist/controls/customize/customize.d.ts +14 -5
  34. package/views/dist/controls/customize/customize.js +11 -14
  35. package/views/dist/controls/customize/map-customize-body.js +12 -11
  36. package/views/dist/controls/customize/words.d.ts +3 -3
  37. package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
  38. package/views/dist/controls/filter-editor/filter-editor.js +4 -6
  39. package/views/dist/controls/filter-editor/parts.d.ts +1 -1
  40. package/views/dist/controls/filter-editor/parts.js +4 -4
  41. package/views/dist/controls/index.d.ts +1 -1
  42. package/views/dist/controls/internal/map-panel-controls.js +9 -5
  43. package/views/dist/controls/internal/panel-controls.d.ts +27 -3
  44. package/views/dist/controls/internal/panel-controls.js +141 -12
  45. package/views/dist/controls/links-editor/links-editor.js +5 -7
  46. package/views/dist/controls/links-editor/map-links-body.d.ts +1 -1
  47. package/views/dist/controls/links-editor/map-links-body.js +5 -1
  48. package/views/dist/controls/menu/menu.d.ts +3 -0
  49. package/views/dist/controls/menu/menu.js +2 -1
  50. package/views/dist/controls/picker/map-fields-body.d.ts +2 -2
  51. package/views/dist/controls/picker/map-fields-body.js +5 -1
  52. package/views/dist/controls/picker/map-picker.d.ts +8 -3
  53. package/views/dist/controls/picker/map-picker.js +14 -3
  54. package/views/dist/controls/picker/picker.js +11 -8
  55. package/views/dist/controls/picker/rows.d.ts +7 -2
  56. package/views/dist/controls/quick-filters/map-quick-filters-body.js +2 -1
  57. package/views/dist/controls/quick-filters/quick-filters.js +4 -4
  58. package/views/dist/controls/quick-filters/reminder.js +2 -2
  59. package/views/dist/controls/quick-filters/rules.d.ts +4 -1
  60. package/views/dist/controls/quick-filters/words.d.ts +2 -0
  61. package/views/dist/controls/quick-filters/words.js +1 -0
  62. package/views/dist/controls/select/select.d.ts +3 -0
  63. package/views/dist/controls/select/select.js +9 -3
  64. package/views/dist/controls/sort-editor/sort-editor.d.ts +2 -0
  65. package/views/dist/controls/sort-editor/sort-editor.js +4 -5
  66. package/views/dist/controls/toolbar/toolbar.d.ts +25 -12
  67. package/views/dist/controls/toolbar/toolbar.js +15 -20
  68. package/views/dist/controls/toolbar.css +0 -5
  69. package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
  70. package/views/dist/controls/tooltip/map-tooltip.js +4 -2
  71. package/views/dist/controls/values-editor/map-values-body.d.ts +1 -2
  72. package/views/dist/controls/values-editor/map-values-body.js +5 -1
  73. package/views/dist/controls/values-editor/values-editor.js +8 -7
  74. package/views/dist/display/option-badges.d.ts +16 -0
  75. package/views/dist/display/option-badges.js +11 -0
  76. package/views/dist/display/relation-link.d.ts +12 -0
  77. package/views/dist/display/relation-link.js +17 -0
  78. package/views/dist/display/relation.d.ts +1 -1
  79. package/views/dist/display/relation.js +10 -3
  80. package/views/dist/display/select.js +1 -8
  81. package/views/dist/editors/EditorPanel.js +1 -1
  82. package/views/dist/editors/RangeEditor.d.ts +3 -0
  83. package/views/dist/editors/RangeEditor.js +2 -2
  84. package/views/dist/editors/SelectEditor.d.ts +2 -2
  85. package/views/dist/editors/SelectEditor.js +1 -1
  86. package/views/dist/editors/TextEditor.js +4 -2
  87. package/views/dist/editors/ValueListEditor.js +2 -1
  88. package/views/dist/field-row/FieldRow.js +32 -5
  89. package/views/dist/field-row/editors/RowRangeEditor.js +2 -1
  90. package/views/dist/grid/chrome/GridAddColumn.js +9 -6
  91. package/views/dist/grid/chrome/GridCellEditors.js +1 -1
  92. package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -1
  93. package/views/dist/grid/chrome/GridCellOutline.js +16 -6
  94. package/views/dist/grid/chrome/GridChipsEditor.js +3 -2
  95. package/views/dist/grid/chrome/GridColumnMenu.js +7 -4
  96. package/views/dist/grid/chrome/GridFooter.d.ts +4 -1
  97. package/views/dist/grid/chrome/GridFooter.js +4 -4
  98. package/views/dist/grid/chrome/GridGroupMenu.js +39 -14
  99. package/views/dist/grid/chrome/GridHeader.d.ts +1 -1
  100. package/views/dist/grid/chrome/GridHeader.js +1 -2
  101. package/views/dist/grid/chrome/GridRangeEditor.d.ts +4 -1
  102. package/views/dist/grid/chrome/GridRangeEditor.js +2 -2
  103. package/views/dist/grid/chrome/GridRow.js +5 -3
  104. package/views/dist/grid/chrome/GridRowActions.d.ts +4 -1
  105. package/views/dist/grid/chrome/GridRowActions.js +2 -2
  106. package/views/dist/grid/chrome/GridRowCells.js +3 -2
  107. package/views/dist/grid/chrome/GridStructure.js +1 -1
  108. package/views/dist/grid/chrome/GridTable.js +32 -20
  109. package/views/dist/grid/chrome/checks.d.ts +1 -1
  110. package/views/dist/grid/chrome/checks.js +4 -1
  111. package/views/dist/grid/chrome/grid-cell-classes.d.ts +6 -2
  112. package/views/dist/grid/chrome/grid-cell-classes.js +10 -5
  113. package/views/dist/grid/chrome/grid-hover.d.ts +10 -2
  114. package/views/dist/grid/chrome/grid-hover.js +14 -4
  115. package/views/dist/grid/chrome/grid-row-props.d.ts +4 -0
  116. package/views/dist/grid/chrome/grid-rows-menu.js +9 -4
  117. package/views/dist/grid/chrome/grid-table-props.d.ts +10 -2
  118. package/views/dist/grid/grid.css +6 -0
  119. package/views/dist/grid/looks.d.ts +3 -1
  120. package/views/dist/grid/looks.js +10 -4
  121. package/views/dist/list/layer.d.ts +8 -0
  122. package/views/dist/list/layer.js +7 -0
  123. package/views/dist/list/store.d.ts +1 -1
  124. package/views/dist/list/toolbar.js +44 -19
  125. package/views/dist/list/views.js +1 -0
  126. package/views/dist/panels/availability.d.ts +5 -0
  127. package/views/dist/panels/availability.js +4 -5
  128. package/views/dist/panels/customize-body.d.ts +4 -0
  129. package/views/dist/panels/customize-body.js +13 -11
  130. package/views/dist/panels/model.d.ts +9 -4
  131. package/views/dist/panels/react/customize-body.js +5 -2
  132. package/views/dist/panels/react/customize.d.ts +5 -0
  133. package/views/dist/panels/react/filter/FilterEditor.d.ts +6 -0
  134. package/views/dist/panels/react/filter/FilterEditor.js +7 -0
  135. package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +3 -1
  136. package/views/dist/panels/react/quick/QuickFiltersPanel.js +7 -3
  137. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +4 -1
  138. package/views/dist/panels/react/toolbar/Toolbar.d.ts +11 -1
  139. package/views/dist/panels/react/toolbar/Toolbar.js +16 -6
  140. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +6 -1
  141. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +12 -5
  142. package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +7 -3
  143. package/views/dist/panels/react/toolbar/ToolbarFilters.js +18 -8
  144. package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +6 -1
  145. package/views/dist/panels/react/toolbar/ToolbarOptions.js +2 -2
  146. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
  147. package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
  148. package/views/dist/panels/react/toolbar/ToolbarSave.js +5 -4
  149. package/views/dist/panels/react/toolbar/ToolbarSort.d.ts +7 -1
  150. package/views/dist/panels/react/toolbar/ToolbarSort.js +6 -3
  151. package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +3 -0
  152. package/views/dist/panels/react/toolbar/ToolbarSortPill.js +4 -4
  153. package/views/dist/panels/react/views-row/ViewPicker.js +13 -5
  154. package/views/dist/panels/react.d.ts +1 -1
  155. package/views/dist/panels/settings/layout.js +6 -38
  156. package/views/dist/panels/toolbar/page-resets.d.ts +17 -0
  157. package/views/dist/panels/toolbar/page-resets.js +62 -0
  158. package/views/dist/panels/toolbar/same-item.d.ts +7 -0
  159. package/views/dist/panels/toolbar/same-item.js +9 -0
  160. package/views/dist/panels/view-state.d.ts +4 -0
  161. package/views/dist/provider/ViewsProvider.d.ts +9 -4
  162. package/views/dist/provider/ViewsProvider.js +13 -2
  163. package/views/dist/provider/components.d.ts +27 -5
  164. package/views/dist/provider/components.js +1 -1
  165. package/views/dist/react.d.ts +1 -1
  166. package/views/dist/styles.css +98 -23
  167. package/views/dist/styles.unlayered.css +98 -23
  168. package/views/docs/contract.md +38 -25
  169. package/views/docs/controls/avatar.md +3 -0
  170. package/views/docs/controls/bulk-bar.md +3 -1
  171. package/views/docs/controls/compound-editor.md +2 -0
  172. package/views/docs/controls/customize.md +1 -1
  173. package/views/docs/controls/filter-editor.md +1 -1
  174. package/views/docs/controls/links-editor.md +2 -0
  175. package/views/docs/controls/pane.md +1 -1
  176. package/views/docs/controls/picker.md +2 -0
  177. package/views/docs/controls/quick-filters.md +1 -1
  178. package/views/docs/controls/text-editor.md +1 -1
  179. package/views/docs/controls/values-editor.md +2 -0
  180. package/views/docs/guides/atoms.md +54 -3
  181. package/views/docs/guides/display.md +1 -1
  182. package/views/docs/guides/looks.md +1 -1
  183. package/views/docs/guides/the-grid.md +4 -2
  184. package/views/docs/guides/the-provider.md +2 -2
  185. package/views/docs/index.md +2 -2
  186. package/views/docs/install.md +198 -104
  187. package/views/docs/reference/controls.md +17 -15
  188. package/views/docs/reference/editors-range.md +1 -1
  189. package/views/docs/reference/field-row.md +1 -1
  190. package/views/docs/reference/grid.md +2 -1
  191. package/views/docs/reference/list.md +2 -2
  192. package/views/docs/reference/looks.md +5 -5
  193. package/views/docs/reference/panels-react.md +13 -12
  194. package/views/docs/reference/panels.md +4 -4
  195. package/views/docs/reference/react.md +10 -8
  196. package/views/docs/reference/views.md +2 -2
  197. package/views/docs/reshaping.md +22 -6
  198. package/views/skills/views/SKILL.md +2 -2
@@ -7,6 +7,7 @@ import { cx as cn } from "../../internal/cx.js";
7
7
  import { Button, ButtonGroup } from "../button/button.js";
8
8
  import { Input, InputGroup, InputGroupAddon, InputGroupButton } from "../input/input.js";
9
9
  import { Icon } from "../internal/icons.js";
10
+ import { isAppButton } from "../internal/panel-controls.js";
10
11
  import { PhoneHost, usePhone } from "../internal/phone.js";
11
12
  import { watchFrame } from "../internal/watch-frame.js";
12
13
  import { Menu } from "../menu/menu.js";
@@ -42,7 +43,7 @@ const isFolds = (el) => el.type === ToolbarFolds;
42
43
  export function ToolbarFolds({ children }) {
43
44
  return children(0);
44
45
  }
45
- const isButton = (el) => el.type === Button;
46
+ const isButton = (el) => el.type === Button || isAppButton(el.type);
46
47
  const words = (n) => (typeof n === "string" || typeof n === "number" ? String(n) : null);
47
48
  const flat = (nodes) => React.Children.toArray(nodes).flatMap((n) => !React.isValidElement(n) ? [] : n.type === React.Fragment ? flat(n.props.children) : [n]);
48
49
  const itemsOf = (nodes, line) => {
@@ -62,14 +63,12 @@ const isJoined = (el) => isGroup(el) && !!el.props["aria-label"] && flat(el.prop
62
63
  const folds = (el) => (isToolbarButton(el) && !el.props.stays)
63
64
  || (isJoined(el) && el.props["data-open"] == null);
64
65
  const isFilter = (el) => !!el && (isJoined(el) || (isToolbarButton(el) && !!el.props.filter));
65
- function stepsOf(items, fill = false) {
66
- const lead = fill ? items.findIndex((el) => sheds(el) && !isTab(el) && !isFilter(el)) : -1;
67
- const from = (test, to) => items.flatMap((el, i) => (i !== lead && test(el) ? [{ i, to }] : [])).reverse();
66
+ function stepsOf(items) {
67
+ const from = (test, to) => items.flatMap((el, i) => (test(el) ? [{ i, to }] : [])).reverse();
68
68
  const held = (kind) => (el, i) => isFolds(el) && el.props.kind === kind ? Array.from({ length: Math.max(0, el.props.count) }, () => ({ i, to: "fold" })) : [];
69
69
  const fromWith = (test, kind) => items.flatMap((el, i) => (test(el) ? [{ i, to: "fold" }] : held(kind)(el, i))).reverse();
70
- const last = lead < 0 ? [] : [{ i: lead, to: "icon" }, ...(folds(items[lead]) ? [{ i: lead, to: "fold" }] : [])];
71
70
  return [...from(sheds, "icon"), ...fromWith((el) => folds(el) && isTab(el), "tabs"), ...fromWith((el) => folds(el) && isFilter(el), "filters"),
72
- ...from((el) => folds(el) && !isTab(el) && !isFilter(el), "fold"), ...last];
71
+ ...from((el) => folds(el) && !isTab(el) && !isFilter(el), "fold")];
73
72
  }
74
73
  export const toolbarSteps = stepsOf;
75
74
  function overflows(line) {
@@ -158,7 +157,7 @@ function useGiveWay(line, max, on, holds = false) {
158
157
  }, [line, on, look]);
159
158
  return stage;
160
159
  }
161
- export function ToolbarControl({ label, children, bar, barLabel: barNamed, words: given, views, settings, search, add, sort, filter, filters, save, quick, added = false, picks: said, size, barSize, spacing, fold = true, fill = false, more, holds = false, form, onMoreViews, moreViewsOpen, className, style, onKeyDown, ...props }) {
160
+ export function ToolbarControl({ label, children, bar, barLabel: barNamed, words: given, views, settings, search, add, sort, filter, filters, save, quick, added = false, picks: said, size, barSize, spacing, fold = true, overflow, moreViews: ownViews, moreFilters: ownFilters, holds = false, form, onMoreViews, moreViewsOpen, className, style, onKeyDown, ...props }) {
162
161
  const spoken = toolbarWords(given), barLabel = barNamed ?? spoken.bar;
163
162
  const host = React.useContext(PhoneHost), narrow = usePhone();
164
163
  const phone = form ? form === "phone" : host != null || narrow;
@@ -227,7 +226,7 @@ export function ToolbarControl({ label, children, bar, barLabel: barNamed, words
227
226
  e.preventDefault();
228
227
  to.focus();
229
228
  };
230
- return (_jsx(BaseToolbar.Root, { ref: setRoot, "aria-label": label, orientation: "horizontal", className: cn("o-toolbar", className), "data-kit": "toolbar", "data-screen": phone ? "phone" : "computer", "data-size": height, "data-lines": listed && !phone ? picks.lines : undefined, "data-fill": fill ? "" : undefined, style: spacing != null ? { ...style, "--toolbar-spacing": spacing } : style, onKeyDown: ends, ...props, children: _jsx(Said.Provider, { value: spoken, children: lines.map((l) => (_jsx(InToolbar.Provider, { value: { size: l.size, form: phone ? "phone" : "computer" }, children: _jsx(Line, { id: l.id, label: l.label, items: l.items, size: l.size, fold: fold, fill: fill && l.id === "row", entries: l.id === "row" ? more : undefined, holds: holds, more: onMoreViews ? { press: onMoreViews, open: !!moreViewsOpen } : undefined }) }, l.id))) }) }));
229
+ return (_jsx(BaseToolbar.Root, { ref: setRoot, "aria-label": label, orientation: "horizontal", className: cn("o-toolbar", className), "data-kit": "toolbar", "data-screen": phone ? "phone" : "computer", "data-size": height, "data-lines": listed && !phone ? picks.lines : undefined, style: spacing != null ? { ...style, "--toolbar-spacing": spacing } : style, onKeyDown: ends, ...props, children: _jsx(Said.Provider, { value: spoken, children: lines.map((l) => (_jsx(InToolbar.Provider, { value: { size: l.size, form: phone ? "phone" : "computer" }, children: _jsx(Line, { id: l.id, label: l.label, items: l.items, size: l.size, fold: fold, overflow: overflow, own: { views: ownViews, filters: ownFilters }, holds: holds, more: onMoreViews ? { press: onMoreViews, open: !!moreViewsOpen } : undefined }) }, l.id))) }) }));
231
230
  }
232
231
  function dressNew(el, form, ground) {
233
232
  if (!isButton(el))
@@ -236,10 +235,10 @@ function dressNew(el, form, ground) {
236
235
  const kind = form.startsWith("primary") ? "primary" : form.startsWith("outline") ? "outline" : KIND_OF_GROUND[ground];
237
236
  return React.cloneElement(el, { kind, ...(form.endsWith("-icon") ? { shape: "icon", children: undefined, "aria-label": p["aria-label"] ?? said ?? undefined } : {}) });
238
237
  }
239
- function Line({ id, label, items, size, fold, fill, entries, holds, more: moreViews }) {
238
+ function Line({ id, label, items, size, fold, overflow, own, holds, more: moreViews }) {
240
239
  const [line, setLine] = React.useState(null);
241
240
  const said = React.useContext(Said);
242
- const steps = fold ? stepsOf(items, fill) : [];
241
+ const steps = fold ? stepsOf(items) : [];
243
242
  const stage = useGiveWay(line, steps.length, fold, holds);
244
243
  const iconAlone = new Set(), folded = new Set(), foldedIn = new Map();
245
244
  for (const s of steps.slice(0, stage)) {
@@ -263,22 +262,20 @@ function Line({ id, label, items, size, fold, fill, entries, holds, more: moreVi
263
262
  return [{ icon: p.icon ?? null, label: words(p.children) ?? p.label, count: p.count, disabled: p.disabled ? said.cantUse : undefined,
264
263
  onSelect: () => pressAt(p.onClick, line?.querySelector(at)) }];
265
264
  };
266
- const given = entries != null, always = !!entries?.length;
267
- const moreEntries = given
268
- ? [...[...otherFolded].sort((a, b) => a - b).flatMap((i) => entryOf(items[i], "[data-more]")), ...entries]
269
- : otherFolded.flatMap((i) => entryOf(items[i], "[data-more]"));
270
- const more = (_jsx(Menu, { label: said.moreOf(label), align: "end", entries: moreEntries, trigger: _jsx(ToolbarButton, { label: said.more, icon: _jsx(Icon, { name: "dots" }), words: "icon", stays: true, "data-more": "" }) }, "more"));
265
+ const Dots = overflow?.button ?? ToolbarButton;
266
+ const more = (_jsx(Menu, { label: said.moreOf(label), align: "end", entries: otherFolded.flatMap((i) => entryOf(items[i], "[data-more]")), trigger: _jsx(Dots, { label: said.more, icon: overflow?.icon ?? _jsx(Icon, { name: "dots" }), words: "icon", stays: true, "data-more": "", ...(overflow?.className && { className: overflow.className }) }) }, "more"));
271
267
  const firstTab = items.find(isTab);
272
- const plusN = (p = {}) => (_jsx(ToolbarButton, { label: said.moreViews(tabFolded.length), words: "word", current: false, stays: true, "data-more-tabs": "", ground: firstTab?.props.ground, corners: firstTab?.props.corners, ...p, children: `+${tabFolded.length}` }, "more-tabs"));
268
+ const Plus = own.views?.button ?? ToolbarButton, MoreFilters = own.filters?.button ?? ToolbarButton;
269
+ const plusN = (p = {}) => (_jsx(Plus, { label: said.moreViews(tabFolded.length), words: "word", current: false, stays: true, "data-more-tabs": "", ground: firstTab?.props.ground, corners: firstTab?.props.corners, ...(own.views?.className && { className: own.views.className }), ...p, children: `+${tabFolded.length}` }, "more-tabs"));
273
270
  const moreTabs = !tabFolded.length ? null : moreViews
274
271
  ? plusN({ "aria-haspopup": "dialog", "aria-expanded": moreViews.open, onClick: (e) => moreViews.press(e.currentTarget) })
275
272
  : _jsx(Menu, { label: said.moreViewsOf(label), align: "start", entries: tabFolded.flatMap((i) => entryOf(items[i], "[data-more-tabs]")), trigger: plusN() }, "more-tabs");
276
273
  const n = filterFolded.length;
277
- const moreFilters = n ? (_jsx(Menu, { label: said.moreFiltersOf(label), align: "start", entries: filterFolded.flatMap((i) => entryOf(items[i], "[data-more-filters]")), trigger: _jsx(ToolbarButton, { label: said.moreFiltersName(n), words: "word", ground: "filled", stays: true, "data-more-filters": "", children: said.moreFilters(n) }) }, "more-filters")) : null;
274
+ const moreFilters = n ? (_jsx(Menu, { label: said.moreFiltersOf(label), align: "start", entries: filterFolded.flatMap((i) => entryOf(items[i], "[data-more-filters]")), trigger: _jsx(MoreFilters, { label: said.moreFiltersName(n), words: "word", ground: "filled", stays: true, "data-more-filters": "", ...(own.filters?.className && { className: own.filters.className }), children: said.moreFilters(n) }) }, "more-filters")) : null;
278
275
  const drawn = [];
279
276
  items.forEach((el, i) => {
280
277
  if (folded.has(i)) {
281
- if (i === moreAt && !given)
278
+ if (i === moreAt)
282
279
  drawn.push(more);
283
280
  if (i === tabsAt)
284
281
  drawn.push(moreTabs);
@@ -292,8 +289,6 @@ function Line({ id, label, items, size, fold, fill, entries, holds, more: moreVi
292
289
  }
293
290
  drawn.push(dress(el, iconAlone.has(i), size));
294
291
  });
295
- if (always || (given && otherFolded.length > 0))
296
- drawn.push(more);
297
292
  const shown = drawn.filter((n, k) => {
298
293
  if (!isSeparator(n))
299
294
  return true;
@@ -6,7 +6,6 @@
6
6
  search on its own line (data-line="search"), above it
7
7
  data-screen computer · phone the room between what a line holds; a phone's is one line
8
8
  data-lines across · none a list's lines in bands with a line across under each, or not
9
- data-fill (set) · none its row's worded buttons grow to share it (a record's actions)
10
9
  --toolbar-spacing how far apart what a line holds stands, in spacing steps, when what holds it says so
11
10
  --toolbar-inset the room at each side of each line, when what holds it gives one (0 unless said)
12
11
 
@@ -29,10 +28,6 @@
29
28
 
30
29
  /* What a line holds keeps its width; only a text box gives some up, from its own width down to its narrowest. */
31
30
  .o-toolbar-line > * { flex: none; }
32
- /* Filling its row (fill: a record's actions, Attio's way): the row's worded buttons grow from their own width to share the line, their
33
- words in their middle; a square one (its icon alone) keeps its own. None shrinks under its own width, so what doesn't fit still
34
- gives way. */
35
- .o-toolbar[data-fill] > .o-toolbar-line[data-line="row"] > .o-button:not(.o-button-icon, .o-button-round) { flex: 1 0 auto; }
36
31
  .o-toolbar-line > :is(.o-toolbar-input, .o-input-group:has(.o-toolbar-input)) { flex: 0 1 calc(var(--vk-spacing) * 55); min-width: calc(var(--vk-spacing) * 30); }
37
32
 
38
33
  /* A list's search: on a phone's line of its own it fills it; open on a phone's one line it takes the room the others left. */
@@ -1,3 +1,3 @@
1
1
  import type { ViewsTooltipProps } from "../../provider/components.js";
2
2
  /** ViewKit's tooltip, drawn as the kit's Tooltip: what it names is its child itself, no element round it. */
3
- export declare function MapTooltip({ content, children, side, align, delayMs, className }: ViewsTooltipProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function MapTooltip({ content, children, reason, side, align, delayMs, className }: ViewsTooltipProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { markOwnControl } from "../../provider/own-control.js";
2
3
  import { Tooltip } from "./tooltip.js";
3
- export function MapTooltip({ content, children, side, align, delayMs, className }) {
4
- return _jsx(Tooltip, { label: content, side: side, align: align, delay: delayMs, className: className, children: children });
4
+ export function MapTooltip({ content, children, reason, side, align, delayMs, className }) {
5
+ return _jsx(Tooltip, { label: content, reason: reason, side: side, align: align, delay: delayMs, className: className, children: children });
5
6
  }
7
+ markOwnControl(MapTooltip);
@@ -7,6 +7,5 @@ import type { ValuesEditorWords } from "./words.js";
7
7
  export declare function valuesEditorWordsOf(say: ViewsMessageResolver): ValuesEditorWords;
8
8
  /** ViewKit's values body's props as the Values editor's, held as a shell that keeps the draft. */
9
9
  export declare function valuesBodyPropsOf(p: ViewsValuesBodyProps, words?: ValuesEditorWords, language?: string): ValuesEditorProps;
10
- /** ViewKit's values body, drawn as the Values editor in the app's words; on a phone, a list's step told to its sheet. Outside a
11
- * provider (a page drawing the body alone), ViewKit's English. */
10
+ /** ViewKit's values body, its controls the app's where the provider's `panelControls` names them (VK-1022). */
12
11
  export declare function MapValuesBody(props: ViewsValuesBodyProps): 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 { 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 { useValuesEditor } from "./values-editor.js";
10
11
  export function valuesEditorWordsOf(say) {
11
12
  return {
@@ -63,6 +64,9 @@ export function valuesBodyPropsOf(p, words, language) {
63
64
  };
64
65
  }
65
66
  export function MapValuesBody(props) {
67
+ return _jsx(PanelControlsFromViews, { children: _jsx(ValuesBodyInner, { ...props }) });
68
+ }
69
+ function ValuesBodyInner(props) {
66
70
  const views = React.useContext(ViewsContext), messages = views?.messages ?? resolveViewsMessage;
67
71
  const words = React.useMemo(() => valuesEditorWordsOf(messages), [messages]);
68
72
  const parts = useValuesEditor(valuesBodyPropsOf(props, words, views?.conventions.language));
@@ -1,9 +1,8 @@
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";
4
+ import { Button as OwnButton } from "../button/button.js";
5
5
  import { Picker, usePicker } from "../picker/picker.js";
6
- import { Popover } from "../popover/popover.js";
7
6
  import { SheetButton } from "../sheet/bottom-sheet.js";
8
7
  import { Flag } from "../flag/flag.js";
9
8
  import { phoneMark, usePhoneForm } from "../internal/phone.js";
@@ -13,7 +12,8 @@ import { VALUES_EDITOR_ATTRS, valuesEditorWornOf } from "./looks.js";
13
12
  import { added, handedList, labelFor, labelsOf, listOf, openOf, charsThatFit, splitEmail } from "./values.js";
14
13
  import { valuesWords } from "./words.js";
15
14
  import { FieldRowsRow as FieldRow, FieldRows } from "../field/field.js";
16
- import { Input, InputGroupAddon, InputGroupButton } from "../input/input.js";
15
+ import { InputGroupAddon } from "../input/input.js";
16
+ import { usePanelControls } from "../internal/panel-controls.js";
17
17
  import { InlineInputGroup } from "../inline-input/inline-input.js";
18
18
  import { cx } from "../../internal/cx.js";
19
19
  import { moved, useReorder } from "../internal/reorder.js";
@@ -73,6 +73,7 @@ const countryItems = (language) => {
73
73
  return countries.get(language);
74
74
  };
75
75
  export function useValuesEditor(props) {
76
+ const { Button, Popover, Input, GroupButton } = usePanelControls();
76
77
  const { label, kind, value, onValueChange, onDone, dialCodes = [], autoFocus = true } = props;
77
78
  const one = props.holds === "one", shell = props.draft === "shell";
78
79
  const w = valuesWords(props.words), language = props.language ?? "en";
@@ -222,7 +223,7 @@ export function useValuesEditor(props) {
222
223
  const lifted = (r, i) => (dragging === i || posed?.id === r.id ? "" : undefined);
223
224
  const grip = (r, i, icon, size, look) => {
224
225
  const g = gripProps(i);
225
- return _jsx(Button, { kind: "quiet", shape: "icon", size: size, look: look, className: "o-values-editor-grip", "data-slot": "vk-values-grip", "aria-label": w.move(r.value), icon: glyph(icon), ...g, onPointerDown: (e) => { setPosed(null); setMainHeld(rows[0]?.id); g.onPointerDown(e); } });
226
+ return _jsx(OwnButton, { kind: "quiet", shape: "icon", size: size, look: look, className: "o-values-editor-grip", "data-slot": "vk-values-grip", "aria-label": w.move(r.value), icon: glyph(icon), ...g, onPointerDown: (e) => { setPosed(null); setMainHeld(rows[0]?.id); g.onPointerDown(e); } });
226
227
  };
227
228
  const [focusTo, setFocusTo] = React.useState(autoFocus && !phone ? (first.editing != null ? ".o-values-editor-edit input" : props.holds === "one" && first.rows.length ? ROOT : ".o-values-editor-line-input") : null);
228
229
  React.useLayoutEffect(() => {
@@ -316,12 +317,12 @@ export function useValuesEditor(props) {
316
317
  } };
317
318
  const card = (_jsxs(_Fragment, { children: [_jsxs(FieldRows, { look: ATTIO_ROWS, className: "o-values-editor-card", "data-slot": "vk-values-rows", role: "list", "aria-label": label, children: [rows.map((r, i) => {
318
319
  const act = openOf(kind, r.value);
319
- return (_jsxs(React.Fragment, { children: [_jsxs(FieldRow, { as: "div", role: "listitem", className: "o-values-editor-row", "data-slot": "vk-values-row", "data-index": i, "data-row": r.id, "data-lifted": lifted(r, i), style: lift(i), children: [!one && grip(r, i, GRIP, "32x44", { radius: "md", corner: "round", edge: "none", words: "inherit", colour: "faint", cursor: "grab", hover: "none", icon: "16" }), editing === i ? (_jsxs(InlineInputGroup, { className: "o-values-editor-edit", "data-slot": "vk-values-edit", style: ROW_40, children: [_jsx(Input, { "aria-label": w.change(r.value), value: editText, type: keys.type, inputMode: keys.inputMode, autofill: false, autoCapitalize: keys.autoCapitalize, enterKeyHint: "done", onChange: (e) => setEditText(e.target.value), onKeyDown: editKeys }), labels.length > 0 && _jsx(InputGroupAddon, { side: "end", children: _jsx(InputGroupButton, { className: "o-values-editor-edit-label", "data-slot": "vk-values-label", size: "line", look: { radius: "none", corner: "round", edge: "none", words: "sm", icon: "14", hover: "words" }, "aria-label": w.labelIs(r.label ?? w.noLabel), onClick: () => go("label", i), iconEnd: glyph(DOWN), children: r.label ?? w.label }) })] })) : _jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "o-values-editor-value", "data-slot": "vk-values-value", onClick: () => { if (!finishEdit())
320
+ return (_jsxs(React.Fragment, { children: [_jsxs(FieldRow, { as: "div", role: "listitem", className: "o-values-editor-row", "data-slot": "vk-values-row", "data-index": i, "data-row": r.id, "data-lifted": lifted(r, i), style: lift(i), children: [!one && grip(r, i, GRIP, "32x44", { radius: "md", corner: "round", edge: "none", words: "inherit", colour: "faint", cursor: "grab", hover: "none", icon: "16" }), editing === i ? (_jsxs(InlineInputGroup, { className: "o-values-editor-edit", "data-slot": "vk-values-edit", style: ROW_40, children: [_jsx(Input, { "aria-label": w.change(r.value), value: editText, type: keys.type, inputMode: keys.inputMode, autofill: false, autoCapitalize: keys.autoCapitalize, enterKeyHint: "done", onChange: (e) => setEditText(e.target.value), onKeyDown: editKeys }), labels.length > 0 && _jsx(InputGroupAddon, { side: "end", children: _jsx(GroupButton, { className: "o-values-editor-edit-label", "data-slot": "vk-values-label", size: "line", look: { radius: "none", corner: "round", edge: "none", words: "sm", icon: "14", hover: "words" }, "aria-label": w.labelIs(r.label ?? w.noLabel), onClick: () => go("label", i), iconEnd: glyph(DOWN), children: r.label ?? w.label }) })] })) : _jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "o-values-editor-value", "data-slot": "vk-values-value", onClick: () => { if (!finishEdit())
320
321
  return; setEditing(i); setEditText(r.value); setFocusTo(".o-values-editor-edit input"); }, children: r.value }), r.label && labels.length > 0 && _jsx("span", { className: "o-values-editor-label", "data-slot": "vk-values-label", children: r.label }), _jsxs("span", { className: "o-values-editor-acts", "data-slot": "vk-values-acts", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "40x44", look: { radius: "md", corner: "round", edge: "none", words: "inherit", icon: "20", hover: "none", press: "card" }, className: "o-values-editor-open", "data-slot": "vk-values-open", nativeButton: false, render: _jsx("a", { href: act.href }), "aria-label": w.open[kind](r.value), icon: glyph(kind === "phone" ? CALL : kind === "email" ? MAIL : OPEN) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "40x44", look: { radius: "md", corner: "round", edge: "none", words: "inherit", icon: "20", hover: "none", press: "card" }, className: "o-values-editor-remove", "data-slot": "vk-values-remove", "aria-label": w.remove(r.value), onClick: () => remove(i), icon: glyph(TRASH) })] })] })] }), bad[i] && !shell && _jsx("p", { className: "o-values-editor-error", "data-slot": "vk-values-error", role: "alert", children: bad[i] })] }, r.id));
321
322
  }), showLine && (_jsxs("div", { className: "o-values-editor-line", "data-slot": "vk-values-line", "data-bad": refusal ? "" : undefined, children: [kind === "phone"
322
323
  ? _jsxs(_Fragment, { children: [_jsx(Button, { kind: "quiet", size: "sm", look: { radius: "md", corner: "round", edge: "none", words: "inherit", colour: "text", icon: "12", iconColour: "faint", pad: "8", gap: "4" }, className: "o-values-editor-code", "data-slot": "vk-values-code", "aria-label": w.countryIs(countryName(reading, language)), onClick: () => go("dial"), iconEnd: glyph(DOWN), children: reading }), _jsx("span", { className: "o-values-editor-prefix", "data-slot": "vk-values-prefix", children: dialOf(reading) })] })
323
324
  : _jsx("span", { className: "o-values-editor-plus", "data-slot": "vk-values-prefix", children: glyph(PLUS) }), _jsx(Input, { chrome: "bare", numeric: true, className: "o-values-editor-line-input", "aria-label": w.add[kind], value: typed, placeholder: kind === "phone" ? patternOf(reading) : w.cardLine[kind], type: keys.type, inputMode: keys.inputMode, autofill: false, autoCapitalize: keys.autoCapitalize, enterKeyHint: "enter", onChange: (e) => setTyped(e.target.value), onKeyDown: lineKeys })] }))] }), refusal && !shell && _jsx("p", { className: "o-values-editor-error", "data-slot": "vk-values-error", role: "alert", children: refusal })] }));
324
- const cards = (_jsxs(FieldRows, { look: MIHAI_CARDS, className: "o-values-editor-cards", "data-slot": "vk-values-rows", role: "list", "aria-label": label, children: [rows.map((r, i) => (_jsxs("div", { role: "listitem", "data-slot": "vk-values-row", "data-index": i, "data-row": r.id, "data-lifted": lifted(r, i), style: lift(i), children: [_jsxs(FieldRow, { as: "div", className: "o-values-editor-card", children: [!one && grip(r, i, LINES, "20x24", { radius: "md", corner: "round", edge: "none", words: "inherit", colour: "faint", cursor: "grab", hover: "none", icon: "20" }), _jsx(Input, { chrome: "bare", numeric: true, className: "o-values-editor-card-input", "data-slot": "vk-values-value", "aria-label": w.nth[kind](i + 1), value: r.value, type: keys.type, inputMode: keys.inputMode, autofill: false, autoCapitalize: keys.autoCapitalize, onChange: (e) => setRows((rs) => rs.map((x) => (x.id === r.id ? { ...x, value: e.target.value } : x))) }), labels.length > 0 && _jsx(Button, { kind: "quiet", size: "line", look: { radius: "none", corner: "round", edge: "none", words: "sm", hover: "none" }, className: "o-values-editor-label", "data-slot": "vk-values-label", "aria-label": w.labelIs(r.label ?? w.noLabel), onClick: () => go("label", i), children: r.label ?? w.label }), _jsx(Button, { kind: "danger", shape: "round", size: "2xs", look: { edge: "none", words: "inherit", colour: "inherit", hover: "none" }, className: "o-values-editor-minus", "data-slot": "vk-values-remove", "aria-label": w.remove(r.value), onClick: () => remove(i), children: _jsx("span", {}) })] }), bad[i] && !shell && _jsx("p", { className: "o-values-editor-error", "data-slot": "vk-values-error", role: "alert", children: bad[i] })] }, r.id))), showLine && _jsxs("div", { className: "o-values-editor-adding", children: [_jsxs(FieldRow, { className: "o-values-editor-card o-values-editor-new", "data-slot": "vk-values-line", children: [kind === "phone" ? _jsxs(_Fragment, { children: [dial && _jsx(Button, { kind: "quiet", shape: "icon", size: "line", look: { radius: "md", corner: "round", edge: "none", words: "xs-medium", colour: "text", disabled: "plain" }, className: "o-values-editor-code", "data-slot": "vk-values-code", "aria-label": w.countryCodeIs(dial.country), disabled: dialCodes.length < 2, onClick: () => go("dial"), icon: _jsx(Flag, { code: dial.country, size: "lg" }) }), dial && _jsx("span", { className: "o-values-editor-prefix", "data-slot": "vk-values-prefix", children: dial.code })] }) : glyph(ICON[kind]), _jsx(Input, { chrome: "bare", numeric: true, className: "o-values-editor-card-input", value: typed, placeholder: w.add[kind], type: keys.type, inputMode: keys.inputMode, autofill: false, autoCapitalize: keys.autoCapitalize, enterKeyHint: "done", onChange: (e) => setTyped(e.target.value), onKeyDown: lineKeys })] }), _jsx(Button, { kind: "soft", size: "lg", "data-slot": "vk-values-add", onClick: add, children: w.addButton })] }), refusal && !shell && _jsx("p", { className: "o-values-editor-error", "data-slot": "vk-values-error", role: "alert", children: refusal })] }));
325
+ const cards = (_jsxs(FieldRows, { look: MIHAI_CARDS, className: "o-values-editor-cards", "data-slot": "vk-values-rows", role: "list", "aria-label": label, children: [rows.map((r, i) => (_jsxs("div", { role: "listitem", "data-slot": "vk-values-row", "data-index": i, "data-row": r.id, "data-lifted": lifted(r, i), style: lift(i), children: [_jsxs(FieldRow, { as: "div", className: "o-values-editor-card", children: [!one && grip(r, i, LINES, "20x24", { radius: "md", corner: "round", edge: "none", words: "inherit", colour: "faint", cursor: "grab", hover: "none", icon: "20" }), _jsx(Input, { chrome: "bare", numeric: true, className: "o-values-editor-card-input", "data-slot": "vk-values-value", "aria-label": w.nth[kind](i + 1), value: r.value, type: keys.type, inputMode: keys.inputMode, autofill: false, autoCapitalize: keys.autoCapitalize, onChange: (e) => setRows((rs) => rs.map((x) => (x.id === r.id ? { ...x, value: e.target.value } : x))) }), labels.length > 0 && _jsx(Button, { kind: "quiet", size: "line", look: { radius: "none", corner: "round", edge: "none", words: "sm", hover: "none" }, className: "o-values-editor-label", "data-slot": "vk-values-label", "aria-label": w.labelIs(r.label ?? w.noLabel), onClick: () => go("label", i), children: r.label ?? w.label }), _jsx(OwnButton, { kind: "danger", shape: "round", size: "2xs", look: { edge: "none", words: "inherit", colour: "inherit", hover: "none" }, className: "o-values-editor-minus", "data-slot": "vk-values-remove", "aria-label": w.remove(r.value), onClick: () => remove(i), children: _jsx("span", {}) })] }), bad[i] && !shell && _jsx("p", { className: "o-values-editor-error", "data-slot": "vk-values-error", role: "alert", children: bad[i] })] }, r.id))), showLine && _jsxs("div", { className: "o-values-editor-adding", children: [_jsxs(FieldRow, { className: "o-values-editor-card o-values-editor-new", "data-slot": "vk-values-line", children: [kind === "phone" ? _jsxs(_Fragment, { children: [dial && _jsx(Button, { kind: "quiet", shape: "icon", size: "line", look: { radius: "md", corner: "round", edge: "none", words: "xs-medium", colour: "text", disabled: "plain" }, className: "o-values-editor-code", "data-slot": "vk-values-code", "aria-label": w.countryCodeIs(dial.country), disabled: dialCodes.length < 2, onClick: () => go("dial"), icon: _jsx(Flag, { code: dial.country, size: "lg" }) }), dial && _jsx("span", { className: "o-values-editor-prefix", "data-slot": "vk-values-prefix", children: dial.code })] }) : glyph(ICON[kind]), _jsx(Input, { chrome: "bare", numeric: true, className: "o-values-editor-card-input", value: typed, placeholder: w.add[kind], type: keys.type, inputMode: keys.inputMode, autofill: false, autoCapitalize: keys.autoCapitalize, enterKeyHint: "done", onChange: (e) => setTyped(e.target.value), onKeyDown: lineKeys })] }), _jsx(Button, { kind: "soft", size: "lg", "data-slot": "vk-values-add", onClick: add, children: w.addButton })] }), refusal && !shell && _jsx("p", { className: "o-values-editor-error", "data-slot": "vk-values-error", role: "alert", children: refusal })] }));
325
326
  const body = (_jsx("div", { ref: placeRoot, className: "o-values-editor", "data-slot": "vk-values", "data-kit": "values-editor", ...device, "data-values-form": "phone", "data-values-view": view, "data-values-holds": one ? "one" : "several", "data-values-phone": worn.phone, children: view === "label" ? labelList.body : view === "dial" ? dialList.body : cardsLook ? cards : card }));
326
327
  if (view !== "rows")
327
328
  return { body, head: { onBack: back, backSlot: "vk-editor-back", close: false }, title: view === "label" ? w.label : w.countryCode };
@@ -407,7 +408,7 @@ export function useValuesEditor(props) {
407
408
  };
408
409
  const editRefusal = editing != null && editText.trim() ? rule(keepAs(editText)) : null;
409
410
  const showLine = !(one && rows.length > 0);
410
- const labelButton = (r, i) => labels.length > 0 && (_jsx(InputGroupAddon, { side: "end", children: _jsx(InputGroupButton, { className: "o-values-editor-edit-label", "data-slot": "vk-values-label", size: "line", look: under ? { radius: "xs", corner: "round", edge: "none", words: "sm", iconColour: "faint", pad: "4", hover: "words", open: "hovered" } : { radius: "none", corner: "round", edge: "none", words: "xs", hover: "words" }, "aria-label": w.labelIs(r.label ?? w.noLabel), "aria-haspopup": under ? "listbox" : undefined, "aria-expanded": under ? drop?.what === "label" : undefined, onClick: open("label", i), iconEnd: under ? glyph(DOWN) : undefined, children: r.label ?? w.label }) }));
411
+ const labelButton = (r, i) => labels.length > 0 && (_jsx(InputGroupAddon, { side: "end", children: _jsx(GroupButton, { className: "o-values-editor-edit-label", "data-slot": "vk-values-label", size: "line", look: under ? { radius: "xs", corner: "round", edge: "none", words: "sm", iconColour: "faint", pad: "4", hover: "words", open: "hovered" } : { radius: "none", corner: "round", edge: "none", words: "xs", hover: "words" }, "aria-label": w.labelIs(r.label ?? w.noLabel), "aria-haspopup": under ? "listbox" : undefined, "aria-expanded": under ? drop?.what === "label" : undefined, onClick: open("label", i), iconEnd: under ? glyph(DOWN) : undefined, children: r.label ?? w.label }) }));
411
412
  const code = attio ? (_jsx(Button, { kind: "quiet", size: "2xs", look: { radius: "sm", corner: "round", edge: "none", words: "inherit", colour: "text", icon: "12", iconColour: "faint", pad: "6", open: "hovered" }, className: "o-values-editor-code", "data-slot": "vk-values-code", "aria-label": w.countryIs(countryName(reading, language)), "aria-haspopup": "listbox", "aria-expanded": drop?.what === "dial", onClick: open("dial"), iconEnd: glyph(DOWN), children: reading })) : dial && (_jsx(Button, { kind: "quiet", size: "26", look: { radius: "md", corner: "round", edge: "none", words: "xs-medium", colour: "text", disabled: "plain", icon: "12", iconColour: "faint" }, className: "o-values-editor-code", "data-slot": "vk-values-code", "aria-label": w.countryCodeIs(dial.country), disabled: dialCodes.length < 2, onClick: open("dial"), icon: _jsx(Flag, { code: dial.country }), iconEnd: dialCodes.length > 1 ? glyph(DOWN) : undefined, children: dial.country }));
412
413
  const line = (_jsxs("div", { className: cx("o-values-editor-line", !attio && "o-popup-line"), "data-slot": "vk-values-line", "data-at": attio ? undefined : "foot", "data-bad": refusal ? "" : undefined, children: [kind === "phone"
413
414
  ? _jsxs(_Fragment, { children: [code, attio ? _jsx("span", { className: "o-values-editor-prefix", "data-slot": "vk-values-prefix", children: dialOf(reading) }) : dial?.code && _jsx("span", { className: "o-values-editor-prefix", "data-slot": "vk-values-prefix", children: dial.code })] })
@@ -0,0 +1,16 @@
1
+ import type { CategoryColor } from "viewkitjs/fields/design/category-colors";
2
+ import type { StatusSlot } from "viewkitjs/fields/design/status-slots";
3
+ import type { ViewsStatusPlace } from "../atoms/types.js";
4
+ /** A status option as its cell draws it. */
5
+ export declare function OptionStatus({ slot, label, icon, place, }: {
6
+ slot: StatusSlot;
7
+ label: string;
8
+ icon?: string;
9
+ place?: ViewsStatusPlace;
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ /** A category option as its cell draws it. */
12
+ export declare function OptionCategory({ label, color, icon }: {
13
+ label: string;
14
+ color: CategoryColor;
15
+ icon?: string;
16
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useViews } from "../provider/context.js";
4
+ export function OptionStatus({ slot, label, icon, place, }) {
5
+ const { atoms: { StatusBadge }, components: { AppIcon }, } = useViews();
6
+ return (_jsx(StatusBadge, { slot: slot, label: label, place: place, size: "row", className: "border-0", leading: icon ? _jsx(AppIcon, { name: icon, className: "size-3 shrink-0" }) : undefined }));
7
+ }
8
+ export function OptionCategory({ label, color, icon }) {
9
+ const { atoms: { Tag }, components: { AppIcon }, } = useViews();
10
+ return (_jsx(Tag, { label: label, color: color, leading: icon ? _jsx(AppIcon, { name: icon, className: "size-3 shrink-0" }) : undefined }));
11
+ }
@@ -0,0 +1,12 @@
1
+ import { type ReactElement } from "react";
2
+ import type { RelationValue } from "viewkitjs/fields";
3
+ import type { ViewsRelationChipLinkProps } from "../atoms/types.js";
4
+ import type { RelationWrap } from "./options.js";
5
+ /** The host's link a chip draws itself through. */
6
+ export type RelationLinkRender = (props: ViewsRelationChipLinkProps) => ReactElement;
7
+ /** The wrap, saying how it draws itself as the element the app's chip hands its props to. */
8
+ export declare function withRelationLink(wrap: RelationWrap, linkFor: (relation: RelationValue) => RelationLinkRender): RelationWrap;
9
+ /** The host's link for one relation, from the wrap it handed: what the wrap says, else the wrap around a span holding the props. */
10
+ export declare function relationLinkOf(wrap: RelationWrap, relation: RelationValue): RelationLinkRender;
11
+ /** The size a mentioned record is drawn at, by place: a field row's value says `row`. */
12
+ export declare const RelationChipSize: import("react").Context<"row" | "chip">;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { createContext } from "react";
4
+ const LINKS = new WeakMap();
5
+ export function withRelationLink(wrap, linkFor) {
6
+ LINKS.set(wrap, linkFor);
7
+ return wrap;
8
+ }
9
+ export function relationLinkOf(wrap, relation) {
10
+ const own = LINKS.get(wrap);
11
+ if (own)
12
+ return own(relation);
13
+ return function hostRelationLink(props) {
14
+ return _jsx(_Fragment, { children: wrap(relation, _jsx("span", { ...props })) });
15
+ };
16
+ }
17
+ export const RelationChipSize = createContext("chip");
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  import { type FieldDefOf } from "viewkitjs/fields";
3
3
  import type { DisplayOptions } from "./options.js";
4
4
  export declare function renderRelation(field: FieldDefOf<"relation">, value: unknown, opts?: DisplayOptions): ReactNode;
@@ -1,10 +1,12 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useContext } from "react";
3
4
  import { orderLinks, relationKinds, relationRolesOf, resolveRelationValue, } from "viewkitjs/fields";
4
5
  import { CHIP_BASE } from "../internal/chip.js";
5
6
  import { useViews } from "../provider/context.js";
6
7
  import { EntityChipIdentity } from "./entity-chip.js";
7
8
  import { MultiValueCell } from "./multi-value.js";
9
+ import { RelationChipSize, relationLinkOf } from "./relation-link.js";
8
10
  import { cellTextClass } from "./text-class.js";
9
11
  function roleLabels(field, relation) {
10
12
  if (field.cardinality !== "many" || !field.links)
@@ -36,9 +38,14 @@ function RelationChip({ field, relation, opts, }) {
36
38
  const views = useViews();
37
39
  const Glyph = views.icons.relation;
38
40
  const { RelationRoles } = views.atoms;
41
+ const App = views.panelControls.has("RelationChip") ? views.atoms.RelationChip : null;
42
+ const size = useContext(RelationChipSize);
39
43
  const roles = roleLabels(field, relation);
40
44
  const chip = (_jsxs(_Fragment, { children: [_jsx(EntityChipIdentity, { label: relation.label, avatarUrl: relation.avatarUrl, kind: relation.entity, iconOverride: relation.icon ?? opts?.entityIcon?.(relation.entity), fallbackIcon: _jsx(Glyph, { className: "h-3 w-3 shrink-0 text-(color:--vk-fg-subtlest)" }), labelClassName: cellTextClass(opts?.wrap) }), roles.length > 0 ? _jsx(RelationRoles, { relation: relation, roles: roles }) : null] }));
41
- if (opts?.relationWrap)
42
- return opts.relationWrap(relation, chip);
43
- return (_jsx("span", { className: CHIP_BASE, title: chipTitle(relation, roles), children: chip }));
45
+ const wrap = opts?.relationWrap;
46
+ const own = wrap ? (wrap(relation, chip)) : (_jsx("span", { className: CHIP_BASE, title: chipTitle(relation, roles), children: chip }));
47
+ if (!App)
48
+ return own;
49
+ const render = wrap && !opts?.slotOwnsClick ? relationLinkOf(wrap, relation) : undefined;
50
+ return _jsx(App, { relation: relation, roles: roles, size: size, ...(render ? { render } : {}), fallback: own });
44
51
  }
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { resolveCategoryColor } from "viewkitjs/fields/design/category-colors";
4
4
  import { optionFor } from "viewkitjs/fields";
5
5
  import { useViews } from "../provider/context.js";
6
+ import { OptionCategory, OptionStatus } from "./option-badges.js";
6
7
  import { MultiValueCell } from "./multi-value.js";
7
8
  import { placeAmong, statusSteps } from "./status-steps.js";
8
9
  export function renderSelect(field, value, opts) {
@@ -30,11 +31,3 @@ function StrayOption({ value }) {
30
31
  const { messages } = useViews();
31
32
  return (_jsx("span", { className: "text-(color:--vk-fg-subtle)", title: messages({ key: "views.display.not-an-option" }), children: value }));
32
33
  }
33
- function OptionStatus({ slot, label, icon, place, }) {
34
- const { atoms: { StatusBadge }, components: { AppIcon }, } = useViews();
35
- return (_jsx(StatusBadge, { slot: slot, label: label, place: place, size: "row", className: "border-0", leading: icon ? _jsx(AppIcon, { name: icon, className: "size-3 shrink-0" }) : undefined }));
36
- }
37
- function OptionCategory({ label, color, icon }) {
38
- const { atoms: { Tag }, components: { AppIcon }, } = useViews();
39
- return (_jsx(Tag, { label: label, color: color, leading: icon ? _jsx(AppIcon, { name: icon, className: "size-3 shrink-0" }) : undefined }));
40
- }
@@ -155,5 +155,5 @@ export function EditorPanel({ session, title, anchor, inPlace = false, sheetOnPh
155
155
  if (details?.reason === "escape-key" && (inMarkedStep(document.activeElement) || goBack()))
156
156
  return;
157
157
  close("escape");
158
- }, title: sheetTitle, ...(typeof sheetTitle === "string" || typeof sheetTitle === "number" ? { label: String(sheetTitle) } : {}), ...(actions && { actions }), snap: snap, children: _jsxs("div", { ref: panelRef, "data-slot": "vk-editor-panel", children: [actions ? null : (_jsxs("div", { "data-slot": "vk-editor-bar", className: "flex items-center justify-between px-2 pb-1", children: [step ? (_jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-back", "aria-label": backLabel, onClick: back, children: _jsx(Back, { className: "size-4" }) })) : (_jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-close", "aria-label": discardLabel, onClick: () => close("escape"), children: _jsx(Discard, { className: "size-4" }) })), _jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-save", "aria-label": saveLabel, onClick: () => close("enter"), children: _jsx(Save, { className: "size-4" }) })] })), _jsx(BodyStepContext.Provider, { value: hold, children: editor }), reason] }) }) }));
158
+ }, ...(actions ? { title: sheetTitle } : {}), ...(typeof sheetTitle === "string" || typeof sheetTitle === "number" ? { label: String(sheetTitle) } : {}), ...(actions && { actions }), snap: snap, children: _jsxs("div", { ref: panelRef, "data-slot": "vk-editor-panel", children: [actions ? null : (_jsxs("div", { "data-slot": "vk-editor-bar", className: "flex items-center justify-between gap-1 px-2 pb-1", children: [step ? (_jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-back", "aria-label": backLabel, onClick: back, children: _jsx(Back, { className: "size-4" }) })) : (_jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-close", "aria-label": discardLabel, onClick: () => close("escape"), children: _jsx(Discard, { className: "size-4" }) })), _jsx("span", { "data-slot": "vk-editor-title", className: "min-w-0 flex-1 truncate px-1 text-center text-(length:--vk-panel-title-text,15px) font-semibold text-(color:--vk-fg)", children: sheetTitle }), _jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-save", "aria-label": saveLabel, onClick: () => close("enter"), children: _jsx(Save, { className: "size-4" }) })] })), _jsx(BodyStepContext.Provider, { value: hold, children: editor }), reason] }) }) }));
159
159
  }
@@ -23,5 +23,8 @@ export declare const RangeEditor: import("react").ForwardRefExoticComponent<{
23
23
  bands?: readonly RangePreset[];
24
24
  /** The field's name, for the app's `PartsBody`. Default: the two ends' words. */
25
25
  label?: string;
26
+ /** The field's limits (`numberBounds`): the body's ends step within them (VK-904). */
27
+ min?: number;
28
+ max?: number;
26
29
  onRequestClose: (reason: CloseReason) => void;
27
30
  } & import("react").RefAttributes<RangeEditorHandle>>;
@@ -7,7 +7,7 @@ import { BodyFrame } from "./BodyFrame.js";
7
7
  import { useBodyStep } from "./body-step.js";
8
8
  import { mergeParts, rangeBodyStart, resolveRangeBody } from "./parts-body.js";
9
9
  import { usePickerForm } from "./picker-slot.js";
10
- export const RangeEditor = forwardRef(function RangeEditor({ initial, seed, decimals = 0, allowEmpty = false, suffix, conventions, bands, label, onRequestClose }, ref) {
10
+ export const RangeEditor = forwardRef(function RangeEditor({ initial, seed, decimals = 0, allowEmpty = false, suffix, conventions, bands, label, min, max, onRequestClose }, ref) {
11
11
  const views = useViews();
12
12
  const { PartsBody } = views.components;
13
13
  const onStepChange = useBodyStep();
@@ -35,6 +35,6 @@ export const RangeEditor = forwardRef(function RangeEditor({ initial, seed, deci
35
35
  bodyRef.current = { low: merged.low, high: merged.high, unread: false };
36
36
  setBodyDraft(bodyRef.current);
37
37
  };
38
- return (_jsx(BodyFrame, { slot: "vk-parts-body", onRequestClose: onRequestClose, children: _jsx(PartsBody, { kind: "range", value: bodyValue, onValueChange: take, decimals: decimals, ...(suffix !== undefined ? { unit: suffix } : {}), ...(bands !== undefined ? { bands } : {}), label: label ??
38
+ return (_jsx(BodyFrame, { slot: "vk-parts-body", onRequestClose: onRequestClose, children: _jsx(PartsBody, { kind: "range", value: bodyValue, onValueChange: take, decimals: decimals, ...(suffix !== undefined ? { unit: suffix } : {}), ...(bands !== undefined ? { bands } : {}), ...(min !== undefined ? { min } : {}), ...(max !== undefined ? { max } : {}), label: label ??
39
39
  `${views.messages({ key: "views.editors.range-low" })} – ${views.messages({ key: "views.editors.range-high" })}`, onDone: (how) => onRequestClose(how === "pick" ? "pick" : "enter"), empty: allowEmpty, typed: seed, autoFocus: true, form: form, ...(onStepChange && { onStepChange }) }) }));
40
40
  });
@@ -87,8 +87,8 @@ export declare const SelectEditor: import("react").ForwardRefExoticComponent<{
87
87
  *
88
88
  * Archived options never reach a picker (`optionsOf`). A status keeps its
89
89
  * semantic slots; a select gets the category-colour chain — the workspace's
90
- * `optionColors` first, then the field's own, then the derived hue — which is
91
- * the same colour the grid draws. `extraValues` are an open select's values, the
90
+ * `optionColors` first, then the field's own (an archived option's too), then the
91
+ * derived hue — which is the same colour the grid draws. `extraValues` are an open select's values, the
92
92
  * ones its records hold: drawn as their raw code (a registry never invents a
93
93
  * label); an archived value stays out. `current` is the value the surface holds:
94
94
  * offered last when no active option is it, a stray or an archived option, so
@@ -65,7 +65,7 @@ export function pickerOptionsFromField(field, opts = {}) {
65
65
  const option = field.options.find((o) => o.value === value);
66
66
  const dressed = field.type === "status"
67
67
  ? { value, label, slot: option?.slot ?? "muted" }
68
- : { value, label, color: resolveCategoryColor(value, active, opts.optionColors) };
68
+ : { value, label, color: resolveCategoryColor(value, field.options, opts.optionColors) };
69
69
  return option?.icon ? { ...dressed, icon: option.icon } : dressed;
70
70
  };
71
71
  return [
@@ -9,7 +9,9 @@ import { useBodyStep } from "./body-step.js";
9
9
  import { resolveTextBody, textChange } from "./text-body.js";
10
10
  const EVERY_VALUE_READS = () => null;
11
11
  export const TextEditorHost = forwardRef(function TextEditorHost({ type, initial, seed, multiline = type === "rich_text", readOnly = false, closeOnBlur = true, label, rows = 1, maxLines = 12, className, style, boxData, check, region, escapeKeeps = false, form = "computer", place = "cell", onRequestClose, }, ref) {
12
- const { TextBody } = useViews().components;
12
+ const views = useViews();
13
+ const { TextBody } = views.components;
14
+ const phoneRegion = region ?? views.conventions.region;
13
15
  const onStepChange = useBodyStep();
14
16
  const draftRef = useRef(seed ?? initial);
15
17
  const [draft, setDraft] = useState(seed ?? initial);
@@ -52,7 +54,7 @@ export const TextEditorHost = forwardRef(function TextEditorHost({ type, initial
52
54
  return;
53
55
  draftRef.current = text;
54
56
  setDraft(text);
55
- }, onDone: () => onRequestClose("enter"), check: check ?? EVERY_VALUE_READS, ...(type === "phone" && region ? { region } : {}), typed: seed, autoFocus: true, form: form, place: place, ...(onStepChange && { onStepChange }) }) }));
57
+ }, onDone: () => onRequestClose("enter"), check: check ?? EVERY_VALUE_READS, ...(type === "phone" && phoneRegion ? { region: phoneRegion } : {}), typed: seed, autoFocus: true, form: form, place: place, ...(onStepChange && { onStepChange }) }) }));
56
58
  }
57
59
  return (_jsx("textarea", { "data-slot": "vk-text-editor", ...boxData, "aria-label": label, defaultValue: seed ?? initial, readOnly: true, onKeyDown: onKeyDown, onBlur: closeOnBlur ? () => onRequestClose("blur") : undefined, onClick: (event) => event.stopPropagation(), className: cx(ELEMENT_RESET, className), style: style, ref: attach, rows: rows }));
58
60
  });
@@ -10,6 +10,7 @@ import { bodyLines, mergeValueLines, openedItems, resolveValueRows, storedByText
10
10
  export const ValueListEditor = forwardRef(function ValueListEditor({ field, initial, labels = true, allowEmpty = false, region, escapeKeeps = false, label, holds = "several", seed, onRequestClose, }, ref) {
11
11
  const views = useViews();
12
12
  const { ValuesBody } = views.components;
13
+ const phoneRegion = region ?? views.conventions.region;
13
14
  const onStepChange = useBodyStep();
14
15
  const [opened] = useState(() => openedItems(initial));
15
16
  const single = (() => {
@@ -49,5 +50,5 @@ export const ValueListEditor = forwardRef(function ValueListEditor({ field, init
49
50
  };
50
51
  return (_jsx(BodyFrame, { slot: "vk-values-body", innerEscape: escapeKeeps, onRequestClose: onRequestClose, children: _jsx(ValuesBody, { label: label ?? field.label, kind: field.type, value: bodyLines(lines), onValueChange: take, onDone: () => onRequestClose("enter"), check: (text) => text.trim() === "" || opened.some((item) => valueText(item.value) === text)
51
52
  ? null
52
- : check(text), labels: keepsLabels, holds: holds, ...(field.type === "phone" && region ? { region } : {}), empty: allowEmpty, typed: seed, autoFocus: true, form: form, ...(onStepChange && { onStepChange }) }) }));
53
+ : check(text), labels: keepsLabels, holds: holds, ...(field.type === "phone" && phoneRegion ? { region: phoneRegion } : {}), empty: allowEmpty, typed: seed, autoFocus: true, form: form, ...(onStepChange && { onStepChange }) }) }));
53
54
  });