@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
@@ -0,0 +1,16 @@
1
+ import { type CloseReason, type CloseResolution } from "@viewkitjs/fields";
2
+ import type { TextEditorType } from "./TextEditor.js";
3
+ /** A text as it is saved: rich text tidied at its edges (`normalizeMarkdown`); anything else trimmed, a line's
4
+ * line breaks (with the spaces around them) first folded into one space when `fold`. */
5
+ export declare function tidyText(type: TextEditorType, fold: boolean, text: string): string;
6
+ /** A body's change against the value it was drawn with: null when it is no change (`null`, `undefined` and `""` one
7
+ * value), else the new draft. */
8
+ export declare function textChange(drawn: string, next: string | null | undefined): string | null;
9
+ /** A text body's close: escape cancels; the draft tidied (`fold` for a line) the same as the stored text tidied is a
10
+ * noop; a phone whose draft and stored text both read (`parsePhone` in `region`) as the same number and extension is
11
+ * a noop; else a commit of the tidied draft. */
12
+ export declare function resolveTextBody(reason: CloseReason, draft: string, initial: string, opts: {
13
+ type: TextEditorType;
14
+ paragraph: boolean;
15
+ region?: string | null;
16
+ }): CloseResolution<string>;
@@ -0,0 +1,30 @@
1
+ import { normalizeMarkdown, parsePhone } from "@viewkitjs/fields";
2
+ export function tidyText(type, fold, text) {
3
+ if (type === "rich_text")
4
+ return normalizeMarkdown(text);
5
+ return (fold ? text.replace(/\s*\n\s*/g, " ") : text).trim();
6
+ }
7
+ export function textChange(drawn, next) {
8
+ const text = next ?? "";
9
+ return text === drawn ? null : text;
10
+ }
11
+ function phoneKey(text, region) {
12
+ if (text.trim() === "")
13
+ return null;
14
+ const read = parsePhone(text, region);
15
+ return read.ok ? `${read.value.number};${read.value.extension ?? ""}` : null;
16
+ }
17
+ export function resolveTextBody(reason, draft, initial, opts) {
18
+ if (reason === "escape")
19
+ return { kind: "cancel" };
20
+ const fold = !opts.paragraph;
21
+ const next = tidyText(opts.type, fold, draft);
22
+ if (next === tidyText(opts.type, fold, initial))
23
+ return { kind: "noop" };
24
+ if (opts.type === "phone") {
25
+ const was = phoneKey(initial, opts.region);
26
+ if (was !== null && was === phoneKey(next, opts.region))
27
+ return { kind: "noop" };
28
+ }
29
+ return { kind: "commit", payload: next };
30
+ }
@@ -0,0 +1,47 @@
1
+ import { type CloseReason, type CloseResolution, type MultipleType, type ValueItem } from "@viewkitjs/fields";
2
+ import type { ViewsValueLine } from "../provider/components.js";
3
+ /** A line of the draft: its id, its text, its label ("" for none), whether it is main, and, for a line the editor's own
4
+ * rows opened, the stored value and the text it opened as (a row whose text is still that keeps the value). */
5
+ export type ValueRow = {
6
+ id: number;
7
+ text: string;
8
+ label: string;
9
+ main: boolean;
10
+ stored?: {
11
+ value: unknown;
12
+ text: string;
13
+ };
14
+ };
15
+ /** A value's text as a line shows it: a string as it is, a phone written out. */
16
+ export declare function valueText(value: unknown): string;
17
+ /** The stored list as the editor reads it: one main (the first marked, when data written elsewhere marks several),
18
+ * main first, a blank label as none. */
19
+ export declare function openedItems(initial: unknown): ValueItem<unknown>[];
20
+ /**
21
+ * The editor's close over its rows: Escape cancels; any other close keeps what was built. Blank rows are dropped; an
22
+ * untouched row keeps its stored value as stored; the main one first (the first, when none is marked); the same
23
+ * values, labels and main as opened is a noop; an empty list commits null with `allowEmpty` and cancels without it.
24
+ */
25
+ export declare function resolveValueRows(reason: CloseReason, rows: readonly ValueRow[], opened: readonly ValueItem<unknown>[], labels: boolean, allowEmpty: boolean): CloseResolution<ValueItem<unknown>[] | null>;
26
+ /**
27
+ * Each line matched to an opened value it hands back (each opened value once): by the field's reading of the value (a
28
+ * phone as the number and extension it reads as, however it is written) or by the text the value opened as. A matched
29
+ * line carries it as `stored`, so it commits as stored.
30
+ */
31
+ export declare function storedByText(rows: readonly ValueRow[], opened: readonly ValueItem<unknown>[], type?: MultipleType, region?: string | null): ValueRow[];
32
+ /** The rows as a body is handed them: `{ value: text, label?, main }`, the label left out when blank. */
33
+ export declare function bodyLines(rows: readonly ValueRow[]): ViewsValueLine[];
34
+ /**
35
+ * A change merged into the draft against what the body was drawn with (`shown`). Classified against `shown`: the same
36
+ * length is edits to lines in place, unless it holds the same lines (value and label) in another order, which is a
37
+ * reorder; one shorter where the rest close up is a line removed; one longer with the rest as drawn is a line added at
38
+ * the end; anything else is the list as handed. Edits, a removal and an addition are applied to the draft by line id,
39
+ * so two changes handed from the same stale props both land and a line removed since is never brought back. A reorder
40
+ * and anything else take the list as handed, a line keeping the id of the drawn line it matches. After any change
41
+ * exactly one line is main.
42
+ */
43
+ export declare function mergeValueLines(draft: readonly ValueRow[], shown: readonly ValueRow[], next: readonly ViewsValueLine[], newId: () => number): ValueRow[];
44
+ /** The stored value of a field holding one as a list to open the editor on: no value, none; else that one. */
45
+ export declare function listOfOne(stored: unknown): unknown[];
46
+ /** A list editor's answer as the text editor's: a list commits its main value's text, null commits "". */
47
+ export declare function oneOfList(answer: CloseResolution<ValueItem<unknown>[] | null>): CloseResolution<string>;
@@ -0,0 +1,140 @@
1
+ import { isPhoneShape, parsePhone, phoneText, valueItems, valueKey, } from "@viewkitjs/fields";
2
+ export function valueText(value) {
3
+ if (typeof value === "string")
4
+ return value;
5
+ return phoneText(value, null) || String(value);
6
+ }
7
+ export function openedItems(initial) {
8
+ const items = valueItems(initial);
9
+ const main = items.find((item) => item.main);
10
+ const one = items.map((item) => ({ ...item, label: item.label?.trim() || null, main: item === main }));
11
+ const first = one.find((item) => item.main);
12
+ return first ? [first, ...one.filter((item) => item !== first)] : one;
13
+ }
14
+ const untouched = (row) => row.stored !== undefined && row.text === row.stored.text;
15
+ export function resolveValueRows(reason, rows, opened, labels, allowEmpty) {
16
+ if (reason === "escape")
17
+ return { kind: "cancel" };
18
+ const kept = rows.filter((row) => row.text.trim() !== "");
19
+ const items = kept.map((row) => ({
20
+ value: untouched(row) ? row.stored.value : row.text.trim(),
21
+ label: labels && row.label.trim() !== "" ? row.label.trim() : null,
22
+ main: row.main,
23
+ }));
24
+ if (items.length > 0 && !items.some((item) => item.main))
25
+ items[0] = { ...items[0], main: true };
26
+ const main = items.find((item) => item.main);
27
+ const next = main ? [main, ...items.filter((item) => item !== main)] : items;
28
+ const same = next.length === opened.length &&
29
+ next.every((item, at) => {
30
+ const was = opened[at];
31
+ return (valueKey(item.value) === valueKey(was.value) &&
32
+ item.label === (labels ? was.label : null) &&
33
+ item.main === was.main);
34
+ });
35
+ if (same)
36
+ return { kind: "noop" };
37
+ if (next.length === 0)
38
+ return allowEmpty ? { kind: "commit", payload: null } : { kind: "cancel" };
39
+ return { kind: "commit", payload: next };
40
+ }
41
+ function matchKey(value, type, region) {
42
+ if (type === "phone") {
43
+ if (isPhoneShape(value))
44
+ return `${value.number};${value.extension ?? ""}`;
45
+ if (typeof value === "string") {
46
+ const read = parsePhone(value, region);
47
+ if (read.ok)
48
+ return `${read.value.number};${read.value.extension ?? ""}`;
49
+ }
50
+ }
51
+ return valueKey(value);
52
+ }
53
+ export function storedByText(rows, opened, type, region) {
54
+ const free = opened.map((item) => ({ value: item.value, text: valueText(item.value), key: matchKey(item.value, type, region) }));
55
+ return rows.map((row) => {
56
+ const key = matchKey(row.text, type, region);
57
+ const at = free.findIndex((item) => item.text === row.text || item.key === key);
58
+ if (at < 0) {
59
+ const { stored: _stored, ...rest } = row;
60
+ return rest;
61
+ }
62
+ const [item] = free.splice(at, 1);
63
+ return { ...row, stored: { value: item.value, text: row.text } };
64
+ });
65
+ }
66
+ export function bodyLines(rows) {
67
+ return rows.map((row) => (row.label.trim() !== "" ? { value: row.text, label: row.label, main: row.main } : { value: row.text, main: row.main }));
68
+ }
69
+ const sameLabel = (a, b) => (a ?? "") === (b ?? "");
70
+ const sameMain = (a, b) => !!a === !!b;
71
+ const lineKey = (value, label) => `${value}\u0000${label ?? ""}`;
72
+ const sameLines = (next, shown) => next.length === shown.length &&
73
+ next.every((line, at) => line.value === shown[at].text && sameLabel(line.label, shown[at].label));
74
+ function oneMain(rows, marked) {
75
+ const main = marked ?? rows.find((row) => row.main)?.id ?? rows[0]?.id;
76
+ return rows.map((row) => (row.main === (row.id === main) ? row : { ...row, main: row.id === main }));
77
+ }
78
+ export function mergeValueLines(draft, shown, next, newId) {
79
+ const n = next.length;
80
+ const s = shown.length;
81
+ if (n === s) {
82
+ const shownKeys = shown.map((row) => lineKey(row.text, row.label)).sort();
83
+ const nextKeys = next.map((line) => lineKey(line.value, line.label)).sort();
84
+ const reordered = shownKeys.every((key, at) => key === nextKeys[at]) && !sameLines(next, shown);
85
+ if (!reordered) {
86
+ let rows = [...draft];
87
+ let marked = null;
88
+ next.forEach((line, at) => {
89
+ const was = shown[at];
90
+ const edit = {};
91
+ if (line.value !== was.text)
92
+ edit.text = line.value;
93
+ if (!sameLabel(line.label, was.label))
94
+ edit.label = line.label ?? "";
95
+ if (!sameMain(line.main, was.main) && line.main)
96
+ marked = was.id;
97
+ if (Object.keys(edit).length > 0)
98
+ rows = rows.map((row) => (row.id === was.id ? { ...row, ...edit } : row));
99
+ });
100
+ const markedHere = marked !== null && rows.some((row) => row.id === marked) ? marked : null;
101
+ return markedHere === null && Object.is(rows.length, draft.length) && rows.every((row, at) => row === draft[at])
102
+ ? [...draft]
103
+ : oneMain(rows, markedHere);
104
+ }
105
+ }
106
+ if (n === s - 1) {
107
+ let gone = next.findIndex((line, at) => line.value !== shown[at].text || !sameLabel(line.label, shown[at].label));
108
+ if (gone < 0)
109
+ gone = s - 1;
110
+ const closes = next.slice(gone).every((line, at) => line.value === shown[gone + at + 1].text && sameLabel(line.label, shown[gone + at + 1].label));
111
+ if (closes) {
112
+ const id = shown[gone].id;
113
+ const markedAt = next.findIndex((line) => line.main);
114
+ const was = markedAt < 0 ? undefined : shown[markedAt < gone ? markedAt : markedAt + 1];
115
+ const left = draft.filter((row) => row.id !== id);
116
+ return oneMain(left, was && left.some((row) => row.id === was.id) ? was.id : null);
117
+ }
118
+ }
119
+ if (n === s + 1 && sameLines(next.slice(0, s), shown)) {
120
+ const line = next[s];
121
+ const added = { id: newId(), text: line.value, label: line.label ?? "", main: !!line.main };
122
+ return oneMain([...draft, added], line.main ? added.id : null);
123
+ }
124
+ const free = [...shown];
125
+ const rows = next.map((line) => {
126
+ const at = free.findIndex((row) => row.text === line.value && sameLabel(row.label, line.label));
127
+ const id = at >= 0 ? free.splice(at, 1)[0].id : newId();
128
+ return { id, text: line.value, label: line.label ?? "", main: !!line.main };
129
+ });
130
+ return oneMain(rows, rows.find((row) => row.main)?.id ?? null);
131
+ }
132
+ export function listOfOne(stored) {
133
+ return stored == null || stored === "" ? [] : [stored];
134
+ }
135
+ export function oneOfList(answer) {
136
+ if (answer.kind !== "commit")
137
+ return answer;
138
+ const first = answer.payload?.[0];
139
+ return { kind: "commit", payload: first ? valueText(first.value) : "" };
140
+ }
@@ -2,6 +2,7 @@ import { type ReactNode } from "react";
2
2
  import type { DisplayOptions } from "../display/options.js";
