viewkitjs 0.28.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (530) hide show
  1. package/CHANGELOG.md +218 -0
  2. package/MIGRATION.md +181 -11
  3. package/fields/dist/derived.d.ts +2 -1
  4. package/fields/dist/derived.js +9 -3
  5. package/fields/dist/entities.js +41 -3
  6. package/fields/dist/index.d.ts +1 -1
  7. package/fields/dist/index.js +1 -1
  8. package/fields/dist/messages.d.ts +8 -2
  9. package/fields/dist/messages.js +3 -0
  10. package/fields/dist/range.d.ts +6 -0
  11. package/fields/dist/range.js +8 -0
  12. package/fields/dist/registry.js +11 -1
  13. package/fields/dist/spec-changes.js +1 -0
  14. package/fields/dist/types.d.ts +23 -1
  15. package/fields/docs/guides/derived-fields.md +7 -5
  16. package/fields/docs/guides/field-types.md +2 -2
  17. package/fields/docs/guides/the-index.md +1 -1
  18. package/fields/docs/reference/fields.md +3 -1
  19. package/fields/docs/reference/types.md +3 -1
  20. package/fields/skills/viewkit/SKILL.md +1 -1
  21. package/package.json +2 -1
  22. package/postgres/dist/definitions/build.js +29 -5
  23. package/postgres/dist/definitions/label.d.ts +7 -0
  24. package/postgres/dist/definitions/label.js +9 -1
  25. package/postgres/dist/definitions/lookup.js +6 -2
  26. package/postgres/dist/definitions/place.d.ts +6 -3
  27. package/postgres/dist/definitions/rollup.js +5 -1
  28. package/postgres/dist/definitions/storage.d.ts +15 -0
  29. package/postgres/dist/definitions/storage.js +52 -1
  30. package/postgres/dist/definitions/stored.js +21 -0
  31. package/postgres/dist/phone.d.ts +13 -1
  32. package/postgres/dist/phone.js +23 -3
  33. package/postgres/dist/search-indexes.d.ts +6 -1
  34. package/postgres/dist/search-indexes.js +71 -25
  35. package/postgres/dist/search.js +3 -3
  36. package/postgres/docs/guides/definitions.md +22 -5
  37. package/postgres/docs/guides/field-map.md +5 -4
  38. package/postgres/docs/reference/definitions.md +3 -3
  39. package/postgres/docs/reference/postgres.md +1 -1
  40. package/views/dist/cells/cell-format.d.ts +2 -2
  41. package/views/dist/cells/cell-format.js +2 -2
  42. package/views/dist/cells/cell-values.js +9 -12
  43. package/views/dist/contract.d.ts +161 -18
  44. package/views/dist/contract.js +170 -28
  45. package/views/dist/controls/bulk-bar/bulk-bar-of.d.ts +66 -0
  46. package/views/dist/controls/bulk-bar/bulk-bar-of.js +22 -0
  47. package/views/dist/controls/bulk-bar/bulk-bar.d.ts +40 -0
  48. package/views/dist/controls/bulk-bar/bulk-bar.js +278 -0
  49. package/views/dist/controls/bulk-bar/looks.d.ts +10 -0
  50. package/views/dist/controls/bulk-bar/looks.js +14 -0
  51. package/views/dist/controls/bulk-bar/map-selection-bar.d.ts +19 -0
  52. package/views/dist/controls/bulk-bar/map-selection-bar.js +57 -0
  53. package/views/dist/controls/bulk-bar/tokens.d.ts +136 -0
  54. package/views/dist/controls/bulk-bar/tokens.js +36 -0
  55. package/views/dist/controls/bulk-bar/words.d.ts +50 -0
  56. package/views/dist/controls/bulk-bar/words.js +19 -0
  57. package/views/dist/controls/bulk-bar.css +96 -0
  58. package/views/dist/controls/button/button.js +3 -1
  59. package/views/dist/controls/button.css +5 -4
  60. package/views/dist/controls/checkbox/checkbox.js +3 -1
  61. package/views/dist/controls/checkbox.css +1 -1
  62. package/views/dist/controls/choice/tokens.d.ts +79 -0
  63. package/views/dist/controls/choice/tokens.js +22 -0
  64. package/views/dist/controls/choice.css +31 -0
  65. package/views/dist/controls/compound-editor/looks.js +1 -1
  66. package/views/dist/controls/controls.d.ts +8 -0
  67. package/views/dist/controls/controls.js +8 -0
  68. package/views/dist/controls/customize/customize.d.ts +176 -0
  69. package/views/dist/controls/customize/customize.js +348 -0
  70. package/views/dist/controls/customize/glide.d.ts +10 -0
  71. package/views/dist/controls/customize/glide.js +55 -0
  72. package/views/dist/controls/customize/looks.d.ts +13 -0
  73. package/views/dist/controls/customize/looks.js +11 -0
  74. package/views/dist/controls/customize/map-customize-body.d.ts +15 -0
  75. package/views/dist/controls/customize/map-customize-body.js +195 -0
  76. package/views/dist/controls/customize/map-ranges.d.ts +23 -0
  77. package/views/dist/controls/customize/map-ranges.js +41 -0
  78. package/views/dist/controls/customize/rules.d.ts +39 -0
  79. package/views/dist/controls/customize/rules.js +21 -0
  80. package/views/dist/controls/customize/tokens.d.ts +40 -0
  81. package/views/dist/controls/customize/tokens.js +12 -0
  82. package/views/dist/controls/customize/words.d.ts +65 -0
  83. package/views/dist/controls/customize/words.js +42 -0
  84. package/views/dist/controls/customize.css +57 -0
  85. package/views/dist/controls/date-editor/looks.js +1 -1
  86. package/views/dist/controls/filter-editor/block.d.ts +31 -0
  87. package/views/dist/controls/filter-editor/block.js +27 -0
  88. package/views/dist/controls/filter-editor/filter-editor.d.ts +4 -0
  89. package/views/dist/controls/filter-editor/filter-editor.js +86 -43
  90. package/views/dist/controls/filter-editor/how.d.ts +1 -1
  91. package/views/dist/controls/filter-editor/how.js +1 -0
  92. package/views/dist/controls/filter-editor/map-filter-body.d.ts +16 -1
  93. package/views/dist/controls/filter-editor/map-filter-body.js +39 -13
  94. package/views/dist/controls/filter-editor/map-rules.d.ts +27 -11
  95. package/views/dist/controls/filter-editor/map-rules.js +73 -42
  96. package/views/dist/controls/filter-editor/rules.d.ts +42 -5
  97. package/views/dist/controls/filter-editor/rules.js +55 -2
  98. package/views/dist/controls/filter-editor/words.d.ts +15 -0
  99. package/views/dist/controls/filter-editor/words.js +6 -0
  100. package/views/dist/controls/filter-editor.css +18 -0
  101. package/views/dist/controls/index.d.ts +33 -9
  102. package/views/dist/controls/index.js +32 -9
  103. package/views/dist/controls/inline-input/looks.js +1 -1
  104. package/views/dist/controls/input/input.js +10 -4
  105. package/views/dist/controls/internal/phone.d.ts +5 -4
  106. package/views/dist/controls/internal/phone.js +7 -7
  107. package/views/dist/controls/internal/scroll.js +5 -1
  108. package/views/dist/controls/internal/typed-run.d.ts +2 -0
  109. package/views/dist/controls/internal/typed-run.js +5 -0
  110. package/views/dist/controls/menu/map-menu.js +2 -2
  111. package/views/dist/controls/menu-list/menu-list.d.ts +16 -1
  112. package/views/dist/controls/menu-list/menu-list.js +26 -8
  113. package/views/dist/controls/menu-list.css +8 -0
  114. package/views/dist/controls/number-editor/looks.js +1 -1
  115. package/views/dist/controls/option/option.js +3 -1
  116. package/views/dist/controls/option.css +1 -1
  117. package/views/dist/controls/pane/pane.d.ts +4 -0
  118. package/views/dist/controls/pane/pane.js +2 -1
  119. package/views/dist/controls/picker/looks.js +1 -1
  120. package/views/dist/controls/picker/map-picker.d.ts +6 -2
  121. package/views/dist/controls/picker/map-picker.js +4 -2
  122. package/views/dist/controls/picker/picker.d.ts +7 -0
  123. package/views/dist/controls/picker/picker.js +57 -8
  124. package/views/dist/controls/popover/map-popover.d.ts +1 -1
  125. package/views/dist/controls/popover/map-popover.js +2 -2
  126. package/views/dist/controls/popover/popover.js +2 -1
  127. package/views/dist/controls/popover.css +3 -0
  128. package/views/dist/controls/ports-host/map-ports-host.d.ts +7 -0
  129. package/views/dist/controls/ports-host/map-ports-host.js +43 -0
  130. package/views/dist/controls/press/tokens.d.ts +8 -0
  131. package/views/dist/controls/press/tokens.js +4 -0
  132. package/views/dist/controls/press.css +44 -0
  133. package/views/dist/controls/quick-filters/looks.d.ts +11 -0
  134. package/views/dist/controls/quick-filters/looks.js +9 -0
  135. package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +31 -0
  136. package/views/dist/controls/quick-filters/map-quick-filters-body.js +59 -0
  137. package/views/dist/controls/quick-filters/quick-filters.d.ts +37 -0
  138. package/views/dist/controls/quick-filters/quick-filters.js +89 -0
  139. package/views/dist/controls/quick-filters/reminder.d.ts +18 -0
  140. package/views/dist/controls/quick-filters/reminder.js +41 -0
  141. package/views/dist/controls/quick-filters/rules.d.ts +89 -0
  142. package/views/dist/controls/quick-filters/rules.js +52 -0
  143. package/views/dist/controls/quick-filters/tokens.d.ts +112 -0
  144. package/views/dist/controls/quick-filters/tokens.js +30 -0
  145. package/views/dist/controls/quick-filters/words.d.ts +25 -0
  146. package/views/dist/controls/quick-filters/words.js +13 -0
  147. package/views/dist/controls/quick-filters.css +118 -0
  148. package/views/dist/controls/sheet/bottom-sheet.d.ts +9 -4
  149. package/views/dist/controls/sheet/bottom-sheet.js +4 -4
  150. package/views/dist/controls/sheet/map-sheet.d.ts +4 -1
  151. package/views/dist/controls/sheet/map-sheet.js +19 -6
  152. package/views/dist/controls/sheet/sheet-parts.d.ts +10 -0
  153. package/views/dist/controls/sheet/sheet-parts.js +2 -0
  154. package/views/dist/controls/switch-row/switch-row.d.ts +15 -0
  155. package/views/dist/controls/switch-row/switch-row.js +9 -0
  156. package/views/dist/controls/switch-row/tokens.d.ts +51 -0
  157. package/views/dist/controls/switch-row/tokens.js +15 -0
  158. package/views/dist/controls/switch-row.css +39 -0
  159. package/views/dist/controls/switch.css +1 -1
  160. package/views/dist/controls/tag/tag.js +3 -1
  161. package/views/dist/controls/tag-field/tag-field.d.ts +20 -0
  162. package/views/dist/controls/tag-field/tag-field.js +19 -0
  163. package/views/dist/controls/tag-field/tokens.d.ts +7 -0
  164. package/views/dist/controls/tag-field/tokens.js +4 -0
  165. package/views/dist/controls/tag-field.css +13 -0
  166. package/views/dist/controls/text-editor/looks.js +1 -1
  167. package/views/dist/controls/text-editor/map-text-body.d.ts +1 -1
  168. package/views/dist/controls/text-editor/map-text-body.js +2 -2
  169. package/views/dist/controls/text-editor/text-editor.d.ts +3 -0
  170. package/views/dist/controls/text-editor/text-editor.js +17 -7
  171. package/views/dist/controls/text-editor.css +11 -0
  172. package/views/dist/controls/toast/toast.d.ts +5 -1
  173. package/views/dist/controls/toast/toast.js +5 -3
  174. package/views/dist/controls/tokens.js +18 -0
  175. package/views/dist/controls/toolbar/keys.d.ts +3 -0
  176. package/views/dist/controls/toolbar/keys.js +11 -0
  177. package/views/dist/controls/toolbar/looks.d.ts +10 -0
  178. package/views/dist/controls/toolbar/looks.js +40 -0
  179. package/views/dist/controls/toolbar/tokens.d.ts +28 -0
  180. package/views/dist/controls/toolbar/tokens.js +9 -0
  181. package/views/dist/controls/toolbar/toolbar.d.ts +111 -0
  182. package/views/dist/controls/toolbar/toolbar.js +370 -0
  183. package/views/dist/controls/toolbar/words.d.ts +28 -0
  184. package/views/dist/controls/toolbar/words.js +17 -0
  185. package/views/dist/controls/toolbar-button/looks.d.ts +4 -0
  186. package/views/dist/controls/toolbar-button/looks.js +21 -0
  187. package/views/dist/controls/toolbar-button/tokens.d.ts +103 -0
  188. package/views/dist/controls/toolbar-button/tokens.js +28 -0
  189. package/views/dist/controls/toolbar-button/toolbar-button.d.ts +66 -0
  190. package/views/dist/controls/toolbar-button/toolbar-button.js +51 -0
  191. package/views/dist/controls/toolbar-button.css +75 -0
  192. package/views/dist/controls/toolbar.css +65 -0
  193. package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
  194. package/views/dist/controls/tooltip/map-tooltip.js +2 -2
  195. package/views/dist/controls/tooltip/tooltip.d.ts +3 -1
  196. package/views/dist/controls/tooltip/tooltip.js +2 -2
  197. package/views/dist/controls/values-editor/looks.js +1 -1
  198. package/views/dist/controls/values-editor/values.js +6 -2
  199. package/views/dist/controls/views-list/map-views-list-body.d.ts +4 -1
  200. package/views/dist/controls/views-list/map-views-list-body.js +128 -4
  201. package/views/dist/controls/views-list/rules.d.ts +26 -0
  202. package/views/dist/controls/views-list/rules.js +63 -0
  203. package/views/dist/controls/views-list/view-menu.d.ts +84 -0
  204. package/views/dist/controls/views-list/view-menu.js +201 -0
  205. package/views/dist/controls/views-list/views-list.d.ts +8 -1
  206. package/views/dist/controls/views-list/views-list.js +18 -3
  207. package/views/dist/controls/views-list/words.d.ts +54 -0
  208. package/views/dist/controls/views-list/words.js +10 -1
  209. package/views/dist/controls/views-list.css +5 -1
  210. package/views/dist/display/date.js +3 -3
  211. package/views/dist/display/format.d.ts +6 -0
  212. package/views/dist/display/format.js +3 -0
  213. package/views/dist/display/index.d.ts +1 -1
  214. package/views/dist/display/index.js +1 -1
  215. package/views/dist/display/options.d.ts +1 -1
  216. package/views/dist/display/range.d.ts +2 -1
  217. package/views/dist/display/range.js +4 -1
  218. package/views/dist/display/rich-text.js +0 -1
  219. package/views/dist/editors/ChipsEditor.d.ts +4 -5
  220. package/views/dist/editors/ChipsEditor.js +12 -78
  221. package/views/dist/editors/DateEditor.d.ts +12 -16
  222. package/views/dist/editors/DateEditor.js +40 -191
  223. package/views/dist/editors/EditorPanel.d.ts +2 -6
  224. package/views/dist/editors/EditorPanel.js +2 -2
  225. package/views/dist/editors/LocationEditor.d.ts +11 -19
  226. package/views/dist/editors/LocationEditor.js +19 -211
  227. package/views/dist/editors/NameEditor.d.ts +8 -16
  228. package/views/dist/editors/NameEditor.js +11 -100
  229. package/views/dist/editors/NumberEditor.d.ts +14 -21
  230. package/views/dist/editors/NumberEditor.js +22 -49
  231. package/views/dist/editors/RangeEditor.d.ts +9 -33
  232. package/views/dist/editors/RangeEditor.js +12 -97
  233. package/views/dist/editors/RelationEditor.d.ts +6 -9
  234. package/views/dist/editors/RelationEditor.js +11 -30
  235. package/views/dist/editors/RelationSetEditor.d.ts +13 -24
  236. package/views/dist/editors/RelationSetEditor.js +33 -101
  237. package/views/dist/editors/SelectEditor.d.ts +15 -17
  238. package/views/dist/editors/SelectEditor.js +15 -94
  239. package/views/dist/editors/TextEditor.d.ts +23 -26
  240. package/views/dist/editors/TextEditor.js +11 -48
  241. package/views/dist/editors/ValueListEditor.d.ts +14 -23
  242. package/views/dist/editors/ValueListEditor.js +16 -202
  243. package/views/dist/editors/body-panel.d.ts +13 -7
  244. package/views/dist/editors/body-panel.js +3 -7
  245. package/views/dist/editors/edit-cores.d.ts +15 -15
  246. package/views/dist/editors/edit-cores.js +14 -14
  247. package/views/dist/editors/number-body.d.ts +1 -1
  248. package/views/dist/editors/number-step.d.ts +0 -34
  249. package/views/dist/editors/number-step.js +0 -37
  250. package/views/dist/editors/option-add-flow.d.ts +1 -13
  251. package/views/dist/editors/option-add-flow.js +0 -22
  252. package/views/dist/editors/relation-links-body.d.ts +2 -3
  253. package/views/dist/editors/relation-picker.d.ts +13 -3
  254. package/views/dist/editors/relation-source.d.ts +0 -22
  255. package/views/dist/editors/relation-source.js +0 -21
  256. package/views/dist/field-row/FieldRow.js +5 -6
  257. package/views/dist/field-row/FieldRowLane.js +0 -1
  258. package/views/dist/field-row/editors/RowChipsEditor.js +2 -2
  259. package/views/dist/field-row/editors/RowDateEditor.d.ts +2 -2
  260. package/views/dist/field-row/editors/RowDateEditor.js +2 -2
  261. package/views/dist/field-row/editors/RowNameEditor.d.ts +2 -5
  262. package/views/dist/field-row/editors/RowNameEditor.js +7 -12
  263. package/views/dist/field-row/editors/RowNumberEditor.d.ts +1 -1
  264. package/views/dist/field-row/editors/RowNumberEditor.js +4 -4
  265. package/views/dist/field-row/editors/RowPlaceEditor.js +3 -3
  266. package/views/dist/field-row/editors/RowRangeEditor.d.ts +2 -5
  267. package/views/dist/field-row/editors/RowRangeEditor.js +7 -14
  268. package/views/dist/field-row/editors/RowRelationEditor.js +3 -3
  269. package/views/dist/field-row/editors/RowSelectEditor.js +2 -2
  270. package/views/dist/field-row/editors/RowTextEditor.d.ts +1 -1
  271. package/views/dist/field-row/editors/RowTextEditor.js +3 -4
  272. package/views/dist/field-row/editors/RowValueListEditor.js +5 -5
  273. package/views/dist/field-row/field-row-button.d.ts +6 -9
  274. package/views/dist/field-row/field-row-button.js +1 -6
  275. package/views/dist/field-row/field-row-checkbox.d.ts +1 -1
  276. package/views/dist/field-row/row-target.d.ts +0 -7
  277. package/views/dist/field-row/row-target.js +0 -2
  278. package/views/dist/grid/chrome/GridAddColumn.d.ts +2 -1
  279. package/views/dist/grid/chrome/GridAddColumn.js +8 -66
  280. package/views/dist/grid/chrome/GridAggregateMenu.d.ts +5 -7
  281. package/views/dist/grid/chrome/GridAggregateMenu.js +20 -39
  282. package/views/dist/grid/chrome/GridCellEditors.d.ts +2 -2
  283. package/views/dist/grid/chrome/GridCellEditors.js +12 -12
  284. package/views/dist/grid/chrome/GridChipsEditor.js +3 -3
  285. package/views/dist/grid/chrome/GridColumnMenu.d.ts +11 -12
  286. package/views/dist/grid/chrome/GridColumnMenu.js +32 -93
  287. package/views/dist/grid/chrome/GridDateEditor.d.ts +6 -6
  288. package/views/dist/grid/chrome/GridDateEditor.js +3 -3
  289. package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -6
  290. package/views/dist/grid/chrome/GridGroupMenu.js +21 -62
  291. package/views/dist/grid/chrome/GridHeader.d.ts +1 -2
  292. package/views/dist/grid/chrome/GridHeader.js +3 -2
  293. package/views/dist/grid/chrome/GridLongTextEditor.d.ts +17 -38
  294. package/views/dist/grid/chrome/GridLongTextEditor.js +6 -7
  295. package/views/dist/grid/chrome/GridNameEditor.js +4 -4
  296. package/views/dist/grid/chrome/GridNumberEditor.d.ts +4 -5
  297. package/views/dist/grid/chrome/GridNumberEditor.js +5 -6
  298. package/views/dist/grid/chrome/GridPlaceEditor.d.ts +2 -5
  299. package/views/dist/grid/chrome/GridPlaceEditor.js +5 -5
  300. package/views/dist/grid/chrome/GridRangeEditor.d.ts +6 -12
  301. package/views/dist/grid/chrome/GridRangeEditor.js +7 -15
  302. package/views/dist/grid/chrome/GridRelationEditor.js +5 -5
  303. package/views/dist/grid/chrome/GridRow.js +0 -3
  304. package/views/dist/grid/chrome/GridRowActions.d.ts +1 -1
  305. package/views/dist/grid/chrome/GridRowActions.js +0 -5
  306. package/views/dist/grid/chrome/GridRowCells.js +11 -7
  307. package/views/dist/grid/chrome/GridSelectEditor.js +3 -3
  308. package/views/dist/grid/chrome/GridStructure.js +0 -1
  309. package/views/dist/grid/chrome/GridTable.js +1 -1
  310. package/views/dist/grid/chrome/GridTextEditor.d.ts +5 -7
  311. package/views/dist/grid/chrome/GridTextEditor.js +5 -18
  312. package/views/dist/grid/chrome/GridValueListEditor.js +4 -4
  313. package/views/dist/grid/chrome/grid-body-place.d.ts +2 -3
  314. package/views/dist/grid/chrome/grid-body-place.js +4 -8
  315. package/views/dist/grid/chrome/grid-button.d.ts +7 -10
  316. package/views/dist/grid/chrome/grid-button.js +1 -6
  317. package/views/dist/grid/chrome/grid-cell-classes.js +1 -1
  318. package/views/dist/grid/chrome/grid-column-menu-items.d.ts +4 -4
  319. package/views/dist/grid/chrome/grid-column-menu-items.js +10 -6
  320. package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -1
  321. package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
  322. package/views/dist/grid/chrome/grid-fitted-box.d.ts +7 -1
  323. package/views/dist/grid/chrome/grid-fitted-box.js +4 -4
  324. package/views/dist/grid/chrome/grid-group-menu-parts.d.ts +5 -9
  325. package/views/dist/grid/chrome/grid-group-menu-parts.js +1 -3
  326. package/views/dist/grid/chrome/grid-hover.js +0 -1
  327. package/views/dist/grid/chrome/grid-menu-focus.d.ts +7 -31
  328. package/views/dist/grid/chrome/grid-menu-focus.js +7 -47
  329. package/views/dist/grid/chrome/grid-styles.d.ts +0 -3
  330. package/views/dist/grid/chrome/grid-styles.js +0 -1
  331. package/views/dist/grid/chrome/grid-table-props.d.ts +6 -10
  332. package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -4
  333. package/views/dist/grid/core/clipboard-model.js +9 -4
  334. package/views/dist/grid/core/editing-controller.d.ts +2 -1
  335. package/views/dist/grid/core/editing-controller.js +10 -2
  336. package/views/dist/grid/core/refusal-sentence.d.ts +3 -0
  337. package/views/dist/grid/core/refusal-sentence.js +2 -2
  338. package/views/dist/grid/core/write-states.d.ts +3 -1
  339. package/views/dist/grid/core/write-states.js +6 -2
  340. package/views/dist/grid/grid.css +240 -0
  341. package/views/dist/grid/looks.d.ts +5 -1
  342. package/views/dist/grid/looks.js +20 -12
  343. package/views/dist/grid-tokens.d.ts +109 -0
  344. package/views/dist/grid-tokens.js +29 -0
  345. package/views/dist/looks/index.d.ts +5 -0
  346. package/views/dist/looks/index.js +5 -0
  347. package/views/dist/looks/pieces.js +10 -0
  348. package/views/dist/model/body-frame.d.ts +0 -32
  349. package/views/dist/model/body-frame.js +1 -15
  350. package/views/dist/model/column-capabilities.d.ts +2 -0
  351. package/views/dist/model/column-filters.d.ts +2 -1
  352. package/views/dist/model/column-from.js +2 -2
  353. package/views/dist/model/column-inspect.d.ts +5 -5
  354. package/views/dist/model/column-inspect.js +2 -2
  355. package/views/dist/model/relation-filters.d.ts +2 -0
  356. package/views/dist/panels/customize-body.d.ts +1 -10
  357. package/views/dist/panels/customize-body.js +0 -3
  358. package/views/dist/panels/filter/MenuSelect.js +0 -5
  359. package/views/dist/panels/filter/RangeFilterBody.js +0 -1
  360. package/views/dist/panels/filter/details.d.ts +1 -5
  361. package/views/dist/panels/filter/details.js +0 -13
  362. package/views/dist/panels/filter/filter-list.d.ts +0 -1
  363. package/views/dist/panels/filter/filter-list.js +1 -1
  364. package/views/dist/panels/index.d.ts +2 -2
  365. package/views/dist/panels/index.js +2 -2
  366. package/views/dist/panels/labels.d.ts +4 -0
  367. package/views/dist/panels/labels.js +8 -0
  368. package/views/dist/panels/model.d.ts +10 -2
  369. package/views/dist/panels/panel-button.d.ts +10 -12
  370. package/views/dist/panels/panel-button.js +1 -6
  371. package/views/dist/panels/quick/model.d.ts +4 -0
  372. package/views/dist/panels/react/chrome.d.ts +0 -17
  373. package/views/dist/panels/react/chrome.js +0 -8
  374. package/views/dist/panels/react/customize-body.d.ts +14 -12
  375. package/views/dist/panels/react/customize-body.js +93 -19
  376. package/views/dist/panels/react/customize.d.ts +16 -12
  377. package/views/dist/panels/react/customize.js +4 -110
  378. package/views/dist/panels/react/filter/FilterEditor.d.ts +4 -18
  379. package/views/dist/panels/react/filter/FilterEditor.js +6 -330
  380. package/views/dist/panels/react/filter/FilterFieldList.d.ts +1 -1
  381. package/views/dist/panels/react/filter/FilterFieldList.js +27 -51
  382. package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +1 -11
  383. package/views/dist/panels/react/filter/PhoneFilterEditor.js +8 -144
  384. package/views/dist/panels/react/filter/editor-ctx.d.ts +1 -33
  385. package/views/dist/panels/react/filter/editor-ctx.js +5 -33
  386. package/views/dist/panels/react/filter/filter-body.js +5 -2
  387. package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -6
  388. package/views/dist/panels/react/filter/filter-part-body.js +0 -5
  389. package/views/dist/panels/react/filter/rule-writes.d.ts +1 -26
  390. package/views/dist/panels/react/filter/rule-writes.js +4 -95
  391. package/views/dist/panels/react/order-details.d.ts +1 -26
  392. package/views/dist/panels/react/order-details.js +3 -69
  393. package/views/dist/panels/react/panel-header.js +0 -1
  394. package/views/dist/panels/react/panel-step.d.ts +3 -0
  395. package/views/dist/panels/react/panel-step.js +2 -1
  396. package/views/dist/panels/react/popover.d.ts +4 -7
  397. package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +2 -4
  398. package/views/dist/panels/react/quick/QuickFiltersPanel.js +16 -136
  399. package/views/dist/panels/react/sort/SortEditor.d.ts +4 -4
  400. package/views/dist/panels/react/sort/SortEditor.js +8 -245
  401. package/views/dist/panels/react/sort/SortFieldList.d.ts +1 -1
  402. package/views/dist/panels/react/sort/SortFieldList.js +11 -25
  403. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -3
  404. package/views/dist/panels/react/toolbar/ReadyToolbar.js +10 -3
  405. package/views/dist/panels/react/toolbar/Toolbar.js +1 -1
  406. package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +2 -2
  407. package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
  408. package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +16 -18
  409. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -1
  410. package/views/dist/panels/react/toolbar/ToolbarFilters.js +3 -3
  411. package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +12 -4
  412. package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -2
  413. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
  414. package/views/dist/panels/react/toolbar/ToolbarSave.js +0 -4
  415. package/views/dist/panels/react/toolbar/ToolbarSearch.js +0 -1
  416. package/views/dist/panels/react/toolbar/ToolbarSortPill.js +3 -3
  417. package/views/dist/panels/react/view-actions.js +0 -1
  418. package/views/dist/panels/react/views-row/FoldingViewRow.js +2 -5
  419. package/views/dist/panels/react/views-row/ViewCreatePill.js +0 -1
  420. package/views/dist/panels/react/views-row/ViewPicker.js +30 -45
  421. package/views/dist/panels/react/views-row/ViewPickerRow.js +0 -2
  422. package/views/dist/panels/react/views-row/menu-classes.d.ts +0 -4
  423. package/views/dist/panels/react/views-row/menu-classes.js +0 -2
  424. package/views/dist/panels/react.d.ts +5 -12
  425. package/views/dist/panels/react.js +5 -12
  426. package/views/dist/panels/settings/filter-groups.d.ts +3 -0
  427. package/views/dist/panels/settings/filter-groups.js +40 -9
  428. package/views/dist/panels/settings/filters.d.ts +5 -0
  429. package/views/dist/panels/settings/filters.js +12 -6
  430. package/views/dist/panels/views-row/model.d.ts +10 -1
  431. package/views/dist/provider/ViewsProvider.d.ts +2 -46
  432. package/views/dist/provider/ViewsProvider.js +31 -27
  433. package/views/dist/provider/components.d.ts +295 -107
  434. package/views/dist/provider/context.d.ts +7 -21
  435. package/views/dist/provider/missing-slot.d.ts +3 -7
  436. package/views/dist/provider/missing-slot.js +2 -9
  437. package/views/dist/provider/ports.d.ts +18 -6
  438. package/views/dist/provider/ports.js +2 -1
  439. package/views/dist/react.d.ts +2 -3
  440. package/views/dist/react.js +1 -1
  441. package/views/dist/selection/SelectionBar.d.ts +2 -16
  442. package/views/dist/selection/SelectionBar.js +6 -4
  443. package/views/dist/selection/bar-props.d.ts +26 -0
  444. package/views/dist/selection/bar-props.js +1 -0
  445. package/views/dist/selection/index.d.ts +1 -1
  446. package/views/dist/selection/verbs.d.ts +32 -5
  447. package/views/dist/styles.css +694 -191
  448. package/views/dist/styles.unlayered.css +691 -188
  449. package/views/docs/contract.md +133 -130
  450. package/views/docs/controls/bulk-bar.md +41 -0
  451. package/views/docs/controls/choice.md +25 -0
  452. package/views/docs/controls/customize.md +17 -0
  453. package/views/docs/controls/popover.md +2 -0
  454. package/views/docs/controls/press.md +9 -0
  455. package/views/docs/controls/quick-filters.md +35 -0
  456. package/views/docs/controls/radio.md +1 -1
  457. package/views/docs/controls/switch-row.md +18 -0
  458. package/views/docs/controls/tag-field.md +7 -0
  459. package/views/docs/controls/toolbar-button.md +31 -0
  460. package/views/docs/controls/toolbar.md +14 -0
  461. package/views/docs/getting-started.md +222 -2
  462. package/views/docs/guides/atoms.md +2 -2
  463. package/views/docs/guides/cells.md +224 -4
  464. package/views/docs/guides/display.md +3 -3
  465. package/views/docs/guides/editors.md +235 -20
  466. package/views/docs/guides/looks.md +8 -2
  467. package/views/docs/guides/ports.md +7 -7
  468. package/views/docs/guides/selection.md +5 -1
  469. package/views/docs/guides/the-grid.md +15 -17
  470. package/views/docs/guides/the-provider.md +9 -15
  471. package/views/docs/install.md +4 -1
  472. package/views/docs/reference/cells.md +2 -2
  473. package/views/docs/reference/controls.md +215 -21
  474. package/views/docs/reference/display.md +1 -0
  475. package/views/docs/reference/editors-chips.md +2 -2
  476. package/views/docs/reference/editors-date.md +4 -4
  477. package/views/docs/reference/editors-location.md +4 -7
  478. package/views/docs/reference/editors-name.md +3 -5
  479. package/views/docs/reference/editors-number.md +10 -10
  480. package/views/docs/reference/editors-panel.md +3 -3
  481. package/views/docs/reference/editors-range.md +3 -5
  482. package/views/docs/reference/editors-relation.md +4 -4
  483. package/views/docs/reference/editors-select.md +3 -3
  484. package/views/docs/reference/editors-text.md +3 -4
  485. package/views/docs/reference/editors-value-list.md +3 -3
  486. package/views/docs/reference/field-row.md +1 -1
  487. package/views/docs/reference/grid.md +2 -2
  488. package/views/docs/reference/looks.md +25 -11
  489. package/views/docs/reference/panels-react.md +23 -37
  490. package/views/docs/reference/panels.md +8 -6
  491. package/views/docs/reference/react.md +24 -24
  492. package/views/docs/reference/selection.md +4 -2
  493. package/views/docs/reference/views.md +12 -11
  494. package/views/skills/views/SKILL.md +2 -2
  495. package/views/dist/editors/relation-panel.d.ts +0 -69
  496. package/views/dist/editors/relation-panel.js +0 -46
  497. package/views/dist/grid/chrome/GridColumnColorSection.d.ts +0 -13
  498. package/views/dist/grid/chrome/GridColumnColorSection.js +0 -40
  499. package/views/dist/grid/chrome/GridColumnDateSection.d.ts +0 -28
  500. package/views/dist/grid/chrome/GridColumnDateSection.js +0 -23
  501. package/views/dist/grid/chrome/GridColumnDurationSection.d.ts +0 -23
  502. package/views/dist/grid/chrome/GridColumnDurationSection.js +0 -24
  503. package/views/dist/grid/chrome/GridColumnNumberSection.d.ts +0 -29
  504. package/views/dist/grid/chrome/GridColumnNumberSection.js +0 -27
  505. package/views/dist/grid/chrome/GridColumnPercentSection.d.ts +0 -16
  506. package/views/dist/grid/chrome/GridColumnPercentSection.js +0 -16
  507. package/views/dist/grid/chrome/GridColumnSortSection.d.ts +0 -38
  508. package/views/dist/grid/chrome/GridColumnSortSection.js +0 -33
  509. package/views/dist/grid/chrome/GridFlyout.d.ts +0 -44
  510. package/views/dist/grid/chrome/GridFlyout.js +0 -80
  511. package/views/dist/grid/chrome/GridMenuRow.d.ts +0 -15
  512. package/views/dist/grid/chrome/GridMenuRow.js +0 -15
  513. package/views/dist/grid/chrome/grid-menu-search.d.ts +0 -7
  514. package/views/dist/grid/chrome/grid-menu-search.js +0 -7
  515. package/views/dist/panels/react/GroupBucketsList.d.ts +0 -16
  516. package/views/dist/panels/react/GroupBucketsList.js +0 -44
  517. package/views/dist/panels/react/LayoutColumnsList.d.ts +0 -24
  518. package/views/dist/panels/react/LayoutColumnsList.js +0 -101
  519. package/views/dist/panels/react/PopoverColumnDetail.d.ts +0 -11
  520. package/views/dist/panels/react/PopoverColumnDetail.js +0 -24
  521. package/views/dist/panels/react/drag.d.ts +0 -2
  522. package/views/dist/panels/react/drag.js +0 -5
  523. package/views/dist/panels/react/layout-detail.d.ts +0 -4
  524. package/views/dist/panels/react/layout-detail.js +0 -29
  525. package/views/dist/panels/react/root-list.d.ts +0 -6
  526. package/views/dist/panels/react/root-list.js +0 -31
  527. package/views/dist/panels/react/sort/use-sort-drag.d.ts +0 -17
  528. package/views/dist/panels/react/sort/use-sort-drag.js +0 -39
  529. package/views/dist/panels/react/view-footer.d.ts +0 -20
  530. package/views/dist/panels/react/view-footer.js +0 -41
