torch-glare 2.5.6 → 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 (362) 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 -403
  69. package/apps/lib/components/Breadcrumb.tsx +0 -280
  70. package/apps/lib/components/Button.tsx +0 -325
  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 -395
  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 -88
  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 -72
  106. package/apps/lib/components/DataViews/states.tsx +0 -73
  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 -451
  118. package/apps/lib/components/DropdownMenu.tsx +0 -554
  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 -85
  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 -168
  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 -114
  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 -67
  147. package/apps/lib/components/FormBuilder/types.ts +0 -316
  148. package/apps/lib/components/FormRenderer/FormDrawer.tsx +0 -250
  149. package/apps/lib/components/FormRenderer/detail.tsx +0 -256
  150. package/apps/lib/components/FormRenderer/form-renderer.tsx +0 -358
  151. package/apps/lib/components/FormRenderer/header.tsx +0 -88
  152. package/apps/lib/components/FormRenderer/index.ts +0 -17
  153. package/apps/lib/components/FormRenderer/notch-action.tsx +0 -64
  154. package/apps/lib/components/FormRenderer/section.tsx +0 -39
  155. package/apps/lib/components/FormRenderer/stepper.tsx +0 -393
  156. package/apps/lib/components/FormRenderer/types.ts +0 -115
  157. package/apps/lib/components/FormSummary.tsx +0 -282
  158. package/apps/lib/components/HeaderBar.tsx +0 -117
  159. package/apps/lib/components/ImageAttachment.tsx +0 -209
  160. package/apps/lib/components/InnerLabelField.tsx +0 -154
  161. package/apps/lib/components/Input.tsx +0 -224
  162. package/apps/lib/components/InputField.tsx +0 -147
  163. package/apps/lib/components/InputOTP.tsx +0 -84
  164. package/apps/lib/components/Label.tsx +0 -129
  165. package/apps/lib/components/LabelField.tsx +0 -76
  166. package/apps/lib/components/LabeledCheckBox.tsx +0 -51
  167. package/apps/lib/components/LabeledRadio.tsx +0 -51
  168. package/apps/lib/components/LinkButton.tsx +0 -94
  169. package/apps/lib/components/LoginButton.tsx +0 -51
  170. package/apps/lib/components/PasswordLevel.tsx +0 -58
  171. package/apps/lib/components/Popover.tsx +0 -312
  172. package/apps/lib/components/ProfileMenu.tsx +0 -85
  173. package/apps/lib/components/Radio.tsx +0 -59
  174. package/apps/lib/components/RadioCard.tsx +0 -50
  175. package/apps/lib/components/ScrollArea.tsx +0 -54
  176. package/apps/lib/components/SearchField.tsx +0 -62
  177. package/apps/lib/components/SearchableSelect.tsx +0 -318
  178. package/apps/lib/components/SearchableTable.tsx +0 -344
  179. package/apps/lib/components/SearchableTree.tsx +0 -485
  180. package/apps/lib/components/SearchableTreeDialog.tsx +0 -502
  181. package/apps/lib/components/SectionBlock.tsx +0 -168
  182. package/apps/lib/components/Select.tsx +0 -347
  183. package/apps/lib/components/SimpleSelect.tsx +0 -225
  184. package/apps/lib/components/Skeleton.tsx +0 -12
  185. package/apps/lib/components/SlideDatePicker.tsx +0 -255
  186. package/apps/lib/components/SpinLoading.tsx +0 -174
  187. package/apps/lib/components/Stepper.tsx +0 -480
  188. package/apps/lib/components/Switch.tsx +0 -82
  189. package/apps/lib/components/TabFormItem.tsx +0 -153
  190. package/apps/lib/components/TabSwitch.tsx +0 -172
  191. package/apps/lib/components/Table.tsx +0 -597
  192. package/apps/lib/components/TextEditor/ChartBlockTool.ts +0 -676
  193. package/apps/lib/components/TextEditor/RichTextField.tsx +0 -46
  194. package/apps/lib/components/TextEditor/TableDnDWrapper.ts +0 -462
  195. package/apps/lib/components/TextEditor/TextEditor.tsx +0 -1164
  196. package/apps/lib/components/TextEditor/TextEditorToolbar.tsx +0 -429
  197. package/apps/lib/components/TextEditor/editor-tools/AlignmentTune.ts +0 -70
  198. package/apps/lib/components/TextEditor/editor-tools/ColorInlineTool.ts +0 -50
  199. package/apps/lib/components/TextEditor/editor-tools/StrikethroughInlineTool.ts +0 -48
  200. package/apps/lib/components/TextEditor/editor-tools/inlineFormat.ts +0 -98
  201. package/apps/lib/components/TextEditor/editorjs.d.ts +0 -60
  202. package/apps/lib/components/TextEditor/index.ts +0 -7
  203. package/apps/lib/components/TextEditor/markdownParser.ts +0 -346
  204. package/apps/lib/components/Textarea.tsx +0 -117
  205. package/apps/lib/components/Timeline.tsx +0 -263
  206. package/apps/lib/components/Toast.tsx +0 -87
  207. package/apps/lib/components/Toggle.tsx +0 -125
  208. package/apps/lib/components/ToggleButton.tsx +0 -140
  209. package/apps/lib/components/Tooltip.tsx +0 -116
  210. package/apps/lib/components/TransparentLabel.tsx +0 -71
  211. package/apps/lib/components/TreeDropDown.tsx +0 -115
  212. package/apps/lib/components/TreeFolder/TreeFolder.tsx +0 -380
  213. package/apps/lib/components/TreeFolder/TreeFolderBreadcrumb.tsx +0 -75
  214. package/apps/lib/components/TreeFolder/TreeFolderRow.tsx +0 -354
  215. package/apps/lib/components/TreeFolder/TreeFolderStyles.tsx +0 -60
  216. package/apps/lib/components/TreeFolder/icons.tsx +0 -60
  217. package/apps/lib/components/TreeFolder/index.ts +0 -24
  218. package/apps/lib/components/TreeFolder/treeFolderUtils.ts +0 -109
  219. package/apps/lib/components/TreeFolder/types.ts +0 -77
  220. package/apps/lib/components/TreeFolder/useTreeFolderDnD.ts +0 -118
  221. package/apps/lib/hooks/useActiveTreeItem.ts +0 -61
  222. package/apps/lib/hooks/useClickOutside.ts +0 -27
  223. package/apps/lib/hooks/useDragDrop.tsx +0 -365
  224. package/apps/lib/hooks/useHtmlDir.ts +0 -31
  225. package/apps/lib/hooks/useInfiniteScroll.ts +0 -108
  226. package/apps/lib/hooks/useIsMobile.ts +0 -21
  227. package/apps/lib/hooks/useResize.ts +0 -67
  228. package/apps/lib/hooks/useTagSelection.ts +0 -300
  229. package/apps/lib/layouts/CNLayout.tsx +0 -372
  230. package/apps/lib/layouts/DataViewCard.tsx +0 -62
  231. package/apps/lib/layouts/FieldSection.tsx +0 -91
  232. package/apps/lib/layouts/TreeSubLayout.tsx +0 -173
  233. package/apps/lib/providers/ThemeProvider.tsx +0 -84
  234. package/apps/lib/registry.json +0 -1217
  235. package/apps/lib/tsconfig.json +0 -9
  236. package/apps/lib/tsconfig.tsbuildinfo +0 -1
  237. package/apps/lib/utils/cn.ts +0 -6
  238. package/apps/lib/utils/color.ts +0 -175
  239. package/apps/lib/utils/dataViews/path.ts +0 -67
  240. package/apps/lib/utils/dataViews/query.ts +0 -73
  241. package/apps/lib/utils/dataViews/types.ts +0 -187
  242. package/apps/lib/utils/dateFormat.ts +0 -108
  243. package/apps/lib/utils/resize.ts +0 -31
  244. package/apps/lib/utils/scroller.ts +0 -26
  245. package/apps/lib/utils/types.ts +0 -16
  246. package/docs/BLOCKS.md +0 -129
  247. package/docs/CHANGELOG-1.1.16.md +0 -108
  248. package/docs/Cover.png +0 -0
  249. package/docs/README.md +0 -215
  250. package/docs/components/action-button.md +0 -638
  251. package/docs/components/actions-group.md +0 -708
  252. package/docs/components/alert-dialog.md +0 -920
  253. package/docs/components/avatar.md +0 -709
  254. package/docs/components/badge-field.md +0 -738
  255. package/docs/components/badge.md +0 -301
  256. package/docs/components/breadcrumb.md +0 -930
  257. package/docs/components/button-group.md +0 -650
  258. package/docs/components/button.md +0 -639
  259. package/docs/components/calendar.md +0 -555
  260. package/docs/components/card.md +0 -622
  261. package/docs/components/chart-block-tool.md +0 -129
  262. package/docs/components/checkbox.md +0 -699
  263. package/docs/components/cn-layout.md +0 -854
  264. package/docs/components/color-picker.md +0 -101
  265. package/docs/components/conclusion-header.md +0 -80
  266. package/docs/components/context-menu.md +0 -483
  267. package/docs/components/count-badge.md +0 -560
  268. package/docs/components/data-table.md +0 -854
  269. package/docs/components/data-views/backend-response.md +0 -324
  270. package/docs/components/data-views/examples/a11y-rtl.md +0 -250
  271. package/docs/components/data-views/examples/api-orders-route.md +0 -130
  272. package/docs/components/data-views/examples/fields.md +0 -362
  273. package/docs/components/data-views/examples/filters.md +0 -307
  274. package/docs/components/data-views/examples/inbox-routing.md +0 -218
  275. package/docs/components/data-views/examples/index.md +0 -29
  276. package/docs/components/data-views/examples/overview.md +0 -244
  277. package/docs/components/data-views/examples/panel.md +0 -212
  278. package/docs/components/data-views/examples/scale.md +0 -231
  279. package/docs/components/data-views/examples/server-side.md +0 -210
  280. package/docs/components/data-views/examples/state.md +0 -250
  281. package/docs/components/data-views/examples/tree-custom.md +0 -388
  282. package/docs/components/data-views/examples/view-registry.md +0 -313
  283. package/docs/components/data-views/examples/views.md +0 -534
  284. package/docs/components/data-views/guide.md +0 -405
  285. package/docs/components/data-views/index.md +0 -1521
  286. package/docs/components/data-views/migration.md +0 -81
  287. package/docs/components/date-picker.md +0 -857
  288. package/docs/components/dialog.md +0 -929
  289. package/docs/components/divider.md +0 -766
  290. package/docs/components/drawer.md +0 -654
  291. package/docs/components/dropdown-menu.md +0 -668
  292. package/docs/components/field-hint.md +0 -898
  293. package/docs/components/field-section.md +0 -781
  294. package/docs/components/form-builder.md +0 -284
  295. package/docs/components/form-renderer.md +0 -396
  296. package/docs/components/form-summary.md +0 -138
  297. package/docs/components/form.md +0 -785
  298. package/docs/components/header-bar.md +0 -188
  299. package/docs/components/image-attachment.md +0 -906
  300. package/docs/components/inner-label-field.md +0 -819
  301. package/docs/components/input-field.md +0 -623
  302. package/docs/components/input-otp.md +0 -756
  303. package/docs/components/input.md +0 -634
  304. package/docs/components/label-field.md +0 -770
  305. package/docs/components/label.md +0 -761
  306. package/docs/components/labeled-check-box.md +0 -642
  307. package/docs/components/labeled-radio.md +0 -796
  308. package/docs/components/link-button.md +0 -685
  309. package/docs/components/login-button.md +0 -872
  310. package/docs/components/password-level.md +0 -803
  311. package/docs/components/popover.md +0 -649
  312. package/docs/components/profile-menu.md +0 -656
  313. package/docs/components/radio-card.md +0 -801
  314. package/docs/components/radio.md +0 -735
  315. package/docs/components/scroll-area.md +0 -691
  316. package/docs/components/search-field.md +0 -702
  317. package/docs/components/searchable-select.md +0 -368
  318. package/docs/components/searchable-table.md +0 -438
  319. package/docs/components/searchable-tree-dialog.md +0 -190
  320. package/docs/components/searchable-tree.md +0 -200
  321. package/docs/components/section-block.md +0 -483
  322. package/docs/components/select.md +0 -709
  323. package/docs/components/simple-select.md +0 -741
  324. package/docs/components/skeleton.md +0 -706
  325. package/docs/components/slide-date-picker.md +0 -837
  326. package/docs/components/spin-loading.md +0 -696
  327. package/docs/components/stepper.md +0 -316
  328. package/docs/components/switch.md +0 -770
  329. package/docs/components/tab-form-item.md +0 -773
  330. package/docs/components/tab-switch.md +0 -170
  331. package/docs/components/table-dnd-wrapper.md +0 -107
  332. package/docs/components/table.md +0 -1088
  333. package/docs/components/text-editor.md +0 -735
  334. package/docs/components/textarea.md +0 -681
  335. package/docs/components/timeline.md +0 -254
  336. package/docs/components/toast.md +0 -773
  337. package/docs/components/toggle-button.md +0 -643
  338. package/docs/components/toggle.md +0 -882
  339. package/docs/components/tooltip.md +0 -513
  340. package/docs/components/transparent-label.md +0 -721
  341. package/docs/components/tree-drop-down.md +0 -740
  342. package/docs/components/tree-folder.md +0 -110
  343. package/docs/components/tree-sub-layout.md +0 -707
  344. package/docs/explanation/architecture.md +0 -54
  345. package/docs/explanation/design-system.md +0 -52
  346. package/docs/how-to/form-and-list-recipes.md +0 -386
  347. package/docs/how-to/forms-with-form-builder.md +0 -472
  348. package/docs/how-to/guides.md +0 -1027
  349. package/docs/migration/changelog.md +0 -60
  350. package/docs/migration/form-builder-2.5.2.md +0 -113
  351. package/docs/reference/cli.md +0 -112
  352. package/docs/reference/components.md +0 -572
  353. package/docs/reference/hooks.md +0 -1523
  354. package/docs/reference/providers.md +0 -866
  355. package/docs/reference/tailwind-plugins.md +0 -942
  356. package/docs/reference/theme.md +0 -85
  357. package/docs/reference/types.md +0 -1016
  358. package/docs/reference/utilities.md +0 -726
  359. package/docs/tutorials/building-first-form.md +0 -846
  360. package/docs/tutorials/component-composition.md +0 -882
  361. package/docs/tutorials/getting-started.md +0 -302
  362. package/docs/tutorials/theming-basics.md +0 -785