3
3
  import type { FieldBinding } from "../fields/binding.js";
4
4
  import type { FieldRowMenuItem } from "../fields/menus.js";
5
+ import type { ViewsMessageResolver } from "../contract.js";
5
6
  import { type FieldNote, type FieldWriteAdmission } from "../fields/write-target.js";
6
7
  export type FieldRowProps<Row> = {
7
8
  binding: FieldBinding<Row>;
@@ -33,6 +34,12 @@ export type FieldRowProps<Row> = {
33
34
  * relation's candidates wear in its editor. Unanswered, they wear the field type's glyph. */
34
35
  kindIcon?: (kind: string) => string | undefined;
35
36
  };
37
+ /**
38
+ * A field row's verbs as its menu hands them over. While the record is still loading, every verb is disabled (a verb
39
+ * would act on the seed) and says why, unless the app disabled it with a reason of its own. Internal: exported for its
40
+ * test, never from the folder's door.
41
+ */
42
+ export declare function fieldRowMenuItems(menu: readonly FieldRowMenuItem[] | undefined, ready: boolean, messages: ViewsMessageResolver): FieldRowMenuItem[];
36
43
  /**
37
44
  * THE FIELD ROW — the third host of the shared field cores (docs/guides/editors.md), after
38
45
  * the grid cell and the form field: one field of a record, in its panel or page.
@@ -9,15 +9,31 @@ import { ELEMENT_RESET } from "../internal/reset.js";
9
9
  import { useViews } from "../provider/context.js";
10
10
  import { RowEditor } from "./editors/RowEditor.js";
11
11
  import { FieldNoteLine } from "./FieldNoteLine.js";
12
+ import { FieldRowCheckbox } from "./field-row-checkbox.js";
13
+ import { FIELD_ROW_FRAME, FIELD_ROW_FRAME_BESIDE, FIELD_ROW_FRAME_UNDER, FieldRowButton, drawFieldRowButton, } from "./field-row-button.js";
12
14
  import { FieldRowLane } from "./FieldRowLane.js";
13
15
  import { FieldWriteReconciliationRequired, } from "../fields/write-target.js";
14
16
  import { OpenValueAction, isOpenableType } from "../editors/open-value.js";
15
17
  import { FIELD_ROW_TARGET as TARGET, FIELD_ROW_TARGET_BESIDE as TARGET_BESIDE, FIELD_ROW_TARGET_UNDER as TARGET_UNDER, } from "./row-target.js";
16
18
  import { settlementAttributes, useRowSettlement } from "./useRowSettlement.js";
19
+ import { EditLeaveContext, useEditLeaveScope } from "../editors/leave-scope.js";
17
20
  const EDITOR_PANEL = '[data-slot="vk-editor-panel"]';
21
+ export function fieldRowMenuItems(menu, ready, messages) {
22
+ return (menu ?? []).map((item) => {
23
+ const onClick = () => {
24
+ if (ready)
25
+ item.onClick();
26
+ };
27
+ if (ready)
28
+ return { ...item, onClick };
29
+ const reason = (item.disabled && item.disabledReason) || messages({ key: "views.menus.loading" });
30
+ return { ...item, disabled: true, disabledReason: reason, onClick };
31
+ });
32
+ }
18
33
  function FieldRowImpl({ binding, row, value, editValue, writable, ready = true, unread = false, refusal, onCommit, opts, menu, meta, note, kindIcon, }) {
19
34
  const { field } = binding;
20
- const { atoms, components, conventions, icons } = useViews();
35
+ const views = useViews();
36
+ const { atoms, components, conventions, icons, messages, fieldRowCheckboxes } = views;
21
37
  const { CommandMenu } = atoms;
22
38
  const { AppIcon } = components;
23
39
  const [editing, setEditing] = useState(false);
@@ -26,6 +42,7 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
26
42
  const [error, setError] = useState(null);
27
43
  const [retryDraft, setRetryDraft] = useState(null);
28
44
  const settlement = useRowSettlement(row);
45
+ const leaveScope = useEditLeaveScope();
29
46
  const message = opts?.presentation?.message ?? resolveFieldMessage;
30
47
  const buttonRef = useRef(null);
31
48
  const focusBack = useRef(null);
@@ -101,13 +118,14 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
101
118
  setError(null);
102
119
  settlement.settle(receipt);
103
120
  }, (failure) => {
104
- setPending(null);
105
- setRetryDraft({ commit: resolution.payload });
106
- setError(failure instanceof FieldWriteReconciliationRequired
121
+ const reason = failure instanceof FieldWriteReconciliationRequired
107
122
  ? failure.warning
108
123
  : failure instanceof Error && failure.name === "FieldWriteRefusal"
109
124
  ? failure.message
110
- : message({ key: "field.retry-save" }));
125
+ : message({ key: "field.retry-save" });
126
+ setPending(null);
127
+ setRetryDraft({ commit: resolution.payload, reason });
128
+ setError(reason);
111
129
  });
112
130
  return { accepted: true };
113
131
  };
@@ -130,6 +148,7 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
130
148
  ...opts,
131
149
  currency: opts?.currency ?? (fieldOwnsCurrency || unread ? undefined : binding.unit?.read(row)),
132
150
  ...(valueInButton ? { slotOwnsClick: true } : {}),
151
+ ...(fieldRowCheckboxes === "checkbox" ? { booleanCheckbox: FieldRowCheckbox } : {}),
133
152
  };
134
153
  const editsInPlace = writable && shownDef.type !== "boolean" && !hasMenu && !unread && !isEmpty;
135
154
  const openType = editsInPlace && singleLink && isOpenableType(shownDef.type) ? shownDef.type : null;
@@ -163,30 +182,31 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
163
182
  const body = unread ? null : isEmpty ? (shownDef.type === "boolean" ? (renderFieldValue(field, shown, displayOpts)) : writable ? null : (_jsx("span", { className: "text-(color:--vk-fg-subtle)", children: "\u2014" }))) : (drawn());
164
183
  const TypeGlyph = icons[field.type];
165
184
  const glyph = binding.icon ? (_jsx(AppIcon, { name: binding.icon, className: "h-3.5 w-3.5 text-(color:--vk-fg-subtlest)" })) : (_jsx(TypeGlyph, { className: "h-3.5 w-3.5 text-(color:--vk-fg-subtlest)" }));
166
- const menuItems = (menu ?? []).map((item) => ({
167
- ...item,
168
- disabled: !ready || item.disabled,
169
- onClick: () => {
170
- if (ready)
171
- item.onClick();
172
- },
173
- }));
185
+ const menuItems = fieldRowMenuItems(menu, ready, messages);
174
186
  const valueNode = (_jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: [_jsx("span", { className: "min-w-0 wrap-break-word", children: body }), meta ? _jsx("span", { className: "shrink-0 text-xs text-(color:--vk-fg-subtle)", children: meta }) : null] }));
175
- const editButton = (className, children) => (_jsx("button", { ref: buttonRef, type: "button", "aria-label": field.label, disabled: !ready, "aria-disabled": pending ? true : undefined, onClick: (event) => {
187
+ const editButton = (shape, className, children) => (_jsx(FieldRowButton, { views: views, own: cx(className, "aria-disabled:pointer-events-none"), frame: cx(shape === "under" ? FIELD_ROW_FRAME_UNDER : shape === "beside" ? FIELD_ROW_FRAME_BESIDE : FIELD_ROW_FRAME, "disabled:pointer-events-none aria-disabled:pointer-events-none", shape !== "under" && pending && "opacity-70"), variant: "ghost", size: "sm", ref: buttonRef, "aria-label": field.label, disabled: !ready, "aria-disabled": pending ? true : undefined, onClick: (event) => {
176
188
  if (pending)
177
189
  return;
178
190
  setError(null);
179
191
  setByKey(event.detail === 0);
180
192
  setEditing(true);
181
- }, className: cx(ELEMENT_RESET, className, "aria-disabled:pointer-events-none"), children: children }));
182
- return (_jsxs("div", { className: "flex items-start gap-3 border-b border-(color:--vk-border) py-2.5 last:border-0", "aria-busy": pending ? "true" : undefined, children: [_jsx("span", { className: "flex h-5 w-3.5 shrink-0 items-center justify-center", children: glyph }), _jsx("span", { className: "w-32 shrink-0 text-sm leading-5 text-(color:--vk-fg-subtle)", children: field.label }), _jsxs("div", { className: cx("min-w-0 flex-1 text-sm leading-5 text-(color:--vk-fg)", settlement.requested && "italic opacity-80"), ...settlementAttributes(settlement.requested, field.provenance, conventions), children: [editing ? (_jsx("div", { children: _jsx(RowEditor, { binding: binding, row: row, initial: retryDraft ? retryDraft.commit : editValue, shown: shown, conversion: convertedFrom ? body : undefined, anchor: _jsx("span", { className: cx(TARGET, "bg-(color:--vk-neutral)"), children: valueNode }), onAttempt: (resolution) => {
183
- watchLeaving();
184
- return attempt(resolution);
185
- }, onClose: closed, message: message, kindIcon: kindIcon, openedByKey: byKey }) })) : hasMenu && !verbsInLane ? (_jsx(CommandMenu, { trigger: _jsx("button", { type: "button", "aria-label": field.label, className: cx(ELEMENT_RESET, TARGET), disabled: !ready, children: valueNode }), items: menuItems, align: "start" })) : writable && shownDef.type !== "boolean" ? (valueOverButton ? (_jsxs("div", { className: "relative min-w-0", children: [editButton(cx(TARGET_UNDER, "disabled:pointer-events-none")), _jsx("span", { "data-slot": "vk-row-value-layer", className: cx("pointer-events-none relative block min-w-0 [&_a]:pointer-events-auto [&_button]:pointer-events-auto", pending && "opacity-70"), children: valueNode })] })) : openType ? (_jsxs("div", { className: "flex min-w-0 items-center gap-1", children: [editButton(cx(TARGET_BESIDE, "disabled:pointer-events-none", pending && "opacity-70"), valueNode), _jsx(OpenValueAction, { type: openType, value: openValue, label: openLabel, compact: true })] })) : (editButton(cx(TARGET, "disabled:pointer-events-none", pending && "opacity-70"), valueNode))) : (_jsx("span", { className: "block min-w-0", children: valueNode })), !editing && note ? (_jsx(FieldNoteLine, { note: typeof note === "string" ? { text: note } : note })) : null, !editing && error && retryDraft ? (_jsx("div", { role: "alert", className: "mt-1 text-xs text-(color:--vk-danger)", children: _jsx("button", { type: "button", onClick: () => {
186
- setError(null);
187
- const retried = attempt({ kind: "commit", payload: retryDraft.commit });
188
- if (!retried.accepted)
189
- setError(retried.reason);
190
- }, className: cx(ELEMENT_RESET, "hover:underline"), children: error }) })) : null] }), _jsx(FieldRowLane, { label: field.label, verbsInLane: verbsInLane, hasMenu: hasMenu, items: menuItems, ready: ready, writable: writable, refusal: refusal })] }));
193
+ }, children: children }));
194
+ return (_jsx(EditLeaveContext.Provider, { value: leaveScope, children: _jsxs("div", { className: "flex items-start gap-3 border-b border-(color:--vk-border) py-2.5 last:border-0", "aria-busy": pending ? "true" : undefined, children: [_jsx("span", { className: "flex h-5 w-3.5 shrink-0 items-center justify-center", children: glyph }), _jsx("span", { className: "w-32 shrink-0 text-sm leading-5 text-(color:--vk-fg-subtle)", children: field.label }), _jsxs("div", { className: cx("min-w-0 flex-1 text-sm leading-5 text-(color:--vk-fg)", settlement.requested && "italic opacity-80"), ...settlementAttributes(settlement.requested, field.provenance, conventions), children: [editing ? (_jsx("div", { children: _jsx(RowEditor, { binding: binding, row: row, initial: retryDraft ? retryDraft.commit : editValue, refused: retryDraft?.reason, shown: shown, conversion: convertedFrom ? body : undefined, anchor: _jsx("span", { className: cx(TARGET, "bg-(color:--vk-neutral)"), children: valueNode }), onAttempt: (resolution) => {
195
+ watchLeaving();
196
+ return attempt(resolution);
197
+ }, onClose: closed, message: message, kindIcon: kindIcon, openedByKey: byKey }) })) : hasMenu && !verbsInLane ? (_jsx(CommandMenu, { trigger: drawFieldRowButton(views, {
198
+ own: TARGET,
199
+ frame: FIELD_ROW_FRAME,
200
+ variant: "ghost",
201
+ size: "sm",
202
+ "aria-label": field.label,
203
+ disabled: !ready,
204
+ children: valueNode,
205
+ }), items: menuItems, align: "start" })) : writable && shownDef.type !== "boolean" ? (valueOverButton ? (_jsxs("div", { className: "relative min-w-0", children: [editButton("under", cx(TARGET_UNDER, "disabled:pointer-events-none")), _jsx("span", { "data-slot": "vk-row-value-layer", className: cx("pointer-events-none relative block min-w-0 [&_a]:pointer-events-auto [&_button]:pointer-events-auto", pending && "opacity-70"), children: valueNode })] })) : openType ? (_jsxs("div", { className: "flex min-w-0 items-center gap-1", children: [editButton("beside", cx(TARGET_BESIDE, "disabled:pointer-events-none", pending && "opacity-70"), valueNode), _jsx(OpenValueAction, { type: openType, value: openValue, label: openLabel, compact: true })] })) : (editButton("target", cx(TARGET, "disabled:pointer-events-none", pending && "opacity-70"), valueNode))) : (_jsx("span", { className: "block min-w-0", children: valueNode })), !editing && note ? (_jsx(FieldNoteLine, { note: typeof note === "string" ? { text: note } : note })) : null, !editing && error && retryDraft ? (_jsx("div", { role: "alert", className: "mt-1 text-xs text-(color:--vk-danger)", children: _jsx("button", { type: "button", "data-slot": "vk-field-retry", onClick: () => {
206
+ setError(null);
207
+ const retried = attempt({ kind: "commit", payload: retryDraft.commit });
208
+ if (!retried.accepted)
209
+ setError(retried.reason);
210
+ }, className: cx(ELEMENT_RESET, "hover:underline"), children: error }) })) : null] }), _jsx(FieldRowLane, { label: field.label, verbsInLane: verbsInLane, hasMenu: hasMenu, items: menuItems, ready: ready, writable: writable, refusal: refusal })] }) }));
191
211
  }
192
212
  export const FieldRow = memo(FieldRowImpl);
@@ -1,13 +1,21 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { cx } from "../internal/cx.js";
4
- import { ELEMENT_RESET } from "../internal/reset.js";
5
3
  import { useViews } from "../provider/context.js";
4
+ import { drawFieldRowButton } from "./field-row-button.js";
6
5
  export function FieldRowLane({ label, verbsInLane, hasMenu, items, ready, writable, refusal, }) {
7
- const { atoms, icons } = useViews();
6
+ const views = useViews();
7
+ const { atoms, icons } = views;
8
8
  const { CommandMenu } = atoms;
9
9
  const Chevron = icons.chevronDown;
10
10
  const More = icons.more;
11
11
  const Lock = icons.lock;
12
- return (_jsx("span", { className: "flex h-5 w-3 shrink-0 items-center justify-center", children: verbsInLane ? (_jsx(CommandMenu, { trigger: _jsx("button", { type: "button", "aria-label": label, className: cx(ELEMENT_RESET, "group -m-1 p-1"), disabled: !ready, children: _jsx(Chevron, { className: "h-3 w-3 text-(color:--vk-fg-subtlest) transition-colors group-hover:text-(color:--vk-fg-subtle)" }) }), items: items, align: "end", label: label })) : hasMenu ? (_jsx(More, { className: "h-3 w-3 text-(color:--vk-fg-subtlest)" })) : !writable && refusal ? (_jsx("span", { title: refusal, className: "leading-none", children: _jsx(Lock, { className: "h-3 w-3 text-(color:--vk-fg-subtlest)" }) })) : null }));
12
+ return (_jsx("span", { className: "flex h-5 w-3 shrink-0 items-center justify-center", children: verbsInLane ? (_jsx(CommandMenu, { trigger: drawFieldRowButton(views, {
13
+ own: "group -m-1 p-1",
14
+ frame: "group -m-1 size-5 shrink-0",
15
+ variant: "ghost",
16
+ size: "icon",
17
+ "aria-label": label,
18
+ disabled: !ready,
19
+ children: (_jsx(Chevron, { className: "h-3 w-3 text-(color:--vk-fg-subtlest) transition-colors group-hover:text-(color:--vk-fg-subtle)" })),
20
+ }), items: items, align: "end", label: label })) : hasMenu ? (_jsx(More, { className: "h-3 w-3 text-(color:--vk-fg-subtlest)" })) : !writable && refusal ? (_jsx("span", { title: refusal, className: "leading-none", children: _jsx(Lock, { className: "h-3 w-3 text-(color:--vk-fg-subtlest)" }) })) : null }));
13
21
  }
@@ -8,7 +8,9 @@ import { EditorPanel } from "../../editors/EditorPanel.js";
8
8
  import { offeredValues, takesNewValues, useOpenValues } from "../../editors/open-values.js";
9
9
  import { OPTION_ROW_INSET } from "./host.js";
10
10
  import { useRowEditSession } from "./row-session.js";
11
+ import { useBodyPanel } from "../../editors/body-panel.js";
11
12
  export function RowChipsEditor({ field, initial, anchor, onAttempt, onClose, message, }) {
13
+ const panel = useBodyPanel("picker", "w-64", "z-90");
12
14
  const editorRef = useRef(null);
13
15
  const anchorRef = useRef(null);
14
16
  const { session, close } = useRowEditSession({ editorRef, onAttempt, onClose });
@@ -21,5 +23,5 @@ export function RowChipsEditor({ field, initial, anchor, onAttempt, onClose, mes
21
23
  label: optionFor(field, value)?.label ?? value,
22
24
  color: resolveCategoryColor(value, field.options, undefined),
23
25
  });
24
- return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { session: session, title: field.label, anchor: anchorRef, align: "start", alignOffset: -OPTION_ROW_INSET, sideOffset: 4, initialFocus: false, chrome: "menu", className: "w-64 z-90", children: _jsx(ChipsEditor, { ref: editorRef, values: values, suggestions: offeredValues(field, known), resolve: resolve, normalize: normalizerFor(field), creatable: takesNewValues(field), onRequestClose: close, message: message, label: field.label }) })] }));
26
+ return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { panelData: panel.data, session: session, title: field.label, anchor: anchorRef, align: "start", alignOffset: -OPTION_ROW_INSET, sideOffset: 4, initialFocus: false, chrome: "menu", className: panel.className, children: _jsx(ChipsEditor, { ref: editorRef, values: values, suggestions: offeredValues(field, known), resolve: resolve, normalize: normalizerFor(field), creatable: takesNewValues(field), onRequestClose: close, message: message, label: field.label }) })] }));
25
27
  }
@@ -8,6 +8,7 @@ import { RowNumberEditor } from "./RowNumberEditor.js";
8
8
  import { RowPlaceEditor } from "./RowPlaceEditor.js";
9
9
  import { RowRangeEditor } from "./RowRangeEditor.js";
10
10
  import { RowRelationEditor } from "./RowRelationEditor.js";
11
+ import { RowRefusedContext } from "./row-session.js";
11
12
  import { RowSelectEditor } from "./RowSelectEditor.js";
12
13
  import { RowTextEditor } from "./RowTextEditor.js";
13
14
  import { RowListOrText } from "./RowValueListEditor.js";
@@ -61,5 +62,5 @@ export function RowEditor(props) {
61
62
  if (!mountsHost(field))
62
63
  return hostless(field);
63
64
  const Host = ROW_HOSTS[field.type];
64
- return (_jsx(EditFieldTypeContext.Provider, { value: field.type, children: _jsx(Host, { ...props, field: field }) }));
65
+ return (_jsx(EditFieldTypeContext.Provider, { value: field.type, children: _jsx(RowRefusedContext.Provider, { value: props.refused, children: _jsx(Host, { ...props, field: field }) }) }));
65
66
  }
@@ -1,4 +1,7 @@
1
1
  import type { RowHostProps } from "./host.js";
2
2
  /** The FIELD ROW's host around the shared `NameEditor` — in place, like the
3
- * range host: three boxes replace the value where it sits, on every width. */
4
- export declare function RowNameEditor<Row>({ field, initial, onAttempt, onClose, }: RowHostProps<Row, "name">): import("react/jsx-runtime").JSX.Element;
3
+ * range host: three boxes replace the value where it sits, on every width.
4
+ * With an app's parts body it opens anchored instead, as the place host does:
5
+ * a popover under the value on a desktop, the sheet on a phone, the value on
6
+ * screen. */
7
+ export declare function RowNameEditor<Row>({ field, initial, anchor, onAttempt, onClose, }: RowHostProps<Row, "name">): import("react/jsx-runtime").JSX.Element;
@@ -1,15 +1,22 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useRef } from "react";
4
4
  import { isNameValue } from "@viewkitjs/fields";