@@ -1,16 +1,11 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import { cx } from "../../internal/cx.js";
5
5
  import { useViews } from "../../provider/context.js";
6
- import { groupSortChoices, groupSortValue, offersManualOrder } from "../group-sort.js";
7
- import { GROUP_BY_SEARCH_AFTER, activeGroupDimension, groupDateByLabel, groupSortLabel, groupValueLabel, matchGroupDimensions, matchSortOptions, } from "../labels.js";
6
+ import { GROUP_BY_SEARCH_AFTER, matchSortOptions } from "../labels.js";
8
7
  import { FIELD_PADDING } from "../filter/TextFilterBody.js";
9
- import { groupOrderFor } from "../model.js";
10
- import { drawPanelButton } from "../panel-button.js";
11
- import { PANEL_LIST_CLASS, PANEL_SEPARATOR_CLASS } from "./chrome.js";
12
- import { GroupBucketsList } from "./GroupBucketsList.js";
13
- const GLYPH = "h-3.5 w-3.5";
8
+ import { PANEL_LIST_CLASS } from "./chrome.js";
14
9
  export function CompactSortDetail({ sort }) {
15
10
  const { atoms, messages } = useViews();
16
11
  const { RadioRow, DirectionButton, PanelSearch } = atoms;
@@ -26,64 +21,3 @@ export function CompactSortDetail({ sort }) {
26
21
  return (_jsx(RadioRow, { mark: "box", selected: selected, label: opt.label, onClick: () => pickValue(opt.value), trailing: selected ? _jsx(DirectionButton, { dir: sort.dir, onClick: flipDir }) : null }, opt.value));
27
22
  })] }));
