@vkzstudio/muza-ui 1.0.25 → 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.
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +17 -14
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +1 -1
- package/dist/components/MuzaUIProvider/MuzaUIProvider.d.ts +10 -3
- package/dist/components/MuzaUIProvider/MuzaUIProvider.d.ts.map +1 -1
- package/dist/components/MuzaUIProvider/MuzaUIProvider.js +14 -12
- package/dist/components/MuzaUIProvider/MuzaUIProvider.stories.d.ts +2 -0
- package/dist/components/MuzaUIProvider/MuzaUIProvider.stories.d.ts.map +1 -1
- package/dist/components/MuzaUIProvider/index.d.ts +4 -0
- package/dist/components/MuzaUIProvider/index.d.ts.map +1 -1
- package/dist/components/MuzaUIProvider/theme/ThemeProvider.d.ts +76 -0
- package/dist/components/MuzaUIProvider/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/components/MuzaUIProvider/theme/ThemeProvider.js +82 -0
- package/dist/components/MuzaUIProvider/theme/ThemeSetterModal.d.ts +7 -0
- package/dist/components/MuzaUIProvider/theme/ThemeSetterModal.d.ts.map +1 -0
- package/dist/components/MuzaUIProvider/theme/ThemeSetterModal.js +303 -0
- package/dist/components/MuzaUIProvider/theme/colorShades.d.ts +31 -0
- package/dist/components/MuzaUIProvider/theme/colorShades.d.ts.map +1 -0
- package/dist/components/MuzaUIProvider/theme/colorShades.js +131 -0
- package/dist/components/MuzaUIProvider/theme/index.d.ts +5 -0
- package/dist/components/MuzaUIProvider/theme/index.d.ts.map +1 -0
- package/dist/components/MuzaUIProvider/theme/setThemeVariables.d.ts +39 -0
- package/dist/components/MuzaUIProvider/theme/setThemeVariables.d.ts.map +1 -0
- package/dist/components/MuzaUIProvider/theme/setThemeVariables.js +44 -0
- package/dist/components/MuzaUIProvider/theme/themePresets.d.ts +7 -0
- package/dist/components/MuzaUIProvider/theme/themePresets.d.ts.map +1 -0
- package/dist/components/MuzaUIProvider/theme/themePresets.js +77 -0
- package/dist/components/MuzaUIProvider/theme/useKeyboardShortcut.d.ts +16 -0
- package/dist/components/MuzaUIProvider/theme/useKeyboardShortcut.d.ts.map +1 -0
- package/dist/components/MuzaUIProvider/theme/useKeyboardShortcut.js +22 -0
- package/dist/index.js +140 -131
- package/dist/muza-ui.css +1 -1
- package/package.json +1 -1
|
@@ -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"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ColorShades } from './ThemeProvider';
|
|
2
|
+
import { ThemePresets } from './themePresets';
|
|
3
|
+
/**
|
|
4
|
+
* Sets theme CSS variables on the root element
|
|
5
|
+
* Maps generated color shades to brand variables
|
|
6
|
+
*/
|
|
7
|
+
export type ThemeCSSVariables = {
|
|
8
|
+
'--brand-tertiary': string;
|
|
9
|
+
'--brand-disabled': string;
|
|
10
|
+
'--brand-secondary': string;
|
|
11
|
+
'--brand-quaternary': string;
|
|
12
|
+
'--brand-primary': string;
|
|
13
|
+
'--brand-hover': string;
|
|
14
|
+
'--brand-focused': string;
|
|
15
|
+
'--brand-8': string;
|
|
16
|
+
'--brand-12': string;
|
|
17
|
+
'--brand-15': string;
|
|
18
|
+
'--brand-white': string;
|
|
19
|
+
'--gray-100': string;
|
|
20
|
+
'--gray-1000': string;
|
|
21
|
+
'--gray-200': string;
|
|
22
|
+
'--gray-300': string;
|
|
23
|
+
'--gray-400': string;
|
|
24
|
+
'--gray-50': string;
|
|
25
|
+
'--gray-500': string;
|
|
26
|
+
'--gray-600': string;
|
|
27
|
+
'--gray-700': string;
|
|
28
|
+
'--gray-800': string;
|
|
29
|
+
'--gray-900': string;
|
|
30
|
+
};
|
|
31
|
+
export declare const themeVariableMapping: Record<keyof ThemeCSSVariables, keyof ColorShades>;
|
|
32
|
+
export declare const setThemeVariables: ({ shades, preset, }: {
|
|
33
|
+
shades: ColorShades;
|
|
34
|
+
preset?: undefined;
|
|
35
|
+
} | {
|
|
36
|
+
shades?: undefined;
|
|
37
|
+
preset: ThemePresets;
|
|
38
|
+
}) => void;
|
|
39
|
+
//# sourceMappingURL=setThemeVariables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setThemeVariables.d.ts","sourceRoot":"","sources":["../../../../src/components/MuzaUIProvider/theme/setThemeVariables.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,gBAAgB,CAAA;AAEhE;;;GAGG;AAEH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,iBAAiB,EAAE,MAAM,CAAA;IACzB,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAGD,eAAO,MAAM,oBAAoB,EAAE,MAAM,CACvC,MAAM,iBAAiB,EACvB,MAAM,WAAW,CAwBlB,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,qBAI9B;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,MAAM,CAAC,EAAE,SAAS,CAAA;CAAE,GAC3C;IAAE,MAAM,CAAC,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,SAmB/C,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { themePresets as g } from "./themePresets.js";
|
|
2
|
+
const o = {
|
|
3
|
+
"--brand-tertiary": "100",
|
|
4
|
+
"--brand-disabled": "200",
|
|
5
|
+
"--brand-secondary": "300",
|
|
6
|
+
"--brand-quaternary": "400",
|
|
7
|
+
"--brand-primary": "500",
|
|
8
|
+
"--brand-hover": "600",
|
|
9
|
+
"--brand-focused": "700",
|
|
10
|
+
"--brand-8": "500-8",
|
|
11
|
+
"--brand-12": "500-12",
|
|
12
|
+
"--brand-15": "500-15",
|
|
13
|
+
"--brand-white": "white",
|
|
14
|
+
"--gray-100": "gray-100",
|
|
15
|
+
"--gray-1000": "gray-1000",
|
|
16
|
+
"--gray-200": "gray-200",
|
|
17
|
+
"--gray-300": "gray-300",
|
|
18
|
+
"--gray-400": "gray-400",
|
|
19
|
+
"--gray-50": "gray-50",
|
|
20
|
+
"--gray-500": "gray-500",
|
|
21
|
+
"--gray-600": "gray-600",
|
|
22
|
+
"--gray-700": "gray-700",
|
|
23
|
+
"--gray-800": "gray-800",
|
|
24
|
+
"--gray-900": "gray-900"
|
|
25
|
+
}, d = ({
|
|
26
|
+
shades: e,
|
|
27
|
+
preset: n
|
|
28
|
+
}) => {
|
|
29
|
+
const t = document.documentElement;
|
|
30
|
+
if (!e) {
|
|
31
|
+
Object.entries(g[n]).forEach(([a, r]) => {
|
|
32
|
+
r && t.style.setProperty(a, r);
|
|
33
|
+
});
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
Object.entries(o).forEach(([a, r]) => {
|
|
37
|
+
const y = e[r];
|
|
38
|
+
y && t.style.setProperty(a, y);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
d as setThemeVariables,
|
|
43
|
+
o as themeVariableMapping
|
|
44
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ThemeCSSVariables } from './setThemeVariables';
|
|
2
|
+
export type ThemePresets = 'default' | 'muzalife' | 'vodafone';
|
|
3
|
+
/**
|
|
4
|
+
* Brand CSS variable names used in the theme system
|
|
5
|
+
*/
|
|
6
|
+
export declare const themePresets: Record<ThemePresets, ThemeCSSVariables>;
|
|
7
|
+
//# sourceMappingURL=themePresets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themePresets.d.ts","sourceRoot":"","sources":["../../../../src/components/MuzaUIProvider/theme/themePresets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5D,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAA;AAE9D;;GAEG;AAEH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,iBAAiB,CAyEhE,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const a = {
|
|
2
|
+
default: {
|
|
3
|
+
"--brand-12": "#5f1eb41f",
|
|
4
|
+
"--brand-15": "#5f1eb426",
|
|
5
|
+
"--brand-8": "#5f1eb414",
|
|
6
|
+
"--brand-disabled": "#d2b9f3",
|
|
7
|
+
"--brand-focused": "#461d7c",
|
|
8
|
+
"--brand-hover": "#521d96",
|
|
9
|
+
"--brand-primary": "#5f1eb4",
|
|
10
|
+
"--brand-quaternary": "#843fde",
|
|
11
|
+
"--brand-secondary": "#a673e7",
|
|
12
|
+
"--brand-tertiary": "#f1e9f8",
|
|
13
|
+
"--brand-white": "#f7f5ff",
|
|
14
|
+
"--gray-100": "#f6f3fe",
|
|
15
|
+
"--gray-1000": "#5a5473",
|
|
16
|
+
"--gray-200": "#eeebf7",
|
|
17
|
+
"--gray-300": "#e3e0f1",
|
|
18
|
+
"--gray-400": "#d6d1ea",
|
|
19
|
+
"--gray-50": "#f9f8fb",
|
|
20
|
+
"--gray-500": "#c6c0dc",
|
|
21
|
+
"--gray-600": "#9a92b9",
|
|
22
|
+
"--gray-700": "#867fa2",
|
|
23
|
+
"--gray-800": "#787194",
|
|
24
|
+
"--gray-900": "#645c81"
|
|
25
|
+
},
|
|
26
|
+
muzalife: {
|
|
27
|
+
"--brand-12": "#14645a1f",
|
|
28
|
+
"--brand-15": "#14645a26",
|
|
29
|
+
"--brand-8": "#14645a14",
|
|
30
|
+
"--brand-disabled": "#9bf4de",
|
|
31
|
+
"--brand-focused": "#117466",
|
|
32
|
+
"--brand-hover": "#10917e",
|
|
33
|
+
"--brand-primary": "#14645a",
|
|
34
|
+
"--brand-quaternary": "#30d1b3",
|
|
35
|
+
"--brand-secondary": "#61e7ca",
|
|
36
|
+
"--brand-tertiary": "#cdfaed",
|
|
37
|
+
"--brand-white": "#f4f4f5",
|
|
38
|
+
"--gray-100": "#f7f7f8",
|
|
39
|
+
"--gray-1000": "#5b5b6f",
|
|
40
|
+
"--gray-200": "#f2f2f3",
|
|
41
|
+
"--gray-300": "#e7e7e9",
|
|
42
|
+
"--gray-400": "#dcdce0",
|
|
43
|
+
"--gray-50": "#fafafa",
|
|
44
|
+
"--gray-500": "#ccccd1",
|
|
45
|
+
"--gray-600": "#a0a0ab",
|
|
46
|
+
"--gray-700": "#8b8b98",
|
|
47
|
+
"--gray-800": "#7d7d87",
|
|
48
|
+
"--gray-900": "#676774"
|
|
49
|
+
},
|
|
50
|
+
vodafone: {
|
|
51
|
+
"--brand-12": "#e600001f",
|
|
52
|
+
"--brand-15": "#e6000026",
|
|
53
|
+
"--brand-8": "#e6000014",
|
|
54
|
+
"--brand-disabled": "#ffc1c1",
|
|
55
|
+
"--brand-focused": "#e60000",
|
|
56
|
+
"--brand-hover": "#fc0606",
|
|
57
|
+
"--brand-primary": "#e60000",
|
|
58
|
+
"--brand-quaternary": "#ff5959",
|
|
59
|
+
"--brand-secondary": "#ff9595",
|
|
60
|
+
"--brand-tertiary": "#ffdddd",
|
|
61
|
+
"--brand-white": "#f4f4f5",
|
|
62
|
+
"--gray-100": "#f7f7f8",
|
|
63
|
+
"--gray-1000": "#5b5b6f",
|
|
64
|
+
"--gray-200": "#f2f2f3",
|
|
65
|
+
"--gray-300": "#e7e7e9",
|
|
66
|
+
"--gray-400": "#dcdce0",
|
|
67
|
+
"--gray-50": "#fafafa",
|
|
68
|
+
"--gray-500": "#ccccd1",
|
|
69
|
+
"--gray-600": "#a0a0ab",
|
|
70
|
+
"--gray-700": "#8b8b98",
|
|
71
|
+
"--gray-800": "#7d7d87",
|
|
72
|
+
"--gray-900": "#676774"
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
export {
|
|
76
|
+
a as themePresets
|
|
77
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface KeyboardShortcutOptions {
|
|
2
|
+
key: string;
|
|
3
|
+
ctrlKey?: boolean;
|
|
4
|
+
shiftKey?: boolean;
|
|
5
|
+
altKey?: boolean;
|
|
6
|
+
metaKey?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Hook to register a keyboard shortcut
|
|
10
|
+
* @param options - Keyboard shortcut configuration
|
|
11
|
+
* @param callback - Function to call when shortcut is pressed
|
|
12
|
+
* @param enabled - Whether the shortcut is enabled (default: true)
|
|
13
|
+
*/
|
|
14
|
+
export declare const useKeyboardShortcut: (options: KeyboardShortcutOptions, callback: () => void, enabled?: boolean) => void;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=useKeyboardShortcut.d.ts.map
|