@yenio-pld/blocks 1.2.0-rc.13 → 1.2.0-rc.14

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/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var React3 = require('react');
4
+ var React5 = require('react');
5
5
  var skeleton_js = require('./ui/skeleton.js');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var lucideReact = require('lucide-react');
@@ -24,6 +24,7 @@ var combobox_js = require('./ui/combobox.js');
24
24
  var dialog_js = require('./ui/dialog.js');
25
25
  var drawer_js = require('./ui/drawer.js');
26
26
  var input_js = require('./ui/input.js');
27
+ var libphonenumberJs = require('libphonenumber-js');
27
28
  var slider_js = require('./ui/slider.js');
28
29
  var toggle_js = require('./ui/toggle.js');
29
30
  var framerMotion = require('framer-motion');
@@ -47,11 +48,11 @@ function _interopNamespace(e) {
47
48
  return Object.freeze(n);
48
49
  }
49
50
 
50
- var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
51
+ var React5__namespace = /*#__PURE__*/_interopNamespace(React5);
51
52
 
52
- var LanguageContext = React3.createContext(null);
53
+ var LanguageContext = React5.createContext(null);
53
54
  function useLanguageContext() {
54
- return React3.useContext(LanguageContext);
55
+ return React5.useContext(LanguageContext);
55
56
  }