5
5
  import { EditorPanel } from "../../editors/EditorPanel.js";
6
6
  import { NameEditor } from "../../editors/NameEditor.js";
7
7
  import { useViews } from "../../provider/context.js";
8
8
  import { RowRefusal, useRowEditSession } from "./row-session.js";
9
- export function RowNameEditor({ field, initial, onAttempt, onClose, }) {
10
- const { conventions } = useViews();
9
+ import { useBodyPanel } from "../../editors/body-panel.js";
10
+ export function RowNameEditor({ field, initial, anchor, onAttempt, onClose, }) {
11
+ const panel = useBodyPanel("parts", "w-80 p-2", "z-90 max-w-[calc(100vw-2rem)]");
12
+ const { conventions, components } = useViews();
13
+ const inPlace = !components.PartsBody;
11
14
  const editorRef = useRef(null);
12
15
  const anchorRef = useRef(null);
13
- const { session, close } = useRowEditSession({ editorRef, inPlace: true, onAttempt, onClose });
14
- return (_jsxs(EditorPanel, { session: session, title: field.label, anchor: anchorRef, inPlace: true, children: [_jsx(NameEditor, { ref: editorRef, initial: isNameValue(initial) ? initial : null, allowEmpty: !!field.nullable, conventions: conventions, onRequestClose: close }), _jsx(RowRefusal, { text: session.refusal })] }));
16
+ const { session, close } = useRowEditSession({ editorRef, inPlace, onAttempt, onClose });
17
+ const editor = (_jsx(NameEditor, { ref: editorRef, initial: isNameValue(initial) ? initial : null, allowEmpty: !!field.nullable, conventions: conventions, label: field.label, onRequestClose: close }));
18
+ if (!inPlace) {
19
+ return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { panelData: panel.data, session: session, title: field.label, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, chrome: "menu", className: panel.className, children: (surface) => (surface === "sheet" ? _jsx("div", { className: "px-4 pb-4", children: editor }) : editor) })] }));
20
+ }
21
+ return (_jsxs(EditorPanel, { session: session, title: field.label, anchor: anchorRef, inPlace: true, children: [editor, _jsx(RowRefusal, { text: session.refusal })] }));
15
22
  }
