@admin-layout/tailwind-ui 10.1.1-alpha.9 → 12.0.16-alpha.14

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 (263) hide show
  1. package/lib/components/Button/Button.d.ts +13 -0
  2. package/lib/components/Button/Button.d.ts.map +1 -0
  3. package/lib/components/Button/Button.js +50 -0
  4. package/lib/components/Button/Button.js.map +1 -0
  5. package/lib/components/DatePicker/DatePicker.d.ts +5 -0
  6. package/lib/components/DatePicker/DatePicker.d.ts.map +1 -0
  7. package/lib/components/DatePicker/DatePicker.js +218 -0
  8. package/lib/components/DatePicker/DatePicker.js.map +1 -0
  9. package/lib/components/DatePicker/index.d.ts +3 -0
  10. package/lib/components/DatePicker/index.d.ts.map +1 -0
  11. package/lib/components/DatePicker/machine.d.ts +3 -0
  12. package/lib/components/DatePicker/machine.d.ts.map +1 -0
  13. package/lib/components/DatePicker/machine.js +95 -0
  14. package/lib/components/DatePicker/machine.js.map +1 -0
  15. package/lib/components/DatePicker/types.d.ts +34 -0
  16. package/lib/components/DatePicker/types.d.ts.map +1 -0
  17. package/lib/components/DatePicker/utils.d.ts +25 -0
  18. package/lib/components/DatePicker/utils.d.ts.map +1 -0
  19. package/lib/components/DatePicker/utils.js +28 -0
  20. package/lib/components/DatePicker/utils.js.map +1 -0
  21. package/lib/components/ReactTable/Table.d.ts.map +1 -1
  22. package/lib/components/ThemeProvider/ThemeProvider.d.ts +14 -0
  23. package/lib/components/ThemeProvider/ThemeProvider.d.ts.map +1 -0
  24. package/lib/components/ThemeProvider/ThemeProvider.js +96 -0
  25. package/lib/components/ThemeProvider/ThemeProvider.js.map +1 -0
  26. package/lib/components/ThemeProvider/ThemeToggle.d.ts +7 -0
  27. package/lib/components/ThemeProvider/ThemeToggle.d.ts.map +1 -0
  28. package/lib/components/ThemeProvider/ThemeToggle.js +50 -0
  29. package/lib/components/ThemeProvider/ThemeToggle.js.map +1 -0
  30. package/lib/components/ThemeProvider/index.d.ts +4 -0
  31. package/lib/components/ThemeProvider/index.d.ts.map +1 -0
  32. package/lib/components/ThemeProvider/types.d.ts +25 -0
  33. package/lib/components/ThemeProvider/types.d.ts.map +1 -0
  34. package/lib/components/index.d.ts +3 -0
  35. package/lib/components/index.d.ts.map +1 -1
  36. package/lib/hooks/index.d.ts +4 -0
  37. package/lib/hooks/index.d.ts.map +1 -0
  38. package/lib/hooks/useTheme.d.ts +2 -0
  39. package/lib/hooks/useTheme.d.ts.map +1 -0
  40. package/lib/hooks/useTheme.js +7 -0
  41. package/lib/hooks/useTheme.js.map +1 -0
  42. package/lib/hooks/useWindowSize.d.ts +5 -0
  43. package/lib/hooks/useWindowSize.d.ts.map +1 -0
  44. package/lib/hooks/useWindowSize.js +20 -0
  45. package/lib/hooks/useWindowSize.js.map +1 -0
  46. package/lib/index.d.ts +1 -1
  47. package/lib/index.d.ts.map +1 -1
  48. package/lib/index.js +1 -1
  49. package/lib/shardui/accordion.d.ts +8 -0
  50. package/lib/shardui/accordion.d.ts.map +1 -0
  51. package/lib/shardui/accordion.js +40 -0
  52. package/lib/shardui/accordion.js.map +1 -0
  53. package/lib/shardui/alert-dialog.d.ts +21 -0
  54. package/lib/shardui/alert-dialog.d.ts.map +1 -0
  55. package/lib/shardui/alert-dialog.js +77 -0
  56. package/lib/shardui/alert-dialog.js.map +1 -0
  57. package/lib/shardui/alert.d.ts +9 -0
  58. package/lib/shardui/alert.d.ts.map +1 -0
  59. package/lib/shardui/alert.js +42 -0
  60. package/lib/shardui/alert.js.map +1 -0
  61. package/lib/shardui/aspect-ratio.d.ts +4 -0
  62. package/lib/shardui/aspect-ratio.d.ts.map +1 -0
  63. package/lib/shardui/aspect-ratio.js +1 -0
  64. package/lib/shardui/aspect-ratio.js.map +1 -0
  65. package/lib/shardui/avatar.d.ts +7 -0
  66. package/lib/shardui/avatar.d.ts.map +1 -0
  67. package/lib/shardui/avatar.js +27 -0
  68. package/lib/shardui/avatar.js.map +1 -0
  69. package/lib/shardui/badge.d.ts +10 -0
  70. package/lib/shardui/badge.d.ts.map +1 -0
  71. package/lib/shardui/badge.js +25 -0
  72. package/lib/shardui/badge.js.map +1 -0
  73. package/lib/shardui/breadcrumb.d.ts +20 -0
  74. package/lib/shardui/breadcrumb.d.ts.map +1 -0
  75. package/lib/shardui/breadcrumb.js +79 -0
  76. package/lib/shardui/breadcrumb.js.map +1 -0
  77. package/lib/shardui/button.d.ts +12 -0
  78. package/lib/shardui/button.d.ts.map +1 -0
  79. package/lib/shardui/button.js +41 -0
  80. package/lib/shardui/button.js.map +1 -0
  81. package/lib/shardui/calendar.d.ts +9 -0
  82. package/lib/shardui/calendar.d.ts.map +1 -0
  83. package/lib/shardui/calendar.js +53 -0
  84. package/lib/shardui/calendar.js.map +1 -0
  85. package/lib/shardui/card.d.ts +9 -0
  86. package/lib/shardui/card.d.ts.map +1 -0
  87. package/lib/shardui/card.js +54 -0
  88. package/lib/shardui/card.js.map +1 -0
  89. package/lib/shardui/carousel.d.ts +19 -0
  90. package/lib/shardui/carousel.d.ts.map +1 -0
  91. package/lib/shardui/carousel.js +176 -0
  92. package/lib/shardui/carousel.js.map +1 -0
  93. package/lib/shardui/chart.d.ts +63 -0
  94. package/lib/shardui/chart.d.ts.map +1 -0
  95. package/lib/shardui/chart.js +197 -0
  96. package/lib/shardui/chart.js.map +1 -0
  97. package/lib/shardui/checkbox.d.ts +5 -0
  98. package/lib/shardui/checkbox.d.ts.map +1 -0
  99. package/lib/shardui/checkbox.js +15 -0
  100. package/lib/shardui/checkbox.js.map +1 -0
  101. package/lib/shardui/collapsible.d.ts +6 -0
  102. package/lib/shardui/collapsible.d.ts.map +1 -0
  103. package/lib/shardui/collapsible.js +3 -0
  104. package/lib/shardui/collapsible.js.map +1 -0
  105. package/lib/shardui/command.d.ts +83 -0
  106. package/lib/shardui/command.d.ts.map +1 -0
  107. package/lib/shardui/command.js +91 -0
  108. package/lib/shardui/command.js.map +1 -0
  109. package/lib/shardui/context-menu.d.ts +28 -0
  110. package/lib/shardui/context-menu.d.ts.map +1 -0
  111. package/lib/shardui/context-menu.js +117 -0
  112. package/lib/shardui/context-menu.js.map +1 -0
  113. package/lib/shardui/dialog.d.ts +20 -0
  114. package/lib/shardui/dialog.d.ts.map +1 -0
  115. package/lib/shardui/dialog.js +67 -0
  116. package/lib/shardui/dialog.js.map +1 -0
  117. package/lib/shardui/drawer.d.ts +23 -0
  118. package/lib/shardui/drawer.d.ts.map +1 -0
  119. package/lib/shardui/drawer.js +69 -0
  120. package/lib/shardui/drawer.js.map +1 -0
  121. package/lib/shardui/dropdown-menu.d.ts +28 -0
  122. package/lib/shardui/dropdown-menu.d.ts.map +1 -0
  123. package/lib/shardui/dropdown-menu.js +119 -0
  124. package/lib/shardui/dropdown-menu.js.map +1 -0
  125. package/lib/shardui/form.d.ts +24 -0
  126. package/lib/shardui/form.d.ts.map +1 -0
  127. package/lib/shardui/form.js +126 -0
  128. package/lib/shardui/form.js.map +1 -0
  129. package/lib/shardui/hover-card.d.ts +7 -0
  130. package/lib/shardui/hover-card.d.ts.map +1 -0
  131. package/lib/shardui/hover-card.js +15 -0
  132. package/lib/shardui/hover-card.js.map +1 -0
  133. package/lib/shardui/index.d.ts +50 -0
  134. package/lib/shardui/index.d.ts.map +1 -0
  135. package/lib/shardui/index.js +1 -0
  136. package/lib/shardui/index.js.map +1 -0
  137. package/lib/shardui/input-otp.d.ts +35 -0
  138. package/lib/shardui/input-otp.d.ts.map +1 -0
  139. package/lib/shardui/input-otp.js +53 -0
  140. package/lib/shardui/input-otp.js.map +1 -0
  141. package/lib/shardui/input.d.ts +4 -0
  142. package/lib/shardui/input.d.ts.map +1 -0
  143. package/lib/shardui/input.js +13 -0
  144. package/lib/shardui/input.js.map +1 -0
  145. package/lib/shardui/label.d.ts +6 -0
  146. package/lib/shardui/label.d.ts.map +1 -0
  147. package/lib/shardui/label.js +10 -0
  148. package/lib/shardui/label.js.map +1 -0
  149. package/lib/shardui/menubar.d.ts +34 -0
  150. package/lib/shardui/menubar.d.ts.map +1 -0
  151. package/lib/shardui/menubar.js +140 -0
  152. package/lib/shardui/menubar.js.map +1 -0
  153. package/lib/shardui/navigation-menu.d.ts +13 -0
  154. package/lib/shardui/navigation-menu.d.ts.map +1 -0
  155. package/lib/shardui/navigation-menu.js +70 -0
  156. package/lib/shardui/navigation-menu.js.map +1 -0
  157. package/lib/shardui/pagination.d.ts +29 -0
  158. package/lib/shardui/pagination.d.ts.map +1 -0
  159. package/lib/shardui/pagination.js +87 -0
  160. package/lib/shardui/pagination.js.map +1 -0
  161. package/lib/shardui/popover.d.ts +7 -0
  162. package/lib/shardui/popover.d.ts.map +1 -0
  163. package/lib/shardui/popover.js +17 -0
  164. package/lib/shardui/popover.js.map +1 -0
  165. package/lib/shardui/progress.d.ts +5 -0
  166. package/lib/shardui/progress.d.ts.map +1 -0
  167. package/lib/shardui/progress.js +16 -0
  168. package/lib/shardui/progress.js.map +1 -0
  169. package/lib/shardui/radio-group.d.ts +6 -0
  170. package/lib/shardui/radio-group.d.ts.map +1 -0
  171. package/lib/shardui/radio-group.js +28 -0
  172. package/lib/shardui/radio-group.js.map +1 -0
  173. package/lib/shardui/resizable.d.ts +24 -0
  174. package/lib/shardui/resizable.d.ts.map +1 -0
  175. package/lib/shardui/resizable.js +22 -0
  176. package/lib/shardui/resizable.js.map +1 -0
  177. package/lib/shardui/scroll-area.d.ts +6 -0
  178. package/lib/shardui/scroll-area.d.ts.map +1 -0
  179. package/lib/shardui/scroll-area.js +28 -0
  180. package/lib/shardui/scroll-area.js.map +1 -0
  181. package/lib/shardui/select.d.ts +14 -0
  182. package/lib/shardui/select.d.ts.map +1 -0
  183. package/lib/shardui/select.js +99 -0
  184. package/lib/shardui/select.js.map +1 -0
  185. package/lib/shardui/separator.d.ts +5 -0
  186. package/lib/shardui/separator.d.ts.map +1 -0
  187. package/lib/shardui/separator.js +13 -0
  188. package/lib/shardui/separator.js.map +1 -0
  189. package/lib/shardui/sheet.d.ts +26 -0
  190. package/lib/shardui/sheet.d.ts.map +1 -0
  191. package/lib/shardui/sheet.js +84 -0
  192. package/lib/shardui/sheet.js.map +1 -0
  193. package/lib/shardui/sidebar.d.ts +67 -0
  194. package/lib/shardui/sidebar.d.ts.map +1 -0
  195. package/lib/shardui/sidebar.js +490 -0
  196. package/lib/shardui/sidebar.js.map +1 -0
  197. package/lib/shardui/skeleton.d.ts +3 -0
  198. package/lib/shardui/skeleton.d.ts.map +1 -0
  199. package/lib/shardui/skeleton.js +9 -0
  200. package/lib/shardui/skeleton.js.map +1 -0
  201. package/lib/shardui/slider.d.ts +5 -0
  202. package/lib/shardui/slider.d.ts.map +1 -0
  203. package/lib/shardui/slider.js +17 -0
  204. package/lib/shardui/slider.js.map +1 -0
  205. package/lib/shardui/sonner.d.ts +5 -0
  206. package/lib/shardui/sonner.d.ts.map +1 -0
  207. package/lib/shardui/sonner.js +20 -0
  208. package/lib/shardui/sonner.js.map +1 -0
  209. package/lib/shardui/switch.d.ts +5 -0
  210. package/lib/shardui/switch.d.ts.map +1 -0
  211. package/lib/shardui/switch.js +12 -0
  212. package/lib/shardui/switch.js.map +1 -0
  213. package/lib/shardui/table.d.ts +11 -0
  214. package/lib/shardui/table.d.ts.map +1 -0
  215. package/lib/shardui/table.js +75 -0
  216. package/lib/shardui/table.js.map +1 -0
  217. package/lib/shardui/tabs.d.ts +8 -0
  218. package/lib/shardui/tabs.d.ts.map +1 -0
  219. package/lib/shardui/tabs.js +28 -0
  220. package/lib/shardui/tabs.js.map +1 -0
  221. package/lib/shardui/textarea.d.ts +6 -0
  222. package/lib/shardui/textarea.d.ts.map +1 -0
  223. package/lib/shardui/textarea.js +11 -0
  224. package/lib/shardui/textarea.js.map +1 -0
  225. package/lib/shardui/toast.d.ts +16 -0
  226. package/lib/shardui/toast.d.ts.map +1 -0
  227. package/lib/shardui/toast.js +75 -0
  228. package/lib/shardui/toast.js.map +1 -0
  229. package/lib/shardui/toaster.d.ts +2 -0
  230. package/lib/shardui/toaster.d.ts.map +1 -0
  231. package/lib/shardui/toaster.js +26 -0
  232. package/lib/shardui/toaster.js.map +1 -0
  233. package/lib/shardui/toggle-group.d.ts +13 -0
  234. package/lib/shardui/toggle-group.d.ts.map +1 -0
  235. package/lib/shardui/toggle-group.js +42 -0
  236. package/lib/shardui/toggle-group.js.map +1 -0
  237. package/lib/shardui/toggle.d.ts +13 -0
  238. package/lib/shardui/toggle.d.ts.map +1 -0
  239. package/lib/shardui/toggle.js +32 -0
  240. package/lib/shardui/toggle.js.map +1 -0
  241. package/lib/shardui/tooltip.d.ts +8 -0
  242. package/lib/shardui/tooltip.d.ts.map +1 -0
  243. package/lib/shardui/tooltip.js +14 -0
  244. package/lib/shardui/tooltip.js.map +1 -0
  245. package/lib/shardui/use-toast.d.ts +3 -0
  246. package/lib/shardui/use-toast.d.ts.map +1 -0
  247. package/lib/utils/hooks/use-mobile.d.ts +2 -0
  248. package/lib/utils/hooks/use-mobile.d.ts.map +1 -0
  249. package/lib/utils/hooks/use-mobile.js +14 -0
  250. package/lib/utils/hooks/use-mobile.js.map +1 -0
  251. package/lib/utils/hooks/use-toast.d.ts +45 -0
  252. package/lib/utils/hooks/use-toast.d.ts.map +1 -0
  253. package/lib/utils/hooks/use-toast.js +133 -0
  254. package/lib/utils/hooks/use-toast.js.map +1 -0
  255. package/lib/utils/index.d.ts +7 -1
  256. package/lib/utils/index.d.ts.map +1 -1
  257. package/lib/utils/isBrowser/index.js +1 -0
  258. package/lib/utils/isBrowser/index.js.map +1 -0
  259. package/lib/utils/util.d.ts +3 -0
  260. package/lib/utils/util.d.ts.map +1 -0
  261. package/lib/utils/util.js +3 -0
  262. package/lib/utils/util.js.map +1 -0
  263. package/package.json +50 -3
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'outline' | 'ghost';
3
+ export type ButtonSize = 'small' | 'medium' | 'large';
4
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
5
+ variant?: ButtonVariant;
6
+ size?: ButtonSize;
7
+ isLoading?: boolean;
8
+ fullWidth?: boolean;
9
+ children: React.ReactNode;
10
+ }
11
+ declare const Button: ({ variant, size, isLoading, fullWidth, className, children, disabled, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
12
+ export { Button as TailwindUiButton };
13
+ //# sourceMappingURL=Button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AACrF,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAC9E,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,QAAA,MAAM,MAAM,GAAI,kFASb,WAAW,4CA6Cb,CAAC;AAEF,OAAO,EAAE,MAAM,IAAI,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,50 @@
1
+ import {jsxs,jsx}from'react/jsx-runtime';import {Loader2}from'lucide-react';const Button = ({
2
+ variant = 'primary',
3
+ size = 'medium',
4
+ isLoading = false,
5
+ fullWidth = false,
6
+ className = '',
7
+ children,
8
+ disabled,
9
+ ...props
10
+ }) => {
11
+ const getVariantClasses = () => {
12
+ switch (variant) {
13
+ case 'primary':
14
+ return 'themed-button';
15
+ case 'secondary':
16
+ return 'bg-secondary text-secondary-foreground hover:bg-secondary/80';
17
+ case 'outline':
18
+ return 'border border-border bg-background text-foreground hover:bg-muted';
19
+ case 'ghost':
20
+ return 'bg-transparent text-foreground hover:bg-muted';
21
+ case 'danger':
22
+ return 'bg-destructive text-destructive-foreground hover:bg-destructive/90';
23
+ default:
24
+ return 'themed-button';
25
+ }
26
+ };
27
+ const getSizeClasses = () => {
28
+ switch (size) {
29
+ case 'small':
30
+ return 'px-3 py-1.5 text-sm';
31
+ case 'large':
32
+ return 'px-6 py-3 text-lg';
33
+ default:
34
+ return 'px-4 py-2 text-base';
35
+ }
36
+ };
37
+ const baseClasses = 'flex items-center justify-center transition-all duration-200 rounded-themed focus-themed';
38
+ const variantClasses = getVariantClasses();
39
+ const sizeClasses = getSizeClasses();
40
+ const widthClass = fullWidth ? 'w-full' : '';
41
+ const disabledClass = isLoading || disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer interactive-hover';
42
+ return jsxs("button", {
43
+ className: `${baseClasses} ${variantClasses} ${sizeClasses} ${widthClass} ${disabledClass} ${className}`,
44
+ disabled: isLoading || disabled,
45
+ ...props,
46
+ children: [isLoading && jsx(Loader2, {
47
+ className: "w-4 h-4 mr-2 animate-spin"
48
+ }), children]
49
+ });
50
+ };export{Button as TailwindUiButton};//# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.js","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":[null],"names":[],"mappings":"4EAIM,MAAA,MAAM;AAEZ,EAAM,OAAA,GAAA;MACK,GAAA,QAAG;WACH,GAAA,KAAA;WACE,GAAC,KAAE;WACH,GAAC,EAAE;AACZ,EAAA,QAAA;AACH,EAAA,QAAA;AAED,EAAA,GAAA;AAwDA,CAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { DatePickerProps } from './types';
3
+ export declare const DatePicker: React.FC<DatePickerProps>;
4
+ export default DatePicker;
5
+ //# sourceMappingURL=DatePicker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAI1C,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmPhD,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,218 @@
1
+ import {jsxs,jsx}from'react/jsx-runtime';import {useRef,useEffect}from'react';import {useActor}from'@xstate/react';import {datePickerMachine}from'./machine.js';import {getDaysInMonth,getYearsRange,months}from'./utils.js';const DatePicker = ({
2
+ value,
3
+ onChange,
4
+ placeholder = 'Select date',
5
+ className = ''
6
+ }) => {
7
+ const [state, send] = useActor(datePickerMachine.provide({
8
+ actors: {}
9
+ }));
10
+ const containerRef = useRef(null);
11
+ useEffect(() => {
12
+ if (value) {
13
+ send({
14
+ type: 'SELECT_DATE',
15
+ date: value
16
+ });
17
+ }
18
+ }, [value]);
19
+ useEffect(() => {
20
+ const handleClickOutside = event => {
21
+ if (containerRef.current && !containerRef.current.contains(event.target)) {
22
+ send({
23
+ type: 'CLICK_OUTSIDE'
24
+ });
25
+ }
26
+ };
27
+ document.addEventListener('mousedown', handleClickOutside);
28
+ return () => {
29
+ document.removeEventListener('mousedown', handleClickOutside);
30
+ };
31
+ }, []);
32
+ const handleDateSelect = date => {
33
+ send({
34
+ type: 'SELECT_DATE',
35
+ date
36
+ });
37
+ onChange && onChange(date);
38
+ };
39
+ const currentDate = new Date();
40
+ const {
41
+ selectedDate,
42
+ currentMonth,
43
+ isOpen,
44
+ inputValue
45
+ } = state.context;
46
+ // Generate dates in a linear array
47
+ const daysInMonth = getDaysInMonth(currentMonth.getFullYear(), currentMonth.getMonth());
48
+ const dates = Array.from({
49
+ length: daysInMonth
50
+ }, (_, i) => {
51
+ return new Date(currentMonth.getFullYear(), currentMonth.getMonth(), i + 1);
52
+ });
53
+ // Group dates into rows (5 rows of 7 days each - may have empty cells)
54
+ const numberOfRows = Math.ceil(daysInMonth / 7);
55
+ const years = getYearsRange(currentDate.getFullYear());
56
+ return jsxs("div", {
57
+ ref: containerRef,
58
+ className: `relative ${className}`,
59
+ children: [jsxs("div", {
60
+ className: "relative",
61
+ children: [jsx("input", {
62
+ type: "text",
63
+ className: "w-full px-2 py-1 h-7 border border-gray-300 hover:border-blue-400 focus:border-blue-400 \n rounded text-xs transition-colors duration-200 ease-in-out shadow-sm \n focus:outline-none focus:ring-0",
64
+ placeholder: placeholder,
65
+ value: inputValue,
66
+ onChange: e => send({
67
+ type: 'INPUT_CHANGE',
68
+ value: e.target.value
69
+ }),
70
+ onClick: () => send({
71
+ type: 'TOGGLE_CALENDAR'
72
+ }),
73
+ readOnly: true
74
+ }), jsx("div", {
75
+ className: "absolute inset-y-0 right-0 flex items-center px-2 cursor-pointer text-gray-400",
76
+ onClick: () => send({
77
+ type: 'TOGGLE_CALENDAR'
78
+ }),
79
+ children: jsx("svg", {
80
+ xmlns: "http://www.w3.org/2000/svg",
81
+ className: "h-3 w-3",
82
+ fill: "none",
83
+ viewBox: "0 0 24 24",
84
+ stroke: "currentColor",
85
+ children: jsx("path", {
86
+ strokeLinecap: "round",
87
+ strokeLinejoin: "round",
88
+ strokeWidth: 2,
89
+ d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
90
+ })
91
+ })
92
+ })]
93
+ }), isOpen && jsxs("div", {
94
+ className: "absolute z-50 mt-1 w-72 bg-white rounded shadow-md border border-gray-200",
95
+ children: [jsx("div", {
96
+ className: "px-1 py-1 border-b border-gray-200",
97
+ children: jsxs("div", {
98
+ className: "flex justify-between items-center",
99
+ children: [jsx("button", {
100
+ className: "p-0.5 hover:bg-gray-100 text-gray-600 rounded flex items-center justify-center w-5 h-5",
101
+ onClick: () => send({
102
+ type: 'PREV_MONTH'
103
+ }),
104
+ children: jsx("svg", {
105
+ xmlns: "http://www.w3.org/2000/svg",
106
+ className: "h-3 w-3",
107
+ fill: "none",
108
+ viewBox: "0 0 24 24",
109
+ stroke: "currentColor",
110
+ children: jsx("path", {
111
+ strokeLinecap: "round",
112
+ strokeLinejoin: "round",
113
+ strokeWidth: 2.5,
114
+ d: "M15 19l-7-7 7-7"
115
+ })
116
+ })
117
+ }), jsxs("div", {
118
+ className: "flex items-center space-x-1 text-xs",
119
+ children: [jsx("select", {
120
+ className: "appearance-none bg-transparent cursor-pointer py-0 px-1 pr-6 w-20 rounded hover:bg-gray-100 text-gray-800 border-0 focus:outline-none focus:ring-0 text-xs",
121
+ value: currentMonth.getMonth(),
122
+ onChange: e => send({
123
+ type: 'SELECT_MONTH',
124
+ month: parseInt(e.target.value)
125
+ }),
126
+ style: {
127
+ backgroundPosition: 'right 4px center'
128
+ },
129
+ children: months.map((month, index) => jsx("option", {
130
+ value: index,
131
+ children: month
132
+ }, month))
133
+ }), jsx("select", {
134
+ className: "appearance-none bg-transparent cursor-pointer py-0 px-1 pr-6 w-14 rounded hover:bg-gray-100 text-gray-800 border-0 focus:outline-none focus:ring-0 text-xs",
135
+ value: currentMonth.getFullYear(),
136
+ onChange: e => send({
137
+ type: 'SELECT_YEAR',
138
+ year: parseInt(e.target.value)
139
+ }),
140
+ style: {
141
+ backgroundPosition: 'right 4px center'
142
+ },
143
+ children: years.map(year => jsx("option", {
144
+ value: year,
145
+ children: year
146
+ }, year))
147
+ })]
148
+ }), jsx("button", {
149
+ className: "p-0.5 hover:bg-gray-100 text-gray-600 rounded flex items-center justify-center w-5 h-5",
150
+ onClick: () => send({
151
+ type: 'NEXT_MONTH'
152
+ }),
153
+ children: jsx("svg", {
154
+ xmlns: "http://www.w3.org/2000/svg",
155
+ className: "h-3 w-3",
156
+ fill: "none",
157
+ viewBox: "0 0 24 24",
158
+ stroke: "currentColor",
159
+ children: jsx("path", {
160
+ strokeLinecap: "round",
161
+ strokeLinejoin: "round",
162
+ strokeWidth: 2.5,
163
+ d: "M9 5l7 7-7 7"
164
+ })
165
+ })
166
+ })]
167
+ })
168
+ }), jsxs("div", {
169
+ className: "border-b border-gray-200",
170
+ children: [jsx("div", {
171
+ className: "flex border-b border-gray-100 bg-gray-50",
172
+ children: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].map((day, index) => jsx("div", {
173
+ className: `flex-1 px-1 py-1 text-xs text-center font-medium text-gray-700 ${index < 6 ? 'border-r border-gray-100' : ''}`,
174
+ children: day
175
+ }, day))
176
+ }), jsx("div", {
177
+ className: "p-0",
178
+ children: Array.from({
179
+ length: numberOfRows
180
+ }).map((_, rowIndex) => jsx("div", {
181
+ className: "flex border-b border-gray-100 last:border-b-0",
182
+ children: Array.from({
183
+ length: 7
184
+ }).map((_, colIndex) => {
185
+ const dateIndex = rowIndex * 7 + colIndex;
186
+ // Return empty cell if out of range
187
+ if (dateIndex >= dates.length) {
188
+ return jsx("div", {
189
+ className: "flex-1 h-6 border-r border-gray-100 last:border-r-0"
190
+ }, `empty-${rowIndex}-${colIndex}`);
191
+ }
192
+ const date = dates[dateIndex];
193
+ const isToday = date.getDate() === currentDate.getDate() && date.getMonth() === currentDate.getMonth() && date.getFullYear() === currentDate.getFullYear();
194
+ const isSelected = selectedDate && date.getDate() === selectedDate.getDate() && date.getMonth() === selectedDate.getMonth() && date.getFullYear() === selectedDate.getFullYear();
195
+ return jsx("div", {
196
+ className: `
197
+ flex-1 h-6 flex items-center justify-center text-xs cursor-pointer transition-colors
198
+ border-r border-gray-100 last:border-r-0
199
+ ${isToday && !isSelected ? 'font-bold text-blue-600' : ''}
200
+ ${isSelected ? 'bg-blue-50 text-blue-700 font-medium' : 'hover:bg-gray-50'}
201
+ `,
202
+ onClick: () => handleDateSelect(date),
203
+ children: date.getDate()
204
+ }, `date-${date.getDate()}`);
205
+ })
206
+ }, `row-${rowIndex}`))
207
+ })]
208
+ }), jsx("div", {
209
+ className: "py-1 px-1 flex justify-end",
210
+ children: jsx("button", {
211
+ className: "px-2 py-0.5 text-xs text-blue-600 hover:bg-blue-50 transition-colors",
212
+ onClick: () => handleDateSelect(new Date()),
213
+ children: "Today"
214
+ })
215
+ })]
216
+ })]
217
+ });
218
+ };export{DatePicker,DatePicker as default};//# sourceMappingURL=DatePicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatePicker.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ export * from './DatePicker';
2
+ export { default } from './DatePicker';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { DatePickerContext, DatePickerEvent } from './types';
2
+ export declare const datePickerMachine: import("xstate").StateMachine<DatePickerContext, DatePickerEvent, Record<string, import("xstate").AnyActorRef>, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject, string, import("xstate").StateValue, string, unknown, {}, import("xstate").EventObject, import("xstate").MetaObject, any>;
3
+ //# sourceMappingURL=machine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/machine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG7D,eAAO,MAAM,iBAAiB,uVAgF5B,CAAC"}
@@ -0,0 +1,95 @@
1
+ import {createMachine,assign}from'xstate';import {formatDate}from'./utils.js';const datePickerMachine = createMachine({
2
+ id: 'datePicker',
3
+ types: {},
4
+ initial: 'idle',
5
+ context: {
6
+ selectedDate: null,
7
+ currentMonth: new Date(),
8
+ isOpen: false,
9
+ inputValue: ''
10
+ },
11
+ states: {
12
+ idle: {
13
+ on: {
14
+ TOGGLE_CALENDAR: {
15
+ actions: assign(({
16
+ context
17
+ }) => ({
18
+ isOpen: !context.isOpen
19
+ }))
20
+ },
21
+ SELECT_DATE: {
22
+ actions: assign(({
23
+ context,
24
+ event
25
+ }) => {
26
+ const formattedDate = formatDate(event.date);
27
+ return {
28
+ selectedDate: event.date,
29
+ inputValue: formattedDate,
30
+ isOpen: false
31
+ };
32
+ })
33
+ },
34
+ NEXT_MONTH: {
35
+ actions: assign(({
36
+ context
37
+ }) => {
38
+ const nextMonth = new Date(context.currentMonth);
39
+ nextMonth.setMonth(nextMonth.getMonth() + 1);
40
+ return {
41
+ currentMonth: nextMonth
42
+ };
43
+ })
44
+ },
45
+ PREV_MONTH: {
46
+ actions: assign(({
47
+ context
48
+ }) => {
49
+ const prevMonth = new Date(context.currentMonth);
50
+ prevMonth.setMonth(prevMonth.getMonth() - 1);
51
+ return {
52
+ currentMonth: prevMonth
53
+ };
54
+ })
55
+ },
56
+ SELECT_YEAR: {
57
+ actions: assign(({
58
+ context,
59
+ event
60
+ }) => {
61
+ const newDate = new Date(context.currentMonth);
62
+ newDate.setFullYear(event.year);
63
+ return {
64
+ currentMonth: newDate
65
+ };
66
+ })
67
+ },
68
+ SELECT_MONTH: {
69
+ actions: assign(({
70
+ context,
71
+ event
72
+ }) => {
73
+ const newDate = new Date(context.currentMonth);
74
+ newDate.setMonth(event.month);
75
+ return {
76
+ currentMonth: newDate
77
+ };
78
+ })
79
+ },
80
+ INPUT_CHANGE: {
81
+ actions: assign(({
82
+ event
83
+ }) => ({
84
+ inputValue: event.value
85
+ }))
86
+ },
87
+ CLICK_OUTSIDE: {
88
+ actions: assign({
89
+ isOpen: false
90
+ })
91
+ }
92
+ }
93
+ }
94
+ }
95
+ });export{datePickerMachine};//# sourceMappingURL=machine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,34 @@
1
+ export type DatePickerContext = {
2
+ selectedDate: Date | null;
3
+ currentMonth: Date;
4
+ isOpen: boolean;
5
+ inputValue: string;
6
+ };
7
+ export type DatePickerEvent = {
8
+ type: 'TOGGLE_CALENDAR';
9
+ } | {
10
+ type: 'SELECT_DATE';
11
+ date: Date;
12
+ } | {
13
+ type: 'NEXT_MONTH';
14
+ } | {
15
+ type: 'PREV_MONTH';
16
+ } | {
17
+ type: 'SELECT_YEAR';
18
+ year: number;
19
+ } | {
20
+ type: 'SELECT_MONTH';
21
+ month: number;
22
+ } | {
23
+ type: 'INPUT_CHANGE';
24
+ value: string;
25
+ } | {
26
+ type: 'CLICK_OUTSIDE';
27
+ };
28
+ export interface DatePickerProps {
29
+ value?: Date;
30
+ onChange?: (date: Date) => void;
31
+ placeholder?: string;
32
+ className?: string;
33
+ }
34
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC5B,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,IAAI,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GACrB;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAC3B;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC;AAEhC,MAAM,WAAW,eAAe;IAC5B,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Format a date to a readable string (e.g. "Jan 1, 2023")
3
+ */
4
+ export declare const formatDate: (date: Date) => string;
5
+ /**
6
+ * Returns the number of days in a month
7
+ */
8
+ export declare const getDaysInMonth: (year: number, month: number) => number;
9
+ /**
10
+ * Returns the day of week (0-6) for the first day of the month
11
+ */
12
+ export declare const getFirstDayOfMonth: (year: number, month: number) => number;
13
+ /**
14
+ * Creates a grid of days for a month calendar view
15
+ */
16
+ export declare const createDaysGrid: (year: number, month: number) => any[];
17
+ /**
18
+ * Array of month names
19
+ */
20
+ export declare const months: string[];
21
+ /**
22
+ * Creates an array of years for year selection (20 years before and after current year)
23
+ */
24
+ export declare const getYearsRange: (currentYear: number) => number[];
25
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,IAAI,KAAG,MAMvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAE5D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAEhE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,UAgBzD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,MAAM,UAalB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,aAAa,MAAM,KAAG,MAAM,EAEzD,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Format a date to a readable string (e.g. "Jan 1, 2023")
3
+ */
4
+ const formatDate = date => {
5
+ return date.toLocaleDateString('en-US', {
6
+ year: 'numeric',
7
+ month: 'short',
8
+ day: 'numeric'
9
+ });
10
+ };
11
+ /**
12
+ * Returns the number of days in a month
13
+ */
14
+ const getDaysInMonth = (year, month) => {
15
+ return new Date(year, month + 1, 0).getDate();
16
+ };
17
+ /**
18
+ * Array of month names
19
+ */
20
+ const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
21
+ /**
22
+ * Creates an array of years for year selection (20 years before and after current year)
23
+ */
24
+ const getYearsRange = currentYear => {
25
+ return Array.from({
26
+ length: 41
27
+ }, (_, i) => currentYear - 20 + i);
28
+ };export{formatDate,getDaysInMonth,getYearsRange,months};//# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../src/components/DatePicker/utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;AAEG;AACH,MAAA,UAAuB,GAAA,IAAA,IAAI;AAQ3B,EAAA,OAAA,IAAA,CAAA,kBAAA,CAAA,OAAA,EAAA;;AAEG,IAAA,KAAA,EAAA,OAAA;AACH,IAAO,GAAA,EAAA;AAIP,GAAA,CAAA;;AAEG;AACH;AAIA;;AAEG,EAAA,OAAA,IAAA,IAAA,CAAA,IAAA,EAAA,KAAA,GAAA,CAAA,EAAA,CAAA,CAAA,CAAA,OAAA,EAAA;AACH;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/components/ReactTable/Table.tsx"],"names":[],"mappings":"AAyCA,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC;IACpB,gBAAgB,CAAC,EAAE,QAAQ,CAAC;IAC5B,aAAa,CAAC,EAAE,QAAQ,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oBAAoB,CAAC,EAAE,QAAQ,CAAC;CACnC;AAED,eAAO,MAAM,UAAU,GAAI,OAAO,oBAAoB,4CAgNrD,CAAC"}
1
+ {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/components/ReactTable/Table.tsx"],"names":[],"mappings":"AAsCA,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC;IACpB,gBAAgB,CAAC,EAAE,QAAQ,CAAC;IAC5B,aAAa,CAAC,EAAE,QAAQ,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oBAAoB,CAAC,EAAE,QAAQ,CAAC;CACnC;AAED,eAAO,MAAM,UAAU,GAAI,OAAO,oBAAoB,4CAgNrD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { ThemeContextType, Theme } from './types';
3
+ export declare const themes: {
4
+ value: Theme;
5
+ label: string;
6
+ description: string;
7
+ }[];
8
+ export declare const ThemeContext: React.Context<ThemeContextType>;
9
+ export declare const TailwindThemeProvider: React.FC<{
10
+ settings: any;
11
+ children: React.ReactNode;
12
+ actor: any;
13
+ }>;
14
+ //# sourceMappingURL=ThemeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeProvider/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkE,MAAM,OAAO,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAElD,eAAO,MAAM,MAAM;WACO,KAAK;;;GAK9B,CAAC;AAEF,eAAO,MAAM,YAAY,iCAOvB,CAAC;AAEH,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,KAAK,EAAE,GAAG,CAAA;CAAE,CAqEpG,CAAC"}
@@ -0,0 +1,96 @@
1
+ import {jsx}from'react/jsx-runtime';import {createContext,useEffect,useMemo}from'react';const themes = [{
2
+ value: 'default',
3
+ label: 'Default',
4
+ description: 'Clean and minimal design'
5
+ }, {
6
+ value: 'airbnb',
7
+ label: 'Airbnb',
8
+ description: 'Warm coral and friendly vibes'
9
+ }, {
10
+ value: 'slack',
11
+ label: 'Slack',
12
+ description: 'Professional purple workspace'
13
+ }, {
14
+ value: 'github',
15
+ label: 'GitHub',
16
+ description: 'Developer-focused dark and light'
17
+ }, {
18
+ value: 'spotify',
19
+ label: 'Spotify',
20
+ description: 'Dark mode with vibrant green'
21
+ }];
22
+ const ThemeContext = createContext({
23
+ theme: 'default',
24
+ mode: 'light',
25
+ setTheme: () => {},
26
+ setMode: () => {},
27
+ toggleMode: () => {},
28
+ themes: themes
29
+ });
30
+ const TailwindThemeProvider = ({
31
+ settings,
32
+ children,
33
+ actor
34
+ }) => {
35
+ const {
36
+ theme,
37
+ themeType,
38
+ primaryColor,
39
+ fontFamily,
40
+ navTheme
41
+ } = settings;
42
+ // Toggle mode
43
+ const toggleMode = () => {
44
+ actor.send({
45
+ type: 'UPDATE',
46
+ value: {
47
+ navTheme: navTheme === 'dark' ? 'light' : 'dark'
48
+ }
49
+ });
50
+ };
51
+ const handleSettingChange = (key, value) => {
52
+ actor.send({
53
+ type: 'UPDATE',
54
+ value: {
55
+ [key]: value
56
+ }
57
+ });
58
+ };
59
+ // Toggle dark mode class on document
60
+ useEffect(() => {
61
+ if (typeof window === 'undefined') return;
62
+ const root = document.documentElement;
63
+ // Remove all previous theme classes
64
+ root.classList.remove('dark', 'light', 'realDark');
65
+ // Add only the current theme class
66
+ if (settings?.navTheme) {
67
+ root.classList.add(settings.navTheme);
68
+ }
69
+ }, [settings?.navTheme]);
70
+ // Apply theme effects when component mounts and when theme settings change
71
+ useEffect(() => {
72
+ if (typeof window === 'undefined') return;
73
+ const root = document.documentElement;
74
+ // Apply font family to document
75
+ root.style.setProperty('--font-family', fontFamily);
76
+ // Apply theme-specific classes
77
+ root.dataset.theme = theme;
78
+ }, [theme, themeType, primaryColor, fontFamily]);
79
+ // Memoize the context value to prevent unnecessary re-renders
80
+ const contextValue = useMemo(() => ({
81
+ theme: theme,
82
+ mode: navTheme,
83
+ toggleMode,
84
+ setTheme: theme => {
85
+ handleSettingChange('theme', theme);
86
+ },
87
+ setMode: mode => {
88
+ handleSettingChange('navTheme', mode);
89
+ },
90
+ themes: themes
91
+ }), [theme, settings]);
92
+ return jsx(ThemeContext.Provider, {
93
+ value: contextValue,
94
+ children: children
95
+ });
96
+ };export{TailwindThemeProvider,ThemeContext,themes};//# sourceMappingURL=ThemeProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeProvider.js","sources":["../../../src/components/ThemeProvider/ThemeProvider.tsx"],"sourcesContent":[null],"names":[],"mappings":"wFAGA,MAAA,SAAmB,CAAA;kBACY;;;GAK9B;AAED,EAAO,KAAA,EAAA,QAAA;AASP,EAAA,KAAA,EAAA;aAAuD;AAAO,CAAA,EAAA;OAAgC,EAAA,OAAK;AAAE,EAqEpG,KAAC,EAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface ThemeToggleProps {
3
+ className?: string;
4
+ }
5
+ export declare const ThemeToggle: React.FC<ThemeToggleProps>;
6
+ export {};
7
+ //# sourceMappingURL=ThemeToggle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeToggle.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeProvider/ThemeToggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,gBAAgB;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAYlD,CAAC"}