@tydavidson/design-system 1.1.2 → 1.1.3

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 (324) hide show
  1. package/dist/index.d.mts +925 -0
  2. package/dist/index.d.ts +925 -7
  3. package/dist/index.js +1758 -23
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +1650 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/dist/themes/index.d.mts +104 -0
  8. package/dist/themes/index.d.ts +104 -6
  9. package/dist/themes/index.js +204 -17
  10. package/dist/themes/index.js.map +1 -1
  11. package/dist/themes/index.mjs +196 -0
  12. package/dist/themes/index.mjs.map +1 -0
  13. package/package.json +26 -12
  14. package/dist/components/SidebarNav.d.ts +0 -13
  15. package/dist/components/SidebarNav.d.ts.map +0 -1
  16. package/dist/components/SidebarNav.js +0 -63
  17. package/dist/components/SidebarNav.js.map +0 -1
  18. package/dist/components/SidebarNavClient.d.ts +0 -2
  19. package/dist/components/SidebarNavClient.d.ts.map +0 -1
  20. package/dist/components/SidebarNavClient.js +0 -35
  21. package/dist/components/SidebarNavClient.js.map +0 -1
  22. package/dist/components/email/button.d.ts +0 -11
  23. package/dist/components/email/button.d.ts.map +0 -1
  24. package/dist/components/email/button.js +0 -86
  25. package/dist/components/email/button.js.map +0 -1
  26. package/dist/components/email/index.d.ts +0 -7
  27. package/dist/components/email/index.d.ts.map +0 -1
  28. package/dist/components/email/index.js +0 -17
  29. package/dist/components/email/index.js.map +0 -1
  30. package/dist/components/email/layout.d.ts +0 -23
  31. package/dist/components/email/layout.d.ts.map +0 -1
  32. package/dist/components/email/layout.js +0 -93
  33. package/dist/components/email/layout.js.map +0 -1
  34. package/dist/components/email/typography.d.ts +0 -11
  35. package/dist/components/email/typography.d.ts.map +0 -1
  36. package/dist/components/email/typography.js +0 -55
  37. package/dist/components/email/typography.js.map +0 -1
  38. package/dist/components/hooks/use-mobile.d.ts +0 -2
  39. package/dist/components/hooks/use-mobile.d.ts.map +0 -1
  40. package/dist/components/hooks/use-mobile.js +0 -7
  41. package/dist/components/hooks/use-mobile.js.map +0 -1
  42. package/dist/components/typography/heading/heading.d.ts +0 -48
  43. package/dist/components/typography/heading/heading.d.ts.map +0 -1
  44. package/dist/components/typography/heading/heading.js +0 -93
  45. package/dist/components/typography/heading/heading.js.map +0 -1
  46. package/dist/components/typography/heading/heading.stories.d.ts +0 -12
  47. package/dist/components/typography/heading/heading.stories.d.ts.map +0 -1
  48. package/dist/components/typography/heading/heading.stories.js +0 -77
  49. package/dist/components/typography/heading/heading.stories.js.map +0 -1
  50. package/dist/components/typography/heading/index.d.ts +0 -2
  51. package/dist/components/typography/heading/index.d.ts.map +0 -1
  52. package/dist/components/typography/heading/index.js +0 -18
  53. package/dist/components/typography/heading/index.js.map +0 -1
  54. package/dist/components/typography/index.d.ts +0 -5
  55. package/dist/components/typography/index.d.ts.map +0 -1
  56. package/dist/components/typography/index.js +0 -24
  57. package/dist/components/typography/index.js.map +0 -1
  58. package/dist/components/typography/showcase.d.ts +0 -7
  59. package/dist/components/typography/showcase.d.ts.map +0 -1
  60. package/dist/components/typography/showcase.js +0 -15
  61. package/dist/components/typography/showcase.js.map +0 -1
  62. package/dist/components/typography/text/index.d.ts +0 -2
  63. package/dist/components/typography/text/index.d.ts.map +0 -1
  64. package/dist/components/typography/text/index.js +0 -18
  65. package/dist/components/typography/text/index.js.map +0 -1
  66. package/dist/components/typography/text/text.d.ts +0 -43
  67. package/dist/components/typography/text/text.d.ts.map +0 -1
  68. package/dist/components/typography/text/text.js +0 -74
  69. package/dist/components/typography/text/text.js.map +0 -1
  70. package/dist/components/typography/text/text.stories.d.ts +0 -13
  71. package/dist/components/typography/text/text.stories.d.ts.map +0 -1
  72. package/dist/components/typography/text/text.stories.js +0 -75
  73. package/dist/components/typography/text/text.stories.js.map +0 -1
  74. package/dist/components/ui/accordion.d.ts +0 -8
  75. package/dist/components/ui/accordion.d.ts.map +0 -1
  76. package/dist/components/ui/accordion.js +0 -53
  77. package/dist/components/ui/accordion.js.map +0 -1
  78. package/dist/components/ui/alert.d.ts +0 -9
  79. package/dist/components/ui/alert.d.ts.map +0 -1
  80. package/dist/components/ui/alert.js +0 -64
  81. package/dist/components/ui/alert.js.map +0 -1
  82. package/dist/components/ui/aspect-ratio.d.ts +0 -5
  83. package/dist/components/ui/aspect-ratio.d.ts.map +0 -1
  84. package/dist/components/ui/aspect-ratio.js +0 -40
  85. package/dist/components/ui/aspect-ratio.js.map +0 -1
  86. package/dist/components/ui/avatar.d.ts +0 -7
  87. package/dist/components/ui/avatar.d.ts.map +0 -1
  88. package/dist/components/ui/avatar.js +0 -50
  89. package/dist/components/ui/avatar.js.map +0 -1
  90. package/dist/components/ui/badge.d.ts +0 -15
  91. package/dist/components/ui/badge.d.ts.map +0 -1
  92. package/dist/components/ui/badge.js +0 -82
  93. package/dist/components/ui/badge.js.map +0 -1
  94. package/dist/components/ui/breadcrumb.d.ts +0 -11
  95. package/dist/components/ui/breadcrumb.d.ts.map +0 -1
  96. package/dist/components/ui/breadcrumb.js +0 -63
  97. package/dist/components/ui/breadcrumb.js.map +0 -1
  98. package/dist/components/ui/button.d.ts +0 -41
  99. package/dist/components/ui/button.d.ts.map +0 -1
  100. package/dist/components/ui/button.js +0 -109
  101. package/dist/components/ui/button.js.map +0 -1
  102. package/dist/components/ui/calendar.d.ts +0 -9
  103. package/dist/components/ui/calendar.d.ts.map +0 -1
  104. package/dist/components/ui/calendar.js +0 -47
  105. package/dist/components/ui/calendar.js.map +0 -1
  106. package/dist/components/ui/card/card.d.ts +0 -35
  107. package/dist/components/ui/card/card.d.ts.map +0 -1
  108. package/dist/components/ui/card/card.js +0 -62
  109. package/dist/components/ui/card/card.js.map +0 -1
  110. package/dist/components/ui/card/index.d.ts +0 -2
  111. package/dist/components/ui/card/index.d.ts.map +0 -1
  112. package/dist/components/ui/card/index.js +0 -18
  113. package/dist/components/ui/card/index.js.map +0 -1
  114. package/dist/components/ui/card.d.ts +0 -12
  115. package/dist/components/ui/card.d.ts.map +0 -1
  116. package/dist/components/ui/card.js +0 -65
  117. package/dist/components/ui/card.js.map +0 -1
  118. package/dist/components/ui/checkbox.d.ts +0 -5
  119. package/dist/components/ui/checkbox.d.ts.map +0 -1
  120. package/dist/components/ui/checkbox.js +0 -45
  121. package/dist/components/ui/checkbox.js.map +0 -1
  122. package/dist/components/ui/collapsible.d.ts +0 -7
  123. package/dist/components/ui/collapsible.d.ts.map +0 -1
  124. package/dist/components/ui/collapsible.js +0 -44
  125. package/dist/components/ui/collapsible.js.map +0 -1
  126. package/dist/components/ui/command.d.ts +0 -83
  127. package/dist/components/ui/command.d.ts.map +0 -1
  128. package/dist/components/ui/command.js +0 -73
  129. package/dist/components/ui/command.js.map +0 -1
  130. package/dist/components/ui/context-menu.d.ts +0 -31
  131. package/dist/components/ui/context-menu.d.ts.map +0 -1
  132. package/dist/components/ui/context-menu.js +0 -92
  133. package/dist/components/ui/context-menu.js.map +0 -1
  134. package/dist/components/ui/dialog.d.ts +0 -20
  135. package/dist/components/ui/dialog.d.ts.map +0 -1
  136. package/dist/components/ui/dialog.js +0 -68
  137. package/dist/components/ui/dialog.js.map +0 -1
  138. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +0 -32
  139. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +0 -1
  140. package/dist/components/ui/dropdown-menu/dropdown-menu.js +0 -108
  141. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +0 -1
  142. package/dist/components/ui/dropdown-menu/index.d.ts +0 -2
  143. package/dist/components/ui/dropdown-menu/index.d.ts.map +0 -1
  144. package/dist/components/ui/dropdown-menu/index.js +0 -18
  145. package/dist/components/ui/dropdown-menu/index.js.map +0 -1
  146. package/dist/components/ui/header.d.ts +0 -3
  147. package/dist/components/ui/header.d.ts.map +0 -1
  148. package/dist/components/ui/header.js +0 -16
  149. package/dist/components/ui/header.js.map +0 -1
  150. package/dist/components/ui/hover-card.d.ts +0 -7
  151. package/dist/components/ui/hover-card.d.ts.map +0 -1
  152. package/dist/components/ui/hover-card.js +0 -48
  153. package/dist/components/ui/hover-card.js.map +0 -1
  154. package/dist/components/ui/index.d.ts +0 -15
  155. package/dist/components/ui/index.d.ts.map +0 -1
  156. package/dist/components/ui/index.js +0 -43
  157. package/dist/components/ui/index.js.map +0 -1
  158. package/dist/components/ui/input.d.ts +0 -6
  159. package/dist/components/ui/input.d.ts.map +0 -1
  160. package/dist/components/ui/input.js +0 -45
  161. package/dist/components/ui/input.js.map +0 -1
  162. package/dist/components/ui/label.d.ts +0 -6
  163. package/dist/components/ui/label.d.ts.map +0 -1
  164. package/dist/components/ui/label.js +0 -46
  165. package/dist/components/ui/label.js.map +0 -1
  166. package/dist/components/ui/nav.d.ts +0 -9
  167. package/dist/components/ui/nav.d.ts.map +0 -1
  168. package/dist/components/ui/nav.js +0 -25
  169. package/dist/components/ui/nav.js.map +0 -1
  170. package/dist/components/ui/org-switcher.d.ts +0 -13
  171. package/dist/components/ui/org-switcher.d.ts.map +0 -1
  172. package/dist/components/ui/org-switcher.js +0 -52
  173. package/dist/components/ui/org-switcher.js.map +0 -1
  174. package/dist/components/ui/popover.d.ts +0 -8
  175. package/dist/components/ui/popover.d.ts.map +0 -1
  176. package/dist/components/ui/popover.js +0 -50
  177. package/dist/components/ui/popover.js.map +0 -1
  178. package/dist/components/ui/progress.d.ts +0 -5
  179. package/dist/components/ui/progress.d.ts.map +0 -1
  180. package/dist/components/ui/progress.js +0 -44
  181. package/dist/components/ui/progress.js.map +0 -1
  182. package/dist/components/ui/radio-group.d.ts +0 -6
  183. package/dist/components/ui/radio-group.d.ts.map +0 -1
  184. package/dist/components/ui/radio-group.js +0 -52
  185. package/dist/components/ui/radio-group.js.map +0 -1
  186. package/dist/components/ui/select.d.ts +0 -14
  187. package/dist/components/ui/select.d.ts.map +0 -1
  188. package/dist/components/ui/select.js +0 -72
  189. package/dist/components/ui/select.js.map +0 -1
  190. package/dist/components/ui/separator.d.ts +0 -5
  191. package/dist/components/ui/separator.d.ts.map +0 -1
  192. package/dist/components/ui/separator.js +0 -44
  193. package/dist/components/ui/separator.js.map +0 -1
  194. package/dist/components/ui/sheet.d.ts +0 -22
  195. package/dist/components/ui/sheet.d.ts.map +0 -1
  196. package/dist/components/ui/sheet.js +0 -76
  197. package/dist/components/ui/sheet.js.map +0 -1
  198. package/dist/components/ui/sidebar.d.ts +0 -65
  199. package/dist/components/ui/sidebar.d.ts.map +0 -1
  200. package/dist/components/ui/sidebar.js +0 -269
  201. package/dist/components/ui/sidebar.js.map +0 -1
  202. package/dist/components/ui/skeleton.d.ts +0 -3
  203. package/dist/components/ui/skeleton.d.ts.map +0 -1
  204. package/dist/components/ui/skeleton.js +0 -9
  205. package/dist/components/ui/skeleton.js.map +0 -1
  206. package/dist/components/ui/slider.d.ts +0 -5
  207. package/dist/components/ui/slider.d.ts.map +0 -1
  208. package/dist/components/ui/slider.js +0 -44
  209. package/dist/components/ui/slider.js.map +0 -1
  210. package/dist/components/ui/switch.d.ts +0 -5
  211. package/dist/components/ui/switch.d.ts.map +0 -1
  212. package/dist/components/ui/switch.js +0 -44
  213. package/dist/components/ui/switch.js.map +0 -1
  214. package/dist/components/ui/tabs.d.ts +0 -8
  215. package/dist/components/ui/tabs.d.ts.map +0 -1
  216. package/dist/components/ui/tabs.js +0 -52
  217. package/dist/components/ui/tabs.js.map +0 -1
  218. package/dist/components/ui/textarea.d.ts +0 -6
  219. package/dist/components/ui/textarea.d.ts.map +0 -1
  220. package/dist/components/ui/textarea.js +0 -45
  221. package/dist/components/ui/textarea.js.map +0 -1
  222. package/dist/components/ui/theme-toggle/index.d.ts +0 -2
  223. package/dist/components/ui/theme-toggle/index.d.ts.map +0 -1
  224. package/dist/components/ui/theme-toggle/index.js +0 -18
  225. package/dist/components/ui/theme-toggle/index.js.map +0 -1
  226. package/dist/components/ui/theme-toggle/theme-toggle.d.ts +0 -21
  227. package/dist/components/ui/theme-toggle/theme-toggle.d.ts.map +0 -1
  228. package/dist/components/ui/theme-toggle/theme-toggle.js +0 -52
  229. package/dist/components/ui/theme-toggle/theme-toggle.js.map +0 -1
  230. package/dist/components/ui/toast.d.ts +0 -5
  231. package/dist/components/ui/toast.d.ts.map +0 -1
  232. package/dist/components/ui/toast.js +0 -17
  233. package/dist/components/ui/toast.js.map +0 -1
  234. package/dist/components/ui/toggle-group.d.ts +0 -6
  235. package/dist/components/ui/toggle-group.d.ts.map +0 -1
  236. package/dist/components/ui/toggle-group.js +0 -47
  237. package/dist/components/ui/toggle-group.js.map +0 -1
  238. package/dist/components/ui/toggle.d.ts +0 -5
  239. package/dist/components/ui/toggle.d.ts.map +0 -1
  240. package/dist/components/ui/toggle.js +0 -44
  241. package/dist/components/ui/toggle.js.map +0 -1
  242. package/dist/components/ui/tooltip.d.ts +0 -8
  243. package/dist/components/ui/tooltip.d.ts.map +0 -1
  244. package/dist/components/ui/tooltip.js +0 -50
  245. package/dist/components/ui/tooltip.js.map +0 -1
  246. package/dist/components/ui/use-toast.d.ts +0 -3
  247. package/dist/components/ui/use-toast.d.ts.map +0 -1
  248. package/dist/components/ui/use-toast.js +0 -7
  249. package/dist/components/ui/use-toast.js.map +0 -1
  250. package/dist/email/button.d.ts +0 -11
  251. package/dist/email/button.d.ts.map +0 -1
  252. package/dist/email/button.js +0 -86
  253. package/dist/email/button.js.map +0 -1
  254. package/dist/email/index.d.ts +0 -7
  255. package/dist/email/index.d.ts.map +0 -1
  256. package/dist/email/index.js +0 -17
  257. package/dist/email/index.js.map +0 -1
  258. package/dist/email/layout.d.ts +0 -23
  259. package/dist/email/layout.d.ts.map +0 -1
  260. package/dist/email/layout.js +0 -93
  261. package/dist/email/layout.js.map +0 -1
  262. package/dist/email/typography.d.ts +0 -11
  263. package/dist/email/typography.d.ts.map +0 -1
  264. package/dist/email/typography.js +0 -55
  265. package/dist/email/typography.js.map +0 -1
  266. package/dist/hooks/use-media-query.d.ts +0 -2
  267. package/dist/hooks/use-media-query.d.ts.map +0 -1
  268. package/dist/hooks/use-media-query.js +0 -20
  269. package/dist/hooks/use-media-query.js.map +0 -1
  270. package/dist/index.d.ts.map +0 -1
  271. package/dist/lib/theme-utils.d.ts +0 -42
  272. package/dist/lib/theme-utils.d.ts.map +0 -1
  273. package/dist/lib/theme-utils.js +0 -85
  274. package/dist/lib/theme-utils.js.map +0 -1
  275. package/dist/lib/types.d.ts +0 -18
  276. package/dist/lib/types.d.ts.map +0 -1
  277. package/dist/lib/types.js +0 -6
  278. package/dist/lib/types.js.map +0 -1
  279. package/dist/lib/utils.d.ts +0 -34
  280. package/dist/lib/utils.d.ts.map +0 -1
  281. package/dist/lib/utils.js +0 -52
  282. package/dist/lib/utils.js.map +0 -1
  283. package/dist/styles/constants/button-colors.d.ts +0 -59
  284. package/dist/styles/constants/button-colors.d.ts.map +0 -1
  285. package/dist/styles/constants/button-colors.js +0 -61
  286. package/dist/styles/constants/button-colors.js.map +0 -1
  287. package/dist/themes/catalog.d.ts +0 -2
  288. package/dist/themes/catalog.d.ts.map +0 -1
  289. package/dist/themes/catalog.js +0 -16
  290. package/dist/themes/catalog.js.map +0 -1
  291. package/dist/themes/index.d.ts.map +0 -1
  292. package/dist/themes/theme-context.d.ts +0 -30
  293. package/dist/themes/theme-context.d.ts.map +0 -1
  294. package/dist/themes/theme-context.js +0 -43
  295. package/dist/themes/theme-context.js.map +0 -1
  296. package/dist/themes/theme-provider.d.ts +0 -9
  297. package/dist/themes/theme-provider.d.ts.map +0 -1
  298. package/dist/themes/theme-provider.js +0 -16
  299. package/dist/themes/theme-provider.js.map +0 -1
  300. package/dist/tokens/colors.d.ts +0 -135
  301. package/dist/tokens/colors.d.ts.map +0 -1
  302. package/dist/tokens/colors.js +0 -140
  303. package/dist/tokens/colors.js.map +0 -1
  304. package/dist/tokens/index.d.ts +0 -256
  305. package/dist/tokens/index.d.ts.map +0 -1
  306. package/dist/tokens/index.js +0 -39
  307. package/dist/tokens/index.js.map +0 -1
  308. package/dist/tokens/radius.d.ts +0 -19
  309. package/dist/tokens/radius.d.ts.map +0 -1
  310. package/dist/tokens/radius.js +0 -27
  311. package/dist/tokens/radius.js.map +0 -1
  312. package/dist/tokens/shadows.d.ts +0 -21
  313. package/dist/tokens/shadows.d.ts.map +0 -1
  314. package/dist/tokens/shadows.js +0 -26
  315. package/dist/tokens/shadows.js.map +0 -1
  316. package/dist/tokens/spacing.d.ts +0 -26
  317. package/dist/tokens/spacing.d.ts.map +0 -1
  318. package/dist/tokens/spacing.js +0 -36
  319. package/dist/tokens/spacing.js.map +0 -1
  320. package/dist/tokens/typography.d.ts +0 -75
  321. package/dist/tokens/typography.d.ts.map +0 -1
  322. package/dist/tokens/typography.js +0 -55
  323. package/dist/tokens/typography.js.map +0 -1
  324. package/dist/tsconfig.build.tsbuildinfo +0 -1
