@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,129 +0,0 @@
1
- // @vitest-environment jsdom
2
- import * as React from 'react';
3
- import { describe, it, expect, afterEach } from 'vitest';
4
- import { render, screen, cleanup } from '@testing-library/react';
5
- import { TopBar } from './TopBar.js';
6
-
7
- void React;
8
- afterEach(() => cleanup());
9
-
10
- describe('<TopBar>', () => {
11
- it('renders as a banner landmark by default (<header>)', () => {
12
- render(<TopBar end={<span>x</span>} />);
13
- expect(screen.getByRole('banner')).toBeTruthy();
14
- });
15
-
16
- it('renders as a plain <div> when asDiv is true', () => {
17
- const { container } = render(<TopBar end={<span>x</span>} asDiv />);
18
- expect(container.querySelector('header')).toBeNull();
19
- expect(container.querySelector('div')).toBeTruthy();
20
- });
21
-
22
- it('renders the start slot', () => {
23
- render(<TopBar start={<button>menu</button>} />);
24
- expect(screen.getByRole('button', { name: 'menu' })).toBeTruthy();
25
- });
26
-
27
- it('renders the center slot', () => {
28
- render(<TopBar center={<span data-testid="c">page</span>} />);
29
- expect(screen.getByTestId('c')).toBeTruthy();
30
- });
31
-
32
- it('renders the end slot', () => {
33
- render(<TopBar end={<button>user</button>} />);
34
- expect(screen.getByRole('button', { name: 'user' })).toBeTruthy();
35
- });
36
-
37
- it('renders children as the center slot when `center` is not provided', () => {
38
- render(
39
- <TopBar>
40
- <span data-testid="child">title</span>
41
- </TopBar>
42
- );
43
- expect(screen.getByTestId('child')).toBeTruthy();
44
- });
45
-
46
- it('prefers explicit `center` over children', () => {
47
- render(
48
- <TopBar center={<span data-testid="explicit-center">c</span>}>
49
- <span data-testid="child">should-not-render</span>
50
- </TopBar>
51
- );
52
- expect(screen.getByTestId('explicit-center')).toBeTruthy();
53
- expect(screen.queryByTestId('child')).toBeNull();
54
- });
55
-
56
- it('does not render start / end wrappers when those props are absent', () => {
57
- const { container } = render(<TopBar center={<span>c</span>} />);
58
- // Inner divs: only the center div is rendered when start/end are
59
- // both undefined (we render `<div>{center ?? children}</div>` always).
60
- expect(container.querySelectorAll('header > div')).toHaveLength(1);
61
- });
62
-
63
- it('applies the sx className to the root', () => {
64
- const { container } = render(
65
- <TopBar center={<span>c</span>} sx="custom-class" />
66
- );
67
- expect(container.querySelector('header.custom-class')).toBeTruthy();
68
- });
69
-
70
- it('renders height variants without throwing', () => {
71
- (['sm', 'md', 'lg'] as const).forEach((h) => {
72
- const { unmount } = render(<TopBar center={<span>c</span>} height={h} />);
73
- expect(screen.getByRole('banner')).toBeTruthy();
74
- unmount();
75
- });
76
- });
77
- });
78
-
79
- describe('<TopBar> performance', () => {
80
- it('mounts in under 20ms', () => {
81
- const t0 = performance.now();
82
- render(
83
- <TopBar
84
- start={<button>start</button>}
85
- center={<span>center</span>}
86
- end={<button>end</button>}
87
- />
88
- );
89
- const t1 = performance.now();
90
- expect(t1 - t0).toBeLessThan(20);
91
- });
92
-
93
- it('renders at most 2 times on mount', () => {
94
- let count = 0;
95
- const Counted = (props: React.ComponentProps<typeof TopBar>) => {
96
- count++;
97
- return <TopBar {...props} />;
98
- };
99
- render(
100
- <Counted
101
- start={<button>s</button>}
102
- center={<span>c</span>}
103
- end={<button>e</button>}
104
- />
105
- );
106
- expect(count).toBeLessThanOrEqual(2);
107
- });
108
-
109
- it('does NOT re-render an unrelated sibling on prop change', () => {
110
- const sibCount = { count: 0 };
111
- const Sibling = () => {
112
- sibCount.count++;
113
- return <div data-testid="sib" />;
114
- };
115
- const Tree = ({ label }: { label: string }) => (
116
- <div>
117
- <TopBar center={<span>{label}</span>} />
118
- <Sibling />
119
- </div>
120
- );
121
- const { rerender } = render(<Tree label="A" />);
122
- const before = sibCount.count;
123
- rerender(<Tree label="B" />);
124
- rerender(<Tree label="C" />);
125
- // Each parent rerender is expected to also re-render the sibling.
126
- // 2 parent rerenders ⇒ ≤ 2 extra sibling renders (+1 tolerance).
127
- expect(sibCount.count - before).toBeLessThanOrEqual(3);
128
- });
129
- });
@@ -1,66 +0,0 @@
1
- import { cn } from '../../utils/cn.js';
2
- import { topBarVariants } from './topBar.variants.js';
3
- import type { TopBarProps } from './topBar.types.js';
4
-
5
- /**
6
- * Dashforge TW TopBar — sticky header with 3 named slots.
7
- *
8
- * Pure composition. Three regions arranged horizontally:
9
- *
10
- * ┌──────────────────────────────────────────────────────────┐
11
- * │ start │ center │ end │
12
- * └──────────────────────────────────────────────────────────┘
13
- *
14
- * - `start` and `end` shrink to content.
15
- * - `center` grows to fill remaining space.
16
- * - If you pass `children` instead of `center`, those children render
17
- * in the center region — handy for terse JSX:
18
- *
19
- * ```tsx
20
- * <TopBar start={<Logo />} end={<UserMenu />}>
21
- * <Breadcrumbs items={trail} />
22
- * </TopBar>
23
- * ```
24
- *
25
- * Default renders as `<header role="banner">` (implicit from
26
- * `<header>` as a top-level landmark). Pass `asDiv` for cases where
27
- * you don't want the banner role (e.g., nested inside another header).
28
- *
29
- * **A11y**:
30
- * - `<header>` is a banner landmark — only one per page; if you put
31
- * multiple TopBars on a page, use `asDiv` on the secondary ones.
32
- * - Slots are agnostic about ARIA — wrap your slot content with
33
- * appropriate roles (`<nav>`, `<search>`, etc.) where needed.
34
- */
35
- export function TopBar(props: TopBarProps) {
36
- const {
37
- start,
38
- center,
39
- end,
40
- children,
41
- height,
42
- sticky,
43
- asDiv,
44
- sx,
45
- slotProps,
46
- } = props;
47
-
48
- const v = topBarVariants({ height, sticky });
49
- const Tag = (asDiv ? 'div' : 'header') as 'header';
50
-
51
- return (
52
- <Tag className={cn(v.root(), sx, slotProps?.root?.className)}>
53
- {(start != null) && (
54
- <div className={cn(v.start(), slotProps?.start?.className)}>
55
- {start}
56
- </div>
57
- )}
58
- <div className={cn(v.center(), slotProps?.center?.className)}>
59
- {center ?? children}
60
- </div>
61
- {(end != null) && (
62
- <div className={cn(v.end(), slotProps?.end?.className)}>{end}</div>
63
- )}
64
- </Tag>
65
- );
66
- }
@@ -1,42 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import type { TopBarVariants } from './topBar.variants.js';
3
-
4
- export interface TopBarSlotProps {
5
- root?: { className?: string };
6
- start?: { className?: string };
7
- center?: { className?: string };
8
- end?: { className?: string };
9
- }
10
-
11
- /**
12
- * Props for `<TopBar>`.
13
- *
14
- * Pure composition container with 3 named slots — `start`, `center`,
15
- * `end` — that fill a sticky horizontal bar.
16
- *
17
- * Typical patterns:
18
- *
19
- * - **start**: mobile menu toggle, brand/logo
20
- * - **center**: Breadcrumbs, page title, global search
21
- * - **end**: notifications icon, user menu, theme toggle
22
- *
23
- * The component is intentionally minimal: it just lays out the three
24
- * regions. All semantics (e.g., `<header role="banner">`) come for
25
- * free from rendering as an HTML `<header>` element.
26
- */
27
- export interface TopBarProps extends TopBarVariants {
28
- /** Left-aligned slot (mobile menu, brand). */
29
- start?: ReactNode;
30
- /** Center slot (breadcrumbs, title). Grows to fill remaining space. */
31
- center?: ReactNode;
32
- /** Right-aligned slot (actions, user menu). */
33
- end?: ReactNode;
34
- /** Convenience: render the bar as a plain `<div>` (no banner role). */
35
- asDiv?: boolean;
36
- /** Root className shortcut. */
37
- sx?: string;
38
- /** Per-slot className overrides. */
39
- slotProps?: TopBarSlotProps;
40
- /** Children render between `start` and `end` when no `center` is set. */
41
- children?: ReactNode;
42
- }
@@ -1,38 +0,0 @@
1
- import { tv, type VariantProps } from 'tailwind-variants';
2
-
3
- /**
4
- * Tailwind-variants recipe for `<TopBar>`.
5
- *
6
- * Slots:
7
- * - `root` — outer `<header>` (or `<div>` with `asDiv`)
8
- * - `start` — left region (shrink-to-content)
9
- * - `center` — middle region (grows to fill)
10
- * - `end` — right region (shrink-to-content)
11
- */
12
- export const topBarVariants = tv({
13
- slots: {
14
- root: [
15
- 'flex items-center gap-3 w-full px-4 shrink-0',
16
- 'bg-neutral-50 border-b border-neutral-200',
17
- ],
18
- start: 'flex items-center gap-2 min-w-0 shrink-0',
19
- center: 'flex items-center gap-2 min-w-0 flex-1',
20
- end: 'flex items-center gap-2 shrink-0',
21
- },
22
- variants: {
23
- height: {
24
- sm: { root: 'h-12 text-sm' },
25
- md: { root: 'h-14' },
26
- lg: { root: 'h-16' },
27
- },
28
- sticky: {
29
- true: { root: 'sticky top-0 z-30' },
30
- },
31
- },
32
- defaultVariants: {
33
- height: 'md',
34
- sticky: true,
35
- },
36
- });
37
-
38
- export type TopBarVariants = VariantProps<typeof topBarVariants>;
@@ -1,247 +0,0 @@
1
- // @vitest-environment jsdom
2
- import { describe, it, expect } from 'vitest';
3
- import { render } from '@testing-library/react';
4
- import { Typography } from './Typography.js';
5
-
6
- /**
7
- * Suite mirrors the Button.test.tsx shape (rendering · variants · color ·
8
- * override · polymorphism) so the test surface is uniform across the
9
- * package.
10
- *
11
- * Strategy: render → query → assert on `tagName` (for HTML-element
12
- * resolution) and `className` (for variant resolution). We deliberately
13
- * DON'T snapshot: snapshots churn on every variant-class edit and offer
14
- * no signal on the actual contract — the contract is "this variant
15
- * emits THESE specific Tailwind utility classes", which we assert
16
- * positively below.
17
- */
18
- describe('<Typography>', () => {
19
- // ─── Rendering / default tag mapping ────────────────────────────────
20
- describe('default tag mapping', () => {
21
- it('renders <p> for body1 by default', () => {
22
- const { container } = render(<Typography>hello</Typography>);
23
- expect(container.firstElementChild?.tagName).toBe('P');
24
- });
25
-
26
- it('renders <h1> for variant="h1"', () => {
27
- const { container } = render(<Typography variant="h1">title</Typography>);
28
- expect(container.firstElementChild?.tagName).toBe('H1');
29
- });
30
-
31
- it('renders <h3> for variant="h3"', () => {
32
- const { container } = render(<Typography variant="h3">title</Typography>);
33
- expect(container.firstElementChild?.tagName).toBe('H3');
34
- });
35
-
36
- it('renders <span> for variant="caption"', () => {
37
- const { container } = render(<Typography variant="caption">note</Typography>);
38
- expect(container.firstElementChild?.tagName).toBe('SPAN');
39
- });
40
-
41
- it('renders <span> for variant="overline"', () => {
42
- const { container } = render(<Typography variant="overline">label</Typography>);
43
- expect(container.firstElementChild?.tagName).toBe('SPAN');
44
- });
45
- });
46
-
47
- // ─── Variant classes ────────────────────────────────────────────────
48
- describe('variant → utility chain', () => {
49
- it('h1 has text-5xl + font-bold', () => {
50
- const { container } = render(<Typography variant="h1">x</Typography>);
51
- const cls = container.firstElementChild?.className ?? '';
52
- expect(cls).toContain('text-5xl');
53
- expect(cls).toContain('font-bold');
54
- });
55
-
56
- it('body2 has text-sm', () => {
57
- const { container } = render(<Typography variant="body2">x</Typography>);
58
- expect(container.firstElementChild?.className).toContain('text-sm');
59
- });
60
-
61
- it('overline has uppercase + tracking', () => {
62
- const { container } = render(<Typography variant="overline">x</Typography>);
63
- const cls = container.firstElementChild?.className ?? '';
64
- expect(cls).toContain('uppercase');
65
- expect(cls).toMatch(/tracking-\[/);
66
- });
67
- });
68
-
69
- // ─── Color intent ───────────────────────────────────────────────────
70
- describe('color', () => {
71
- it('color="primary" emits text-primary-* with dark variant', () => {
72
- const { container } = render(<Typography color="primary">x</Typography>);
73
- const cls = container.firstElementChild?.className ?? '';
74
- expect(cls).toContain('text-primary-700');
75
- expect(cls).toContain('dark:text-primary-400');
76
- });
77
-
78
- it('color="danger" emits text-danger-*', () => {
79
- const { container } = render(<Typography color="danger">x</Typography>);
80
- expect(container.firstElementChild?.className).toContain('text-danger-700');
81
- });
82
-
83
- it('color="inherit" emits text-inherit', () => {
84
- const { container } = render(<Typography color="inherit">x</Typography>);
85
- expect(container.firstElementChild?.className).toContain('text-inherit');
86
- });
87
-
88
- it('defaults to color="neutral" (text-neutral-900, NOT text-inherit)', () => {
89
- // Sprint 6 P5 fix — a bare <Typography> must emit the
90
- // auto-inverting neutral token, not inherit the consumer's
91
- // arbitrary root colour (which broke dark-mode consistency).
92
- const { container } = render(<Typography>x</Typography>);
93
- const cls = container.firstElementChild?.className ?? '';
94
- expect(cls).toContain('text-neutral-900');
95
- expect(cls).not.toContain('text-inherit');
96
- });
97
-
98
- it('color="muted" emits text-neutral-600', () => {
99
- const { container } = render(<Typography color="muted">x</Typography>);
100
- expect(container.firstElementChild?.className).toContain('text-neutral-600');
101
- });
102
- });
103
-
104
- // ─── Override semantics ─────────────────────────────────────────────
105
- describe('override', () => {
106
- it('sx wins over variant defaults via tailwind-merge', () => {
107
- const { container } = render(
108
- <Typography variant="h1" color="primary" sx="text-pink-500">x</Typography>,
109
- );
110
- const cls = container.firstElementChild?.className ?? '';
111
- // tailwind-merge collapses the conflicting `text-*` colour to the last one
112
- expect(cls).toContain('text-pink-500');
113
- expect(cls).not.toContain('text-primary-700');
114
- });
115
-
116
- it('weight prop overrides variant default weight', () => {
117
- const { container } = render(<Typography variant="h1" weight="normal">x</Typography>);
118
- const cls = container.firstElementChild?.className ?? '';
119
- // h1's default `font-bold` is dropped by tailwind-merge, replaced by font-normal
120
- expect(cls).toContain('font-normal');
121
- expect(cls).not.toContain('font-bold');
122
- });
123
-
124
- it('truncate adds the truncate utility', () => {
125
- const { container } = render(<Typography truncate>x</Typography>);
126
- expect(container.firstElementChild?.className).toContain('truncate');
127
- });
128
-
129
- it('gutterBottom adds mb-3', () => {
130
- const { container } = render(<Typography gutterBottom>x</Typography>);
131
- expect(container.firstElementChild?.className).toContain('mb-3');
132
- });
133
- });
134
-
135
- // ─── Polymorphism — `as` and `asChild` ───────────────────────────────
136
- describe('polymorphism', () => {
137
- it('as="section" overrides the variant-default tag', () => {
138
- const { container } = render(
139
- <Typography variant="h1" as="section">x</Typography>,
140
- );
141
- expect(container.firstElementChild?.tagName).toBe('SECTION');
142
- });
143
-
144
- it('asChild renders the single child element with merged className', () => {
145
- const { container } = render(
146
- <Typography variant="h2" color="primary" asChild>
147
- <a href="#">link</a>
148
- </Typography>,
149
- );
150
- const el = container.firstElementChild;
151
- expect(el?.tagName).toBe('A');
152
- expect(el?.className).toContain('text-4xl');
153
- expect(el?.className).toContain('text-primary-700');
154
- expect(el?.getAttribute('href')).toBe('#');
155
- });
156
-
157
- it('asChild wins over `as` when both are passed', () => {
158
- const { container } = render(
159
- <Typography variant="h1" as="section" asChild>
160
- <article>x</article>
161
- </Typography>,
162
- );
163
- // Slot renders the child element, ignoring `as`
164
- expect(container.firstElementChild?.tagName).toBe('ARTICLE');
165
- });
166
- });
167
-
168
- // ─── Pass-through ────────────────────────────────────────────────────
169
- describe('pass-through props', () => {
170
- it('forwards data-* attributes', () => {
171
- const { container } = render(
172
- <Typography data-testid="typo">x</Typography>,
173
- );
174
- expect(container.firstElementChild?.getAttribute('data-testid')).toBe('typo');
175
- });
176
-
177
- it('forwards aria-label', () => {
178
- const { container } = render(
179
- <Typography aria-label="heading">x</Typography>,
180
- );
181
- expect(container.firstElementChild?.getAttribute('aria-label')).toBe('heading');
182
- });
183
- });
184
-
185
- // ─── F11-bis edge cases ─────────────────────────────────────────────
186
- describe('multi-axis combinations', () => {
187
- it('variant=h2 + color=primary + weight=normal + align=center + truncate + gutterBottom', () => {
188
- const { container } = render(
189
- <Typography
190
- variant="h2"
191
- color="primary"
192
- weight="normal"
193
- align="center"
194
- truncate
195
- gutterBottom
196
- >
197
- x
198
- </Typography>,
199
- );
200
- const cls = container.firstElementChild?.className ?? '';
201
- expect(cls).toContain('text-4xl'); // h2 size
202
- expect(cls).toContain('text-primary-700'); // color intent
203
- expect(cls).toContain('font-normal'); // weight override (vs h2 default font-bold)
204
- expect(cls).not.toContain('font-bold'); // overridden
205
- expect(cls).toContain('text-center'); // align
206
- expect(cls).toContain('truncate'); // truncate
207
- expect(cls).toContain('mb-3'); // gutterBottom
208
- });
209
-
210
- it('noWrap + truncate: truncate wins (later in chain, tailwind-merge collapses whitespace-nowrap)', () => {
211
- const { container } = render(<Typography noWrap truncate>x</Typography>);
212
- // truncate utility already includes whitespace-nowrap — tailwind-merge
213
- // collapses the redundant nowrap from noWrap
214
- expect(container.firstElementChild?.className).toContain('truncate');
215
- });
216
-
217
- it('every variant maps to its expected default tag', () => {
218
- const cases: Array<[Parameters<typeof Typography>[0]['variant'], string]> = [
219
- ['h1', 'H1'], ['h2', 'H2'], ['h3', 'H3'], ['h4', 'H4'], ['h5', 'H5'], ['h6', 'H6'],
220
- ['subtitle1', 'P'], ['subtitle2', 'P'],
221
- ['body1', 'P'], ['body2', 'P'],
222
- ['caption', 'SPAN'], ['overline', 'SPAN'],
223
- ];
224
- cases.forEach(([variant, tag]) => {
225
- const { container } = render(<Typography variant={variant}>x</Typography>);
226
- expect(container.firstElementChild?.tagName).toBe(tag);
227
- });
228
- });
229
- });
230
-
231
- describe('color edge cases', () => {
232
- const INTENTS = ['primary', 'secondary', 'success', 'warning', 'danger', 'info', 'muted'] as const;
233
- it.each(INTENTS)('color="%s" emits the right text-* + dark pair', (color) => {
234
- const { container } = render(<Typography color={color}>x</Typography>);
235
- const cls = container.firstElementChild?.className ?? '';
236
- if (color === 'muted') {
237
- // Sprint 4.3 identity sweep: neutral palette auto-inverts via
238
- // CSS-var swap — no `dark:` variant needed.
239
- expect(cls).toContain('text-neutral-600');
240
- expect(cls).not.toContain('dark:text-neutral-');
241
- } else {
242
- expect(cls).toContain(`text-${color}-700`);
243
- expect(cls).toContain(`dark:text-${color}-400`);
244
- }
245
- });
246
- });
247
- });
@@ -1,112 +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 { typographyVariants } from './typography.variants.js';
5
- import type { TypographyProps } from './typography.types.js';
6
-
7
- /**
8
- * Default HTML tag per variant. Headings get their semantic level (h1→h1
9
- * etc.); subtitle/body get `<p>` (block, paragraph semantics);
10
- * caption/overline get `<span>` (inline, no implicit block break).
11
- *
12
- * Override per-instance via the `as` prop — useful when the semantic
13
- * heading level should differ from the visual scale (e.g. a hero
14
- * rendered as `<h2>` but visually styled `h1`).
15
- */
16
- const VARIANT_TO_TAG: Record<NonNullable<TypographyProps['variant']>, ElementType> = {
17
- h1: 'h1',
18
- h2: 'h2',
19
- h3: 'h3',
20
- h4: 'h4',
21
- h5: 'h5',
22
- h6: 'h6',
23
- subtitle1: 'p',
24
- subtitle2: 'p',
25
- body1: 'p',
26
- body2: 'p',
27
- caption: 'span',
28
- overline: 'span',
29
- };
30
-
31
- /**
32
- * `<Typography>` — semantic typed text, the foundation of every readable
33
- * surface in @dashforge/tw.
34
- *
35
- * Why this exists:
36
- * Tailwind ships a typographic scale (`text-xl`, `font-bold`,
37
- * `leading-relaxed`) but leaves the SEMANTIC HTML tag and the
38
- * intent-coloured palette to the consumer. That's fine for one-off
39
- * marketing surfaces, but at app scale it means every `<h2>` and every
40
- * body paragraph re-derives its own utility chain — and they drift.
41
- *
42
- * Typography moves that decision into a typed prop set: the visual
43
- * scale, the intent colour, the alignment, the truncation all live in
44
- * `tailwind-variants` and resolve to the same utility chain everywhere
45
- * in the app. The default HTML tag is inferred from `variant` so the
46
- * semantic layer follows the visual layer; `as` and `asChild` are the
47
- * two escape hatches when you need something else.
48
- *
49
- * Layering:
50
- * • Sits BENEATH every component that renders text — `<Button>`'s
51
- * label, `<TextField>`'s helper text, MDX prose in our own docs.
52
- * • Composes ON TOP of `@dashforge/tw-tokens` colour scales (so
53
- * `color="primary"` paints `text-primary-700` in light, `-400` in dark,
54
- * reactive to `setMode()`).
55
- * • Polymorphic via Radix Slot — pairs cleanly with router `<Link>`,
56
- * `<button>`, or `<a>` without injecting an extra wrapper element.
57
- *
58
- * Polymorphism rules — `as` vs `asChild`:
59
- * • `as` swaps the rendered tag (we still render the element ourselves).
60
- * • `asChild` removes our element entirely — the single React child
61
- * becomes the rendered tag, with our className/ref merged onto it.
62
- * This is the Radix Slot pattern; use when you need a router Link
63
- * to style as a heading.
64
- * When BOTH are passed, `asChild` wins. We considered making this a
65
- * compile-time error via discriminated unions, but the API surface
66
- * already has 8 axes and adding one more dimension to the props type
67
- * would inflate IntelliSense suggestions for marginal benefit. The
68
- * runtime preference is documented; the test asserts it.
69
- */
70
- export const Typography = forwardRef<HTMLElement, TypographyProps>(
71
- function Typography(props, ref) {
72
- const {
73
- variant = 'body1',
74
- color,
75
- weight,
76
- align,
77
- truncate,
78
- noWrap,
79
- gutterBottom,
80
- as,
81
- asChild = false,
82
- sx,
83
- children,
84
- ...rest
85
- } = props;
86
-
87
- const classes = cn(
88
- typographyVariants({ variant, color, weight, align, truncate, noWrap, gutterBottom }),
89
- sx,
90
- );
91
-
92
- // asChild wins over `as` when both are passed (see component header).
93
- if (asChild) {
94
- return (
95
- <Slot ref={ref} className={classes} {...rest}>
96
- {children as ReactElement}
97
- </Slot>
98
- );
99
- }
100
-
101
- // Resolve the rendered tag: explicit `as` > variant default > fallback.
102
- const Tag = (as ?? VARIANT_TO_TAG[variant] ?? 'span') as ElementType;
103
-
104
- return (
105
- <Tag ref={ref as never} className={classes} {...rest}>
106
- {children}
107
- </Tag>
108
- );
109
- },
110
- );
111
-
112
- Typography.displayName = 'Typography';