viewkitjs 0.29.0 → 0.30.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 (287) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/MIGRATION.md +97 -8
  3. package/package.json +1 -1
  4. package/views/dist/cells/cell-format.d.ts +2 -2
  5. package/views/dist/cells/cell-values.js +0 -2
  6. package/views/dist/contract.d.ts +15 -18
  7. package/views/dist/contract.js +13 -27
  8. package/views/dist/controls/controls.d.ts +2 -4
  9. package/views/dist/controls/controls.js +2 -2
  10. package/views/dist/controls/customize/customize.d.ts +51 -0
  11. package/views/dist/controls/customize/customize.js +128 -23
  12. package/views/dist/controls/customize/map-customize-body.d.ts +0 -3
  13. package/views/dist/controls/customize/map-customize-body.js +46 -11
  14. package/views/dist/controls/customize/map-ranges.d.ts +23 -0
  15. package/views/dist/controls/customize/map-ranges.js +41 -0
  16. package/views/dist/controls/customize/rules.d.ts +17 -1
  17. package/views/dist/controls/customize/rules.js +2 -0
  18. package/views/dist/controls/customize/words.d.ts +7 -0
  19. package/views/dist/controls/customize/words.js +5 -0
  20. package/views/dist/controls/customize.css +3 -0
  21. package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
  22. package/views/dist/controls/filter-editor/filter-editor.js +1 -0
  23. package/views/dist/controls/filter-editor/rules.d.ts +1 -2
  24. package/views/dist/controls/index.d.ts +8 -8
  25. package/views/dist/controls/index.js +8 -8
  26. package/views/dist/controls/menu-list/menu-list.d.ts +16 -1
  27. package/views/dist/controls/menu-list/menu-list.js +26 -8
  28. package/views/dist/controls/menu-list.css +8 -0
  29. package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +1 -1
  30. package/views/dist/controls/quick-filters/map-quick-filters-body.js +6 -3
  31. package/views/dist/controls/sheet/map-sheet.js +1 -1
  32. package/views/dist/controls/text-editor/map-text-body.d.ts +1 -1
  33. package/views/dist/controls/text-editor/map-text-body.js +2 -2
  34. package/views/dist/controls/text-editor/text-editor.d.ts +3 -0
  35. package/views/dist/controls/text-editor/text-editor.js +16 -2
  36. package/views/dist/controls/text-editor.css +11 -0
  37. package/views/dist/controls/values-editor/values.js +6 -2
  38. package/views/dist/display/options.d.ts +1 -1
  39. package/views/dist/display/rich-text.js +0 -1
  40. package/views/dist/editors/ChipsEditor.d.ts +4 -5
  41. package/views/dist/editors/ChipsEditor.js +12 -78
  42. package/views/dist/editors/DateEditor.d.ts +12 -16
  43. package/views/dist/editors/DateEditor.js +40 -191
  44. package/views/dist/editors/EditorPanel.d.ts +2 -6
  45. package/views/dist/editors/EditorPanel.js +2 -2
  46. package/views/dist/editors/LocationEditor.d.ts +11 -19
  47. package/views/dist/editors/LocationEditor.js +19 -211
  48. package/views/dist/editors/NameEditor.d.ts +8 -16
  49. package/views/dist/editors/NameEditor.js +11 -100
  50. package/views/dist/editors/NumberEditor.d.ts +14 -21
  51. package/views/dist/editors/NumberEditor.js +22 -49
  52. package/views/dist/editors/RangeEditor.d.ts +9 -33
  53. package/views/dist/editors/RangeEditor.js +12 -97
  54. package/views/dist/editors/RelationEditor.d.ts +6 -9
  55. package/views/dist/editors/RelationEditor.js +11 -30
  56. package/views/dist/editors/RelationSetEditor.d.ts +13 -24
  57. package/views/dist/editors/RelationSetEditor.js +33 -101
  58. package/views/dist/editors/SelectEditor.d.ts +15 -17
  59. package/views/dist/editors/SelectEditor.js +15 -94
  60. package/views/dist/editors/TextEditor.d.ts +23 -26
  61. package/views/dist/editors/TextEditor.js +11 -48
  62. package/views/dist/editors/ValueListEditor.d.ts +14 -23
  63. package/views/dist/editors/ValueListEditor.js +16 -202
  64. package/views/dist/editors/body-panel.d.ts +13 -7
  65. package/views/dist/editors/body-panel.js +3 -7
  66. package/views/dist/editors/edit-cores.d.ts +15 -15
  67. package/views/dist/editors/edit-cores.js +14 -14
  68. package/views/dist/editors/number-body.d.ts +1 -1
  69. package/views/dist/editors/number-step.d.ts +0 -34
  70. package/views/dist/editors/number-step.js +0 -37
  71. package/views/dist/editors/option-add-flow.d.ts +1 -13
  72. package/views/dist/editors/option-add-flow.js +0 -22
  73. package/views/dist/editors/relation-links-body.d.ts +2 -3
  74. package/views/dist/editors/relation-picker.d.ts +13 -3
  75. package/views/dist/editors/relation-source.d.ts +0 -22
  76. package/views/dist/editors/relation-source.js +0 -21
  77. package/views/dist/field-row/FieldRow.js +5 -6
  78. package/views/dist/field-row/FieldRowLane.js +0 -1
  79. package/views/dist/field-row/editors/RowChipsEditor.js +2 -2
  80. package/views/dist/field-row/editors/RowDateEditor.d.ts +2 -2
  81. package/views/dist/field-row/editors/RowDateEditor.js +2 -2
  82. package/views/dist/field-row/editors/RowNameEditor.d.ts +2 -5
  83. package/views/dist/field-row/editors/RowNameEditor.js +7 -12
  84. package/views/dist/field-row/editors/RowNumberEditor.d.ts +1 -1
  85. package/views/dist/field-row/editors/RowNumberEditor.js +4 -4
  86. package/views/dist/field-row/editors/RowPlaceEditor.js +3 -3
  87. package/views/dist/field-row/editors/RowRangeEditor.d.ts +2 -5
  88. package/views/dist/field-row/editors/RowRangeEditor.js +7 -14
  89. package/views/dist/field-row/editors/RowRelationEditor.js +3 -3
  90. package/views/dist/field-row/editors/RowSelectEditor.js +2 -2
  91. package/views/dist/field-row/editors/RowTextEditor.d.ts +1 -1
  92. package/views/dist/field-row/editors/RowTextEditor.js +3 -4
  93. package/views/dist/field-row/editors/RowValueListEditor.js +5 -5
  94. package/views/dist/field-row/field-row-button.d.ts +6 -9
  95. package/views/dist/field-row/field-row-button.js +1 -6
  96. package/views/dist/field-row/field-row-checkbox.d.ts +1 -1
  97. package/views/dist/field-row/row-target.d.ts +0 -7
  98. package/views/dist/field-row/row-target.js +0 -2
  99. package/views/dist/grid/chrome/GridAddColumn.d.ts +2 -1
  100. package/views/dist/grid/chrome/GridAddColumn.js +8 -66
  101. package/views/dist/grid/chrome/GridAggregateMenu.d.ts +5 -7
  102. package/views/dist/grid/chrome/GridAggregateMenu.js +20 -39
  103. package/views/dist/grid/chrome/GridCellEditors.d.ts +2 -2
  104. package/views/dist/grid/chrome/GridCellEditors.js +12 -12
  105. package/views/dist/grid/chrome/GridChipsEditor.js +3 -3
  106. package/views/dist/grid/chrome/GridColumnMenu.d.ts +11 -12
  107. package/views/dist/grid/chrome/GridColumnMenu.js +32 -93
  108. package/views/dist/grid/chrome/GridDateEditor.d.ts +6 -6
  109. package/views/dist/grid/chrome/GridDateEditor.js +3 -3
  110. package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -6
  111. package/views/dist/grid/chrome/GridGroupMenu.js +21 -62
  112. package/views/dist/grid/chrome/GridHeader.d.ts +1 -2
  113. package/views/dist/grid/chrome/GridHeader.js +2 -2
  114. package/views/dist/grid/chrome/GridLongTextEditor.d.ts +17 -38
  115. package/views/dist/grid/chrome/GridLongTextEditor.js +6 -7
  116. package/views/dist/grid/chrome/GridNameEditor.js +4 -4
  117. package/views/dist/grid/chrome/GridNumberEditor.d.ts +4 -5
  118. package/views/dist/grid/chrome/GridNumberEditor.js +3 -4
  119. package/views/dist/grid/chrome/GridPlaceEditor.d.ts +2 -5
  120. package/views/dist/grid/chrome/GridPlaceEditor.js +5 -5
  121. package/views/dist/grid/chrome/GridRangeEditor.d.ts +6 -12
  122. package/views/dist/grid/chrome/GridRangeEditor.js +7 -15
  123. package/views/dist/grid/chrome/GridRelationEditor.js +5 -5
  124. package/views/dist/grid/chrome/GridRow.js +0 -3
  125. package/views/dist/grid/chrome/GridRowActions.d.ts +1 -1
  126. package/views/dist/grid/chrome/GridRowActions.js +0 -5
  127. package/views/dist/grid/chrome/GridRowCells.js +9 -6
  128. package/views/dist/grid/chrome/GridSelectEditor.js +3 -3
  129. package/views/dist/grid/chrome/GridStructure.js +0 -1
  130. package/views/dist/grid/chrome/GridTable.js +1 -1
  131. package/views/dist/grid/chrome/GridTextEditor.d.ts +5 -7
  132. package/views/dist/grid/chrome/GridTextEditor.js +4 -17
  133. package/views/dist/grid/chrome/GridValueListEditor.js +4 -4
  134. package/views/dist/grid/chrome/grid-body-place.d.ts +2 -3
  135. package/views/dist/grid/chrome/grid-body-place.js +4 -8
  136. package/views/dist/grid/chrome/grid-button.d.ts +7 -10
  137. package/views/dist/grid/chrome/grid-button.js +1 -6
  138. package/views/dist/grid/chrome/grid-cell-classes.js +1 -1
  139. package/views/dist/grid/chrome/grid-column-menu-items.d.ts +4 -4
  140. package/views/dist/grid/chrome/grid-column-menu-items.js +10 -6
  141. package/views/dist/grid/chrome/grid-group-menu-parts.d.ts +5 -9
  142. package/views/dist/grid/chrome/grid-group-menu-parts.js +1 -3
  143. package/views/dist/grid/chrome/grid-hover.js +0 -1
  144. package/views/dist/grid/chrome/grid-menu-focus.d.ts +7 -31
  145. package/views/dist/grid/chrome/grid-menu-focus.js +7 -47
  146. package/views/dist/grid/chrome/grid-styles.d.ts +0 -3
  147. package/views/dist/grid/chrome/grid-styles.js +0 -1
  148. package/views/dist/grid/chrome/grid-table-props.d.ts +6 -10
  149. package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -4
  150. package/views/dist/grid/core/editing-controller.d.ts +2 -1
  151. package/views/dist/grid/core/editing-controller.js +10 -2
  152. package/views/dist/grid/core/refusal-sentence.d.ts +3 -0
  153. package/views/dist/grid/core/refusal-sentence.js +2 -2
  154. package/views/dist/grid/core/write-states.d.ts +3 -1
  155. package/views/dist/grid/core/write-states.js +6 -2
  156. package/views/dist/grid/grid.css +1 -1
  157. package/views/dist/model/body-frame.d.ts +0 -32
  158. package/views/dist/model/body-frame.js +1 -15
  159. package/views/dist/model/column-inspect.d.ts +5 -5
  160. package/views/dist/model/column-inspect.js +2 -2
  161. package/views/dist/panels/customize-body.d.ts +1 -10
  162. package/views/dist/panels/customize-body.js +0 -3
  163. package/views/dist/panels/filter/MenuSelect.js +0 -5
  164. package/views/dist/panels/filter/RangeFilterBody.js +0 -1
  165. package/views/dist/panels/filter/details.d.ts +1 -5
  166. package/views/dist/panels/filter/details.js +0 -13
  167. package/views/dist/panels/filter/filter-list.d.ts +0 -1
  168. package/views/dist/panels/filter/filter-list.js +1 -1
  169. package/views/dist/panels/panel-button.d.ts +10 -12
  170. package/views/dist/panels/panel-button.js +1 -6
  171. package/views/dist/panels/react/chrome.d.ts +0 -17
  172. package/views/dist/panels/react/chrome.js +0 -8
  173. package/views/dist/panels/react/customize-body.d.ts +9 -12
  174. package/views/dist/panels/react/customize-body.js +57 -11
  175. package/views/dist/panels/react/customize.d.ts +9 -12
  176. package/views/dist/panels/react/customize.js +3 -112
  177. package/views/dist/panels/react/filter/FilterEditor.d.ts +4 -18
  178. package/views/dist/panels/react/filter/FilterEditor.js +6 -330
  179. package/views/dist/panels/react/filter/FilterFieldList.d.ts +1 -1
  180. package/views/dist/panels/react/filter/FilterFieldList.js +27 -59
  181. package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +1 -11
  182. package/views/dist/panels/react/filter/PhoneFilterEditor.js +8 -144
  183. package/views/dist/panels/react/filter/editor-ctx.d.ts +1 -33
  184. package/views/dist/panels/react/filter/editor-ctx.js +5 -33
  185. package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -6
  186. package/views/dist/panels/react/filter/filter-part-body.js +0 -5
  187. package/views/dist/panels/react/filter/rule-writes.d.ts +1 -26
  188. package/views/dist/panels/react/filter/rule-writes.js +4 -95
  189. package/views/dist/panels/react/order-details.d.ts +1 -26
  190. package/views/dist/panels/react/order-details.js +3 -69
  191. package/views/dist/panels/react/panel-header.js +0 -1
  192. package/views/dist/panels/react/popover.d.ts +4 -7
  193. package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +2 -4
  194. package/views/dist/panels/react/quick/QuickFiltersPanel.js +16 -137
  195. package/views/dist/panels/react/sort/SortEditor.d.ts +4 -4
  196. package/views/dist/panels/react/sort/SortEditor.js +8 -245
  197. package/views/dist/panels/react/sort/SortFieldList.d.ts +1 -1
  198. package/views/dist/panels/react/sort/SortFieldList.js +11 -25
  199. package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +2 -2
  200. package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -16
  201. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
  202. package/views/dist/panels/react/toolbar/ToolbarSave.js +0 -4
  203. package/views/dist/panels/react/toolbar/ToolbarSearch.js +0 -1
  204. package/views/dist/panels/react/toolbar/ToolbarSortPill.js +3 -3
  205. package/views/dist/panels/react/view-actions.js +0 -1
  206. package/views/dist/panels/react/views-row/FoldingViewRow.js +2 -5
  207. package/views/dist/panels/react/views-row/ViewCreatePill.js +0 -1
  208. package/views/dist/panels/react/views-row/ViewPicker.js +7 -43
  209. package/views/dist/panels/react/views-row/ViewPickerRow.js +0 -2
  210. package/views/dist/panels/react/views-row/menu-classes.d.ts +0 -4
  211. package/views/dist/panels/react/views-row/menu-classes.js +0 -2
  212. package/views/dist/panels/react.d.ts +5 -12
  213. package/views/dist/panels/react.js +5 -12
  214. package/views/dist/provider/ViewsProvider.d.ts +2 -46
  215. package/views/dist/provider/ViewsProvider.js +2 -22
  216. package/views/dist/provider/components.d.ts +153 -106
  217. package/views/dist/provider/context.d.ts +1 -21
  218. package/views/dist/provider/missing-slot.d.ts +3 -7
  219. package/views/dist/provider/missing-slot.js +2 -9
  220. package/views/dist/react.d.ts +1 -2
  221. package/views/dist/selection/SelectionBar.js +2 -3
  222. package/views/dist/styles.css +40 -168
  223. package/views/dist/styles.unlayered.css +40 -168
  224. package/views/docs/contract.md +99 -123
  225. package/views/docs/getting-started.md +222 -2
  226. package/views/docs/guides/cells.md +222 -2
  227. package/views/docs/guides/display.md +1 -1
  228. package/views/docs/guides/editors.md +235 -20
  229. package/views/docs/guides/ports.md +1 -1
  230. package/views/docs/guides/selection.md +1 -1
  231. package/views/docs/guides/the-grid.md +14 -16
  232. package/views/docs/guides/the-provider.md +9 -15
  233. package/views/docs/reference/cells.md +1 -1
  234. package/views/docs/reference/controls.md +26 -13
  235. package/views/docs/reference/editors-chips.md +2 -2
  236. package/views/docs/reference/editors-date.md +4 -4
  237. package/views/docs/reference/editors-location.md +4 -7
  238. package/views/docs/reference/editors-name.md +3 -5
  239. package/views/docs/reference/editors-number.md +10 -10
  240. package/views/docs/reference/editors-panel.md +3 -3
  241. package/views/docs/reference/editors-range.md +3 -5
  242. package/views/docs/reference/editors-relation.md +4 -4
  243. package/views/docs/reference/editors-select.md +3 -3
  244. package/views/docs/reference/editors-text.md +3 -4
  245. package/views/docs/reference/editors-value-list.md +3 -3
  246. package/views/docs/reference/field-row.md +1 -1
  247. package/views/docs/reference/grid.md +2 -2
  248. package/views/docs/reference/panels-react.md +20 -34
  249. package/views/docs/reference/react.md +11 -18
  250. package/views/docs/reference/views.md +5 -5
  251. package/views/skills/views/SKILL.md +1 -1
  252. package/views/dist/editors/relation-panel.d.ts +0 -69
  253. package/views/dist/editors/relation-panel.js +0 -46
  254. package/views/dist/grid/chrome/GridColumnColorSection.d.ts +0 -13
  255. package/views/dist/grid/chrome/GridColumnColorSection.js +0 -40
  256. package/views/dist/grid/chrome/GridColumnDateSection.d.ts +0 -28
  257. package/views/dist/grid/chrome/GridColumnDateSection.js +0 -23
  258. package/views/dist/grid/chrome/GridColumnDurationSection.d.ts +0 -23
  259. package/views/dist/grid/chrome/GridColumnDurationSection.js +0 -24
  260. package/views/dist/grid/chrome/GridColumnNumberSection.d.ts +0 -29
  261. package/views/dist/grid/chrome/GridColumnNumberSection.js +0 -27
  262. package/views/dist/grid/chrome/GridColumnPercentSection.d.ts +0 -16
  263. package/views/dist/grid/chrome/GridColumnPercentSection.js +0 -16
  264. package/views/dist/grid/chrome/GridColumnSortSection.d.ts +0 -38
  265. package/views/dist/grid/chrome/GridColumnSortSection.js +0 -33
  266. package/views/dist/grid/chrome/GridFlyout.d.ts +0 -44
  267. package/views/dist/grid/chrome/GridFlyout.js +0 -80
  268. package/views/dist/grid/chrome/GridMenuRow.d.ts +0 -15
  269. package/views/dist/grid/chrome/GridMenuRow.js +0 -15
  270. package/views/dist/grid/chrome/grid-menu-search.d.ts +0 -7
  271. package/views/dist/grid/chrome/grid-menu-search.js +0 -7
  272. package/views/dist/panels/react/GroupBucketsList.d.ts +0 -16
  273. package/views/dist/panels/react/GroupBucketsList.js +0 -44
  274. package/views/dist/panels/react/LayoutColumnsList.d.ts +0 -24
  275. package/views/dist/panels/react/LayoutColumnsList.js +0 -101
  276. package/views/dist/panels/react/PopoverColumnDetail.d.ts +0 -11
  277. package/views/dist/panels/react/PopoverColumnDetail.js +0 -24
  278. package/views/dist/panels/react/drag.d.ts +0 -2
  279. package/views/dist/panels/react/drag.js +0 -5
  280. package/views/dist/panels/react/layout-detail.d.ts +0 -4
  281. package/views/dist/panels/react/layout-detail.js +0 -29
  282. package/views/dist/panels/react/root-list.d.ts +0 -6
  283. package/views/dist/panels/react/root-list.js +0 -31
  284. package/views/dist/panels/react/sort/use-sort-drag.d.ts +0 -17
  285. package/views/dist/panels/react/sort/use-sort-drag.js +0 -39
  286. package/views/dist/panels/react/view-footer.d.ts +0 -20
  287. package/views/dist/panels/react/view-footer.js +0 -41
