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,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
3
3
  import { type InputProps } from "../input/input.js";
4
- import { type MenuEntry } from "../menu/menu.js";
4
+ import { type ToolbarButtonProps } from "../toolbar-button/toolbar-button.js";
5
5
  import { type ToolbarPicks } from "./looks.js";
6
6
  import { type ToolbarWords } from "./words.js";
7
7
  /** Where a list's part stands: on the row (where it begins), on the row's right, on the filter bar, or on a phone's one line. */
@@ -57,13 +57,16 @@ export interface ToolbarProps extends Omit<BaseToolbar.Root.Props, "className" |
57
57
  spacing?: number;
58
58
  /** Whether what doesn't fit gives way (words to icons, then into ⋯); otherwise it runs past its end. */
59
59
  fold?: boolean;
60
- /** Its row's worded buttons grow to share the row's width, its square ones keeping theirs (a record's actions, Attio's way);
61
- * what doesn't fit still gives way, the first worded button with an icon keeping its words to the last. The filter bar under
62
- * it draws as without. */
63
- fill?: boolean;
64
- /** What ⋯ at the row's end always holds, after what folded into it: a row of actions with more than it shows (a record's).
65
- * Given, ⋯ stands at the row's end even when nothing folded, what folds joining it in the row's order. */
66
- more?: MenuEntry[];
60
+ /** ⋯ as the app draws it, where what doesn't fit folds (VK-1031): `icon`, its glyph over ViewKit's dots; `className`, put on
61
+ * it; `button`, the app's own button drawn in place of the Toolbar button, handed the very props it would get (`ref`, and what
62
+ * its Menu sets to open from it, included): spread them on your button. Absent, ViewKit's own ⋯. */
63
+ overflow?: ToolbarOverflowControl;
64
+ /** "+N" on the view tabs as the app draws it (VK-1037): `className`, put on it; `button`, the app's own button drawn in place of
65
+ * the Toolbar button, handed the very props it would get (`ref`, its words, and what its Menu, or `onMoreViews`, sets to open
66
+ * from it, included): spread them on your button. Absent, ViewKit's own "+N". */
67
+ moreViews?: ToolbarMoreControl;
68
+ /** "+N filters" as the app draws it, the same way as `moreViews` (VK-1037). Absent, ViewKit's own. */
69
+ moreFilters?: ToolbarMoreControl;
67
70
  /** Holds every line as it stands, giving way no further and taking no step back: while what a folded item opened stands open
68
71
  * under the button that holds it ("+N filters", ⋯), so that button keeps its place (KIT-624). */
69
72
  holds?: boolean;
@@ -77,6 +80,23 @@ export interface ToolbarProps extends Omit<BaseToolbar.Root.Props, "className" |
77
80
  className?: string;
78
81
  style?: React.CSSProperties;
79
82
  }
