xertica-ui 2.9.8 → 2.9.9

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 (30) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -1
  3. package/components/pages/forgot-password-page/ForgotPasswordPage.tsx +19 -5
  4. package/components/pages/login-page/LoginPage.tsx +19 -5
  5. package/components/pages/reset-password-page/ResetPasswordPage.tsx +15 -2
  6. package/components/pages/verify-email-page/VerifyEmailPage.tsx +17 -3
  7. package/dist/AssistenteContext-Bm8_RJTB.js +200 -0
  8. package/dist/AssistenteContext-CLK8tgdt.cjs +205 -0
  9. package/dist/BrandColorsContext-D3Y0CYZF.js +643 -0
  10. package/dist/BrandColorsContext-SeOZd2Cq.cjs +646 -0
  11. package/dist/VerifyEmailPage-BInYcjRd.cjs +3305 -0
  12. package/dist/VerifyEmailPage-Z-cA_IIo.js +3295 -0
  13. package/dist/XerticaProvider-Ck996htf.cjs +47 -0
  14. package/dist/XerticaProvider-kE5l0MQn.js +45 -0
  15. package/dist/brand.cjs.js +1 -1
  16. package/dist/brand.es.js +1 -1
  17. package/dist/components/pages/forgot-password-page/ForgotPasswordPage.d.ts +4 -3
  18. package/dist/components/pages/login-page/LoginPage.d.ts +4 -3
  19. package/dist/components/pages/verify-email-page/VerifyEmailPage.d.ts +2 -1
  20. package/dist/hooks.cjs.js +6 -5
  21. package/dist/hooks.es.js +2 -1
  22. package/dist/index.cjs.js +2 -2
  23. package/dist/index.es.js +2 -2
  24. package/dist/pages.cjs.js +1 -1
  25. package/dist/pages.es.js +1 -1
  26. package/package.json +1 -1
  27. package/templates/src/features/auth/ui/ForgotPasswordContent.tsx +15 -2
  28. package/templates/src/features/auth/ui/LoginContent.tsx +15 -2
  29. package/templates/src/features/auth/ui/ResetPasswordContent.tsx +15 -2
  30. package/templates/src/features/auth/ui/VerifyEmailContent.tsx +15 -2