@@ -1,18 +1,34 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useRef } from "react";
4
+ import { acceptFieldCommit } from "@viewkitjs/fields";
4
5
  import { ConversionLine } from "../../display/converted.js";
5
6
  import { EditorPanel } from "../../editors/EditorPanel.js";
6
7
  import { NumberEditor } from "../../editors/NumberEditor.js";
8
+ import { numberBounds } from "../../editors/number-body.js";
7
9
  import { durationUnitOf, numberEditCode, numberEditDecimals } from "../../fields/number-edit.js";
8
10
  import { useViews } from "../../provider/context.js";
9
11
  import { RowRefusal, useRowEditSession } from "./row-session.js";
10
12
  export function RowNumberEditor({ binding, row, field, initial, conversion, onAttempt, onClose, }) {
11
- const { conventions } = useViews();
13
+ const { conventions, components } = useViews();
12
14
  const editorRef = useRef(null);
13
15
  const anchorRef = useRef(null);
14
16
  const { session, close } = useRowEditSession({ editorRef, inPlace: true, onAttempt, onClose });
15
17
  const decimals = numberEditDecimals(field);
16
18
  const durationUnit = durationUnitOf(field);
17
- return (_jsxs(EditorPanel, { session: session, title: field.label, anchor: anchorRef, inPlace: true, children: [_jsx(NumberEditor, { ref: editorRef, initial: typeof initial === "number" ? initial : Number.NaN, unit: binding.unit?.read(row), unitOptions: binding.unit ? [...binding.unit.options] : undefined, code: binding.unit ? undefined : numberEditCode(field), decimals: decimals, durationUnit: durationUnit, allowEmpty: !!field.nullable, align: "start", conventions: conventions, onRequestClose: close }), _jsx(RowRefusal, { text: session.refusal }), conversion ? _jsx(ConversionLine, { figure: conversion, className: "pt-1" }) : null] }));
19
+ const body = !!components.NumberBody && !durationUnit;
20
+ const unitOptions = binding.unit ? [...binding.unit.options] : undefined;
21
+ const check = (value, unit) => {
22
+ const read = acceptFieldCommit(field, { value, ...(unit === undefined ? {} : { unit }) }, { conventions, unitOptions });
23
+ return read.ok ? null : read.reason;
24
+ };
25
+ return (_jsxs(EditorPanel, { session: session, title: field.label, anchor: anchorRef, inPlace: true, children: [_jsx(NumberEditor, { ref: editorRef, initial: typeof initial === "number" ? initial : Number.NaN, unit: binding.unit?.read(row), unitOptions: unitOptions, code: binding.unit ? undefined : numberEditCode(field), decimals: decimals, durationUnit: durationUnit, allowEmpty: !!field.nullable, align: "start", conventions: conventions, ...(body
26
+ ? {
27
+ type: field.type,
28
+ label: field.label,
29
+ ...numberBounds(field),
30
+ check,
31
+ escapeKeeps: session.keeps ?? false,
32
+ }
33
+ : {}), onRequestClose: close }), _jsx(RowRefusal, { text: session.refusal }), conversion ? _jsx(ConversionLine, { figure: conversion, className: "pt-1" }) : null] }));
18
34
  }
