@alfadocs/ui-kit 1.70.0 → 1.71.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/_chunks/auth-form-parts-DHv6LVV2.js +98 -0
- package/dist/_chunks/{forgot-password-form-Dqi7R-NL.js → forgot-password-form-BGPc8TGr.js} +2 -2
- package/dist/_chunks/header-settings-CAC0Yl0t.js +516 -0
- package/dist/_chunks/login-dev-card-CWpoTuVY.js +332 -0
- package/dist/_chunks/{marketplace-app-shell-CcLQ0Dn-.js → marketplace-app-shell-BeWm-Efp.js} +2 -2
- package/dist/agent-catalog.json +9 -1
- package/dist/agent-i18n/en.json +1 -0
- package/dist/components/header-settings/index.js +1 -1
- package/dist/i18n/locales/ar.d.ts +1 -0
- package/dist/i18n/locales/ar.js +1 -0
- package/dist/i18n/locales/de.d.ts +1 -0
- package/dist/i18n/locales/de.js +1 -0
- package/dist/i18n/locales/el.d.ts +1 -0
- package/dist/i18n/locales/el.js +1 -0
- package/dist/i18n/locales/en.d.ts +1 -0
- package/dist/i18n/locales/en.js +1 -0
- package/dist/i18n/locales/es.d.ts +1 -0
- package/dist/i18n/locales/es.js +1 -0
- package/dist/i18n/locales/fr.d.ts +1 -0
- package/dist/i18n/locales/fr.js +1 -0
- package/dist/i18n/locales/hi.d.ts +1 -0
- package/dist/i18n/locales/hi.js +1 -0
- package/dist/i18n/locales/it.d.ts +1 -0
- package/dist/i18n/locales/it.js +1 -0
- package/dist/i18n/locales/ja.d.ts +1 -0
- package/dist/i18n/locales/ja.js +1 -0
- package/dist/i18n/locales/nl.d.ts +1 -0
- package/dist/i18n/locales/nl.js +1 -0
- package/dist/i18n/locales/pl.d.ts +1 -0
- package/dist/i18n/locales/pl.js +1 -0
- package/dist/i18n/locales/pt.d.ts +1 -0
- package/dist/i18n/locales/pt.js +1 -0
- package/dist/i18n/locales/ro.d.ts +1 -0
- package/dist/i18n/locales/ro.js +1 -0
- package/dist/i18n/locales/ru.d.ts +1 -0
- package/dist/i18n/locales/ru.js +1 -0
- package/dist/i18n/locales/sq.d.ts +1 -0
- package/dist/i18n/locales/sq.js +1 -0
- package/dist/i18n/locales/sv.d.ts +1 -0
- package/dist/i18n/locales/sv.js +1 -0
- package/dist/i18n/locales/tr.d.ts +1 -0
- package/dist/i18n/locales/tr.js +1 -0
- package/dist/i18n/locales/zh.d.ts +1 -0
- package/dist/i18n/locales/zh.js +1 -0
- package/dist/index.js +3 -3
- package/dist/locales/ar.json +1 -0
- package/dist/locales/de.json +1 -0
- package/dist/locales/el.json +1 -0
- package/dist/locales/en.json +1 -0
- package/dist/locales/es.json +1 -0
- package/dist/locales/fr.json +1 -0
- package/dist/locales/hi.json +1 -0
- package/dist/locales/it.json +1 -0
- package/dist/locales/ja.json +1 -0
- package/dist/locales/nl.json +1 -0
- package/dist/locales/pl.json +1 -0
- package/dist/locales/pt.json +1 -0
- package/dist/locales/ro.json +1 -0
- package/dist/locales/ru.json +1 -0
- package/dist/locales/sq.json +1 -0
- package/dist/locales/sv.json +1 -0
- package/dist/locales/tr.json +1 -0
- package/dist/locales/zh.json +1 -0
- package/dist/patterns/_shared/auth-form-parts.d.ts +4 -3
- package/dist/patterns/forgot-password-form/index.js +1 -1
- package/dist/patterns/login-form/index.js +1 -1
- package/dist/patterns/login-form/login-form.d.ts +6 -2
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/auth-form-parts-B40zvD-a.js +0 -86
- package/dist/_chunks/header-settings-DlUbvAUx.js +0 -306
- package/dist/_chunks/login-dev-card-vEL-o5wq.js +0 -309
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsxs as m, jsx as r, Fragment as v } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as f, forwardRef as h } from "react";
|
|
3
|
+
import { c as l } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as g } from "react-i18next";
|
|
5
|
+
import { A as c } from "./alert-9kEwDza3.js";
|
|
6
|
+
import { i as u } from "./is-development-CLUAnsU7.js";
|
|
7
|
+
import { a as p } from "./safe-href-5dbsfbQn.js";
|
|
8
|
+
import { B as b } from "./use-registration-submit-eWAECgUC.js";
|
|
9
|
+
const x = "Alfadocs", w = l(
|
|
10
|
+
"ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-xs)]",
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
centred: { true: "ds:items-center ds:text-center", false: "" }
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: { centred: !0 }
|
|
16
|
+
}
|
|
17
|
+
), A = l(
|
|
18
|
+
"ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)] ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
19
|
+
), N = l(
|
|
20
|
+
'type-body-sm ds:relative ds:rounded-[var(--radius-sm)] ds:underline ds:underline-offset-4 ds:text-[var(--foreground)] ds:before:absolute ds:before:inset-x-0 ds:before:inset-y-[calc((var(--min-target-size)-100%)/-2)] ds:before:content-[""] ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)] ds:forced-colors:focus-visible:outline-[CanvasText]',
|
|
21
|
+
{
|
|
22
|
+
variants: {
|
|
23
|
+
/** Centred under a button, or at the end edge under a field. */
|
|
24
|
+
align: { center: "ds:self-center", end: "ds:self-end" }
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: { align: "center" }
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
function B({
|
|
30
|
+
href: e,
|
|
31
|
+
action: s,
|
|
32
|
+
align: t,
|
|
33
|
+
children: a
|
|
34
|
+
}) {
|
|
35
|
+
return /* @__PURE__ */ r("a", { href: e, "data-action": s, className: N({ align: t }), children: a });
|
|
36
|
+
}
|
|
37
|
+
function S({
|
|
38
|
+
id: e,
|
|
39
|
+
title: s,
|
|
40
|
+
description: t,
|
|
41
|
+
level: a,
|
|
42
|
+
showLogo: n,
|
|
43
|
+
logoMotion: d
|
|
44
|
+
}) {
|
|
45
|
+
const i = `h${a}`;
|
|
46
|
+
return /* @__PURE__ */ m("div", { className: w({ centred: n }), children: [
|
|
47
|
+
n && /* @__PURE__ */ r(b, { motion: d, label: x }),
|
|
48
|
+
/* @__PURE__ */ r(i, { id: e, className: "type-title-card", children: s }),
|
|
49
|
+
t && /* @__PURE__ */ r("p", { className: "type-body-sm ds:text-[var(--muted-foreground)]", children: t })
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
const y = h(
|
|
53
|
+
({ id: e, announce: s, children: t }, a) => /* @__PURE__ */ r(
|
|
54
|
+
c,
|
|
55
|
+
{
|
|
56
|
+
ref: a,
|
|
57
|
+
id: e,
|
|
58
|
+
variant: "error",
|
|
59
|
+
announce: s,
|
|
60
|
+
tabIndex: -1,
|
|
61
|
+
"data-field": "form",
|
|
62
|
+
className: A(),
|
|
63
|
+
children: /* @__PURE__ */ r(c.Description, { children: t })
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
y.displayName = "AuthFormMessage";
|
|
68
|
+
function C(e, s, t, a) {
|
|
69
|
+
const n = new Set(Object.values(t ?? {})), d = s ? Object.entries(a ?? {}) : [], i = d.filter(([o]) => n.has(o)).map(([o]) => o).join(", ");
|
|
70
|
+
return f(() => {
|
|
71
|
+
i && u() && console.warn(
|
|
72
|
+
`${e}: hiddenFields "${i}" is also named in fieldNames and was left out. The form's own field wins.`
|
|
73
|
+
);
|
|
74
|
+
}, [i, e]), d.filter(([o]) => !n.has(o));
|
|
75
|
+
}
|
|
76
|
+
function D(e, s, t) {
|
|
77
|
+
const a = s && t && p(t) ? t : void 0, n = t ? s ? a ? void 0 : "`action` is not a path or an address on this origin and was left out. The form posts to the current address." : "`action` does nothing without `fieldNames`: only a native form post has an address." : void 0;
|
|
78
|
+
return f(() => {
|
|
79
|
+
n && u() && console.warn(`${e}: ${n}`);
|
|
80
|
+
}, [e, n]), a;
|
|
81
|
+
}
|
|
82
|
+
function H({ fields: e }) {
|
|
83
|
+
return /* @__PURE__ */ r(v, { children: e.map(([s, t]) => /* @__PURE__ */ r("input", { type: "hidden", name: s, value: t }, s)) });
|
|
84
|
+
}
|
|
85
|
+
function O({ busy: e }) {
|
|
86
|
+
const { t: s } = g("ui");
|
|
87
|
+
return /* @__PURE__ */ r("p", { role: "status", className: "ds:sr-only", children: e ? s("chat.message.status.sending") : "" });
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
S as A,
|
|
91
|
+
H as E,
|
|
92
|
+
C as a,
|
|
93
|
+
y as b,
|
|
94
|
+
O as c,
|
|
95
|
+
B as d,
|
|
96
|
+
D as u
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=auth-form-parts-DHv6LVV2.js.map
|
|
@@ -10,7 +10,7 @@ import { E as bo } from "./error-summary-mGxIyDAY.js";
|
|
|
10
10
|
import { F as wo } from "./form-field-Ani72sVY.js";
|
|
11
11
|
import { i as xo } from "./safe-href-5dbsfbQn.js";
|
|
12
12
|
import { u as Eo } from "./use-state-backed-input-DhRQo6gM.js";
|
|
13
|
-
import { u as Io, a as Ao, A as Po, b as yo, E as So, c as Ro, d as To } from "./auth-form-parts-
|
|
13
|
+
import { u as Io, a as Ao, A as Po, b as yo, E as So, c as Ro, d as To } from "./auth-form-parts-DHv6LVV2.js";
|
|
14
14
|
import { u as Bo, a as Mo, b as No } from "./use-registration-submit-eWAECgUC.js";
|
|
15
15
|
const Vo = ["email"], Do = U(
|
|
16
16
|
"ds:mx-auto ds:w-full ds:max-w-[400px] ds:text-start ds:text-[var(--foreground)]"
|
|
@@ -231,4 +231,4 @@ export {
|
|
|
231
231
|
Vo as F,
|
|
232
232
|
_o as a
|
|
233
233
|
};
|
|
234
|
-
//# sourceMappingURL=forgot-password-form-
|
|
234
|
+
//# sourceMappingURL=forgot-password-form-BGPc8TGr.js.map
|
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
import { jsx as t, jsxs as g, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as se, useRef as d, useImperativeHandle as ie, useState as oe, useCallback as ce, useMemo as le } from "react";
|
|
3
|
+
import { c as P } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as J } from "react-i18next";
|
|
5
|
+
import { B as de } from "./button-D-MQxsA_.js";
|
|
6
|
+
import { I as ue } from "./icon-button-C_1TgRiK.js";
|
|
7
|
+
import { D as r } from "./dropdown-menu-D1we7oAY.js";
|
|
8
|
+
import { u as pe, c as v, a as X, L as ge } from "./locale-picker-CeveTnDK.js";
|
|
9
|
+
import { u as me } from "./use-media-query-CcAx5SMM.js";
|
|
10
|
+
import { u as he } from "./use-locale-BExNy9Dl.js";
|
|
11
|
+
import { u as fe } from "./use-theme-CAuo6EYT.js";
|
|
12
|
+
import { a as ye } from "./use-direction-Dp8h70PP.js";
|
|
13
|
+
import { u as be } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
|
|
14
|
+
import { u as we } from "./registry-DvAUVLHh.js";
|
|
15
|
+
import { u as ve } from "./length-token-DwMnGEYT.js";
|
|
16
|
+
import { S as Se } from "./settings-d25ju_6L.js";
|
|
17
|
+
import { A as Y } from "./arrow-left-BfaGqVam.js";
|
|
18
|
+
import { C as $ } from "./chevron-right-I9AeSxH2.js";
|
|
19
|
+
const ke = {
|
|
20
|
+
id: "header-settings",
|
|
21
|
+
// Each setter persists a single preference value (locale / theme /
|
|
22
|
+
// accessibility) — `set_value` semantics, not an ephemeral view switch.
|
|
23
|
+
capabilities: ["set_value"],
|
|
24
|
+
// Read-back for all three setters. None of these preferences is
|
|
25
|
+
// recoverable from the DOM — `useTheme` resolves preference + OS into
|
|
26
|
+
// a single applied class, so `theme: 'system'` and `theme: 'light'`
|
|
27
|
+
// both paint `.theme-light` — and `set_locale` swallows unknown tags.
|
|
28
|
+
// Without these slots an agent cannot distinguish "switched to
|
|
29
|
+
// Italian" from "the tag was dropped on the floor". All four are UI
|
|
30
|
+
// preferences: no PHI, no patient-identifiable data (§7).
|
|
31
|
+
state: {
|
|
32
|
+
locale: {
|
|
33
|
+
type: "string",
|
|
34
|
+
descriptionKey: "ui.agent.headerSettings.state.locale",
|
|
35
|
+
description: 'Active IETF language tag (e.g. "en", "it", "ar"). Read after `set_locale` to confirm the switch landed — an unknown tag is silently dropped and leaves this unchanged.',
|
|
36
|
+
read: (a) => a.getLocale()
|
|
37
|
+
},
|
|
38
|
+
theme: {
|
|
39
|
+
type: "'light' | 'dark' | 'system'",
|
|
40
|
+
descriptionKey: "ui.agent.headerSettings.state.theme",
|
|
41
|
+
description: "Stored base-theme preference. `'system'` means no override is set and the OS decides — read `resolvedTheme` for what is actually painted.",
|
|
42
|
+
read: (a) => a.getTheme()
|
|
43
|
+
},
|
|
44
|
+
accessibility: {
|
|
45
|
+
type: "'default' | 'accessible' | 'system'",
|
|
46
|
+
descriptionKey: "ui.agent.headerSettings.state.accessibility",
|
|
47
|
+
description: "Stored AAA-contrast preference. `'system'` means no override is set and `prefers-contrast` decides.",
|
|
48
|
+
read: (a) => a.getAccessibility()
|
|
49
|
+
},
|
|
50
|
+
resolvedTheme: {
|
|
51
|
+
type: "'light' | 'dark' | 'light-accessible' | 'dark-accessible'",
|
|
52
|
+
descriptionKey: "ui.agent.headerSettings.state.resolvedTheme",
|
|
53
|
+
description: 'The theme actually applied to the document once preference and OS signals resolve. This is what makes a `set_theme("system")` or `set_accessibility("system")` write verifiable.',
|
|
54
|
+
read: (a) => a.getResolvedTheme()
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
actions: {
|
|
58
|
+
set_locale: {
|
|
59
|
+
safety: "write",
|
|
60
|
+
argsType: "{ locale: string }",
|
|
61
|
+
argsSchema: {
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: {
|
|
64
|
+
locale: {
|
|
65
|
+
type: "string",
|
|
66
|
+
description: 'IETF language tag (e.g. "en", "it", "ar"). Unknown tags are silently dropped.'
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
required: ["locale"]
|
|
70
|
+
},
|
|
71
|
+
idempotent: !0,
|
|
72
|
+
descriptionKey: "ui.agent.headerSettings.actions.setLocale",
|
|
73
|
+
description: "Switch the active locale to the given IETF tag. Unknown tags are silently dropped — read the `locale` state slot afterwards to confirm.",
|
|
74
|
+
errors: [
|
|
75
|
+
"Silently ignored when the tag names a locale the kit ships no bundle for — `locale` is unchanged."
|
|
76
|
+
],
|
|
77
|
+
examples: [{ args: { locale: "it" }, note: "Switch to Italian." }],
|
|
78
|
+
invoke: (a, n) => {
|
|
79
|
+
a.setLocale(n.locale);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
set_theme: {
|
|
83
|
+
safety: "write",
|
|
84
|
+
argsType: '{ theme: "light" | "dark" | "system" }',
|
|
85
|
+
argsSchema: {
|
|
86
|
+
type: "object",
|
|
87
|
+
properties: { theme: { enum: ["light", "dark", "system"] } },
|
|
88
|
+
required: ["theme"]
|
|
89
|
+
},
|
|
90
|
+
idempotent: !0,
|
|
91
|
+
descriptionKey: "ui.agent.headerSettings.actions.setTheme",
|
|
92
|
+
description: "Switch the theme preference. Verify with the `theme` slot (the stored preference) and `resolvedTheme` (what is actually painted).",
|
|
93
|
+
examples: [
|
|
94
|
+
{ args: { theme: "dark" }, note: "Switch to the dark theme." }
|
|
95
|
+
],
|
|
96
|
+
invoke: (a, n) => {
|
|
97
|
+
a.setTheme(n.theme);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
set_accessibility: {
|
|
101
|
+
safety: "write",
|
|
102
|
+
argsType: '{ accessibility: "default" | "accessible" | "system" }',
|
|
103
|
+
argsSchema: {
|
|
104
|
+
type: "object",
|
|
105
|
+
properties: {
|
|
106
|
+
accessibility: {
|
|
107
|
+
enum: ["default", "accessible", "system"],
|
|
108
|
+
description: "`'system'` clears the override and follows `prefers-contrast`."
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
required: ["accessibility"]
|
|
112
|
+
},
|
|
113
|
+
idempotent: !0,
|
|
114
|
+
descriptionKey: "ui.agent.headerSettings.actions.setAccessibility",
|
|
115
|
+
description: "Switch the accessibility preference. Verify with the `accessibility` slot (the stored preference) and `resolvedTheme` (what is actually painted).",
|
|
116
|
+
examples: [
|
|
117
|
+
{
|
|
118
|
+
args: { accessibility: "accessible" },
|
|
119
|
+
note: "Enable the AAA-accessible profile."
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
invoke: (a, n) => {
|
|
123
|
+
a.setAccessibility(n.accessibility);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
domHooks: {
|
|
128
|
+
root: {
|
|
129
|
+
attr: "data-component",
|
|
130
|
+
value: "header-settings",
|
|
131
|
+
description: "Marks the HeaderSettings wrapper."
|
|
132
|
+
},
|
|
133
|
+
instanceId: {
|
|
134
|
+
attr: "data-component-id",
|
|
135
|
+
sourceProp: "id",
|
|
136
|
+
description: "Sourced from the id prop (forwarded via HTMLAttributes)."
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
function Te(a, n) {
|
|
141
|
+
if (!(typeof window > "u"))
|
|
142
|
+
try {
|
|
143
|
+
window.localStorage.setItem(a, n);
|
|
144
|
+
} catch {
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function Le(a) {
|
|
148
|
+
if (typeof document > "u") return;
|
|
149
|
+
const n = document.documentElement;
|
|
150
|
+
n.lang = a, n.dir = v[a].dir;
|
|
151
|
+
}
|
|
152
|
+
const Ae = P("ds:inline-flex ds:items-center", {
|
|
153
|
+
variants: {
|
|
154
|
+
align: {
|
|
155
|
+
start: "",
|
|
156
|
+
end: ""
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
defaultVariants: { align: "end" }
|
|
160
|
+
}), Re = "ds:w-[var(--popover-size-md)]", Ce = P("", {
|
|
161
|
+
variants: {
|
|
162
|
+
language: {
|
|
163
|
+
true: "ds:[inline-size:var(--popover-size-md)] ds:[min-inline-size:0] ds:[max-inline-size:calc(100vw_-_2_*_var(--spacing-lg))] ds:[&_input]:min-w-0",
|
|
164
|
+
false: ""
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}), De = P(
|
|
168
|
+
"ds:flex ds:flex-1 ds:min-w-0 ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]"
|
|
169
|
+
);
|
|
170
|
+
function A({
|
|
171
|
+
label: a,
|
|
172
|
+
value: n,
|
|
173
|
+
lang: u
|
|
174
|
+
}) {
|
|
175
|
+
return /* @__PURE__ */ g("span", { className: De(), children: [
|
|
176
|
+
/* @__PURE__ */ t("span", { className: "ds:truncate", children: a }),
|
|
177
|
+
/* @__PURE__ */ t(
|
|
178
|
+
"span",
|
|
179
|
+
{
|
|
180
|
+
lang: u,
|
|
181
|
+
className: "ds:shrink-0 ds:text-muted-foreground ds:[[data-highlighted]_&]:text-current",
|
|
182
|
+
children: n
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
] });
|
|
186
|
+
}
|
|
187
|
+
function Z(a) {
|
|
188
|
+
return Object.prototype.hasOwnProperty.call(v, a);
|
|
189
|
+
}
|
|
190
|
+
function Ie({ locale: a }) {
|
|
191
|
+
const { t: n } = J("ui"), u = v[Z(a) ? a : "en"], R = (s) => {
|
|
192
|
+
var l;
|
|
193
|
+
s.target === s.currentTarget && ((l = s.currentTarget.querySelector("input")) == null || l.focus({ preventScroll: !0 }));
|
|
194
|
+
}, C = (s) => {
|
|
195
|
+
const l = s.target;
|
|
196
|
+
if (l instanceof HTMLInputElement) {
|
|
197
|
+
if (s.nativeEvent.isComposing) {
|
|
198
|
+
s.stopPropagation();
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
s.key !== "ArrowLeft" && s.key !== "ArrowRight" || (l.selectionStart !== 0 || l.selectionEnd !== 0) && s.stopPropagation();
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
return /* @__PURE__ */ g(r.Sub, { children: [
|
|
205
|
+
/* @__PURE__ */ t(r.SubTrigger, { "aria-haspopup": "dialog", "data-value": u.code, children: /* @__PURE__ */ g("span", { className: "ds:flex ds:min-w-0 ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
|
|
206
|
+
/* @__PURE__ */ t("span", { className: "ds:truncate", children: n("navigation.headerSettings.language.label") }),
|
|
207
|
+
/* @__PURE__ */ t(
|
|
208
|
+
"span",
|
|
209
|
+
{
|
|
210
|
+
lang: u.code,
|
|
211
|
+
className: "ds:shrink-0 ds:text-[color:var(--muted-foreground)] ds:[[data-highlighted]_&]:text-current",
|
|
212
|
+
children: u.nativeName
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
] }) }),
|
|
216
|
+
/* @__PURE__ */ t(
|
|
217
|
+
r.SubContent,
|
|
218
|
+
{
|
|
219
|
+
role: "dialog",
|
|
220
|
+
"aria-orientation": void 0,
|
|
221
|
+
className: Re,
|
|
222
|
+
onFocus: R,
|
|
223
|
+
onKeyDownCapture: C,
|
|
224
|
+
onEscapeKeyDown: (s) => {
|
|
225
|
+
s.isComposing && s.preventDefault();
|
|
226
|
+
},
|
|
227
|
+
children: /* @__PURE__ */ t(X.SearchList, {})
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
] });
|
|
231
|
+
}
|
|
232
|
+
const Ke = se(
|
|
233
|
+
(a, n) => {
|
|
234
|
+
var B;
|
|
235
|
+
const {
|
|
236
|
+
align: u = "end",
|
|
237
|
+
size: R = "md",
|
|
238
|
+
disabled: C = !1,
|
|
239
|
+
className: s,
|
|
240
|
+
id: l,
|
|
241
|
+
...ee
|
|
242
|
+
} = a, { t: p } = J("ui"), o = fe(), { locale: b, setLocale: _ } = he();
|
|
243
|
+
pe();
|
|
244
|
+
const D = d(null);
|
|
245
|
+
ie(n, () => D.current, []);
|
|
246
|
+
const m = me("(width < 48rem)"), z = ye(), [S, h] = oe("main"), c = m ? S : "main", k = d(null), H = d(null), O = d(null), f = d(null), T = d("keyboard");
|
|
247
|
+
be(() => {
|
|
248
|
+
var e, i, w, G, U;
|
|
249
|
+
if (!m && S !== "main" && (f.current = S, h("main")), c === "language")
|
|
250
|
+
(i = (e = k.current) == null ? void 0 : e.querySelector(
|
|
251
|
+
T.current === "keyboard" ? "input" : "button"
|
|
252
|
+
)) == null || i.focus({ preventScroll: !0 });
|
|
253
|
+
else if (c === "appearance")
|
|
254
|
+
(G = (w = k.current) == null ? void 0 : w.querySelector('[role="menuitem"]')) == null || G.focus({ preventScroll: !0 });
|
|
255
|
+
else if (f.current) {
|
|
256
|
+
const W = f.current, N = m ? (W === "language" ? H : O).current : (U = k.current) == null ? void 0 : U.querySelector(
|
|
257
|
+
`[role="menuitem"][aria-haspopup="${W === "language" ? "dialog" : "menu"}"]`
|
|
258
|
+
);
|
|
259
|
+
N == null || N.focus({ preventScroll: !0 }), f.current = null;
|
|
260
|
+
}
|
|
261
|
+
}, [m, S, c]);
|
|
262
|
+
const j = (e, i) => {
|
|
263
|
+
if (e.nativeEvent.isComposing) return;
|
|
264
|
+
const w = z === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
265
|
+
(e.key === "Enter" || e.key === " " || e.key === w) && (T.current = "keyboard"), e.key === w && (e.preventDefault(), h(i));
|
|
266
|
+
}, I = () => {
|
|
267
|
+
c !== "main" && (f.current = c, h("main"));
|
|
268
|
+
}, te = (e) => {
|
|
269
|
+
if (c === "main") return;
|
|
270
|
+
if (e.nativeEvent.isComposing) {
|
|
271
|
+
e.stopPropagation();
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (e.key !== (z === "rtl" ? "ArrowRight" : "ArrowLeft"))
|
|
275
|
+
return;
|
|
276
|
+
const i = e.target;
|
|
277
|
+
i instanceof HTMLInputElement && (i.selectionStart !== 0 || i.selectionEnd !== 0) || (e.preventDefault(), e.stopPropagation(), I());
|
|
278
|
+
}, M = ce(
|
|
279
|
+
(e) => {
|
|
280
|
+
_(e), Le(e), Te(ge, e);
|
|
281
|
+
},
|
|
282
|
+
[_]
|
|
283
|
+
), V = d(M);
|
|
284
|
+
V.current = M;
|
|
285
|
+
const q = d(b);
|
|
286
|
+
q.current = b;
|
|
287
|
+
const y = d(o);
|
|
288
|
+
y.current = o;
|
|
289
|
+
const ae = le(
|
|
290
|
+
() => ({
|
|
291
|
+
setLocale: (e) => {
|
|
292
|
+
Object.prototype.hasOwnProperty.call(v, e) && V.current(e);
|
|
293
|
+
},
|
|
294
|
+
setTheme: (e) => y.current.setTheme(e),
|
|
295
|
+
setAccessibility: (e) => y.current.setAccessibility(e),
|
|
296
|
+
// Read-back. None of the three preferences is recoverable from
|
|
297
|
+
// the DOM: `useTheme` resolves preference + OS into one applied
|
|
298
|
+
// class, so `theme: 'system'` and `theme: 'light'` both paint
|
|
299
|
+
// `.theme-light`. Without these an agent cannot tell a switch
|
|
300
|
+
// that landed from one that was dropped.
|
|
301
|
+
getLocale: () => q.current,
|
|
302
|
+
getTheme: () => y.current.theme,
|
|
303
|
+
getAccessibility: () => y.current.accessibility,
|
|
304
|
+
getResolvedTheme: () => y.current.resolvedTheme
|
|
305
|
+
}),
|
|
306
|
+
[]
|
|
307
|
+
);
|
|
308
|
+
we(ke, ae, l);
|
|
309
|
+
const ne = o.accessibility === "accessible", re = ve("--spacing-lg", D, 24), K = p("navigation.headerSettings.language.label"), L = p("navigation.headerSettings.appearance.label"), E = v[Z(b) ? b : "en"], x = [
|
|
310
|
+
{
|
|
311
|
+
value: "light",
|
|
312
|
+
label: p("navigation.headerSettings.appearance.light")
|
|
313
|
+
},
|
|
314
|
+
{ value: "dark", label: p("navigation.headerSettings.appearance.dark") },
|
|
315
|
+
{
|
|
316
|
+
value: "system",
|
|
317
|
+
label: p("navigation.headerSettings.appearance.system")
|
|
318
|
+
}
|
|
319
|
+
], F = p("navigation.headerSettings.back");
|
|
320
|
+
return /* @__PURE__ */ t(
|
|
321
|
+
"div",
|
|
322
|
+
{
|
|
323
|
+
ref: D,
|
|
324
|
+
"data-component": "header-settings",
|
|
325
|
+
"data-component-id": l,
|
|
326
|
+
className: Ae({ align: u, className: s }),
|
|
327
|
+
...ee,
|
|
328
|
+
children: /* @__PURE__ */ g(
|
|
329
|
+
r.Root,
|
|
330
|
+
{
|
|
331
|
+
onOpenChange: (e) => {
|
|
332
|
+
e || (f.current = null, h("main"));
|
|
333
|
+
},
|
|
334
|
+
children: [
|
|
335
|
+
/* @__PURE__ */ t(r.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
336
|
+
ue,
|
|
337
|
+
{
|
|
338
|
+
size: R,
|
|
339
|
+
disabled: C,
|
|
340
|
+
icon: /* @__PURE__ */ t(Se, { "aria-hidden": !0 }),
|
|
341
|
+
"aria-label": p("navigation.headerSettings.trigger")
|
|
342
|
+
}
|
|
343
|
+
) }),
|
|
344
|
+
/* @__PURE__ */ t(
|
|
345
|
+
r.Content,
|
|
346
|
+
{
|
|
347
|
+
ref: k,
|
|
348
|
+
align: u,
|
|
349
|
+
collisionPadding: re,
|
|
350
|
+
className: Ce({ language: c === "language" }),
|
|
351
|
+
...c === "language" ? {
|
|
352
|
+
role: "dialog",
|
|
353
|
+
"aria-orientation": void 0,
|
|
354
|
+
"aria-label": K,
|
|
355
|
+
"aria-labelledby": void 0
|
|
356
|
+
} : {},
|
|
357
|
+
onKeyDownCapture: te,
|
|
358
|
+
onEscapeKeyDown: (e) => {
|
|
359
|
+
e.isComposing && e.preventDefault();
|
|
360
|
+
},
|
|
361
|
+
children: c === "language" ? /* @__PURE__ */ g(
|
|
362
|
+
"div",
|
|
363
|
+
{
|
|
364
|
+
role: "presentation",
|
|
365
|
+
onKeyDown: (e) => {
|
|
366
|
+
var i;
|
|
367
|
+
e.key === "Tab" && !e.altKey && !e.ctrlKey && !e.metaKey && (e.preventDefault(), (i = e.currentTarget.querySelector(
|
|
368
|
+
e.target instanceof HTMLInputElement ? "button" : "input"
|
|
369
|
+
)) == null || i.focus()), e.stopPropagation();
|
|
370
|
+
},
|
|
371
|
+
children: [
|
|
372
|
+
/* @__PURE__ */ t(
|
|
373
|
+
de,
|
|
374
|
+
{
|
|
375
|
+
intent: "ghost",
|
|
376
|
+
size: "sm",
|
|
377
|
+
className: "ds:w-full ds:justify-start ds:text-start ds:font-normal ds:min-h-[var(--min-target-size)] ds:sm:min-h-[var(--min-target-size)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:gap-[var(--spacing-sm)] ds:[&>span:last-child]:flex-1",
|
|
378
|
+
startIcon: /* @__PURE__ */ t(Y, { "aria-hidden": !0, className: "ds:size-4" }),
|
|
379
|
+
flipIconInRtl: !0,
|
|
380
|
+
onClick: I,
|
|
381
|
+
children: /* @__PURE__ */ t(A, { label: F, value: K })
|
|
382
|
+
}
|
|
383
|
+
),
|
|
384
|
+
/* @__PURE__ */ t(r.Separator, {}),
|
|
385
|
+
/* @__PURE__ */ t(X.SearchList, {})
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
) : c === "appearance" ? /* @__PURE__ */ g(Q, { children: [
|
|
389
|
+
/* @__PURE__ */ t(
|
|
390
|
+
r.Item,
|
|
391
|
+
{
|
|
392
|
+
startIcon: /* @__PURE__ */ t(
|
|
393
|
+
Y,
|
|
394
|
+
{
|
|
395
|
+
"aria-hidden": !0,
|
|
396
|
+
className: "ds:size-4 ds:rtl:-scale-x-100"
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
onSelect: (e) => {
|
|
400
|
+
e.preventDefault(), I();
|
|
401
|
+
},
|
|
402
|
+
children: /* @__PURE__ */ t(A, { label: F, value: L })
|
|
403
|
+
}
|
|
404
|
+
),
|
|
405
|
+
/* @__PURE__ */ t(r.Separator, {}),
|
|
406
|
+
/* @__PURE__ */ t(
|
|
407
|
+
r.RadioGroup,
|
|
408
|
+
{
|
|
409
|
+
"aria-label": L,
|
|
410
|
+
value: o.theme,
|
|
411
|
+
onValueChange: (e) => o.setTheme(e),
|
|
412
|
+
children: x.map((e) => /* @__PURE__ */ t(
|
|
413
|
+
r.RadioItem,
|
|
414
|
+
{
|
|
415
|
+
value: e.value,
|
|
416
|
+
onSelect: (i) => i.preventDefault(),
|
|
417
|
+
children: e.label
|
|
418
|
+
},
|
|
419
|
+
e.value
|
|
420
|
+
))
|
|
421
|
+
}
|
|
422
|
+
)
|
|
423
|
+
] }) : /* @__PURE__ */ g(Q, { children: [
|
|
424
|
+
m ? /* @__PURE__ */ t(
|
|
425
|
+
r.Item,
|
|
426
|
+
{
|
|
427
|
+
ref: H,
|
|
428
|
+
"aria-haspopup": "dialog",
|
|
429
|
+
"data-value": E.code,
|
|
430
|
+
endIcon: /* @__PURE__ */ t(
|
|
431
|
+
$,
|
|
432
|
+
{
|
|
433
|
+
"aria-hidden": !0,
|
|
434
|
+
className: "ds:size-4 ds:rtl:-scale-x-100"
|
|
435
|
+
}
|
|
436
|
+
),
|
|
437
|
+
onPointerDown: (e) => {
|
|
438
|
+
T.current = e.pointerType;
|
|
439
|
+
},
|
|
440
|
+
onKeyDown: (e) => j(e, "language"),
|
|
441
|
+
onSelect: (e) => {
|
|
442
|
+
e.preventDefault(), h("language");
|
|
443
|
+
},
|
|
444
|
+
children: /* @__PURE__ */ t(
|
|
445
|
+
A,
|
|
446
|
+
{
|
|
447
|
+
label: K,
|
|
448
|
+
value: E.nativeName,
|
|
449
|
+
lang: E.code
|
|
450
|
+
}
|
|
451
|
+
)
|
|
452
|
+
}
|
|
453
|
+
) : /* @__PURE__ */ t(Ie, { locale: b }),
|
|
454
|
+
/* @__PURE__ */ t(r.Separator, {}),
|
|
455
|
+
m ? /* @__PURE__ */ t(
|
|
456
|
+
r.Item,
|
|
457
|
+
{
|
|
458
|
+
ref: O,
|
|
459
|
+
"aria-haspopup": "menu",
|
|
460
|
+
"data-value": o.theme,
|
|
461
|
+
endIcon: /* @__PURE__ */ t(
|
|
462
|
+
$,
|
|
463
|
+
{
|
|
464
|
+
"aria-hidden": !0,
|
|
465
|
+
className: "ds:size-4 ds:rtl:-scale-x-100"
|
|
466
|
+
}
|
|
467
|
+
),
|
|
468
|
+
onPointerDown: (e) => {
|
|
469
|
+
T.current = e.pointerType;
|
|
470
|
+
},
|
|
471
|
+
onKeyDown: (e) => j(e, "appearance"),
|
|
472
|
+
onSelect: (e) => {
|
|
473
|
+
e.preventDefault(), h("appearance");
|
|
474
|
+
},
|
|
475
|
+
children: /* @__PURE__ */ t(
|
|
476
|
+
A,
|
|
477
|
+
{
|
|
478
|
+
label: L,
|
|
479
|
+
value: ((B = x.find(
|
|
480
|
+
(e) => e.value === o.theme
|
|
481
|
+
)) == null ? void 0 : B.label) ?? ""
|
|
482
|
+
}
|
|
483
|
+
)
|
|
484
|
+
}
|
|
485
|
+
) : /* @__PURE__ */ t(
|
|
486
|
+
r.ChoiceSub,
|
|
487
|
+
{
|
|
488
|
+
label: L,
|
|
489
|
+
value: o.theme,
|
|
490
|
+
onValueChange: o.setTheme,
|
|
491
|
+
options: x
|
|
492
|
+
}
|
|
493
|
+
),
|
|
494
|
+
/* @__PURE__ */ t(
|
|
495
|
+
r.SwitchItem,
|
|
496
|
+
{
|
|
497
|
+
checked: ne,
|
|
498
|
+
onCheckedChange: (e) => o.setAccessibility(e ? "accessible" : "default"),
|
|
499
|
+
children: p("navigation.headerSettings.appearance.accessible")
|
|
500
|
+
}
|
|
501
|
+
)
|
|
502
|
+
] })
|
|
503
|
+
}
|
|
504
|
+
)
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
)
|
|
508
|
+
}
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
);
|
|
512
|
+
Ke.displayName = "HeaderSettings";
|
|
513
|
+
export {
|
|
514
|
+
Ke as H
|
|
515
|
+
};
|
|
516
|
+
//# sourceMappingURL=header-settings-CAC0Yl0t.js.map
|