@vkzstudio/muza-ui 1.0.23 → 1.0.26

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 (47) hide show
  1. package/dist/components/Calendar/Calendar.d.ts +9 -5
  2. package/dist/components/Calendar/Calendar.d.ts.map +1 -1
  3. package/dist/components/Calendar/Calendar.js +61 -58
  4. package/dist/components/Calendar/utils/formatDateRange.d.ts.map +1 -1
  5. package/dist/components/Calendar/utils/formatDateRange.js +3 -6
  6. package/dist/components/DatePicker/DatePicker.d.ts +10 -6
  7. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  8. package/dist/components/DatePicker/DatePicker.js +136 -126
  9. package/dist/components/DatePicker/DatePicker.stories.d.ts +3 -0
  10. package/dist/components/DatePicker/DatePicker.stories.d.ts.map +1 -1
  11. package/dist/components/DatePicker/utils/resolveOneDayRange.d.ts +13 -0
  12. package/dist/components/DatePicker/utils/resolveOneDayRange.d.ts.map +1 -0
  13. package/dist/components/DatePicker/utils/resolveOneDayRange.js +5 -0
  14. package/dist/components/DropdownMenu/DropdownMenu.d.ts +1 -1
  15. package/dist/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  16. package/dist/components/DropdownMenu/DropdownMenu.js +17 -14
  17. package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +1 -1
  18. package/dist/components/MuzaUIProvider/MuzaUIProvider.d.ts +10 -3
  19. package/dist/components/MuzaUIProvider/MuzaUIProvider.d.ts.map +1 -1
  20. package/dist/components/MuzaUIProvider/MuzaUIProvider.js +14 -12
  21. package/dist/components/MuzaUIProvider/MuzaUIProvider.stories.d.ts +2 -0
  22. package/dist/components/MuzaUIProvider/MuzaUIProvider.stories.d.ts.map +1 -1
  23. package/dist/components/MuzaUIProvider/index.d.ts +4 -0
  24. package/dist/components/MuzaUIProvider/index.d.ts.map +1 -1
  25. package/dist/components/MuzaUIProvider/theme/ThemeProvider.d.ts +76 -0
  26. package/dist/components/MuzaUIProvider/theme/ThemeProvider.d.ts.map +1 -0
  27. package/dist/components/MuzaUIProvider/theme/ThemeProvider.js +82 -0
  28. package/dist/components/MuzaUIProvider/theme/ThemeSetterModal.d.ts +7 -0
  29. package/dist/components/MuzaUIProvider/theme/ThemeSetterModal.d.ts.map +1 -0
  30. package/dist/components/MuzaUIProvider/theme/ThemeSetterModal.js +303 -0
  31. package/dist/components/MuzaUIProvider/theme/colorShades.d.ts +31 -0
  32. package/dist/components/MuzaUIProvider/theme/colorShades.d.ts.map +1 -0
  33. package/dist/components/MuzaUIProvider/theme/colorShades.js +131 -0
  34. package/dist/components/MuzaUIProvider/theme/index.d.ts +5 -0
  35. package/dist/components/MuzaUIProvider/theme/index.d.ts.map +1 -0
  36. package/dist/components/MuzaUIProvider/theme/setThemeVariables.d.ts +39 -0
  37. package/dist/components/MuzaUIProvider/theme/setThemeVariables.d.ts.map +1 -0
  38. package/dist/components/MuzaUIProvider/theme/setThemeVariables.js +44 -0
  39. package/dist/components/MuzaUIProvider/theme/themePresets.d.ts +7 -0
  40. package/dist/components/MuzaUIProvider/theme/themePresets.d.ts.map +1 -0
  41. package/dist/components/MuzaUIProvider/theme/themePresets.js +77 -0
  42. package/dist/components/MuzaUIProvider/theme/useKeyboardShortcut.d.ts +16 -0
  43. package/dist/components/MuzaUIProvider/theme/useKeyboardShortcut.d.ts.map +1 -0
  44. package/dist/components/MuzaUIProvider/theme/useKeyboardShortcut.js +22 -0
  45. package/dist/index.js +140 -131
  46. package/dist/muza-ui.css +1 -1
  47. package/package.json +1 -1