@@ -5,14 +5,16 @@ import { EditorPanel } from "../../editors/EditorPanel.js";
5
5
  import { LocationEditor } from "../../editors/LocationEditor.js";
6
6
  import { useViews } from "../../provider/context.js";
7
7
  import { useRowEditSession } from "./row-session.js";
8
+ import { useBodyPanel } from "../../editors/body-panel.js";
8
9
  export function RowPlaceEditor({ field, initial, anchor, onAttempt, onClose, }) {
10
+ const panel = useBodyPanel("parts", "w-96 p-2", "z-90 max-w-[calc(100vw-2rem)]");
9
11
  const { conventions } = useViews();
10
12
  const editorRef = useRef(null);
11
13
  const anchorRef = useRef(null);
12
14
  const { session, close } = useRowEditSession({ editorRef, onAttempt, onClose });
13
15
  const place = initial && typeof initial === "object" && !Array.isArray(initial) ? initial : null;
14
- return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { session: session, title: field.label, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, chrome: "menu", className: "z-90 w-96 max-w-[calc(100vw-2rem)] p-2", children: (surface) => {
15
- const editor = (_jsx(LocationEditor, { ref: editorRef, field: field, initial: place, allowEmpty: true, conventions: conventions, chrome: surface === "sheet" ? "field" : "bare", onRequestClose: close }));
16
+ return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { panelData: panel.data, session: session, title: field.label, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, chrome: "menu", className: panel.className, children: (surface) => {
17
+ const editor = (_jsx(LocationEditor, { ref: editorRef, field: field, initial: place, allowEmpty: true, conventions: conventions, label: field.label, chrome: surface === "sheet" ? "field" : "bare", onRequestClose: close }));
16
18
  return surface === "sheet" ? _jsx("div", { className: "px-4 pb-4", children: editor }) : editor;
17
19
  } })] }));