@@ -0,0 +1,646 @@
1
+ 'use strict';
2
+
3
+ const jsxRuntime = require('react/jsx-runtime');
4
+ const React = require('react');
5
+
6
+ const colorThemes = [
7
+ {
8
+ id: "xertica-original",
9
+ name: "Xertica Classic",
10
+ description: "A identidade visual clássica da Xertica com o gradiente original",
11
+ colors: {
12
+ primary: "#2C275B",
13
+ primaryForeground: "#FFFFFF",
14
+ primaryLight: "#5B568F",
15
+ primaryDarkMode: "#72CDFD",
16
+ primaryForegroundDark: "#09090B",
17
+ sidebarLight: "#2C275B",
18
+ // Primary Color
19
+ sidebarDark: "#1a1928",
20
+ // Original Dark BG
21
+ darkBackground: "#05050d",
22
+ darkCard: "#0d0c16",
23
+ darkMuted: "#16151f",
24
+ darkBorder: "#252336",
25
+ gradientStart: "#FDB0F2",
26
+ gradientEnd: "#72CDFD",
27
+ gradientStartDark: "#7B4A7A",
28
+ gradientEndDark: "#3A5C7D",
29
+ chart1: "#2C275B",
30
+ chart2: "#047857",
31
+ chart3: "#B45309",
32
+ chart4: "#1D4ED8",
33
+ chart5: "#B91C1C"
34
+ },
35
+ preview: {
36
+ primary: "#2C275B",
37
+ secondary: "#FDB0F2",
38
+ accent: "#72CDFD"
39
+ }
40
+ },
41
+ {
42
+ id: "xertica",
43
+ name: "Xertica",
44
+ description: "A nova identidade visual da Xertica: papel quente, tintas vivas e botões em estilo serigrafia",
45
+ colors: {
46
+ // General-purpose brand accent (logo, links, radio buttons, focus rings,
47
+ // sidebar active state, badges, etc). Kept as Negro Xertica / Crema so it
48
+ // stays legible everywhere — yellow is reserved for buttonPrimaryBg below.
49
+ primary: "#1E1E1E",
50
+ // Negro Xertica
51
+ primaryForeground: "#FFFEF8",
52
+ // Marfim
53
+ primaryLight: "#1E1E1E",
54
+ primaryDarkMode: "#F2EDD8",
55
+ // Crema
56
+ primaryForegroundDark: "#1E1E1E",
57
+ sidebarLight: "#1E1E1E",
58
+ // Negro Xertica
59
+ sidebarDark: "#1E1E1E",
60
+ darkBackground: "#141311",
61
+ darkCard: "#1E1E1E",
62
+ darkMuted: "#26241f",
63
+ darkBorder: "#38352c",
64
+ // Flat fill, same value on every stop — this theme uses solid ink
65
+ // colors, never gradients (Negro Xertica, matching sidebar/secondary-button).
66
+ gradientStart: "#1E1E1E",
67
+ gradientEnd: "#1E1E1E",
68
+ gradientStartDark: "#1E1E1E",
69
+ gradientEndDark: "#1E1E1E",
70
+ chart1: "#3D63AC",
71
+ // Azul
72
+ chart2: "#1899AF",
73
+ // Celeste
74
+ chart3: "#FAF338",
75
+ // Amarillo
76
+ chart4: "#DE5B48",
77
+ // Rojo Coral
78
+ chart5: "#2E8B5A",
79
+ // Verde
80
+ backgroundLight: "#E9E6DC",
81
+ // page/shell background
82
+ cardLight: "#FFFEF8",
83
+ // Marfim — cards, header, assistant panel
84
+ inputBorderColor: "rgba(30, 30, 30, 0.4)",
85
+ // Negro Xertica stroke — form fields only
86
+ outlineBorderColor: "rgba(30, 30, 30, 0.4)",
87
+ // Negro Xertica stroke — Button `outline` variant only
88
+ successColor: "#2E8B5A",
89
+ // Verde
90
+ warningColor: "#E37744",
91
+ // Naranja
92
+ infoColor: "#3D63AC",
93
+ // Azul
94
+ destructiveColor: "#DE5B48",
95
+ // Rojo Coral
96
+ buttonRadius: "9999px",
97
+ buttonStrokeWidth: "1px",
98
+ buttonStrokeColor: "#1E1E1E",
99
+ buttonStrokeColorDark: "#F2EDD8",
100
+ // Crema
101
+ buttonFontWeight: "400",
102
+ buttonSecondaryBg: "#1E1E1E",
103
+ buttonSecondaryBgDark: "#1E1E1E",
104
+ buttonSecondaryForeground: "#FFFEF8",
105
+ buttonSecondaryForegroundDark: "#FFFEF8",
106
+ // Amarillo stays vibrant, but only here — Button `default` variant and
107
+ // Switch's checked track, per the brand rule that yellow is the one
108
+ // accent allowed to dominate, and only in those two contexts.
109
+ buttonPrimaryBg: "#FAF338",
110
+ buttonPrimaryBgDark: "#FAF338",
111
+ buttonPrimaryForeground: "#1E1E1E",
112
+ buttonPrimaryForegroundDark: "#1E1E1E"
113
+ },
114
+ preview: {
115
+ primary: "#FAF338",
116
+ secondary: "#1E1E1E",
117
+ accent: "#1899AF"
118
+ }
119
+ },
120
+ {
121
+ id: "zinc",
122
+ name: "Zinc",
123
+ description: "Minimalista, sério e elegante (Escala de Cinza)",
124
+ colors: {
125
+ primary: "#18181B",
126
+ primaryForeground: "#FAFAFA",
127
+ primaryLight: "#E4E4E7",
128
+ primaryDarkMode: "#FAFAFA",
129
+ primaryForegroundDark: "#18181B",
130
+ sidebarLight: "#18181B",
131
+ // Primary Color
132
+ sidebarDark: "#09090B",
133
+ darkBackground: "#05050d",
134
+ darkCard: "#0d0c16",
135
+ darkMuted: "#16151f",
136
+ darkBorder: "#252336",
137
+ gradientStart: "#52525B",
138
+ gradientEnd: "#D4D4D8",
139
+ gradientStartDark: "#27272A",
140
+ gradientEndDark: "#52525B",
141
+ chart1: "#18181B",
142
+ chart2: "#52525B",
143
+ chart3: "#A1A1AA",
144
+ chart4: "#D4D4D8",
145
+ chart5: "#E4E4E7"
146
+ },
147
+ preview: {
148
+ primary: "#18181B",
149
+ secondary: "#52525B",
150
+ accent: "#E4E4E7"
151
+ }
152
+ },
153
+ {
154
+ id: "slate",
155
+ name: "Slate",
156
+ description: "Profissional com tons de azul acinzentado",
157
+ colors: {
158
+ primary: "#0F172A",
159
+ primaryForeground: "#F8FAFC",
160
+ primaryLight: "#CBD5E1",
161
+ primaryDarkMode: "#F8FAFC",
162
+ primaryForegroundDark: "#0F172A",
163
+ sidebarLight: "#0F172A",
164
+ // Primary Color
165
+ sidebarDark: "#020617",
166
+ darkBackground: "#05050d",
167
+ darkCard: "#0d0c16",
168
+ darkMuted: "#16151f",
169
+ darkBorder: "#252336",
170
+ gradientStart: "#475569",
171
+ gradientEnd: "#94A3B8",
172
+ gradientStartDark: "#1E293B",
173
+ gradientEndDark: "#475569",
174
+ chart1: "#0F172A",
175
+ chart2: "#475569",
176
+ chart3: "#94A3B8",
177
+ chart4: "#CBD5E1",
178
+ chart5: "#E2E8F0"
179
+ },
180
+ preview: {
181
+ primary: "#0F172A",
182
+ secondary: "#475569",
183
+ accent: "#94A3B8"
184
+ }
185
+ },
186
+ {
187
+ id: "blue",
188
+ name: "Blue",
189
+ description: "Confiável e seguro, padrão corporativo",
190
+ colors: {
191
+ primary: "#2563EB",
192
+ primaryForeground: "#FFFFFF",
193
+ primaryLight: "#DBEAFE",
194
+ primaryDarkMode: "#3B82F6",
195
+ primaryForegroundDark: "#FFFFFF",
196
+ sidebarLight: "#1E3A8A",
197
+ // Blue 900 (High Contrast Sidebar)
198
+ sidebarDark: "#172554",
199
+ darkBackground: "#03050f",
200
+ darkCard: "#080d18",
201
+ darkMuted: "#0f1422",
202
+ darkBorder: "#1a2440",
203
+ gradientStart: "#2563EB",
204
+ gradientEnd: "#60A5FA",
205
+ gradientStartDark: "#1D4ED8",
206
+ gradientEndDark: "#2563EB",
207
+ chart1: "#2563EB",
208
+ chart2: "#3B82F6",
209
+ chart3: "#60A5FA",
210
+ chart4: "#93C5FD",
211
+ chart5: "#BFDBFE"
212
+ },
213
+ preview: {
214
+ primary: "#2563EB",
215
+ secondary: "#60A5FA",
216
+ accent: "#DBEAFE"
217
+ }
218
+ },
219
+ {
220
+ id: "violet",
221
+ name: "Violet",
222
+ description: "Criativo e vibrante",
223
+ colors: {
224
+ primary: "#7C3AED",
225
+ primaryForeground: "#FFFFFF",
226
+ primaryLight: "#EDE9FE",
227
+ primaryDarkMode: "#8B5CF6",
228
+ primaryForegroundDark: "#FFFFFF",
229
+ sidebarLight: "#4C1D95",
230
+ // Violet 900 (High Contrast Sidebar)
231
+ sidebarDark: "#2E1065",
232
+ darkBackground: "#07040f",
233
+ darkCard: "#0e0a18",
234
+ darkMuted: "#150f21",
235
+ darkBorder: "#221838",
236
+ gradientStart: "#7C3AED",
237
+ gradientEnd: "#A78BFA",
238
+ gradientStartDark: "#5B21B6",
239
+ gradientEndDark: "#7C3AED",
240
+ chart1: "#7C3AED",
241
+ chart2: "#8B5CF6",
242
+ chart3: "#A78BFA",
243
+ chart4: "#C4B5FD",
244
+ chart5: "#DDD6FE"
245
+ },
246
+ preview: {
247
+ primary: "#7C3AED",
248
+ secondary: "#A78BFA",
249
+ accent: "#EDE9FE"
250
+ }
251
+ },
252
+ {
253
+ id: "rose",
254
+ name: "Rose",
255
+ description: "Elegante e suave",
256
+ colors: {
257
+ primary: "#BE123C",
258
+ // Rose 700 (Better text contrast for Primary)
259
+ primaryForeground: "#FFFFFF",
260
+ primaryLight: "#FFE4E6",
261
+ primaryDarkMode: "#F43F5E",
262
+ primaryForegroundDark: "#FFFFFF",
263
+ sidebarLight: "#881337",
264
+ // Rose 900 (High Contrast Sidebar)
265
+ sidebarDark: "#881337",
266
+ darkBackground: "#0f0305",
267
+ darkCard: "#180709",
268
+ darkMuted: "#200c0f",
269
+ darkBorder: "#3a1018",
270
+ gradientStart: "#E11D48",
271
+ gradientEnd: "#FB7185",
272
+ gradientStartDark: "#9F1239",
273
+ gradientEndDark: "#E11D48",
274
+ chart1: "#E11D48",
275
+ chart2: "#F43F5E",
276
+ chart3: "#FB7185",
277
+ chart4: "#FDA4AF",
278
+ chart5: "#FECDD3"
279
+ },
280
+ preview: {
281
+ primary: "#BE123C",
282
+ secondary: "#FB7185",
283
+ accent: "#FFE4E6"
284
+ }
285
+ },
286
+ {
287
+ id: "emerald",
288
+ name: "Emerald",
289
+ description: "Natural e equilibrado",
290
+ colors: {
291
+ primary: "#047857",
292
+ // Emerald 700 (Better text contrast for Primary)
293
+ primaryForeground: "#FFFFFF",
294
+ primaryLight: "#D1FAE5",
295
+ primaryDarkMode: "#10B981",
296
+ primaryForegroundDark: "#FFFFFF",
297
+ sidebarLight: "#064E3B",
298
+ // Emerald 900 (High Contrast Sidebar)
299
+ sidebarDark: "#064E3B",
300
+ darkBackground: "#030f08",
301
+ darkCard: "#07160c",
302
+ darkMuted: "#0c1e11",
303
+ darkBorder: "#143320",
304
+ gradientStart: "#059669",
305
+ gradientEnd: "#34D399",
306
+ gradientStartDark: "#064E3B",
307
+ gradientEndDark: "#059669",
308
+ chart1: "#059669",
309
+ chart2: "#10B981",
310
+ chart3: "#34D399",
311
+ chart4: "#6EE7B7",
312
+ chart5: "#A7F3D0"
313
+ },
314
+ preview: {
315
+ primary: "#047857",
316
+ secondary: "#34D399",
317
+ accent: "#D1FAE5"
318
+ }
319
+ },
320
+ {
321
+ id: "amber",
322
+ name: "Amber",
323
+ description: "Quente e energético",
324
+ colors: {
325
+ primary: "#B45309",
326
+ // Amber 700 (Better text contrast for Primary)
327
+ primaryForeground: "#FFFFFF",
328
+ primaryLight: "#FEF3C7",
329
+ primaryDarkMode: "#F59E0B",
330
+ primaryForegroundDark: "#FFFFFF",
331
+ sidebarLight: "#78350F",
332
+ // Amber 900 (High Contrast Sidebar)
333
+ sidebarDark: "#78350F",
334
+ darkBackground: "#0f0a03",
335
+ darkCard: "#181107",
336
+ darkMuted: "#20190d",
337
+ darkBorder: "#382e14",
338
+ gradientStart: "#D97706",
339
+ gradientEnd: "#FBBF24",
340
+ gradientStartDark: "#92400E",
341
+ gradientEndDark: "#D97706",
342
+ chart1: "#D97706",
343
+ chart2: "#F59E0B",
344
+ chart3: "#FBBF24",
345
+ chart4: "#FDE68A",
346
+ chart5: "#FEF3C7"
347
+ },
348
+ preview: {
349
+ primary: "#B45309",
350
+ secondary: "#FBBF24",
351
+ accent: "#FEF3C7"
352
+ }
353
+ },
354
+ {
355
+ id: "orange",
356
+ name: "Orange",
357
+ description: "Vibrante e amigável",
358
+ colors: {
359
+ primary: "#C2410C",
360
+ // Orange 700 (Better text contrast for Primary)
361
+ primaryForeground: "#FFFFFF",
362
+ primaryLight: "#FFEDD5",
363
+ primaryDarkMode: "#F97316",
364
+ primaryForegroundDark: "#FFFFFF",
365
+ sidebarLight: "#7C2D12",
366
+ // Orange 900 (High Contrast Sidebar)
367
+ sidebarDark: "#7C2D12",
368
+ darkBackground: "#0f0703",
369
+ darkCard: "#180e06",
370
+ darkMuted: "#20150a",
371
+ darkBorder: "#382512",
372
+ gradientStart: "#EA580C",
373
+ gradientEnd: "#FB923C",
374
+ gradientStartDark: "#9A3412",
375
+ gradientEndDark: "#EA580C",
376
+ chart1: "#EA580C",
377
+ chart2: "#F97316",
378
+ chart3: "#FB923C",
379
+ chart4: "#FDBA74",
380
+ chart5: "#FED7AA"
381
+ },
382
+ preview: {
383
+ primary: "#C2410C",
384
+ secondary: "#FB923C",
385
+ accent: "#FFEDD5"
386
+ }
387
+ }
388
+ ];
389
+
390
+ function hexToRgb(hex) {
391
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
392
+ return result ? {
393
+ r: parseInt(result[1], 16),
394
+ g: parseInt(result[2], 16),
395
+ b: parseInt(result[3], 16)
396
+ } : null;
397
+ }
398
+
399
+ const BrandColorsContext = React.createContext(void 0);
400
+ const BrandColorsProvider = ({
401
+ children,
402
+ defaultTheme,
403
+ primaryColor,
404
+ useCustomTokens = false
405
+ }) => {
406
+ const [currentTheme, setCurrentTheme] = React.useState(() => {
407
+ if (primaryColor) return "custom";
408
+ return defaultTheme || "xertica-original";
409
+ });
410
+ const [radius, setRadius] = React.useState(0.5);
411
+ const [colors, setColors] = React.useState(() => {
412
+ if (primaryColor) {
413
+ return {
414
+ ...colorThemes[0].colors,
415
+ primary: primaryColor,
416
+ primaryDarkMode: primaryColor,
417
+ sidebarLight: primaryColor,
418
+ sidebarDark: primaryColor,
419
+ chart1: primaryColor
420
+ };
421
+ }
422
+ const theme = colorThemes.find((t) => t.id === currentTheme);
423
+ return theme?.colors || colorThemes[0].colors;
424
+ });
425
+ React.useEffect(() => {
426
+ if (primaryColor) {
427
+ setColors({
428
+ ...colorThemes[0].colors,
429
+ primary: primaryColor,
430
+ primaryDarkMode: primaryColor,
431
+ sidebarLight: primaryColor,
432
+ sidebarDark: primaryColor,
433
+ chart1: primaryColor
434
+ });
435
+ setCurrentTheme("custom");
436
+ return;
437
+ }
438
+ const theme = colorThemes.find((t) => t.id === currentTheme);
439
+ if (theme) {
440
+ setColors(theme.colors);
441
+ }
442
+ }, [currentTheme, primaryColor]);
443
+ const applyColors = React.useCallback(() => {
444
+ if (useCustomTokens) return;
445
+ if (typeof document === "undefined") return;
446
+ const root = document.documentElement;
447
+ const isDark = root.classList.contains("dark");
448
+ const primary = isDark ? colors.primaryDarkMode : colors.primary;
449
+ const primaryForeground = isDark ? colors.primaryForegroundDark : colors.primaryForeground;
450
+ const gradientStart = isDark ? colors.gradientStartDark : colors.gradientStart;
451
+ const gradientEnd = isDark ? colors.gradientEndDark : colors.gradientEnd;
452
+ const semantic = {
453
+ success: isDark ? "#4ade80" : colors.successColor || "#047857",
454
+ // Green 400 / 700
455
+ warning: isDark ? "#fbbf24" : colors.warningColor || "#b45309",
456
+ // Amber 400 / 700
457
+ info: isDark ? "#60a5fa" : colors.infoColor || "#1d4ed8",
458
+ // Blue 400 / 700
459
+ destructive: isDark ? "#f87171" : colors.destructiveColor || "#b91c1c",
460
+ // Red 400 / 700
461
+ foreground: isDark ? "#050505" : "#ffffff"
462
+ };
463
+ const cssVars = [];
464
+ cssVars.push(`--primary: ${primary}`);
465
+ cssVars.push(`--primary-foreground: ${primaryForeground}`);
466
+ cssVars.push(`--success: ${semantic.success}`);
467
+ cssVars.push(`--success-foreground: ${semantic.foreground}`);
468
+ cssVars.push(`--warning: ${semantic.warning}`);
469
+ cssVars.push(`--warning-foreground: ${semantic.foreground}`);
470
+ cssVars.push(`--info: ${semantic.info}`);
471
+ cssVars.push(`--info-foreground: ${semantic.foreground}`);
472
+ cssVars.push(`--destructive: ${semantic.destructive}`);
473
+ cssVars.push(`--destructive-foreground: ${semantic.foreground}`);
474
+ const primaryRGB = hexToRgb(primary);
475
+ if (primaryRGB) {
476
+ cssVars.push(
477
+ `--ring: ${isDark ? colors.primaryDarkMode : `rgba(${primaryRGB.r}, ${primaryRGB.g}, ${primaryRGB.b}, 0.5)`}`
478
+ );
479
+ cssVars.push(`--xertica-primary: ${primary}`);
480
+ cssVars.push(
481
+ `--primary-light: rgba(${primaryRGB.r}, ${primaryRGB.g}, ${primaryRGB.b}, 0.15)`
482
+ );
483
+ cssVars.push(`--primary-light-foreground: ${primary}`);
484
+ }
485
+ cssVars.push(`--radius: ${radius}rem`);
486
+ cssVars.push(`--radius-button: ${colors.buttonRadius || "12px"}`);
487
+ cssVars.push(`--button-stroke-width: ${colors.buttonStrokeWidth || "0px"}`);
488
+ cssVars.push(`--button-font-weight: ${colors.buttonFontWeight || "500"}`);
489
+ cssVars.push(`--chart-1: ${colors.chart1}`);
490
+ cssVars.push(`--chart-2: ${colors.chart2}`);
491
+ cssVars.push(`--chart-3: ${colors.chart3}`);
492
+ cssVars.push(`--chart-4: ${colors.chart4}`);
493
+ cssVars.push(`--chart-5: ${colors.chart5}`);
494
+ const sidebarBg = isDark ? colors.sidebarDark : colors.sidebarLight;
495
+ const isSidebarLight = sidebarBg.toLowerCase() === "#ffffff" || sidebarBg.toLowerCase() === "#f3f4f6" || sidebarBg.toLowerCase() === "#fafafa";
496
+ const sidebarFg = isSidebarLight ? "#0F172A" : "#FFFFFF";
497
+ cssVars.push(`--sidebar: ${sidebarBg}`);
498
+ cssVars.push(`--sidebar-foreground: ${sidebarFg}`);
499
+ if (primaryRGB) {
500
+ if (isSidebarLight) {
501
+ cssVars.push(
502
+ `--sidebar-accent: rgba(${primaryRGB.r}, ${primaryRGB.g}, ${primaryRGB.b}, 0.1)`
503
+ );
504
+ cssVars.push(`--sidebar-accent-foreground: ${primary}`);
505
+ cssVars.push(`--sidebar-border: rgba(0,0,0,0.1)`);
506
+ } else {
507
+ cssVars.push(`--sidebar-accent: rgba(255, 255, 255, 0.1)`);
508
+ cssVars.push(`--sidebar-accent-foreground: #FFFFFF`);
509
+ cssVars.push(`--sidebar-border: rgba(255,255,255,0.1)`);
510
+ }
511
+ cssVars.push(`--sidebar-ring: rgba(${primaryRGB.r}, ${primaryRGB.g}, ${primaryRGB.b}, 0.5)`);
512
+ }
513
+ if (!isSidebarLight) {
514
+ cssVars.push(`--sidebar-primary: #FFFFFF`);
515
+ cssVars.push(`--sidebar-primary-foreground: ${primary}`);
516
+ } else {
517
+ cssVars.push(`--sidebar-primary: ${primary}`);
518
+ cssVars.push(`--sidebar-primary-foreground: ${primaryForeground}`);
519
+ }
520
+ cssVars.push(
521
+ `--gradient-diagonal: linear-gradient(135deg, ${gradientStart} 0%, ${gradientEnd} 100%)`
522
+ );
523
+ const darkSurfaceVars = [];
524
+ if (colors.darkBackground) {
525
+ darkSurfaceVars.push(`--background: ${colors.darkBackground}`);
526
+ darkSurfaceVars.push(`--card: ${colors.darkCard}`);
527
+ darkSurfaceVars.push(`--popover: ${colors.darkCard}`);
528
+ darkSurfaceVars.push(`--secondary: ${colors.darkMuted}`);
529
+ darkSurfaceVars.push(`--muted: ${colors.darkMuted}`);
530
+ darkSurfaceVars.push(`--accent: ${colors.darkMuted}`);
531
+ darkSurfaceVars.push(`--border: ${colors.darkBorder}`);
532
+ darkSurfaceVars.push(`--input: ${colors.darkMuted}`);
533
+ darkSurfaceVars.push(`--input-background: ${colors.darkMuted}`);
534
+ }
535
+ const lightModeVars = [
536
+ `--button-stroke-color: ${colors.buttonStrokeColor || "transparent"}`,
537
+ `--button-secondary-bg: ${colors.buttonSecondaryBg || "var(--secondary)"}`,
538
+ `--button-secondary-foreground: ${colors.buttonSecondaryForeground || "var(--secondary-foreground)"}`,
539
+ `--button-primary-bg: ${colors.buttonPrimaryBg || "var(--primary)"}`,
540
+ `--button-primary-foreground: ${colors.buttonPrimaryForeground || "var(--primary-foreground)"}`
541
+ ];
542
+ if (colors.backgroundLight) {
543
+ lightModeVars.push(`--background: ${colors.backgroundLight}`);
544
+ lightModeVars.push(`--muted: ${colors.backgroundLight}`);
545
+ }
546
+ if (colors.cardLight) {
547
+ lightModeVars.push(`--card: ${colors.cardLight}`);
548
+ lightModeVars.push(`--popover: ${colors.cardLight}`);
549
+ }
550
+ if (colors.inputBorderColor) {
551
+ lightModeVars.push(`--input-border: ${colors.inputBorderColor}`);
552
+ }
553
+ if (colors.outlineBorderColor) {
554
+ lightModeVars.push(`--outline-border: ${colors.outlineBorderColor}`);
555
+ }
556
+ darkSurfaceVars.push(
557
+ `--button-stroke-color: ${colors.buttonStrokeColorDark || colors.buttonStrokeColor || "transparent"}`
558
+ );
559
+ darkSurfaceVars.push(
560
+ `--button-secondary-bg: ${colors.buttonSecondaryBgDark || colors.buttonSecondaryBg || "var(--secondary)"}`
561
+ );
562
+ darkSurfaceVars.push(
563
+ `--button-secondary-foreground: ${colors.buttonSecondaryForegroundDark || colors.buttonSecondaryForeground || "var(--secondary-foreground)"}`
564
+ );
565
+ darkSurfaceVars.push(
566
+ `--button-primary-bg: ${colors.buttonPrimaryBgDark || colors.buttonPrimaryBg || "var(--primary)"}`
567
+ );
568
+ darkSurfaceVars.push(
569
+ `--button-primary-foreground: ${colors.buttonPrimaryForegroundDark || colors.buttonPrimaryForeground || "var(--primary-foreground)"}`
570
+ );
571
+ cssVars.forEach((declaration) => {
572
+ const eqIdx = declaration.indexOf(":");
573
+ if (eqIdx === -1) return;
574
+ const prop = declaration.substring(0, eqIdx).trim();
575
+ const val = declaration.substring(eqIdx + 1).trim();
576
+ root.style.setProperty(prop, val);
577
+ });
578
+ const styleId = "xertica-brand-colors-injection";
579
+ let styleEl = document.getElementById(styleId);
580
+ if (!styleEl) {
581
+ styleEl = document.createElement("style");
582
+ styleEl.id = styleId;
583
+ document.head.appendChild(styleEl);
584
+ } else {
585
+ document.head.appendChild(styleEl);
586
+ }
587
+ const lightModeBlock = `:root:not(.dark) {
588
+ ${lightModeVars.join(";\n ")};
589
+ }`;
590
+ const darkSurfaceBlock = darkSurfaceVars.length > 0 ? `
591
+ :root[data-mode='dark'], .dark {
592
+ ${darkSurfaceVars.join(";\n ")};
593
+ }` : "";
594
+ styleEl.innerHTML = `${lightModeBlock}${darkSurfaceBlock}`.trim();
595
+ }, [colors, currentTheme, radius, useCustomTokens]);
596
+ React.useEffect(() => {
597
+ applyColors();
598
+ }, [applyColors]);
599
+ React.useEffect(() => {
600
+ if (typeof document === "undefined" || typeof MutationObserver === "undefined") return;
601
+ const root = document.documentElement;
602
+ const observer = new MutationObserver((mutations) => {
603
+ mutations.forEach((mutation) => {
604
+ if (mutation.type === "attributes" && mutation.attributeName === "class") {
605
+ applyColors();
606
+ }
607
+ });
608
+ });
609
+ observer.observe(root, { attributes: true, attributeFilter: ["class"] });
610
+ return () => observer.disconnect();
611
+ }, [applyColors]);
612
+ const setTheme = (themeId) => {
613
+ setCurrentTheme(themeId);
614
+ };
615
+ const setBrandColor = (colorKey, value) => {
616
+ setColors((prev) => ({
617
+ ...prev,
618
+ [colorKey]: value
619
+ }));
620
+ };
621
+ return /* @__PURE__ */ jsxRuntime.jsx(
622
+ BrandColorsContext.Provider,
623
+ {
624
+ value: {
625
+ colors,
626
+ currentTheme,
627
+ themes: colorThemes,
628
+ setTheme,
629
+ setBrandColor,
630
+ radius,
631
+ setRadius
632
+ },
633
+ children
634
+ }
635
+ );
636
+ };
637
+ const useBrandColors = () => {
638
+ const context = React.useContext(BrandColorsContext);
639
+ if (context === void 0) {
640
+ throw new Error("useBrandColors must be used within a BrandColorsProvider");
641
+ }
642
+ return context;
643
+ };
644
+
645
+ exports.BrandColorsProvider = BrandColorsProvider;
646
+ exports.useBrandColors = useBrandColors;