83
+ /** What the Toolbar hands an app's own button (⋯, "+N", "+N filters"): a Toolbar button's props, its `style` a plain one, never
84
+ * Base UI's state function, so the app spreads them onto a plain `<button>` with no cast (VK-1060). A button typed with
85
+ * `ToolbarButtonProps` is still taken. */
86
+ export type ToolbarOwnButtonProps = Omit<ToolbarButtonProps, "style"> & {
87
+ style?: React.CSSProperties;
88
+ };
89
+ /** ⋯ as the app draws it: its glyph, its class, or its whole button, handed a Toolbar button's props. */
90
+ export type ToolbarOverflowControl = {
91
+ icon?: React.ReactNode;
92
+ className?: string;
93
+ button?: React.ComponentType<ToolbarOwnButtonProps & React.RefAttributes<HTMLButtonElement>>;
94
+ };
95
+ /** "+N" or "+N filters" as the app draws it: its class, or its whole button, handed a Toolbar button's props (VK-1037). */
96
+ export type ToolbarMoreControl = {
97
+ className?: string;
98
+ button?: React.ComponentType<ToolbarOwnButtonProps & React.RefAttributes<HTMLButtonElement>>;
99
+ };
80
100
  type Step = {
81
101
  i: number;
82
102
  to: "icon" | "fold";
@@ -94,13 +114,12 @@ export interface ToolbarFoldsProps {
94
114
  export declare function ToolbarFolds({ children }: ToolbarFoldsProps): React.ReactNode;
95
115
  /** The steps a line takes as it narrows, in order: words to icons from its end; then the view tabs fold into "+N" from their end,
96
116
  * the views giving way before the tools, as the portal's row does; then the filters fold into "+N filters" from their end, only
97
- * once nothing else gives words up (KIT-624); then the rest folds into ⋯ from its end. Filling its row (`fill`), its first worded
98
- * button with an icon leads: it keeps its words while the others give theirs up and fold, then turns to its icon and folds last. */
99
- declare function stepsOf(items: React.ReactElement[], fill?: boolean): Step[];
117
+ * once nothing else gives words up (KIT-624); then the rest folds into ⋯ from its end. */
118
+ declare function stepsOf(items: React.ReactElement[]): Step[];
100
119
  /** The steps a line takes as it narrows, for a test (stepsOf). */
101
120
  export declare const toolbarSteps: typeof stepsOf;
102
121
  /** The row and, under it, the filter bar: Base UI's toolbar, one Tab stop for the whole of it, the arrows inside. */
103
- export declare function ToolbarControl({ label, children, bar, barLabel: barNamed, words: given, views, settings, search, add, sort, filter, filters, save, quick, added, picks: said, size, barSize, spacing, fold, fill, more, holds, form, onMoreViews, moreViewsOpen, className, style, onKeyDown, ...props }: ToolbarProps): import("react/jsx-runtime").JSX.Element;
122
+ export declare function ToolbarControl({ label, children, bar, barLabel: barNamed, words: given, views, settings, search, add, sort, filter, filters, save, quick, added, picks: said, size, barSize, spacing, fold, overflow, moreViews: ownViews, moreFilters: ownFilters, holds, form, onMoreViews, moreViewsOpen, className, style, onKeyDown, ...props }: ToolbarProps): import("react/jsx-runtime").JSX.Element;
104
123
  /** A line between what belongs together and what doesn't, across a line. `data-slot`, its public name where a part names it
105
124
  * (VK-1023: the bulk bar's `vk-bulk-separator`). */
106
125
  export declare function ToolbarSeparatorControl({ className, "data-slot": slot }: {
@@ -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 })] })
@@ -15,6 +15,7 @@ import { PanelHeadButton } from "../internal/head-button.js";
15
15
  import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
16
16
  import { SheetPartsFrom } from "../sheet/sheet-parts.js";
17
17
  import { Icon } from "../internal/icons.js";
18
+ import { glyph, X } from "../internal/editor-parts.js";
18
19
  export function viewsListWordsOf(say, createLabel) {
19
20
  return {
20
21
  label: say({ key: "views.panels.views-list" }),
@@ -102,6 +103,8 @@ export function viewMenuWordsOf(say) {
102
103
  copyOf: (name) => say({ key: "views.panels.view-copy-name", values: { name } }),
103
104
  stay: (records) => say({ key: "views.panels.view-delete-stays", values: { records } }),
104
105
  goes: say({ key: "views.panels.view-delete-goes" }),
106
+ goesOwn: say({ key: "views.panels.view-delete-goes-own" }),
107
+ notNow: say({ key: "views.menus.not-now" }),
105
108
  columns: (layout) => say({ key: "views.panels.view-columns", values: { layout } }),
106
109
  };
107
110
  }
@@ -117,7 +120,12 @@ function useStepHead(step, props) {
117
120
  const setParts = React.useContext(SheetPartsFrom);
118
121
  React.useLayoutEffect(() => { setParts?.(step ? { title: step.title, head: { onBack: step.onBack } } : null); });
119
122
  React.useLayoutEffect(() => () => setParts?.(null), [setParts]);
120
- return step && props.actions?.back && !setParts ? (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-views-list-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: step.title }), right: _jsx("span", {}), left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-back", "aria-label": props.actions.back.label, className: "o-sheet-back", icon: _jsx(Icon, { name: "left" }), onClick: props.actions.back.onPress }) }) })) : null;
123
+ const actions = props.actions;
124
+ if (!actions || setParts)
125
+ return null;
126
+ if (step)
127
+ return actions.back ? (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-views-list-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: step.title }), right: _jsx("span", {}), left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-back", "aria-label": actions.back.label, className: "o-sheet-back", icon: _jsx(Icon, { name: "left" }), onClick: actions.back.onPress }) }) })) : null;
128
+ return (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-views-list-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: props.label }), right: _jsx("span", {}), left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-close", "aria-label": actions.close.label, icon: glyph(X), onClick: actions.close.onPress }) }) }));
121
129
  }