18
20
  }
@@ -1,4 +1,7 @@
1
1
  import type { RowHostProps } from "./host.js";
2
2
  /** The FIELD ROW's host around the shared `RangeEditor` — in place, like the
3
- * number host: two boxes replace the value where it sits, on every width. */
4
- export declare function RowRangeEditor<Row>({ field, initial, onAttempt, onClose, }: RowHostProps<Row, "range">): import("react/jsx-runtime").JSX.Element;
3
+ * number host: two boxes replace the value where it sits, on every width.
4
+ * With an app's parts body it opens anchored instead, as the place host does:
5
+ * a popover under the value on a desktop, the sheet on a phone, the value on
6
+ * screen, the refusal drawn by the panel. */
7
+ export declare function RowRangeEditor<Row>({ field, initial, anchor, onAttempt, onClose, }: RowHostProps<Row, "range">): import("react/jsx-runtime").JSX.Element;
@@ -1,16 +1,23 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useRef } from "react";
4
4
  import { isRangeValue, rangeDecimals } from "@viewkitjs/fields";
5
5
  import { EditorPanel } from "../../editors/EditorPanel.js";
6
6
  import { RangeEditor } from "../../editors/RangeEditor.js";
7
7
  import { useViews } from "../../provider/context.js";
8
8
  import { RowRefusal, useRowEditSession } from "./row-session.js";
