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