@viewkitjs/views 0.4.0 → 0.6.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 (447) hide show
  1. package/CHANGELOG.md +768 -0
  2. package/README.md +5 -3
  3. package/dist/atoms/Avatar.d.ts +2 -0
  4. package/dist/atoms/Avatar.js +13 -0
  5. package/dist/atoms/CellMore.d.ts +2 -0
  6. package/dist/atoms/CellMore.js +4 -0
  7. package/dist/atoms/DisabledReason.d.ts +11 -0
  8. package/dist/atoms/DisabledReason.js +10 -0
  9. package/dist/atoms/DrillRows.d.ts +3 -0
  10. package/dist/atoms/DrillRows.js +27 -0
  11. package/dist/atoms/Loading.d.ts +6 -0
  12. package/dist/atoms/Loading.js +4 -1
  13. package/dist/atoms/PanelRows.d.ts +5 -0
  14. package/dist/atoms/PanelRows.js +38 -0
  15. package/dist/atoms/PanelSearch.d.ts +2 -0
  16. package/dist/atoms/PanelSearch.js +21 -0
  17. package/dist/atoms/Pill.d.ts +2 -0
  18. package/dist/atoms/Pill.js +25 -0
  19. package/dist/atoms/RangeCalendar.d.ts +8 -0
  20. package/dist/atoms/RangeCalendar.js +30 -0
  21. package/dist/atoms/RelationRoles.js +2 -2
  22. package/dist/atoms/SelectionSheet.d.ts +3 -0
  23. package/dist/atoms/SelectionSheet.js +31 -0
  24. package/dist/atoms/ToolbarButton.d.ts +2 -0
  25. package/dist/atoms/ToolbarButton.js +18 -0
  26. package/dist/atoms/defaults.js +22 -0
  27. package/dist/atoms/types.d.ts +257 -1
  28. package/dist/cells/cell-format.d.ts +10 -1
  29. package/dist/cells/cell-title.d.ts +5 -1
  30. package/dist/cells/cell-title.js +2 -2
  31. package/dist/cells/cell-values.js +22 -7
  32. package/dist/cells/relation-wrap.js +1 -1
  33. package/dist/contract.d.ts +515 -18
  34. package/dist/contract.js +660 -5
  35. package/dist/display/actor.js +1 -1
  36. package/dist/display/boolean.js +5 -0
  37. package/dist/display/entity-chip.d.ts +12 -9
  38. package/dist/display/entity-chip.js +4 -5
  39. package/dist/display/fit-values.d.ts +34 -0
  40. package/dist/display/fit-values.js +45 -0
  41. package/dist/display/location.js +1 -1
  42. package/dist/display/multi-value.js +72 -8
  43. package/dist/display/options.d.ts +9 -1
  44. package/dist/display/relation.js +1 -1
  45. package/dist/display/rich-text.js +17 -6
  46. package/dist/display/select.js +6 -4
  47. package/dist/display/status-steps.d.ts +8 -0
  48. package/dist/display/status-steps.js +18 -0
  49. package/dist/display/viewer.js +1 -0
  50. package/dist/editors/BodyFrame.d.ts +29 -0
  51. package/dist/editors/BodyFrame.js +80 -0
  52. package/dist/editors/DateEditor.js +13 -17
  53. package/dist/editors/LocationEditor.d.ts +2 -0
  54. package/dist/editors/LocationEditor.js +29 -5
  55. package/dist/editors/NameEditor.d.ts +2 -0
  56. package/dist/editors/NameEditor.js +27 -7
  57. package/dist/editors/NumberEditor.d.ts +18 -0
  58. package/dist/editors/NumberEditor.js +29 -2
  59. package/dist/editors/RangeEditor.d.ts +2 -0
  60. package/dist/editors/RangeEditor.js +29 -4
  61. package/dist/editors/SelectEditor.d.ts +5 -0
  62. package/dist/editors/SelectEditor.js +3 -2
  63. package/dist/editors/TextEditor.d.ts +11 -1
  64. package/dist/editors/TextEditor.js +25 -8
  65. package/dist/editors/ValueListEditor.d.ts +7 -0
  66. package/dist/editors/ValueListEditor.js +60 -48
  67. package/dist/editors/body-panel.d.ts +7 -0
  68. package/dist/editors/body-panel.js +8 -0
  69. package/dist/editors/edit-session.d.ts +20 -3
  70. package/dist/editors/edit-session.js +43 -3
  71. package/dist/editors/leave-scope.d.ts +23 -0
  72. package/dist/editors/leave-scope.js +28 -0
  73. package/dist/editors/number-body.d.ts +29 -0
  74. package/dist/editors/number-body.js +37 -0
  75. package/dist/editors/parts-body.d.ts +66 -0
  76. package/dist/editors/parts-body.js +114 -0
  77. package/dist/editors/tab-ends.d.ts +5 -0
  78. package/dist/editors/tab-ends.js +7 -0
  79. package/dist/editors/text-body.d.ts +16 -0
  80. package/dist/editors/text-body.js +30 -0
  81. package/dist/editors/values-body.d.ts +47 -0
  82. package/dist/editors/values-body.js +140 -0
  83. package/dist/field-row/FieldRow.d.ts +7 -0
  84. package/dist/field-row/FieldRow.js +44 -24
  85. package/dist/field-row/FieldRowLane.js +12 -4
  86. package/dist/field-row/editors/RowChipsEditor.js +3 -1
  87. package/dist/field-row/editors/RowEditor.js +2 -1
  88. package/dist/field-row/editors/RowNameEditor.d.ts +5 -2
  89. package/dist/field-row/editors/RowNameEditor.js +12 -5
  90. package/dist/field-row/editors/RowNumberEditor.js +18 -2
  91. package/dist/field-row/editors/RowPlaceEditor.js +4 -2
  92. package/dist/field-row/editors/RowRangeEditor.d.ts +5 -2
  93. package/dist/field-row/editors/RowRangeEditor.js +13 -6
  94. package/dist/field-row/editors/RowRelationEditor.js +5 -2
  95. package/dist/field-row/editors/RowSelectEditor.js +4 -1
  96. package/dist/field-row/editors/RowTextEditor.d.ts +1 -1
  97. package/dist/field-row/editors/RowTextEditor.js +12 -3
  98. package/dist/field-row/editors/RowValueListEditor.d.ts +2 -1
  99. package/dist/field-row/editors/RowValueListEditor.js +17 -4
  100. package/dist/field-row/editors/host.d.ts +3 -0
  101. package/dist/field-row/editors/row-session.d.ts +12 -1
  102. package/dist/field-row/editors/row-session.js +52 -2
  103. package/dist/field-row/field-row-button.d.ts +40 -0
  104. package/dist/field-row/field-row-button.js +18 -0
  105. package/dist/field-row/field-row-checkbox.d.ts +9 -0
  106. package/dist/field-row/field-row-checkbox.js +7 -0
  107. package/dist/figures.d.ts +5 -48
  108. package/dist/figures.js +1 -63
  109. package/dist/filters/filter-model.d.ts +2 -0
  110. package/dist/grid/chrome/GridAddColumn.js +17 -3
  111. package/dist/grid/chrome/GridAggregateMenu.d.ts +2 -0
  112. package/dist/grid/chrome/GridAggregateMenu.js +2 -0
  113. package/dist/grid/chrome/GridCellEditors.js +16 -6
  114. package/dist/grid/chrome/GridCellOutline.d.ts +7 -4
  115. package/dist/grid/chrome/GridCellOutline.js +4 -2
  116. package/dist/grid/chrome/GridChipsEditor.js +3 -1
  117. package/dist/grid/chrome/GridColumnMenu.d.ts +7 -4
  118. package/dist/grid/chrome/GridColumnMenu.js +5 -3
  119. package/dist/grid/chrome/GridColumnSortSection.d.ts +23 -3
  120. package/dist/grid/chrome/GridColumnSortSection.js +18 -1
  121. package/dist/grid/chrome/GridFooter.d.ts +4 -1
  122. package/dist/grid/chrome/GridFooter.js +6 -4
  123. package/dist/grid/chrome/GridGroupMenu.d.ts +7 -3
  124. package/dist/grid/chrome/GridGroupMenu.js +30 -8
  125. package/dist/grid/chrome/GridHeader.d.ts +5 -1
  126. package/dist/grid/chrome/GridHeader.js +9 -5
  127. package/dist/grid/chrome/GridLongTextEditor.js +15 -11
  128. package/dist/grid/chrome/GridNameEditor.js +4 -2
  129. package/dist/grid/chrome/GridNumberEditor.d.ts +8 -1
  130. package/dist/grid/chrome/GridNumberEditor.js +15 -3
  131. package/dist/grid/chrome/GridPager.d.ts +7 -0
  132. package/dist/grid/chrome/GridPager.js +34 -0
  133. package/dist/grid/chrome/GridPlaceEditor.js +4 -2
  134. package/dist/grid/chrome/GridRangeEditor.js +12 -4
  135. package/dist/grid/chrome/GridRelationEditor.js +5 -2
  136. package/dist/grid/chrome/GridRow.js +18 -6
  137. package/dist/grid/chrome/GridRowActions.d.ts +8 -3
  138. package/dist/grid/chrome/GridRowActions.js +16 -6
  139. package/dist/grid/chrome/GridRowCells.js +23 -7
  140. package/dist/grid/chrome/GridRowGlyph.d.ts +3 -1
  141. package/dist/grid/chrome/GridRowGlyph.js +7 -2
  142. package/dist/grid/chrome/GridSelectEditor.js +6 -3
  143. package/dist/grid/chrome/GridStructure.d.ts +6 -1
  144. package/dist/grid/chrome/GridStructure.js +32 -8
  145. package/dist/grid/chrome/GridTable.js +36 -24
  146. package/dist/grid/chrome/GridTableSurface.d.ts +5 -1
  147. package/dist/grid/chrome/GridTableSurface.js +5 -2
  148. package/dist/grid/chrome/GridTextEditor.d.ts +5 -1
  149. package/dist/grid/chrome/GridTextEditor.js +13 -3
  150. package/dist/grid/chrome/GridValueListEditor.d.ts +12 -4
  151. package/dist/grid/chrome/GridValueListEditor.js +11 -3
  152. package/dist/grid/chrome/StuckMarker.d.ts +3 -1
  153. package/dist/grid/chrome/StuckMarker.js +6 -2
  154. package/dist/grid/chrome/cells.d.ts +4 -2
  155. package/dist/grid/chrome/cells.js +2 -2
  156. package/dist/grid/chrome/grid-add-column-items.d.ts +1 -1
  157. package/dist/grid/chrome/grid-add-column-items.js +8 -1
  158. package/dist/grid/chrome/grid-button.d.ts +32 -0
  159. package/dist/grid/chrome/grid-button.js +12 -0
  160. package/dist/grid/chrome/grid-cell-classes.d.ts +38 -0
  161. package/dist/grid/chrome/grid-cell-classes.js +30 -0
  162. package/dist/grid/chrome/grid-column-menu-items.d.ts +3 -0
  163. package/dist/grid/chrome/grid-column-menu-items.js +32 -3
  164. package/dist/grid/chrome/grid-columns-template.d.ts +27 -0
  165. package/dist/grid/chrome/grid-columns-template.js +13 -0
  166. package/dist/grid/chrome/grid-edit-session.d.ts +4 -1
  167. package/dist/grid/chrome/grid-edit-session.js +11 -1
  168. package/dist/grid/chrome/grid-group-menu-items.d.ts +8 -1
  169. package/dist/grid/chrome/grid-group-menu-items.js +17 -0
  170. package/dist/grid/chrome/grid-group-menu-parts.d.ts +10 -6
  171. package/dist/grid/chrome/grid-group-menu-parts.js +4 -2
  172. package/dist/grid/chrome/grid-hover.d.ts +4 -1
  173. package/dist/grid/chrome/grid-hover.js +16 -6
  174. package/dist/grid/chrome/grid-pages.d.ts +15 -0
  175. package/dist/grid/chrome/grid-pages.js +9 -0
  176. package/dist/grid/chrome/grid-row-menu-items.js +18 -10
  177. package/dist/grid/chrome/grid-row-props.d.ts +6 -2
  178. package/dist/grid/chrome/grid-row-window.d.ts +7 -0
  179. package/dist/grid/chrome/grid-row-window.js +35 -1
  180. package/dist/grid/chrome/grid-table-props.d.ts +38 -4
  181. package/dist/grid/chrome/useGridColumnLayout.d.ts +3 -1
  182. package/dist/grid/chrome/useGridColumnLayout.js +29 -9
  183. package/dist/grid/chrome/useGridPartColumns.js +1 -1
  184. package/dist/grid/chrome/useGridScrollArea.js +2 -0
  185. package/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -0
  186. package/dist/grid/chrome/useGridTableInteractionModel.js +5 -3
  187. package/dist/grid/chrome/useGridTableSelection.d.ts +3 -1
  188. package/dist/grid/chrome/useGridTableSelection.js +2 -2
  189. package/dist/grid/chrome/useHeaderDragReorder.js +2 -0
  190. package/dist/grid/core/editing-controller.d.ts +36 -11
  191. package/dist/grid/core/editing-controller.js +92 -25
  192. package/dist/grid/core/grid-aria.d.ts +4 -0
  193. package/dist/grid/core/grid-aria.js +6 -4
  194. package/dist/grid/core/grid-focus.d.ts +6 -0
  195. package/dist/grid/core/grid-focus.js +28 -5
  196. package/dist/grid/core/useGridEditing.d.ts +11 -2
  197. package/dist/grid/core/useGridEditing.js +9 -5
  198. package/dist/grid/core/write-states.d.ts +20 -0
  199. package/dist/grid/core/write-states.js +21 -0
  200. package/dist/grid/grid-format-props.d.ts +26 -0
  201. package/dist/grid/grid-format-props.js +65 -0
  202. package/dist/grid/index.d.ts +3 -1
  203. package/dist/grid/index.js +1 -0
  204. package/dist/grid/useGridTablePrefs.d.ts +20 -21
  205. package/dist/grid/useGridTablePrefs.js +6 -58
  206. package/dist/grid/useGridTableSettings.d.ts +60 -0
  207. package/dist/grid/useGridTableSettings.js +61 -0
  208. package/dist/grouping/sort-groups.d.ts +6 -7
  209. package/dist/internal/count.d.ts +3 -0
  210. package/dist/internal/count.js +3 -0
  211. package/dist/model/aggregates.d.ts +3 -3
  212. package/dist/model/aggregates.js +17 -71
  213. package/dist/model/body-frame.d.ts +16 -0
  214. package/dist/model/body-frame.js +5 -0
  215. package/dist/model/column-capabilities.d.ts +4 -1
  216. package/dist/model/column-capabilities.js +4 -1
  217. package/dist/model/column-filters.d.ts +7 -4
  218. package/dist/model/column-filters.js +26 -18
  219. package/dist/model/column-inspect.d.ts +3 -2
  220. package/dist/model/column-inspect.js +3 -1
  221. package/dist/model/column-order.d.ts +2 -2
  222. package/dist/model/column-schema.d.ts +6 -7
  223. package/dist/model/column-sort.d.ts +11 -0
  224. package/dist/model/column-sort.js +14 -0
  225. package/dist/model/column-state.d.ts +3 -20
  226. package/dist/model/column-state.js +1 -4
  227. package/dist/model/column-types.d.ts +1 -15
  228. package/dist/model/column-types.js +1 -1
  229. package/dist/model/one-value.d.ts +6 -0
  230. package/dist/model/one-value.js +5 -0
  231. package/dist/model/part-columns.d.ts +1 -6
  232. package/dist/model/part-columns.js +1 -1
  233. package/dist/model/part-rows.d.ts +2 -9
  234. package/dist/model/part-rows.js +1 -10
  235. package/dist/model/part-write.js +1 -1
  236. package/dist/model/place-parts.d.ts +6 -0
  237. package/dist/model/place-parts.js +14 -0
  238. package/dist/model/preferences.d.ts +3 -23
  239. package/dist/model/preferences.js +1 -17
  240. package/dist/model/prefs-buckets.d.ts +0 -27
  241. package/dist/model/prefs-buckets.js +1 -1
  242. package/dist/model/relation-filters.d.ts +13 -3
  243. package/dist/model/relation-filters.js +9 -4
  244. package/dist/model/row-icon.d.ts +17 -11
  245. package/dist/model/settings-columns.d.ts +34 -0
  246. package/dist/model/settings-columns.js +146 -0
  247. package/dist/model/settings-look.d.ts +17 -0
  248. package/dist/model/settings-look.js +23 -0
  249. package/dist/model/view-rules.d.ts +32 -6
  250. package/dist/model/view-rules.js +99 -23
  251. package/dist/panels/availability.d.ts +26 -0
  252. package/dist/panels/availability.js +28 -0
  253. package/dist/panels/filter/DateFilterBody.d.ts +42 -0
  254. package/dist/panels/filter/DateFilterBody.js +64 -0
  255. package/dist/panels/filter/DateFilterCalendar.d.ts +19 -0
  256. package/dist/panels/filter/DateFilterCalendar.js +37 -0
  257. package/dist/panels/filter/DateFilterInput.d.ts +16 -0
  258. package/dist/panels/filter/DateFilterInput.js +37 -0
  259. package/dist/panels/filter/FilterIcon.d.ts +7 -0
  260. package/dist/panels/filter/FilterIcon.js +15 -0
  261. package/dist/panels/filter/MenuSelect.d.ts +12 -0
  262. package/dist/panels/filter/MenuSelect.js +34 -0
  263. package/dist/panels/filter/NumberFilterBody.d.ts +21 -0
  264. package/dist/panels/filter/NumberFilterBody.js +76 -0
  265. package/dist/panels/filter/RangeFilterBody.d.ts +19 -0
  266. package/dist/panels/filter/RangeFilterBody.js +71 -0
  267. package/dist/panels/filter/RelationFilterBody.d.ts +17 -0
  268. package/dist/panels/filter/RelationFilterBody.js +20 -0
  269. package/dist/panels/filter/TextFilterBody.d.ts +31 -0
  270. package/dist/panels/filter/TextFilterBody.js +44 -0
  271. package/dist/panels/filter/TimeScopeDetail.d.ts +6 -0
  272. package/dist/panels/filter/TimeScopeDetail.js +47 -0
  273. package/dist/panels/filter/details.d.ts +17 -0
  274. package/dist/panels/filter/details.js +73 -0
  275. package/dist/panels/filter/filter-list.d.ts +23 -0
  276. package/dist/panels/filter/filter-list.js +38 -0
  277. package/dist/panels/group-sort.d.ts +24 -0
  278. package/dist/panels/group-sort.js +58 -0
  279. package/dist/panels/index.d.ts +24 -0
  280. package/dist/panels/index.js +17 -0
  281. package/dist/panels/labels.d.ts +37 -0
  282. package/dist/panels/labels.js +166 -0
  283. package/dist/panels/model.d.ts +343 -0
  284. package/dist/panels/model.js +77 -0
  285. package/dist/panels/react/GroupBucketsList.d.ts +16 -0
  286. package/dist/panels/react/GroupBucketsList.js +38 -0
  287. package/dist/panels/react/LayoutColumnsList.d.ts +24 -0
  288. package/dist/panels/react/LayoutColumnsList.js +71 -0
  289. package/dist/panels/react/PopoverColumnDetail.d.ts +11 -0
  290. package/dist/panels/react/PopoverColumnDetail.js +24 -0
  291. package/dist/panels/react/chrome.d.ts +17 -0
  292. package/dist/panels/react/chrome.js +8 -0
  293. package/dist/panels/react/column-refusals.d.ts +7 -0
  294. package/dist/panels/react/column-refusals.js +14 -0
  295. package/dist/panels/react/customize.d.ts +26 -0
  296. package/dist/panels/react/customize.js +98 -0
  297. package/dist/panels/react/drag.d.ts +2 -0
  298. package/dist/panels/react/drag.js +6 -0
  299. package/dist/panels/react/field-editor.d.ts +10 -0
  300. package/dist/panels/react/field-editor.js +1 -0
  301. package/dist/panels/react/filter-panel.d.ts +15 -0
  302. package/dist/panels/react/filter-panel.js +48 -0
  303. package/dist/panels/react/layout-detail.d.ts +4 -0
  304. package/dist/panels/react/layout-detail.js +21 -0
  305. package/dist/panels/react/order-details.d.ts +32 -0
  306. package/dist/panels/react/order-details.js +81 -0
  307. package/dist/panels/react/panel-header.d.ts +10 -0
  308. package/dist/panels/react/panel-header.js +12 -0
  309. package/dist/panels/react/panel-sheet.d.ts +19 -0
  310. package/dist/panels/react/panel-sheet.js +22 -0
  311. package/dist/panels/react/popover.d.ts +71 -0
  312. package/dist/panels/react/popover.js +47 -0
  313. package/dist/panels/react/root-list.d.ts +6 -0
  314. package/dist/panels/react/root-list.js +31 -0
  315. package/dist/panels/react/toolbar/ReadyToolbar.d.ts +42 -0
  316. package/dist/panels/react/toolbar/ReadyToolbar.js +92 -0
  317. package/dist/panels/react/toolbar/Toolbar.d.ts +16 -0
  318. package/dist/panels/react/toolbar/Toolbar.js +34 -0
  319. package/dist/panels/react/toolbar/ToolbarButton.d.ts +5 -0
  320. package/dist/panels/react/toolbar/ToolbarButton.js +9 -0
  321. package/dist/panels/react/toolbar/ToolbarFilter.d.ts +19 -0
  322. package/dist/panels/react/toolbar/ToolbarFilter.js +32 -0
  323. package/dist/panels/react/toolbar/ToolbarNew.d.ts +12 -0
  324. package/dist/panels/react/toolbar/ToolbarNew.js +21 -0
  325. package/dist/panels/react/toolbar/ToolbarOptions.d.ts +25 -0
  326. package/dist/panels/react/toolbar/ToolbarOptions.js +33 -0
  327. package/dist/panels/react/toolbar/ToolbarSearch.d.ts +9 -0
  328. package/dist/panels/react/toolbar/ToolbarSearch.js +41 -0
  329. package/dist/panels/react/toolbar/ToolbarSort.d.ts +12 -0
  330. package/dist/panels/react/toolbar/ToolbarSort.js +16 -0
  331. package/dist/panels/react/toolbar/ToolbarViews.d.ts +13 -0
  332. package/dist/panels/react/toolbar/ToolbarViews.js +24 -0
  333. package/dist/panels/react/toolbar/context.d.ts +29 -0
  334. package/dist/panels/react/toolbar/context.js +49 -0
  335. package/dist/panels/react/toolbar/panel-part.d.ts +37 -0
  336. package/dist/panels/react/toolbar/panel-part.js +37 -0
  337. package/dist/panels/react/toolbar/panel-state.d.ts +9 -0
  338. package/dist/panels/react/toolbar/panel-state.js +12 -0
  339. package/dist/panels/react/toolbar/use-box-narrow.d.ts +2 -0
  340. package/dist/panels/react/toolbar/use-box-narrow.js +18 -0
  341. package/dist/panels/react/toolbar/use-list-settings-state.d.ts +10 -0
  342. package/dist/panels/react/toolbar/use-list-settings-state.js +10 -0
  343. package/dist/panels/react/view-actions.d.ts +4 -0
  344. package/dist/panels/react/view-actions.js +37 -0
  345. package/dist/panels/react/view-footer.d.ts +16 -0
  346. package/dist/panels/react/view-footer.js +11 -0
  347. package/dist/panels/react/views-row/FoldingViewRow.d.ts +4 -0
  348. package/dist/panels/react/views-row/FoldingViewRow.js +105 -0
  349. package/dist/panels/react/views-row/HScrollRow.d.ts +7 -0
  350. package/dist/panels/react/views-row/HScrollRow.js +42 -0
  351. package/dist/panels/react/views-row/PillGroup.d.ts +30 -0
  352. package/dist/panels/react/views-row/PillGroup.js +86 -0
  353. package/dist/panels/react/views-row/ViewAxes.d.ts +6 -0
  354. package/dist/panels/react/views-row/ViewAxes.js +16 -0
  355. package/dist/panels/react/views-row/ViewCreatePill.d.ts +7 -0
  356. package/dist/panels/react/views-row/ViewCreatePill.js +11 -0
  357. package/dist/panels/react/views-row/ViewPicker.d.ts +5 -0
  358. package/dist/panels/react/views-row/ViewPicker.js +65 -0
  359. package/dist/panels/react/views-row/ViewPickerRow.d.ts +7 -0
  360. package/dist/panels/react/views-row/ViewPickerRow.js +18 -0
  361. package/dist/panels/react/views-row/ViewTabs.d.ts +31 -0
  362. package/dist/panels/react/views-row/ViewTabs.js +29 -0
  363. package/dist/panels/react/views-row/menu-classes.d.ts +6 -0
  364. package/dist/panels/react/views-row/menu-classes.js +3 -0
  365. package/dist/panels/react/views-row/use-anchored-toggle.d.ts +19 -0
  366. package/dist/panels/react/views-row/use-anchored-toggle.js +31 -0
  367. package/dist/panels/react.d.ts +51 -0
  368. package/dist/panels/react.js +43 -0
  369. package/dist/panels/settings/axes.d.ts +28 -0
  370. package/dist/panels/settings/axes.js +71 -0
  371. package/dist/panels/settings/filters.d.ts +5 -0
  372. package/dist/panels/settings/filters.js +62 -0
  373. package/dist/panels/settings/group-buckets.d.ts +23 -0
  374. package/dist/panels/settings/group-buckets.js +73 -0
  375. package/dist/panels/settings/input.d.ts +69 -0
  376. package/dist/panels/settings/input.js +1 -0
  377. package/dist/panels/settings/layout.d.ts +5 -0
  378. package/dist/panels/settings/layout.js +244 -0
  379. package/dist/panels/settings/order.d.ts +19 -0
  380. package/dist/panels/settings/order.js +271 -0
  381. package/dist/panels/settings/settings-panels.d.ts +17 -0
  382. package/dist/panels/settings/settings-panels.js +28 -0
  383. package/dist/panels/toolbar/clear.d.ts +9 -0
  384. package/dist/panels/toolbar/clear.js +26 -0
  385. package/dist/panels/toolbar/counts.d.ts +15 -0
  386. package/dist/panels/toolbar/counts.js +21 -0
  387. package/dist/panels/toolbar/edit-view.d.ts +5 -0
  388. package/dist/panels/toolbar/edit-view.js +18 -0
  389. package/dist/panels/toolbar/model.d.ts +34 -0
  390. package/dist/panels/toolbar/model.js +52 -0
  391. package/dist/panels/use-filter-opened.d.ts +8 -0
  392. package/dist/panels/use-filter-opened.js +11 -0
  393. package/dist/panels/view-state.d.ts +38 -0
  394. package/dist/panels/view-state.js +1 -0
  395. package/dist/panels/views-row/model.d.ts +131 -0
  396. package/dist/panels/views-row/model.js +14 -0
  397. package/dist/provider/ViewsProvider.d.ts +50 -6
  398. package/dist/provider/ViewsProvider.js +33 -2
  399. package/dist/provider/components.d.ts +274 -11
  400. package/dist/provider/context.d.ts +23 -2
  401. package/dist/provider/desktop.d.ts +3 -0
  402. package/dist/provider/desktop.js +7 -4
  403. package/dist/react.d.ts +5 -2
  404. package/dist/selection/SelectionBar.d.ts +18 -0
  405. package/dist/selection/SelectionBar.js +98 -0
  406. package/dist/selection/SelectionBarPhone.d.ts +3 -0
  407. package/dist/selection/SelectionBarPhone.js +14 -0
  408. package/dist/selection/bar-overflow.d.ts +12 -0
  409. package/dist/selection/bar-overflow.js +55 -0
  410. package/dist/selection/bar-parts.d.ts +17 -0
  411. package/dist/selection/bar-parts.js +19 -0
  412. package/dist/selection/index.d.ts +2 -0
  413. package/dist/selection/index.js +1 -0
  414. package/dist/selection/types.d.ts +3 -2
  415. package/dist/selection/useListSelectionShortcuts.d.ts +3 -2
  416. package/dist/selection/useListSelectionShortcuts.js +1 -1
  417. package/dist/selection/verbs.d.ts +41 -0
  418. package/dist/selection/verbs.js +1 -0
  419. package/docs/contract.md +355 -35
  420. package/docs/getting-started.md +1 -1
  421. package/docs/guides/atoms.md +39 -6
  422. package/docs/guides/columns.md +1 -1
  423. package/docs/guides/display.md +3 -2
  424. package/docs/guides/editors.md +4 -3
  425. package/docs/guides/selection.md +35 -21
  426. package/docs/guides/the-grid.md +24 -13
  427. package/docs/guides/the-provider.md +24 -6
  428. package/docs/index.md +2 -0
  429. package/docs/install.md +3 -1
  430. package/docs/reference/cells.md +1 -1
  431. package/docs/reference/display.md +5 -4
  432. package/docs/reference/editors-location.md +3 -1
  433. package/docs/reference/editors-name.md +3 -1
  434. package/docs/reference/editors-number.md +1 -0
  435. package/docs/reference/editors-range.md +3 -1
  436. package/docs/reference/editors-session.md +1 -0
  437. package/docs/reference/editors-text.md +2 -2
  438. package/docs/reference/editors-value-list.md +1 -1
  439. package/docs/reference/field-row.md +2 -2
  440. package/docs/reference/grid.md +10 -7
  441. package/docs/reference/panels-react.md +101 -0
  442. package/docs/reference/panels.md +123 -0
  443. package/docs/reference/react.md +45 -12
  444. package/docs/reference/selection.md +11 -3
  445. package/docs/reference/views.md +41 -38
  446. package/package.json +33 -4
  447. package/skills/views/SKILL.md +5 -4
