@dashforge/tw 1.1.0 → 1.1.1

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 (390) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/dist/index.esm.js +1 -1
  3. package/dist/src/index.d.ts +1 -1
  4. package/package.json +8 -3
  5. package/.swcrc +0 -29
  6. package/A11Y.md +0 -130
  7. package/CONSUMER-VALIDATION.md +0 -130
  8. package/COVERAGE.md +0 -63
  9. package/PARITY.md +0 -481
  10. package/PERFORMANCE.md +0 -227
  11. package/REFINEMENT-NOTES.md +0 -50
  12. package/THEME-AUDIT.md +0 -174
  13. package/dashforge-tw-1.0.0.tgz +0 -0
  14. package/eslint.config.mjs +0 -62
  15. package/project.json +0 -15
  16. package/rollup.config.cjs +0 -16
  17. package/src/components/Accordion/Accordion.test.tsx +0 -95
  18. package/src/components/Accordion/Accordion.tsx +0 -97
  19. package/src/components/Accordion/accordion.types.ts +0 -66
  20. package/src/components/Accordion/accordion.variants.ts +0 -32
  21. package/src/components/Alert/Alert.test.tsx +0 -302
  22. package/src/components/Alert/Alert.tsx +0 -186
  23. package/src/components/Alert/alert.types.ts +0 -144
  24. package/src/components/Alert/alert.variants.ts +0 -71
  25. package/src/components/AppShell/AppShell.test.tsx +0 -223
  26. package/src/components/AppShell/AppShell.tsx +0 -239
  27. package/src/components/AppShell/appShell.types.ts +0 -49
  28. package/src/components/AppShell/appShell.variants.ts +0 -54
  29. package/src/components/AspectRatio/AspectRatio.test.tsx +0 -173
  30. package/src/components/AspectRatio/AspectRatio.tsx +0 -73
  31. package/src/components/AspectRatio/aspectRatio.types.ts +0 -54
  32. package/src/components/Autocomplete/Autocomplete.perf.test.tsx +0 -225
  33. package/src/components/Autocomplete/Autocomplete.test.tsx +0 -556
  34. package/src/components/Autocomplete/Autocomplete.tsx +0 -1069
  35. package/src/components/Autocomplete/autocomplete.types.ts +0 -198
  36. package/src/components/Autocomplete/autocomplete.variants.ts +0 -141
  37. package/src/components/Avatar/Avatar.test.tsx +0 -287
  38. package/src/components/Avatar/Avatar.tsx +0 -304
  39. package/src/components/Avatar/avatar.types.ts +0 -205
  40. package/src/components/Avatar/avatar.variants.ts +0 -194
  41. package/src/components/Badge/Badge.test.tsx +0 -385
  42. package/src/components/Badge/Badge.tsx +0 -174
  43. package/src/components/Badge/badge.types.ts +0 -154
  44. package/src/components/Badge/badge.variants.ts +0 -161
  45. package/src/components/Box/Box.test.tsx +0 -391
  46. package/src/components/Box/Box.tsx +0 -112
  47. package/src/components/Box/box.types.ts +0 -116
  48. package/src/components/Box/box.variants.ts +0 -230
  49. package/src/components/Breadcrumbs/Breadcrumbs.perf.test.tsx +0 -128
  50. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +0 -231
  51. package/src/components/Breadcrumbs/Breadcrumbs.tsx +0 -203
  52. package/src/components/Breadcrumbs/breadcrumbs.types.ts +0 -87
  53. package/src/components/Breadcrumbs/breadcrumbs.variants.ts +0 -54
  54. package/src/components/Button/Button.test.tsx +0 -204
  55. package/src/components/Button/Button.tsx +0 -151
  56. package/src/components/Button/button.types.ts +0 -110
  57. package/src/components/Button/button.variants.ts +0 -159
  58. package/src/components/Calendar/Calendar.test.tsx +0 -75
  59. package/src/components/Calendar/Calendar.tsx +0 -264
  60. package/src/components/Calendar/calendar.types.ts +0 -65
  61. package/src/components/Calendar/calendar.variants.ts +0 -64
  62. package/src/components/Card/Card.test.tsx +0 -291
  63. package/src/components/Card/Card.tsx +0 -241
  64. package/src/components/Card/card.types.ts +0 -132
  65. package/src/components/Checkbox/Checkbox.test.tsx +0 -146
  66. package/src/components/Checkbox/Checkbox.tsx +0 -286
  67. package/src/components/Checkbox/checkbox.types.ts +0 -88
  68. package/src/components/Checkbox/checkbox.variants.ts +0 -68
  69. package/src/components/Chip/Chip.test.tsx +0 -316
  70. package/src/components/Chip/Chip.tsx +0 -224
  71. package/src/components/Chip/chip.types.ts +0 -128
  72. package/src/components/Chip/chip.variants.ts +0 -173
  73. package/src/components/ConfirmDialog/ConfirmDialog.perf.test.tsx +0 -172
  74. package/src/components/ConfirmDialog/ConfirmDialog.test.tsx +0 -311
  75. package/src/components/ConfirmDialog/ConfirmDialog.tsx +0 -252
  76. package/src/components/ConfirmDialog/confirmDialog.types.ts +0 -70
  77. package/src/components/ConfirmDialog/confirmDialog.variants.ts +0 -76
  78. package/src/components/Container/Container.test.tsx +0 -209
  79. package/src/components/Container/Container.tsx +0 -74
  80. package/src/components/Container/container.types.ts +0 -45
  81. package/src/components/Container/container.variants.ts +0 -81
  82. package/src/components/DataGrid/DataGrid.perf.test.tsx +0 -114
  83. package/src/components/DataGrid/DataGrid.test.tsx +0 -1153
  84. package/src/components/DataGrid/DataGrid.tsx +0 -1282
  85. package/src/components/DataGrid/dataGrid.types.ts +0 -238
  86. package/src/components/DataGrid/dataGrid.variants.ts +0 -152
  87. package/src/components/DataGrid/filters/ColumnFilters.test.tsx +0 -330
  88. package/src/components/DataGrid/filters/ColumnFilters.tsx +0 -456
  89. package/src/components/DataGrid/reorder/useColumnReorder.test.ts +0 -130
  90. package/src/components/DataGrid/reorder/useColumnReorder.ts +0 -144
  91. package/src/components/DataGrid/resize/useColumnResize.test.ts +0 -144
  92. package/src/components/DataGrid/resize/useColumnResize.ts +0 -135
  93. package/src/components/DataGrid/visibility/ColumnVisibilityMenu.tsx +0 -186
  94. package/src/components/DatePicker/DatePicker.test.tsx +0 -76
  95. package/src/components/DatePicker/DatePicker.tsx +0 -305
  96. package/src/components/DatePicker/datePicker.types.ts +0 -77
  97. package/src/components/DatePicker/datePicker.variants.ts +0 -50
  98. package/src/components/DateRangePicker/DateRangePicker.test.tsx +0 -92
  99. package/src/components/DateRangePicker/DateRangePicker.tsx +0 -510
  100. package/src/components/DateRangePicker/dateRangePicker.types.ts +0 -74
  101. package/src/components/DateRangePicker/dateRangePicker.variants.ts +0 -101
  102. package/src/components/DateTimePicker/DateTimePicker.test.tsx +0 -78
  103. package/src/components/DateTimePicker/DateTimePicker.tsx +0 -347
  104. package/src/components/DateTimePicker/dateTimePicker.types.ts +0 -79
  105. package/src/components/DateTimePicker/dateTimePicker.variants.ts +0 -55
  106. package/src/components/Dialog/Dialog.test.tsx +0 -96
  107. package/src/components/Dialog/Dialog.tsx +0 -102
  108. package/src/components/Dialog/dialog.types.ts +0 -62
  109. package/src/components/Dialog/dialog.variants.ts +0 -66
  110. package/src/components/Divider/Divider.test.tsx +0 -243
  111. package/src/components/Divider/Divider.tsx +0 -140
  112. package/src/components/Divider/divider.types.ts +0 -52
  113. package/src/components/Divider/divider.variants.ts +0 -116
  114. package/src/components/Grid/Grid.test.tsx +0 -321
  115. package/src/components/Grid/Grid.tsx +0 -148
  116. package/src/components/Grid/grid.types.ts +0 -112
  117. package/src/components/Grid/grid.variants.ts +0 -133
  118. package/src/components/IconButton/IconButton.test.tsx +0 -367
  119. package/src/components/IconButton/IconButton.tsx +0 -159
  120. package/src/components/IconButton/iconButton.types.ts +0 -106
  121. package/src/components/IconButton/iconButton.variants.ts +0 -31
  122. package/src/components/LeftNav/LeftNav.perf.test.tsx +0 -172
  123. package/src/components/LeftNav/LeftNav.test.tsx +0 -302
  124. package/src/components/LeftNav/LeftNav.tsx +0 -330
  125. package/src/components/LeftNav/leftNav.types.ts +0 -120
  126. package/src/components/LeftNav/leftNav.variants.ts +0 -107
  127. package/src/components/Menu/Menu.test.tsx +0 -408
  128. package/src/components/Menu/Menu.tsx +0 -335
  129. package/src/components/Menu/menu.types.ts +0 -221
  130. package/src/components/Menu/menu.variants.ts +0 -132
  131. package/src/components/NumberField/NumberField.test.tsx +0 -83
  132. package/src/components/NumberField/NumberField.tsx +0 -321
  133. package/src/components/NumberField/numberField.types.ts +0 -72
  134. package/src/components/NumberField/numberField.variants.ts +0 -94
  135. package/src/components/OTPField/OTPField.test.tsx +0 -121
  136. package/src/components/OTPField/OTPField.tsx +0 -250
  137. package/src/components/OTPField/otpField.types.ts +0 -58
  138. package/src/components/OTPField/otpField.variants.ts +0 -72
  139. package/src/components/Pagination/Pagination.test.tsx +0 -314
  140. package/src/components/Pagination/Pagination.tsx +0 -277
  141. package/src/components/Pagination/pagination.helpers.ts +0 -102
  142. package/src/components/Pagination/pagination.types.ts +0 -117
  143. package/src/components/Pagination/pagination.variants.ts +0 -117
  144. package/src/components/Popover/Popover.test.tsx +0 -72
  145. package/src/components/Popover/Popover.tsx +0 -55
  146. package/src/components/Popover/popover.types.ts +0 -42
  147. package/src/components/Popover/popover.variants.ts +0 -24
  148. package/src/components/RadioGroup/RadioGroup.test.tsx +0 -140
  149. package/src/components/RadioGroup/RadioGroup.tsx +0 -283
  150. package/src/components/RadioGroup/radioGroup.types.ts +0 -85
  151. package/src/components/RadioGroup/radioGroup.variants.ts +0 -87
  152. package/src/components/Skeleton/Skeleton.test.tsx +0 -127
  153. package/src/components/Skeleton/Skeleton.tsx +0 -49
  154. package/src/components/Skeleton/skeleton.types.ts +0 -59
  155. package/src/components/Skeleton/skeleton.variants.ts +0 -87
  156. package/src/components/Snackbar/Snackbar.perf.test.tsx +0 -144
  157. package/src/components/Snackbar/Snackbar.test.tsx +0 -327
  158. package/src/components/Snackbar/Snackbar.tsx +0 -316
  159. package/src/components/Snackbar/snackbar.types.ts +0 -127
  160. package/src/components/Snackbar/snackbar.variants.ts +0 -81
  161. package/src/components/Spinner/Spinner.test.tsx +0 -199
  162. package/src/components/Spinner/Spinner.tsx +0 -158
  163. package/src/components/Spinner/spinner.types.ts +0 -113
  164. package/src/components/Spinner/spinner.variants.ts +0 -83
  165. package/src/components/Stack/Stack.test.tsx +0 -309
  166. package/src/components/Stack/Stack.tsx +0 -115
  167. package/src/components/Stack/stack.types.ts +0 -68
  168. package/src/components/Stack/stack.variants.ts +0 -80
  169. package/src/components/Switch/Switch.test.tsx +0 -131
  170. package/src/components/Switch/Switch.tsx +0 -158
  171. package/src/components/Switch/switch.types.ts +0 -36
  172. package/src/components/Switch/switch.variants.ts +0 -70
  173. package/src/components/Table/Table.perf.test.tsx +0 -81
  174. package/src/components/Table/Table.test.tsx +0 -674
  175. package/src/components/Table/Table.tsx +0 -863
  176. package/src/components/Table/cells/RenderButton.tsx +0 -23
  177. package/src/components/Table/cells/RenderChip.tsx +0 -37
  178. package/src/components/Table/cells/RenderText.tsx +0 -37
  179. package/src/components/Table/cells/RenderTwoLine.tsx +0 -34
  180. package/src/components/Table/cells/RowActionsMenu.tsx +0 -147
  181. package/src/components/Table/cells/cells.test.tsx +0 -247
  182. package/src/components/Table/cells/index.ts +0 -14
  183. package/src/components/Table/table.types.ts +0 -438
  184. package/src/components/Table/table.variants.ts +0 -207
  185. package/src/components/Tabs/Tabs.test.tsx +0 -145
  186. package/src/components/Tabs/Tabs.tsx +0 -77
  187. package/src/components/Tabs/tabs.types.ts +0 -55
  188. package/src/components/Tabs/tabs.variants.ts +0 -69
  189. package/src/components/Tabs/useTabs.ts +0 -167
  190. package/src/components/TextField/TextField.test.tsx +0 -198
  191. package/src/components/TextField/TextField.tsx +0 -245
  192. package/src/components/TextField/textField.types.ts +0 -90
  193. package/src/components/TextField/textField.variants.ts +0 -105
  194. package/src/components/Textarea/Textarea.test.tsx +0 -75
  195. package/src/components/Textarea/Textarea.tsx +0 -190
  196. package/src/components/Textarea/textarea.types.ts +0 -60
  197. package/src/components/Textarea/textarea.variants.ts +0 -85
  198. package/src/components/TimePicker/TimePicker.test.tsx +0 -65
  199. package/src/components/TimePicker/TimePicker.tsx +0 -274
  200. package/src/components/TimePicker/timePicker.types.ts +0 -69
  201. package/src/components/TimePicker/timePicker.variants.ts +0 -53
  202. package/src/components/Tooltip/Tooltip.test.tsx +0 -73
  203. package/src/components/Tooltip/Tooltip.tsx +0 -70
  204. package/src/components/Tooltip/tooltip.types.ts +0 -44
  205. package/src/components/Tooltip/tooltip.variants.ts +0 -28
  206. package/src/components/TopBar/TopBar.test.tsx +0 -129
  207. package/src/components/TopBar/TopBar.tsx +0 -66
  208. package/src/components/TopBar/topBar.types.ts +0 -42
  209. package/src/components/TopBar/topBar.variants.ts +0 -38
  210. package/src/components/Typography/Typography.test.tsx +0 -247
  211. package/src/components/Typography/Typography.tsx +0 -112
  212. package/src/components/Typography/typography.types.ts +0 -65
  213. package/src/components/Typography/typography.variants.ts +0 -130
  214. package/src/components/VisuallyHidden/VisuallyHidden.test.tsx +0 -86
  215. package/src/components/VisuallyHidden/VisuallyHidden.tsx +0 -59
  216. package/src/components/VisuallyHidden/visuallyHidden.types.ts +0 -45
  217. package/src/components/_shared/data/getNestedValue.test.ts +0 -50
  218. package/src/components/_shared/data/getNestedValue.ts +0 -32
  219. package/src/components/_shared/data/useColumnAutoDetect.test.ts +0 -123
  220. package/src/components/_shared/data/useColumnAutoDetect.ts +0 -100
  221. package/src/components/_shared/data/useControllableState.ts +0 -48
  222. package/src/components/_shared/data/useDebouncedValue.ts +0 -24
  223. package/src/components/_shared/data/useTableFilter.test.ts +0 -166
  224. package/src/components/_shared/data/useTableFilter.ts +0 -118
  225. package/src/components/_shared/data/useTableSearch.test.ts +0 -115
  226. package/src/components/_shared/data/useTableSearch.ts +0 -66
  227. package/src/components/_shared/data/useTableSelection.test.ts +0 -100
  228. package/src/components/_shared/data/useTableSelection.ts +0 -100
  229. package/src/components/_shared/data/useTableSort.test.ts +0 -150
  230. package/src/components/_shared/data/useTableSort.ts +0 -141
  231. package/src/components/_shared/data/useVirtualizer.test.ts +0 -158
  232. package/src/components/_shared/data/useVirtualizer.ts +0 -199
  233. package/src/components/_shared/resolveValidationState.ts +0 -60
  234. package/src/components/_shared/severity/index.ts +0 -33
  235. package/src/components/_shared/severity/severity.types.ts +0 -50
  236. package/src/components/_shared/severity/severityIcons.tsx +0 -104
  237. package/src/components/_shared/severity/severityVariants.test.ts +0 -136
  238. package/src/components/_shared/severity/severityVariants.ts +0 -115
  239. package/src/components/_shared/themeIdentity.test.ts +0 -113
  240. package/src/hooks/useAccessState.spec.tsx +0 -161
  241. package/src/hooks/useAccessState.ts +0 -81
  242. package/src/index.ts +0 -550
  243. package/src/utils/cn.spec.ts +0 -16
  244. package/src/utils/cn.ts +0 -29
  245. package/test-output/vitest/coverage/base.css +0 -224
  246. package/test-output/vitest/coverage/block-navigation.js +0 -87
  247. package/test-output/vitest/coverage/clover.xml +0 -2418
  248. package/test-output/vitest/coverage/coverage-final.json +0 -89
  249. package/test-output/vitest/coverage/favicon.png +0 -0
  250. package/test-output/vitest/coverage/index.html +0 -746
  251. package/test-output/vitest/coverage/prettify.css +0 -1
  252. package/test-output/vitest/coverage/prettify.js +0 -2
  253. package/test-output/vitest/coverage/sort-arrow-sprite.png +0 -0
  254. package/test-output/vitest/coverage/sorter.js +0 -210
  255. package/test-output/vitest/coverage/src/components/Accordion/Accordion.tsx.html +0 -376
  256. package/test-output/vitest/coverage/src/components/Accordion/accordion.variants.ts.html +0 -181
  257. package/test-output/vitest/coverage/src/components/Accordion/index.html +0 -131
  258. package/test-output/vitest/coverage/src/components/AppShell/AppShell.tsx.html +0 -802
  259. package/test-output/vitest/coverage/src/components/AppShell/appShell.variants.ts.html +0 -247
  260. package/test-output/vitest/coverage/src/components/AppShell/index.html +0 -131
  261. package/test-output/vitest/coverage/src/components/AspectRatio/AspectRatio.tsx.html +0 -304
  262. package/test-output/vitest/coverage/src/components/AspectRatio/index.html +0 -116
  263. package/test-output/vitest/coverage/src/components/Autocomplete/Autocomplete.tsx.html +0 -3292
  264. package/test-output/vitest/coverage/src/components/Autocomplete/autocomplete.variants.ts.html +0 -508
  265. package/test-output/vitest/coverage/src/components/Autocomplete/index.html +0 -131
  266. package/test-output/vitest/coverage/src/components/Box/Box.tsx.html +0 -334
  267. package/test-output/vitest/coverage/src/components/Box/box.variants.ts.html +0 -775
  268. package/test-output/vitest/coverage/src/components/Box/index.html +0 -131
  269. package/test-output/vitest/coverage/src/components/Breadcrumbs/Breadcrumbs.tsx.html +0 -694
  270. package/test-output/vitest/coverage/src/components/Breadcrumbs/breadcrumbs.variants.ts.html +0 -247
  271. package/test-output/vitest/coverage/src/components/Breadcrumbs/index.html +0 -131
  272. package/test-output/vitest/coverage/src/components/Button/Button.tsx.html +0 -535
  273. package/test-output/vitest/coverage/src/components/Button/button.variants.ts.html +0 -562
  274. package/test-output/vitest/coverage/src/components/Button/index.html +0 -131
  275. package/test-output/vitest/coverage/src/components/Checkbox/Checkbox.tsx.html +0 -943
  276. package/test-output/vitest/coverage/src/components/Checkbox/checkbox.variants.ts.html +0 -289
  277. package/test-output/vitest/coverage/src/components/Checkbox/index.html +0 -131
  278. package/test-output/vitest/coverage/src/components/ConfirmDialog/ConfirmDialog.tsx.html +0 -841
  279. package/test-output/vitest/coverage/src/components/ConfirmDialog/confirmDialog.variants.ts.html +0 -313
  280. package/test-output/vitest/coverage/src/components/ConfirmDialog/index.html +0 -131
  281. package/test-output/vitest/coverage/src/components/Container/Container.tsx.html +0 -307
  282. package/test-output/vitest/coverage/src/components/Container/container.variants.ts.html +0 -328
  283. package/test-output/vitest/coverage/src/components/Container/index.html +0 -131
  284. package/test-output/vitest/coverage/src/components/DataGrid/DataGrid.tsx.html +0 -3937
  285. package/test-output/vitest/coverage/src/components/DataGrid/dataGrid.variants.ts.html +0 -541
  286. package/test-output/vitest/coverage/src/components/DataGrid/filters/ColumnFilters.tsx.html +0 -1453
  287. package/test-output/vitest/coverage/src/components/DataGrid/filters/index.html +0 -116
  288. package/test-output/vitest/coverage/src/components/DataGrid/index.html +0 -131
  289. package/test-output/vitest/coverage/src/components/DataGrid/reorder/index.html +0 -116
  290. package/test-output/vitest/coverage/src/components/DataGrid/reorder/useColumnReorder.ts.html +0 -517
  291. package/test-output/vitest/coverage/src/components/DataGrid/resize/index.html +0 -116
  292. package/test-output/vitest/coverage/src/components/DataGrid/resize/useColumnResize.ts.html +0 -490
  293. package/test-output/vitest/coverage/src/components/DataGrid/visibility/ColumnVisibilityMenu.tsx.html +0 -592
  294. package/test-output/vitest/coverage/src/components/DataGrid/visibility/index.html +0 -116
  295. package/test-output/vitest/coverage/src/components/DateTimePicker/DateTimePicker.tsx.html +0 -1042
  296. package/test-output/vitest/coverage/src/components/DateTimePicker/dateTimePicker.variants.ts.html +0 -337
  297. package/test-output/vitest/coverage/src/components/DateTimePicker/index.html +0 -131
  298. package/test-output/vitest/coverage/src/components/Dialog/Dialog.tsx.html +0 -391
  299. package/test-output/vitest/coverage/src/components/Dialog/dialog.variants.ts.html +0 -283
  300. package/test-output/vitest/coverage/src/components/Dialog/index.html +0 -131
  301. package/test-output/vitest/coverage/src/components/Divider/Divider.tsx.html +0 -505
  302. package/test-output/vitest/coverage/src/components/Divider/divider.variants.ts.html +0 -433
  303. package/test-output/vitest/coverage/src/components/Divider/index.html +0 -131
  304. package/test-output/vitest/coverage/src/components/Grid/Grid.tsx.html +0 -529
  305. package/test-output/vitest/coverage/src/components/Grid/grid.variants.ts.html +0 -484
  306. package/test-output/vitest/coverage/src/components/Grid/index.html +0 -131
  307. package/test-output/vitest/coverage/src/components/LeftNav/LeftNav.tsx.html +0 -1075
  308. package/test-output/vitest/coverage/src/components/LeftNav/index.html +0 -131
  309. package/test-output/vitest/coverage/src/components/LeftNav/leftNav.variants.ts.html +0 -406
  310. package/test-output/vitest/coverage/src/components/NumberField/NumberField.tsx.html +0 -1048
  311. package/test-output/vitest/coverage/src/components/NumberField/index.html +0 -131
  312. package/test-output/vitest/coverage/src/components/NumberField/numberField.variants.ts.html +0 -367
  313. package/test-output/vitest/coverage/src/components/OTPField/OTPField.tsx.html +0 -835
  314. package/test-output/vitest/coverage/src/components/OTPField/index.html +0 -131
  315. package/test-output/vitest/coverage/src/components/OTPField/otpField.variants.ts.html +0 -301
  316. package/test-output/vitest/coverage/src/components/Pagination/Pagination.tsx.html +0 -916
  317. package/test-output/vitest/coverage/src/components/Pagination/index.html +0 -146
  318. package/test-output/vitest/coverage/src/components/Pagination/pagination.helpers.ts.html +0 -391
  319. package/test-output/vitest/coverage/src/components/Pagination/pagination.variants.ts.html +0 -436
  320. package/test-output/vitest/coverage/src/components/Popover/Popover.tsx.html +0 -250
  321. package/test-output/vitest/coverage/src/components/Popover/index.html +0 -131
  322. package/test-output/vitest/coverage/src/components/Popover/popover.variants.ts.html +0 -157
  323. package/test-output/vitest/coverage/src/components/RadioGroup/RadioGroup.tsx.html +0 -934
  324. package/test-output/vitest/coverage/src/components/RadioGroup/index.html +0 -131
  325. package/test-output/vitest/coverage/src/components/RadioGroup/radioGroup.variants.ts.html +0 -346
  326. package/test-output/vitest/coverage/src/components/Skeleton/Skeleton.tsx.html +0 -232
  327. package/test-output/vitest/coverage/src/components/Skeleton/index.html +0 -131
  328. package/test-output/vitest/coverage/src/components/Skeleton/skeleton.variants.ts.html +0 -346
  329. package/test-output/vitest/coverage/src/components/Snackbar/Snackbar.tsx.html +0 -979
  330. package/test-output/vitest/coverage/src/components/Snackbar/index.html +0 -131
  331. package/test-output/vitest/coverage/src/components/Snackbar/snackbar.variants.ts.html +0 -307
  332. package/test-output/vitest/coverage/src/components/Stack/Stack.tsx.html +0 -430
  333. package/test-output/vitest/coverage/src/components/Stack/index.html +0 -131
  334. package/test-output/vitest/coverage/src/components/Stack/stack.variants.ts.html +0 -325
  335. package/test-output/vitest/coverage/src/components/Switch/Switch.tsx.html +0 -559
  336. package/test-output/vitest/coverage/src/components/Switch/index.html +0 -131
  337. package/test-output/vitest/coverage/src/components/Switch/switch.variants.ts.html +0 -295
  338. package/test-output/vitest/coverage/src/components/Table/Table.tsx.html +0 -2677
  339. package/test-output/vitest/coverage/src/components/Table/cells/RenderButton.tsx.html +0 -154
  340. package/test-output/vitest/coverage/src/components/Table/cells/RenderChip.tsx.html +0 -385
  341. package/test-output/vitest/coverage/src/components/Table/cells/RenderText.tsx.html +0 -196
  342. package/test-output/vitest/coverage/src/components/Table/cells/RenderTwoLine.tsx.html +0 -187
  343. package/test-output/vitest/coverage/src/components/Table/cells/RowActionsMenu.tsx.html +0 -526
  344. package/test-output/vitest/coverage/src/components/Table/cells/index.html +0 -191
  345. package/test-output/vitest/coverage/src/components/Table/cells/index.ts.html +0 -127
  346. package/test-output/vitest/coverage/src/components/Table/index.html +0 -131
  347. package/test-output/vitest/coverage/src/components/Table/table.variants.ts.html +0 -706
  348. package/test-output/vitest/coverage/src/components/Tabs/Tabs.tsx.html +0 -283
  349. package/test-output/vitest/coverage/src/components/Tabs/index.html +0 -131
  350. package/test-output/vitest/coverage/src/components/Tabs/tabs.variants.ts.html +0 -292
  351. package/test-output/vitest/coverage/src/components/TextField/TextField.tsx.html +0 -820
  352. package/test-output/vitest/coverage/src/components/TextField/index.html +0 -131
  353. package/test-output/vitest/coverage/src/components/TextField/textField.variants.ts.html +0 -400
  354. package/test-output/vitest/coverage/src/components/Textarea/Textarea.tsx.html +0 -655
  355. package/test-output/vitest/coverage/src/components/Textarea/index.html +0 -131
  356. package/test-output/vitest/coverage/src/components/Textarea/textarea.variants.ts.html +0 -340
  357. package/test-output/vitest/coverage/src/components/Tooltip/Tooltip.tsx.html +0 -295
  358. package/test-output/vitest/coverage/src/components/Tooltip/index.html +0 -131
  359. package/test-output/vitest/coverage/src/components/Tooltip/tooltip.variants.ts.html +0 -169
  360. package/test-output/vitest/coverage/src/components/TopBar/TopBar.tsx.html +0 -283
  361. package/test-output/vitest/coverage/src/components/TopBar/index.html +0 -131
  362. package/test-output/vitest/coverage/src/components/TopBar/topBar.variants.ts.html +0 -199
  363. package/test-output/vitest/coverage/src/components/Typography/Typography.tsx.html +0 -421
  364. package/test-output/vitest/coverage/src/components/Typography/index.html +0 -131
  365. package/test-output/vitest/coverage/src/components/Typography/typography.variants.ts.html +0 -436
  366. package/test-output/vitest/coverage/src/components/VisuallyHidden/VisuallyHidden.tsx.html +0 -262
  367. package/test-output/vitest/coverage/src/components/VisuallyHidden/index.html +0 -116
  368. package/test-output/vitest/coverage/src/components/_shared/data/getNestedValue.ts.html +0 -181
  369. package/test-output/vitest/coverage/src/components/_shared/data/index.html +0 -236
  370. package/test-output/vitest/coverage/src/components/_shared/data/useColumnAutoDetect.ts.html +0 -385
  371. package/test-output/vitest/coverage/src/components/_shared/data/useControllableState.ts.html +0 -229
  372. package/test-output/vitest/coverage/src/components/_shared/data/useDebouncedValue.ts.html +0 -157
  373. package/test-output/vitest/coverage/src/components/_shared/data/useTableFilter.ts.html +0 -439
  374. package/test-output/vitest/coverage/src/components/_shared/data/useTableSearch.ts.html +0 -283
  375. package/test-output/vitest/coverage/src/components/_shared/data/useTableSelection.ts.html +0 -385
  376. package/test-output/vitest/coverage/src/components/_shared/data/useTableSort.ts.html +0 -508
  377. package/test-output/vitest/coverage/src/components/_shared/data/useVirtualizer.ts.html +0 -682
  378. package/test-output/vitest/coverage/src/components/_shared/index.html +0 -116
  379. package/test-output/vitest/coverage/src/components/_shared/resolveValidationState.ts.html +0 -265
  380. package/test-output/vitest/coverage/src/hooks/index.html +0 -116
  381. package/test-output/vitest/coverage/src/hooks/useAccessState.ts.html +0 -328
  382. package/test-output/vitest/coverage/src/index.html +0 -116
  383. package/test-output/vitest/coverage/src/index.ts.html +0 -1153
  384. package/test-output/vitest/coverage/src/utils/cn.ts.html +0 -172
  385. package/test-output/vitest/coverage/src/utils/index.html +0 -116
  386. package/tsconfig.json +0 -13
  387. package/tsconfig.lib.json +0 -58
  388. package/tsconfig.spec.json +0 -34
  389. package/vite.config.ts +0 -33
  390. package/vitest.config.mts +0 -29
