@club-employes/utopia 2.11.0 → 2.11.1
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/dark-CJ1ivx_-.js +4 -0
- package/dist/dark-CZ1KmhXy.js +4 -0
- package/dist/index.d.ts +33 -3
- package/dist/index.js +305 -143
- package/dist/light-BAFzIOTZ.js +4 -0
- package/dist/light-CXtMcqsV.js +4 -0
- package/dist/tokens/club-employes/dark.css +798 -0
- package/dist/tokens/club-employes/dark.js +1189 -0
- package/dist/tokens/club-employes/light.css +798 -0
- package/dist/tokens/club-employes/light.js +1189 -0
- package/dist/tokens/gifteo/dark.css +804 -0
- package/dist/tokens/gifteo/dark.js +1191 -0
- package/dist/tokens/gifteo/light.css +804 -0
- package/dist/tokens/gifteo/light.js +1191 -0
- package/dist/utopia.css +1 -1
- package/package.json +9 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Type definitions for @club-employes/utopia
|
|
2
|
-
import { DefineComponent } from 'vue'
|
|
2
|
+
import { ComputedRef, DefineComponent } from 'vue'
|
|
3
3
|
|
|
4
4
|
// Component prop types
|
|
5
5
|
export interface BadgeProps {
|
|
@@ -21,7 +21,10 @@ export interface IconProps {
|
|
|
21
21
|
|
|
22
22
|
export interface LogoProps {
|
|
23
23
|
variant?: 'auto' | 'default' | 'white' | 'small' | 'small-white'
|
|
24
|
-
size?: '
|
|
24
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
|
|
25
|
+
brand?: 'club-employes' | 'gifteo'
|
|
26
|
+
alt?: string
|
|
27
|
+
class?: string
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
export interface ThemeConfig {
|
|
@@ -47,6 +50,32 @@ export declare const clubEmployesDark: ThemeConfig
|
|
|
47
50
|
export declare const gifteoLight: ThemeConfig
|
|
48
51
|
export declare const gifteoDark: ThemeConfig
|
|
49
52
|
|
|
53
|
+
// Composable types
|
|
54
|
+
export type BrandTheme = 'club-employes' | 'gifteo'
|
|
55
|
+
export type ThemeMode = 'light' | 'dark'
|
|
56
|
+
|
|
57
|
+
export interface UseThemeReturn {
|
|
58
|
+
currentTheme: ComputedRef<ThemeConfig>
|
|
59
|
+
currentBrand: ComputedRef<BrandTheme>
|
|
60
|
+
currentMode: ComputedRef<ThemeMode>
|
|
61
|
+
currentBrandName: ComputedRef<string>
|
|
62
|
+
availableBrands: ComputedRef<Array<{ key: BrandTheme; name: string }>>
|
|
63
|
+
toggleBrand: () => void
|
|
64
|
+
toggleMode: () => void
|
|
65
|
+
setBrand: (brand: BrandTheme) => void
|
|
66
|
+
setMode: (mode: ThemeMode) => void
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface UseFaviconReturn {
|
|
70
|
+
faviconUrl: ComputedRef<string>
|
|
71
|
+
refreshFavicon: () => void
|
|
72
|
+
updateFavicon: (faviconUrl: string) => void
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Composable exports
|
|
76
|
+
export declare function useTheme(): UseThemeReturn
|
|
77
|
+
export declare function useFavicon(): UseFaviconReturn
|
|
78
|
+
|
|
50
79
|
// Type exports
|
|
51
80
|
export type BadgeVariant = 'default' | 'success' | 'warning' | 'danger'
|
|
52
81
|
export type BadgeSize = 'small' | 'medium'
|
|
@@ -56,4 +85,5 @@ export type IconName = string
|
|
|
56
85
|
export type IconSize = 'small' | 'medium' | 'large'
|
|
57
86
|
export type IconColor = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'neutral' | 'current'
|
|
58
87
|
export type LogoVariant = 'auto' | 'default' | 'white' | 'small' | 'small-white'
|
|
59
|
-
export type LogoSize = '
|
|
88
|
+
export type LogoSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
|
|
89
|
+
export type LogoBrand = 'club-employes' | 'gifteo'
|
package/dist/index.js
CHANGED
|
@@ -1,73 +1,144 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as w, computed as u, ref as C, provide as I, onMounted as z, onBeforeUnmount as L, watch as k, createElementBlock as g, openBlock as h, renderSlot as y, normalizeClass as $, mergeProps as D, createCommentVNode as T, createElementVNode as v, normalizeStyle as A, onUnmounted as F } from "vue";
|
|
2
|
+
const P = (n, t, o) => {
|
|
3
|
+
const r = n[t];
|
|
4
|
+
return r ? typeof r == "function" ? r() : Promise.resolve(r) : new Promise((l, d) => {
|
|
5
|
+
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(d.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== o ? ". Note that variables only represent file names one level deep." : ""))));
|
|
6
|
+
});
|
|
7
|
+
}, j = ["data-theme"], x = /* @__PURE__ */ w({
|
|
3
8
|
__name: "ThemeProvider",
|
|
4
9
|
props: {
|
|
5
10
|
theme: {}
|
|
6
11
|
},
|
|
7
|
-
setup(
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
setup(n) {
|
|
13
|
+
const t = n, o = u(() => t.theme.name), r = /* @__PURE__ */ new Map(), l = C(!1), d = async (s) => {
|
|
14
|
+
if (r.has(s))
|
|
15
|
+
return r.get(s);
|
|
16
|
+
const c = s.lastIndexOf("-"), m = s.substring(0, c), p = s.substring(c + 1);
|
|
17
|
+
try {
|
|
18
|
+
const S = await P(/* @__PURE__ */ Object.assign({ "../tokens/generated/club-employes/dark.css": () => import("./dark-CJ1ivx_-.js"), "../tokens/generated/club-employes/light.css": () => import("./light-CXtMcqsV.js"), "../tokens/generated/gifteo/dark.css": () => import("./dark-CZ1KmhXy.js"), "../tokens/generated/gifteo/light.css": () => import("./light-BAFzIOTZ.js") }), `../tokens/generated/${m}/${p}.css`, 5), E = S.default || S;
|
|
19
|
+
return r.set(s, E), E;
|
|
20
|
+
} catch (S) {
|
|
21
|
+
return console.warn(`Failed to preload theme CSS for ${s}:`, S), "";
|
|
22
|
+
}
|
|
23
|
+
}, a = async () => {
|
|
24
|
+
if (!l.value) {
|
|
25
|
+
l.value = !0, console.log("🎨 Switching to theme:", o.value);
|
|
26
|
+
try {
|
|
27
|
+
const s = await d(o.value);
|
|
28
|
+
if (!s) {
|
|
29
|
+
console.warn("No CSS content found for theme:", o.value), l.value = !1;
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
document.body.classList.add("theme-transition"), await new Promise((p) => setTimeout(p, 50)), document.querySelectorAll("style[data-theme-css]").forEach((p) => p.remove());
|
|
33
|
+
const m = document.createElement("style");
|
|
34
|
+
m.setAttribute("data-theme-css", "true"), m.textContent = s, document.head.appendChild(m), document.body.setAttribute("data-theme", o.value), setTimeout(() => {
|
|
35
|
+
document.body.classList.remove("theme-transition"), l.value = !1;
|
|
36
|
+
}, 300), console.log("✅ Theme CSS applied smoothly:", o.value);
|
|
37
|
+
} catch (s) {
|
|
38
|
+
console.warn("Failed to inject theme CSS:", s), document.body.classList.remove("theme-transition"), l.value = !1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, e = () => {
|
|
42
|
+
document.body.removeAttribute("data-theme");
|
|
43
|
+
const s = document.querySelector("style[data-theme-css]");
|
|
44
|
+
s && s.remove();
|
|
14
45
|
};
|
|
15
|
-
return
|
|
16
|
-
name:
|
|
17
|
-
config:
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
46
|
+
return I("theme", {
|
|
47
|
+
name: o,
|
|
48
|
+
config: t.theme
|
|
49
|
+
}), z(async () => {
|
|
50
|
+
const s = document.querySelector("style[data-default-theme]"), c = [
|
|
51
|
+
"club-employes-light",
|
|
52
|
+
"club-employes-dark",
|
|
53
|
+
"gifteo-light",
|
|
54
|
+
"gifteo-dark"
|
|
55
|
+
];
|
|
56
|
+
if (Promise.all(
|
|
57
|
+
c.map((m) => d(m))
|
|
58
|
+
).then(() => {
|
|
59
|
+
console.log("🚀 All themes preloaded in cache");
|
|
60
|
+
}), s && o.value === "club-employes-light") {
|
|
61
|
+
console.log("✅ Default theme already loaded, skipping initial injection");
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
await a();
|
|
65
|
+
}), L(() => {
|
|
66
|
+
e();
|
|
67
|
+
}), k(() => t.theme, () => {
|
|
68
|
+
console.log("Theme changed to:", t.theme.name), a();
|
|
69
|
+
}, { deep: !0 }), (() => {
|
|
70
|
+
if (document.querySelector("style[data-theme-transitions]")) return;
|
|
71
|
+
const c = document.createElement("style");
|
|
72
|
+
c.setAttribute("data-theme-transitions", "true"), c.textContent = `
|
|
73
|
+
body.theme-transition {
|
|
74
|
+
transition: background-color 0.3s ease, color 0.3s ease;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
body.theme-transition *,
|
|
78
|
+
body.theme-transition *::before,
|
|
79
|
+
body.theme-transition *::after {
|
|
80
|
+
transition: background-color 0.3s ease,
|
|
81
|
+
color 0.3s ease,
|
|
82
|
+
border-color 0.3s ease,
|
|
83
|
+
box-shadow 0.3s ease,
|
|
84
|
+
fill 0.3s ease,
|
|
85
|
+
stroke 0.3s ease !important;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Désactiver les transitions sur les éléments interactifs pour éviter les lags */
|
|
89
|
+
body.theme-transition button:hover,
|
|
90
|
+
body.theme-transition a:hover,
|
|
91
|
+
body.theme-transition [role="button"]:hover {
|
|
92
|
+
transition: none !important;
|
|
93
|
+
}
|
|
94
|
+
`, document.head.appendChild(c);
|
|
95
|
+
})(), (s, c) => (h(), g("div", {
|
|
25
96
|
class: "theme-provider",
|
|
26
|
-
"data-theme":
|
|
97
|
+
"data-theme": o.value
|
|
27
98
|
}, [
|
|
28
|
-
|
|
29
|
-
], 8,
|
|
99
|
+
y(s.$slots, "default", {}, void 0, !0)
|
|
100
|
+
], 8, j));
|
|
30
101
|
}
|
|
31
|
-
}),
|
|
32
|
-
const
|
|
33
|
-
for (const [
|
|
34
|
-
|
|
35
|
-
return
|
|
36
|
-
},
|
|
102
|
+
}), B = (n, t) => {
|
|
103
|
+
const o = n.__vccOpts || n;
|
|
104
|
+
for (const [r, l] of t)
|
|
105
|
+
o[r] = l;
|
|
106
|
+
return o;
|
|
107
|
+
}, ae = /* @__PURE__ */ B(x, [["__scopeId", "data-v-de954be9"]]), O = /* @__PURE__ */ w({
|
|
37
108
|
__name: "Badge",
|
|
38
109
|
props: {
|
|
39
110
|
variant: { default: "default" },
|
|
40
111
|
size: { default: "medium" }
|
|
41
112
|
},
|
|
42
|
-
setup(
|
|
43
|
-
const
|
|
44
|
-
const
|
|
113
|
+
setup(n) {
|
|
114
|
+
const t = n, o = u(() => {
|
|
115
|
+
const r = {
|
|
45
116
|
small: "sm",
|
|
46
117
|
medium: "md"
|
|
47
118
|
};
|
|
48
119
|
return [
|
|
49
120
|
"badge",
|
|
50
|
-
`badge--${
|
|
51
|
-
`badge--${
|
|
121
|
+
`badge--${t.variant}`,
|
|
122
|
+
`badge--${r[t.size]}`
|
|
52
123
|
];
|
|
53
124
|
});
|
|
54
|
-
return (
|
|
55
|
-
class:
|
|
125
|
+
return (r, l) => (h(), g("span", {
|
|
126
|
+
class: $(o.value)
|
|
56
127
|
}, [
|
|
57
|
-
|
|
128
|
+
y(r.$slots, "default", {}, void 0, !0)
|
|
58
129
|
], 2));
|
|
59
130
|
}
|
|
60
|
-
}),
|
|
131
|
+
}), re = /* @__PURE__ */ B(O, [["__scopeId", "data-v-2a8fca7d"]]), q = ["disabled", "aria-disabled", "aria-label"], U = {
|
|
61
132
|
key: 0,
|
|
62
133
|
class: "button-spinner",
|
|
63
134
|
"aria-hidden": "true"
|
|
64
|
-
},
|
|
135
|
+
}, N = {
|
|
65
136
|
key: 0,
|
|
66
137
|
class: "button-icon button-icon--before"
|
|
67
|
-
},
|
|
138
|
+
}, G = { class: "button-text" }, R = {
|
|
68
139
|
key: 1,
|
|
69
140
|
class: "button-icon button-icon--after"
|
|
70
|
-
},
|
|
141
|
+
}, V = /* @__PURE__ */ w({
|
|
71
142
|
__name: "Button",
|
|
72
143
|
props: {
|
|
73
144
|
variant: { default: "primary" },
|
|
@@ -78,38 +149,38 @@ const I = ["data-theme"], L = /* @__PURE__ */ h({
|
|
|
78
149
|
ariaLabel: {}
|
|
79
150
|
},
|
|
80
151
|
emits: ["click"],
|
|
81
|
-
setup(
|
|
82
|
-
const
|
|
83
|
-
const
|
|
152
|
+
setup(n, { emit: t }) {
|
|
153
|
+
const o = n, r = t, l = u(() => {
|
|
154
|
+
const a = {
|
|
84
155
|
small: "sm",
|
|
85
156
|
medium: "md",
|
|
86
157
|
large: "lg"
|
|
87
158
|
};
|
|
88
159
|
return [
|
|
89
160
|
"button",
|
|
90
|
-
`button--${
|
|
91
|
-
`button--${
|
|
161
|
+
`button--${o.variant}`,
|
|
162
|
+
`button--${a[o.size]}`,
|
|
92
163
|
{
|
|
93
|
-
"button--disabled":
|
|
94
|
-
"button--loading":
|
|
95
|
-
"button--block":
|
|
164
|
+
"button--disabled": o.disabled,
|
|
165
|
+
"button--loading": o.loading,
|
|
166
|
+
"button--block": o.block
|
|
96
167
|
}
|
|
97
168
|
];
|
|
98
|
-
}),
|
|
99
|
-
!
|
|
169
|
+
}), d = (a) => {
|
|
170
|
+
!o.disabled && !o.loading && r("click", a);
|
|
100
171
|
};
|
|
101
|
-
return (
|
|
102
|
-
class:
|
|
103
|
-
disabled:
|
|
104
|
-
"aria-disabled":
|
|
105
|
-
"aria-label":
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
|
|
172
|
+
return (a, e) => (h(), g("button", D({
|
|
173
|
+
class: l.value,
|
|
174
|
+
disabled: a.disabled || a.loading,
|
|
175
|
+
"aria-disabled": a.disabled || a.loading,
|
|
176
|
+
"aria-label": a.ariaLabel
|
|
177
|
+
}, a.$attrs, { onClick: d }), [
|
|
178
|
+
a.loading ? (h(), g("span", U, e[0] || (e[0] = [
|
|
179
|
+
v("svg", {
|
|
109
180
|
class: "spinner-icon",
|
|
110
181
|
viewBox: "0 0 24 24"
|
|
111
182
|
}, [
|
|
112
|
-
|
|
183
|
+
v("circle", {
|
|
113
184
|
class: "spinner-path",
|
|
114
185
|
cx: "12",
|
|
115
186
|
cy: "12",
|
|
@@ -121,13 +192,13 @@ const I = ["data-theme"], L = /* @__PURE__ */ h({
|
|
|
121
192
|
"stroke-dasharray": "31.416",
|
|
122
193
|
"stroke-dashoffset": "31.416"
|
|
123
194
|
}, [
|
|
124
|
-
|
|
195
|
+
v("animate", {
|
|
125
196
|
attributeName: "stroke-dasharray",
|
|
126
197
|
dur: "2s",
|
|
127
198
|
values: "0 31.416;15.708 15.708;0 31.416",
|
|
128
199
|
repeatCount: "indefinite"
|
|
129
200
|
}),
|
|
130
|
-
|
|
201
|
+
v("animate", {
|
|
131
202
|
attributeName: "stroke-dashoffset",
|
|
132
203
|
dur: "2s",
|
|
133
204
|
values: "0;-15.708;-31.416",
|
|
@@ -135,23 +206,23 @@ const I = ["data-theme"], L = /* @__PURE__ */ h({
|
|
|
135
206
|
})
|
|
136
207
|
])
|
|
137
208
|
], -1)
|
|
138
|
-
]))) :
|
|
139
|
-
|
|
140
|
-
class:
|
|
209
|
+
]))) : T("", !0),
|
|
210
|
+
v("span", {
|
|
211
|
+
class: $(["button-content", { "button-content--hidden": a.loading }])
|
|
141
212
|
}, [
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
])) :
|
|
145
|
-
|
|
146
|
-
|
|
213
|
+
a.$slots.icon ? (h(), g("span", N, [
|
|
214
|
+
y(a.$slots, "icon", {}, void 0, !0)
|
|
215
|
+
])) : T("", !0),
|
|
216
|
+
v("span", G, [
|
|
217
|
+
y(a.$slots, "default", {}, void 0, !0)
|
|
147
218
|
]),
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
])) :
|
|
219
|
+
a.$slots.iconAfter ? (h(), g("span", R, [
|
|
220
|
+
y(a.$slots, "iconAfter", {}, void 0, !0)
|
|
221
|
+
])) : T("", !0)
|
|
151
222
|
], 2)
|
|
152
|
-
], 16,
|
|
223
|
+
], 16, q));
|
|
153
224
|
}
|
|
154
|
-
}),
|
|
225
|
+
}), le = /* @__PURE__ */ B(V, [["__scopeId", "data-v-c5f4114b"]]), H = ["aria-label", "innerHTML"], W = /* @__PURE__ */ w({
|
|
155
226
|
__name: "Icon",
|
|
156
227
|
props: {
|
|
157
228
|
name: {},
|
|
@@ -160,17 +231,17 @@ const I = ["data-theme"], L = /* @__PURE__ */ h({
|
|
|
160
231
|
alt: {},
|
|
161
232
|
class: {}
|
|
162
233
|
},
|
|
163
|
-
setup(
|
|
164
|
-
const
|
|
234
|
+
setup(n) {
|
|
235
|
+
const t = n, o = C(""), r = u(() => [
|
|
165
236
|
"icon",
|
|
166
237
|
`icon--${{
|
|
167
238
|
small: "sm",
|
|
168
239
|
medium: "md",
|
|
169
240
|
large: "lg"
|
|
170
|
-
}[
|
|
171
|
-
`icon--${
|
|
172
|
-
|
|
173
|
-
].filter(Boolean)),
|
|
241
|
+
}[t.size]}`,
|
|
242
|
+
`icon--${t.color}`,
|
|
243
|
+
t.class
|
|
244
|
+
].filter(Boolean)), l = u(() => ({
|
|
174
245
|
color: {
|
|
175
246
|
primary: "var(--theme-colors-brand-primary-600)",
|
|
176
247
|
secondary: "var(--theme-colors-brand-secondary-600)",
|
|
@@ -179,16 +250,16 @@ const I = ["data-theme"], L = /* @__PURE__ */ h({
|
|
|
179
250
|
danger: "var(--theme-colors-common-danger-600)",
|
|
180
251
|
neutral: "var(--theme-colors-common-slate-600)",
|
|
181
252
|
current: "currentColor"
|
|
182
|
-
}[
|
|
183
|
-
})),
|
|
253
|
+
}[t.color]
|
|
254
|
+
})), d = async (e) => {
|
|
184
255
|
try {
|
|
185
|
-
const
|
|
186
|
-
if (!
|
|
187
|
-
throw new Error(`Icon not found: ${
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
} catch (
|
|
191
|
-
console.error(`Failed to load icon: ${
|
|
256
|
+
const i = `/src/assets/icons-processed/${e}.svg`, s = await fetch(i);
|
|
257
|
+
if (!s.ok)
|
|
258
|
+
throw new Error(`Icon not found: ${e}`);
|
|
259
|
+
const m = (await s.text()).replace(/width="[^"]*"/g, "").replace(/height="[^"]*"/g, "").replace(/<svg([^>]*)>/g, '<svg$1 width="100%" height="100%">');
|
|
260
|
+
o.value = m;
|
|
261
|
+
} catch (i) {
|
|
262
|
+
console.error(`Failed to load icon: ${e}`, i), o.value = `
|
|
192
263
|
<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
193
264
|
<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"/>
|
|
194
265
|
<path d="M12 8v4" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
@@ -196,76 +267,167 @@ const I = ["data-theme"], L = /* @__PURE__ */ h({
|
|
|
196
267
|
</svg>
|
|
197
268
|
`;
|
|
198
269
|
}
|
|
199
|
-
},
|
|
200
|
-
return k(() =>
|
|
201
|
-
const
|
|
202
|
-
i
|
|
203
|
-
}, { immediate: !0 }), (
|
|
204
|
-
class:
|
|
205
|
-
style:
|
|
206
|
-
"aria-label":
|
|
270
|
+
}, a = (e) => e.includes("/") && e.split("/").pop() || e;
|
|
271
|
+
return k(() => t.name, (e) => {
|
|
272
|
+
const i = a(e);
|
|
273
|
+
d(i);
|
|
274
|
+
}, { immediate: !0 }), (e, i) => (h(), g("span", {
|
|
275
|
+
class: $(r.value),
|
|
276
|
+
style: A(l.value),
|
|
277
|
+
"aria-label": e.alt || e.name,
|
|
207
278
|
role: "img",
|
|
208
|
-
innerHTML:
|
|
209
|
-
}, null, 14,
|
|
279
|
+
innerHTML: o.value
|
|
280
|
+
}, null, 14, H));
|
|
210
281
|
}
|
|
211
|
-
}),
|
|
282
|
+
}), ie = /* @__PURE__ */ B(W, [["__scopeId", "data-v-8bcf9243"]]), K = ["aria-label"], ce = /* @__PURE__ */ w({
|
|
212
283
|
__name: "Logo",
|
|
213
284
|
props: {
|
|
285
|
+
brand: {},
|
|
214
286
|
variant: { default: "auto" },
|
|
215
287
|
size: { default: "md" },
|
|
216
|
-
alt: {
|
|
288
|
+
alt: {},
|
|
217
289
|
class: {}
|
|
218
290
|
},
|
|
219
|
-
setup(
|
|
220
|
-
const
|
|
221
|
-
"logo"
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
return {
|
|
234
|
-
backgroundImage: `var(${e.variant === "auto" && (e.size === "xs" || e.size === "sm") ? "--theme-assets-logo-small" : n[e.variant]})`
|
|
235
|
-
};
|
|
236
|
-
});
|
|
237
|
-
return (n, i) => (c(), l("div", {
|
|
238
|
-
class: f(t.value),
|
|
239
|
-
style: _(o.value),
|
|
240
|
-
"aria-label": n.alt || "Logo",
|
|
291
|
+
setup(n) {
|
|
292
|
+
const t = n, o = u(() => {
|
|
293
|
+
const l = t.brand ? `logo--${t.brand}` : "logo--auto-brand";
|
|
294
|
+
return [
|
|
295
|
+
"logo",
|
|
296
|
+
`logo--${t.size}`,
|
|
297
|
+
`logo--${t.variant}`,
|
|
298
|
+
l,
|
|
299
|
+
t.class
|
|
300
|
+
].filter(Boolean);
|
|
301
|
+
}), r = u(() => t.brand === "gifteo" ? "Gifteo" : t.brand === "club-employes" ? "Club Employés" : "Logo");
|
|
302
|
+
return (l, d) => (h(), g("div", {
|
|
303
|
+
class: $(o.value),
|
|
304
|
+
"aria-label": l.alt || `Logo ${r.value}`,
|
|
241
305
|
role: "img"
|
|
242
|
-
}, null,
|
|
306
|
+
}, null, 10, K));
|
|
243
307
|
}
|
|
244
|
-
}),
|
|
308
|
+
}), Y = {
|
|
245
309
|
name: "club-employes-light",
|
|
246
|
-
mode: "light"
|
|
247
|
-
|
|
248
|
-
}, R = {
|
|
310
|
+
mode: "light"
|
|
311
|
+
}, J = {
|
|
249
312
|
name: "club-employes-dark",
|
|
250
|
-
mode: "dark"
|
|
251
|
-
|
|
252
|
-
}, W = {
|
|
313
|
+
mode: "dark"
|
|
314
|
+
}, Q = {
|
|
253
315
|
name: "gifteo-light",
|
|
254
|
-
mode: "light"
|
|
255
|
-
cssFile: "/src/tokens/generated/gifteo/light.css"
|
|
316
|
+
mode: "light"
|
|
256
317
|
}, X = {
|
|
257
318
|
name: "gifteo-dark",
|
|
258
|
-
mode: "dark"
|
|
259
|
-
|
|
319
|
+
mode: "dark"
|
|
320
|
+
}, M = {
|
|
321
|
+
BRAND: "utopia-theme-brand",
|
|
322
|
+
MODE: "utopia-theme-mode"
|
|
323
|
+
}, Z = () => {
|
|
324
|
+
if (typeof window > "u") return "club-employes";
|
|
325
|
+
const n = localStorage.getItem(M.BRAND);
|
|
326
|
+
return n === "club-employes" || n === "gifteo" ? n : "club-employes";
|
|
327
|
+
}, ee = () => {
|
|
328
|
+
if (typeof window > "u") return "light";
|
|
329
|
+
const n = localStorage.getItem(M.MODE);
|
|
330
|
+
return n === "light" || n === "dark" ? n : "light";
|
|
331
|
+
}, te = (n) => {
|
|
332
|
+
typeof window < "u" && localStorage.setItem(M.BRAND, n);
|
|
333
|
+
}, oe = (n) => {
|
|
334
|
+
typeof window < "u" && localStorage.setItem(M.MODE, n);
|
|
335
|
+
}, f = C(Z()), b = C(ee()), _ = {
|
|
336
|
+
"club-employes": {
|
|
337
|
+
light: Y,
|
|
338
|
+
dark: J,
|
|
339
|
+
name: "Club Employés"
|
|
340
|
+
},
|
|
341
|
+
gifteo: {
|
|
342
|
+
light: Q,
|
|
343
|
+
dark: X,
|
|
344
|
+
name: "Gifteo"
|
|
345
|
+
}
|
|
260
346
|
};
|
|
347
|
+
function ne() {
|
|
348
|
+
const n = u(() => _[f.value][b.value]), t = u(() => _[f.value].name);
|
|
349
|
+
k(f, (e) => {
|
|
350
|
+
te(e);
|
|
351
|
+
}, { immediate: !1 }), k(b, (e) => {
|
|
352
|
+
oe(e);
|
|
353
|
+
}, { immediate: !1 });
|
|
354
|
+
const o = () => {
|
|
355
|
+
f.value = f.value === "club-employes" ? "gifteo" : "club-employes";
|
|
356
|
+
}, r = () => {
|
|
357
|
+
b.value = b.value === "light" ? "dark" : "light";
|
|
358
|
+
}, l = (e) => {
|
|
359
|
+
f.value = e;
|
|
360
|
+
}, d = (e) => {
|
|
361
|
+
b.value = e;
|
|
362
|
+
}, a = u(() => Object.keys(_).map((e) => ({
|
|
363
|
+
key: e,
|
|
364
|
+
name: _[e].name
|
|
365
|
+
})));
|
|
366
|
+
return {
|
|
367
|
+
// State
|
|
368
|
+
currentTheme: n,
|
|
369
|
+
currentBrand: u(() => f.value),
|
|
370
|
+
currentMode: u(() => b.value),
|
|
371
|
+
currentBrandName: t,
|
|
372
|
+
availableBrands: a,
|
|
373
|
+
// Actions
|
|
374
|
+
toggleBrand: o,
|
|
375
|
+
toggleMode: r,
|
|
376
|
+
setBrand: l,
|
|
377
|
+
setMode: d
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
function de() {
|
|
381
|
+
const { currentBrand: n, currentMode: t } = ne(), o = (i) => {
|
|
382
|
+
try {
|
|
383
|
+
const c = `--assets-logos-${i}-small`, p = getComputedStyle(document.documentElement).getPropertyValue(c).trim();
|
|
384
|
+
return p && p.startsWith("url(") && p.endsWith(")") ? p.slice(4, -1).replace(/['"`]/g, "") : null;
|
|
385
|
+
} catch (s) {
|
|
386
|
+
return console.warn("Erreur lors de la récupération du logo pour le favicon:", s), null;
|
|
387
|
+
}
|
|
388
|
+
}, r = (i) => i, l = (i) => {
|
|
389
|
+
try {
|
|
390
|
+
const s = document.querySelector('link[rel="icon"]');
|
|
391
|
+
s && s.remove();
|
|
392
|
+
const c = document.createElement("link");
|
|
393
|
+
c.rel = "icon", c.type = "image/svg+xml", c.href = i, document.head.appendChild(c);
|
|
394
|
+
} catch (s) {
|
|
395
|
+
console.warn("Erreur lors de la mise à jour du favicon:", s);
|
|
396
|
+
}
|
|
397
|
+
}, d = u(() => {
|
|
398
|
+
const i = o(n.value);
|
|
399
|
+
return i ? r(i) : "/favicon.ico";
|
|
400
|
+
}), a = () => {
|
|
401
|
+
const i = d.value;
|
|
402
|
+
i && l(i);
|
|
403
|
+
};
|
|
404
|
+
let e = null;
|
|
405
|
+
return z(() => {
|
|
406
|
+
setTimeout(a, 50), e = k(
|
|
407
|
+
[n, t],
|
|
408
|
+
() => {
|
|
409
|
+
a();
|
|
410
|
+
},
|
|
411
|
+
{ immediate: !1 }
|
|
412
|
+
);
|
|
413
|
+
}), F(() => {
|
|
414
|
+
e && e();
|
|
415
|
+
}), {
|
|
416
|
+
faviconUrl: d,
|
|
417
|
+
refreshFavicon: a,
|
|
418
|
+
updateFavicon: l
|
|
419
|
+
};
|
|
420
|
+
}
|
|
261
421
|
export {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
422
|
+
re as Badge,
|
|
423
|
+
le as Button,
|
|
424
|
+
ie as Icon,
|
|
425
|
+
ce as Logo,
|
|
426
|
+
ae as ThemeProvider,
|
|
427
|
+
J as clubEmployesDark,
|
|
428
|
+
Y as clubEmployesLight,
|
|
269
429
|
X as gifteoDark,
|
|
270
|
-
|
|
430
|
+
Q as gifteoLight,
|
|
431
|
+
de as useFavicon,
|
|
432
|
+
ne as useTheme
|
|
271
433
|
};
|