@@ -1,46 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useViews } from "../provider/context.js";
4
- import { EndOfListSentinel, useRemotePage, } from "./relation-source.js";
5
- export function RelationPanel({ candidates, query, onQueryChange, searchRef, onSearchKeyDown, before, drawsBefore = false, labels, hide, isChosen, onSelect, kindGlyph, message, creates, onCreate, startOn, }) {
6
- const remote = candidates.kind === "remote";
7
- const page = useRemotePage(candidates, query);
8
- const rows = candidates.kind === "static" ? candidates.items : page.items;
9
- const views = useViews();
10
- const words = message ?? views.conventions.messages;
11
- const { Command } = views.components;
12
- const { List, Row, RowContent } = views.atoms;
13
- const Add = views.icons.add;
14
- const glyphs = kindGlyph != null || rows.some((candidate) => candidate.icon != null);
15
- const glyph = (node) => node != null ? (_jsx("span", { className: "flex size-3.5 items-center justify-center [&>svg]:size-3.5", children: node })) : undefined;
16
- const shown = hide ? rows.filter((candidate) => !hide(candidate.id)) : rows;
17
- const status = !remote
18
- ? null
19
- : page.failed && rows.length === 0
20
- ? words({ key: "editor.search-failed" })
21
- : page.searching
22
- ? words({ key: "editor.searching" })
23
- : rows.length === 0 && !page.loadingMore && !drawsBefore
24
- ? words({ key: "editor.nothing-matches" })
25
- : null;
26
- const moreStatus = !remote
27
- ? null
28
- : page.loadingMore
29
- ? words({ key: "editor.loading-more" })
30
- : page.failed && rows.length > 0
31
- ? words({ key: "editor.search-failed" })
32
- : null;
33
- const paging = remote && !page.exhausted && rows.length > 0;
34
- return (_jsxs(Command.Root, { shouldFilter: !remote, defaultValue: startOn, filter: remote
35
- ? undefined
36
- : (value, search) => {
37
- const label = rows.find((candidate) => candidate.id === value)?.label ?? labels?.get(value) ?? "";
38
- return label.toLowerCase().includes(search.toLowerCase()) ? 1 : 0;
39
- }, children: [_jsx(Command.Input, { ref: searchRef, placeholder: words({ key: "editor.search" }), className: "h-9 text-(length:--vk-input-text,13px)", value: query, onValueChange: onQueryChange, onKeyDown: (event) => {
40
- if (remote && page.searching && event.key === "Enter") {
41
- event.preventDefault();
42
- return;
43
- }
44
- onSearchKeyDown?.(event);
45
- } }), _jsxs(Command.List, { className: "max-h-72 overscroll-contain scrollbar-overlay", children: [remote ? (status && (_jsx("div", { role: "status", className: "py-4 text-center text-xs text-(color:--vk-fg-subtle)", children: status }))) : (_jsx(Command.Empty, { className: "py-4 text-center text-xs text-(color:--vk-fg-subtle)", children: words({ key: "editor.nothing-matches" }) })), _jsx(Command.Group, { className: "p-0", children: _jsxs(List, { children: [before?.({ glyphs, glyph }), shown.map((candidate) => (_jsx(Command.Item, { value: candidate.id, onSelect: () => onSelect(candidate), chosen: isChosen(candidate.id), children: _jsx(RowContent, { size: "compact", leading: glyph(candidate.icon ?? kindGlyph), leadingLane: glyphs, label: candidate.label, description: candidate.sublabel, trailing: candidate.badge ? (_jsx("span", { className: "ml-2 shrink-0 rounded-sm border border-(color:--vk-border) px-1.5 py-0.5 text-(length:--vk-caption-text,10px) font-medium uppercase tracking-wide text-(color:--vk-fg-subtle)", children: candidate.badge })) : undefined, chosen: isChosen(candidate.id), chosenTint: false }) }, candidate.id)))] }) }), paging && _jsx(EndOfListSentinel, { onReveal: page.loadMore }), moreStatus && (_jsx("div", { role: "status", className: "py-3 text-center text-xs text-(color:--vk-fg-subtle)", children: moreStatus }))] }), creates && creates.length > 0 && (_jsx("div", { className: "border-t border-(color:--vk-border)", children: creates.map((create, index) => (_jsx(Row, { size: "compact", tone: "muted", leading: _jsx(Add, { className: "h-3.5 w-3.5 shrink-0" }), label: create.label(query.trim()), onClick: () => onCreate(create, query.trim()) }, index))) }))] }));
46
- }
@@ -1,13 +0,0 @@
1
- import type { ListColumn, ListSelectColor } from "../../model/column-schema.js";
2
- import { type GridFlyouts } from "./GridFlyout.js";
3
- export declare const COLOR_DOTS: Record<ListSelectColor, string>;
4
- export declare const ALL_COLORS: ListSelectColor[];
5
- export declare function GridColumnColorSection<Row>({ column, values, optionColors, flyouts, onOptionColorChange, onClose, }: {
6
- column: ListColumn<Row>;
7
- values: string[];
8
- optionColors?: Record<string, ListSelectColor>;
9
- flyouts: GridFlyouts;
10
- /** Called with the FIELD key — the format map's key on every surface. */
11
- onOptionColorChange: (key: string, value: string, color: ListSelectColor | null) => void;
12
- onClose: () => void;
13
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,40 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { CATEGORY_DOT_CLASSES, resolveCategoryColor, } from "viewkitjs/fields/design/category-colors";
4
- import { prettifyOptionValue } from "../../model/column-state.js";
5
- import { fieldKeyOf } from "../../model/view-rules.js";
6
- import { useViews } from "../../provider/context.js";
7
- import { cx } from "../../internal/cx.js";
8
- import { GridFlyoutRow } from "./GridFlyout.js";
9
- import { GridMenuSeparator } from "./GridMenuRow.js";
10
- export const COLOR_DOTS = CATEGORY_DOT_CLASSES;
11
- export const ALL_COLORS = [
12
- "gray",
13
- "blue",
14
- "green",
15
- "amber",
16
- "red",
17
- "purple",
18
- "pink",
19
- "teal",
20
- ];
21
- export function GridColumnColorSection({ column, values, optionColors, flyouts, onOptionColorChange, onClose, }) {
22
- const { atoms, messages } = useViews();
23
- const { Row, Tag } = atoms;
24
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: "max-h-72 overflow-y-auto overscroll-contain", children: values.map((value) => {
25
- const resolved = resolveCategoryColor(value, column.options, optionColors);
26
- return (_jsxs(GridFlyoutRow, { id: `color:${value}`, flyouts: flyouts, title: prettifyOptionValue(value), label: _jsx(Tag, { label: column.options?.find((option) => option.value === value)?.label ??
27
- prettifyOptionValue(value), color: resolved }), children: [_jsx(Row, { chosen: !optionColors?.[value], label: messages({ key: "views.menus.automatic" }), leading: _jsx("span", { className: "h-2.5 w-2.5 rounded-full border border-(color:--vk-border)" }), onClick: () => {
28
- onOptionColorChange(fieldKeyOf(column), value, null);
29
- flyouts.close();
30
- } }), ALL_COLORS.map((color) => (_jsx(Row, { chosen: resolved === color, label: messages({ key: "views.menus.colour", values: { colour: color } }), leading: _jsx("span", { className: cx("h-2.5 w-2.5 rounded-full", COLOR_DOTS[color]) }), onClick: () => {
31
- onOptionColorChange(fieldKeyOf(column), value, color);
32
- flyouts.close();
33
- } }, color)))] }, value));
34
- }) }), optionColors && Object.keys(optionColors).length > 0 && (_jsxs(_Fragment, { children: [_jsx(GridMenuSeparator, {}), _jsx(Row, { label: messages({ key: "views.menus.colours-reset" }), onClick: () => {
35
- for (const value of Object.keys(optionColors)) {
36
- onOptionColorChange(fieldKeyOf(column), value, null);
37
- }
38
- onClose();
39
- } })] }))] }));
40
- }
@@ -1,28 +0,0 @@
1
- import type { ListColumn } from "../../model/column-schema.js";
2
- import type { ListDateStyle } from "../../model/column-format.js";
3
- import { type GridFlyouts } from "./GridFlyout.js";
4
- export declare const DATE_STYLES: ListDateStyle[];
5
- /** The live sample beside each style: a few days before the provider's moment, so Relative reads as a real "3d ago"
6
- * rather than the "now" it would say of the moment it opened. None before the provider has a moment: the clock is
7
- * never read while drawing. */
8
- export declare const sampleDate: (now: Date | undefined) => Date | null;
9
- /**
10
- * The date-column row in the header menu — one Format row whose flyout holds
11
- * the styles (each beside a live sample) and, on a date-time, Show time —
12
- * split out of GridColumnMenu because that file is held under the component
13
- * ratchet's line ceiling rather than grown to hold them; the policy there is
14
- * split, not raise (the same reason GridColumnColorSection and
15
- * GridColumnDurationSection are their own files rather than inline).
16
- */
17
- export declare function GridColumnDateSection<Row>({ column, dateStyle, onDateStyleChange, showTime, onShowTimeChange, flyouts, onClose, }: {
18
- column: ListColumn<Row>;
19
- /** This column's date-style override. */
20
- dateStyle?: ListDateStyle;
21
- /** Both handlers are called with the FIELD key — the format map's key. */
22
- onDateStyleChange: (key: string, style: ListDateStyle) => void;
23
- /** Resolved show-time (override → declared `format.withTime`). */
24
- showTime?: boolean;
25
- onShowTimeChange?: (key: string, show: boolean) => void;
26
- flyouts: GridFlyouts;
27
- onClose: () => void;
28
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,23 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { temporalKindOf } from "../../model/field-type-of.js";
4
- import { fieldKeyOf } from "../../model/view-rules.js";
5
- import { formatDate } from "./cells.js";
6
- import { useCellFormat } from "../../cells/use-cell-format.js";
7
- import { useViews } from "../../provider/context.js";
8
- import { GridFlyoutRow } from "./GridFlyout.js";
9
- import { GridMenuSeparator, KnobGlyph } from "./GridMenuRow.js";
10
- export const DATE_STYLES = ["short", "long", "numeric", "relative"];
11
- export const sampleDate = (now) => now ? new Date(now.getTime() - 3 * 86_400_000) : null;
12
- export function GridColumnDateSection({ column, dateStyle, onDateStyleChange, showTime, onShowTimeChange, flyouts, onClose, }) {
13
- const activeDateStyle = dateStyle ?? column.format?.dateStyle ?? "short";
14
- const { viewer, presentation } = useCellFormat();
15
- const sample = sampleDate(viewer.now);
16
- const { atoms, messages } = useViews();
17
- const { Row } = atoms;
18
- const styleLabel = (style) => messages({ key: "views.menus.date-style", values: { style } });
19
- return (_jsxs(GridFlyoutRow, { id: "date-format", flyouts: flyouts, label: messages({ key: "views.menus.format" }), detail: styleLabel(activeDateStyle), leading: _jsx(KnobGlyph, { name: "calendar" }), children: [DATE_STYLES.map((style) => (_jsx(Row, { chosen: activeDateStyle === style, label: styleLabel(style), detail: _jsx("span", { className: "max-w-30 truncate", children: sample && formatDate(sample, column, style, false, viewer, presentation) }), onClick: () => {
20
- onDateStyleChange(fieldKeyOf(column), style);
21
- onClose();
22
- } }, style))), onShowTimeChange && temporalKindOf(column) === "datetime" && (_jsxs(_Fragment, { children: [_jsx(GridMenuSeparator, {}), _jsx(Row, { chosen: !!showTime, label: messages({ key: "views.menus.show-time" }), onClick: () => onShowTimeChange(fieldKeyOf(column), !showTime) })] }))] }));
23
- }
@@ -1,23 +0,0 @@
1
- import type { ListColumn } from "../../model/column-schema.js";
2
- import type { ListDurationStyle } from "../../model/column-format.js";
3
- import { type GridFlyouts } from "./GridFlyout.js";
4
- export declare const DURATION_STYLES: ListDurationStyle[];
5
- /** Live example beside each of the three duration renderings — long enough
6
- * (an hour and a half) that every style's shape is visible at a glance. */
7
- export declare const DURATION_SAMPLE_MS = 5904000;
8
- /**
9
- * The duration-column row in the header menu — one Format row whose flyout
10
- * holds the styles — split out of GridColumnMenu because that file is held
11
- * under the component ratchet's line ceiling rather than grown to hold them;
12
- * the policy there is split, not raise (the same reason GridColumnColorSection
13
- * is its own file rather than inline).
14
- */
15
- export declare function GridColumnDurationSection<Row>({ column, durationStyle, onDurationStyleChange, flyouts, onClose, }: {
16
- column: ListColumn<Row>;
17
- /** This column's duration-rendering override. */
18
- durationStyle?: ListDurationStyle;
19
- /** Called with the FIELD key — the format map's key on every surface. */
20
- onDurationStyleChange: (key: string, style: ListDurationStyle) => void;
21
- flyouts: GridFlyouts;
22
- onClose: () => void;
23
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,24 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { fieldKeyOf } from "../../model/view-rules.js";
4
- import { formatNumber } from "./cells.js";
5
- import { useUndatedCellFormat } from "../../cells/use-cell-format.js";
6
- import { useViews } from "../../provider/context.js";
7
- import { GridFlyoutRow } from "./GridFlyout.js";
8
- import { KnobGlyph } from "./GridMenuRow.js";
9
- export const DURATION_STYLES = ["adaptive", "clock", "units"];
10
- export const DURATION_SAMPLE_MS = 5_904_000;
11
- export function GridColumnDurationSection({ column, durationStyle, onDurationStyleChange, flyouts, onClose, }) {
12
- const activeDurationStyle = durationStyle ?? column.format?.durationStyle ?? "adaptive";
13
- const cellFormat = useUndatedCellFormat();
14
- const { atoms, messages } = useViews();
15
- const { Row } = atoms;
16
- const styleLabel = (style) => messages({ key: "views.menus.duration-style", values: { style } });
17
- return (_jsx(GridFlyoutRow, { id: "duration-format", flyouts: flyouts, label: messages({ key: "views.menus.format" }), detail: styleLabel(activeDurationStyle), leading: _jsx(KnobGlyph, { name: "duration" }), children: DURATION_STYLES.map((style) => (_jsx(Row, { chosen: activeDurationStyle === style, label: styleLabel(style), detail: _jsx("span", { className: "max-w-30 truncate", children: formatNumber(DURATION_SAMPLE_MS, column, {
18
- ...cellFormat,
19
- durationStyle: style,
20
- }) }), onClick: () => {
21
- onDurationStyleChange(fieldKeyOf(column), style);
22
- onClose();
23
- } }, style))) }));
24
- }
@@ -1,29 +0,0 @@
1
- import type { ListColumn } from "../../model/column-schema.js";
2
- import type { ListNumberFormatState } from "../../model/column-format.js";
3
- import { type GridFlyouts } from "./GridFlyout.js";
4
- /** Live example beside each of the shared `LIST_DECIMALS_CHOICES`. */
5
- export declare const DECIMALS_SAMPLE = 1234.567;
6
- /** What a plain number with no decimals draws: up to two, trailing zeros dropped (`formatNumberValue`). */
7
- export declare const AUTOMATIC_SAMPLE: string;
8
- /**
9
- * The number rows in the header menu — Decimals, and Currency on a column
10
- * whose binding states rates (Original · EUR · USD · RON), each one row whose
11
- * choices fly out. Lifted out of GridColumnMenu for the line ceiling; the
12
- * policy is split, not raise. Writes under the FIELD key.
13
- */
14
- export declare function GridColumnNumberSection<Row>({ column, fieldKey, decimals, currency, numberFormat, onNumberFormatChange, flyouts, onClose, }: {
15
- column: ListColumn<Row>;
16
- fieldKey: string;
17
- /** Offer the Decimals row. */
18
- decimals: boolean;
19
- /** Offer the Currency row (the column carries rates — `columnKnobs`). */
20
- currency: boolean;
21
- numberFormat?: ListNumberFormatState;
22
- /** `decimals: null` = the field's own (Automatic). */
23
- onNumberFormatChange: (key: string, patch: {
24
- decimals?: number | null;
25
- currency?: string;
26
- }) => void;
27
- flyouts: GridFlyouts;
28
- onClose: () => void;
29
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,27 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { LIST_DECIMALS_CHOICES } from "../../model/column-state.js";
4
- import { useViews } from "../../provider/context.js";
5
- import { GridFlyoutRow } from "./GridFlyout.js";
6
- import { KnobGlyph } from "./GridMenuRow.js";
7
- export const DECIMALS_SAMPLE = 1234.567;
8
- export const AUTOMATIC_SAMPLE = String(Number(DECIMALS_SAMPLE.toFixed(2)));
9
- export function GridColumnNumberSection({ column, fieldKey, decimals, currency, numberFormat, onNumberFormatChange, flyouts, onClose, }) {
10
- const chosen = numberFormat?.decimals ?? undefined;
11
- const declared = column.format?.decimals;
12
- const shown = chosen ?? declared;
13
- const currencyOptions = numberFormat?.currencyOptions ?? [];
14
- const { atoms, messages } = useViews();
15
- const { Row } = atoms;
16
- const automatic = messages({ key: "views.menus.automatic" });
17
- return (_jsxs(_Fragment, { children: [decimals && (_jsxs(GridFlyoutRow, { id: "decimals", flyouts: flyouts, label: messages({ key: "views.menus.decimals" }), detail: shown ?? automatic, leading: _jsx(KnobGlyph, { name: "number" }), children: [_jsx(Row, { chosen: chosen === undefined, label: automatic, detail: _jsx("span", { className: "tabular-nums", children: declared === undefined ? AUTOMATIC_SAMPLE : DECIMALS_SAMPLE.toFixed(declared) }), onClick: () => {
18
- onNumberFormatChange(fieldKey, { decimals: null });
19
- onClose();
20
- } }), LIST_DECIMALS_CHOICES.map((d) => (_jsx(Row, { chosen: chosen === d, label: d, detail: _jsx("span", { className: "tabular-nums", children: DECIMALS_SAMPLE.toFixed(d) }), onClick: () => {
21
- onNumberFormatChange(fieldKey, { decimals: d });
22
- onClose();
23
- } }, d)))] })), currency && currencyOptions.length > 0 && (_jsx(GridFlyoutRow, { id: "currency", flyouts: flyouts, label: messages({ key: "views.menus.currency" }), detail: currencyOptions.find((c) => c.value === numberFormat?.currency)?.label, leading: _jsx(KnobGlyph, { name: "currency" }), children: currencyOptions.map((c) => (_jsx(Row, { chosen: numberFormat?.currency === c.value, label: c.label, onClick: () => {
24
- onNumberFormatChange(fieldKey, { currency: c.value });
25
- onClose();
26
- } }, c.value))) }))] }));
27
- }
@@ -1,16 +0,0 @@
1
- import type { PercentDisplay } from "viewkitjs/fields";
2
- import type { ListColumn } from "../../model/column-schema.js";
3
- import { type GridFlyouts } from "./GridFlyout.js";
4
- export declare const DISPLAYS: PercentDisplay[];
5
- /** The percent row in the header menu — how the figure is drawn, one row
6
- * whose choices fly out. Split out of GridColumnMenu for the line ceiling;
7
- * the policy is split, not raise. */
8
- export declare function GridColumnPercentSection<Row>({ column, percentDisplay, onPercentDisplayChange, fieldKey, flyouts, onClose, }: {
9
- column: ListColumn<Row>;
10
- /** The workspace's choice for this field, when one is stored. */
11
- percentDisplay?: PercentDisplay;
12
- onPercentDisplayChange: (fieldKey: string, display: PercentDisplay) => void;
13
- fieldKey: string;
14
- flyouts: GridFlyouts;
15
- onClose: () => void;
16
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,16 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useViews } from "../../provider/context.js";
4
- import { GridFlyoutRow } from "./GridFlyout.js";
5
- import { KnobGlyph } from "./GridMenuRow.js";
6
- export const DISPLAYS = ["text", "bar", "ring"];
7
- export function GridColumnPercentSection({ column, percentDisplay, onPercentDisplayChange, fieldKey, flyouts, onClose, }) {
8
- const active = percentDisplay ?? column.format?.percentDisplay ?? "text";
9
- const { atoms, messages } = useViews();
10
- const { Row } = atoms;
11
- const displayLabel = (display) => messages({ key: "views.menus.percent-display-option", values: { display } });
12
- return (_jsx(GridFlyoutRow, { id: "percent-display", flyouts: flyouts, label: messages({ key: "views.menus.percent-display" }), detail: displayLabel(active), leading: _jsx(KnobGlyph, { name: "progress" }), children: DISPLAYS.map((display) => (_jsx(Row, { chosen: active === display, label: displayLabel(display), onClick: () => {
13
- onPercentDisplayChange(fieldKey, display);
14
- onClose();
15
- } }, display))) }));
16
- }
@@ -1,38 +0,0 @@
1
- import type { SortDirection } from "viewkitjs/fields/query";
2
- import { type GridFlyouts } from "./GridFlyout.js";
3
- /**
4
- * A place column's sort rows in the header menu: ascending and descending each fly out its parts, the part
5
- * in force the row's detail, and Clear sort while this column sorts by any of them. A pick writes the part key
6
- * (`partKey(fieldKey, part)`), which a host reads with `parsePartKey`.
7
- */
8
- export declare function GridColumnSortPartsSection({ fieldKey, parts, value, dir, onChange, flyouts, onClose, }: {
9
- /** The place's field key: the part key's whole. */
10
- fieldKey: string;
11
- /** The parts this column sorts by (`columnSortParts`). */
12
- parts: readonly string[];
13
- value: string;
14
- dir: SortDirection;
15
- onChange: (next: {
16
- value: string;
17
- dir: SortDirection;
18
- }) => void;
19
- flyouts: GridFlyouts;
20
- onClose: () => void;
21
- }): import("react/jsx-runtime").JSX.Element;
22
- /**
23
- * The sort rows in the header menu — ascending, descending, and Clear sort
24
- * while this column IS the sort. Split out of GridColumnMenu for the line
25
- * ceiling; the policy is split, not raise.
26
- */
27
- export declare function GridColumnSortSection({ sortKey, value, dir, onChange, onClose, }: {
28
- /** The key this column sorts by (`effectiveSortKey`). */
29
- sortKey: string;
30
- /** The list's current sort key and direction. */
31
- value: string;
32
- dir: SortDirection;
33
- onChange: (next: {
34
- value: string;
35
- dir: SortDirection;
36
- }) => void;
37
- onClose: () => void;
38
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,33 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { sortPartOf } from "../../model/column-sort.js";
4
- import { partKey, partWord } from "../../model/part-rows.js";
5
- import { useViews } from "../../provider/context.js";
6
- import { GridFlyoutRow } from "./GridFlyout.js";
7
- import { GridMenuRow, KnobGlyph } from "./GridMenuRow.js";
8
- export function GridColumnSortPartsSection({ fieldKey, parts, value, dir, onChange, flyouts, onClose, }) {
9
- const { atoms, messages } = useViews();
10
- const { Row } = atoms;
11
- const active = sortPartOf(value, fieldKey, parts);
12
- const word = (part) => partWord("location", part, messages) ?? part;
13
- const direction = (next) => (_jsx(GridFlyoutRow, { id: `sort-${next}`, flyouts: flyouts, label: messages({ key: next === "asc" ? "views.menus.sort-asc" : "views.menus.sort-desc" }), detail: active !== undefined && dir === next ? word(active) : undefined, leading: _jsx(KnobGlyph, { name: next === "asc" ? "sortRowsUp" : "sortRowsDown" }), children: parts.map((part) => (_jsx(Row, { chosen: active === part && dir === next, label: word(part), onClick: () => {
14
- onChange({ value: partKey(fieldKey, part), dir: next });
15
- onClose();
16
- } }, part))) }));
17
- return (_jsxs(_Fragment, { children: [direction("asc"), direction("desc"), active !== undefined && (_jsx(GridMenuRow, { label: messages({ key: "views.menus.sort-clear" }), icon: "clearSort", onClick: () => {
18
- onChange({ value: "", dir: "asc" });
19
- onClose();
20
- } }))] }));
21
- }
22
- export function GridColumnSortSection({ sortKey, value, dir, onChange, onClose, }) {
23
- const { messages } = useViews();
24
- const active = value === sortKey;
25
- const pick = (next) => {
26
- onChange({ value: sortKey, dir: next });
27
- onClose();
28
- };
29
- return (_jsxs(_Fragment, { children: [_jsx(GridMenuRow, { label: messages({ key: "views.menus.sort-asc" }), icon: "sortRowsUp", active: active && dir === "asc", onClick: () => pick("asc") }), _jsx(GridMenuRow, { label: messages({ key: "views.menus.sort-desc" }), icon: "sortRowsDown", active: active && dir === "desc", onClick: () => pick("desc") }), active && (_jsx(GridMenuRow, { label: messages({ key: "views.menus.sort-clear" }), icon: "clearSort", onClick: () => {
30
- onChange({ value: "", dir: "asc" });
31
- onClose();
32
- } }))] }));
33
- }
@@ -1,44 +0,0 @@
1
- import { type PointerEvent as ReactPointerEvent, type ReactElement, type ReactNode } from "react";
2
- /** How long the pointer rests on a row before its flyout opens: a sweep down the list opens none. */
3
- export declare const GRID_FLYOUT_HOVER_MS = 150;
4
- export type GridFlyouts = {
5
- /** The flyout showing now, by row id. */
6
- openId: string | null;
7
- /** Opens `id` after the hover delay; `null` closes whatever is open. */
8
- hoverTo: (id: string | null) => void;
9
- /** Drops a pending hover; an open flyout stays (the pointer is usually on its way in). */
10
- cancelHover: () => void;
11
- toggle: (id: string) => void;
12
- /** Opens `id` at once, dropping a pending hover; never closes it. */
13
- open: (id: string) => void;
14
- close: () => void;
15
- /** For the list that holds the rows: resting on a plain row closes the open flyout. */
16
- onListPointerOver: (event: ReactPointerEvent<HTMLElement>) => void;
17
- /** A flyout row hands its pointer events here, its popup's too through the React tree, so the list leaves them be. */
18
- claim: (event: ReactPointerEvent<HTMLElement>) => void;
19
- };
20
- /**
21
- * THE FLYOUTS' STATE — one open at a time across every `GridFlyoutRow` in a menu. The menu
22
- * that holds the rows owns it and calls `close()` when it closes itself.
23
- */
24
- export declare function useGridFlyouts(): GridFlyouts;
25
- /** Whether a press landed inside a grid flyout, read from its slot: the menu that opened it stays open. */
26
- export declare function insideGridFlyout(event: Event): boolean;
27
- /**
28
- * A menu row that opens its choices BESIDE the menu: the map's Popover anchored on the row.
29
- * A resting pointer opens it after a short delay; a mouse click opens it at once and never
30
- * closes it (the hover usually got there first); a tap toggles it, the only way in on a phone.
31
- * The row and its popup sit inside one element, so the popup's pointer events reach `claim`
32
- * through the React tree, and the menu's list leaves the flyout open while the pointer is in it.
33
- */
34
- export declare function GridFlyoutRow({ id, flyouts, label, detail, leading, title, children, }: {
35
- id: string;
36
- flyouts: GridFlyouts;
37
- label: ReactNode;
38
- /** The current choice, the row's right-hand detail. */
39
- detail?: ReactNode;
40
- leading?: ReactNode;
41
- title?: string;
42
- /** The flyout's rows. */
43
- children: ReactNode;
44
- }): ReactElement;
@@ -1,80 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect, useRef, useState, } from "react";
4
- import { useViews } from "../../provider/context.js";
5
- export const GRID_FLYOUT_HOVER_MS = 150;
6
- export function useGridFlyouts() {
7
- const [openId, setOpenId] = useState(null);
8
- const timerRef = useRef(null);
9
- const claimed = useRef(new WeakSet());
10
- const cancelHover = () => {
11
- if (timerRef.current != null) {
12
- window.clearTimeout(timerRef.current);
13
- timerRef.current = null;
14
- }
15
- };
16
- useEffect(() => cancelHover, []);
17
- const hoverTo = (id) => {
18
- cancelHover();
19
- timerRef.current = window.setTimeout(() => {
20
- timerRef.current = null;
21
- setOpenId(id);
22
- }, GRID_FLYOUT_HOVER_MS);
23
- };
24
- return {
25
- openId,
26
- hoverTo,
27
- cancelHover,
28
- toggle: (id) => {
29
- cancelHover();
30
- setOpenId((current) => (current === id ? null : id));
31
- },
32
- open: (id) => {
33
- cancelHover();
34
- setOpenId(id);
35
- },
36
- close: () => {
37
- cancelHover();
38
- setOpenId(null);
39
- },
40
- onListPointerOver: (event) => {
41
- if (claimed.current.has(event.nativeEvent))
42
- return;
43
- if (openId != null)
44
- hoverTo(null);
45
- },
46
- claim: (event) => {
47
- claimed.current.add(event.nativeEvent);
48
- },
49
- };
50
- }
51
- export function insideGridFlyout(event) {
52
- const target = event.target;
53
- return target?.closest?.('[data-slot="vk-grid-flyout"]') != null;
54
- }
55
- export function GridFlyoutRow({ id, flyouts, label, detail, leading, title, children, }) {
56
- const { atoms, components, icons } = useViews();
57
- const { Row, List } = atoms;
58
- const { Popover } = components;
59
- const ChevronRight = icons.chevronRight;
60
- const anchor = useRef(null);
61
- const pressedWith = useRef(null);
62
- const open = flyouts.openId === id;
63
- return (_jsxs("div", { ref: anchor, onPointerOver: flyouts.claim, onPointerDown: (event) => {
64
- if (anchor.current?.contains(event.target))
65
- pressedWith.current = event.pointerType;
66
- }, onMouseEnter: () => flyouts.hoverTo(id), onMouseLeave: () => {
67
- pressedWith.current = null;
68
- flyouts.cancelHover();
69
- }, children: [_jsx(Row, { label: label, detail: detail, leading: leading, title: title, opens: true, open: open, trailing: _jsx(ChevronRight, { className: "size-3.5 shrink-0 text-(color:--vk-fg-subtlest)" }), onClick: () => {
70
- const pointer = pressedWith.current;
71
- pressedWith.current = null;
72
- if (pointer === "mouse")
73
- flyouts.open(id);
74
- else
75
- flyouts.toggle(id);
76
- } }), _jsx(Popover, { open: open, onOpenChange: (next) => {
77
- if (!next && flyouts.openId === id)
78
- flyouts.close();
79
- }, anchor: anchor, side: "right", align: "start", sideOffset: -2, alignOffset: -4, initialFocus: false, chrome: "menu", panelData: { "data-slot": "vk-grid-flyout" }, className: "min-w-32 max-w-80", onOutsidePress: (event) => anchor.current?.contains(event.target) ? false : undefined, children: _jsx(List, { children: children }) })] }));
80
- }
@@ -1,15 +0,0 @@
1
- import type { ReactElement } from "react";
2
- import type { ViewsIconName } from "../../contract.js";
3
- /** A knob row's leading glyph, by meaning, in the subtle ink every verb row's glyph wears at rest. */
4
- export declare function KnobGlyph({ name }: {
5
- name: ViewsIconName;
6
- }): ReactElement;
7
- /** One verb row in a grid menu: a glyph, a label, the chosen mark while active (its glyph then in the brand ink). */
8
- export declare function GridMenuRow({ label, icon, onClick, active, }: {
9
- label: string;
10
- icon: ViewsIconName;
11
- onClick: () => void;
12
- active?: boolean;
13
- }): ReactElement;
14
- /** The divider between a grid menu's blocks. */
15
- export declare function GridMenuSeparator(): ReactElement;
@@ -1,15 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useViews } from "../../provider/context.js";
4
- export function KnobGlyph({ name }) {
5
- const Glyph = useViews().icons[name];
6
- return _jsx(Glyph, { className: "size-4 text-(color:--vk-fg-subtle)" });
7
- }
8
- export function GridMenuRow({ label, icon, onClick, active = false, }) {
9
- const { atoms, icons } = useViews();
10
- const Glyph = icons[icon];
11
- return (_jsx(atoms.Row, { label: label, chosen: active, leading: _jsx(Glyph, { className: active ? "size-4 text-(color:--vk-fg-brand)" : "size-4 text-(color:--vk-fg-subtle)" }), onClick: onClick }));
12
- }
13
- export function GridMenuSeparator() {
14
- return _jsx("div", { role: "separator", className: "-mx-1 my-1.5 h-px bg-(color:--vk-border)" });
15
- }
@@ -1,7 +0,0 @@
1
- /** How many options a grid menu lists before it offers a search: a group band's Sort rows. */
2
- export declare const GRID_MENU_SEARCH_AFTER = 8;
3
- /** The options a grid menu lists for a search: every one while the search is empty, else those whose label
4
- * holds it. */
5
- export declare function matchMenuOptions<O extends {
6
- label: string;
7
- }>(options: readonly O[], query: string): O[];
@@ -1,7 +0,0 @@
1
- export const GRID_MENU_SEARCH_AFTER = 8;
2
- export function matchMenuOptions(options, query) {
3
- const needle = query.trim().toLowerCase();
4
- if (!needle)
5
- return [...options];
6
- return options.filter((option) => option.label.toLowerCase().includes(needle));
7
- }
@@ -1,16 +0,0 @@
1
- import type { GroupConfig } from "../model.js";
2
- type Groups = NonNullable<GroupConfig["groups"]>;
3
- /**
4
- * THE GROUP PANEL'S GROUPS: every group of the list in the panel's order (shown, then empty, then hidden),
5
- * each with a grip to drag it and an eye to show or hide it. The same row chrome, grip and sensors as the
6
- * Columns list (`LayoutColumnsList`), so the two editors read as one; `comfortable` is the phone sheet's
7
- * taller row.
8
- *
9
- * An empty group is dimmed (Hide empty groups hides it, the eye is still open); a group the reader hid is
10
- * dimmed with a crossed eye. Dragging one sets the list's order by hand.
11
- */
12
- export declare function GroupBucketsList({ groups, variant, }: {
13
- groups: Groups;
14
- variant?: "compact" | "comfortable";
15
- }): import("react/jsx-runtime").JSX.Element;
16
- export {};
@@ -1,44 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { cx } from "../../internal/cx.js";
4
- import { useViews } from "../../provider/context.js";
5
- import { drawPanelButton } from "../panel-button.js";
6
- import { DRAGGING_CLASS, PANEL_ROW_CLASS, SHEET_ROW_CLASS, SHEET_ROW_GROUND_CLASS } from "./chrome.js";
7
- import { usePanelListSensors } from "./drag.js";
8
- import { moveItem, SortableFrame, useDragKit, useSortableItem } from "./drag-kit.js";
9
- export function GroupBucketsList({ groups, variant = "compact", }) {
10
- const kit = useDragKit();
11
- const sensors = usePanelListSensors(kit);
12
- const keys = groups.entries.map((entry) => entry.key);
13
- const handleDragEnd = (event) => {
14
- const { active, over } = event;
15
- if (!over || active.id === over.id)
16
- return;
17
- const from = keys.indexOf(String(active.id));
18
- const to = keys.indexOf(String(over.id));
19
- if (from === -1 || to === -1)
20
- return;
21
- groups.onReorder(moveItem(keys, from, to));
22
- };
23
- return (_jsx(SortableFrame, { kit: kit, sensors: sensors, items: keys, axis: "y", onDragEnd: handleDragEnd, nameOf: (key) => groups.entries.find((entry) => entry.key === key)?.label ?? key, children: groups.entries.map((entry) => (_jsx(GroupRow, { entry: entry, variant: variant, onToggle: groups.onToggle }, entry.key))) }));
24
- }
25
- function GroupRow({ entry, variant, onToggle, }) {
26
- const views = useViews();
27
- const { icons, messages } = views;
28
- const { attributes, listeners, setNodeRef, isDragging, style } = useSortableItem({ id: entry.key, axis: "y" });
29
- const comfortable = variant === "comfortable";
30
- const dim = entry.empty || entry.hidden;
31
- const glyph = comfortable ? "h-4 w-4" : "h-3.5 w-3.5";
32
- const label = entry.label || messages({ key: "views.panels.group-empty" });
33
- const Grip = icons.drag;
34
- const Eye = entry.hidden ? icons.hide : icons.show;
35
- return (_jsxs("div", { ref: setNodeRef, "data-vs-row": true, "data-group-entry": entry.key, style: style, className: cx(comfortable ? SHEET_ROW_CLASS : PANEL_ROW_CLASS, comfortable && !isDragging && SHEET_ROW_GROUND_CLASS, isDragging && DRAGGING_CLASS), children: [_jsx("span", { ...attributes, ...listeners, "data-base-ui-swipe-ignore": true, "aria-label": messages({ key: "views.panels.move", values: { label } }), className: "flex shrink-0 cursor-grab items-center text-(color:--vk-fg-subtlest) transition-colors hover:text-(color:--vk-fg-subtle) active:cursor-grabbing", style: { touchAction: "none" }, children: _jsx(Grip, { className: glyph }) }), _jsx("span", { className: cx("min-w-0 flex-1 truncate font-medium", comfortable ? "text-(length:--vk-sheet-text,15px)" : "text-sm", dim ? "text-(color:--vk-fg-subtle)" : "text-(color:--vk-fg)"), children: label }), drawPanelButton(views, {
36
- own: cx("flex shrink-0 items-center justify-center rounded-sm text-(color:--vk-fg-subtle) transition-colors hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)", comfortable ? "h-7 w-7" : "h-5 w-5"),
37
- frame: cx("shrink-0", comfortable ? "h-7 w-7" : "h-5 w-5"),
38
- variant: "ghost",
39
- size: "icon",
40
- onClick: () => onToggle(entry.key, entry.hidden),
41
- "aria-label": messages({ key: entry.hidden ? "views.panels.show" : "views.panels.hide", values: { label } }),
42
- children: _jsx(Eye, { className: glyph }),
43
- })] }));
44
- }