viewkitjs 0.29.0 → 0.30.1

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 (289) hide show
  1. package/CHANGELOG.md +127 -6
  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/button/map-button.d.ts +5 -3
  9. package/views/dist/controls/button/map-button.js +14 -7
  10. package/views/dist/controls/controls.d.ts +2 -4
  11. package/views/dist/controls/controls.js +2 -2
  12. package/views/dist/controls/customize/customize.d.ts +51 -0
  13. package/views/dist/controls/customize/customize.js +128 -23
  14. package/views/dist/controls/customize/map-customize-body.d.ts +0 -3
  15. package/views/dist/controls/customize/map-customize-body.js +46 -11
  16. package/views/dist/controls/customize/map-ranges.d.ts +23 -0
  17. package/views/dist/controls/customize/map-ranges.js +41 -0
  18. package/views/dist/controls/customize/rules.d.ts +17 -1
  19. package/views/dist/controls/customize/rules.js +2 -0
  20. package/views/dist/controls/customize/words.d.ts +7 -0
  21. package/views/dist/controls/customize/words.js +5 -0
  22. package/views/dist/controls/customize.css +3 -0
  23. package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
  24. package/views/dist/controls/filter-editor/filter-editor.js +1 -0
  25. package/views/dist/controls/filter-editor/rules.d.ts +1 -2
  26. package/views/dist/controls/index.d.ts +8 -8
  27. package/views/dist/controls/index.js +8 -8
  28. package/views/dist/controls/menu-list/menu-list.d.ts +16 -1
  29. package/views/dist/controls/menu-list/menu-list.js +26 -8
  30. package/views/dist/controls/menu-list.css +8 -0
  31. package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +1 -1
  32. package/views/dist/controls/quick-filters/map-quick-filters-body.js +6 -3
  33. package/views/dist/controls/sheet/map-sheet.js +1 -1
  34. package/views/dist/controls/text-editor/map-text-body.d.ts +1 -1
  35. package/views/dist/controls/text-editor/map-text-body.js +2 -2
  36. package/views/dist/controls/text-editor/text-editor.d.ts +3 -0
  37. package/views/dist/controls/text-editor/text-editor.js +16 -2
  38. package/views/dist/controls/text-editor.css +11 -0
  39. package/views/dist/controls/values-editor/values.js +6 -2
  40. package/views/dist/display/options.d.ts +1 -1
  41. package/views/dist/display/rich-text.js +0 -1
  42. package/views/dist/editors/ChipsEditor.d.ts +4 -5
  43. package/views/dist/editors/ChipsEditor.js +12 -78
  44. package/views/dist/editors/DateEditor.d.ts +12 -16
  45. package/views/dist/editors/DateEditor.js +40 -191
  46. package/views/dist/editors/EditorPanel.d.ts +2 -6
  47. package/views/dist/editors/EditorPanel.js +2 -2
  48. package/views/dist/editors/LocationEditor.d.ts +11 -19
  49. package/views/dist/editors/LocationEditor.js +19 -211
  50. package/views/dist/editors/NameEditor.d.ts +8 -16
  51. package/views/dist/editors/NameEditor.js +11 -100
  52. package/views/dist/editors/NumberEditor.d.ts +14 -21
  53. package/views/dist/editors/NumberEditor.js +22 -49
  54. package/views/dist/editors/RangeEditor.d.ts +9 -33
  55. package/views/dist/editors/RangeEditor.js +12 -97
  56. package/views/dist/editors/RelationEditor.d.ts +6 -9
  57. package/views/dist/editors/RelationEditor.js +11 -30
  58. package/views/dist/editors/RelationSetEditor.d.ts +13 -24
  59. package/views/dist/editors/RelationSetEditor.js +33 -101
  60. package/views/dist/editors/SelectEditor.d.ts +15 -17
  61. package/views/dist/editors/SelectEditor.js +15 -94
  62. package/views/dist/editors/TextEditor.d.ts +23 -26
  63. package/views/dist/editors/TextEditor.js +11 -48
  64. package/views/dist/editors/ValueListEditor.d.ts +14 -23
  65. package/views/dist/editors/ValueListEditor.js +16 -202
  66. package/views/dist/editors/body-panel.d.ts +13 -7
  67. package/views/dist/editors/body-panel.js +3 -7
  68. package/views/dist/editors/edit-cores.d.ts +15 -15
  69. package/views/dist/editors/edit-cores.js +14 -14
  70. package/views/dist/editors/number-body.d.ts +1 -1
  71. package/views/dist/editors/number-step.d.ts +0 -34
  72. package/views/dist/editors/number-step.js +0 -37
  73. package/views/dist/editors/option-add-flow.d.ts +1 -13
  74. package/views/dist/editors/option-add-flow.js +0 -22
  75. package/views/dist/editors/relation-links-body.d.ts +2 -3
  76. package/views/dist/editors/relation-picker.d.ts +13 -3
  77. package/views/dist/editors/relation-source.d.ts +0 -22
  78. package/views/dist/editors/relation-source.js +0 -21
  79. package/views/dist/field-row/FieldRow.js +5 -6
  80. package/views/dist/field-row/FieldRowLane.js +0 -1
  81. package/views/dist/field-row/editors/RowChipsEditor.js +2 -2
  82. package/views/dist/field-row/editors/RowDateEditor.d.ts +2 -2
  83. package/views/dist/field-row/editors/RowDateEditor.js +2 -2
  84. package/views/dist/field-row/editors/RowNameEditor.d.ts +2 -5
  85. package/views/dist/field-row/editors/RowNameEditor.js +7 -12
  86. package/views/dist/field-row/editors/RowNumberEditor.d.ts +1 -1
  87. package/views/dist/field-row/editors/RowNumberEditor.js +4 -4
  88. package/views/dist/field-row/editors/RowPlaceEditor.js +3 -3
  89. package/views/dist/field-row/editors/RowRangeEditor.d.ts +2 -5
  90. package/views/dist/field-row/editors/RowRangeEditor.js +7 -14
  91. package/views/dist/field-row/editors/RowRelationEditor.js +3 -3
  92. package/views/dist/field-row/editors/RowSelectEditor.js +2 -2
  93. package/views/dist/field-row/editors/RowTextEditor.d.ts +1 -1
  94. package/views/dist/field-row/editors/RowTextEditor.js +3 -4
  95. package/views/dist/field-row/editors/RowValueListEditor.js +5 -5
  96. package/views/dist/field-row/field-row-button.d.ts +6 -9
  97. package/views/dist/field-row/field-row-button.js +1 -6
  98. package/views/dist/field-row/field-row-checkbox.d.ts +1 -1
  99. package/views/dist/field-row/row-target.d.ts +0 -7
  100. package/views/dist/field-row/row-target.js +0 -2
  101. package/views/dist/grid/chrome/GridAddColumn.d.ts +2 -1
  102. package/views/dist/grid/chrome/GridAddColumn.js +8 -66
  103. package/views/dist/grid/chrome/GridAggregateMenu.d.ts +5 -7
  104. package/views/dist/grid/chrome/GridAggregateMenu.js +20 -39
  105. package/views/dist/grid/chrome/GridCellEditors.d.ts +2 -2
  106. package/views/dist/grid/chrome/GridCellEditors.js +12 -12
  107. package/views/dist/grid/chrome/GridChipsEditor.js +3 -3
  108. package/views/dist/grid/chrome/GridColumnMenu.d.ts +11 -12
  109. package/views/dist/grid/chrome/GridColumnMenu.js +32 -93
  110. package/views/dist/grid/chrome/GridDateEditor.d.ts +6 -6
  111. package/views/dist/grid/chrome/GridDateEditor.js +3 -3
  112. package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -6
  113. package/views/dist/grid/chrome/GridGroupMenu.js +21 -62
  114. package/views/dist/grid/chrome/GridHeader.d.ts +1 -2
  115. package/views/dist/grid/chrome/GridHeader.js +2 -2
  116. package/views/dist/grid/chrome/GridLongTextEditor.d.ts +17 -38
  117. package/views/dist/grid/chrome/GridLongTextEditor.js +6 -7
  118. package/views/dist/grid/chrome/GridNameEditor.js +4 -4
  119. package/views/dist/grid/chrome/GridNumberEditor.d.ts +4 -5
  120. package/views/dist/grid/chrome/GridNumberEditor.js +3 -4
  121. package/views/dist/grid/chrome/GridPlaceEditor.d.ts +2 -5
  122. package/views/dist/grid/chrome/GridPlaceEditor.js +5 -5
  123. package/views/dist/grid/chrome/GridRangeEditor.d.ts +6 -12
  124. package/views/dist/grid/chrome/GridRangeEditor.js +7 -15
  125. package/views/dist/grid/chrome/GridRelationEditor.js +5 -5
  126. package/views/dist/grid/chrome/GridRow.js +0 -3
  127. package/views/dist/grid/chrome/GridRowActions.d.ts +1 -1
  128. package/views/dist/grid/chrome/GridRowActions.js +0 -5
  129. package/views/dist/grid/chrome/GridRowCells.js +9 -6
  130. package/views/dist/grid/chrome/GridSelectEditor.js +3 -3
  131. package/views/dist/grid/chrome/GridStructure.js +0 -1
  132. package/views/dist/grid/chrome/GridTable.js +1 -1
  133. package/views/dist/grid/chrome/GridTextEditor.d.ts +5 -7
  134. package/views/dist/grid/chrome/GridTextEditor.js +4 -17
  135. package/views/dist/grid/chrome/GridValueListEditor.js +4 -4
  136. package/views/dist/grid/chrome/grid-body-place.d.ts +2 -3
  137. package/views/dist/grid/chrome/grid-body-place.js +4 -8
  138. package/views/dist/grid/chrome/grid-button.d.ts +7 -10
  139. package/views/dist/grid/chrome/grid-button.js +1 -6
  140. package/views/dist/grid/chrome/grid-cell-classes.js +1 -1
  141. package/views/dist/grid/chrome/grid-column-menu-items.d.ts +4 -4
  142. package/views/dist/grid/chrome/grid-column-menu-items.js +10 -6
  143. package/views/dist/grid/chrome/grid-group-menu-parts.d.ts +5 -9
  144. package/views/dist/grid/chrome/grid-group-menu-parts.js +1 -3
  145. package/views/dist/grid/chrome/grid-hover.js +0 -1
  146. package/views/dist/grid/chrome/grid-menu-focus.d.ts +7 -31
  147. package/views/dist/grid/chrome/grid-menu-focus.js +7 -47
  148. package/views/dist/grid/chrome/grid-styles.d.ts +0 -3
  149. package/views/dist/grid/chrome/grid-styles.js +0 -1
  150. package/views/dist/grid/chrome/grid-table-props.d.ts +6 -10
  151. package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -4
  152. package/views/dist/grid/core/editing-controller.d.ts +2 -1
  153. package/views/dist/grid/core/editing-controller.js +10 -2
  154. package/views/dist/grid/core/refusal-sentence.d.ts +3 -0
  155. package/views/dist/grid/core/refusal-sentence.js +2 -2
  156. package/views/dist/grid/core/write-states.d.ts +3 -1
  157. package/views/dist/grid/core/write-states.js +6 -2
  158. package/views/dist/grid/grid.css +1 -1
  159. package/views/dist/model/body-frame.d.ts +0 -32
  160. package/views/dist/model/body-frame.js +1 -15
  161. package/views/dist/model/column-inspect.d.ts +5 -5
  162. package/views/dist/model/column-inspect.js +2 -2
  163. package/views/dist/panels/customize-body.d.ts +1 -10
  164. package/views/dist/panels/customize-body.js +0 -3
  165. package/views/dist/panels/filter/MenuSelect.js +0 -5
  166. package/views/dist/panels/filter/RangeFilterBody.js +0 -1
  167. package/views/dist/panels/filter/details.d.ts +1 -5
  168. package/views/dist/panels/filter/details.js +0 -13
  169. package/views/dist/panels/filter/filter-list.d.ts +0 -1
  170. package/views/dist/panels/filter/filter-list.js +1 -1
  171. package/views/dist/panels/panel-button.d.ts +10 -12
  172. package/views/dist/panels/panel-button.js +1 -6
  173. package/views/dist/panels/react/chrome.d.ts +0 -17
  174. package/views/dist/panels/react/chrome.js +0 -8
  175. package/views/dist/panels/react/customize-body.d.ts +9 -12
  176. package/views/dist/panels/react/customize-body.js +57 -11
  177. package/views/dist/panels/react/customize.d.ts +9 -12
  178. package/views/dist/panels/react/customize.js +3 -112
  179. package/views/dist/panels/react/filter/FilterEditor.d.ts +4 -18
  180. package/views/dist/panels/react/filter/FilterEditor.js +6 -330
  181. package/views/dist/panels/react/filter/FilterFieldList.d.ts +1 -1
  182. package/views/dist/panels/react/filter/FilterFieldList.js +27 -59
  183. package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +1 -11
  184. package/views/dist/panels/react/filter/PhoneFilterEditor.js +8 -144
  185. package/views/dist/panels/react/filter/editor-ctx.d.ts +1 -33
  186. package/views/dist/panels/react/filter/editor-ctx.js +5 -33
  187. package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -6
  188. package/views/dist/panels/react/filter/filter-part-body.js +0 -5
  189. package/views/dist/panels/react/filter/rule-writes.d.ts +1 -26
  190. package/views/dist/panels/react/filter/rule-writes.js +4 -95
  191. package/views/dist/panels/react/order-details.d.ts +1 -26
  192. package/views/dist/panels/react/order-details.js +3 -69
  193. package/views/dist/panels/react/panel-header.js +0 -1
  194. package/views/dist/panels/react/popover.d.ts +4 -7
  195. package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +2 -4
  196. package/views/dist/panels/react/quick/QuickFiltersPanel.js +16 -137
  197. package/views/dist/panels/react/sort/SortEditor.d.ts +4 -4
  198. package/views/dist/panels/react/sort/SortEditor.js +8 -245
  199. package/views/dist/panels/react/sort/SortFieldList.d.ts +1 -1
  200. package/views/dist/panels/react/sort/SortFieldList.js +11 -25
  201. package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +2 -2
  202. package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -16
  203. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
  204. package/views/dist/panels/react/toolbar/ToolbarSave.js +0 -4
  205. package/views/dist/panels/react/toolbar/ToolbarSearch.js +0 -1
  206. package/views/dist/panels/react/toolbar/ToolbarSortPill.js +3 -3
  207. package/views/dist/panels/react/view-actions.js +0 -1
  208. package/views/dist/panels/react/views-row/FoldingViewRow.js +5 -9
  209. package/views/dist/panels/react/views-row/ViewCreatePill.js +0 -1
  210. package/views/dist/panels/react/views-row/ViewPicker.js +7 -43
  211. package/views/dist/panels/react/views-row/ViewPickerRow.js +0 -2
  212. package/views/dist/panels/react/views-row/menu-classes.d.ts +0 -4
  213. package/views/dist/panels/react/views-row/menu-classes.js +0 -2
  214. package/views/dist/panels/react.d.ts +5 -12
  215. package/views/dist/panels/react.js +5 -12
  216. package/views/dist/provider/ViewsProvider.d.ts +2 -46
  217. package/views/dist/provider/ViewsProvider.js +2 -22
  218. package/views/dist/provider/components.d.ts +153 -106
  219. package/views/dist/provider/context.d.ts +1 -21
  220. package/views/dist/provider/missing-slot.d.ts +3 -7
  221. package/views/dist/provider/missing-slot.js +2 -9
  222. package/views/dist/react.d.ts +1 -2
  223. package/views/dist/selection/SelectionBar.js +2 -3
  224. package/views/dist/styles.css +40 -168
  225. package/views/dist/styles.unlayered.css +40 -168
  226. package/views/docs/contract.md +99 -123
  227. package/views/docs/getting-started.md +222 -2
  228. package/views/docs/guides/cells.md +222 -2
  229. package/views/docs/guides/display.md +1 -1
  230. package/views/docs/guides/editors.md +235 -20
  231. package/views/docs/guides/ports.md +1 -1
  232. package/views/docs/guides/selection.md +1 -1
  233. package/views/docs/guides/the-grid.md +14 -16
  234. package/views/docs/guides/the-provider.md +9 -15
  235. package/views/docs/reference/cells.md +1 -1
  236. package/views/docs/reference/controls.md +28 -15
  237. package/views/docs/reference/editors-chips.md +2 -2
  238. package/views/docs/reference/editors-date.md +4 -4
  239. package/views/docs/reference/editors-location.md +4 -7
  240. package/views/docs/reference/editors-name.md +3 -5
  241. package/views/docs/reference/editors-number.md +10 -10
  242. package/views/docs/reference/editors-panel.md +3 -3
  243. package/views/docs/reference/editors-range.md +3 -5
  244. package/views/docs/reference/editors-relation.md +4 -4
  245. package/views/docs/reference/editors-select.md +3 -3
  246. package/views/docs/reference/editors-text.md +3 -4
  247. package/views/docs/reference/editors-value-list.md +3 -3
  248. package/views/docs/reference/field-row.md +1 -1
  249. package/views/docs/reference/grid.md +2 -2
  250. package/views/docs/reference/panels-react.md +20 -34
  251. package/views/docs/reference/react.md +11 -18
  252. package/views/docs/reference/views.md +5 -5
  253. package/views/skills/views/SKILL.md +1 -1
  254. package/views/dist/editors/relation-panel.d.ts +0 -69
  255. package/views/dist/editors/relation-panel.js +0 -46
  256. package/views/dist/grid/chrome/GridColumnColorSection.d.ts +0 -13
  257. package/views/dist/grid/chrome/GridColumnColorSection.js +0 -40
  258. package/views/dist/grid/chrome/GridColumnDateSection.d.ts +0 -28
  259. package/views/dist/grid/chrome/GridColumnDateSection.js +0 -23
  260. package/views/dist/grid/chrome/GridColumnDurationSection.d.ts +0 -23
  261. package/views/dist/grid/chrome/GridColumnDurationSection.js +0 -24
  262. package/views/dist/grid/chrome/GridColumnNumberSection.d.ts +0 -29
  263. package/views/dist/grid/chrome/GridColumnNumberSection.js +0 -27
  264. package/views/dist/grid/chrome/GridColumnPercentSection.d.ts +0 -16
  265. package/views/dist/grid/chrome/GridColumnPercentSection.js +0 -16
  266. package/views/dist/grid/chrome/GridColumnSortSection.d.ts +0 -38
  267. package/views/dist/grid/chrome/GridColumnSortSection.js +0 -33
  268. package/views/dist/grid/chrome/GridFlyout.d.ts +0 -44
  269. package/views/dist/grid/chrome/GridFlyout.js +0 -80
  270. package/views/dist/grid/chrome/GridMenuRow.d.ts +0 -15
  271. package/views/dist/grid/chrome/GridMenuRow.js +0 -15
  272. package/views/dist/grid/chrome/grid-menu-search.d.ts +0 -7
  273. package/views/dist/grid/chrome/grid-menu-search.js +0 -7
  274. package/views/dist/panels/react/GroupBucketsList.d.ts +0 -16
  275. package/views/dist/panels/react/GroupBucketsList.js +0 -44
  276. package/views/dist/panels/react/LayoutColumnsList.d.ts +0 -24
  277. package/views/dist/panels/react/LayoutColumnsList.js +0 -101
  278. package/views/dist/panels/react/PopoverColumnDetail.d.ts +0 -11
  279. package/views/dist/panels/react/PopoverColumnDetail.js +0 -24
  280. package/views/dist/panels/react/drag.d.ts +0 -2
  281. package/views/dist/panels/react/drag.js +0 -5
  282. package/views/dist/panels/react/layout-detail.d.ts +0 -4
  283. package/views/dist/panels/react/layout-detail.js +0 -29
  284. package/views/dist/panels/react/root-list.d.ts +0 -6
  285. package/views/dist/panels/react/root-list.js +0 -31
  286. package/views/dist/panels/react/sort/use-sort-drag.d.ts +0 -17
  287. package/views/dist/panels/react/sort/use-sort-drag.js +0 -39
  288. package/views/dist/panels/react/view-footer.d.ts +0 -20
  289. package/views/dist/panels/react/view-footer.js +0 -41
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { useCallback, useEffect, useRef, useState, } from "react";
2
+ import { useCallback, useEffect, useRef } from "react";
3
3
  const POPUP = '[role="dialog"], [role="menu"]';