56
57
  function PageTitle({
57
58
  title,
@@ -295,8 +296,8 @@ function renderShellLink({
295
296
  }
296
297
  function DismissMobileSidebar({ pathname }) {
297
298
  const { setOpenMobile } = sidebar_js.useSidebar();
298
- const previous = React3.useRef(pathname);
299
- React3.useEffect(() => {
299
+ const previous = React5.useRef(pathname);
300
+ React5.useEffect(() => {
300
301
  if (previous.current === pathname) return;
301
302
  previous.current = pathname;
302
303
  setOpenMobile(false);
@@ -485,7 +486,7 @@ function NavTabs({
485
486
  "aria-current": active ? "page" : void 0,
486
487
  children: label2
487
488
  });
488
- return React3.cloneElement(link, { key: tab.href });
489
+ return React5.cloneElement(link, { key: tab.href });
489
490
  })
490
491
  }
491
492
  );
@@ -685,14 +686,14 @@ function LoadMoreControls({
685
686
  pending,
686
687
  onLoadMore
687
688
  }) {
688
- const sentinelRef = React3.useRef(null);
689
- const pendingRef = React3.useRef(pending);
690
- const onLoadMoreRef = React3.useRef(onLoadMore);
691
- const armedRef = React3.useRef(true);
692
- const wasPendingRef = React3.useRef(false);
689
+ const sentinelRef = React5.useRef(null);
690
+ const pendingRef = React5.useRef(pending);
691
+ const onLoadMoreRef = React5.useRef(onLoadMore);
692
+ const armedRef = React5.useRef(true);
693
+ const wasPendingRef = React5.useRef(false);
693
694
  pendingRef.current = pending;
694
695
  onLoadMoreRef.current = onLoadMore;
695
- React3.useEffect(() => {
696
+ React5.useEffect(() => {
696
697
  const node = sentinelRef.current;
697
698
  if (!node || typeof IntersectionObserver === "undefined") return;
698
699
  function maybeLoad() {
@@ -710,7 +711,7 @@ function LoadMoreControls({
710
711
  observer.observe(node);
711
712
  return () => observer.disconnect();
712
713
  }, []);
713
- React3.useEffect(() => {
714
+ React5.useEffect(() => {
714
715
  if (pending) {
715
716
  wasPendingRef.current = true;
716
717
  return;
@@ -850,15 +851,15 @@ function NavigationProgress({
850
851
  ariaLabel = "Loading",
851
852
  forceVisible = false
852
853
  }) {
853
- const [visible, setVisible] = React3.useState(forceVisible);
854
- const [runId, setRunId] = React3.useState(0);
855
- const startedAt = React3.useRef(0);
856
- const startedRoute = React3.useRef(null);
857
- const committedRoute = React3.useRef(null);
858
- React3.useEffect(() => {
854
+ const [visible, setVisible] = React5.useState(forceVisible);
855
+ const [runId, setRunId] = React5.useState(0);
856
+ const startedAt = React5.useRef(0);
857
+ const startedRoute = React5.useRef(null);
858
+ const committedRoute = React5.useRef(null);
859
+ React5.useEffect(() => {
859
860
  committedRoute.current = routeKey(pathname, search);
860
861
  }, [pathname, search]);
861
- React3.useEffect(() => {
862
+ React5.useEffect(() => {
862
863
  if (forceVisible) return;
863
864
  function begin(route) {
864
865
  if (navigationSuppressed) return;
@@ -895,12 +896,12 @@ function NavigationProgress({
895
896
  window.removeEventListener("popstate", onPopState);
896
897
  };
897
898
  }, [forceVisible, pathname, search]);
898
- React3.useEffect(() => {
899
+ React5.useEffect(() => {
899
900
  if (forceVisible || !visible) return;
900
901
  const safety = window.setTimeout(() => setVisible(false), SAFETY_MS);
901
902
  return () => window.clearTimeout(safety);
902
903
  }, [forceVisible, runId, visible]);
903
- React3.useEffect(() => {
904
+ React5.useEffect(() => {
904
905
  if (forceVisible || !visible) return;
905
906
  const started = startedRoute.current;
906
907
  if (!started) return;
@@ -1383,20 +1384,20 @@ function useEditableSection({
1383
1384
  ...DEFAULT_EDITABLE_SECTION_LABELS,
1384
1385
  ...labels
1385
1386
  };
1386
- const [mode, setMode] = React3.useState("reading");
1387
- const [status, setStatus] = React3.useState(null);
1388
- const [confirmOpen, setConfirmOpen] = React3.useState(false);
1389
- const [minHeightPx, setMinHeightPx] = React3.useState(void 0);
1390
- const contentRef = React3.useRef(null);
1391
- const editButtonRef = React3.useRef(null);
1392
- const measuredHeightRef = React3.useRef(0);
1393
- const shouldFocusEditRef = React3.useRef(false);
1394
- const shouldFocusFirstFieldRef = React3.useRef(false);
1395
- const editButtonId = React3.useId();
1396
- const contentFormId = React3.useId();
1387
+ const [mode, setMode] = React5.useState("reading");
1388
+ const [status, setStatus] = React5.useState(null);
1389
+ const [confirmOpen, setConfirmOpen] = React5.useState(false);
1390
+ const [minHeightPx, setMinHeightPx] = React5.useState(void 0);
1391
+ const contentRef = React5.useRef(null);
1392
+ const editButtonRef = React5.useRef(null);
1393
+ const measuredHeightRef = React5.useRef(0);
1394
+ const shouldFocusEditRef = React5.useRef(false);
1395
+ const shouldFocusFirstFieldRef = React5.useRef(false);
1396
+ const editButtonId = React5.useId();
1397
+ const contentFormId = React5.useId();
1397
1398
  const isEditing = mode === "editing" || mode === "saving";
1398
1399
  const isSaving = mode === "saving";
1399
- React3.useEffect(() => {
1400
+ React5.useEffect(() => {
1400
1401
  if (mode === "reading" && shouldFocusEditRef.current) {
1401
1402
  shouldFocusEditRef.current = false;
1402
1403
  editButtonRef.current?.focus();
@@ -1414,18 +1415,18 @@ function useEditableSection({
1414
1415
  focusFirstField(contentRef.current);
1415
1416
  }
1416
1417
  }, [mode]);
1417
- const exitToReading = React3.useCallback(() => {
1418
+ const exitToReading = React5.useCallback(() => {
1418
1419
  setConfirmOpen(false);
1419
1420
  shouldFocusEditRef.current = true;
1420
1421
  setMode("reading");
1421
1422
  onDiscard?.();
1422
1423
  }, [onDiscard]);
1423
- const startEdit = React3.useCallback(() => {
1424
+ const startEdit = React5.useCallback(() => {
1424
1425
  setStatus(null);
1425
1426
  shouldFocusFirstFieldRef.current = true;
1426
1427
  setMode("editing");
1427
1428
  }, []);
1428
- const requestCancel = React3.useCallback(() => {
1429
+ const requestCancel = React5.useCallback(() => {
1429
1430
  if (isSaving) return;
1430
1431
  if (isDirty) {
1431
1432
  setConfirmOpen(true);
@@ -1433,7 +1434,7 @@ function useEditableSection({
1433
1434
  }
1434
1435
  exitToReading();
1435
1436
  }, [exitToReading, isDirty, isSaving]);
1436
- const handleSubmit = React3.useCallback(
1437
+ const handleSubmit = React5.useCallback(
1437
1438
  (event) => {
1438
1439
  event.preventDefault();
1439
1440
  if (isSaving) return;
@@ -1453,7 +1454,7 @@ function useEditableSection({
1453
1454
  },
1454
1455
  [isSaving, onSave, resolvedLabels.saved]
1455
1456
  );
1456
- const handleFormKeyDown = React3.useCallback(
1457
+ const handleFormKeyDown = React5.useCallback(
1457
1458
  (event) => {
1458
1459
  if (event.key !== "Escape") return;
1459
1460
  event.preventDefault();
@@ -1461,7 +1462,7 @@ function useEditableSection({
1461
1462
  },
1462
1463
  [requestCancel]
1463
1464
  );
1464
- React3.useEffect(() => {
1465
+ React5.useEffect(() => {
1465
1466
  if (!stableHeight || !isEditing) return;
1466
1467
  const el = contentRef.current;
1467
1468
  if (!el) return;
@@ -1707,16 +1708,16 @@ function SafeImage({
1707
1708
  className,
1708
1709
  ...imgProps
1709
1710
  }) {
1710
- const [failed, setFailed] = React3.useState(false);
1711
- const [loaded, setLoaded] = React3.useState(false);
1712
- const imgRef = React3.useRef(null);
1711
+ const [failed, setFailed] = React5.useState(false);
1712
+ const [loaded, setLoaded] = React5.useState(false);
1713
+ const imgRef = React5.useRef(null);
1713
1714
  const resolvedSrc = typeof src === "string" && src.length > 0 ? src : null;
1714
1715
  const resolvedBlur = resolveBlurDataUrl(blurDataUrl);
1715
- React3.useLayoutEffect(() => {
1716
+ React5.useLayoutEffect(() => {
1716
1717
  setFailed(false);
1717
1718
  setLoaded(false);
1718
1719
  }, [resolvedSrc]);
1719
- React3.useLayoutEffect(() => {
1720
+ React5.useLayoutEffect(() => {
1720
1721
  const img = imgRef.current;
1721
1722
  if (!img) return;
1722
1723
  if (isBrokenImage(img)) {
@@ -1826,17 +1827,17 @@ function ThemeSwitcher({
1826
1827
  labels: userLabels
1827
1828
  }) {
1828
1829
  const { theme, setTheme } = nextThemes.useTheme();
1829
- const [mounted, setMounted] = React3.useState(false);
1830
+ const [mounted, setMounted] = React5.useState(false);
1830
1831
  const sizes = sizeClasses[size];
1831
1832
  const shapeClass = shapeClasses[shape];
1832
1833
  const labels = { ...defaultLabels, ...userLabels };
1833
- const handleThemeClick = React3.useCallback(
1834
+ const handleThemeClick = React5.useCallback(
1834
1835
  (themeKey) => {
1835
1836
  setTheme(themeKey);
1836
1837
  },
1837
1838
  [setTheme]
1838
1839
  );
1839
- React3.useEffect(() => {
1840
+ React5.useEffect(() => {
1840
1841
  setMounted(true);
1841
1842
  }, []);
1842
1843
  if (!mounted) {
@@ -3085,8 +3086,8 @@ function CountryPicker({
3085
3086
  "aria-invalid": ariaInvalid
3086
3087
  }) {
3087
3088
  const labels = { ...defaultLabels2(purpose, locale), ...labelsProp };
3088
- const items = React3__namespace.useMemo(() => countryPickerItems(locale), [locale]);
3089
- const selected = React3__namespace.useMemo(() => findItem(items, value), [items, value]);
3089
+ const items = React5__namespace.useMemo(() => countryPickerItems(locale), [locale]);
3090
+ const selected = React5__namespace.useMemo(() => findItem(items, value), [items, value]);
3090
3091
  const dialogPortalContainer = dialog_js.useDialogPortalContainer();
3091
3092
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3092
3093
  name ? /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name, value: value.trim().toUpperCase() }) : null,
@@ -3187,8 +3188,8 @@ function CountryPicker({
3187
3188
  ] });
3188
3189
  }
3189
3190
  function useMediaQuery(query) {
3190
- const [matches, setMatches] = React3.useState(false);
3191
- React3.useEffect(() => {
3191
+ const [matches, setMatches] = React5.useState(false);
3192
+ React5.useEffect(() => {
3192
3193
  if (typeof window === "undefined" || !window.matchMedia) return;
3193
3194
  const mql = window.matchMedia(query);
3194
3195
  const onChange = () => setMatches(mql.matches);
@@ -3242,21 +3243,21 @@ function SearchablePicker({
3242
3243
  }) {
3243
3244
  const isMdUp = useMediaQuery(MD_UP);
3244
3245
  const dialogPortalContainer = dialog_js.useDialogPortalContainer();
3245
- const [open, setOpen] = React3__namespace.useState(false);
3246
- const searchRef = React3__namespace.useRef(null);
3246
+ const [open, setOpen] = React5__namespace.useState(false);
3247
+ const searchRef = React5__namespace.useRef(null);
3247
3248
  function setOpenState(next) {
3248
3249
  setOpen(next);
3249
3250
  onOpenChange?.(next);
3250
3251
  if (!next) onQueryChange("");
3251
3252
  }
3252
- const selected = React3__namespace.useMemo(() => {
3253
+ const selected = React5__namespace.useMemo(() => {
3253
3254
  if (!value) return null;
3254
3255
  return options.find((option) => option.id === value) ?? {
3255
3256
  id: value,
3256
3257
  label: selectedLabel || value
3257
3258
  };
3258
3259
  }, [options, selectedLabel, value]);
3259
- React3__namespace.useEffect(() => {
3260
+ React5__namespace.useEffect(() => {
3260
3261
  if (!open || isMdUp) return;
3261
3262
  const handle = window.setTimeout(() => searchRef.current?.focus(), 0);
3262
3263
  return () => window.clearTimeout(handle);
@@ -3577,18 +3578,18 @@ function PaginatedCombobox({
3577
3578
  }) {
3578
3579
  const labels = { ...DEFAULT_LABELS, ...labelsProp };
3579
3580
  const dialogPortalContainer = dialog_js.useDialogPortalContainer();
3580
- const selected = React3__namespace.useMemo(
3581
+ const selected = React5__namespace.useMemo(
3581
3582
  () => resolveSelected(value, items, selectedItem),
3582
3583
  [value, items, selectedItem]
3583
3584
  );
3584
- const listItems = React3__namespace.useMemo(() => {
3585
+ const listItems = React5__namespace.useMemo(() => {
3585
3586
  if (!selected) return items;
3586
3587
  if (items.some((item) => item.value === selected.value)) return items;
3587
3588
  return [selected, ...items];
3588
3589
  }, [items, selected]);
3589
- const queryRef = React3__namespace.useRef("");
3590
- const debounceRef = React3__namespace.useRef(null);
3591
- React3__namespace.useEffect(() => {
3590
+ const queryRef = React5__namespace.useRef("");
3591
+ const debounceRef = React5__namespace.useRef(null);
3592
+ React5__namespace.useEffect(() => {
3592
3593
  return () => {
3593
3594
  if (debounceRef.current) clearTimeout(debounceRef.current);
3594
3595
  };
@@ -3861,7 +3862,7 @@ function PasswordInput({
3861
3862
  hideLabel = "Hide password",
3862
3863
  ...props
3863
3864
  }) {
3864
- const [visible, setVisible] = React3__namespace.useState(false);
3865
+ const [visible, setVisible] = React5__namespace.useState(false);
3865
3866
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full", children: [
3866
3867
  /* @__PURE__ */ jsxRuntime.jsx(
3867
3868
  input_js.Input,
@@ -3888,6 +3889,345 @@ function PasswordInput({
3888
3889
  )
3889
3890
  ] });
3890
3891
  }
3892
+ var MD_UP2 = "(min-width: 768px)";
3893
+ var ROW_CLASS = "flex h-8 w-full min-w-0 items-stretch overflow-hidden rounded-lg border border-input bg-transparent transition-colors outline-none focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40";
3894
+ var SEARCH_CLASS2 = "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 md:text-sm dark:bg-input/30";
3895
+ function isCountryCode(value) {
3896
+ return libphonenumberJs.getCountries().includes(value);
3897
+ }
3898
+ function resolveCountry(code, fallback) {
3899
+ const normalized = (code ?? "").trim().toUpperCase();
3900
+ return isCountryCode(normalized) ? normalized : fallback;
3901
+ }
3902
+ function flagEmoji(iso) {
3903
+ const code = iso.trim().toUpperCase();
3904
+ if (!/^[A-Z]{2}$/.test(code)) return "\u{1F3F3}\uFE0F";
3905
+ return String.fromCodePoint(
3906
+ ...code.split("").map((char) => 127397 + char.charCodeAt(0))
3907
+ );
3908
+ }
3909
+ var regionNames;
3910
+ function countryName(code) {
3911
+ try {
3912
+ regionNames ??= new Intl.DisplayNames(["en"], { type: "region" });
3913
+ return regionNames.of(code) ?? code;
3914
+ } catch {
3915
+ return code;
3916
+ }
3917
+ }
3918
+ function buildCountryOptions() {
3919
+ return libphonenumberJs.getCountries().map((id) => {
3920
+ const dialCode = `+${libphonenumberJs.getCountryCallingCode(id)}`;
3921
+ const name = countryName(id);
3922
+ return {
3923
+ id,
3924
+ dialCode,
3925
+ flag: flagEmoji(id),
3926
+ label: `${name} (${dialCode})`
3927
+ };
3928
+ }).sort((left, right) => left.label.localeCompare(right.label, "en"));
3929
+ }
3930
+ var COUNTRY_OPTIONS2 = buildCountryOptions();
3931
+ function nationalDigits(value) {
3932
+ return value.replace(/\D/g, "");
3933
+ }
3934
+ function formatNational(country, raw) {
3935
+ const digits = nationalDigits(raw);
3936
+ if (!digits) return "";
3937
+ return new libphonenumberJs.AsYouType(country).input(digits);
3938
+ }
3939
+ function toE164(country, national) {
3940
+ const digits = nationalDigits(national);
3941
+ if (!digits) return "";
3942
+ const parsed = libphonenumberJs.parsePhoneNumberFromString(digits, country);
3943
+ if (parsed?.number) return parsed.number;
3944
+ return `+${libphonenumberJs.getCountryCallingCode(country)}${digits}`;
3945
+ }
3946
+ function parseIncoming(value, defaultCountry) {
3947
+ const trimmed = value.trim();
3948
+ if (!trimmed) {
3949
+ return { country: defaultCountry, national: "" };
3950
+ }
3951
+ const parsed = libphonenumberJs.parsePhoneNumberFromString(trimmed, defaultCountry);
3952
+ if (parsed) {
3953
+ const country = parsed.country ?? defaultCountry;
3954
+ const national = parsed.formatNational();
3955
+ return { country, national };
3956
+ }
3957
+ return {
3958
+ country: defaultCountry,
3959
+ national: formatNational(defaultCountry, trimmed)
3960
+ };
3961
+ }
3962
+ function filterCountries2(options, query) {
3963
+ const needle = query.trim().toLowerCase();
3964
+ if (!needle) return options;
3965
+ return options.filter((option) => {
3966
+ const haystack = `${option.label} ${option.id} ${option.dialCode}`.toLowerCase();
3967
+ return haystack.includes(needle);
3968
+ });
3969
+ }
3970
+ function PhoneInput({
3971
+ value,
3972
+ onValueChange,
3973
+ defaultCountry = "MX",
3974
+ searchPlaceholder = "Search country or code\u2026",
3975
+ countryListLabel = "Country",
3976
+ countryTriggerLabel = "Select country",
3977
+ emptyLabel = "No matches",
3978
+ className,
3979
+ disabled,
3980
+ id,
3981
+ name,
3982
+ "aria-invalid": ariaInvalid,
3983
+ "aria-label": ariaLabel,
3984
+ placeholder,
3985
+ ...props
3986
+ }) {
3987
+ const resolvedDefault = resolveCountry(defaultCountry, "MX");
3988
+ const [country, setCountry] = React5__namespace.useState(
3989
+ () => parseIncoming(value, resolvedDefault).country
3990
+ );
3991
+ const [national, setNational] = React5__namespace.useState(
3992
+ () => parseIncoming(value, resolvedDefault).national
3993
+ );
3994
+ const [open, setOpen] = React5__namespace.useState(false);
3995
+ const [query, setQuery] = React5__namespace.useState("");
3996
+ const lastEmittedRef = React5__namespace.useRef(value);
3997
+ const isMdUp = useMediaQuery(MD_UP2);
3998
+ const dialogPortalContainer = dialog_js.useDialogPortalContainer();
3999
+ const searchRef = React5__namespace.useRef(null);
4000
+ React5__namespace.useEffect(() => {
4001
+ if (value === lastEmittedRef.current) return;
4002
+ lastEmittedRef.current = value;
4003
+ const next = parseIncoming(value, resolvedDefault);
4004
+ setCountry(next.country);
4005
+ setNational(next.national);
4006
+ }, [value, resolvedDefault]);
4007
+ React5__namespace.useEffect(() => {
4008
+ if (!open || isMdUp) return;
4009
+ const handle = window.setTimeout(() => searchRef.current?.focus(), 0);
4010
+ return () => window.clearTimeout(handle);
4011
+ }, [isMdUp, open]);
4012
+ const selected = COUNTRY_OPTIONS2.find((option) => option.id === country) ?? COUNTRY_OPTIONS2.find((option) => option.id === resolvedDefault);
4013
+ const filtered = React5__namespace.useMemo(
4014
+ () => filterCountries2(COUNTRY_OPTIONS2, query),
4015
+ [query]
4016
+ );
4017
+ function emit(nextCountry, nextNational) {
4018
+ const nextValue = toE164(nextCountry, nextNational);
4019
+ lastEmittedRef.current = nextValue;
4020
+ setCountry(nextCountry);
4021
+ setNational(nextNational);
4022
+ onValueChange(nextValue);
4023
+ }
4024
+ function setOpenState(next) {
4025
+ setOpen(next);
4026
+ if (!next) setQuery("");
4027
+ }
4028
+ function selectCountry(next) {
4029
+ const formatted = formatNational(next, national);
4030
+ emit(next, formatted);
4031
+ setOpenState(false);
4032
+ }
4033
+ function onNationalChange(nextRaw) {
4034
+ const formatted = formatNational(country, nextRaw);
4035
+ emit(country, formatted);
4036
+ }
4037
+ const dialDisplay = selected.dialCode;
4038
+ const countryTriggerClass = "inline-flex h-full shrink-0 items-center gap-1 border-r border-input px-2 text-sm outline-none disabled:pointer-events-none";
4039
+ const desktopPicker = /* @__PURE__ */ jsxRuntime.jsxs(
4040
+ combobox_js.Combobox.Root,
4041
+ {
4042
+ items: filtered,
4043
+ value: selected,
4044
+ open,
4045
+ onOpenChange: setOpenState,
4046
+ inputValue: query,
4047
+ onInputValueChange: setQuery,
4048
+ onValueChange: (item) => {
4049
+ if (item) selectCountry(item.id);
4050
+ },
4051
+ disabled,
4052
+ filter: null,
4053
+ autoComplete: "none",
4054
+ itemToStringLabel: (item) => item.label,
4055
+ itemToStringValue: (item) => item.id,
4056
+ isItemEqualToValue: (item, current) => item.id === current.id,
4057
+ children: [
4058
+ /* @__PURE__ */ jsxRuntime.jsxs(
4059
+ combobox_js.Combobox.Trigger,
4060
+ {
4061
+ "aria-invalid": ariaInvalid,
4062
+ "aria-label": countryTriggerLabel,
4063
+ className: countryTriggerClass,
4064
+ disabled,
4065
+ children: [
4066
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-base leading-none", children: selected.flag }),
4067
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tabular-nums text-muted-foreground", children: dialDisplay }),
4068
+ /* @__PURE__ */ jsxRuntime.jsx(
4069
+ lucideReact.ChevronDownIcon,
4070
+ {
4071
+ "aria-hidden": true,
4072
+ className: "size-3.5 shrink-0 text-muted-foreground"
4073
+ }
4074
+ )
4075
+ ]
4076
+ }
4077
+ ),
4078
+ /* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Portal, { container: dialogPortalContainer ?? void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
4079
+ combobox_js.Combobox.Positioner,
4080
+ {
4081
+ className: "pointer-events-auto isolate z-[60] outline-none",
4082
+ sideOffset: 4,
4083
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
4084
+ combobox_js.Combobox.Popup,
4085
+ {
4086
+ className: cn(
4087
+ "pointer-events-auto z-[60] flex w-[min(20rem,var(--anchor-width))] min-w-[16rem] flex-col overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10",
4088
+ "motion-safe:data-open:animate-in motion-safe:data-open:fade-in-0 motion-safe:data-open:zoom-in-95"
4089
+ ),
4090
+ children: [
4091
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sticky top-0 z-10 border-b border-border bg-popover p-2", children: /* @__PURE__ */ jsxRuntime.jsx(
4092
+ combobox_js.Combobox.Input,
4093
+ {
4094
+ "aria-label": searchPlaceholder,
4095
+ className: SEARCH_CLASS2,
4096
+ placeholder: searchPlaceholder
4097
+ }
4098
+ ) }),
4099
+ /* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Empty, { className: "px-3 py-3 text-sm text-muted-foreground", children: emptyLabel }),
4100
+ /* @__PURE__ */ jsxRuntime.jsx(
4101
+ combobox_js.Combobox.List,
4102
+ {
4103
+ "aria-label": countryListLabel,
4104
+ className: "max-h-60 overflow-y-auto p-1 outline-none",
4105
+ onWheel: (event) => event.stopPropagation(),
4106
+ children: (item) => /* @__PURE__ */ jsxRuntime.jsxs(
4107
+ combobox_js.Combobox.Item,
4108
+ {
4109
+ value: item,
4110
+ className: cn(
4111
+ "relative flex cursor-default items-center gap-2 rounded-md py-2 pr-2 pl-8 text-sm outline-none select-none",
4112
+ "data-highlighted:bg-accent data-highlighted:text-accent-foreground"
4113
+ ),
4114
+ children: [
4115
+ /* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.ItemIndicator, { className: "absolute left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4", "aria-hidden": true }) }),
4116
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-base leading-none", children: item.flag }),
4117
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate", children: item.label })
4118
+ ]
4119
+ },
4120
+ item.id
4121
+ )
4122
+ }
4123
+ )
4124
+ ]
4125
+ }
4126
+ )
4127
+ }
4128
+ ) })
4129
+ ]
4130
+ }
4131
+ );
4132
+ const mobileTrigger = /* @__PURE__ */ jsxRuntime.jsxs(
4133
+ "button",
4134
+ {
4135
+ "aria-expanded": open,
4136
+ "aria-haspopup": "dialog",
4137
+ "aria-invalid": ariaInvalid,
4138
+ "aria-label": countryTriggerLabel,
4139
+ className: countryTriggerClass,
4140
+ disabled,
4141
+ type: "button",
4142
+ onClick: () => setOpenState(true),
4143
+ children: [
4144
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-base leading-none", children: selected.flag }),
4145
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tabular-nums text-muted-foreground", children: dialDisplay }),
4146
+ /* @__PURE__ */ jsxRuntime.jsx(
4147
+ lucideReact.ChevronDownIcon,
4148
+ {
4149
+ "aria-hidden": true,
4150
+ className: "size-3.5 shrink-0 text-muted-foreground"
4151
+ }
4152
+ )
4153
+ ]
4154
+ }
4155
+ );
4156
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4157
+ "div",
4158
+ {
4159
+ "aria-invalid": ariaInvalid,
4160
+ className: cn(
4161
+ ROW_CLASS,
4162
+ disabled ? "pointer-events-none cursor-not-allowed bg-input/50 opacity-50 dark:bg-input/80" : null,
4163
+ className
4164
+ ),
4165
+ children: [
4166
+ name ? /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name, value }) : null,
4167
+ isMdUp ? desktopPicker : mobileTrigger,
4168
+ /* @__PURE__ */ jsxRuntime.jsx(
4169
+ "input",
4170
+ {
4171
+ ...props,
4172
+ "aria-invalid": ariaInvalid,
4173
+ "aria-label": ariaLabel,
4174
+ autoComplete: props.autoComplete ?? "tel-national",
4175
+ className: "h-full min-w-0 flex-1 border-0 bg-transparent px-2.5 py-1 text-base outline-none placeholder:text-muted-foreground md:text-sm",
4176
+ disabled,
4177
+ id,
4178
+ inputMode: "tel",
4179
+ placeholder,
4180
+ type: "tel",
4181
+ value: national,
4182
+ onChange: (event) => onNationalChange(event.target.value)
4183
+ }
4184
+ ),
4185
+ !isMdUp ? /* @__PURE__ */ jsxRuntime.jsx(drawer_js.Drawer, { open, onOpenChange: setOpenState, children: /* @__PURE__ */ jsxRuntime.jsxs(drawer_js.DrawerContent, { className: "max-h-[85vh]", children: [
4186
+ /* @__PURE__ */ jsxRuntime.jsx(drawer_js.DrawerHeader, { className: "text-left", children: /* @__PURE__ */ jsxRuntime.jsx(drawer_js.DrawerTitle, { children: countryListLabel }) }),
4187
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sticky top-0 z-10 border-b border-border bg-background px-4 pb-3", children: /* @__PURE__ */ jsxRuntime.jsx(
4188
+ input_js.Input,
4189
+ {
4190
+ ref: searchRef,
4191
+ "aria-label": searchPlaceholder,
4192
+ disabled,
4193
+ placeholder: searchPlaceholder,
4194
+ value: query,
4195
+ onChange: (event) => setQuery(event.target.value)
4196
+ }
4197
+ ) }),
4198
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-y-auto px-2 pb-4", children: filtered.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2 py-3 text-sm text-muted-foreground", children: emptyLabel }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "flex flex-col gap-1 p-1", role: "listbox", children: filtered.map((option) => {
4199
+ const isSelected = option.id === country;
4200
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
4201
+ "button",
4202
+ {
4203
+ "aria-selected": isSelected,
4204
+ className: cn(
4205
+ "flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm outline-none transition-colors",
4206
+ "hover:bg-muted/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
4207
+ isSelected ? "bg-accent" : null
4208
+ ),
4209
+ role: "option",
4210
+ type: "button",
4211
+ onClick: () => selectCountry(option.id),
4212
+ children: [
4213
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-base leading-none", children: option.flag }),
4214
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate", children: option.label }),
4215
+ isSelected ? /* @__PURE__ */ jsxRuntime.jsx(
4216
+ lucideReact.CheckIcon,
4217
+ {
4218
+ "aria-hidden": true,
4219
+ className: "size-4 shrink-0"
4220
+ }
4221
+ ) : null
4222
+ ]
4223
+ }
4224
+ ) }, option.id);
4225
+ }) }) })
4226
+ ] }) }) : null
4227
+ ]
4228
+ }
4229
+ );
4230
+ }
3891
4231
  var DEFAULT_LABELS2 = {
3892
4232
  uploadAria: "Upload image",
3893
4233
  uploadHint: "Click to upload",
@@ -3916,18 +4256,18 @@ function AvatarEditor({
3916
4256
  labels
3917
4257
  }) {
3918
4258
  const t = { ...DEFAULT_LABELS2, ...labels };
3919
- const canvasRef = React3.useRef(null);
3920
- const fileInputRef = React3.useRef(null);
3921
- const containerRef = React3.useRef(null);
3922
- const [image, setImage] = React3.useState(null);
3923
- const [imageLoaded, setImageLoaded] = React3.useState(false);
3924
- const [zoom, setZoom] = React3.useState(1);
3925
- const [rotation, setRotation] = React3.useState(0);
3926
- const [position, setPosition] = React3.useState({ x: 0, y: 0 });
3927
- const [isDragging, setIsDragging] = React3.useState(false);
3928
- const [dragStart, setDragStart] = React3.useState({ x: 0, y: 0 });
3929
- const [showGrid, setShowGrid] = React3.useState(initialShowGrid);
3930
- const generateOutput = React3.useCallback(() => {
4259
+ const canvasRef = React5.useRef(null);
4260
+ const fileInputRef = React5.useRef(null);
4261
+ const containerRef = React5.useRef(null);
4262
+ const [image, setImage] = React5.useState(null);
4263
+ const [imageLoaded, setImageLoaded] = React5.useState(false);
4264
+ const [zoom, setZoom] = React5.useState(1);
4265
+ const [rotation, setRotation] = React5.useState(0);
4266
+ const [position, setPosition] = React5.useState({ x: 0, y: 0 });
4267
+ const [isDragging, setIsDragging] = React5.useState(false);
4268
+ const [dragStart, setDragStart] = React5.useState({ x: 0, y: 0 });
4269
+ const [showGrid, setShowGrid] = React5.useState(initialShowGrid);
4270
+ const generateOutput = React5.useCallback(() => {
3931
4271
  if (!canvasRef.current || !image) return null;
3932
4272
  const outputCanvas = document.createElement("canvas");
3933
4273
  outputCanvas.width = outputSize;
@@ -3938,7 +4278,7 @@ function AvatarEditor({
3938
4278
  const mimeType = `image/${outputFormat}`;
3939
4279
  return outputCanvas.toDataURL(mimeType, outputQuality);
3940
4280
  }, [image, outputSize, outputFormat, outputQuality]);
3941
- React3.useEffect(() => {
4281
+ React5.useEffect(() => {
3942
4282
  if (!canvasRef.current || !image || !imageLoaded) return;
3943
4283
  const canvas = canvasRef.current;
3944
4284
  const ctx = canvas.getContext("2d");
@@ -3982,12 +4322,12 @@ function AvatarEditor({
3982
4322
  generateOutput,
3983
4323
  onChange
3984
4324
  ]);
3985
- const resetTransforms = React3.useCallback(() => {
4325
+ const resetTransforms = React5.useCallback(() => {
3986
4326
  setZoom(1);
3987
4327
  setRotation(0);
3988
4328
  setPosition({ x: 0, y: 0 });
3989
4329
  }, []);
3990
- const handleFileSelect = React3.useCallback(
4330
+ const handleFileSelect = React5.useCallback(
3991
4331
  (e) => {
3992
4332
  const file = e.target.files?.[0];
3993
4333
  if (!file) return;
@@ -4006,7 +4346,7 @@ function AvatarEditor({
4006
4346
  },
4007
4347
  [resetTransforms]
4008
4348
  );
4009
- const handleMouseDown = React3.useCallback(
4349
+ const handleMouseDown = React5.useCallback(
4010
4350
  (e) => {
4011
4351
  if (!imageLoaded) return;
4012
4352
  setIsDragging(true);
@@ -4014,7 +4354,7 @@ function AvatarEditor({
4014
4354
  },
4015
4355
  [imageLoaded, position]
4016
4356
  );
4017
- const handleMouseMove = React3.useCallback(
4357
+ const handleMouseMove = React5.useCallback(
4018
4358
  (e) => {
4019
4359
  if (!isDragging) return;
4020
4360
  setPosition({
@@ -4024,10 +4364,10 @@ function AvatarEditor({
4024
4364
  },
4025
4365
  [isDragging, dragStart]
4026
4366
  );
4027
- const handleMouseUp = React3.useCallback(() => {
4367
+ const handleMouseUp = React5.useCallback(() => {
4028
4368
  setIsDragging(false);
4029
4369
  }, []);
4030
- const handleTouchStart = React3.useCallback(
4370
+ const handleTouchStart = React5.useCallback(
4031
4371
  (e) => {
4032
4372
  if (!imageLoaded) return;
4033
4373
  const touch = e.touches[0];
@@ -4039,7 +4379,7 @@ function AvatarEditor({
4039
4379
  },
4040
4380
  [imageLoaded, position]
4041
4381
  );
4042
- const handleTouchMove = React3.useCallback(
4382
+ const handleTouchMove = React5.useCallback(
4043
4383
  (e) => {
4044
4384
  if (!isDragging) return;
4045
4385
  const touch = e.touches[0];
@@ -4050,7 +4390,7 @@ function AvatarEditor({
4050
4390
  },
4051
4391
  [isDragging, dragStart]
4052
4392
  );
4053
- const handleDiscard = React3.useCallback(() => {
4393
+ const handleDiscard = React5.useCallback(() => {
4054
4394
  setImage(null);
4055
4395
  setImageLoaded(false);
4056
4396
  resetTransforms();
@@ -4421,8 +4761,8 @@ function AvatarEditor({
4421
4761
  );
4422
4762
  }
4423
4763
  function useMediaQuery2(query) {
4424
- const [matches, setMatches] = React3.useState(false);
4425
- React3.useEffect(() => {
4764
+ const [matches, setMatches] = React5.useState(false);
4765
+ React5.useEffect(() => {
4426
4766
  const media = window.matchMedia(query);
4427
4767
  if (media.matches !== matches) {
4428
4768
  setMatches(media.matches);
@@ -4452,17 +4792,17 @@ function AvatarEditorDialog({
4452
4792
  className,
4453
4793
  editorLabels
4454
4794
  }) {
4455
- const [isOpen, setIsOpen] = React3.useState(false);
4456
- const [editedValue, setEditedValue] = React3.useState(value ?? null);
4457
- const [displaySrc, setDisplaySrc] = React3.useState(value ?? null);
4458
- const [isSaving, setIsSaving] = React3.useState(false);
4459
- const [feedback, setFeedback] = React3.useState(null);
4460
- React3.useEffect(() => {
4795
+ const [isOpen, setIsOpen] = React5.useState(false);
4796
+ const [editedValue, setEditedValue] = React5.useState(value ?? null);
4797
+ const [displaySrc, setDisplaySrc] = React5.useState(value ?? null);
4798
+ const [isSaving, setIsSaving] = React5.useState(false);
4799
+ const [feedback, setFeedback] = React5.useState(null);
4800
+ React5.useEffect(() => {
4461
4801
  setDisplaySrc(value ?? null);
4462
4802
  }, [value]);
4463
4803
  const isMobile = useMediaQuery2("(max-width: 640px)");
4464
4804
  const caption = (placeholder ?? "").trim();
4465
- const handleOpenChange = React3.useCallback(
4805
+ const handleOpenChange = React5.useCallback(
4466
4806
  (open) => {
4467
4807
  if (open) {
4468
4808
  setEditedValue(value ?? null);
@@ -4472,7 +4812,7 @@ function AvatarEditorDialog({
4472
4812
  },
4473
4813
  [value]
4474
4814
  );
4475
- const handleAccept = React3.useCallback(async () => {
4815
+ const handleAccept = React5.useCallback(async () => {
4476
4816
  if (!editedValue) return;
4477
4817
  setIsSaving(true);
4478
4818
  setFeedback(null);
@@ -4739,10 +5079,10 @@ function FileDropzone({
4739
5079
  className
4740
5080
  }) {
4741
5081
  const labels = { ...DEFAULT_FILE_DROPZONE_LABELS, ...labelOverrides };
4742
- const inputId = React3.useId();
4743
- const inputRef = React3.useRef(null);
4744
- const [dragging, setDragging] = React3.useState(false);
4745
- const [message, setMessage] = React3.useState(null);
5082
+ const inputId = React5.useId();
5083
+ const inputRef = React5.useRef(null);
5084
+ const [dragging, setDragging] = React5.useState(false);
5085
+ const [message, setMessage] = React5.useState(null);
4746
5086
  function takeFile(file) {
4747
5087
  if (!file || disabled) return;
4748
5088
  if (!fileMatchesAccept(file, accept)) {
@@ -4996,7 +5336,7 @@ function FileUploadMenu({
4996
5336
  }) {
4997
5337
  const labels = { ...DEFAULT_FILE_UPLOAD_TRAY_LABELS, ...labelOverrides };
4998
5338
  const visible = jobs.filter((job) => job.status !== "cancelled");
4999
- const [uncontrolledOpen, setUncontrolledOpen] = React3.useState(false);
5339
+ const [uncontrolledOpen, setUncontrolledOpen] = React5.useState(false);
5000
5340
  const isControlled = open !== void 0;
5001
5341
  const resolvedOpen = isControlled ? open : uncontrolledOpen;
5002
5342
  function setResolvedOpen(next) {
@@ -5607,10 +5947,10 @@ function CookieConsentBanner({
5607
5947
  className
5608
5948
  }) {
5609
5949
  const copy = { ...DEFAULT_COOKIE_CONSENT_BANNER_LABELS, ...labels };
5610
- const [consent, setConsent] = React3.useState(
5950
+ const [consent, setConsent] = React5.useState(
5611
5951
  "pending"
5612
5952
  );
5613
- React3.useEffect(() => {
5953
+ React5.useEffect(() => {
5614
5954
  if (variant === "embed" || isEmbeddedWindow()) {
5615
5955
  setConsent("necessary");
5616
5956
  return;
@@ -6087,7 +6427,7 @@ function FormSection({
6087
6427
  );
6088
6428
  }
6089
6429
  function useDirtyGuard(dirty) {
6090
- React3.useEffect(() => {
6430
+ React5.useEffect(() => {
6091
6431
  if (!dirty) return;
6092
6432
  function onBeforeUnload(event) {
6093
6433
  event.preventDefault();
@@ -6239,7 +6579,7 @@ function useQueueKeys({
6239
6579
  selectedId,
6240
6580
  onSelect
6241
6581
  }) {
6242
- const move = React3.useCallback(
6582
+ const move = React5.useCallback(
6243
6583
  (delta) => {
6244
6584
  if (ids.length === 0) return;
6245
6585
  const currentIndex = selectedId ? ids.indexOf(selectedId) : -1;
@@ -6254,7 +6594,7 @@ function useQueueKeys({
6254
6594
  },
6255
6595
  [ids, onSelect, selectedId]
6256
6596
  );
6257
- React3.useEffect(() => {
6597
+ React5.useEffect(() => {
6258
6598
  if (!enabled) return;
6259
6599
  function onKeyDown(event) {
6260
6600
  if (isTypingTarget(event.target)) return;
@@ -6358,8 +6698,8 @@ function prefersReducedMotion() {
6358
6698
  return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
6359
6699
  }
6360
6700
  function useSectionNav(sections) {
6361
- const [active, setActive] = React3.useState(sections[0]?.id ?? "");
6362
- React3.useEffect(() => {
6701
+ const [active, setActive] = React5.useState(sections[0]?.id ?? "");
6702
+ React5.useEffect(() => {
6363
6703
  const elements = sections.map((section) => document.getElementById(section.id)).filter((node) => node !== null);
6364
6704
  if (elements.length === 0) return;
6365
6705
  const observer = new IntersectionObserver(
@@ -6838,8 +7178,8 @@ function MatchReview({
6838
7178
  className
6839
7179
  }) {
6840
7180
  const copy = { ...DEFAULT_MATCH_REVIEW_LABELS, ...labels };
6841
- const reasonId = React3.useId();
6842
- const [reason, setReason] = React3.useState("");
7181
+ const reasonId = React5.useId();
7182
+ const [reason, setReason] = React5.useState("");
6843
7183
  const trimmed = reason.trim();
6844
7184
  if (!hit) {
6845
7185
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -7017,6 +7357,7 @@ exports.PageTitle = PageTitle;
7017
7357
  exports.PageTitleSkeleton = PageTitleSkeleton;
7018
7358
  exports.PaginatedCombobox = PaginatedCombobox;
7019
7359
  exports.PasswordInput = PasswordInput;
7360
+ exports.PhoneInput = PhoneInput;
7020
7361
  exports.QueueLayout = QueueLayout;
7021
7362
  exports.RfcInput = RfcInput;
7022
7363
  exports.RiskBadge = RiskBadge;