@@ -0,0 +1,76 @@
1
+ import { ShadesGenerator } from './colorShades';
2
+ import { ThemePresets } from './themePresets';
3
+ /**
4
+ * Generated color shade palette. Brand shades 100-700, opacity variants at 8/12/15%,
5
+ * plus a white value and gray scale (50-1000).
6
+ */
7
+ export type ColorShades = {
8
+ /** Lightest brand shade (mapped to --brand-tertiary) */
9
+ '100': string;
10
+ /** Light brand shade (mapped to --brand-disabled) */
11
+ '200': string;
12
+ /** Medium-light brand shade (mapped to --brand-secondary) */
13
+ '300': string;
14
+ /** Medium brand shade (mapped to --brand-quaternary) */
15
+ '400': string;
16
+ /** Primary brand shade (mapped to --brand-primary) */
17
+ '500': string;
18
+ /** Dark brand shade (mapped to --brand-hover) */
19
+ '600': string;
20
+ /** Darkest brand shade (mapped to --brand-focused) */
21
+ '700': string;
22
+ /** Primary shade at 8% opacity (mapped to --brand-8) */
23
+ '500-8': string;
24
+ /** Primary shade at 12% opacity (mapped to --brand-12) */
25
+ '500-12': string;
26
+ /** Primary shade at 15% opacity (mapped to --brand-15) */
27
+ '500-15': string;
28
+ /** Brand white value (mapped to --brand-white) */
29
+ white: string;
30
+ 'gray-100': string;
31
+ 'gray-1000': string;
32
+ 'gray-200': string;
33
+ 'gray-300': string;
34
+ 'gray-400': string;
35
+ 'gray-50': string;
36
+ 'gray-500': string;
37
+ 'gray-600': string;
38
+ 'gray-700': string;
39
+ 'gray-800': string;
40
+ 'gray-900': string;
41
+ };
42
+ interface ThemeContextValue {
43
+ shades: ColorShades;
44
+ shadesGenerator: ShadesGenerator;
45
+ setShadesFromHex: (hex: string) => void;
46
+ setShades: (shades: ColorShades) => void;
47
+ setShadesFromPreset: (preset: ThemePresets) => void;
48
+ setShadesGenerator: (generator: ShadesGenerator) => void;
49
+ setActiveColor: (color: string | undefined) => void;
50
+ }
51
+ /** Props for the ThemeProvider component. */
52
+ export interface ThemeProviderProps {
53
+ /** React children to wrap with the theme provider */
54
+ children: React.ReactNode;
55
+ /**
56
+ * Brand color hex string for white-label theming.
57
+ * Generates a full shade palette and sets --brand-* CSS variables on :root.
58
+ *
59
+ * @example
60
+ * <ThemeProvider color="#14645a">
61
+ * <App />
62
+ * </ThemeProvider>
63
+ */
64
+ color?: string;
65
+ }
66
+ export declare const ThemeProvider: {
67
+ ({ children, color }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
68
+ displayName: string;
69
+ };
70
+ /**
71
+ * Hook to access theme context.
72
+ * Provides read-only shades and setter functions for dynamic theming.
73
+ */
74
+ export declare const useTheme: () => ThemeContextValue;
75
+ export {};
76
+ //# sourceMappingURL=ThemeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/MuzaUIProvider/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AAEvE,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,gBAAgB,CAAA;AAGhE;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAA;IACb,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAA;IACb,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAA;IACb,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAA;IACb,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAA;IACb,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAA;IACf,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAA;IAChB,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAA;IAChB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,UAAU,iBAAiB;IAEzB,MAAM,EAAE,WAAW,CAAA;IACnB,eAAe,EAAE,eAAe,CAAA;IAGhC,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;IACxC,mBAAmB,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAA;IACnD,kBAAkB,EAAE,CAAC,SAAS,EAAE,eAAe,KAAK,IAAI,CAAA;IACxD,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAA;CACpD;AAID,6CAA6C;AAC7C,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,eAAO,MAAM,aAAa;0BAAyB,kBAAkB;;CAiHpE,CAAA;AAID;;;GAGG;AACH,eAAO,MAAM,QAAQ,yBAMpB,CAAA"}
@@ -0,0 +1,82 @@
1
+ import { jsxs as j, jsx as w } from "react/jsx-runtime";
2
+ import { useContext as A, createContext as G, useState as i, useLayoutEffect as S, useCallback as C, useMemo as K } from "react";
3
+ import { ThemeSetterModal as k } from "./ThemeSetterModal.js";
4
+ import { SHADES_GENERATORS as l } from "./colorShades.js";
5
+ import { themeVariableMapping as T, setThemeVariables as H } from "./setThemeVariables.js";
6
+ import { themePresets as x } from "./themePresets.js";
7
+ import { useKeyboardShortcut as N } from "./useKeyboardShortcut.js";
8
+ const F = G(void 0), R = ({ children: n, color: b }) => {
9
+ const [g, O] = i(void 0), [s, P] = i("preserve500"), d = g ?? b ?? "", [m, o] = i(() => {
10
+ const t = x.default, e = l.preserve500, r = e(d);
11
+ return r || Object.entries(T).reduce(
12
+ (a, [h, c]) => {
13
+ const v = t[h];
14
+ return v && (a[c] = v), a;
15
+ },
16
+ {}
17
+ );
18
+ });
19
+ S(() => {
20
+ const t = l[s], e = t(d);
21
+ e && o(e);
22
+ }, [d, s]), S(() => {
23
+ H({ shades: m });
24
+ }, [m]);
25
+ const y = C(
26
+ (t) => {
27
+ const e = l[s], r = e(t);
28
+ r && o(r);
29
+ },
30
+ [s]
31
+ ), E = C(
32
+ (t) => {
33
+ const e = x[t], r = Object.entries(T).reduce(
34
+ (u, [a, h]) => {
35
+ const c = e[a];
36
+ return c && (u[h] = c), u;
37
+ },
38
+ {}
39
+ );
40
+ o(r);
41
+ },
42
+ [o]
43
+ ), [f, p] = i(!1), M = K(
44
+ () => ({ key: "l", ctrlKey: !0, shiftKey: !0 }),
45
+ []
46
+ );
47
+ return N(M, () => p(!0)), /* @__PURE__ */ j(
48
+ F.Provider,
49
+ {
50
+ value: {
51
+ shades: m,
52
+ shadesGenerator: s,
53
+ setShades: o,
54
+ setShadesFromHex: y,
55
+ setShadesFromPreset: E,
56
+ setShadesGenerator: P,
57
+ setActiveColor: O
58
+ },
59
+ children: [
60
+ n,
61
+ f && /* @__PURE__ */ w(
62
+ k,
63
+ {
64
+ isOpen: f,
65
+ onClose: () => p(!1)
66
+ }
67
+ )
68
+ ]
69
+ }
70
+ );
71
+ };
72
+ R.displayName = "ThemeProvider";
73
+ const B = () => {
74
+ const n = A(F);
75
+ if (!n)
76
+ throw new Error("useTheme must be used within ThemeProvider");
77
+ return n;
78
+ };
79
+ export {
80
+ R as ThemeProvider,
81
+ B as useTheme
82
+ };
@@ -0,0 +1,7 @@
1
+ interface ThemeSetterModalProps {
2
+ isOpen: boolean;
3
+ onClose?: () => void;
4
+ }
5
+ export declare const ThemeSetterModal: ({ isOpen, onClose, }: ThemeSetterModalProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=ThemeSetterModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeSetterModal.d.ts","sourceRoot":"","sources":["../../../../src/components/MuzaUIProvider/theme/ThemeSetterModal.tsx"],"names":[],"mappings":"AAqBA,UAAU,qBAAqB;IAC7B,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,eAAO,MAAM,gBAAgB,GAAI,sBAG9B,qBAAqB,4CAqUvB,CAAA"}
@@ -0,0 +1,303 @@
1
+ import { jsx as r, jsxs as a } from "react/jsx-runtime";
2
+ import { useState as f } from "react";
3
+ import { useTheme as D } from "./ThemeProvider.js";
4
+ import { themePresets as u } from "./themePresets.js";
5
+ import { Dialog as I, DialogOverlay as M, DialogContent as H } from "../../Dialog/Dialog.js";
6
+ import { Button as s } from "../../Button/Button.js";
7
+ import { DropdownMenu as v, DropdownMenuTrigger as N, DropdownMenuContent as b, DropdownMenuItem as p } from "../../DropdownMenu/DropdownMenu.js";
8
+ import { Input as R } from "../../Input/Input.js";
9
+ const z = ({
10
+ isOpen: C,
11
+ onClose: o
12
+ }) => {
13
+ const {
14
+ shades: t,
15
+ shadesGenerator: w,
16
+ setShadesFromHex: c,
17
+ setShadesFromPreset: S,
18
+ setShadesGenerator: k
19
+ } = D(), n = () => {
20
+ o == null || o();
21
+ }, [i, d] = f(t[500]), [m, y] = f(""), P = (e) => {
22
+ if (d(e), /^#?([A-Fa-f0-9]{6})$/.test(e)) {
23
+ const g = e.startsWith("#") ? e : `#${e}`;
24
+ c(g), y("");
25
+ } else e.length >= 6 && y("Invalid hex format. Use format: #RRGGBB");
26
+ }, $ = (e) => {
27
+ c(e), d(e);
28
+ }, G = (e) => {
29
+ S(e);
30
+ const l = u[e]["--brand-primary"];
31
+ l && d(l);
32
+ }, x = (e) => {
33
+ k(e), c(i);
34
+ }, h = {
35
+ tailwindStyle: "Tailwind-style",
36
+ preserve500: "Preserve 500"
37
+ };
38
+ return /* @__PURE__ */ r(
39
+ I,
40
+ {
41
+ open: C,
42
+ onOpenChange: (e) => {
43
+ e === !1 && n();
44
+ },
45
+ children: /* @__PURE__ */ r(M, { className: "bg-transparent", children: /* @__PURE__ */ a(
46
+ H,
47
+ {
48
+ size: "large",
49
+ className: "space-y-6",
50
+ title: "Color Shade Generator",
51
+ children: [
52
+ /* @__PURE__ */ a("div", { className: "flex flex-col gap-2", children: [
53
+ /* @__PURE__ */ r("label", { className: "text-sm font-medium text-gray-700", children: "Generator Algorithm" }),
54
+ /* @__PURE__ */ a(v, { children: [
55
+ /* @__PURE__ */ r(N, { asChild: !0, children: /* @__PURE__ */ r(s, { variant: "secondary", className: "w-max", children: h[w] }) }),
56
+ /* @__PURE__ */ a(b, { className: "w-full", children: [
57
+ /* @__PURE__ */ r(
58
+ p,
59
+ {
60
+ onClick: () => x("tailwindStyle"),
61
+ children: h.tailwindStyle
62
+ }
63
+ ),
64
+ /* @__PURE__ */ r(
65
+ p,
66
+ {
67
+ onClick: () => x("preserve500"),
68
+ children: h.preserve500
69
+ }
70
+ )
71
+ ] })
72
+ ] })
73
+ ] }),
74
+ /* @__PURE__ */ a("div", { className: "space-y-4", children: [
75
+ /* @__PURE__ */ a("div", { className: "flex gap-4", children: [
76
+ /* @__PURE__ */ a("div", { className: "flex flex-col gap-2", children: [
77
+ /* @__PURE__ */ r("label", { className: "text-sm font-medium text-gray-700", children: "Pick Color" }),
78
+ /* @__PURE__ */ r(
79
+ "input",
80
+ {
81
+ type: "color",
82
+ value: i,
83
+ onChange: (e) => $(e.target.value),
84
+ className: "h-12 w-24 cursor-pointer rounded border border-gray-300"
85
+ }
86
+ )
87
+ ] }),
88
+ /* @__PURE__ */ a("div", { className: "flex flex-1 flex-col gap-2", children: [
89
+ /* @__PURE__ */ r("label", { className: "text-sm font-medium text-gray-700", children: "Hex Code" }),
90
+ /* @__PURE__ */ r(
91
+ R,
92
+ {
93
+ value: i,
94
+ onChange: (e) => P(e.target.value),
95
+ placeholder: "#3b82f6",
96
+ className: "font-mono text-lg",
97
+ error: !!m
98
+ }
99
+ )
100
+ ] }),
101
+ /* @__PURE__ */ a("div", { className: "flex flex-col gap-2", children: [
102
+ /* @__PURE__ */ r("label", { className: "text-sm font-medium text-gray-700", children: "Presets" }),
103
+ /* @__PURE__ */ a(v, { children: [
104
+ /* @__PURE__ */ r(N, { asChild: !0, children: /* @__PURE__ */ r(s, { variant: "secondary", className: "h-12", children: "Select Preset" }) }),
105
+ /* @__PURE__ */ r(b, { children: Object.keys(u).map(
106
+ (e) => /* @__PURE__ */ r(
107
+ p,
108
+ {
109
+ onClick: () => G(e),
110
+ children: e.charAt(0).toUpperCase() + e.slice(1)
111
+ },
112
+ e
113
+ )
114
+ ) })
115
+ ] })
116
+ ] })
117
+ ] }),
118
+ m && /* @__PURE__ */ r("p", { className: "text-sm text-red-600", children: m })
119
+ ] }),
120
+ /* @__PURE__ */ a("div", { className: "space-y-4", children: [
121
+ /* @__PURE__ */ r("h3", { className: "text-base font-semibold", children: "Color Shades Preview" }),
122
+ /* @__PURE__ */ a("div", { className: "space-y-2", children: [
123
+ /* @__PURE__ */ r(
124
+ "h4",
125
+ {
126
+ className: "text-sm font-medium",
127
+ style: { color: "var(--gray-700)" },
128
+ children: "Brand Colors"
129
+ }
130
+ ),
131
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-7 gap-2", children: ["100", "200", "300", "400", "500", "600", "700"].map(
132
+ (e) => {
133
+ const l = t[e];
134
+ return /* @__PURE__ */ a("div", { className: "flex flex-col gap-1", children: [
135
+ /* @__PURE__ */ r(
136
+ "div",
137
+ {
138
+ className: "aspect-square w-full rounded-md border shadow-sm",
139
+ style: {
140
+ backgroundColor: l,
141
+ borderColor: "var(--gray-300)"
142
+ },
143
+ title: `${e}: ${l}`
144
+ }
145
+ ),
146
+ /* @__PURE__ */ r(
147
+ "p",
148
+ {
149
+ className: "text-center text-xs font-medium",
150
+ style: { color: "var(--gray-700)" },
151
+ children: e
152
+ }
153
+ ),
154
+ /* @__PURE__ */ r(
155
+ "p",
156
+ {
157
+ className: "text-center font-mono text-[10px]",
158
+ style: { color: "var(--gray-500)" },
159
+ children: l == null ? void 0 : l.slice(0, 7).toUpperCase()
160
+ }
161
+ )
162
+ ] }, e);
163
+ }
164
+ ) })
165
+ ] }),
166
+ /* @__PURE__ */ a("div", { className: "space-y-2", children: [
167
+ /* @__PURE__ */ r(
168
+ "h4",
169
+ {
170
+ className: "text-sm font-medium",
171
+ style: { color: "var(--gray-700)" },
172
+ children: "Opacity Variants"
173
+ }
174
+ ),
175
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-3 gap-2", children: ["500-8", "500-12", "500-15"].map((e) => {
176
+ const l = t[e];
177
+ return /* @__PURE__ */ a(
178
+ "div",
179
+ {
180
+ className: "flex items-center gap-2 rounded-md border p-2",
181
+ style: { borderColor: "var(--gray-300)" },
182
+ children: [
183
+ /* @__PURE__ */ r(
184
+ "div",
185
+ {
186
+ className: "h-10 w-10 shrink-0 rounded border shadow-sm",
187
+ style: {
188
+ backgroundColor: l,
189
+ borderColor: "var(--gray-300)"
190
+ },
191
+ title: `${e}: ${l}`
192
+ }
193
+ ),
194
+ /* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: [
195
+ /* @__PURE__ */ a(
196
+ "p",
197
+ {
198
+ className: "text-xs font-medium",
199
+ style: { color: "var(--gray-700)" },
200
+ children: [
201
+ e.replace("500-", ""),
202
+ "% opacity"
203
+ ]
204
+ }
205
+ ),
206
+ /* @__PURE__ */ r(
207
+ "p",
208
+ {
209
+ className: "truncate font-mono text-[10px]",
210
+ style: { color: "var(--gray-500)" },
211
+ children: l
212
+ }
213
+ )
214
+ ] })
215
+ ]
216
+ },
217
+ e
218
+ );
219
+ }) })
220
+ ] }),
221
+ /* @__PURE__ */ a("div", { className: "space-y-2", children: [
222
+ /* @__PURE__ */ r(
223
+ "h4",
224
+ {
225
+ className: "text-sm font-medium",
226
+ style: { color: "var(--gray-700)" },
227
+ children: "Gray Scale"
228
+ }
229
+ ),
230
+ /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
231
+ /* @__PURE__ */ a("div", { className: "flex flex-col gap-1", children: [
232
+ /* @__PURE__ */ r(
233
+ "div",
234
+ {
235
+ className: "aspect-square w-full rounded-md border shadow-sm",
236
+ style: {
237
+ backgroundColor: t.white,
238
+ borderColor: "var(--gray-300)"
239
+ },
240
+ title: `white: ${t.white}`
241
+ }
242
+ ),
243
+ /* @__PURE__ */ r(
244
+ "p",
245
+ {
246
+ className: "text-center text-[10px] font-medium",
247
+ style: { color: "var(--gray-700)" },
248
+ children: "White"
249
+ }
250
+ )
251
+ ] }),
252
+ [
253
+ "gray-50",
254
+ "gray-100",
255
+ "gray-200",
256
+ "gray-300",
257
+ "gray-400",
258
+ "gray-500",
259
+ "gray-600",
260
+ "gray-700",
261
+ "gray-800",
262
+ "gray-900",
263
+ "gray-1000"
264
+ ].map((e) => {
265
+ const l = t[e], g = e.replace("gray-", "");
266
+ return /* @__PURE__ */ a("div", { className: "flex flex-col gap-1", children: [
267
+ /* @__PURE__ */ r(
268
+ "div",
269
+ {
270
+ className: "aspect-square w-full rounded-md border shadow-sm",
271
+ style: {
272
+ backgroundColor: l,
273
+ borderColor: "var(--gray-300)"
274
+ },
275
+ title: `${e}: ${l}`
276
+ }
277
+ ),
278
+ /* @__PURE__ */ r(
279
+ "p",
280
+ {
281
+ className: "text-center text-[12px] font-medium",
282
+ style: { color: "var(--gray-700)" },
283
+ children: g
284
+ }
285
+ )
286
+ ] }, e);
287
+ })
288
+ ] })
289
+ ] })
290
+ ] }),
291
+ /* @__PURE__ */ a("div", { className: "flex justify-end gap-3", children: [
292
+ /* @__PURE__ */ r(s, { onClick: n, variant: "secondary", danger: !0, children: "Reset" }),
293
+ /* @__PURE__ */ r(s, { onClick: n, variant: "primary", children: "Accept" })
294
+ ] })
295
+ ]
296
+ }
297
+ ) })
298
+ }
299
+ );
300
+ };
301
+ export {
302
+ z as ThemeSetterModal
303
+ };
@@ -0,0 +1,31 @@
1
+ import { ColorShades } from './ThemeProvider';
2
+ /**
3
+ * Generate Tailwind-style color shades from a base color
4
+ * Shades: 100, 200, 300, 400, 500, 600, 700, 500/8%, 500/12%, 500/15%
5
+ * Gray shades and white are constant values from the default preset
6
+ * Returns null if the input is not a valid hex color
7
+ */
8
+ export declare const generateColorShades: (baseHex: string) => ColorShades | null;
9
+ /**
10
+ * Same as generateColorShades, except input baseHex is used for 500 shade
11
+ * Gray shades and white are constant values from the default preset
12
+ */
13
+ export declare const generateColorShades2: (baseHex: string) => ColorShades | null;
14
+ /**
15
+ * Format color shades as a JavaScript object string
16
+ */
17
+ export declare const formatShadesAsObject: (colorName: string, shades: ColorShades) => string;
18
+ /**
19
+ * Shades generator type - defines available shade generation algorithms
20
+ */
21
+ export type ShadesGenerator = 'tailwindStyle' | 'preserve500';
22
+ /**
23
+ * Generator function type
24
+ */
25
+ export type GeneratorFunction = (baseHex: string) => ColorShades | null;
26
+ /**
27
+ * Registry of available shades generators
28
+ * Makes the system extensible for future generator functions
29
+ */
30
+ export declare const SHADES_GENERATORS: Record<ShadesGenerator, GeneratorFunction>;
31
+ //# sourceMappingURL=colorShades.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorShades.d.ts","sourceRoot":"","sources":["../../../../src/components/MuzaUIProvider/theme/colorShades.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAA;AA8KlD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,WAAW,GAAG,IA6DnE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,KAAG,WAAW,GAAG,IAgBpE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAC/B,WAAW,MAAM,EACjB,QAAQ,WAAW,WAWpB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,aAAa,CAAA;AAE7D;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,WAAW,GAAG,IAAI,CAAA;AAEvE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,eAAe,EAAE,iBAAiB,CAGxE,CAAA"}
@@ -0,0 +1,131 @@
1
+ import { themePresets as t } from "./themePresets.js";
2
+ const m = (e) => {
3
+ const r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
4
+ return r ? {
5
+ r: parseInt(r[1], 16),
6
+ g: parseInt(r[2], 16),
7
+ b: parseInt(r[3], 16)
8
+ } : null;
9
+ }, S = (e) => {
10
+ const r = e.r / 255, n = e.g / 255, a = e.b / 255, g = Math.max(r, n, a), u = Math.min(r, n, a);
11
+ let o = 0, l = 0;
12
+ const c = (g + u) / 2;
13
+ if (g !== u) {
14
+ const s = g - u;
15
+ switch (l = c > 0.5 ? s / (2 - g - u) : s / (g + u), g) {
16
+ case r:
17
+ o = ((n - a) / s + (n < a ? 6 : 0)) / 6;
18
+ break;
19
+ case n:
20
+ o = ((a - r) / s + 2) / 6;
21
+ break;
22
+ case a:
23
+ o = ((r - n) / s + 4) / 6;
24
+ break;
25
+ }
26
+ }
27
+ return {
28
+ h: Math.round(o * 360),
29
+ s: Math.round(l * 100),
30
+ l: Math.round(c * 100)
31
+ };
32
+ }, T = (e) => {
33
+ const r = e.h / 360, n = e.s / 100, a = e.l / 100;
34
+ let g, u, o;
35
+ if (n === 0)
36
+ g = u = o = a;
37
+ else {
38
+ const c = (i, d, y) => (y < 0 && (y += 1), y > 1 && (y -= 1), y < 0.16666666666666666 ? i + (d - i) * 6 * y : y < 0.5 ? d : y < 0.6666666666666666 ? i + (d - i) * (0.6666666666666666 - y) * 6 : i), s = a < 0.5 ? a * (1 + n) : a + n - a * n, f = 2 * a - s;
39
+ g = c(f, s, r + 1 / 3), u = c(f, s, r), o = c(f, s, r - 1 / 3);
40
+ }
41
+ const l = (c) => {
42
+ const s = Math.round(c * 255).toString(16);
43
+ return s.length === 1 ? "0" + s : s;
44
+ };
45
+ return `#${l(g)}${l(u)}${l(o)}`;
46
+ }, h = (e, r) => `rgba(${e.r}, ${e.g}, ${e.b}, ${r / 100})`, b = {
47
+ white: t.muzalife["--brand-white"],
48
+ "gray-50": t.muzalife["--gray-50"],
49
+ "gray-100": t.muzalife["--gray-100"],
50
+ "gray-200": t.muzalife["--gray-200"],
51
+ "gray-300": t.muzalife["--gray-300"],
52
+ "gray-400": t.muzalife["--gray-400"],
53
+ "gray-500": t.muzalife["--gray-500"],
54
+ "gray-600": t.muzalife["--gray-600"],
55
+ "gray-700": t.muzalife["--gray-700"],
56
+ "gray-800": t.muzalife["--gray-800"],
57
+ "gray-900": t.muzalife["--gray-900"],
58
+ "gray-1000": t.muzalife["--gray-1000"]
59
+ }, $ = {
60
+ white: t.default["--brand-white"],
61
+ "gray-50": t.default["--gray-50"],
62
+ "gray-100": t.default["--gray-100"],
63
+ "gray-200": t.default["--gray-200"],
64
+ "gray-300": t.default["--gray-300"],
65
+ "gray-400": t.default["--gray-400"],
66
+ "gray-500": t.default["--gray-500"],
67
+ "gray-600": t.default["--gray-600"],
68
+ "gray-700": t.default["--gray-700"],
69
+ "gray-800": t.default["--gray-800"],
70
+ "gray-900": t.default["--gray-900"],
71
+ "gray-1000": t.default["--gray-1000"]
72
+ }, z = (e) => {
73
+ const r = m(e);
74
+ if (!r)
75
+ return null;
76
+ const n = S(r), a = {}, g = {
77
+ 100: 95,
78
+ // Very light
79
+ 200: 85,
80
+ 300: 75,
81
+ 400: 65,
82
+ 500: 50,
83
+ // Base/middle
84
+ 600: 40,
85
+ 700: 30
86
+ }, u = {
87
+ 100: 0.7,
88
+ 200: 0.8,
89
+ 300: 0.9,
90
+ 400: 0.95,
91
+ 500: 1,
92
+ 600: 1,
93
+ 700: 0.95
94
+ };
95
+ Object.entries(g).forEach(([l, c]) => {
96
+ const s = Math.round(n.s * u[Number(l)]);
97
+ a[l] = T({
98
+ h: n.h,
99
+ s,
100
+ l: c
101
+ });
102
+ });
103
+ const o = m(a[500]);
104
+ return o && (a["500-8"] = h(o, 8), a["500-12"] = h(o, 12), a["500-15"] = h(o, 15)), Object.assign(
105
+ a,
106
+ a[500] === "#5f1eb4" ? $ : b
107
+ ), a;
108
+ }, A = (e) => {
109
+ const r = z(e);
110
+ return r ? (r[500] = e, Object.assign(
111
+ r,
112
+ e === "#5f1eb4" ? $ : b
113
+ ), r) : null;
114
+ }, j = (e, r) => {
115
+ const n = Object.entries(r).map(([a, g]) => ` ${a.includes("-") ? `'${a}'` : a}: '${g}'`).join(`,
116
+ `);
117
+ return `{
118
+ ${e}: {
119
+ ${n}
120
+ }
121
+ }`;
122
+ }, E = {
123
+ tailwindStyle: z,
124
+ preserve500: A
125
+ };
126
+ export {
127
+ E as SHADES_GENERATORS,
128
+ j as formatShadesAsObject,
129
+ z as generateColorShades,
130
+ A as generateColorShades2
131
+ };
@@ -0,0 +1,5 @@
1
+ export { ThemeProvider, useTheme, type ColorShades, type ThemeProviderProps, } from './ThemeProvider';
2
+ export { setThemeVariables, themeVariableMapping, type ThemeCSSVariables, } from './setThemeVariables';
3
+ export { generateColorShades, generateColorShades2, formatShadesAsObject, SHADES_GENERATORS, type ShadesGenerator, type GeneratorFunction, } from './colorShades';
4
+ export { themePresets, type ThemePresets } from './themePresets';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/MuzaUIProvider/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,QAAQ,EACR,KAAK,WAAW,EAChB,KAAK,kBAAkB,GACxB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,iBAAiB,GACvB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA"}