viewkitjs 0.30.1 → 0.32.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 (298) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/MIGRATION.md +40 -6
  3. package/README.md +1 -1
  4. package/fields/dist/query/index.d.ts +2 -0
  5. package/fields/dist/query/index.js +2 -0
  6. package/fields/dist/query/list-request.d.ts +148 -0
  7. package/fields/dist/query/list-request.js +125 -0
  8. package/fields/dist/query/saved-view.d.ts +15 -0
  9. package/fields/dist/query/saved-view.js +11 -0
  10. package/fields/dist/query/settings.d.ts +9 -0
  11. package/fields/dist/query/settings.js +9 -0
  12. package/fields/docs/reference/query.md +66 -0
  13. package/package.json +8 -2
  14. package/postgres/README.md +1 -0
  15. package/postgres/dist/handler.d.ts +53 -0
  16. package/postgres/dist/handler.js +211 -0
  17. package/postgres/dist/ids.d.ts +1 -1
  18. package/postgres/dist/ids.js +19 -1
  19. package/postgres/dist/index.d.ts +1 -0
  20. package/postgres/dist/index.js +1 -0
  21. package/postgres/dist/limits.d.ts +3 -1
  22. package/postgres/dist/limits.js +1 -1
  23. package/postgres/dist/list-fields.d.ts +10 -0
  24. package/postgres/dist/list-fields.js +36 -0
  25. package/postgres/dist/readable.d.ts +4 -0
  26. package/postgres/dist/readable.js +4 -0
  27. package/postgres/dist/refusals.d.ts +9 -2
  28. package/postgres/dist/refusals.js +6 -0
  29. package/postgres/docs/guides/field-map.md +2 -2
  30. package/postgres/docs/guides/list-handler.md +99 -0
  31. package/postgres/docs/index.md +1 -0
  32. package/postgres/docs/reference/postgres.md +11 -3
  33. package/views/README.md +2 -2
  34. package/views/dist/atoms/RowMenu.d.ts +7 -0
  35. package/views/dist/atoms/RowMenu.js +18 -16
  36. package/views/dist/atoms/carried.d.ts +5 -0
  37. package/views/dist/atoms/carried.js +7 -0
  38. package/views/dist/atoms/types.d.ts +3 -0
  39. package/views/dist/contract.d.ts +26 -6
  40. package/views/dist/contract.js +25 -0
  41. package/views/dist/controls/alert-dialog/alert-dialog.js +2 -1
  42. package/views/dist/controls/atoms.d.ts +2 -0
  43. package/views/dist/controls/atoms.js +2 -0
  44. package/views/dist/controls/avatar/avatar.d.ts +10 -4
  45. package/views/dist/controls/avatar/avatar.js +5 -3
  46. package/views/dist/controls/avatar/tokens.d.ts +104 -0
  47. package/views/dist/controls/avatar/tokens.js +26 -0
  48. package/views/dist/controls/avatar.css +46 -15
  49. package/views/dist/controls/choice/tokens.d.ts +0 -4
  50. package/views/dist/controls/choice/tokens.js +0 -1
  51. package/views/dist/controls/choice.css +3 -3
  52. package/views/dist/controls/controls.d.ts +6 -0
  53. package/views/dist/controls/controls.js +10 -2
  54. package/views/dist/controls/customize/map-customize-body.js +1 -1
  55. package/views/dist/controls/field/field.d.ts +19 -4
  56. package/views/dist/controls/field/field.js +63 -5
  57. package/views/dist/controls/field/tokens.d.ts +4 -0
  58. package/views/dist/controls/field/tokens.js +1 -0
  59. package/views/dist/controls/field.css +41 -16
  60. package/views/dist/controls/glyphs/glyphs.d.ts +10 -0
  61. package/views/dist/controls/glyphs/glyphs.js +173 -0
  62. package/views/dist/controls/index.d.ts +4 -2
  63. package/views/dist/controls/index.js +3 -1
  64. package/views/dist/controls/input/input.d.ts +12 -1
  65. package/views/dist/controls/input/input.js +10 -6
  66. package/views/dist/controls/input/save-mark.d.ts +8 -0
  67. package/views/dist/controls/input/save-mark.js +26 -0
  68. package/views/dist/controls/input/tokens.d.ts +20 -0
  69. package/views/dist/controls/input/tokens.js +5 -0
  70. package/views/dist/controls/input.css +49 -3
  71. package/views/dist/controls/internal/icons.js +10 -0
  72. package/views/dist/controls/internal/keep-focus.d.ts +2 -0
  73. package/views/dist/controls/internal/keep-focus.js +17 -0
  74. package/views/dist/controls/internal/watch-frame.d.ts +2 -0
  75. package/views/dist/controls/internal/watch-frame.js +33 -0
  76. package/views/dist/controls/markdown/map-markdown.d.ts +4 -0
  77. package/views/dist/controls/markdown/map-markdown.js +5 -0
  78. package/views/dist/controls/menu/map-menu.js +2 -2
  79. package/views/dist/controls/menu-list/menu-list.d.ts +3 -0
  80. package/views/dist/controls/menu-list/menu-list.js +5 -4
  81. package/views/dist/controls/modal/modal.js +5 -1
  82. package/views/dist/controls/pane/pane.js +2 -1
  83. package/views/dist/controls/phone-header/header-bar.d.ts +5 -1
  84. package/views/dist/controls/phone-header/header-bar.js +2 -2
  85. package/views/dist/controls/phone-header.css +11 -1
  86. package/views/dist/controls/picker/map-picker.js +3 -0
  87. package/views/dist/controls/picker/picker.d.ts +14 -0
  88. package/views/dist/controls/picker/picker.js +30 -10
  89. package/views/dist/controls/picker.css +2 -0
  90. package/views/dist/controls/popover/popover.js +2 -1
  91. package/views/dist/controls/radio/radio.d.ts +12 -3
  92. package/views/dist/controls/radio/radio.js +25 -5
  93. package/views/dist/controls/radio/tokens.d.ts +84 -0
  94. package/views/dist/controls/radio/tokens.js +21 -0
  95. package/views/dist/controls/radio.css +130 -3
  96. package/views/dist/controls/select/select.d.ts +12 -2
  97. package/views/dist/controls/select/select.js +15 -7
  98. package/views/dist/controls/select/tokens.d.ts +8 -0
  99. package/views/dist/controls/select/tokens.js +2 -0
  100. package/views/dist/controls/select.css +17 -0
  101. package/views/dist/controls/setting-row/looks.d.ts +10 -0
  102. package/views/dist/controls/setting-row/looks.js +22 -0
  103. package/views/dist/controls/setting-row/setting-row.d.ts +100 -0
  104. package/views/dist/controls/setting-row/setting-row.js +133 -0
  105. package/views/dist/controls/setting-row/tokens.d.ts +156 -0
  106. package/views/dist/controls/setting-row/tokens.js +41 -0
  107. package/views/dist/controls/setting-row.css +215 -0
  108. package/views/dist/controls/sheet/bottom-sheet.d.ts +10 -2
  109. package/views/dist/controls/sheet/bottom-sheet.js +6 -3
  110. package/views/dist/controls/sheet.css +4 -1
  111. package/views/dist/controls/sort-editor/sort-editor.js +3 -2
  112. package/views/dist/controls/sort-editor.css +8 -2
  113. package/views/dist/controls/switch-row/switch-row.d.ts +1 -15
  114. package/views/dist/controls/switch-row/switch-row.js +1 -9
  115. package/views/dist/controls/switch-row/tokens.d.ts +0 -12
  116. package/views/dist/controls/switch-row/tokens.js +0 -3
  117. package/views/dist/controls/switch-row.css +3 -7
  118. package/views/dist/controls/switch.css +17 -7
  119. package/views/dist/controls/tag/tag.d.ts +3 -1
  120. package/views/dist/controls/tag/tag.js +2 -2
  121. package/views/dist/controls/tag/tokens.d.ts +4 -0
  122. package/views/dist/controls/tag/tokens.js +1 -0
  123. package/views/dist/controls/tag-field/tag-field.d.ts +5 -1
  124. package/views/dist/controls/tag-field/tag-field.js +11 -5
  125. package/views/dist/controls/tag-field/tokens.d.ts +16 -0
  126. package/views/dist/controls/tag-field/tokens.js +4 -0
  127. package/views/dist/controls/tag-field.css +19 -0
  128. package/views/dist/controls/tag.css +2 -0
  129. package/views/dist/controls/tokens.js +2 -0
  130. package/views/dist/controls/toolbar/toolbar.d.ts +15 -3
  131. package/views/dist/controls/toolbar/toolbar.js +22 -15
  132. package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +14 -0
  133. package/views/dist/controls/toolbar-button/atom-toolbar-button.js +51 -0
  134. package/views/dist/controls/toolbar-button/toolbar-button.d.ts +1 -1
  135. package/views/dist/controls/toolbar-button/toolbar-button.js +2 -3
  136. package/views/dist/controls/toolbar-button.css +4 -0
  137. package/views/dist/controls/toolbar.css +5 -0
  138. package/views/dist/controls/views-list/map-view-menu.d.ts +3 -0
  139. package/views/dist/controls/views-list/map-view-menu.js +25 -0
  140. package/views/dist/controls/views-list/map-views-list-body.d.ts +28 -1
  141. package/views/dist/controls/views-list/map-views-list-body.js +39 -21
  142. package/views/dist/controls/views-list/rules.d.ts +2 -0
  143. package/views/dist/controls/views-list/view-menu.d.ts +7 -0
  144. package/views/dist/controls/views-list/view-menu.js +28 -24
  145. package/views/dist/controls/views-list/words.d.ts +2 -0
  146. package/views/dist/controls/views-list/words.js +1 -1
  147. package/views/dist/editors/EditorPanel.js +2 -1
  148. package/views/dist/editors/edit-session.js +2 -5
  149. package/views/dist/field-row/FieldRow.d.ts +4 -2
  150. package/views/dist/field-row/FieldRow.js +67 -20
  151. package/views/dist/field-row/FieldRowLane.d.ts +7 -2
  152. package/views/dist/field-row/FieldRowLane.js +4 -3
  153. package/views/dist/field-row/editors/RowEditor.d.ts +12 -0
  154. package/views/dist/field-row/editors/RowEditor.js +31 -1
  155. package/views/dist/field-row/editors/RowValueListEditor.d.ts +5 -1
  156. package/views/dist/field-row/editors/RowValueListEditor.js +4 -1
  157. package/views/dist/field-row/field-row-button.d.ts +5 -0
  158. package/views/dist/field-row/field-row-button.js +2 -0
  159. package/views/dist/fields/binding.d.ts +3 -2
  160. package/views/dist/fields/binding.js +38 -5
  161. package/views/dist/grid/chrome/GridColumnMenu.d.ts +4 -2
  162. package/views/dist/grid/chrome/GridColumnMenu.js +3 -2
  163. package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -1
  164. package/views/dist/grid/chrome/GridGroupMenu.js +4 -3
  165. package/views/dist/grid/chrome/GridHeader.d.ts +4 -1
  166. package/views/dist/grid/chrome/GridHeader.js +2 -2
  167. package/views/dist/grid/chrome/GridRow.js +6 -5
  168. package/views/dist/grid/chrome/GridRowCells.js +6 -9
  169. package/views/dist/grid/chrome/GridStructure.d.ts +4 -1
  170. package/views/dist/grid/chrome/GridStructure.js +4 -4
  171. package/views/dist/grid/chrome/GridTable.js +5 -2
  172. package/views/dist/grid/chrome/grid-column-menu-items.js +1 -1
  173. package/views/dist/grid/chrome/grid-row-menu-items.d.ts +27 -3
  174. package/views/dist/grid/chrome/grid-row-menu-items.js +92 -6
  175. package/views/dist/grid/chrome/grid-row-props.d.ts +7 -2
  176. package/views/dist/grid/chrome/grid-rows-menu.js +34 -6
  177. package/views/dist/grid/chrome/grid-table-props.d.ts +38 -7
  178. package/views/dist/grid/chrome/useGridBatchApi.d.ts +3 -1
  179. package/views/dist/grid/chrome/useGridBatchApi.js +4 -2
  180. package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -2
  181. package/views/dist/grid/chrome/useGridKeyboard.js +15 -9
  182. package/views/dist/grid/chrome/useGridPendingReconciliation.js +1 -2
  183. package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -1
  184. package/views/dist/grid/chrome/useGridTableInteractionModel.js +11 -5
  185. package/views/dist/grid/core/commit-model.d.ts +20 -2
  186. package/views/dist/grid/core/editing-controller.d.ts +18 -0
  187. package/views/dist/grid/core/editing-controller.js +188 -42
  188. package/views/dist/grid/core/editing-model.d.ts +3 -0
  189. package/views/dist/grid/core/editing-model.js +3 -0
  190. package/views/dist/grid/core/save-path.d.ts +24 -0
  191. package/views/dist/grid/core/save-path.js +122 -0
  192. package/views/dist/grid/core/spreadsheet-operations.d.ts +3 -0
  193. package/views/dist/grid/core/spreadsheet-operations.js +23 -0
  194. package/views/dist/grid/index.d.ts +3 -2
  195. package/views/dist/grid/index.js +1 -0
  196. package/views/dist/internal/field-rows.d.ts +26 -0
  197. package/views/dist/internal/field-rows.js +8 -0
  198. package/views/dist/internal/page-close.d.ts +7 -0
  199. package/views/dist/internal/page-close.js +43 -0
  200. package/views/dist/list/browser-views-store.d.ts +10 -0
  201. package/views/dist/list/browser-views-store.js +182 -0
  202. package/views/dist/list/index.d.ts +23 -0
  203. package/views/dist/list/index.js +8 -0
  204. package/views/dist/list/menu.d.ts +31 -0
  205. package/views/dist/list/menu.js +76 -0
  206. package/views/dist/list/parts.d.ts +6 -0
  207. package/views/dist/list/parts.js +59 -0
  208. package/views/dist/list/registry.d.ts +11 -0
  209. package/views/dist/list/registry.js +31 -0
  210. package/views/dist/list/root.d.ts +40 -0
  211. package/views/dist/list/root.js +128 -0
  212. package/views/dist/list/slot.d.ts +14 -0
  213. package/views/dist/list/slot.js +22 -0
  214. package/views/dist/list/source.d.ts +11 -0
  215. package/views/dist/list/source.js +31 -0
  216. package/views/dist/list/store.d.ts +87 -0
  217. package/views/dist/list/store.js +115 -0
  218. package/views/dist/list/toolbar.d.ts +6 -0
  219. package/views/dist/list/toolbar.js +359 -0
  220. package/views/dist/list/views-axis.d.ts +5 -0
  221. package/views/dist/list/views-axis.js +96 -0
  222. package/views/dist/list/views-store.d.ts +41 -0
  223. package/views/dist/list/views-store.js +1 -0
  224. package/views/dist/list/views.d.ts +67 -0
  225. package/views/dist/list/views.js +400 -0
  226. package/views/dist/looks/index.d.ts +1 -0
  227. package/views/dist/looks/index.js +1 -0
  228. package/views/dist/looks/pieces.js +2 -0
  229. package/views/dist/model/preferences.js +1 -1
  230. package/views/dist/model/prefs-buckets.js +1 -1
  231. package/views/dist/panels/index.d.ts +3 -1
  232. package/views/dist/panels/index.js +1 -0
  233. package/views/dist/panels/react/customize-body.js +1 -0
  234. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +41 -4
  235. package/views/dist/panels/react/toolbar/ReadyToolbar.js +6 -326
  236. package/views/dist/panels/react/toolbar/Toolbar.d.ts +9 -1
  237. package/views/dist/panels/react/toolbar/Toolbar.js +34 -23
  238. package/views/dist/panels/react/toolbar/ToolbarButton.js +4 -1
  239. package/views/dist/panels/react/toolbar/ToolbarNew.js +1 -1
  240. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +2 -2
  241. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +3 -1
  242. package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
  243. package/views/dist/panels/react/toolbar/context.d.ts +10 -2
  244. package/views/dist/panels/react/toolbar/context.js +3 -1
  245. package/views/dist/panels/react/views-row/FoldingViewRow.d.ts +1 -1
  246. package/views/dist/panels/react/views-row/FoldingViewRow.js +15 -4
  247. package/views/dist/panels/react/views-row/PillGroup.d.ts +5 -2
  248. package/views/dist/panels/react/views-row/PillGroup.js +16 -7
  249. package/views/dist/panels/react/views-row/ViewPicker.js +2 -12
  250. package/views/dist/panels/react/views-row/ViewPickerRow.d.ts +4 -2
  251. package/views/dist/panels/react/views-row/ViewPickerRow.js +9 -5
  252. package/views/dist/panels/react.d.ts +2 -2
  253. package/views/dist/panels/toolbar/edit-view.d.ts +7 -1
  254. package/views/dist/panels/toolbar/edit-view.js +14 -0
  255. package/views/dist/panels/toolbar/model.d.ts +5 -0
  256. package/views/dist/panels/toolbar/model.js +7 -3
  257. package/views/dist/panels/view-state.d.ts +5 -3
  258. package/views/dist/panels/views-row/model.d.ts +19 -2
  259. package/views/dist/panels/views-row/model.js +14 -0
  260. package/views/dist/provider/ViewsProvider.d.ts +16 -7
  261. package/views/dist/provider/ViewsProvider.js +23 -5
  262. package/views/dist/provider/components.d.ts +43 -2
  263. package/views/dist/provider/context.d.ts +2 -1
  264. package/views/dist/provider/context.js +1 -1
  265. package/views/dist/provider/ports.d.ts +19 -12
  266. package/views/dist/provider/ports.js +69 -1
  267. package/views/dist/react.d.ts +1 -1
  268. package/views/dist/styles.css +583 -61
  269. package/views/dist/styles.unlayered.css +583 -61
  270. package/views/docs/contract.md +42 -31
  271. package/views/docs/controls/avatar.md +26 -0
  272. package/views/docs/controls/choice.md +0 -1
  273. package/views/docs/controls/field.md +3 -0
  274. package/views/docs/controls/input.md +9 -0
  275. package/views/docs/controls/radio.md +33 -0
  276. package/views/docs/controls/select.md +6 -0
  277. package/views/docs/controls/setting-row.md +44 -0
  278. package/views/docs/controls/switch-row.md +0 -3
  279. package/views/docs/controls/tag-field.md +4 -0
  280. package/views/docs/controls/tag.md +1 -0
  281. package/views/docs/getting-started.md +2 -2
  282. package/views/docs/guides/atoms.md +2 -2
  283. package/views/docs/guides/columns.md +1 -1
  284. package/views/docs/guides/ports.md +1 -1
  285. package/views/docs/guides/the-grid.md +34 -7
  286. package/views/docs/guides/the-provider.md +4 -2
  287. package/views/docs/index.md +1 -0
  288. package/views/docs/reference/controls.md +54 -27
  289. package/views/docs/reference/editors-session.md +1 -1
  290. package/views/docs/reference/field-row.md +9 -1
  291. package/views/docs/reference/grid.md +14 -8
  292. package/views/docs/reference/list.md +227 -0
  293. package/views/docs/reference/looks.md +3 -0
  294. package/views/docs/reference/panels-react.md +17 -12
  295. package/views/docs/reference/panels.md +8 -5
  296. package/views/docs/reference/react.md +11 -9
  297. package/views/docs/reference/views.md +2 -2
  298. package/views/skills/views/SKILL.md +9 -6
