torch-glare 2.5.5 → 2.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 (359) hide show
  1. package/README.md +4 -3
  2. package/dist/bin/index.js +9 -24
  3. package/dist/bin/index.js.map +1 -1
  4. package/dist/src/commands/add.d.ts +2 -2
  5. package/dist/src/commands/add.d.ts.map +1 -1
  6. package/dist/src/commands/add.js +4 -70
  7. package/dist/src/commands/add.js.map +1 -1
  8. package/dist/src/commands/hook.d.ts +5 -4
  9. package/dist/src/commands/hook.d.ts.map +1 -1
  10. package/dist/src/commands/hook.js +7 -75
  11. package/dist/src/commands/hook.js.map +1 -1
  12. package/dist/src/commands/init.js +1 -1
  13. package/dist/src/commands/init.js.map +1 -1
  14. package/dist/src/commands/layout.d.ts +5 -4
  15. package/dist/src/commands/layout.d.ts.map +1 -1
  16. package/dist/src/commands/layout.js +7 -75
  17. package/dist/src/commands/layout.js.map +1 -1
  18. package/dist/src/commands/provider.d.ts +5 -4
  19. package/dist/src/commands/provider.d.ts.map +1 -1
  20. package/dist/src/commands/provider.js +7 -75
  21. package/dist/src/commands/provider.js.map +1 -1
  22. package/dist/src/commands/update.d.ts.map +1 -1
  23. package/dist/src/commands/update.js +78 -43
  24. package/dist/src/commands/update.js.map +1 -1
  25. package/dist/src/commands/utils.d.ts +5 -4
  26. package/dist/src/commands/utils.d.ts.map +1 -1
  27. package/dist/src/commands/utils.js +7 -80
  28. package/dist/src/commands/utils.js.map +1 -1
  29. package/dist/src/shared/addFromRegistry.d.ts +16 -0
  30. package/dist/src/shared/addFromRegistry.d.ts.map +1 -0
  31. package/dist/src/shared/addFromRegistry.js +88 -0
  32. package/dist/src/shared/addFromRegistry.js.map +1 -0
  33. package/dist/src/shared/getInstallCommand.d.ts.map +1 -1
  34. package/dist/src/shared/getInstallCommand.js +5 -0
  35. package/dist/src/shared/getInstallCommand.js.map +1 -1
  36. package/dist/src/shared/installDependencies.d.ts +0 -10
  37. package/dist/src/shared/installDependencies.d.ts.map +1 -1
  38. package/dist/src/shared/installDependencies.js +0 -17
  39. package/dist/src/shared/installDependencies.js.map +1 -1
  40. package/dist/src/shared/installFromPlan.d.ts +7 -5
  41. package/dist/src/shared/installFromPlan.d.ts.map +1 -1
  42. package/dist/src/shared/installFromPlan.js +103 -36
  43. package/dist/src/shared/installFromPlan.js.map +1 -1
  44. package/dist/src/shared/loadRegistry.d.ts +12 -3
  45. package/dist/src/shared/loadRegistry.d.ts.map +1 -1
  46. package/dist/src/shared/loadRegistry.js +19 -20
  47. package/dist/src/shared/loadRegistry.js.map +1 -1
  48. package/dist/src/shared/registryClient.d.ts +19 -0
  49. package/dist/src/shared/registryClient.d.ts.map +1 -0
  50. package/dist/src/shared/registryClient.js +128 -0
  51. package/dist/src/shared/registryClient.js.map +1 -0
  52. package/dist/src/shared/resolveEntry.d.ts +10 -7
  53. package/dist/src/shared/resolveEntry.d.ts.map +1 -1
  54. package/dist/src/shared/resolveEntry.js +18 -13
  55. package/dist/src/shared/resolveEntry.js.map +1 -1
  56. package/dist/src/shared/suggestOtherCommand.d.ts +7 -1
  57. package/dist/src/shared/suggestOtherCommand.d.ts.map +1 -1
  58. package/dist/src/shared/suggestOtherCommand.js +29 -23
  59. package/dist/src/shared/suggestOtherCommand.js.map +1 -1
  60. package/dist/src/types/main.d.ts +31 -2
  61. package/dist/src/types/main.d.ts.map +1 -1
  62. package/package.json +6 -11
  63. package/apps/lib/components/ActionButton.tsx +0 -93
  64. package/apps/lib/components/ActionsGroup.tsx +0 -27
  65. package/apps/lib/components/AlertDialog.tsx +0 -204
  66. package/apps/lib/components/Avatar.tsx +0 -46
  67. package/apps/lib/components/Badge.tsx +0 -250
  68. package/apps/lib/components/BadgeField.tsx +0 -338
  69. package/apps/lib/components/Breadcrumb.tsx +0 -280
  70. package/apps/lib/components/Button.tsx +0 -317
  71. package/apps/lib/components/ButtonGroup.tsx +0 -190
  72. package/apps/lib/components/Calendar.tsx +0 -115
  73. package/apps/lib/components/Card.tsx +0 -95
  74. package/apps/lib/components/Checkbox.tsx +0 -42
  75. package/apps/lib/components/ColorPicker.tsx +0 -441
  76. package/apps/lib/components/ConclusionHeader.tsx +0 -148
  77. package/apps/lib/components/ContextMenu.tsx +0 -571
  78. package/apps/lib/components/CountBadge.tsx +0 -52
  79. package/apps/lib/components/DataTable.tsx +0 -213
  80. package/apps/lib/components/DataViews/badge.ts +0 -49
  81. package/apps/lib/components/DataViews/cell.tsx +0 -324
  82. package/apps/lib/components/DataViews/context.ts +0 -144
  83. package/apps/lib/components/DataViews/data-views.tsx +0 -383
  84. package/apps/lib/components/DataViews/filters/children.tsx +0 -98
  85. package/apps/lib/components/DataViews/filters/custom.tsx +0 -34
  86. package/apps/lib/components/DataViews/filters/filters.tsx +0 -157
  87. package/apps/lib/components/DataViews/filters/index.ts +0 -4
  88. package/apps/lib/components/DataViews/filters/labelled.tsx +0 -20
  89. package/apps/lib/components/DataViews/filters/presets.tsx +0 -65
  90. package/apps/lib/components/DataViews/filters/sync.tsx +0 -35
  91. package/apps/lib/components/DataViews/filters/values.ts +0 -173
  92. package/apps/lib/components/DataViews/header.tsx +0 -220
  93. package/apps/lib/components/DataViews/hooks/index.ts +0 -5
  94. package/apps/lib/components/DataViews/hooks/useActiveRow.ts +0 -22
  95. package/apps/lib/components/DataViews/hooks/useControllable.ts +0 -52
  96. package/apps/lib/components/DataViews/index.ts +0 -84
  97. package/apps/lib/components/DataViews/panel/columns.tsx +0 -153
  98. package/apps/lib/components/DataViews/panel/controls.tsx +0 -106
  99. package/apps/lib/components/DataViews/panel/index.ts +0 -3
  100. package/apps/lib/components/DataViews/panel/panel.tsx +0 -164
  101. package/apps/lib/components/DataViews/panel/saved-views.tsx +0 -67
  102. package/apps/lib/components/DataViews/panel/section.tsx +0 -81
  103. package/apps/lib/components/DataViews/panel/sort.tsx +0 -42
  104. package/apps/lib/components/DataViews/panel/tab.tsx +0 -31
  105. package/apps/lib/components/DataViews/slots.ts +0 -63
  106. package/apps/lib/components/DataViews/states.tsx +0 -38
  107. package/apps/lib/components/DataViews/types.ts +0 -510
  108. package/apps/lib/components/DataViews/views/board-view.tsx +0 -381
  109. package/apps/lib/components/DataViews/views/card-rows.tsx +0 -36
  110. package/apps/lib/components/DataViews/views/inbox-view.tsx +0 -260
  111. package/apps/lib/components/DataViews/views/pane-views.tsx +0 -196
  112. package/apps/lib/components/DataViews/views/table-view.tsx +0 -493
  113. package/apps/lib/components/DataViews/views/tree-view.tsx +0 -367
  114. package/apps/lib/components/DatePicker.tsx +0 -232
  115. package/apps/lib/components/Dialog.tsx +0 -116
  116. package/apps/lib/components/Divider.tsx +0 -28
  117. package/apps/lib/components/Drawer.tsx +0 -420
  118. package/apps/lib/components/DropdownMenu.tsx +0 -540
  119. package/apps/lib/components/FieldHint.tsx +0 -69
  120. package/apps/lib/components/Form.tsx +0 -182
  121. package/apps/lib/components/FormBuilder/context.ts +0 -73
  122. package/apps/lib/components/FormBuilder/field-kind.ts +0 -28
  123. package/apps/lib/components/FormBuilder/fields/ChoiceFields.tsx +0 -60
  124. package/apps/lib/components/FormBuilder/fields/ColorField.tsx +0 -59
  125. package/apps/lib/components/FormBuilder/fields/CustomField.tsx +0 -11
  126. package/apps/lib/components/FormBuilder/fields/DateField.tsx +0 -32
  127. package/apps/lib/components/FormBuilder/fields/FieldArray.tsx +0 -74
  128. package/apps/lib/components/FormBuilder/fields/FieldShell.tsx +0 -163
  129. package/apps/lib/components/FormBuilder/fields/FileField.tsx +0 -39
  130. package/apps/lib/components/FormBuilder/fields/OptionListFields.tsx +0 -132
  131. package/apps/lib/components/FormBuilder/fields/OtpField.tsx +0 -31
  132. package/apps/lib/components/FormBuilder/fields/PhoneField.tsx +0 -109
  133. package/apps/lib/components/FormBuilder/fields/RichTextEditorField.tsx +0 -31
  134. package/apps/lib/components/FormBuilder/fields/SelectField.tsx +0 -91
  135. package/apps/lib/components/FormBuilder/fields/SignatureField.tsx +0 -157
  136. package/apps/lib/components/FormBuilder/fields/SliderField.tsx +0 -67
  137. package/apps/lib/components/FormBuilder/fields/SwitchBoxField.tsx +0 -41
  138. package/apps/lib/components/FormBuilder/fields/TableField.tsx +0 -336
  139. package/apps/lib/components/FormBuilder/fields/TextField.tsx +0 -213
  140. package/apps/lib/components/FormBuilder/fields/TreeSelectField.tsx +0 -43
  141. package/apps/lib/components/FormBuilder/fields/countries.ts +0 -303
  142. package/apps/lib/components/FormBuilder/fields/index.ts +0 -25
  143. package/apps/lib/components/FormBuilder/form-builder.tsx +0 -198
  144. package/apps/lib/components/FormBuilder/index.ts +0 -31
  145. package/apps/lib/components/FormBuilder/numberFormat.ts +0 -16
  146. package/apps/lib/components/FormBuilder/submit.tsx +0 -47
  147. package/apps/lib/components/FormBuilder/types.ts +0 -311
  148. package/apps/lib/components/FormRenderer/FormDrawer.tsx +0 -128
  149. package/apps/lib/components/FormRenderer/detail.tsx +0 -207
  150. package/apps/lib/components/FormRenderer/form-renderer.tsx +0 -297
  151. package/apps/lib/components/FormRenderer/header.tsx +0 -88
  152. package/apps/lib/components/FormRenderer/index.ts +0 -15
  153. package/apps/lib/components/FormRenderer/section.tsx +0 -39
  154. package/apps/lib/components/FormRenderer/stepper.tsx +0 -339
  155. package/apps/lib/components/FormRenderer/types.ts +0 -78
  156. package/apps/lib/components/FormSummary.tsx +0 -282
  157. package/apps/lib/components/HeaderBar.tsx +0 -117
  158. package/apps/lib/components/ImageAttachment.tsx +0 -209
  159. package/apps/lib/components/InnerLabelField.tsx +0 -154
  160. package/apps/lib/components/Input.tsx +0 -224
  161. package/apps/lib/components/InputField.tsx +0 -147
  162. package/apps/lib/components/InputOTP.tsx +0 -84
  163. package/apps/lib/components/Label.tsx +0 -129
  164. package/apps/lib/components/LabelField.tsx +0 -76
  165. package/apps/lib/components/LabeledCheckBox.tsx +0 -51
  166. package/apps/lib/components/LabeledRadio.tsx +0 -51
  167. package/apps/lib/components/LinkButton.tsx +0 -94
  168. package/apps/lib/components/LoginButton.tsx +0 -51
  169. package/apps/lib/components/PasswordLevel.tsx +0 -58
  170. package/apps/lib/components/Popover.tsx +0 -312
  171. package/apps/lib/components/ProfileMenu.tsx +0 -85
  172. package/apps/lib/components/Radio.tsx +0 -59
  173. package/apps/lib/components/RadioCard.tsx +0 -50
  174. package/apps/lib/components/ScrollArea.tsx +0 -54
  175. package/apps/lib/components/SearchField.tsx +0 -62
  176. package/apps/lib/components/SearchableSelect.tsx +0 -318
  177. package/apps/lib/components/SearchableTable.tsx +0 -344
  178. package/apps/lib/components/SearchableTree.tsx +0 -485
  179. package/apps/lib/components/SearchableTreeDialog.tsx +0 -502
  180. package/apps/lib/components/SectionBlock.tsx +0 -147
  181. package/apps/lib/components/Select.tsx +0 -347
  182. package/apps/lib/components/SimpleSelect.tsx +0 -225
  183. package/apps/lib/components/Skeleton.tsx +0 -12
  184. package/apps/lib/components/SlideDatePicker.tsx +0 -253
  185. package/apps/lib/components/SpinLoading.tsx +0 -174
  186. package/apps/lib/components/Stepper.tsx +0 -480
  187. package/apps/lib/components/Switch.tsx +0 -82
  188. package/apps/lib/components/TabFormItem.tsx +0 -153
  189. package/apps/lib/components/TabSwitch.tsx +0 -172
  190. package/apps/lib/components/Table.tsx +0 -610
  191. package/apps/lib/components/TextEditor/ChartBlockTool.ts +0 -676
  192. package/apps/lib/components/TextEditor/RichTextField.tsx +0 -46
  193. package/apps/lib/components/TextEditor/TableDnDWrapper.ts +0 -462
  194. package/apps/lib/components/TextEditor/TextEditor.tsx +0 -1164
  195. package/apps/lib/components/TextEditor/TextEditorToolbar.tsx +0 -429
  196. package/apps/lib/components/TextEditor/editor-tools/AlignmentTune.ts +0 -70
  197. package/apps/lib/components/TextEditor/editor-tools/ColorInlineTool.ts +0 -50
  198. package/apps/lib/components/TextEditor/editor-tools/StrikethroughInlineTool.ts +0 -48
  199. package/apps/lib/components/TextEditor/editor-tools/inlineFormat.ts +0 -98
  200. package/apps/lib/components/TextEditor/editorjs.d.ts +0 -60
  201. package/apps/lib/components/TextEditor/index.ts +0 -7
  202. package/apps/lib/components/TextEditor/markdownParser.ts +0 -346
  203. package/apps/lib/components/Textarea.tsx +0 -117
  204. package/apps/lib/components/Timeline.tsx +0 -263
  205. package/apps/lib/components/Toast.tsx +0 -87
  206. package/apps/lib/components/Toggle.tsx +0 -125
  207. package/apps/lib/components/ToggleButton.tsx +0 -140
  208. package/apps/lib/components/Tooltip.tsx +0 -116
  209. package/apps/lib/components/TransparentLabel.tsx +0 -71
  210. package/apps/lib/components/TreeDropDown.tsx +0 -115
  211. package/apps/lib/components/TreeFolder/TreeFolder.tsx +0 -380
  212. package/apps/lib/components/TreeFolder/TreeFolderBreadcrumb.tsx +0 -75
  213. package/apps/lib/components/TreeFolder/TreeFolderRow.tsx +0 -354
  214. package/apps/lib/components/TreeFolder/TreeFolderStyles.tsx +0 -60
  215. package/apps/lib/components/TreeFolder/icons.tsx +0 -60
  216. package/apps/lib/components/TreeFolder/index.ts +0 -24
  217. package/apps/lib/components/TreeFolder/treeFolderUtils.ts +0 -109
  218. package/apps/lib/components/TreeFolder/types.ts +0 -77
  219. package/apps/lib/components/TreeFolder/useTreeFolderDnD.ts +0 -118
  220. package/apps/lib/hooks/useActiveTreeItem.ts +0 -58
  221. package/apps/lib/hooks/useClickOutside.ts +0 -27
  222. package/apps/lib/hooks/useDragDrop.tsx +0 -365
  223. package/apps/lib/hooks/useInfiniteScroll.ts +0 -108
  224. package/apps/lib/hooks/useIsMobile.ts +0 -21
  225. package/apps/lib/hooks/useResize.ts +0 -67
  226. package/apps/lib/hooks/useTagSelection.ts +0 -214
  227. package/apps/lib/layouts/CNLayout.tsx +0 -372
  228. package/apps/lib/layouts/DataViewCard.tsx +0 -62
  229. package/apps/lib/layouts/FieldSection.tsx +0 -91
  230. package/apps/lib/layouts/TreeSubLayout.tsx +0 -173
  231. package/apps/lib/providers/ThemeProvider.tsx +0 -84
  232. package/apps/lib/registry.json +0 -1201
  233. package/apps/lib/tsconfig.json +0 -9
  234. package/apps/lib/tsconfig.tsbuildinfo +0 -1
  235. package/apps/lib/utils/cn.ts +0 -6
  236. package/apps/lib/utils/color.ts +0 -175
  237. package/apps/lib/utils/dataViews/path.ts +0 -67
  238. package/apps/lib/utils/dataViews/query.ts +0 -73
  239. package/apps/lib/utils/dataViews/types.ts +0 -187
  240. package/apps/lib/utils/dateFormat.ts +0 -108
  241. package/apps/lib/utils/resize.ts +0 -31
  242. package/apps/lib/utils/types.ts +0 -16
  243. package/docs/BLOCKS.md +0 -129
  244. package/docs/CHANGELOG-1.1.16.md +0 -108
  245. package/docs/Cover.png +0 -0
  246. package/docs/README.md +0 -215
  247. package/docs/components/action-button.md +0 -638
  248. package/docs/components/actions-group.md +0 -708
  249. package/docs/components/alert-dialog.md +0 -920
  250. package/docs/components/avatar.md +0 -709
  251. package/docs/components/badge-field.md +0 -712
  252. package/docs/components/badge.md +0 -301
  253. package/docs/components/breadcrumb.md +0 -930
  254. package/docs/components/button-group.md +0 -650
  255. package/docs/components/button.md +0 -639
  256. package/docs/components/calendar.md +0 -555
  257. package/docs/components/card.md +0 -622
  258. package/docs/components/chart-block-tool.md +0 -129
  259. package/docs/components/checkbox.md +0 -699
  260. package/docs/components/cn-layout.md +0 -854
  261. package/docs/components/color-picker.md +0 -101
  262. package/docs/components/conclusion-header.md +0 -80
  263. package/docs/components/context-menu.md +0 -483
  264. package/docs/components/count-badge.md +0 -560
  265. package/docs/components/data-table.md +0 -854
  266. package/docs/components/data-views/backend-response.md +0 -324
  267. package/docs/components/data-views/examples/a11y-rtl.md +0 -250
  268. package/docs/components/data-views/examples/api-orders-route.md +0 -130
  269. package/docs/components/data-views/examples/fields.md +0 -362
  270. package/docs/components/data-views/examples/filters.md +0 -307
  271. package/docs/components/data-views/examples/inbox-routing.md +0 -218
  272. package/docs/components/data-views/examples/index.md +0 -29
  273. package/docs/components/data-views/examples/overview.md +0 -244
  274. package/docs/components/data-views/examples/panel.md +0 -212
  275. package/docs/components/data-views/examples/scale.md +0 -231
  276. package/docs/components/data-views/examples/server-side.md +0 -210
  277. package/docs/components/data-views/examples/state.md +0 -250
  278. package/docs/components/data-views/examples/tree-custom.md +0 -388
  279. package/docs/components/data-views/examples/view-registry.md +0 -313
  280. package/docs/components/data-views/examples/views.md +0 -534
  281. package/docs/components/data-views/guide.md +0 -405
  282. package/docs/components/data-views/index.md +0 -1495
  283. package/docs/components/data-views/migration.md +0 -79
  284. package/docs/components/date-picker.md +0 -857
  285. package/docs/components/dialog.md +0 -929
  286. package/docs/components/divider.md +0 -766
  287. package/docs/components/drawer.md +0 -654
  288. package/docs/components/dropdown-menu.md +0 -668
  289. package/docs/components/field-hint.md +0 -898
  290. package/docs/components/field-section.md +0 -781
  291. package/docs/components/form-builder.md +0 -276
  292. package/docs/components/form-renderer.md +0 -326
  293. package/docs/components/form-summary.md +0 -138
  294. package/docs/components/form.md +0 -785
  295. package/docs/components/header-bar.md +0 -188
  296. package/docs/components/image-attachment.md +0 -906
  297. package/docs/components/inner-label-field.md +0 -819
  298. package/docs/components/input-field.md +0 -623
  299. package/docs/components/input-otp.md +0 -756
  300. package/docs/components/input.md +0 -634
  301. package/docs/components/label-field.md +0 -770
  302. package/docs/components/label.md +0 -761
  303. package/docs/components/labeled-check-box.md +0 -642
  304. package/docs/components/labeled-radio.md +0 -796
  305. package/docs/components/link-button.md +0 -685
  306. package/docs/components/login-button.md +0 -872
  307. package/docs/components/password-level.md +0 -803
  308. package/docs/components/popover.md +0 -649
  309. package/docs/components/profile-menu.md +0 -656
  310. package/docs/components/radio-card.md +0 -801
  311. package/docs/components/radio.md +0 -735
  312. package/docs/components/scroll-area.md +0 -691
  313. package/docs/components/search-field.md +0 -702
  314. package/docs/components/searchable-select.md +0 -368
  315. package/docs/components/searchable-table.md +0 -438
  316. package/docs/components/searchable-tree-dialog.md +0 -190
  317. package/docs/components/searchable-tree.md +0 -200
  318. package/docs/components/section-block.md +0 -477
  319. package/docs/components/select.md +0 -709
  320. package/docs/components/simple-select.md +0 -741
  321. package/docs/components/skeleton.md +0 -706
  322. package/docs/components/slide-date-picker.md +0 -837
  323. package/docs/components/spin-loading.md +0 -696
  324. package/docs/components/stepper.md +0 -316
  325. package/docs/components/switch.md +0 -770
  326. package/docs/components/tab-form-item.md +0 -773
  327. package/docs/components/tab-switch.md +0 -170
  328. package/docs/components/table-dnd-wrapper.md +0 -107
  329. package/docs/components/table.md +0 -1088
  330. package/docs/components/text-editor.md +0 -735
  331. package/docs/components/textarea.md +0 -681
  332. package/docs/components/timeline.md +0 -254
  333. package/docs/components/toast.md +0 -773
  334. package/docs/components/toggle-button.md +0 -643
  335. package/docs/components/toggle.md +0 -882
  336. package/docs/components/tooltip.md +0 -513
  337. package/docs/components/transparent-label.md +0 -721
  338. package/docs/components/tree-drop-down.md +0 -740
  339. package/docs/components/tree-folder.md +0 -110
  340. package/docs/components/tree-sub-layout.md +0 -707
  341. package/docs/explanation/architecture.md +0 -54
  342. package/docs/explanation/design-system.md +0 -52
  343. package/docs/how-to/form-and-list-recipes.md +0 -386
  344. package/docs/how-to/forms-with-form-builder.md +0 -472
  345. package/docs/how-to/guides.md +0 -1027
  346. package/docs/migration/changelog.md +0 -54
  347. package/docs/migration/form-builder-2.5.2.md +0 -113
  348. package/docs/reference/cli.md +0 -112
  349. package/docs/reference/components.md +0 -572
  350. package/docs/reference/hooks.md +0 -1500
  351. package/docs/reference/providers.md +0 -866
  352. package/docs/reference/tailwind-plugins.md +0 -942
  353. package/docs/reference/theme.md +0 -85
  354. package/docs/reference/types.md +0 -1016
  355. package/docs/reference/utilities.md +0 -704
  356. package/docs/tutorials/building-first-form.md +0 -846
  357. package/docs/tutorials/component-composition.md +0 -882
  358. package/docs/tutorials/getting-started.md +0 -302
  359. package/docs/tutorials/theming-basics.md +0 -785
