@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,83 +0,0 @@
1
- import { tv, type VariantProps } from 'tailwind-variants';
2
- import type { SpinnerColor } from './spinner.types.js';
3
-
4
- /**
5
- * Tailwind-variants recipe for `<Spinner>`.
6
- *
7
- * Axes:
8
- * - `size` — 5 steps (xs/sm/md/lg/xl) → w/h spacing tokens
9
- * - `thickness` — 3 steps (thin/md/thick) → SVG stroke-width
10
- * - `color` — 7 intents (or omitted → `currentColor`)
11
- *
12
- * The stroke + fill of the SVG paths are governed by
13
- * `stroke="currentColor"` (set inline in Spinner.tsx), so the root
14
- * `text-*` class drives the color. When `color` is omitted, no
15
- * `text-*` class is emitted at all — `currentColor` resolves to
16
- * whatever the parent's text color is.
17
- */
18
- export const spinnerVariants = tv({
19
- base: 'inline-block animate-spin motion-reduce:animate-none',
20
- variants: {
21
- size: {
22
- xs: 'w-3 h-3',
23
- sm: 'w-4 h-4',
24
- md: 'w-5 h-5',
25
- lg: 'w-6 h-6',
26
- xl: 'w-8 h-8',
27
- },
28
- /**
29
- * Color → text-{color}-600 (mid-tone, readable on most surfaces).
30
- * Note: text-{color}-600 acts on currentColor inside the SVG via
31
- * `stroke="currentColor"`. Neutral uses `text-neutral-600` which
32
- * auto-inverts via the dashforgePreset CSS-var swap (no `dark:`
33
- * needed). Color rows do NOT carry `dark:` either — the chosen
34
- * 600 step works in both modes for the spinner's specific use
35
- * (small element, brief visibility).
36
- */
37
- color: {
38
- neutral: 'text-neutral-600',
39
- primary: 'text-primary-600',
40
- secondary: 'text-secondary-600',
41
- success: 'text-success-600',
42
- warning: 'text-warning-600',
43
- danger: 'text-danger-600',
44
- info: 'text-info-600',
45
- },
46
- },
47
- defaultVariants: {
48
- size: 'md',
49
- // No default `color` — when omitted, the spinner inherits via
50
- // `currentColor`, which is the right default for nested use.
51
- },
52
- });
53
-
54
- export type SpinnerVariants = VariantProps<typeof spinnerVariants>;
55
-
56
- /**
57
- * SVG stroke-width per thickness step. Picked to read well at every
58
- * size — thin (1.5px) is the minimum readable; thick (3px) saturates
59
- * the available radius at sizes xs/sm.
60
- */
61
- export const SPINNER_STROKE_WIDTH: Record<'thin' | 'md' | 'thick', number> = {
62
- thin: 1.5,
63
- md: 2.25,
64
- thick: 3,
65
- };
66
-
67
- /**
68
- * The track ring renders at this opacity of `currentColor`. 0.2 is
69
- * the sweet spot — visible enough to anchor the eye, faint enough
70
- * to read as background.
71
- */
72
- export const SPINNER_TRACK_OPACITY = 0.2;
73
-
74
- /** Re-export the color name list so playground demos can iterate. */
75
- export const SPINNER_COLORS: SpinnerColor[] = [
76
- 'neutral',
77
- 'primary',
78
- 'secondary',
79
- 'success',
80
- 'warning',
81
- 'danger',
82
- 'info',
83
- ];
@@ -1,309 +0,0 @@
1
- // @vitest-environment jsdom
2
- import { describe, it, expect } from 'vitest';
3
- import { render } from '@testing-library/react';
4
- import { Stack } from './Stack.js';
5
-
6
- describe('<Stack>', () => {
7
- // ─── Default rendering ──────────────────────────────────────────────
8
- describe('default rendering', () => {
9
- it('renders a <div> by default', () => {
10
- const { container } = render(<Stack>x</Stack>);
11
- expect(container.firstElementChild?.tagName).toBe('DIV');
12
- });
13
-
14
- it('has flex + flex-col by default', () => {
15
- const { container } = render(<Stack>x</Stack>);
16
- const cls = container.firstElementChild?.className ?? '';
17
- expect(cls).toContain('flex');
18
- expect(cls).toContain('flex-col');
19
- });
20
- });
21
-
22
- // ─── Direction ──────────────────────────────────────────────────────
23
- describe('direction', () => {
24
- it('row', () => {
25
- const { container } = render(<Stack direction="row">x</Stack>);
26
- expect(container.firstElementChild?.className).toContain('flex-row');
27
- });
28
-
29
- it('row-reverse', () => {
30
- const { container } = render(<Stack direction="row-reverse">x</Stack>);
31
- expect(container.firstElementChild?.className).toContain('flex-row-reverse');
32
- });
33
- });
34
-
35
- // ─── Align + justify ────────────────────────────────────────────────
36
- describe('align + justify', () => {
37
- it('align="center" + justify="between"', () => {
38
- const { container } = render(
39
- <Stack align="center" justify="between">x</Stack>,
40
- );
41
- const cls = container.firstElementChild?.className ?? '';
42
- expect(cls).toContain('items-center');
43
- expect(cls).toContain('justify-between');
44
- });
45
-
46
- it('align="baseline"', () => {
47
- const { container } = render(<Stack align="baseline">x</Stack>);
48
- expect(container.firstElementChild?.className).toContain('items-baseline');
49
- });
50
- });
51
-
52
- // ─── Gap + wrap + sizing ────────────────────────────────────────────
53
- describe('gap + wrap + sizing', () => {
54
- it('gap={4} emits gap-4', () => {
55
- const { container } = render(<Stack gap={4}>x</Stack>);
56
- expect(container.firstElementChild?.className).toContain('gap-4');
57
- });
58
-
59
- it('gap={"0.5"} emits gap-0.5', () => {
60
- const { container } = render(<Stack gap="0.5">x</Stack>);
61
- expect(container.firstElementChild?.className).toContain('gap-0.5');
62
- });
63
-
64
- it('wrap emits flex-wrap', () => {
65
- const { container } = render(<Stack wrap>x</Stack>);
66
- expect(container.firstElementChild?.className).toContain('flex-wrap');
67
- });
68
-
69
- it('fullWidth + fullHeight', () => {
70
- const { container } = render(<Stack fullWidth fullHeight>x</Stack>);
71
- const cls = container.firstElementChild?.className ?? '';
72
- expect(cls).toContain('w-full');
73
- expect(cls).toContain('h-full');
74
- });
75
- });
76
-
77
- // ─── Divider ─────────────────────────────────────────────────────────
78
- describe('divider', () => {
79
- it('inserts N-1 dividers between N children', () => {
80
- const { container } = render(
81
- <Stack divider={<hr data-testid="div" />}>
82
- <span>a</span>
83
- <span>b</span>
84
- <span>c</span>
85
- </Stack>,
86
- );
87
- // 3 children + 2 dividers
88
- expect(container.firstElementChild?.children.length).toBe(5);
89
- const dividers = container.querySelectorAll('[data-testid="div"]');
90
- expect(dividers.length).toBe(2);
91
- });
92
-
93
- it('does NOT insert dividers when there is only one child', () => {
94
- const { container } = render(
95
- <Stack divider={<hr data-testid="div" />}>
96
- <span>only</span>
97
- </Stack>,
98
- );
99
- expect(container.firstElementChild?.children.length).toBe(1);
100
- expect(container.querySelectorAll('[data-testid="div"]').length).toBe(0);
101
- });
102
-
103
- it('treats a Fragment as a single child for divider boundary counting', () => {
104
- const { container } = render(
105
- <Stack divider={<hr data-testid="div" />}>
106
- <>
107
- <span>a</span>
108
- <span>b</span>
109
- </>
110
- <span>c</span>
111
- </Stack>,
112
- );
113
- // React.Children.toArray does NOT recursively flatten fragments — it
114
- // treats them as opaque single children. Documented behaviour: 2
115
- // top-level children → 1 divider between them. If you need a divider
116
- // BETWEEN the items inside the fragment, hoist them out of it.
117
- expect(container.querySelectorAll('[data-testid="div"]').length).toBe(1);
118
- });
119
-
120
- it('renders string/number divider correctly', () => {
121
- const { container } = render(
122
- <Stack divider=" · ">
123
- <span>a</span>
124
- <span>b</span>
125
- <span>c</span>
126
- </Stack>,
127
- );
128
- expect(container.firstElementChild?.textContent).toBe('a · b · c');
129
- });
130
-
131
- it('asChild silently ignores divider', () => {
132
- const { container } = render(
133
- <Stack asChild divider={<hr data-testid="div" />}>
134
- <nav>
135
- <a href="#">link</a>
136
- </nav>
137
- </Stack>,
138
- );
139
- // Slot wraps a single child — divider has nowhere to go
140
- expect(container.firstElementChild?.tagName).toBe('NAV');
141
- expect(container.querySelectorAll('[data-testid="div"]').length).toBe(0);
142
- });
143
- });
144
-
145
- // ─── Override + sx ──────────────────────────────────────────────────
146
- describe('override', () => {
147
- it('sx wins over variant defaults', () => {
148
- const { container } = render(
149
- <Stack direction="row" sx="flex-col">x</Stack>,
150
- );
151
- const cls = container.firstElementChild?.className ?? '';
152
- expect(cls).toContain('flex-col');
153
- expect(cls).not.toContain('flex-row');
154
- });
155
-
156
- it('sx can add utilities Stack does not expose (overflow)', () => {
157
- const { container } = render(<Stack sx="overflow-x-auto">x</Stack>);
158
- expect(container.firstElementChild?.className).toContain('overflow-x-auto');
159
- });
160
- });
161
-
162
- // ─── Polymorphism ───────────────────────────────────────────────────
163
- describe('polymorphism', () => {
164
- it('as="nav" renders a <nav>', () => {
165
- const { container } = render(<Stack as="nav">x</Stack>);
166
- expect(container.firstElementChild?.tagName).toBe('NAV');
167
- });
168
-
169
- it('asChild wins over as', () => {
170
- const { container } = render(
171
- <Stack as="nav" asChild>
172
- <header>x</header>
173
- </Stack>,
174
- );
175
- expect(container.firstElementChild?.tagName).toBe('HEADER');
176
- });
177
- });
178
-
179
- // ─── Pass-through ────────────────────────────────────────────────────
180
- it('forwards data-* + aria-*', () => {
181
- const { container } = render(
182
- <Stack data-testid="s" aria-label="settings">x</Stack>,
183
- );
184
- const el = container.firstElementChild;
185
- expect(el?.getAttribute('data-testid')).toBe('s');
186
- expect(el?.getAttribute('aria-label')).toBe('settings');
187
- });
188
-
189
- // ─── F11-bis edge cases: divider with array / null / mixed children ─
190
- describe('divider edge cases', () => {
191
- it('children passed as an array still gets N-1 dividers', () => {
192
- // Children.toArray handles arrays the same as iterated siblings —
193
- // the divider count is items.length - 1 regardless of how the
194
- // children were passed in.
195
- const items = ['a', 'b', 'c', 'd'];
196
- const { container } = render(
197
- <Stack divider={<hr data-testid="div" />}>
198
- {items.map((t) => <span key={t}>{t}</span>)}
199
- </Stack>,
200
- );
201
- expect(container.querySelectorAll('[data-testid="div"]').length).toBe(3);
202
- });
203
-
204
- it('null children are stripped before divider insertion', () => {
205
- // React's Children.toArray filters out null/undefined/false before
206
- // returning the flat array — so a conditional child collapses to
207
- // nothing and dividers are sized to the remaining set.
208
- const showB = false;
209
- const { container } = render(
210
- <Stack divider={<hr data-testid="div" />}>
211
- <span>a</span>
212
- {showB && <span>b</span>}
213
- <span>c</span>
214
- </Stack>,
215
- );
216
- // After stripping `false`: 2 effective children → 1 divider
217
- expect(container.querySelectorAll('[data-testid="div"]').length).toBe(1);
218
- });
219
-
220
- it('mixed text + element children — divider between EVERY pair', () => {
221
- const { container } = render(
222
- <Stack divider={<hr data-testid="div" />}>
223
- {'plain string'}
224
- <span>element child</span>
225
- {42}
226
- <span>last</span>
227
- </Stack>,
228
- );
229
- // 4 effective children (Children.toArray wraps primitives) → 3 dividers
230
- expect(container.querySelectorAll('[data-testid="div"]').length).toBe(3);
231
- });
232
-
233
- it('nested Stack inside Stack with divider — inner Stack counts as 1 child', () => {
234
- const { container } = render(
235
- <Stack gap={2} divider={<hr data-testid="outer-div" />}>
236
- <span>top</span>
237
- <Stack gap={1} direction="row">
238
- <span>nested-a</span>
239
- <span>nested-b</span>
240
- </Stack>
241
- <span>bottom</span>
242
- </Stack>,
243
- );
244
- // Outer has 3 effective children → 2 outer dividers
245
- expect(container.querySelectorAll('[data-testid="outer-div"]').length).toBe(2);
246
- });
247
-
248
- it('divider key is stable across re-renders (no key warning)', () => {
249
- // Re-rendering with the same children + divider shouldn't produce
250
- // React key warnings. We assert nothing throws + the structure is
251
- // identical to a single render.
252
- const { container, rerender } = render(
253
- <Stack divider={<hr data-testid="d" />}>
254
- <span>a</span>
255
- <span>b</span>
256
- </Stack>,
257
- );
258
- const firstRender = container.innerHTML;
259
- rerender(
260
- <Stack divider={<hr data-testid="d" />}>
261
- <span>a</span>
262
- <span>b</span>
263
- </Stack>,
264
- );
265
- expect(container.innerHTML).toBe(firstRender);
266
- });
267
- });
268
-
269
- // ─── F11-bis edge cases: gap value coverage ─────────────────────────
270
- describe('gap — every token step', () => {
271
- const GAPS = [0, '0.5', 1, 2, 3, 4, 6, 8, 12, 16, 24] as const;
272
- it.each(GAPS)('gap=%s emits gap-%s', (g) => {
273
- const { container } = render(<Stack gap={g}>x</Stack>);
274
- expect(container.firstElementChild?.className).toContain(`gap-${g}`);
275
- });
276
- });
277
-
278
- // ─── F11-bis edge cases: align / justify all values ─────────────────
279
- describe('align + justify — all valid values', () => {
280
- const ALIGNS = ['start', 'center', 'end', 'stretch', 'baseline'] as const;
281
- const JUSTIFIES = ['start', 'center', 'end', 'between', 'around', 'evenly'] as const;
282
-
283
- it.each(ALIGNS)('align="%s"', (v) => {
284
- const { container } = render(<Stack align={v}>x</Stack>);
285
- expect(container.firstElementChild?.className).toContain(`items-${v}`);
286
- });
287
-
288
- it.each(JUSTIFIES)('justify="%s"', (v) => {
289
- const { container } = render(<Stack justify={v}>x</Stack>);
290
- expect(container.firstElementChild?.className).toContain(`justify-${v}`);
291
- });
292
- });
293
-
294
- // ─── F11-bis edge cases: empty Stack ────────────────────────────────
295
- describe('empty Stack', () => {
296
- it('renders an empty div with flex classes', () => {
297
- const { container } = render(<Stack gap={4} />);
298
- const el = container.firstElementChild;
299
- expect(el?.children.length).toBe(0);
300
- expect(el?.className).toContain('flex');
301
- expect(el?.className).toContain('gap-4');
302
- });
303
-
304
- it('empty Stack with divider does NOT render the divider', () => {
305
- const { container } = render(<Stack divider={<hr data-testid="d" />} />);
306
- expect(container.querySelectorAll('[data-testid="d"]').length).toBe(0);
307
- });
308
- });
309
- });
@@ -1,115 +0,0 @@
1
- import {
2
- Children,
3
- Fragment,
4
- cloneElement,
5
- forwardRef,
6
- isValidElement,
7
- type ElementType,
8
- type ReactElement,
9
- type ReactNode,
10
- } from 'react';
11
- import { Slot } from '@radix-ui/react-slot';
12
- import { cn } from '../../utils/cn.js';
13
- import { stackVariants } from './stack.variants.js';
14
- import type { StackProps } from './stack.types.js';
15
-
16
- /**
17
- * Walk the children, inserting `divider` BETWEEN every consecutive pair.
18
- *
19
- * Implementation notes:
20
- * • `React.Children.toArray` assigns auto-keys but does NOT recursively
21
- * flatten Fragments — it treats them as opaque single children. So
22
- * `<Stack><><a/><b/></><c/></Stack>` is 2 boundaries (fragment + c),
23
- * yielding ONE divider. Hoist items out of the fragment when you
24
- * need a divider between them. Documented + asserted in the tests.
25
- * • Dividers are wrapped in `<Fragment>` with a deterministic key
26
- * derived from the boundary index — stable across re-renders so
27
- * React reconciles correctly when children re-order.
28
- * • If `divider` is a valid element, we `cloneElement` once per
29
- * boundary (cheaper than re-rendering the JSX expression N-1 times).
30
- * For string/number dividers we wrap in a span automatically.
31
- */
32
- function interleaveDividers(children: ReactNode, divider: ReactNode): ReactNode[] {
33
- const items = Children.toArray(children);
34
- if (items.length <= 1) return items;
35
-
36
- const result: ReactNode[] = [];
37
- items.forEach((child, i) => {
38
- result.push(child);
39
- if (i < items.length - 1) {
40
- const key = `df-stack-divider-${i}`;
41
- if (isValidElement(divider)) {
42
- result.push(cloneElement(divider as ReactElement<{ key?: string }>, { key }));
43
- } else {
44
- result.push(<Fragment key={key}>{divider}</Fragment>);
45
- }
46
- }
47
- });
48
- return result;
49
- }
50
-
51
- /**
52
- * `<Stack>` — flex container 1D, the layout primitive.
53
- *
54
- * This is the ONLY component in @dashforge/tw that does flex. Box
55
- * doesn't, Grid does CSS Grid (not flex). The strict naming → engine
56
- * mapping is the whole point: when you read `<Stack>` in a JSX tree,
57
- * you instantly know it's flex. No `<Box display="flex" ...>` traps.
58
- *
59
- * Direction defaults to `'col'` (vertical stack) — the most common
60
- * case for forms, sidebars, settings panels. Pass `direction="row"`
61
- * for horizontal layouts (toolbars, button rows, breadcrumbs).
62
- *
63
- * The `divider` prop is the runtime-only piece: TV can't encode the
64
- * "render this between each child" logic as a class, so we walk the
65
- * children at render time. The walk is O(n); for n ≤ ~10 (typical
66
- * Stack content) the cost is negligible. For very long Stacks (1000+
67
- * items), prefer to render dividers as part of each child instead.
68
- *
69
- * When `asChild` is true, the divider prop is silently ignored — Slot
70
- * requires a single child, and the N-1 insertion has nowhere to act.
71
- */
72
- export const Stack = forwardRef<HTMLElement, StackProps>(
73
- function Stack(props, ref) {
74
- const {
75
- direction,
76
- align,
77
- justify,
78
- gap,
79
- wrap,
80
- fullWidth,
81
- fullHeight,
82
- divider,
83
- as,
84
- asChild = false,
85
- sx,
86
- children,
87
- ...rest
88
- } = props;
89
-
90
- const classes = cn(
91
- stackVariants({ direction, align, justify, gap, wrap, fullWidth, fullHeight }),
92
- sx,
93
- );
94
-
95
- if (asChild) {
96
- // Slot expects a single child; divider has no place here.
97
- return (
98
- <Slot ref={ref} className={classes} {...rest}>
99
- {children as ReactElement}
100
- </Slot>
101
- );
102
- }
103
-
104
- const Tag = (as ?? 'div') as ElementType;
105
- const content = divider != null ? interleaveDividers(children, divider) : children;
106
-
107
- return (
108
- <Tag ref={ref as never} className={classes} {...rest}>
109
- {content}
110
- </Tag>
111
- );
112
- },
113
- );
114
-
115
- Stack.displayName = 'Stack';
@@ -1,68 +0,0 @@
1
- import type { ElementType, HTMLAttributes, ReactNode } from 'react';
2
- import type { StackVariants } from './stack.variants.js';
3
-
4
- /**
5
- * Props for `<Stack>` — flex container 1D, the layout primitive.
6
- *
7
- * Axes:
8
- * • direction — flex-direction (default 'col')
9
- * • align — items-* (cross-axis)
10
- * • justify — justify-* (main-axis)
11
- * • gap — token-scale spacing step
12
- * • wrap — flex-wrap
13
- * • fullWidth/fullHeight — w-full / h-full
14
- * • divider — node rendered N-1 times between children
15
- *
16
- * Polymorphism:
17
- * • as — override the HTML tag (default 'div')
18
- * • asChild — render via Radix Slot onto the single child
19
- *
20
- * What Stack does NOT do (route to other primitives):
21
- * • Surface chrome (border, bg, shadow) → wrap in <Box>
22
- * • 2D layout (rows AND columns) → use <Grid>
23
- * • Text styling → <Typography>
24
- */
25
- export interface StackProps
26
- extends Omit<HTMLAttributes<HTMLDivElement>, 'className'>,
27
- Pick<StackVariants,
28
- 'direction' | 'align' | 'justify' | 'gap' | 'wrap'
29
- | 'fullWidth' | 'fullHeight'> {
30
- /**
31
- * Node rendered N-1 times BETWEEN children — mirror of MUI Stack's
32
- * divider prop. Useful for visual separators (a `<hr>`, a thin
33
- * `<Box variant="outlined" sx="h-px border-0 border-t">`, an
34
- * `<svg>` glyph) that need to follow the flex direction.
35
- *
36
- * The node is cloned for each insertion via `cloneElement`; pass a
37
- * stable element (not a function) for best React reconciliation.
38
- * `React.Children.toArray` flattens fragments before the walk, so
39
- * `<Stack divider={...}><><...></></Stack>` works as expected.
40
- */
41
- divider?: ReactNode;
42
-
43
- /**
44
- * Override the rendered HTML tag. Defaults to `'div'`. Use when the
45
- * Stack also has semantic meaning — `<Stack as="nav">` for a nav
46
- * bar, `<Stack as="ul">` for a list (children become `<li>` via
47
- * native HTML, not by us).
48
- *
49
- * Ignored when `asChild` is true.
50
- */
51
- as?: ElementType;
52
-
53
- /**
54
- * Render via Radix `Slot` — the Stack styles paint onto the single
55
- * React child instead of wrapping it. Mutually exclusive with `as`
56
- * (when both are passed, `asChild` wins). The `divider` prop is
57
- * ignored when `asChild` is true (the Slot pattern wraps a single
58
- * node, so the N-1 insertion logic has no place to act).
59
- */
60
- asChild?: boolean;
61
-
62
- /**
63
- * Utility classes appended to the variant chain. Resolved via
64
- * `tailwind-merge` so the consumer's classes always win over the
65
- * variant defaults.
66
- */
67
- sx?: string;
68
- }
@@ -1,80 +0,0 @@
1
- import { tv, type VariantProps } from 'tailwind-variants';
2
-
3
- /**
4
- * `stackVariants` — flex container 1D, the layout primitive of @dashforge/tw.
5
- *
6
- * Architectural role (planned with the user — F9 deep dive):
7
- *
8
- * Stack is the ONLY way to do flex in this library. Box is the
9
- * surface (border / bg / shadow); Stack is the arrangement (direction
10
- * / align / justify / gap). Two primitives, two responsibilities,
11
- * zero overlap.
12
- *
13
- * This rules out the MUI failure mode where every `<Box display="flex"
14
- * gap={2}>` quietly becomes the de-facto flex container, drowning
15
- * the surface vs layout distinction. Here, if you see `<Stack>` in
16
- * the JSX, you KNOW it's flex; if you see `<Box>`, you KNOW it's
17
- * not. The component name carries the intent.
18
- *
19
- * Axes:
20
- * • direction — row / col (+ reverse variants)
21
- * • align / justify — cross-axis / main-axis alignment
22
- * • gap — token-scale step (mirror Box spacing scale)
23
- * • wrap — flex-wrap
24
- * • divider — runtime-only (handled in Stack.tsx, not here)
25
- *
26
- * Sizing (`fullWidth`, `fullHeight`) is duplicated from Box because
27
- * Stack often plays the role of a full-width strip / full-height
28
- * column — re-typing `sx="w-full"` every time would be friction.
29
- */
30
- export const stackVariants = tv({
31
- base: 'flex',
32
-
33
- variants: {
34
- direction: {
35
- row: 'flex-row',
36
- col: 'flex-col',
37
- 'row-reverse': 'flex-row-reverse',
38
- 'col-reverse': 'flex-col-reverse',
39
- },
40
-
41
- align: {
42
- start: 'items-start',
43
- center: 'items-center',
44
- end: 'items-end',
45
- stretch: 'items-stretch',
46
- baseline: 'items-baseline',
47
- },
48
-
49
- justify: {
50
- start: 'justify-start',
51
- center: 'justify-center',
52
- end: 'justify-end',
53
- between: 'justify-between',
54
- around: 'justify-around',
55
- evenly: 'justify-evenly',
56
- },
57
-
58
- /*
59
- * `gap` — explicit literal mapping for the 11 token-scale steps.
60
- * Same set as Box's spacing axes (p, m, etc.) so muscle memory
61
- * carries over: `<Stack gap={4}>` aligns visually with `<Box p={4}>`.
62
- */
63
- gap: {
64
- 0: 'gap-0', '0.5': 'gap-0.5', 1: 'gap-1', 2: 'gap-2', 3: 'gap-3',
65
- 4: 'gap-4', 6: 'gap-6', 8: 'gap-8', 12: 'gap-12', 16: 'gap-16',
66
- 24: 'gap-24',
67
- },
68
-
69
- wrap: { true: 'flex-wrap' },
70
-
71
- fullWidth: { true: 'w-full' },
72
- fullHeight: { true: 'h-full' },
73
- },
74
-
75
- defaultVariants: {
76
- direction: 'col',
77
- },
78
- });
79
-
80
- export type StackVariants = VariantProps<typeof stackVariants>;