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
@@ -1,329 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { settingsChange } from "viewkitjs/fields/query";
4
- import { useState } from "react";
5
- import { barItemsOf } from "../../../filters/filter-tree.js";
6
- import { useViews } from "../../../provider/context.js";
7
- import { useDesktop } from "../../../provider/desktop.js";
8
- import { getViewOptionAvailability } from "../../availability.js";
9
- import { settingsPanels } from "../../settings/settings-panels.js";
10
- import { settingsCleared } from "../../toolbar/clear.js";
11
- import { countsToggle, groupShown, showCountsChange, showCountsOf } from "../../toolbar/counts.js";
12
- import { withEditView } from "../../toolbar/edit-view.js";
13
- import { splitViewAxes } from "../../views-row/model.js";
14
- import { heldStands } from "../filter/editor-ctx.js";
15
- import { useToolbarPanelState } from "./panel-state.js";
16
- import { Toolbar, ToolbarSeparator } from "./Toolbar.js";
17
- import { ToolbarFilter } from "./ToolbarFilter.js";
18
- import { ToolbarFilterAdd } from "./ToolbarFilterAdd.js";
19
- import { ToolbarFilters, foldableFilters } from "./ToolbarFilters.js";
20
- import { ToolbarNew } from "./ToolbarNew.js";
21
- import { ToolbarOptions } from "./ToolbarOptions.js";
22
- import { ToolbarQuickFilters } from "./ToolbarQuickFilters.js";
23
- import { ToolbarSave } from "./ToolbarSave.js";
24
- import { ToolbarSearch } from "./ToolbarSearch.js";
25
- import { ToolbarSort } from "./ToolbarSort.js";
26
- import { ToolbarSortPill } from "./ToolbarSortPill.js";
27
- import { ToolbarAdvancedFilters } from "./ToolbarAdvancedFilters.js";
28
- import { ToolbarViews } from "./ToolbarViews.js";
29
- export function ReadyToolbar(props) {
30
- const { settings, onChange, views, viewsLayout, onAdd, addItems, addLabel, view, fieldEditor, searchPlaceholder, searching, hosts, narrow, className, viewName, onRenameView, onCopyLink, onExport, exportCount, } = props;
31
- const customizeOwn = {
32
- ...(viewName !== undefined && { viewName }),
33
- ...(onRenameView && { onRenameView }),
34
- ...(onCopyLink && { onCopyLink }),
35
- ...(onExport && { onExport }),
36
- ...(exportCount !== undefined && { exportCount }),
37
- };
38
- const { icons, messages, conventions } = useViews();
39
- const desktop = useDesktop();
40
- const phone = props.phone ?? !desktop;
41
- const options = useToolbarPanelState();
42
- const sortState = useToolbarPanelState();
43
- const filterState = useToolbarPanelState();
44
- const sortAdd = useToolbarPanelState();
45
- const filterAdd = useToolbarPanelState();
46
- const quickOwn = useToolbarPanelState();
47
- const quickState = props.quickFiltersOpen !== undefined && props.onQuickFiltersOpenChange
48
- ? { open: props.quickFiltersOpen, onOpenChange: props.onQuickFiltersOpenChange }
49
- : quickOwn;
50
- const [held, setHeld] = useState(null);
51
- const show = showCountsOf(settings);
52
- const setShow = (next) => {
53
- const change = showCountsChange(settings, next);
54
- if (Object.keys(change).length > 0)
55
- onChange(change);
56
- };
57
- const several = props.severalSorts ?? true;
58
- const input = {
59
- ...props,
60
- severalSorts: several,
61
- filterGroups: props.filterGroups ?? true,
62
- resolve: props.resolve ?? messages,
63
- conventions: props.conventions ?? conventions,
64
- };
65
- const panels = settingsPanels(input);
66
- const counts = countsToggle(views, props.toggles, show, setShow, messages);
67
- const toggles = counts ? [...(props.toggles ?? []), counts] : props.toggles;
68
- const inputs = {
69
- filters: panels.filters,
70
- sort: panels.sort,
71
- sorts: panels.sorts,
72
- filterTree: panels.filterTree,
73
- group: groupShown(panels.group, panels.layout, phone),
74
- layout: panels.layout,
75
- toggles,
76
- };
77
- const clear = (scope) => () => {
78
- const change = settingsCleared(input, scope, { phone });
79
- if (change)
80
- onChange(change);
81
- };
82
- const Edit = icons.options;
83
- const shownViews = getViewOptionAvailability(inputs).desktop
84
- ? withEditView(views, {
85
- key: "edit-view",
86
- label: messages({ key: "views.panels.edit-view" }),
87
- icon: _jsx(Edit, { className: "h-4 w-4" }),
88
- onSelect: () => options.onOpenChange(true),
89
- })
90
- : views;
91
- const search = settings.search ?? "";
92
- const searchNode = (_jsx(ToolbarSearch, { value: search, placeholder: searchPlaceholder, searching: searching, onChange: (next) => {
93
- const change = settingsChange(settings, { ...settings, search: next === "" ? undefined : next });
94
- if (Object.keys(change).length > 0)
95
- onChange(change);
96
- } }));
97
- const sortNode = several && panels.sorts ? (_jsx(ToolbarSortPill, { sorts: panels.sorts, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort, addAfter: props.addAfter })) : (_jsx(ToolbarSort, { sort: panels.sort, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort }));
98
- const filterNode = (_jsx(ToolbarFilter, { filters: panels.filters, filterTree: panels.filterTree, onClear: clear("filters"), open: filterState.open, onOpenChange: filterState.onOpenChange, page: filterState.page, onPageChange: filterState.onPageChange, host: hosts?.filter }));
99
- const quick = props.quickFilters?.fields.length
100
- ? { ...props.quickFilters, showCounts: props.quickFilters.showCounts ?? show }
101
- : null;
102
- const quickNode = quick ? (_jsx(ToolbarQuickFilters, { quickFilters: quick, open: quickState.open, onOpenChange: quickState.onOpenChange, host: hosts?.quick })) : null;
103
- if ((props.arrangement ?? "kit") === "kit") {
104
- const clearable = !view && settingsCleared(input, "options", { phone }) !== null;
105
- const { viewAxes, stackedAxes } = splitViewAxes(shownViews, viewsLayout);
106
- const tabs = !phone && viewAxes?.length === 1 ? Math.max(0, viewAxes[0].options.length - 1) : 0;
107
- const Sort = icons.sort;
108
- const Filter = icons.filter;
109
- const QuickGlyph = icons.filterCategory;
110
- const hasFilter = panels.filters.length > 0;
111
- const filterMenu = {
112
- label: messages({ key: "views.panels.filter" }),
113
- icon: _jsx(Filter, { className: "h-4 w-4" }),
114
- onSelect: () => filterState.onOpenChange(true),
115
- };
116
- const tree = panels.filterTree;
117
- const mihais = (props.sortFilter ?? "right") === "right" && !phone;
118
- const always = props.bar === "always";
119
- const filtered = tree ? barItemsOf(tree.tree).length > 0 || !!heldStands(held, tree.tree) : false;
120
- const barShown = always || !!stackedAxes || filtered;
121
- const footHere = phone || (mihais && !barShown);
122
- const filterParts = tree && !phone
123
- ? [
124
- {
125
- key: "filters",
126
- line: 2,
127
- ...(barItemsOf(tree.tree).length === 0 && !heldStands(held, tree.tree)
128
- ? { shed: true, fold: true, menu: filterMenu }
129
- : { filters: foldableFilters(tree.tree, held) }),
130
- node: (_jsx(ToolbarFilters, { filterTree: tree, open: filterState.open, onOpenChange: filterState.onOpenChange, held: held, onHeldChange: setHeld, host: hosts?.filter })),
131
- },
132
- ]
133
- : [
134
- { key: "filter", line: 2, shed: true, fold: true, menu: filterMenu, node: filterNode },
135
- ...(tree
136
- ? [
137
- {
138
- key: "advanced-filters",
139
- line: 2,
140
- node: _jsx(ToolbarAdvancedFilters, { filterTree: tree, host: hosts?.filter }),
141
- },
142
- ]
143
- : []),
144
- ];
145
- const kitParts = [
146
- ...(shownViews
147
- ? [{ key: "views", tabs, node: _jsx(ToolbarViews, { views: shownViews, viewsLayout: viewsLayout, showCounts: show }) }]
148
- : []),
149
- ...(shownViews && stackedAxes && !phone
150
- ? [
151
- {
152
- key: "views-stacked",
153
- line: 2,
154
- node: _jsx(ToolbarViews, { views: shownViews, viewsLayout: viewsLayout, showCounts: show, stacked: true }),
155
- },
156
- ]
157
- : []),
158
- {
159
- key: "options",
160
- shed: true,
161
- fold: true,
162
- menu: {
163
- label: messages({ key: "views.panels.toolbar-options" }),
164
- icon: _jsx(Edit, { className: "h-4 w-4" }),
165
- onSelect: () => options.onOpenChange(true),
166
- },
167
- node: (_jsx(ToolbarOptions, { ...inputs, view: view, viewFoot: !footHere ? "none" : view ? undefined : "kit", footClear: footHere && clearable ? clear("options") : undefined, fieldEditor: fieldEditor, onClear: view ? view.onReset : clear("options"), open: options.open, onOpenChange: options.onOpenChange, page: options.page, onPageChange: options.onPageChange, host: hosts?.options, ...customizeOwn })),
168
- },
169
- ...(quickNode
170
- ? [
171
- {
172
- key: "quick",
173
- side: "end",
174
- shed: true,
175
- fold: true,
176
- menu: {
177
- label: quick?.label ?? messages({ key: "views.panels.quick-filters" }),
178
- icon: _jsx(QuickGlyph, { className: "h-4 w-4" }),
179
- onSelect: () => quickState.onOpenChange(true),
180
- },
181
- node: quickNode,
182
- },
183
- ]
184
- : []),
185
- { key: "search", side: "end", role: "search", node: searchNode },
186
- { key: "new", side: "end", shed: true, node: _jsx(ToolbarNew, { onAdd: onAdd, items: addItems, label: addLabel }) },
187
- {
188
- key: "sort",
189
- line: 2,
190
- shed: true,
191
- fold: true,
192
- menu: {
193
- label: messages({ key: "views.panels.sort" }),
194
- icon: _jsx(Sort, { className: "h-4 w-4" }),
195
- onSelect: () => sortState.onOpenChange(true),
196
- },
197
- node: sortNode,
198
- },
199
- ...(hasFilter ? [{ key: "sep", line: 2, role: "separator", node: _jsx(ToolbarSeparator, {}) }] : []),
200
- ...filterParts,
201
- ...(!phone
202
- ? [
203
- {
204
- key: "save",
205
- line: 2,
206
- side: "end",
207
- node: _jsx(ToolbarSave, { view: view, onClear: clearable ? clear("options") : undefined }),
208
- },
209
- ]
210
- : []),
211
- ];
212
- if (phone) {
213
- const quickHere = kitParts.find((part) => part.key === "quick");
214
- const phoneParts = quickHere
215
- ? [...kitParts.filter((part) => part !== quickHere), { ...quickHere, line: 2, side: "start" }]
216
- : kitParts;
217
- return _jsx(Toolbar, { parts: phoneParts, phone: true, fold: true, className: className });
218
- }
219
- if ((props.sortFilter ?? "right") === "bar")
220
- return _jsx(Toolbar, { parts: kitParts, phone: phone, fold: true, className: className });
221
- const rowSort = {
222
- key: "sort",
223
- side: "end",
224
- shed: true,
225
- fold: true,
226
- menu: {
227
- label: messages({ key: "views.panels.sort" }),
228
- icon: _jsx(Sort, { className: "h-4 w-4" }),
229
- onSelect: () => sortAdd.onOpenChange(true),
230
- },
231
- node: panels.sorts ? (_jsx(ToolbarSortPill, { row: true, sorts: panels.sorts, open: sortAdd.open, onOpenChange: sortAdd.onOpenChange, host: hosts?.sort })) : (_jsx(ToolbarSort, { sort: panels.sort, open: sortAdd.open, onOpenChange: sortAdd.onOpenChange, host: hosts?.sort })),
232
- };
233
- const rowFilter = tree
234
- ? {
235
- key: "filter-add",
236
- side: "end",
237
- shed: true,
238
- fold: true,
239
- menu: { ...filterMenu, onSelect: () => filterAdd.onOpenChange(true) },
240
- node: (_jsx(ToolbarFilterAdd, { filterTree: tree, onHeldChange: setHeld, open: filterAdd.open, onOpenChange: filterAdd.onOpenChange, host: hosts?.filter })),
241
- }
242
- : { key: "filter", side: "end", shed: true, fold: true, menu: filterMenu, node: filterNode };
243
- const pill = always && panels.sorts ? (_jsx(ToolbarSortPill, { sorts: panels.sorts, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort, addAfter: false })) : null;
244
- const stackedPart = kitParts.find((part) => part.key === "views-stacked");
245
- const barParts = barShown
246
- ? [
247
- ...(stackedPart ? [stackedPart] : []),
248
- ...(pill ? [{ key: "sort-pill", line: 2, node: pill }] : []),
249
- ...(pill && (filtered || always) ? [{ key: "sep", line: 2, role: "separator", node: _jsx(ToolbarSeparator, {}) }] : []),
250
- ...(tree
251
- ? [
252
- {
253
- key: "filters",
254
- line: 2,
255
- filters: foldableFilters(tree.tree, held),
256
- node: (_jsx(ToolbarFilters, { filterTree: tree, open: filterState.open, onOpenChange: filterState.onOpenChange, held: held, onHeldChange: setHeld, host: hosts?.filter, emptyPlace: always })),
257
- },
258
- ]
259
- : []),
260
- {
261
- key: "save",
262
- line: 2,
263
- side: "end",
264
- node: _jsx(ToolbarSave, { view: view, onClear: clearable ? clear("options") : undefined }),
265
- },
266
- ]
267
- : [];
268
- const at = (key) => kitParts.find((part) => part.key === key);
269
- const quickPart = at("quick");
270
- const mihaisParts = [
271
- ...kitParts.filter((part) => (part.line ?? 1) === 1 && !["quick", "search", "new", "sort", "filter", "filters"].includes(part.key)),
272
- rowSort,
273
- rowFilter,
274
- ...(quickPart && quick
275
- ? [
276
- {
277
- ...quickPart,
278
- node: (_jsx(ToolbarQuickFilters, { quickFilters: quick, open: quickState.open, onOpenChange: quickState.onOpenChange, host: hosts?.quick, word: null })),
279
- },
280
- ]
281
- : []),
282
- at("search"),
283
- at("new"),
284
- ...barParts,
285
- ];
286
- return _jsx(Toolbar, { parts: mihaisParts, phone: phone, fold: true, className: className });
287
- }
288
- const parts = [
289
- ...(shownViews
290
- ? [
291
- { key: "views", node: _jsx(ToolbarViews, { views: shownViews, viewsLayout: viewsLayout, showCounts: show }) },
292
- { key: "views-stacked", line: 2, node: _jsx(ToolbarViews, { views: shownViews, viewsLayout: viewsLayout, showCounts: show, stacked: true }) },
293
- ]
294
- : []),
295
- {
296
- key: "search",
297
- side: "end",
298
- role: "search",
299
- node: searchNode,
300
- },
301
- {
302
- key: "sort",
303
- side: "end",
304
- node: sortNode,
305
- },
306
- {
307
- key: "filter",
308
- side: "end",
309
- node: filterNode,
310
- },
311
- ...(panels.filterTree
312
- ? [
313
- {
314
- key: "advanced-filters",
315
- side: "end",
316
- node: _jsx(ToolbarAdvancedFilters, { filterTree: panels.filterTree, host: hosts?.filter }),
317
- },
318
- ]
319
- : []),
320
- ...(quickNode ? [{ key: "quick", side: "end", node: quickNode }] : []),
321
- {
322
- key: "options",
323
- side: "end",
324
- node: (_jsx(ToolbarOptions, { ...inputs, view: view, fieldEditor: fieldEditor, onClear: view ? view.onReset : clear("options"), open: options.open, onOpenChange: options.onOpenChange, page: options.page, onPageChange: options.onPageChange, host: hosts?.options, ...customizeOwn })),
325
- },
326
- { key: "new", side: "end", node: _jsx(ToolbarNew, { onAdd: onAdd, items: addItems, label: addLabel }) },
327
- ];
328
- return _jsx(Toolbar, { parts: parts, phone: phone, narrow: narrow, className: className });
3
+ import { useId } from "react";
4
+ import { ListRoot } from "../../../list/root.js";
5
+ import { ListToolbar } from "../../../list/toolbar.js";
6
+ export function ReadyToolbar({ settings, layer, onChange, onLayerChange, view, sortFilter, bar, ...rest }) {
7
+ const id = useId();
8
+ return (_jsx(ListRoot, { id: id, settings: settings, layer: layer, onChange: onChange, onLayerChange: onLayerChange, view: view, sortFilter: sortFilter, bar: bar, children: _jsx(ListToolbar, { ...rest }) }));
329
9
  }
@@ -1,5 +1,10 @@
1
1
  import { type ReactNode } from "react";
2
+ import type { ViewsMenuItem } from "../../../provider/components.js";
2
3
  import { type ToolbarPlacement } from "../../toolbar/model.js";
4
+ /** ⋯ as data (VK-741): the folded parts' rows, each keyed by its part, and which line's ⋯ they are in. */
5
+ export type ToolbarMore = (items: ViewsMenuItem[], ctx: {
6
+ line: "row" | "bar";
7
+ }) => ViewsMenuItem[];
3
8
  /** A part as an app hands it: where it stands, and what it draws. `menu` is its row in ⋯, for a part placed
4
9
  * with `fold`: its words, its glyph, and what picking it does (open what the part opens). */
5
10
  export type ToolbarPart = ToolbarPlacement & {
@@ -10,7 +15,7 @@ export type ToolbarPart = ToolbarPlacement & {
10
15
  onSelect: () => void;
11
16
  };
12
17
  };
13
- export declare function Toolbar({ parts, phone, narrow, narrowBelow, fold, className, }: {
18
+ export declare function Toolbar({ parts, phone, narrow, narrowBelow, fold, more, className, }: {
14
19
  parts: readonly ToolbarPart[];
15
20
  /** The phone's one row; absent, the provider's answer (`desktopQuery`). */
16
21
  phone?: boolean;
@@ -23,6 +28,9 @@ export declare function Toolbar({ parts, phone, narrow, narrowBelow, fold, class
23
28
  * filters into "+N filters", then ⋯).
24
29
  * Default false: the three forms as they always were. */
25
30
  fold?: boolean;
31
+ /** ⋯ as data (VK-741): handed the folded parts' rows, each keyed by its part, and which line's ⋯ it is (each line folds into
32
+ * its own: the row's, or the filter bar's), it hands back the rows ⋯ shows. A press on any of them closes ⋯ first. */
33
+ more?: ToolbarMore;
26
34
  className?: string;
27
35
  }): ReactNode;
28
36
  /** A line between what belongs together and what doesn't: placed with `role: "separator"`, drawn in the fold
@@ -1,34 +1,41 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Fragment, useRef, useState } from "react";
3
+ import { Fragment, useContext, useRef, useState } from "react";
4
4
  import { cx } from "../../../internal/cx.js";
5
5
  import { useViews } from "../../../provider/context.js";
6
6
  import { useDesktop } from "../../../provider/desktop.js";
7
7
  import { TOOLBAR_NARROW_BELOW, arrangeToolbar, foldState, foldSteps, toolbarForm, } from "../../toolbar/model.js";
8
8
  import { useAnchoredToggle } from "../views-row/use-anchored-toggle.js";
9
- import { NOT_FOLDING, ToolbarRadioContext, ToolbarSlotContext, useToolbarPanel, useToolbarRadioState } from "./context.js";
9
+ import { ListRadioContext, NOT_FOLDING, ToolbarRadioContext, ToolbarSlotContext, useToolbarPanel, useToolbarRadioState } from "./context.js";
10
10
  import { ToolbarButton } from "./ToolbarButton.js";
11
11
  import { useBoxNarrow } from "./use-box-narrow.js";
12
12
  import { useGiveWay } from "./use-give-way.js";
13
13
  const CLUSTER_FADE = "linear-gradient(to right, transparent 0, var(--vk-ground) 1.25rem, var(--vk-ground) 100%)";
14
- export function Toolbar({ parts, phone, narrow, narrowBelow = TOOLBAR_NARROW_BELOW, fold = false, className, }) {
14
+ export function Toolbar({ parts, phone, narrow, narrowBelow = TOOLBAR_NARROW_BELOW, fold = false, more, className, }) {
15
15
  const box = useRef(null);
16
16
  const desktop = useDesktop();
17
17
  const measured = useBoxNarrow(box, narrowBelow);
18
- const radio = useToolbarRadioState();
18
+ const own = useToolbarRadioState();
19
+ const radio = useContext(ListRadioContext) ?? own;
19
20
  const [searchOpen, setSearchOpen] = useState(false);
20
21
  const form = toolbarForm({ phone: phone ?? !desktop, narrow: fold ? false : (narrow ?? measured) });
21
22
  const lines = arrangeToolbar(parts, form, { fold });
22
23
  const nodes = new Map(parts.map((part) => [part.key, part.node]));
24
+ const placed = new Map(parts.map((part) => [part.key, { ...(part.words && { words: part.words }), ...(part.foot !== undefined && { foot: part.foot }) }]));
23
25
  if (fold) {
24
26
  const menus = new Map(parts.flatMap((part) => (part.menu ? [[part.key, part.menu]] : [])));
25
- return (_jsx(ToolbarRadioContext.Provider, { value: radio, children: _jsx("div", { ref: box, "data-slot": "vk-toolbar", "data-form": form, "data-fold": "", className: cx("@container flex w-full flex-col", className), children: lines.map((line) => (_jsx(FoldLine, { line: line, form: form, nodes: nodes, menus: menus, search: { open: searchOpen, onOpenChange: setSearchOpen } }, line.kind))) }) }));
27
+ return (_jsx(ToolbarRadioContext.Provider, { value: radio, children: _jsx("div", { ref: box, "data-slot": "vk-toolbar", "data-form": form, "data-fold": "", className: cx("@container flex w-full flex-col", className), children: lines.map((line) => (_jsx(FoldLine, { line: line, form: form, nodes: nodes, placed: placed, menus: menus, more: more, search: { open: searchOpen, onOpenChange: setSearchOpen } }, line.kind))) }) }));
26
28
  }
27
- return (_jsx(ToolbarRadioContext.Provider, { value: radio, children: _jsx("div", { ref: box, "data-slot": "vk-toolbar", "data-form": form, className: cx("flex w-full flex-col", form === "row" ? "gap-1" : "gap-2", className), children: lines.map((line) => (_jsx(Line, { line: line, form: form, nodes: nodes }, line.kind))) }) }));
29
+ return (_jsx(ToolbarRadioContext.Provider, { value: radio, children: _jsx("div", { ref: box, "data-slot": "vk-toolbar", "data-form": form, className: cx("flex w-full flex-col", form === "row" ? "gap-1" : "gap-2", className), children: lines.map((line) => (_jsx(Line, { line: line, form: form, nodes: nodes, placed: placed }, line.kind))) }) }));
28
30
  }
29
- function Line({ line, form, nodes }) {
30
- const draw = (slots) => slots.map((slot) => (_jsx(ToolbarSlotContext.Provider, { value: { form, fill: slot.fill, size: line.size, line: line.kind, ...NOT_FOLDING, appFrame: false }, children: _jsx(Fragment, { children: nodes.get(slot.key) }) }, slot.key)));
31
- const mark = { "data-slot": "vk-toolbar-line", "data-line": line.kind };
31
+ function useLineName(kind) {
32
+ const { messages } = useViews();
33
+ return messages({ key: kind === "bar" || kind === "below" ? "views.panels.toolbar-bar" : "views.panels.toolbar-row" });
34
+ }
35
+ function Line({ line, form, nodes, placed }) {
36
+ const name = useLineName(line.kind);
37
+ const draw = (slots) => slots.map((slot) => (_jsx(ToolbarSlotContext.Provider, { value: { form, fill: slot.fill, size: line.size, line: line.kind, ...NOT_FOLDING, appFrame: false, ...placed.get(slot.key) }, children: _jsx(Fragment, { children: nodes.get(slot.key) }) }, slot.key)));
38
+ const mark = { "data-slot": "vk-toolbar-line", "data-line": line.kind, role: "toolbar", "aria-label": name };
32
39
  if (line.kind === "main" && form === "row") {
33
40
  return (_jsxs("div", { ...mark, "data-toolbar-row": true, className: "relative flex min-h-9 items-center empty:hidden", children: [_jsx("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: draw(line.start) }), line.end.length > 0 && (_jsx("div", { "data-slot": "vk-toolbar-cluster", "data-toolbar-cluster": true, className: "absolute inset-y-0 right-0 flex items-center gap-1 pl-8", style: { background: CLUSTER_FADE }, children: draw(line.end) }))] }));
34
41
  }
@@ -41,7 +48,8 @@ function Line({ line, form, nodes }) {
41
48
  }
42
49
  return (_jsxs("div", { ...mark, className: "flex flex-wrap items-center gap-2 empty:hidden", children: [draw(line.start), line.end.length > 0 && _jsx("div", { className: "ml-auto flex items-center gap-1", children: draw(line.end) })] }));
43
50
  }
44
- function FoldLine({ line, form, nodes, menus, search, }) {
51
+ function FoldLine({ line, form, nodes, placed, menus, more: reshape, search, }) {
52
+ const name = useLineName(line.kind);
45
53
  const [element, setElement] = useState(null);
46
54
  const more = useRef(null);
47
55
  const steps = foldSteps(line);
@@ -49,7 +57,8 @@ function FoldLine({ line, form, nodes, menus, search, }) {
49
57
  const state = foldState(line, steps, stage);
50
58
  const phone = form === "phone";
51
59
  const searchTakesLine = phone && search.open && [...line.start, ...line.end].some((slot) => slot.search);
52
- const waits = (slot) => searchTakesLine && !slot.search && slot.key !== "views" && slot.key !== "new";
60
+ const atFoot = (slot) => slot.key === "new" && placed.get(slot.key)?.foot !== false;
61
+ const waits = (slot) => searchTakesLine && !slot.search && slot.key !== "views" && !atFoot(slot);
53
62
  const drawnIn = (slots) => slots.map((slot, i) => {
54
63
  if (!slot.separator)
55
64
  return !state.folded.has(slot.key);
@@ -78,6 +87,7 @@ function FoldLine({ line, form, nodes, menus, search, }) {
78
87
  more,
79
88
  search: slot.search ? search : null,
80
89
  appFrame: false,
90
+ ...placed.get(slot.key),
81
91
  }, children: _jsx(Fragment, { children: nodes.get(slot.key) }) }) }, slot.key));
82
92
  if (slot.key !== state.moreAfter)
83
93
  return [itemNode];
@@ -86,27 +96,28 @@ function FoldLine({ line, form, nodes, menus, search, }) {
86
96
  return menu ? [{ key: s.key, ...menu }] : [];
87
97
  });
88
98
  const align = line.start.some((s) => s.key === slot.key) ? "start" : "end";
89
- return [itemNode, _jsx(Overflow, { anchor: more, rows: rows, size: line.size, form: form, align: align }, "vk-overflow")];
99
+ return [itemNode, _jsx(Overflow, { anchor: more, rows: rows, reshape: reshape && ((items) => reshape(items, { line: line.kind === "bar" || line.kind === "below" ? "bar" : "row" })), size: line.size, form: form, align: align }, "vk-overflow")];
90
100
  });
91
101
  };
92
- return (_jsxs("div", { ref: setElement, "data-slot": "vk-toolbar-line", "data-line": line.kind, ...(line.kind === "main" ? { "data-toolbar-row": "" } : {}), className: cx("flex min-w-0 items-center", phone ? "gap-1.5" : "gap-2 border-b border-(color:--vk-border-subtle) py-2.5"), children: [draw(line.start), !searchTakesLine && _jsx("span", { "data-toolbar-spacer": true, "aria-hidden": true, className: "min-w-0 flex-1" }), draw(line.end)] }));
102
+ return (_jsxs("div", { ref: setElement, "data-slot": "vk-toolbar-line", "data-line": line.kind, role: "toolbar", "aria-label": name, ...(line.kind === "main" ? { "data-toolbar-row": "" } : {}), className: cx("flex min-w-0 items-center", phone ? "gap-1.5" : "gap-2 border-b border-(color:--vk-border-subtle) py-2.5"), children: [draw(line.start), !searchTakesLine && _jsx("span", { "data-toolbar-spacer": true, "aria-hidden": true, className: "min-w-0 flex-1" }), draw(line.end)] }));
93
103
  }
94
- function Overflow({ anchor, rows, size, form, align, }) {
104
+ const closingFirst = (items, setOpen) => items.map((item) => ({
105
+ ...item,
106
+ ...(item.onSelect && { onSelect: () => { setOpen(false); item.onSelect?.(); } }),
107
+ ...(item.children && { children: closingFirst(item.children, setOpen) }),
108
+ }));
109
+ function Overflow({ anchor, rows, reshape, size, form, align, }) {
95
110
  const { components, icons, messages } = useViews();
96
111
  const { Menu } = components;
97
112
  const More = icons.more;
98
113
  const toggle = useAnchoredToggle(anchor);
99
114
  useToolbarPanel("overflow", { open: toggle.open, onOpenChange: toggle.setOpen });
100
115
  const name = messages({ key: "views.panels.toolbar-more" });
101
- return (_jsxs("span", { "data-slot": "vk-toolbar-overflow", className: "relative inline-flex shrink-0", children: [_jsx(ToolbarSlotContext.Provider, { value: { form, fill: false, size, line: "main", ...NOT_FOLDING, iconAlone: true, appFrame: false }, children: _jsx(ToolbarButton, { ref: anchor, icon: _jsx(More, { className: "h-4 w-4 shrink-0" }), label: name, word: null, popup: "menu", open: toggle.open, onPointerDown: toggle.triggerProps.onPointerDown, onClick: toggle.triggerProps.onClick }) }), _jsx(Menu, { open: toggle.open, onOpenChange: toggle.onOpenChange, anchor: anchor, align: align, label: name, items: rows.map((row) => ({
102
- key: row.key,
103
- label: row.label,
104
- icon: row.icon,
105
- onSelect: () => {
106
- toggle.setOpen(false);
107
- row.onSelect();
108
- },
109
- })) })] }));
116
+ const own = (list) => {
117
+ const items = list.map((row) => ({ key: row.key, label: row.label, icon: row.icon, onSelect: row.onSelect }));
118
+ return reshape ? reshape(items) : items;
119
+ };
120
+ return (_jsxs("span", { "data-slot": "vk-toolbar-overflow", className: "relative inline-flex shrink-0", children: [_jsx(ToolbarSlotContext.Provider, { value: { form, fill: false, size, line: "main", ...NOT_FOLDING, iconAlone: true, appFrame: false }, children: _jsx(ToolbarButton, { ref: anchor, icon: _jsx(More, { className: "h-4 w-4 shrink-0" }), label: name, word: null, popup: "menu", open: toggle.open, onPointerDown: toggle.triggerProps.onPointerDown, onClick: toggle.triggerProps.onClick }) }), _jsx(Menu, { open: toggle.open, onOpenChange: toggle.onOpenChange, anchor: anchor, align: align, label: name, items: closingFirst(own(rows), toggle.setOpen) })] }));
110
121
  }
111
122
  export function ToolbarSeparator() {
112
123
  return _jsx("span", { role: "separator", "aria-orientation": "vertical", "data-slot": "vk-toolbar-separator", className: "h-4 w-px shrink-0 self-center bg-(color:--vk-border)" });
@@ -5,5 +5,8 @@ import { useToolbarSlot } from "./context.js";
5
5
  export function ToolbarButton({ size, ...props }) {
6
6
  const { atoms } = useViews();
7
7
  const slot = useToolbarSlot();
8
- return _jsx(atoms.ToolbarButton, { ...props, ...(slot.iconAlone && { iconAlone: true }), size: size ?? slot.size });
8
+ const iconOnly = slot.words === "icon" && props.icon != null;
9
+ const hasWords = props.word !== null || props.children != null;
10
+ const alone = slot.iconAlone || (iconOnly && hasWords);
11
+ return (_jsx(atoms.ToolbarButton, { ...props, ...(iconOnly && { word: null }), ...(alone && { iconAlone: true }), size: size ?? slot.size }));
9
12
  }
@@ -19,7 +19,7 @@ export function ToolbarNew({ onAdd, items, label, icon, }) {
19
19
  if (!onAdd && !hasMenu && slot.form !== "row")
20
20
  return null;
21
21
  const name = label ?? messages({ key: "views.panels.toolbar-new" });
22
- const atFoot = slot.fold && slot.form === "phone";
22
+ const atFoot = slot.fold && slot.form === "phone" && slot.foot !== false;
23
23
  const place = (_jsxs("span", { "data-slot": "vk-toolbar-new", "data-at": atFoot ? "foot" : undefined, className: atFoot
24
24
  ? "fixed bottom-[calc(var(--vk-toolbar-foot,1rem)+env(safe-area-inset-bottom))] end-4 z-30 inline-flex"
25
25
  : "relative inline-flex shrink-0", children: [_jsx(ToolbarButton, { ref: anchor, icon: icon ?? _jsx(Add, { className: "h-4 w-4 shrink-0" }), label: name, word: name, edge: true, foot: atFoot || undefined, disabled: !onAdd && !hasMenu, popup: hasMenu ? "menu" : undefined, open: hasMenu && toggle.open, onPointerDown: hasMenu ? toggle.triggerProps.onPointerDown : undefined, onClick: (event) => (hasMenu ? toggle.triggerProps.onClick(event) : onAdd?.()) }), hasMenu && (_jsx(Menu, { open: toggle.open, onOpenChange: toggle.onOpenChange, anchor: anchor, items: items, align: "end", side: atFoot ? "top" : undefined, label: name }))] }));
@@ -11,7 +11,7 @@ export declare function ToolbarQuickFilters({ quickFilters, open, onOpenChange,
11
11
  host?: ToolbarPanelHost;
12
12
  /** The button's glyph; absent, the filter row's category glyph. */
13
13
  icon?: ReactNode;
14
- /** `null`: its icon alone, its words its name to a screen reader (the ready toolbar's default arrangement, Mihai's
15
- * look); absent, its icon and its words. */
14
+ /** `null`: its icon alone, its words its name to a screen reader, unless it was placed `words: "both"` (VK-967); absent,
15
+ * its icon and its words. */
16
16
  word?: null;
17
17
  }): ReactNode;
@@ -4,13 +4,15 @@ import { useViews } from "../../../provider/context.js";
4
4
  import { holdStands } from "../../quick/model.js";
5
5
  import { useSheetPanels } from "../panel-sheet.js";
6
6
  import { QuickFiltersPanel } from "../quick/QuickFiltersPanel.js";
7
+ import { useToolbarSlot } from "./context.js";
7
8
  import { ToolbarPanelPart } from "./panel-part.js";
8
9
  export function ToolbarQuickFilters({ quickFilters, open, onOpenChange, host, icon, word, }) {
9
10
  const { icons, messages } = useViews();
10
11
  const phone = useSheetPanels();
12
+ const slot = useToolbarSlot();
11
13
  if (quickFilters.fields.length === 0)
12
14
  return null;
13
15
  const Glyph = icons.filterCategory;
14
16
  const label = quickFilters.label ?? messages({ key: "views.panels.quick-filters" });
15
- return (_jsx(ToolbarPanelPart, { panelKey: "quick", slot: "vk-toolbar-quick", icon: icon ?? _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: label, word: word === null ? null : label, changed: holdStands(quickFilters.hold), open: open, onOpenChange: onOpenChange, host: host, children: ({ close, closeButton }) => (_jsx(QuickFiltersPanel, { quickFilters: quickFilters, form: phone ? "phone" : "computer", onDone: close, closeButton: closeButton })) }));
17
+ return (_jsx(ToolbarPanelPart, { panelKey: "quick", slot: "vk-toolbar-quick", icon: icon ?? _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: label, word: word === null && slot.words !== "both" ? null : label, changed: holdStands(quickFilters.hold), open: open, onOpenChange: onOpenChange, host: host, children: ({ close, closeButton }) => (_jsx(QuickFiltersPanel, { quickFilters: quickFilters, form: phone ? "phone" : "computer", onDone: close, closeButton: closeButton })) }));
16
18
  }
@@ -43,7 +43,7 @@ export function ToolbarSearch({ value, onChange, placeholder, searching = false,
43
43
  setOpened(false);
44
44
  };
45
45
  if (!shown) {
46
- return (_jsx("div", { "data-slot": "vk-toolbar-search", className: "relative flex flex-none items-center", children: _jsx(ToolbarButton, { icon: searching ? _jsx(LoadingRing, { label: busy, slot: "vk-toolbar-search-spinner", className: "h-4 w-4" }) : _jsx(Glass, { className: "h-4 w-4 shrink-0" }), label: name, word: null, onClick: () => {
46
+ return (_jsx("div", { "data-slot": "vk-toolbar-search", className: "relative flex flex-none items-center", children: _jsx(ToolbarButton, { icon: searching ? _jsx(LoadingRing, { label: busy, slot: "vk-toolbar-search-spinner", className: "h-4 w-4" }) : _jsx(Glass, { className: "h-4 w-4 shrink-0" }), label: name, word: slot.words === "both" ? undefined : null, onClick: () => {
47
47
  pressed.current = true;
48
48
  setOpened(true);
49
49
  } }) }));
@@ -26,6 +26,11 @@ export type ToolbarSlotState = {
26
26
  /** The part stands in an app's own toolbar frame (`ToolbarSlotProvider`), not ViewKit's `Toolbar` nor none: the views
27
27
  * part's chip, tabs, "+N" and "+", and Clear and Save draw through your `ToolbarButton`. */
28
28
  appFrame: boolean;
29
+ /** Its words as it was placed (`ToolbarPlacement.words`, VK-967): `icon`, its icon alone; `both`, a part that is its icon
30
+ * alone by default (the search, the quick filters' button) reads its word. Absent, its own. */
31
+ words?: "both" | "icon";
32
+ /** `false`: New stays on a phone's folding line instead of at the list's foot. */
33
+ foot?: boolean;
29
34
  };
30
35
  /** The fold arrangement's part of a slot, for a line that doesn't fold. */
31
36
  export declare const NOT_FOLDING: {
@@ -57,15 +62,18 @@ export type ToolbarRadio = {
57
62
  /** A fresh radio, held by the frame for its life. */
58
63
  export declare function useToolbarRadioState(): ToolbarRadio;
59
64
  export declare const ToolbarRadioContext: import("react").Context<ToolbarRadio | null>;
65
+ /** The radio of the list root around a frame (`ListRoot`, VK-739): a frame inside one takes it over its own, so one
66
+ * panel is open per list whichever frame opened it. */
67
+ export declare const ListRadioContext: import("react").Context<ToolbarRadio | null>;
60
68
  /** For an app's own toolbar frame (VK-559): the radio, held for its life, as ViewKit's `Toolbar` holds one. The parts
61
69
  * inside it that open something (`useToolbarPanel`) close each other, and a part's panel reads its slot's `form` for
62
- * a phone's sheet, as inside a `Toolbar`. */
70
+ * a phone's sheet, as inside a `Toolbar`. Inside a `ListRoot` it is the root's radio, shared with every frame there. */
63
71
  export declare function ToolbarRadioProvider({ children }: {
64
72
  children?: ReactNode;
65
73
  }): ReactNode;
66
74
  /** A part's open state, one of the toolbar's panels: when it opens, the toolbar closes every other. Handed
67
75
  * `own`, it reads and changes that state (a panel the app holds, which may open itself); without, it holds its
68
- * own. Outside a `Toolbar`, it is plain open state. */
76
+ * own. Inside a `ListRoot` it is one of the root's panels; outside a `Toolbar` and a root, it is plain open state. */
69
77
  export declare function useToolbarPanel(key: string, own?: {
70
78
  open: boolean;
71
79
  onOpenChange: (open: boolean) => void;
@@ -38,8 +38,10 @@ export function useToolbarRadioState() {
38
38
  return radio;
39
39
  }
40
40
  export const ToolbarRadioContext = createContext(null);
41
+ export const ListRadioContext = createContext(null);
41
42
  export function ToolbarRadioProvider({ children }) {
42
- const radio = useToolbarRadioState();
43
+ const own = useToolbarRadioState();
44
+ const radio = useContext(ListRadioContext) ?? own;
43
45
  return createElement(ToolbarRadioContext.Provider, { value: radio }, children);
44
46
  }
45
47
  export function useToolbarPanel(key, own) {
@@ -1,4 +1,4 @@
1
- import type { CollectionViewsConfig } from "../../views-row/model.js";
1
+ import { type CollectionViewsConfig } from "../../views-row/model.js";
2
2
  export declare function FoldingViewRow({ axis, folded: told }: {
3
3
  axis: CollectionViewsConfig<string>;
4
4
  folded?: number;