28
23
  }
29
- export function CompactGroupDetail({ group, onOpenPanel, }) {
30
- const views = useViews();
31
- const { atoms, icons, messages } = views;
32
- const { MenuRow, ToggleRow, ChoiceRow } = atoms;
33
- const activeDim = activeGroupDimension(group);
34
- const anyShown = group.groups?.entries.some((entry) => !entry.hidden && !entry.empty) ?? false;
35
- const anyHidden = group.groups?.entries.some((entry) => entry.hidden) ?? false;
36
- const { group: GroupGlyph, sortRowsDown: SortGlyph, calendar: CalendarGlyph, hide: HideGlyph, delete: TrashGlyph } = icons;
37
- return (_jsxs("div", { "data-vs-detail": true, className: cx("max-h-96", PANEL_LIST_CLASS), children: [_jsx(MenuRow, { icon: _jsx(GroupGlyph, { className: GLYPH }), label: messages({ key: "views.panels.group-by" }), value: groupValueLabel(group, messages), active: false, onClick: () => onOpenPanel({ type: "groupBy" }) }), activeDim && (_jsx(MenuRow, { icon: _jsx(SortGlyph, { className: GLYPH }), label: messages({ key: "views.panels.sort" }), value: groupSortLabel(group, messages), active: false, onClick: () => onOpenPanel({ type: "groupSort" }) })), activeDim?.granularities && activeDim.granularities.length > 0 && (_jsx(MenuRow, { icon: _jsx(CalendarGlyph, { className: GLYPH }), label: messages({ key: "views.panels.date-by" }), value: groupDateByLabel(group), active: false, onClick: () => onOpenPanel({ type: "groupDateBy" }) })), activeDim && group.hideEmpty && (_jsx(ToggleRow, { icon: _jsx(HideGlyph, { className: GLYPH }), label: messages({ key: "views.panels.hide-empty-groups" }), active: group.hideEmpty.value, onClick: () => group.hideEmpty.onChange(!group.hideEmpty.value) })), activeDim && group.groups && (_jsxs(_Fragment, { children: [_jsx("div", { className: PANEL_SEPARATOR_CLASS }), _jsxs("div", { "data-vs-heading": true, className: "flex items-center justify-between px-3 pt-1.5 pb-1", children: [_jsx("span", { className: "text-(length:--vk-caption-text,10px) font-bold uppercase tracking-(--vk-caps-tracking,0.15em) text-(color:--vk-fg-subtlest)", children: messages({ key: "views.panels.groups" }) }), (anyShown || anyHidden) && (drawPanelButton(views, {
38
- own: "text-xs text-(color:--vk-fg-brand) hover:underline focus-visible:underline",
39
- frame: "h-auto p-0",
40
- variant: "ghost",
41
- size: "sm",
42
- onClick: anyShown ? group.groups.onHideAll : group.groups.onShowAll,
43
- children: messages({ key: anyShown ? "views.panels.groups-hide-all" : "views.panels.groups-show-all" }),
44
- }))] }), _jsx(GroupBucketsList, { groups: group.groups, variant: "compact" })] })), activeDim && (_jsxs(_Fragment, { children: [_jsx("div", { className: PANEL_SEPARATOR_CLASS }), _jsx(ChoiceRow, { "data-vs-row": true, label: messages({ key: "views.panels.group-remove" }), leading: _jsx("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center text-(color:--vk-fg-subtle)", children: _jsx(TrashGlyph, { className: GLYPH }) }), onClick: () => group.onChange({ value: "none", order: group.order, granularity: group.granularity }) })] }))] }));
45
- }
46
- export function CompactGroupByDetail({ group, onBack, }) {
47
- const { atoms, messages } = useViews();
48
- const { RadioRow, PanelSearch } = atoms;
49
- const [query, setQuery] = useState("");
50
- const searchable = group.dimensions.length > GROUP_BY_SEARCH_AFTER;
51
- const needle = query.trim();
52
- const dimensions = matchGroupDimensions(group.dimensions, query);
53
- const pick = (next) => {
54
- group.onChange({ value: next, order: group.order, granularity: group.granularity });
55
- onBack();
56
- };
57
- return (_jsxs("div", { "data-vs-detail": true, className: cx("max-h-96", PANEL_LIST_CLASS), children: [searchable && (_jsx("div", { "data-vs-inset": true, className: FIELD_PADDING, children: _jsx(PanelSearch, { value: query, onChange: setQuery, placeholder: messages({ key: "views.panels.search" }), autoFocus: true }) })), !needle && (_jsx(RadioRow, { selected: group.value === "none", label: messages({ key: "views.panels.group-none" }), onClick: () => pick("none") })), dimensions.map((dimension) => (_jsx(RadioRow, { selected: group.value === dimension.value, label: dimension.label, onClick: () => pick(dimension.value) }, dimension.value)))] }));
58
- }
59
- export function CompactGroupSortDetail({ group, onBack, }) {
60
- const { atoms, messages } = useViews();
61
- const { RadioRow } = atoms;
62
- const activeDim = activeGroupDimension(group);
63
- if (!activeDim)
64
- return null;
65
- const current = groupSortValue(group.order[activeDim.value] ?? groupOrderFor(activeDim));
66
- return (_jsx("div", { "data-vs-detail": true, className: cx("max-h-96", PANEL_LIST_CLASS), children: groupSortChoices(activeDim, { manual: offersManualOrder(group) }, messages).map((choice) => (_jsx(RadioRow, { selected: choice.value === current, label: choice.label, onClick: () => {
67
- group.onChange({
68
- value: activeDim.value,
69
- order: { ...group.order, [activeDim.value]: choice.order },
70
- granularity: group.granularity,
71
- });
72
- onBack();
73
- } }, choice.value))) }));
74
- }
75
- export function CompactGroupDateByDetail({ group, onBack, }) {
76
- const { RadioRow } = useViews().atoms;
77
- const activeDim = activeGroupDimension(group);
78
- if (!activeDim?.granularities?.length)
79
- return null;
80
- const current = group.granularity?.[activeDim.value] ?? activeDim.defaultGranularity ?? activeDim.granularities[0].value;
81
- return (_jsx("div", { "data-vs-detail": true, className: cx("max-h-96", PANEL_LIST_CLASS), children: activeDim.granularities.map((choice) => (_jsx(RadioRow, { selected: choice.value === current, label: choice.label, onClick: () => {
82
- group.onChange({
83
- value: activeDim.value,
84
- order: group.order,
85
- granularity: { ...group.granularity, [activeDim.value]: choice.value },
86
- });
87
- onBack();
88
- } }, choice.value))) }));
89
- }
@@ -5,7 +5,6 @@ import { useViews } from "../../provider/context.js";
5
5
  import { drawPanelButton } from "../panel-button.js";
