@fabio.caffarello/react-design-system 1.7.0 → 1.8.0

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 (460) hide show
  1. package/README.md +48 -3
  2. package/dist/docs/components/ComponentStatusTable.d.ts +11 -0
  3. package/dist/ui/atoms/Accordion/Accordion.d.ts +34 -0
  4. package/dist/ui/atoms/Accordion/Accordion.stories.d.ts +11 -0
  5. package/dist/ui/atoms/Accordion/Accordion.test.d.ts +1 -0
  6. package/dist/ui/atoms/Accordion/index.d.ts +2 -0
  7. package/dist/ui/atoms/Avatar/Avatar.d.ts +30 -0
  8. package/dist/ui/atoms/Avatar/Avatar.stories.d.ts +13 -0
  9. package/dist/ui/atoms/Avatar/Avatar.test.d.ts +1 -0
  10. package/dist/ui/atoms/Avatar/AvatarGroup.d.ts +26 -0
  11. package/dist/ui/atoms/Avatar/index.d.ts +9 -0
  12. package/dist/ui/atoms/Badge/Badge.d.ts +14 -6
  13. package/dist/ui/atoms/Badge/Badge.stories.d.ts +8 -9
  14. package/dist/ui/atoms/BoxWrapper/BoxWrapper.d.ts +3 -3
  15. package/dist/ui/atoms/BoxWrapper/BoxWrapper.test.d.ts +1 -0
  16. package/dist/ui/atoms/Button/Button.d.ts +32 -10
  17. package/dist/ui/atoms/Button/Button.stories.d.ts +7 -0
  18. package/dist/ui/atoms/Button/Button.test.d.ts +1 -0
  19. package/dist/ui/atoms/Checkbox/Checkbox.d.ts +2 -1
  20. package/dist/ui/atoms/Collapsible/Collapsible.stories.d.ts +2 -0
  21. package/dist/ui/atoms/Info/Info.d.ts +2 -3
  22. package/dist/ui/atoms/Info/Info.test.d.ts +1 -0
  23. package/dist/ui/atoms/Input/Input.d.ts +14 -4
  24. package/dist/ui/atoms/Input/Input.stories.d.ts +6 -0
  25. package/dist/ui/atoms/Popover/Popover.d.ts +35 -0
  26. package/dist/ui/atoms/Popover/Popover.stories.d.ts +11 -0
  27. package/dist/ui/atoms/Popover/Popover.test.d.ts +1 -0
  28. package/dist/ui/atoms/Popover/index.d.ts +2 -0
  29. package/dist/ui/atoms/Progress/Progress.d.ts +33 -0
  30. package/dist/ui/atoms/Progress/Progress.stories.d.ts +12 -0
  31. package/dist/ui/atoms/Progress/Progress.test.d.ts +1 -0
  32. package/dist/ui/atoms/Select/Select.d.ts +18 -6
  33. package/dist/ui/atoms/Select/Select.stories.d.ts +11 -8
  34. package/dist/ui/atoms/Separator/Separator.d.ts +23 -0
  35. package/dist/ui/atoms/Separator/Separator.stories.d.ts +10 -0
  36. package/dist/ui/atoms/Separator/Separator.test.d.ts +1 -0
  37. package/dist/ui/atoms/Separator/index.d.ts +2 -0
  38. package/dist/ui/atoms/Skeleton/Skeleton.d.ts +1 -1
  39. package/dist/ui/atoms/Skeleton/Skeleton.stories.d.ts +24 -0
  40. package/dist/ui/atoms/Slider/Slider.d.ts +45 -0
  41. package/dist/ui/atoms/Slider/Slider.stories.d.ts +13 -0
  42. package/dist/ui/atoms/Slider/Slider.test.d.ts +1 -0
  43. package/dist/ui/atoms/Slider/index.d.ts +2 -0
  44. package/dist/ui/atoms/Spinner/Spinner.d.ts +22 -0
  45. package/dist/ui/atoms/Spinner/Spinner.stories.d.ts +9 -0
  46. package/dist/ui/atoms/Spinner/Spinner.test.d.ts +1 -0
  47. package/dist/ui/atoms/Switch/Switch.d.ts +28 -0
  48. package/dist/ui/atoms/Switch/Switch.stories.d.ts +11 -0
  49. package/dist/ui/atoms/Switch/Switch.test.d.ts +1 -0
  50. package/dist/ui/atoms/Switch/index.d.ts +2 -0
  51. package/dist/ui/atoms/Tooltip/Tooltip.d.ts +2 -1
  52. package/dist/ui/atoms/Tooltip/Tooltip.stories.d.ts +17 -0
  53. package/dist/ui/atoms/index.d.ts +20 -3
  54. package/dist/ui/index.d.ts +6 -1
  55. package/dist/ui/molecules/Card/Card.d.ts +6 -2
  56. package/dist/ui/molecules/Card/Card.stories.d.ts +2 -0
  57. package/dist/ui/molecules/ColorPicker/ColorPicker.d.ts +28 -0
  58. package/dist/ui/molecules/ColorPicker/ColorPicker.stories.d.ts +12 -0
  59. package/dist/ui/molecules/ColorPicker/ColorPicker.test.d.ts +1 -0
  60. package/dist/ui/molecules/ColorPicker/index.d.ts +2 -0
  61. package/dist/ui/molecules/DatePicker/DatePicker.d.ts +74 -0
  62. package/dist/ui/molecules/DatePicker/DatePicker.stories.d.ts +12 -0
  63. package/dist/ui/molecules/DatePicker/DatePicker.test.d.ts +1 -0
  64. package/dist/ui/molecules/DatePicker/DatePickerCalendar.d.ts +6 -0
  65. package/dist/ui/molecules/DatePicker/DatePickerContext.d.ts +28 -0
  66. package/dist/ui/molecules/DatePicker/DatePickerInput.d.ts +9 -0
  67. package/dist/ui/molecules/DatePicker/DatePickerProvider.d.ts +23 -0
  68. package/dist/ui/molecules/DatePicker/index.d.ts +14 -0
  69. package/dist/ui/molecules/Dropdown/Dropdown.d.ts +2 -1
  70. package/dist/ui/molecules/Dropdown/Dropdown.stories.d.ts +13 -0
  71. package/dist/ui/molecules/EmptyState/EmptyState.stories.d.ts +22 -0
  72. package/dist/ui/molecules/FileUpload/FileUpload.d.ts +37 -0
  73. package/dist/ui/molecules/FileUpload/FileUpload.stories.d.ts +12 -0
  74. package/dist/ui/molecules/FileUpload/FileUpload.test.d.ts +1 -0
  75. package/dist/ui/molecules/FileUpload/index.d.ts +2 -0
  76. package/dist/ui/molecules/Form/Form.d.ts +29 -4
  77. package/dist/ui/molecules/Form/Form.stories.d.ts +2 -0
  78. package/dist/ui/molecules/Form/FormContext.d.ts +17 -0
  79. package/dist/ui/molecules/Form/FormField.d.ts +36 -0
  80. package/dist/ui/molecules/Form/FormProvider.d.ts +14 -0
  81. package/dist/ui/molecules/Form/index.d.ts +13 -0
  82. package/dist/ui/molecules/Form/useFormFieldArray.d.ts +28 -0
  83. package/dist/ui/molecules/InputWithLabel/InputWithLabel.test.d.ts +1 -0
  84. package/dist/ui/molecules/Rating/Rating.d.ts +33 -0
  85. package/dist/ui/molecules/Rating/Rating.stories.d.ts +13 -0
  86. package/dist/ui/molecules/Rating/Rating.test.d.ts +1 -0
  87. package/dist/ui/molecules/Rating/index.d.ts +2 -0
  88. package/dist/ui/molecules/SearchInput/SearchInput.d.ts +24 -0
  89. package/dist/ui/molecules/SearchInput/SearchInput.stories.d.ts +10 -0
  90. package/dist/ui/molecules/SearchInput/SearchInput.test.d.ts +1 -0
  91. package/dist/ui/molecules/SearchInput/index.d.ts +2 -0
  92. package/dist/ui/molecules/SidebarHeader/SidebarHeader.test.d.ts +1 -0
  93. package/dist/ui/molecules/TableActions/TableActions.d.ts +31 -0
  94. package/dist/ui/molecules/TableActions/TableActions.stories.d.ts +7 -0
  95. package/dist/ui/molecules/TableActions/TableActions.test.d.ts +1 -0
  96. package/dist/ui/molecules/TableFilters/TableFilters.d.ts +37 -0
  97. package/dist/ui/molecules/TableFilters/TableFilters.stories.d.ts +7 -0
  98. package/dist/ui/molecules/TableFilters/TableFilters.test.d.ts +1 -0
  99. package/dist/ui/molecules/TablePagination/TablePagination.d.ts +29 -0
  100. package/dist/ui/molecules/TablePagination/TablePagination.stories.d.ts +8 -0
  101. package/dist/ui/molecules/TablePagination/TablePagination.test.d.ts +1 -0
  102. package/dist/ui/molecules/Tabs/Tabs.d.ts +15 -0
  103. package/dist/ui/molecules/Tabs/Tabs.stories.d.ts +10 -0
  104. package/dist/ui/molecules/Tabs/Tabs.test.d.ts +1 -0
  105. package/dist/ui/molecules/Tabs/TabsContent.d.ts +14 -0
  106. package/dist/ui/molecules/Tabs/TabsContext.d.ts +18 -0
  107. package/dist/ui/molecules/Tabs/TabsList.d.ts +12 -0
  108. package/dist/ui/molecules/Tabs/TabsProvider.d.ts +16 -0
  109. package/dist/ui/molecules/Tabs/TabsTrigger.d.ts +13 -0
  110. package/dist/ui/molecules/Tabs/index.d.ts +17 -0
  111. package/dist/ui/molecules/TimePicker/TimePicker.d.ts +29 -0
  112. package/dist/ui/molecules/TimePicker/TimePicker.stories.d.ts +12 -0
  113. package/dist/ui/molecules/TimePicker/TimePicker.test.d.ts +1 -0
  114. package/dist/ui/molecules/TimePicker/index.d.ts +2 -0
  115. package/dist/ui/molecules/index.d.ts +13 -5
  116. package/dist/ui/organisms/CommandPalette/CommandPalette.d.ts +37 -0
  117. package/dist/ui/organisms/CommandPalette/CommandPalette.stories.d.ts +11 -0
  118. package/dist/ui/organisms/CommandPalette/CommandPalette.test.d.ts +1 -0
  119. package/dist/ui/organisms/CommandPalette/index.d.ts +2 -0
  120. package/dist/ui/organisms/DataGrid/DataGrid.d.ts +84 -0
  121. package/dist/ui/organisms/DataGrid/DataGrid.stories.d.ts +14 -0
  122. package/dist/ui/organisms/DataGrid/DataGrid.test.d.ts +1 -0
  123. package/dist/ui/organisms/DataGrid/index.d.ts +2 -0
  124. package/dist/ui/organisms/Dialog/AlertDialog.d.ts +34 -0
  125. package/dist/ui/organisms/Dialog/Dialog.d.ts +58 -0
  126. package/dist/ui/organisms/Dialog/Dialog.stories.d.ts +13 -0
  127. package/dist/ui/organisms/Dialog/Dialog.test.d.ts +1 -0
  128. package/dist/ui/organisms/Dialog/DialogClose.d.ts +8 -0
  129. package/dist/ui/organisms/Dialog/DialogContent.d.ts +8 -0
  130. package/dist/ui/organisms/Dialog/DialogContext.d.ts +10 -0
  131. package/dist/ui/organisms/Dialog/DialogDescription.d.ts +4 -0
  132. package/dist/ui/organisms/Dialog/DialogFooter.d.ts +5 -0
  133. package/dist/ui/organisms/Dialog/DialogHeader.d.ts +5 -0
  134. package/dist/ui/organisms/Dialog/DialogProvider.d.ts +10 -0
  135. package/dist/ui/organisms/Dialog/DialogTitle.d.ts +5 -0
  136. package/dist/ui/organisms/Dialog/DialogTrigger.d.ts +6 -0
  137. package/dist/ui/organisms/Dialog/index.d.ts +22 -0
  138. package/dist/ui/organisms/Sidebar/Sidebar.d.ts +7 -4
  139. package/dist/ui/organisms/Sidebar/SidebarGroup/SidebarGroup.d.ts +27 -0
  140. package/dist/ui/organisms/Sidebar/SidebarGroup/SidebarGroup.stories.d.ts +11 -0
  141. package/dist/ui/organisms/Sidebar/SidebarGroup/SidebarGroup.test.d.ts +1 -0
  142. package/dist/ui/organisms/Sidebar/SidebarHeader/SidebarHeader.d.ts +19 -0
  143. package/dist/ui/organisms/Sidebar/SidebarHeader/SidebarHeader.test.d.ts +1 -0
  144. package/dist/ui/organisms/Sidebar/SidebarItem/SidebarItem.d.ts +23 -0
  145. package/dist/ui/organisms/Sidebar/SidebarItem/SidebarItem.stories.d.ts +10 -0
  146. package/dist/ui/organisms/Sidebar/SidebarItem/SidebarItem.test.d.ts +1 -0
  147. package/dist/ui/organisms/Sidebar/index.d.ts +8 -0
  148. package/dist/ui/organisms/Stepper/Stepper.d.ts +40 -0
  149. package/dist/ui/organisms/Stepper/Stepper.stories.d.ts +12 -0
  150. package/dist/ui/organisms/Stepper/Stepper.test.d.ts +1 -0
  151. package/dist/ui/organisms/Stepper/index.d.ts +2 -0
  152. package/dist/ui/organisms/Table/Table.d.ts +84 -16
  153. package/dist/ui/organisms/Table/Table.stories.d.ts +15 -0
  154. package/dist/ui/organisms/Table/TableActions/TableActions.d.ts +31 -0
  155. package/dist/ui/organisms/Table/TableActions/TableActions.stories.d.ts +7 -0
  156. package/dist/ui/organisms/Table/TableActions/TableActions.test.d.ts +1 -0
  157. package/dist/ui/organisms/Table/TableActions.d.ts +13 -0
  158. package/dist/ui/organisms/Table/TableBody.d.ts +12 -0
  159. package/dist/ui/organisms/Table/TableCell.d.ts +14 -0
  160. package/dist/ui/organisms/Table/TableContext.d.ts +75 -0
  161. package/dist/ui/organisms/Table/TableEmptyState.d.ts +11 -0
  162. package/dist/ui/organisms/Table/TableFilters/TableFilters.d.ts +37 -0
  163. package/dist/ui/organisms/Table/TableFilters/TableFilters.stories.d.ts +7 -0
  164. package/dist/ui/organisms/Table/TableFilters/TableFilters.test.d.ts +1 -0
  165. package/dist/ui/organisms/Table/TableFilters.d.ts +12 -0
  166. package/dist/ui/organisms/Table/TableHeader.d.ts +10 -0
  167. package/dist/ui/organisms/Table/TableHeaderCell.d.ts +18 -0
  168. package/dist/ui/organisms/Table/TableHeaderRow.d.ts +10 -0
  169. package/dist/ui/organisms/Table/TablePagination/TablePagination.d.ts +29 -0
  170. package/dist/ui/organisms/Table/TablePagination/TablePagination.stories.d.ts +8 -0
  171. package/dist/ui/organisms/Table/TablePagination/TablePagination.test.d.ts +1 -0
  172. package/dist/ui/organisms/Table/TablePagination.d.ts +14 -0
  173. package/dist/ui/organisms/Table/TableProvider.d.ts +55 -0
  174. package/dist/ui/organisms/Table/TableRow.d.ts +14 -0
  175. package/dist/ui/organisms/Table/TableTypes.d.ts +8 -0
  176. package/dist/ui/organisms/Table/index.d.ts +30 -0
  177. package/dist/ui/organisms/Table/useColumnResizing.d.ts +39 -0
  178. package/dist/ui/organisms/Table/useVirtualScrolling.d.ts +35 -0
  179. package/dist/ui/organisms/Timeline/Timeline.d.ts +34 -0
  180. package/dist/ui/organisms/Timeline/Timeline.stories.d.ts +12 -0
  181. package/dist/ui/organisms/Timeline/Timeline.test.d.ts +1 -0
  182. package/dist/ui/organisms/Timeline/index.d.ts +2 -0
  183. package/dist/ui/organisms/Toast/Toast.d.ts +8 -0
  184. package/dist/ui/organisms/Toast/Toast.stories.d.ts +14 -0
  185. package/dist/ui/organisms/Toast/Toast.test.d.ts +1 -0
  186. package/dist/ui/organisms/Toast/ToastContainer.d.ts +5 -0
  187. package/dist/ui/organisms/Toast/ToastContext.d.ts +21 -0
  188. package/dist/ui/organisms/Toast/ToastProvider.d.ts +7 -0
  189. package/dist/ui/organisms/Toast/index.d.ts +15 -0
  190. package/dist/ui/organisms/Toast/useToast.d.ts +35 -0
  191. package/dist/ui/organisms/index.d.ts +12 -2
  192. package/dist/ui/providers/AdvancedThemeProvider.d.ts +52 -0
  193. package/dist/ui/providers/index.d.ts +9 -0
  194. package/dist/ui/themes/ThemeBuilder.d.ts +28 -0
  195. package/dist/ui/themes/ThemeRegistry.d.ts +55 -0
  196. package/dist/ui/themes/index.d.ts +9 -0
  197. package/dist/ui/themes/types.d.ts +48 -0
  198. package/dist/ui/themes/utils.d.ts +21 -0
  199. package/dist/ui/tokens/TokenVisualizations.d.ts +41 -0
  200. package/dist/ui/tokens/animations.d.ts +65 -0
  201. package/dist/ui/tokens/borders.d.ts +61 -0
  202. package/dist/ui/tokens/gradients.d.ts +55 -0
  203. package/dist/ui/tokens/index.d.ts +31 -0
  204. package/dist/ui/tokens/opacity.d.ts +51 -0
  205. package/dist/ui/tokens/radius.d.ts +45 -0
  206. package/dist/ui/tokens/shadows.d.ts +42 -0
  207. package/dist/ui/tokens/themes/dark.d.ts +26 -26
  208. package/dist/ui/tokens/themes/light.d.ts +26 -26
  209. package/dist/ui/tokens/tokens.factory.d.ts +42 -0
  210. package/dist/ui/tokens/z-index.d.ts +44 -0
  211. package/dist/ui/utils/index.d.ts +6 -0
  212. package/package.json +50 -6
  213. package/src/docs/Accessibility.mdx +402 -0
  214. package/src/docs/BestPractices.mdx +315 -0
  215. package/src/docs/ComponentComposition.mdx +381 -0
  216. package/src/docs/ComponentStatus.mdx +177 -0
  217. package/src/docs/DesignSystem.mdx +121 -0
  218. package/src/docs/GettingStarted.mdx +284 -0
  219. package/src/docs/MigrationGuide.mdx +297 -0
  220. package/src/docs/Performance.mdx +206 -0
  221. package/src/docs/components/ComponentStatusTable.tsx +184 -0
  222. package/src/setupTests.ts +32 -0
  223. package/src/ui/atoms/Accordion/Accordion.stories.tsx +147 -0
  224. package/src/ui/atoms/Accordion/Accordion.test.tsx +86 -0
  225. package/src/ui/atoms/Accordion/Accordion.tsx +147 -0
  226. package/src/ui/atoms/Accordion/index.ts +2 -0
  227. package/src/ui/atoms/Avatar/Avatar.stories.tsx +226 -0
  228. package/src/ui/atoms/Avatar/Avatar.test.tsx +233 -0
  229. package/src/ui/atoms/Avatar/Avatar.tsx +128 -0
  230. package/src/ui/atoms/Avatar/AvatarGroup.tsx +96 -0
  231. package/src/ui/atoms/Avatar/index.ts +11 -0
  232. package/src/ui/atoms/Badge/Badge.stories.tsx +65 -56
  233. package/src/ui/atoms/Badge/Badge.test.tsx +27 -50
  234. package/src/ui/atoms/Badge/Badge.tsx +70 -27
  235. package/src/ui/atoms/BoxWrapper/BoxWrapper.stories.tsx +1 -1
  236. package/src/ui/atoms/BoxWrapper/BoxWrapper.test.tsx +27 -0
  237. package/src/ui/atoms/BoxWrapper/BoxWrapper.tsx +5 -2
  238. package/src/ui/atoms/Button/Button.stories.tsx +130 -1
  239. package/src/ui/atoms/Button/Button.test.tsx +233 -0
  240. package/src/ui/atoms/Button/Button.tsx +160 -53
  241. package/src/ui/atoms/Checkbox/Checkbox.tsx +14 -1
  242. package/src/ui/atoms/Collapsible/Collapsible.stories.tsx +47 -1
  243. package/src/ui/atoms/Collapsible/Collapsible.test.tsx +36 -24
  244. package/src/ui/atoms/Collapsible/Collapsible.tsx +9 -1
  245. package/src/ui/atoms/ErrorMessage/ErrorMessage.stories.tsx +1 -1
  246. package/src/ui/atoms/Info/Info.stories.tsx +1 -1
  247. package/src/ui/atoms/Info/Info.test.tsx +45 -0
  248. package/src/ui/atoms/Info/Info.tsx +2 -2
  249. package/src/ui/atoms/Input/Input.stories.tsx +80 -0
  250. package/src/ui/atoms/Input/Input.test.tsx +190 -36
  251. package/src/ui/atoms/Input/Input.tsx +144 -25
  252. package/src/ui/atoms/Label/Label.stories.tsx +1 -1
  253. package/src/ui/atoms/NavLink/NavLink.stories.tsx +1 -1
  254. package/src/ui/atoms/Popover/Popover.stories.tsx +157 -0
  255. package/src/ui/atoms/Popover/Popover.test.tsx +80 -0
  256. package/src/ui/atoms/Popover/Popover.tsx +256 -0
  257. package/src/ui/atoms/Popover/index.ts +2 -0
  258. package/src/ui/atoms/Progress/Progress.css +17 -0
  259. package/src/ui/atoms/Progress/Progress.stories.tsx +170 -0
  260. package/src/ui/atoms/Progress/Progress.test.tsx +134 -0
  261. package/src/ui/atoms/Progress/Progress.tsx +138 -0
  262. package/src/ui/atoms/Radio/Radio.tsx +1 -1
  263. package/src/ui/atoms/Select/Select.stories.tsx +93 -58
  264. package/src/ui/atoms/Select/Select.test.tsx +162 -46
  265. package/src/ui/atoms/Select/Select.tsx +142 -44
  266. package/src/ui/atoms/Separator/Separator.stories.tsx +88 -0
  267. package/src/ui/atoms/Separator/Separator.test.tsx +34 -0
  268. package/src/ui/atoms/Separator/Separator.tsx +81 -0
  269. package/src/ui/atoms/Separator/index.ts +2 -0
  270. package/src/ui/atoms/Skeleton/Skeleton.stories.tsx +62 -0
  271. package/src/ui/atoms/Skeleton/Skeleton.tsx +19 -2
  272. package/src/ui/atoms/Slider/Slider.stories.tsx +205 -0
  273. package/src/ui/atoms/Slider/Slider.test.tsx +53 -0
  274. package/src/ui/atoms/Slider/Slider.tsx +307 -0
  275. package/src/ui/atoms/Slider/index.ts +2 -0
  276. package/src/ui/atoms/Spinner/Spinner.stories.tsx +56 -0
  277. package/src/ui/atoms/Spinner/Spinner.test.tsx +35 -0
  278. package/src/ui/atoms/Spinner/Spinner.tsx +88 -0
  279. package/src/ui/atoms/Switch/Switch.stories.tsx +182 -0
  280. package/src/ui/atoms/Switch/Switch.test.tsx +90 -0
  281. package/src/ui/atoms/Switch/Switch.tsx +181 -0
  282. package/src/ui/atoms/Switch/index.ts +2 -0
  283. package/src/ui/atoms/Text/Text.stories.tsx +1 -1
  284. package/src/ui/atoms/Text/Text.test.tsx +48 -32
  285. package/src/ui/atoms/Textarea/Textarea.stories.tsx +1 -1
  286. package/src/ui/atoms/Tooltip/Tooltip.stories.tsx +44 -0
  287. package/src/ui/atoms/Tooltip/Tooltip.tsx +94 -6
  288. package/src/ui/atoms/index.ts +27 -4
  289. package/src/ui/index.ts +6 -1
  290. package/src/ui/molecules/Breadcrumb/Breadcrumb.stories.tsx +1 -1
  291. package/src/ui/molecules/Breadcrumb/Breadcrumb.tsx +1 -1
  292. package/src/ui/molecules/Card/Card.stories.tsx +49 -1
  293. package/src/ui/molecules/Card/Card.tsx +40 -5
  294. package/src/ui/molecules/ColorPicker/ColorPicker.stories.tsx +156 -0
  295. package/src/ui/molecules/ColorPicker/ColorPicker.test.tsx +47 -0
  296. package/src/ui/molecules/ColorPicker/ColorPicker.tsx +271 -0
  297. package/src/ui/molecules/ColorPicker/index.ts +2 -0
  298. package/src/ui/molecules/DatePicker/DatePicker.mdx +150 -0
  299. package/src/ui/molecules/DatePicker/DatePicker.stories.tsx +188 -0
  300. package/src/ui/molecules/DatePicker/DatePicker.test.tsx +381 -0
  301. package/src/ui/molecules/DatePicker/DatePicker.tsx +231 -0
  302. package/src/ui/molecules/DatePicker/DatePickerCalendar.tsx +277 -0
  303. package/src/ui/molecules/DatePicker/DatePickerContext.tsx +39 -0
  304. package/src/ui/molecules/DatePicker/DatePickerInput.tsx +147 -0
  305. package/src/ui/molecules/DatePicker/DatePickerProvider.tsx +100 -0
  306. package/src/ui/molecules/DatePicker/index.ts +16 -0
  307. package/src/ui/molecules/Dropdown/Dropdown.stories.tsx +50 -8
  308. package/src/ui/molecules/Dropdown/Dropdown.test.tsx +272 -12
  309. package/src/ui/molecules/Dropdown/Dropdown.tsx +176 -10
  310. package/src/ui/molecules/EmptyState/EmptyState.stories.tsx +24 -2
  311. package/src/ui/molecules/EmptyState/EmptyState.tsx +9 -3
  312. package/src/ui/molecules/FileUpload/FileUpload.stories.tsx +177 -0
  313. package/src/ui/molecules/FileUpload/FileUpload.test.tsx +114 -0
  314. package/src/ui/molecules/FileUpload/FileUpload.tsx +312 -0
  315. package/src/ui/molecules/FileUpload/index.ts +2 -0
  316. package/src/ui/molecules/Form/Form.mdx +145 -0
  317. package/src/ui/molecules/Form/Form.stories.tsx +121 -1
  318. package/src/ui/molecules/Form/Form.test.tsx +1 -3
  319. package/src/ui/molecules/Form/Form.tsx +95 -15
  320. package/src/ui/molecules/Form/FormContext.tsx +35 -0
  321. package/src/ui/molecules/Form/FormField.tsx +83 -0
  322. package/src/ui/molecules/Form/FormProvider.tsx +34 -0
  323. package/src/ui/molecules/Form/index.ts +21 -0
  324. package/src/ui/molecules/Form/useFormFieldArray.ts +46 -0
  325. package/src/ui/molecules/InputWithLabel/InputWithLabel.stories.tsx +1 -1
  326. package/src/ui/molecules/InputWithLabel/InputWithLabel.test.tsx +44 -0
  327. package/src/ui/molecules/InputWithLabel/InputWithLabel.tsx +3 -1
  328. package/src/ui/molecules/NavbarGroup/NavbarGroup.stories.tsx +1 -1
  329. package/src/ui/molecules/Pagination/Pagination.stories.tsx +1 -1
  330. package/src/ui/molecules/Rating/Rating.stories.tsx +206 -0
  331. package/src/ui/molecules/Rating/Rating.test.tsx +60 -0
  332. package/src/ui/molecules/Rating/Rating.tsx +173 -0
  333. package/src/ui/molecules/Rating/index.ts +2 -0
  334. package/src/ui/molecules/SearchInput/SearchInput.stories.tsx +146 -0
  335. package/src/ui/molecules/SearchInput/SearchInput.test.tsx +82 -0
  336. package/src/ui/molecules/SearchInput/SearchInput.tsx +133 -0
  337. package/src/ui/molecules/SearchInput/index.ts +2 -0
  338. package/src/ui/molecules/Tabs/Tabs.stories.tsx +229 -0
  339. package/src/ui/molecules/Tabs/Tabs.test.tsx +497 -0
  340. package/src/ui/molecules/Tabs/Tabs.tsx +58 -0
  341. package/src/ui/molecules/Tabs/TabsContent.tsx +50 -0
  342. package/src/ui/molecules/Tabs/TabsContext.tsx +36 -0
  343. package/src/ui/molecules/Tabs/TabsList.tsx +98 -0
  344. package/src/ui/molecules/Tabs/TabsProvider.tsx +53 -0
  345. package/src/ui/molecules/Tabs/TabsTrigger.tsx +111 -0
  346. package/src/ui/molecules/Tabs/index.ts +23 -0
  347. package/src/ui/molecules/TimePicker/TimePicker.stories.tsx +145 -0
  348. package/src/ui/molecules/TimePicker/TimePicker.test.tsx +41 -0
  349. package/src/ui/molecules/TimePicker/TimePicker.tsx +264 -0
  350. package/src/ui/molecules/TimePicker/index.ts +2 -0
  351. package/src/ui/molecules/index.ts +20 -7
  352. package/src/ui/organisms/CommandPalette/CommandPalette.stories.tsx +218 -0
  353. package/src/ui/organisms/CommandPalette/CommandPalette.test.tsx +85 -0
  354. package/src/ui/organisms/CommandPalette/CommandPalette.tsx +333 -0
  355. package/src/ui/organisms/CommandPalette/index.ts +2 -0
  356. package/src/ui/organisms/DataGrid/DataGrid.stories.tsx +196 -0
  357. package/src/ui/organisms/DataGrid/DataGrid.test.tsx +53 -0
  358. package/src/ui/organisms/DataGrid/DataGrid.tsx +294 -0
  359. package/src/ui/organisms/DataGrid/index.ts +2 -0
  360. package/src/ui/organisms/Dialog/AlertDialog.tsx +92 -0
  361. package/src/ui/organisms/Dialog/Dialog.mdx +200 -0
  362. package/src/ui/organisms/Dialog/Dialog.stories.tsx +226 -0
  363. package/src/ui/organisms/Dialog/Dialog.test.tsx +435 -0
  364. package/src/ui/organisms/Dialog/Dialog.tsx +79 -0
  365. package/src/ui/organisms/Dialog/DialogClose.tsx +45 -0
  366. package/src/ui/organisms/Dialog/DialogContent.tsx +149 -0
  367. package/src/ui/organisms/Dialog/DialogContext.tsx +25 -0
  368. package/src/ui/organisms/Dialog/DialogDescription.tsx +28 -0
  369. package/src/ui/organisms/Dialog/DialogFooter.tsx +18 -0
  370. package/src/ui/organisms/Dialog/DialogHeader.tsx +18 -0
  371. package/src/ui/organisms/Dialog/DialogProvider.tsx +73 -0
  372. package/src/ui/organisms/Dialog/DialogTitle.tsx +31 -0
  373. package/src/ui/organisms/Dialog/DialogTrigger.tsx +34 -0
  374. package/src/ui/organisms/Dialog/index.ts +24 -0
  375. package/src/ui/organisms/LoginBox/LoginBox.stories.tsx +1 -1
  376. package/src/ui/organisms/Modal/Modal.stories.tsx +2 -2
  377. package/src/ui/organisms/Modal/Modal.test.tsx +1 -1
  378. package/src/ui/organisms/Sidebar/Sidebar.stories.tsx +1 -1
  379. package/src/ui/organisms/Sidebar/Sidebar.test.tsx +5 -3
  380. package/src/ui/organisms/Sidebar/Sidebar.tsx +21 -6
  381. package/src/ui/{molecules → organisms/Sidebar}/SidebarGroup/SidebarGroup.stories.tsx +2 -2
  382. package/src/ui/{molecules → organisms/Sidebar}/SidebarGroup/SidebarGroup.test.tsx +32 -9
  383. package/src/ui/{molecules → organisms/Sidebar}/SidebarGroup/SidebarGroup.tsx +7 -7
  384. package/src/ui/organisms/Sidebar/SidebarHeader/SidebarHeader.test.tsx +66 -0
  385. package/src/ui/{molecules → organisms/Sidebar}/SidebarHeader/SidebarHeader.tsx +1 -2
  386. package/src/ui/{atoms → organisms/Sidebar}/SidebarItem/SidebarItem.stories.tsx +1 -1
  387. package/src/ui/{atoms → organisms/Sidebar}/SidebarItem/SidebarItem.test.tsx +9 -8
  388. package/src/ui/{atoms → organisms/Sidebar}/SidebarItem/SidebarItem.tsx +9 -3
  389. package/src/ui/organisms/Sidebar/index.ts +13 -0
  390. package/src/ui/organisms/Stepper/Stepper.stories.tsx +253 -0
  391. package/src/ui/organisms/Stepper/Stepper.test.tsx +76 -0
  392. package/src/ui/organisms/Stepper/Stepper.tsx +323 -0
  393. package/src/ui/organisms/Stepper/index.ts +2 -0
  394. package/src/ui/organisms/Table/Table.mdx +154 -0
  395. package/src/ui/organisms/Table/Table.stories.tsx +614 -4
  396. package/src/ui/organisms/Table/Table.test.tsx +86 -4
  397. package/src/ui/organisms/Table/Table.tsx +215 -99
  398. package/src/ui/organisms/Table/TableActions/TableActions.stories.tsx +88 -0
  399. package/src/ui/organisms/Table/TableActions/TableActions.test.tsx +64 -0
  400. package/src/ui/organisms/Table/TableActions/TableActions.tsx +71 -0
  401. package/src/ui/organisms/Table/TableActions.tsx +46 -0
  402. package/src/ui/organisms/Table/TableBody.tsx +137 -0
  403. package/src/ui/organisms/Table/TableCell.tsx +36 -0
  404. package/src/ui/organisms/Table/TableContext.tsx +111 -0
  405. package/src/ui/organisms/Table/TableEmptyState.tsx +51 -0
  406. package/src/ui/organisms/Table/TableFilters/TableFilters.stories.tsx +111 -0
  407. package/src/ui/organisms/Table/TableFilters/TableFilters.test.tsx +104 -0
  408. package/src/ui/organisms/Table/TableFilters/TableFilters.tsx +191 -0
  409. package/src/ui/organisms/Table/TableFilters.tsx +39 -0
  410. package/src/ui/organisms/Table/TableHeader.tsx +29 -0
  411. package/src/ui/organisms/Table/TableHeaderCell.tsx +142 -0
  412. package/src/ui/organisms/Table/TableHeaderRow.tsx +72 -0
  413. package/src/ui/organisms/Table/TablePagination/TablePagination.stories.tsx +87 -0
  414. package/src/ui/organisms/Table/TablePagination/TablePagination.test.tsx +90 -0
  415. package/src/ui/organisms/Table/TablePagination/TablePagination.tsx +207 -0
  416. package/src/ui/organisms/Table/TablePagination.tsx +48 -0
  417. package/src/ui/organisms/Table/TableProvider.tsx +429 -0
  418. package/src/ui/organisms/Table/TableRow.tsx +85 -0
  419. package/src/ui/organisms/Table/TableTypes.ts +11 -0
  420. package/src/ui/organisms/Table/index.ts +55 -0
  421. package/src/ui/organisms/Table/useColumnResizing.ts +134 -0
  422. package/src/ui/organisms/Table/useVirtualScrolling.ts +116 -0
  423. package/src/ui/organisms/Timeline/Timeline.stories.tsx +230 -0
  424. package/src/ui/organisms/Timeline/Timeline.test.tsx +47 -0
  425. package/src/ui/organisms/Timeline/Timeline.tsx +179 -0
  426. package/src/ui/organisms/Timeline/index.ts +2 -0
  427. package/src/ui/organisms/Toast/Toast.stories.tsx +169 -0
  428. package/src/ui/organisms/Toast/Toast.test.tsx +537 -0
  429. package/src/ui/organisms/Toast/Toast.tsx +144 -0
  430. package/src/ui/organisms/Toast/ToastContainer.tsx +54 -0
  431. package/src/ui/organisms/Toast/ToastContext.tsx +38 -0
  432. package/src/ui/organisms/Toast/ToastProvider.tsx +56 -0
  433. package/src/ui/organisms/Toast/index.ts +17 -0
  434. package/src/ui/organisms/Toast/useToast.ts +70 -0
  435. package/src/ui/organisms/index.ts +17 -2
  436. package/src/ui/providers/AdvancedThemeProvider.tsx +229 -0
  437. package/src/ui/providers/index.ts +14 -0
  438. package/src/ui/themes/README.md +281 -0
  439. package/src/ui/themes/ThemeBuilder.ts +149 -0
  440. package/src/ui/themes/ThemeRegistry.ts +187 -0
  441. package/src/ui/themes/index.ts +20 -0
  442. package/src/ui/themes/types.ts +53 -0
  443. package/src/ui/themes/utils.ts +70 -0
  444. package/src/ui/tokens/README.md +212 -0
  445. package/src/ui/tokens/TokenVisualizations.tsx +273 -0
  446. package/src/ui/tokens/Tokens.mdx +348 -0
  447. package/src/ui/tokens/animations.ts +157 -0
  448. package/src/ui/tokens/borders.ts +121 -0
  449. package/src/ui/tokens/gradients.ts +154 -0
  450. package/src/ui/tokens/index.ts +57 -0
  451. package/src/ui/tokens/opacity.ts +107 -0
  452. package/src/ui/tokens/radius.ts +107 -0
  453. package/src/ui/tokens/shadows.ts +92 -0
  454. package/src/ui/tokens/tokens.factory.ts +124 -0
  455. package/src/ui/tokens/z-index.ts +113 -0
  456. package/src/ui/utils/index.ts +10 -0
  457. package/src/App.css +0 -42
  458. package/src/App.tsx +0 -35
  459. package/src/index.css +0 -68
  460. package/src/main.tsx +0 -15
