@babelize/elements 1.1.2 → 1.1.4
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/README.md +32 -0
- package/dist/cli/index.js +20 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +323 -264
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -16
- package/dist/index.d.ts +0 -16
- package/dist/index.js +274 -229
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +35 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +5 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +10 -0
- package/dist/utils.js.map +1 -0
- package/package.json +19 -5
package/dist/index.cjs
CHANGED
|
@@ -1,43 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
});
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
18
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
30
|
|
|
26
|
-
|
|
31
|
+
// src/registry/components/index.ts
|
|
32
|
+
var components_exports = {};
|
|
33
|
+
__export(components_exports, {
|
|
34
|
+
COUNTRIES: () => COUNTRIES,
|
|
35
|
+
LanguageSwitcher: () => LanguageSwitcher,
|
|
36
|
+
NavBar: () => NavBar,
|
|
37
|
+
PhoneInput: () => PhoneInput,
|
|
38
|
+
cn: () => cn
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(components_exports);
|
|
27
41
|
|
|
28
42
|
// src/lib/utils.ts
|
|
43
|
+
var import_clsx = require("clsx");
|
|
44
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
29
45
|
function cn(...inputs) {
|
|
30
|
-
return
|
|
46
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
31
47
|
}
|
|
48
|
+
|
|
49
|
+
// src/registry/components/language-switcher.tsx
|
|
50
|
+
var React2 = __toESM(require("react"), 1);
|
|
51
|
+
|
|
52
|
+
// src/lib/use-controllable-state.ts
|
|
53
|
+
var React = __toESM(require("react"), 1);
|
|
32
54
|
function useControllableState(value, defaultValue, onChange) {
|
|
33
55
|
const isControlled = value !== void 0;
|
|
34
|
-
const [uncontrolled, setUncontrolled] =
|
|
35
|
-
const onChangeRef =
|
|
36
|
-
|
|
56
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultValue);
|
|
57
|
+
const onChangeRef = React.useRef(onChange);
|
|
58
|
+
React.useEffect(() => {
|
|
37
59
|
onChangeRef.current = onChange;
|
|
38
60
|
}, [onChange]);
|
|
39
61
|
const current = isControlled ? value : uncontrolled;
|
|
40
|
-
const setValue =
|
|
62
|
+
const setValue = React.useCallback(
|
|
41
63
|
(next) => {
|
|
42
64
|
var _a;
|
|
43
65
|
if (!isControlled) setUncontrolled(next);
|
|
@@ -47,6 +69,9 @@ function useControllableState(value, defaultValue, onChange) {
|
|
|
47
69
|
);
|
|
48
70
|
return [current, setValue];
|
|
49
71
|
}
|
|
72
|
+
|
|
73
|
+
// src/registry/components/language-switcher.tsx
|
|
74
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
50
75
|
var RTL_LOCALES = /* @__PURE__ */ new Set(["ar", "he", "fa", "ur", "ps", "sd", "yi"]);
|
|
51
76
|
function isRtl(code) {
|
|
52
77
|
const lang = code.split("-")[0].toLowerCase();
|
|
@@ -247,7 +272,7 @@ function getLabel(code, mode) {
|
|
|
247
272
|
if (!names) return code;
|
|
248
273
|
return mode === "native" ? names[0] : names[1];
|
|
249
274
|
}
|
|
250
|
-
var LanguageSwitcher =
|
|
275
|
+
var LanguageSwitcher = React2.forwardRef(
|
|
251
276
|
function LanguageSwitcher2({
|
|
252
277
|
locales,
|
|
253
278
|
value,
|
|
@@ -264,11 +289,11 @@ var LanguageSwitcher = React3__namespace.forwardRef(
|
|
|
264
289
|
(_b = defaultValue != null ? defaultValue : (_a = locales[0]) == null ? void 0 : _a.code) != null ? _b : "",
|
|
265
290
|
onValueChange
|
|
266
291
|
);
|
|
267
|
-
const [open, setOpen] =
|
|
268
|
-
const [search, setSearch] =
|
|
269
|
-
const ref =
|
|
270
|
-
const inputRef =
|
|
271
|
-
|
|
292
|
+
const [open, setOpen] = React2.useState(false);
|
|
293
|
+
const [search, setSearch] = React2.useState("");
|
|
294
|
+
const ref = React2.useRef(null);
|
|
295
|
+
const inputRef = React2.useRef(null);
|
|
296
|
+
React2.useImperativeHandle(forwardedRef, () => ref.current);
|
|
272
297
|
const resolveLabel = (l) => {
|
|
273
298
|
var _a2;
|
|
274
299
|
return (_a2 = l.label) != null ? _a2 : getLabel(l.code, labelMode);
|
|
@@ -278,7 +303,7 @@ var LanguageSwitcher = React3__namespace.forwardRef(
|
|
|
278
303
|
(l) => resolveLabel(l).toLowerCase().includes(search.toLowerCase()) || l.code.toLowerCase().includes(search.toLowerCase())
|
|
279
304
|
);
|
|
280
305
|
const dir = isRtl(locale) ? "rtl" : "ltr";
|
|
281
|
-
|
|
306
|
+
React2.useEffect(() => {
|
|
282
307
|
function handleClickOutside(e) {
|
|
283
308
|
if (ref.current && !ref.current.contains(e.target)) {
|
|
284
309
|
setOpen(false);
|
|
@@ -288,11 +313,11 @@ var LanguageSwitcher = React3__namespace.forwardRef(
|
|
|
288
313
|
document.addEventListener("mousedown", handleClickOutside);
|
|
289
314
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
290
315
|
}, []);
|
|
291
|
-
|
|
316
|
+
React2.useEffect(() => {
|
|
292
317
|
var _a2;
|
|
293
318
|
if (open) (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
294
319
|
}, [open]);
|
|
295
|
-
|
|
320
|
+
React2.useEffect(() => {
|
|
296
321
|
function handleKeyDown(e) {
|
|
297
322
|
if (e.key === "Escape") {
|
|
298
323
|
setOpen(false);
|
|
@@ -304,106 +329,118 @@ var LanguageSwitcher = React3__namespace.forwardRef(
|
|
|
304
329
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
305
330
|
}
|
|
306
331
|
}, [open]);
|
|
307
|
-
return /* @__PURE__ */
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
"
|
|
325
|
-
{
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
)
|
|
330
|
-
|
|
331
|
-
viewBox: "0 0 24 24",
|
|
332
|
-
stroke: "currentColor",
|
|
333
|
-
strokeWidth: 2,
|
|
334
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
335
|
-
}
|
|
336
|
-
)
|
|
337
|
-
]
|
|
338
|
-
}
|
|
339
|
-
),
|
|
340
|
-
open && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
341
|
-
"div",
|
|
342
|
-
{
|
|
343
|
-
className: "absolute z-50 mt-1 min-w-[200px] overflow-hidden rounded-xl border border-zinc-200 bg-white shadow-xl dark:border-zinc-800 dark:bg-zinc-950",
|
|
344
|
-
role: "listbox",
|
|
345
|
-
"aria-label": "Select language",
|
|
346
|
-
children: [
|
|
347
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-zinc-200 p-2 dark:border-zinc-800", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
348
|
-
"input",
|
|
349
|
-
{
|
|
350
|
-
ref: inputRef,
|
|
351
|
-
type: "text",
|
|
352
|
-
placeholder: "Search...",
|
|
353
|
-
value: search,
|
|
354
|
-
onChange: (e) => setSearch(e.target.value),
|
|
355
|
-
className: "w-full rounded-lg bg-zinc-100 px-3 py-1.5 text-sm text-zinc-900 outline-none placeholder:text-zinc-400 focus:ring-1 focus:ring-emerald-500/50 dark:bg-zinc-800 dark:text-zinc-100 dark:placeholder:text-zinc-500"
|
|
356
|
-
}
|
|
357
|
-
) }),
|
|
358
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-h-60 overflow-y-auto p-1", children: [
|
|
359
|
-
filtered.map((l) => {
|
|
360
|
-
var _a2;
|
|
361
|
-
const isActive = l.code === locale;
|
|
362
|
-
const itemDir = l.rtl || isRtl(l.code) ? "rtl" : "ltr";
|
|
363
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
364
|
-
"button",
|
|
332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
333
|
+
"div",
|
|
334
|
+
{
|
|
335
|
+
ref,
|
|
336
|
+
dir,
|
|
337
|
+
className: cn("relative inline-block text-sm z-50", className),
|
|
338
|
+
...rest,
|
|
339
|
+
children: [
|
|
340
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
341
|
+
"button",
|
|
342
|
+
{
|
|
343
|
+
type: "button",
|
|
344
|
+
onClick: () => setOpen(!open),
|
|
345
|
+
className: cn(
|
|
346
|
+
"inline-flex items-center gap-2 rounded-lg border border-zinc-200 bg-zinc-100 px-3 py-2 text-sm font-medium text-zinc-900 transition-colors hover:bg-zinc-100 hover:text-zinc-900 focus:outline-none focus:ring-2 focus:ring-emerald-500/50 dark:border-zinc-800 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700 dark:hover:text-zinc-50"
|
|
347
|
+
),
|
|
348
|
+
"aria-expanded": open,
|
|
349
|
+
"aria-haspopup": "listbox",
|
|
350
|
+
"aria-label": `Current language: ${activeLocale ? resolveLabel(activeLocale) : locale}`,
|
|
351
|
+
children: [
|
|
352
|
+
showFlags && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-base", children: (_c = activeLocale == null ? void 0 : activeLocale.flag) != null ? _c : getFlag(locale) }),
|
|
353
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: activeLocale ? resolveLabel(activeLocale) : locale }),
|
|
354
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
355
|
+
"svg",
|
|
365
356
|
{
|
|
366
|
-
type: "button",
|
|
367
|
-
role: "option",
|
|
368
|
-
"aria-selected": isActive,
|
|
369
|
-
dir: itemDir,
|
|
370
|
-
onClick: () => {
|
|
371
|
-
setLocale(l.code);
|
|
372
|
-
setOpen(false);
|
|
373
|
-
setSearch("");
|
|
374
|
-
},
|
|
375
357
|
className: cn(
|
|
376
|
-
"
|
|
377
|
-
|
|
378
|
-
isActive ? "bg-emerald-500/10 text-emerald-600 font-medium dark:text-emerald-400" : "text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-100"
|
|
358
|
+
"size-4 text-zinc-500 transition-transform dark:text-zinc-400",
|
|
359
|
+
open && "rotate-180"
|
|
379
360
|
),
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
)
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
361
|
+
fill: "none",
|
|
362
|
+
viewBox: "0 0 24 24",
|
|
363
|
+
stroke: "currentColor",
|
|
364
|
+
strokeWidth: 2,
|
|
365
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
),
|
|
371
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
372
|
+
"div",
|
|
373
|
+
{
|
|
374
|
+
className: "absolute z-50 mt-1 min-w-[200px] overflow-hidden rounded-xl border border-zinc-200 bg-white shadow-xl dark:border-zinc-800 dark:bg-zinc-950",
|
|
375
|
+
role: "listbox",
|
|
376
|
+
"aria-label": "Select language",
|
|
377
|
+
children: [
|
|
378
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "border-b border-zinc-200 p-2 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
379
|
+
"input",
|
|
380
|
+
{
|
|
381
|
+
ref: inputRef,
|
|
382
|
+
type: "text",
|
|
383
|
+
placeholder: "Search...",
|
|
384
|
+
"aria-label": "Search languages",
|
|
385
|
+
value: search,
|
|
386
|
+
onChange: (e) => setSearch(e.target.value),
|
|
387
|
+
className: "w-full rounded-lg bg-zinc-100 px-3 py-1.5 text-sm text-zinc-900 outline-none placeholder:text-zinc-400 focus:ring-1 focus:ring-emerald-500/50 dark:bg-zinc-800 dark:text-zinc-100 dark:placeholder:text-zinc-500"
|
|
388
|
+
}
|
|
389
|
+
) }),
|
|
390
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "max-h-60 overflow-y-auto p-1", children: [
|
|
391
|
+
filtered.map((l) => {
|
|
392
|
+
var _a2;
|
|
393
|
+
const isActive = l.code === locale;
|
|
394
|
+
const itemDir = l.rtl || isRtl(l.code) ? "rtl" : "ltr";
|
|
395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
396
|
+
"button",
|
|
397
|
+
{
|
|
398
|
+
type: "button",
|
|
399
|
+
role: "option",
|
|
400
|
+
"aria-selected": isActive,
|
|
401
|
+
dir: itemDir,
|
|
402
|
+
onClick: () => {
|
|
403
|
+
setLocale(l.code);
|
|
404
|
+
setOpen(false);
|
|
405
|
+
setSearch("");
|
|
406
|
+
},
|
|
407
|
+
className: cn(
|
|
408
|
+
"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-start text-sm transition-colors",
|
|
409
|
+
isActive ? "bg-emerald-500/10 text-emerald-600 font-medium dark:text-emerald-400" : "text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-100"
|
|
410
|
+
),
|
|
411
|
+
children: [
|
|
412
|
+
showFlags && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-base", children: (_a2 = l.flag) != null ? _a2 : getFlag(l.code) }),
|
|
413
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "flex-1", children: resolveLabel(l) }),
|
|
414
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
415
|
+
"svg",
|
|
416
|
+
{
|
|
417
|
+
className: "size-4 text-emerald-600 dark:text-emerald-400",
|
|
418
|
+
fill: "none",
|
|
419
|
+
viewBox: "0 0 24 24",
|
|
420
|
+
stroke: "currentColor",
|
|
421
|
+
strokeWidth: 2,
|
|
422
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
|
|
423
|
+
}
|
|
424
|
+
)
|
|
425
|
+
]
|
|
426
|
+
},
|
|
427
|
+
l.code
|
|
428
|
+
);
|
|
429
|
+
}),
|
|
430
|
+
filtered.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "px-3 py-2 text-sm text-zinc-500 dark:text-zinc-400", children: "No results" })
|
|
431
|
+
] })
|
|
432
|
+
]
|
|
433
|
+
}
|
|
434
|
+
)
|
|
435
|
+
]
|
|
436
|
+
}
|
|
437
|
+
);
|
|
405
438
|
}
|
|
406
439
|
);
|
|
440
|
+
|
|
441
|
+
// src/registry/components/phone-input.tsx
|
|
442
|
+
var React3 = __toESM(require("react"), 1);
|
|
443
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
407
444
|
var COUNTRIES = [
|
|
408
445
|
{ code: "US", dialCode: "+1", name: "United States", flag: "\u{1F1FA}\u{1F1F8}" },
|
|
409
446
|
{ code: "GB", dialCode: "+44", name: "United Kingdom", flag: "\u{1F1EC}\u{1F1E7}" },
|
|
@@ -459,39 +496,35 @@ var COUNTRIES = [
|
|
|
459
496
|
function getCountryByCode(code) {
|
|
460
497
|
return COUNTRIES.find((c) => c.code === code.toUpperCase());
|
|
461
498
|
}
|
|
462
|
-
var PhoneInput =
|
|
499
|
+
var PhoneInput = React3.forwardRef(function PhoneInput2({
|
|
463
500
|
value,
|
|
464
501
|
defaultValue,
|
|
465
502
|
onValueChange,
|
|
466
|
-
onChange,
|
|
467
503
|
defaultCountry = "US",
|
|
468
504
|
placeholder = "Phone number",
|
|
469
505
|
disabled = false,
|
|
470
506
|
className,
|
|
471
|
-
showFlags,
|
|
472
|
-
showFlag,
|
|
507
|
+
showFlags = true,
|
|
473
508
|
label = "Phone number",
|
|
474
509
|
...rest
|
|
475
510
|
}, forwardedRef) {
|
|
476
|
-
|
|
477
|
-
const flagsVisible = (_a = showFlags != null ? showFlags : showFlag) != null ? _a : true;
|
|
478
|
-
const [selectedCountry, setSelectedCountry] = React3__namespace.useState(
|
|
511
|
+
const [selectedCountry, setSelectedCountry] = React3.useState(
|
|
479
512
|
() => {
|
|
480
|
-
var
|
|
481
|
-
return (
|
|
513
|
+
var _a;
|
|
514
|
+
return (_a = getCountryByCode(defaultCountry)) != null ? _a : COUNTRIES[0];
|
|
482
515
|
}
|
|
483
516
|
);
|
|
484
|
-
const notify = onValueChange != null ? onValueChange : onChange;
|
|
485
517
|
const [inputValue, setInputValue] = useControllableState(value, defaultValue != null ? defaultValue : "", void 0);
|
|
486
|
-
const [open, setOpen] =
|
|
487
|
-
const [search, setSearch] =
|
|
488
|
-
const ref =
|
|
489
|
-
const inputRef =
|
|
490
|
-
|
|
518
|
+
const [open, setOpen] = React3.useState(false);
|
|
519
|
+
const [search, setSearch] = React3.useState("");
|
|
520
|
+
const ref = React3.useRef(null);
|
|
521
|
+
const inputRef = React3.useRef(null);
|
|
522
|
+
const searchRef = React3.useRef(null);
|
|
523
|
+
React3.useImperativeHandle(forwardedRef, () => inputRef.current);
|
|
491
524
|
const filtered = COUNTRIES.filter(
|
|
492
525
|
(c) => c.name.toLowerCase().includes(search.toLowerCase()) || c.dialCode.includes(search) || c.code.toLowerCase().includes(search.toLowerCase())
|
|
493
526
|
);
|
|
494
|
-
|
|
527
|
+
React3.useEffect(() => {
|
|
495
528
|
function handleClickOutside(e) {
|
|
496
529
|
if (ref.current && !ref.current.contains(e.target)) {
|
|
497
530
|
setOpen(false);
|
|
@@ -501,11 +534,11 @@ var PhoneInput = React3__namespace.forwardRef(function PhoneInput2({
|
|
|
501
534
|
document.addEventListener("mousedown", handleClickOutside);
|
|
502
535
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
503
536
|
}, []);
|
|
504
|
-
|
|
505
|
-
var
|
|
506
|
-
if (open) (
|
|
537
|
+
React3.useEffect(() => {
|
|
538
|
+
var _a;
|
|
539
|
+
if (open) (_a = searchRef.current) == null ? void 0 : _a.focus();
|
|
507
540
|
}, [open]);
|
|
508
|
-
|
|
541
|
+
React3.useEffect(() => {
|
|
509
542
|
function handleKeyDown(e) {
|
|
510
543
|
if (e.key === "Escape") {
|
|
511
544
|
setOpen(false);
|
|
@@ -518,20 +551,20 @@ var PhoneInput = React3__namespace.forwardRef(function PhoneInput2({
|
|
|
518
551
|
}
|
|
519
552
|
}, [open]);
|
|
520
553
|
const handleCountrySelect = (country) => {
|
|
521
|
-
var
|
|
554
|
+
var _a;
|
|
522
555
|
setSelectedCountry(country);
|
|
523
556
|
setOpen(false);
|
|
524
557
|
setSearch("");
|
|
525
|
-
|
|
526
|
-
(
|
|
558
|
+
onValueChange == null ? void 0 : onValueChange(inputValue, country);
|
|
559
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
527
560
|
};
|
|
528
561
|
const handleInputChange = (e) => {
|
|
529
562
|
const newValue = e.target.value;
|
|
530
563
|
setInputValue(newValue);
|
|
531
|
-
|
|
564
|
+
onValueChange == null ? void 0 : onValueChange(newValue, selectedCountry);
|
|
532
565
|
};
|
|
533
|
-
return /* @__PURE__ */
|
|
534
|
-
/* @__PURE__ */
|
|
566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref, className: cn("relative inline-block text-sm", className), children: [
|
|
567
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
535
568
|
"div",
|
|
536
569
|
{
|
|
537
570
|
className: cn(
|
|
@@ -540,7 +573,7 @@ var PhoneInput = React3__namespace.forwardRef(function PhoneInput2({
|
|
|
540
573
|
disabled && "opacity-50 cursor-not-allowed"
|
|
541
574
|
),
|
|
542
575
|
children: [
|
|
543
|
-
/* @__PURE__ */
|
|
576
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
544
577
|
"button",
|
|
545
578
|
{
|
|
546
579
|
type: "button",
|
|
@@ -555,9 +588,9 @@ var PhoneInput = React3__namespace.forwardRef(function PhoneInput2({
|
|
|
555
588
|
"aria-expanded": open,
|
|
556
589
|
"aria-haspopup": "listbox",
|
|
557
590
|
children: [
|
|
558
|
-
|
|
559
|
-
/* @__PURE__ */
|
|
560
|
-
/* @__PURE__ */
|
|
591
|
+
showFlags && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-base leading-none", children: selectedCountry.flag }),
|
|
592
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "font-mono text-xs", children: selectedCountry.dialCode }),
|
|
593
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
561
594
|
"svg",
|
|
562
595
|
{
|
|
563
596
|
className: cn(
|
|
@@ -568,13 +601,13 @@ var PhoneInput = React3__namespace.forwardRef(function PhoneInput2({
|
|
|
568
601
|
viewBox: "0 0 24 24",
|
|
569
602
|
stroke: "currentColor",
|
|
570
603
|
strokeWidth: 2,
|
|
571
|
-
children: /* @__PURE__ */
|
|
604
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
572
605
|
}
|
|
573
606
|
)
|
|
574
607
|
]
|
|
575
608
|
}
|
|
576
609
|
),
|
|
577
|
-
/* @__PURE__ */
|
|
610
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
578
611
|
"input",
|
|
579
612
|
{
|
|
580
613
|
ref: inputRef,
|
|
@@ -596,28 +629,29 @@ var PhoneInput = React3__namespace.forwardRef(function PhoneInput2({
|
|
|
596
629
|
]
|
|
597
630
|
}
|
|
598
631
|
),
|
|
599
|
-
open && /* @__PURE__ */
|
|
632
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
600
633
|
"div",
|
|
601
634
|
{
|
|
602
635
|
className: "absolute z-50 mt-1 min-w-[280px] overflow-hidden rounded-xl border border-zinc-200 bg-white shadow-xl dark:border-zinc-800 dark:bg-zinc-950",
|
|
603
636
|
role: "listbox",
|
|
604
637
|
"aria-label": "Select country",
|
|
605
638
|
children: [
|
|
606
|
-
/* @__PURE__ */
|
|
639
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "border-b border-zinc-200 p-2 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
607
640
|
"input",
|
|
608
641
|
{
|
|
609
|
-
ref:
|
|
642
|
+
ref: searchRef,
|
|
610
643
|
type: "text",
|
|
611
644
|
placeholder: "Search countries...",
|
|
645
|
+
"aria-label": "Search countries",
|
|
612
646
|
value: search,
|
|
613
647
|
onChange: (e) => setSearch(e.target.value),
|
|
614
648
|
className: "w-full rounded-lg bg-zinc-100 px-3 py-1.5 text-sm text-zinc-900 outline-none placeholder:text-zinc-400 focus:ring-1 focus:ring-emerald-500/50 dark:bg-zinc-800 dark:text-zinc-100 dark:placeholder:text-zinc-500"
|
|
615
649
|
}
|
|
616
650
|
) }),
|
|
617
|
-
/* @__PURE__ */
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "max-h-60 overflow-y-auto p-1", children: [
|
|
618
652
|
filtered.map((country) => {
|
|
619
653
|
const isActive = country.code === selectedCountry.code;
|
|
620
|
-
return /* @__PURE__ */
|
|
654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
621
655
|
"button",
|
|
622
656
|
{
|
|
623
657
|
type: "button",
|
|
@@ -629,10 +663,10 @@ var PhoneInput = React3__namespace.forwardRef(function PhoneInput2({
|
|
|
629
663
|
isActive ? "bg-emerald-500/10 text-emerald-600 font-medium dark:text-emerald-400" : "text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-100"
|
|
630
664
|
),
|
|
631
665
|
children: [
|
|
632
|
-
/* @__PURE__ */
|
|
633
|
-
/* @__PURE__ */
|
|
634
|
-
/* @__PURE__ */
|
|
635
|
-
isActive && /* @__PURE__ */
|
|
666
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-base leading-none", children: country.flag }),
|
|
667
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "flex-1", children: country.name }),
|
|
668
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "font-mono text-xs text-zinc-500 dark:text-zinc-400", children: country.dialCode }),
|
|
669
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
636
670
|
"svg",
|
|
637
671
|
{
|
|
638
672
|
className: "size-4 text-emerald-600 dark:text-emerald-400",
|
|
@@ -640,7 +674,7 @@ var PhoneInput = React3__namespace.forwardRef(function PhoneInput2({
|
|
|
640
674
|
viewBox: "0 0 24 24",
|
|
641
675
|
stroke: "currentColor",
|
|
642
676
|
strokeWidth: 2,
|
|
643
|
-
children: /* @__PURE__ */
|
|
677
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
|
|
644
678
|
}
|
|
645
679
|
)
|
|
646
680
|
]
|
|
@@ -648,13 +682,17 @@ var PhoneInput = React3__namespace.forwardRef(function PhoneInput2({
|
|
|
648
682
|
country.code
|
|
649
683
|
);
|
|
650
684
|
}),
|
|
651
|
-
filtered.length === 0 && /* @__PURE__ */
|
|
685
|
+
filtered.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "px-3 py-2 text-sm text-zinc-500 dark:text-zinc-400", children: "No countries found" })
|
|
652
686
|
] })
|
|
653
687
|
]
|
|
654
688
|
}
|
|
655
689
|
)
|
|
656
690
|
] });
|
|
657
691
|
});
|
|
692
|
+
|
|
693
|
+
// src/registry/components/navbar.tsx
|
|
694
|
+
var React4 = __toESM(require("react"), 1);
|
|
695
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
658
696
|
var LOCALE_MAP = {
|
|
659
697
|
en: { label: "English", flag: "\u{1F1FA}\u{1F1F8}" },
|
|
660
698
|
fr: { label: "Fran\xE7ais", flag: "\u{1F1EB}\u{1F1F7}" },
|
|
@@ -705,15 +743,13 @@ function getLocaleInfo(code) {
|
|
|
705
743
|
var _a;
|
|
706
744
|
return (_a = LOCALE_MAP[code]) != null ? _a : { label: code.toUpperCase(), flag: "\u{1F310}" };
|
|
707
745
|
}
|
|
708
|
-
var NavBar =
|
|
746
|
+
var NavBar = React4.forwardRef(function NavBar2({
|
|
709
747
|
logo,
|
|
710
748
|
links = [],
|
|
711
749
|
locales = [],
|
|
712
750
|
value,
|
|
713
751
|
defaultValue,
|
|
714
752
|
onValueChange,
|
|
715
|
-
currentLocale,
|
|
716
|
-
onLocaleChange,
|
|
717
753
|
cta,
|
|
718
754
|
showGitHub = false,
|
|
719
755
|
githubUrl = "https://github.com/babelize/babelize-elements",
|
|
@@ -723,75 +759,85 @@ var NavBar = React3__namespace.forwardRef(function NavBar2({
|
|
|
723
759
|
linkComponent: Link = "a",
|
|
724
760
|
...rest
|
|
725
761
|
}, forwardedRef) {
|
|
762
|
+
var _a, _b;
|
|
726
763
|
const [locale, setLocale] = useControllableState(
|
|
727
|
-
value
|
|
728
|
-
defaultValue != null ? defaultValue : "en",
|
|
729
|
-
onValueChange
|
|
764
|
+
value,
|
|
765
|
+
(_b = defaultValue != null ? defaultValue : (_a = locales[0]) == null ? void 0 : _a.code) != null ? _b : "en",
|
|
766
|
+
onValueChange
|
|
730
767
|
);
|
|
731
|
-
const [mobileOpen, setMobileOpen] =
|
|
732
|
-
const [langOpen, setLangOpen] =
|
|
733
|
-
const langRef =
|
|
734
|
-
const mobileLangRef =
|
|
768
|
+
const [mobileOpen, setMobileOpen] = React4.useState(false);
|
|
769
|
+
const [langOpen, setLangOpen] = React4.useState(null);
|
|
770
|
+
const langRef = React4.useRef(null);
|
|
771
|
+
const mobileLangRef = React4.useRef(null);
|
|
772
|
+
const menuId = React4.useId();
|
|
735
773
|
const currentLocaleInfo = getLocaleInfo(locale);
|
|
736
|
-
|
|
774
|
+
React4.useEffect(() => {
|
|
737
775
|
function handleClickOutside(e) {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
776
|
+
var _a2, _b2;
|
|
777
|
+
const target = e.target;
|
|
778
|
+
if (((_a2 = langRef.current) == null ? void 0 : _a2.contains(target)) || ((_b2 = mobileLangRef.current) == null ? void 0 : _b2.contains(target))) return;
|
|
779
|
+
setLangOpen(null);
|
|
741
780
|
}
|
|
742
781
|
document.addEventListener("mousedown", handleClickOutside);
|
|
743
782
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
744
783
|
}, []);
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
784
|
+
React4.useEffect(() => {
|
|
785
|
+
function handleKeyDown(e) {
|
|
786
|
+
if (e.key !== "Escape") return;
|
|
787
|
+
setLangOpen(null);
|
|
788
|
+
setMobileOpen(false);
|
|
750
789
|
}
|
|
790
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
791
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
792
|
+
}, []);
|
|
793
|
+
React4.useEffect(() => {
|
|
794
|
+
if (!mobileOpen) return;
|
|
795
|
+
const previous = document.body.style.overflow;
|
|
796
|
+
document.body.style.overflow = "hidden";
|
|
751
797
|
return () => {
|
|
752
|
-
document.body.style.overflow =
|
|
798
|
+
document.body.style.overflow = previous;
|
|
753
799
|
};
|
|
754
800
|
}, [mobileOpen]);
|
|
755
|
-
const langButton = /* @__PURE__ */
|
|
801
|
+
const langButton = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
756
802
|
"button",
|
|
757
803
|
{
|
|
758
804
|
type: "button",
|
|
759
|
-
onClick: () => setLangOpen(
|
|
805
|
+
onClick: () => setLangOpen(langOpen === "desktop" ? null : "desktop"),
|
|
760
806
|
className: "flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-sm font-medium text-zinc-500 transition-colors hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-50",
|
|
761
|
-
"aria-expanded": langOpen,
|
|
807
|
+
"aria-expanded": langOpen === "desktop",
|
|
762
808
|
"aria-haspopup": "listbox",
|
|
763
809
|
"aria-label": `Current language: ${currentLocaleInfo.label}`,
|
|
764
810
|
children: [
|
|
765
|
-
showFlags && /* @__PURE__ */
|
|
766
|
-
/* @__PURE__ */
|
|
767
|
-
/* @__PURE__ */
|
|
811
|
+
showFlags && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-sm leading-none", children: currentLocaleInfo.flag }),
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "hidden sm:inline", children: currentLocaleInfo.label }),
|
|
813
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
768
814
|
"svg",
|
|
769
815
|
{
|
|
770
816
|
className: cn(
|
|
771
817
|
"size-3 text-zinc-500 transition-transform dark:text-zinc-400",
|
|
772
|
-
langOpen && "rotate-180"
|
|
818
|
+
langOpen === "desktop" && "rotate-180"
|
|
773
819
|
),
|
|
774
820
|
fill: "none",
|
|
775
821
|
viewBox: "0 0 24 24",
|
|
776
822
|
stroke: "currentColor",
|
|
777
823
|
strokeWidth: 2,
|
|
778
|
-
children: /* @__PURE__ */
|
|
824
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
779
825
|
}
|
|
780
826
|
)
|
|
781
827
|
]
|
|
782
828
|
}
|
|
783
829
|
);
|
|
784
|
-
const langDropdown = /* @__PURE__ */
|
|
830
|
+
const langDropdown = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
785
831
|
"div",
|
|
786
832
|
{
|
|
787
833
|
className: "absolute right-0 top-full z-50 mt-1.5 min-w-[170px] rounded-xl border border-zinc-200 bg-white py-1.5 shadow-xl dark:border-zinc-800 dark:bg-zinc-950",
|
|
788
834
|
role: "listbox",
|
|
789
835
|
"aria-label": "Select language",
|
|
790
836
|
children: locales.map((item) => {
|
|
791
|
-
var
|
|
837
|
+
var _a2;
|
|
792
838
|
const info = getLocaleInfo(item.code);
|
|
793
839
|
const isActive = item.code === locale;
|
|
794
|
-
return /* @__PURE__ */
|
|
840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
795
841
|
"button",
|
|
796
842
|
{
|
|
797
843
|
type: "button",
|
|
@@ -799,16 +845,16 @@ var NavBar = React3__namespace.forwardRef(function NavBar2({
|
|
|
799
845
|
"aria-selected": isActive,
|
|
800
846
|
onClick: () => {
|
|
801
847
|
setLocale(item.code);
|
|
802
|
-
setLangOpen(
|
|
848
|
+
setLangOpen(null);
|
|
803
849
|
},
|
|
804
850
|
className: cn(
|
|
805
|
-
"flex w-
|
|
851
|
+
"mx-1.5 flex w-[calc(100%-12px)] items-center gap-2.5 rounded-lg px-3 py-2 text-sm transition-colors",
|
|
806
852
|
isActive ? "bg-emerald-500/10 text-emerald-600 font-medium dark:text-emerald-400" : "text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-100"
|
|
807
853
|
),
|
|
808
854
|
children: [
|
|
809
|
-
showFlags && /* @__PURE__ */
|
|
810
|
-
/* @__PURE__ */
|
|
811
|
-
isActive && /* @__PURE__ */
|
|
855
|
+
showFlags && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-base leading-none", children: info.flag }),
|
|
856
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "flex-1", children: (_a2 = item.label) != null ? _a2 : info.label }),
|
|
857
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
812
858
|
"svg",
|
|
813
859
|
{
|
|
814
860
|
className: "size-4 shrink-0 text-emerald-600 dark:text-emerald-400",
|
|
@@ -816,7 +862,7 @@ var NavBar = React3__namespace.forwardRef(function NavBar2({
|
|
|
816
862
|
viewBox: "0 0 24 24",
|
|
817
863
|
stroke: "currentColor",
|
|
818
864
|
strokeWidth: 2.5,
|
|
819
|
-
children: /* @__PURE__ */
|
|
865
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
|
|
820
866
|
}
|
|
821
867
|
)
|
|
822
868
|
]
|
|
@@ -826,7 +872,7 @@ var NavBar = React3__namespace.forwardRef(function NavBar2({
|
|
|
826
872
|
})
|
|
827
873
|
}
|
|
828
874
|
);
|
|
829
|
-
return /* @__PURE__ */
|
|
875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
830
876
|
"nav",
|
|
831
877
|
{
|
|
832
878
|
ref: forwardedRef,
|
|
@@ -837,9 +883,9 @@ var NavBar = React3__namespace.forwardRef(function NavBar2({
|
|
|
837
883
|
className
|
|
838
884
|
),
|
|
839
885
|
children: [
|
|
840
|
-
/* @__PURE__ */
|
|
841
|
-
logo && /* @__PURE__ */
|
|
842
|
-
/* @__PURE__ */
|
|
886
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mx-auto hidden max-w-6xl items-center justify-between px-5 py-3 md:flex", children: [
|
|
887
|
+
logo && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex-shrink-0", children: logo }),
|
|
888
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex items-center gap-1", children: links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
843
889
|
Link,
|
|
844
890
|
{
|
|
845
891
|
href: link.href,
|
|
@@ -848,12 +894,12 @@ var NavBar = React3__namespace.forwardRef(function NavBar2({
|
|
|
848
894
|
},
|
|
849
895
|
link.href
|
|
850
896
|
)) }),
|
|
851
|
-
/* @__PURE__ */
|
|
852
|
-
locales.length > 0 && /* @__PURE__ */
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
898
|
+
locales.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref: langRef, className: "relative", children: [
|
|
853
899
|
langButton,
|
|
854
|
-
langOpen && langDropdown
|
|
900
|
+
langOpen === "desktop" && langDropdown
|
|
855
901
|
] }),
|
|
856
|
-
showGitHub && /* @__PURE__ */
|
|
902
|
+
showGitHub && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
857
903
|
"a",
|
|
858
904
|
{
|
|
859
905
|
href: githubUrl,
|
|
@@ -861,10 +907,10 @@ var NavBar = React3__namespace.forwardRef(function NavBar2({
|
|
|
861
907
|
rel: "noopener noreferrer",
|
|
862
908
|
className: "inline-flex size-8 items-center justify-center rounded-md transition-colors no-underline text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-50",
|
|
863
909
|
"aria-label": "GitHub",
|
|
864
|
-
children: /* @__PURE__ */
|
|
910
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" }) })
|
|
865
911
|
}
|
|
866
912
|
),
|
|
867
|
-
cta && /* @__PURE__ */
|
|
913
|
+
cta && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
868
914
|
Link,
|
|
869
915
|
{
|
|
870
916
|
href: cta.href,
|
|
@@ -874,29 +920,34 @@ var NavBar = React3__namespace.forwardRef(function NavBar2({
|
|
|
874
920
|
)
|
|
875
921
|
] })
|
|
876
922
|
] }),
|
|
877
|
-
/* @__PURE__ */
|
|
878
|
-
logo && /* @__PURE__ */
|
|
879
|
-
/* @__PURE__ */
|
|
880
|
-
locales.length > 0 && /* @__PURE__ */
|
|
881
|
-
/* @__PURE__ */
|
|
923
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center justify-between px-4 py-3 md:hidden", children: [
|
|
924
|
+
logo && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex-shrink-0", children: logo }),
|
|
925
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
926
|
+
locales.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref: mobileLangRef, className: "relative", children: [
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
882
928
|
"button",
|
|
883
929
|
{
|
|
884
930
|
type: "button",
|
|
885
|
-
onClick: () => setLangOpen(
|
|
931
|
+
onClick: () => setLangOpen(langOpen === "mobile" ? null : "mobile"),
|
|
886
932
|
className: "inline-flex size-8 items-center justify-center rounded-md transition-colors text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-50",
|
|
933
|
+
"aria-expanded": langOpen === "mobile",
|
|
934
|
+
"aria-haspopup": "listbox",
|
|
887
935
|
"aria-label": `Current language: ${currentLocaleInfo.label}`,
|
|
888
|
-
children: showFlags && /* @__PURE__ */
|
|
936
|
+
children: showFlags && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-base leading-none", children: currentLocaleInfo.flag })
|
|
889
937
|
}
|
|
890
938
|
),
|
|
891
|
-
langOpen && langDropdown
|
|
939
|
+
langOpen === "mobile" && langDropdown
|
|
892
940
|
] }),
|
|
893
|
-
/* @__PURE__ */
|
|
941
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
894
942
|
"button",
|
|
895
943
|
{
|
|
944
|
+
type: "button",
|
|
896
945
|
className: "inline-flex size-8 items-center justify-center rounded-md transition-colors text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-50",
|
|
897
946
|
onClick: () => setMobileOpen(!mobileOpen),
|
|
898
947
|
"aria-label": "Toggle menu",
|
|
899
|
-
|
|
948
|
+
"aria-expanded": mobileOpen,
|
|
949
|
+
"aria-controls": mobileOpen ? menuId : void 0,
|
|
950
|
+
children: mobileOpen ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
900
951
|
"svg",
|
|
901
952
|
{
|
|
902
953
|
className: "size-4",
|
|
@@ -904,9 +955,9 @@ var NavBar = React3__namespace.forwardRef(function NavBar2({
|
|
|
904
955
|
viewBox: "0 0 24 24",
|
|
905
956
|
stroke: "currentColor",
|
|
906
957
|
strokeWidth: 2,
|
|
907
|
-
children: /* @__PURE__ */
|
|
958
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
908
959
|
}
|
|
909
|
-
) : /* @__PURE__ */
|
|
960
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
910
961
|
"svg",
|
|
911
962
|
{
|
|
912
963
|
className: "size-4",
|
|
@@ -914,43 +965,51 @@ var NavBar = React3__namespace.forwardRef(function NavBar2({
|
|
|
914
965
|
viewBox: "0 0 24 24",
|
|
915
966
|
stroke: "currentColor",
|
|
916
967
|
strokeWidth: 2,
|
|
917
|
-
children: /* @__PURE__ */
|
|
968
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 6h16M4 12h16M4 18h16" })
|
|
918
969
|
}
|
|
919
970
|
)
|
|
920
971
|
}
|
|
921
972
|
)
|
|
922
973
|
] })
|
|
923
974
|
] }),
|
|
924
|
-
mobileOpen && /* @__PURE__ */
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
975
|
+
mobileOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
976
|
+
"div",
|
|
977
|
+
{
|
|
978
|
+
id: menuId,
|
|
979
|
+
className: "border-t border-zinc-200 bg-white px-4 py-3 md:hidden dark:border-zinc-800 dark:bg-zinc-900",
|
|
980
|
+
children: [
|
|
981
|
+
links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
982
|
+
Link,
|
|
983
|
+
{
|
|
984
|
+
href: link.href,
|
|
985
|
+
onClick: () => setMobileOpen(false),
|
|
986
|
+
className: "block py-2.5 text-sm transition-colors no-underline text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-50",
|
|
987
|
+
children: link.label
|
|
988
|
+
},
|
|
989
|
+
link.href
|
|
990
|
+
)),
|
|
991
|
+
cta && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
992
|
+
Link,
|
|
993
|
+
{
|
|
994
|
+
href: cta.href,
|
|
995
|
+
onClick: () => setMobileOpen(false),
|
|
996
|
+
className: "mt-2 block rounded-md px-3.5 py-2 text-center text-sm font-medium transition-colors no-underline bg-emerald-500 text-white hover:opacity-90",
|
|
997
|
+
children: cta.label
|
|
998
|
+
}
|
|
999
|
+
)
|
|
1000
|
+
]
|
|
1001
|
+
}
|
|
1002
|
+
)
|
|
945
1003
|
]
|
|
946
1004
|
}
|
|
947
1005
|
);
|
|
948
1006
|
});
|
|
949
|
-
|
|
950
|
-
exports
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
1007
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1008
|
+
0 && (module.exports = {
|
|
1009
|
+
COUNTRIES,
|
|
1010
|
+
LanguageSwitcher,
|
|
1011
|
+
NavBar,
|
|
1012
|
+
PhoneInput,
|
|
1013
|
+
cn
|
|
1014
|
+
});
|
|
956
1015
|
//# sourceMappingURL=index.cjs.map
|