4
4
  const onNothing = (active) => active == null || active === document.body;
5
5
  export function returnGridFocus(anchor) {
@@ -28,52 +28,15 @@ export function returnGridFocus(anchor) {
28
28
  return;
29
29
  stop();
30
30
  });
31
- watch.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ["inert"] });
31
+ watch.observe(document.body, {
32
+ childList: true,
33
+ subtree: true,
34
+ attributes: true,
35
+ attributeFilter: ["inert"],
36
+ });
32
37
  document.addEventListener("focusin", stop, true);
33
38
  return stop;
34
39
  }
35
- const isArrow = (event) => (event.key === "ArrowDown" || event.key === "ArrowUp") && !(event.altKey || event.ctrlKey || event.metaKey || event.shiftKey);
36
- const menuRows = (box) => [...box.querySelectorAll("button:not(:disabled)")];
37
- export function gridMenuArrows(event, search) {
38
- if (!isArrow(event))
39
- return;
40
- const box = event.currentTarget;
41
- if (!box.contains(event.target))
42
- return;
43
- if (search?.contains(event.target))
44
- return;
45
- const rows = search?.isConnected ? [search, ...menuRows(box)] : menuRows(box);
46
- if (rows.length === 0)
47
- return;
48
- event.preventDefault();
49
- const at = rows.indexOf(document.activeElement);
50
- const down = event.key === "ArrowDown";
51
- const next = at < 0 ? (down ? 0 : rows.length - 1) : (at + (down ? 1 : -1) + rows.length) % rows.length;
52
- const row = rows[next];
53
- row.focus();
54
- if (row === search) {
55
- row.dispatchEvent(new KeyboardEvent("keydown", { key: down ? "Home" : "End", bubbles: true, cancelable: true }));
56
- }
57
- }
58
- export function gridMenuSearchArrows(event, box) {
59
- if (!box || !isArrow(event))
60
- return;
61
- const rows = menuRows(box);
62
- if (rows.length === 0)
63
- return;
64
- const down = event.key === "ArrowDown";
65
- const matches = [...box.querySelectorAll('[role="option"]:not([aria-disabled="true"])')];
66
- if (matches.length > 0) {
67
- const named = event.currentTarget.getAttribute("aria-activedescendant");
68
- if (!named)
69
- return;
70
- const at = matches.findIndex((match) => match.id === named);
71
- if (at !== (down ? matches.length - 1 : 0))
72
- return;
73
- }
74
- event.preventDefault();
75
- (down ? rows[0] : rows[rows.length - 1]).focus();
76
- }
77
40
  export function useGridMenuPress(open) {
78
41
  const note = useRef(false);
79
42
  return {
@@ -88,7 +51,6 @@ export function useGridMenuPress(open) {
88
51
  };
89
52
  }
90
53
  export function useGridMenuFocus(open, anchor) {
91
- const [byKey, setByKey] = useState(false);
92
54
  const wasOpen = useRef(false);
93
55
  useEffect(() => {
94
56
  if (open) {
@@ -101,8 +63,6 @@ export function useGridMenuFocus(open, anchor) {
101
63
  if (anchor)
102
64
  return returnGridFocus(anchor);
103
65
  }, [open, anchor]);
104
- const noteOpen = useCallback((event) => setByKey(event.detail === 0), []);
105
- return { initialFocus: byKey, noteOpen };
106
66
  }
107
67
  export function useGridHeldMenuReport(held, onChange) {
108
68
  const pressingRef = useRef(false);
@@ -18,9 +18,6 @@ export declare const GRID_CHROME_FOCUS = "outline-none focus-visible:shadow-[var
18
18
  * than its cell grows into. One whole `box-shadow` value, the app's `--vk-editing-shadow` (`none` turns it off);
19
19
  * undeclared, what `shadow-lg shadow-black/20 dark:shadow-black/50` drew. */
20
20
  export declare const GRID_EDITING_SHADOW = "shadow-[var(--vk-editing-shadow,0_10px_15px_-3px_rgb(0_0_0/0.2),0_4px_6px_-4px_rgb(0_0_0/0.2))] dark:shadow-[var(--vk-editing-shadow,0_10px_15px_-3px_rgb(0_0_0/0.5),0_4px_6px_-4px_rgb(0_0_0/0.5))]";
21
- /** THE endFill-tail ⋯ button look: each row's menu button. Its hover is the caller's: neutral, or
22
- * brand on a selected row. */
23
- export declare const GRID_TAIL_BUTTON_BASE = "inline-flex h-8 w-9 items-center justify-center rounded-sm text-(color:--vk-fg-subtle) hover:text-(color:--vk-fg)";
24
21
  /**
25
22
  * A FROZEN header cell's OWN paint — the ground down to a 2px sliver at its
26
23
  * foot, alpha-gated on `--vk-scrolled` (0/1, from the scroll area), like the
@@ -6,6 +6,5 @@ export const GRID_GROUND = "bg-(color:--vk-ground)";
6
6
  export const GRID_GROUND_WHILE_SCROLLED = "bg-[color-mix(in_oklab,_var(--vk-ground)_calc(var(--vk-scrolled,0)*100%),_transparent)]";
7
7
  export const GRID_CHROME_FOCUS = "outline-none focus-visible:shadow-[var(--vk-focus-ring,inset_0_0_0_2px_var(--vk-brand))]";
8
8
  export const GRID_EDITING_SHADOW = "shadow-[var(--vk-editing-shadow,0_10px_15px_-3px_rgb(0_0_0/0.2),0_4px_6px_-4px_rgb(0_0_0/0.2))] dark:shadow-[var(--vk-editing-shadow,0_10px_15px_-3px_rgb(0_0_0/0.5),0_4px_6px_-4px_rgb(0_0_0/0.5))]";
9
- export const GRID_TAIL_BUTTON_BASE = "inline-flex h-8 w-9 items-center justify-center rounded-sm text-(color:--vk-fg-subtle) hover:text-(color:--vk-fg)";
10
9
  export const GRID_HEADER_BG_FROZEN = "bg-[linear-gradient(to_bottom,color-mix(in_oklab,_var(--vk-ground)_calc(var(--vk-scrolled,0)*100%),_transparent)_calc(100%-2px),transparent_calc(100%-2px))]";
11
10
  export const GRID_HEADER_BG_FROZEN_HOVER = "hover:bg-[linear-gradient(var(--vk-hovered),var(--vk-hovered)),linear-gradient(to_bottom,color-mix(in_oklab,_var(--vk-ground)_calc(var(--vk-scrolled,0)*100%),_transparent)_calc(100%-2px),transparent_calc(100%-2px))]";
@@ -80,10 +80,8 @@ export type GridTableProps<Row> = {
80
80
  /** Which parts a group band's ⋯ menu holds: `"select"` (Select all in group, leading the menu), `"sort"`,
81
81
  * `"figures"` (the count and each figure, turned on and off) and `"hide"`. Each shows only when you also pass
82
82
  * what it needs: `selection` for Select; `sort` with `sortOptions`; `groupFigures` with `onGroupSummaryChange`;
83
- * `onHideGroup`. Select is never in the menu unless you name it here. On the `popover` route the sort list then always
84
- * searches through your `Command`, at any count. Left out, the ⋯ opens for sort or Hide, carries the figure toggles
85
- * with them, and searches past eight sort choices. On the `menu` route (the provider's `menus`) the sort choices
86
- * open beside the menu with no search, either way. */
83
+ * `onHideGroup`. Select is never in the menu unless you name it here. Left out, the ⋯ opens for sort or Hide and
84
+ * carries the figure toggles with them. The sort choices open beside the menu, with no search, either way. */
87
85
  groupMenu?: readonly GridGroupMenuPart[];
88
86
  /** Source-paged group continuation, rendered after this group's loaded rows. */
89
87
  renderGroupFooter?: (group: ListGroup<Row>) => ReactNode;
@@ -230,14 +228,12 @@ export type GridTableProps<Row> = {
230
228
  * a sort's `fieldKey` and `by`), copies, edits and pastes as its part; an edit commits the whole column's id and
231
229
  * the whole value with that part replaced, locked, refused and limited as its whole. Off by default. */
232
230
  parts?: boolean;
233
- /** The host's rows in a column's menu for the column's field, above Hide (a field editor's Edit field and
234
- * Archive field); `close` shuts the menu. Null for a field the host adds nothing to. On the `menu` route (the
235
- * provider's `menus`) it isn't drawn: hand `columnMenuItems`. */
231
+ /** @deprecated Read by nothing: a column's menu is your `Menu`, handed its rows as data, so a drawn row has nowhere
232
+ * to stand. Hand `columnMenuItems`. It goes when every menu takes a function from its default items. */
236
233
  renderColumnMenuRows?: (fieldKey: string, close: () => void) => ReactNode;
237
- /** The host's rows for a column's field on the `menu` route, as data, drawn just above Hide; null or an empty
234
+ /** The host's rows for a column's field, as data, drawn just above Hide; null or an empty
238
235
  * list for a field the host adds nothing to. Their keys must not reuse the package's own (`sort-asc`,
239
- * `hide-column` and the rest). It is called while the grid renders, for every column: keep it pure and cheap.
240
- * On the `popover` route `renderColumnMenuRows` draws them instead. */
236
+ * `hide-column` and the rest). It is called while the grid renders, for every column: keep it pure and cheap. */
241
237
  columnMenuItems?: (fieldKey: string) => ViewsMenuItem[] | null;
242
238
  columnState?: ListColumnState;
243
239
  onColumnStateChange?: (next: ListColumnState) => void;
@@ -21,17 +21,15 @@ import { useGridCellPick } from "./useGridCellPick.js";
21
21
  const REFUSAL_REPEAT_MS = 600;
22
22
  export function useGridTableInteractionModel({ rootRef, props, rows, visibleRows, heldRows, rowIndex, visibleColumns, selecting, revealRow, focusShape, groupOfRow, }) {
23
23
  const { columns, getRowId, listConfig } = props;
24
- const { conventions, ports, messages, sayRefusals = false } = useViews();
24
+ const { conventions, ports, messages } = useViews();
25
25
  const editingEnabled = !!props.onCellCommit;
26
26
  const sayRefusal = useCallback((refusal) => {
27
- if (!sayRefusals)
28
- return;
29
27
  const nameOf = (columnId) => {
30
28
  const col = columns.find((each) => each.id === columnId);
31
29
  return col ? columnLabel(col) : columnId;
32
30
  };
33
31
  ports.toast.error(gridRefusalSentence(refusal, nameOf, messages));
34
- }, [sayRefusals, columns, ports, messages]);
32
+ }, [columns, ports, messages]);
35
33
  const columnById = useMemo(() => new Map([...columns, ...visibleColumns].map((column) => [column.id, column])), [columns, visibleColumns]);
36
34
  const partOfWhole = useCallback((wholeId) => [...columnById.values()].find((column) => column.partOf?.column === wholeId)?.partOf, [columnById]);
37
35
  const keepsSent = useCallback((columnId) => partOfWhole(columnId) != null, [partOfWhole]);
@@ -35,7 +35,8 @@ export declare class GridEditingController<Row> {
35
35
  /** The tokens of the writes waiting undos and redos noted, kept through `forgetSent` until their apply ends. */
36
36
  private readonly openNotes;
37
37
  /** Each cell's writes, for its `data-pending` and `data-invalid`: how many are out, the latest one's token, and
38
- * whether that latest one was refused. An entry goes once nothing is out and it isn't refused. */
38
+ * whether that latest one was refused, with the refusal's own words when it has some. An entry goes once nothing
39
+ * is out and it isn't refused. */
39
40
  private readonly writes;
40
41
  private writeStates;
41
42
  private applyChain;
@@ -1,6 +1,7 @@
1
1
  import { gridCellKey, } from "./commit-model.js";
2
2
  import { applyGridPending, carryGridPutBack, createGridHistory, gridEditValue, gridOverlayValue, gridHistoryValue, gridKeptValue, groupGridPendingByRow, groupGridPendingSettlement, keepGridPending, markGridPendingSettlement, planGridPendingAssignments, pressGridHistory, pruneGridEntry, pruneGridHistoryEntry, reconcileGridPending, recordGridHistory, revertGridHistoryPress, rollbackGridPending, } from "./editing-model.js";
3
3
  import { setGridWriteStates } from "./write-states.js";
4
+ import { refusalWords } from "./refusal-sentence.js";
4
5
  import { noteGridEdited } from "./undo-owner.js";
5
6
  const confirmed = (outcome) => outcome ?? { status: "confirmed" };
6
7
  export class GridEditingController {
@@ -293,8 +294,11 @@ export class GridEditingController {
293
294
  if (!entry)
294
295
  return;
295
296
  entry.out -= 1;
296
- if (entry.latest === token && results[index]?.status === "failed")
297
+ const result = results[index];
298
+ if (entry.latest === token && result?.status === "failed") {
297
299
  entry.invalid = true;
300
+ entry.reason = refusalWords(result.error) ?? undefined;
301
+ }
298
302
  if (entry.out <= 0 && !entry.invalid)
299
303
  this.writes.delete(key);
300
304
  });
@@ -304,7 +308,11 @@ export class GridEditingController {
304
308
  publishWriteStates(cells) {
305
309
  const next = setGridWriteStates(this.writeStates, cells.map(({ rowId, columnId }) => {
306
310
  const entry = this.writes.get(gridCellKey(rowId, columnId));
307
- return { rowId, columnId, state: entry ? { pending: entry.out > 0, invalid: entry.invalid } : null };
311
+ return {
312
+ rowId,
313
+ columnId,
314
+ state: entry ? { pending: entry.out > 0, invalid: entry.invalid, reason: entry.reason } : null,
315
+ };
308
316
  }));
309
317
  if (next === this.writeStates)
310
318
  return;
@@ -1,3 +1,6 @@
1
1
  import type { ViewsMessageResolver } from "../../contract.js";
2
2
  import type { GridCommitRefusal } from "./commit-model.js";
3
+ /** An error's own words: an Error's message or a string, trimmed; null when it has none. A refused cell carries them as
4
+ * its reason (`GridWriteState.reason`). */
5
+ export declare function refusalWords(error: unknown): string | null;
3
6
  export declare function gridRefusalSentence(refusal: GridCommitRefusal, fieldName: (columnId: string) => string, messages: ViewsMessageResolver): string;
@@ -1,10 +1,10 @@
1
- function wordsOf(error) {
1
+ export function refusalWords(error) {
2
2
  const text = error instanceof Error ? error.message : typeof error === "string" ? error : "";
3
3
  const trimmed = text.trim();
4
4
  return trimmed === "" ? null : trimmed;
5
5
  }
6
6
  export function gridRefusalSentence(refusal, fieldName, messages) {
7
- const reason = wordsOf(refusal.error);
7
+ const reason = refusalWords(refusal.error);
8
8
  if (refusal.count === 1) {
9
9
  return reason ?? messages({ key: "views.grid.commit-refused", values: { field: fieldName(refusal.columnIds[0]) } });
10
10
  }
@@ -1,11 +1,13 @@
1
1
  /**
2
2
  * Where each cell's writes stand, as the grid's states say it (`data-pending`, `data-invalid`): a write to it is
3
3
  * still in flight, and the latest one sent was refused. Both can hold at once: an older write still out while the
4
- * newest was refused. A cell with neither is absent, and a row with no such cell is absent.
4
+ * newest was refused. A cell with neither is absent, and a row with no such cell is absent. `reason` is the refusal's
5
+ * own words, while it is invalid and the app gave some: the cell's title and accessible description.
5
6
  */
6
7
  export type GridWriteState = {
7
8
  readonly pending: boolean;
8
9
  readonly invalid: boolean;
10
+ readonly reason?: string;
9
11
  };
10
12
  /** By record id, then column id. A row with none is absent. */
11
13
  export type GridWriteStateByRow = ReadonlyMap<string, Readonly<Record<string, GridWriteState>>>;
@@ -1,4 +1,4 @@
1
- const sameState = (a, b) => a == null ? b == null : b != null && a.pending === b.pending && a.invalid === b.invalid;
1
+ const sameState = (a, b) => a == null ? b == null : b != null && a.pending === b.pending && a.invalid === b.invalid && a.reason === b.reason;
2
2
  export function setGridWriteStates(byRow, cells) {
3
3
  let next = null;
4
4
  for (const { rowId, columnId, state } of cells) {
@@ -9,7 +9,11 @@ export function setGridWriteStates(byRow, cells) {
9
9
  next ??= new Map(byRow);
10
10
  const record = { ...current };
11
11
  if (given)
12
- record[columnId] = { pending: given.pending, invalid: given.invalid };
12
+ record[columnId] = {
13
+ pending: given.pending,
14
+ invalid: given.invalid,
15
+ ...(given.invalid && given.reason !== undefined ? { reason: given.reason } : {}),
16
+ };
13
17
  else
14
18
  delete record[columnId];
15
19
  if (Object.keys(record).length > 0)
@@ -116,7 +116,7 @@
116
116
  display: none;
117
117
  }
118
118
 
119
- /* A body over its cell (gridBodyPlace) has its own edge: while the grid's editor part holds ViewKit's Picker, Compound editor,
119
+ /* A body over its cell has its own edge: while the grid's editor part holds ViewKit's Picker, Compound editor,
120
120
  Values editor or Date editor, the cell being edited under it shows no outline, so the brand's line never peeks out under the
121
121
  body's rounded corners. The grid's own editors keep it. */
122
122
  :root:has([data-slot="vk-grid-editor"] [data-kit="picker"], [data-slot="vk-grid-editor"] [data-kit="compound-editor"], [data-slot="vk-grid-editor"] [data-kit="values-editor"], [data-slot="vk-grid-editor"] [data-kit="date-editor"]) [data-slot="vk-grid-cell"][data-editing] [data-slot="vk-grid-outline"] {
@@ -1,34 +1,2 @@
1
- /** Who sets the width and padding of the popover around a whole body your app hands: ViewKit (`views`, the default) or
2
- * your `Popover` (`popover`). */
3
- export type ViewsBodyFrame = "views" | "popover";
4
- /** Where a grid editor opens the popover around a whole body your app hands: 4px under the cell (`under`, the default)
5
- * or with its top on the cell's top (`over`). */
6
- export type ViewsGridBodyPlace = "under" | "over";
7
1
  /** Which of the app's whole bodies an editor opens: its `Picker`, its `PartsBody`, its `ValuesBody` or its `LinksBody`. */
8
2
  export type ViewsBodyKind = "picker" | "parts" | "values" | "links";
9
- /** Which of the app's whole bodies a grid editor opens: one with a frame (`ViewsBodyKind`), or its `DateBody`, which
10
- * has none. */
11
- export type ViewsBodySlot = ViewsBodyKind | "date";
12
- /** The components map's body slots, as far as whether one was handed. */
13
- type BodySlots = {
14
- Picker?: unknown;
15
- PartsBody?: unknown;
16
- ValuesBody?: unknown;
17
- LinksBody?: unknown;
18
- DateBody?: unknown;
19
- };
20
- /** Whether the app handed the body this slot names. The panel's width and frame and a grid popover's place both read
21
- * it, so the two can't disagree about one body. */
22
- export declare function bodyHanded(components: BodySlots, slot: ViewsBodySlot): boolean;
23
- /**
24
- * The class and the data a host hands its popover. `body` is the app's body the editor opens, or null when it draws
25
- * ViewKit's own; `viewkit` is ViewKit's width and padding, `kept` what isn't look (the layer, a screen cap). At
26
- * `popover` with a body, only `kept` and the mark `data-vk-body`; otherwise today's classes and no mark.
27
- */
28
- export declare function bodyPanel(frame: ViewsBodyFrame | undefined, body: ViewsBodyKind | null, viewkit: string, kept: string): {
29
- className: string;
30
- data: {
31
- "data-vk-body"?: ViewsBodyKind;
32
- };
33
- };
34
- export {};
@@ -1,15 +1 @@
1
- const SLOT_KEYS = {
2
- picker: "Picker",
3
- parts: "PartsBody",
4
- values: "ValuesBody",
5
- links: "LinksBody",
6
- date: "DateBody",
7
- };
8
- export function bodyHanded(components, slot) {
9
- return !!components[SLOT_KEYS[slot]];
10
- }
11
- export function bodyPanel(frame, body, viewkit, kept) {
12
- if (frame === "popover" && body)
13
- return { className: kept, data: { "data-vk-body": body } };
14
- return { className: `${viewkit} ${kept}`, data: {} };
15
- }
1
+ export {};
@@ -18,11 +18,11 @@ export declare function isLongTextColumn<Row>(col: ListColumn<Row>): boolean;
18
18
  /** Whether a cell opens a PANEL to be READ, whatever its write state. */
19
19
  export declare function gridColumnInspectable<Row>(col: ListColumn<Row>): boolean;
20
20
  /** A text that opens WHOLE in the panel when the cell cuts it off: plain text, and a name that is
21
- * text (not a person's name, which edits in its own boxes). Links, emails, phones and domains keep
21
+ * text (not a person's name, which edits in the app's parts body). Links, emails, phones and domains keep
22
22
  * their one-line box, which grows to fit what is typed in it. Whether it IS cut off is the cell's to
23
23
  * measure (`gridCellCutOff`). */
24
24
  export declare function isWholeTextColumn<Row>(col: ListColumn<Row>): boolean;
25
- /** Whether an open text cell is drawn in the panel over the cell rather than in the cell: a
26
- * paragraph always, a line when it opened `whole` (cut off when it was opened). `inCell`: an app's text body is
27
- * handed and the cell is writable: the body stands in the cell, so nothing opens the panel. */
28
- export declare function gridTextOpensBox<Row>(col: ListColumn<Row>, whole: boolean, inCell?: boolean): boolean;
25
+ /** Whether an open text cell is drawn in the read-only panel over the cell rather than in the cell. A writable cell
26
+ * never is: the app's text body stands in the cell. A read-only one is when it is a paragraph, or a line that opened
27
+ * `whole` (cut off when it was opened). `writable` defaults to false, as the argument it replaced (`inCell`) did. */
28
+ export declare function gridTextOpensBox<Row>(col: ListColumn<Row>, whole: boolean, writable?: boolean): boolean;
@@ -10,8 +10,8 @@ export function isWholeTextColumn(col) {
10
10
  return !col.format?.long;
11
11
  return col.type === "title" && !(col.field && valueTypeOf(col.field) === "name");
12
12
  }
13
- export function gridTextOpensBox(col, whole, inCell = false) {
14
- if (inCell)
13
+ export function gridTextOpensBox(col, whole, writable = false) {
14
+ if (writable)
15
15
  return false;
16
16
  return isLongTextColumn(col) || (whole && isWholeTextColumn(col));
17
17
  }
@@ -10,15 +10,6 @@ export declare function groupBodyValue(group: GroupConfig): ViewsGroupValue;
10
10
  export declare function groupBodyWrite(group: GroupConfig, next: ViewsGroupValue): (() => void) | null;
11
11
  /** What a `GroupBody` is handed, its chrome (`form`, `onDone`, `actions`) aside: a Customize body's `group` too. */
12
12
  export declare function groupBodyProps(group: GroupConfig, messages: ViewsMessageResolver): Omit<ViewsGroupBodyProps, "form" | "onDone" | "actions">;
13
- /** Whether a list's filter is only per-field values (a field's values, a time scope, a date range) with no filter tree:
14
- * a Customize body has no data shape for those, so such a list keeps ViewKit's own Customize even where the app hands
15
- * one. */
16
- export declare function perFieldFiltersOnly({ filters, filterTree, timeScopeConfig, dateRangeConfigs, }: {
17
- filters?: readonly unknown[];
18
- filterTree?: unknown;
19
- timeScopeConfig?: unknown;
20
- dateRangeConfigs?: readonly unknown[];
21
- }): boolean;
22
13
  /** ViewKit's page as a Customize body's: a page under a section is that section's. */
23
14
  export declare function customizePageOf(panel: ActivePanel): ViewsCustomizePage;
24
15
  /** A Customize body's page as ViewKit's: its list is no page; Filter is the folded Filter page. */
@@ -36,7 +27,7 @@ export declare function columnsBodyWrite(columns: LayoutColumnsConfig, next: rea
36
27
  id: string;
37
28
  hidden: boolean;
38
29
  }[], messages: ViewsMessageResolver): (() => void) | null;
39
- /** The Columns section, where ViewKit's own Customize shows Columns (`columnsFor`, else the layout's sub-options):
30
+ /** The Columns section, where the layout in use has one (`columnsFor`, else the layout's sub-options):
40
31
  * the columns with a card's new lines on a layout that lays fields out on a card, Reset while they differ from the
41
32
  * view, and the field editor's rows. */
42
33
  export declare function customizeColumnsOf(layout: LayoutConfig, fieldEditor: PanelFieldEditor | null | undefined, messages: ViewsMessageResolver): ViewsCustomizeColumns | undefined;
@@ -92,9 +92,6 @@ export function groupBodyProps(group, messages) {
92
92
  onGroupChange: (next) => groupBodyWrite(group, next)?.(),
93
93
  };
94
94
  }
95
- export function perFieldFiltersOnly({ filters, filterTree, timeScopeConfig, dateRangeConfigs, }) {
96
- return !filterTree && ((filters?.length ?? 0) > 0 || !!timeScopeConfig || (dateRangeConfigs?.length ?? 0) > 0);
97
- }
98
95
  export function customizePageOf(panel) {
99
96
  switch (panel?.type) {
100
97
  case "layout":
@@ -4,10 +4,6 @@ import { useRef, useState } from "react";
4
4
  import { cx } from "../../internal/cx.js";
5
5
  import { useViews } from "../../provider/context.js";
6
6
  import { drawPanelButton } from "../panel-button.js";
7
- const LOOKS = {
8
- sentence: "inline-flex items-center gap-1 whitespace-nowrap text-sm font-medium text-(color:--vk-fg)",
9
- field: "flex h-8 w-full items-center justify-between gap-1 whitespace-nowrap rounded-lg border border-(color:--vk-border) px-2.5 text-sm text-(color:--vk-fg)",
10
- };
11
7
  const FRAMES = {
12
8
  sentence: "h-auto gap-1 whitespace-nowrap p-0",
13
9
  field: "h-8 w-full justify-between gap-1 whitespace-nowrap px-2.5",
@@ -22,7 +18,6 @@ export function MenuSelect({ value, options, onChange, label, look, className, }
22
18
  const openAtPress = useRef(null);
23
19
  const chosen = options.find((option) => option.value === value)?.label ?? value;
24
20
  return (_jsxs(_Fragment, { children: [drawPanelButton(views, {
25
- own: cx(LOOKS[look], className),
26
21
  frame: cx(FRAMES[look], className),
27
22
  variant: look === "sentence" ? "ghost" : "outline",
28
23
  size: "sm",
@@ -62,7 +62,6 @@ export function RangeFilterBody({ filter, rowClassName, rowBorderClassName, labe
62
62
  commit(a, b, op.value);
63
63
  }, className: cx(rowClassName, index > 0 && rowBorderClassName), labelClassName: labelClassName, checkClassName: checkClassName }, op.value)));
64
64
  return (_jsxs(_Fragment, { children: [filter.presets?.length ? (_jsx("div", { "data-vs-inset": true, className: cx("flex flex-wrap gap-1.5", fieldClassName ?? PRESETS_PADDING), children: filter.presets.map((p) => (_jsx(Fragment, { children: drawPanelButton(views, {
65
- own: "rounded-md border border-(color:--vk-border) px-2 py-0.5 text-xs text-(color:--vk-fg) hover:bg-(color:--vk-hovered)",
66
65
  frame: "h-auto px-2 py-0.5",
67
66
  variant: "outline",
68
67
  size: "sm",
@@ -1,5 +1,5 @@
1
1
  import { type FilterConfig } from "../../filters/filter-model.js";
2
- import { type DateRangeConfig, type ToggleConfig } from "../model.js";
2
+ import { type DateRangeConfig } from "../model.js";
3
3
  export declare function CompactFilterDetail<T extends string>({ filter, onOpenField, onConverted, }: {
4
4
  filter: FilterConfig<T>;
5
5
  /** A relation's Where row opens its far field one level down (POR-704). */
@@ -9,10 +9,6 @@ export declare function CompactFilterDetail<T extends string>({ filter, onOpenFi
9
9
  * phone (VK-531). */
10
10
  onConverted?: () => void;
11
11
  }): import("react/jsx-runtime").JSX.Element;
12
- export declare function CompactToggleDetail({ toggle, onBack, }: {
13
- toggle: ToggleConfig;
14
- onBack: () => void;
15
- }): import("react/jsx-runtime").JSX.Element;
16
12
  /** A `Date` as the month's ISO day, and back, on the local calendar. */
17
13
  export declare const dayOf: (date: Date | null) => string | null;
18
14
  export declare const dateOf: (key: string | null) => Date | null;
@@ -36,7 +36,6 @@ function FilterDetailBody({ filter, onOpenField, }) {
36
36
  }
37
37
  if (isUnavailableFilter(filter)) {
38
38
  return (_jsxs("div", { "data-vs-detail": true, className: "space-y-3 px-3 py-3 text-sm text-(color:--vk-fg-subtle)", children: [_jsx("p", { children: filter.reason }), filter.stale && (drawPanelButton(views, {
39
- own: "font-medium text-(color:--vk-fg-brand)",
40
39
  frame: "h-auto p-0",
41
40
  variant: "ghost",
42
41
  size: "sm",
@@ -72,17 +71,6 @@ function FilterDetailBody({ filter, onOpenField, }) {
72
71
  const hideAllOption = filter.hideAllOption ?? false;
73
72
  return (_jsxs("div", { "data-vs-detail": true, className: cx("max-h-64", PANEL_SCROLL), children: [!hideAllOption && (_jsx(RadioRow, { mark: "box", selected: filter.value === allValue, label: filter.allLabel ?? messages({ key: "views.panels.filter-all-of", values: { field: filter.label } }), onClick: () => filter.onChange(allValue) })), filter.options.map((opt) => (_jsx(RadioRow, { mark: "box", selected: filter.value === opt.value, label: opt.label, onClick: () => filter.onChange(opt.value) }, opt.value)))] }));
74
73
  }
75
- export function CompactToggleDetail({ toggle, onBack, }) {
76
- const { atoms, messages } = useViews();
77
- const { RadioRow } = atoms;
78
- return (_jsxs("div", { "data-vs-detail": true, className: cx("max-h-64", PANEL_SCROLL), children: [_jsx(RadioRow, { mark: "box", selected: toggle.value === true, label: messages({ key: "views.panels.toggle-on" }), onClick: () => {
79
- toggle.onChange(true);
80
- onBack();
81
- } }), _jsx(RadioRow, { mark: "box", selected: toggle.value === false, label: messages({ key: "views.panels.toggle-off" }), onClick: () => {
82
- toggle.onChange(false);
83
- onBack();
84
- } })] }));
85
- }
86
74
  export const dayOf = (date) => (date ? toDayKey(date) : null);
87
75
  export const dateOf = (key) => (key ? fromDayKey(key) : null);
88
76
  export function CompactDateRangeDetail({ dateRangeConfig }) {
@@ -90,7 +78,6 @@ export function CompactDateRangeDetail({ dateRangeConfig }) {
90
78
  const { atoms, conventions, messages } = views;
91
79
  const { from, to } = dateRangeConfig.value;
92
80
  return (_jsx(atoms.RangeCalendar, { mode: "range", from: dayOf(from), to: dayOf(to), locale: conventions.locale, onSelect: (next) => dateRangeConfig.onChange({ from: dateOf(next.from), to: dateOf(next.to) }), footer: isDateRangeActive(dateRangeConfig) ? (_jsx("div", { className: "flex justify-end", children: drawPanelButton(views, {
93
- own: "text-xs text-(color:--vk-fg-subtle) hover:text-(color:--vk-fg) transition-colors",
94
81
  frame: "h-auto p-0",
95
82
  variant: "ghost",
96
83
  size: "sm",
@@ -16,7 +16,6 @@ export declare const PANEL_SCROLL = "overflow-y-auto overscroll-contain p-(--vk-
16
16
  export declare function FilterSectionHeading({ children }: {
17
17
  children: string;
18
18
  }): import("react/jsx-runtime").JSX.Element;
19
- export declare function dimensionRows<S extends string, G extends string, T extends string>(filters: ViewOptionInputs<S, G, T>["filters"], timeScopeConfig: ViewOptionInputs<S, G, T>["timeScopeConfig"], dateRangeConfigs: ViewOptionInputs<S, G, T>["dateRangeConfigs"], onOpenPanel: (p: ActivePanel) => void): import("react/jsx-runtime").JSX.Element;
20
19
  /** The consolidated Filter drill-in — the same dimension rows, one level down. */
21
20
  export declare function CompactFilterList<S extends string, G extends string, T extends string>({ filters, timeScopeConfig, dateRangeConfigs, onOpenPanel, }: Pick<ViewOptionInputs<S, G, T>, "filters" | "timeScopeConfig" | "dateRangeConfigs"> & {
22
21
  onOpenPanel: (p: ActivePanel) => void;
@@ -26,7 +26,7 @@ function DateRangeRows({ configs, onOpenPanel, }) {
26
26
  const Calendar = icons.date;
27
27
  return (_jsx(_Fragment, { children: configs.map((d) => (_jsx(atoms.MenuRow, { icon: _jsx(Calendar, { className: "h-3.5 w-3.5" }), label: d.label ?? messages({ key: "views.panels.date-range-label" }), value: dateRangeValueLabel(d, messages, conventions), active: isDateRangeActive(d), onClick: () => onOpenPanel({ type: "dateRange", key: d.key }) }, d.key))) }));
28
28
  }
29
- export function dimensionRows(filters, timeScopeConfig, dateRangeConfigs, onOpenPanel) {
29
+ function dimensionRows(filters, timeScopeConfig, dateRangeConfigs, onOpenPanel) {
30
30
  const plain = (filters ?? []).filter((f) => !f.section);
31
31
  const sections = filterSectionNames(filters);
32
32
  return (_jsxs(_Fragment, { children: [plain.map((f) => (_jsx(FilterRow, { filter: f, onOpenPanel: onOpenPanel }, f.key))), sections.map((section) => (_jsxs("div", { children: [_jsx(FilterSectionHeading, { children: section }), (filters ?? [])
@@ -1,11 +1,9 @@
1
1
  import type { MouseEvent as ReactMouseEvent, ReactElement, ReactNode, Ref } from "react";
2
2
  import type { ViewsContextValue } from "../provider/context.js";
3
- /** What a panel's button reads from the provider: the app's `Button` and who draws. */
4
- export type PanelButtonViews = Pick<ViewsContextValue, "components" | "panelButtons">;
3
+ /** What a panel's button reads from the provider: the app's `Button`. */
4
+ export type PanelButtonViews = Pick<ViewsContextValue, "components">;
5
5
  /** One button a panel draws itself, as each of its places describes it. */
6
6
  export type PanelButtonDraw = {
7
- /** Today's classes, without `ELEMENT_RESET`: drawn on ViewKit's own `<button>`. */
8
- own: string;
9
7
  /** The box ViewKit keeps on the app's `Button`: its size, its place. The look is the app's. */
10
8
  frame: string;
11
9
  variant: "ghost" | "outline" | "secondary";
@@ -21,15 +19,15 @@ export type PanelButtonDraw = {
21
19
  "aria-selected"?: boolean;
22
20
  "data-slot"?: string;
23
21
  "data-state"?: "open" | "closed";
24
- /** An actions row a host's inset well sizes: on ViewKit's button and on the app's alike, never a wrapper. */
22
+ /** An actions row a host's inset well sizes: on the app's button itself, never a wrapper. */
25
23
  "data-vs-row"?: boolean;
26
- /** A press noted before its click: on ViewKit's button, on a `display: contents` span around the app's. */
24
+ /** A press noted before its click: on a `display: contents` span around the app's button. */
27
25
  onPointerDown?: () => void;
28
26
  onPointerDownCapture?: () => void;
29
- /** The search's ✕ keeps the field's caret: on ViewKit's button, on a `display: contents` span around the app's. */
27
+ /** The search's ✕ keeps the field's caret: on a `display: contents` span around the app's button. */
30
28
  onMouseDown?: (event: ReactMouseEvent<HTMLElement>) => void;
31
- /** A reveal on hover on a computer: `data-desktop` on ViewKit's button (its classes already in `own`); around the
32
- * app's, a span carrying `data-desktop`, `data-state` and these classes. */
29
+ /** A reveal on hover on a computer: a span around the app's button carrying `data-desktop`, `data-state` and these
30
+ * classes. */
33
31
  reveal?: {
34
32
  desktop: boolean;
35
33
  classes: string;
@@ -38,10 +36,10 @@ export type PanelButtonDraw = {
38
36
  children: ReactNode;
39
37
  };
40
38
  /**
41
- * Draws a button a panel draws itself: ViewKit's own `<button>` by default (the provider's `panelButtons` is `own`),
42
- * exactly as on 0.6.0, or the app's `Button` with `panelButtons: "button"`. A plain function, never a hook.
39
+ * Draws a button a panel draws itself: the app's `Button`, handed the panel's box in its class. A plain function,
40
+ * never a hook.
43
41
  */
44
- export declare function drawPanelButton(views: PanelButtonViews, { own, frame, variant, size, onPointerDown, onPointerDownCapture, onMouseDown, reveal, children, ...props }: PanelButtonDraw): ReactElement;
42
+ export declare function drawPanelButton(views: PanelButtonViews, { frame, variant, size, onPointerDown, onPointerDownCapture, onMouseDown, reveal, children, ...props }: PanelButtonDraw): ReactElement;
45
43
  /** `drawPanelButton` as a component, for a place that draws it on one branch of a choice (VK-621): a ref handed in its
46
44
  * `draw` reaches the button as JSX props do. */
47
45
  export declare function PanelButton({ views, draw }: {
@@ -1,11 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { cx } from "../internal/cx.js";
4
- import { ELEMENT_RESET } from "../internal/reset.js";
5
- export function drawPanelButton(views, { own, frame, variant, size, onPointerDown, onPointerDownCapture, onMouseDown, reveal, children, ...props }) {
6
- if (views.panelButtons !== "button") {
7
- return (_jsx("button", { type: "button", ...props, "data-desktop": reveal?.desktop ? "" : undefined, onPointerDown: onPointerDown, onPointerDownCapture: onPointerDownCapture, onMouseDown: onMouseDown, className: cx(ELEMENT_RESET, own), children: children }));
8
- }
3
+ export function drawPanelButton(views, { frame, variant, size, onPointerDown, onPointerDownCapture, onMouseDown, reveal, children, ...props }) {
9
4
  const { Button } = views.components;
10
5
  let drawn = (_jsx(Button, { type: "button", variant: variant, size: size, className: frame, ...props, children: children }));
11
6
  if (onPointerDown || onPointerDownCapture || onMouseDown) {
@@ -1,20 +1,3 @@
1
1
  /** A panel's list that scrolls: its inset (`--vk-panel-padding`), its own scroll, and the bounce kept from
2
2
  * dragging the page behind it. Its height cap is the caller's: `cx("max-h-64", PANEL_LIST_CLASS)`. */
3
3
  export declare const PANEL_LIST_CLASS = "overflow-y-auto overscroll-contain p-(--vk-panel-padding,0.375rem)";
4
- /** The hairline between two runs of rows, as far off a row as the list's inset keeps it from the edge. */
5
- export declare const PANEL_SEPARATOR_CLASS = "-mx-1 my-1.5 h-px bg-(color:--vk-border)";
6
- /** A row richer than a menu item (a grip, an eye, a switch): the panel row's inset, radius, gutter and hover. */
7
- export declare const PANEL_ROW_CLASS = "flex w-full items-center gap-2.5 rounded-lg px-2 py-1.5 text-left transition-colors hover:bg-(color:--vk-hovered)";
8
- /** The phone sheet's taller row (a list's `comfortable` variant), without its ground: the ground is
9
- * `SHEET_ROW_GROUND_CLASS` at rest and `DRAGGING_CLASS` while dragged, never both. */
10
- export declare const SHEET_ROW_CLASS = "w-full flex items-center gap-2.5 px-4 py-2.5 text-left transition-colors";
11
- export declare const SHEET_ROW_GROUND_CLASS = "bg-(color:--vk-neutral) active:bg-(color:--vk-pressed)";
12
- /** A row while it is dragged: lifted over its neighbours on the panel's own ground. */
13
- export declare const DRAGGING_CLASS = "z-50 bg-(color:--vk-overlay) shadow-lg";
14
- /** The rule over a labelled section of a panel. */
15
- export declare const SECTION_RULE_CLASS = "my-1 border-t border-solid border-(color:--vk-border)";
16
- /** A section's label: small capitals in the quietest colour. */
17
- export declare const SECTION_HEADING_CLASS = "px-3 pt-1.5 pb-1 text-(length:--vk-caption-text,10px) font-bold uppercase tracking-(--vk-caps-tracking,0.15em) text-(color:--vk-fg-subtlest)";
18
- /** A set-aside rule's or sort's field box: dashed in the warning colour, as the toolbar button's `aside` draws it
19
- * (`atoms/ToolbarButton.tsx`), its fallback where an app declares no `--vk-warning`. */
20
- export declare const ASIDE_CLASS = "border border-dashed border-[color:var(--vk-warning,hsl(38_92%_50%))] text-[color:var(--vk-warning,hsl(38_92%_50%))]";
@@ -1,9 +1 @@
1
1
  export const PANEL_LIST_CLASS = "overflow-y-auto overscroll-contain p-(--vk-panel-padding,0.375rem)";
2
- export const PANEL_SEPARATOR_CLASS = "-mx-1 my-1.5 h-px bg-(color:--vk-border)";
3
- export const PANEL_ROW_CLASS = "flex w-full items-center gap-2.5 rounded-lg px-2 py-1.5 text-left transition-colors hover:bg-(color:--vk-hovered)";
4
- export const SHEET_ROW_CLASS = "w-full flex items-center gap-2.5 px-4 py-2.5 text-left transition-colors";
5
- export const SHEET_ROW_GROUND_CLASS = "bg-(color:--vk-neutral) active:bg-(color:--vk-pressed)";
6
- export const DRAGGING_CLASS = "z-50 bg-(color:--vk-overlay) shadow-lg";
7
- export const SECTION_RULE_CLASS = "my-1 border-t border-solid border-(color:--vk-border)";
8
- export const SECTION_HEADING_CLASS = "px-3 pt-1.5 pb-1 text-(length:--vk-caption-text,10px) font-bold uppercase tracking-(--vk-caps-tracking,0.15em) text-(color:--vk-fg-subtlest)";
9
- export const ASIDE_CLASS = "border border-dashed border-[color:var(--vk-warning,hsl(38_92%_50%))] text-[color:var(--vk-warning,hsl(38_92%_50%))]";