@alfadocs/ui-kit 0.21.0 → 0.24.0
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/{autocomplete-BxfabhZ8.js → autocomplete-C7xq06bP.js} +40 -40
- package/dist/_chunks/editable-currency-cell-renderer-DJB5MxAI.js +2349 -0
- package/dist/_chunks/locale-picker-CYBhgSHR.js +575 -0
- package/dist/_chunks/{patient-shell-DavGODt9.js → patient-shell-B164drIa.js} +40 -55
- package/dist/_chunks/settings-ca2Yi9R8.js +21 -0
- package/dist/_chunks/sun-Eweh5fvi.js +50 -0
- package/dist/_chunks/{theme-toggle-BswYl0Yp.js → theme-toggle-FrotC2VI.js} +85 -127
- package/dist/_chunks/use-locale-BkCIHujH.js +20 -0
- package/dist/_chunks/use-scroll-to-first-error-BrK7dKB_.js +55 -0
- package/dist/_chunks/{whatsapp-button-CtlLwM3M.js → whatsapp-button-DUjlWGKf.js} +26 -25
- package/dist/agent-catalog.json +59 -1
- package/dist/components/autocomplete/index.js +1 -1
- package/dist/components/data-table/filters/number-filter.d.ts +56 -0
- package/dist/components/data-table/filters/text-filter.d.ts +49 -0
- package/dist/components/data-table/index.d.ts +4 -0
- package/dist/components/data-table/index.js +25 -21
- package/dist/components/header-settings/index.js +205 -0
- package/dist/components/locale-picker/index.js +7 -0
- package/dist/components/theme-toggle/index.js +1 -1
- package/dist/components/whatsapp-button/index.js +1 -1
- package/dist/components/whatsapp-button/whatsapp-button.d.ts +14 -1
- package/dist/fonts/Lexend-VF-latin-ext.woff2 +0 -0
- package/dist/fonts/Lexend-VF-latin.woff2 +0 -0
- package/dist/fonts/Lexend-VF-vietnamese.woff2 +0 -0
- package/dist/fonts/NotoSansArabic-VF-arabic.woff2 +0 -0
- package/dist/fonts/NotoSansDevanagari-VF-devanagari.woff2 +0 -0
- package/dist/hooks/index.js +29 -28
- package/dist/i18n/config.d.ts +1 -1
- package/dist/i18n/config.js +20944 -2110
- package/dist/i18n/locales/ar.d.ts +1225 -0
- package/dist/i18n/locales/de.d.ts +1225 -0
- package/dist/i18n/locales/el.d.ts +1222 -0
- package/dist/i18n/locales/es.d.ts +1222 -0
- package/dist/i18n/locales/fr.d.ts +1222 -0
- package/dist/i18n/locales/hi.d.ts +1222 -0
- package/dist/i18n/locales/ja.d.ts +1222 -0
- package/dist/i18n/locales/nl.d.ts +1222 -0
- package/dist/i18n/locales/pl.d.ts +1222 -0
- package/dist/i18n/locales/pt.d.ts +1223 -0
- package/dist/i18n/locales/ro.d.ts +1222 -0
- package/dist/i18n/locales/ru.d.ts +1222 -0
- package/dist/i18n/locales/sq.d.ts +1222 -0
- package/dist/i18n/locales/sv.d.ts +1222 -0
- package/dist/i18n/locales/tr.d.ts +1222 -0
- package/dist/i18n/locales/zh.d.ts +1222 -0
- package/dist/i18n/resources.d.ts +342 -1040
- package/dist/index.js +512 -507
- package/dist/locales/ar.json +1217 -1
- package/dist/locales/de.json +207 -13
- package/dist/locales/el.json +1217 -0
- package/dist/locales/en.json +147 -3
- package/dist/locales/es.json +1217 -0
- package/dist/locales/fr.json +1217 -0
- package/dist/locales/hi.json +1217 -0
- package/dist/locales/it.json +178 -3
- package/dist/locales/ja.json +1217 -0
- package/dist/locales/nl.json +1217 -0
- package/dist/locales/pl.json +1217 -0
- package/dist/locales/pt.json +1217 -0
- package/dist/locales/ro.json +1217 -0
- package/dist/locales/ru.json +1217 -0
- package/dist/locales/sq.json +1217 -0
- package/dist/locales/sv.json +1217 -0
- package/dist/locales/tr.json +1217 -0
- package/dist/locales/zh.json +1217 -0
- package/dist/patterns/patient-shell/index.js +1 -1
- package/dist/tokens.css +2 -2
- package/package.json +13 -1
- package/dist/_chunks/editable-currency-cell-renderer-1t42gENX.js +0 -1972
- package/dist/_chunks/use-locale-C5rS3Xon.js +0 -71
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
import { jsx as t, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as z, useId as B, useState as D, useCallback as I, useMemo as R, useRef as T, useImperativeHandle as q, useEffect as M } from "react";
|
|
3
|
+
import { c as _ } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as j } from "react-i18next";
|
|
5
|
+
import { _ as b, R as K } from "./index-4xgbg-sn.js";
|
|
6
|
+
import { I as W } from "./icon-button-C4CGcYuz.js";
|
|
7
|
+
import { P as p } from "./popover--derJ_wq.js";
|
|
8
|
+
import { LOCALES_WITH_BUNDLES as O } from "../i18n/config.js";
|
|
9
|
+
import { u as J } from "./use-locale-BkCIHujH.js";
|
|
10
|
+
import { u as U } from "./registry-C9nwlNyL.js";
|
|
11
|
+
import { G as E } from "./globe-BkEFMNSg.js";
|
|
12
|
+
import { C as Y } from "./check-DPdL_Sm7.js";
|
|
13
|
+
const P = {
|
|
14
|
+
en: {
|
|
15
|
+
code: "en",
|
|
16
|
+
nativeName: "English",
|
|
17
|
+
englishName: "English",
|
|
18
|
+
flag: "🇬🇧",
|
|
19
|
+
dir: "ltr"
|
|
20
|
+
},
|
|
21
|
+
it: {
|
|
22
|
+
code: "it",
|
|
23
|
+
nativeName: "Italiano",
|
|
24
|
+
englishName: "Italian",
|
|
25
|
+
flag: "🇮🇹",
|
|
26
|
+
dir: "ltr"
|
|
27
|
+
},
|
|
28
|
+
de: {
|
|
29
|
+
code: "de",
|
|
30
|
+
nativeName: "Deutsch",
|
|
31
|
+
englishName: "German",
|
|
32
|
+
flag: "🇩🇪",
|
|
33
|
+
dir: "ltr"
|
|
34
|
+
},
|
|
35
|
+
ar: {
|
|
36
|
+
code: "ar",
|
|
37
|
+
nativeName: "العربية",
|
|
38
|
+
englishName: "Arabic",
|
|
39
|
+
flag: "🇸🇦",
|
|
40
|
+
dir: "rtl"
|
|
41
|
+
},
|
|
42
|
+
fr: {
|
|
43
|
+
code: "fr",
|
|
44
|
+
nativeName: "Français",
|
|
45
|
+
englishName: "French",
|
|
46
|
+
flag: "🇫🇷",
|
|
47
|
+
dir: "ltr"
|
|
48
|
+
},
|
|
49
|
+
es: {
|
|
50
|
+
code: "es",
|
|
51
|
+
nativeName: "Español",
|
|
52
|
+
englishName: "Spanish",
|
|
53
|
+
flag: "🇪🇸",
|
|
54
|
+
dir: "ltr"
|
|
55
|
+
},
|
|
56
|
+
pt: {
|
|
57
|
+
code: "pt",
|
|
58
|
+
nativeName: "Português",
|
|
59
|
+
englishName: "Portuguese",
|
|
60
|
+
flag: "🇵🇹",
|
|
61
|
+
dir: "ltr"
|
|
62
|
+
},
|
|
63
|
+
nl: {
|
|
64
|
+
code: "nl",
|
|
65
|
+
nativeName: "Nederlands",
|
|
66
|
+
englishName: "Dutch",
|
|
67
|
+
flag: "🇳🇱",
|
|
68
|
+
dir: "ltr"
|
|
69
|
+
},
|
|
70
|
+
ro: {
|
|
71
|
+
code: "ro",
|
|
72
|
+
nativeName: "Română",
|
|
73
|
+
englishName: "Romanian",
|
|
74
|
+
flag: "🇷🇴",
|
|
75
|
+
dir: "ltr"
|
|
76
|
+
},
|
|
77
|
+
sq: {
|
|
78
|
+
code: "sq",
|
|
79
|
+
nativeName: "Shqip",
|
|
80
|
+
englishName: "Albanian",
|
|
81
|
+
flag: "🇦🇱",
|
|
82
|
+
dir: "ltr"
|
|
83
|
+
},
|
|
84
|
+
tr: {
|
|
85
|
+
code: "tr",
|
|
86
|
+
nativeName: "Türkçe",
|
|
87
|
+
englishName: "Turkish",
|
|
88
|
+
flag: "🇹🇷",
|
|
89
|
+
dir: "ltr"
|
|
90
|
+
},
|
|
91
|
+
pl: {
|
|
92
|
+
code: "pl",
|
|
93
|
+
nativeName: "Polski",
|
|
94
|
+
englishName: "Polish",
|
|
95
|
+
flag: "🇵🇱",
|
|
96
|
+
dir: "ltr"
|
|
97
|
+
},
|
|
98
|
+
sv: {
|
|
99
|
+
code: "sv",
|
|
100
|
+
nativeName: "Svenska",
|
|
101
|
+
englishName: "Swedish",
|
|
102
|
+
flag: "🇸🇪",
|
|
103
|
+
dir: "ltr"
|
|
104
|
+
},
|
|
105
|
+
ru: {
|
|
106
|
+
code: "ru",
|
|
107
|
+
nativeName: "Русский",
|
|
108
|
+
englishName: "Russian",
|
|
109
|
+
flag: "🇷🇺",
|
|
110
|
+
dir: "ltr"
|
|
111
|
+
},
|
|
112
|
+
el: {
|
|
113
|
+
code: "el",
|
|
114
|
+
nativeName: "Ελληνικά",
|
|
115
|
+
englishName: "Greek",
|
|
116
|
+
flag: "🇬🇷",
|
|
117
|
+
dir: "ltr"
|
|
118
|
+
},
|
|
119
|
+
ja: {
|
|
120
|
+
code: "ja",
|
|
121
|
+
nativeName: "日本語",
|
|
122
|
+
englishName: "Japanese",
|
|
123
|
+
flag: "🇯🇵",
|
|
124
|
+
dir: "ltr"
|
|
125
|
+
},
|
|
126
|
+
zh: {
|
|
127
|
+
code: "zh",
|
|
128
|
+
nativeName: "中文",
|
|
129
|
+
englishName: "Chinese",
|
|
130
|
+
flag: "🇨🇳",
|
|
131
|
+
dir: "ltr"
|
|
132
|
+
},
|
|
133
|
+
hi: {
|
|
134
|
+
code: "hi",
|
|
135
|
+
nativeName: "हिन्दी",
|
|
136
|
+
englishName: "Hindi",
|
|
137
|
+
flag: "🇮🇳",
|
|
138
|
+
dir: "ltr"
|
|
139
|
+
}
|
|
140
|
+
}, $ = O.map(
|
|
141
|
+
(e) => P[e]
|
|
142
|
+
), Q = {
|
|
143
|
+
id: "locale-picker",
|
|
144
|
+
capabilities: ["view_change"],
|
|
145
|
+
state: {},
|
|
146
|
+
actions: {
|
|
147
|
+
set_locale: {
|
|
148
|
+
safety: "write",
|
|
149
|
+
argsType: "{ locale: string }",
|
|
150
|
+
descriptionKey: "ui.agent.localePicker.actions.setLocale",
|
|
151
|
+
description: "Switch the active locale to the given IETF tag.",
|
|
152
|
+
invoke: (e, a) => {
|
|
153
|
+
e.setLocale(a.locale);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
domHooks: {
|
|
158
|
+
root: {
|
|
159
|
+
attr: "data-component",
|
|
160
|
+
value: "locale-picker",
|
|
161
|
+
description: "Marks the LocalePicker wrapper."
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}, y = "alfadocs-ui.locale";
|
|
165
|
+
let A = !1;
|
|
166
|
+
function u(e) {
|
|
167
|
+
return typeof e == "string" && O.includes(e);
|
|
168
|
+
}
|
|
169
|
+
function X(e) {
|
|
170
|
+
if (typeof window > "u") return null;
|
|
171
|
+
try {
|
|
172
|
+
return window.localStorage.getItem(e);
|
|
173
|
+
} catch {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function C(e, a) {
|
|
178
|
+
if (!(typeof window > "u"))
|
|
179
|
+
try {
|
|
180
|
+
window.localStorage.setItem(e, a);
|
|
181
|
+
} catch {
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function Z() {
|
|
185
|
+
if (typeof navigator > "u") return "en";
|
|
186
|
+
const e = navigator.language;
|
|
187
|
+
if (!e) return "en";
|
|
188
|
+
const a = e.toLowerCase().split("-")[0];
|
|
189
|
+
return u(a) ? a : "en";
|
|
190
|
+
}
|
|
191
|
+
function x(e) {
|
|
192
|
+
if (typeof document > "u") return;
|
|
193
|
+
const a = document.documentElement;
|
|
194
|
+
a.lang = e, a.dir = P[e].dir;
|
|
195
|
+
}
|
|
196
|
+
function V() {
|
|
197
|
+
const { locale: e, setLocale: a } = J(), d = u(e) ? e : "en", o = I(
|
|
198
|
+
(s) => {
|
|
199
|
+
u(s) && (a(s), x(s), C(y, s));
|
|
200
|
+
},
|
|
201
|
+
[a]
|
|
202
|
+
);
|
|
203
|
+
return M(() => {
|
|
204
|
+
if (A) return;
|
|
205
|
+
A = !0;
|
|
206
|
+
const s = X(y);
|
|
207
|
+
if (u(s)) {
|
|
208
|
+
s !== e && a(s), x(s);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const n = Z();
|
|
212
|
+
a(n), x(n), C(y, n);
|
|
213
|
+
}, []), { locale: d, setLocale: o };
|
|
214
|
+
}
|
|
215
|
+
const F = _("ds:inline-flex ds:items-center", {
|
|
216
|
+
variants: {
|
|
217
|
+
variant: {
|
|
218
|
+
icon: "",
|
|
219
|
+
compact: ""
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
defaultVariants: { variant: "icon" }
|
|
223
|
+
}), ee = [
|
|
224
|
+
"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
225
|
+
"ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-sm)]",
|
|
226
|
+
"ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]",
|
|
227
|
+
"ds:bg-transparent ds:text-foreground",
|
|
228
|
+
"ds:hover:bg-muted",
|
|
229
|
+
"ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
|
|
230
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
|
|
231
|
+
"ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
232
|
+
"ds:disabled:opacity-50 ds:disabled:cursor-not-allowed",
|
|
233
|
+
"type-body-sm"
|
|
234
|
+
].join(" "), G = [
|
|
235
|
+
"ds:w-[18rem] ds:rounded-[var(--radius-md)]",
|
|
236
|
+
"ds:bg-background ds:text-foreground ds:border ds:border-border",
|
|
237
|
+
"ds:shadow-[var(--shadow-lg)]",
|
|
238
|
+
"ds:overflow-hidden"
|
|
239
|
+
].join(" "), ae = _("ds:flex ds:flex-col", {
|
|
240
|
+
variants: {
|
|
241
|
+
loading: {
|
|
242
|
+
true: "ds:opacity-60 ds:pointer-events-none",
|
|
243
|
+
false: ""
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
defaultVariants: { loading: !1 }
|
|
247
|
+
}), S = z(
|
|
248
|
+
({
|
|
249
|
+
value: e,
|
|
250
|
+
onValueChange: a,
|
|
251
|
+
inputId: d,
|
|
252
|
+
disabled: o = !1,
|
|
253
|
+
loading: s = !1,
|
|
254
|
+
className: n
|
|
255
|
+
}, l) => {
|
|
256
|
+
const { t: r } = j(), h = V(), L = e ?? h.locale, v = B(), k = d ?? `${v}-search`, [w, g] = D(""), N = I(
|
|
257
|
+
(i) => {
|
|
258
|
+
!u(i) || o || s || (a ? a(i) : h.setLocale(i));
|
|
259
|
+
},
|
|
260
|
+
[o, s, a, h]
|
|
261
|
+
);
|
|
262
|
+
return /* @__PURE__ */ t(
|
|
263
|
+
"div",
|
|
264
|
+
{
|
|
265
|
+
ref: l,
|
|
266
|
+
className: [ae({ loading: s }), n].filter(Boolean).join(" "),
|
|
267
|
+
"data-component": "locale-picker-search-list",
|
|
268
|
+
children: /* @__PURE__ */ m(
|
|
269
|
+
b,
|
|
270
|
+
{
|
|
271
|
+
label: r("navigation.localePicker.commandLabel"),
|
|
272
|
+
filter: K,
|
|
273
|
+
shouldFilter: !0,
|
|
274
|
+
children: [
|
|
275
|
+
/* @__PURE__ */ m(
|
|
276
|
+
"div",
|
|
277
|
+
{
|
|
278
|
+
className: [
|
|
279
|
+
"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
280
|
+
"ds:border-b ds:border-border ds:px-[var(--spacing-sm)]",
|
|
281
|
+
"ds:py-[var(--spacing-xs)]"
|
|
282
|
+
].join(" "),
|
|
283
|
+
children: [
|
|
284
|
+
/* @__PURE__ */ t(
|
|
285
|
+
E,
|
|
286
|
+
{
|
|
287
|
+
"aria-hidden": "true",
|
|
288
|
+
className: "ds:size-4 ds:text-muted-foreground ds:shrink-0"
|
|
289
|
+
}
|
|
290
|
+
),
|
|
291
|
+
/* @__PURE__ */ t(
|
|
292
|
+
b.Input,
|
|
293
|
+
{
|
|
294
|
+
id: k,
|
|
295
|
+
value: w,
|
|
296
|
+
onValueChange: g,
|
|
297
|
+
placeholder: r("navigation.localePicker.searchPlaceholder"),
|
|
298
|
+
"aria-label": r("navigation.localePicker.searchLabel"),
|
|
299
|
+
disabled: o || s,
|
|
300
|
+
className: [
|
|
301
|
+
"ds:flex-1 ds:bg-transparent ds:border-0 ds:outline-none",
|
|
302
|
+
"ds:placeholder:text-muted-foreground ds:text-foreground",
|
|
303
|
+
"type-body-sm"
|
|
304
|
+
].join(" ")
|
|
305
|
+
}
|
|
306
|
+
)
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
),
|
|
310
|
+
/* @__PURE__ */ m(
|
|
311
|
+
b.List,
|
|
312
|
+
{
|
|
313
|
+
className: [
|
|
314
|
+
"ds:max-h-[18rem] ds:overflow-y-auto",
|
|
315
|
+
"ds:p-[var(--spacing-xs)]"
|
|
316
|
+
].join(" "),
|
|
317
|
+
children: [
|
|
318
|
+
/* @__PURE__ */ t(
|
|
319
|
+
b.Empty,
|
|
320
|
+
{
|
|
321
|
+
className: [
|
|
322
|
+
"ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-sm)]",
|
|
323
|
+
"type-body-sm ds:text-muted-foreground"
|
|
324
|
+
].join(" "),
|
|
325
|
+
children: r("navigation.localePicker.empty")
|
|
326
|
+
}
|
|
327
|
+
),
|
|
328
|
+
$.map((i) => {
|
|
329
|
+
const f = i.code === L;
|
|
330
|
+
return /* @__PURE__ */ m(
|
|
331
|
+
b.Item,
|
|
332
|
+
{
|
|
333
|
+
value: i.code,
|
|
334
|
+
keywords: [i.nativeName, i.englishName],
|
|
335
|
+
disabled: o || s,
|
|
336
|
+
onSelect: N,
|
|
337
|
+
className: [
|
|
338
|
+
"ds:relative ds:flex ds:cursor-pointer ds:select-none",
|
|
339
|
+
"ds:items-center ds:gap-[var(--spacing-sm)]",
|
|
340
|
+
"ds:rounded-[var(--radius-sm)]",
|
|
341
|
+
"ds:min-h-[var(--min-target-size)]",
|
|
342
|
+
"ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]",
|
|
343
|
+
"ds:text-foreground ds:outline-none",
|
|
344
|
+
"ds:data-[highlighted]:bg-muted",
|
|
345
|
+
"ds:aria-selected:bg-muted",
|
|
346
|
+
"ds:aria-disabled:opacity-50 ds:aria-disabled:cursor-not-allowed"
|
|
347
|
+
].join(" "),
|
|
348
|
+
"aria-selected": f || void 0,
|
|
349
|
+
"data-current": f ? "true" : void 0,
|
|
350
|
+
lang: i.code,
|
|
351
|
+
dir: i.dir,
|
|
352
|
+
children: [
|
|
353
|
+
/* @__PURE__ */ t("span", { "aria-hidden": "true", className: "ds:text-base ds:shrink-0", children: i.flag }),
|
|
354
|
+
/* @__PURE__ */ t("span", { className: "ds:flex-1 ds:min-w-0 ds:truncate type-body-sm", children: i.nativeName }),
|
|
355
|
+
f ? /* @__PURE__ */ t(
|
|
356
|
+
Y,
|
|
357
|
+
{
|
|
358
|
+
"aria-hidden": "true",
|
|
359
|
+
className: "ds:size-4 ds:text-primary ds:shrink-0"
|
|
360
|
+
}
|
|
361
|
+
) : null,
|
|
362
|
+
f ? /* @__PURE__ */ t("span", { className: "ds:sr-only", children: r("navigation.localePicker.currentSelection") }) : null
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
i.code
|
|
366
|
+
);
|
|
367
|
+
})
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
)
|
|
374
|
+
}
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
);
|
|
378
|
+
S.displayName = "LocalePicker.SearchList";
|
|
379
|
+
function se({
|
|
380
|
+
state: e,
|
|
381
|
+
rest: a,
|
|
382
|
+
forwardedRef: d,
|
|
383
|
+
className: o,
|
|
384
|
+
disabled: s,
|
|
385
|
+
loading: n
|
|
386
|
+
}) {
|
|
387
|
+
const { t: l } = j(), r = P[e.locale];
|
|
388
|
+
return /* @__PURE__ */ t(
|
|
389
|
+
"div",
|
|
390
|
+
{
|
|
391
|
+
ref: d,
|
|
392
|
+
"data-component": "locale-picker",
|
|
393
|
+
"data-component-id": a.id,
|
|
394
|
+
className: F({ variant: "icon", className: o }),
|
|
395
|
+
...a,
|
|
396
|
+
children: /* @__PURE__ */ m(p.Root, { children: [
|
|
397
|
+
/* @__PURE__ */ t(p.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
398
|
+
W,
|
|
399
|
+
{
|
|
400
|
+
disabled: s || n,
|
|
401
|
+
icon: /* @__PURE__ */ m("span", { className: "ds:relative ds:inline-flex ds:items-center ds:justify-center", children: [
|
|
402
|
+
/* @__PURE__ */ t(E, { "aria-hidden": !0, className: "ds:size-5" }),
|
|
403
|
+
/* @__PURE__ */ t(
|
|
404
|
+
"span",
|
|
405
|
+
{
|
|
406
|
+
"aria-hidden": "true",
|
|
407
|
+
className: [
|
|
408
|
+
"ds:absolute ds:bottom-[-2px] ds:end-[-4px]",
|
|
409
|
+
"ds:text-[length:var(--font-size-xs)] ds:leading-none",
|
|
410
|
+
"ds:bg-background ds:rounded-full ds:px-0.5"
|
|
411
|
+
].join(" "),
|
|
412
|
+
children: r.flag
|
|
413
|
+
}
|
|
414
|
+
)
|
|
415
|
+
] }),
|
|
416
|
+
"aria-label": l("navigation.localePicker.trigger", {
|
|
417
|
+
locale: r.nativeName
|
|
418
|
+
})
|
|
419
|
+
}
|
|
420
|
+
) }),
|
|
421
|
+
/* @__PURE__ */ t(
|
|
422
|
+
p.Content,
|
|
423
|
+
{
|
|
424
|
+
align: "end",
|
|
425
|
+
sideOffset: 8,
|
|
426
|
+
className: G,
|
|
427
|
+
"aria-label": l("navigation.localePicker.popupLabel"),
|
|
428
|
+
children: /* @__PURE__ */ t(
|
|
429
|
+
S,
|
|
430
|
+
{
|
|
431
|
+
value: e.locale,
|
|
432
|
+
onValueChange: e.setLocale,
|
|
433
|
+
disabled: s,
|
|
434
|
+
loading: n
|
|
435
|
+
}
|
|
436
|
+
)
|
|
437
|
+
}
|
|
438
|
+
)
|
|
439
|
+
] })
|
|
440
|
+
}
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
function te({
|
|
444
|
+
state: e,
|
|
445
|
+
rest: a,
|
|
446
|
+
forwardedRef: d,
|
|
447
|
+
className: o,
|
|
448
|
+
disabled: s,
|
|
449
|
+
loading: n
|
|
450
|
+
}) {
|
|
451
|
+
const { t: l } = j(), r = P[e.locale];
|
|
452
|
+
return /* @__PURE__ */ t(
|
|
453
|
+
"div",
|
|
454
|
+
{
|
|
455
|
+
ref: d,
|
|
456
|
+
"data-component": "locale-picker",
|
|
457
|
+
"data-component-id": a.id,
|
|
458
|
+
className: F({ variant: "compact", className: o }),
|
|
459
|
+
...a,
|
|
460
|
+
children: /* @__PURE__ */ m(p.Root, { children: [
|
|
461
|
+
/* @__PURE__ */ t(p.Trigger, { asChild: !0, children: /* @__PURE__ */ m(
|
|
462
|
+
"button",
|
|
463
|
+
{
|
|
464
|
+
type: "button",
|
|
465
|
+
disabled: s || n,
|
|
466
|
+
className: ee,
|
|
467
|
+
"aria-label": l("navigation.localePicker.trigger", {
|
|
468
|
+
locale: r.nativeName
|
|
469
|
+
}),
|
|
470
|
+
children: [
|
|
471
|
+
/* @__PURE__ */ t(E, { "aria-hidden": !0, className: "ds:size-4 ds:shrink-0" }),
|
|
472
|
+
/* @__PURE__ */ t(
|
|
473
|
+
"span",
|
|
474
|
+
{
|
|
475
|
+
className: "ds:flex-1 ds:truncate type-body-sm",
|
|
476
|
+
lang: r.code,
|
|
477
|
+
children: r.nativeName
|
|
478
|
+
}
|
|
479
|
+
)
|
|
480
|
+
]
|
|
481
|
+
}
|
|
482
|
+
) }),
|
|
483
|
+
/* @__PURE__ */ t(
|
|
484
|
+
p.Content,
|
|
485
|
+
{
|
|
486
|
+
align: "end",
|
|
487
|
+
sideOffset: 8,
|
|
488
|
+
className: G,
|
|
489
|
+
"aria-label": l("navigation.localePicker.popupLabel"),
|
|
490
|
+
children: /* @__PURE__ */ t(
|
|
491
|
+
S,
|
|
492
|
+
{
|
|
493
|
+
value: e.locale,
|
|
494
|
+
onValueChange: e.setLocale,
|
|
495
|
+
disabled: s,
|
|
496
|
+
loading: n
|
|
497
|
+
}
|
|
498
|
+
)
|
|
499
|
+
}
|
|
500
|
+
)
|
|
501
|
+
] })
|
|
502
|
+
}
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
const H = z(
|
|
506
|
+
(e, a) => {
|
|
507
|
+
const {
|
|
508
|
+
variant: d = "icon",
|
|
509
|
+
value: o,
|
|
510
|
+
onValueChange: s,
|
|
511
|
+
disabled: n = !1,
|
|
512
|
+
loading: l = !1,
|
|
513
|
+
className: r,
|
|
514
|
+
id: h,
|
|
515
|
+
...L
|
|
516
|
+
} = e, v = V(), k = o ?? v.locale, w = I(
|
|
517
|
+
(c) => {
|
|
518
|
+
if (u(c)) {
|
|
519
|
+
if (s) {
|
|
520
|
+
s(c), x(c), C(y, c);
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
v.setLocale(c);
|
|
524
|
+
}
|
|
525
|
+
},
|
|
526
|
+
[s, v]
|
|
527
|
+
), g = R(
|
|
528
|
+
() => ({ locale: k, setLocale: w }),
|
|
529
|
+
[k, w]
|
|
530
|
+
), N = T(null);
|
|
531
|
+
q(a, () => N.current, []);
|
|
532
|
+
const i = T(g);
|
|
533
|
+
i.current = g;
|
|
534
|
+
const f = R(
|
|
535
|
+
() => ({
|
|
536
|
+
setLocale: (c) => {
|
|
537
|
+
u(c) && i.current.setLocale(c);
|
|
538
|
+
}
|
|
539
|
+
}),
|
|
540
|
+
[]
|
|
541
|
+
);
|
|
542
|
+
return U(Q, f, h), d === "compact" ? /* @__PURE__ */ t(
|
|
543
|
+
te,
|
|
544
|
+
{
|
|
545
|
+
state: g,
|
|
546
|
+
rest: L,
|
|
547
|
+
forwardedRef: N,
|
|
548
|
+
className: r,
|
|
549
|
+
disabled: n,
|
|
550
|
+
loading: l
|
|
551
|
+
}
|
|
552
|
+
) : /* @__PURE__ */ t(
|
|
553
|
+
se,
|
|
554
|
+
{
|
|
555
|
+
state: g,
|
|
556
|
+
rest: L,
|
|
557
|
+
forwardedRef: N,
|
|
558
|
+
className: r,
|
|
559
|
+
disabled: n,
|
|
560
|
+
loading: l
|
|
561
|
+
}
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
);
|
|
565
|
+
H.displayName = "LocalePicker";
|
|
566
|
+
const he = Object.assign(H, {
|
|
567
|
+
SearchList: S
|
|
568
|
+
});
|
|
569
|
+
export {
|
|
570
|
+
y as L,
|
|
571
|
+
he as a,
|
|
572
|
+
S as b,
|
|
573
|
+
P as c
|
|
574
|
+
};
|
|
575
|
+
//# sourceMappingURL=locale-picker-CYBhgSHR.js.map
|