@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,304 +0,0 @@
1
- import {
2
- Children,
3
- cloneElement,
4
- forwardRef,
5
- isValidElement,
6
- useState,
7
- type ReactElement,
8
- } from 'react';
9
- import { cn } from '../../utils/cn.js';
10
- import {
11
- AVATAR_SOFT_FALLBACK,
12
- AVATAR_TONE_FALLBACK,
13
- avatarVariants,
14
- } from './avatar.variants.js';
15
- import type {
16
- AvatarGroupProps,
17
- AvatarProps,
18
- AvatarShape,
19
- AvatarSize,
20
- } from './avatar.types.js';
21
- import type { BoxProps } from '../Box/box.types.js';
22
-
23
- /**
24
- * Generic user icon — inline SVG fallback when no `src` and no
25
- * `name` are provided. Stroke uses `currentColor` so it inherits the
26
- * resolved fallback text color. Same convention as Calendar +
27
- * Autocomplete + Alert icons (no icon-library dep).
28
- *
29
- * @internal
30
- */
31
- function DefaultUserIcon() {
32
- return (
33
- <svg
34
- viewBox="0 0 24 24"
35
- fill="none"
36
- stroke="currentColor"
37
- strokeWidth={1.75}
38
- strokeLinecap="round"
39
- strokeLinejoin="round"
40
- aria-hidden="true"
41
- >
42
- <circle cx="12" cy="8" r="3.75" />
43
- <path d="M4.5 20a7.5 7.5 0 0 1 15 0" />
44
- </svg>
45
- );
46
- }
47
-
48
- /**
49
- * Map the semantic `shape` shortcut to a Box-style `radius` token.
50
- * Used only when `radius` is NOT explicitly passed (explicit wins).
51
- *
52
- * @internal
53
- */
54
- function shapeToRadius(shape: AvatarShape): BoxProps['rounded'] {
55
- switch (shape) {
56
- case 'circle':
57
- return 'full';
58
- case 'rounded':
59
- return 'lg';
60
- case 'square':
61
- return 'none';
62
- }
63
- }
64
-
65
- /**
66
- * Extract initials from a name string. Strategy:
67
- * - Split by whitespace, filter empty.
68
- * - Take the first letter of the first 2 tokens, uppercased.
69
- * - "Maya Rodriguez" → "MR"
70
- * - "Cher" → "C"
71
- * - " multiple spaces " → "MS" (if 2+ words after trim)
72
- * - "" → "" (empty string — caller falls back to icon)
73
- *
74
- * @internal
75
- */
76
- function initialsFromName(name?: string): string {
77
- if (!name) return '';
78
- const tokens = name.trim().split(/\s+/).filter(Boolean);
79
- if (tokens.length === 0) return '';
80
- return (tokens[0]![0]! + (tokens[1]?.[0] ?? '')).toUpperCase();
81
- }
82
-
83
- /**
84
- * `<Avatar>` — image / initials / icon visual identity.
85
- *
86
- * Fallback chain (top to bottom — first match wins):
87
- * 1. `src` set + image loads OK → render `<img>`
88
- * 2. `src` set + image fails → render initials from `name`
89
- * 3. `src` absent + `name` set → render initials from `name`
90
- * 4. `fallbackIcon` set → render that ReactNode
91
- * 5. Nothing → render generic user SVG
92
- *
93
- * Color resolution (only for fallback content, image surface is
94
- * independent):
95
- * - `color="primary"` only → soft default (bg-100, text-900)
96
- * - `color="primary" tone={500}` → bg-primary-500 + text-primary-50
97
- * - Outside the palette → use `sx`
98
- *
99
- * No `access` / `visibleWhen` — Avatar is display-only by category.
100
- * For visibility gating, wrap in `<Box>` (which has both since
101
- * Sprint 4.4).
102
- */
103
- export const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(function Avatar(
104
- props,
105
- ref
106
- ) {
107
- const {
108
- src,
109
- alt,
110
- imgProps,
111
- name,
112
- shape = 'circle',
113
- radius,
114
- size = 'md',
115
- color = 'neutral',
116
- tone,
117
- fallbackIcon,
118
- sx,
119
- className,
120
- } = props;
121
-
122
- // Track image-load failures so we can fall through to initials/icon
123
- // dynamically. `imgLoaded` distinguishes between "still loading"
124
- // (don't show fallback yet — would flash) and "loaded successfully"
125
- // (don't paint a fallback color underneath, which would peek through
126
- // transparent PNGs).
127
- const [imgFailed, setImgFailed] = useState(false);
128
-
129
- // Resolve final radius: explicit `radius` prop wins over `shape`.
130
- const finalRadius = radius ?? shapeToRadius(shape);
131
-
132
- // Compute base classes from the TV recipe.
133
- const v = avatarVariants({ size, radius: finalRadius });
134
-
135
- // Fallback color resolution. `tone` (when set) drives the specific
136
- // shade; otherwise the soft-default lookup is used.
137
- const fallbackTone =
138
- tone !== undefined
139
- ? AVATAR_TONE_FALLBACK[color]?.[tone] ?? AVATAR_SOFT_FALLBACK[color]
140
- : AVATAR_SOFT_FALLBACK[color];
141
-
142
- // Image is "successful" when src is set AND the load hasn't failed.
143
- const showImage = !!src && !imgFailed;
144
- const initials = initialsFromName(name);
145
-
146
- // The root carries the fallback color ONLY when we're showing the
147
- // fallback content. Painting it underneath a successful image is
148
- // wrong if the image has transparency.
149
- const fallbackBgClasses = !showImage ? fallbackTone : '';
150
-
151
- const rootClasses = cn(
152
- v.root(),
153
- fallbackBgClasses,
154
- sx,
155
- className
156
- );
157
-
158
- // Pick which fallback to render — priority: initials > custom icon > generic SVG.
159
- const fallbackContent: ReactElement = initials ? (
160
- <span className={v.initials()}>{initials}</span>
161
- ) : fallbackIcon ? (
162
- <span className="inline-flex items-center justify-center w-full h-full">
163
- {fallbackIcon}
164
- </span>
165
- ) : (
166
- <span className={v.icon() + ' inline-flex items-center justify-center'}>
167
- <DefaultUserIcon />
168
- </span>
169
- );
170
-
171
- return (
172
- <span
173
- ref={ref}
174
- className={rootClasses}
175
- role="img"
176
- aria-label={alt ?? name ?? undefined}
177
- >
178
- {showImage ? (
179
- // Inner img is DECORATIVE (alt="") — the parent span carries
180
- // the accessible name via role="img" + aria-label. This avoids
181
- // a duplicate role="img" announcement and matches MUI's a11y
182
- // pattern.
183
- <img
184
- src={src}
185
- alt=""
186
- onError={() => setImgFailed(true)}
187
- {...imgProps}
188
- className={cn(v.img(), imgProps?.className)}
189
- />
190
- ) : (
191
- fallbackContent
192
- )}
193
- </span>
194
- );
195
- });
196
-
197
- Avatar.displayName = 'Avatar';
198
-
199
- // ─── AvatarGroup ─────────────────────────────────────────────────
200
-
201
- /**
202
- * Horizontal spacing tokens for the group overlap. Negative margin
203
- * pulls each child onto the previous, simulating the "stack of
204
- * avatars" pattern. Tokens map to spacing scale.
205
- *
206
- * @internal
207
- */
208
- const GROUP_SPACING: Record<NonNullable<AvatarGroupProps['spacing']>, string> = {
209
- xs: '-space-x-1',
210
- sm: '-space-x-2',
211
- md: '-space-x-3',
212
- };
213
-
214
- /**
215
- * `<AvatarGroup>` — thin horizontal wrapper for overlapping avatars.
216
- *
217
- * Slices children to `max - 1` visible items and renders a trailing
218
- * "+N" overflow indicator with the remaining count (when more than
219
- * `max` children are passed).
220
- *
221
- * Each child Avatar inherits the group's `size` unless it explicitly
222
- * overrides. When `withRing` is `true` (default), each visible
223
- * Avatar gets a `ring-2 ring-white` halo so overlapping borders
224
- * stay visually separated.
225
- *
226
- * @example
227
- * ```tsx
228
- * <AvatarGroup max={3}>
229
- * <Avatar name="Maya Rodriguez" color="primary" />
230
- * <Avatar name="John Doe" color="success" />
231
- * <Avatar name="Sara Chen" color="warning" />
232
- * <Avatar name="Lila Park" color="info" />
233
- * <Avatar name="Eve Kim" color="danger" />
234
- * </AvatarGroup>
235
- * // Renders: MR, JD, SC + a "+2" overflow chip
236
- * ```
237
- */
238
- export const AvatarGroup = forwardRef<HTMLDivElement, AvatarGroupProps>(
239
- function AvatarGroup(props, ref) {
240
- const {
241
- children,
242
- max = 4,
243
- size = 'md',
244
- spacing = 'sm',
245
- withRing = true,
246
- className,
247
- sx,
248
- } = props;
249
-
250
- const allChildren = Children.toArray(children).filter(isValidElement);
251
- const total = allChildren.length;
252
- const visibleCount = Math.min(total, max);
253
- const overflow = Math.max(0, total - visibleCount);
254
-
255
- // Decorate each visible child with size (if not overridden by the
256
- // child) and optional ring halo. cloneElement is the standard
257
- // React pattern for prop-injection across a children array.
258
- const visible = allChildren.slice(0, visibleCount).map((child, idx) => {
259
- const childProps = (child as ReactElement<AvatarProps>).props;
260
- const inheritedSize: AvatarSize = childProps.size ?? size;
261
- const ringClass = withRing ? 'ring-2 ring-neutral-50' : '';
262
- const mergedSx = cn(
263
- ringClass,
264
- childProps.sx as string | undefined,
265
- childProps.className
266
- );
267
- return cloneElement(child as ReactElement<AvatarProps>, {
268
- key: idx,
269
- size: inheritedSize,
270
- sx: mergedSx,
271
- });
272
- });
273
-
274
- return (
275
- <div
276
- ref={ref}
277
- className={cn(
278
- 'inline-flex items-center',
279
- GROUP_SPACING[spacing],
280
- sx,
281
- className
282
- )}
283
- >
284
- {visible}
285
- {overflow > 0 && (
286
- <Avatar
287
- // The overflow indicator IS an avatar (same dimensions /
288
- // radius), but with a +N text fallback rather than initials.
289
- // We pass an empty `name` and a custom `fallbackIcon` that
290
- // renders the count.
291
- size={size}
292
- color="neutral"
293
- sx={cn(withRing && 'ring-2 ring-neutral-50')}
294
- fallbackIcon={
295
- <span className="text-xs font-medium">+{overflow}</span>
296
- }
297
- />
298
- )}
299
- </div>
300
- );
301
- }
302
- );
303
-
304
- AvatarGroup.displayName = 'AvatarGroup';
@@ -1,205 +0,0 @@
1
- import type { ImgHTMLAttributes, ReactNode } from 'react';
2
- import type { ClassValue } from 'tailwind-variants';
3
- import type { BoxProps } from '../Box/box.types.js';
4
-
5
- /**
6
- * Avatar size scale — maps to spacing tokens via avatar.variants.ts:
7
- * - xs → w-5 / 20px
8
- * - sm → w-7 / 28px
9
- * - md → w-9 / 36px ← default
10
- * - lg → w-12 / 48px
11
- * - xl → w-16 / 64px
12
- */
13
- export type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
14
-
15
- /**
16
- * Avatar shape — semantic shortcut. Maps internally to a Box-style
17
- * `radius` value:
18
- * - circle → 'full'
19
- * - rounded → 'lg'
20
- * - square → 'none'
21
- *
22
- * When both `shape` and `radius` are set, `radius` wins (explicit
23
- * token reference takes precedence over semantic shortcut).
24
- */
25
- export type AvatarShape = 'circle' | 'rounded' | 'square';
26
-
27
- /**
28
- * Intent color — drives the fallback bg + text colors when no `src`
29
- * is provided (or when the image fails to load). Reuses the 7
30
- * Dashforge intent tokens.
31
- */
32
- export type AvatarColor =
33
- | 'neutral'
34
- | 'primary'
35
- | 'secondary'
36
- | 'success'
37
- | 'warning'
38
- | 'danger'
39
- | 'info';
40
-
41
- /**
42
- * Tone shade for the fallback background — gives type-safe access to
43
- * any specific shade within the chosen `color` palette. When omitted,
44
- * the default "soft" treatment is applied (bg-{color}-100 +
45
- * text-{color}-900). When set, both bg and text are computed:
46
- * - tones 50-400 → bg-{color}-{tone} + text-{color}-900 (dark text)
47
- * - tones 500-900 → bg-{color}-{tone} + text-{color}-50 (light text)
48
- *
49
- * For colors outside the token palette (custom hex, gradient, image
50
- * patterns), use the `sx` escape hatch with arbitrary Tailwind
51
- * utilities.
52
- */
53
- export type AvatarTone =
54
- | 50
55
- | 100
56
- | 200
57
- | 300
58
- | 400
59
- | 500
60
- | 600
61
- | 700
62
- | 800
63
- | 900;
64
-
65
- /**
66
- * Props for `<Avatar>`.
67
- *
68
- * Fallback resolution chain:
69
- * 1. `src` set + image loads OK → render `<img>`
70
- * 2. `src` set + image fails → render initials from `name`
71
- * (or a generic user icon if `name` is also absent)
72
- * 3. `src` absent + `name` set → render initials from `name`
73
- * (first letter of first two words, uppercased)
74
- * 4. Everything absent → render a generic user icon
75
- *
76
- * No `access` / `visibleWhen` — Avatar is display-only by category.
77
- * For visibility gating, wrap in `<Box>` (which has both props since
78
- * Sprint 4.4).
79
- */
80
- export interface AvatarProps {
81
- // ─── Image source ──────────────────────────────────────────────
82
- /** Image URL. Falls back to initials/icon on load failure. */
83
- src?: string;
84
-
85
- /**
86
- * `alt` text for the image. **Required when `src` is set** (a11y
87
- * — screen readers need a name). When `src` is absent, the alt is
88
- * implied from `name`.
89
- */
90
- alt?: string;
91
-
92
- /** Additional `<img>` HTML attributes (sizes, loading, srcSet, …). */
93
- imgProps?: ImgHTMLAttributes<HTMLImageElement>;
94
-
95
- // ─── Fallback ──────────────────────────────────────────────────
96
- /**
97
- * Person / entity name. Auto-generates initials when `src` is
98
- * absent or the image fails to load. Algorithm: take the first
99
- * letter of the first two whitespace-separated words, uppercased.
100
- * "Maya Rodriguez" → "MR". "Cher" → "C". Empty → generic icon.
101
- */
102
- name?: string;
103
-
104
- // ─── Visual ────────────────────────────────────────────────────
105
- /**
106
- * Shape — semantic shortcut. Override with `radius` for fine
107
- * control on the Box token scale.
108
- * @default 'circle'
109
- */
110
- shape?: AvatarShape;
111
-
112
- /**
113
- * Border radius — same enum as `<Box rounded>` (Box token scale).
114
- * When set, overrides the `shape` mapping. Useful for matching a
115
- * specific Card/Box radius (e.g., `radius='2xl'`).
116
- */
117
- radius?: BoxProps['rounded'];
118
-
119
- /** @default 'md' */
120
- size?: AvatarSize;
121
-
122
- /**
123
- * Intent color used for the fallback background. Ignored when the
124
- * image loads successfully.
125
- * @default 'neutral'
126
- */
127
- color?: AvatarColor;
128
-
129
- /**
130
- * Specific shade within the `color` palette (TS-safe). When set,
131
- * overrides the default "soft" treatment. See `AvatarTone` for the
132
- * full scale.
133
- */
134
- tone?: AvatarTone;
135
-
136
- // ─── Override ──────────────────────────────────────────────────
137
- /** Root-element class shortcut (string or clsx-compatible value). */
138
- sx?: ClassValue;
139
-
140
- /** Standard React className — appended to the root via `cn()`. */
141
- className?: string;
142
-
143
- /**
144
- * Optional custom fallback ReactNode — replaces both initials and
145
- * the generic icon when the image is absent / fails. Useful for
146
- * Avatar-with-emoji or Avatar-with-custom-icon patterns. When
147
- * passed, `name` is ignored for initials generation but kept as
148
- * `alt` semantic.
149
- *
150
- * **NB**: this is the ONE exception to the "no fallback prop —
151
- * only name" rule from the spec. Kept narrow because emoji /
152
- * custom icon avatars are common enough that forcing `sx` for
153
- * them would be friction.
154
- */
155
- fallbackIcon?: ReactNode;
156
- }
157
-
158
- /**
159
- * Props for `<AvatarGroup>` — thin horizontal wrapper.
160
- *
161
- * Renders the first `max` children visibly (with negative-margin
162
- * overlap), then an overflow indicator avatar with the remaining
163
- * count. Each child Avatar inherits `size` from the group unless it
164
- * overrides explicitly. Optional `ring-2 ring-white` halo on each
165
- * child via the group's `withRing` prop (visually separates
166
- * overlapping avatars on a busy background).
167
- */
168
- export interface AvatarGroupProps {
169
- /** Avatar children. */
170
- children: ReactNode;
171
-
172
- /**
173
- * Max number of avatars to render visibly. Excess collapses into
174
- * a trailing "+N" overflow indicator.
175
- * @default 4
176
- */
177
- max?: number;
178
-
179
- /**
180
- * Size applied to every child Avatar (unless the child explicitly
181
- * overrides). Propagated via React.cloneElement.
182
- * @default 'md'
183
- */
184
- size?: AvatarSize;
185
-
186
- /**
187
- * Negative margin between overlapping avatars. Tighter = more
188
- * overlap. Looser = more space.
189
- * @default 'sm'
190
- */
191
- spacing?: 'xs' | 'sm' | 'md';
192
-
193
- /**
194
- * Wrap each child avatar with a `ring-2 ring-white` halo for
195
- * separation on busy backgrounds.
196
- * @default true
197
- */
198
- withRing?: boolean;
199
-
200
- /** Standard className. */
201
- className?: string;
202
-
203
- /** sx escape hatch. */
204
- sx?: ClassValue;
205
- }
@@ -1,194 +0,0 @@
1
- import { tv, type VariantProps } from 'tailwind-variants';
2
-
3
- /**
4
- * Tailwind-variants recipe for `<Avatar>`.
5
- *
6
- * Axes:
7
- * - `size` — 5 steps (xs/sm/md/lg/xl), maps to w/h spacing tokens
8
- * + matching text-size for the initials inside.
9
- * - `radius` — 7 steps (none/sm/md/lg/xl/2xl/full), same scale as
10
- * `<Box rounded>`. `shape` prop in the component maps
11
- * semantically: circle → full, rounded → lg, square → none.
12
- * - `color` — 7 intents. Drives the FALLBACK bg+text only (image
13
- * surface is independent of color).
14
- *
15
- * The `color` × `tone` combo is resolved at render time in
16
- * `Avatar.tsx` via compound lookup — see the SOFT_TINT and TONE
17
- * tables there. We do NOT expand the matrix exhaustively in this TV
18
- * recipe (it would be 7 colors × 10 tones × 5 sizes = 350 rules; the
19
- * runtime resolver keeps the recipe slim).
20
- */
21
- export const avatarVariants = tv({
22
- slots: {
23
- /** Outer wrapper — sets dimensions + radius + ring + alignment. */
24
- root: [
25
- 'relative inline-flex items-center justify-center shrink-0',
26
- 'overflow-hidden align-middle',
27
- 'select-none',
28
- // The font weight + leading are baked into root so initials slot
29
- // inherits them without an extra class layer.
30
- 'font-medium leading-none',
31
- ],
32
- /** `<img>` slot — fills the root, object-cover for crop-to-square. */
33
- img: 'block w-full h-full object-cover',
34
- /** Initials text slot. */
35
- initials: 'uppercase tracking-tight',
36
- /** Generic user icon SVG fallback. */
37
- icon: 'w-1/2 h-1/2 opacity-80',
38
- },
39
- variants: {
40
- size: {
41
- xs: {
42
- root: 'w-5 h-5 text-[10px]',
43
- initials: '',
44
- },
45
- sm: {
46
- root: 'w-7 h-7 text-xs',
47
- initials: '',
48
- },
49
- md: {
50
- root: 'w-9 h-9 text-sm',
51
- initials: '',
52
- },
53
- lg: {
54
- root: 'w-12 h-12 text-base',
55
- initials: '',
56
- },
57
- xl: {
58
- root: 'w-16 h-16 text-xl',
59
- initials: '',
60
- },
61
- },
62
- radius: {
63
- none: { root: 'rounded-none' },
64
- sm: { root: 'rounded-sm' },
65
- md: { root: 'rounded-md' },
66
- lg: { root: 'rounded-lg' },
67
- xl: { root: 'rounded-xl' },
68
- '2xl':{ root: 'rounded-2xl' },
69
- full: { root: 'rounded-full' },
70
- },
71
- },
72
- defaultVariants: {
73
- size: 'md',
74
- radius: 'full',
75
- },
76
- });
77
-
78
- export type AvatarVariants = VariantProps<typeof avatarVariants>;
79
-
80
- /**
81
- * Default "soft" fallback treatment per intent — what you get when
82
- * `tone` is omitted. Light tinted bg + dark text for legibility.
83
- * Neutral row uses no `dark:` because the dashforgePreset() CSS-var
84
- * swap auto-inverts neutral; color rows keep `dark:` for the
85
- * intentional palette shift (palette colors don't auto-invert).
86
- */
87
- export const AVATAR_SOFT_FALLBACK: Record<string, string> = {
88
- neutral: 'bg-neutral-100 text-neutral-900',
89
- primary: 'bg-primary-100 text-primary-900 dark:bg-primary-950 dark:text-primary-100',
90
- secondary: 'bg-secondary-100 text-secondary-900 dark:bg-secondary-950 dark:text-secondary-100',
91
- success: 'bg-success-100 text-success-900 dark:bg-success-950 dark:text-success-100',
92
- warning: 'bg-warning-100 text-warning-900 dark:bg-warning-950 dark:text-warning-100',
93
- danger: 'bg-danger-100 text-danger-900 dark:bg-danger-950 dark:text-danger-100',
94
- info: 'bg-info-100 text-info-900 dark:bg-info-950 dark:text-info-100',
95
- };
96
-
97
- /**
98
- * Specific-tone resolver — when the consumer sets `tone={500}` (or
99
- * any other value), this lookup builds the matching bg + text class.
100
- *
101
- * Text color logic:
102
- * - tones 50-400 → dark text (uses the 900 step)
103
- * - tones 500-900 → light text (uses the 50 step)
104
- *
105
- * Tailwind JIT requires literal class strings, so we enumerate them
106
- * explicitly here. The bundle cost is ~70 lines, acceptable for the
107
- * type-safety win of letting consumers pick any palette shade.
108
- */
109
- export const AVATAR_TONE_FALLBACK: Record<string, Record<number, string>> = {
110
- neutral: {
111
- 50: 'bg-neutral-50 text-neutral-900',
112
- 100: 'bg-neutral-100 text-neutral-900',
113
- 200: 'bg-neutral-200 text-neutral-900',
114
- 300: 'bg-neutral-300 text-neutral-900',
115
- 400: 'bg-neutral-400 text-neutral-900',
116
- 500: 'bg-neutral-500 text-neutral-50',
117
- 600: 'bg-neutral-600 text-neutral-50',
118
- 700: 'bg-neutral-700 text-neutral-50',
119
- 800: 'bg-neutral-800 text-neutral-50',
120
- 900: 'bg-neutral-900 text-neutral-50',
121
- },
122
- primary: {
123
- 50: 'bg-primary-50 text-primary-900',
124
- 100: 'bg-primary-100 text-primary-900',
125
- 200: 'bg-primary-200 text-primary-900',
126
- 300: 'bg-primary-300 text-primary-900',
127
- 400: 'bg-primary-400 text-primary-900',
128
- 500: 'bg-primary-500 text-primary-50',
129
- 600: 'bg-primary-600 text-primary-50',
130
- 700: 'bg-primary-700 text-primary-50',
131
- 800: 'bg-primary-800 text-primary-50',
132
- 900: 'bg-primary-900 text-primary-50',
133
- },
134
- secondary: {
135
- 50: 'bg-secondary-50 text-secondary-900',
136
- 100: 'bg-secondary-100 text-secondary-900',
137
- 200: 'bg-secondary-200 text-secondary-900',
138
- 300: 'bg-secondary-300 text-secondary-900',
139
- 400: 'bg-secondary-400 text-secondary-900',
140
- 500: 'bg-secondary-500 text-secondary-50',
141
- 600: 'bg-secondary-600 text-secondary-50',
142
- 700: 'bg-secondary-700 text-secondary-50',
143
- 800: 'bg-secondary-800 text-secondary-50',
144
- 900: 'bg-secondary-900 text-secondary-50',
145
- },
146
- success: {
147
- 50: 'bg-success-50 text-success-900',
148
- 100: 'bg-success-100 text-success-900',
149
- 200: 'bg-success-200 text-success-900',
150
- 300: 'bg-success-300 text-success-900',
151
- 400: 'bg-success-400 text-success-900',
152
- 500: 'bg-success-500 text-success-50',
153
- 600: 'bg-success-600 text-success-50',
154
- 700: 'bg-success-700 text-success-50',
155
- 800: 'bg-success-800 text-success-50',
156
- 900: 'bg-success-900 text-success-50',
157
- },
158
- warning: {
159
- 50: 'bg-warning-50 text-warning-900',
160
- 100: 'bg-warning-100 text-warning-900',
161
- 200: 'bg-warning-200 text-warning-900',
162
- 300: 'bg-warning-300 text-warning-900',
163
- 400: 'bg-warning-400 text-warning-900',
164
- 500: 'bg-warning-500 text-warning-50',
165
- 600: 'bg-warning-600 text-warning-50',
166
- 700: 'bg-warning-700 text-warning-50',
167
- 800: 'bg-warning-800 text-warning-50',
168
- 900: 'bg-warning-900 text-warning-50',
169
- },
170
- danger: {
171
- 50: 'bg-danger-50 text-danger-900',
172
- 100: 'bg-danger-100 text-danger-900',
173
- 200: 'bg-danger-200 text-danger-900',
174
- 300: 'bg-danger-300 text-danger-900',
175
- 400: 'bg-danger-400 text-danger-900',
176
- 500: 'bg-danger-500 text-danger-50',
177
- 600: 'bg-danger-600 text-danger-50',
178
- 700: 'bg-danger-700 text-danger-50',
179
- 800: 'bg-danger-800 text-danger-50',
180
- 900: 'bg-danger-900 text-danger-50',
181
- },
182
- info: {
183
- 50: 'bg-info-50 text-info-900',
184
- 100: 'bg-info-100 text-info-900',
185
- 200: 'bg-info-200 text-info-900',
186
- 300: 'bg-info-300 text-info-900',
187
- 400: 'bg-info-400 text-info-900',
188
- 500: 'bg-info-500 text-info-50',
189
- 600: 'bg-info-600 text-info-50',
190
- 700: 'bg-info-700 text-info-50',
191
- 800: 'bg-info-800 text-info-50',
192
- 900: 'bg-info-900 text-info-50',
193
- },
194
- };