6
6
  function HeaderIconButton({ icon, label, onClick, edge, }) {
7
7
  return drawPanelButton(useViews(), {
8
- own: cx("-my-1 p-1 inline-flex shrink-0 items-center justify-center rounded-md", "text-(color:--vk-fg-subtle) transition-colors hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)", edge === "left" ? "-ml-1" : "-mr-1"),
9
8
  frame: cx("-my-1 h-6 w-6 shrink-0", edge === "left" ? "-ml-1" : "-mr-1"),
10
9
  variant: "ghost",
11
10
  size: "icon",
@@ -10,3 +10,6 @@ export type PanelStep = {
10
10
  escapeBack: () => boolean;
11
11
  };
12
12
  export declare function usePanelStep(): PanelStep;
13
+ /** The step a toolbar panel's sheet holds (`ToolbarOptions`), handed to what stands in it so a body's level of its own is told
14
+ * there and the sheet's Escape goes back a level; null where nothing holds one, and the panel holds its own. */
15
+ export declare const PanelStepHold: import("react").Context<PanelStep | null>;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { useCallback, useMemo, useRef, useState } from "react";
2
+ import { createContext, useCallback, useMemo, useRef, useState } from "react";
3
3
  export function usePanelStep() {
4
4
  const [step, setStep] = useState(null);
5
5
  const held = useRef(null);
@@ -24,3 +24,4 @@ export function usePanelStep() {
24
24
  }, []);
25
25
  return useMemo(() => ({ onStepChange, title: step?.title, back: step ? goBack : undefined, escapeBack }), [onStepChange, step, goBack, escapeBack]);
26
26
  }
27
+ export const PanelStepHold = createContext(null);
@@ -57,15 +57,12 @@ export declare function ViewOptionsPopoverPanel<S extends string = string, G ext
57
57
  clearAll: () => void;
58
58
  /** The shared view this list shows, when it shows one: see `CollectionViewState`. */
59
59
  view?: CollectionViewState;
60
- /** Consolidate filters + time scope + date ranges behind one "Filter" row (list pages). Off = every
61
- * dimension is a root row (dashboards). */
60
+ /** The body's `fields` folded behind one Filter row (list pages); off, each is a row of its own (dashboards). */
62
61
  foldFilters?: boolean;
63
- /** Dismisses the panel, which drives the header's ✕. Every host that owns the open state passes it; one that
64
- * doesn't renders no ✕. */
62
+ /** Dismisses the panel: the body's `onDone`. */
65
63
  onClose?: () => void;
66
- /** Full-height host (a drawer): the panel stretches, the body scrolls, and detail max-heights are lifted.
67
- * Off for popovers. */
64
+ /** @deprecated Read by nothing: the app's body sizes itself in its host. */
68
65
  fill?: boolean;
69
- /** The list's field editor (Add field, Edit field), for the Columns list and a column's settings. */
66
+ /** The list's field editor (Add field, Edit field), handed to the body's columns. */
70
67
  fieldEditor?: PanelFieldEditor | null;
71
68
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,10 @@
1
- import { type ReactNode } from "react";
1
+ import type { ReactNode } from "react";
2
2
  import { type QuickFiltersConfig } from "../../quick/model.js";
3
- export declare function QuickFiltersPanel({ quickFilters, form, onDone, closeButton, fill, }: {
3
+ export declare function QuickFiltersPanel({ quickFilters, form, onDone, closeButton, }: {
4
4
  quickFilters: QuickFiltersConfig;
5
5
  form: "computer" | "phone";
6
6
  /** The job is done and what holds the panel closes. */
7
7
  onDone?: () => void;
8
8
  /** Its own ✕: false in a sheet whose head draws one. */
9
9
  closeButton?: boolean;
10
- /** It fills a host or a sheet, its values scrolling under the strip. */
11
- fill?: boolean;
12
10
  }): ReactNode;
@@ -1,14 +1,8 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Fragment, useEffect, useRef, useState } from "react";
4
- import { cx } from "../../../internal/cx.js";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
5
3
  import { useViews } from "../../../provider/context.js";
6
- import { FIELD_PADDING } from "../../filter/TextFilterBody.js";
7
- import { drawPanelButton } from "../../panel-button.js";
8
- import { QUICK_SEARCH_AFTER, holdAfterPress, quickFieldsShown, quickFirstOpen, quickHoldFits, quickPressCloses, quickValuesFound, quickValuesShown, } from "../../quick/model.js";
9
- import { PANEL_LIST_CLASS, PANEL_ROW_CLASS, SHEET_ROW_CLASS } from "../chrome.js";
10
- import { PanelHeader } from "../panel-header.js";
11
- export function QuickFiltersPanel({ quickFilters, form, onDone, closeButton = true, fill = false, }) {
4
+ import { quickFieldsShown, quickHoldFits, quickValuesShown, } from "../../quick/model.js";
5
+ export function QuickFiltersPanel({ quickFilters, form, onDone, closeButton = true, }) {
12
6
  const { components, messages } = useViews();
13
7
  const Body = components.QuickFiltersBody;
14
8
  const label = quickFilters.label ?? messages({ key: "views.panels.quick-filters" });
@@ -16,133 +10,19 @@ export function QuickFiltersPanel({ quickFilters, form, onDone, closeButton = tr
16
10
  const showCounts = quickFilters.showCounts ?? true;
17
11
  const emptyLabel = messages({ key: "views.panels.quick-empty" });
18
12
  const done = () => onDone?.();
19
- if (Body) {
20
- const close = {
21
- close: { label: messages({ key: "views.panels.close" }), onPress: done },
22
- };
23
- return (_jsx(Body, { label: label, fields: quickFieldsShown(quickFilters).map((field) => ({
24
- key: field.key,
25
- label: field.label,
26
- searchPlaceholder: searchWords(field, messages),
27
- values: quickValuesShown(field, quickFilters.hold, showCounts, emptyLabel, quickFilters.heldLabels?.[field.key]?.values),
28
- })), hold: quickFilters.hold, several: several, showCounts: showCounts, form: form, onHoldChange: (next) => {
29
- if (quickHoldFits(quickFilters, next))
30
- quickFilters.onHoldChange(next);
31
- }, onDone: done, actions: form === "phone" && closeButton ? close : undefined }));
32
- }
33
- return (_jsx(PlainPanel, { quickFilters: quickFilters, form: form, onDone: done, label: label, several: several, showCounts: showCounts, emptyLabel: emptyLabel, onClose: closeButton ? done : undefined, fill: fill }));
13
+ const close = {
14
+ close: { label: messages({ key: "views.panels.close" }), onPress: done },
15
+ };
16
+ return (_jsx(Body, { label: label, fields: quickFieldsShown(quickFilters).map((field) => ({
17
+ key: field.key,
18
+ label: field.label,
19
+ searchPlaceholder: searchWords(field, messages),
20
+ ...(field.options ? { options: field.options } : {}),
21
+ values: quickValuesShown(field, quickFilters.hold, showCounts, emptyLabel, quickFilters.heldLabels?.[field.key]?.values),
22
+ })), hold: quickFilters.hold, several: several, showCounts: showCounts, form: form, onHoldChange: (next) => {
23
+ if (quickHoldFits(quickFilters, next))
24
+ quickFilters.onHoldChange(next);
25
+ }, onDone: done, actions: form === "phone" && closeButton ? close : undefined }));
34
26
  }
35
27
  const searchWords = (field, messages) => field.searchPlaceholder ??
36
28
  messages({ key: "views.panels.quick-search", values: { field: field.label } });
37
- function PlainPanel({ quickFilters, form, onDone, label, several, showCounts, emptyLabel, onClose, fill, }) {
38
- const views = useViews();
39
- const { atoms, messages } = views;
40
- const { PanelSearch } = atoms;
41
- const { fields, hold } = quickFilters;
42
- const strip = quickFieldsShown(quickFilters);
43
- const [own, setOwn] = useState(() => quickFirstOpen(strip, hold));
44
- const field = strip.find((f) => f.key === own) ?? strip[0];
45
- const [query, setQuery] = useState("");
46
- const [typedIn, setTypedIn] = useState(field?.key);
47
- if (field && typedIn !== field.key) {
48
- setTypedIn(field.key);
49
- setQuery("");
50
- }
51
- const search = useRef(null);
52
- const list = useRef(null);
53
- const root = useRef(null);
54
- const leaving = useRef(null);
55
- useEffect(() => {
56
- const key = leaving.current;
57
- if (key === null || strip.some((f) => f.key === key))
58
- return;
59
- leaving.current = null;
60
- if (root.current?.contains(document.activeElement))
61
- return;
62
- root.current
63
- ?.querySelector('[data-slot="vk-quick-filters-field"][aria-pressed="true"]')
64
- ?.focus();
65
- });
66
- if (!field)
67
- return null;
68
- const shown = quickValuesShown(field, hold, showCounts, emptyLabel, quickFilters.heldLabels?.[field.key]?.values);
69
- const searching = shown.length > QUICK_SEARCH_AFTER;
70
- const values = quickValuesFound(shown, searching ? query : "");
71
- const press = (value) => {
72
- if (!fields.includes(field))
73
- leaving.current = field.key;
74
- quickFilters.onHoldChange(holdAfterPress(hold, field.key, value, several));
75
- if (form === "phone" && quickPressCloses(several))
76
- onDone();
77
- };
78
- const toFirst = (event) => {
79
- if (event.key !== "ArrowDown")
80
- return;
81
- event.preventDefault();
82
- list.current?.querySelector('[data-slot="vk-quick-filters-value"]')?.focus();
83
- };
84
- return (_jsxs("div", { ref: root, "data-slot": "vk-quick-filters", "data-form": form, className: fill ? "flex h-full min-h-0 flex-col" : "flex w-72 flex-col", children: [_jsx(PanelHeader, { title: label, onClose: onClose }), _jsx("div", { role: "group", "aria-label": messages({ key: "views.panels.quick-fields" }), className: "flex flex-wrap gap-1 px-2 pt-1", children: strip.map((f) => {
85
- const open = f.key === field.key;
86
- return (_jsx(Fragment, { children: drawPanelButton(views, {
87
- own: cx("rounded-full px-2.5 py-1 text-xs font-medium transition-colors", open
88
- ? "bg-(color:--vk-selected,var(--vk-neutral)) text-(color:--vk-fg)"
89
- : "text-(color:--vk-fg-subtle) hover:bg-(color:--vk-hovered)"),
90
- frame: "rounded-full",
91
- variant: "ghost",
92
- size: "sm",
93
- "data-slot": "vk-quick-filters-field",
94
- "aria-pressed": open,
95
- onClick: () => setOwn(f.key),
96
- children: f.label,
97
- }) }, f.key));
98
- }) }), searching && (_jsx("div", { "data-vs-inset": true, className: FIELD_PADDING, children: _jsx(PanelSearch, { value: query, onChange: setQuery, placeholder: searchWords(field, messages), inputRef: search, onKeyDown: toFirst }) })), values.length > 0 ? (_jsx(FieldValues, { listRef: list, field: field, values: values, several: several, search: searching ? search : null, onPress: press, fill: fill, phone: form === "phone" }, `${field.key}:${query}`)) : query ? (_jsx("p", { "data-slot": "vk-quick-filters-none", role: "status", className: "px-3 py-2 text-sm text-(color:--vk-fg-subtle)", children: messages({ key: "views.panels.quick-none" }) })) : (_jsx("p", { className: "px-3 py-2 text-sm text-(color:--vk-fg-subtle)", children: messages({ key: "views.panels.filter-no-options" }) }))] }));
99
- }
100
- function FieldValues({ listRef, field, values, several, search, onPress, fill, phone, }) {
101
- const { messages, conventions } = useViews();
102
- const [at, setAt] = useState(() => Math.max(0, values.findIndex((v) => v.held)));
103
- const here = Math.min(at, values.length - 1);
104
- const rows = useRef([]);
105
- const pressed = useRef(null);
106
- useEffect(() => {
107
- const press = pressed.current;
108
- if (!press || press.count === values.length)
109
- return;
110
- pressed.current = null;
111
- if (listRef.current?.contains(document.activeElement))
112
- return;
113
- rows.current[Math.min(press.row, values.length - 1)]?.focus();
114
- });
115
- const go = (i) => {
116
- const n = Math.max(0, Math.min(values.length - 1, i));
117
- setAt(n);
118
- rows.current[n]?.focus();
119
- };
120
- const keys = (event, i) => {
121
- const to = { ArrowDown: i + 1, ArrowUp: i - 1, Home: 0, End: values.length - 1 }[event.key];
122
- if (to !== undefined) {
123
- event.preventDefault();
124
- if (event.key === "ArrowUp" && i === 0 && search?.current)
125
- search.current.focus();
126
- else
127
- go(to);
128
- return;
129
- }
130
- if (event.key === "Enter" || event.key === " ") {
131
- event.preventDefault();
132
- pressed.current = { row: i, count: values.length };
133
- onPress(values[i].value);
134
- }
135
- };
136
- return (_jsx("div", { ref: listRef, role: "listbox", "aria-label": field.label, "aria-multiselectable": several || undefined, className: cx(fill ? "min-h-0 flex-1" : "max-h-72", PANEL_LIST_CLASS), children: values.map((v, i) => {
137
- const count = v.count === undefined ? null : v.count.toLocaleString(conventions.locale);
138
- return (_jsxs("div", { ref: (el) => {
139
- rows.current[i] = el;
140
- }, role: "option", "aria-selected": v.held, "aria-label": count === null
141
- ? undefined
142
- : messages({ key: "views.panels.quick-value", values: { label: v.label, count } }), tabIndex: i === here ? 0 : -1, "data-slot": "vk-quick-filters-value", "data-chosen": v.held || undefined, onClick: () => {
143
- setAt(i);
144
- pressed.current = { row: i, count: values.length };
145
- onPress(v.value);
146
- }, onKeyDown: (event) => keys(event, i), className: cx(phone ? cx(SHEET_ROW_CLASS, "rounded-lg active:bg-(color:--vk-pressed)") : PANEL_ROW_CLASS, "cursor-default text-sm outline-none focus-visible:bg-(color:--vk-hovered)", v.held ? "font-medium text-(color:--vk-fg-selected)" : "text-(color:--vk-fg)"), children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: v.label }), count !== null && (_jsx("span", { "aria-hidden": "true", className: "shrink-0 text-xs tabular-nums text-(color:--vk-fg-subtle)", children: count }))] }, v.value));
147
- }) }));
148
- }
@@ -8,13 +8,13 @@ export type SortEditorOptions = {
8
8
  open: boolean;
9
9
  /** The job is done and what holds it closes: ✓, or ✕ once the rules are back. */
10
10
  onDone?: () => void;
11
- /** On a computer, Add sort at the editor's foot, for a holder with no + of its own to add a rule with. A phone's
12
- * editor always has one. */
11
+ /** Handed to the body as `addSort`: Add sort at a computer's editor's foot, for a holder with no + of its own to
12
+ * add a rule with. */
13
13
  addSort?: boolean;
14
14
  };
15
15
  /** The sort editor's state and its parts: the body (on a phone told whether it draws its own ✕ and ✓), and the ✕
16
16
  * and ✓ for a sheet's head. */
17
- export declare function useSortEditor(o: SortEditorOptions): {
17
+ export declare function useSortEditorHost(o: SortEditorOptions): {
18
18
  body: (closeButton?: boolean) => ReactNode;
19
19
  head: ViewsSheetActions;
20
20
  /** An app's body's step on a phone, for the sheet's title while it stands. */
@@ -23,6 +23,6 @@ export declare function useSortEditor(o: SortEditorOptions): {
23
23
  escapeBack: () => boolean;
24
24
  };
25
25
  /** The body alone, for a holder that holds only a body (a popover). */
26
- export declare function SortEditor({ sorts, form, open, onDone, addSort, }: Omit<SortEditorOptions, "open"> & {
26
+ export declare function SortEditorHost({ sorts, form, open, onDone, addSort, }: Omit<SortEditorOptions, "open"> & {
27
27
  open?: boolean;
28
28
  }): ReactNode;
@@ -1,28 +1,14 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { useLayoutEffect, useRef, useState } from "react";
4
- import { DisabledReason } from "../../../atoms/DisabledReason.js";
5
- import { cx } from "../../../internal/cx.js";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useLayoutEffect, useRef } from "react";
6
4
  import { useViews } from "../../../provider/context.js";
7
- import { addSortRule, canAddSortRule, openSortPlaces, sortBodyChangeFits, sortedField, } from "../../settings/sorts.js";
8
- import { ASIDE_CLASS, DRAGGING_CLASS, PANEL_ROW_CLASS, SHEET_ROW_CLASS, SHEET_ROW_GROUND_CLASS, } from "../chrome.js";
5
+ import { sortBodyChangeFits } from "../../settings/sorts.js";
9
6
  import { sortBodyOptions } from "../../sort-body-options.js";
10
- import { SortableFrame, useDragKit, useSortableItem } from "../drag-kit.js";
11
- import { PanelHeader } from "../panel-header.js";
12
7
  import { usePanelStep } from "../panel-step.js";
13
- import { SortFieldList } from "./SortFieldList.js";
14
- import { useSortDrag } from "./use-sort-drag.js";
15
8
  const same = (a, b) => a.length === b.length &&
16
9
  a.every((rule, at) => rule.value === b[at]?.value && rule.dir === b[at]?.dir);
17
10
  const sameAside = (a, b) => a.length === b.length && a.every((rule, at) => rule.fieldKey === b[at]?.fieldKey);
18
- const moved = (list, from, to) => {
19
- const out = [...list];
20
- const [one] = out.splice(from, 1);
21
- if (one !== undefined)
22
- out.splice(to, 0, one);
23
- return out;
24
- };
25
- export function useSortEditor(o) {
11
+ export function useSortEditorHost(o) {
26
12
  const { sorts, form, open, onDone, addSort = false } = o;
27
13
  const { messages, components, icons } = useViews();
28
14
  const SortBody = components.SortBody;
@@ -59,235 +45,12 @@ export function useSortEditor(o) {
59
45
  done: { label: messages({ key: "views.panels.sort-done" }), onPress: () => onDone?.() },
60
46
  ...(step.back && { back: { label: messages({ key: "views.panels.back" }), onPress: step.back } }),
61
47
  };
62
- const body = (closeButton = true) => SortBody ? (_jsx(SortBody, { label: sorts.label ?? messages({ key: "views.panels.sort" }), options: sortBodyOptions(sorts.options, { icons, AppIcon: components.AppIcon }), rules: sorts.rules, setAside: sorts.setAside ?? [], max: sorts.max, form: form, addSort: addSort, onRulesChange: (rules, setAside) => {
48
+ const body = (closeButton = true) => (_jsx(SortBody, { label: sorts.label ?? messages({ key: "views.panels.sort" }), options: sortBodyOptions(sorts.options, { icons, AppIcon: components.AppIcon }), rules: sorts.rules, setAside: sorts.setAside ?? [], max: sorts.max, form: form, addSort: addSort, onRulesChange: (rules, setAside) => {
63
49
  if (sortBodyChangeFits(sorts, rules, setAside))
64
50
  change(rules, setAside);
65
- }, onDone: () => onDone?.(), actions: form === "phone" && closeButton ? head : undefined, ...(form === "phone" && { onStepChange: step.onStepChange }) })) : form === "phone" ? (_jsx(PhoneEditor, { sorts: sorts, latest: latest, latestAside: latestAside, change: change, head: closeButton ? head : null })) : (_jsx(ComputerEditor, { sorts: sorts, latest: latest, latestAside: latestAside, change: change, addSort: addSort }));
51
+ }, onDone: () => onDone?.(), actions: form === "phone" && closeButton ? head : undefined, ...(form === "phone" && { onStepChange: step.onStepChange }) }));
66
52
  return { body, head, title: step.title, escapeBack: step.escapeBack };
67
53
  }
68
- export function SortEditor({ sorts, form, open = true, onDone, addSort, }) {
69
- return useSortEditor({ sorts, form, open, onDone, addSort }).body();
70
- }
71
- function labelOf(sorts, value) {
72
- return sorts.options.find((option) => option.value === value)?.label ?? value;
73
- }
74
- function ComputerEditor({ sorts, latest, latestAside, change, addSort, }) {
75
- const { messages } = useViews();
76
- const ids = sorts.rules.map((rule) => rule.value);
77
- const kit = useDragKit();
78
- const drag = useSortDrag({
79
- kit,
80
- count: ids.length,
81
- ids,
82
- onMove: (from, to) => change(moved(latest.current, from, to)),
83
- });
84
- const root = useRef(null);
85
- const refocus = useRef(null);
86
- useLayoutEffect(() => {
87
- const at = refocus.current;
88
- if (at === null)
89
- return;
90
- refocus.current = null;
91
- const rows = root.current?.querySelectorAll('[data-slot="vk-sort-rule"], [data-slot="vk-sort-aside"]') ?? [];
92
- const row = rows[at] ?? rows[rows.length - 1];
93
- const buttons = row?.querySelectorAll("button");
94
- buttons?.[buttons.length - 1]?.focus({ preventScroll: true });
95
- });
96
- const aside = sorts.setAside ?? [];
97
- if (sorts.rules.length === 0 && aside.length === 0)
98
- return null;
99
- const label = sorts.label ?? messages({ key: "views.panels.sort" });
100
- const writes = asideWritesOf(latest, latestAside, change);
101
- const asideWrites = {
102
- ...writes,
103
- remove: (rule) => {
104
- refocus.current = sorts.rules.length + aside.findIndex((held) => held.fieldKey === rule.fieldKey);
105
- writes.remove(rule);
106
- },
107
- };
108
- return (_jsxs("div", { ref: root, "data-slot": "vk-sort-editor", role: "group", "aria-label": label, className: "p-(--vk-panel-padding,0.375rem)", children: [_jsx(SortableFrame, { kit: kit, sensors: drag.sensors, items: ids, axis: "y", onDragEnd: drag.onDragEnd, nameOf: (value) => labelOf(sorts, value), children: _jsx("div", { role: "list", "aria-label": label, className: "flex flex-col gap-0.5", children: sorts.rules.map((rule, index) => (_jsx(ComputerRule, { rule: rule, sorts: sorts, onKeyDown: drag.gripKeyDown(index), onField: (value) => {
109
- if (sortedField(latest.current, value, latest.current[index]?.value))
110
- return;
111
- change(latest.current.map((held, at) => (at === index ? { ...held, value } : held)));
112
- }, onDir: (dir) => change(latest.current.map((held, at) => (at === index ? { ...held, dir } : held))), onRemove: () => {
113
- refocus.current = index;
114
- change(latest.current.filter((_, at) => at !== index));
115
- } }, rule.value))) }) }), aside.map((rule) => (_jsx(AsideSortRow, { form: "computer", rule: rule, sorts: sorts, writes: asideWrites }, rule.fieldKey))), addSort && (_jsx(ComputerAddSort, { sorts: sorts, onPick: (value) => change(addSortRule(latest.current, value, openSortPlaces(sorts))) }))] }));
116
- }
117
- function ComputerAddSort({ sorts, onPick, }) {
118
- const { components, icons, messages } = useViews();
119
- const { Button, Popover } = components;
120
- const add = useRef(null);
121
- const [open, setOpen] = useState(false);
122
- const can = canAddSortRule(sorts.rules, openSortPlaces(sorts));
123
- const Plus = icons.add;
124
- return (_jsxs("div", { "data-slot": "vk-sort-add", className: "flex pt-1", children: [_jsx(DisabledReason, { reason: can ? null : messages({ key: "views.panels.sort-max", values: { max: sorts.max } }), side: "bottom", children: _jsxs(Button, { ref: add, variant: "outline", size: "sm", "aria-disabled": !can || undefined, "aria-haspopup": "dialog", "aria-expanded": open, onClick: () => {
125
- if (can)
126
- setOpen(!open);
127
- }, children: [_jsx(Plus, { className: "h-3.5 w-3.5 shrink-0" }), messages({ key: "views.panels.sort-add" })] }) }), _jsx(Popover, { open: open && can, onOpenChange: setOpen, anchor: add, align: "start", sideOffset: 4, chrome: "menu", children: _jsx(SortFieldList, { sorts: sorts, onPick: (value) => {
128
- setOpen(false);
129
- onPick(value);
130
- }, onDone: () => setOpen(false) }) })] }));
131
- }
132
- function asideWritesOf(latest, latestAside, change) {
133
- const without = (rule) => latestAside.current.filter((held) => held.fieldKey !== rule.fieldKey);
134
- const toRule = (rule, value) => {
135
- if (sortedField(latest.current, value))
136
- return;
137
- change([...latest.current, { value, dir: rule.dir }], without(rule));
138
- };
139
- return {
140
- repoint: toRule,
141
- putBack: (rule) => {
142
- if (rule.value !== null)
143
- toRule(rule, rule.value);
144
- },
145
- remove: (rule) => change(latest.current, without(rule)),
146
- };
147
- }
148
- function AsideSortRow({ form, rule, sorts, writes, onField, }) {
149
- const { components, icons, messages } = useViews();
150
- const { Button, Menu, Popover, Tooltip } = components;
151
- const field = useRef(null);
152
- const more = useRef(null);
153
- const [opens, setOpens] = useState(null);
154
- const why = rule.reason === "missing-field" && rule.value !== null
155
- ? messages({ key: "views.panels.sort-set-aside-back" })
156
- : messages({ key: "views.panels.sort-set-aside-why", values: { reason: rule.reason } });
157
- const direction = messages({
158
- key: rule.dir === "asc" ? "views.panels.sort-ascending" : "views.panels.sort-descending",
159
- });
160
- const actions = messages({ key: "views.panels.sort-actions", values: { label: rule.label } });
161
- const Down = icons.chevronDown;
162
- const More = icons.more;
163
- const phone = form === "phone";
164
- return (_jsxs("div", { "data-slot": "vk-sort-aside", "data-aside": "", role: "listitem", className: cx(phone
165
- ? cx(SHEET_ROW_CLASS, "py-1.5", SHEET_ROW_GROUND_CLASS)
166
- : cx(PANEL_ROW_CLASS, "gap-1.5")), children: [!phone && _jsx("span", { "aria-hidden": true, className: "w-8 shrink-0" }), _jsx(Tooltip, { content: why, side: "bottom", children: _jsx("span", { className: "inline-flex min-w-0 flex-1", children: _jsxs(Button, { ref: field, variant: "outline", size: phone ? "default" : "sm", "aria-label": messages({
167
- key: "views.panels.sort-field-named",
168
- values: { label: rule.label },
169
- }), "aria-haspopup": "dialog", "aria-expanded": opens === "field", className: cx("min-w-0 flex-1 justify-between", ASIDE_CLASS), onClick: () => (phone ? onField?.() : setOpens(opens === "field" ? null : "field")), children: [_jsx("span", { className: "truncate", children: rule.label }), _jsx(Down, { className: "h-3.5 w-3.5 shrink-0" })] }) }) }), !phone && (_jsx(Popover, { open: opens === "field", onOpenChange: (next) => setOpens(next ? "field" : null), anchor: field, align: "start", sideOffset: 4, chrome: "menu", children: _jsx(SortFieldList, { sorts: sorts, onPick: (value) => {
170
- setOpens(null);
171
- writes.repoint(rule, value);
172
- }, onDone: () => setOpens(null) }) })), _jsx(DisabledReason, { reason: why, className: "inline-flex shrink-0", children: _jsx(Button, { variant: "outline", size: phone ? "default" : "sm", disabled: true, className: "shrink-0 justify-between", children: _jsx("span", { children: direction }) }) }), _jsx(Button, { ref: more, variant: "ghost", size: "icon", "aria-label": actions, "aria-haspopup": "menu", "aria-expanded": opens === "more", onClick: () => setOpens(opens === "more" ? null : "more"), children: _jsx(More, { className: "h-4 w-4" }) }), _jsx(Menu, { open: opens === "more", onOpenChange: (next) => setOpens(next ? "more" : null), anchor: more, align: "end", label: actions, items: [
173
- { key: "why", label: why, disabled: true },
174
- ...(rule.value !== null
175
- ? [
176
- {
177
- key: "put-back",
178
- label: messages({ key: "views.panels.put-back" }),
179
- onSelect: () => {
180
- setOpens(null);
181
- writes.putBack(rule);
182
- },
183
- },
184
- ]
185
- : []),
186
- {
187
- key: "delete",
188
- label: messages({ key: "views.panels.sort-delete" }),
189
- destructive: true,
190
- onSelect: () => {
191
- setOpens(null);
192
- writes.remove(rule);
193
- },
194
- },
195
- ] })] }));
196
- }
197
- function ComputerRule({ rule, sorts, onKeyDown, onField, onDir, onRemove, }) {
198
- const { components, icons, messages } = useViews();
199
- const { Button, Popover, Menu } = components;
200
- const { listeners, setNodeRef, isDragging, style } = useSortableItem({ id: rule.value, axis: "y" });
201
- const field = useRef(null);
202
- const direction = useRef(null);
203
- const [opens, setOpens] = useState(null);
204
- const name = labelOf(sorts, rule.value);
205
- const Grip = icons.drag;
206
- const Down = icons.chevronDown;
207
- const Close = icons.close;
208
- const words = (dir) => messages({
209
- key: dir === "asc" ? "views.panels.sort-ascending" : "views.panels.sort-descending",
210
- });
211
- return (_jsxs("div", { ref: setNodeRef, "data-slot": "vk-sort-rule", role: "listitem", style: style, className: cx(PANEL_ROW_CLASS, "gap-1.5", isDragging && DRAGGING_CLASS), children: [_jsx("span", { ...listeners, onKeyDown: onKeyDown, "data-base-ui-swipe-ignore": true, className: "flex shrink-0 cursor-grab active:cursor-grabbing", style: { touchAction: "none" }, children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": messages({ key: "views.panels.sort-move", values: { label: name } }), children: _jsx(Grip, { className: "h-3.5 w-3.5" }) }) }), _jsxs(Button, { ref: field, variant: "outline", size: "sm", "aria-label": messages({ key: "views.panels.sort-field-named", values: { label: name } }), "aria-haspopup": "dialog", "aria-expanded": opens === "field", className: "min-w-0 flex-1 justify-between", onClick: () => setOpens(opens === "field" ? null : "field"), children: [_jsx("span", { className: "truncate", children: name }), _jsx(Down, { className: "h-3.5 w-3.5 shrink-0" })] }), _jsx(Popover, { open: opens === "field", onOpenChange: (next) => setOpens(next ? "field" : null), anchor: field, align: "start", sideOffset: 4, chrome: "menu", children: _jsx(SortFieldList, { sorts: sorts, own: rule.value, onPick: (value) => {
212
- setOpens(null);
213
- onField(value);
214
- }, onDone: () => setOpens(null) }) }), _jsxs(Button, { ref: direction, variant: "outline", size: "sm", "aria-label": messages({
215
- key: "views.panels.sort-direction-named",
216
- values: { label: words(rule.dir) },
217
- }), "aria-haspopup": "menu", "aria-expanded": opens === "direction", className: "shrink-0 justify-between", onClick: () => setOpens(opens === "direction" ? null : "direction"), children: [_jsx("span", { children: words(rule.dir) }), _jsx(Down, { className: "h-3.5 w-3.5 shrink-0" })] }), _jsx(Menu, { open: opens === "direction", onOpenChange: (next) => setOpens(next ? "direction" : null), anchor: direction, align: "start", label: messages({ key: "views.panels.sort-direction" }), items: ["asc", "desc"].map((dir) => ({
218
- key: dir,
219
- label: words(dir),
220
- checked: rule.dir === dir,
221
- onSelect: () => {
222
- setOpens(null);
223
- if (dir !== rule.dir)
224
- onDir(dir);
225
- },
226
- })) }), _jsx(Button, { variant: "ghost", size: "icon", "aria-label": messages({ key: "views.panels.sort-remove", values: { label: name } }), onClick: onRemove, children: _jsx(Close, { className: "h-3.5 w-3.5" }) })] }));
227
- }
228
- function PhoneEditor({ sorts, latest, latestAside, change, head, }) {
229
- const { components, icons, messages } = useViews();
230
- const { Button } = components;
231
- const [page, setPage] = useState("rules");
232
- const aside = sorts.setAside ?? [];
233
- const asideWrites = asideWritesOf(latest, latestAside, change);
234
- const ids = sorts.rules.map((rule) => rule.value);
235
- const kit = useDragKit();
236
- const drag = useSortDrag({
237
- kit,
238
- count: ids.length,
239
- ids,
240
- onMove: (from, to) => change(moved(latest.current, from, to)),
241
- });
242
- const title = sorts.label ?? messages({ key: "views.panels.sort" });
243
- const can = canAddSortRule(sorts.rules, openSortPlaces(sorts));
244
- const Check = icons.check;
245
- if (page !== "rules") {
246
- const repointing = typeof page === "object" ? aside.find((rule) => rule.fieldKey === page.repoint) : undefined;
247
- return (_jsxs("div", { "data-slot": "vk-sort-editor", className: "flex h-full min-h-0 flex-col", children: [_jsx(PanelHeader, { title: repointing
248
- ? messages({ key: "views.panels.sort-field-named", values: { label: repointing.label } })
249
- : messages({ key: "views.panels.sort-add" }), onBack: () => setPage("rules") }), _jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children: _jsx(SortFieldList, { sorts: sorts, form: "phone", onPick: (value) => {
250
- if (repointing)
251
- asideWrites.repoint(repointing, value);
252
- else
253
- change(addSortRule(latest.current, value, openSortPlaces(sorts)));
254
- setPage("rules");
255
- }, onDone: () => setPage("rules") }) })] }));
256
- }
257
- return (_jsxs("div", { "data-slot": "vk-sort-editor", className: "flex h-full min-h-0 flex-col", children: [_jsx(PanelHeader, { title: title, onClose: head ? head.close.onPress : undefined, trailing: head?.done ? (_jsx(Button, { variant: "ghost", size: "icon", "aria-label": head.done.label, onClick: head.done.onPress, children: _jsx(Check, { className: "h-4 w-4" }) })) : undefined }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto py-2", children: [sorts.rules.length > 0 || aside.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(SortableFrame, { kit: kit, sensors: drag.sensors, items: ids, axis: "y", onDragEnd: drag.onDragEnd, nameOf: (value) => labelOf(sorts, value), children: _jsx("div", { role: "list", "aria-label": title, className: "flex flex-col", children: sorts.rules.map((rule, index) => (_jsx(PhoneRule, { rule: rule, name: labelOf(sorts, rule.value), onDir: (dir) => change(latest.current.map((held, at) => (at === index ? { ...held, dir } : held))), onDelete: () => change(latest.current.filter((_, at) => at !== index)) }, rule.value))) }) }), aside.map((rule) => (_jsx(AsideSortRow, { form: "phone", rule: rule, sorts: sorts, writes: asideWrites, onField: () => setPage({ repoint: rule.fieldKey }) }, rule.fieldKey)))] })) : (_jsxs("div", { className: "px-4 py-6 text-center", children: [_jsx("p", { className: "text-sm font-medium text-(color:--vk-fg)", children: messages({ key: "views.panels.sort-empty" }) }), _jsx("p", { className: "text-sm text-(color:--vk-fg-subtle)", children: messages({ key: "views.panels.sort-empty-line" }) })] })), _jsxs("div", { className: "flex flex-col gap-1 px-4 pt-3", children: [_jsx(DisabledReason, { reason: can ? null : messages({ key: "views.panels.sort-max", values: { max: sorts.max } }), side: "top", children: _jsx(Button, { variant: "outline", "aria-disabled": !can || undefined, "aria-haspopup": "dialog", className: "w-full", onClick: () => {
258
- if (can)
259
- setPage("fields");
260
- }, children: messages({ key: "views.panels.sort-add" }) }) }), sorts.rules.length > 0 && (_jsx(Button, { variant: "ghost", className: "w-full", onClick: () => change([]), children: messages({ key: "views.panels.sort-clear-all" }) }))] })] })] }));
261
- }
262
- function PhoneRule({ rule, name, onDir, onDelete, }) {
263
- const { components, icons, messages } = useViews();
264
- const { Button, Menu } = components;
265
- const { listeners, setNodeRef, isDragging, style } = useSortableItem({ id: rule.value, axis: "y" });
266
- const press = useRef(null);
267
- const more = useRef(null);
268
- const [opens, setOpens] = useState(null);
269
- const More = icons.more;
270
- const words = (dir) => messages({
271
- key: dir === "asc" ? "views.panels.sort-ascending" : "views.panels.sort-descending",
272
- });
273
- return (_jsxs("div", { ref: setNodeRef, "data-slot": "vk-sort-rule", role: "listitem", style: style, className: cx(SHEET_ROW_CLASS, "py-1.5", isDragging ? DRAGGING_CLASS : SHEET_ROW_GROUND_CLASS), children: [_jsx("span", { ...listeners, "data-base-ui-swipe-ignore": true, className: "flex min-w-0 flex-1", style: { touchAction: "manipulation" }, children: _jsxs(Button, { ref: press, variant: "ghost", "aria-haspopup": "menu", "aria-expanded": opens === "direction", className: "h-auto w-full flex-col items-start", onClick: () => setOpens(opens === "direction" ? null : "direction"), children: [_jsx("span", { className: "truncate text-sm text-(color:--vk-fg)", children: name }), _jsx("span", { className: "text-xs text-(color:--vk-fg-subtle)", children: words(rule.dir) })] }) }), _jsx(Menu, { open: opens === "direction", onOpenChange: (next) => setOpens(next ? "direction" : null), anchor: press, align: "start", label: name, items: ["asc", "desc"].map((dir) => ({
274
- key: dir,
275
- label: words(dir),
276
- checked: rule.dir === dir,
277
- onSelect: () => {
278
- setOpens(null);
279
- if (dir !== rule.dir)
280
- onDir(dir);
281
- },
282
- })) }), _jsx(Button, { ref: more, variant: "ghost", size: "icon", "aria-label": messages({ key: "views.panels.sort-actions", values: { label: name } }), "aria-haspopup": "menu", "aria-expanded": opens === "more", onClick: () => setOpens(opens === "more" ? null : "more"), children: _jsx(More, { className: "h-4 w-4" }) }), _jsx(Menu, { open: opens === "more", onOpenChange: (next) => setOpens(next ? "more" : null), anchor: more, align: "end", label: messages({ key: "views.panels.sort-actions", values: { label: name } }), items: [
283
- {
284
- key: "delete",
285
- label: messages({ key: "views.panels.sort-delete" }),
286
- destructive: true,
287
- onSelect: () => {
288
- setOpens(null);
289
- onDelete();
290
- },
291
- },
292
- ] })] }));
54
+ export function SortEditorHost({ sorts, form, open = true, onDone, addSort, }) {
55
+ return useSortEditorHost({ sorts, form, open, onDone, addSort }).body();
293
56
  }