@@ -0,0 +1,281 @@
1
+ # Advanced Theme System
2
+
3
+ Sistema avançado de temas para o React Design System, com suporte a múltiplos temas, CSS variables, herança de temas e transições suaves.
4
+
5
+ ## Características
6
+
7
+ - ✅ **Múltiplos Temas Simultâneos**: Registre e use vários temas na mesma aplicação
8
+ - ✅ **CSS Variables**: Geração automática de variáveis CSS a partir de tokens
9
+ - ✅ **Theme Inheritance**: Herde de temas base (light/dark) e customize apenas o necessário
10
+ - ✅ **Transições Suaves**: Transições animadas entre temas
11
+ - ✅ **Persistência**: Salva preferências de tema no localStorage
12
+ - ✅ **Type-Safe**: Totalmente tipado com TypeScript
13
+
14
+ ## Uso Básico
15
+
16
+ ### Usando o AdvancedThemeProvider
17
+
18
+ ```tsx
19
+ import { AdvancedThemeProvider, useAdvancedTheme } from '@fabio.caffarello/react-design-system';
20
+
21
+ function App() {
22
+ return (
23
+ <AdvancedThemeProvider
24
+ defaultTheme="light"
25
+ options={{
26
+ enableCSSVariables: true,
27
+ enableTransitions: true,
28
+ transitionDuration: '200ms',
29
+ }}
30
+ >
31
+ <MyComponent />
32
+ </AdvancedThemeProvider>
33
+ );
34
+ }
35
+
36
+ function MyComponent() {
37
+ const { currentTheme, setTheme, tokens } = useAdvancedTheme();
38
+
39
+ return (
40
+ <div>
41
+ <p>Current theme: {currentTheme}</p>
42
+ <button onClick={() => setTheme('dark')}>Switch to Dark</button>
43
+ </div>
44
+ );
45
+ }
46
+ ```
47
+
48
+ ## Criando Temas Customizados
49
+
50
+ ### Usando ThemeBuilder
51
+
52
+ ```tsx
53
+ import { ThemeBuilder } from '@fabio.caffarello/react-design-system';
54
+
55
+ const customTheme = ThemeBuilder.create({
56
+ name: 'my-custom-theme',
57
+ base: 'light', // Herda de 'light'
58
+ colors: {
59
+ primary: {
60
+ DEFAULT: {
61
+ hex: '#8b5cf6', // Roxo customizado
62
+ rgb: { r: 139, g: 92, b: 246 },
63
+ },
64
+ },
65
+ },
66
+ spacing: {
67
+ // Override spacing tokens se necessário
68
+ },
69
+ }).build();
70
+ ```
71
+
72
+ ### Registrando Temas no Provider
73
+
74
+ ```tsx
75
+ <AdvancedThemeProvider
76
+ defaultTheme="light"
77
+ initialThemes={[
78
+ {
79
+ name: 'brand-theme',
80
+ base: 'light',
81
+ colors: {
82
+ primary: {
83
+ DEFAULT: { hex: '#your-brand-color' },
84
+ },
85
+ },
86
+ },
87
+ ]}
88
+ >
89
+ <App />
90
+ </AdvancedThemeProvider>
91
+ ```
92
+
93
+ ### Registrando Temas Dinamicamente
94
+
95
+ ```tsx
96
+ function ThemeManager() {
97
+ const { registerTheme, setTheme } = useAdvancedTheme();
98
+
99
+ const handleCreateTheme = () => {
100
+ const newTheme = registerTheme({
101
+ name: 'dynamic-theme',
102
+ base: 'dark',
103
+ colors: {
104
+ primary: {
105
+ DEFAULT: { hex: '#ff6b6b' },
106
+ },
107
+ },
108
+ });
109
+
110
+ setTheme(newTheme.name);
111
+ };
112
+
113
+ return <button onClick={handleCreateTheme}>Create Theme</button>;
114
+ }
115
+ ```
116
+
117
+ ## CSS Variables
118
+
119
+ Quando `enableCSSVariables` está ativado, o sistema gera automaticamente variáveis CSS:
120
+
121
+ ```css
122
+ :root {
123
+ --color-primary-default: #6366f1;
124
+ --color-primary-light: #818cf8;
125
+ --color-primary-dark: #4f46e5;
126
+ --spacing-xs: 4px;
127
+ --spacing-sm: 8px;
128
+ --font-size-h1: 2.25rem;
129
+ --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
130
+ /* ... */
131
+ }
132
+ ```
133
+
134
+ Você pode usar essas variáveis em seu CSS:
135
+
136
+ ```css
137
+ .my-component {
138
+ background-color: var(--color-primary-default);
139
+ padding: var(--spacing-md);
140
+ box-shadow: var(--shadow-md);
141
+ }
142
+ ```
143
+
144
+ ## API
145
+
146
+ ### AdvancedThemeProvider Props
147
+
148
+ ```typescript
149
+ interface AdvancedThemeProviderProps {
150
+ children: ReactNode;
151
+ defaultTheme?: string; // Nome do tema padrão (default: 'light')
152
+ options?: ThemeBuilderOptions;
153
+ initialThemes?: CustomThemeConfig[]; // Temas para registrar na inicialização
154
+ }
155
+ ```
156
+
157
+ ### ThemeBuilderOptions
158
+
159
+ ```typescript
160
+ interface ThemeBuilderOptions {
161
+ enableCSSVariables?: boolean; // Gerar CSS variables (default: true)
162
+ enableTransitions?: boolean; // Habilitar transições (default: true)
163
+ transitionDuration?: string; // Duração da transição (default: '200ms')
164
+ storageKey?: string; // Chave do localStorage (default: 'theme')
165
+ }
166
+ ```
167
+
168
+ ### useAdvancedTheme Hook
169
+
170
+ ```typescript
171
+ interface AdvancedThemeContextValue {
172
+ currentTheme: string; // Nome do tema atual
173
+ themes: Record<string, Theme>; // Todos os temas registrados
174
+ setTheme: (themeName: string) => void; // Mudar tema
175
+ registerTheme: (config: CustomThemeConfig) => Theme; // Registrar novo tema
176
+ removeTheme: (themeName: string) => boolean; // Remover tema
177
+ getTheme: (themeName?: string) => Theme | undefined; // Obter tema
178
+ tokens: Theme | null; // Tokens do tema atual
179
+ options: ThemeBuilderOptions; // Opções atuais
180
+ setOptions: (options: Partial<ThemeBuilderOptions>) => void; // Atualizar opções
181
+ }
182
+ ```
183
+
184
+ ## Theme Inheritance
185
+
186
+ Temas podem herdar de temas base (light ou dark) e sobrescrever apenas o necessário:
187
+
188
+ ```tsx
189
+ const brandTheme = ThemeBuilder.create({
190
+ name: 'brand',
191
+ base: 'light', // Herda todos os tokens de 'light'
192
+ colors: {
193
+ // Apenas sobrescreve cores
194
+ primary: {
195
+ DEFAULT: { hex: '#custom-color' },
196
+ },
197
+ },
198
+ // Outros tokens são herdados de 'light'
199
+ }).build();
200
+ ```
201
+
202
+ ## Exemplos
203
+
204
+ ### Toggle de Tema
205
+
206
+ ```tsx
207
+ function ThemeToggle() {
208
+ const { currentTheme, setTheme, themes } = useAdvancedTheme();
209
+
210
+ return (
211
+ <select
212
+ value={currentTheme}
213
+ onChange={(e) => setTheme(e.target.value)}
214
+ >
215
+ {Object.keys(themes).map((name) => (
216
+ <option key={name} value={name}>
217
+ {name}
218
+ </option>
219
+ ))}
220
+ </select>
221
+ );
222
+ }
223
+ ```
224
+
225
+ ### Criar Tema Dinamicamente
226
+
227
+ ```tsx
228
+ function ThemeCreator() {
229
+ const { registerTheme, setTheme } = useAdvancedTheme();
230
+ const [color, setColor] = useState('#6366f1');
231
+
232
+ const createTheme = () => {
233
+ const theme = registerTheme({
234
+ name: `custom-${Date.now()}`,
235
+ base: 'light',
236
+ colors: {
237
+ primary: {
238
+ DEFAULT: { hex: color },
239
+ },
240
+ },
241
+ });
242
+
243
+ setTheme(theme.name);
244
+ };
245
+
246
+ return (
247
+ <div>
248
+ <input
249
+ type="color"
250
+ value={color}
251
+ onChange={(e) => setColor(e.target.value)}
252
+ />
253
+ <button onClick={createTheme}>Create Theme</button>
254
+ </div>
255
+ );
256
+ }
257
+ ```
258
+
259
+ ## Migração do ThemeProvider Original
260
+
261
+ O `ThemeProvider` original ainda está disponível e funciona normalmente. Para migrar para o sistema avançado:
262
+
263
+ **Antes:**
264
+ ```tsx
265
+ import { ThemeProvider, useTheme } from '@fabio.caffarello/react-design-system';
266
+
267
+ <ThemeProvider defaultTheme="light">
268
+ <App />
269
+ </ThemeProvider>
270
+ ```
271
+
272
+ **Depois:**
273
+ ```tsx
274
+ import { AdvancedThemeProvider, useAdvancedTheme } from '@fabio.caffarello/react-design-system';
275
+
276
+ <AdvancedThemeProvider defaultTheme="light">
277
+ <App />
278
+ </AdvancedThemeProvider>
279
+ ```
280
+
281
+ O `AdvancedThemeProvider` é compatível com os temas `light` e `dark` padrão, então a migração é simples.
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Theme Builder
3
+ *
4
+ * Builder Pattern for creating custom themes.
5
+ * Supports theme inheritance and CSS variable generation.
6
+ */
7
+
8
+ import { TokensFactory, type TokenSet, type ThemeMode } from '../tokens/tokens.factory';
9
+ import type { CustomThemeConfig, Theme } from './types';
10
+
11
+ export class ThemeBuilder {
12
+ private config: CustomThemeConfig;
13
+ private baseFactory: TokensFactory;
14
+
15
+ constructor(config: CustomThemeConfig) {
16
+ this.config = config;
17
+ const baseMode: ThemeMode = config.base || 'light';
18
+ this.baseFactory = new TokensFactory(baseMode);
19
+ }
20
+
21
+ /**
22
+ * Build a complete theme from configuration
23
+ */
24
+ build(): Theme {
25
+ // Start with base token set
26
+ const baseTokenSet = this.baseFactory.createTokenSet();
27
+
28
+ // Merge custom overrides
29
+ const mergedTokens: TokenSet = {
30
+ spacing: { ...baseTokenSet.spacing, ...this.config.spacing },
31
+ typography: { ...baseTokenSet.typography, ...this.config.typography },
32
+ colors: this.mergeColors(baseTokenSet.colors, this.config.colors),
33
+ breakpoints: baseTokenSet.breakpoints, // Breakpoints are usually not customized
34
+ shadows: { ...baseTokenSet.shadows, ...this.config.shadows },
35
+ radius: { ...baseTokenSet.radius, ...this.config.radius },
36
+ borders: { ...baseTokenSet.borders, ...this.config.borders },
37
+ animations: { ...baseTokenSet.animations, ...this.config.animations },
38
+ zIndex: { ...baseTokenSet.zIndex, ...this.config.zIndex },
39
+ opacity: { ...baseTokenSet.opacity, ...this.config.opacity },
40
+ gradients: { ...baseTokenSet.gradients, ...this.config.gradients },
41
+ };
42
+
43
+ // Generate CSS variables
44
+ const cssVariables = this.generateCSSVariables(mergedTokens);
45
+
46
+ return {
47
+ name: this.config.name,
48
+ mode: this.config.base || 'light',
49
+ ...mergedTokens,
50
+ cssVariables,
51
+ };
52
+ }
53
+
54
+ /**
55
+ * Merge color overrides with base colors
56
+ */
57
+ private mergeColors(
58
+ baseColors: Record<string, unknown>,
59
+ colorOverrides?: Partial<Record<string, Partial<unknown>>>
60
+ ): Record<string, unknown> {
61
+ if (!colorOverrides) {
62
+ return baseColors;
63
+ }
64
+
65
+ const merged = { ...baseColors };
66
+ for (const [role, override] of Object.entries(colorOverrides)) {
67
+ if (merged[role]) {
68
+ merged[role] = { ...merged[role], ...override };
69
+ }
70
+ }
71
+ return merged;
72
+ }
73
+
74
+ /**
75
+ * Generate CSS variables from token set
76
+ */
77
+ private generateCSSVariables(tokens: TokenSet): Record<string, string> {
78
+ const variables: Record<string, string> = {};
79
+
80
+ // Color variables
81
+ for (const [role, color] of Object.entries(tokens.colors)) {
82
+ if (color && typeof color === 'object') {
83
+ for (const [shade, value] of Object.entries(color)) {
84
+ if (value && typeof value === 'object' && 'hex' in value) {
85
+ const varName = `--color-${role}-${shade.toLowerCase()}`;
86
+ variables[varName] = (value as { hex: string }).hex;
87
+ }
88
+ }
89
+ }
90
+ }
91
+
92
+ // Spacing variables
93
+ for (const [name, token] of Object.entries(tokens.spacing)) {
94
+ if (token && typeof token === 'object' && 'px' in token) {
95
+ variables[`--spacing-${name}`] = (token as { px: string }).px;
96
+ }
97
+ }
98
+
99
+ // Typography variables
100
+ for (const [name, token] of Object.entries(tokens.typography)) {
101
+ if (token && typeof token === 'object') {
102
+ if ('fontSize' in token) {
103
+ variables[`--font-size-${name}`] = (token as { fontSize: string }).fontSize;
104
+ }
105
+ if ('lineHeight' in token) {
106
+ variables[`--line-height-${name}`] = (token as { lineHeight: string }).lineHeight;
107
+ }
108
+ if ('fontWeight' in token) {
109
+ variables[`--font-weight-${name}`] = (token as { fontWeight: string }).fontWeight;
110
+ }
111
+ }
112
+ }
113
+
114
+ // Shadow variables
115
+ for (const [name, token] of Object.entries(tokens.shadows)) {
116
+ if (token && typeof token === 'object' && 'value' in token) {
117
+ variables[`--shadow-${name}`] = (token as { value: string }).value;
118
+ }
119
+ }
120
+
121
+ // Radius variables
122
+ for (const [name, token] of Object.entries(tokens.radius)) {
123
+ if (token && typeof token === 'object' && 'value' in token) {
124
+ variables[`--radius-${name}`] = (token as { value: string }).value;
125
+ }
126
+ }
127
+
128
+ // Animation variables
129
+ for (const [name, token] of Object.entries(tokens.animations)) {
130
+ if (token && typeof token === 'object') {
131
+ if ('duration' in token) {
132
+ variables[`--animation-duration-${name}`] = (token as { duration: string }).duration;
133
+ }
134
+ if ('easing' in token) {
135
+ variables[`--animation-easing-${name}`] = (token as { easing: string }).easing;
136
+ }
137
+ }
138
+ }
139
+
140
+ return variables;
141
+ }
142
+
143
+ /**
144
+ * Create a theme builder instance
145
+ */
146
+ static create(config: CustomThemeConfig): ThemeBuilder {
147
+ return new ThemeBuilder(config);
148
+ }
149
+ }
@@ -0,0 +1,187 @@
1
+ /**
2
+ * Theme Registry
3
+ *
4
+ * Central registry for managing multiple themes.
5
+ * Supports theme registration, retrieval, and switching.
6
+ */
7
+
8
+ import { ThemeBuilder } from './ThemeBuilder';
9
+ import { createTokenSet } from '../tokens/tokens.factory';
10
+ import type { CustomThemeConfig, Theme, ThemeRegistry } from './types';
11
+
12
+ export class ThemeRegistryManager {
13
+ private themes: ThemeRegistry = {};
14
+ private defaultTheme: string = 'light';
15
+
16
+ /**
17
+ * Register a new theme
18
+ */
19
+ register(config: CustomThemeConfig): Theme {
20
+ const builder = ThemeBuilder.create(config);
21
+ const theme = builder.build();
22
+ this.themes[theme.name] = theme;
23
+ return theme;
24
+ }
25
+
26
+ /**
27
+ * Register built-in themes (light and dark)
28
+ */
29
+ registerBuiltInThemes(): void {
30
+ // Register light theme with CSS variables
31
+ const lightTokenSet = createTokenSet('light');
32
+ const lightTheme: Theme = {
33
+ name: 'light',
34
+ mode: 'light',
35
+ ...lightTokenSet,
36
+ cssVariables: this.generateCSSVariables(lightTokenSet),
37
+ };
38
+ this.themes['light'] = lightTheme;
39
+
40
+ // Register dark theme with CSS variables
41
+ const darkTokenSet = createTokenSet('dark');
42
+ const darkTheme: Theme = {
43
+ name: 'dark',
44
+ mode: 'dark',
45
+ ...darkTokenSet,
46
+ cssVariables: this.generateCSSVariables(darkTokenSet),
47
+ };
48
+ this.themes['dark'] = darkTheme;
49
+
50
+ this.defaultTheme = 'light';
51
+ }
52
+
53
+ /**
54
+ * Generate CSS variables from token set
55
+ */
56
+ private generateCSSVariables(tokens: unknown): Record<string, string> {
57
+ const variables: Record<string, string> = {};
58
+
59
+ // Color variables
60
+ for (const [role, color] of Object.entries(tokens.colors || {})) {
61
+ if (color && typeof color === 'object') {
62
+ for (const [shade, value] of Object.entries(color)) {
63
+ if (value && typeof value === 'object' && 'hex' in value) {
64
+ const varName = `--color-${role}-${shade.toLowerCase()}`;
65
+ variables[varName] = (value as { hex: string }).hex;
66
+ }
67
+ }
68
+ }
69
+ }
70
+
71
+ // Spacing variables
72
+ for (const [name, token] of Object.entries(tokens.spacing || {})) {
73
+ if (token && typeof token === 'object' && 'px' in token) {
74
+ variables[`--spacing-${name}`] = (token as { px: string }).px;
75
+ }
76
+ }
77
+
78
+ // Typography variables
79
+ for (const [name, token] of Object.entries(tokens.typography || {})) {
80
+ if (token && typeof token === 'object') {
81
+ if ('fontSize' in token) {
82
+ variables[`--font-size-${name}`] = (token as { fontSize: string }).fontSize;
83
+ }
84
+ if ('lineHeight' in token) {
85
+ variables[`--line-height-${name}`] = (token as { lineHeight: string }).lineHeight;
86
+ }
87
+ if ('fontWeight' in token) {
88
+ variables[`--font-weight-${name}`] = (token as { fontWeight: string }).fontWeight;
89
+ }
90
+ }
91
+ }
92
+
93
+ // Shadow variables
94
+ for (const [name, token] of Object.entries(tokens.shadows || {})) {
95
+ if (token && typeof token === 'object' && 'value' in token) {
96
+ variables[`--shadow-${name}`] = (token as { value: string }).value;
97
+ }
98
+ }
99
+
100
+ // Radius variables
101
+ for (const [name, token] of Object.entries(tokens.radius || {})) {
102
+ if (token && typeof token === 'object' && 'value' in token) {
103
+ variables[`--radius-${name}`] = (token as { value: string }).value;
104
+ }
105
+ }
106
+
107
+ // Animation variables
108
+ for (const [name, token] of Object.entries(tokens.animations || {})) {
109
+ if (token && typeof token === 'object') {
110
+ if ('duration' in token) {
111
+ variables[`--animation-duration-${name}`] = (token as { duration: string }).duration;
112
+ }
113
+ if ('easing' in token) {
114
+ variables[`--animation-easing-${name}`] = (token as { easing: string }).easing;
115
+ }
116
+ }
117
+ }
118
+
119
+ return variables;
120
+ }
121
+
122
+ /**
123
+ * Get a theme by name
124
+ */
125
+ get(name: string): Theme | undefined {
126
+ return this.themes[name];
127
+ }
128
+
129
+ /**
130
+ * Get all registered themes
131
+ */
132
+ getAll(): ThemeRegistry {
133
+ return { ...this.themes };
134
+ }
135
+
136
+ /**
137
+ * Check if a theme exists
138
+ */
139
+ has(name: string): boolean {
140
+ return name in this.themes;
141
+ }
142
+
143
+ /**
144
+ * Remove a theme
145
+ */
146
+ remove(name: string): boolean {
147
+ if (name === 'light' || name === 'dark') {
148
+ return false; // Cannot remove built-in themes
149
+ }
150
+ if (this.has(name)) {
151
+ delete this.themes[name];
152
+ return true;
153
+ }
154
+ return false;
155
+ }
156
+
157
+ /**
158
+ * Get default theme name
159
+ */
160
+ getDefaultTheme(): string {
161
+ return this.defaultTheme;
162
+ }
163
+
164
+ /**
165
+ * Set default theme
166
+ */
167
+ setDefaultTheme(name: string): void {
168
+ if (this.has(name)) {
169
+ this.defaultTheme = name;
170
+ }
171
+ }
172
+
173
+ /**
174
+ * Get theme names
175
+ */
176
+ getThemeNames(): string[] {
177
+ return Object.keys(this.themes);
178
+ }
179
+ }
180
+
181
+ /**
182
+ * Global theme registry instance
183
+ */
184
+ export const themeRegistry = new ThemeRegistryManager();
185
+
186
+ // Initialize with built-in themes
187
+ themeRegistry.registerBuiltInThemes();
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Themes Module
3
+ *
4
+ * Exports for the advanced theme system.
5
+ */
6
+
7
+ export { ThemeBuilder } from './ThemeBuilder';
8
+ export { ThemeRegistryManager, themeRegistry } from './ThemeRegistry';
9
+ export type {
10
+ CustomThemeConfig,
11
+ Theme,
12
+ ThemeRegistry,
13
+ ThemeBuilderOptions,
14
+ } from './types';
15
+ export {
16
+ mergeDeep,
17
+ toCSSVariableName,
18
+ applyCSSVariables,
19
+ removeCSSVariables,
20
+ } from './utils';
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Theme Types
3
+ *
4
+ * Type definitions for the advanced theme system.
5
+ */
6
+
7
+ import type { TokenSet, ThemeMode } from '../tokens/tokens.factory';
8
+ import type { ColorRole, SemanticColor } from '../tokens/colors';
9
+
10
+ /**
11
+ * Custom theme configuration
12
+ * Allows partial overrides of the default token set
13
+ */
14
+ export interface CustomThemeConfig {
15
+ name: string;
16
+ base?: ThemeMode; // Base theme to inherit from
17
+ colors?: Partial<Record<ColorRole, Partial<SemanticColor>>>;
18
+ spacing?: Partial<TokenSet['spacing']>;
19
+ typography?: Partial<TokenSet['typography']>;
20
+ shadows?: Partial<TokenSet['shadows']>;
21
+ radius?: Partial<TokenSet['radius']>;
22
+ borders?: Partial<TokenSet['borders']>;
23
+ animations?: Partial<TokenSet['animations']>;
24
+ zIndex?: Partial<TokenSet['zIndex']>;
25
+ opacity?: Partial<TokenSet['opacity']>;
26
+ gradients?: Partial<TokenSet['gradients']>;
27
+ }
28
+
29
+ /**
30
+ * Complete theme definition
31
+ */
32
+ export interface Theme extends TokenSet {
33
+ name: string;
34
+ mode: ThemeMode;
35
+ cssVariables: Record<string, string>;
36
+ }
37
+
38
+ /**
39
+ * Theme registry
40
+ */
41
+ export interface ThemeRegistry {
42
+ [themeName: string]: Theme;
43
+ }
44
+
45
+ /**
46
+ * Theme builder options
47
+ */
48
+ export interface ThemeBuilderOptions {
49
+ enableCSSVariables?: boolean;
50
+ enableTransitions?: boolean;
51
+ transitionDuration?: string;
52
+ storageKey?: string;
53
+ }