@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,65 +0,0 @@
1
- import type { ElementType, HTMLAttributes } from 'react';
2
- import type { TypographyVariants } from './typography.variants.js';
3
-
4
- /**
5
- * Props for `<Typography>`.
6
- *
7
- * Composition with native `HTMLAttributes`:
8
- * • `className` is omitted in favour of `sx` (string of utility classes)
9
- * — same convention as Button/TextField/Checkbox/Switch in this
10
- * package. `sx` is merged via `tailwind-merge`, so the consumer's
11
- * classes always win over variant defaults.
12
- * • `color` is omitted because the native HTML attribute (the
13
- * deprecated `color="red"` from HTML4) collides with our intent
14
- * prop — TypeScript would otherwise widen to a confusing union.
15
- *
16
- * Variant axes picked from `TypographyVariants`:
17
- * • `variant` — the type scale (h1–h6, subtitle1/2, body1/2, caption, overline)
18
- * • `color` — the intent (primary, secondary, success, warning, danger, info, neutral, muted, inherit)
19
- * • `weight` — overrides the variant's default font-weight
20
- * • `align` — text-align
21
- * • `truncate` — one-line ellipsis
22
- * • `noWrap` — one-line without ellipsis
23
- * • `gutterBottom` — adds mb-3 (mirror of MUI's same prop)
24
- *
25
- * Polymorphism:
26
- * • `as` — override the HTML tag while keeping the variant's visual
27
- * style (e.g. `<Typography variant="h1" as="h2">` renders an
28
- * `<h2>` styled like h1 — useful when the semantic heading
29
- * level matters more than the type scale).
30
- * • `asChild` — render as the single child element via Radix Slot
31
- * (so the styles paint onto a `<Link>`, `<a>`, etc.).
32
- * Mutually exclusive with `as` — see component header for
33
- * the rationale.
34
- */
35
- export interface TypographyProps
36
- extends Omit<HTMLAttributes<HTMLElement>, 'className' | 'color'>,
37
- Pick<TypographyVariants, 'variant' | 'color' | 'weight' | 'align' | 'truncate' | 'noWrap' | 'gutterBottom'> {
38
- /**
39
- * Override the HTML tag. Defaults to a sensible mapping per variant
40
- * (h1→h1, …, body1→p, caption→span, overline→span). Use when the
41
- * semantic heading level should differ from the visual scale —
42
- * e.g. a "hero" rendered as an `<h2>` but styled like `h1`.
43
- *
44
- * Ignored when `asChild` is true.
45
- */
46
- as?: ElementType;
47
-
48
- /**
49
- * Render via Radix `Slot` — the Typography styles paint onto the
50
- * single React child instead of wrapping it in our own tag. Useful
51
- * for `<Typography asChild><Link>...</Link></Typography>` to get a
52
- * styled router link with no extra DOM.
53
- *
54
- * Mutually exclusive with `as` (when both are passed, `asChild` wins
55
- * and `as` is ignored — see Typography.tsx for the reason).
56
- */
57
- asChild?: boolean;
58
-
59
- /**
60
- * Utility classes appended to the variant chain. Resolved via
61
- * `tailwind-merge` so the consumer's classes always win over the
62
- * variant defaults — e.g. `sx="text-pink-500"` overrides `color="primary"`.
63
- */
64
- sx?: string;
65
- }
@@ -1,130 +0,0 @@
1
- import { tv, type VariantProps } from 'tailwind-variants';
2
-
3
- /**
4
- * `typographyVariants` — the full type scale for the @dashforge/tw library.
5
- *
6
- * Mirrors the MUI Typography variant set (h1–h6 · subtitle1/2 · body1/2 ·
7
- * caption · overline) so the mental model carries over for developers
8
- * moving between the two ecosystems. Each variant baseline maps to a
9
- * Tailwind utility chain that resolves through the @dashforge/tw-tokens
10
- * scale (so the visual stays in sync with the rest of the system when the
11
- * token theme is patched).
12
- *
13
- * Variant axes are intentionally ORTHOGONAL — `variant` chooses the type
14
- * scale, `weight` overrides the variant's default weight (useful for "h2
15
- * but lighter"), `color` picks the intent, `align` picks the axis. They
16
- * never collide, so consumers can mix them freely.
17
- *
18
- * Two boolean flags (`truncate`, `noWrap`) encode the most common one-line
19
- * patterns; `gutterBottom` adds the conventional bottom margin used when a
20
- * heading precedes a paragraph block (mirror of MUI's same flag).
21
- */
22
- export const typographyVariants = tv({
23
- base: 'text-inherit',
24
-
25
- variants: {
26
- /*
27
- * `variant` is the type-scale axis.
28
- *
29
- * The default font-weight is baked into each variant (headings come
30
- * with semibold/bold by default). Consumers override per-instance via
31
- * the `weight` axis below — when set, `weight` wins because it's
32
- * declared later in the cn() chain and tailwind-merge resolves the
33
- * last `font-*` to win.
34
- */
35
- variant: {
36
- h1: 'text-5xl font-bold leading-[1.05] tracking-[-0.025em]',
37
- h2: 'text-4xl font-bold leading-[1.1] tracking-[-0.022em]',
38
- h3: 'text-3xl font-semibold leading-[1.15] tracking-[-0.02em]',
39
- h4: 'text-2xl font-semibold leading-snug tracking-[-0.015em]',
40
- h5: 'text-xl font-semibold leading-snug',
41
- h6: 'text-lg font-semibold leading-normal',
42
- subtitle1: 'text-base font-medium leading-relaxed',
43
- subtitle2: 'text-sm font-medium leading-relaxed',
44
- body1: 'text-base font-normal leading-relaxed',
45
- body2: 'text-sm font-normal leading-relaxed',
46
- caption: 'text-xs font-normal leading-normal',
47
- overline: 'text-xs font-semibold uppercase tracking-[0.12em] leading-normal',
48
- },
49
-
50
- /*
51
- * `color` is the intent axis. Pairs with the @dashforge/tw-theme
52
- * reactive colour vars so the choice survives theme patches and dark
53
- * mode flips. `inherit` is the escape hatch — used inside a Box that
54
- * has set its own color (e.g. `<Box variant="solid" color="primary">`
55
- * paints white text).
56
- */
57
- color: {
58
- // `inherit` is the explicit escape hatch — use it on a
59
- // `<Typography>` inside a coloured surface (e.g.
60
- // `<Box variant="solid" color="primary">` paints white text)
61
- // so the text picks up the surface colour. It is NO LONGER the
62
- // default: a bare `<Typography>` would otherwise inherit the
63
- // consuming app's arbitrary root colour (often OS-`prefers-
64
- // color-scheme` driven), which diverges from the Dashforge
65
- // `data-dash-tw-theme` mode and breaks colour consistency in
66
- // dark mode. The default is now `neutral` — see `defaultVariants`.
67
- inherit: 'text-inherit',
68
- primary: 'text-primary-700 dark:text-primary-400',
69
- secondary: 'text-secondary-700 dark:text-secondary-400',
70
- success: 'text-success-700 dark:text-success-400',
71
- warning: 'text-warning-700 dark:text-warning-400',
72
- danger: 'text-danger-700 dark:text-danger-400',
73
- info: 'text-info-700 dark:text-info-400',
74
- // Neutral palette auto-inverts via the dashforgePreset() CSS-var
75
- // swap — no `dark:` variants. `text-neutral-900` resolves to
76
- // dark text in light mode and light text in dark mode; same
77
- // applies to `text-neutral-600` (muted).
78
- neutral: 'text-neutral-900',
79
- muted: 'text-neutral-600',
80
- },
81
-
82
- /*
83
- * `weight` overrides the variant's default weight. When unset, the
84
- * variant's own weight wins. When set, this axis appears LATER in the
85
- * cn() chain so tailwind-merge resolves to this value.
86
- */
87
- weight: {
88
- normal: 'font-normal',
89
- medium: 'font-medium',
90
- semibold: 'font-semibold',
91
- bold: 'font-bold',
92
- extrabold: 'font-extrabold',
93
- },
94
-
95
- align: {
96
- left: 'text-left',
97
- center: 'text-center',
98
- right: 'text-right',
99
- justify: 'text-justify',
100
- },
101
-
102
- /*
103
- * `truncate` collapses to a one-line ellipsis. `noWrap` is the looser
104
- * sibling — keeps the text on one line but lets it overflow without
105
- * the `…`. Mutually-exclusive intent-wise; if both are passed,
106
- * `truncate` wins (later in the cn() chain).
107
- */
108
- truncate: { true: 'truncate' },
109
- noWrap: { true: 'whitespace-nowrap' },
110
-
111
- /*
112
- * `gutterBottom` adds the conventional bottom margin used when a
113
- * heading precedes a paragraph block. Mirror of MUI's same prop —
114
- * familiar to developers crossing from the MUI side.
115
- */
116
- gutterBottom: { true: 'mb-3' },
117
- },
118
-
119
- defaultVariants: {
120
- variant: 'body1',
121
- // `neutral` (not `inherit`): a bare `<Typography>` emits
122
- // `text-neutral-900`, which auto-inverts via the dashforgePreset()
123
- // CSS-var swap and follows the Dashforge mode. Pass
124
- // `color="inherit"` explicitly inside a coloured surface.
125
- color: 'neutral',
126
- align: 'left',
127
- },
128
- });
129
-
130
- export type TypographyVariants = VariantProps<typeof typographyVariants>;
@@ -1,86 +0,0 @@
1
- // @vitest-environment jsdom
2
- import { describe, it, expect } from 'vitest';
3
- import { render } from '@testing-library/react';
4
- import { VisuallyHidden } from './VisuallyHidden.js';
5
-
6
- describe('<VisuallyHidden>', () => {
7
- it('renders a <span> by default', () => {
8
- const { container } = render(<VisuallyHidden>label</VisuallyHidden>);
9
- expect(container.firstElementChild?.tagName).toBe('SPAN');
10
- });
11
-
12
- it('has the sr-only class', () => {
13
- const { container } = render(<VisuallyHidden>label</VisuallyHidden>);
14
- expect(container.firstElementChild?.className).toContain('sr-only');
15
- });
16
-
17
- it('preserves the text content (so screen readers can read it)', () => {
18
- const { container } = render(<VisuallyHidden>Close dialog</VisuallyHidden>);
19
- expect(container.firstElementChild?.textContent).toBe('Close dialog');
20
- });
21
-
22
- it('as="div" renders <div>', () => {
23
- const { container } = render(<VisuallyHidden as="div">label</VisuallyHidden>);
24
- expect(container.firstElementChild?.tagName).toBe('DIV');
25
- });
26
-
27
- it('sx adds utilities (merged with sr-only)', () => {
28
- const { container } = render(
29
- <VisuallyHidden sx="text-xs">label</VisuallyHidden>,
30
- );
31
- const cls = container.firstElementChild?.className ?? '';
32
- expect(cls).toContain('sr-only');
33
- expect(cls).toContain('text-xs');
34
- });
35
-
36
- it('forwards data-* + aria-*', () => {
37
- const { container } = render(
38
- <VisuallyHidden data-testid="vh" aria-live="polite">x</VisuallyHidden>,
39
- );
40
- const el = container.firstElementChild;
41
- expect(el?.getAttribute('data-testid')).toBe('vh');
42
- expect(el?.getAttribute('aria-live')).toBe('polite');
43
- });
44
-
45
- it('typical pattern — icon button label', () => {
46
- const { container } = render(
47
- <button type="button">
48
- <span aria-hidden="true">✕</span>
49
- <VisuallyHidden>Close</VisuallyHidden>
50
- </button>,
51
- );
52
- const btn = container.querySelector('button');
53
- // textContent includes the hidden label so AT can read it
54
- expect(btn?.textContent).toBe('✕Close');
55
- // visually, the Close span has sr-only
56
- const hidden = btn?.querySelector('.sr-only');
57
- expect(hidden?.textContent).toBe('Close');
58
- });
59
-
60
- // ─── F11-bis edge cases ─────────────────────────────────────────────
61
- it('empty children renders empty element with sr-only', () => {
62
- const { container } = render(<VisuallyHidden>{''}</VisuallyHidden>);
63
- const el = container.firstElementChild;
64
- expect(el?.className).toContain('sr-only');
65
- expect(el?.textContent).toBe('');
66
- });
67
-
68
- it('aria-live="polite" pattern for status announcements', () => {
69
- const { container } = render(
70
- <VisuallyHidden aria-live="polite">Saved successfully</VisuallyHidden>,
71
- );
72
- const el = container.firstElementChild;
73
- expect(el?.getAttribute('aria-live')).toBe('polite');
74
- expect(el?.textContent).toBe('Saved successfully');
75
- });
76
-
77
- it('as="div" renders block element (consumer choice for block hidden content)', () => {
78
- const { container } = render(
79
- <VisuallyHidden as="div">
80
- Block content hidden from sight but readable by AT
81
- </VisuallyHidden>,
82
- );
83
- expect(container.firstElementChild?.tagName).toBe('DIV');
84
- expect(container.firstElementChild?.className).toContain('sr-only');
85
- });
86
- });
@@ -1,59 +0,0 @@
1
- import { forwardRef, type ElementType } from 'react';
2
- import { cn } from '../../utils/cn.js';
3
- import type { VisuallyHiddenProps } from './visuallyHidden.types.js';
4
-
5
- /**
6
- * `<VisuallyHidden>` — the accessibility primitive.
7
- *
8
- * Hides children from sighted users (zero pixels rendered, no layout
9
- * impact) while keeping them in the accessibility tree. Screen readers
10
- * speak the content; voice control software uses it for click targets;
11
- * keyboard users see nothing — same as if it weren't there.
12
- *
13
- * Implementation: Tailwind's built-in `sr-only` utility, which expands to:
14
- *
15
- * .sr-only {
16
- * position: absolute;
17
- * width: 1px;
18
- * height: 1px;
19
- * padding: 0;
20
- * margin: -1px;
21
- * overflow: hidden;
22
- * clip: rect(0,0,0,0);
23
- * white-space: nowrap;
24
- * border-width: 0;
25
- * }
26
- *
27
- * This is the canonical "visually-hidden but screen-reader-accessible"
28
- * pattern, also known as the WebAIM clip technique. Critically:
29
- *
30
- * • NOT `display: none` (removes from a11y tree)
31
- * • NOT `visibility: hidden` (also removes from a11y tree)
32
- * • NOT `opacity: 0` (technically still rendered, doesn't help AT)
33
- * • NOT `width/height: 0` (collapses, some AT skips it)
34
- *
35
- * Default tag is `<span>` (inline) — the 99% case is "label inside a
36
- * button or link". For block content, override with `as="div"`, but
37
- * be aware nesting block inside inline is invalid HTML.
38
- *
39
- * The component is intentionally tiny (~30 LoC total): one className,
40
- * one tag. The value is the COMPONENT NAME — `<VisuallyHidden>` reads
41
- * as an intentional a11y decision in code review, while
42
- * `className="sr-only"` looks like a typo or a forgotten utility.
43
- */
44
- export const VisuallyHidden = forwardRef<HTMLElement, VisuallyHiddenProps>(
45
- function VisuallyHidden(props, ref) {
46
- const { as, sx, children, ...rest } = props;
47
-
48
- const Tag = (as ?? 'span') as ElementType;
49
- const classes = cn('sr-only', sx);
50
-
51
- return (
52
- <Tag ref={ref as never} className={classes} {...rest}>
53
- {children}
54
- </Tag>
55
- );
56
- },
57
- );
58
-
59
- VisuallyHidden.displayName = 'VisuallyHidden';
@@ -1,45 +0,0 @@
1
- import type { ElementType, HTMLAttributes, ReactElement } from 'react';
2
-
3
- /**
4
- * Props for `<VisuallyHidden>` — the a11y primitive.
5
- *
6
- * Hides content visually (zero pixels rendered) while keeping it
7
- * accessible to assistive technology (screen readers, voice control).
8
- * The canonical use case: icon-only buttons that need an audible label
9
- * for non-visual users.
10
- *
11
- * <button>
12
- * <CloseIcon />
13
- * <VisuallyHidden>Close dialog</VisuallyHidden>
14
- * </button>
15
- *
16
- * Implementation uses Tailwind's `sr-only` utility, which sets
17
- * `position: absolute; width: 1px; height: 1px; padding: 0;
18
- * margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
19
- * white-space: nowrap; border-width: 0;` — the canonical
20
- * "visually-hidden but screen-reader-accessible" pattern. Better
21
- * than `display: none` (removes from a11y tree) and better than
22
- * `visibility: hidden` (also removes from a11y tree).
23
- */
24
- export interface VisuallyHiddenProps
25
- extends Omit<HTMLAttributes<HTMLElement>, 'className'> {
26
- /**
27
- * The text or markup hidden from sighted users but read by AT.
28
- * Most often a string label.
29
- */
30
- children?: ReactElement | string | number;
31
-
32
- /**
33
- * Override the rendered HTML tag. Defaults to `'span'` — inline
34
- * placement is the most common case (label inside a button or link).
35
- * Use `as="div"` when the hidden content is block-level, but be
36
- * aware: nesting a block inside an inline parent is invalid HTML.
37
- */
38
- as?: ElementType;
39
-
40
- /**
41
- * Utility classes appended to `sr-only`. RARELY needed for this
42
- * primitive (it's just hidden text) — kept for API parity.
43
- */
44
- sx?: string;
45
- }
@@ -1,50 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { getNestedValue } from './getNestedValue.js';
3
-
4
- describe('getNestedValue', () => {
5
- it('returns top-level value', () => {
6
- expect(getNestedValue({ a: 1 }, 'a')).toBe(1);
7
- });
8
-
9
- it('returns nested value (1 level)', () => {
10
- expect(getNestedValue({ user: { name: 'Jane' } }, 'user.name')).toBe('Jane');
11
- });
12
-
13
- it('returns nested value (3 levels)', () => {
14
- expect(
15
- getNestedValue({ a: { b: { c: { d: 42 } } } }, 'a.b.c.d'),
16
- ).toBe(42);
17
- });
18
-
19
- it('returns undefined when path is empty', () => {
20
- expect(getNestedValue({ a: 1 }, '')).toBeUndefined();
21
- });
22
-
23
- it('returns undefined when intermediate segment is null', () => {
24
- expect(getNestedValue({ user: null as never }, 'user.name')).toBeUndefined();
25
- });
26
-
27
- it('returns undefined when intermediate segment is undefined', () => {
28
- expect(getNestedValue({} as { a?: { b?: number } }, 'a.b')).toBeUndefined();
29
- });
30
-
31
- it('returns undefined when intermediate segment is a primitive', () => {
32
- expect(getNestedValue({ a: 'hello' }, 'a.b')).toBeUndefined();
33
- });
34
-
35
- it('preserves zero value (not coerced to undefined)', () => {
36
- expect(getNestedValue({ a: { b: 0 } }, 'a.b')).toBe(0);
37
- });
38
-
39
- it('preserves false value', () => {
40
- expect(getNestedValue({ a: { b: false } }, 'a.b')).toBe(false);
41
- });
42
-
43
- it('preserves empty string value', () => {
44
- expect(getNestedValue({ a: { b: '' } }, 'a.b')).toBe('');
45
- });
46
-
47
- it('returns the full sub-object when path stops mid-tree', () => {
48
- expect(getNestedValue({ a: { b: { c: 1 } } }, 'a.b')).toEqual({ c: 1 });
49
- });
50
- });
@@ -1,32 +0,0 @@
1
- /**
2
- * Walk a dotted path through an object and return the value, or
3
- * `undefined` if any segment is missing / nullish.
4
- *
5
- * Bug fix from the MUI-side Table (Sprint 4.1 motivation): the
6
- * existing wrapper typed `field: NestedKeyOf<T>` but performed a
7
- * flat `row[col.field]` lookup at runtime — nested keys silently
8
- * returned `undefined`. This helper makes the runtime match the
9
- * type contract.
10
- *
11
- * @example
12
- * ```ts
13
- * getNestedValue({ user: { name: 'Jane' } }, 'user.name') // 'Jane'
14
- * getNestedValue({ user: null }, 'user.name') // undefined
15
- * getNestedValue({}, 'a.b.c') // undefined
16
- * getNestedValue({ a: { b: 0 } }, 'a.b') // 0 (NOT undefined)
17
- * ```
18
- */
19
- export function getNestedValue<T extends object>(
20
- row: T,
21
- path: string,
22
- ): unknown {
23
- if (!path) return undefined;
24
- const segments = path.split('.');
25
- let current: unknown = row;
26
- for (const segment of segments) {
27
- if (current == null) return undefined;
28
- if (typeof current !== 'object') return undefined;
29
- current = (current as Record<string, unknown>)[segment];
30
- }
31
- return current;
32
- }
@@ -1,123 +0,0 @@
1
- // @vitest-environment jsdom
2
- import { describe, it, expect } from 'vitest';
3
- import { renderHook } from '@testing-library/react';
4
- import {
5
- useColumnAutoDetect,
6
- resolveAlign,
7
- resolveMonospace,
8
- resolveTabularNums,
9
- } from './useColumnAutoDetect.js';
10
- import type { TableColumn } from '../../Table/table.types.js';
11
-
12
- interface Row {
13
- name: string;
14
- age: number;
15
- active: boolean;
16
- joinedAt: Date;
17
- isoDate: string;
18
- meta: { count: number };
19
- unknownField?: never;
20
- }
21
-
22
- const cols: TableColumn<Row>[] = [
23
- { field: 'name', header: 'Name' },
24
- { field: 'age', header: 'Age' },
25
- { field: 'active', header: 'Active' },
26
- { field: 'joinedAt' as never, header: 'JoinedAt' },
27
- { field: 'isoDate' as never, header: 'ISO Date' },
28
- { field: 'meta.count' as never, header: 'Count' },
29
- { field: 'unknownField' as never, header: 'Unknown' },
30
- ];
31
-
32
- const rows: Row[] = [
33
- {
34
- name: 'Jane', age: 30, active: true,
35
- joinedAt: new Date('2024-01-15'),
36
- isoDate: '2024-01-15T00:00:00Z',
37
- meta: { count: 5 },
38
- },
39
- ];
40
-
41
- describe('useColumnAutoDetect', () => {
42
- it('infers number / boolean / string / date / nested-number', () => {
43
- const { result } = renderHook(() => useColumnAutoDetect(rows, cols));
44
- expect(result.current.get('name')).toBe('string');
45
- expect(result.current.get('age')).toBe('number');
46
- expect(result.current.get('active')).toBe('boolean');
47
- expect(result.current.get('joinedAt')).toBe('date');
48
- expect(result.current.get('isoDate')).toBe('date');
49
- expect(result.current.get('meta.count')).toBe('number');
50
- expect(result.current.get('unknownField')).toBe('unknown');
51
- });
52
-
53
- it('returns unknown for empty rows array', () => {
54
- const { result } = renderHook(() => useColumnAutoDetect([], cols));
55
- for (const col of cols) {
56
- expect(result.current.get(col.field as string)).toBe('unknown');
57
- }
58
- });
59
-
60
- it('skips null values to find the first non-null sample', () => {
61
- const colsAge: TableColumn<{ age: number | null }>[] = [{ field: 'age', header: 'Age' }];
62
- const sparseRows = [{ age: null }, { age: null }, { age: 42 }];
63
- const { result } = renderHook(() => useColumnAutoDetect(sparseRows, colsAge));
64
- expect(result.current.get('age')).toBe('number');
65
- });
66
- });
67
-
68
- describe('resolveAlign', () => {
69
- it('explicit align wins', () => {
70
- expect(resolveAlign({ align: 'center' }, 'number')).toBe('center');
71
- });
72
- it('number → right', () => {
73
- expect(resolveAlign({}, 'number')).toBe('right');
74
- });
75
- it('boolean → center', () => {
76
- expect(resolveAlign({}, 'boolean')).toBe('center');
77
- });
78
- it('string → left (default)', () => {
79
- expect(resolveAlign({}, 'string')).toBe('left');
80
- });
81
- it('date → left', () => {
82
- expect(resolveAlign({}, 'date')).toBe('left');
83
- });
84
- it('unknown → left', () => {
85
- expect(resolveAlign({}, 'unknown')).toBe('left');
86
- });
87
- });
88
-
89
- describe('resolveMonospace', () => {
90
- // Library MUST NOT auto-pick a font family — it would override
91
- // the consumer's theme font. Only explicit opt-in turns it on.
92
- it('explicit monospace=true wins', () => {
93
- expect(resolveMonospace({ monospace: true })).toBe(true);
94
- });
95
- it('explicit monospace=false → false', () => {
96
- expect(resolveMonospace({ monospace: false })).toBe(false);
97
- });
98
- it('omitted → false (never auto-applies)', () => {
99
- expect(resolveMonospace({})).toBe(false);
100
- });
101
- });
102
-
103
- describe('resolveTabularNums', () => {
104
- // tabular-nums is a font-feature-setting (digit alignment) — does
105
- // NOT change the font family. Safe to auto-apply for number/date.
106
- it('explicit tabularNums=true wins', () => {
107
- expect(resolveTabularNums({ tabularNums: true }, 'string')).toBe(true);
108
- });
109
- it('explicit tabularNums=false wins (opt-out)', () => {
110
- expect(resolveTabularNums({ tabularNums: false }, 'number')).toBe(false);
111
- });
112
- it('number → true (auto)', () => {
113
- expect(resolveTabularNums({}, 'number')).toBe(true);
114
- });
115
- it('date → true (auto, ISO digits align)', () => {
116
- expect(resolveTabularNums({}, 'date')).toBe(true);
117
- });
118
- it('string / boolean / unknown → false', () => {
119
- expect(resolveTabularNums({}, 'string')).toBe(false);
120
- expect(resolveTabularNums({}, 'boolean')).toBe(false);
121
- expect(resolveTabularNums({}, 'unknown')).toBe(false);
122
- });
123
- });