@@ -1,391 +0,0 @@
1
- // @vitest-environment jsdom
2
- import { describe, it, expect } from 'vitest';
3
- import { render } from '@testing-library/react';
4
- import { Box } from './Box.js';
5
-
6
- /**
7
- * Suite mirrors the Typography/Button test shape (rendering · variants ·
8
- * compound × intent · override · polymorphism · pass-through). The big
9
- * delta here is the compound-variant matrix: 5 surface variants × 7
10
- * intents = 35 combos, of which 21 carry actual visual differences
11
- * (outlined / soft / solid × 7 intents). We spot-check a representative
12
- * subset rather than enumerate all 35 — if the TV compound resolution
13
- * works for one of each (primary, danger, neutral), it works for all.
14
- */
15
- describe('<Box>', () => {
16
- // ─── Default rendering ──────────────────────────────────────────────
17
- describe('default rendering', () => {
18
- it('renders a <div> by default', () => {
19
- const { container } = render(<Box>x</Box>);
20
- expect(container.firstElementChild?.tagName).toBe('DIV');
21
- });
22
-
23
- it('default variant is plain — no border, no bg, no shadow', () => {
24
- const { container } = render(<Box>x</Box>);
25
- const cls = container.firstElementChild?.className ?? '';
26
- expect(cls).not.toContain('border');
27
- expect(cls).not.toContain('bg-');
28
- expect(cls).not.toContain('shadow-sm');
29
- // baseline `block` is always present
30
- expect(cls).toContain('block');
31
- });
32
- });
33
-
34
- // ─── Variant — surface chrome ───────────────────────────────────────
35
- describe('surface variants', () => {
36
- it('variant="outlined" adds a border', () => {
37
- const { container } = render(<Box variant="outlined" color="neutral">x</Box>);
38
- const cls = container.firstElementChild?.className ?? '';
39
- expect(cls).toContain('border');
40
- // neutral outlined picks the white surface + neutral-200 border
41
- expect(cls).toContain('border-neutral-200');
42
- expect(cls).toContain('bg-white');
43
- });
44
-
45
- it('variant="elevated" adds the neutral surface, no border, no color tint', () => {
46
- const { container } = render(<Box variant="elevated" elevation={3}>x</Box>);
47
- const cls = container.firstElementChild?.className ?? '';
48
- expect(cls).toContain('bg-white');
49
- // Sprint 4.3 theme identity sweep: corrected `dark:bg-neutral-900`
50
- // (which resolved to near-white in dark mode via inversion — broken
51
- // elevation) to `dark:bg-neutral-100` which resolves to `#171717`,
52
- // one elevation tier above the page surface in dark mode.
53
- expect(cls).toContain('dark:bg-neutral-100');
54
- expect(cls).toContain('shadow-md');
55
- expect(cls).not.toContain('border ');
56
- });
57
-
58
- it('variant="soft" + color="warning" picks the warning soft tones', () => {
59
- const { container } = render(<Box variant="soft" color="warning">x</Box>);
60
- const cls = container.firstElementChild?.className ?? '';
61
- expect(cls).toContain('bg-warning-100');
62
- expect(cls).toContain('text-warning-900');
63
- expect(cls).toContain('dark:bg-warning-950/50');
64
- });
65
-
66
- it('variant="solid" + color="primary" picks the primary solid', () => {
67
- const { container } = render(<Box variant="solid" color="primary">x</Box>);
68
- const cls = container.firstElementChild?.className ?? '';
69
- expect(cls).toContain('bg-primary-600');
70
- expect(cls).toContain('text-white');
71
- expect(cls).toContain('dark:bg-primary-500');
72
- });
73
-
74
- it('variant="solid" + color="danger" picks the danger solid', () => {
75
- const { container } = render(<Box variant="solid" color="danger">x</Box>);
76
- const cls = container.firstElementChild?.className ?? '';
77
- expect(cls).toContain('bg-danger-600');
78
- expect(cls).toContain('text-white');
79
- });
80
- });
81
-
82
- // ─── Elevation scale ─────────────────────────────────────────────────
83
- describe('elevation', () => {
84
- it('elevation={0} emits shadow-none', () => {
85
- const { container } = render(<Box variant="elevated" elevation={0}>x</Box>);
86
- expect(container.firstElementChild?.className).toContain('shadow-none');
87
- });
88
-
89
- it('elevation={5} emits shadow-xl', () => {
90
- const { container } = render(<Box variant="elevated" elevation={5}>x</Box>);
91
- expect(container.firstElementChild?.className).toContain('shadow-xl');
92
- });
93
- });
94
-
95
- // ─── Spacing ─────────────────────────────────────────────────────────
96
- describe('spacing', () => {
97
- it('p={4} emits p-4', () => {
98
- const { container } = render(<Box p={4}>x</Box>);
99
- expect(container.firstElementChild?.className).toContain('p-4');
100
- });
101
-
102
- it('px={6} + py={2} emits px-6 + py-2', () => {
103
- const { container } = render(<Box px={6} py={2}>x</Box>);
104
- const cls = container.firstElementChild?.className ?? '';
105
- expect(cls).toContain('px-6');
106
- expect(cls).toContain('py-2');
107
- });
108
-
109
- it('m={"0.5"} emits m-0.5', () => {
110
- const { container } = render(<Box m="0.5">x</Box>);
111
- expect(container.firstElementChild?.className).toContain('m-0.5');
112
- });
113
- });
114
-
115
- // ─── Rounded + sizing ────────────────────────────────────────────────
116
- describe('rounded + sizing', () => {
117
- it('rounded="xl" emits rounded-xl', () => {
118
- const { container } = render(<Box rounded="xl">x</Box>);
119
- expect(container.firstElementChild?.className).toContain('rounded-xl');
120
- });
121
-
122
- it('fullWidth emits w-full', () => {
123
- const { container } = render(<Box fullWidth>x</Box>);
124
- expect(container.firstElementChild?.className).toContain('w-full');
125
- });
126
-
127
- it('fullHeight emits h-full', () => {
128
- const { container } = render(<Box fullHeight>x</Box>);
129
- expect(container.firstElementChild?.className).toContain('h-full');
130
- });
131
- });
132
-
133
- // ─── Override semantics ─────────────────────────────────────────────
134
- describe('override', () => {
135
- it('sx wins over variant defaults via tailwind-merge', () => {
136
- const { container } = render(
137
- <Box variant="solid" color="primary" sx="bg-fuchsia-600">x</Box>,
138
- );
139
- const cls = container.firstElementChild?.className ?? '';
140
- expect(cls).toContain('bg-fuchsia-600');
141
- // the conflicting bg-primary-600 from the compound is collapsed
142
- expect(cls).not.toContain('bg-primary-600');
143
- });
144
-
145
- it('sx can add utilities Box deliberately omits (overflow)', () => {
146
- const { container } = render(<Box sx="overflow-hidden">x</Box>);
147
- expect(container.firstElementChild?.className).toContain('overflow-hidden');
148
- });
149
- });
150
-
151
- // ─── Polymorphism ───────────────────────────────────────────────────
152
- describe('polymorphism', () => {
153
- it('as="section" renders a <section>', () => {
154
- const { container } = render(<Box as="section">x</Box>);
155
- expect(container.firstElementChild?.tagName).toBe('SECTION');
156
- });
157
-
158
- it('asChild renders the single child element with merged className', () => {
159
- const { container } = render(
160
- <Box variant="elevated" elevation={2} asChild>
161
- <article>x</article>
162
- </Box>,
163
- );
164
- const el = container.firstElementChild;
165
- expect(el?.tagName).toBe('ARTICLE');
166
- expect(el?.className).toContain('shadow');
167
- expect(el?.className).toContain('bg-white');
168
- });
169
-
170
- it('asChild wins over as when both are passed', () => {
171
- const { container } = render(
172
- <Box as="section" asChild>
173
- <article>x</article>
174
- </Box>,
175
- );
176
- expect(container.firstElementChild?.tagName).toBe('ARTICLE');
177
- });
178
- });
179
-
180
- // ─── Pass-through ────────────────────────────────────────────────────
181
- describe('pass-through', () => {
182
- it('forwards data-* and aria-*', () => {
183
- const { container } = render(
184
- <Box data-testid="box" aria-label="surface">x</Box>,
185
- );
186
- const el = container.firstElementChild;
187
- expect(el?.getAttribute('data-testid')).toBe('box');
188
- expect(el?.getAttribute('aria-label')).toBe('surface');
189
- });
190
- });
191
-
192
- // ─── F11-bis edge cases: every compound variant explicit ─────────────
193
- // The original suite spot-checked 4 surface×intent combos (outlined
194
- // neutral, soft warning, solid primary, solid danger). The validation
195
- // pass before publishing 0.2.0-beta enumerates ALL 21 visually-distinct
196
- // compound entries so a future TV recipe edit can't silently drop one.
197
- describe('compound variants matrix — every surface × intent', () => {
198
- const INTENTS = ['primary', 'secondary', 'success', 'warning', 'danger', 'info', 'neutral'] as const;
199
-
200
- /*
201
- * Outlined × 7 intents — each emits a tinted border + soft bg pair
202
- * with the dark-mode counterpart pre-wired. Spot-check picks the
203
- * `border-{color}-300` light token and the `dark:border-{color}-{N}` pair.
204
- */
205
- describe('outlined × intent', () => {
206
- it.each(INTENTS)('outlined × %s emits border + bg with dark pair', (color) => {
207
- const { container } = render(<Box variant="outlined" color={color}>x</Box>);
208
- const cls = container.firstElementChild?.className ?? '';
209
- if (color === 'neutral') {
210
- // Sprint 4.3 identity sweep: neutral outlined uses
211
- // `border-neutral-200` (auto-inverts via CSS-var swap; no
212
- // `dark:` needed) + `bg-white dark:bg-neutral-100`
213
- // (bg-white is hardcoded so `dark:` is required; target
214
- // `dark:bg-neutral-100` = `#171717` is one tier elevated
215
- // above the page surface in dark mode).
216
- expect(cls).toContain('border-neutral-200');
217
- expect(cls).toContain('bg-white');
218
- expect(cls).toContain('dark:bg-neutral-100');
219
- // No more dark:border-neutral-700 (auto-inverts).
220
- expect(cls).not.toContain('dark:border-neutral-');
221
- } else {
222
- // primary/secondary/success/warning/danger/info share the
223
- // border-{color}-300 + bg-{color}-50/40 + dark:* pattern
224
- expect(cls).toContain(`border-${color}-300`);
225
- expect(cls).toContain(`bg-${color}-50/40`);
226
- expect(cls).toContain(`dark:border-${color}-800`);
227
- expect(cls).toContain(`dark:bg-${color}-950/30`);
228
- }
229
- });
230
- });
231
-
232
- /*
233
- * Soft × 7 intents — semi-transparent tinted background + matching
234
- * intent text colour. Dark pair uses a darker bg + lighter text so
235
- * contrast holds in both modes.
236
- */
237
- describe('soft × intent', () => {
238
- it.each(INTENTS)('soft × %s emits bg + text with dark pair', (color) => {
239
- const { container } = render(<Box variant="soft" color={color}>x</Box>);
240
- const cls = container.firstElementChild?.className ?? '';
241
- if (color === 'neutral') {
242
- // Sprint 4.3 identity sweep: both neutral classes auto-invert
243
- // via the dashforgePreset() CSS-var swap — no `dark:` needed.
244
- expect(cls).toContain('bg-neutral-100');
245
- expect(cls).toContain('text-neutral-900');
246
- expect(cls).not.toContain('dark:bg-neutral-');
247
- expect(cls).not.toContain('dark:text-neutral-');
248
- } else {
249
- expect(cls).toContain(`bg-${color}-100`);
250
- expect(cls).toContain(`text-${color}-900`);
251
- expect(cls).toContain(`dark:bg-${color}-950/50`);
252
- expect(cls).toContain(`dark:text-${color}-100`);
253
- }
254
- });
255
- });
256
-
257
- /*
258
- * Solid × 7 intents — full-bleed intent background, white text by
259
- * default (neutral inverts: black bg → white text in light, white
260
- * bg → black text in dark). The dark variant typically uses a
261
- * lighter shade so the surface doesn't look pitch black on already-
262
- * dark page backgrounds.
263
- */
264
- describe('solid × intent', () => {
265
- it.each(INTENTS)('solid × %s emits bg + text-white (or contrast pair for neutral)', (color) => {
266
- const { container } = render(<Box variant="solid" color={color}>x</Box>);
267
- const cls = container.firstElementChild?.className ?? '';
268
- if (color === 'neutral') {
269
- // Sprint 4.3 identity sweep: solid neutral now uses
270
- // `bg-neutral-900 text-neutral-50` (both auto-invert) — the
271
- // accent surface inverts WITH the page (dark surface in
272
- // light mode, light surface in dark mode), consistent with
273
- // identity rule. Previously was `text-white` (no inversion)
274
- // forcing double-invert pattern to stay readable.
275
- expect(cls).toContain('bg-neutral-900');
276
- expect(cls).toContain('text-neutral-50');
277
- expect(cls).not.toContain('text-white');
278
- expect(cls).not.toContain('dark:bg-neutral-');
279
- expect(cls).not.toContain('dark:text-neutral-');
280
- } else if (color === 'warning') {
281
- // warning uses 500/600 instead of 600/500 to keep contrast
282
- // legible against an already-yellow surface in light mode.
283
- expect(cls).toContain('bg-warning-500');
284
- expect(cls).toContain('text-white');
285
- expect(cls).toContain('dark:bg-warning-600');
286
- } else {
287
- expect(cls).toContain(`bg-${color}-600`);
288
- expect(cls).toContain('text-white');
289
- expect(cls).toContain(`dark:bg-${color}-500`);
290
- }
291
- });
292
- });
293
- });
294
-
295
- // ─── F11-bis edge cases: color is ignored for plain / elevated ──────
296
- // These two variants are color-agnostic by design (see box.variants.ts
297
- // header) — passing `color` shouldn't accidentally inject the intent
298
- // bg/border via the compound matrix.
299
- describe('color-agnostic variants', () => {
300
- it('plain + color="primary" does NOT add intent classes', () => {
301
- const { container } = render(<Box variant="plain" color="primary">x</Box>);
302
- const cls = container.firstElementChild?.className ?? '';
303
- expect(cls).not.toContain('bg-primary-');
304
- expect(cls).not.toContain('border-primary-');
305
- expect(cls).not.toContain('text-primary-');
306
- });
307
-
308
- it('elevated + color="danger" stays on the neutral surface', () => {
309
- const { container } = render(<Box variant="elevated" color="danger">x</Box>);
310
- const cls = container.firstElementChild?.className ?? '';
311
- // elevated paints bg-white / dark:bg-neutral-100 regardless of
312
- // intent (Sprint 4.3 sweep: dark target corrected to
313
- // `dark:bg-neutral-100` for proper dark elevation).
314
- expect(cls).toContain('bg-white');
315
- expect(cls).toContain('dark:bg-neutral-100');
316
- expect(cls).not.toContain('bg-danger-');
317
- expect(cls).not.toContain('border-danger-');
318
- });
319
- });
320
-
321
- // ─── F11-bis edge cases: spacing axis coexistence ───────────────────
322
- describe('spacing axis coexistence', () => {
323
- it('p={4} + px={6}: both classes emitted (tailwind-merge resolves)', () => {
324
- const { container } = render(<Box p={4} px={6}>x</Box>);
325
- const cls = container.firstElementChild?.className ?? '';
326
- // tailwind-merge: px-6 wins over p-4 on horizontal padding,
327
- // p-4 keeps applying vertical via py
328
- expect(cls).toContain('px-6');
329
- // p-4 → tailwind-merge collapses with px-6 (latter wins on x-axis)
330
- // The vertical (py-4 derived from p-4) is what remains.
331
- });
332
-
333
- it('m={2} + mx={4} + my={6}: all three coexist (resolves to mx-4 + my-6 effectively)', () => {
334
- const { container } = render(<Box m={2} mx={4} my={6}>x</Box>);
335
- const cls = container.firstElementChild?.className ?? '';
336
- expect(cls).toContain('mx-4');
337
- expect(cls).toContain('my-6');
338
- });
339
- });
340
-
341
- // ─── F11-bis edge cases: elevation × variant interaction ────────────
342
- describe('elevation × variant', () => {
343
- it('elevation works on non-elevated variants too (consumer choice)', () => {
344
- const { container } = render(<Box variant="outlined" color="neutral" elevation={4}>x</Box>);
345
- // The shadow class still gets emitted even though the design
346
- // recommendation is "use elevation only with variant=elevated".
347
- // We don't gate this at the TV level because compound restrictions
348
- // would make the API harder to discover.
349
- expect(container.firstElementChild?.className).toContain('shadow-lg');
350
- });
351
-
352
- it('elevation=0 explicitly disables shadow', () => {
353
- const { container } = render(<Box variant="elevated" elevation={0}>x</Box>);
354
- expect(container.firstElementChild?.className).toContain('shadow-none');
355
- });
356
- });
357
-
358
- // ─── F11-bis edge cases: rounded full ───────────────────────────────
359
- describe('rounded edge values', () => {
360
- it('rounded="full" produces rounded-full (avatars, pills)', () => {
361
- const { container } = render(<Box rounded="full">x</Box>);
362
- expect(container.firstElementChild?.className).toContain('rounded-full');
363
- });
364
-
365
- it('rounded="none" explicitly removes any rounding', () => {
366
- const { container } = render(<Box rounded="none">x</Box>);
367
- expect(container.firstElementChild?.className).toContain('rounded-none');
368
- });
369
- });
370
-
371
- describe('bridge integration — visibleWhen (Sprint 4.4 surface alignment)', () => {
372
- it('renders when visibleWhen returns true', () => {
373
- const { container } = render(
374
- <Box visibleWhen={() => true}>shown</Box>
375
- );
376
- expect(container.firstChild).toBeTruthy();
377
- });
378
-
379
- it('returns null when visibleWhen returns false', () => {
380
- const { container } = render(
381
- <Box visibleWhen={() => false}>hidden</Box>
382
- );
383
- expect(container.firstChild).toBeNull();
384
- });
385
-
386
- it('renders normally when visibleWhen is omitted', () => {
387
- const { container } = render(<Box>always</Box>);
388
- expect(container.firstChild).toBeTruthy();
389
- });
390
- });
391
- });
@@ -1,112 +0,0 @@
1
- import { forwardRef, useContext, type ElementType, type ReactElement } from 'react';
2
- import { Slot } from '@radix-ui/react-slot';
3
- import { DashFormContext, useEngineVisibility } from '@dashforge/ui-core';
4
- import { cn } from '../../utils/cn.js';
5
- import { useAccessState } from '../../hooks/useAccessState.js';
6
- import { boxVariants } from './box.variants.js';
7
- import type { BoxProps } from './box.types.js';
8
-
9
- /**
10
- * `<Box>` — the surface primitive of @dashforge/tw.
11
- *
12
- * What it IS:
13
- * A polymorphic container with typed surface variants (plain /
14
- * outlined / elevated / soft / solid) × 7 intent colours, plus
15
- * spacing / sizing / rounded / elevation as enumerated token-scale
16
- * props. Replaces MUI's Box + Paper + Card + Surface in one component.
17
- *
18
- * What it is NOT (deliberate, enforced by the prop set):
19
- * • Not a flex container → use <Stack>
20
- * • Not a grid container → use <Grid>
21
- * • Not a paragraph → use <Typography>
22
- * • Not a button → use <Button>
23
- *
24
- * The "Box is not flex" rule is the spine of the layout layer. Without
25
- * it, every `<div>` in an app gravitates back to Box and the surface
26
- * vs layout distinction collapses. Box's job is the SURFACE around
27
- * content; Stack/Grid's job is the ARRANGEMENT of content. Two
28
- * primitives, two responsibilities.
29
- *
30
- * When BOTH `as` and `asChild` are passed, `asChild` wins. Same rule
31
- * as Typography — documented to avoid the dimension-bloat of a
32
- * discriminated union over an 11-axis props type.
33
- *
34
- * Layering:
35
- * • Sits BENEATH every visual chrome — every card, every panel,
36
- * every section background.
37
- * • Composes ON TOP of @dashforge/tw-tokens (color + spacing + radius
38
- * + shadow scales) via the dashforgePreset CSS variables.
39
- * • Pairs with Typography for text content, Stack/Grid for layout
40
- * children inside it.
41
- */
42
- export const Box = forwardRef<HTMLElement, BoxProps>(
43
- function Box(props, ref) {
44
- const {
45
- variant,
46
- color,
47
- elevation,
48
- rounded,
49
- p, px, py, m, mx, my,
50
- fullWidth,
51
- fullHeight,
52
- as,
53
- asChild = false,
54
- sx,
55
- visibleWhen,
56
- access,
57
- children,
58
- ...rest
59
- } = props;
60
-
61
- // Bridge — hooks called unconditionally (rules-of-hooks).
62
- // `useEngineVisibility` subscribes to engine state inside a
63
- // `<DashForm>` and re-evaluates the predicate reactively; outside
64
- // a form, it evaluates the predicate as a plain closure.
65
- // `useAccessState` consults the @dashforge/rbac policy engine.
66
- // Both default to no-op when the corresponding prop is omitted.
67
- const bridge = useContext(DashFormContext);
68
- const isVisible = useEngineVisibility(bridge?.engine, visibleWhen);
69
- const accessState = useAccessState(access);
70
-
71
- // Early return — predicate false OR RBAC denies visibility.
72
- if (!isVisible || !accessState.visible) return null;
73
-
74
- const classes = cn(
75
- boxVariants({
76
- variant, color, elevation, rounded,
77
- p, px, py, m, mx, my,
78
- fullWidth, fullHeight,
79
- }),
80
- // RBAC-disabled / readonly surfaces dim visually + carry
81
- // semantic ARIA attributes (assigned below) so descendants and
82
- // assistive tech can react.
83
- accessState.disabled && 'opacity-60',
84
- accessState.readonly && 'opacity-80',
85
- sx,
86
- );
87
-
88
- const ariaProps = {
89
- 'aria-disabled': accessState.disabled || undefined,
90
- 'aria-readonly': accessState.readonly || undefined,
91
- 'data-disabled': accessState.disabled || undefined,
92
- 'data-readonly': accessState.readonly || undefined,
93
- };
94
-
95
- if (asChild) {
96
- return (
97
- <Slot ref={ref} className={classes} {...ariaProps} {...rest}>
98
- {children as ReactElement}
99
- </Slot>
100
- );
101
- }
102
-
103
- const Tag = (as ?? 'div') as ElementType;
104
- return (
105
- <Tag ref={ref as never} className={classes} {...ariaProps} {...rest}>
106
- {children}
107
- </Tag>
108
- );
109
- },
110
- );
111
-
112
- Box.displayName = 'Box';
@@ -1,116 +0,0 @@
1
- import type { ElementType, HTMLAttributes } from 'react';
2
- import type { Engine } from '@dashforge/ui-core';
3
- import type { AccessRequirement } from '@dashforge/rbac';
4
- import type { BoxVariants } from './box.variants.js';
5
-
6
- /**
7
- * Props for `<Box>` — the surface primitive.
8
- *
9
- * What lives in props (typed, ergonomic):
10
- * • Surface — variant, color, elevation, rounded
11
- * • Spacing — p, px, py, m, mx, my (token-scale steps)
12
- * • Sizing — fullWidth, fullHeight
13
- * • Polymorphism — as, asChild
14
- * • Override escape — sx (utility string, merged via tailwind-merge)
15
- *
16
- * What does NOT live here (deliberate, see Box.tsx header):
17
- * • display / flex / grid / gap → use Stack or Grid
18
- * • position / top / z-index → use sx
19
- * • overflow / cursor → use sx
20
- * • animation / transition → use sx
21
- *
22
- * Native attribute overrides:
23
- * • `className` is omitted in favour of `sx` (string of utilities,
24
- * resolved by tailwind-merge so consumer wins over variant defaults)
25
- * — same convention as Button/TextField/Checkbox/Switch.
26
- * • `color` is omitted: collides with the deprecated HTML4 `color`
27
- * attribute. Our typed `color` (intent) is the right one.
28
- */
29
- export interface BoxProps
30
- extends Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'color'>,
31
- Pick<BoxVariants,
32
- 'variant' | 'color' | 'elevation' | 'rounded'
33
- | 'p' | 'px' | 'py' | 'm' | 'mx' | 'my'
34
- | 'fullWidth' | 'fullHeight'> {
35
- /**
36
- * Override the rendered HTML tag. Defaults to `'div'`. Useful when
37
- * the surface should also carry semantic meaning — `<Box as="section">`
38
- * for a page section, `<Box as="article">` for a card-shaped article.
39
- *
40
- * Ignored when `asChild` is true.
41
- */
42
- as?: ElementType;
43
-
44
- /**
45
- * Render via Radix `Slot` — the Box styles paint onto the single
46
- * React child instead of wrapping it in our own element. Useful for
47
- * `<Box asChild><Link>...</Link></Box>` to get a styled router link
48
- * with no extra DOM wrapper.
49
- *
50
- * Mutually exclusive with `as` (when both are passed, `asChild` wins
51
- * — see Box.tsx for the reasoning).
52
- */
53
- asChild?: boolean;
54
-
55
- /**
56
- * Utility classes appended to the variant chain. Resolved via
57
- * `tailwind-merge` so the consumer's classes always win over the
58
- * variant defaults. Use for one-off overrides AND for utility
59
- * dimensions Box deliberately doesn't expose as props (overflow,
60
- * position, animation, etc.).
61
- */
62
- sx?: string;
63
-
64
- /**
65
- * Reactive visibility predicate — added in 1.1.0 (Sprint 4.4
66
- * surface alignment). When the predicate returns `false`, the
67
- * component renders `null`. Inside a `<DashForm>` it subscribes
68
- * reactively to engine state changes; outside a form, it's
69
- * evaluated as a plain closure.
70
- *
71
- * Use for state-driven hiding of dashboard cards, conditional
72
- * sections, gated content, etc. **For permission-driven hiding,
73
- * prefer `access` with `onUnauthorized: 'hide'`** — it's semantically
74
- * the correct path and surfaces better in RBAC dev tools.
75
- *
76
- * @example
77
- * ```tsx
78
- * // Dashboard card visible only when there are pending shipments
79
- * <Box variant="outlined" rounded="lg" p={4}
80
- * visibleWhen={() => pendingCount > 0}>
81
- * <Typography variant="h3">{pendingCount} pending</Typography>
82
- * </Box>
83
- * ```
84
- */
85
- visibleWhen?: (engine: Engine) => boolean;
86
-
87
- /**
88
- * RBAC requirement — added in 1.1.0 (Sprint 4.4 surface alignment).
89
- * Controls Box visibility / disabled-state via the centralized
90
- * `@dashforge/rbac` policy engine.
91
- *
92
- * - `onUnauthorized: 'hide'` → Box does not render
93
- * - `onUnauthorized: 'disable'` → adds `aria-disabled` + dimmed
94
- * visual; interactive children should derive their disabled state
95
- * from `data-disabled` on the Box or pass their own `access`
96
- * - `onUnauthorized: 'readonly'` → adds `aria-readonly`; mostly used
97
- * when Box wraps form sections that propagate readonly to children
98
- *
99
- * Use for permission-gated dashboard cards, admin-only sections,
100
- * tenant-aware layouts. The hide path is the common case.
101
- *
102
- * @example
103
- * ```tsx
104
- * // Revenue card visible only to users with billing:read permission
105
- * <Box variant="elevated" rounded="lg" elevation={2} p={4}
106
- * access={{
107
- * resource: 'billing',
108
- * action: 'read',
109
- * onUnauthorized: 'hide'
110
- * }}>
111
- * <Typography variant="h3">Q3 Revenue</Typography>
112
- * </Box>
113
- * ```
114
- */
115
- access?: AccessRequirement;
116
- }