9
- export function RowRangeEditor({ field, initial, onAttempt, onClose, }) {
10
- const { conventions } = useViews();
9
+ import { useBodyPanel } from "../../editors/body-panel.js";
10
+ export function RowRangeEditor({ field, initial, anchor, onAttempt, onClose, }) {
11
+ const panel = useBodyPanel("parts", "w-80 p-2", "z-90 max-w-[calc(100vw-2rem)]");
12
+ const { conventions, components } = useViews();
13
+ const inPlace = !components.PartsBody;
11
14
  const editorRef = useRef(null);
12
15
  const anchorRef = useRef(null);
13
- const { session, close } = useRowEditSession({ editorRef, inPlace: true, onAttempt, onClose });
14
- const banded = (field.presets?.length ?? 0) > 0;
15
- return (_jsxs(EditorPanel, { session: session, title: field.label, anchor: anchorRef, inPlace: true, children: [_jsx(RangeEditor, { ref: editorRef, initial: isRangeValue(initial) ? initial : null, decimals: rangeDecimals(field), allowEmpty: !!field.nullable, suffix: field.of === "percent" ? "%" : field.of === "currency" ? field.code?.fixed : undefined, align: "start", bands: field.presets, refusal: session.refusal, conventions: conventions, onRequestClose: close }), !banded && _jsx(RowRefusal, { text: session.refusal })] }));
16
+ const { session, close } = useRowEditSession({ editorRef, inPlace, onAttempt, onClose });
17
+ const banded = (field.presets?.length ?? 0) > 0 && inPlace;
18
+ const editor = (_jsx(RangeEditor, { ref: editorRef, initial: isRangeValue(initial) ? initial : null, decimals: rangeDecimals(field), allowEmpty: !!field.nullable, suffix: field.of === "percent" ? "%" : field.of === "currency" ? field.code?.fixed : undefined, align: "start", bands: field.presets, refusal: session.refusal, conventions: conventions, label: field.label, onRequestClose: close }));
19
+ if (!inPlace) {
20
+ return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { panelData: panel.data, session: session, title: field.label, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, chrome: "menu", className: panel.className, children: (surface) => (surface === "sheet" ? _jsx("div", { className: "px-4 pb-4", children: editor }) : editor) })] }));
21
+ }
22
+ return (_jsxs(EditorPanel, { session: session, title: field.label, anchor: anchorRef, inPlace: true, children: [editor, !banded && _jsx(RowRefusal, { text: session.refusal })] }));
16
23
  }