@@ -1,157 +0,0 @@
1
- "use client";
2
-
3
- import { useId, useMemo, useState } from "react";
4
- import { cn } from "../../../utils/cn";
5
- import { Button } from "../../Button";
6
- import { ConclusionHeader } from "../../ConclusionHeader";
7
- import { FormBuilder } from "../../FormBuilder";
8
- import { CellContext } from "../../FormBuilder/context";
9
- import { FiltersContext, useDataViewsFilters } from "../context";
10
- import { collectFilterFields, renderFields } from "./children";
11
- import { Custom } from "./custom";
12
- import { Presets } from "./presets";
13
- import { Sync } from "./sync";
14
- import { toFormValues } from "./values";
15
- import type { FiltersProps } from "../types";
16
-
17
- /**
18
- * `DataViews.Filters` — the filter controls, written as a form.
19
- *
20
- * Three things to be clear about.
21
- *
22
- * **It does not filter.** It collects what the user asked for and calls `onValueChange`. Going and
23
- * fetching the matching rows is your job, almost certainly server-side. The rows on screen change
24
- * when you hand back different `rows` — never before.
25
- *
26
- * **The children are FormBuilder fields.** Not a config array describing fields — the fields
27
- * themselves, one JSX child each, exactly as any other form in this library is written. They
28
- * render through `CellContext` in `"bare"` mode: no `FieldSection` label row, no table borders,
29
- * errors as tooltips.
30
- *
31
- * **What each child means comes from the field, not from you.** `FormBuilder` stamps every field
32
- * with a `FieldKind` — see `fieldKindOf` — so a `MultiSelect` becomes a list of values, a `Slider`
33
- * a numeric range, a `DateRange` a date range. Nothing is inferred from the rows.
34
- *
35
- * There is no `value`/`onValueChange` here: the filters live in the root's query, and this reads
36
- * and writes them through `useDataViewsFilters()`. What leaves the component is `onQueryChange`.
37
- *
38
- * ```tsx
39
- * <DataViews.Filters>
40
- * <FormBuilder.MultiSelect name="status" label="Status" options={STATUS} />
41
- * <FormBuilder.Slider name="total" label="Total" range min={0} max={15000} step={100} />
42
- * <DataViews.Filters.Presets for="total" items={[{ label: "Under $500", max: 500 }]} />
43
- * </DataViews.Filters>
44
- * ```
45
- */
46
- function FiltersRoot({
47
- children,
48
- title = "Filters",
49
- description,
50
- clearLabel = "Clear",
51
- collapsible = true,
52
- defaultOpen = true,
53
- className,
54
- }: FiltersProps) {
55
- const { filters, setFilters } = useDataViewsFilters();
56
-
57
- const fields = useMemo(() => collectFilterFields(children), [children]);
58
-
59
- const value = useMemo(
60
- () => ({ filters, setFilters, filterFields: fields }),
61
- [filters, setFilters, fields],
62
- );
63
-
64
- const values = useMemo(() => toFormValues(filters, fields), [filters, fields]);
65
- const active = Object.keys(filters).length > 0;
66
-
67
- const [open, setOpen] = useState(defaultOpen);
68
- const bodyId = useId();
69
- const isCollapsible = collapsible && title != null;
70
- const shown = !isCollapsible || open;
71
-
72
- return (
73
- <FiltersContext.Provider value={value}>
74
- <div
75
- className={cn(
76
- "flex shrink-0 flex-col gap-3 px-4 py-3",
77
- "border-border-presentation-global-primary border-b",
78
- className,
79
- )}
80
- >
81
- {(title || active) && (
82
- // `ConclusionHeader` renders a `<button>`, so Clear cannot live inside it — nesting a
83
- // button in a button is invalid and swallows the inner click. They are siblings.
84
- <div className="flex items-center gap-2">
85
- {title != null &&
86
- (isCollapsible ? (
87
- <ConclusionHeader
88
- label={title}
89
- open={open}
90
- onOpenChange={setOpen}
91
- aria-controls={bodyId}
92
- className="flex-1"
93
- />
94
- ) : (
95
- // Reading the colour from a token rather than a `text-white` literal is what lets
96
- // the same controls sit in the dark rail and in the light content area.
97
- <h3 className="text-content-presentation-global-primary min-w-0 truncate text-[18px] font-[510] leading-[1.32] tracking-[-0.01em]">
98
- {title}
99
- </h3>
100
- ))}
101
- {active && (
102
- <Button
103
- size="S"
104
- variant="BorderStyle"
105
- className="ms-auto"
106
- onClick={() => setFilters({})}
107
- >
108
- {clearLabel}
109
- </Button>
110
- )}
111
- </div>
112
- )}
113
-
114
- {/* Below the header *row*, not inside it — that row is a flex line holding the header and
115
- Clear as siblings, and the description belongs to the section, not beside the button. */}
116
- {description != null && (
117
- <p className="typography-body-small-regular text-content-presentation-global-primary">
118
- {description}
119
- </p>
120
- )}
121
-
122
- {/* `onSubmit` is required by FormBuilder but never reached — there is no submit button and
123
- no Enter target. Filters emit as you touch them. */}
124
- <FormBuilder onSubmit={() => {}} values={values} fieldDirection="vertical">
125
- <Sync fields={fields} />
126
- <CellContext.Provider value="bare">
127
- {/* Same fold as `Panel.Section`: a 0fr→1fr grid row, and `inert` so a collapsed
128
- filter's control leaves the tab order rather than staying focusable. */}
129
- <div
130
- id={bodyId}
131
- inert={!shown}
132
- aria-hidden={!shown}
133
- className={cn(
134
- "grid transition-[grid-template-rows,opacity] duration-200 ease-in-out",
135
- "motion-reduce:transition-none",
136
- shown ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0",
137
- )}
138
- >
139
- <div className="overflow-hidden">
140
- <div className="flex flex-wrap items-start gap-3">{renderFields(children)}</div>
141
- </div>
142
- </div>
143
- </CellContext.Provider>
144
- </FormBuilder>
145
- </div>
146
- </FiltersContext.Provider>
147
- );
148
- }
149
-
150
- /**
151
- * The filter surface, assembled in one place. `Presets` and `Custom` are ours because FormBuilder
152
- * has no field for them; everything else you write is a FormBuilder field.
153
- */
154
- export const Filters = Object.assign(FiltersRoot, {
155
- Presets,
156
- Custom,
157
- });
@@ -1,4 +0,0 @@
1
- // The filter surface. `filters.tsx` assembles the compound; `children.tsx` is the walk that reads
2
- // your FormBuilder fields; `values.ts` is the pure mapping between `FilterState` and form values.
3
- export { Filters } from "./filters";
4
- export { collectFilterFields } from "./children";
@@ -1,20 +0,0 @@
1
- "use client";
2
-
3
- import React from "react";
4
-
5
- /** A label above a bare control, since `FieldSection` is exactly what "bare" removes. */
6
- export function Labelled({ label, children }: { label?: React.ReactNode; children: React.ReactNode }) {
7
- return (
8
- // `flex-1` is what makes a control fill the width it was given rather than sitting at its
9
- // minimum with dead space beside it — one per line in the 260px rail, sharing the line evenly
10
- // in anything wider. `min-w` stays as the floor that decides where the parent wraps.
11
- <div className="flex min-w-[180px] flex-1 flex-col gap-1">
12
- {label && (
13
- <span className="typography-body-small-regular text-content-presentation-global-secondary">
14
- {label}
15
- </span>
16
- )}
17
- {children}
18
- </div>
19
- );
20
- }
@@ -1,65 +0,0 @@
1
- "use client";
2
-
3
- import { useFormContext } from "react-hook-form";
4
- import { cn } from "../../../utils/cn";
5
- import type { FilterFieldDescriptor, NumberPreset } from "../../../utils/dataViews/types";
6
- import { useDataViewsFilters } from "../context";
7
- import { datePresets, numberPresets, toName } from "./values";
8
- import type { FilterPresetsProps } from "../types";
9
-
10
- /** Look up what `Filters` learned about a path, so a sibling control can target it. */
11
- function useDescriptor(path: string): FilterFieldDescriptor | undefined {
12
- const { filterFields } = useDataViewsFilters();
13
- return filterFields.find((f) => f.path === path);
14
- }
15
-
16
-
17
- /**
18
- * `DataViews.Filters.Presets` — named shortcuts for the field named in `for`.
19
- *
20
- * FormBuilder has no field for this, and it is not a filter of its own: it writes into a sibling's
21
- * value. Numeric presets fill the side they do not name from that slider's bounds, so
22
- * `{ label: "$5k+", min: 5000 }` means "5,000 to the top" rather than "5,000 to 100".
23
- */
24
- export function Presets({ for: path, items, className }: FilterPresetsProps) {
25
- const form = useFormContext();
26
- const field = useDescriptor(path);
27
- const name = toName(path);
28
-
29
- if (!field) return null;
30
-
31
- const shortcuts =
32
- field.kind === "date"
33
- ? datePresets(items).map((preset) => ({
34
- label: preset.label,
35
- apply: () =>
36
- form.setValue(name, {
37
- from: preset.from ? new Date(preset.from) : undefined,
38
- to: preset.to ? new Date(preset.to) : undefined,
39
- }),
40
- }))
41
- : numberPresets(items).map((preset: NumberPreset) => ({
42
- label: preset.label,
43
- apply: () => form.setValue(name, [preset.min ?? field.min ?? 0, preset.max ?? field.max ?? 100]),
44
- }));
45
-
46
- if (shortcuts.length === 0) return null;
47
-
48
- return (
49
- <div className={cn("flex flex-wrap gap-1", className)}>
50
- {shortcuts.map((preset) => (
51
- <button
52
- key={preset.label}
53
- type="button"
54
- onClick={preset.apply}
55
- className={cn(
56
- "typography-body-small-regular rounded-[4px] px-2 py-[2px] transition-colors",
57
- "text-content-presentation-global-secondary hover:bg-background-presentation-action-hover",
58
- )}
59
- >
60
- {preset.label}
61
- </button>
62
- ))}
63
- </div>
64
- );
65
- }
@@ -1,35 +0,0 @@
1
- "use client";
2
-
3
- import { useEffect, useRef } from "react";
4
- import { useWatch } from "react-hook-form";
5
- import type { FilterFieldDescriptor } from "../../../utils/dataViews/types";
6
- import { useDataViewsFilters } from "../context";
7
- import { sameFilters, toFilterState } from "./values";
8
-
9
- /**
10
- * Pushes what the user typed back out as `onValueChange`.
11
- *
12
- * Debounced, and guarded by an equality check: without both, `watch` → emit → new `values` →
13
- * re-render is a loop that swallows keystrokes mid-type.
14
- */
15
- export function Sync({ fields }: { fields: readonly FilterFieldDescriptor[] }) {
16
- const { setFilters, filters } = useDataViewsFilters();
17
- const watched = useWatch();
18
-
19
- // Read the current filters through a ref so the effect does not re-run just because the parent
20
- // handed back a new (equal) object.
21
- const latest = useRef(filters);
22
- latest.current = filters;
23
-
24
- useEffect(() => {
25
- const timer = setTimeout(() => {
26
- // Merged onto the current state, not derived from scratch — these controls own only their
27
- // own paths. Anything else (a `Filters.Custom` value, a key the caller supplied) survives.
28
- const next = toFilterState(watched as Record<string, unknown>, fields, latest.current);
29
- if (!sameFilters(next, latest.current)) setFilters(next);
30
- }, 200);
31
- return () => clearTimeout(timer);
32
- }, [watched, fields, setFilters]);
33
-
34
- return null;
35
- }
@@ -1,173 +0,0 @@
1
- import type {
2
- DatePreset,
3
- FilterFieldDescriptor,
4
- FilterState,
5
- FilterValue,
6
- NumberPreset,
7
- Preset,
8
- } from "../../../utils/dataViews/types";
9
-
10
- /**
11
- * Translating between `FilterState` (what you receive) and react-hook-form values (what the
12
- * inputs speak). Pure functions, no React — the fiddly half of `Filters` is here so the component
13
- * itself stays readable, and so this is testable without rendering anything.
14
- */
15
-
16
- /**
17
- * RHF reads `.` in a field name as object nesting, so a filter on `customer.name` would arrive as
18
- * `{ customer: { name: … } }`. Names are escaped on the way in and unescaped on the way out.
19
- */
20
- export const toName = (path: string) => path.replace(/\./g, "__");
21
-
22
- const isRange = (v: FilterValue | undefined): v is Exclude<FilterValue, string[]> =>
23
- !!v && !Array.isArray(v);
24
-
25
- /** `FilterState` → the values the inputs want. */
26
- export function toFormValues(
27
- filters: FilterState,
28
- fields: readonly FilterFieldDescriptor[],
29
- ): Record<string, unknown> {
30
- const out: Record<string, unknown> = {};
31
-
32
- for (const field of fields) {
33
- const value = filters[field.path];
34
- const name = toName(field.path);
35
-
36
- switch (field.kind) {
37
- case "choice": {
38
- const selected = Array.isArray(value) ? value : [];
39
- out[name] = field.single ? (selected[0] ?? "") : selected;
40
- break;
41
- }
42
- case "number": {
43
- const lo = field.min ?? 0;
44
- const hi = field.max ?? 100;
45
- const range = isRange(value) && value.kind === "number" ? value : undefined;
46
- out[name] = [range?.min ?? lo, range?.max ?? hi];
47
- break;
48
- }
49
- case "date": {
50
- const range = isRange(value) && value.kind === "date" ? value : undefined;
51
- out[name] = {
52
- from: range?.from ? new Date(range.from) : undefined,
53
- to: range?.to ? new Date(range.to) : undefined,
54
- };
55
- break;
56
- }
57
- case "text":
58
- out[name] = Array.isArray(value) ? (value[0] ?? "") : "";
59
- break;
60
- }
61
- }
62
-
63
- return out;
64
- }
65
-
66
- /**
67
- * `YYYY-MM-DD` in the **user's** timezone.
68
- *
69
- * `toISOString()` converts to UTC first, so someone east of UTC picking "today" in the calendar
70
- * would emit yesterday's date — an off-by-one-day filter that only reproduces in some timezones.
71
- */
72
- const iso = (d: unknown) => {
73
- const date = d instanceof Date ? d : d ? new Date(String(d)) : null;
74
- if (!date || Number.isNaN(date.getTime())) return undefined;
75
- const pad = (n: number) => String(n).padStart(2, "0");
76
- return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
77
- };
78
-
79
- /**
80
- * The inputs' values → `FilterState`.
81
- *
82
- * A control at its neutral position produces **no key at all** rather than an empty one. That
83
- * matters: the emitted query is a request to go and fetch, and `{ total: { min: 0, max: 100 } }`
84
- * when the slider has never been touched would narrow a query that the user never narrowed.
85
- *
86
- * `previous` is merged rather than replaced, and this is load-bearing: these `fields` own only
87
- * their own paths. `Filters.Custom` writes straight into `FilterState`, and a caller's initial
88
- * `filters` may carry keys no control was declared for. Rebuilding the state from `fields` alone
89
- * would silently drop both the moment any control changed.
90
- */
91
- export function toFilterState(
92
- values: Record<string, unknown>,
93
- fields: readonly FilterFieldDescriptor[],
94
- previous: FilterState = {},
95
- ): FilterState {
96
- const owned = new Set(fields.map((f) => f.path));
97
- const out: FilterState = {};
98
- for (const [path, value] of Object.entries(previous)) {
99
- if (!owned.has(path)) out[path] = value;
100
- }
101
-
102
- for (const field of fields) {
103
- const raw = values[toName(field.path)];
104
-
105
- switch (field.kind) {
106
- case "choice": {
107
- const selected =
108
- field.single
109
- ? raw
110
- ? [String(raw)]
111
- : []
112
- : Array.isArray(raw)
113
- ? raw.map(String)
114
- : [];
115
- if (selected.length > 0) out[field.path] = selected;
116
- break;
117
- }
118
- case "number": {
119
- if (!Array.isArray(raw)) break;
120
- const lo = field.min ?? 0;
121
- const hi = field.max ?? 100;
122
- const [min, max] = raw as number[];
123
- // Untouched means "no constraint", not "everything".
124
- if (min === lo && max === hi) break;
125
- out[field.path] = { kind: "number", min, max };
126
- break;
127
- }
128
- case "date": {
129
- const range = (raw ?? {}) as { from?: unknown; to?: unknown };
130
- const from = iso(range.from);
131
- const to = iso(range.to);
132
- if (from || to) out[field.path] = { kind: "date", from, to };
133
- break;
134
- }
135
- case "text": {
136
- const text = typeof raw === "string" ? raw.trim() : "";
137
- if (text) out[field.path] = [text];
138
- break;
139
- }
140
- }
141
- }
142
-
143
- return out;
144
- }
145
-
146
- /**
147
- * Whether two filter states are the same. Used to break the `watch` → `onChange` → new `values`
148
- * → re-render loop that otherwise eats keystrokes: if nothing actually changed, nothing is
149
- * emitted.
150
- */
151
- export function sameFilters(a: FilterState, b: FilterState): boolean {
152
- const keys = new Set([...Object.keys(a), ...Object.keys(b)]);
153
- for (const key of keys) {
154
- const x = a[key];
155
- const y = b[key];
156
- if (x === undefined || y === undefined) return false;
157
- if (Array.isArray(x) !== Array.isArray(y)) return false;
158
- if (Array.isArray(x) && Array.isArray(y)) {
159
- if (x.length !== y.length || x.some((v, i) => v !== y[i])) return false;
160
- } else if (JSON.stringify(x) !== JSON.stringify(y)) {
161
- return false;
162
- }
163
- }
164
- return true;
165
- }
166
-
167
- /** The numeric shortcuts out of a mixed `presets` list. */
168
- export const numberPresets = (presets?: readonly Preset[]): NumberPreset[] =>
169
- (presets ?? []).filter((p): p is NumberPreset => "min" in p || "max" in p);
170
-
171
- /** The date shortcuts out of a mixed `presets` list. */
172
- export const datePresets = (presets?: readonly Preset[]): DatePreset[] =>
173
- (presets ?? []).filter((p): p is DatePreset => "from" in p || "to" in p);
@@ -1,220 +0,0 @@
1
- "use client";
2
-
3
- import React, { useEffect, useRef, useState } from "react";
4
- import { Search as SearchIcon, Settings } from "lucide-react";
5
- import { cn } from "../../utils/cn";
6
- import { Button } from "../Button";
7
- import { TabSwitch, type TabSwitchOption } from "../TabSwitch";
8
- import { useDataViewsPanel, useDataViewsView } from "./context";
9
- import { markHeader } from "./slots";
10
- import type {
11
- ActionsProps,
12
- HeaderProps,
13
- PanelToggleProps,
14
- SearchProps,
15
- ViewSwitchProps,
16
- } from "./types";
17
-
18
- /**
19
- * The bar above the views — 52px, black, always dark.
20
- *
21
- * `data-theme="dark"` is deliberate and scoped to the bar: it makes the child Buttons and the
22
- * view switcher resolve dark tokens so they read correctly against the black, even when the host
23
- * app runs light. It must not wrap the content below, which stays in the host theme.
24
- *
25
- * ```tsx
26
- * <DataViews.Header title="Orders">
27
- * <DataViews.ViewSwitch />
28
- * <DataViews.Search />
29
- * <DataViews.Actions><Button>New</Button></DataViews.Actions>
30
- * <DataViews.PanelToggle />
31
- * </DataViews.Header>
32
- * ```
33
- */
34
- export function Header({ title, children, className }: HeaderProps) {
35
- return (
36
- <div
37
- data-theme="dark"
38
- className={cn(
39
- // 40px and no background of its own, per Figma's `Body-HeaderBar-1.0`. The bar has never
40
- // needed one: the root shell already paints black behind it.
41
- "flex h-[40px] w-full shrink-0 items-center gap-2 rounded-[12px]",
42
- className,
43
- )}
44
- >
45
- {title !== undefined && (
46
- <>
47
- {/* `min-w-0`, not `shrink-0`: the pill has to be able to give up width, or a long title
48
- pushes the view switch, actions and panel toggle off the end of the bar. It yields
49
- first and the title ellipsises instead. */}
50
- <div className="flex h-9 min-w-0 items-center gap-2 rounded-[12px] border border-[#434446] bg-[#252729] px-[10px]">
51
- <span className="truncate text-[28px] font-[510] uppercase leading-[1.19] text-white">
52
- {title}
53
- </span>
54
- </div>
55
- {/* `border/presentation/global/primary`, not the pill's `#434446` — the design uses two
56
- different greys here, and the divider is the darker one. */}
57
- <div className="h-5 w-px shrink-0 rounded-[4px] bg-[#2c2d2e]" />
58
- </>
59
- )}
60
- {children}
61
- </div>
62
- );
63
- }
64
-
65
- markHeader(Header);
66
-
67
- /**
68
- * Switches between the views you rendered. The options come from the view registry, so this stays
69
- * in sync by construction — there is no list to keep updated.
70
- *
71
- * It takes the remaining width, which is what pushes `Actions` and the panel toggle to the end of
72
- * the bar. Renders nothing when fewer than two views are registered: a switcher with one option
73
- * is noise.
74
- *
75
- */
76
- export function ViewSwitch({ className }: ViewSwitchProps) {
77
- const { views, view, setView } = useDataViewsView();
78
-
79
- if (views.length < 2) return <div className="flex-1" />;
80
-
81
- const options: TabSwitchOption[] = views.map((v) => ({
82
- value: v.id,
83
- label: v.label,
84
- icon: v.icon,
85
- }));
86
-
87
- return (
88
- <div className={cn("flex flex-1 items-center gap-2", className)}>
89
- <TabSwitch theme="dark" options={options} value={view} onValueChange={setView} />
90
- </div>
91
- );
92
- }
93
-
94
- /**
95
- * The search box — an icon button that expands into a field.
96
- *
97
- * It only reports what was typed: typing puts a `search` in the query and `onQueryChange` is
98
- * where you go and fetch. DataViews never matches rows against this string.
99
- */
100
- export function Search({ placeholder = "Search...", className }: SearchProps) {
101
- const { search, setSearch } = useDataViewsView();
102
- const [open, setOpen] = useState(false);
103
- const inputRef = useRef<HTMLInputElement>(null);
104
- const wrapRef = useRef<HTMLDivElement>(null);
105
-
106
- useEffect(() => {
107
- if (open) inputRef.current?.focus();
108
- }, [open]);
109
-
110
- const clearAndCollapse = () => {
111
- setSearch("");
112
- setOpen(false);
113
- };
114
-
115
- useEffect(() => {
116
- if (!open) return;
117
- const onDown = (e: MouseEvent) => {
118
- if (wrapRef.current?.contains(e.target as Node)) return;
119
- // Collapsing on an outside click would throw away an active query — only close when the
120
- // field is empty.
121
- if (!search) setOpen(false);
122
- };
123
- document.addEventListener("mousedown", onDown);
124
- return () => document.removeEventListener("mousedown", onDown);
125
- }, [open, search]);
126
-
127
- if (!open) {
128
- return (
129
- <Button
130
- variant="BluContStyle"
131
- size="M"
132
- buttonType="icon"
133
- aria-label="Open search"
134
- onClick={() => setOpen(true)}
135
- className={cn(
136
- "border-border-presentation-global-primary shrink-0 rounded-[6px] border",
137
- className,
138
- )}
139
- >
140
- <SearchIcon className="h-[18px] w-[18px]" />
141
- </Button>
142
- );
143
- }
144
-
145
- return (
146
- <div
147
- ref={wrapRef}
148
- className={cn(
149
- "relative flex h-[28px] w-[260px] shrink-0 items-center justify-center rounded-[6px]",
150
- "border-border-presentation-state-focus bg-background-presentation-form-field-primary border px-1",
151
- "shadow-[0_1px_6px_0_rgba(0,0,0,0.30)] transition-all duration-150 ease-in-out",
152
- className,
153
- )}
154
- >
155
- <input
156
- ref={inputRef}
157
- type="text"
158
- size={1}
159
- value={search}
160
- placeholder={placeholder}
161
- onChange={(e) => setSearch(e.target.value)}
162
- onKeyDown={(e) => {
163
- if (e.key === "Escape") clearAndCollapse();
164
- }}
165
- className="placeholder:text-content-presentation-global-tertiary min-w-0 flex-1 bg-transparent text-[14px] leading-none text-white caret-[#1E7AFE] focus:outline-none"
166
- />
167
- <button
168
- type="button"
169
- aria-label="Clear search"
170
- onClick={clearAndCollapse}
171
- className="flex shrink-0 items-center justify-center self-stretch px-1"
172
- >
173
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
174
- <path
175
- d="M7.99992 14.6666C4.31802 14.6666 1.33325 11.6818 1.33325 7.99992C1.33325 4.31802 4.31802 1.33325 7.99992 1.33325C11.6818 1.33325 14.6666 4.31802 14.6666 7.99992C14.6666 11.6818 11.6818 14.6666 7.99992 14.6666ZM7.99992 7.05712L6.1143 5.17149L5.17149 6.1143L7.05712 7.99992L5.17149 9.88552L6.1143 10.8283L7.99992 8.94272L9.88552 10.8283L10.8283 9.88552L8.94272 7.99992L10.8283 6.1143L9.88552 5.17149L7.99992 7.05712Z"
176
- fill="white"
177
- />
178
- </svg>
179
- </button>
180
- </div>
181
- );
182
- }
183
-
184
- /**
185
- * A slot for your own buttons, so they line up with the rest of the header.
186
- *
187
- * The convention is `<Button variant="BluColStyle" size="M">` — the solid `#005ecc` Figma uses
188
- * for the bar's action. `Search` and `PanelToggle` beside it stay ghost on purpose: they are
189
- * toggles, and three solid pills on black would stop them reading as such. A toggle of your own
190
- * belongs here too, with `BluColStyle` for its on state.
191
- *
192
- * Not enforced. Cloning the children to force a variant would override a caller who deliberately
193
- * wants a destructive button here, and would fight their `className`.
194
- */
195
- export function Actions({ children, className }: ActionsProps) {
196
- return <div className={cn("flex shrink-0 items-center gap-2", className)}>{children}</div>;
197
- }
198
-
199
- /**
200
- * Opens `DataViews.Panel`. It hides itself while the panel is open — the panel has its own close
201
- * control, so keeping this one visible would be a second way to do the same thing.
202
- */
203
- export function PanelToggle({ children, className }: PanelToggleProps) {
204
- const { open, setOpen } = useDataViewsPanel();
205
-
206
- if (open) return null;
207
-
208
- return (
209
- <Button
210
- variant="BluContStyle"
211
- size="M"
212
- onClick={() => setOpen(true)}
213
- aria-expanded={open}
214
- className={cn("gap-[6px] rounded-[6px] px-[14px] text-[16px] font-[510]", className)}
215
- >
216
- <Settings className="h-[18px] w-[18px]" />
217
- {children ?? "Filter & Config."}
218
- </Button>
219
- );
220
- }
@@ -1,5 +0,0 @@
1
- // DataViews' own hooks. The drag hook is not here: `TreeFolder` needs it too, and a shared
2
- // component cannot import from inside DataViews without inverting the dependency — it lives in
3
- // `lib/hooks/useDragDrop.tsx`.
4
- export { useActiveRow } from "./useActiveRow";
5
- export { useControllable } from "./useControllable";