@@ -10,6 +10,10 @@ export interface TagFieldProps {
10
10
  /** Off: nothing typed in, and its tags have no remove button. */
11
11
  disabled?: boolean;
12
12
  defaultValue?: string[];
13
+ /** Tags that stay: drawn first, with no remove button, and Backspace passes them by. One missing from the value is put first. */
14
+ fixed?: string[];
15
+ /** A quiet word after a tag's name, by its name ({ EUR: "main" }). */
16
+ asides?: Record<string, React.ReactNode>;
13
17
  onValueChange?: (tags: string[]) => void;
14
18
  placeholder?: string;
15
19
  className?: string;
@@ -17,4 +21,4 @@ export interface TagFieldProps {
17
21
  "data-force"?: string;
18
22
  }
19
23
  /** Tags inside the Input's field, before the caret, in a Field with its label, note and error. */
20
- export declare function TagField({ label, note, error, disabled, defaultValue, onValueChange, placeholder, className, "data-force": force }: TagFieldProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare function TagField({ label, note, error, disabled, defaultValue, fixed, asides, onValueChange, placeholder, className, "data-force": force }: TagFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -1,19 +1,25 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
+ import { cx } from "../../internal/cx.js";
4
+ import { FieldRowsCardContext } from "../../internal/field-rows.js";
3
5
  import { Field } from "../field/field.js";
4
6
  import { Input, InputGroup } from "../input/input.js";
5
7
  import { Tag } from "../tag/tag.js";
6
- export function TagField({ label, note, error, disabled, defaultValue = [], onValueChange, placeholder = "Add a tag", className, "data-force": force }) {
7
- const [tags, setTags] = React.useState(defaultValue), [draft, setDraft] = React.useState("");
8
+ export function TagField({ label, note, error, disabled, defaultValue = [], fixed = [], asides, onValueChange, placeholder = "Add a tag", className, "data-force": force }) {
9
+ const [tags, setTags] = React.useState(() => [...fixed, ...defaultValue.filter((t) => !fixed.includes(t))]), [draft, setDraft] = React.useState("");
10
+ const loose = tags.filter((t) => !fixed.includes(t));
8
11
  const set = (next) => { setTags(next); onValueChange?.(next); };
12
+ const inRows = React.useContext(FieldRowsCardContext) != null;
9
13
  const add = () => { const w = draft.trim(); if (w && !tags.includes(w))
10
14
  set([...tags, w]); setDraft(""); };
11
- return (_jsx(Field, { label: label, note: note, error: error, disabled: disabled, className: className, children: _jsxs(InputGroup, { className: "o-tag-field", "data-force": force, children: [tags.map((t) => _jsx(Tag, { onRemove: disabled ? undefined : () => set(tags.filter((x) => x !== t)), children: t }, t)), _jsx(Input, { className: "o-tag-field-input", value: draft, placeholder: placeholder, autoComplete: "off", onChange: (e) => setDraft(e.currentTarget.value), onBlur: add, onKeyDown: (e) => {
15
+ return (_jsx(Field, { label: label, note: note, error: error, disabled: disabled, className: cx(inRows && "o-tag-field-row", className), children: _jsxs(InputGroup, { className: "o-tag-field", "data-force": force, children: [tags.map((t) => _jsx(Tag, { aside: asides?.[t], onRemove: disabled || fixed.includes(t) ? undefined : () => set(tags.filter((x) => x !== t)), children: t }, t)), _jsx(Input, { className: "o-tag-field-input", value: draft, placeholder: placeholder, autoComplete: "off", onChange: (e) => setDraft(e.currentTarget.value), onBlur: add, onKeyDown: (e) => {
12
16
  if (e.key === "Enter" || e.key === ",") {
13
17
  e.preventDefault();
14
18
  add();
15
19
  }
16
- else if (e.key === "Backspace" && !draft && tags.length)
17
- set(tags.slice(0, -1));
20
+ else if (e.key === "Backspace" && !draft && loose.length) {
21
+ const last = loose[loose.length - 1];
22
+ set(tags.filter((x) => x !== last));
23
+ }
18
24
  } })] }) }));
19
25
  }
@@ -1,4 +1,20 @@
1
1
  export declare const TAG_FIELD_TOKENS: readonly [{
2
+ readonly name: "--vk-border-width";
3
+ readonly kind: "size";
4
+ readonly outright: "--border-width";
5
+ }, {
6
+ readonly name: "--vk-font-weight-normal";
7
+ readonly kind: "size";
8
+ readonly outright: "--font-weight-normal";
9
+ }, {
10
+ readonly name: "--vk-neutral";
11
+ readonly kind: "colour";
12
+ readonly outright: "--background-neutral";
13
+ }, {
14
+ readonly name: "--vk-radius-full";
15
+ readonly kind: "size";
16
+ readonly outright: "--radius-full";
17
+ }, {
2
18
  readonly name: "--vk-spacing";
3
19
  readonly kind: "size";
4
20
  readonly outright: "--spacing";
@@ -1,4 +1,8 @@
1
1
  export const TAG_FIELD_TOKENS = [
2
+ { name: "--vk-border-width", kind: "size", outright: "--border-width" },
3
+ { name: "--vk-font-weight-normal", kind: "size", outright: "--font-weight-normal" },
4
+ { name: "--vk-neutral", kind: "colour", outright: "--background-neutral" },
5
+ { name: "--vk-radius-full", kind: "size", outright: "--radius-full" },
2
6
  { name: "--vk-spacing", kind: "size", outright: "--spacing" },
3
7
  ];
4
8
  export const TAG_FIELD_PRIVATE = [];
@@ -10,4 +10,23 @@
10
10
  .o-input.o-input-group.o-tag-field { flex-wrap: wrap; height: auto; min-height: calc(var(--vk-spacing) * 9); padding-block: calc(var(--vk-spacing) * 1.5); }
11
11
  .o-input.o-input-group.o-tag-field:where([data-vk-phone], [data-vk-phone] *) { min-height: calc(var(--vk-spacing) * 11); padding-block: calc(var(--vk-spacing) * 2.5); }
12
12
  .o-input-control.o-tag-field-input { align-self: center; min-width: calc(var(--vk-spacing) * 20); }
13
+
14
+ /* ── In a row of Field rows (VK-978; the settings canvas, round 3: look-ios.mjs .tok, .caret): the card's row as iOS draws a To
15
+ field. Its tokens fill the row from its words' inset, 6 apart, 12 above and below, wrapping as they grow, the caret after the
16
+ last (the Input typed in place, input.css). Its label names the box but stands out of sight: its place titles the group. Each
17
+ token is the Tag as iOS draws it: 30 tall, a pill on the neutral ground, no edge, no icon and no smoothing, the row's words in the normal
18
+ weight, as wide as the row lets it; its remove button stays, quiet. Its rules outweigh the box's and the phone's above, and
19
+ the Tag's own. ── */
20
+ .o-field.o-field-row.o-tag-field-row { position: relative; }
21
+ .o-tag-field-row > .o-field-row-label { position: absolute; width: var(--vk-border-width); height: var(--vk-border-width); overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
22
+ .o-input.o-input-inrow.o-tag-field.o-tag-field { flex-wrap: wrap; align-content: center; gap: calc(var(--vk-spacing) * 1.5); min-height: 0; padding-block: calc(var(--vk-spacing) * 3); }
23
+ .o-input.o-input-inrow.o-tag-field > .o-tag.o-tag {
24
+ --tag-h: calc(var(--vk-spacing) * 7.5); --tag-r: var(--vk-radius-full);
25
+ max-width: 100%; padding: 0 calc(var(--vk-spacing) * 2.5); border-radius: var(--tag-r); background-color: var(--vk-neutral); box-shadow: none;
26
+ font-size: inherit; font-weight: var(--vk-font-weight-normal);
27
+ }
28
+ /* A pill has no corner to smooth: the token paints its own ground, and its cut (the smooth ground and edge) stands down. */
29
+ .o-input-inrow.o-tag-field > .o-tag > :is(.o-tag-cut, .o-tag-icon) { display: none; }
30
+ /* Once a token stands, the caret alone after it: the placeholder only asks while the row is empty. */
31
+ .o-input-inrow.o-tag-field:has(> .o-tag) > .o-tag-field-input::placeholder { color: transparent; }
13
32
  }
@@ -20,6 +20,8 @@
20
20
  /* Its word is cropped so a long one ends in "…". The box that crops it stands as tall as the chip, never only as tall as its
21
21
  letters: at the chip's line-height of 1 the crop took the foot of every g, y and p. The word stays where it was. */
22
22
  .o-tag-word { overflow: hidden; text-overflow: ellipsis; line-height: var(--tag-h); }
23
+ /* A quiet word after its name ("main"): the quieter colour, the normal weight. */
24
+ .o-tag-aside { flex: none; color: var(--vk-fg-subtle); font-weight: var(--vk-font-weight-normal); line-height: var(--tag-h); }
23
25
  .o-tag-icon { flex: none; width: calc(var(--vk-spacing) * 3); height: calc(var(--vk-spacing) * 3); margin-left: calc(var(--vk-spacing) * -0.25); fill: none; stroke: var(--vk-fg-subtle); stroke-linecap: round; stroke-linejoin: round; }
24
26
  /* Small, in dense rows; a count for the rest, its number in the quieter colour. */
25
27
  .o-tag.o-tag-sm { --tag-h: calc(var(--vk-spacing) * 5); padding: 0 calc(var(--vk-spacing) * 1.5); }
@@ -51,6 +51,7 @@ import { LINKS_EDITOR_PRIVATE, LINKS_EDITOR_TOKENS } from "./links-editor/tokens
51
51
  import { PRESS_PRIVATE, PRESS_TOKENS } from "./press/tokens.js";
52
52
  import { CHOICE_PRIVATE, CHOICE_TOKENS } from "./choice/tokens.js";
53
53
  import { TAG_FIELD_PRIVATE, TAG_FIELD_TOKENS } from "./tag-field/tokens.js";
54
+ import { SETTING_ROW_PRIVATE, SETTING_ROW_TOKENS } from "./setting-row/tokens.js";
54
55
  import { SWITCH_ROW_PRIVATE, SWITCH_ROW_TOKENS } from "./switch-row/tokens.js";
55
56
  const CONTROLS_OWN = {
56
57
  button: { tokens: BUTTON_TOKENS, private: BUTTON_PRIVATE },
@@ -107,6 +108,7 @@ const CONTROLS_OWN = {
107
108
  choice: { tokens: CHOICE_TOKENS, private: CHOICE_PRIVATE },
108
109
  "tag-field": { tokens: TAG_FIELD_TOKENS, private: TAG_FIELD_PRIVATE },
109
110
  "switch-row": { tokens: SWITCH_ROW_TOKENS, private: SWITCH_ROW_PRIVATE },
111
+ "setting-row": { tokens: SETTING_ROW_TOKENS, private: SETTING_ROW_PRIVATE },
110
112
  };
111
113
  export const VK_CONTROL_TOKENS_BY_PIECE = Object.fromEntries(Object.entries(CONTROLS_OWN).map(([piece, own]) => [piece, own.tokens]));
112
114
  export const VK_CONTROL_TOKENS = Object.entries(VK_CONTROL_TOKENS_BY_PIECE)
@@ -1,6 +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
5
  import { type ToolbarPicks } from "./looks.js";
5
6
  import { type ToolbarWords } from "./words.js";
6
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. */
@@ -56,6 +57,13 @@ export interface ToolbarProps extends Omit<BaseToolbar.Root.Props, "className" |
56
57
  spacing?: number;
57
58
  /** Whether what doesn't fit gives way (words to icons, then into ⋯); otherwise it runs past its end. */
58
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[];
59
67
  /** Holds every line as it stands, giving way no further and taking no step back: while what a folded item opened stands open
60
68
  * under the button that holds it ("+N filters", ⋯), so that button keeps its place (KIT-624). */
61
69
  holds?: boolean;
@@ -86,12 +94,13 @@ export interface ToolbarFoldsProps {
86
94
  export declare function ToolbarFolds({ children }: ToolbarFoldsProps): React.ReactNode;
87
95
  /** 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,
88
96
  * the views giving way before the tools, as the portal's row does; then the filters fold into "+N filters" from their end, only
89
- * once nothing else gives words up (KIT-624); then the rest folds into ⋯ from its end. */
90
- declare function stepsOf(items: React.ReactElement[]): Step[];
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[];
91
100
  /** The steps a line takes as it narrows, for a test (stepsOf). */
92
101
  export declare const toolbarSteps: typeof stepsOf;
93
102
  /** The row and, under it, the filter bar: Base UI's toolbar, one Tab stop for the whole of it, the arrows inside. */
94
- 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, holds, form, onMoreViews, moreViewsOpen, className, style, onKeyDown, ...props }: ToolbarProps): import("react/jsx-runtime").JSX.Element;
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;
95
104
  /** A line between what belongs together and what doesn't, across a line. */
96
105
  export declare function ToolbarSeparatorControl({ className }: {
97
106
  className?: string;
@@ -101,6 +110,9 @@ export declare function ToolbarSpacer(): import("react/jsx-runtime").JSX.Element
101
110
  export interface ToolbarInputProps extends InputProps {
102
111
  /** An icon at its start side, inside the field: the search's. */
103
112
  icon?: React.ReactNode;
113
+ /** The search's button, shut: `both` shows "Search" beside its icon as the buttons on the right show their words; absent or
114
+ * `icon`, its icon alone (VK-967). */
115
+ words?: "both" | "icon";
104
116
  }
105
117
  /** The text box in the Toolbar: the Input, one of its stops, at its line's height unless it says its own (the search, its icon at
106
118
  * its start side). It keeps its width, giving some up down to its narrowest when the line is tight. The arrows move its caret,
@@ -8,6 +8,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
10
  import { PhoneHost, usePhone } from "../internal/phone.js";
11
+ import { watchFrame } from "../internal/watch-frame.js";
11
12
  import { Menu } from "../menu/menu.js";
12
13
  import { ToggleGroup } from "../toggle/toggle.js";
13
14
  import { InToolbar, ToolbarButtonControl as ToolbarButton, useToolbarButtonWorn } from "../toolbar-button/toolbar-button.js";
@@ -27,9 +28,7 @@ export function useToolbarWorn(el) {
27
28
  React.useLayoutEffect(() => {
28
29
  const read = () => setPicks((was) => { const now = toolbarWornOf(el); return samePicks(was, now) ? was : now; });
29
30
  read();
30
- const watch = new MutationObserver(read);
31
- watch.observe(document.documentElement, { attributes: true, subtree: true, attributeFilter: TOOLBAR_ATTRS });
32
- return () => watch.disconnect();
31
+ return watchFrame(TOOLBAR_ATTRS, read);
33
32
  }, [el]);
34
33
  return picks;
35
34
  }
@@ -63,12 +62,14 @@ const isJoined = (el) => isGroup(el) && !!el.props["aria-label"] && flat(el.prop
63
62
  const folds = (el) => (isToolbarButton(el) && !el.props.stays)
64
63
  || (isJoined(el) && el.props["data-open"] == null);
65
64
  const isFilter = (el) => !!el && (isJoined(el) || (isToolbarButton(el) && !!el.props.filter));
66
- function stepsOf(items) {
67
- const from = (test, to) => items.flatMap((el, i) => (test(el) ? [{ i, to }] : [])).reverse();
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();
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" }] : [])];
70
71
  return [...from(sheds, "icon"), ...fromWith((el) => folds(el) && isTab(el), "tabs"), ...fromWith((el) => folds(el) && isFilter(el), "filters"),
71
- ...from((el) => folds(el) && !isTab(el) && !isFilter(el), "fold")];
72
+ ...from((el) => folds(el) && !isTab(el) && !isFilter(el), "fold"), ...last];
72
73
  }
73
74
  export const toolbarSteps = stepsOf;
74
75
  function overflows(line) {
@@ -157,7 +158,7 @@ function useGiveWay(line, max, on, holds = false) {
157
158
  }, [line, on, look]);
158
159
  return stage;
159
160
  }
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, holds = false, form, onMoreViews, moreViewsOpen, className, style, onKeyDown, ...props }) {
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 }) {
161
162
  const spoken = toolbarWords(given), barLabel = barNamed ?? spoken.bar;
162
163
  const host = React.useContext(PhoneHost), narrow = usePhone();
163
164
  const phone = form ? form === "phone" : host != null || narrow;
@@ -179,7 +180,7 @@ export function ToolbarControl({ label, children, bar, barLabel: barNamed, words
179
180
  const searchForm = phone ? picks.searchphone : picks.search;
180
181
  const opens = searchForm === "button";
181
182
  const rightWords = picks.words === "both" ? "both" : "icon";
182
- const searchEl = search && (_jsx(InSearch.Provider, { value: { form: opens ? "button" : "input", words: "icon", open: searching, setOpen: setSearching }, children: search }, "search"));
183
+ const searchEl = search && (_jsx(InSearch.Provider, { value: { form: opens ? "button" : "input", rightWords: phone ? "icon" : rightWords, open: searching, setOpen: setSearching }, children: search }, "search"));
183
184
  const spacer = (key) => _jsx(ToolbarSpacer, {}, key);
184
185
  if (phone) {
185
186
  const right = picks.sortfilterphone === "right";
@@ -226,7 +227,7 @@ export function ToolbarControl({ label, children, bar, barLabel: barNamed, words
226
227
  e.preventDefault();
227
228
  to.focus();
228
229
  };
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, holds: holds, more: onMoreViews ? { press: onMoreViews, open: !!moreViewsOpen } : undefined }) }, l.id))) }) }));
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))) }) }));
230
231
  }
231
232
  function dressNew(el, form, ground) {
232
233
  if (!isButton(el))
@@ -235,10 +236,10 @@ function dressNew(el, form, ground) {
235
236
  const kind = form.startsWith("primary") ? "primary" : form.startsWith("outline") ? "outline" : KIND_OF_GROUND[ground];
236
237
  return React.cloneElement(el, { kind, ...(form.endsWith("-icon") ? { shape: "icon", children: undefined, "aria-label": p["aria-label"] ?? said ?? undefined } : {}) });
237
238
  }
238
- function Line({ id, label, items, size, fold, holds, more: moreViews }) {
239
+ function Line({ id, label, items, size, fold, fill, entries, holds, more: moreViews }) {
239
240
  const [line, setLine] = React.useState(null);
240
241
  const said = React.useContext(Said);
241
- const steps = fold ? stepsOf(items) : [];
242
+ const steps = fold ? stepsOf(items, fill) : [];
242
243
  const stage = useGiveWay(line, steps.length, fold, holds);
243
244
  const iconAlone = new Set(), folded = new Set(), foldedIn = new Map();
244
245
  for (const s of steps.slice(0, stage)) {
@@ -262,7 +263,11 @@ function Line({ id, label, items, size, fold, holds, more: moreViews }) {
262
263
  return [{ icon: p.icon ?? null, label: words(p.children) ?? p.label, count: p.count, disabled: p.disabled ? said.cantUse : undefined,
263
264
  onSelect: () => pressAt(p.onClick, line?.querySelector(at)) }];
264
265
  };
265
- const more = (_jsx(Menu, { label: said.moreOf(label), align: "end", entries: otherFolded.flatMap((i) => entryOf(items[i], "[data-more]")), trigger: _jsx(ToolbarButton, { label: said.more, icon: _jsx(Icon, { name: "dots" }), words: "icon", stays: true, "data-more": "" }) }, "more"));
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"));
266
271
  const firstTab = items.find(isTab);
267
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
273
  const moreTabs = !tabFolded.length ? null : moreViews
@@ -273,7 +278,7 @@ function Line({ id, label, items, size, fold, holds, more: moreViews }) {
273
278
  const drawn = [];
274
279
  items.forEach((el, i) => {
275
280
  if (folded.has(i)) {
276
- if (i === moreAt)
281
+ if (i === moreAt && !given)
277
282
  drawn.push(more);
278
283
  if (i === tabsAt)
279
284
  drawn.push(moreTabs);
@@ -287,6 +292,8 @@ function Line({ id, label, items, size, fold, holds, more: moreViews }) {
287
292
  }
288
293
  drawn.push(dress(el, iconAlone.has(i), size));
289
294
  });
295
+ if (always || (given && otherFolded.length > 0))
296
+ drawn.push(more);
290
297
  const shown = drawn.filter((n, k) => {
291
298
  if (!isSeparator(n))
292
299
  return true;
@@ -340,7 +347,7 @@ export function ToolbarSeparatorControl({ className }) {
340
347
  export function ToolbarSpacer() {
341
348
  return _jsx("span", { className: "o-toolbar-spacer", "aria-hidden": "true" });
342
349
  }
343
- export const ToolbarInput = React.forwardRef(function ToolbarInput({ size, icon, className, onKeyDown, onBlur, ...props }, ref) {
350
+ export const ToolbarInput = React.forwardRef(function ToolbarInput({ size, icon, words, className, onKeyDown, onBlur, ...props }, ref) {
344
351
  const row = React.useContext(InToolbar), search = React.useContext(InSearch), said = React.useContext(Said);
345
352
  const z = size ?? (row ? INPUT_SIZE[row.size] : undefined);
346
353
  const opens = search?.form === "button" && icon != null;
@@ -351,7 +358,7 @@ export const ToolbarInput = React.forwardRef(function ToolbarInput({ size, icon,
351
358
  } }, [iconEl]);
352
359
  const name = props["aria-label"] ?? props.placeholder ?? said.search;
353
360
  if (opens && !search.open)
354
- return _jsx(ToolbarButton, { ref: setIconEl, label: name, icon: icon, words: search.words, stays: true, onClick: () => search.setOpen(true), children: said.search });
361
+ return _jsx(ToolbarButton, { ref: setIconEl, label: name, icon: icon, words: words === "both" ? search.rightWords : "icon", stays: true, onClick: () => search.setOpen(true), children: said.search });
355
362
  const close = opens ? () => { if (props.value != null)
356
363
  props.onValueChange?.("", undefined); search.setOpen(false); } : null;
357
364
  const input = (_jsx(Input, { ref: ref, size: z, className: cn("o-toolbar-input", className), ...(row ? { render: _jsx(BaseToolbar.Input, {}) } : {}), ...(close ? { autoFocus: true } : {}), onKeyDown: (e) => { onKeyDown?.(e); if (close && e.key === "Escape") {
@@ -0,0 +1,14 @@
1
+ import type { ViewsToolbarButtonPart, ViewsToolbarButtonProps } from "../../atoms/types.js";
2
+ import { type ToolbarButtonGround, type ToolbarButtonProps } from "./toolbar-button.js";
3
+ /** How the Toolbar's own page dresses each of the toolbar's parts, on a phone or a computer, its tabs on the ground "The tabs"
4
+ * picks: the view switcher with its words and ▾ (on a phone, current and in the brand where the views are tabs, its words alone
5
+ * where they are one button); a tab its corners full, its words beside its icon, the open one current; "+N" an unopened tab's
6
+ * dress with its word; + its icon alone, ghost; Clear the ghost and Save the bordered, each its word. */
7
+ export declare function toolbarPartDress(part: ViewsToolbarButtonPart, { current, phone, tabs, ground }: {
8
+ current?: boolean;
9
+ phone: boolean;
10
+ tabs: boolean;
11
+ ground: ToolbarButtonGround;
12
+ }): Partial<ToolbarButtonProps>;
13
+ /** The ToolbarButton atom as the toolbar button. ViewKit's own `size` is not read: in a Toolbar a button takes its line's. */
14
+ export declare function ToolbarButtonAtom({ icon, label, word, count, more, dot, open, changed, edge, disabled, disabledReason, children, empty, aside, foot, iconAlone, popup, joined, waits, current, part, onContextMenu, onClick, onPointerDown, ref }: ViewsToolbarButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
5
+ import { Button } from "../button/button.js";
6
+ import { Icon } from "../internal/icons.js";
7
+ import { useToolbarWorn } from "../toolbar/toolbar.js";
8
+ import { InToolbar, ToolbarButtonControl } from "./toolbar-button.js";
9
+ const BUTTON_SIZE = { "28": "xs", "32": "sm", "36": "md", "44": "44" };
10
+ const PART_SLOT = {
11
+ "views-chip": "vk-views-chip", "views-tab": "vk-views-tab", "views-more": "vk-views-more", "views-add": "vk-views-add",
12
+ clear: "vk-toolbar-clear", save: "vk-toolbar-save-button",
13
+ };
14
+ export function toolbarPartDress(part, { current, phone, tabs, ground }) {
15
+ switch (part) {
16
+ case "views-chip": return phone && !tabs ? { words: "both" } : { words: "both", iconEnd: _jsx(Icon, { name: "down" }), ...(phone ? { current: true, lit: true } : {}) };
17
+ case "views-tab": return { ground, corners: "full", words: "both", current: !!current };
18
+ case "views-more": return { ground, corners: "full", words: "word", current: false };
19
+ case "views-add": return { ground: "ghost", corners: "full", words: "icon" };
20
+ case "clear": return { ground: "ghost", words: "word" };
21
+ case "save": return { ground: "bordered", words: "word" };
22
+ }
23
+ }
24
+ export function ToolbarButtonAtom({ icon, label, word, count, more, dot, open, changed, edge, disabled, disabledReason, children, empty, aside, foot, iconAlone, popup, joined, waits, current, part, onContextMenu, onClick, onPointerDown, ref }) {
25
+ const row = React.useContext(InToolbar);
26
+ const [el, setEl] = React.useState(null);
27
+ const picks = useToolbarWorn(el);
28
+ const own = React.useCallback((node) => {
29
+ setEl(node);
30
+ if (typeof ref === "function")
31
+ ref(node);
32
+ else if (ref)
33
+ ref.current = node;
34
+ }, [ref]);
35
+ const opens = popup ? { "aria-haspopup": popup, "aria-expanded": !!open } : {};
36
+ const text = children ?? (typeof word === "string" ? word : undefined);
37
+ const said = waits && text != null ? _jsx("span", { className: "o-toolbar-button-waits", children: text }) : text;
38
+ if (foot)
39
+ return _jsx(Button, { ref: own, kind: "primary", shape: "round", size: "44", icon: icon, "aria-label": label, disabled: disabled, onClick: onClick, onPointerDown: onPointerDown, ...opens });
40
+ if (edge && !picks.add.startsWith("like")) {
41
+ const alone = word === null || picks.add.endsWith("-icon");
42
+ const button = (_jsx(Button, { ref: own, kind: picks.add.startsWith("primary") ? "primary" : "outline", size: BUTTON_SIZE[row?.size ?? "32"], icon: icon, shape: alone ? "icon" : undefined, "aria-label": alone ? label : undefined, disabled: disabled, onClick: onClick, onPointerDown: onPointerDown, ...opens, children: alone ? undefined : (said ?? label) }));
43
+ return row ? _jsx(BaseToolbar.Button, { render: button, disabled: disabled }) : button;
44
+ }
45
+ const words = iconAlone || (edge && picks.add === "like-icon") || word === null ? "icon" : undefined;
46
+ if (part) {
47
+ return (_jsx(ToolbarButtonControl, { ref: own, label: label, icon: icon, "data-slot": PART_SLOT[part], ...toolbarPartDress(part, { current, phone: row?.form === "phone", tabs: picks.views === "tabs", ground: picks.tabs ?? "ghost" }), disabled: disabled, focusableWhenDisabled: !!disabledReason, onClick: onClick, onPointerDown: onPointerDown, onContextMenu: onContextMenu, ...opens, children: said }));
48
+ }
49
+ const counted = !dot && typeof count === "number" && count > 0 ? count : more;
50
+ return (_jsx(ToolbarButtonControl, { ref: own, label: label, icon: icon, words: words, count: counted, dot: dot, empty: empty, lit: changed, aside: aside, stays: edge, joined: joined, ...(waits ? { "data-waits": "" } : {}), disabled: disabled, focusableWhenDisabled: !!disabledReason, onClick: onClick, onPointerDown: onPointerDown, ...opens, children: said }));
51
+ }
@@ -17,7 +17,7 @@ export declare const InToolbar: React.Context<{
17
17
  form: "computer" | "phone";
18
18
  } | null>;
19
19
  /** Its options as worn around `el`, kept up to date as the frame's attributes change: what a toolbar reads too, for its row's
20
- * height. */
20
+ * height. Every reader shares one observer on the page (watch-frame.ts), so a toolbar of them opens one, not one per button. */
21
21
  export declare function useToolbarButtonWorn(el: HTMLElement | null, phone: boolean): Worn;
22
22
  export interface ToolbarButtonProps extends Omit<ButtonProps, "kind" | "size" | "shape" | "look" | "children"> {
23
23
  /** Its name: its word, unless `children` says more, and its name to a screen reader when its icon stands alone. */
@@ -5,6 +5,7 @@ import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
5
5
  import { cx } from "../../internal/cx.js";
6
6
  import { Button } from "../button/button.js";
7
7
  import { PhoneHost, usePhone } from "../internal/phone.js";
8
+ import { watchFrame } from "../internal/watch-frame.js";
8
9
  import { TOOLBAR_BUTTON_LOOKS } from "./looks.js";
9
10
  const KIND = { ghost: "quiet", bordered: "outline", filled: "soft" };
10
11
  const SIZE = { "28": "xs", "32": "sm", "36": "md", "44": "44" };
@@ -23,9 +24,7 @@ export function useToolbarButtonWorn(el, phone) {
23
24
  React.useLayoutEffect(() => {
24
25
  const read = () => setWorn((was) => { const now = wornOf(el, phone); return same(was, now) ? was : now; });
25
26
  read();
26
- const watch = new MutationObserver(read);
27
- watch.observe(document.documentElement, { attributes: true, subtree: true, attributeFilter: ATTRS });
28
- return () => watch.disconnect();
27
+ return watchFrame(ATTRS, read);
29
28
  }, [el, phone]);
30
29
  return worn;
31
30
  }
@@ -36,6 +36,10 @@
36
36
  .o-toolbar-button-count { margin-left: var(--vk-spacing); color: var(--vk-fg-subtle); font-variant-numeric: tabular-nums; }
37
37
  .o-toolbar-button-count[data-alone] { margin-left: 0; }
38
38
 
39
+ /* The words of a value it waits for (a filter's "Choose"), in the placeholder's colour: ViewKit's ToolbarButton atom drawn with it
40
+ (CONTROL_ATOMS) wraps them. */
41
+ .o-toolbar-button-waits { color: var(--vk-fg-subtle); }
42
+
39
43
  /* A dot at its top end corner, in the brand: something applied with no number. Drawn with ::before, since the pressing area takes
40
44
  ::after on a phone (its pressing area). */
41
45
  .o-button.o-toolbar-button[data-dot]::before {
@@ -6,6 +6,7 @@
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)
9
10
  --toolbar-spacing how far apart what a line holds stands, in spacing steps, when what holds it says so
10
11
  --toolbar-inset the room at each side of each line, when what holds it gives one (0 unless said)
11
12
 
@@ -28,6 +29,10 @@
28
29
 
29
30
  /* What a line holds keeps its width; only a text box gives some up, from its own width down to its narrowest. */
30
31
  .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; }
31
36
  .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); }
32
37
 
33
38
  /* 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. */
@@ -0,0 +1,3 @@
1
+ import type { ViewsViewMenuProps } from "../../provider/components.js";
2
+ /** ViewKit's view menu at a views row's pill. */
3
+ export declare function MapViewMenu({ open, onOpenChange, anchor, align, view, views, value, verbs, onDone, onHold }: ViewsViewMenuProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { ViewsContext } from "../../provider/context.js";
5
+ import { PhoneHost, usePhone } from "../internal/phone.js";
6
+ import { MapMenu } from "../menu/map-menu.js";
7
+ import { useVerbsMenu } from "./map-views-list-body.js";
8
+ export function MapViewMenu({ open, onOpenChange, anchor, align, view, views, value, verbs, onDone, onHold }) {
9
+ const Menu = React.useContext(ViewsContext)?.components.Menu ?? MapMenu;
10
+ const screen = React.useContext(PhoneHost), small = usePhone();
11
+ const creating = view === undefined;
12
+ const menu = useVerbsMenu({
13
+ views, value, verbs, form: screen || small ? "phone" : "computer",
14
+ ...(onDone ? { onDone } : {}), ...(onHold ? { onHold } : {}), ...(creating && open ? { shows: { what: "new" } } : {}),
15
+ });
16
+ const { asking } = menu;
17
+ React.useEffect(() => {
18
+ if (creating && !asking)
19
+ onOpenChange(false);
20
+ }, [creating, asking, onOpenChange]);
21
+ if (creating)
22
+ return _jsx(_Fragment, { children: menu.dialogs });
23
+ const label = views.find((v) => v.value === view)?.label ?? "";
24
+ return (_jsxs(_Fragment, { children: [_jsx(Menu, { open: open, onOpenChange: onOpenChange, anchor: anchor, align: align ?? "start", label: label, items: open ? menu.items(view) : [] }), menu.dialogs] }));
25
+ }
@@ -1,7 +1,9 @@
1
1
  import * as React from "react";
2
2
  import { type ViewsMessageResolver } from "../../contract.js";
3
- import type { ViewsViewsListBodyProps, ViewsViewsListItem } from "../../provider/components.js";
3
+ import type { ViewsViewsListBodyProps, ViewsViewsListItem, ViewsViewVerbs } from "../../provider/components.js";
4
+ import { type ViewMenuParts, type ViewMenuShows } from "./view-menu.js";
4
5
  import type { ViewMenuWords } from "./words.js";
6
+ import type { ListView, ViewsListChange, ViewsListLayout } from "./rules.js";
5
7
  import { type ViewsListProps } from "./views-list.js";
6
8
  import type { ViewsListWords } from "./words.js";
7
9
  type AppIcon = React.ComponentType<{
@@ -19,4 +21,29 @@ export declare function viewsListPropsOf(p: ViewsViewsListBodyProps, words: View
19
21
  export declare function viewMenuWordsOf(say: ViewsMessageResolver): ViewMenuWords;
20
22
  /** ViewKit's views list body, drawn as the views list. */
21
23
  export declare function MapViewsListBody(props: ViewsViewsListBodyProps): import("react/jsx-runtime").JSX.Element;
24
+ /** What a view's menu drawn from the axis's verbs is handed: the views list body's (VK-823), and a pill's (`ViewMenu`, VK-947). */
25
+ export type VerbsMenuProps = {
26
+ views: readonly ViewsViewsListItem[];
27
+ /** The view in use. */
28
+ value: string;
29
+ verbs: ViewsViewVerbs;
30
+ form: "computer" | "phone";
31
+ /** A phone's menu and what it opens are steps of its holder's one Sheet (the list body's). */
32
+ steps?: boolean;
33
+ /** A pick and an order, which only a list makes: a menu alone hands on neither. */
34
+ onListChange?: (change: Extract<ViewsListChange, {
35
+ kind: "open" | "order";
36
+ }>) => void;
37
+ onDone?: () => void;
38
+ onHold?: (holding: boolean) => void;
39
+ /** What stands open as it mounts (useViewMenu's `shows`): New view's Modal, for the views row's + (VK-971). */
40
+ shows?: ViewMenuShows;
41
+ };
42
+ /** A view's menu from the axis's verbs (useViewMenu): the views as the menu reads them, their layouts (the verbs', a view's
43
+ * icon else), the app's own shape of the menu (`verbs.menu`, VK-741), its `confirm` on a computer and its `toast`; every change
44
+ * but a pick and an order goes to `verbs.onChange`. */
45
+ export declare function useVerbsMenu(p: VerbsMenuProps): ViewMenuParts & {
46
+ views: ListView[];
47
+ layouts: ViewsListLayout[];
48
+ };
22
49
  export {};