122
130
  function Plain(props) {
123
131
  const context = React.useContext(ViewsContext);
@@ -85,6 +85,7 @@ export declare const canDelete: (views: ListView[]) => boolean;
85
85
  export type DeleteLineWords = {
86
86
  stay: (records: string) => string;
87
87
  goes: string;
88
+ goesOwn: string;
88
89
  };
89
90
  /** The delete question's line: the view goes for everyone who uses it (a private view only for its maker), and the records stay. */
90
91
  export declare function deleteLine(view: ListView, records: string, words?: DeleteLineWords): string;
@@ -12,10 +12,10 @@ export function copyName(name, names, copyOf = (n) => `Copy of ${n}`) {
12
12
  return `${base} ${n}`;
13
13
  }
14
14
  export const canDelete = (views) => views.length > 1;
15
- const DELETE_LINE = { stay: (records) => `The ${records} in it stay as they are.`, goes: "The view goes for everyone who uses it." };
15
+ const DELETE_LINE = { stay: (records) => `The ${records} in it stay as they are.`, goes: "The view goes for everyone who uses it.", goesOwn: "The view goes only for you." };
16
16
  export function deleteLine(view, records, words = DELETE_LINE) {
17
17
  const stay = words.stay(records);
18
- return view.private ? stay : `${words.goes} ${stay}`;
18
+ return `${view.private ? words.goesOwn : words.goes} ${stay}`;
19
19
  }
20
20
  export const columnsLabel = (layoutName, words = (l) => `${l} columns`) => words(layoutName);
21
21
  const set = (views, id, change) => views.map((v) => (v.id === id ? { ...v, ...change } : v));
@@ -107,7 +107,7 @@ export function useViewMenu(props) {
107
107
  onDone?.();
108
108
  say(w.deleted(view.name), () => onChange({ kind: "restore", view, at, open: wasOpen }));
109
109
  };
110
- const lineOf = (v) => deleteLine(worn.privateViews ? v : { ...v, private: false }, records, { stay: w.stay, goes: w.goes });
110
+ const lineOf = (v) => deleteLine(v, records, { stay: w.stay, goes: w.goes, goesOwn: w.goesOwn });
111
111
  const askDelete = (id) => {
112
112
  const v = viewOf(id);
113
113
  if (!stepping && askPort && v) {
@@ -150,7 +150,7 @@ export function useViewMenu(props) {
150
150
  ];
151
151
  return props.reshape ? props.reshape(all, id) : all;
152
152
  };
153
- const entries = (id) => menuEntries(items(id), undefined, "vk-view-menu-row");
153
+ const entries = (id) => menuEntries(items(id), w.notNow, "vk-view-menu-row");
154
154
  const where = props.container ?? undefined, standing = props.standing;
155
155
  const target = asked && (asked.what === "rename" || asked.what === "delete" || asked.what === "menu") ? viewOf(asked.id) : undefined;
156
156
  const asking = shown;
@@ -72,6 +72,10 @@ export interface ViewMenuWords {
72
72
  copyOf: (name: string) => string;
73
73
  stay: (records: string) => string;
74
74
  goes: string;
75
+ /** The delete question's line on a person's own view (VK-959). */
76
+ goesOwn: string;
77
+ /** Why a row that can't be used, and gives no reason of its own, can't be (VK-997). */
78
+ notNow: string;
75
79
  columns: (layout: string) => string;
76
80
  }
77
81
  /** A view's menu's words in English. */
@@ -8,5 +8,6 @@ export const VIEW_MENU_WORDS = {
8
8
  thisView: "This view", renameTitle: "Rename view", save: "Save", newView: "New view", createView: "Create view", layout: "Layout", name: "Name",
9
9
  cancel: "Cancel", close: "Close", failed: "That didn't go through. Nothing changed.", tryAgain: "Try again",
10
10
  deleteTitle: (name) => `Delete ${name}?`, deleted: (name) => `${name} was deleted`, copyOf: (name) => `Copy of ${name}`,
11
- stay: (records) => `The ${records} in it stay as they are.`, goes: "The view goes for everyone who uses it.", columns: (layout) => `${layout} columns`,
11
+ stay: (records) => `The ${records} in it stay as they are.`, goes: "The view goes for everyone who uses it.", goesOwn: "The view goes only for you.", notNow: "Not now",
12
+ columns: (layout) => `${layout} columns`,
12
13
  };
@@ -0,0 +1,17 @@
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; handed a remove, as an editor draws it held, with its ×. */
12
+ export declare function OptionCategory({ label, color, icon, onRemove }: {
13
+ label: string;
14
+ color: CategoryColor;
15
+ icon?: string;
16
+ onRemove?: () => void;
17
+ }): 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, onRemove }) {
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, ...(onRemove ? { onRemove } : {}) }));
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
  }