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,5 +1,5 @@
1
1
  "use client";
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
4
4
  import { parseNumber, roundTo, } from "viewkitjs/fields";
5
5
  import { durationUnitToMs, formatDurationInput, msToDurationUnit, parseDurationInput, } from "viewkitjs/fields/query";
@@ -7,20 +7,15 @@ import { cx } from "../internal/cx.js";
7
7
  import { BodyFrame } from "./BodyFrame.js";
8
8
  import { useBodyStep } from "./body-step.js";
9
9
  import { numberBodyKind, numberChange, resolveNumberBody } from "./number-body.js";
10
- import { openingNumberText, stepDelta, stepKey, steppedNumber, writeStep } from "./number-step.js";
11
- import { ELEMENT_RESET } from "../internal/reset.js";
10
+ import { openingNumberText } from "./number-step.js";
12
11
  import { useViews } from "../provider/context.js";
13
12
  const EVERY_VALUE_READS = () => null;
14
- export const NumberEditor = forwardRef(function NumberEditor({ boxClassName, initial, seed, unit, unitOptions, code, decimals = 2, durationUnit, allowEmpty = false, unitLeft = false, align = "end", conventions, type = "number", label, min, max, check, escapeKeeps = false, closeOnBlur = true, form = "computer", onRequestClose, }, ref) {
13
+ export const NumberEditorHost = forwardRef(function NumberEditorHost({ boxClassName, initial, seed, unit, unitOptions, code, decimals = 2, durationUnit, allowEmpty = false, align = "end", conventions, type = "number", label, min, max, check, escapeKeeps = false, closeOnBlur = true, form = "computer", onRequestClose, }, ref) {
15
14
  const inputRef = useRef(null);
16
- const chipRef = useRef(null);
17
- const [currentUnit, setCurrentUnit] = useState(unit);
18
- const [unitOpen, setUnitOpen] = useState(false);
19
15
  const views = useViews();
20
16
  const cv = conventions ?? views.conventions;
21
- const { Popover, Input } = views.components;
17
+ const { Input } = views.components;
22
18
  const NumberBody = durationUnit ? undefined : views.components.NumberBody;
23
- const { List, Row } = views.atoms;
24
19
  const onStepChange = useBodyStep();
25
20
  useEffect(() => {
26
21
  const el = inputRef.current;
@@ -54,16 +49,16 @@ export const NumberEditor = forwardRef(function NumberEditor({ boxClassName, ini
54
49
  if (raw.trim() === "") {
55
50
  if (!allowEmpty)
56
51
  return { kind: "cancel" };
57
- if (!Number.isFinite(initial) && currentUnit === unit)
52
+ if (!Number.isFinite(initial))
58
53
  return { kind: "noop" };
59
- return { kind: "commit", payload: { value: null, unit: currentUnit } };
54
+ return { kind: "commit", payload: { value: null, unit } };
60
55
  }
61
56
  const parsed = parse(raw);
62
57
  if (parsed == null)
63
58
  return { kind: "cancel" };
64
- if (parsed === round(initial) && currentUnit === unit)
59
+ if (parsed === round(initial))
65
60
  return { kind: "noop" };
66
- return { kind: "commit", payload: { value: parsed, unit: currentUnit } };
61
+ return { kind: "commit", payload: { value: parsed, unit } };
67
62
  };
68
63
  const opening = () => ({
69
64
  value: seed === undefined ? (Number.isFinite(initial) ? round(initial) : null) : (parse(seed) ?? Number.NaN),
@@ -89,40 +84,18 @@ export const NumberEditor = forwardRef(function NumberEditor({ boxClassName, ini
89
84
  ? (value, next) => check(value == null || !Number.isFinite(value) ? value : round(value), next !== undefined && units?.includes(next) ? next : draftRef.current.unit)
90
85
  : EVERY_VALUE_READS, decimals: decimals, ...(min !== undefined ? { min } : {}), ...(max !== undefined ? { max } : {}), locale: cv.locale, ...(cv.decimal ? { decimal: cv.decimal } : {}), empty: allowEmpty, align: align, ...(seed !== undefined ? { typed: seed } : {}), autoFocus: true, form: form, ...(onStepChange && { onStepChange }) }) }));
91
86
  }
92
- return (_jsxs("span", { className: "flex h-full w-full min-w-0 items-center gap-1.5", children: [_jsx(Input, { ref: inputRef, defaultValue: seed ?? initialText, inputMode: durationUnit ? "text" : "decimal", onKeyDown: (e) => {
93
- e.stopPropagation();
94
- const delta = durationUnit ? null : stepDelta(stepKey(e));
95
- if (delta != null) {
96
- e.preventDefault();
97
- const box = e.currentTarget;
98
- const current = box.value.trim() === "" ? null : parse(box.value);
99
- if (current == null && box.value.trim() !== "")
100
- return;
101
- const next = steppedNumber(current, delta, { decimals, min, max });
102
- writeStep(box, openingNumberText(next, decimals, cv));
103
- return;
104
- }
105
- if (e.key === "Enter") {
106
- e.preventDefault();
107
- onRequestClose("enter");
108
- }
109
- else if (e.key === "Escape") {
110
- onRequestClose("escape");
111
- }
112
- else if (e.key === "Tab") {
113
- e.preventDefault();
114
- onRequestClose(e.shiftKey ? "shift-tab" : "tab");
115
- }
116
- }, onBlur: () => {
117
- if (!unitOpen)
118
- onRequestClose("blur");
119
- }, onClick: (e) => e.stopPropagation(), className: cx("h-full min-w-0 select-text bg-transparent tabular-nums text-(length:--vk-text) text-(color:--vk-fg) outline-hidden", align === "start" ? "w-40 flex-initial text-left" : "w-full flex-1 text-right", boxClassName) }), (unit ?? code) &&
120
- (unit && unitOptions && unitOptions.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("button", { ref: chipRef, type: "button", tabIndex: -1, onMouseDown: (e) => e.preventDefault(), onClick: (e) => {
121
- e.stopPropagation();
122
- setUnitOpen((o) => !o);
123
- }, className: cx(ELEMENT_RESET, "shrink-0 text-xs font-normal text-(color:--vk-fg-subtle) transition-colors hover:text-(color:--vk-fg)", unitLeft && "order-first"), children: currentUnit }), _jsx(Popover, { open: unitOpen, onOpenChange: (next) => setUnitOpen(next), anchor: chipRef, side: "bottom", align: unitLeft ? "start" : "end", sideOffset: 6, initialFocus: false, onOutsidePress: (event) => (chipRef.current?.contains(event.target) ? false : undefined), onPanelClick: (e) => e.stopPropagation(), chrome: "menu", className: "w-24", children: _jsx(List, { children: unitOptions.map((u) => (_jsx(Row, { label: u, chosen: u === currentUnit, onMouseDown: (e) => e.preventDefault(), onClick: () => {
124
- setCurrentUnit(u);
125
- setUnitOpen(false);
126
- inputRef.current?.focus();
127
- } }, u))) }) })] })) : (_jsx("span", { className: cx("shrink-0 text-xs font-normal text-(color:--vk-fg-subtlest)", unitLeft && "order-first"), children: unit ?? code })))] }));
87
+ return (_jsx("span", { className: "flex h-full w-full min-w-0 items-center gap-1.5", children: _jsx(Input, { ref: inputRef, defaultValue: seed ?? initialText, inputMode: "text", onKeyDown: (e) => {
88
+ e.stopPropagation();
89
+ if (e.key === "Enter") {
90
+ e.preventDefault();
91
+ onRequestClose("enter");
92
+ }
93
+ else if (e.key === "Escape") {
94
+ onRequestClose("escape");
95
+ }
96
+ else if (e.key === "Tab") {
97
+ e.preventDefault();
98
+ onRequestClose(e.shiftKey ? "shift-tab" : "tab");
99
+ }
100
+ }, onBlur: () => onRequestClose("blur"), onClick: (e) => e.stopPropagation(), className: cx("h-full min-w-0 select-text bg-transparent tabular-nums text-(length:--vk-text) text-(color:--vk-fg) outline-hidden", align === "start" ? "w-40 flex-initial text-left" : "w-full flex-1 text-right", boxClassName) }) }));
128
101
  });
@@ -1,51 +1,27 @@
1
1
  import { type CloseReason, type CloseResolution, type FieldConventions, type RangePreset, type RangeValue } from "viewkitjs/fields";
2
2
  /**
3
- * A RANGE — two number boxes, low and high, inline like the number core. Tab
4
- * moves from low to high inside the editor; a blur that lands on the other box
5
- * is not a close. An empty box is an open end; two empty boxes are a clear,
6
- * committed only when the host allows one.
3
+ * A RANGE — two ends, low and high, drawn by the app's `PartsBody` (`CONTROLS.PartsBody` is ViewKit's own). An empty
4
+ * end is an open end; two empty ends are a clear, committed only when the host allows one.
7
5
  *
8
- * A field that names its bands (`presets`, such as a company's 1–10 or 11–50
9
- * people) lists them under the boxes: on the desktop in a small menu that opens
10
- * with the editor, in a sheet or a panel in the editor's own column. A click on a
11
- * band writes its two ends into the boxes and closes as a pick, so the band is
12
- * read, compared and judged exactly as typed ends are. The boxes stay, so a value
13
- * between bands is still typed.
14
- *
15
- * With bands listed, the editor draws its host's refusal itself, between the
16
- * boxes and the bands (atop the menu, or above the list below), so the bands
17
- * never cover the reason or push it away from the boxes it is about.
6
+ * A field that names its bands (`presets`, such as a company's 1–10 or 11–50 people) hands them to the body, which
7
+ * lists them; a band chosen writes its two ends and closes as a pick, so the band is read, compared and judged exactly
8
+ * as typed ends are. The body draws no refusal: the host's panel draws it.
18
9
  */
19
10
  export type RangeEditorHandle = {
20
11
  resolveClose: (reason: CloseReason) => CloseResolution<RangeValue>;
21
12
  };
22
13
  export declare const RangeEditor: import("react").ForwardRefExoticComponent<{
23
14
  initial: RangeValue | null;
24
- /** Type-to-replace: the character that opened the editor replaces the low box. */
15
+ /** Type-to-replace: the character that opened the editor replaces the low end. */
25
16
  seed?: string;
26
17
  decimals?: number;
27
18
  allowEmpty?: boolean;
28
- /** A unit drawn after the high box: "%", a currency code. */
19
+ /** A unit drawn after the high end: "%", a currency code. */
29
20
  suffix?: string;
30
- align?: "start" | "end";
31
21
  conventions?: FieldConventions;
32
- /** The field's bands (`presets`): listed under the two boxes, and a click saves that band. */
22
+ /** The field's bands (`presets`): the body lists them, and choosing one saves that band. */
33
23
  bands?: readonly RangePreset[];
34
- /** Where the bands are listed. `popover` (the default): a small menu under the boxes, for an
35
- * editor typed where its value stands. `below`: in the editor's own column, for an editor
36
- * that already sits in a sheet or a panel. */
37
- bandsAt?: "popover" | "below";
38
- /** The host's reason for refusing the range typed or picked. With bands listed it is drawn here,
39
- * between the boxes and the bands, and the host draws none of its own; without bands the editor
40
- * draws nothing, and the host draws it as for any type-in. */
41
- refusal?: string | null;
42
- /** Classes for the box that holds the two inputs: the host's frame, such as a sheet's field. */
43
- boxClassName?: string;
44
- /** The field's name, for an app's `PartsBody`. Default: the two ends' words. */
24
+ /** The field's name, for the app's `PartsBody`. Default: the two ends' words. */
45
25
  label?: string;
46
- /** The lowest either end may hold, where the field says: a box steps no lower. */
47
- min?: number;
48
- /** The highest either end may hold, where the field says: a box steps no higher. */
49
- max?: number;
50
26
  onRequestClose: (reason: CloseReason) => void;
51
27
  } & import("react").RefAttributes<RangeEditorHandle>>;
@@ -1,38 +1,23 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState, } from "react";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { forwardRef, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
4
4
  import { parseNumber, roundTo, } from "viewkitjs/fields";
5
- import { cx } from "../internal/cx.js";
6
5
  import { useViews } from "../provider/context.js";
7
6
  import { BodyFrame } from "./BodyFrame.js";
8
7
  import { useBodyStep } from "./body-step.js";
9
8
  import { mergeParts, rangeBodyStart, resolveRangeBody } from "./parts-body.js";
10
- import { openingNumberText, stepDelta, stepKey, steppedNumber, writeStep } from "./number-step.js";
11
9
  import { usePickerForm } from "./picker-slot.js";
12
- export const RangeEditor = forwardRef(function RangeEditor({ initial, seed, decimals = 0, allowEmpty = false, suffix, align = "end", conventions, bands, bandsAt = "popover", refusal, boxClassName, label, min, max, onRequestClose, }, ref) {
10
+ export const RangeEditor = forwardRef(function RangeEditor({ initial, seed, decimals = 0, allowEmpty = false, suffix, conventions, bands, label, onRequestClose }, ref) {
13
11
  const views = useViews();
14
- const { Input, Popover, PartsBody } = views.components;
12
+ const { PartsBody } = views.components;
15
13
  const onStepChange = useBodyStep();
16
- const { List, Row } = views.atoms;
17
14
  const cv = conventions ?? views.conventions;
18
- const rootRef = useRef(null);
19
- const boxRef = useRef(null);
20
- const lowRef = useRef(null);
21
- const highRef = useRef(null);
22
- useEffect(() => {
23
- const el = lowRef.current;
24
- if (!el)
25
- return;
26
- el.focus({ preventScroll: true });
27
- el.setSelectionRange(el.value.length, el.value.length);
28
- }, []);
29
15
  const parse = (raw) => {
30
16
  if (raw.trim() === "")
31
17
  return null;
32
18
  const n = parseNumber(raw, cv);
33
19
  return n == null ? undefined : roundTo(n, decimals);
34
20
  };
35
- const text = (n) => n == null ? "" : openingNumberText(n, decimals, cv);
36
21
  const form = usePickerForm();
37
22
  const [bodyDraft, setBodyDraft] = useState(() => rangeBodyStart(initial, seed, parse));
38
23
  const bodyRef = useRef(bodyDraft);
@@ -41,85 +26,15 @@ export const RangeEditor = forwardRef(function RangeEditor({ initial, seed, deci
41
26
  useLayoutEffect(() => {
42
27
  shownRef.current = bodyValue;
43
28
  });
44
- const resolveClose = (reason) => {
45
- if (reason === "escape")
46
- return { kind: "cancel" };
47
- const low = parse(lowRef.current?.value ?? "");
48
- const high = parse(highRef.current?.value ?? "");
49
- if (low === undefined || high === undefined)
50
- return { kind: "cancel" };
51
- const shown = (n) => (n == null ? null : roundTo(n, decimals));
52
- if (low === shown(initial?.low) && high === shown(initial?.high))
53
- return { kind: "noop" };
54
- if (low === null && high === null && !allowEmpty)
55
- return { kind: "cancel" };
56
- return { kind: "commit", payload: { low, high } };
57
- };
58
29
  useImperativeHandle(ref, () => ({
59
- resolveClose: PartsBody
60
- ? (reason) => resolveRangeBody(reason, bodyRef.current, initial, decimals, allowEmpty)
61
- : resolveClose,
30
+ resolveClose: (reason) => resolveRangeBody(reason, bodyRef.current, initial, decimals, allowEmpty),
62
31
  }));
63
- const keys = (which) => (e) => {
64
- e.stopPropagation();
65
- const delta = stepDelta(stepKey(e));
66
- if (delta != null) {
67
- e.preventDefault();
68
- const box = e.currentTarget;
69
- const current = parse(box.value);
70
- if (current === undefined)
71
- return;
72
- writeStep(box, text(steppedNumber(current, delta, { decimals, min, max })));
73
- return;
74
- }
75
- if (e.key === "Enter") {
76
- e.preventDefault();
77
- onRequestClose("enter");
78
- }
79
- else if (e.key === "Escape") {
80
- onRequestClose("escape");
81
- }
82
- else if (e.key === "Tab") {
83
- e.preventDefault();
84
- if (which === "low" && !e.shiftKey)
85
- highRef.current?.focus();
86
- else if (which === "high" && e.shiftKey)
87
- lowRef.current?.focus();
88
- else
89
- onRequestClose(e.shiftKey ? "shift-tab" : "tab");
90
- }
91
- };
92
- const blur = (e) => {
93
- if (!rootRef.current?.contains(e.relatedTarget))
94
- onRequestClose("blur");
95
- };
96
- const pickBand = (band) => {
97
- if (lowRef.current)
98
- lowRef.current.value = text(band.low);
99
- if (highRef.current)
100
- highRef.current.value = text(band.high);
101
- onRequestClose("pick");
102
- };
103
- const held = (band) => {
104
- const at = (n) => (n == null ? null : roundTo(n, decimals));
105
- return initial != null && at(initial.low) === band.low && at(initial.high) === band.high;
32
+ const take = (next) => {
33
+ const current = bodyRef.current;
34
+ const merged = mergeParts({ low: current.low, high: current.high }, shownRef.current, next);
35
+ bodyRef.current = { low: merged.low, high: merged.high, unread: false };
36
+ setBodyDraft(bodyRef.current);
106
37
  };
107
- const bandList = bands && bands.length > 0 ? (_jsx(List, { children: bands.map((band) => (_jsx(Row, { label: band.label, chosen: held(band), onMouseDown: (e) => e.preventDefault(), onClick: () => pickBand(band) }, band.key))) })) : null;
108
- const input = cx("h-full w-16 min-w-0 shrink select-text bg-transparent tabular-nums text-(length:--vk-text) text-(color:--vk-fg) outline-hidden", align === "end" ? "text-right" : "text-left");
109
- const below = bandList !== null && bandsAt === "below";
110
- const reason = bandList !== null && refusal ? (_jsx("p", { role: "alert", "data-slot": "vk-editor-refusal", className: cx("text-xs text-(color:--vk-danger)", !below && "px-2 pb-1 pt-1.5"), children: refusal })) : null;
111
- if (PartsBody) {
112
- const take = (next) => {
113
- const current = bodyRef.current;
114
- const merged = mergeParts({ low: current.low, high: current.high }, shownRef.current, next);
115
- bodyRef.current = { low: merged.low, high: merged.high, unread: false };
116
- setBodyDraft(bodyRef.current);
117
- };
118
- return (_jsx(BodyFrame, { slot: "vk-parts-body", onRequestClose: onRequestClose, children: _jsx(PartsBody, { kind: "range", value: bodyValue, onValueChange: take, decimals: decimals, ...(suffix !== undefined ? { unit: suffix } : {}), ...(bands !== undefined ? { bands } : {}), label: label ??
119
- `${views.messages({ key: "views.editors.range-low" })} – ${views.messages({ key: "views.editors.range-high" })}`, onDone: (how) => onRequestClose(how === "pick" ? "pick" : "enter"), empty: allowEmpty, typed: seed, autoFocus: true, form: form, ...(onStepChange && { onStepChange }) }) }));
120
- }
121
- return (_jsxs("span", { ref: rootRef, onMouseDown: (e) => {
122
- if (!(e.target instanceof HTMLInputElement))
123
- e.preventDefault();
124
- }, className: below ? "flex w-full min-w-0 flex-col gap-1" : "contents", children: [_jsxs("span", { ref: boxRef, className: cx("flex h-full w-full min-w-0 items-center gap-1.5", align === "end" && "justify-end", boxClassName), children: [_jsx(Input, { ref: lowRef, defaultValue: seed ?? text(initial?.low), inputMode: "decimal", "aria-label": views.messages({ key: "views.editors.range-low" }), placeholder: views.messages({ key: "views.editors.range-low" }), onKeyDown: keys("low"), onBlur: blur, onClick: (e) => e.stopPropagation(), className: input }), _jsx("span", { className: "shrink-0 text-xs text-(color:--vk-fg-subtle)", children: "\u2013" }), _jsx(Input, { ref: highRef, defaultValue: text(initial?.high), inputMode: "decimal", "aria-label": views.messages({ key: "views.editors.range-high" }), placeholder: views.messages({ key: "views.editors.range-high" }), onKeyDown: keys("high"), onBlur: blur, onClick: (e) => e.stopPropagation(), className: input }), suffix && _jsx("span", { className: "shrink-0 text-xs text-(color:--vk-fg-subtlest)", children: suffix })] }), below && reason, below && bandList, bandList !== null && !below && (_jsxs(Popover, { open: true, onOpenChange: () => { }, anchor: boxRef, side: "bottom", align: align === "end" ? "end" : "start", sideOffset: 6, initialFocus: false, onPanelClick: (e) => e.stopPropagation(), chrome: "menu", className: "w-40", children: [reason, bandList] }))] }));
38
+ return (_jsx(BodyFrame, { slot: "vk-parts-body", onRequestClose: onRequestClose, children: _jsx(PartsBody, { kind: "range", value: bodyValue, onValueChange: take, decimals: decimals, ...(suffix !== undefined ? { unit: suffix } : {}), ...(bands !== undefined ? { bands } : {}), label: label ??
39
+ `${views.messages({ key: "views.editors.range-low" })} – ${views.messages({ key: "views.editors.range-high" })}`, onDone: (how) => onRequestClose(how === "pick" ? "pick" : "enter"), empty: allowEmpty, typed: seed, autoFocus: true, form: form, ...(onStepChange && { onStepChange }) }) }));
125
40
  });
@@ -1,22 +1,19 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { CloseReason, CloseResolution, FieldMessageResolver } from "viewkitjs/fields";
3
- import { type RelationCreate } from "./relation-panel.js";
3
+ import { type RelationCreate } from "./relation-picker.js";
4
4
  import type { RelationSource } from "./relation-source.js";
5
5
  export { RELATION_PAGE_SIZE, RELATION_SEARCH_DEBOUNCE_MS } from "./relation-source.js";
6
6
  export type { RelationCandidate, RelationSearch, RelationSource } from "./relation-source.js";
7
- export type { RelationCreate } from "./relation-panel.js";
7
+ export type { RelationCreate } from "./relation-picker.js";
8
8
  export { RelationSetEditor, type RelationSetEditorHandle, type RelationSetItem, } from "./RelationSetEditor.js";
9
9
  /**
10
10
  * THE relation-picking core — search the candidates, pick one, it REPLACES the
11
11
  * link. Many-to-one, so there is nothing to accumulate.
12
12
  *
13
- * Built from the app's command list (the components map) rather than a
14
- * combobox: a combobox owns a trigger button, and a cell editor has none — it
15
- * is already open, anchored over a value that is already on screen. The host
16
- * owns that mounting behaviour; what lives here is what a close MEANS for a
17
- * relation: a pick is the commit, everything else discards. The list itself —
18
- * the search, the candidates, the host's pinned create rows — is the shared
19
- * `RelationPanel`.
13
+ * The list is the app's `Picker` (the components map's), handed the candidates
14
+ * as data, the host's create rows as its actions. The host owns the mounting;
15
+ * what lives here is what a close MEANS for a relation: a pick is the commit,
16
+ * everything else discards.
20
17
  */
21
18
  export type RelationEditorHandle = {
22
19
  /** What this close means. Synchronous, idempotent, no timer — the host
@@ -1,8 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { forwardRef, useEffect, useImperativeHandle, useRef, useState, } from "react";
3
+ import { forwardRef, useImperativeHandle, useRef, useState } from "react";
4
4
  import { useViews } from "../provider/context.js";
5
- import { RelationPanel } from "./relation-panel.js";
6
5
  import { RelationPickerBody } from "./relation-picker.js";
7
6
  export { RELATION_PAGE_SIZE, RELATION_SEARCH_DEBOUNCE_MS } from "./relation-source.js";
8
7
  export { RelationSetEditor, } from "./RelationSetEditor.js";
@@ -10,15 +9,9 @@ export const RelationEditor = forwardRef(function RelationEditor({ candidates, i
10
9
  const [picked, setPicked] = useState(undefined);
11
10
  const pickedRef = useRef(undefined);
12
11
  const [query, setQuery] = useState(seed ?? "");
13
- const searchRef = useRef(null);
14
12
  const views = useViews();
15
13
  const words = message ?? views.conventions.messages;
16
- const { Command, Picker } = views.components;
17
- const { RowContent } = views.atoms;
18
- useEffect(() => {
19
- if (focusSearch)
20
- searchRef.current?.focus({ preventScroll: true });
21
- }, []);
14
+ const { Picker } = views.components;
22
15
  const resolveClose = (reason) => {
23
16
  if (reason !== "pick")
24
17
  return { kind: "cancel" };
@@ -28,28 +21,16 @@ export const RelationEditor = forwardRef(function RelationEditor({ candidates, i
28
21
  return value === initial ? { kind: "noop" } : { kind: "commit", payload: value };
29
22
  };
30
23
  useImperativeHandle(ref, () => ({ resolveClose }));
31
- const pick = (id) => {
32
- pickedRef.current = id;
33
- setPicked(id);
34
- onRequestClose("pick");
35
- };
36
24
  const current = picked === undefined ? initial : picked;
37
- const none = clearable && (candidates.kind !== "remote" || query === "");
38
- if (Picker) {
39
- return (_jsx(RelationPickerBody, { Picker: Picker, label: label ?? words({ key: "editor.search" }), candidates: candidates, query: query, onQueryChange: setQuery, held: [], multiple: false, value: current ?? null, onValueChange: (id) => {
40
- if (typeof id === "string" || id === null) {
41
- pickedRef.current = id;
42
- setPicked(id);
43
- }
44
- }, onDone: () => onRequestClose("pick"), empty: clearable ? (noneLabel ?? words({ key: "relation.none" })) : undefined, creates: creates, onCreate: (create, typed) => {
45
- pickedRef.current = undefined;
46
- setPicked(undefined);
47
- onRequestClose("pick");
48
- create.onCreate(typed);
49
- }, kindGlyph: kindGlyph, search: words({ key: "editor.search" }), onTab: (reason) => onRequestClose(reason), typed: seed, autoFocus: focusSearch }));
50
- }
51
- return (_jsx(RelationPanel, { candidates: candidates, query: query, onQueryChange: setQuery, searchRef: searchRef, kindGlyph: kindGlyph, message: message, creates: creates, onCreate: (create, typed) => {
25
+ return (_jsx(RelationPickerBody, { Picker: Picker, label: label ?? words({ key: "editor.search" }), candidates: candidates, query: query, onQueryChange: setQuery, held: [], multiple: false, value: current ?? null, onValueChange: (id) => {
26
+ if (typeof id === "string" || id === null) {
27
+ pickedRef.current = id;
28
+ setPicked(id);
29
+ }
30
+ }, onDone: () => onRequestClose("pick"), empty: clearable ? (noneLabel ?? words({ key: "relation.none" })) : undefined, creates: creates, onCreate: (create, typed) => {
31
+ pickedRef.current = undefined;
32
+ setPicked(undefined);
52
33
  onRequestClose("pick");
53
34
  create.onCreate(typed);
54
- }, isChosen: (id) => id === current, startOn: seed ? undefined : (initial ?? undefined), onSelect: (candidate) => pick(candidate.id), before: ({ glyphs }) => none && (_jsx(Command.Item, { value: "__none__", onSelect: () => pick(null), chosen: current == null, children: _jsx(RowContent, { size: "compact", leadingLane: glyphs, label: noneLabel ?? words({ key: "relation.none" }), tone: current == null ? "default" : "muted", chosen: current == null, chosenTint: false }) })) }));
35
+ }, kindGlyph: kindGlyph, search: words({ key: "editor.search" }), onTab: (reason) => onRequestClose(reason), typed: seed, autoFocus: focusSearch }));
55
36
  });
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type CloseReason, type CloseResolution, type FieldMessageResolver, type RelationDraftLink, type RelationLinks } from "viewkitjs/fields";
3
- import { type RelationCreate } from "./relation-panel.js";
3
+ import { type RelationCreate } from "./relation-picker.js";
4
4
  import type { RelationSource } from "./relation-source.js";
5
5
  /** One linked record as the several-records core holds it: the link, and what its row shows. */
6
6
  export type RelationSetItem = RelationDraftLink & {
@@ -13,29 +13,18 @@ export type RelationSetEditorHandle = {
13
13
  resolveClose: (reason: CloseReason) => CloseResolution<RelationDraftLink[]>;
14
14
  };
15
15
  /**
16
- * THE core for a relation holding several records: search the candidates, and
17
- * every click adds a record to the set or takes it out, with the list kept
18
- * open; Enter toggles the highlighted row, as a click does. The set leaves as
19
- * ONE change: a click outside, the sheet's ✓, Tab or Shift-Tab commit what it
20
- * holds, as pick many does; Escape and the sheet's ✕ throw it away.
16
+ * THE core for a relation holding several records, in the app's `Picker`: search the candidates, and every pick adds
17
+ * a record to the set or takes it out, with the list kept open. The set leaves as ONE change: a click outside, the
18
+ * sheet's ✓, Tab or Shift-Tab commit what it holds, as pick many does; Escape and the sheet's ✕ throw it away.
21
19
  *
22
- * The linked records are drawn first, chosen, whatever page the search holds —
23
- * a remote list may not hold them at all. Where the field leads by a flag the
24
- * first is the lead: it carries the lead's mark and every other linked record
25
- * a way to become it; a record added joins at the end, so the lead stays until
26
- * another is marked, and removing the lead passes it to the next; Space on a
27
- * highlighted linked record, with the search empty, makes it the lead, as its
28
- * Make lead button does. A link keeps the role and roles it was stored with; a
29
- * new one has neither.
20
+ * The linked records are handed first, chosen, whatever page the search holds — a remote list may not hold them at all.
21
+ * Where the field leads by a flag the first is the lead (the Picker's `lead`); a record added joins at the end, so the
22
+ * lead stays until another is marked, and removing the lead passes it to the next. A link keeps the role and roles it
23
+ * was stored with; a new one has neither.
30
24
  *
31
- * Handed the field's `links` while the app hands a `LinksBody`, the set opens that body instead: each link's roles, the
32
- * field's roles and the lead go to it, and what it sets is saved, each link's roles in the key it was stored with
33
- * (`writtenRoles`). There the lead is held beside the links, so a line never moves when it changes; the set still
34
- * saves it first.
35
- *
36
- * The highlight opens on the first linked record. Until it leaves that record,
37
- * by a key, by typing or by the pointer, an Enter does nothing, so the first
38
- * linked record is never taken out unasked.
25
+ * Handed the field's `links`, the set opens the app's `LinksBody` instead: each link's roles, the field's roles and the
26
+ * lead go to it, and what it sets is saved, each link's roles in the key it was stored with (`writtenRoles`). There the
27
+ * lead is held beside the links, so a line never moves when it changes; the set still saves it first.
39
28
  */
40
29
  export declare const RelationSetEditor: import("react").ForwardRefExoticComponent<{
41
30
  candidates: RelationSource;
@@ -57,7 +46,7 @@ export declare const RelationSetEditor: import("react").ForwardRefExoticComponen
57
46
  focusSearch?: boolean;
58
47
  /** The field's name, for an app's own `Picker` (its list's accessible name). Default: the search's words. */
59
48
  label?: string;
60
- /** The field's `links`: handed, with the app's `LinksBody`, the set opens that body with each link's roles and the
61
- * field's roles; left out, today's Picker or list. */
49
+ /** The field's `links`: handed, the set opens the app's `LinksBody` with each link's roles and the field's roles;
50
+ * left out, its `Picker`. */
62
51
  links?: RelationLinks;
63
52
  } & import("react").RefAttributes<RelationSetEditorHandle>>;