@@ -1,282 +0,0 @@
1
- "use client";
2
-
3
- import { Children, Fragment, createContext, useContext, useId, useState, ReactNode } from "react";
4
- import { useWatch, type Control, type FieldValues, type UseFormReturn } from "react-hook-form";
5
-
6
- import { cn } from "../utils/cn";
7
- import { Group, Input, Trilling } from "./Input";
8
- import { ConclusionHeader } from "./ConclusionHeader";
9
-
10
- /**
11
- * The form the rows read from. `undefined` means "fall back to the surrounding
12
- * FormProvider" — which is what react-hook-form's `useWatch` does with no `control`.
13
- */
14
- const ControlContext = createContext<Control | undefined>(undefined);
15
-
16
- /** Format a computed amount with thousands separators and fixed decimals (2 → "1,299.00"). */
17
- export function formatAmount(value: unknown, decimals = 2): string {
18
- if (value == null || value === "") return "";
19
- const n = typeof value === "number" ? value : Number(String(value).replace(/,/g, ""));
20
- if (Number.isNaN(n)) return "";
21
- return new Intl.NumberFormat("en-US", {
22
- minimumFractionDigits: decimals,
23
- maximumFractionDigits: decimals,
24
- }).format(n);
25
- }
26
-
27
- /** Currency-code color. Maps to Glare's semantic state tokens. */
28
- export type SummaryTone = "neutral" | "success" | "info";
29
-
30
- const toneStyles: Record<SummaryTone, string> = {
31
- neutral: "text-content-presentation-action-light-secondary",
32
- success: "text-content-presentation-state-success",
33
- info: "text-content-presentation-state-information",
34
- };
35
-
36
- export interface FormSummaryProps<T extends FieldValues = FieldValues> {
37
- /** Panel title, e.g. "Invoice" (bold). */
38
- title: ReactNode;
39
- /** Muted text beside the title, e.g. "Summary". */
40
- subtitle?: ReactNode;
41
- /**
42
- * The form to read values from. Required when the panel renders **outside** the
43
- * `<FormBuilder>` (the usual case — the two sit side by side, so hoist `useForm`
44
- * and hand the same instance to both). Omit it only when the panel is a child of
45
- * the form, in which case it reads the surrounding context.
46
- */
47
- form?: UseFormReturn<T>;
48
- /** Panel width (default `228px`, matching the design). */
49
- width?: number | string;
50
- className?: string;
51
- children: ReactNode;
52
- }
53
-
54
- /**
55
- * `FormSummary` — a read-only calculation panel displayed **beside a form**.
56
- *
57
- * Each `FormSummary.Row` declares a `compute(values)` that runs against the **live** form
58
- * values (via react-hook-form `useWatch`), so every total recalculates as the user types.
59
- *
60
- * It renders *outside* the form, so hoist the form and share it:
61
- *
62
- * ```tsx
63
- * const form = useForm({ resolver, defaultValues })
64
- *
65
- * <div className="flex items-start gap-4">
66
- * <FormBuilder form={form} onSubmit={save} className="flex-1">…fields…</FormBuilder>
67
- * <FormSummary form={form} title="Invoice" subtitle="Summary">…rows…</FormSummary>
68
- * </div>
69
- * ```
70
- */
71
- function FormSummaryRoot<T extends FieldValues = FieldValues>({
72
- title,
73
- subtitle,
74
- form,
75
- width = 228,
76
- className,
77
- children,
78
- }: FormSummaryProps<T>) {
79
- // The design stacks the header and every group in ONE 12px-gap column, with the dividers
80
- // as their own items — so they're interleaved here rather than drawn with `divide-y`,
81
- // which can only sit flush against a child's edge and couldn't be centred in its block.
82
- const groups = Children.toArray(children).filter(Boolean);
83
-
84
- return (
85
- <ControlContext.Provider value={form?.control as Control | undefined}>
86
- <aside
87
- data-theme="dark"
88
- style={{ width: typeof width === "number" ? `${width}px` : width }}
89
- className={cn(
90
- "flex h-full flex-col gap-3 overflow-hidden rounded-[16px] bg-black text-white",
91
- className,
92
- )}
93
- >
94
- {/* 48px tall: 12 + 24 + 12, aligned with the groups at px-2. Pinned — only the
95
- groups below it scroll. */}
96
- <header className="flex shrink-0 items-baseline gap-1 px-2 py-3">
97
- <span className="typography-body-large-medium text-white">{title}</span>
98
- {subtitle && (
99
- <span className="typography-body-medium-regular text-[#A0A0A0]">{subtitle}</span>
100
- )}
101
- </header>
102
-
103
- {/* Takes the remaining height and scrolls when the groups outrun it, as in the
104
- design (its group column is taller than the panel). `min-h-0` is required —
105
- without it this flex child refuses to shrink below its content and the panel
106
- grows instead of scrolling. */}
107
- <div className="flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto pb-3 scrollbar-hide">
108
- {groups.map((group, i) => (
109
- <Fragment key={i}>
110
- {/* Full-bleed divider: a 16px block with the line at its centre, so the 12px
111
- column gap either side lands the line 20px clear of both groups. */}
112
- {i > 0 && (
113
- <div className="flex h-4 items-center" aria-hidden>
114
- <div className="h-px w-full bg-[#2C2D2E]" />
115
- </div>
116
- )}
117
- {group}
118
- </Fragment>
119
- ))}
120
- </div>
121
- </aside>
122
- </ControlContext.Provider>
123
- );
124
- }
125
-
126
- export interface FormSummaryGroupProps {
127
- title?: ReactNode;
128
- /** Make the group collapsible via a `ConclusionHeader` title (default `true` when titled). */
129
- collapsible?: boolean;
130
- /** Initial open state when collapsible (default `true`). */
131
- defaultOpen?: boolean;
132
- className?: string;
133
- children: ReactNode;
134
- }
135
-
136
- /**
137
- * A titled group of summary rows. When it has a `title` it is **collapsible**: the title
138
- * is a `ConclusionHeader` whose chevron opens/closes just this group's rows.
139
- */
140
- function FormSummaryGroup({
141
- title,
142
- collapsible = true,
143
- defaultOpen = true,
144
- className,
145
- children,
146
- }: FormSummaryGroupProps) {
147
- const [open, setOpen] = useState(defaultOpen);
148
- const bodyId = useId();
149
- const isCollapsible = collapsible && title != null;
150
- const shown = !isCollapsible || open;
151
-
152
- return (
153
- // No `gap` here: the body collapses to zero height, and a flex gap would survive it as
154
- // dead space. The 12px below the title is `pt-3` on the body — inside what collapses.
155
- // No vertical padding either: the panel's 12px column gap is the only spacing between
156
- // groups, and the dividers carry their own.
157
- <section className={cn("flex flex-col px-2", className)}>
158
- {title != null &&
159
- (isCollapsible ? (
160
- <ConclusionHeader
161
- label={title}
162
- open={open}
163
- onOpenChange={setOpen}
164
- aria-controls={bodyId}
165
- />
166
- ) : (
167
- <h3 className="typography-body-large-medium text-white">{title}</h3>
168
- ))}
169
-
170
- {/* Fold/unfold: `grid-rows-[0fr → 1fr]` animates to the rows' natural height without
171
- measuring it, so the group stays a pure-CSS transition. The inner `overflow-hidden`
172
- is what the 0fr track actually clips — it must stay a bare wrapper. */}
173
- <div
174
- id={bodyId}
175
- // Collapsed rows keep their inputs in the DOM, so `inert` is what takes them out of
176
- // the tab order and the a11y tree — `overflow-hidden` alone would still let focus in.
177
- inert={!shown}
178
- aria-hidden={!shown}
179
- className={cn(
180
- "grid transition-[grid-template-rows,opacity] duration-200 ease-in-out",
181
- "motion-reduce:transition-none",
182
- shown ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0",
183
- )}
184
- >
185
- <div className="overflow-hidden">
186
- {/* Rows sit flush with the header (both at the section's px-2), 12px apart. */}
187
- <div className={cn("flex flex-col gap-3", title != null && "pt-3")}>{children}</div>
188
- </div>
189
- </div>
190
- </section>
191
- );
192
- }
193
-
194
- export interface FormSummaryRowProps<T extends FieldValues = FieldValues> {
195
- label: ReactNode;
196
- /**
197
- * The calculation. Receives the **live** form values and returns the row's value.
198
- * Omit it and pass `value` for a static row.
199
- */
200
- compute?: (values: T) => number | string | undefined | null;
201
- /** Static value (used when there's no `compute`). */
202
- value?: number | string | null;
203
- /** Currency code shown beside the label, e.g. "IQD" / "USD". */
204
- currency?: ReactNode;
205
- /** Color of the currency code. */
206
- tone?: SummaryTone;
207
- /** The primary result — renders with a lighter, emphasized border. */
208
- emphasized?: boolean;
209
- /** Decimal places (default 2 → `0.00`). */
210
- decimals?: number;
211
- /** Trailing slot inside the field, e.g. an `ActionButton`. */
212
- action?: ReactNode;
213
- /** Override the default number formatting. */
214
- format?: (value: number | string | undefined | null) => string;
215
- className?: string;
216
- }
217
-
218
- /**
219
- * One summary row: a label above a read-only, right-aligned value field.
220
- *
221
- * Uses the raw `Input` primitives (`Group`/`Input`/`Trilling`) rather than `InputField`,
222
- * which always wraps in a Popover/Tooltip and whose `className` targets the wrapper —
223
- * so it can't right-align the value text.
224
- */
225
- function FormSummaryRow<T extends FieldValues = FieldValues>({
226
- label,
227
- compute,
228
- value,
229
- currency,
230
- tone = "neutral",
231
- emphasized,
232
- decimals = 2,
233
- action,
234
- format,
235
- className,
236
- }: FormSummaryRowProps<T>) {
237
- // Subscribes to the form's values — recomputes as the user types. `control` comes
238
- // from the panel's `form` prop; with none, useWatch falls back to a surrounding
239
- // FormProvider (so the panel still works as a child of the form).
240
- const control = useContext(ControlContext);
241
- const values = useWatch({ control }) as T;
242
- const raw = compute ? compute(values) : value;
243
- const text = format ? format(raw) : formatAmount(raw, decimals);
244
-
245
- return (
246
- // 18px label + 4px + 30px field = the design's 52px row.
247
- <div className={cn("flex flex-col gap-1", className)}>
248
- <span className="typography-body-small-regular text-[#E5E5E5]">{label}</span>
249
-
250
- <Group
251
- size="S"
252
- variant="PresentationStyle"
253
- className={cn("w-full", emphasized && "!border-black-400")}
254
- >
255
- {/* readOnly, not disabled — `disabled` triggers the greyed-out field styles.
256
- `mask-image:none` cancels Input's fade-out-to-the-right gradient, which
257
- would otherwise fade the tail of a right-aligned value. */}
258
- <Input readOnly value={text} tabIndex={-1} className="cursor-default [mask-image:none]" />
259
-
260
- {/* The currency code rides in the field's trailing slot, not the label — it shares
261
- the slot with `action`, which is why both live in one `Trilling`. */}
262
- {(currency || action) && (
263
- <Trilling>
264
- {currency && (
265
- <span className={cn("pe-1 typography-body-small-medium", toneStyles[tone])}>
266
- {currency}
267
- </span>
268
- )}
269
- {action}
270
- </Trilling>
271
- )}
272
- </Group>
273
- </div>
274
- );
275
- }
276
-
277
- export const FormSummary = Object.assign(FormSummaryRoot, {
278
- Group: FormSummaryGroup,
279
- Row: FormSummaryRow,
280
- });
281
-
282
- FormSummaryRoot.displayName = "FormSummary";
@@ -1,117 +0,0 @@
1
- import React, { forwardRef } from "react";
2
- import { cva, type VariantProps } from "class-variance-authority";
3
- import { cn } from "../utils/cn";
4
- import { Themes } from "../utils/types";
5
-
6
- /**
7
- * HeaderBar
8
- *
9
- * A variant-driven header chip showing two text pieces inside a single
10
- * rounded container:
11
- * - `label` -> the colored emphasis pill (BADGE piece)
12
- * - `title` -> the plain text (PLAIN piece)
13
- *
14
- * The `variant` controls BOTH the colors AND the DOM order:
15
- * - "new" / "edit" -> [badge(label)] [plain(title)] (badge on the LEFT)
16
- * - "detail" -> [plain(title)] [badge(label)] (badge on the RIGHT)
17
- *
18
- * Example usage:
19
- * - new: <HeaderBar variant="new" label="New" title="sales iNVOICE" />
20
- * - edit: <HeaderBar variant="edit" label="edit" title="sales iNVOICE" />
21
- * - detail: <HeaderBar variant="detail" label="de-344" title="sales iNVOICE" />
22
- * (renders plain "sales iNVOICE" on the LEFT, colored "de-344" on the RIGHT)
23
- */
24
-
25
- // 28px / weight 510 — the design's `Font/Size/Display/Medium`, which is exactly what this class
26
- // carries. Shared by the badge and the plain title so the two pieces cannot drift apart.
27
- const headerTextStyles = "typography-display-medium-medium uppercase [font-feature-settings:'cv05'_on]";
28
-
29
- // Colored pill holding `label`. 32px tall, 4px side padding, 8px radius — Figma `Header.Badge`.
30
- const badgeStyles = cva(["flex", "h-8", "items-center", "justify-center", "rounded-lg", "px-1"], {
31
- variants: {
32
- variant: {
33
- new: "bg-blue-sparkle-alpha-50",
34
- edit: "bg-orange-alpha-50",
35
- // `White Alpha/15`, not /30 — the detail chip is the faintest of the three.
36
- detail: "bg-white-alpha-15",
37
- },
38
- },
39
- defaultVariants: {
40
- variant: "new",
41
- },
42
- });
43
-
44
- // Text inside the colored pill.
45
- const badgeTextStyles = cva([headerTextStyles], {
46
- variants: {
47
- variant: {
48
- new: "text-blue-sparkle-200",
49
- edit: "text-orange-200",
50
- detail: "text-white-00",
51
- },
52
- },
53
- defaultVariants: {
54
- variant: "new",
55
- },
56
- });
57
-
58
- interface HeaderBarProps
59
- extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeStyles> {
60
- theme?: Themes;
61
- /** The colored emphasis pill text. */
62
- label: string;
63
- /** The plain text. */
64
- title: string;
65
- }
66
-
67
- const HeaderBar = forwardRef<HTMLDivElement, HeaderBarProps>(
68
- ({ variant = "new", label, title, theme, className, ...props }, ref) => {
69
- const badge = (
70
- <div className={cn(badgeStyles({ variant }))}>
71
- <p className={cn(badgeTextStyles({ variant }))}>{label}</p>
72
- </div>
73
- );
74
-
75
- // The plain title sits in its own 32px box with 6px side padding — that padding, not a row
76
- // `gap`, is what separates it from the badge (matching the design's `padding` frame).
77
- const plain = (
78
- <div className="flex h-8 items-center justify-center px-1.5">
79
- <p className={cn(headerTextStyles, "text-white-00")}>{title}</p>
80
- </div>
81
- );
82
-
83
- return (
84
- <div
85
- ref={ref}
86
- data-theme={theme}
87
- className={cn(
88
- "inline-flex flex-col items-start overflow-hidden rounded-[14px] border border-black-600 bg-black-1000 p-1.5 shadow-[0_0_32px_2px_rgba(0,0,0,0.05),0_0_32px_2px_rgba(0,0,0,0.05)]",
89
- className,
90
- )}
91
- {...props}
92
- >
93
- {/* `detail` genuinely swaps the two children rather than using `flex-row-reverse`. The
94
- visual result is the same in LTR, but reversing the row would flip the pair the wrong
95
- way under `dir="rtl"` and would read out of order to a screen reader. */}
96
- <div className="flex items-center">
97
- {variant === "detail" ? (
98
- <>
99
- {plain}
100
- {badge}
101
- </>
102
- ) : (
103
- <>
104
- {badge}
105
- {plain}
106
- </>
107
- )}
108
- </div>
109
- </div>
110
- );
111
- },
112
- );
113
-
114
- HeaderBar.displayName = "HeaderBar";
115
-
116
- export default HeaderBar;
117
- export { HeaderBar };
@@ -1,209 +0,0 @@
1
- import { forwardRef, HTMLAttributes, InputHTMLAttributes, ReactNode } from "react";
2
- import { Button } from "./Button";
3
- import { cva } from "class-variance-authority";
4
- import { cn } from "../utils/cn";
5
- import { Themes } from "../utils/types";
6
- import {
7
- AlertDialog,
8
- AlertDialogTrigger,
9
- AlertDialogContent,
10
- AlertDialogCancel,
11
- } from "./AlertDialog";
12
-
13
- const dropZoneStyles = cva(
14
- [
15
- // Dashed drop zone that fills the field box (design: Attachment-Field-1.0 "Upload-Button").
16
- // Transparent fill so the surrounding #f9f9f9 box shows through the dashed border.
17
- "flex-1 h-[65px] flex flex-col rounded-[8px] border-dashed !border-2 transition-all duration-300 ease-in-out",
18
- "!border-border-presentation-action-borderstyle bg-transparent",
19
- "hover:bg-background-presentation-badge-gray-subtle",
20
- ],
21
- {
22
- variants: {
23
- active: {
24
- true: "!bg-background-presentation-badge-gray-subtle !border-border-presentation-badge-gray",
25
- },
26
- },
27
- },
28
- );
29
-
30
- interface Props extends InputHTMLAttributes<HTMLInputElement | HTMLDivElement> {
31
- isDropAreaActive?: boolean;
32
- mainLabel: string;
33
- secondaryLabel: string;
34
- theme?: Themes;
35
- expandLabel?: ReactNode;
36
- children?: ReactNode;
37
- getRootProps?: () => Record<string, unknown>;
38
- }
39
-
40
- const ImageAttachment = forwardRef<HTMLInputElement, Props>(
41
- (
42
- {
43
- isDropAreaActive,
44
- mainLabel,
45
- theme,
46
- secondaryLabel,
47
- className,
48
- getRootProps,
49
- children,
50
- // eslint-disable-next-line @typescript-eslint/no-unused-vars -- excluded from {...props} so it isn't leaked onto the <input>
51
- expandLabel,
52
- ...props
53
- }: Props,
54
- ref,
55
- ) => {
56
- return (
57
- // The #f9f9f9 field box (design: Attachment-Field-1.0). Holds an optional preview
58
- // (children) on the leading side and the dashed drop zone filling the rest.
59
- <section
60
- className={cn(
61
- "flex w-full items-center gap-[10px] rounded-[8px] bg-background-presentation-form-field-primary",
62
- className,
63
- )}
64
- >
65
- {children}
66
- <Button
67
- {...getRootProps?.()}
68
- theme={theme}
69
- as="label"
70
- id={props.id}
71
- variant="PrimeContStyle"
72
- className={cn(dropZoneStyles({ active: isDropAreaActive }))}
73
- containerClassName="flex-col"
74
- >
75
- <h1 className="text-content-presentation-action-light-primary typography-body-large-medium">
76
- {mainLabel}
77
- </h1>
78
- <p className="text-content-presentation-action-light-secondary typography-body-small-medium">
79
- {secondaryLabel}
80
- </p>
81
- <input ref={ref} {...props} type="file" hidden />
82
- </Button>
83
- </section>
84
- );
85
- },
86
- );
87
-
88
- ImageAttachment.displayName = "ImageAttachment";
89
-
90
- export { ImageAttachment, ExpandableImage, AttachmentImagePreview };
91
-
92
- interface ExpandableImageProps extends HTMLAttributes<HTMLDivElement> {
93
- previewSrc: string;
94
- expandLabel: ReactNode;
95
- placeholderLabel?: string;
96
- theme?: Themes;
97
- }
98
-
99
- const ExpandableImage = ({
100
- theme,
101
- previewSrc,
102
- expandLabel,
103
- placeholderLabel = "Upload Image",
104
- className,
105
- ...props
106
- }: ExpandableImageProps) => {
107
- return (
108
- // Pic-Container-1.0: a 65×65 square thumbnail (or the placeholder), with an Expand
109
- // overlay revealed on hover.
110
- <section
111
- style={props.style}
112
- data-theme={theme}
113
- className={cn(
114
- "group relative flex size-[65px] shrink-0 items-center justify-center overflow-hidden rounded-[8px] border-none",
115
- className,
116
- )}
117
- >
118
- {previewSrc ? <SelectedImg src={previewSrc} /> : <PlaceHolder label={placeholderLabel} />}
119
-
120
- {previewSrc && (
121
- <AlertDialog>
122
- <AlertDialogTrigger asChild>
123
- <button className="absolute z-10 flex h-full w-full flex-col items-center justify-center gap-[2px] bg-black/50 opacity-0 transition-all duration-200 ease-in-out hover:opacity-100">
124
- <i className="ri-fullscreen-line text-content-presentation-global-hover text-[24px] leading-none" />
125
- <p className="text-content-presentation-global-hover typography-labels-small-regular m-0 max-w-[50px] break-words text-center">
126
- {expandLabel}
127
- </p>
128
- </button>
129
- </AlertDialogTrigger>
130
- <AlertDialogContent className="w-fit bg-transparent border-none">
131
- {props.children}
132
- </AlertDialogContent>
133
- </AlertDialog>
134
- )}
135
- </section>
136
- );
137
- };
138
-
139
- function PlaceHolder({ label }: { label: string }) {
140
- return (
141
- // Pic-Container-1.0 default: ocean fill + dashed blue-purple border; on hover it goes gray.
142
- // (Was styled with a `badge-blue-purple` token that does not exist — a no-op until now.)
143
- <section
144
- className={cn([
145
- "size-[65px] gap-[2px] flex flex-col justify-center items-center px-1",
146
- " rounded-[8px] border-2 border-dashed",
147
- " border-blue-purple-300 bg-background-presentation-badge-ocean-subtle",
148
- " transition-all duration-300 ease-in-out",
149
- " group-hover:bg-background-presentation-badge-gray-subtle group-hover:border-border-presentation-badge-gray",
150
- ])}
151
- >
152
- <i className="ri-attachment-line text-blue-purple-800 group-hover:text-content-presentation-badge-gray text-[24px] h-[24px]"></i>
153
- <p className="text-blue-purple-800 typography-labels-small-regular group-hover:text-content-presentation-badge-gray px-1 py-[2px] text-center">
154
- {label}
155
- </p>
156
- </section>
157
- );
158
- }
159
-
160
- function SelectedImg({ src }: { src: string }) {
161
- return (
162
- <section className="size-full shrink-0 overflow-hidden rounded-[8px] border border-border-presentation-global-primary bg-white">
163
- <img alt="" src={src} className="h-full w-full object-cover object-center" />
164
- </section>
165
- );
166
- }
167
-
168
- interface AttachmentImagePreviewProps extends HTMLAttributes<HTMLDivElement> {
169
- src: string;
170
- header?: ReactNode;
171
- theme?: Themes;
172
- }
173
-
174
- function AttachmentImagePreview({
175
- theme,
176
- src,
177
- header,
178
- className,
179
- ...props
180
- }: AttachmentImagePreviewProps) {
181
- return (
182
- <section
183
- {...props}
184
- data-theme={theme}
185
- className={cn(
186
- " overflow-hidden flex flex-col items-center justify-center w-80 p-2 gap-2 rounded-md border shadow-md border-border-presentation-global-primary bg-background-presentation-form-base",
187
- className,
188
- )}
189
- >
190
- <section className="flex items-center justify-between w-full m-0">
191
- <p className="m-0 text-content-presentation-global-primary typography-display-medium-semibold">
192
- {header}
193
- </p>
194
- <AlertDialogCancel asChild>
195
- <Button theme={theme} size="M" buttonType="icon">
196
- <i className="ri-close-line text-[16px]"></i>
197
- </Button>
198
- </AlertDialogCancel>
199
- </section>
200
-
201
- <img
202
- className="w-full object-cover object-center rounded-md border shadow-md border-border-presentation-global-primary"
203
- src={src}
204
- />
205
-
206
- <section className="flex items-center justify-end w-full gap-2">{props.children}</section>
207
- </section>
208
- );
209
- }