@@ -1,18 +1,205 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getColorVariantClasses = exports.mapVariantToShadcnVariant = exports.mapColorToShadcnVariant = exports.isDarkTheme = exports.ThemeToggle = exports.useTheme = exports.ThemeContextProvider = exports.ThemeProvider = void 0;
4
- // Theme system exports
5
- var theme_provider_1 = require("./theme-provider");
6
- Object.defineProperty(exports, "ThemeProvider", { enumerable: true, get: function () { return theme_provider_1.ThemeProvider; } });
7
- var theme_context_1 = require("./theme-context");
8
- Object.defineProperty(exports, "ThemeContextProvider", { enumerable: true, get: function () { return theme_context_1.ThemeContextProvider; } });
9
- Object.defineProperty(exports, "useTheme", { enumerable: true, get: function () { return theme_context_1.useTheme; } });
10
- var index_1 = require("../components/ui/theme-toggle/index");
11
- Object.defineProperty(exports, "ThemeToggle", { enumerable: true, get: function () { return index_1.ThemeToggle; } });
12
- // Re-export theme utilities
13
- var theme_utils_1 = require("../lib/theme-utils");
14
- Object.defineProperty(exports, "isDarkTheme", { enumerable: true, get: function () { return theme_utils_1.isDarkTheme; } });
15
- Object.defineProperty(exports, "mapColorToShadcnVariant", { enumerable: true, get: function () { return theme_utils_1.mapColorToShadcnVariant; } });
16
- Object.defineProperty(exports, "mapVariantToShadcnVariant", { enumerable: true, get: function () { return theme_utils_1.mapVariantToShadcnVariant; } });
17
- Object.defineProperty(exports, "getColorVariantClasses", { enumerable: true, get: function () { return theme_utils_1.getColorVariantClasses; } });
1
+ 'use strict';
2
+
3
+ var nextThemes = require('next-themes');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var react = require('react');
6
+ var clsx = require('clsx');
7
+ var tailwindMerge = require('tailwind-merge');
8
+ var iconsReact = require('@tabler/icons-react');
9
+
10
+ // src/themes/theme-provider.tsx
11
+ function ThemeProvider({
12
+ children,
13
+ ...props
14
+ }) {
15
+ return /* @__PURE__ */ jsxRuntime.jsx(
16
+ nextThemes.ThemeProvider,
17
+ {
18
+ attribute: "class",
19
+ defaultTheme: "system",
20
+ enableSystem: true,
21
+ disableTransitionOnChange: true,
22
+ ...props,
23
+ children
24
+ }
25
+ );
26
+ }
27
+
28
+ // src/lib/theme-utils.ts
29
+ var mapColorToShadcnVariant = (color) => {
30
+ switch (color) {
31
+ case "brand":
32
+ return "default";
33
+ case "error":
34
+ return "destructive";
35
+ case "warning":
36
+ case "success":
37
+ return "secondary";
38
+ // Will need additional classes
39
+ default:
40
+ return "default";
41
+ }
42
+ };
43
+ var mapVariantToShadcnVariant = (variant) => {
44
+ switch (variant) {
45
+ case "primary":
46
+ return "default";
47
+ case "secondary":
48
+ return "outline";
49
+ case "tertiary":
50
+ return "ghost";
51
+ default:
52
+ return "default";
53
+ }
54
+ };
55
+ var getColorVariantClasses = (color, variant) => {
56
+ const colorVariantMap = {
57
+ primary: {
58
+ brand: "bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500",
59
+ error: "bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500",
60
+ warning: "bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500",
61
+ success: "bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500"
62
+ },
63
+ secondary: {
64
+ brand: "border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
65
+ error: "border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
66
+ warning: "border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
67
+ success: "border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
68
+ },
69
+ tertiary: {
70
+ brand: "text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
71
+ error: "text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
72
+ warning: "text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
73
+ success: "text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
74
+ }
75
+ };
76
+ return colorVariantMap[variant]?.[color] || "";
77
+ };
78
+ var isDarkTheme = (theme, systemTheme) => {
79
+ if (theme === "system") {
80
+ return systemTheme === "dark";
81
+ }
82
+ return theme === "dark";
83
+ };
84
+ var ThemeContext = react.createContext(void 0);
85
+ function ThemeContextProvider({
86
+ children
87
+ }) {
88
+ const [isClient, setIsClient] = react.useState(false);
89
+ const { theme, setTheme, resolvedTheme, systemTheme } = nextThemes.useTheme();
90
+ react.useEffect(() => {
91
+ setIsClient(true);
92
+ }, []);
93
+ const isDark = isDarkTheme(theme, systemTheme);
94
+ return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: {
95
+ theme: theme || "system",
96
+ setTheme,
97
+ resolvedTheme: resolvedTheme || "light",
98
+ isClient,
99
+ isDark
100
+ }, children });
101
+ }
102
+ function useTheme() {
103
+ const context = react.useContext(ThemeContext);
104
+ if (context === void 0) {
105
+ throw new Error("useTheme must be used within a ThemeContextProvider");
106
+ }
107
+ return context;
108
+ }
109
+ function cn(...inputs) {
110
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
111
+ }
112
+ function ThemeToggle({
113
+ className,
114
+ variant = "icon",
115
+ size = "md",
116
+ ...props
117
+ }) {
118
+ const { theme, setTheme, resolvedTheme, isClient } = useTheme();
119
+ if (!isClient) return null;
120
+ const toggleTheme = () => {
121
+ setTheme(resolvedTheme === "dark" ? "light" : "dark");
122
+ };
123
+ const iconSize = {
124
+ sm: 16,
125
+ md: 20,
126
+ lg: 24
127
+ };
128
+ const sizeClasses = {
129
+ sm: "h-8 w-8",
130
+ md: "h-10 w-10",
131
+ lg: "h-12 w-12"
132
+ };
133
+ const textSizeClasses = {
134
+ sm: "text-xs",
135
+ md: "text-sm",
136
+ lg: "text-base"
137
+ };
138
+ if (variant === "icon") {
139
+ return /* @__PURE__ */ jsxRuntime.jsx(
140
+ "button",
141
+ {
142
+ type: "button",
143
+ onClick: toggleTheme,
144
+ className: cn(
145
+ "inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground",
146
+ sizeClasses[size],
147
+ className
148
+ ),
149
+ "aria-label": resolvedTheme === "dark" ? "Switch to light theme" : "Switch to dark theme",
150
+ ...props,
151
+ children: resolvedTheme === "dark" ? /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconSun, { size: iconSize[size], stroke: 1.5 }) : /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconMoon, { size: iconSize[size], stroke: 1.5 })
152
+ }
153
+ );
154
+ }
155
+ if (variant === "button") {
156
+ return /* @__PURE__ */ jsxRuntime.jsx(
157
+ "button",
158
+ {
159
+ type: "button",
160
+ onClick: toggleTheme,
161
+ className: cn(
162
+ "inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2",
163
+ textSizeClasses[size],
164
+ "hover:bg-accent hover:text-accent-foreground",
165
+ className
166
+ ),
167
+ ...props,
168
+ children: resolvedTheme === "dark" ? "Light Mode" : "Dark Mode"
169
+ }
170
+ );
171
+ }
172
+ return /* @__PURE__ */ jsxRuntime.jsx(
173
+ "button",
174
+ {
175
+ type: "button",
176
+ onClick: toggleTheme,
177
+ className: cn(
178
+ "inline-flex items-center justify-center rounded-md px-3 py-2 font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
179
+ textSizeClasses[size],
180
+ resolvedTheme === "dark" ? "bg-accent text-accent-foreground hover:bg-accent/80" : "bg-muted text-muted-foreground hover:bg-muted/80",
181
+ className
182
+ ),
183
+ "aria-label": resolvedTheme === "dark" ? "Switch to light theme" : "Switch to dark theme",
184
+ ...props,
185
+ children: resolvedTheme === "dark" ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center", children: [
186
+ /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconSun, { size: iconSize[size], stroke: 1.5, className: "mr-2" }),
187
+ "Light"
188
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center", children: [
189
+ /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconMoon, { size: iconSize[size], stroke: 1.5, className: "mr-2" }),
190
+ "Dark"
191
+ ] })
192
+ }
193
+ );
194
+ }
195
+
196
+ exports.ThemeContextProvider = ThemeContextProvider;
197
+ exports.ThemeProvider = ThemeProvider;
198
+ exports.ThemeToggle = ThemeToggle;
199
+ exports.getColorVariantClasses = getColorVariantClasses;
200
+ exports.isDarkTheme = isDarkTheme;
201
+ exports.mapColorToShadcnVariant = mapColorToShadcnVariant;
202
+ exports.mapVariantToShadcnVariant = mapVariantToShadcnVariant;
203
+ exports.useTheme = useTheme;
204
+ //# sourceMappingURL=index.js.map
18
205
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/themes/index.ts"],"names":[],"mappings":";;;AAAA,uBAAuB;AACvB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,iDAAiE;AAAxD,qHAAA,oBAAoB,OAAA;AAAE,yGAAA,QAAQ,OAAA;AACvC,6DAAkE;AAAzD,oGAAA,WAAW,OAAA;AAEpB,4BAA4B;AAC5B,kDAA6H;AAApH,0GAAA,WAAW,OAAA;AAAE,sHAAA,uBAAuB,OAAA;AAAE,wHAAA,yBAAyB,OAAA;AAAE,qHAAA,sBAAsB,OAAA"}
1
+ {"version":3,"sources":["../../src/themes/theme-provider.tsx","../../src/lib/theme-utils.ts","../../src/themes/theme-context.tsx","../../src/lib/utils.ts","../../src/components/ui/theme-toggle/theme-toggle.tsx"],"names":["jsx","NextThemesProvider","createContext","useState","useNextTheme","useEffect","useContext","twMerge","clsx","IconSun","IconMoon","jsxs"],"mappings":";;;;;;;;;;AAYO,SAAS,aAAA,CAAc;AAAA,EAC5B,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAuB;AACrB,EAAA,uBACEA,cAAA;AAAA,IAACC,wBAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,OAAA;AAAA,MACV,YAAA,EAAa,QAAA;AAAA,MACb,YAAA,EAAY,IAAA;AAAA,MACZ,yBAAA,EAAyB,IAAA;AAAA,MACxB,GAAG,KAAA;AAAA,MAEH;AAAA;AAAA,GACH;AAEJ;;;ACPO,IAAM,uBAAA,GAA0B,CAAC,KAAA,KAAsB;AAC5D,EAAA,QAAQ,KAAA;AAAO,IACb,KAAK,OAAA;AAAS,MAAA,OAAO,SAAA;AAAA,IACrB,KAAK,OAAA;AAAS,MAAA,OAAO,aAAA;AAAA,IACrB,KAAK,SAAA;AAAA,IACL,KAAK,SAAA;AACH,MAAA,OAAO,WAAA;AAAA;AAAA,IACT;AAAS,MAAA,OAAO,SAAA;AAAA;AAEpB;AAQO,IAAM,yBAAA,GAA4B,CAAC,OAAA,KAA8B;AACtE,EAAA,QAAQ,OAAA;AAAS,IACf,KAAK,SAAA;AAAW,MAAA,OAAO,SAAA;AAAA,IACvB,KAAK,WAAA;AAAa,MAAA,OAAO,SAAA;AAAA,IACzB,KAAK,UAAA;AAAY,MAAA,OAAO,OAAA;AAAA,IACxB;AAAS,MAAA,OAAO,SAAA;AAAA;AAEpB;AASO,IAAM,sBAAA,GAAyB,CACpC,KAAA,EACA,OAAA,KACW;AACX,EAAA,MAAM,eAAA,GAAwE;AAAA,IAC5E,OAAA,EAAS;AAAA,MACP,KAAA,EAAO,yEAAA;AA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A;AAAA,MAChE,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA,aAAA,KAAkB,MAAA,mBACjBW,eAAA,CAAC,MAAA,EAAA,EAAK,WAAU,mBAAA,EACd,QAAA,EAAA;AAAA,wBAAAX,cAAAA,CAACS,sBAAQ,IAAA,EAAM,QAAA,CAAS,IAAI,CAAA,EAAG,MAAA,EAAQ,GAAA,EAAK,SAAA,EAAU,MAAA,EAAO,CAAA;AAAA,QAAE;AAAA,OAAA,EAEjE,CAAA,mBAEAE,eAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,mBAAA,EACd,QAAA,EAAA;AAAA,wBAAAX,cAAAA,CAACU,uBAAS,IAAA,EAAM,QAAA,CAAS,IAAI,CAAA,EAAG,MAAA,EAAQ,GAAA,EAAK,SAAA,EAAU,MAAA,EAAO,CAAA;AAAA,QAAE;AAAA,OAAA,EAElE;AAAA;AAAA,GAEJ;AAEJ","file":"index.js","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { ThemeProvider as NextThemesProvider } from \"next-themes\"\nimport type { ThemeProviderProps } from \"next-themes/dist/types\"\n\n/**\n * ThemeProvider component for handling theme state\n * \n * This wraps the next-themes provider with sensible defaults\n * for handling light/dark themes and system preferences\n */\nexport function ThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n return (\n <NextThemesProvider\n attribute=\"class\"\n defaultTheme=\"system\"\n enableSystem\n disableTransitionOnChange\n {...props}\n >\n {children}\n </NextThemesProvider>\n )\n}","/**\n * Utility functions for theme handling\n */\n\n/**\n * Supported color theme values\n */\nexport type ThemeColor = 'brand' | 'error' | 'warning' | 'success';\n\n/**\n * Supported component variant types\n */\nexport type ComponentVariant = 'primary' | 'secondary' | 'tertiary';\n\n/**\n * Map design system colors to shadcn variants\n * \n * @param color - The design system color\n * @returns The corresponding shadcn variant\n */\nexport const mapColorToShadcnVariant = (color: ThemeColor) => {\n switch (color) {\n case 'brand': return 'default';\n case 'error': return 'destructive';\n case 'warning':\n case 'success':\n return 'secondary'; // Will need additional classes\n default: return 'default';\n }\n};\n\n/**\n * Map design system variants to shadcn variants\n * \n * @param variant - The design system variant\n * @returns The corresponding shadcn variant\n */\nexport const mapVariantToShadcnVariant = (variant: ComponentVariant) => {\n switch (variant) {\n case 'primary': return 'default';\n case 'secondary': return 'outline';\n case 'tertiary': return 'ghost';\n default: return 'default';\n }\n};\n\n/**\n * Generate Tailwind classes for color/variant combinations\n * \n * @param color - The design system color\n * @param variant - The design system variant\n * @returns String of Tailwind classes\n */\nexport const getColorVariantClasses = (\n color: ThemeColor, \n variant: ComponentVariant\n): string => {\n const colorVariantMap: Record<ComponentVariant, Record<ThemeColor, string>> = {\n primary: {\n brand: 'bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500',\n error: 'bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500',\n warning: 'bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500',\n success: 'bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500',\n },\n secondary: {\n brand: 'border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n },\n tertiary: {\n brand: 'text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n }\n };\n\n return colorVariantMap[variant]?.[color] || '';\n};\n\n/**\n * Determine if the current theme is dark\n * \n * @param theme - The current theme\n * @param systemTheme - The system theme\n * @returns True if the theme is dark\n */\nexport const isDarkTheme = (theme: string | undefined, systemTheme: string | undefined): boolean => {\n if (theme === 'system') {\n return systemTheme === 'dark';\n }\n return theme === 'dark';\n};","\"use client\"\n\nimport React, { createContext, useContext, useEffect, useState } from \"react\"\nimport { useTheme as useNextTheme } from \"next-themes\"\nimport { isDarkTheme } from \"../lib/theme-utils\"\n\n/**\n * Theme context type definition\n */\ntype ThemeContextType = {\n /** Current theme name (light, dark, system) */\n theme: string;\n \n /** Method to change the theme */\n setTheme: (theme: string) => void;\n \n /** Current resolved theme (light or dark) accounting for system preference */\n resolvedTheme: string;\n \n /** Whether the client-side code has been initialized */\n isClient: boolean;\n \n /** Whether the current theme is dark */\n isDark: boolean;\n}\n\nconst ThemeContext = createContext<ThemeContextType | undefined>(undefined);\n\n/**\n * ThemeContextProvider wraps the app and provides theme context\n */\nexport function ThemeContextProvider({ \n children \n}: { \n children: React.ReactNode \n}) {\n const [isClient, setIsClient] = useState(false);\n const { theme, setTheme, resolvedTheme, systemTheme } = useNextTheme();\n\n // Handle client-side hydration\n useEffect(() => {\n setIsClient(true);\n }, []);\n\n // Determine if the theme is dark\n const isDark = isDarkTheme(theme, systemTheme);\n\n return (\n <ThemeContext.Provider value={{\n theme: theme || \"system\",\n setTheme,\n resolvedTheme: resolvedTheme || \"light\",\n isClient,\n isDark,\n }}>\n {children}\n </ThemeContext.Provider>\n );\n}\n\n/**\n * Custom hook to access theme context\n * \n * @returns Theme context object\n */\nexport function useTheme() {\n const context = useContext(ThemeContext);\n \n if (context === undefined) {\n throw new Error(\"useTheme must be used within a ThemeContextProvider\");\n }\n \n return context;\n}","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * Combines multiple class values into a single className string\n * with proper Tailwind CSS class merging.\n * \n * @param inputs - Class values to merge\n * @returns Merged className string\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n/**\n * Utility function to generate a unique ID.\n * Useful for ensuring unique IDs for form elements.\n * \n * @param prefix - Optional prefix for the ID\n * @returns A unique ID string\n */\nexport function generateId(prefix = 'id'): string {\n const randomId = Math.random().toString(36).substring(2, 9);\n return `${prefix}-${randomId}`;\n}\n\n/**\n * Type guard to check if a value is not null or undefined\n * \n * @param value - Value to check\n * @returns True if value is not null or undefined\n */\nexport function isNotNullOrUndefined<T>(value: T | null | undefined): value is T {\n return value !== null && value !== undefined;\n}\n\n/**\n * Returns only the props that are safe to spread onto a DOM element\n * by filtering out custom props\n * \n * @param props - The props object\n * @param propNames - Names of custom props to filter out\n * @returns Object with only DOM-safe props\n */\nexport function filterDOMProps<T extends Record<string, any>, K extends keyof T>(\n props: T, \n propNames: K[]\n): Omit<T, K> {\n const result = { ...props };\n propNames.forEach(name => delete result[name]);\n return result;\n}","\"use client\"\n\nimport * as React from \"react\"\nimport { useTheme } from \"../../../themes/theme-context\"\nimport { cn } from \"../../../lib/utils\"\nimport { IconMoon, IconSun } from \"@tabler/icons-react\"\n\n/**\n * Props for the ThemeToggle component\n */\nexport interface ThemeToggleProps extends React.HTMLAttributes<HTMLButtonElement> {\n /**\n * Variant of the toggle\n * @default 'icon'\n */\n variant?: 'icon' | 'switch' | 'button';\n \n /**\n * Size of the toggle\n * @default 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n}\n\n/**\n * ThemeToggle component to switch between light and dark themes\n */\nexport function ThemeToggle({ \n className, \n variant = 'icon', \n size = 'md',\n ...props \n}: ThemeToggleProps) {\n const { theme, setTheme, resolvedTheme, isClient } = useTheme()\n\n // Only render on client to prevent hydration mismatch\n if (!isClient) return null;\n\n // Toggle between light and dark\n const toggleTheme = () => {\n setTheme(resolvedTheme === \"dark\" ? \"light\" : \"dark\")\n }\n\n // Size mapping for Tabler icons\n const iconSize = {\n sm: 16,\n md: 20,\n lg: 24,\n }\n\n // Size classes for button\n const sizeClasses = {\n sm: 'h-8 w-8',\n md: 'h-10 w-10',\n lg: 'h-12 w-12',\n }\n\n // Text size classes\n const textSizeClasses = {\n sm: 'text-xs',\n md: 'text-sm',\n lg: 'text-base',\n }\n\n // Variant specific rendering\n if (variant === 'icon') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n sizeClasses[size],\n className\n )}\n aria-label={resolvedTheme === \"dark\" ? \"Switch to light theme\" : \"Switch to dark theme\"}\n {...props}\n >\n {resolvedTheme === \"dark\" ? (\n <IconSun size={iconSize[size]} stroke={1.5} />\n ) : (\n <IconMoon size={iconSize[size]} stroke={1.5} />\n )}\n </button>\n )\n }\n \n // Button variant\n if (variant === 'button') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2\",\n textSizeClasses[size],\n \"hover:bg-accent hover:text-accent-foreground\",\n className\n )}\n {...props}\n >\n {resolvedTheme === \"dark\" ? \"Light Mode\" : \"Dark Mode\"}\n </button>\n )\n }\n \n // Switch variant\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md px-3 py-2 font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n textSizeClasses[size],\n resolvedTheme === \"dark\" \n ? \"bg-accent text-accent-foreground hover:bg-accent/80\" \n : \"bg-muted text-muted-foreground hover:bg-muted/80\",\n className\n )}\n aria-label={resolvedTheme === \"dark\" ? \"Switch to light theme\" : \"Switch to dark theme\"}\n {...props}\n >\n {resolvedTheme === \"dark\" ? (\n <span className=\"flex items-center\">\n <IconSun size={iconSize[size]} stroke={1.5} className=\"mr-2\" />\n Light\n </span>\n ) : (\n <span className=\"flex items-center\">\n <IconMoon size={iconSize[size]} stroke={1.5} className=\"mr-2\" />\n Dark\n </span>\n )}\n </button>\n )\n}"]}
@@ -0,0 +1,196 @@
1
+ import { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1 } from 'next-themes';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { createContext, useState, useEffect, useContext } from 'react';
4
+ import { clsx } from 'clsx';
5
+ import { twMerge } from 'tailwind-merge';
6
+ import { IconSun, IconMoon } from '@tabler/icons-react';
7
+
8
+ // src/themes/theme-provider.tsx
9
+ function ThemeProvider({
10
+ children,
11
+ ...props
12
+ }) {
13
+ return /* @__PURE__ */ jsx(
14
+ ThemeProvider$1,
15
+ {
16
+ attribute: "class",
17
+ defaultTheme: "system",
18
+ enableSystem: true,
19
+ disableTransitionOnChange: true,
20
+ ...props,
21
+ children
22
+ }
23
+ );
24
+ }
25
+
26
+ // src/lib/theme-utils.ts
27
+ var mapColorToShadcnVariant = (color) => {
28
+ switch (color) {
29
+ case "brand":
30
+ return "default";
31
+ case "error":
32
+ return "destructive";
33
+ case "warning":
34
+ case "success":
35
+ return "secondary";
36
+ // Will need additional classes
37
+ default:
38
+ return "default";
39
+ }
40
+ };
41
+ var mapVariantToShadcnVariant = (variant) => {
42
+ switch (variant) {
43
+ case "primary":
44
+ return "default";
45
+ case "secondary":
46
+ return "outline";
47
+ case "tertiary":
48
+ return "ghost";
49
+ default:
50
+ return "default";
51
+ }
52
+ };
53
+ var getColorVariantClasses = (color, variant) => {
54
+ const colorVariantMap = {
55
+ primary: {
56
+ brand: "bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500",
57
+ error: "bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500",
58
+ warning: "bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500",
59
+ success: "bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500"
60
+ },
61
+ secondary: {
62
+ brand: "border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
63
+ error: "border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
64
+ warning: "border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
65
+ success: "border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
66
+ },
67
+ tertiary: {
68
+ brand: "text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500",
69
+ error: "text-error-700 hover:bg-error-50 focus-visible:ring-error-500",
70
+ warning: "text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500",
71
+ success: "text-success-700 hover:bg-success-50 focus-visible:ring-success-500"
72
+ }
73
+ };
74
+ return colorVariantMap[variant]?.[color] || "";
75
+ };
76
+ var isDarkTheme = (theme, systemTheme) => {
77
+ if (theme === "system") {
78
+ return systemTheme === "dark";
79
+ }
80
+ return theme === "dark";
81
+ };
82
+ var ThemeContext = createContext(void 0);
83
+ function ThemeContextProvider({
84
+ children
85
+ }) {
86
+ const [isClient, setIsClient] = useState(false);
87
+ const { theme, setTheme, resolvedTheme, systemTheme } = useTheme$1();
88
+ useEffect(() => {
89
+ setIsClient(true);
90
+ }, []);
91
+ const isDark = isDarkTheme(theme, systemTheme);
92
+ return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: {
93
+ theme: theme || "system",
94
+ setTheme,
95
+ resolvedTheme: resolvedTheme || "light",
96
+ isClient,
97
+ isDark
98
+ }, children });
99
+ }
100
+ function useTheme() {
101
+ const context = useContext(ThemeContext);
102
+ if (context === void 0) {
103
+ throw new Error("useTheme must be used within a ThemeContextProvider");
104
+ }
105
+ return context;
106
+ }
107
+ function cn(...inputs) {
108
+ return twMerge(clsx(inputs));
109
+ }
110
+ function ThemeToggle({
111
+ className,
112
+ variant = "icon",
113
+ size = "md",
114
+ ...props
115
+ }) {
116
+ const { theme, setTheme, resolvedTheme, isClient } = useTheme();
117
+ if (!isClient) return null;
118
+ const toggleTheme = () => {
119
+ setTheme(resolvedTheme === "dark" ? "light" : "dark");
120
+ };
121
+ const iconSize = {
122
+ sm: 16,
123
+ md: 20,
124
+ lg: 24
125
+ };
126
+ const sizeClasses = {
127
+ sm: "h-8 w-8",
128
+ md: "h-10 w-10",
129
+ lg: "h-12 w-12"
130
+ };
131
+ const textSizeClasses = {
132
+ sm: "text-xs",
133
+ md: "text-sm",
134
+ lg: "text-base"
135
+ };
136
+ if (variant === "icon") {
137
+ return /* @__PURE__ */ jsx(
138
+ "button",
139
+ {
140
+ type: "button",
141
+ onClick: toggleTheme,
142
+ className: cn(
143
+ "inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground",
144
+ sizeClasses[size],
145
+ className
146
+ ),
147
+ "aria-label": resolvedTheme === "dark" ? "Switch to light theme" : "Switch to dark theme",
148
+ ...props,
149
+ children: resolvedTheme === "dark" ? /* @__PURE__ */ jsx(IconSun, { size: iconSize[size], stroke: 1.5 }) : /* @__PURE__ */ jsx(IconMoon, { size: iconSize[size], stroke: 1.5 })
150
+ }
151
+ );
152
+ }
153
+ if (variant === "button") {
154
+ return /* @__PURE__ */ jsx(
155
+ "button",
156
+ {
157
+ type: "button",
158
+ onClick: toggleTheme,
159
+ className: cn(
160
+ "inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2",
161
+ textSizeClasses[size],
162
+ "hover:bg-accent hover:text-accent-foreground",
163
+ className
164
+ ),
165
+ ...props,
166
+ children: resolvedTheme === "dark" ? "Light Mode" : "Dark Mode"
167
+ }
168
+ );
169
+ }
170
+ return /* @__PURE__ */ jsx(
171
+ "button",
172
+ {
173
+ type: "button",
174
+ onClick: toggleTheme,
175
+ className: cn(
176
+ "inline-flex items-center justify-center rounded-md px-3 py-2 font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
177
+ textSizeClasses[size],
178
+ resolvedTheme === "dark" ? "bg-accent text-accent-foreground hover:bg-accent/80" : "bg-muted text-muted-foreground hover:bg-muted/80",
179
+ className
180
+ ),
181
+ "aria-label": resolvedTheme === "dark" ? "Switch to light theme" : "Switch to dark theme",
182
+ ...props,
183
+ children: resolvedTheme === "dark" ? /* @__PURE__ */ jsxs("span", { className: "flex items-center", children: [
184
+ /* @__PURE__ */ jsx(IconSun, { size: iconSize[size], stroke: 1.5, className: "mr-2" }),
185
+ "Light"
186
+ ] }) : /* @__PURE__ */ jsxs("span", { className: "flex items-center", children: [
187
+ /* @__PURE__ */ jsx(IconMoon, { size: iconSize[size], stroke: 1.5, className: "mr-2" }),
188
+ "Dark"
189
+ ] })
190
+ }
191
+ );
192
+ }
193
+
194
+ export { ThemeContextProvider, ThemeProvider, ThemeToggle, getColorVariantClasses, isDarkTheme, mapColorToShadcnVariant, mapVariantToShadcnVariant, useTheme };
195
+ //# sourceMappingURL=index.mjs.map
196
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/themes/theme-provider.tsx","../../src/lib/theme-utils.ts","../../src/themes/theme-context.tsx","../../src/lib/utils.ts","../../src/components/ui/theme-toggle/theme-toggle.tsx"],"names":["NextThemesProvider","useNextTheme","jsx"],"mappings":";;;;;;;;AAYO,SAAS,aAAA,CAAc;AAAA,EAC5B,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAuB;AACrB,EAAA,uBACE,GAAA;AAAA,IAACA,eAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,OAAA;AAAA,MACV,YAAA,EAAa,QAAA;AAAA,MACb,YAAA,EAAY,IAAA;AAAA,MACZ,yBAAA,EAAyB,IAAA;AAAA,MACxB,GAAG,KAAA;AAAA,MAEH;AAAA;AAAA,GACH;AAEJ;;;ACPO,IAAM,uBAAA,GAA0B,CAAC,KAAA,KAAsB;AAC5D,EAAA,QAAQ,KAAA;AAAO,IACb,KAAK,OAAA;AAAS,MAAA,OAAO,SAAA;AAAA,IACrB,KAAK,OAAA;AAAS,MAAA,OAAO,aAAA;AAAA,IACrB,KAAK,SAAA;AAAA,IACL,KAAK,SAAA;AACH,MAAA,OAAO,WAAA;AAAA;AAAA,IACT;AAAS,MAAA,OAAO,SAAA;AAAA;AAEpB;AAQO,IAAM,yBAAA,GAA4B,CAAC,OAAA,KAA8B;AACtE,EAAA,QAAQ,OAAA;AAAS,IACf,KAAK,SAAA;AAAW,MAAA,OAAO,SAAA;AAAA,IACvB,KAAK,WAAA;AAAa,MAAA,OAAO,SAAA;AAAA,IACzB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AA,MACT,SAAA,EAAW,EAAA;AAAA,QACT,oKAAA;AAAA,QACA,gBAAgB,IAAI,CAAA;AAAA,QACpB,aAAA,KAAkB,SACd,qDAAA,GACA,kDAAA;AAAA,QACJ;AAAA,OACF;AAAA,MACA,YAAA,EAAY,aAAA,KAAkB,MAAA,GAAS,uBAAA,GAA0B,sBAAA;AAAA,MAChE,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA,aAAA,KAAkB,MAAA,mBACjB,IAAA,CAAC,MAAA,EAAA,EAAK,WAAU,mBAAA,EACd,QAAA,EAAA;AAAA,wBAAAA,GAAAA,CAAC,WAAQ,IAAA,EAAM,QAAA,CAAS,IAAI,CAAA,EAAG,MAAA,EAAQ,GAAA,EAAK,SAAA,EAAU,MAAA,EAAO,CAAA;AAAA,QAAE;AAAA,OAAA,EAEjE,CAAA,mBAEA,IAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,mBAAA,EACd,QAAA,EAAA;AAAA,wBAAAA,GAAAA,CAAC,YAAS,IAAA,EAAM,QAAA,CAAS,IAAI,CAAA,EAAG,MAAA,EAAQ,GAAA,EAAK,SAAA,EAAU,MAAA,EAAO,CAAA;AAAA,QAAE;AAAA,OAAA,EAElE;AAAA;AAAA,GAEJ;AAEJ","file":"index.mjs","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { ThemeProvider as NextThemesProvider } from \"next-themes\"\nimport type { ThemeProviderProps } from \"next-themes/dist/types\"\n\n/**\n * ThemeProvider component for handling theme state\n * \n * This wraps the next-themes provider with sensible defaults\n * for handling light/dark themes and system preferences\n */\nexport function ThemeProvider({ \n children, \n ...props \n}: ThemeProviderProps) {\n return (\n <NextThemesProvider\n attribute=\"class\"\n defaultTheme=\"system\"\n enableSystem\n disableTransitionOnChange\n {...props}\n >\n {children}\n </NextThemesProvider>\n )\n}","/**\n * Utility functions for theme handling\n */\n\n/**\n * Supported color theme values\n */\nexport type ThemeColor = 'brand' | 'error' | 'warning' | 'success';\n\n/**\n * Supported component variant types\n */\nexport type ComponentVariant = 'primary' | 'secondary' | 'tertiary';\n\n/**\n * Map design system colors to shadcn variants\n * \n * @param color - The design system color\n * @returns The corresponding shadcn variant\n */\nexport const mapColorToShadcnVariant = (color: ThemeColor) => {\n switch (color) {\n case 'brand': return 'default';\n case 'error': return 'destructive';\n case 'warning':\n case 'success':\n return 'secondary'; // Will need additional classes\n default: return 'default';\n }\n};\n\n/**\n * Map design system variants to shadcn variants\n * \n * @param variant - The design system variant\n * @returns The corresponding shadcn variant\n */\nexport const mapVariantToShadcnVariant = (variant: ComponentVariant) => {\n switch (variant) {\n case 'primary': return 'default';\n case 'secondary': return 'outline';\n case 'tertiary': return 'ghost';\n default: return 'default';\n }\n};\n\n/**\n * Generate Tailwind classes for color/variant combinations\n * \n * @param color - The design system color\n * @param variant - The design system variant\n * @returns String of Tailwind classes\n */\nexport const getColorVariantClasses = (\n color: ThemeColor, \n variant: ComponentVariant\n): string => {\n const colorVariantMap: Record<ComponentVariant, Record<ThemeColor, string>> = {\n primary: {\n brand: 'bg-brand-600 hover:bg-brand-700 text-white focus-visible:ring-brand-500',\n error: 'bg-error-600 hover:bg-error-700 text-white focus-visible:ring-error-500',\n warning: 'bg-warning-600 hover:bg-warning-700 text-white focus-visible:ring-warning-500',\n success: 'bg-success-600 hover:bg-success-700 text-white focus-visible:ring-success-500',\n },\n secondary: {\n brand: 'border-brand-300 text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'border-error-300 text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'border-warning-300 text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'border-success-300 text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n },\n tertiary: {\n brand: 'text-brand-700 hover:bg-brand-50 focus-visible:ring-brand-500',\n error: 'text-error-700 hover:bg-error-50 focus-visible:ring-error-500',\n warning: 'text-warning-700 hover:bg-warning-50 focus-visible:ring-warning-500',\n success: 'text-success-700 hover:bg-success-50 focus-visible:ring-success-500',\n }\n };\n\n return colorVariantMap[variant]?.[color] || '';\n};\n\n/**\n * Determine if the current theme is dark\n * \n * @param theme - The current theme\n * @param systemTheme - The system theme\n * @returns True if the theme is dark\n */\nexport const isDarkTheme = (theme: string | undefined, systemTheme: string | undefined): boolean => {\n if (theme === 'system') {\n return systemTheme === 'dark';\n }\n return theme === 'dark';\n};","\"use client\"\n\nimport React, { createContext, useContext, useEffect, useState } from \"react\"\nimport { useTheme as useNextTheme } from \"next-themes\"\nimport { isDarkTheme } from \"../lib/theme-utils\"\n\n/**\n * Theme context type definition\n */\ntype ThemeContextType = {\n /** Current theme name (light, dark, system) */\n theme: string;\n \n /** Method to change the theme */\n setTheme: (theme: string) => void;\n \n /** Current resolved theme (light or dark) accounting for system preference */\n resolvedTheme: string;\n \n /** Whether the client-side code has been initialized */\n isClient: boolean;\n \n /** Whether the current theme is dark */\n isDark: boolean;\n}\n\nconst ThemeContext = createContext<ThemeContextType | undefined>(undefined);\n\n/**\n * ThemeContextProvider wraps the app and provides theme context\n */\nexport function ThemeContextProvider({ \n children \n}: { \n children: React.ReactNode \n}) {\n const [isClient, setIsClient] = useState(false);\n const { theme, setTheme, resolvedTheme, systemTheme } = useNextTheme();\n\n // Handle client-side hydration\n useEffect(() => {\n setIsClient(true);\n }, []);\n\n // Determine if the theme is dark\n const isDark = isDarkTheme(theme, systemTheme);\n\n return (\n <ThemeContext.Provider value={{\n theme: theme || \"system\",\n setTheme,\n resolvedTheme: resolvedTheme || \"light\",\n isClient,\n isDark,\n }}>\n {children}\n </ThemeContext.Provider>\n );\n}\n\n/**\n * Custom hook to access theme context\n * \n * @returns Theme context object\n */\nexport function useTheme() {\n const context = useContext(ThemeContext);\n \n if (context === undefined) {\n throw new Error(\"useTheme must be used within a ThemeContextProvider\");\n }\n \n return context;\n}","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * Combines multiple class values into a single className string\n * with proper Tailwind CSS class merging.\n * \n * @param inputs - Class values to merge\n * @returns Merged className string\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n/**\n * Utility function to generate a unique ID.\n * Useful for ensuring unique IDs for form elements.\n * \n * @param prefix - Optional prefix for the ID\n * @returns A unique ID string\n */\nexport function generateId(prefix = 'id'): string {\n const randomId = Math.random().toString(36).substring(2, 9);\n return `${prefix}-${randomId}`;\n}\n\n/**\n * Type guard to check if a value is not null or undefined\n * \n * @param value - Value to check\n * @returns True if value is not null or undefined\n */\nexport function isNotNullOrUndefined<T>(value: T | null | undefined): value is T {\n return value !== null && value !== undefined;\n}\n\n/**\n * Returns only the props that are safe to spread onto a DOM element\n * by filtering out custom props\n * \n * @param props - The props object\n * @param propNames - Names of custom props to filter out\n * @returns Object with only DOM-safe props\n */\nexport function filterDOMProps<T extends Record<string, any>, K extends keyof T>(\n props: T, \n propNames: K[]\n): Omit<T, K> {\n const result = { ...props };\n propNames.forEach(name => delete result[name]);\n return result;\n}","\"use client\"\n\nimport * as React from \"react\"\nimport { useTheme } from \"../../../themes/theme-context\"\nimport { cn } from \"../../../lib/utils\"\nimport { IconMoon, IconSun } from \"@tabler/icons-react\"\n\n/**\n * Props for the ThemeToggle component\n */\nexport interface ThemeToggleProps extends React.HTMLAttributes<HTMLButtonElement> {\n /**\n * Variant of the toggle\n * @default 'icon'\n */\n variant?: 'icon' | 'switch' | 'button';\n \n /**\n * Size of the toggle\n * @default 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n}\n\n/**\n * ThemeToggle component to switch between light and dark themes\n */\nexport function ThemeToggle({ \n className, \n variant = 'icon', \n size = 'md',\n ...props \n}: ThemeToggleProps) {\n const { theme, setTheme, resolvedTheme, isClient } = useTheme()\n\n // Only render on client to prevent hydration mismatch\n if (!isClient) return null;\n\n // Toggle between light and dark\n const toggleTheme = () => {\n setTheme(resolvedTheme === \"dark\" ? \"light\" : \"dark\")\n }\n\n // Size mapping for Tabler icons\n const iconSize = {\n sm: 16,\n md: 20,\n lg: 24,\n }\n\n // Size classes for button\n const sizeClasses = {\n sm: 'h-8 w-8',\n md: 'h-10 w-10',\n lg: 'h-12 w-12',\n }\n\n // Text size classes\n const textSizeClasses = {\n sm: 'text-xs',\n md: 'text-sm',\n lg: 'text-base',\n }\n\n // Variant specific rendering\n if (variant === 'icon') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n sizeClasses[size],\n className\n )}\n aria-label={resolvedTheme === \"dark\" ? \"Switch to light theme\" : \"Switch to dark theme\"}\n {...props}\n >\n {resolvedTheme === \"dark\" ? (\n <IconSun size={iconSize[size]} stroke={1.5} />\n ) : (\n <IconMoon size={iconSize[size]} stroke={1.5} />\n )}\n </button>\n )\n }\n \n // Button variant\n if (variant === 'button') {\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2\",\n textSizeClasses[size],\n \"hover:bg-accent hover:text-accent-foreground\",\n className\n )}\n {...props}\n >\n {resolvedTheme === \"dark\" ? \"Light Mode\" : \"Dark Mode\"}\n </button>\n )\n }\n \n // Switch variant\n return (\n <button\n type=\"button\"\n onClick={toggleTheme}\n className={cn(\n \"inline-flex items-center justify-center rounded-md px-3 py-2 font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n textSizeClasses[size],\n resolvedTheme === \"dark\" \n ? \"bg-accent text-accent-foreground hover:bg-accent/80\" \n : \"bg-muted text-muted-foreground hover:bg-muted/80\",\n className\n )}\n aria-label={resolvedTheme === \"dark\" ? \"Switch to light theme\" : \"Switch to dark theme\"}\n {...props}\n >\n {resolvedTheme === \"dark\" ? (\n <span className=\"flex items-center\">\n <IconSun size={iconSize[size]} stroke={1.5} className=\"mr-2\" />\n Light\n </span>\n ) : (\n <span className=\"flex items-center\">\n <IconMoon size={iconSize[size]} stroke={1.5} className=\"mr-2\" />\n Dark\n </span>\n )}\n </button>\n )\n}"]}
package/package.json CHANGED
@@ -1,26 +1,38 @@
1
1
  {
2
2
  "name": "@tydavidson/design-system",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Float Design System with email components and theme system",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
7
8
  "exports": {
8
9
  ".": {
9
- "require": "./dist/index.js",
10
- "types": "./dist/index.d.ts"
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
11
13
  },
12
14
  "./email": {
13
- "require": "./dist/email/index.js",
14
- "types": "./dist/email/index.d.ts"
15
+ "types": "./dist/email/index.d.ts",
16
+ "import": "./dist/email/index.mjs",
17
+ "require": "./dist/email/index.js"
15
18
  },
16
19
  "./themes": {
17
- "require": "./dist/themes/index.js",
18
- "types": "./dist/themes/index.d.ts"
20
+ "types": "./dist/themes/index.d.ts",
21
+ "import": "./dist/themes/index.mjs",
22
+ "require": "./dist/themes/index.js"
19
23
  },
20
24
  "./themes/theme.css": "./src/themes/theme.css"
21
25
  },
22
- "files": ["dist", "src/themes/theme.css"],
23
- "keywords": ["design-system", "components", "email", "react"],
26
+ "files": [
27
+ "dist",
28
+ "src/themes/theme.css"
29
+ ],
30
+ "keywords": [
31
+ "design-system",
32
+ "components",
33
+ "email",
34
+ "react"
35
+ ],
24
36
  "author": "Float Technologies",
25
37
  "license": "ISC",
26
38
  "scripts": {
@@ -31,7 +43,7 @@
31
43
  "ui:add": "pnpm dlx shadcn-ui@latest add",
32
44
  "storybook": "storybook dev -p 6006",
33
45
  "build-storybook": "storybook build",
34
- "build:lib": "tsc --project tsconfig.build.json",
46
+ "build:lib": "tsup",
35
47
  "build:email": "tsc --project tsconfig.email.json",
36
48
  "build:all": "npm run build:lib && npm run build:email",
37
49
  "prepublishOnly": "npm run build:all",
@@ -94,6 +106,7 @@
94
106
  "@storybook/react": "^8.6.12",
95
107
  "@storybook/test": "^8.6.12",
96
108
  "@svgr/webpack": "^8.1.0",
109
+ "@swc/core": "^1.13.3",
97
110
  "@types/node": "^20.11.5",
98
111
  "@types/react": "^18.2.48",
99
112
  "@types/react-dom": "^18.2.18",
@@ -102,6 +115,7 @@
102
115
  "storybook": "^8.6.12",
103
116
  "tailwindcss": "^3.4.1",
104
117
  "tailwindcss-animate": "^1.0.7",
118
+ "tsup": "^8.5.0",
105
119
  "typescript": "^5.3.3"
106
120
  }
107
121
  }
@@ -1,13 +0,0 @@
1
- import * as React from "react";
2
- export declare function SidebarNav({ organizations, currentOrg, setCurrentOrg }: {
3
- organizations: Array<{
4
- id: string;
5
- name: string;
6
- logo: React.ElementType;
7
- avatarUrl: string;
8
- avatarFallback: string;
9
- }>;
10
- currentOrg: string;
11
- setCurrentOrg: React.Dispatch<React.SetStateAction<string>>;
12
- }): import("react/jsx-runtime").JSX.Element;
13
- //# sourceMappingURL=SidebarNav.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SidebarNav.d.ts","sourceRoot":"","sources":["../../src/components/SidebarNav.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA6C/B,wBAAgB,UAAU,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE;IACvE,aAAa,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvH,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;CAC7D,2CA+IA"}