@@ -1,12 +1,14 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState, } from "react";
3
+ import { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, } from "react";
4
4
  import { COUNTRY_CODES, countryName, LOCATION_PARTS, placeFormat, sameStoredValue, } from "@viewkitjs/fields";
5
5
  import { loadRegions, regionLabel } from "@viewkitjs/fields/places";
6
6
  import { placeWordKey } from "../contract.js";
7
7
  import { ELEMENT_RESET } from "../internal/reset.js";
8
8
  import { useViews } from "../provider/context.js";
9
9
  import { EDITOR_INNER_ESCAPE } from "./EditorPanel.js";
10
+ import { BodyFrame } from "./BodyFrame.js";
11
+ import { mergeParts, placeBodyValue, samePlacePart, takePlaceParts } from "./parts-body.js";
10
12
  import { PickerFrame, usePickerForm } from "./picker-slot.js";
11
13
  const GENERIC = ["line1", "line2", "postalCode", "city", "region"];
12
14
  function folded(text) {
@@ -25,12 +27,12 @@ function withFilled(kept, draft) {
25
27
  const filled = GENERIC.filter((part) => !kept.has(part) && draft[part]?.trim());
26
28
  return filled.length === 0 ? kept : new Set([...kept, ...filled]);
27
29
  }
28
- export const LocationEditor = forwardRef(function LocationEditor({ field, initial, allowEmpty = false, conventions, chrome = "bare", onRequestClose }, ref) {
30
+ export const LocationEditor = forwardRef(function LocationEditor({ field, initial, allowEmpty = false, conventions, chrome = "bare", label, onRequestClose }, ref) {
29
31
  const views = useViews();
30
- const locale = (conventions ?? views.conventions).locale;
32
+ const locale = (conventions ?? views.conventions).language;
31
33
  const say = (message) => views.messages(message);
32
34
  const { List, RowContent } = views.atoms;
33
- const { Command, Input, Picker } = views.components;
35
+ const { Command, Input, Picker, PartsBody } = views.components;
34
36
  const form = usePickerForm();
35
37
  const boxRef = useRef(null);
36
38
  const parts = field.parts ?? LOCATION_PARTS;
@@ -51,7 +53,7 @@ export const LocationEditor = forwardRef(function LocationEditor({ field, initia
51
53
  const [regions, setRegions] = useState(null);
52
54
  const format = placeFormat(country, locale);
53
55
  const editsRegion = parts.includes("region");
54
- const wantsRegions = !choosingCountry && editsRegion && format.hasRegions && country !== null;
56
+ const wantsRegions = (PartsBody !== undefined || !choosingCountry) && editsRegion && format.hasRegions && country !== null;
55
57
  useEffect(() => {
56
58
  if (!wantsRegions || !country)
57
59
  return;
@@ -84,6 +86,12 @@ export const LocationEditor = forwardRef(function LocationEditor({ field, initia
84
86
  return lines;
85
87
  }, [format, parts, field.parts, keptShown]);
86
88
  const countries = useMemo(() => COUNTRY_CODES.map((code) => ({ code, name: countryName(code, locale) })).sort((a, b) => a.name.localeCompare(b.name, locale)), [locale]);
89
+ const [opensOnCountries] = useState(takesCountry && !country);
90
+ const bodyValue = placeBodyValue(draft);
91
+ const shownRef = useRef(bodyValue);
92
+ useLayoutEffect(() => {
93
+ shownRef.current = bodyValue;
94
+ });
87
95
  const resolveClose = (reason) => {
88
96
  if (reason === "escape")
89
97
  return { kind: "cancel" };
@@ -261,6 +269,22 @@ export const LocationEditor = forwardRef(function LocationEditor({ field, initia
261
269
  body = (_jsxs(_Fragment, { children: [takesCountry && country && line(_jsx("button", { type: "button", "data-place-control": "", "aria-label": `${say({ key: "views.editors.place-change-country" })}: ${countryName(country, locale)}`, onClick: () => setChoosingCountry(true), onKeyDown: keys, className: `${ELEMENT_RESET} ${button} font-medium`, children: countryName(country, locale) })), rows.map((row) => (_jsx("span", { className: "flex min-w-0 items-center gap-1.5", children: row.map((part) => part === "region" && regionList ? (_jsx("button", { type: "button", "data-place-control": "", ...focus(part), ...required(part, "button"), "data-place-part": part, "aria-label": draft.region ? `${labelOf(part)}: ${draft.region}` : labelOf(part), onFocus: () => (lastFocused.current = part), onClick: () => setChoosingRegion(true), onKeyDown: keys, className: `${ELEMENT_RESET} ${button} ${draft.region ? "" : "text-(color:--vk-fg-subtle)"}`, children: draft.region || labelOf(part) }, part)) : (_jsx(Input, { "data-place-control": "", ...focus(part), ...required(part, "input"), "data-place-part": part, onFocus: () => (lastFocused.current = part), value: draft[part] ?? "", "aria-label": labelOf(part), placeholder: labelOf(part), onChange: (e) => type(part, e.target.value), onKeyDown: keys, onClick: (e) => e.stopPropagation(), chrome: chrome, className: input }, part))) }, row.join(" "))))] }));
262
270
  }
263
271
  const inner = (choosingRegion && regionList !== null) || (choosingCountry && country !== null);
272
+ if (PartsBody) {
273
+ const boxes = GENERIC.filter((part) => parts.includes(part));
274
+ const labelOf = (region) => regionLabel(region, country ?? "", locale);
275
+ const take = (next) => {
276
+ const draftCountry = draftRef.current.countryCode?.trim() || "";
277
+ const list = regions && regions.country === draftCountry && regions.list.length > 0 ? regions.list : null;
278
+ const merged = mergeParts(draftRef.current, shownRef.current, next, samePlacePart);
279
+ setDraft(takePlaceParts(draftRef.current, merged, {
280
+ parts,
281
+ regions: list,
282
+ labelOf: (region) => regionLabel(region, draftCountry, locale),
283
+ }));
284
+ };
285
+ const words = Object.fromEntries(GENERIC.map((part) => [part, wordOf(part)]));
286
+ return (_jsx(BodyFrame, { slot: "vk-parts-body", onRequestClose: onRequestClose, children: _jsx(PartsBody, { kind: "place", value: bodyValue, onValueChange: take, parts: boxes, rows: rows, words: words, required: format.required.filter((part) => boxes.includes(part)), ...(takesCountry ? { countries } : {}), ...(regionList ? { regions: regionList.map((region) => ({ code: region.code, name: labelOf(region) })) } : {}), ...(opensOnCountries ? { opens: "countries" } : {}), label: label ?? field.label, onDone: (how) => onRequestClose(how === "pick" ? "pick" : "enter"), empty: allowEmpty, autoFocus: true, form: form }) }));
287
+ }
264
288
  return (_jsx("div", { ref: boxRef, ...(inner ? { [EDITOR_INNER_ESCAPE]: "" } : {}), onBlur: blur, onMouseDown: (e) => {
265
289
  if (!(e.target instanceof HTMLInputElement))
266
290
  e.preventDefault();
@@ -21,5 +21,7 @@ export declare const NameEditor: import("react").ForwardRefExoticComponent<{
21
21
  /** How the boxes are drawn: `bare` in a cell or a popover, `field` where they stand on their own (a phone's
22
22
  * sheet), each in the app's field frame. Default `bare`. */
23
23
  chrome?: "bare" | "field";
24
+ /** The field's name, for an app's `PartsBody`. Default: the full name's words. */
25
+ label?: string;
24
26
  onRequestClose: (reason: CloseReason) => void;
25
27
  } & import("react").RefAttributes<NameEditorHandle>>;
@@ -1,20 +1,20 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { forwardRef, useEffect, useImperativeHandle, useRef, useState, } from "react";
3
+ import { forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState, } from "react";
4
4
  import { isEmptyName, sameName, tidyName, } from "@viewkitjs/fields";
5
5
  import { useViews } from "../provider/context.js";
6
+ import { BodyFrame } from "./BodyFrame.js";
7
+ import { fromParts, mergeParts, nameBodyStart, nameBodyValue, resolveNameBody, takeNameParts, } from "./parts-body.js";
8
+ import { usePickerForm } from "./picker-slot.js";
6
9
  const ORDER = ["given", "family", "full"];
7
10
  const LABELS = {
8
11
  given: "views.editors.name-given",
9
12
  family: "views.editors.name-family",
10
13
  full: "views.editors.name-full",
11
14
  };
12
- function fromParts(given, family) {
13
- return [given.trim(), family.trim()].filter(Boolean).join(" ");
14
- }
15
- export const NameEditor = forwardRef(function NameEditor({ initial, seed, allowEmpty = false, chrome = "bare", onRequestClose }, ref) {
15
+ export const NameEditor = forwardRef(function NameEditor({ initial, seed, allowEmpty = false, chrome = "bare", label, onRequestClose }, ref) {
16
16
  const views = useViews();
17
- const { Input } = views.components;
17
+ const { Input, PartsBody } = views.components;
18
18
  const boxRef = useRef(null);
19
19
  const givenRef = useRef(null);
20
20
  const refs = {
@@ -31,6 +31,14 @@ export const NameEditor = forwardRef(function NameEditor({ initial, seed, allowE
31
31
  const [typedFull, setTypedFull] = useState(initial?.full ?? "");
32
32
  const [partsEdited, setPartsEdited] = useState(seed !== undefined);
33
33
  const full = ownFull || !partsEdited ? typedFull : fromParts(given, family);
34
+ const form = usePickerForm();
35
+ const [bodyDraft, setBodyDraft] = useState(() => nameBodyStart(initial, seed));
36
+ const bodyRef = useRef(bodyDraft);
37
+ const shownRef = useRef(nameBodyValue(bodyDraft));
38
+ const bodyValue = nameBodyValue(bodyDraft);
39
+ useLayoutEffect(() => {
40
+ shownRef.current = bodyValue;
41
+ });
34
42
  useEffect(() => {
35
43
  const el = givenRef.current;
36
44
  if (!el)
@@ -48,7 +56,11 @@ export const NameEditor = forwardRef(function NameEditor({ initial, seed, allowE
48
56
  return allowEmpty ? { kind: "commit", payload: null } : { kind: "cancel" };
49
57
  return { kind: "commit", payload: next };
50
58
  };
51
- useImperativeHandle(ref, () => ({ resolveClose }));
59
+ useImperativeHandle(ref, () => ({
60
+ resolveClose: PartsBody
61
+ ? (reason) => resolveNameBody(reason, bodyRef.current, initial, allowEmpty)
62
+ : resolveClose,
63
+ }));
52
64
  const keys = (which) => (e) => {
53
65
  e.stopPropagation();
54
66
  if (e.key === "Enter") {
@@ -83,6 +95,14 @@ export const NameEditor = forwardRef(function NameEditor({ initial, seed, allowE
83
95
  setOwnFull(true);
84
96
  setTypedFull(next);
85
97
  });
98
+ if (PartsBody) {
99
+ const take = (next) => {
100
+ const merged = mergeParts(nameBodyValue(bodyRef.current), shownRef.current, next);
101
+ bodyRef.current = takeNameParts(bodyRef.current, merged);
102
+ setBodyDraft(bodyRef.current);
103
+ };
104
+ return (_jsx(BodyFrame, { slot: "vk-parts-body", onRequestClose: onRequestClose, children: _jsx(PartsBody, { kind: "name", value: bodyValue, onValueChange: take, label: label ?? views.messages({ key: "views.editors.name-full" }), onDone: (how) => onRequestClose(how === "pick" ? "pick" : "enter"), empty: allowEmpty, typed: seed, autoFocus: true, form: form }) }));
105
+ }
86
106
  return (_jsxs("span", { ref: boxRef, onMouseDown: (e) => {
87
107
  if (!(e.target instanceof HTMLInputElement))
88
108
  e.preventDefault();
@@ -65,6 +65,24 @@ export declare const NumberEditor: import("react").ForwardRefExoticComponent<{
65
65
  align?: "start" | "end";
66
66
  /** The host's conventions — how its people write a number. Default: the provider's. */
67
67
  conventions?: FieldConventions;
68
+ /** The field's type: a `NumberBody`'s `kind`. Default `number`. */
69
+ type?: "number" | "percent" | "currency";
70
+ /** The field's name: a `NumberBody`'s label. */
71
+ label?: string;
72
+ /** The field's lowest value: handed to a `NumberBody`. */
73
+ min?: number;
74
+ /** The field's highest value: handed to a `NumberBody`. */
75
+ max?: number;
76
+ /** The host's reading of a value: its reason, or null. Handed to a `NumberBody`, asked with the value rounded to
77
+ * `decimals`; unused by the editor's own box. Default: every value reads. */
78
+ check?: (value: number | null, unit?: string) => string | null;
79
+ /** The session keeps on Escape: a `NumberBody`'s frame carries `EDITOR_INNER_ESCAPE`. Default false. */
80
+ escapeKeeps?: boolean;
81
+ /** Whether a `NumberBody`'s frame closes on a focus leaving it and stops a Tab between its controls from reaching
82
+ * the grid: where it stands in place. Default true; a sheet passes false. ViewKit's own box ignores it. */
83
+ closeOnBlur?: boolean;
84
+ /** Where a `NumberBody` stands: `phone` in a sheet. Default `computer`. */
85
+ form?: "computer" | "phone";
68
86
  /** The core saw a key (or a blur) that means "done". */
69
87
  onRequestClose: (reason: CloseReason) => void;
70
88
  } & import("react").RefAttributes<NumberEditorHandle>>;
@@ -4,9 +4,12 @@ import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "re
4
4
  import { formatNumberText, parseNumber, roundTo, } from "@viewkitjs/fields";
5
5
  import { durationUnitToMs, formatDurationInput, msToDurationUnit, parseDurationInput, } from "@viewkitjs/fields/query";
6
6
  import { cx } from "../internal/cx.js";
7
+ import { BodyFrame } from "./BodyFrame.js";
8
+ import { numberBodyKind, numberChange, resolveNumberBody } from "./number-body.js";
7
9
  import { ELEMENT_RESET } from "../internal/reset.js";
8
10
  import { useViews } from "../provider/context.js";
9
- export const NumberEditor = forwardRef(function NumberEditor({ initial, seed, unit, unitOptions, code, decimals = 2, durationUnit, allowEmpty = false, unitLeft = false, align = "end", conventions, onRequestClose, }, ref) {
11
+ const EVERY_VALUE_READS = () => null;
12
+ export const NumberEditor = forwardRef(function NumberEditor({ 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) {
10
13
  const inputRef = useRef(null);
11
14
  const chipRef = useRef(null);
12
15
  const [currentUnit, setCurrentUnit] = useState(unit);
@@ -14,6 +17,7 @@ export const NumberEditor = forwardRef(function NumberEditor({ initial, seed, un
14
17
  const views = useViews();
15
18
  const cv = conventions ?? views.conventions;
16
19
  const { Popover, Input } = views.components;
20
+ const NumberBody = durationUnit ? undefined : views.components.NumberBody;
17
21
  const { List, Row } = views.atoms;
18
22
  useEffect(() => {
19
23
  const el = inputRef.current;
@@ -58,7 +62,30 @@ export const NumberEditor = forwardRef(function NumberEditor({ initial, seed, un
58
62
  return { kind: "noop" };
59
63
  return { kind: "commit", payload: { value: parsed, unit: currentUnit } };
60
64
  };
61
- useImperativeHandle(ref, () => ({ resolveClose }));
65
+ const opening = () => ({
66
+ value: seed === undefined ? (Number.isFinite(initial) ? round(initial) : null) : (parse(seed) ?? Number.NaN),
67
+ unit,
68
+ });
69
+ const [draft, setDraft] = useState(opening);
70
+ const draftRef = useRef(draft);
71
+ useImperativeHandle(ref, () => ({
72
+ resolveClose: NumberBody
73
+ ? (reason) => resolveNumberBody(reason, draftRef.current, initial, unit, { decimals, allowEmpty })
74
+ : resolveClose,
75
+ }));
76
+ if (NumberBody) {
77
+ const units = unit && unitOptions && unitOptions.length > 0 ? unitOptions : undefined;
78
+ const drawn = draft;
79
+ return (_jsx(BodyFrame, { slot: "vk-number-body", innerEscape: escapeKeeps, closeOnModEnter: "any", closeOnBlur: closeOnBlur, inPlace: closeOnBlur, onRequestClose: onRequestClose, children: _jsx(NumberBody, { label: label ?? "", kind: numberBodyKind(type), value: draft.value, ...((unit ?? code) ? { unit: unit ?? code } : {}), ...(units ? { units } : {}), onValueChange: (value, next) => {
80
+ const changed = numberChange(drawn, { value, unit: next }, units);
81
+ if (!changed)
82
+ return;
83
+ draftRef.current = changed;
84
+ setDraft(changed);
85
+ }, onDone: () => onRequestClose("enter"), check: check
86
+ ? (value, next) => check(value == null || !Number.isFinite(value) ? value : round(value), next !== undefined && units?.includes(next) ? next : draftRef.current.unit)
87
+ : 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 }) }));
88
+ }
62
89
  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) => {
63
90
  e.stopPropagation();
64
91
  if (e.key === "Enter") {
@@ -41,5 +41,7 @@ export declare const RangeEditor: import("react").ForwardRefExoticComponent<{
41
41
  refusal?: string | null;
42
42
  /** Classes for the box that holds the two inputs: the host's frame, such as a sheet's field. */
43
43
  boxClassName?: string;
44
+ /** The field's name, for an app's `PartsBody`. Default: the two ends' words. */
45
+ label?: string;
44
46
  onRequestClose: (reason: CloseReason) => void;
45
47
  } & import("react").RefAttributes<RangeEditorHandle>>;
@@ -1,12 +1,15 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { forwardRef, useEffect, useImperativeHandle, useRef, } from "react";
3
+ import { forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState, } from "react";
4
4
  import { formatNumberText, parseNumber, roundTo, } from "@viewkitjs/fields";
5
5
  import { cx } from "../internal/cx.js";
6
6
  import { useViews } from "../provider/context.js";
7
- export const RangeEditor = forwardRef(function RangeEditor({ initial, seed, decimals = 0, allowEmpty = false, suffix, align = "end", conventions, bands, bandsAt = "popover", refusal, boxClassName, onRequestClose, }, ref) {
7
+ import { BodyFrame } from "./BodyFrame.js";
8
+ import { mergeParts, rangeBodyStart, resolveRangeBody } from "./parts-body.js";
9
+ import { usePickerForm } from "./picker-slot.js";
10
+ export const RangeEditor = forwardRef(function RangeEditor({ initial, seed, decimals = 0, allowEmpty = false, suffix, align = "end", conventions, bands, bandsAt = "popover", refusal, boxClassName, label, onRequestClose, }, ref) {
8
11
  const views = useViews();
9
- const { Input, Popover } = views.components;
12
+ const { Input, Popover, PartsBody } = views.components;
10
13
  const { List, Row } = views.atoms;
11
14
  const cv = conventions ?? views.conventions;
12
15
  const rootRef = useRef(null);
@@ -27,6 +30,14 @@ export const RangeEditor = forwardRef(function RangeEditor({ initial, seed, deci
27
30
  return n == null ? undefined : roundTo(n, decimals);
28
31
  };
29
32
  const text = (n) => n == null ? "" : formatNumberText(n, decimals, cv);
33
+ const form = usePickerForm();
34
+ const [bodyDraft, setBodyDraft] = useState(() => rangeBodyStart(initial, seed, parse));
35
+ const bodyRef = useRef(bodyDraft);
36
+ const bodyValue = { low: bodyDraft.low, high: bodyDraft.high };
37
+ const shownRef = useRef(bodyValue);
38
+ useLayoutEffect(() => {
39
+ shownRef.current = bodyValue;
40
+ });
30
41
  const resolveClose = (reason) => {
31
42
  if (reason === "escape")
32
43
  return { kind: "cancel" };
@@ -41,7 +52,11 @@ export const RangeEditor = forwardRef(function RangeEditor({ initial, seed, deci
41
52
  return { kind: "cancel" };
42
53
  return { kind: "commit", payload: { low, high } };
43
54
  };
44
- useImperativeHandle(ref, () => ({ resolveClose }));
55
+ useImperativeHandle(ref, () => ({
56
+ resolveClose: PartsBody
57
+ ? (reason) => resolveRangeBody(reason, bodyRef.current, initial, decimals, allowEmpty)
58
+ : resolveClose,
59
+ }));
45
60
  const keys = (which) => (e) => {
46
61
  e.stopPropagation();
47
62
  if (e.key === "Enter") {
@@ -80,6 +95,16 @@ export const RangeEditor = forwardRef(function RangeEditor({ initial, seed, deci
80
95
  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");
81
96
  const below = bandList !== null && bandsAt === "below";
82
97
  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;
98
+ if (PartsBody) {
99
+ const take = (next) => {
100
+ const current = bodyRef.current;
101
+ const merged = mergeParts({ low: current.low, high: current.high }, shownRef.current, next);
102
+ bodyRef.current = { low: merged.low, high: merged.high, unread: false };
103
+ setBodyDraft(bodyRef.current);
104
+ };
105
+ 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 ??
106
+ `${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 }) }));
107
+ }
83
108
  return (_jsxs("span", { ref: rootRef, onMouseDown: (e) => {
84
109
  if (!(e.target instanceof HTMLInputElement))
85
110
  e.preventDefault();
@@ -1,6 +1,7 @@
1
1
  import { type CategoryColor } from "@viewkitjs/fields/design/category-colors";
2
2
  import type { StatusSlot } from "@viewkitjs/fields/design/status-slots";
3
3
  import { type CloseReason, type CloseResolution, type FieldDefOf, type FieldMessageResolver } from "@viewkitjs/fields";
4
+ import type { ViewsStatusOption } from "../atoms/types.js";
4
5
  /**
5
6
  * THE option-picking core — one panel, many surfaces.
6
7
  *
@@ -42,6 +43,10 @@ export type SelectEditorHandle = {
42
43
  export declare const SelectEditor: import("react").ForwardRefExoticComponent<{
43
44
  /** In display order, colours already resolved. */
44
45
  options: PickerOption[];
46
+ /** A status field's steps (`statusSteps(field)`: its active options in their order), which each option's badge
47
+ * is placed among, as a cell places it (VK-482). An option that is no step (an archived or stray value offered
48
+ * last) is placed nowhere; left out, no badge is. */
49
+ steps?: readonly ViewsStatusOption[];
45
50
  /** The value the surface currently holds — checked in the list. */
46
51
  initial?: string | null;
47
52
  /** Offer "None" first — only when the surface says the value is optional.
@@ -3,10 +3,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
4
4
  import { resolveCategoryColor } from "@viewkitjs/fields/design/category-colors";
5
5
  import { optionsOf, } from "@viewkitjs/fields";
6
+ import { placeAmong } from "../display/status-steps.js";
6
7
  import { useViews } from "../provider/context.js";
7
8
  import { PickerFrame, pickerItemOf, typedPick, usePickerForm } from "./picker-slot.js";
8
9
  export const SELECT_SEARCH_PAST = 8;
9
- export const SelectEditor = forwardRef(function SelectEditor({ options, initial, clearable = false, onRequestClose, message, creatable = false, seed, focusSearch = false, focusList = false, label, }, ref) {
10
+ export const SelectEditor = forwardRef(function SelectEditor({ options, steps, initial, clearable = false, onRequestClose, message, creatable = false, seed, focusSearch = false, focusList = false, label, }, ref) {
10
11
  const searchable = creatable || options.length > SELECT_SEARCH_PAST;
11
12
  const [picked, setPicked] = useState(null);
12
13
  const pickedRef = useRef(null);
@@ -59,7 +60,7 @@ export const SelectEditor = forwardRef(function SelectEditor({ options, initial,
59
60
  onRequestClose(event.shiftKey ? "shift-tab" : "tab");
60
61
  return true;
61
62
  };
62
- const badge = (option) => option.slot ? (_jsx(StatusBadge, { slot: option.slot, label: option.label, leading: glyph(option.icon) })) : option.color ? (_jsx(Tag, { label: option.label, color: option.color, leading: glyph(option.icon) })) : (option.label);
63
+ const badge = (option) => option.slot ? (_jsx(StatusBadge, { slot: option.slot, label: option.label, leading: glyph(option.icon), place: steps && placeAmong(steps, option.value) })) : option.color ? (_jsx(Tag, { label: option.label, color: option.color, leading: glyph(option.icon) })) : (option.label);
63
64
  if (Picker) {
64
65
  const take = (value) => {
65
66
  if (Array.isArray(value) || (value === null && !clearable))
@@ -1,5 +1,5 @@
1
1
  import { type CSSProperties } from "react";
2
- import { type CloseReason, type CloseResolution } from "@viewkitjs/fields";
2
+ import type { CloseReason, CloseResolution } from "@viewkitjs/fields";
3
3
  /**
4
4
  * THE TEXT EDITOR — one box for every text-like value: text, a link, an email, a phone, a domain,
5
5
  * long text and rich text (VK-218). It owns what every surface used to write for itself and got
@@ -46,6 +46,16 @@ export type TextEditorProps = {
46
46
  style?: CSSProperties;
47
47
  /** Set on the box, over `{ "data-slot": "vk-text-editor" }`, for the host's own selectors. */
48
48
  boxData?: Readonly<Record<`data-${string}`, string>>;
49
+ /** The host's reading of a value: its reason, or null. Handed to a `TextBody`; unused by the editor's own box.
50
+ * Default: every value reads. */
51
+ check?: (value: string) => string | null;
52
+ /** The record's country, where a phone typed without its code is read: handed to a `TextBody` for a phone, and
53
+ * read by its close. */
54
+ region?: string | null;
55
+ /** The session keeps on Escape: a `TextBody`'s frame carries `EDITOR_INNER_ESCAPE`. Default false. */
56
+ escapeKeeps?: boolean;
57
+ /** Where a `TextBody` stands: `phone` in a sheet. Default `computer`. */
58
+ form?: "computer" | "phone";
49
59
  onRequestClose: (reason: CloseReason) => void;
50
60
  };
51
61
  export declare const TextEditor: import("react").ForwardRefExoticComponent<TextEditorProps & import("react").RefAttributes<TextEditorHandle>>;
@@ -1,10 +1,11 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { forwardRef, useCallback, useImperativeHandle, useRef, } from "react";
4
- import { normalizeMarkdown } from "@viewkitjs/fields";
3
+ import { forwardRef, useCallback, useImperativeHandle, useRef, useState, } from "react";
5
4
  import { cx } from "../internal/cx.js";
6
5
  import { ELEMENT_RESET } from "../internal/reset.js";
7
6
  import { useViews } from "../provider/context.js";
7
+ import { BodyFrame } from "./BodyFrame.js";
8
+ import { resolveTextBody, textChange, tidyText } from "./text-body.js";
8
9
  export const TEXT_INPUT_TYPE = {
9
10
  text: "text",
10
11
  url: "url",
@@ -13,14 +14,16 @@ export const TEXT_INPUT_TYPE = {
13
14
  phone: "tel",
14
15
  rich_text: "text",
15
16
  };
16
- export const TextEditor = forwardRef(function TextEditor({ type, initial, seed, multiline = type === "rich_text", wraps = false, readOnly = false, closeOnBlur = true, label, chrome = "bare", rows = 1, maxLines = 12, className, style, boxData, onRequestClose, }, ref) {
17
- const { Input } = useViews().components;
17
+ const EVERY_VALUE_READS = () => null;
18
+ export const TextEditor = forwardRef(function TextEditor({ type, initial, seed, multiline = type === "rich_text", wraps = false, readOnly = false, closeOnBlur = true, label, chrome = "bare", rows = 1, maxLines = 12, className, style, boxData, check, region, escapeKeeps = false, form = "computer", onRequestClose, }, ref) {
19
+ const { Input, TextBody: AppBody } = useViews().components;
20
+ const TextBody = readOnly ? undefined : AppBody;
21
+ const draftRef = useRef(seed ?? initial);
22
+ const [draft, setDraft] = useState(seed ?? initial);
18
23
  const boxRef = useRef(null);
19
24
  const area = multiline || wraps;
20
25
  const grows = area && maxLines > rows;
21
- const tidy = (text) => type === "rich_text"
22
- ? normalizeMarkdown(text)
23
- : (wraps && !multiline ? text.replace(/\s*\n\s*/g, " ") : text).trim();
26
+ const tidy = (text) => tidyText(type, wraps && !multiline, text);
24
27
  const resolveClose = (reason) => {
25
28
  if (readOnly)
26
29
  return { kind: "noop" };
@@ -29,7 +32,11 @@ export const TextEditor = forwardRef(function TextEditor({ type, initial, seed,
29
32
  const next = tidy(boxRef.current?.value ?? seed ?? initial);
30
33
  return next === tidy(initial) ? { kind: "noop" } : { kind: "commit", payload: next };
31
34
  };
32
- useImperativeHandle(ref, () => ({ resolveClose }));
35
+ useImperativeHandle(ref, () => ({
36
+ resolveClose: TextBody
37
+ ? (reason) => resolveTextBody(reason, draftRef.current, initial, { type, paragraph: multiline, region })
38
+ : resolveClose,
39
+ }));
33
40
  const attach = useCallback((el) => {
34
41
  boxRef.current = el;
35
42
  if (!el)
@@ -60,6 +67,16 @@ export const TextEditor = forwardRef(function TextEditor({ type, initial, seed,
60
67
  onRequestClose(event.shiftKey ? "shift-tab" : "tab");
61
68
  }
62
69
  };
70
+ if (TextBody) {
71
+ const drawn = draft;
72
+ return (_jsx(BodyFrame, { slot: "vk-text-body", innerEscape: escapeKeeps, closeOnModEnter: true, closeOnBlur: closeOnBlur, inPlace: closeOnBlur, onRequestClose: onRequestClose, children: _jsx(TextBody, { label: label ?? "", kind: type, paragraph: multiline, value: draft, onValueChange: (next) => {
73
+ const text = textChange(drawn, next);
74
+ if (text === null)
75
+ return;
76
+ draftRef.current = text;
77
+ setDraft(text);
78
+ }, onDone: () => onRequestClose("enter"), check: check ?? EVERY_VALUE_READS, ...(type === "phone" && region ? { region } : {}), typed: seed, autoFocus: true, form: form }) }));
79
+ }
63
80
  const shared = {
64
81
  "data-slot": "vk-text-editor",
65
82
  ...boxData,
@@ -40,5 +40,12 @@ export declare const ValueListEditor: import("react").ForwardRefExoticComponent<
40
40
  /** Escape keeps the rows (the host's session keeps: `EditSession.keeps`): it checks them first, as Enter does,
41
41
  * and an invalid row stays open with its error. Default false: Escape throws the edit away unchecked. */
42
42
  escapeKeeps?: boolean;
43
+ /** The field's name, for an app's `ValuesBody`. Default `field.label`. */
44
+ label?: string;
45
+ /** `one`: the field holds one value: one line, no main mark, no label box and no Add row; × empties the line.
46
+ * Default `several`. */
47
+ holds?: "one" | "several";
48
+ /** What was typed on what opened it: the first line's text starts as it, replacing what was there. */
49
+ seed?: string;
43
50
  onRequestClose: (reason: CloseReason) => void;
44
51
  } & import("react").RefAttributes<ValueListEditorHandle>>;