@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,116 +0,0 @@
1
- import { tv, type VariantProps } from 'tailwind-variants';
2
-
3
- /**
4
- * `dividerVariants` — visual separator with two rendering modes (line-only
5
- * vs labeled). Two interconnected TV recipes:
6
- *
7
- * • `dividerVariants` — root container (block layout, alignment)
8
- * • `dividerLineVariants` — the actual line segments (border style,
9
- * color, orientation)
10
- *
11
- * Two recipes (not one with slots) because the labeled mode renders
12
- * THREE elements (left line · label · right line) while the line-only
13
- * mode is ONE element. Splitting keeps each TV catalogue small and
14
- * the type unions narrow.
15
- *
16
- * Mental model:
17
- * • Without `children` → renders an `<hr>` (or a div if vertical)
18
- * with the line styles applied directly.
19
- * • With `children` → renders a flex row with two `<span>` line
20
- * segments either side of the label. The label's flex-shrink keeps
21
- * it from being squashed; the line segments share the remaining
22
- * space according to `align`.
23
- *
24
- * a11y: the root always carries `role="separator"` + `aria-orientation`
25
- * — handled in Divider.tsx, not in TV (it's a prop, not a class).
26
- */
27
-
28
- /*
29
- * Root container — only relevant when label is present (flex layout).
30
- * For line-only, the root IS the line.
31
- */
32
- export const dividerVariants = tv({
33
- base: 'flex items-center',
34
-
35
- variants: {
36
- orientation: {
37
- horizontal: 'w-full',
38
- vertical: 'h-full flex-col',
39
- },
40
-
41
- /*
42
- * Label alignment along the divider's main axis. Implemented by
43
- * setting the flex-basis of the two line segments asymmetrically
44
- * — handled in the variants for `dividerLineVariants` below via
45
- * compound logic. The root just needs the flex layout.
46
- */
47
- align: {
48
- start: '',
49
- center: '',
50
- end: '',
51
- },
52
- },
53
-
54
- defaultVariants: {
55
- orientation: 'horizontal',
56
- align: 'center',
57
- },
58
- });
59
-
60
- export type DividerVariants = VariantProps<typeof dividerVariants>;
61
-
62
- /*
63
- * Line segment(s).
64
- *
65
- * Border styles (solid/dashed/dotted) are applied as `border-t-{style}`
66
- * for horizontal, `border-l-{style}` for vertical. Color drives the
67
- * border-* color token to the intent.
68
- *
69
- * The `segment` axis distinguishes whether this is a line-only render
70
- * (full width) vs a labeled-mode segment (flex-1 grows to share space).
71
- */
72
- export const dividerLineVariants = tv({
73
- base: '',
74
-
75
- variants: {
76
- orientation: {
77
- horizontal: 'h-0 border-t',
78
- vertical: 'w-0 border-l self-stretch',
79
- },
80
-
81
- variant: {
82
- solid: 'border-solid',
83
- dashed: 'border-dashed',
84
- dotted: 'border-dotted',
85
- },
86
-
87
- color: {
88
- // Neutral palette auto-inverts via CSS-var swap (no `dark:`).
89
- neutral: 'border-neutral-200',
90
- primary: 'border-primary-300 dark:border-primary-700',
91
- secondary: 'border-secondary-300 dark:border-secondary-700',
92
- success: 'border-success-300 dark:border-success-700',
93
- warning: 'border-warning-300 dark:border-warning-700',
94
- danger: 'border-danger-300 dark:border-danger-700',
95
- info: 'border-info-300 dark:border-info-700',
96
- },
97
-
98
- /*
99
- * `segment` controls whether the line spans full width (line-only
100
- * mode) or grows to fill space (labeled-mode flex segment).
101
- */
102
- segment: {
103
- full: 'w-full',
104
- grow: 'flex-1',
105
- },
106
- },
107
-
108
- defaultVariants: {
109
- orientation: 'horizontal',
110
- variant: 'solid',
111
- color: 'neutral',
112
- segment: 'full',
113
- },
114
- });
115
-
116
- export type DividerLineVariants = VariantProps<typeof dividerLineVariants>;
@@ -1,321 +0,0 @@
1
- // @vitest-environment jsdom
2
- import { describe, it, expect } from 'vitest';
3
- import { render } from '@testing-library/react';
4
- import { Grid } from './Grid.js';
5
-
6
- /**
7
- * Suite covers:
8
- * • Container role — display:grid + cols + spacing + autoFlow
9
- * • Item role — col-span at xs/sm/md/lg/xl breakpoints
10
- * • Default semantics — container without cols → 12; item without xs → 'full'
11
- * • Polymorphism — as / asChild on both roles
12
- * • Override — sx wins over variant defaults
13
- *
14
- * We don't enumerate every breakpoint × span (5 × 14 = 70 combos);
15
- * spot-checks across xs/md/xl with span 6/auto/full cover the
16
- * cascade. If those work, the rest works.
17
- */
18
- describe('<Grid>', () => {
19
- // ─── Container role ─────────────────────────────────────────────────
20
- describe('container', () => {
21
- it('renders display:grid + default cols=12', () => {
22
- const { container } = render(<Grid container>x</Grid>);
23
- const cls = container.firstElementChild?.className ?? '';
24
- expect(cls).toContain('grid');
25
- expect(cls).toContain('grid-cols-12');
26
- });
27
-
28
- it('container with cols={6}', () => {
29
- const { container } = render(<Grid container cols={6}>x</Grid>);
30
- expect(container.firstElementChild?.className).toContain('grid-cols-6');
31
- });
32
-
33
- it('spacing={4} emits gap-4', () => {
34
- const { container } = render(<Grid container spacing={4}>x</Grid>);
35
- expect(container.firstElementChild?.className).toContain('gap-4');
36
- });
37
-
38
- it('spacingX + spacingY emit gap-x / gap-y', () => {
39
- const { container } = render(
40
- <Grid container spacingX={6} spacingY={2}>x</Grid>,
41
- );
42
- const cls = container.firstElementChild?.className ?? '';
43
- expect(cls).toContain('gap-x-6');
44
- expect(cls).toContain('gap-y-2');
45
- });
46
-
47
- it('autoFlow="dense"', () => {
48
- const { container } = render(<Grid container autoFlow="dense">x</Grid>);
49
- expect(container.firstElementChild?.className).toContain('grid-flow-dense');
50
- });
51
- });
52
-
53
- // ─── Item role ──────────────────────────────────────────────────────
54
- describe('item', () => {
55
- it('item without props defaults to col-span-full (xs="full")', () => {
56
- const { container } = render(<Grid>x</Grid>);
57
- const cls = container.firstElementChild?.className ?? '';
58
- expect(cls).toContain('col-span-full');
59
- // never accidentally a container
60
- expect(cls).not.toContain('grid-cols-12');
61
- // confirm it's NOT display:grid (no `grid` class)
62
- expect(cls.split(' ')).not.toContain('grid');
63
- });
64
-
65
- it('item xs={6}', () => {
66
- const { container } = render(<Grid xs={6}>x</Grid>);
67
- expect(container.firstElementChild?.className).toContain('col-span-6');
68
- });
69
-
70
- it('item with responsive cascade xs={12} md={6} lg={4}', () => {
71
- const { container } = render(<Grid xs={12} md={6} lg={4}>x</Grid>);
72
- const cls = container.firstElementChild?.className ?? '';
73
- expect(cls).toContain('col-span-12');
74
- expect(cls).toContain('md:col-span-6');
75
- expect(cls).toContain('lg:col-span-4');
76
- });
77
-
78
- it('item xs="auto"', () => {
79
- const { container } = render(<Grid xs="auto">x</Grid>);
80
- expect(container.firstElementChild?.className).toContain('col-auto');
81
- });
82
-
83
- it('item sm="full" xl={3}', () => {
84
- const { container } = render(<Grid sm="full" xl={3}>x</Grid>);
85
- const cls = container.firstElementChild?.className ?? '';
86
- expect(cls).toContain('sm:col-span-full');
87
- expect(cls).toContain('xl:col-span-3');
88
- });
89
- });
90
-
91
- // ─── Composition: container > item ──────────────────────────────────
92
- describe('container > item composition', () => {
93
- it('container with item children produces the canonical class chain', () => {
94
- const { container } = render(
95
- <Grid container spacing={4}>
96
- <Grid xs={12} md={6}>a</Grid>
97
- <Grid xs={12} md={6}>b</Grid>
98
- </Grid>,
99
- );
100
- const root = container.firstElementChild;
101
- expect(root?.className).toContain('grid');
102
- expect(root?.className).toContain('gap-4');
103
- const items = root?.querySelectorAll(':scope > div') ?? [];
104
- expect(items.length).toBe(2);
105
- items.forEach((item) => {
106
- expect(item.className).toContain('col-span-12');
107
- expect(item.className).toContain('md:col-span-6');
108
- });
109
- });
110
- });
111
-
112
- // ─── Override + sx ──────────────────────────────────────────────────
113
- describe('override', () => {
114
- it('sx wins over default cols on container', () => {
115
- const { container } = render(
116
- <Grid container sx="grid-cols-4">x</Grid>,
117
- );
118
- const cls = container.firstElementChild?.className ?? '';
119
- expect(cls).toContain('grid-cols-4');
120
- // tailwind-merge collapses the default 12 → 4
121
- expect(cls).not.toContain('grid-cols-12');
122
- });
123
-
124
- it('sx adds utilities Grid does not expose', () => {
125
- const { container } = render(<Grid container sx="min-h-screen">x</Grid>);
126
- expect(container.firstElementChild?.className).toContain('min-h-screen');
127
- });
128
- });
129
-
130
- // ─── Polymorphism ───────────────────────────────────────────────────
131
- describe('polymorphism', () => {
132
- it('container as="section" renders <section> + grid classes', () => {
133
- const { container } = render(<Grid container as="section">x</Grid>);
134
- const el = container.firstElementChild;
135
- expect(el?.tagName).toBe('SECTION');
136
- expect(el?.className).toContain('grid');
137
- });
138
-
139
- it('item asChild paints onto child element', () => {
140
- const { container } = render(
141
- <Grid xs={6} asChild>
142
- <article>x</article>
143
- </Grid>,
144
- );
145
- const el = container.firstElementChild;
146
- expect(el?.tagName).toBe('ARTICLE');
147
- expect(el?.className).toContain('col-span-6');
148
- });
149
- });
150
-
151
- // ─── DOM cleanliness (no role-specific props leak as HTML attrs) ────
152
- describe('DOM cleanliness', () => {
153
- it('container props (cols/spacing/autoFlow) do not leak to DOM', () => {
154
- const { container } = render(
155
- <Grid container cols={4} spacing={2} autoFlow="dense">x</Grid>,
156
- );
157
- const el = container.firstElementChild as HTMLElement;
158
- expect(el.hasAttribute('cols')).toBe(false);
159
- expect(el.hasAttribute('spacing')).toBe(false);
160
- expect(el.hasAttribute('autoflow')).toBe(false);
161
- });
162
-
163
- it('item props (xs/sm/md/lg/xl) do not leak to DOM', () => {
164
- const { container } = render(
165
- <Grid xs={12} md={6} lg={4}>x</Grid>,
166
- );
167
- const el = container.firstElementChild as HTMLElement;
168
- expect(el.hasAttribute('xs')).toBe(false);
169
- expect(el.hasAttribute('md')).toBe(false);
170
- expect(el.hasAttribute('lg')).toBe(false);
171
- });
172
- });
173
-
174
- // ─── F11-bis edge cases: responsive cascade across ALL breakpoints ──
175
- // The original suite spot-checked xs/md/lg/sm/xl with a couple of
176
- // values each. The publish-validation pass enumerates each breakpoint
177
- // for the high-traffic span values (1, 6, 12, auto, full) so a future
178
- // mapping-table edit can't silently drop one.
179
- describe('responsive cascade — every breakpoint × representative span', () => {
180
- const BREAKPOINTS = ['sm', 'md', 'lg', 'xl'] as const;
181
-
182
- it.each(BREAKPOINTS)('breakpoint %s × span=1', (bp) => {
183
- const props = { [bp]: 1 as const };
184
- const { container } = render(<Grid {...props}>x</Grid>);
185
- expect(container.firstElementChild?.className).toContain(`${bp}:col-span-1`);
186
- });
187
-
188
- it.each(BREAKPOINTS)('breakpoint %s × span=6', (bp) => {
189
- const props = { [bp]: 6 as const };
190
- const { container } = render(<Grid {...props}>x</Grid>);
191
- expect(container.firstElementChild?.className).toContain(`${bp}:col-span-6`);
192
- });
193
-
194
- it.each(BREAKPOINTS)('breakpoint %s × span=12', (bp) => {
195
- const props = { [bp]: 12 as const };
196
- const { container } = render(<Grid {...props}>x</Grid>);
197
- expect(container.firstElementChild?.className).toContain(`${bp}:col-span-12`);
198
- });
199
-
200
- it.each(BREAKPOINTS)('breakpoint %s × auto', (bp) => {
201
- const props = { [bp]: 'auto' as const };
202
- const { container } = render(<Grid {...props}>x</Grid>);
203
- expect(container.firstElementChild?.className).toContain(`${bp}:col-auto`);
204
- });
205
-
206
- it.each(BREAKPOINTS)('breakpoint %s × full', (bp) => {
207
- const props = { [bp]: 'full' as const };
208
- const { container } = render(<Grid {...props}>x</Grid>);
209
- expect(container.firstElementChild?.className).toContain(`${bp}:col-span-full`);
210
- });
211
-
212
- it('full cascade xs=12 sm=6 md=4 lg=3 xl=2 emits all five', () => {
213
- const { container } = render(
214
- <Grid xs={12} sm={6} md={4} lg={3} xl={2}>x</Grid>,
215
- );
216
- const cls = container.firstElementChild?.className ?? '';
217
- expect(cls).toContain('col-span-12');
218
- expect(cls).toContain('sm:col-span-6');
219
- expect(cls).toContain('md:col-span-4');
220
- expect(cls).toContain('lg:col-span-3');
221
- expect(cls).toContain('xl:col-span-2');
222
- });
223
- });
224
-
225
- // ─── F11-bis edge cases: autoFlow all five varianti ─────────────────
226
- describe('autoFlow — every value', () => {
227
- const FLOWS = ['row', 'col', 'dense', 'row-dense', 'col-dense'] as const;
228
- const EXPECTED: Record<typeof FLOWS[number], string> = {
229
- row: 'grid-flow-row',
230
- col: 'grid-flow-col',
231
- dense: 'grid-flow-dense',
232
- 'row-dense': 'grid-flow-row-dense',
233
- 'col-dense': 'grid-flow-col-dense',
234
- };
235
-
236
- it.each(FLOWS)('autoFlow="%s" emits the right grid-flow-* class', (flow) => {
237
- const { container } = render(<Grid container autoFlow={flow}>x</Grid>);
238
- expect(container.firstElementChild?.className).toContain(EXPECTED[flow]);
239
- });
240
- });
241
-
242
- // ─── F11-bis edge cases: container cols all valid values ────────────
243
- describe('cols — every valid value', () => {
244
- const COLS = [1, 2, 3, 4, 6, 12] as const;
245
- it.each(COLS)('container cols=%s emits grid-cols-%s', (n) => {
246
- const { container } = render(<Grid container cols={n}>x</Grid>);
247
- expect(container.firstElementChild?.className).toContain(`grid-cols-${n}`);
248
- });
249
- });
250
-
251
- // ─── F11-bis edge cases: spacingX vs spacingY independence ──────────
252
- describe('spacingX / spacingY independence', () => {
253
- it('spacingX without spacingY emits only gap-x', () => {
254
- const { container } = render(<Grid container spacingX={4}>x</Grid>);
255
- const cls = container.firstElementChild?.className ?? '';
256
- expect(cls).toContain('gap-x-4');
257
- expect(cls).not.toMatch(/gap-y-/);
258
- // standalone `gap-` shouldn't appear unless spacing was passed
259
- expect(cls).not.toMatch(/gap-\d/);
260
- });
261
-
262
- it('spacingY without spacingX emits only gap-y', () => {
263
- const { container } = render(<Grid container spacingY={2}>x</Grid>);
264
- const cls = container.firstElementChild?.className ?? '';
265
- expect(cls).toContain('gap-y-2');
266
- expect(cls).not.toMatch(/gap-x-/);
267
- });
268
-
269
- it('spacing + spacingX: spacing applies symmetrically, spacingX overrides on X', () => {
270
- const { container } = render(
271
- <Grid container spacing={4} spacingX={8}>x</Grid>,
272
- );
273
- const cls = container.firstElementChild?.className ?? '';
274
- expect(cls).toContain('gap-4');
275
- expect(cls).toContain('gap-x-8');
276
- });
277
- });
278
-
279
- // ─── F11-bis edge cases: empty container / orphan item ──────────────
280
- describe('empty children + orphan item', () => {
281
- it('container with NO children emits grid + cols, renders empty div', () => {
282
- const { container } = render(<Grid container />);
283
- const el = container.firstElementChild as HTMLElement;
284
- expect(el.className).toContain('grid');
285
- expect(el.className).toContain('grid-cols-12');
286
- expect(el.children.length).toBe(0);
287
- });
288
-
289
- it('orphan item (no container parent) still emits col-span-* (consumer mistake)', () => {
290
- // Doesn't crash — produces a col-span-* class that has no effect
291
- // outside a CSS Grid parent. Documented behaviour: the consumer
292
- // owns the composition.
293
- const { container } = render(<Grid xs={6}>x</Grid>);
294
- expect(container.firstElementChild?.className).toContain('col-span-6');
295
- });
296
- });
297
-
298
- // ─── F11-bis edge cases: composition deep nesting ───────────────────
299
- describe('deep nesting — Grid inside Grid item', () => {
300
- it('nested Grid container inside an item works (12-col inside a 6-span)', () => {
301
- const { container } = render(
302
- <Grid container spacing={4}>
303
- <Grid xs={6}>
304
- <Grid container spacing={2}>
305
- <Grid xs={6}>inner-a</Grid>
306
- <Grid xs={6}>inner-b</Grid>
307
- </Grid>
308
- </Grid>
309
- <Grid xs={6}>outer-b</Grid>
310
- </Grid>,
311
- );
312
- // Outer: grid + 12-col + gap-4
313
- const outer = container.firstElementChild;
314
- expect(outer?.className).toContain('grid');
315
- expect(outer?.className).toContain('grid-cols-12');
316
- expect(outer?.className).toContain('gap-4');
317
- // Inner items count: outer has 2 direct children
318
- expect(outer?.children.length).toBe(2);
319
- });
320
- });
321
- });
@@ -1,148 +0,0 @@
1
- import { forwardRef, type ElementType, type ReactElement } from 'react';
2
- import { Slot } from '@radix-ui/react-slot';
3
- import { cn } from '../../utils/cn.js';
4
- import { gridVariants } from './grid.variants.js';
5
- import type {
6
- GridProps,
7
- GridContainerProps,
8
- GridItemProps,
9
- ColSpan,
10
- GridSpacingStep,
11
- } from './grid.types.js';
12
-
13
- /**
14
- * `<Grid>` — CSS Grid container + item, polymorphic in role.
15
- *
16
- * API surface mirrors MUI Grid v2:
17
- * • <Grid container spacing={4} cols={12}> ← container
18
- * • <Grid xs={12} md={6}> ← item
19
- *
20
- * Engine is REAL CSS Grid (not flexbox, unlike MUI v2 internals).
21
- * Benefits over flexbox-based implementation:
22
- * • Native `gap` (no negative-margin tricks)
23
- * • `col-span-N` maps directly to `grid-column: span N`
24
- * • Vertical alignment without manual `align-items` per item
25
- * • Auto-flow for dense packing without DOM gymnastics
26
- *
27
- * TypeScript discriminated union (see grid.types.ts) makes mixing
28
- * impossible: `<Grid container xs={6}>` won't compile. Same for the
29
- * inverse. IntelliSense filters by role.
30
- *
31
- * Defaults at the component level (not at the TV level — see the
32
- * variants file for the rationale):
33
- * • container: cols defaults to 12 (MUI convention)
34
- * • item: xs defaults to 'full' so a forgotten prop doesn't
35
- * collapse the cell to 1/12th of a row
36
- *
37
- * `asChild` on a CONTAINER is technically allowed but rarely useful:
38
- * `display:grid` only applies to direct children, so the slotted
39
- * element has to already be a viable container parent. Use sparingly;
40
- * test asserts the wrapping still emits the right class chain.
41
- */
42
- export const Grid = forwardRef<HTMLElement, GridProps>(
43
- function Grid(props, ref) {
44
- const { as, asChild = false, sx, children, ...rest } = props as GridProps & {
45
- as?: ElementType;
46
- asChild?: boolean;
47
- sx?: string;
48
- children?: React.ReactNode;
49
- };
50
- /*
51
- * Discriminated union runtime branch.
52
- *
53
- * TS narrows GridProps to ONE of the two shapes (container or item)
54
- * at the call site, but inside this function body we receive the
55
- * union — so we manually narrow via a single cast per branch.
56
- * `as GridContainerProps` / `as GridItemProps` is sound because
57
- * `container === true` is the literal discriminator declared in
58
- * the types file; the cast just makes TS read the right branch.
59
- */
60
- const isContainer = (props as { container?: boolean }).container === true;
61
-
62
- let classes: string;
63
- let containerPayload: GridContainerProps | null = null;
64
- let itemPayload: GridItemProps | null = null;
65
-
66
- if (isContainer) {
67
- containerPayload = props as GridContainerProps;
68
- /*
69
- * Container branch — pass ONLY container axes to TV. Default cols
70
- * to 12 (MUI v2 convention) so a forgotten prop doesn't collapse
71
- * to grid-cols-1. The spacing axes are passed straight through;
72
- * TV silently drops undefined values.
73
- */
74
- classes = cn(
75
- gridVariants({
76
- container: true,
77
- cols: (containerPayload.cols ?? 12) as 1 | 2 | 3 | 4 | 6 | 12,
78
- spacing: containerPayload.spacing,
79
- spacingX: containerPayload.spacingX,
80
- spacingY: containerPayload.spacingY,
81
- autoFlow: containerPayload.autoFlow,
82
- }),
83
- sx,
84
- );
85
- } else {
86
- itemPayload = props as GridItemProps;
87
- /*
88
- * Item branch — default `xs` to 'full' so a forgotten breakpoint
89
- * prop doesn't collapse the cell to grid-auto's minimum width.
90
- */
91
- classes = cn(
92
- gridVariants({
93
- xs: (itemPayload.xs ?? 'full') as ColSpan,
94
- sm: itemPayload.sm,
95
- md: itemPayload.md,
96
- lg: itemPayload.lg,
97
- xl: itemPayload.xl,
98
- }),
99
- sx,
100
- );
101
- }
102
-
103
- /*
104
- * Strip role-specific props from `rest` before spreading on the DOM
105
- * element. Without this, React warns:
106
- * "React does not recognize the `cols` prop on a DOM element"
107
- */
108
- const domRest: Record<string, unknown> = { ...(rest as Record<string, unknown>) };
109
- if (containerPayload) {
110
- delete domRest.cols;
111
- delete domRest.spacing;
112
- delete domRest.spacingX;
113
- delete domRest.spacingY;
114
- delete domRest.autoFlow;
115
- }
116
- if (itemPayload) {
117
- delete domRest.xs;
118
- delete domRest.sm;
119
- delete domRest.md;
120
- delete domRest.lg;
121
- delete domRest.xl;
122
- }
123
- // `container` discriminator itself must never reach the DOM.
124
- delete domRest.container;
125
- // Silence unused vars that the union typings require us to receive.
126
- void itemPayload; void containerPayload;
127
- // The unused-vars helper from grid.types is a type-only import,
128
- // referenced here to keep ESM tree-shake clean — TS handles imports.
129
- void ({} as GridSpacingStep);
130
-
131
- if (asChild) {
132
- return (
133
- <Slot ref={ref} className={classes} {...domRest}>
134
- {children as ReactElement}
135
- </Slot>
136
- );
137
- }
138
-
139
- const Tag = (as ?? 'div') as ElementType;
140
- return (
141
- <Tag ref={ref as never} className={classes} {...domRest}>
142
- {children}
143
- </Tag>
144
- );
145
- },
146
- );
147
-
148
- Grid.displayName = 'Grid';