@yenio-pld/blocks 1.2.0-rc.1 → 1.2.0-rc.3
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/consent.cjs +2 -2
- package/dist/consent.cjs.map +1 -1
- package/dist/consent.js +2 -2
- package/dist/consent.js.map +1 -1
- package/dist/index.cjs +249 -252
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -69
- package/dist/index.d.ts +65 -69
- package/dist/index.js +252 -255
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/consent.cjs
CHANGED
|
@@ -14,8 +14,8 @@ function cookieDomainFromHostname(hostname) {
|
|
|
14
14
|
const host = hostname.toLowerCase();
|
|
15
15
|
if (host === "localhost" || host === "127.0.0.1") return void 0;
|
|
16
16
|
if (host.endsWith(".yenio.mx") || host === "yenio.mx") return ".yenio.mx";
|
|
17
|
-
if (host.endsWith(".yenio
|
|
18
|
-
return ".yenio
|
|
17
|
+
if (host.endsWith(".yenio.workers.dev") || host === "yenio.workers.dev") {
|
|
18
|
+
return ".yenio.workers.dev";
|
|
19
19
|
}
|
|
20
20
|
return void 0;
|
|
21
21
|
}
|
package/dist/consent.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/cookie-consent.ts"],"names":[],"mappings":";;;AAAO,IAAM,mBAAA,GAAsB;AAE5B,IAAM,qBAAA,GAAwB,CAAC,WAAA,EAAa,KAAK;AAKjD,IAAM,sBAAA,GAAyB,GAAA,GAAM,EAAA,GAAK,EAAA,GAAK;AAQ/C,SAAS,qBACf,KAAA,EAC8B;AAC9B,EAAA,OACC,OAAO,KAAA,KAAU,QAAA,IAChB,qBAAA,CAA4C,SAAS,KAAK,CAAA;AAE7D;AAEO,SAAS,0BACf,KAAA,EACU;AACV,EAAA,OAAO,KAAA,KAAU,KAAA;AAClB;AAEO,SAAS,yBAAyB,QAAA,EAAsC;AAC9E,EAAA,MAAM,IA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,CAAA,OAAA,EAAU,OAAA,CAAQ,MAAM,CAAA,CAAE,CAAA;AAAA,EACtC;AACA,EAAA,IAAI,MAAA,EAAQ;AACX,IAAA,KAAA,CAAM,KAAK,QAAQ,CAAA;AAAA,EACpB;AACA,EAAA,OAAO,KAAA,CAAM,KAAK,IAAI,CAAA;AACvB;AAEO,SAAS,kBAAA,CACf,KAAA,EACA,OAAA,GAAqC,EAAC,EAC/B;AACP,EAAA,IAAI,OAAO,aAAa,WAAA,EAAa;AACrC,EAAA,QAAA,CAAS,MAAA,GAAS,sBAAA,CAAuB,KAAA,EAAO,OAAO,CAAA;AACxD;AAEO,SAAS,gBAAA,GAA4B;AAC3C,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,KAAA;AAC1C,EAAA,IAAI;AACH,IAAA,OAAO,MAAA,CAAO,SAAS,MAAA,CAAO,GAAA;AAAA,EAC/B,CAAA,CAAA,MAAQ;AACP,IAAA,OAAO,IAAA;AAAA,EACR;AACD","file":"consent.cjs","sourcesContent":["export const COOKIE_CONSENT_NAME = \"yenio-cookie-consent\";\n\nexport const COOKIE_CONSENT_VALUES = [\"necessary\", \"all\"] as const;\n\nexport type CookieConsentValue = (typeof COOKIE_CONSENT_VALUES)[number];\n\n/** ~180 days, matching contracts §1.2. */\nexport const COOKIE_CONSENT_MAX_AGE = 180 * 24 * 60 * 60;\n\nexport type WriteCookieConsentOptions = {\n\tdomain?: string;\n\tsecure?: boolean;\n\tmaxAge?: number;\n};\n\nexport function isCookieConsentValue(\n\tvalue: unknown,\n): value is CookieConsentValue {\n\treturn (\n\t\ttypeof value === \"string\" &&\n\t\t(COOKIE_CONSENT_VALUES as readonly string[]).includes(value)\n\t);\n}\n\nexport function cookieConsentAllowsReplay(\n\tvalue: CookieConsentValue | null | undefined,\n): boolean {\n\treturn value === \"all\";\n}\n\nexport function cookieDomainFromHostname(hostname: string): string | undefined {\n\tconst host = hostname.toLowerCase();\n\tif (host === \"localhost\" || host === \"127.0.0.1\") return undefined;\n\tif (host.endsWith(\".yenio.mx\") || host === \"yenio.mx\") return \".yenio.mx\";\n\tif (host.endsWith(\".yenio.workers.dev\") || host === \"yenio.workers.dev\") {\n\t\treturn \".yenio.workers.dev\";\n\t}\n\treturn undefined;\n}\n\nfunction readCookieMap(cookieSource: string): Map<string, string> {\n\tconst map = new Map<string, string>();\n\tfor (const part of cookieSource.split(\";\")) {\n\t\tconst trimmed = part.trim();\n\t\tif (!trimmed) continue;\n\t\tconst eq = trimmed.indexOf(\"=\");\n\t\tif (eq < 0) continue;\n\t\tconst name = trimmed.slice(0, eq).trim();\n\t\tconst raw = trimmed.slice(eq + 1).trim();\n\t\tmap.set(name, decodeURIComponent(raw));\n\t}\n\treturn map;\n}\n\nexport function parseCookieConsent(\n\tcookieSource: string,\n): CookieConsentValue | null {\n\tconst raw = readCookieMap(cookieSource).get(COOKIE_CONSENT_NAME);\n\treturn isCookieConsentValue(raw) ? raw : null;\n}\n\nexport function readCookieConsent(): CookieConsentValue | null {\n\tif (typeof document === \"undefined\") return null;\n\treturn parseCookieConsent(document.cookie);\n}\n\nexport function serializeCookieConsent(\n\tvalue: CookieConsentValue,\n\toptions: WriteCookieConsentOptions = {},\n): string {\n\tconst maxAge = options.maxAge ?? COOKIE_CONSENT_MAX_AGE;\n\tconst secure =\n\t\toptions.secure ??\n\t\t(typeof window !== \"undefined\" && window.location.protocol === \"https:\");\n\tconst parts = [\n\t\t`${COOKIE_CONSENT_NAME}=${encodeURIComponent(value)}`,\n\t\t\"Path=/\",\n\t\t`Max-Age=${maxAge}`,\n\t\t\"SameSite=Lax\",\n\t];\n\tif (options.domain) {\n\t\tparts.push(`Domain=${options.domain}`);\n\t}\n\tif (secure) {\n\t\tparts.push(\"Secure\");\n\t}\n\treturn parts.join(\"; \");\n}\n\nexport function writeCookieConsent(\n\tvalue: CookieConsentValue,\n\toptions: WriteCookieConsentOptions = {},\n): void {\n\tif (typeof document === \"undefined\") return;\n\tdocument.cookie = serializeCookieConsent(value, options);\n}\n\nexport function isEmbeddedWindow(): boolean {\n\tif (typeof window === \"undefined\") return false;\n\ttry {\n\t\treturn window.self !== window.top;\n\t} catch {\n\t\treturn true;\n\t}\n}\n"]}
|
package/dist/consent.js
CHANGED
|
@@ -12,8 +12,8 @@ function cookieDomainFromHostname(hostname) {
|
|
|
12
12
|
const host = hostname.toLowerCase();
|
|
13
13
|
if (host === "localhost" || host === "127.0.0.1") return void 0;
|
|
14
14
|
if (host.endsWith(".yenio.mx") || host === "yenio.mx") return ".yenio.mx";
|
|
15
|
-
if (host.endsWith(".yenio
|
|
16
|
-
return ".yenio
|
|
15
|
+
if (host.endsWith(".yenio.workers.dev") || host === "yenio.workers.dev") {
|
|
16
|
+
return ".yenio.workers.dev";
|
|
17
17
|
}
|
|
18
18
|
return void 0;
|
|
19
19
|
}
|
package/dist/consent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/cookie-consent.ts"],"names":[],"mappings":";AAAO,IAAM,mBAAA,GAAsB;AAE5B,IAAM,qBAAA,GAAwB,CAAC,WAAA,EAAa,KAAK;AAKjD,IAAM,sBAAA,GAAyB,GAAA,GAAM,EAAA,GAAK,EAAA,GAAK;AAQ/C,SAAS,qBACf,KAAA,EAC8B;AAC9B,EAAA,OACC,OAAO,KAAA,KAAU,QAAA,IAChB,qBAAA,CAA4C,SAAS,KAAK,CAAA;AAE7D;AAEO,SAAS,0BACf,KAAA,EACU;AACV,EAAA,OAAO,KAAA,KAAU,KAAA;AAClB;AAEO,SAAS,yBAAyB,QAAA,EAAsC;AAC9E,EAAA,MAAM,IAAA,GAAO,SAAS,WAAA,EAAY;AAClC,EAAA,IAAI,IAAA,KAAS,WAAA,IAAe,IAAA,KAAS,WAAA,EAAa,OAAO,MAAA;AACzD,EAAA,IAAI,KAAK,QAAA,CAAS,WAAW,CAAA,IAAK,IAAA,KAAS,YAAY,OAAO,WAAA;AAC9D,EAAA,
|
|
1
|
+
{"version":3,"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f,KAAA,EACA,OAAA,GAAqC,EAAC,EAC/B;AACP,EAAA,IAAI,OAAO,aAAa,WAAA,EAAa;AACrC,EAAA,QAAA,CAAS,MAAA,GAAS,sBAAA,CAAuB,KAAA,EAAO,OAAO,CAAA;AACxD;AAEO,SAAS,gBAAA,GAA4B;AAC3C,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,KAAA;AAC1C,EAAA,IAAI;AACH,IAAA,OAAO,MAAA,CAAO,SAAS,MAAA,CAAO,GAAA;AAAA,EAC/B,CAAA,CAAA,MAAQ;AACP,IAAA,OAAO,IAAA;AAAA,EACR;AACD","file":"consent.js","sourcesContent":["export const COOKIE_CONSENT_NAME = \"yenio-cookie-consent\";\n\nexport const COOKIE_CONSENT_VALUES = [\"necessary\", \"all\"] as const;\n\nexport type CookieConsentValue = (typeof COOKIE_CONSENT_VALUES)[number];\n\n/** ~180 days, matching contracts §1.2. */\nexport const COOKIE_CONSENT_MAX_AGE = 180 * 24 * 60 * 60;\n\nexport type WriteCookieConsentOptions = {\n\tdomain?: string;\n\tsecure?: boolean;\n\tmaxAge?: number;\n};\n\nexport function isCookieConsentValue(\n\tvalue: unknown,\n): value is CookieConsentValue {\n\treturn (\n\t\ttypeof value === \"string\" &&\n\t\t(COOKIE_CONSENT_VALUES as readonly string[]).includes(value)\n\t);\n}\n\nexport function cookieConsentAllowsReplay(\n\tvalue: CookieConsentValue | null | undefined,\n): boolean {\n\treturn value === \"all\";\n}\n\nexport function cookieDomainFromHostname(hostname: string): string | undefined {\n\tconst host = hostname.toLowerCase();\n\tif (host === \"localhost\" || host === \"127.0.0.1\") return undefined;\n\tif (host.endsWith(\".yenio.mx\") || host === \"yenio.mx\") return \".yenio.mx\";\n\tif (host.endsWith(\".yenio.workers.dev\") || host === \"yenio.workers.dev\") {\n\t\treturn \".yenio.workers.dev\";\n\t}\n\treturn undefined;\n}\n\nfunction readCookieMap(cookieSource: string): Map<string, string> {\n\tconst map = new Map<string, string>();\n\tfor (const part of cookieSource.split(\";\")) {\n\t\tconst trimmed = part.trim();\n\t\tif (!trimmed) continue;\n\t\tconst eq = trimmed.indexOf(\"=\");\n\t\tif (eq < 0) continue;\n\t\tconst name = trimmed.slice(0, eq).trim();\n\t\tconst raw = trimmed.slice(eq + 1).trim();\n\t\tmap.set(name, decodeURIComponent(raw));\n\t}\n\treturn map;\n}\n\nexport function parseCookieConsent(\n\tcookieSource: string,\n): CookieConsentValue | null {\n\tconst raw = readCookieMap(cookieSource).get(COOKIE_CONSENT_NAME);\n\treturn isCookieConsentValue(raw) ? raw : null;\n}\n\nexport function readCookieConsent(): CookieConsentValue | null {\n\tif (typeof document === \"undefined\") return null;\n\treturn parseCookieConsent(document.cookie);\n}\n\nexport function serializeCookieConsent(\n\tvalue: CookieConsentValue,\n\toptions: WriteCookieConsentOptions = {},\n): string {\n\tconst maxAge = options.maxAge ?? COOKIE_CONSENT_MAX_AGE;\n\tconst secure =\n\t\toptions.secure ??\n\t\t(typeof window !== \"undefined\" && window.location.protocol === \"https:\");\n\tconst parts = [\n\t\t`${COOKIE_CONSENT_NAME}=${encodeURIComponent(value)}`,\n\t\t\"Path=/\",\n\t\t`Max-Age=${maxAge}`,\n\t\t\"SameSite=Lax\",\n\t];\n\tif (options.domain) {\n\t\tparts.push(`Domain=${options.domain}`);\n\t}\n\tif (secure) {\n\t\tparts.push(\"Secure\");\n\t}\n\treturn parts.join(\"; \");\n}\n\nexport function writeCookieConsent(\n\tvalue: CookieConsentValue,\n\toptions: WriteCookieConsentOptions = {},\n): void {\n\tif (typeof document === \"undefined\") return;\n\tdocument.cookie = serializeCookieConsent(value, options);\n}\n\nexport function isEmbeddedWindow(): boolean {\n\tif (typeof window === \"undefined\") return false;\n\ttry {\n\t\treturn window.self !== window.top;\n\t} catch {\n\t\treturn true;\n\t}\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -11,7 +11,6 @@ var avatar_js = require('./ui/avatar.js');
|
|
|
11
11
|
var button_js = require('./ui/button.js');
|
|
12
12
|
var dropdownMenu_js = require('./ui/dropdown-menu.js');
|
|
13
13
|
var empty_js = require('./ui/empty.js');
|
|
14
|
-
var nextThemes = require('next-themes');
|
|
15
14
|
var separator_js = require('./ui/separator.js');
|
|
16
15
|
var sidebar_js = require('./ui/sidebar.js');
|
|
17
16
|
var table_js = require('./ui/table.js');
|
|
@@ -19,6 +18,7 @@ var tooltip_js = require('./ui/tooltip.js');
|
|
|
19
18
|
var card_js = require('./ui/card.js');
|
|
20
19
|
var classVarianceAuthority = require('class-variance-authority');
|
|
21
20
|
var alertDialog_js = require('./ui/alert-dialog.js');
|
|
21
|
+
var nextThemes = require('next-themes');
|
|
22
22
|
var slider_js = require('./ui/slider.js');
|
|
23
23
|
var toggle_js = require('./ui/toggle.js');
|
|
24
24
|
var dialog_js = require('./ui/dialog.js');
|
|
@@ -246,206 +246,6 @@ function EmptyState({
|
|
|
246
246
|
}
|
|
247
247
|
);
|
|
248
248
|
}
|
|
249
|
-
var defaultLanguages = [
|
|
250
|
-
{ key: "es-MX", label: "ES", nativeName: "Espa\xF1ol (M\xE9xico)" },
|
|
251
|
-
{ key: "en", label: "EN", nativeName: "English" }
|
|
252
|
-
];
|
|
253
|
-
var sizeClasses = {
|
|
254
|
-
sm: { button: "size-8", icon: "size-4" },
|
|
255
|
-
md: { button: "size-8", icon: "size-4" },
|
|
256
|
-
lg: { button: "size-9", icon: "size-4" }
|
|
257
|
-
};
|
|
258
|
-
var shapeClasses = {
|
|
259
|
-
rounded: "rounded-md",
|
|
260
|
-
squared: "rounded-sm",
|
|
261
|
-
pill: "rounded-full"
|
|
262
|
-
};
|
|
263
|
-
var iconTriggerClassName = "border border-border bg-transparent text-muted-foreground shadow-none hover:bg-accent hover:text-foreground dark:border-border dark:bg-transparent dark:text-muted-foreground dark:hover:bg-accent/50";
|
|
264
|
-
function LanguageSwitcher({
|
|
265
|
-
languages: propLanguages,
|
|
266
|
-
currentLanguage: propCurrentLanguage,
|
|
267
|
-
onLanguageChange: propOnLanguageChange,
|
|
268
|
-
labels = {},
|
|
269
|
-
className,
|
|
270
|
-
size = "sm",
|
|
271
|
-
shape = "rounded",
|
|
272
|
-
align = "end",
|
|
273
|
-
side = "bottom"
|
|
274
|
-
}) {
|
|
275
|
-
const context = useLanguageContext();
|
|
276
|
-
const contextLanguages = context?.languages?.map((lang) => ({
|
|
277
|
-
key: lang.code,
|
|
278
|
-
label: lang.code.toUpperCase(),
|
|
279
|
-
nativeName: lang.name
|
|
280
|
-
}));
|
|
281
|
-
const languages = propLanguages ?? contextLanguages ?? defaultLanguages;
|
|
282
|
-
const currentLanguage = propCurrentLanguage ?? context?.language ?? "en";
|
|
283
|
-
const onLanguageChange = propOnLanguageChange ?? context?.setLanguage;
|
|
284
|
-
const sizes = sizeClasses[size];
|
|
285
|
-
const shapeClass = shapeClasses[shape];
|
|
286
|
-
const accessibleName = labels.language ?? "Language";
|
|
287
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenu, { children: [
|
|
288
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
289
|
-
dropdownMenu_js.DropdownMenuTrigger,
|
|
290
|
-
{
|
|
291
|
-
render: /* @__PURE__ */ jsxRuntime.jsx(
|
|
292
|
-
button_js.Button,
|
|
293
|
-
{
|
|
294
|
-
variant: "outline",
|
|
295
|
-
size: "icon",
|
|
296
|
-
"aria-label": accessibleName,
|
|
297
|
-
className: cn(
|
|
298
|
-
sizes.button,
|
|
299
|
-
shapeClass,
|
|
300
|
-
iconTriggerClassName,
|
|
301
|
-
className
|
|
302
|
-
)
|
|
303
|
-
}
|
|
304
|
-
),
|
|
305
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Languages, { className: sizes.icon })
|
|
306
|
-
}
|
|
307
|
-
),
|
|
308
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
309
|
-
dropdownMenu_js.DropdownMenuContent,
|
|
310
|
-
{
|
|
311
|
-
side,
|
|
312
|
-
align,
|
|
313
|
-
sideOffset: dropdownMenu_js.miniMenuContentDefaults.sideOffset,
|
|
314
|
-
collisionPadding: dropdownMenu_js.miniMenuContentDefaults.collisionPadding,
|
|
315
|
-
className: cn(dropdownMenu_js.miniMenuContentClassName, "min-w-0 w-auto"),
|
|
316
|
-
children: languages.map(({ key, nativeName }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
317
|
-
dropdownMenu_js.DropdownMenuItem,
|
|
318
|
-
{
|
|
319
|
-
onClick: () => onLanguageChange?.(key),
|
|
320
|
-
className: cn(
|
|
321
|
-
"justify-center text-xs font-semibold cursor-pointer px-3",
|
|
322
|
-
currentLanguage === key && "bg-accent text-accent-foreground"
|
|
323
|
-
),
|
|
324
|
-
children: nativeName
|
|
325
|
-
},
|
|
326
|
-
key
|
|
327
|
-
))
|
|
328
|
-
}
|
|
329
|
-
)
|
|
330
|
-
] });
|
|
331
|
-
}
|
|
332
|
-
var defaultLabels = {
|
|
333
|
-
theme: "Theme",
|
|
334
|
-
system: "System",
|
|
335
|
-
light: "Light",
|
|
336
|
-
dark: "Dark"
|
|
337
|
-
};
|
|
338
|
-
var sizeClasses2 = {
|
|
339
|
-
sm: { button: "size-8", icon: "size-4" },
|
|
340
|
-
md: { button: "size-8", icon: "size-4" },
|
|
341
|
-
lg: { button: "size-9", icon: "size-4" }
|
|
342
|
-
};
|
|
343
|
-
var shapeClasses2 = {
|
|
344
|
-
rounded: "rounded-md",
|
|
345
|
-
pill: "rounded-full"
|
|
346
|
-
};
|
|
347
|
-
var iconTriggerClassName2 = "border border-border bg-transparent text-muted-foreground shadow-none hover:bg-accent hover:text-foreground dark:border-border dark:bg-transparent dark:text-muted-foreground dark:hover:bg-accent/50";
|
|
348
|
-
var themeIcons = {
|
|
349
|
-
system: lucideReact.Monitor,
|
|
350
|
-
light: lucideReact.Sun,
|
|
351
|
-
dark: lucideReact.Moon
|
|
352
|
-
};
|
|
353
|
-
var themes = [
|
|
354
|
-
{ key: "system", icon: themeIcons.system },
|
|
355
|
-
{ key: "light", icon: themeIcons.light },
|
|
356
|
-
{ key: "dark", icon: themeIcons.dark }
|
|
357
|
-
];
|
|
358
|
-
function storedTheme(value) {
|
|
359
|
-
if (value === "system" || value === "light" || value === "dark") return value;
|
|
360
|
-
return void 0;
|
|
361
|
-
}
|
|
362
|
-
function ThemeSwitcher({
|
|
363
|
-
className,
|
|
364
|
-
size = "sm",
|
|
365
|
-
shape = "rounded",
|
|
366
|
-
align = "end",
|
|
367
|
-
side = "bottom",
|
|
368
|
-
labels: userLabels
|
|
369
|
-
}) {
|
|
370
|
-
const { theme, setTheme } = nextThemes.useTheme();
|
|
371
|
-
const [mounted, setMounted] = react.useState(false);
|
|
372
|
-
const sizes = sizeClasses2[size];
|
|
373
|
-
const shapeClass = shapeClasses2[shape];
|
|
374
|
-
const labels = { ...defaultLabels, ...userLabels };
|
|
375
|
-
const handleThemeClick = react.useCallback(
|
|
376
|
-
(themeKey) => {
|
|
377
|
-
setTheme(themeKey);
|
|
378
|
-
},
|
|
379
|
-
[setTheme]
|
|
380
|
-
);
|
|
381
|
-
react.useEffect(() => {
|
|
382
|
-
setMounted(true);
|
|
383
|
-
}, []);
|
|
384
|
-
if (!mounted) {
|
|
385
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
386
|
-
"div",
|
|
387
|
-
{
|
|
388
|
-
"aria-hidden": true,
|
|
389
|
-
className: cn(
|
|
390
|
-
sizes.button,
|
|
391
|
-
shapeClass,
|
|
392
|
-
iconTriggerClassName2,
|
|
393
|
-
className
|
|
394
|
-
)
|
|
395
|
-
}
|
|
396
|
-
);
|
|
397
|
-
}
|
|
398
|
-
const currentTheme = storedTheme(theme);
|
|
399
|
-
const TriggerIcon = currentTheme ? themeIcons[currentTheme] : lucideReact.Monitor;
|
|
400
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenu, { children: [
|
|
401
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
402
|
-
dropdownMenu_js.DropdownMenuTrigger,
|
|
403
|
-
{
|
|
404
|
-
render: /* @__PURE__ */ jsxRuntime.jsx(
|
|
405
|
-
button_js.Button,
|
|
406
|
-
{
|
|
407
|
-
"data-testid": "theme-switcher",
|
|
408
|
-
variant: "outline",
|
|
409
|
-
size: "icon",
|
|
410
|
-
"aria-label": labels.theme,
|
|
411
|
-
className: cn(
|
|
412
|
-
sizes.button,
|
|
413
|
-
shapeClass,
|
|
414
|
-
iconTriggerClassName2,
|
|
415
|
-
className
|
|
416
|
-
)
|
|
417
|
-
}
|
|
418
|
-
),
|
|
419
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(TriggerIcon, { className: sizes.icon })
|
|
420
|
-
}
|
|
421
|
-
),
|
|
422
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
423
|
-
dropdownMenu_js.DropdownMenuContent,
|
|
424
|
-
{
|
|
425
|
-
side,
|
|
426
|
-
align,
|
|
427
|
-
sideOffset: dropdownMenu_js.miniMenuContentDefaults.sideOffset,
|
|
428
|
-
collisionPadding: dropdownMenu_js.miniMenuContentDefaults.collisionPadding,
|
|
429
|
-
className: dropdownMenu_js.miniMenuContentClassName,
|
|
430
|
-
children: themes.map(({ key, icon: Icon }) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
431
|
-
dropdownMenu_js.DropdownMenuItem,
|
|
432
|
-
{
|
|
433
|
-
onClick: () => handleThemeClick(key),
|
|
434
|
-
className: cn(
|
|
435
|
-
"gap-2 cursor-pointer",
|
|
436
|
-
currentTheme === key && "bg-accent text-accent-foreground [&_svg]:text-accent-foreground"
|
|
437
|
-
),
|
|
438
|
-
children: [
|
|
439
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4" }),
|
|
440
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: labels[key] })
|
|
441
|
-
]
|
|
442
|
-
},
|
|
443
|
-
key
|
|
444
|
-
))
|
|
445
|
-
}
|
|
446
|
-
)
|
|
447
|
-
] });
|
|
448
|
-
}
|
|
449
249
|
var DATA_TABLE_ROW_CLASS = "h-14";
|
|
450
250
|
function renderShellLink({
|
|
451
251
|
href,
|
|
@@ -583,35 +383,40 @@ function NavTabs({
|
|
|
583
383
|
}
|
|
584
384
|
var accountMenuDefaults = {
|
|
585
385
|
menu: "Account menu",
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
language: "Language",
|
|
589
|
-
system: "System",
|
|
590
|
-
light: "Light",
|
|
591
|
-
dark: "Dark"
|
|
386
|
+
account: "Account",
|
|
387
|
+
signOut: "Sign out"
|
|
592
388
|
};
|
|
389
|
+
function AccountAvatar({
|
|
390
|
+
name,
|
|
391
|
+
imageSrc,
|
|
392
|
+
imageAlt
|
|
393
|
+
}) {
|
|
394
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(avatar_js.Avatar, { className: "size-8", children: [
|
|
395
|
+
imageSrc ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
396
|
+
avatar_js.AvatarImage,
|
|
397
|
+
{
|
|
398
|
+
src: imageSrc,
|
|
399
|
+
alt: imageAlt,
|
|
400
|
+
width: 32,
|
|
401
|
+
height: 32,
|
|
402
|
+
keepMounted: true
|
|
403
|
+
}
|
|
404
|
+
) : null,
|
|
405
|
+
/* @__PURE__ */ jsxRuntime.jsx(avatar_js.AvatarFallback, { style: avatarFallbackStyle(name), children: getInitials(name) })
|
|
406
|
+
] });
|
|
407
|
+
}
|
|
593
408
|
function AccountMenu({
|
|
594
409
|
name,
|
|
595
410
|
email,
|
|
596
|
-
organization,
|
|
597
411
|
imageSrc,
|
|
598
412
|
imageAlt = "",
|
|
599
413
|
labels: userLabels,
|
|
600
|
-
|
|
601
|
-
currentLanguage,
|
|
602
|
-
onLanguageChange,
|
|
414
|
+
onAccount,
|
|
603
415
|
onSignOut
|
|
604
416
|
}) {
|
|
605
417
|
const labels = { ...accountMenuDefaults, ...userLabels };
|
|
606
418
|
const { isMobile } = sidebar_js.useSidebar();
|
|
607
419
|
const side = isMobile ? "bottom" : "right";
|
|
608
|
-
const themeLabels = {
|
|
609
|
-
theme: labels.theme,
|
|
610
|
-
system: labels.system,
|
|
611
|
-
light: labels.light,
|
|
612
|
-
dark: labels.dark
|
|
613
|
-
};
|
|
614
|
-
const languageLabels = { language: labels.language };
|
|
615
420
|
return /* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarMenu, { children: /* @__PURE__ */ jsxRuntime.jsx(sidebar_js.SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenu, { children: [
|
|
616
421
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
617
422
|
dropdownMenu_js.DropdownMenuTrigger,
|
|
@@ -625,23 +430,17 @@ function AccountMenu({
|
|
|
625
430
|
}
|
|
626
431
|
),
|
|
627
432
|
children: [
|
|
628
|
-
/* @__PURE__ */ jsxRuntime.
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
keepMounted: true
|
|
637
|
-
}
|
|
638
|
-
) : null,
|
|
639
|
-
/* @__PURE__ */ jsxRuntime.jsx(avatar_js.AvatarFallback, { style: avatarFallbackStyle(name), children: getInitials(name) })
|
|
640
|
-
] }),
|
|
433
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
434
|
+
AccountAvatar,
|
|
435
|
+
{
|
|
436
|
+
name,
|
|
437
|
+
imageSrc,
|
|
438
|
+
imageAlt
|
|
439
|
+
}
|
|
440
|
+
),
|
|
641
441
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "grid min-w-0 flex-1 text-left text-sm leading-tight group-data-[collapsible=icon]:hidden", children: [
|
|
642
442
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children: name }),
|
|
643
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs text-muted-foreground", children: email })
|
|
644
|
-
organization ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs text-muted-foreground", children: organization }) : null
|
|
443
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs text-muted-foreground", children: email })
|
|
645
444
|
] }),
|
|
646
445
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { className: "ml-auto size-4 group-data-[collapsible=icon]:hidden" })
|
|
647
446
|
]
|
|
@@ -654,27 +453,25 @@ function AccountMenu({
|
|
|
654
453
|
align: "end",
|
|
655
454
|
className: "w-56 min-w-56",
|
|
656
455
|
children: [
|
|
657
|
-
/* @__PURE__ */ jsxRuntime.
|
|
658
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate font-medium", children: name }),
|
|
659
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate text-xs text-muted-foreground", children: email }),
|
|
660
|
-
organization ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate text-xs text-muted-foreground", children: organization }) : null
|
|
661
|
-
] }),
|
|
662
|
-
/* @__PURE__ */ jsxRuntime.jsx(dropdownMenu_js.DropdownMenuSeparator, {}),
|
|
663
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-1 px-1.5 py-1", children: [
|
|
664
|
-
/* @__PURE__ */ jsxRuntime.jsx(ThemeSwitcher, { labels: themeLabels, side, align: "end" }),
|
|
456
|
+
/* @__PURE__ */ jsxRuntime.jsx(dropdownMenu_js.DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
|
|
665
457
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
666
|
-
|
|
458
|
+
AccountAvatar,
|
|
667
459
|
{
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
onLanguageChange,
|
|
672
|
-
side,
|
|
673
|
-
align: "end"
|
|
460
|
+
name,
|
|
461
|
+
imageSrc,
|
|
462
|
+
imageAlt
|
|
674
463
|
}
|
|
675
|
-
)
|
|
676
|
-
|
|
464
|
+
),
|
|
465
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "grid min-w-0 flex-1 text-sm leading-tight", children: [
|
|
466
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children: name }),
|
|
467
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs text-muted-foreground", children: email })
|
|
468
|
+
] })
|
|
469
|
+
] }) }),
|
|
677
470
|
/* @__PURE__ */ jsxRuntime.jsx(dropdownMenu_js.DropdownMenuSeparator, {}),
|
|
471
|
+
onAccount ? /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenuItem, { onClick: onAccount, children: [
|
|
472
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserRound, {}),
|
|
473
|
+
labels.account
|
|
474
|
+
] }) : null,
|
|
678
475
|
/* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenuItem, { onClick: onSignOut, children: [
|
|
679
476
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, {}),
|
|
680
477
|
labels.signOut
|
|
@@ -1701,6 +1498,206 @@ function SafeImage({
|
|
|
1701
1498
|
}
|
|
1702
1499
|
);
|
|
1703
1500
|
}
|
|
1501
|
+
var defaultLabels = {
|
|
1502
|
+
theme: "Theme",
|
|
1503
|
+
system: "System",
|
|
1504
|
+
light: "Light",
|
|
1505
|
+
dark: "Dark"
|
|
1506
|
+
};
|
|
1507
|
+
var sizeClasses = {
|
|
1508
|
+
sm: { button: "size-8", icon: "size-4" },
|
|
1509
|
+
md: { button: "size-8", icon: "size-4" },
|
|
1510
|
+
lg: { button: "size-9", icon: "size-4" }
|
|
1511
|
+
};
|
|
1512
|
+
var shapeClasses = {
|
|
1513
|
+
rounded: "rounded-md",
|
|
1514
|
+
pill: "rounded-full"
|
|
1515
|
+
};
|
|
1516
|
+
var iconTriggerClassName = "border border-border bg-transparent text-muted-foreground shadow-none hover:bg-accent hover:text-foreground dark:border-border dark:bg-transparent dark:text-muted-foreground dark:hover:bg-accent/50";
|
|
1517
|
+
var themeIcons = {
|
|
1518
|
+
system: lucideReact.Monitor,
|
|
1519
|
+
light: lucideReact.Sun,
|
|
1520
|
+
dark: lucideReact.Moon
|
|
1521
|
+
};
|
|
1522
|
+
var themes = [
|
|
1523
|
+
{ key: "system", icon: themeIcons.system },
|
|
1524
|
+
{ key: "light", icon: themeIcons.light },
|
|
1525
|
+
{ key: "dark", icon: themeIcons.dark }
|
|
1526
|
+
];
|
|
1527
|
+
function storedTheme(value) {
|
|
1528
|
+
if (value === "system" || value === "light" || value === "dark") return value;
|
|
1529
|
+
return void 0;
|
|
1530
|
+
}
|
|
1531
|
+
function ThemeSwitcher({
|
|
1532
|
+
className,
|
|
1533
|
+
size = "sm",
|
|
1534
|
+
shape = "rounded",
|
|
1535
|
+
align = "end",
|
|
1536
|
+
side = "bottom",
|
|
1537
|
+
labels: userLabels
|
|
1538
|
+
}) {
|
|
1539
|
+
const { theme, setTheme } = nextThemes.useTheme();
|
|
1540
|
+
const [mounted, setMounted] = react.useState(false);
|
|
1541
|
+
const sizes = sizeClasses[size];
|
|
1542
|
+
const shapeClass = shapeClasses[shape];
|
|
1543
|
+
const labels = { ...defaultLabels, ...userLabels };
|
|
1544
|
+
const handleThemeClick = react.useCallback(
|
|
1545
|
+
(themeKey) => {
|
|
1546
|
+
setTheme(themeKey);
|
|
1547
|
+
},
|
|
1548
|
+
[setTheme]
|
|
1549
|
+
);
|
|
1550
|
+
react.useEffect(() => {
|
|
1551
|
+
setMounted(true);
|
|
1552
|
+
}, []);
|
|
1553
|
+
if (!mounted) {
|
|
1554
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1555
|
+
"div",
|
|
1556
|
+
{
|
|
1557
|
+
"aria-hidden": true,
|
|
1558
|
+
className: cn(
|
|
1559
|
+
sizes.button,
|
|
1560
|
+
shapeClass,
|
|
1561
|
+
iconTriggerClassName,
|
|
1562
|
+
className
|
|
1563
|
+
)
|
|
1564
|
+
}
|
|
1565
|
+
);
|
|
1566
|
+
}
|
|
1567
|
+
const currentTheme = storedTheme(theme);
|
|
1568
|
+
const TriggerIcon = currentTheme ? themeIcons[currentTheme] : lucideReact.Monitor;
|
|
1569
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenu, { children: [
|
|
1570
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1571
|
+
dropdownMenu_js.DropdownMenuTrigger,
|
|
1572
|
+
{
|
|
1573
|
+
render: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1574
|
+
button_js.Button,
|
|
1575
|
+
{
|
|
1576
|
+
"data-testid": "theme-switcher",
|
|
1577
|
+
variant: "outline",
|
|
1578
|
+
size: "icon",
|
|
1579
|
+
"aria-label": labels.theme,
|
|
1580
|
+
className: cn(
|
|
1581
|
+
sizes.button,
|
|
1582
|
+
shapeClass,
|
|
1583
|
+
iconTriggerClassName,
|
|
1584
|
+
className
|
|
1585
|
+
)
|
|
1586
|
+
}
|
|
1587
|
+
),
|
|
1588
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TriggerIcon, { className: sizes.icon })
|
|
1589
|
+
}
|
|
1590
|
+
),
|
|
1591
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1592
|
+
dropdownMenu_js.DropdownMenuContent,
|
|
1593
|
+
{
|
|
1594
|
+
side,
|
|
1595
|
+
align,
|
|
1596
|
+
sideOffset: dropdownMenu_js.miniMenuContentDefaults.sideOffset,
|
|
1597
|
+
collisionPadding: dropdownMenu_js.miniMenuContentDefaults.collisionPadding,
|
|
1598
|
+
className: dropdownMenu_js.miniMenuContentClassName,
|
|
1599
|
+
children: themes.map(({ key, icon: Icon }) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1600
|
+
dropdownMenu_js.DropdownMenuItem,
|
|
1601
|
+
{
|
|
1602
|
+
onClick: () => handleThemeClick(key),
|
|
1603
|
+
className: cn(
|
|
1604
|
+
"gap-2 cursor-pointer",
|
|
1605
|
+
currentTheme === key && "bg-accent text-accent-foreground [&_svg]:text-accent-foreground"
|
|
1606
|
+
),
|
|
1607
|
+
children: [
|
|
1608
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4" }),
|
|
1609
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: labels[key] })
|
|
1610
|
+
]
|
|
1611
|
+
},
|
|
1612
|
+
key
|
|
1613
|
+
))
|
|
1614
|
+
}
|
|
1615
|
+
)
|
|
1616
|
+
] });
|
|
1617
|
+
}
|
|
1618
|
+
var defaultLanguages = [
|
|
1619
|
+
{ key: "es-MX", label: "ES", nativeName: "Espa\xF1ol (M\xE9xico)" },
|
|
1620
|
+
{ key: "en", label: "EN", nativeName: "English" }
|
|
1621
|
+
];
|
|
1622
|
+
var sizeClasses2 = {
|
|
1623
|
+
sm: { button: "size-8", icon: "size-4" },
|
|
1624
|
+
md: { button: "size-8", icon: "size-4" },
|
|
1625
|
+
lg: { button: "size-9", icon: "size-4" }
|
|
1626
|
+
};
|
|
1627
|
+
var shapeClasses2 = {
|
|
1628
|
+
rounded: "rounded-md",
|
|
1629
|
+
squared: "rounded-sm",
|
|
1630
|
+
pill: "rounded-full"
|
|
1631
|
+
};
|
|
1632
|
+
var iconTriggerClassName2 = "border border-border bg-transparent text-muted-foreground shadow-none hover:bg-accent hover:text-foreground dark:border-border dark:bg-transparent dark:text-muted-foreground dark:hover:bg-accent/50";
|
|
1633
|
+
function LanguageSwitcher({
|
|
1634
|
+
languages: propLanguages,
|
|
1635
|
+
currentLanguage: propCurrentLanguage,
|
|
1636
|
+
onLanguageChange: propOnLanguageChange,
|
|
1637
|
+
labels = {},
|
|
1638
|
+
className,
|
|
1639
|
+
size = "sm",
|
|
1640
|
+
shape = "rounded",
|
|
1641
|
+
align = "end",
|
|
1642
|
+
side = "bottom"
|
|
1643
|
+
}) {
|
|
1644
|
+
const context = useLanguageContext();
|
|
1645
|
+
const contextLanguages = context?.languages?.map((lang) => ({
|
|
1646
|
+
key: lang.code,
|
|
1647
|
+
label: lang.code.toUpperCase(),
|
|
1648
|
+
nativeName: lang.name
|
|
1649
|
+
}));
|
|
1650
|
+
const languages = propLanguages ?? contextLanguages ?? defaultLanguages;
|
|
1651
|
+
const currentLanguage = propCurrentLanguage ?? context?.language ?? "en";
|
|
1652
|
+
const onLanguageChange = propOnLanguageChange ?? context?.setLanguage;
|
|
1653
|
+
const sizes = sizeClasses2[size];
|
|
1654
|
+
const shapeClass = shapeClasses2[shape];
|
|
1655
|
+
const accessibleName = labels.language ?? "Language";
|
|
1656
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu_js.DropdownMenu, { children: [
|
|
1657
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1658
|
+
dropdownMenu_js.DropdownMenuTrigger,
|
|
1659
|
+
{
|
|
1660
|
+
render: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1661
|
+
button_js.Button,
|
|
1662
|
+
{
|
|
1663
|
+
variant: "outline",
|
|
1664
|
+
size: "icon",
|
|
1665
|
+
"aria-label": accessibleName,
|
|
1666
|
+
className: cn(
|
|
1667
|
+
sizes.button,
|
|
1668
|
+
shapeClass,
|
|
1669
|
+
iconTriggerClassName2,
|
|
1670
|
+
className
|
|
1671
|
+
)
|
|
1672
|
+
}
|
|
1673
|
+
),
|
|
1674
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Languages, { className: sizes.icon })
|
|
1675
|
+
}
|
|
1676
|
+
),
|
|
1677
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1678
|
+
dropdownMenu_js.DropdownMenuContent,
|
|
1679
|
+
{
|
|
1680
|
+
side,
|
|
1681
|
+
align,
|
|
1682
|
+
sideOffset: dropdownMenu_js.miniMenuContentDefaults.sideOffset,
|
|
1683
|
+
collisionPadding: dropdownMenu_js.miniMenuContentDefaults.collisionPadding,
|
|
1684
|
+
className: cn(dropdownMenu_js.miniMenuContentClassName, "min-w-0 w-auto"),
|
|
1685
|
+
children: languages.map(({ key, nativeName }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1686
|
+
dropdownMenu_js.DropdownMenuItem,
|
|
1687
|
+
{
|
|
1688
|
+
onClick: () => onLanguageChange?.(key),
|
|
1689
|
+
className: cn(
|
|
1690
|
+
"justify-center text-xs font-semibold cursor-pointer px-3",
|
|
1691
|
+
currentLanguage === key && "bg-accent text-accent-foreground"
|
|
1692
|
+
),
|
|
1693
|
+
children: nativeName
|
|
1694
|
+
},
|
|
1695
|
+
key
|
|
1696
|
+
))
|
|
1697
|
+
}
|
|
1698
|
+
)
|
|
1699
|
+
] });
|
|
1700
|
+
}
|
|
1704
1701
|
var DEFAULT_LABELS = {
|
|
1705
1702
|
uploadAria: "Upload image",
|
|
1706
1703
|
uploadHint: "Click to upload",
|
|
@@ -3355,8 +3352,8 @@ function cookieDomainFromHostname(hostname) {
|
|
|
3355
3352
|
const host = hostname.toLowerCase();
|
|
3356
3353
|
if (host === "localhost" || host === "127.0.0.1") return void 0;
|
|
3357
3354
|
if (host.endsWith(".yenio.mx") || host === "yenio.mx") return ".yenio.mx";
|
|
3358
|
-
if (host.endsWith(".yenio
|
|
3359
|
-
return ".yenio
|
|
3355
|
+
if (host.endsWith(".yenio.workers.dev") || host === "yenio.workers.dev") {
|
|
3356
|
+
return ".yenio.workers.dev";
|
|
3360
3357
|
}
|
|
3361
3358
|
return void 0;
|
|
3362
3359
|
}
|