@chekinapp/ui 0.0.21 → 0.0.23
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 +797 -595
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +166 -13
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +73 -2
- package/dist/index.d.ts +73 -2
- package/dist/index.js +712 -526
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -293,10 +293,26 @@ __export(index_exports, {
|
|
|
293
293
|
toggleVariants: () => toggleVariants,
|
|
294
294
|
uiKitI18nResources: () => uiKitI18nResources,
|
|
295
295
|
uiKitTranslations: () => uiKitTranslations,
|
|
296
|
+
useAbortController: () => useAbortController,
|
|
297
|
+
useClickEscape: () => useClickEscape,
|
|
298
|
+
useCombinedRef: () => useCombinedRef,
|
|
299
|
+
useDebounce: () => useDebounce,
|
|
300
|
+
useEvent: () => useEvent,
|
|
301
|
+
useHover: () => useHover,
|
|
302
|
+
useIsMobile: () => useIsMobile,
|
|
303
|
+
useIsMounted: () => useIsMounted,
|
|
304
|
+
useModalControls: () => useModalControls,
|
|
305
|
+
useOutsideClick: () => useOutsideClick,
|
|
306
|
+
usePrevious: () => usePrevious,
|
|
296
307
|
useRadioOptions: () => useRadioOptions,
|
|
308
|
+
useScreenResize: () => useScreenResize,
|
|
309
|
+
useScrollFrameIntoView: () => useScrollFrameIntoView,
|
|
310
|
+
useScrollToTop: () => useScrollToTop,
|
|
297
311
|
useSidebar: () => useSidebar,
|
|
298
312
|
useSidebarMenuButton: () => useSidebarMenuButton,
|
|
299
313
|
useSidebarSafe: () => useSidebarSafe,
|
|
314
|
+
useTimeout: () => useTimeout,
|
|
315
|
+
useTimer: () => useTimer,
|
|
300
316
|
useUpdateToast: () => useUpdateToast
|
|
301
317
|
});
|
|
302
318
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -348,10 +364,11 @@ var AccordionTrigger = React.forwardRef(({ className, children, openIcon, closed
|
|
|
348
364
|
"div",
|
|
349
365
|
{
|
|
350
366
|
className: cn(
|
|
367
|
+
"accordion__icon",
|
|
368
|
+
Accordion_default.accordion__icon,
|
|
351
369
|
"shrink-0 rounded-full p-0.5",
|
|
352
370
|
"transition-colors duration-200",
|
|
353
|
-
"
|
|
354
|
-
"relative h-4 w-4"
|
|
371
|
+
"relative"
|
|
355
372
|
),
|
|
356
373
|
children: [
|
|
357
374
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -413,6 +430,11 @@ AccordionContent.displayName = AccordionPrimitive.Content.displayName;
|
|
|
413
430
|
|
|
414
431
|
// src/alert-box/AlertBox.tsx
|
|
415
432
|
var import_lucide_react2 = require("lucide-react");
|
|
433
|
+
|
|
434
|
+
// src/alert-box/AlertBox.module.css
|
|
435
|
+
var AlertBox_default = {};
|
|
436
|
+
|
|
437
|
+
// src/alert-box/AlertBox.tsx
|
|
416
438
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
417
439
|
var AlertType = /* @__PURE__ */ ((AlertType2) => {
|
|
418
440
|
AlertType2["INFO"] = "INFO";
|
|
@@ -440,12 +462,12 @@ var sizeClasses = {
|
|
|
440
462
|
["M" /* M */]: "p-4 text-base font-medium items-start",
|
|
441
463
|
["L" /* L */]: "px-6 py-5 items-start"
|
|
442
464
|
};
|
|
443
|
-
var
|
|
444
|
-
["INFO" /* INFO */]: "
|
|
445
|
-
["WARNING" /* WARNING */]: "
|
|
446
|
-
["ERROR" /* ERROR */]: "
|
|
447
|
-
["
|
|
448
|
-
["
|
|
465
|
+
var typeStyles = {
|
|
466
|
+
["INFO" /* INFO */]: AlertBox_default["alertBox--info"],
|
|
467
|
+
["WARNING" /* WARNING */]: AlertBox_default["alertBox--warning"],
|
|
468
|
+
["ERROR" /* ERROR */]: AlertBox_default["alertBox--error"],
|
|
469
|
+
["SUCCESS" /* SUCCESS */]: AlertBox_default["alertBox--success"],
|
|
470
|
+
["LIGHT" /* LIGHT */]: ""
|
|
449
471
|
};
|
|
450
472
|
function AlertBox({
|
|
451
473
|
text,
|
|
@@ -461,9 +483,10 @@ function AlertBox({
|
|
|
461
483
|
{
|
|
462
484
|
"data-slot": "alert-box",
|
|
463
485
|
className: cn(
|
|
464
|
-
|
|
486
|
+
AlertBox_default.alertBox,
|
|
487
|
+
"flex gap-3 [&_svg]:h-5 [&_svg]:w-5 [&_svg]:shrink-0",
|
|
465
488
|
sizeClasses[size],
|
|
466
|
-
|
|
489
|
+
typeStyles[type],
|
|
467
490
|
className
|
|
468
491
|
),
|
|
469
492
|
children: [
|
|
@@ -480,6 +503,11 @@ var AlertSizes = AlertSize;
|
|
|
480
503
|
// src/audio-player/AudioPlayer.tsx
|
|
481
504
|
var import_react = require("react");
|
|
482
505
|
var import_lucide_react3 = require("lucide-react");
|
|
506
|
+
|
|
507
|
+
// src/audio-player/AudioPlayer.module.css
|
|
508
|
+
var AudioPlayer_default = {};
|
|
509
|
+
|
|
510
|
+
// src/audio-player/AudioPlayer.tsx
|
|
483
511
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
484
512
|
function formatTime(seconds) {
|
|
485
513
|
const mins = Math.floor(seconds / 60);
|
|
@@ -543,16 +571,12 @@ function AudioPlayer({ src, compact, className }) {
|
|
|
543
571
|
{
|
|
544
572
|
type: "button",
|
|
545
573
|
className: cn(
|
|
546
|
-
|
|
574
|
+
AudioPlayer_default.playButton,
|
|
575
|
+
"inline-flex items-center justify-center",
|
|
547
576
|
compact ? "h-6 min-w-6 p-1" : "h-8 min-w-8 p-1.5"
|
|
548
577
|
),
|
|
549
578
|
onClick: togglePlayPause,
|
|
550
|
-
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react3.Pause, { className: cn(compact ? "h-2.5 w-2.5" : "h-3 w-3", "
|
|
551
|
-
import_lucide_react3.Play,
|
|
552
|
-
{
|
|
553
|
-
className: cn(compact ? "h-2.5 w-2.5" : "h-3 w-3", "fill-white text-white")
|
|
554
|
-
}
|
|
555
|
-
)
|
|
579
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react3.Pause, { className: cn(compact ? "h-2.5 w-2.5" : "h-3 w-3", "fill-current") }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react3.Play, { className: cn(compact ? "h-2.5 w-2.5" : "h-3 w-3", "fill-current") })
|
|
556
580
|
}
|
|
557
581
|
),
|
|
558
582
|
!compact && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
@@ -560,18 +584,24 @@ function AudioPlayer({ src, compact, className }) {
|
|
|
560
584
|
"div",
|
|
561
585
|
{
|
|
562
586
|
ref: progressRef,
|
|
563
|
-
className:
|
|
587
|
+
className: cn(
|
|
588
|
+
AudioPlayer_default.track,
|
|
589
|
+
"h-1 flex-1 cursor-pointer overflow-hidden rounded-full"
|
|
590
|
+
),
|
|
564
591
|
onClick: handleSeek,
|
|
565
592
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
566
593
|
"div",
|
|
567
594
|
{
|
|
568
|
-
className:
|
|
595
|
+
className: cn(
|
|
596
|
+
AudioPlayer_default.progress,
|
|
597
|
+
"h-full transition-all duration-100 ease-linear"
|
|
598
|
+
),
|
|
569
599
|
style: { width: `${progress}%` }
|
|
570
600
|
}
|
|
571
601
|
)
|
|
572
602
|
}
|
|
573
603
|
),
|
|
574
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "min-w-10 text-xs font-medium
|
|
604
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cn(AudioPlayer_default.time, "min-w-10 text-xs font-medium"), children: isPlaying || currentTime > 0 ? formatTime(currentTime) : formatTime(duration) })
|
|
575
605
|
] })
|
|
576
606
|
] });
|
|
577
607
|
}
|
|
@@ -580,6 +610,11 @@ AudioPlayer.displayName = "AudioPlayer";
|
|
|
580
610
|
// src/avatar/Avatar.tsx
|
|
581
611
|
var React2 = __toESM(require("react"), 1);
|
|
582
612
|
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"), 1);
|
|
613
|
+
|
|
614
|
+
// src/avatar/Avatar.module.css
|
|
615
|
+
var Avatar_default = {};
|
|
616
|
+
|
|
617
|
+
// src/avatar/Avatar.tsx
|
|
583
618
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
584
619
|
var sizeClasses2 = {
|
|
585
620
|
sm: "h-8 w-8",
|
|
@@ -610,8 +645,9 @@ var Avatar = React2.forwardRef(({ className, src, alt, fallback, size = "md", fa
|
|
|
610
645
|
AvatarPrimitive.Fallback,
|
|
611
646
|
{
|
|
612
647
|
className: cn(
|
|
613
|
-
"flex h-full w-full items-center justify-center rounded-full font-medium
|
|
614
|
-
fallbackClassName
|
|
648
|
+
"flex h-full w-full items-center justify-center rounded-full font-medium",
|
|
649
|
+
!fallbackClassName && Avatar_default.fallback,
|
|
650
|
+
fallbackClassName
|
|
615
651
|
),
|
|
616
652
|
children: fallback
|
|
617
653
|
}
|
|
@@ -663,6 +699,11 @@ Badge.displayName = "Badge";
|
|
|
663
699
|
|
|
664
700
|
// src/beta-badge/BetaBadge.tsx
|
|
665
701
|
var import_react_i18next = require("react-i18next");
|
|
702
|
+
|
|
703
|
+
// src/beta-badge/BetaBadge.module.css
|
|
704
|
+
var BetaBadge_default = {};
|
|
705
|
+
|
|
706
|
+
// src/beta-badge/BetaBadge.tsx
|
|
666
707
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
667
708
|
function BetaBadge({
|
|
668
709
|
className,
|
|
@@ -677,8 +718,9 @@ function BetaBadge({
|
|
|
677
718
|
{
|
|
678
719
|
"data-slot": "beta-badge",
|
|
679
720
|
className: cn(
|
|
721
|
+
BetaBadge_default.betaBadge,
|
|
680
722
|
"rounded-sm px-2 py-1 text-sm/4 font-semibold uppercase",
|
|
681
|
-
readOnly
|
|
723
|
+
readOnly && BetaBadge_default["betaBadge--readonly"],
|
|
682
724
|
className
|
|
683
725
|
),
|
|
684
726
|
...props,
|
|
@@ -769,6 +811,11 @@ BookmarkTabsTrigger.displayName = "BookmarkTabsTrigger";
|
|
|
769
811
|
// src/box-option-selector/BoxOptionSelector.tsx
|
|
770
812
|
var import_react2 = require("react");
|
|
771
813
|
var import_react_i18next2 = require("react-i18next");
|
|
814
|
+
|
|
815
|
+
// src/box-option-selector/BoxOptionSelector.module.css
|
|
816
|
+
var BoxOptionSelector_default = {};
|
|
817
|
+
|
|
818
|
+
// src/box-option-selector/BoxOptionSelector.tsx
|
|
772
819
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
773
820
|
var BoxOptionSelector = (0, import_react2.forwardRef)(
|
|
774
821
|
({
|
|
@@ -804,8 +851,9 @@ var BoxOptionSelector = (0, import_react2.forwardRef)(
|
|
|
804
851
|
ref,
|
|
805
852
|
"data-slot": "box-option-selector",
|
|
806
853
|
className: cn(
|
|
854
|
+
BoxOptionSelector_default.boxOption,
|
|
807
855
|
"flex min-h-[116px] w-full max-w-[400px] cursor-pointer flex-col gap-4 rounded-lg border p-4 transition-all duration-200",
|
|
808
|
-
isSelected
|
|
856
|
+
isSelected && BoxOptionSelector_default["boxOption--selected"],
|
|
809
857
|
disabled && "cursor-not-allowed opacity-50"
|
|
810
858
|
),
|
|
811
859
|
onClick: handleClick,
|
|
@@ -866,8 +914,8 @@ function Breadcrumb({
|
|
|
866
914
|
}
|
|
867
915
|
const isLink = Boolean(to && !current);
|
|
868
916
|
const contentClassName = cn(
|
|
869
|
-
"flex items-center gap-2.5 text-sm font-medium text-
|
|
870
|
-
current && "font-bold text-
|
|
917
|
+
"flex items-center gap-2.5 text-sm font-medium text-[var(--breadcrumbs-link-color)]",
|
|
918
|
+
current && "font-bold text-[var(--breadcrumbs-current-color)]",
|
|
871
919
|
isLink && "transition-opacity hover:opacity-80",
|
|
872
920
|
className
|
|
873
921
|
);
|
|
@@ -907,7 +955,7 @@ function Breadcrumbs({ className, children }) {
|
|
|
907
955
|
import_lucide_react4.ChevronRight,
|
|
908
956
|
{
|
|
909
957
|
"aria-hidden": "true",
|
|
910
|
-
className: "shrink-0 text-
|
|
958
|
+
className: "shrink-0 text-[var(--breadcrumbs-separator-color)]",
|
|
911
959
|
size: 16
|
|
912
960
|
}
|
|
913
961
|
) : null,
|
|
@@ -1213,7 +1261,7 @@ function ButtonGroupText({
|
|
|
1213
1261
|
{
|
|
1214
1262
|
"data-slot": "button-group-text",
|
|
1215
1263
|
className: cn(
|
|
1216
|
-
"flex items-center gap-2 rounded-lg border bg-
|
|
1264
|
+
"flex items-center gap-2 rounded-lg border border-[var(--button-group-text-border)] bg-[var(--button-group-text-bg)] px-2.5 text-sm font-medium text-[var(--button-group-text-color)]",
|
|
1217
1265
|
"[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none",
|
|
1218
1266
|
className
|
|
1219
1267
|
),
|
|
@@ -1227,7 +1275,7 @@ ButtonGroupText.displayName = "ButtonGroupText";
|
|
|
1227
1275
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1228
1276
|
function ButtonsGroupLabel({ children, label, className }) {
|
|
1229
1277
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { "data-slot": "buttons-group-label", className: cn(className), children: [
|
|
1230
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "mb-2 text-xs font-medium text-
|
|
1278
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "mb-2 text-xs font-medium text-[var(--buttons-group-label-color)]", children: label }),
|
|
1231
1279
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children })
|
|
1232
1280
|
] });
|
|
1233
1281
|
}
|
|
@@ -1423,6 +1471,15 @@ var getDocument = () => {
|
|
|
1423
1471
|
function getCustomContainer() {
|
|
1424
1472
|
return getDocument()?.body;
|
|
1425
1473
|
}
|
|
1474
|
+
function scrollToTop(value = 0, behavior) {
|
|
1475
|
+
window.scrollTo({
|
|
1476
|
+
top: value,
|
|
1477
|
+
behavior
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
function isObject(value) {
|
|
1481
|
+
return value !== null && typeof value === "object";
|
|
1482
|
+
}
|
|
1426
1483
|
var isNumeric = (n) => n !== "" && !isNaN(n);
|
|
1427
1484
|
function toCssSize(size) {
|
|
1428
1485
|
if (!size) {
|
|
@@ -2279,15 +2336,60 @@ function DataTable({ columns, data }) {
|
|
|
2279
2336
|
}
|
|
2280
2337
|
|
|
2281
2338
|
// src/dialog/Dialog.tsx
|
|
2282
|
-
var
|
|
2339
|
+
var React11 = __toESM(require("react"), 1);
|
|
2283
2340
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
2284
2341
|
var import_react_visually_hidden = require("@radix-ui/react-visually-hidden");
|
|
2285
2342
|
var import_lucide_react10 = require("lucide-react");
|
|
2286
2343
|
|
|
2287
|
-
// src/
|
|
2344
|
+
// src/hooks/use-scroll-to-top.ts
|
|
2288
2345
|
var import_react8 = require("react");
|
|
2346
|
+
function useScrollToTop() {
|
|
2347
|
+
(0, import_react8.useEffect)(() => {
|
|
2348
|
+
scrollToTop();
|
|
2349
|
+
}, []);
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
// src/hooks/use-abort-controller.ts
|
|
2353
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
2354
|
+
function useAbortController() {
|
|
2355
|
+
const [abortController, setAbortController] = import_react9.default.useState(() => {
|
|
2356
|
+
return new AbortController();
|
|
2357
|
+
});
|
|
2358
|
+
const setupAbortController = import_react9.default.useCallback(() => {
|
|
2359
|
+
const abortController2 = new AbortController();
|
|
2360
|
+
setAbortController(abortController2);
|
|
2361
|
+
return abortController2.signal;
|
|
2362
|
+
}, []);
|
|
2363
|
+
return {
|
|
2364
|
+
abortController,
|
|
2365
|
+
setupAbortController
|
|
2366
|
+
};
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
// src/hooks/use-click-escape.ts
|
|
2370
|
+
var import_react10 = require("react");
|
|
2371
|
+
function useClickEscape({ enabled = true, onClick }) {
|
|
2372
|
+
const onClickRef = (0, import_react10.useRef)(onClick);
|
|
2373
|
+
(0, import_react10.useEffect)(() => {
|
|
2374
|
+
onClickRef.current = onClick;
|
|
2375
|
+
}, [onClick]);
|
|
2376
|
+
(0, import_react10.useEffect)(() => {
|
|
2377
|
+
const handleKeyDown = (event) => {
|
|
2378
|
+
if (event.key === "Escape" && enabled) {
|
|
2379
|
+
onClickRef.current?.();
|
|
2380
|
+
}
|
|
2381
|
+
};
|
|
2382
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
2383
|
+
return () => {
|
|
2384
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
2385
|
+
};
|
|
2386
|
+
}, [enabled]);
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
// src/hooks/use-combined-ref.ts
|
|
2390
|
+
var import_react11 = require("react");
|
|
2289
2391
|
function useCombinedRef(...refs) {
|
|
2290
|
-
return (0,
|
|
2392
|
+
return (0, import_react11.useCallback)(
|
|
2291
2393
|
(node) => {
|
|
2292
2394
|
refs.forEach((ref) => {
|
|
2293
2395
|
if (!ref) return;
|
|
@@ -2303,10 +2405,298 @@ function useCombinedRef(...refs) {
|
|
|
2303
2405
|
);
|
|
2304
2406
|
}
|
|
2305
2407
|
|
|
2408
|
+
// src/hooks/use-event.ts
|
|
2409
|
+
var import_react12 = require("react");
|
|
2410
|
+
function useEvent(fn) {
|
|
2411
|
+
const fnRef = (0, import_react12.useRef)(fn);
|
|
2412
|
+
(0, import_react12.useLayoutEffect)(() => {
|
|
2413
|
+
fnRef.current = fn;
|
|
2414
|
+
}, [fn]);
|
|
2415
|
+
const eventCb = (0, import_react12.useCallback)(
|
|
2416
|
+
(...args) => {
|
|
2417
|
+
return fnRef.current?.apply(null, args);
|
|
2418
|
+
},
|
|
2419
|
+
[fnRef]
|
|
2420
|
+
);
|
|
2421
|
+
return eventCb;
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
// src/hooks/use-is-mobile.ts
|
|
2425
|
+
var import_react13 = require("react");
|
|
2426
|
+
var MOBILE_BREAKPOINT = 768;
|
|
2427
|
+
function useIsMobile({ breakpoint = MOBILE_BREAKPOINT } = {}) {
|
|
2428
|
+
const [isMobile, setIsMobile] = (0, import_react13.useState)(void 0);
|
|
2429
|
+
(0, import_react13.useEffect)(() => {
|
|
2430
|
+
const mediaQuery = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
|
2431
|
+
const onChange = () => {
|
|
2432
|
+
setIsMobile(window.innerWidth < breakpoint);
|
|
2433
|
+
};
|
|
2434
|
+
mediaQuery.addEventListener("change", onChange);
|
|
2435
|
+
setIsMobile(window.innerWidth < breakpoint);
|
|
2436
|
+
return () => {
|
|
2437
|
+
mediaQuery.removeEventListener("change", onChange);
|
|
2438
|
+
};
|
|
2439
|
+
}, [breakpoint]);
|
|
2440
|
+
return !!isMobile;
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
// src/hooks/use-is-mounted.ts
|
|
2444
|
+
var import_react14 = require("react");
|
|
2445
|
+
function useIsMounted() {
|
|
2446
|
+
const isMounted = (0, import_react14.useRef)(false);
|
|
2447
|
+
(0, import_react14.useEffect)(() => {
|
|
2448
|
+
isMounted.current = true;
|
|
2449
|
+
return () => {
|
|
2450
|
+
isMounted.current = false;
|
|
2451
|
+
};
|
|
2452
|
+
}, []);
|
|
2453
|
+
return isMounted;
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
// src/hooks/use-modal-controls.ts
|
|
2457
|
+
var import_react15 = require("react");
|
|
2458
|
+
function useModalControls(initState = false, { disabled } = {}) {
|
|
2459
|
+
const [isOpen, setIsOpen] = (0, import_react15.useState)(initState);
|
|
2460
|
+
const openModal = (0, import_react15.useCallback)(() => {
|
|
2461
|
+
if (disabled) return;
|
|
2462
|
+
setIsOpen(true);
|
|
2463
|
+
}, [disabled]);
|
|
2464
|
+
const closeModal = (0, import_react15.useCallback)(() => {
|
|
2465
|
+
if (disabled) return;
|
|
2466
|
+
setIsOpen(false);
|
|
2467
|
+
}, [disabled]);
|
|
2468
|
+
const toggleModal = (0, import_react15.useCallback)(() => {
|
|
2469
|
+
if (disabled) return;
|
|
2470
|
+
setIsOpen((value) => !value);
|
|
2471
|
+
}, [disabled]);
|
|
2472
|
+
return {
|
|
2473
|
+
isOpen,
|
|
2474
|
+
openModal,
|
|
2475
|
+
closeModal,
|
|
2476
|
+
toggleModal,
|
|
2477
|
+
setIsOpen
|
|
2478
|
+
};
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
// src/hooks/use-outside-click.ts
|
|
2482
|
+
var import_react16 = require("react");
|
|
2483
|
+
function useOutsideClick(elementRef, onOutsideClick, nested) {
|
|
2484
|
+
const handleOutsideClick = (0, import_react16.useRef)(onOutsideClick);
|
|
2485
|
+
handleOutsideClick.current = onOutsideClick;
|
|
2486
|
+
const checkNestedElements = (0, import_react16.useCallback)(
|
|
2487
|
+
(event) => {
|
|
2488
|
+
const checkIsElementClickedBySelector = (selector) => {
|
|
2489
|
+
const nestedElement = getDocument().querySelector(selector);
|
|
2490
|
+
return nestedElement?.contains(event.target);
|
|
2491
|
+
};
|
|
2492
|
+
const checkDataAttribute = () => {
|
|
2493
|
+
const target = event.target;
|
|
2494
|
+
if (!target || !(target instanceof HTMLElement)) {
|
|
2495
|
+
return false;
|
|
2496
|
+
}
|
|
2497
|
+
let current = target;
|
|
2498
|
+
while (current) {
|
|
2499
|
+
if (current.hasAttribute("data-exclude-from-outside-click")) {
|
|
2500
|
+
return true;
|
|
2501
|
+
}
|
|
2502
|
+
current = current.parentElement;
|
|
2503
|
+
}
|
|
2504
|
+
return false;
|
|
2505
|
+
};
|
|
2506
|
+
if (nested) {
|
|
2507
|
+
if (typeof nested === "string") {
|
|
2508
|
+
if (checkIsElementClickedBySelector(nested)) return true;
|
|
2509
|
+
} else {
|
|
2510
|
+
if (nested.some(checkIsElementClickedBySelector)) return true;
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
return checkDataAttribute();
|
|
2514
|
+
},
|
|
2515
|
+
[nested]
|
|
2516
|
+
);
|
|
2517
|
+
(0, import_react16.useEffect)(() => {
|
|
2518
|
+
function handleClickOutside(event) {
|
|
2519
|
+
const isNestedElement = checkNestedElements(event);
|
|
2520
|
+
if (elementRef?.current && !elementRef.current.contains(event.target) && !isNestedElement) {
|
|
2521
|
+
handleOutsideClick.current?.(event);
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
getDocument().addEventListener("mousedown", handleClickOutside, true);
|
|
2525
|
+
getDocument().addEventListener("touchstart", handleClickOutside, true);
|
|
2526
|
+
return () => {
|
|
2527
|
+
getDocument().removeEventListener("mousedown", handleClickOutside, true);
|
|
2528
|
+
getDocument().removeEventListener("touchstart", handleClickOutside, true);
|
|
2529
|
+
};
|
|
2530
|
+
}, [checkNestedElements, elementRef]);
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
// src/hooks/use-screen-resize.ts
|
|
2534
|
+
var import_react17 = require("react");
|
|
2535
|
+
var eventName = "resize";
|
|
2536
|
+
function useScreenResize(maxWidth) {
|
|
2537
|
+
const [isInitialized, setIsInitialized] = (0, import_react17.useState)(false);
|
|
2538
|
+
const [isMatch, setIsMatch] = (0, import_react17.useState)(false);
|
|
2539
|
+
const handleResizeEvent = (0, import_react17.useCallback)(() => {
|
|
2540
|
+
const adjustedMaxWidth = `${parseInt(maxWidth, 10) - 1}px`;
|
|
2541
|
+
const media = getWindow().matchMedia(`(max-width: ${adjustedMaxWidth})`);
|
|
2542
|
+
setIsInitialized(true);
|
|
2543
|
+
setIsMatch(media?.matches);
|
|
2544
|
+
}, [maxWidth]);
|
|
2545
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
2546
|
+
handleResizeEvent();
|
|
2547
|
+
getWindow().addEventListener(eventName, handleResizeEvent);
|
|
2548
|
+
return () => {
|
|
2549
|
+
getWindow().removeEventListener(eventName, handleResizeEvent);
|
|
2550
|
+
};
|
|
2551
|
+
}, [handleResizeEvent]);
|
|
2552
|
+
return { isMatch, isInitialized };
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
// src/hooks/use-scroll-frame-into-view.ts
|
|
2556
|
+
var import_react18 = require("react");
|
|
2557
|
+
|
|
2558
|
+
// src/lib/runtimeSettings.ts
|
|
2559
|
+
function getChekinRuntimeSettings() {
|
|
2560
|
+
return window.ChekinProSettings || window.ChekinHousingsSDKSettings || {};
|
|
2561
|
+
}
|
|
2562
|
+
function isMobileModalModeAvailable() {
|
|
2563
|
+
const settings = getChekinRuntimeSettings();
|
|
2564
|
+
return !settings.autoHeight;
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
// src/hooks/use-scroll-frame-into-view.ts
|
|
2568
|
+
function useScrollFrameIntoView(active, options = {}) {
|
|
2569
|
+
const { behavior = "smooth", elementRef } = options;
|
|
2570
|
+
(0, import_react18.useEffect)(() => {
|
|
2571
|
+
const sdkWindow = window;
|
|
2572
|
+
if (!active || !getChekinRuntimeSettings()?.autoHeight) {
|
|
2573
|
+
return;
|
|
2574
|
+
}
|
|
2575
|
+
const frame = sdkWindow.chekinCustomFrame;
|
|
2576
|
+
if (!frame) {
|
|
2577
|
+
return;
|
|
2578
|
+
}
|
|
2579
|
+
const parentWindow = window.parent;
|
|
2580
|
+
const scrollToElement = () => {
|
|
2581
|
+
const frameRect = frame.getBoundingClientRect();
|
|
2582
|
+
if (elementRef?.current) {
|
|
2583
|
+
const elementRect = elementRef.current.getBoundingClientRect();
|
|
2584
|
+
const elementCenterInFrame = elementRect.top + elementRect.height / 2;
|
|
2585
|
+
const elementCenterInParent = frameRect.top + elementCenterInFrame;
|
|
2586
|
+
const targetScroll = parentWindow.scrollY + elementCenterInParent - parentWindow.innerHeight / 2;
|
|
2587
|
+
parentWindow.scrollTo({
|
|
2588
|
+
top: Math.max(0, targetScroll),
|
|
2589
|
+
behavior
|
|
2590
|
+
});
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
frame.scrollIntoView({ behavior, block: "start" });
|
|
2594
|
+
};
|
|
2595
|
+
requestAnimationFrame(() => {
|
|
2596
|
+
requestAnimationFrame(scrollToElement);
|
|
2597
|
+
});
|
|
2598
|
+
}, [active, behavior, elementRef]);
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
// src/hooks/use-debounce.ts
|
|
2602
|
+
var import_react19 = require("react");
|
|
2603
|
+
function useDebounce(value, delayMs = 1e3, handleChange) {
|
|
2604
|
+
const onChange = useEvent(handleChange);
|
|
2605
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react19.useState)(value);
|
|
2606
|
+
(0, import_react19.useEffect)(() => {
|
|
2607
|
+
const handler = setTimeout(() => {
|
|
2608
|
+
setDebouncedValue(value);
|
|
2609
|
+
}, delayMs);
|
|
2610
|
+
return () => {
|
|
2611
|
+
clearTimeout(handler);
|
|
2612
|
+
};
|
|
2613
|
+
}, [value, delayMs]);
|
|
2614
|
+
(0, import_react19.useEffect)(() => {
|
|
2615
|
+
onChange?.(debouncedValue);
|
|
2616
|
+
}, [debouncedValue, onChange]);
|
|
2617
|
+
return [debouncedValue, setDebouncedValue];
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
// src/hooks/use-previous.ts
|
|
2621
|
+
var import_react20 = require("react");
|
|
2622
|
+
function usePrevious(value, defaultValue) {
|
|
2623
|
+
const ref = (0, import_react20.useRef)(defaultValue);
|
|
2624
|
+
(0, import_react20.useEffect)(() => {
|
|
2625
|
+
ref.current = isObject(value) ? { ...value } : value;
|
|
2626
|
+
}, [value]);
|
|
2627
|
+
return ref.current;
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
// src/hooks/use-timer.ts
|
|
2631
|
+
var import_react21 = require("react");
|
|
2632
|
+
var useTimer = ({ seconds }) => {
|
|
2633
|
+
const [timeLeft, setTimeLeft] = (0, import_react21.useState)(seconds);
|
|
2634
|
+
const [isTimerRunning, setIsTimerRunning] = (0, import_react21.useState)(true);
|
|
2635
|
+
(0, import_react21.useEffect)(() => {
|
|
2636
|
+
if (!isTimerRunning) return;
|
|
2637
|
+
const timer = setInterval(() => {
|
|
2638
|
+
setTimeLeft((prev) => {
|
|
2639
|
+
if (prev <= 1) {
|
|
2640
|
+
clearInterval(timer);
|
|
2641
|
+
setIsTimerRunning(false);
|
|
2642
|
+
return 0;
|
|
2643
|
+
}
|
|
2644
|
+
return prev - 1;
|
|
2645
|
+
});
|
|
2646
|
+
}, 1e3);
|
|
2647
|
+
return () => clearInterval(timer);
|
|
2648
|
+
}, [isTimerRunning]);
|
|
2649
|
+
const resetTimer = () => {
|
|
2650
|
+
setTimeLeft(seconds);
|
|
2651
|
+
setIsTimerRunning(true);
|
|
2652
|
+
};
|
|
2653
|
+
return {
|
|
2654
|
+
timeLeft,
|
|
2655
|
+
isTimerRunning,
|
|
2656
|
+
resetTimer
|
|
2657
|
+
};
|
|
2658
|
+
};
|
|
2659
|
+
|
|
2660
|
+
// src/hooks/use-timeout.ts
|
|
2661
|
+
var import_react22 = require("react");
|
|
2662
|
+
function useTimeout() {
|
|
2663
|
+
const timeoutRef = (0, import_react22.useRef)();
|
|
2664
|
+
const clearTimeoutRef = (0, import_react22.useCallback)(() => {
|
|
2665
|
+
clearTimeout(timeoutRef.current);
|
|
2666
|
+
timeoutRef.current = void 0;
|
|
2667
|
+
}, []);
|
|
2668
|
+
const scheduleTimeout = (0, import_react22.useCallback)(
|
|
2669
|
+
(callback, delay) => {
|
|
2670
|
+
clearTimeoutRef();
|
|
2671
|
+
timeoutRef.current = setTimeout(callback, delay);
|
|
2672
|
+
},
|
|
2673
|
+
[clearTimeoutRef]
|
|
2674
|
+
);
|
|
2675
|
+
(0, import_react22.useEffect)(() => clearTimeoutRef, [clearTimeoutRef]);
|
|
2676
|
+
return { scheduleTimeout, clearTimeoutRef };
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
// src/hooks/use-hover.ts
|
|
2680
|
+
var import_react23 = require("react");
|
|
2681
|
+
function useHover() {
|
|
2682
|
+
const [isHovering, setIsHovering] = (0, import_react23.useState)(false);
|
|
2683
|
+
const handleMouseEnter = (0, import_react23.useCallback)(() => {
|
|
2684
|
+
setIsHovering(true);
|
|
2685
|
+
}, []);
|
|
2686
|
+
const handleMouseLeave = (0, import_react23.useCallback)(() => {
|
|
2687
|
+
setIsHovering(false);
|
|
2688
|
+
}, []);
|
|
2689
|
+
return {
|
|
2690
|
+
isHovering,
|
|
2691
|
+
handleMouseEnter,
|
|
2692
|
+
handleMouseLeave
|
|
2693
|
+
};
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2306
2696
|
// src/dialog/Dialog.tsx
|
|
2307
2697
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2308
2698
|
function useIframeTitleFix(titleRef) {
|
|
2309
|
-
|
|
2699
|
+
React11.useEffect(() => {
|
|
2310
2700
|
if (!window.chekinCustomDocument) {
|
|
2311
2701
|
return;
|
|
2312
2702
|
}
|
|
@@ -2335,7 +2725,7 @@ function DialogClose({ ...props }) {
|
|
|
2335
2725
|
}
|
|
2336
2726
|
var dialogOverlayClasses = "fixed inset-0 z-50 bg-[var(--dialog-overlay-bg)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0";
|
|
2337
2727
|
var scrollableOverlayClasses = "fixed inset-0 z-50 flex flex-col items-center overflow-y-auto overscroll-none pb-[19px] pt-[20px]";
|
|
2338
|
-
var DialogOverlay =
|
|
2728
|
+
var DialogOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2339
2729
|
DialogPrimitive.Overlay,
|
|
2340
2730
|
{
|
|
2341
2731
|
ref,
|
|
@@ -2347,7 +2737,7 @@ var DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
2347
2737
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
2348
2738
|
var dialogContentClasses = "relative z-50 my-auto w-full max-w-[calc(100%-2rem)] rounded-[var(--dialog-content-radius)] border border-[var(--dialog-content-border)] bg-[var(--dialog-content-bg)] p-6 text-[var(--dialog-content-text)] shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:max-w-2xl";
|
|
2349
2739
|
var dialogCloseButtonClasses = "absolute right-4 top-4 rounded-[var(--dialog-close-radius)] opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:shadow-chekin-focus disabled:pointer-events-none [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0";
|
|
2350
|
-
var DialogContent =
|
|
2740
|
+
var DialogContent = React11.forwardRef(
|
|
2351
2741
|
({ className, showCloseButton = true, children, container, lockScroll = true, ...props }, ref) => {
|
|
2352
2742
|
const contentElement = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
2353
2743
|
DialogPrimitive.Content,
|
|
@@ -2395,8 +2785,8 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
2395
2785
|
}
|
|
2396
2786
|
);
|
|
2397
2787
|
DialogFooter.displayName = "DialogFooter";
|
|
2398
|
-
var DialogTitle =
|
|
2399
|
-
const titleRef =
|
|
2788
|
+
var DialogTitle = React11.forwardRef(({ className, ...props }, ref) => {
|
|
2789
|
+
const titleRef = React11.useRef(null);
|
|
2400
2790
|
const combinedRef = useCombinedRef(titleRef, ref);
|
|
2401
2791
|
useIframeTitleFix(titleRef);
|
|
2402
2792
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
@@ -2410,7 +2800,7 @@ var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => {
|
|
|
2410
2800
|
);
|
|
2411
2801
|
});
|
|
2412
2802
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
2413
|
-
var DialogDescription =
|
|
2803
|
+
var DialogDescription = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2414
2804
|
DialogPrimitive.Description,
|
|
2415
2805
|
{
|
|
2416
2806
|
ref,
|
|
@@ -2472,9 +2862,9 @@ function ConfirmationDialog({
|
|
|
2472
2862
|
}
|
|
2473
2863
|
|
|
2474
2864
|
// src/default-select-trigger/DefaultSelectTrigger.tsx
|
|
2475
|
-
var
|
|
2865
|
+
var React12 = __toESM(require("react"), 1);
|
|
2476
2866
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2477
|
-
var DefaultSelectTrigger =
|
|
2867
|
+
var DefaultSelectTrigger = React12.forwardRef(
|
|
2478
2868
|
({
|
|
2479
2869
|
className,
|
|
2480
2870
|
disabled,
|
|
@@ -2538,17 +2928,17 @@ function DownloadEntryFormsButton({
|
|
|
2538
2928
|
}
|
|
2539
2929
|
|
|
2540
2930
|
// src/dropdown-button/DropdownButton.tsx
|
|
2541
|
-
var
|
|
2931
|
+
var import_react24 = require("react");
|
|
2542
2932
|
|
|
2543
2933
|
// src/dropdown-menu/DropdownMenu.tsx
|
|
2544
|
-
var
|
|
2934
|
+
var React13 = __toESM(require("react"), 1);
|
|
2545
2935
|
var RadixMenu = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
|
|
2546
2936
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2547
2937
|
var DropdownMenu = RadixMenu.Root;
|
|
2548
2938
|
var DropdownMenuTrigger = RadixMenu.Trigger;
|
|
2549
2939
|
var DropdownMenuPortal = RadixMenu.Portal;
|
|
2550
2940
|
var DropdownMenuGroup = RadixMenu.Group;
|
|
2551
|
-
var DropdownMenuContent =
|
|
2941
|
+
var DropdownMenuContent = React13.forwardRef(({ className, sideOffset = 6, container, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RadixMenu.Portal, { container: container || getCustomContainer(), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2552
2942
|
RadixMenu.Content,
|
|
2553
2943
|
{
|
|
2554
2944
|
ref,
|
|
@@ -2569,9 +2959,9 @@ var itemClasses = [
|
|
|
2569
2959
|
"data-[highlighted]:bg-chekin-surface-pressed data-[highlighted]:text-chekin-blue",
|
|
2570
2960
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-30"
|
|
2571
2961
|
];
|
|
2572
|
-
var DropdownMenuItem =
|
|
2962
|
+
var DropdownMenuItem = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RadixMenu.Item, { ref, className: cn(itemClasses, className), ...props }));
|
|
2573
2963
|
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
2574
|
-
var DropdownMenuLabel =
|
|
2964
|
+
var DropdownMenuLabel = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2575
2965
|
RadixMenu.Label,
|
|
2576
2966
|
{
|
|
2577
2967
|
ref,
|
|
@@ -2583,7 +2973,7 @@ var DropdownMenuLabel = React12.forwardRef(({ className, ...props }, ref) => /*
|
|
|
2583
2973
|
}
|
|
2584
2974
|
));
|
|
2585
2975
|
DropdownMenuLabel.displayName = "DropdownMenuLabel";
|
|
2586
|
-
var DropdownMenuSeparator =
|
|
2976
|
+
var DropdownMenuSeparator = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2587
2977
|
RadixMenu.Separator,
|
|
2588
2978
|
{
|
|
2589
2979
|
ref,
|
|
@@ -2602,7 +2992,7 @@ function DropdownButton({
|
|
|
2602
2992
|
modal,
|
|
2603
2993
|
className
|
|
2604
2994
|
}) {
|
|
2605
|
-
const [isOpen, setIsOpen] = (0,
|
|
2995
|
+
const [isOpen, setIsOpen] = (0, import_react24.useState)(false);
|
|
2606
2996
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(DropdownMenu, { onOpenChange: setIsOpen, modal, children: [
|
|
2607
2997
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropdownMenuTrigger, { asChild: true, children: typeof trigger === "function" ? trigger(isOpen) : trigger }),
|
|
2608
2998
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
@@ -2729,7 +3119,7 @@ var import_lucide_react12 = require("lucide-react");
|
|
|
2729
3119
|
var import_react_i18next7 = require("react-i18next");
|
|
2730
3120
|
|
|
2731
3121
|
// src/halo-icon/HaloIcon.tsx
|
|
2732
|
-
var
|
|
3122
|
+
var import_react25 = require("react");
|
|
2733
3123
|
|
|
2734
3124
|
// src/halo-icon/constants.ts
|
|
2735
3125
|
var HALO_ICON_STATUS = {
|
|
@@ -2759,7 +3149,7 @@ var statusStyles = {
|
|
|
2759
3149
|
color: "text-chekin-red"
|
|
2760
3150
|
}
|
|
2761
3151
|
};
|
|
2762
|
-
var HaloIcon = (0,
|
|
3152
|
+
var HaloIcon = (0, import_react25.forwardRef)(
|
|
2763
3153
|
({
|
|
2764
3154
|
children,
|
|
2765
3155
|
variant = "default",
|
|
@@ -2815,9 +3205,9 @@ function EmptySectionPlaceholder({
|
|
|
2815
3205
|
}
|
|
2816
3206
|
|
|
2817
3207
|
// src/external-link/ExternalLink.tsx
|
|
2818
|
-
var
|
|
3208
|
+
var React14 = __toESM(require("react"), 1);
|
|
2819
3209
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
2820
|
-
var ExternalLink =
|
|
3210
|
+
var ExternalLink = React14.forwardRef(
|
|
2821
3211
|
({ className, children, showIcon = true, target = "_blank", rel, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
2822
3212
|
"a",
|
|
2823
3213
|
{
|
|
@@ -2862,33 +3252,8 @@ ExternalLink.displayName = "ExternalLink";
|
|
|
2862
3252
|
var import_react_i18next9 = require("react-i18next");
|
|
2863
3253
|
var import_lucide_react14 = require("lucide-react");
|
|
2864
3254
|
|
|
2865
|
-
// src/lib/use-modal-controls.ts
|
|
2866
|
-
var import_react11 = require("react");
|
|
2867
|
-
function useModalControls(initState = false, { disabled } = {}) {
|
|
2868
|
-
const [isOpen, setIsOpen] = (0, import_react11.useState)(initState);
|
|
2869
|
-
const openModal = (0, import_react11.useCallback)(() => {
|
|
2870
|
-
if (disabled) return;
|
|
2871
|
-
setIsOpen(true);
|
|
2872
|
-
}, [disabled]);
|
|
2873
|
-
const closeModal = (0, import_react11.useCallback)(() => {
|
|
2874
|
-
if (disabled) return;
|
|
2875
|
-
setIsOpen(false);
|
|
2876
|
-
}, [disabled]);
|
|
2877
|
-
const toggleModal = (0, import_react11.useCallback)(() => {
|
|
2878
|
-
if (disabled) return;
|
|
2879
|
-
setIsOpen((value) => !value);
|
|
2880
|
-
}, [disabled]);
|
|
2881
|
-
return {
|
|
2882
|
-
isOpen,
|
|
2883
|
-
openModal,
|
|
2884
|
-
closeModal,
|
|
2885
|
-
toggleModal,
|
|
2886
|
-
setIsOpen
|
|
2887
|
-
};
|
|
2888
|
-
}
|
|
2889
|
-
|
|
2890
3255
|
// src/switch/Switch.tsx
|
|
2891
|
-
var
|
|
3256
|
+
var React15 = __toESM(require("react"), 1);
|
|
2892
3257
|
var SwitchPrimitives = __toESM(require("@radix-ui/react-switch"), 1);
|
|
2893
3258
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
2894
3259
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
@@ -2930,9 +3295,9 @@ var switchThumbVariants = (0, import_class_variance_authority7.cva)(
|
|
|
2930
3295
|
}
|
|
2931
3296
|
}
|
|
2932
3297
|
);
|
|
2933
|
-
var Switch =
|
|
3298
|
+
var Switch = React15.forwardRef(
|
|
2934
3299
|
({ className, size, readOnly, loading, onChange, value, id, label, error, ...props }, ref) => {
|
|
2935
|
-
const generatedId =
|
|
3300
|
+
const generatedId = React15.useId();
|
|
2936
3301
|
const fieldId = id || generatedId;
|
|
2937
3302
|
const switchElement = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2938
3303
|
SwitchPrimitives.Root,
|
|
@@ -2952,44 +3317,22 @@ var Switch = React14.forwardRef(
|
|
|
2952
3317
|
);
|
|
2953
3318
|
if (!label && !error) {
|
|
2954
3319
|
return switchElement;
|
|
2955
|
-
}
|
|
2956
|
-
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { children: [
|
|
2957
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
2958
|
-
switchElement,
|
|
2959
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Label, { htmlFor: fieldId, className: "cursor-pointer font-medium", children: label })
|
|
2960
|
-
] }),
|
|
2961
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ErrorMessage, { disabled: props.disabled, children: error })
|
|
2962
|
-
] });
|
|
2963
|
-
}
|
|
2964
|
-
);
|
|
2965
|
-
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
2966
|
-
|
|
2967
|
-
// src/video-player/VideoPlayer.tsx
|
|
2968
|
-
var import_react13 = require("react");
|
|
2969
|
-
var import_react_i18next8 = require("react-i18next");
|
|
2970
|
-
var import_lucide_react13 = require("lucide-react");
|
|
2971
|
-
|
|
2972
|
-
// src/lib/use-click-escape.ts
|
|
2973
|
-
var import_react12 = require("react");
|
|
2974
|
-
function useClickEscape({ enabled = true, onClick }) {
|
|
2975
|
-
const onClickRef = (0, import_react12.useRef)(onClick);
|
|
2976
|
-
(0, import_react12.useEffect)(() => {
|
|
2977
|
-
onClickRef.current = onClick;
|
|
2978
|
-
}, [onClick]);
|
|
2979
|
-
(0, import_react12.useEffect)(() => {
|
|
2980
|
-
const handleKeyDown = (event) => {
|
|
2981
|
-
if (event.key === "Escape" && enabled) {
|
|
2982
|
-
onClickRef.current?.();
|
|
2983
|
-
}
|
|
2984
|
-
};
|
|
2985
|
-
window.addEventListener("keydown", handleKeyDown);
|
|
2986
|
-
return () => {
|
|
2987
|
-
window.removeEventListener("keydown", handleKeyDown);
|
|
2988
|
-
};
|
|
2989
|
-
}, [enabled]);
|
|
2990
|
-
}
|
|
3320
|
+
}
|
|
3321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { children: [
|
|
3322
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
3323
|
+
switchElement,
|
|
3324
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Label, { htmlFor: fieldId, className: "cursor-pointer font-medium", children: label })
|
|
3325
|
+
] }),
|
|
3326
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ErrorMessage, { disabled: props.disabled, children: error })
|
|
3327
|
+
] });
|
|
3328
|
+
}
|
|
3329
|
+
);
|
|
3330
|
+
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
2991
3331
|
|
|
2992
3332
|
// src/video-player/VideoPlayer.tsx
|
|
3333
|
+
var import_react26 = require("react");
|
|
3334
|
+
var import_react_i18next8 = require("react-i18next");
|
|
3335
|
+
var import_lucide_react13 = require("lucide-react");
|
|
2993
3336
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
2994
3337
|
function VideoPlayer({
|
|
2995
3338
|
src,
|
|
@@ -3000,20 +3343,20 @@ function VideoPlayer({
|
|
|
3000
3343
|
autoPlay = false
|
|
3001
3344
|
}) {
|
|
3002
3345
|
const { t } = (0, import_react_i18next8.useTranslation)();
|
|
3003
|
-
const videoRef = (0,
|
|
3004
|
-
const iframeRef = (0,
|
|
3005
|
-
const containerRef = (0,
|
|
3006
|
-
const [isPlaying, setIsPlaying] = (0,
|
|
3007
|
-
const [isMuted, setIsMuted] = (0,
|
|
3008
|
-
const [currentTime, setCurrentTime] = (0,
|
|
3009
|
-
const [duration, setDuration] = (0,
|
|
3010
|
-
const [isFullScreenMode, setIsFullScreenMode] = (0,
|
|
3011
|
-
const [isLoading, setIsLoading] = (0,
|
|
3012
|
-
const [videoSource, setVideoSource] = (0,
|
|
3013
|
-
const [youtubeEmbedUrl, setYoutubeEmbedUrl] = (0,
|
|
3014
|
-
const [vimeoEmbedUrl, setVimeoEmbedUrl] = (0,
|
|
3346
|
+
const videoRef = (0, import_react26.useRef)(null);
|
|
3347
|
+
const iframeRef = (0, import_react26.useRef)(null);
|
|
3348
|
+
const containerRef = (0, import_react26.useRef)(null);
|
|
3349
|
+
const [isPlaying, setIsPlaying] = (0, import_react26.useState)(false);
|
|
3350
|
+
const [isMuted, setIsMuted] = (0, import_react26.useState)(false);
|
|
3351
|
+
const [currentTime, setCurrentTime] = (0, import_react26.useState)(0);
|
|
3352
|
+
const [duration, setDuration] = (0, import_react26.useState)(0);
|
|
3353
|
+
const [isFullScreenMode, setIsFullScreenMode] = (0, import_react26.useState)(isFullScreen);
|
|
3354
|
+
const [isLoading, setIsLoading] = (0, import_react26.useState)(true);
|
|
3355
|
+
const [videoSource, setVideoSource] = (0, import_react26.useState)("file");
|
|
3356
|
+
const [youtubeEmbedUrl, setYoutubeEmbedUrl] = (0, import_react26.useState)("");
|
|
3357
|
+
const [vimeoEmbedUrl, setVimeoEmbedUrl] = (0, import_react26.useState)("");
|
|
3015
3358
|
useClickEscape({ enabled: isFullScreenMode, onClick: onClose });
|
|
3016
|
-
(0,
|
|
3359
|
+
(0, import_react26.useEffect)(() => {
|
|
3017
3360
|
const youtubeRegex = /(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/;
|
|
3018
3361
|
const vimeoRegex = /(?:vimeo\.com\/|vimeo\.com\/video\/)(\d+)/;
|
|
3019
3362
|
const youtubeMatch = src.match(youtubeRegex);
|
|
@@ -3042,7 +3385,7 @@ function VideoPlayer({
|
|
|
3042
3385
|
setYoutubeEmbedUrl("");
|
|
3043
3386
|
setVimeoEmbedUrl("");
|
|
3044
3387
|
}, [src, autoPlay]);
|
|
3045
|
-
(0,
|
|
3388
|
+
(0, import_react26.useEffect)(() => {
|
|
3046
3389
|
if (videoSource !== "file") return;
|
|
3047
3390
|
const video = videoRef.current;
|
|
3048
3391
|
if (!video) return;
|
|
@@ -3070,7 +3413,7 @@ function VideoPlayer({
|
|
|
3070
3413
|
video.removeEventListener("canplay", handleCanPlay);
|
|
3071
3414
|
};
|
|
3072
3415
|
}, [videoSource]);
|
|
3073
|
-
(0,
|
|
3416
|
+
(0, import_react26.useEffect)(() => {
|
|
3074
3417
|
if (isFullScreenMode && videoRef.current && videoSource === "file") {
|
|
3075
3418
|
void videoRef.current.play();
|
|
3076
3419
|
setIsPlaying(true);
|
|
@@ -3347,10 +3690,10 @@ function FeatureCard({
|
|
|
3347
3690
|
}
|
|
3348
3691
|
|
|
3349
3692
|
// src/file-input-button/FileInputButton.tsx
|
|
3350
|
-
var
|
|
3693
|
+
var import_react27 = require("react");
|
|
3351
3694
|
var import_lucide_react15 = require("lucide-react");
|
|
3352
3695
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3353
|
-
var FileInputButton = (0,
|
|
3696
|
+
var FileInputButton = (0, import_react27.forwardRef)(
|
|
3354
3697
|
({
|
|
3355
3698
|
label,
|
|
3356
3699
|
onChange,
|
|
@@ -3362,7 +3705,7 @@ var FileInputButton = (0, import_react14.forwardRef)(
|
|
|
3362
3705
|
size = "default",
|
|
3363
3706
|
...props
|
|
3364
3707
|
}, ref) => {
|
|
3365
|
-
const handleChange = (0,
|
|
3708
|
+
const handleChange = (0, import_react27.useCallback)(
|
|
3366
3709
|
(event) => {
|
|
3367
3710
|
onChange?.(event);
|
|
3368
3711
|
event.target.value = "";
|
|
@@ -3442,7 +3785,7 @@ var FormBox = {
|
|
|
3442
3785
|
};
|
|
3443
3786
|
|
|
3444
3787
|
// src/free-text-field/FreeTextField.tsx
|
|
3445
|
-
var
|
|
3788
|
+
var import_react28 = require("react");
|
|
3446
3789
|
var import_react_i18next10 = require("react-i18next");
|
|
3447
3790
|
|
|
3448
3791
|
// src/free-text-field/styles.module.css
|
|
@@ -3450,7 +3793,7 @@ var styles_default3 = {};
|
|
|
3450
3793
|
|
|
3451
3794
|
// src/free-text-field/FreeTextField.tsx
|
|
3452
3795
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3453
|
-
var FreeTextField = (0,
|
|
3796
|
+
var FreeTextField = (0, import_react28.forwardRef)(
|
|
3454
3797
|
({
|
|
3455
3798
|
label,
|
|
3456
3799
|
error,
|
|
@@ -3472,9 +3815,9 @@ var FreeTextField = (0, import_react15.forwardRef)(
|
|
|
3472
3815
|
...inputProps
|
|
3473
3816
|
}, ref) => {
|
|
3474
3817
|
const { t } = (0, import_react_i18next10.useTranslation)();
|
|
3475
|
-
const inputId = (0,
|
|
3476
|
-
const [internalValue, setInternalValue] = (0,
|
|
3477
|
-
const [isFocused, setIsFocused] = (0,
|
|
3818
|
+
const inputId = (0, import_react28.useId)();
|
|
3819
|
+
const [internalValue, setInternalValue] = (0, import_react28.useState)(defaultValue ?? "");
|
|
3820
|
+
const [isFocused, setIsFocused] = (0, import_react28.useState)(false);
|
|
3478
3821
|
const currentValue = value !== void 0 ? value : internalValue;
|
|
3479
3822
|
const isEmpty = !currentValue || String(currentValue).length === 0;
|
|
3480
3823
|
const hasError = Boolean(error);
|
|
@@ -3558,7 +3901,7 @@ var FreeTextField = (0, import_react15.forwardRef)(
|
|
|
3558
3901
|
FreeTextField.displayName = "FreeTextField";
|
|
3559
3902
|
|
|
3560
3903
|
// src/framed-icon/FramedIcon.tsx
|
|
3561
|
-
var
|
|
3904
|
+
var React16 = __toESM(require("react"), 1);
|
|
3562
3905
|
var import_class_variance_authority8 = require("class-variance-authority");
|
|
3563
3906
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3564
3907
|
var framedIconVariants = (0, import_class_variance_authority8.cva)("inline-flex items-center justify-center shrink-0", {
|
|
@@ -3582,7 +3925,7 @@ var framedIconVariants = (0, import_class_variance_authority8.cva)("inline-flex
|
|
|
3582
3925
|
},
|
|
3583
3926
|
defaultVariants: { size: "m", shape: "rounded", tone: "info" }
|
|
3584
3927
|
});
|
|
3585
|
-
var FramedIcon =
|
|
3928
|
+
var FramedIcon = React16.forwardRef(
|
|
3586
3929
|
({ className, size, shape, tone, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3587
3930
|
"span",
|
|
3588
3931
|
{
|
|
@@ -3597,9 +3940,9 @@ var FramedIcon = React15.forwardRef(
|
|
|
3597
3940
|
FramedIcon.displayName = "FramedIcon";
|
|
3598
3941
|
|
|
3599
3942
|
// src/grid-items/GridItems.tsx
|
|
3600
|
-
var
|
|
3943
|
+
var import_react29 = require("react");
|
|
3601
3944
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
3602
|
-
var GridItems = (0,
|
|
3945
|
+
var GridItems = (0, import_react29.forwardRef)(
|
|
3603
3946
|
({ children, title, placeholder, className }, ref) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
3604
3947
|
"div",
|
|
3605
3948
|
{
|
|
@@ -3676,9 +4019,9 @@ function HelpTooltip({
|
|
|
3676
4019
|
}
|
|
3677
4020
|
|
|
3678
4021
|
// src/icon/Icon.tsx
|
|
3679
|
-
var
|
|
4022
|
+
var import_react30 = require("react");
|
|
3680
4023
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3681
|
-
var MissingIcon = (0,
|
|
4024
|
+
var MissingIcon = (0, import_react30.forwardRef)(
|
|
3682
4025
|
({ size = 24, className = "", fallback = null, color, ...props }, ref) => {
|
|
3683
4026
|
if (fallback) {
|
|
3684
4027
|
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: fallback });
|
|
@@ -3707,8 +4050,8 @@ var MissingIcon = (0, import_react17.forwardRef)(
|
|
|
3707
4050
|
}
|
|
3708
4051
|
);
|
|
3709
4052
|
MissingIcon.displayName = "MissingIcon";
|
|
3710
|
-
var Icon = (0,
|
|
3711
|
-
(0,
|
|
4053
|
+
var Icon = (0, import_react30.memo)(
|
|
4054
|
+
(0, import_react30.forwardRef)(
|
|
3712
4055
|
({ name: _name, size = 24, className = "", fallback = null, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3713
4056
|
MissingIcon,
|
|
3714
4057
|
{
|
|
@@ -3744,7 +4087,7 @@ var IconRegistry = class {
|
|
|
3744
4087
|
var RegistryIcon = Icon;
|
|
3745
4088
|
|
|
3746
4089
|
// src/icon-button/IconButton.tsx
|
|
3747
|
-
var
|
|
4090
|
+
var React17 = __toESM(require("react"), 1);
|
|
3748
4091
|
var import_class_variance_authority9 = require("class-variance-authority");
|
|
3749
4092
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
3750
4093
|
var iconButtonVariants = (0, import_class_variance_authority9.cva)(
|
|
@@ -3775,7 +4118,7 @@ var iconButtonVariants = (0, import_class_variance_authority9.cva)(
|
|
|
3775
4118
|
defaultVariants: { size: "m", shape: "rounded", variant: "secondary" }
|
|
3776
4119
|
}
|
|
3777
4120
|
);
|
|
3778
|
-
var IconButton =
|
|
4121
|
+
var IconButton = React17.forwardRef(
|
|
3779
4122
|
({ className, size, shape, variant, label, children, type = "button", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
3780
4123
|
"button",
|
|
3781
4124
|
{
|
|
@@ -3806,7 +4149,7 @@ function InfoBox({ className, children }) {
|
|
|
3806
4149
|
}
|
|
3807
4150
|
|
|
3808
4151
|
// src/image/Image.tsx
|
|
3809
|
-
var
|
|
4152
|
+
var import_react31 = require("react");
|
|
3810
4153
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
3811
4154
|
function Image2({
|
|
3812
4155
|
src,
|
|
@@ -3815,7 +4158,7 @@ function Image2({
|
|
|
3815
4158
|
fallbackSrc = "https://placehold.co/600x400?text=Image",
|
|
3816
4159
|
...props
|
|
3817
4160
|
}) {
|
|
3818
|
-
const [error, setError] = (0,
|
|
4161
|
+
const [error, setError] = (0, import_react31.useState)(false);
|
|
3819
4162
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3820
4163
|
"img",
|
|
3821
4164
|
{
|
|
@@ -3830,9 +4173,9 @@ function Image2({
|
|
|
3830
4173
|
}
|
|
3831
4174
|
|
|
3832
4175
|
// src/input/Input.tsx
|
|
3833
|
-
var
|
|
4176
|
+
var React18 = __toESM(require("react"), 1);
|
|
3834
4177
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
3835
|
-
var Input =
|
|
4178
|
+
var Input = React18.forwardRef(
|
|
3836
4179
|
({ className, type, readOnly, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3837
4180
|
"input",
|
|
3838
4181
|
{
|
|
@@ -3856,13 +4199,13 @@ var Input = React17.forwardRef(
|
|
|
3856
4199
|
Input.displayName = "Input";
|
|
3857
4200
|
|
|
3858
4201
|
// src/input-otp/InputOTP.tsx
|
|
3859
|
-
var
|
|
4202
|
+
var React19 = __toESM(require("react"), 1);
|
|
3860
4203
|
|
|
3861
4204
|
// src/input-otp/InputOTPContext.ts
|
|
3862
|
-
var
|
|
3863
|
-
var InputOTPContext = (0,
|
|
4205
|
+
var import_react32 = require("react");
|
|
4206
|
+
var InputOTPContext = (0, import_react32.createContext)(null);
|
|
3864
4207
|
function useInputOTPContext() {
|
|
3865
|
-
const ctx = (0,
|
|
4208
|
+
const ctx = (0, import_react32.useContext)(InputOTPContext);
|
|
3866
4209
|
if (!ctx) {
|
|
3867
4210
|
throw new Error("InputOTP compound components must be used within <InputOTP>");
|
|
3868
4211
|
}
|
|
@@ -3874,7 +4217,7 @@ function extractDigits(str) {
|
|
|
3874
4217
|
}
|
|
3875
4218
|
|
|
3876
4219
|
// src/input-otp/useInputOTP.ts
|
|
3877
|
-
var
|
|
4220
|
+
var import_react33 = require("react");
|
|
3878
4221
|
function useInputOTP({
|
|
3879
4222
|
maxLength,
|
|
3880
4223
|
value,
|
|
@@ -3883,12 +4226,12 @@ function useInputOTP({
|
|
|
3883
4226
|
autoFocus,
|
|
3884
4227
|
error
|
|
3885
4228
|
}) {
|
|
3886
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
3887
|
-
const inputRefs = (0,
|
|
3888
|
-
const containerRef = (0,
|
|
3889
|
-
const blurTimeoutRef = (0,
|
|
3890
|
-
const slotsRef = (0,
|
|
3891
|
-
const slots = (0,
|
|
4229
|
+
const [activeIndex, setActiveIndex] = (0, import_react33.useState)(-1);
|
|
4230
|
+
const inputRefs = (0, import_react33.useRef)([]);
|
|
4231
|
+
const containerRef = (0, import_react33.useRef)(null);
|
|
4232
|
+
const blurTimeoutRef = (0, import_react33.useRef)();
|
|
4233
|
+
const slotsRef = (0, import_react33.useRef)(Array.from({ length: maxLength }, () => ""));
|
|
4234
|
+
const slots = (0, import_react33.useMemo)(() => {
|
|
3892
4235
|
const nextSlots = Array.from({ length: maxLength }, () => "");
|
|
3893
4236
|
for (let index = 0; index < Math.min(value.length, maxLength); index += 1) {
|
|
3894
4237
|
const char = value[index];
|
|
@@ -3899,7 +4242,7 @@ function useInputOTP({
|
|
|
3899
4242
|
return nextSlots;
|
|
3900
4243
|
}, [value, maxLength]);
|
|
3901
4244
|
slotsRef.current = slots;
|
|
3902
|
-
const emitValue = (0,
|
|
4245
|
+
const emitValue = (0, import_react33.useCallback)(
|
|
3903
4246
|
(newSlots) => {
|
|
3904
4247
|
let lastFilledIndex = -1;
|
|
3905
4248
|
for (let index = newSlots.length - 1; index >= 0; index -= 1) {
|
|
@@ -3920,12 +4263,12 @@ function useInputOTP({
|
|
|
3920
4263
|
},
|
|
3921
4264
|
[onChange]
|
|
3922
4265
|
);
|
|
3923
|
-
(0,
|
|
4266
|
+
(0, import_react33.useEffect)(() => {
|
|
3924
4267
|
if (autoFocus && inputRefs.current[0]) {
|
|
3925
4268
|
inputRefs.current[0].focus();
|
|
3926
4269
|
}
|
|
3927
4270
|
}, [autoFocus]);
|
|
3928
|
-
const handleContainerFocusIn = (0,
|
|
4271
|
+
const handleContainerFocusIn = (0, import_react33.useCallback)((event) => {
|
|
3929
4272
|
clearTimeout(blurTimeoutRef.current);
|
|
3930
4273
|
const target = event.target;
|
|
3931
4274
|
const slotIndex = inputRefs.current.indexOf(target);
|
|
@@ -3933,7 +4276,7 @@ function useInputOTP({
|
|
|
3933
4276
|
setActiveIndex(slotIndex);
|
|
3934
4277
|
}
|
|
3935
4278
|
}, []);
|
|
3936
|
-
const handleContainerFocusOut = (0,
|
|
4279
|
+
const handleContainerFocusOut = (0, import_react33.useCallback)(() => {
|
|
3937
4280
|
clearTimeout(blurTimeoutRef.current);
|
|
3938
4281
|
blurTimeoutRef.current = setTimeout(() => {
|
|
3939
4282
|
if (!containerRef.current?.contains(document.activeElement)) {
|
|
@@ -3941,8 +4284,8 @@ function useInputOTP({
|
|
|
3941
4284
|
}
|
|
3942
4285
|
}, 0);
|
|
3943
4286
|
}, []);
|
|
3944
|
-
(0,
|
|
3945
|
-
const handleDigitInput = (0,
|
|
4287
|
+
(0, import_react33.useEffect)(() => () => clearTimeout(blurTimeoutRef.current), []);
|
|
4288
|
+
const handleDigitInput = (0, import_react33.useCallback)(
|
|
3946
4289
|
(index, digit) => {
|
|
3947
4290
|
if (!DIGIT_REGEX.test(digit)) return;
|
|
3948
4291
|
const newSlots = [...slotsRef.current];
|
|
@@ -3956,7 +4299,7 @@ function useInputOTP({
|
|
|
3956
4299
|
},
|
|
3957
4300
|
[maxLength, emitValue]
|
|
3958
4301
|
);
|
|
3959
|
-
const handleDelete = (0,
|
|
4302
|
+
const handleDelete = (0, import_react33.useCallback)(
|
|
3960
4303
|
(index) => {
|
|
3961
4304
|
const newSlots = [...slotsRef.current];
|
|
3962
4305
|
if (newSlots[index]) {
|
|
@@ -3971,7 +4314,7 @@ function useInputOTP({
|
|
|
3971
4314
|
},
|
|
3972
4315
|
[emitValue]
|
|
3973
4316
|
);
|
|
3974
|
-
const handlePaste = (0,
|
|
4317
|
+
const handlePaste = (0, import_react33.useCallback)(
|
|
3975
4318
|
(text) => {
|
|
3976
4319
|
const digits = extractDigits(text).slice(0, maxLength);
|
|
3977
4320
|
if (digits.length > 0) {
|
|
@@ -3987,7 +4330,7 @@ function useInputOTP({
|
|
|
3987
4330
|
},
|
|
3988
4331
|
[maxLength, emitValue]
|
|
3989
4332
|
);
|
|
3990
|
-
const contextValue = (0,
|
|
4333
|
+
const contextValue = (0, import_react33.useMemo)(
|
|
3991
4334
|
() => ({
|
|
3992
4335
|
slots,
|
|
3993
4336
|
activeIndex,
|
|
@@ -4020,7 +4363,7 @@ function useInputOTP({
|
|
|
4020
4363
|
}
|
|
4021
4364
|
|
|
4022
4365
|
// src/input-otp/useInputOTPSlot.ts
|
|
4023
|
-
var
|
|
4366
|
+
var import_react34 = require("react");
|
|
4024
4367
|
function useInputOTPSlot(index) {
|
|
4025
4368
|
const {
|
|
4026
4369
|
slots,
|
|
@@ -4090,13 +4433,13 @@ function useInputOTPSlot(index) {
|
|
|
4090
4433
|
event.preventDefault();
|
|
4091
4434
|
handlePaste(event.clipboardData.getData("text/plain"));
|
|
4092
4435
|
};
|
|
4093
|
-
const setInputRef = (0,
|
|
4436
|
+
const setInputRef = (0, import_react34.useCallback)(
|
|
4094
4437
|
(element) => {
|
|
4095
4438
|
inputRefs.current[index] = element;
|
|
4096
4439
|
},
|
|
4097
4440
|
[index, inputRefs]
|
|
4098
4441
|
);
|
|
4099
|
-
const focusSlot = (0,
|
|
4442
|
+
const focusSlot = (0, import_react34.useCallback)(() => {
|
|
4100
4443
|
inputRefs.current[index]?.focus();
|
|
4101
4444
|
}, [index, inputRefs]);
|
|
4102
4445
|
return {
|
|
@@ -4139,11 +4482,11 @@ function InputOTP({
|
|
|
4139
4482
|
}
|
|
4140
4483
|
) });
|
|
4141
4484
|
}
|
|
4142
|
-
var InputOTPGroup =
|
|
4485
|
+
var InputOTPGroup = React19.forwardRef(
|
|
4143
4486
|
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { ref, className: cn("flex items-center", className), ...props })
|
|
4144
4487
|
);
|
|
4145
4488
|
InputOTPGroup.displayName = "InputOTPGroup";
|
|
4146
|
-
var InputOTPSlot =
|
|
4489
|
+
var InputOTPSlot = React19.forwardRef(
|
|
4147
4490
|
({ index, className, ...props }, ref) => {
|
|
4148
4491
|
const {
|
|
4149
4492
|
char,
|
|
@@ -4192,13 +4535,13 @@ var InputOTPSlot = React18.forwardRef(
|
|
|
4192
4535
|
}
|
|
4193
4536
|
);
|
|
4194
4537
|
InputOTPSlot.displayName = "InputOTPSlot";
|
|
4195
|
-
var InputOTPSeparator =
|
|
4538
|
+
var InputOTPSeparator = React19.forwardRef(
|
|
4196
4539
|
(props, ref) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { ref, role: "separator", ...props })
|
|
4197
4540
|
);
|
|
4198
4541
|
InputOTPSeparator.displayName = "InputOTPSeparator";
|
|
4199
4542
|
|
|
4200
4543
|
// src/icons-dropdown/IconsDropdown.tsx
|
|
4201
|
-
var
|
|
4544
|
+
var import_react35 = require("react");
|
|
4202
4545
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
4203
4546
|
function IconsDropdown({
|
|
4204
4547
|
icons,
|
|
@@ -4210,7 +4553,7 @@ function IconsDropdown({
|
|
|
4210
4553
|
defaultOpen,
|
|
4211
4554
|
onOpenChange: onOpenChangeProp
|
|
4212
4555
|
}) {
|
|
4213
|
-
const [open, setOpen] = (0,
|
|
4556
|
+
const [open, setOpen] = (0, import_react35.useState)(defaultOpen ?? false);
|
|
4214
4557
|
function handleOpenChange(value) {
|
|
4215
4558
|
setOpen(value);
|
|
4216
4559
|
onOpenChangeProp?.(value);
|
|
@@ -4793,9 +5136,9 @@ function LearnMoreButton({ label, ...props }) {
|
|
|
4793
5136
|
}
|
|
4794
5137
|
|
|
4795
5138
|
// src/link/Link.tsx
|
|
4796
|
-
var
|
|
5139
|
+
var import_react36 = require("react");
|
|
4797
5140
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
4798
|
-
var LinkInternal = (0,
|
|
5141
|
+
var LinkInternal = (0, import_react36.forwardRef)(
|
|
4799
5142
|
({ disabled = false, className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
4800
5143
|
"a",
|
|
4801
5144
|
{
|
|
@@ -4814,17 +5157,17 @@ var LinkInternal = (0, import_react23.forwardRef)(
|
|
|
4814
5157
|
)
|
|
4815
5158
|
);
|
|
4816
5159
|
LinkInternal.displayName = "Link";
|
|
4817
|
-
var Link = (0,
|
|
5160
|
+
var Link = (0, import_react36.memo)(LinkInternal);
|
|
4818
5161
|
|
|
4819
5162
|
// src/image-full-screen-view/ImageFullScreenView.tsx
|
|
4820
|
-
var
|
|
5163
|
+
var import_react37 = require("react");
|
|
4821
5164
|
var import_lucide_react20 = require("lucide-react");
|
|
4822
5165
|
var import_react_i18next13 = require("react-i18next");
|
|
4823
5166
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
4824
5167
|
function ImageFullScreenView({ src, alt, onClose }) {
|
|
4825
5168
|
const { t } = (0, import_react_i18next13.useTranslation)();
|
|
4826
|
-
const [scale, setScale] = (0,
|
|
4827
|
-
const [rotation, setRotation] = (0,
|
|
5169
|
+
const [scale, setScale] = (0, import_react37.useState)(1);
|
|
5170
|
+
const [rotation, setRotation] = (0, import_react37.useState)(0);
|
|
4828
5171
|
useClickEscape({ onClick: onClose });
|
|
4829
5172
|
const zoomIn = () => setScale((value) => Math.min(value + 0.25, 3));
|
|
4830
5173
|
const zoomOut = () => setScale((value) => Math.max(value - 0.25, 0.5));
|
|
@@ -5022,55 +5365,9 @@ var METRIC_CARD_VARIANTS = {
|
|
|
5022
5365
|
};
|
|
5023
5366
|
|
|
5024
5367
|
// src/modal/Modal.tsx
|
|
5025
|
-
var
|
|
5368
|
+
var import_react38 = require("react");
|
|
5026
5369
|
var import_lucide_react23 = require("lucide-react");
|
|
5027
5370
|
|
|
5028
|
-
// src/lib/use-scroll-frame-into-view.ts
|
|
5029
|
-
var import_react25 = require("react");
|
|
5030
|
-
|
|
5031
|
-
// src/lib/runtimeSettings.ts
|
|
5032
|
-
function getChekinRuntimeSettings() {
|
|
5033
|
-
return window.ChekinProSettings || window.ChekinHousingsSDKSettings || {};
|
|
5034
|
-
}
|
|
5035
|
-
function isMobileModalModeAvailable() {
|
|
5036
|
-
const settings = getChekinRuntimeSettings();
|
|
5037
|
-
return !settings.autoHeight;
|
|
5038
|
-
}
|
|
5039
|
-
|
|
5040
|
-
// src/lib/use-scroll-frame-into-view.ts
|
|
5041
|
-
function useScrollFrameIntoView(active, options = {}) {
|
|
5042
|
-
const { behavior = "smooth", elementRef } = options;
|
|
5043
|
-
(0, import_react25.useEffect)(() => {
|
|
5044
|
-
const sdkWindow = window;
|
|
5045
|
-
if (!active || !getChekinRuntimeSettings()?.autoHeight) {
|
|
5046
|
-
return;
|
|
5047
|
-
}
|
|
5048
|
-
const frame = sdkWindow.chekinCustomFrame;
|
|
5049
|
-
if (!frame) {
|
|
5050
|
-
return;
|
|
5051
|
-
}
|
|
5052
|
-
const parentWindow = window.parent;
|
|
5053
|
-
const scrollToElement = () => {
|
|
5054
|
-
const frameRect = frame.getBoundingClientRect();
|
|
5055
|
-
if (elementRef?.current) {
|
|
5056
|
-
const elementRect = elementRef.current.getBoundingClientRect();
|
|
5057
|
-
const elementCenterInFrame = elementRect.top + elementRect.height / 2;
|
|
5058
|
-
const elementCenterInParent = frameRect.top + elementCenterInFrame;
|
|
5059
|
-
const targetScroll = parentWindow.scrollY + elementCenterInParent - parentWindow.innerHeight / 2;
|
|
5060
|
-
parentWindow.scrollTo({
|
|
5061
|
-
top: Math.max(0, targetScroll),
|
|
5062
|
-
behavior
|
|
5063
|
-
});
|
|
5064
|
-
return;
|
|
5065
|
-
}
|
|
5066
|
-
frame.scrollIntoView({ behavior, block: "start" });
|
|
5067
|
-
};
|
|
5068
|
-
requestAnimationFrame(() => {
|
|
5069
|
-
requestAnimationFrame(scrollToElement);
|
|
5070
|
-
});
|
|
5071
|
-
}, [active, behavior, elementRef]);
|
|
5072
|
-
}
|
|
5073
|
-
|
|
5074
5371
|
// src/modal/styles.module.css
|
|
5075
5372
|
var styles_default4 = {};
|
|
5076
5373
|
|
|
@@ -5099,7 +5396,7 @@ function Modal({
|
|
|
5099
5396
|
container,
|
|
5100
5397
|
modal
|
|
5101
5398
|
}) {
|
|
5102
|
-
const contentRef = (0,
|
|
5399
|
+
const contentRef = (0, import_react38.useRef)(null);
|
|
5103
5400
|
useScrollFrameIntoView(open, { elementRef: contentRef });
|
|
5104
5401
|
const handleClose = () => {
|
|
5105
5402
|
onOpenChange?.(false);
|
|
@@ -5141,7 +5438,7 @@ function Modal({
|
|
|
5141
5438
|
}
|
|
5142
5439
|
) });
|
|
5143
5440
|
}
|
|
5144
|
-
var ModalButton = (0,
|
|
5441
|
+
var ModalButton = (0, import_react38.forwardRef)(
|
|
5145
5442
|
({ children, size, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5146
5443
|
Button,
|
|
5147
5444
|
{
|
|
@@ -5157,9 +5454,9 @@ ModalButton.displayName = "ModalButton";
|
|
|
5157
5454
|
Modal.displayName = "Modal";
|
|
5158
5455
|
|
|
5159
5456
|
// src/modal-loader/ModalLoader.tsx
|
|
5160
|
-
var
|
|
5457
|
+
var import_react39 = require("react");
|
|
5161
5458
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
5162
|
-
var ModalLoader = (0,
|
|
5459
|
+
var ModalLoader = (0, import_react39.memo)(({ visible, className }) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
5163
5460
|
"div",
|
|
5164
5461
|
{
|
|
5165
5462
|
className: cn(
|
|
@@ -5229,14 +5526,14 @@ var import_react_i18next16 = require("react-i18next");
|
|
|
5229
5526
|
var import_lucide_react24 = require("lucide-react");
|
|
5230
5527
|
|
|
5231
5528
|
// src/select/Select.tsx
|
|
5232
|
-
var
|
|
5529
|
+
var React20 = __toESM(require("react"), 1);
|
|
5233
5530
|
var RadixSelect = __toESM(require("@radix-ui/react-select"), 1);
|
|
5234
5531
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
5235
5532
|
var SelectRoot = RadixSelect.Root;
|
|
5236
5533
|
var SelectValue = RadixSelect.Value;
|
|
5237
5534
|
var SelectGroup = RadixSelect.Group;
|
|
5238
5535
|
var SelectPortal = RadixSelect.Portal;
|
|
5239
|
-
var SelectTrigger =
|
|
5536
|
+
var SelectTrigger = React20.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
5240
5537
|
RadixSelect.Trigger,
|
|
5241
5538
|
{
|
|
5242
5539
|
ref,
|
|
@@ -5277,7 +5574,7 @@ var SelectTrigger = React19.forwardRef(({ className, children, ...props }, ref)
|
|
|
5277
5574
|
}
|
|
5278
5575
|
));
|
|
5279
5576
|
SelectTrigger.displayName = "SelectTrigger";
|
|
5280
|
-
var SelectContent =
|
|
5577
|
+
var SelectContent = React20.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(RadixSelect.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
5281
5578
|
RadixSelect.Content,
|
|
5282
5579
|
{
|
|
5283
5580
|
ref,
|
|
@@ -5296,7 +5593,7 @@ var SelectContent = React19.forwardRef(({ className, children, position = "poppe
|
|
|
5296
5593
|
}
|
|
5297
5594
|
) }));
|
|
5298
5595
|
SelectContent.displayName = "SelectContent";
|
|
5299
|
-
var SelectItem =
|
|
5596
|
+
var SelectItem = React20.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
5300
5597
|
RadixSelect.Item,
|
|
5301
5598
|
{
|
|
5302
5599
|
ref,
|
|
@@ -5331,7 +5628,7 @@ var SelectItem = React19.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
5331
5628
|
}
|
|
5332
5629
|
));
|
|
5333
5630
|
SelectItem.displayName = "SelectItem";
|
|
5334
|
-
var SelectSeparator =
|
|
5631
|
+
var SelectSeparator = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
5335
5632
|
RadixSelect.Separator,
|
|
5336
5633
|
{
|
|
5337
5634
|
ref,
|
|
@@ -5340,7 +5637,7 @@ var SelectSeparator = React19.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
5340
5637
|
}
|
|
5341
5638
|
));
|
|
5342
5639
|
SelectSeparator.displayName = "SelectSeparator";
|
|
5343
|
-
var SelectLabel =
|
|
5640
|
+
var SelectLabel = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
5344
5641
|
RadixSelect.Label,
|
|
5345
5642
|
{
|
|
5346
5643
|
ref,
|
|
@@ -5352,7 +5649,7 @@ var SelectLabel = React19.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5352
5649
|
}
|
|
5353
5650
|
));
|
|
5354
5651
|
SelectLabel.displayName = "SelectLabel";
|
|
5355
|
-
var Select =
|
|
5652
|
+
var Select = React20.forwardRef(
|
|
5356
5653
|
({
|
|
5357
5654
|
placeholder,
|
|
5358
5655
|
label,
|
|
@@ -5363,9 +5660,9 @@ var Select = React19.forwardRef(
|
|
|
5363
5660
|
children,
|
|
5364
5661
|
...props
|
|
5365
5662
|
}, ref) => {
|
|
5366
|
-
const reactId =
|
|
5663
|
+
const reactId = React20.useId();
|
|
5367
5664
|
const triggerId = props.name ?? reactId;
|
|
5368
|
-
const internalRef =
|
|
5665
|
+
const internalRef = React20.useRef(null);
|
|
5369
5666
|
const combinedRef = useCombinedRef(ref, internalRef);
|
|
5370
5667
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: cn("flex flex-col gap-chekin-1 w-[300px]", containerClassName), children: [
|
|
5371
5668
|
label && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
@@ -5522,7 +5819,7 @@ function Pagination({
|
|
|
5522
5819
|
}
|
|
5523
5820
|
|
|
5524
5821
|
// src/popover/Popover.tsx
|
|
5525
|
-
var
|
|
5822
|
+
var React21 = __toESM(require("react"), 1);
|
|
5526
5823
|
var RadixPopover = __toESM(require("@radix-ui/react-popover"), 1);
|
|
5527
5824
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
5528
5825
|
var Popover = RadixPopover.Root;
|
|
@@ -5530,7 +5827,7 @@ var PopoverTrigger = RadixPopover.Trigger;
|
|
|
5530
5827
|
var PopoverAnchor = RadixPopover.Anchor;
|
|
5531
5828
|
var PopoverPortal = RadixPopover.Portal;
|
|
5532
5829
|
var PopoverClose = RadixPopover.Close;
|
|
5533
|
-
var PopoverContent =
|
|
5830
|
+
var PopoverContent = React21.forwardRef(({ className, sideOffset = 8, align = "start", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(RadixPopover.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5534
5831
|
RadixPopover.Content,
|
|
5535
5832
|
{
|
|
5536
5833
|
ref,
|
|
@@ -5547,14 +5844,14 @@ var PopoverContent = React20.forwardRef(({ className, sideOffset = 8, align = "s
|
|
|
5547
5844
|
PopoverContent.displayName = "PopoverContent";
|
|
5548
5845
|
|
|
5549
5846
|
// src/radio/Radio.tsx
|
|
5550
|
-
var
|
|
5847
|
+
var import_react41 = require("react");
|
|
5551
5848
|
|
|
5552
5849
|
// src/radio-group/RadioGroup.tsx
|
|
5553
|
-
var
|
|
5850
|
+
var React22 = __toESM(require("react"), 1);
|
|
5554
5851
|
var RadioGroupPrimitive = __toESM(require("@radix-ui/react-radio-group"), 1);
|
|
5555
5852
|
var import_lucide_react25 = require("lucide-react");
|
|
5556
5853
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
5557
|
-
var RadioGroup =
|
|
5854
|
+
var RadioGroup = React22.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
5558
5855
|
RadioGroupPrimitive.Root,
|
|
5559
5856
|
{
|
|
5560
5857
|
ref,
|
|
@@ -5563,7 +5860,7 @@ var RadioGroup = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
5563
5860
|
}
|
|
5564
5861
|
));
|
|
5565
5862
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
5566
|
-
var RadioGroupItem =
|
|
5863
|
+
var RadioGroupItem = React22.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
5567
5864
|
RadioGroupPrimitive.Item,
|
|
5568
5865
|
{
|
|
5569
5866
|
ref,
|
|
@@ -5580,11 +5877,11 @@ var RadioGroupItem = React21.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
5580
5877
|
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
5581
5878
|
|
|
5582
5879
|
// src/radio/useRadioOptions.ts
|
|
5583
|
-
var
|
|
5880
|
+
var import_react40 = require("react");
|
|
5584
5881
|
function useRadioOptions({ options, defaultValue, onChange }) {
|
|
5585
5882
|
const initialValue = (typeof defaultValue === "string" ? options.find((option) => option.value === defaultValue) : defaultValue) || "";
|
|
5586
|
-
const [selectedValue, setSelectedValue] = (0,
|
|
5587
|
-
const handleValueChange = (0,
|
|
5883
|
+
const [selectedValue, setSelectedValue] = (0, import_react40.useState)(initialValue);
|
|
5884
|
+
const handleValueChange = (0, import_react40.useCallback)(
|
|
5588
5885
|
(value) => {
|
|
5589
5886
|
setSelectedValue(value);
|
|
5590
5887
|
const selectedOption = options.find((option) => option.value === value) || "";
|
|
@@ -5605,7 +5902,7 @@ var styles_default5 = {};
|
|
|
5605
5902
|
|
|
5606
5903
|
// src/radio/Radio.tsx
|
|
5607
5904
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
5608
|
-
var Radio = (0,
|
|
5905
|
+
var Radio = (0, import_react41.forwardRef)(
|
|
5609
5906
|
({ options, value, onChange, error, className = "", disabled = false, renderOption }, ref) => {
|
|
5610
5907
|
const { selectedValue, handleValueChange } = useRadioOptions({
|
|
5611
5908
|
options,
|
|
@@ -5792,7 +6089,7 @@ function RatingRadioGroup({
|
|
|
5792
6089
|
}
|
|
5793
6090
|
|
|
5794
6091
|
// src/rating-stars/RatingStars.tsx
|
|
5795
|
-
var
|
|
6092
|
+
var React23 = __toESM(require("react"), 1);
|
|
5796
6093
|
var import_lucide_react27 = require("lucide-react");
|
|
5797
6094
|
var import_react_i18next17 = require("react-i18next");
|
|
5798
6095
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
@@ -5812,7 +6109,7 @@ function RatingStars({
|
|
|
5812
6109
|
const { t } = (0, import_react_i18next17.useTranslation)();
|
|
5813
6110
|
const normalizedRating = Math.max(0, Math.min(maxRating, rating));
|
|
5814
6111
|
const stars = Array.from({ length: maxRating }, (_, index) => index + 1);
|
|
5815
|
-
const componentId =
|
|
6112
|
+
const componentId = React23.useId();
|
|
5816
6113
|
const decimal = normalizedRating - Math.floor(normalizedRating);
|
|
5817
6114
|
const partialStarIndex = decimal > 0 ? Math.ceil(normalizedRating) : -1;
|
|
5818
6115
|
const gradientId = `star-gradient-${componentId.replace(/:/g, "")}`;
|
|
@@ -5995,7 +6292,7 @@ var SectionTagColors = /* @__PURE__ */ ((SectionTagColors2) => {
|
|
|
5995
6292
|
})(SectionTagColors || {});
|
|
5996
6293
|
|
|
5997
6294
|
// src/section/Section.tsx
|
|
5998
|
-
var
|
|
6295
|
+
var import_react42 = require("react");
|
|
5999
6296
|
var import_lucide_react31 = require("lucide-react");
|
|
6000
6297
|
|
|
6001
6298
|
// src/section/constants.ts
|
|
@@ -6022,7 +6319,7 @@ function TooltipInfo({ content, className }) {
|
|
|
6022
6319
|
}
|
|
6023
6320
|
) });
|
|
6024
6321
|
}
|
|
6025
|
-
var Section = (0,
|
|
6322
|
+
var Section = (0, import_react42.forwardRef)(
|
|
6026
6323
|
({
|
|
6027
6324
|
children,
|
|
6028
6325
|
title,
|
|
@@ -6074,17 +6371,17 @@ var Section = (0, import_react30.forwardRef)(
|
|
|
6074
6371
|
)
|
|
6075
6372
|
);
|
|
6076
6373
|
Section.displayName = "Section";
|
|
6077
|
-
var SubSection = (0,
|
|
6374
|
+
var SubSection = (0, import_react42.forwardRef)(
|
|
6078
6375
|
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Section, { ref, className: cn(Section_default.section_sub, className), ...props })
|
|
6079
6376
|
);
|
|
6080
6377
|
SubSection.displayName = "SubSection";
|
|
6081
|
-
var DividingSubsection = (0,
|
|
6378
|
+
var DividingSubsection = (0, import_react42.forwardRef)(
|
|
6082
6379
|
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(SubSection, { ref, className: cn(Section_default.section_dividing, className), ...props })
|
|
6083
6380
|
);
|
|
6084
6381
|
DividingSubsection.displayName = "DividingSubsection";
|
|
6085
6382
|
|
|
6086
6383
|
// src/selectors/Selectors.tsx
|
|
6087
|
-
var
|
|
6384
|
+
var import_react43 = require("react");
|
|
6088
6385
|
|
|
6089
6386
|
// src/selector-button/styles.module.css
|
|
6090
6387
|
var styles_default7 = {};
|
|
@@ -6156,8 +6453,8 @@ var getValueArray = (value) => {
|
|
|
6156
6453
|
return [];
|
|
6157
6454
|
};
|
|
6158
6455
|
function getSelectorContent(label, disabled, readOnly, active) {
|
|
6159
|
-
if ((0,
|
|
6160
|
-
return (0,
|
|
6456
|
+
if ((0, import_react43.isValidElement)(label)) {
|
|
6457
|
+
return (0, import_react43.cloneElement)(label, {
|
|
6161
6458
|
disabled,
|
|
6162
6459
|
readOnly,
|
|
6163
6460
|
active
|
|
@@ -6202,7 +6499,7 @@ function SelectorsInternal({
|
|
|
6202
6499
|
}
|
|
6203
6500
|
};
|
|
6204
6501
|
const isAnyActive = getValueArray(value).length > 0;
|
|
6205
|
-
(0,
|
|
6502
|
+
(0, import_react43.useEffect)(() => {
|
|
6206
6503
|
onAnySelectorActive?.(isAnyActive);
|
|
6207
6504
|
}, [isAnyActive, onAnySelectorActive]);
|
|
6208
6505
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
|
|
@@ -6245,7 +6542,7 @@ function SelectorsInternal({
|
|
|
6245
6542
|
)
|
|
6246
6543
|
] });
|
|
6247
6544
|
}
|
|
6248
|
-
var Selectors = (0,
|
|
6545
|
+
var Selectors = (0, import_react43.forwardRef)(SelectorsInternal);
|
|
6249
6546
|
|
|
6250
6547
|
// src/separator/Separator.tsx
|
|
6251
6548
|
var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"), 1);
|
|
@@ -6383,30 +6680,11 @@ function SheetDescription({
|
|
|
6383
6680
|
}
|
|
6384
6681
|
|
|
6385
6682
|
// src/sidebar/Sidebar.tsx
|
|
6386
|
-
var
|
|
6683
|
+
var React24 = __toESM(require("react"), 1);
|
|
6387
6684
|
var import_react_slot4 = require("@radix-ui/react-slot");
|
|
6388
6685
|
var import_class_variance_authority11 = require("class-variance-authority");
|
|
6389
6686
|
var import_lucide_react33 = require("lucide-react");
|
|
6390
6687
|
|
|
6391
|
-
// src/lib/use-is-mobile.ts
|
|
6392
|
-
var import_react32 = require("react");
|
|
6393
|
-
var MOBILE_BREAKPOINT = 768;
|
|
6394
|
-
function useIsMobile({ breakpoint = MOBILE_BREAKPOINT } = {}) {
|
|
6395
|
-
const [isMobile, setIsMobile] = (0, import_react32.useState)(void 0);
|
|
6396
|
-
(0, import_react32.useEffect)(() => {
|
|
6397
|
-
const mediaQuery = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
|
6398
|
-
const onChange = () => {
|
|
6399
|
-
setIsMobile(window.innerWidth < breakpoint);
|
|
6400
|
-
};
|
|
6401
|
-
mediaQuery.addEventListener("change", onChange);
|
|
6402
|
-
setIsMobile(window.innerWidth < breakpoint);
|
|
6403
|
-
return () => {
|
|
6404
|
-
mediaQuery.removeEventListener("change", onChange);
|
|
6405
|
-
};
|
|
6406
|
-
}, [breakpoint]);
|
|
6407
|
-
return !!isMobile;
|
|
6408
|
-
}
|
|
6409
|
-
|
|
6410
6688
|
// src/skeleton/Skeleton.tsx
|
|
6411
6689
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
6412
6690
|
function Skeleton({ className, ...props }) {
|
|
@@ -6424,19 +6702,19 @@ function Skeleton({ className, ...props }) {
|
|
|
6424
6702
|
}
|
|
6425
6703
|
|
|
6426
6704
|
// src/sidebar/SidebarContext.ts
|
|
6427
|
-
var
|
|
6428
|
-
var SidebarContext = (0,
|
|
6705
|
+
var import_react44 = require("react");
|
|
6706
|
+
var SidebarContext = (0, import_react44.createContext)(null);
|
|
6429
6707
|
|
|
6430
6708
|
// src/sidebar/useSidebarMenuButton.ts
|
|
6431
|
-
var
|
|
6709
|
+
var import_react46 = require("react");
|
|
6432
6710
|
|
|
6433
6711
|
// src/sidebar/SidebarMenuButtonContext.ts
|
|
6434
|
-
var
|
|
6435
|
-
var SidebarMenuButtonContext = (0,
|
|
6712
|
+
var import_react45 = require("react");
|
|
6713
|
+
var SidebarMenuButtonContext = (0, import_react45.createContext)(null);
|
|
6436
6714
|
|
|
6437
6715
|
// src/sidebar/useSidebarMenuButton.ts
|
|
6438
6716
|
function useSidebarMenuButton() {
|
|
6439
|
-
return (0,
|
|
6717
|
+
return (0, import_react46.useContext)(SidebarMenuButtonContext);
|
|
6440
6718
|
}
|
|
6441
6719
|
|
|
6442
6720
|
// src/sidebar/SidebarIcon.tsx
|
|
@@ -6477,16 +6755,16 @@ var SidebarIcon = ({
|
|
|
6477
6755
|
};
|
|
6478
6756
|
|
|
6479
6757
|
// src/sidebar/useSidebar.ts
|
|
6480
|
-
var
|
|
6758
|
+
var import_react47 = require("react");
|
|
6481
6759
|
function useSidebar() {
|
|
6482
|
-
const context = (0,
|
|
6760
|
+
const context = (0, import_react47.useContext)(SidebarContext);
|
|
6483
6761
|
if (!context) {
|
|
6484
6762
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
6485
6763
|
}
|
|
6486
6764
|
return context;
|
|
6487
6765
|
}
|
|
6488
6766
|
function useSidebarSafe() {
|
|
6489
|
-
return (0,
|
|
6767
|
+
return (0, import_react47.useContext)(SidebarContext);
|
|
6490
6768
|
}
|
|
6491
6769
|
|
|
6492
6770
|
// src/sidebar/Sidebar.tsx
|
|
@@ -6495,7 +6773,7 @@ var SIDEBAR_COOKIE_NAME_DEFAULT = "sidebar_state";
|
|
|
6495
6773
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
6496
6774
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
6497
6775
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
6498
|
-
var SidebarProvider =
|
|
6776
|
+
var SidebarProvider = React24.forwardRef(
|
|
6499
6777
|
({
|
|
6500
6778
|
defaultOpen = true,
|
|
6501
6779
|
open: openProp,
|
|
@@ -6507,10 +6785,10 @@ var SidebarProvider = React23.forwardRef(
|
|
|
6507
6785
|
...props
|
|
6508
6786
|
}, ref) => {
|
|
6509
6787
|
const isMobile = useIsMobile({ breakpoint: 641 });
|
|
6510
|
-
const [openMobile, setOpenMobile] =
|
|
6511
|
-
const [_open, _setOpen] =
|
|
6788
|
+
const [openMobile, setOpenMobile] = React24.useState(false);
|
|
6789
|
+
const [_open, _setOpen] = React24.useState(defaultOpen);
|
|
6512
6790
|
const open = openProp ?? _open;
|
|
6513
|
-
const setOpen =
|
|
6791
|
+
const setOpen = React24.useCallback(
|
|
6514
6792
|
(value) => {
|
|
6515
6793
|
const openState = typeof value === "function" ? value(open) : value;
|
|
6516
6794
|
if (setOpenProp) {
|
|
@@ -6522,10 +6800,10 @@ var SidebarProvider = React23.forwardRef(
|
|
|
6522
6800
|
},
|
|
6523
6801
|
[setOpenProp, open, stateName]
|
|
6524
6802
|
);
|
|
6525
|
-
const toggleSidebar =
|
|
6803
|
+
const toggleSidebar = React24.useCallback(() => {
|
|
6526
6804
|
return isMobile ? setOpenMobile((value) => !value) : setOpen((value) => !value);
|
|
6527
6805
|
}, [isMobile, setOpen]);
|
|
6528
|
-
|
|
6806
|
+
React24.useEffect(() => {
|
|
6529
6807
|
const handleKeyDown = (event) => {
|
|
6530
6808
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
6531
6809
|
event.preventDefault();
|
|
@@ -6536,7 +6814,7 @@ var SidebarProvider = React23.forwardRef(
|
|
|
6536
6814
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
6537
6815
|
}, [toggleSidebar]);
|
|
6538
6816
|
const state = open ? "expanded" : "collapsed";
|
|
6539
|
-
const contextValue =
|
|
6817
|
+
const contextValue = React24.useMemo(
|
|
6540
6818
|
() => ({
|
|
6541
6819
|
state,
|
|
6542
6820
|
open,
|
|
@@ -6561,7 +6839,7 @@ var SidebarProvider = React23.forwardRef(
|
|
|
6561
6839
|
}
|
|
6562
6840
|
);
|
|
6563
6841
|
SidebarProvider.displayName = "SidebarProvider";
|
|
6564
|
-
var Sidebar =
|
|
6842
|
+
var Sidebar = React24.forwardRef(
|
|
6565
6843
|
({
|
|
6566
6844
|
side = "left",
|
|
6567
6845
|
variant = "sidebar",
|
|
@@ -6655,7 +6933,7 @@ var Sidebar = React23.forwardRef(
|
|
|
6655
6933
|
}
|
|
6656
6934
|
);
|
|
6657
6935
|
Sidebar.displayName = "Sidebar";
|
|
6658
|
-
var SidebarTrigger =
|
|
6936
|
+
var SidebarTrigger = React24.forwardRef(({ className, onClick, icon, ...props }, ref) => {
|
|
6659
6937
|
const { toggleSidebar, open, isMobile, openMobile } = useSidebar();
|
|
6660
6938
|
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
|
|
6661
6939
|
Button,
|
|
@@ -6682,7 +6960,7 @@ var SidebarTrigger = React23.forwardRef(({ className, onClick, icon, ...props },
|
|
|
6682
6960
|
);
|
|
6683
6961
|
});
|
|
6684
6962
|
SidebarTrigger.displayName = "SidebarTrigger";
|
|
6685
|
-
var SidebarRail =
|
|
6963
|
+
var SidebarRail = React24.forwardRef(
|
|
6686
6964
|
({ className, ...props }, ref) => {
|
|
6687
6965
|
const { toggleSidebar } = useSidebar();
|
|
6688
6966
|
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
@@ -6708,7 +6986,7 @@ var SidebarRail = React23.forwardRef(
|
|
|
6708
6986
|
}
|
|
6709
6987
|
);
|
|
6710
6988
|
SidebarRail.displayName = "SidebarRail";
|
|
6711
|
-
var SidebarInset =
|
|
6989
|
+
var SidebarInset = React24.forwardRef(
|
|
6712
6990
|
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
6713
6991
|
"main",
|
|
6714
6992
|
{
|
|
@@ -6723,7 +7001,7 @@ var SidebarInset = React23.forwardRef(
|
|
|
6723
7001
|
)
|
|
6724
7002
|
);
|
|
6725
7003
|
SidebarInset.displayName = "SidebarInset";
|
|
6726
|
-
var SidebarInput =
|
|
7004
|
+
var SidebarInput = React24.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
6727
7005
|
Input,
|
|
6728
7006
|
{
|
|
6729
7007
|
ref,
|
|
@@ -6733,7 +7011,7 @@ var SidebarInput = React23.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
6733
7011
|
}
|
|
6734
7012
|
));
|
|
6735
7013
|
SidebarInput.displayName = "SidebarInput";
|
|
6736
|
-
var SidebarHeader =
|
|
7014
|
+
var SidebarHeader = React24.forwardRef(
|
|
6737
7015
|
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
6738
7016
|
"div",
|
|
6739
7017
|
{
|
|
@@ -6745,7 +7023,7 @@ var SidebarHeader = React23.forwardRef(
|
|
|
6745
7023
|
)
|
|
6746
7024
|
);
|
|
6747
7025
|
SidebarHeader.displayName = "SidebarHeader";
|
|
6748
|
-
var SidebarFooter =
|
|
7026
|
+
var SidebarFooter = React24.forwardRef(
|
|
6749
7027
|
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
6750
7028
|
"div",
|
|
6751
7029
|
{
|
|
@@ -6757,7 +7035,7 @@ var SidebarFooter = React23.forwardRef(
|
|
|
6757
7035
|
)
|
|
6758
7036
|
);
|
|
6759
7037
|
SidebarFooter.displayName = "SidebarFooter";
|
|
6760
|
-
var SidebarSeparator =
|
|
7038
|
+
var SidebarSeparator = React24.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
6761
7039
|
Separator3,
|
|
6762
7040
|
{
|
|
6763
7041
|
ref,
|
|
@@ -6767,7 +7045,7 @@ var SidebarSeparator = React23.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
6767
7045
|
}
|
|
6768
7046
|
));
|
|
6769
7047
|
SidebarSeparator.displayName = "SidebarSeparator";
|
|
6770
|
-
var SidebarContent =
|
|
7048
|
+
var SidebarContent = React24.forwardRef(
|
|
6771
7049
|
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
6772
7050
|
"div",
|
|
6773
7051
|
{
|
|
@@ -6782,7 +7060,7 @@ var SidebarContent = React23.forwardRef(
|
|
|
6782
7060
|
)
|
|
6783
7061
|
);
|
|
6784
7062
|
SidebarContent.displayName = "SidebarContent";
|
|
6785
|
-
var SidebarGroup =
|
|
7063
|
+
var SidebarGroup = React24.forwardRef(
|
|
6786
7064
|
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
6787
7065
|
"div",
|
|
6788
7066
|
{
|
|
@@ -6794,7 +7072,7 @@ var SidebarGroup = React23.forwardRef(
|
|
|
6794
7072
|
)
|
|
6795
7073
|
);
|
|
6796
7074
|
SidebarGroup.displayName = "SidebarGroup";
|
|
6797
|
-
var SidebarGroupLabel =
|
|
7075
|
+
var SidebarGroupLabel = React24.forwardRef(({ className, asChild = false, ...props }, ref) => {
|
|
6798
7076
|
const Comp = asChild ? import_react_slot4.Slot : "div";
|
|
6799
7077
|
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
6800
7078
|
Comp,
|
|
@@ -6811,7 +7089,7 @@ var SidebarGroupLabel = React23.forwardRef(({ className, asChild = false, ...pro
|
|
|
6811
7089
|
);
|
|
6812
7090
|
});
|
|
6813
7091
|
SidebarGroupLabel.displayName = "SidebarGroupLabel";
|
|
6814
|
-
var SidebarGroupAction =
|
|
7092
|
+
var SidebarGroupAction = React24.forwardRef(({ className, asChild = false, ...props }, ref) => {
|
|
6815
7093
|
const Comp = asChild ? import_react_slot4.Slot : "button";
|
|
6816
7094
|
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
6817
7095
|
Comp,
|
|
@@ -6827,7 +7105,7 @@ var SidebarGroupAction = React23.forwardRef(({ className, asChild = false, ...pr
|
|
|
6827
7105
|
);
|
|
6828
7106
|
});
|
|
6829
7107
|
SidebarGroupAction.displayName = "SidebarGroupAction";
|
|
6830
|
-
var SidebarGroupContent =
|
|
7108
|
+
var SidebarGroupContent = React24.forwardRef(
|
|
6831
7109
|
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
6832
7110
|
"div",
|
|
6833
7111
|
{
|
|
@@ -6839,7 +7117,7 @@ var SidebarGroupContent = React23.forwardRef(
|
|
|
6839
7117
|
)
|
|
6840
7118
|
);
|
|
6841
7119
|
SidebarGroupContent.displayName = "SidebarGroupContent";
|
|
6842
|
-
var SidebarMenu =
|
|
7120
|
+
var SidebarMenu = React24.forwardRef(
|
|
6843
7121
|
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
6844
7122
|
"ul",
|
|
6845
7123
|
{
|
|
@@ -6851,7 +7129,7 @@ var SidebarMenu = React23.forwardRef(
|
|
|
6851
7129
|
)
|
|
6852
7130
|
);
|
|
6853
7131
|
SidebarMenu.displayName = "SidebarMenu";
|
|
6854
|
-
var SidebarMenuItem =
|
|
7132
|
+
var SidebarMenuItem = React24.forwardRef(
|
|
6855
7133
|
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
6856
7134
|
"li",
|
|
6857
7135
|
{
|
|
@@ -6883,7 +7161,7 @@ var sidebarMenuButtonVariants = (0, import_class_variance_authority11.cva)(
|
|
|
6883
7161
|
}
|
|
6884
7162
|
}
|
|
6885
7163
|
);
|
|
6886
|
-
var SidebarMenuButton =
|
|
7164
|
+
var SidebarMenuButton = React24.forwardRef(
|
|
6887
7165
|
({
|
|
6888
7166
|
asChild = false,
|
|
6889
7167
|
isActive = false,
|
|
@@ -6929,7 +7207,7 @@ var SidebarMenuButton = React23.forwardRef(
|
|
|
6929
7207
|
}
|
|
6930
7208
|
);
|
|
6931
7209
|
SidebarMenuButton.displayName = "SidebarMenuButton";
|
|
6932
|
-
var SidebarMenuAction =
|
|
7210
|
+
var SidebarMenuAction = React24.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
|
|
6933
7211
|
const Comp = asChild ? import_react_slot4.Slot : "button";
|
|
6934
7212
|
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
6935
7213
|
Comp,
|
|
@@ -6946,7 +7224,7 @@ var SidebarMenuAction = React23.forwardRef(({ className, asChild = false, showOn
|
|
|
6946
7224
|
);
|
|
6947
7225
|
});
|
|
6948
7226
|
SidebarMenuAction.displayName = "SidebarMenuAction";
|
|
6949
|
-
var SidebarMenuBadge =
|
|
7227
|
+
var SidebarMenuBadge = React24.forwardRef(
|
|
6950
7228
|
({ className, ...props }, ref) => {
|
|
6951
7229
|
const { open, isMobile, openMobile } = useSidebar();
|
|
6952
7230
|
const isOpen = isMobile ? openMobile : open;
|
|
@@ -6966,8 +7244,8 @@ var SidebarMenuBadge = React23.forwardRef(
|
|
|
6966
7244
|
}
|
|
6967
7245
|
);
|
|
6968
7246
|
SidebarMenuBadge.displayName = "SidebarMenuBadge";
|
|
6969
|
-
var SidebarMenuSkeleton =
|
|
6970
|
-
const width =
|
|
7247
|
+
var SidebarMenuSkeleton = React24.forwardRef(({ className, showIcon = false, ...props }, ref) => {
|
|
7248
|
+
const width = React24.useMemo(() => `${Math.floor(Math.random() * 40) + 50}%`, []);
|
|
6971
7249
|
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
|
|
6972
7250
|
"div",
|
|
6973
7251
|
{
|
|
@@ -6990,7 +7268,7 @@ var SidebarMenuSkeleton = React23.forwardRef(({ className, showIcon = false, ...
|
|
|
6990
7268
|
);
|
|
6991
7269
|
});
|
|
6992
7270
|
SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
|
|
6993
|
-
var SidebarMenuSub =
|
|
7271
|
+
var SidebarMenuSub = React24.forwardRef(
|
|
6994
7272
|
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
6995
7273
|
"ul",
|
|
6996
7274
|
{
|
|
@@ -7005,7 +7283,7 @@ var SidebarMenuSub = React23.forwardRef(
|
|
|
7005
7283
|
)
|
|
7006
7284
|
);
|
|
7007
7285
|
SidebarMenuSub.displayName = "SidebarMenuSub";
|
|
7008
|
-
var SidebarMenuSubItem =
|
|
7286
|
+
var SidebarMenuSubItem = React24.forwardRef(
|
|
7009
7287
|
({ ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("li", { ref, ...props })
|
|
7010
7288
|
);
|
|
7011
7289
|
SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
|
|
@@ -7029,7 +7307,7 @@ var sidebarMenuSubButtonVariants = (0, import_class_variance_authority11.cva)(
|
|
|
7029
7307
|
}
|
|
7030
7308
|
}
|
|
7031
7309
|
);
|
|
7032
|
-
var SidebarMenuSubButton =
|
|
7310
|
+
var SidebarMenuSubButton = React24.forwardRef(
|
|
7033
7311
|
({
|
|
7034
7312
|
asChild = false,
|
|
7035
7313
|
isActive,
|
|
@@ -7059,9 +7337,9 @@ var VALUE_PART = 1;
|
|
|
7059
7337
|
var getSidebarState = (stateName) => document.cookie.split("; ").find((row) => row.startsWith(`${stateName}=`))?.split("=")[VALUE_PART] === "true";
|
|
7060
7338
|
|
|
7061
7339
|
// src/circular-loader/CircularLoader.tsx
|
|
7062
|
-
var
|
|
7340
|
+
var import_react48 = __toESM(require("react"), 1);
|
|
7063
7341
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
7064
|
-
var CircularLoader =
|
|
7342
|
+
var CircularLoader = import_react48.default.memo(
|
|
7065
7343
|
({ visible = true, height, width, position, label, className }) => {
|
|
7066
7344
|
if (!visible) return null;
|
|
7067
7345
|
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
@@ -7155,10 +7433,10 @@ var CircularLoader = import_react37.default.memo(
|
|
|
7155
7433
|
CircularLoader.displayName = "CircularLoader";
|
|
7156
7434
|
|
|
7157
7435
|
// src/small-grid-single-item/SmallGridSingleItem.tsx
|
|
7158
|
-
var
|
|
7436
|
+
var import_react49 = require("react");
|
|
7159
7437
|
var import_lucide_react34 = require("lucide-react");
|
|
7160
7438
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
7161
|
-
var SmallGridSingleItem = (0,
|
|
7439
|
+
var SmallGridSingleItem = (0, import_react49.memo)(
|
|
7162
7440
|
({
|
|
7163
7441
|
title,
|
|
7164
7442
|
subtitle,
|
|
@@ -7279,7 +7557,7 @@ function SortingAction({
|
|
|
7279
7557
|
}
|
|
7280
7558
|
|
|
7281
7559
|
// src/status-button/StatusButton.tsx
|
|
7282
|
-
var
|
|
7560
|
+
var import_react50 = require("react");
|
|
7283
7561
|
var import_react_i18next20 = require("react-i18next");
|
|
7284
7562
|
var import_lucide_react36 = require("lucide-react");
|
|
7285
7563
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
@@ -7297,7 +7575,7 @@ function StatusButton({
|
|
|
7297
7575
|
...props
|
|
7298
7576
|
}) {
|
|
7299
7577
|
const { t } = (0, import_react_i18next20.useTranslation)();
|
|
7300
|
-
const configMap = (0,
|
|
7578
|
+
const configMap = (0, import_react50.useMemo)(() => {
|
|
7301
7579
|
const defaultLoadingConfig = {
|
|
7302
7580
|
text: loadingText ?? `${t("saving")}...`,
|
|
7303
7581
|
icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react36.Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
@@ -7422,9 +7700,9 @@ function Stepper({
|
|
|
7422
7700
|
}
|
|
7423
7701
|
|
|
7424
7702
|
// src/switch-blocks/SwitchBlocks.tsx
|
|
7425
|
-
var
|
|
7703
|
+
var import_react51 = require("react");
|
|
7426
7704
|
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
7427
|
-
var SwitchBlocksInternal = (0,
|
|
7705
|
+
var SwitchBlocksInternal = (0, import_react51.forwardRef)(
|
|
7428
7706
|
({ options, value, onChange, disabled, className }, ref) => /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
7429
7707
|
"div",
|
|
7430
7708
|
{
|
|
@@ -7448,12 +7726,12 @@ var SwitchBlocksInternal = (0, import_react40.forwardRef)(
|
|
|
7448
7726
|
)
|
|
7449
7727
|
);
|
|
7450
7728
|
SwitchBlocksInternal.displayName = "SwitchBlocks";
|
|
7451
|
-
var SwitchBlocks = (0,
|
|
7729
|
+
var SwitchBlocks = (0, import_react51.memo)(SwitchBlocksInternal);
|
|
7452
7730
|
|
|
7453
7731
|
// src/switch-group/SwitchGroup.tsx
|
|
7454
|
-
var
|
|
7732
|
+
var React26 = __toESM(require("react"), 1);
|
|
7455
7733
|
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
7456
|
-
var SwitchGroup =
|
|
7734
|
+
var SwitchGroup = React26.forwardRef(
|
|
7457
7735
|
({ options, value = [], onChange, disabled = false, className, error, ...props }, ref) => {
|
|
7458
7736
|
const handleOptionChange = (optionValue, checked) => {
|
|
7459
7737
|
if (!onChange) return;
|
|
@@ -7508,7 +7786,7 @@ var SwitchGroup = React25.forwardRef(
|
|
|
7508
7786
|
SwitchGroup.displayName = "SwitchGroup";
|
|
7509
7787
|
|
|
7510
7788
|
// src/tabs/Tabs.tsx
|
|
7511
|
-
var
|
|
7789
|
+
var import_react52 = require("react");
|
|
7512
7790
|
var TabsPrimitive2 = __toESM(require("@radix-ui/react-tabs"), 1);
|
|
7513
7791
|
var import_class_variance_authority12 = require("class-variance-authority");
|
|
7514
7792
|
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
@@ -7524,7 +7802,7 @@ var tabsListVariants = (0, import_class_variance_authority12.cva)("inline-flex i
|
|
|
7524
7802
|
variant: "default"
|
|
7525
7803
|
}
|
|
7526
7804
|
});
|
|
7527
|
-
var TabsList = (0,
|
|
7805
|
+
var TabsList = (0, import_react52.forwardRef)(
|
|
7528
7806
|
({ className, variant, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
7529
7807
|
TabsPrimitive2.List,
|
|
7530
7808
|
{
|
|
@@ -7549,7 +7827,7 @@ var tabsTriggerVariants = (0, import_class_variance_authority12.cva)(
|
|
|
7549
7827
|
}
|
|
7550
7828
|
}
|
|
7551
7829
|
);
|
|
7552
|
-
var TabsTrigger = (0,
|
|
7830
|
+
var TabsTrigger = (0, import_react52.forwardRef)(({ className, variant, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
7553
7831
|
TabsPrimitive2.Trigger,
|
|
7554
7832
|
{
|
|
7555
7833
|
ref,
|
|
@@ -7558,7 +7836,7 @@ var TabsTrigger = (0, import_react41.forwardRef)(({ className, variant, ...props
|
|
|
7558
7836
|
}
|
|
7559
7837
|
));
|
|
7560
7838
|
TabsTrigger.displayName = TabsPrimitive2.Trigger.displayName;
|
|
7561
|
-
var TabsContent = (0,
|
|
7839
|
+
var TabsContent = (0, import_react52.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(TabsPrimitive2.Content, { ref, className, tabIndex: -1, ...props }));
|
|
7562
7840
|
TabsContent.displayName = TabsPrimitive2.Content.displayName;
|
|
7563
7841
|
|
|
7564
7842
|
// src/tabbed-section/TabbedSection.tsx
|
|
@@ -7699,11 +7977,11 @@ var TASK_VARIANTS = {
|
|
|
7699
7977
|
var import_sonner2 = require("sonner");
|
|
7700
7978
|
|
|
7701
7979
|
// src/toaster/useUpdateToast.ts
|
|
7702
|
-
var
|
|
7980
|
+
var import_react53 = require("react");
|
|
7703
7981
|
var import_sonner = require("sonner");
|
|
7704
7982
|
function useUpdateToast({ id }) {
|
|
7705
|
-
const toastIdRef = (0,
|
|
7706
|
-
const getToastOptions = (0,
|
|
7983
|
+
const toastIdRef = (0, import_react53.useRef)("");
|
|
7984
|
+
const getToastOptions = (0, import_react53.useCallback)(
|
|
7707
7985
|
(options) => ({
|
|
7708
7986
|
id: toastIdRef.current,
|
|
7709
7987
|
dismissible: false,
|
|
@@ -7735,7 +8013,7 @@ function useUpdateToast({ id }) {
|
|
|
7735
8013
|
}
|
|
7736
8014
|
|
|
7737
8015
|
// src/toggle-group/ToggleGroup.tsx
|
|
7738
|
-
var
|
|
8016
|
+
var React27 = __toESM(require("react"), 1);
|
|
7739
8017
|
var ToggleGroupPrimitive = __toESM(require("@radix-ui/react-toggle-group"), 1);
|
|
7740
8018
|
|
|
7741
8019
|
// src/toggle-group/style.ts
|
|
@@ -7769,12 +8047,12 @@ var toggleVariants = (0, import_class_variance_authority13.cva)(
|
|
|
7769
8047
|
|
|
7770
8048
|
// src/toggle-group/ToggleGroup.tsx
|
|
7771
8049
|
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
7772
|
-
var ToggleGroupContext =
|
|
8050
|
+
var ToggleGroupContext = React27.createContext({
|
|
7773
8051
|
size: "default",
|
|
7774
8052
|
variant: "default",
|
|
7775
8053
|
theme: "default"
|
|
7776
8054
|
});
|
|
7777
|
-
var ToggleGroup =
|
|
8055
|
+
var ToggleGroup = React27.forwardRef(({ className, variant, size, theme, children, ...props }, ref) => {
|
|
7778
8056
|
const isTabVariant = variant === "tab";
|
|
7779
8057
|
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
7780
8058
|
ToggleGroupPrimitive.Root,
|
|
@@ -7791,8 +8069,8 @@ var ToggleGroup = React26.forwardRef(({ className, variant, size, theme, childre
|
|
|
7791
8069
|
);
|
|
7792
8070
|
});
|
|
7793
8071
|
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
7794
|
-
var ToggleGroupItem =
|
|
7795
|
-
const context =
|
|
8072
|
+
var ToggleGroupItem = React27.forwardRef(({ className, children, variant, size, theme, ...props }, ref) => {
|
|
8073
|
+
const context = React27.useContext(ToggleGroupContext);
|
|
7796
8074
|
const resolvedVariant = context.variant || variant;
|
|
7797
8075
|
const isTabVariant = resolvedVariant === "tab";
|
|
7798
8076
|
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
@@ -7818,7 +8096,7 @@ var ToggleGroupItem = React26.forwardRef(({ className, children, variant, size,
|
|
|
7818
8096
|
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
7819
8097
|
|
|
7820
8098
|
// src/toggle-group/Toggles.tsx
|
|
7821
|
-
var
|
|
8099
|
+
var import_react54 = require("react");
|
|
7822
8100
|
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
7823
8101
|
var getValueArray2 = (value) => {
|
|
7824
8102
|
if (value) {
|
|
@@ -7893,7 +8171,7 @@ function TogglesInternal({
|
|
|
7893
8171
|
}
|
|
7894
8172
|
};
|
|
7895
8173
|
const isAnyActive = getValueArray2(value).length > 0;
|
|
7896
|
-
(0,
|
|
8174
|
+
(0, import_react54.useEffect)(() => {
|
|
7897
8175
|
onAnySelectorActive?.(isAnyActive);
|
|
7898
8176
|
}, [isAnyActive, onAnySelectorActive]);
|
|
7899
8177
|
const currentValue = getValueArray2(value).map((item) => String(item));
|
|
@@ -7924,10 +8202,10 @@ function TogglesInternal({
|
|
|
7924
8202
|
}) })
|
|
7925
8203
|
] });
|
|
7926
8204
|
}
|
|
7927
|
-
var Toggles = (0,
|
|
8205
|
+
var Toggles = (0, import_react54.forwardRef)(TogglesInternal);
|
|
7928
8206
|
|
|
7929
8207
|
// src/text-field/TextField.tsx
|
|
7930
|
-
var
|
|
8208
|
+
var React28 = __toESM(require("react"), 1);
|
|
7931
8209
|
var LabelPrimitive2 = __toESM(require("@radix-ui/react-label"), 1);
|
|
7932
8210
|
var import_class_variance_authority14 = require("class-variance-authority");
|
|
7933
8211
|
var import_react_i18next21 = require("react-i18next");
|
|
@@ -8021,7 +8299,7 @@ var floatingLabelClasses = [
|
|
|
8021
8299
|
"peer-focus:to-[var(--text-field-bg-filled)]",
|
|
8022
8300
|
"peer-focus:to-50%"
|
|
8023
8301
|
];
|
|
8024
|
-
var TextField =
|
|
8302
|
+
var TextField = React28.forwardRef(
|
|
8025
8303
|
({
|
|
8026
8304
|
className,
|
|
8027
8305
|
wrapperClassName,
|
|
@@ -8040,7 +8318,7 @@ var TextField = React27.forwardRef(
|
|
|
8040
8318
|
}, ref) => {
|
|
8041
8319
|
const { t } = (0, import_react_i18next21.useTranslation)();
|
|
8042
8320
|
const hasError = Boolean(error);
|
|
8043
|
-
const autoId =
|
|
8321
|
+
const autoId = React28.useId();
|
|
8044
8322
|
const inputId = props.id || autoId;
|
|
8045
8323
|
const inputClasses = cn(
|
|
8046
8324
|
inputVariants({ variant, error: hasError, readOnly: Boolean(readOnly) }),
|
|
@@ -8135,16 +8413,16 @@ var TextField = React27.forwardRef(
|
|
|
8135
8413
|
TextField.displayName = "TextField";
|
|
8136
8414
|
|
|
8137
8415
|
// src/textarea/Textarea.tsx
|
|
8138
|
-
var
|
|
8416
|
+
var import_react55 = require("react");
|
|
8139
8417
|
|
|
8140
8418
|
// src/textarea/styles.module.css
|
|
8141
8419
|
var styles_default9 = {};
|
|
8142
8420
|
|
|
8143
8421
|
// src/textarea/Textarea.tsx
|
|
8144
8422
|
var import_jsx_runtime115 = require("react/jsx-runtime");
|
|
8145
|
-
var Textarea = (0,
|
|
8423
|
+
var Textarea = (0, import_react55.forwardRef)(
|
|
8146
8424
|
({ className, textareaClassName, label, disabled, name, invalid, ...textareaProps }, ref) => {
|
|
8147
|
-
const inputId = (0,
|
|
8425
|
+
const inputId = (0, import_react55.useId)();
|
|
8148
8426
|
return /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: cn(styles_default9.container, className), children: [
|
|
8149
8427
|
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
|
|
8150
8428
|
"textarea",
|
|
@@ -8273,11 +8551,11 @@ function WideButton({ className, disabled, ...props }) {
|
|
|
8273
8551
|
}
|
|
8274
8552
|
|
|
8275
8553
|
// src/datepicker/DatePicker.tsx
|
|
8276
|
-
var
|
|
8554
|
+
var React32 = __toESM(require("react"), 1);
|
|
8277
8555
|
var import_lucide_react42 = require("lucide-react");
|
|
8278
8556
|
|
|
8279
8557
|
// src/drawer/Drawer.tsx
|
|
8280
|
-
var
|
|
8558
|
+
var React29 = __toESM(require("react"), 1);
|
|
8281
8559
|
var DialogPrimitive2 = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
8282
8560
|
var import_react_draggable = __toESM(require("react-draggable"), 1);
|
|
8283
8561
|
var import_jsx_runtime119 = require("react/jsx-runtime");
|
|
@@ -8295,7 +8573,7 @@ function DrawerPortal({ ...props }) {
|
|
|
8295
8573
|
function DrawerClose({ ...props }) {
|
|
8296
8574
|
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(DialogPrimitive2.Close, { "data-slot": "drawer-close", ...props });
|
|
8297
8575
|
}
|
|
8298
|
-
var DrawerOverlay =
|
|
8576
|
+
var DrawerOverlay = React29.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
8299
8577
|
DialogPrimitive2.Overlay,
|
|
8300
8578
|
{
|
|
8301
8579
|
ref,
|
|
@@ -8309,7 +8587,7 @@ var DrawerOverlay = React28.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
8309
8587
|
));
|
|
8310
8588
|
DrawerOverlay.displayName = DialogPrimitive2.Overlay.displayName;
|
|
8311
8589
|
var DrawerOverlayClasses = "fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0";
|
|
8312
|
-
var DrawerContent =
|
|
8590
|
+
var DrawerContent = React29.forwardRef(
|
|
8313
8591
|
({
|
|
8314
8592
|
className,
|
|
8315
8593
|
children,
|
|
@@ -8321,19 +8599,19 @@ var DrawerContent = React28.forwardRef(
|
|
|
8321
8599
|
...props
|
|
8322
8600
|
}, ref) => {
|
|
8323
8601
|
const finalContainer = container || getCustomContainer() || void 0;
|
|
8324
|
-
const nodeRef =
|
|
8325
|
-
const [dragOffsetY, setDragOffsetY] =
|
|
8602
|
+
const nodeRef = React29.useRef(null);
|
|
8603
|
+
const [dragOffsetY, setDragOffsetY] = React29.useState(0);
|
|
8326
8604
|
const overlayOpacity = Math.max(
|
|
8327
8605
|
DRAWER_MIN_OVERLAY_OPACITY,
|
|
8328
8606
|
1 - dragOffsetY / (DRAWER_CLOSE_THRESHOLD * 2)
|
|
8329
8607
|
);
|
|
8330
|
-
const handleDrag =
|
|
8608
|
+
const handleDrag = React29.useCallback(
|
|
8331
8609
|
(_event, data) => {
|
|
8332
8610
|
setDragOffsetY(Math.max(0, data.y));
|
|
8333
8611
|
},
|
|
8334
8612
|
[]
|
|
8335
8613
|
);
|
|
8336
|
-
const handleStop =
|
|
8614
|
+
const handleStop = React29.useCallback(
|
|
8337
8615
|
(_event, data) => {
|
|
8338
8616
|
if (data.y > DRAWER_CLOSE_THRESHOLD) {
|
|
8339
8617
|
setDragOffsetY(0);
|
|
@@ -8424,7 +8702,7 @@ var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
8424
8702
|
DrawerHeader.displayName = "DrawerHeader";
|
|
8425
8703
|
var DrawerFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: cn("flex flex-col gap-2 p-5", className), ...props });
|
|
8426
8704
|
DrawerFooter.displayName = "DrawerFooter";
|
|
8427
|
-
var DrawerTitle =
|
|
8705
|
+
var DrawerTitle = React29.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
8428
8706
|
DialogPrimitive2.Title,
|
|
8429
8707
|
{
|
|
8430
8708
|
ref,
|
|
@@ -8434,7 +8712,7 @@ var DrawerTitle = React28.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
8434
8712
|
}
|
|
8435
8713
|
));
|
|
8436
8714
|
DrawerTitle.displayName = DialogPrimitive2.Title.displayName;
|
|
8437
|
-
var DrawerDescription =
|
|
8715
|
+
var DrawerDescription = React29.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
8438
8716
|
DialogPrimitive2.Description,
|
|
8439
8717
|
{
|
|
8440
8718
|
ref,
|
|
@@ -8446,7 +8724,7 @@ var DrawerDescription = React28.forwardRef(({ className, ...props }, ref) => /*
|
|
|
8446
8724
|
DrawerDescription.displayName = DialogPrimitive2.Description.displayName;
|
|
8447
8725
|
|
|
8448
8726
|
// src/datepicker/useDatePickerWheel.ts
|
|
8449
|
-
var
|
|
8727
|
+
var React30 = __toESM(require("react"), 1);
|
|
8450
8728
|
|
|
8451
8729
|
// src/datepicker/datePicker.utils.ts
|
|
8452
8730
|
var DISPLAY_PAD_LENGTH = 2;
|
|
@@ -8597,21 +8875,21 @@ function useDatePickerWheel({
|
|
|
8597
8875
|
minDate,
|
|
8598
8876
|
maxDate
|
|
8599
8877
|
}) {
|
|
8600
|
-
const years =
|
|
8601
|
-
const [draftDate, setDraftDate] =
|
|
8878
|
+
const years = React30.useMemo(() => getYearRange(minDate, maxDate), [maxDate, minDate]);
|
|
8879
|
+
const [draftDate, setDraftDate] = React30.useState(
|
|
8602
8880
|
() => resolveInitialDate({ value, defaultValue, minDate, maxDate })
|
|
8603
8881
|
);
|
|
8604
8882
|
const draftYear = draftDate.getFullYear();
|
|
8605
8883
|
const draftMonth = draftDate.getMonth();
|
|
8606
|
-
const [monthScrollTop, setMonthScrollTop] =
|
|
8607
|
-
const [dayScrollTop, setDayScrollTop] =
|
|
8608
|
-
const [yearScrollTop, setYearScrollTop] =
|
|
8609
|
-
const monthListRef =
|
|
8610
|
-
const dayListRef =
|
|
8611
|
-
const yearListRef =
|
|
8612
|
-
const settleTimeoutsRef =
|
|
8613
|
-
const animationFramesRef =
|
|
8614
|
-
const columnRefs =
|
|
8884
|
+
const [monthScrollTop, setMonthScrollTop] = React30.useState(0);
|
|
8885
|
+
const [dayScrollTop, setDayScrollTop] = React30.useState(0);
|
|
8886
|
+
const [yearScrollTop, setYearScrollTop] = React30.useState(0);
|
|
8887
|
+
const monthListRef = React30.useRef(null);
|
|
8888
|
+
const dayListRef = React30.useRef(null);
|
|
8889
|
+
const yearListRef = React30.useRef(null);
|
|
8890
|
+
const settleTimeoutsRef = React30.useRef({});
|
|
8891
|
+
const animationFramesRef = React30.useRef({});
|
|
8892
|
+
const columnRefs = React30.useMemo(
|
|
8615
8893
|
() => ({
|
|
8616
8894
|
month: monthListRef,
|
|
8617
8895
|
day: dayListRef,
|
|
@@ -8619,7 +8897,7 @@ function useDatePickerWheel({
|
|
|
8619
8897
|
}),
|
|
8620
8898
|
[]
|
|
8621
8899
|
);
|
|
8622
|
-
const setColumnScrollTop =
|
|
8900
|
+
const setColumnScrollTop = React30.useCallback(
|
|
8623
8901
|
(column, nextScrollTop) => {
|
|
8624
8902
|
if (column === "month") {
|
|
8625
8903
|
setMonthScrollTop(nextScrollTop);
|
|
@@ -8633,19 +8911,19 @@ function useDatePickerWheel({
|
|
|
8633
8911
|
},
|
|
8634
8912
|
[]
|
|
8635
8913
|
);
|
|
8636
|
-
const clearSettleTimeout =
|
|
8914
|
+
const clearSettleTimeout = React30.useCallback((column) => {
|
|
8637
8915
|
const timeoutId = settleTimeoutsRef.current[column];
|
|
8638
8916
|
if (timeoutId === void 0) return;
|
|
8639
8917
|
window.clearTimeout(timeoutId);
|
|
8640
8918
|
delete settleTimeoutsRef.current[column];
|
|
8641
8919
|
}, []);
|
|
8642
|
-
const clearAnimationFrame =
|
|
8920
|
+
const clearAnimationFrame = React30.useCallback((column) => {
|
|
8643
8921
|
const frameId = animationFramesRef.current[column];
|
|
8644
8922
|
if (frameId === void 0) return;
|
|
8645
8923
|
window.cancelAnimationFrame(frameId);
|
|
8646
8924
|
delete animationFramesRef.current[column];
|
|
8647
8925
|
}, []);
|
|
8648
|
-
|
|
8926
|
+
React30.useEffect(
|
|
8649
8927
|
() => () => {
|
|
8650
8928
|
["month", "day", "year"].forEach((column) => {
|
|
8651
8929
|
clearSettleTimeout(column);
|
|
@@ -8654,22 +8932,22 @@ function useDatePickerWheel({
|
|
|
8654
8932
|
},
|
|
8655
8933
|
[clearAnimationFrame, clearSettleTimeout]
|
|
8656
8934
|
);
|
|
8657
|
-
|
|
8935
|
+
React30.useEffect(() => {
|
|
8658
8936
|
if (isOpen) return;
|
|
8659
8937
|
setDraftDate(resolveInitialDate({ value, defaultValue, minDate, maxDate }));
|
|
8660
8938
|
}, [defaultValue, isOpen, maxDate, minDate, value]);
|
|
8661
|
-
const months =
|
|
8939
|
+
const months = React30.useMemo(
|
|
8662
8940
|
() => getAllowedMonths(draftYear, minDate, maxDate),
|
|
8663
8941
|
[draftYear, maxDate, minDate]
|
|
8664
8942
|
);
|
|
8665
|
-
const days =
|
|
8943
|
+
const days = React30.useMemo(
|
|
8666
8944
|
() => getAllowedDays(draftYear, draftMonth, minDate, maxDate),
|
|
8667
8945
|
[draftMonth, draftYear, maxDate, minDate]
|
|
8668
8946
|
);
|
|
8669
8947
|
const monthIndex = months.findIndex((month) => month === draftMonth);
|
|
8670
8948
|
const dayIndex = days.findIndex((day) => day === draftDate.getDate());
|
|
8671
8949
|
const yearIndex = years.findIndex((year) => year === draftYear);
|
|
8672
|
-
const syncScrollPositions =
|
|
8950
|
+
const syncScrollPositions = React30.useCallback(
|
|
8673
8951
|
(nextDate, behavior = "auto") => {
|
|
8674
8952
|
const nextMonths = getAllowedMonths(nextDate.getFullYear(), minDate, maxDate);
|
|
8675
8953
|
const nextMonthIndex = nextMonths.findIndex((month) => month === nextDate.getMonth());
|
|
@@ -8693,7 +8971,7 @@ function useDatePickerWheel({
|
|
|
8693
8971
|
},
|
|
8694
8972
|
[maxDate, minDate, years]
|
|
8695
8973
|
);
|
|
8696
|
-
|
|
8974
|
+
React30.useLayoutEffect(() => {
|
|
8697
8975
|
if (!isOpen) return;
|
|
8698
8976
|
const nextDate = resolveInitialDate({ value, defaultValue, minDate, maxDate });
|
|
8699
8977
|
setDraftDate(nextDate);
|
|
@@ -8704,7 +8982,7 @@ function useDatePickerWheel({
|
|
|
8704
8982
|
window.cancelAnimationFrame(frameId);
|
|
8705
8983
|
};
|
|
8706
8984
|
}, [defaultValue, isOpen, maxDate, minDate, syncScrollPositions, value]);
|
|
8707
|
-
const updateDraftDate =
|
|
8985
|
+
const updateDraftDate = React30.useCallback(
|
|
8708
8986
|
(column, targetIndex, behavior = "smooth") => {
|
|
8709
8987
|
const currentDate = stripTime(draftDate);
|
|
8710
8988
|
const currentYear = currentDate.getFullYear();
|
|
@@ -8749,7 +9027,7 @@ function useDatePickerWheel({
|
|
|
8749
9027
|
},
|
|
8750
9028
|
[days, draftDate, maxDate, minDate, months, syncScrollPositions, years]
|
|
8751
9029
|
);
|
|
8752
|
-
const settleColumnScroll =
|
|
9030
|
+
const settleColumnScroll = React30.useCallback(
|
|
8753
9031
|
(column) => {
|
|
8754
9032
|
const list = columnRefs[column].current;
|
|
8755
9033
|
if (!list) return;
|
|
@@ -8762,7 +9040,7 @@ function useDatePickerWheel({
|
|
|
8762
9040
|
},
|
|
8763
9041
|
[columnRefs, days.length, months.length, updateDraftDate, years.length]
|
|
8764
9042
|
);
|
|
8765
|
-
const scheduleScrollSettle =
|
|
9043
|
+
const scheduleScrollSettle = React30.useCallback(
|
|
8766
9044
|
(column) => {
|
|
8767
9045
|
clearSettleTimeout(column);
|
|
8768
9046
|
settleTimeoutsRef.current[column] = window.setTimeout(() => {
|
|
@@ -8771,7 +9049,7 @@ function useDatePickerWheel({
|
|
|
8771
9049
|
},
|
|
8772
9050
|
[clearSettleTimeout, settleColumnScroll]
|
|
8773
9051
|
);
|
|
8774
|
-
const handleColumnScroll =
|
|
9052
|
+
const handleColumnScroll = React30.useCallback(
|
|
8775
9053
|
(column) => {
|
|
8776
9054
|
const list = columnRefs[column].current;
|
|
8777
9055
|
if (!list) return;
|
|
@@ -8785,13 +9063,13 @@ function useDatePickerWheel({
|
|
|
8785
9063
|
},
|
|
8786
9064
|
[clearAnimationFrame, columnRefs, scheduleScrollSettle, setColumnScrollTop]
|
|
8787
9065
|
);
|
|
8788
|
-
const handleOptionSelect =
|
|
9066
|
+
const handleOptionSelect = React30.useCallback(
|
|
8789
9067
|
(column, targetIndex) => {
|
|
8790
9068
|
updateDraftDate(column, targetIndex, "smooth");
|
|
8791
9069
|
},
|
|
8792
9070
|
[updateDraftDate]
|
|
8793
9071
|
);
|
|
8794
|
-
const focusAdjacentColumn =
|
|
9072
|
+
const focusAdjacentColumn = React30.useCallback(
|
|
8795
9073
|
(column, direction) => {
|
|
8796
9074
|
const order = ["month", "day", "year"];
|
|
8797
9075
|
const currentIndex = order.indexOf(column);
|
|
@@ -8801,7 +9079,7 @@ function useDatePickerWheel({
|
|
|
8801
9079
|
},
|
|
8802
9080
|
[columnRefs]
|
|
8803
9081
|
);
|
|
8804
|
-
const handleColumnKeyDown =
|
|
9082
|
+
const handleColumnKeyDown = React30.useCallback(
|
|
8805
9083
|
(column, event) => {
|
|
8806
9084
|
const currentIndex = column === "month" ? monthIndex : column === "day" ? dayIndex : yearIndex;
|
|
8807
9085
|
const maxIndex = column === "month" ? months.length - 1 : column === "day" ? days.length - 1 : years.length - 1;
|
|
@@ -9089,28 +9367,6 @@ function DatePickerContent({
|
|
|
9089
9367
|
) });
|
|
9090
9368
|
}
|
|
9091
9369
|
|
|
9092
|
-
// src/lib/use-screen-resize.ts
|
|
9093
|
-
var import_react45 = require("react");
|
|
9094
|
-
var eventName = "resize";
|
|
9095
|
-
function useScreenResize(maxWidth) {
|
|
9096
|
-
const [isInitialized, setIsInitialized] = (0, import_react45.useState)(false);
|
|
9097
|
-
const [isMatch, setIsMatch] = (0, import_react45.useState)(false);
|
|
9098
|
-
const handleResizeEvent = (0, import_react45.useCallback)(() => {
|
|
9099
|
-
const adjustedMaxWidth = `${parseInt(maxWidth, 10) - 1}px`;
|
|
9100
|
-
const media = getWindow().matchMedia(`(max-width: ${adjustedMaxWidth})`);
|
|
9101
|
-
setIsInitialized(true);
|
|
9102
|
-
setIsMatch(!!media?.matches);
|
|
9103
|
-
}, [maxWidth]);
|
|
9104
|
-
(0, import_react45.useLayoutEffect)(() => {
|
|
9105
|
-
handleResizeEvent();
|
|
9106
|
-
getWindow().addEventListener(eventName, handleResizeEvent);
|
|
9107
|
-
return () => {
|
|
9108
|
-
getWindow().removeEventListener(eventName, handleResizeEvent);
|
|
9109
|
-
};
|
|
9110
|
-
}, [handleResizeEvent]);
|
|
9111
|
-
return { isMatch, isInitialized };
|
|
9112
|
-
}
|
|
9113
|
-
|
|
9114
9370
|
// src/lib/device.ts
|
|
9115
9371
|
var DEVICE = {
|
|
9116
9372
|
mobileS: "320px",
|
|
@@ -9127,7 +9383,7 @@ var DEVICE = {
|
|
|
9127
9383
|
};
|
|
9128
9384
|
|
|
9129
9385
|
// src/field-trigger/FieldTrigger.tsx
|
|
9130
|
-
var
|
|
9386
|
+
var React31 = __toESM(require("react"), 1);
|
|
9131
9387
|
var import_lucide_react41 = require("lucide-react");
|
|
9132
9388
|
var import_react_i18next22 = require("react-i18next");
|
|
9133
9389
|
|
|
@@ -9171,7 +9427,7 @@ function FieldErrorMessage({
|
|
|
9171
9427
|
|
|
9172
9428
|
// src/field-trigger/FieldTrigger.tsx
|
|
9173
9429
|
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
9174
|
-
var FieldTrigger =
|
|
9430
|
+
var FieldTrigger = React31.forwardRef(
|
|
9175
9431
|
({
|
|
9176
9432
|
as = "button",
|
|
9177
9433
|
variant = "airbnb",
|
|
@@ -9338,7 +9594,7 @@ FieldTrigger.displayName = "FieldTrigger";
|
|
|
9338
9594
|
// src/datepicker/DatePicker.tsx
|
|
9339
9595
|
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
9340
9596
|
var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
|
|
9341
|
-
var DatePicker =
|
|
9597
|
+
var DatePicker = React32.forwardRef(
|
|
9342
9598
|
({
|
|
9343
9599
|
variant = "default",
|
|
9344
9600
|
label,
|
|
@@ -9364,24 +9620,24 @@ var DatePicker = React31.forwardRef(
|
|
|
9364
9620
|
formatValue = formatDateValue
|
|
9365
9621
|
}, ref) => {
|
|
9366
9622
|
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
9367
|
-
const [isOpen, setIsOpen] =
|
|
9368
|
-
const triggerId =
|
|
9369
|
-
const pickerId =
|
|
9370
|
-
const labelId =
|
|
9371
|
-
const valueId =
|
|
9372
|
-
const helperTextId =
|
|
9373
|
-
const errorId =
|
|
9374
|
-
const internalRef =
|
|
9623
|
+
const [isOpen, setIsOpen] = React32.useState(false);
|
|
9624
|
+
const triggerId = React32.useId();
|
|
9625
|
+
const pickerId = React32.useId();
|
|
9626
|
+
const labelId = React32.useId();
|
|
9627
|
+
const valueId = React32.useId();
|
|
9628
|
+
const helperTextId = React32.useId();
|
|
9629
|
+
const errorId = React32.useId();
|
|
9630
|
+
const internalRef = React32.useRef(null);
|
|
9375
9631
|
const combinedRef = useCombinedRef(ref, internalRef);
|
|
9376
|
-
const monthLabels =
|
|
9377
|
-
const resolvedMinDate =
|
|
9378
|
-
const resolvedMaxDate =
|
|
9379
|
-
const normalizedValue =
|
|
9380
|
-
const normalizedDefaultValue =
|
|
9632
|
+
const monthLabels = React32.useMemo(() => getMonthLabels(locale), [locale]);
|
|
9633
|
+
const resolvedMinDate = React32.useMemo(() => minDate ?? DEFAULT_MIN_DATE, [minDate]);
|
|
9634
|
+
const resolvedMaxDate = React32.useMemo(() => maxDate ?? /* @__PURE__ */ new Date(), [maxDate]);
|
|
9635
|
+
const normalizedValue = React32.useMemo(() => normalizeDateValue(value), [value]);
|
|
9636
|
+
const normalizedDefaultValue = React32.useMemo(
|
|
9381
9637
|
() => normalizeDateValue(defaultValue),
|
|
9382
9638
|
[defaultValue]
|
|
9383
9639
|
);
|
|
9384
|
-
const resolvedValue =
|
|
9640
|
+
const resolvedValue = React32.useMemo(
|
|
9385
9641
|
() => normalizedValue ? clampDate(normalizedValue, resolvedMinDate, resolvedMaxDate) : null,
|
|
9386
9642
|
[normalizedValue, resolvedMaxDate, resolvedMinDate]
|
|
9387
9643
|
);
|
|
@@ -9412,7 +9668,7 @@ var DatePicker = React31.forwardRef(
|
|
|
9412
9668
|
minDate: resolvedMinDate,
|
|
9413
9669
|
maxDate: resolvedMaxDate
|
|
9414
9670
|
});
|
|
9415
|
-
const handleOpenChange =
|
|
9671
|
+
const handleOpenChange = React32.useCallback(
|
|
9416
9672
|
(nextOpen) => {
|
|
9417
9673
|
if (isBlocked && nextOpen) return;
|
|
9418
9674
|
setIsOpen(nextOpen);
|
|
@@ -9422,7 +9678,7 @@ var DatePicker = React31.forwardRef(
|
|
|
9422
9678
|
},
|
|
9423
9679
|
[isBlocked]
|
|
9424
9680
|
);
|
|
9425
|
-
const handleDone =
|
|
9681
|
+
const handleDone = React32.useCallback(() => {
|
|
9426
9682
|
if (isBlocked) return;
|
|
9427
9683
|
onChange(clampDate(draftDate, resolvedMinDate, resolvedMaxDate));
|
|
9428
9684
|
handleOpenChange(false);
|
|
@@ -9434,11 +9690,11 @@ var DatePicker = React31.forwardRef(
|
|
|
9434
9690
|
resolvedMaxDate,
|
|
9435
9691
|
resolvedMinDate
|
|
9436
9692
|
]);
|
|
9437
|
-
const handleTriggerClick =
|
|
9693
|
+
const handleTriggerClick = React32.useCallback(() => {
|
|
9438
9694
|
if (isBlocked) return;
|
|
9439
9695
|
setIsOpen(true);
|
|
9440
9696
|
}, [isBlocked]);
|
|
9441
|
-
const handleTriggerKeyDown =
|
|
9697
|
+
const handleTriggerKeyDown = React32.useCallback(
|
|
9442
9698
|
(event) => {
|
|
9443
9699
|
if (isBlocked) return;
|
|
9444
9700
|
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
@@ -9448,7 +9704,7 @@ var DatePicker = React31.forwardRef(
|
|
|
9448
9704
|
},
|
|
9449
9705
|
[isBlocked]
|
|
9450
9706
|
);
|
|
9451
|
-
|
|
9707
|
+
React32.useEffect(() => {
|
|
9452
9708
|
if (isBlocked) {
|
|
9453
9709
|
setIsOpen(false);
|
|
9454
9710
|
}
|
|
@@ -9630,10 +9886,10 @@ function ResponsiveSheet({
|
|
|
9630
9886
|
}
|
|
9631
9887
|
|
|
9632
9888
|
// src/airbnb/input/Input.tsx
|
|
9633
|
-
var
|
|
9889
|
+
var React33 = __toESM(require("react"), 1);
|
|
9634
9890
|
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
9635
9891
|
var getInputValue = (value) => value != null ? String(value) : "";
|
|
9636
|
-
var AirbnbInput =
|
|
9892
|
+
var AirbnbInput = React33.forwardRef(
|
|
9637
9893
|
({
|
|
9638
9894
|
variant = "default",
|
|
9639
9895
|
label,
|
|
@@ -9662,15 +9918,15 @@ var AirbnbInput = React32.forwardRef(
|
|
|
9662
9918
|
placeholder,
|
|
9663
9919
|
...props
|
|
9664
9920
|
}, ref) => {
|
|
9665
|
-
const generatedId =
|
|
9666
|
-
const inputRef =
|
|
9921
|
+
const generatedId = React33.useId();
|
|
9922
|
+
const inputRef = React33.useRef(null);
|
|
9667
9923
|
const inputId = id ?? generatedId;
|
|
9668
9924
|
const fieldId = `${inputId}-field`;
|
|
9669
9925
|
const labelId = `${inputId}-label`;
|
|
9670
9926
|
const errorId = `${inputId}-error`;
|
|
9671
9927
|
const accessibleLabel = placeholder ?? label;
|
|
9672
|
-
const [isFocused, setIsFocused] =
|
|
9673
|
-
const [currentValue, setCurrentValue] =
|
|
9928
|
+
const [isFocused, setIsFocused] = React33.useState(false);
|
|
9929
|
+
const [currentValue, setCurrentValue] = React33.useState(
|
|
9674
9930
|
() => value != null ? getInputValue(value) : getInputValue(defaultValue)
|
|
9675
9931
|
);
|
|
9676
9932
|
const resolvedValue = value != null ? getInputValue(value) : currentValue;
|
|
@@ -9680,11 +9936,11 @@ var AirbnbInput = React32.forwardRef(
|
|
|
9680
9936
|
const triggerError = error ?? invalid;
|
|
9681
9937
|
const hasLabelMeta = Boolean(optional) || Boolean(tooltip);
|
|
9682
9938
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
9683
|
-
|
|
9939
|
+
React33.useLayoutEffect(() => {
|
|
9684
9940
|
const nextValue = value != null ? getInputValue(value) : getInputValue(inputRef.current?.value);
|
|
9685
9941
|
setCurrentValue((prevValue) => prevValue === nextValue ? prevValue : nextValue);
|
|
9686
9942
|
}, [value]);
|
|
9687
|
-
const setRefs =
|
|
9943
|
+
const setRefs = React33.useCallback(
|
|
9688
9944
|
(node) => {
|
|
9689
9945
|
inputRef.current = node;
|
|
9690
9946
|
if (node && value == null) {
|
|
@@ -9782,11 +10038,11 @@ var AirbnbInput = React32.forwardRef(
|
|
|
9782
10038
|
AirbnbInput.displayName = "Input";
|
|
9783
10039
|
|
|
9784
10040
|
// src/airbnb/phone-field/PhoneField.tsx
|
|
9785
|
-
var
|
|
10041
|
+
var React39 = __toESM(require("react"), 1);
|
|
9786
10042
|
var import_lucide_react44 = require("lucide-react");
|
|
9787
10043
|
|
|
9788
10044
|
// src/airbnb/select/Select.tsx
|
|
9789
|
-
var
|
|
10045
|
+
var React38 = __toESM(require("react"), 1);
|
|
9790
10046
|
|
|
9791
10047
|
// src/airbnb/select/SelectDesktopMenu.tsx
|
|
9792
10048
|
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
@@ -10131,10 +10387,10 @@ function SelectMobileContent({
|
|
|
10131
10387
|
}
|
|
10132
10388
|
|
|
10133
10389
|
// src/airbnb/select/SelectTrigger.tsx
|
|
10134
|
-
var
|
|
10390
|
+
var React34 = __toESM(require("react"), 1);
|
|
10135
10391
|
var import_lucide_react43 = require("lucide-react");
|
|
10136
10392
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
10137
|
-
var SelectTrigger2 =
|
|
10393
|
+
var SelectTrigger2 = React34.forwardRef(
|
|
10138
10394
|
({
|
|
10139
10395
|
id,
|
|
10140
10396
|
open,
|
|
@@ -10201,7 +10457,7 @@ var SelectTrigger2 = React33.forwardRef(
|
|
|
10201
10457
|
SelectTrigger2.displayName = "SelectTrigger";
|
|
10202
10458
|
|
|
10203
10459
|
// src/airbnb/select/useDesktopSelect.ts
|
|
10204
|
-
var
|
|
10460
|
+
var React35 = __toESM(require("react"), 1);
|
|
10205
10461
|
function useDesktopSelect({
|
|
10206
10462
|
isMobile,
|
|
10207
10463
|
isOpen,
|
|
@@ -10210,12 +10466,12 @@ function useDesktopSelect({
|
|
|
10210
10466
|
disabled,
|
|
10211
10467
|
onChange
|
|
10212
10468
|
}) {
|
|
10213
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
10214
|
-
const triggerRef =
|
|
10215
|
-
const listRef =
|
|
10216
|
-
const optionRefs =
|
|
10469
|
+
const [highlightedIndex, setHighlightedIndex] = React35.useState(-1);
|
|
10470
|
+
const triggerRef = React35.useRef(null);
|
|
10471
|
+
const listRef = React35.useRef(null);
|
|
10472
|
+
const optionRefs = React35.useRef([]);
|
|
10217
10473
|
const selectedIndex = getOptionIndex(options, value);
|
|
10218
|
-
|
|
10474
|
+
React35.useEffect(() => {
|
|
10219
10475
|
if (!isOpen || isMobile) return;
|
|
10220
10476
|
setHighlightedIndex((currentIndex) => {
|
|
10221
10477
|
if (currentIndex >= 0) {
|
|
@@ -10230,34 +10486,34 @@ function useDesktopSelect({
|
|
|
10230
10486
|
window.cancelAnimationFrame(frameId);
|
|
10231
10487
|
};
|
|
10232
10488
|
}, [isMobile, isOpen, options, selectedIndex]);
|
|
10233
|
-
|
|
10489
|
+
React35.useEffect(() => {
|
|
10234
10490
|
if (!isOpen || isMobile || highlightedIndex < 0) return;
|
|
10235
10491
|
optionRefs.current[highlightedIndex]?.scrollIntoView({
|
|
10236
10492
|
block: "nearest"
|
|
10237
10493
|
});
|
|
10238
10494
|
}, [highlightedIndex, isMobile, isOpen]);
|
|
10239
|
-
|
|
10495
|
+
React35.useEffect(() => {
|
|
10240
10496
|
if (isOpen) return;
|
|
10241
10497
|
setHighlightedIndex(-1);
|
|
10242
10498
|
}, [isOpen]);
|
|
10243
|
-
const focusTrigger =
|
|
10499
|
+
const focusTrigger = React35.useCallback(() => {
|
|
10244
10500
|
triggerRef.current?.focus();
|
|
10245
10501
|
}, []);
|
|
10246
|
-
const handleSelect =
|
|
10502
|
+
const handleSelect = React35.useCallback(
|
|
10247
10503
|
(option) => {
|
|
10248
10504
|
if (option.isDisabled || disabled) return;
|
|
10249
10505
|
onChange(option);
|
|
10250
10506
|
},
|
|
10251
10507
|
[disabled, onChange]
|
|
10252
10508
|
);
|
|
10253
|
-
const openMenu =
|
|
10509
|
+
const openMenu = React35.useCallback(
|
|
10254
10510
|
(targetIndex) => {
|
|
10255
10511
|
const fallbackIndex = selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex(options);
|
|
10256
10512
|
setHighlightedIndex(targetIndex ?? fallbackIndex);
|
|
10257
10513
|
},
|
|
10258
10514
|
[options, selectedIndex]
|
|
10259
10515
|
);
|
|
10260
|
-
const handleTriggerKeyDown =
|
|
10516
|
+
const handleTriggerKeyDown = React35.useCallback(
|
|
10261
10517
|
(event, onOpen) => {
|
|
10262
10518
|
if (disabled) return;
|
|
10263
10519
|
if (event.key === "ArrowDown") {
|
|
@@ -10282,7 +10538,7 @@ function useDesktopSelect({
|
|
|
10282
10538
|
},
|
|
10283
10539
|
[disabled, openMenu, options, selectedIndex]
|
|
10284
10540
|
);
|
|
10285
|
-
const handleMenuKeyDown =
|
|
10541
|
+
const handleMenuKeyDown = React35.useCallback(
|
|
10286
10542
|
(event, onClose) => {
|
|
10287
10543
|
if (event.key === "Escape") {
|
|
10288
10544
|
event.preventDefault();
|
|
@@ -10332,7 +10588,7 @@ function useDesktopSelect({
|
|
|
10332
10588
|
},
|
|
10333
10589
|
[focusTrigger, highlightedIndex, onChange, options]
|
|
10334
10590
|
);
|
|
10335
|
-
const setOptionRef =
|
|
10591
|
+
const setOptionRef = React35.useCallback(
|
|
10336
10592
|
(index, node) => {
|
|
10337
10593
|
optionRefs.current[index] = node;
|
|
10338
10594
|
},
|
|
@@ -10352,23 +10608,23 @@ function useDesktopSelect({
|
|
|
10352
10608
|
}
|
|
10353
10609
|
|
|
10354
10610
|
// src/airbnb/select/useMobileSelectWheel.ts
|
|
10355
|
-
var
|
|
10611
|
+
var React36 = __toESM(require("react"), 1);
|
|
10356
10612
|
function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
10357
|
-
const [pendingValue, setPendingValue] =
|
|
10613
|
+
const [pendingValue, setPendingValue] = React36.useState(
|
|
10358
10614
|
value ?? null
|
|
10359
10615
|
);
|
|
10360
|
-
const [mobileScrollTop, setMobileScrollTop] =
|
|
10361
|
-
const mobileListRef =
|
|
10362
|
-
const scrollSettleTimeoutRef =
|
|
10363
|
-
const scrollAnimationFrameRef =
|
|
10364
|
-
const getTargetIndex =
|
|
10616
|
+
const [mobileScrollTop, setMobileScrollTop] = React36.useState(0);
|
|
10617
|
+
const mobileListRef = React36.useRef(null);
|
|
10618
|
+
const scrollSettleTimeoutRef = React36.useRef(null);
|
|
10619
|
+
const scrollAnimationFrameRef = React36.useRef(null);
|
|
10620
|
+
const getTargetIndex = React36.useCallback(
|
|
10365
10621
|
(targetValue) => {
|
|
10366
10622
|
const selectedIndex = getOptionIndex(options, targetValue);
|
|
10367
10623
|
return selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex(options);
|
|
10368
10624
|
},
|
|
10369
10625
|
[options]
|
|
10370
10626
|
);
|
|
10371
|
-
const syncScrollPosition =
|
|
10627
|
+
const syncScrollPosition = React36.useCallback(
|
|
10372
10628
|
(targetValue, behavior = "instant") => {
|
|
10373
10629
|
const targetIndex = getTargetIndex(targetValue);
|
|
10374
10630
|
if (targetIndex < 0) return;
|
|
@@ -10387,27 +10643,27 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10387
10643
|
},
|
|
10388
10644
|
[getTargetIndex, options]
|
|
10389
10645
|
);
|
|
10390
|
-
const clearScrollSettleTimeout =
|
|
10646
|
+
const clearScrollSettleTimeout = React36.useCallback(() => {
|
|
10391
10647
|
if (scrollSettleTimeoutRef.current === null) return;
|
|
10392
10648
|
window.clearTimeout(scrollSettleTimeoutRef.current);
|
|
10393
10649
|
scrollSettleTimeoutRef.current = null;
|
|
10394
10650
|
}, []);
|
|
10395
|
-
const clearScrollAnimationFrame =
|
|
10651
|
+
const clearScrollAnimationFrame = React36.useCallback(() => {
|
|
10396
10652
|
if (scrollAnimationFrameRef.current === null) return;
|
|
10397
10653
|
window.cancelAnimationFrame(scrollAnimationFrameRef.current);
|
|
10398
10654
|
scrollAnimationFrameRef.current = null;
|
|
10399
10655
|
}, []);
|
|
10400
|
-
|
|
10656
|
+
React36.useEffect(
|
|
10401
10657
|
() => () => {
|
|
10402
10658
|
clearScrollSettleTimeout();
|
|
10403
10659
|
clearScrollAnimationFrame();
|
|
10404
10660
|
},
|
|
10405
10661
|
[clearScrollAnimationFrame, clearScrollSettleTimeout]
|
|
10406
10662
|
);
|
|
10407
|
-
|
|
10663
|
+
React36.useEffect(() => {
|
|
10408
10664
|
setPendingValue(value ?? null);
|
|
10409
10665
|
}, [value]);
|
|
10410
|
-
|
|
10666
|
+
React36.useLayoutEffect(() => {
|
|
10411
10667
|
if (!isMobile || !isOpen) return;
|
|
10412
10668
|
const frameId = window.requestAnimationFrame(() => {
|
|
10413
10669
|
syncScrollPosition(value ?? null, "instant");
|
|
@@ -10416,7 +10672,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10416
10672
|
window.cancelAnimationFrame(frameId);
|
|
10417
10673
|
};
|
|
10418
10674
|
}, [isMobile, isOpen, syncScrollPosition, value]);
|
|
10419
|
-
const settleScroll =
|
|
10675
|
+
const settleScroll = React36.useCallback(() => {
|
|
10420
10676
|
if (!mobileListRef.current) return;
|
|
10421
10677
|
const nextIndex = Math.round(mobileListRef.current.scrollTop / MOBILE_OPTION_HEIGHT);
|
|
10422
10678
|
const nextOption = options[nextIndex];
|
|
@@ -10428,13 +10684,13 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10428
10684
|
}
|
|
10429
10685
|
setPendingValue(nextOption);
|
|
10430
10686
|
}, [options, pendingValue]);
|
|
10431
|
-
const scheduleScrollSettle =
|
|
10687
|
+
const scheduleScrollSettle = React36.useCallback(() => {
|
|
10432
10688
|
clearScrollSettleTimeout();
|
|
10433
10689
|
scrollSettleTimeoutRef.current = window.setTimeout(() => {
|
|
10434
10690
|
settleScroll();
|
|
10435
10691
|
}, MOBILE_SCROLL_SETTLE_DELAY);
|
|
10436
10692
|
}, [clearScrollSettleTimeout, settleScroll]);
|
|
10437
|
-
const handleScroll =
|
|
10693
|
+
const handleScroll = React36.useCallback(() => {
|
|
10438
10694
|
if (!mobileListRef.current) return;
|
|
10439
10695
|
const nextScrollTop = mobileListRef.current.scrollTop;
|
|
10440
10696
|
clearScrollAnimationFrame();
|
|
@@ -10444,7 +10700,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10444
10700
|
});
|
|
10445
10701
|
scheduleScrollSettle();
|
|
10446
10702
|
}, [clearScrollAnimationFrame, scheduleScrollSettle]);
|
|
10447
|
-
const focusOptionByIndex =
|
|
10703
|
+
const focusOptionByIndex = React36.useCallback(
|
|
10448
10704
|
(index, behavior = "instant", updatePendingImmediately = behavior === "instant") => {
|
|
10449
10705
|
if (!mobileListRef.current || index < 0 || index >= options.length) return;
|
|
10450
10706
|
const option = options[index];
|
|
@@ -10462,7 +10718,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10462
10718
|
},
|
|
10463
10719
|
[options, scheduleScrollSettle]
|
|
10464
10720
|
);
|
|
10465
|
-
const handleOptionClick =
|
|
10721
|
+
const handleOptionClick = React36.useCallback(
|
|
10466
10722
|
(option) => {
|
|
10467
10723
|
if (!mobileListRef.current || disabled || option.isDisabled) return;
|
|
10468
10724
|
const optionIndex = getOptionIndex(options, option);
|
|
@@ -10471,7 +10727,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10471
10727
|
},
|
|
10472
10728
|
[disabled, focusOptionByIndex, options]
|
|
10473
10729
|
);
|
|
10474
|
-
const moveByStep =
|
|
10730
|
+
const moveByStep = React36.useCallback(
|
|
10475
10731
|
(step) => {
|
|
10476
10732
|
const currentIndex = getOptionIndex(options, pendingValue);
|
|
10477
10733
|
const fallbackIndex = step === 1 ? getFirstEnabledOptionIndex(options) : getLastEnabledOptionIndex(options);
|
|
@@ -10483,7 +10739,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10483
10739
|
},
|
|
10484
10740
|
[focusOptionByIndex, options, pendingValue]
|
|
10485
10741
|
);
|
|
10486
|
-
const moveToBoundary =
|
|
10742
|
+
const moveToBoundary = React36.useCallback(
|
|
10487
10743
|
(boundary) => {
|
|
10488
10744
|
const targetIndex = boundary === "start" ? getFirstEnabledOptionIndex(options) : getLastEnabledOptionIndex(options);
|
|
10489
10745
|
if (targetIndex >= 0) {
|
|
@@ -10492,7 +10748,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10492
10748
|
},
|
|
10493
10749
|
[focusOptionByIndex, options]
|
|
10494
10750
|
);
|
|
10495
|
-
const syncPendingValue =
|
|
10751
|
+
const syncPendingValue = React36.useCallback(
|
|
10496
10752
|
(nextValue) => {
|
|
10497
10753
|
const normalizedValue = nextValue ?? null;
|
|
10498
10754
|
const matchedIndex = getOptionIndex(options, normalizedValue);
|
|
@@ -10520,9 +10776,9 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10520
10776
|
}
|
|
10521
10777
|
|
|
10522
10778
|
// src/airbnb/select/useSelectIds.ts
|
|
10523
|
-
var
|
|
10779
|
+
var React37 = __toESM(require("react"), 1);
|
|
10524
10780
|
function useSelectIds({ name, hasValue, error, hideErrorMessage }) {
|
|
10525
|
-
const reactId =
|
|
10781
|
+
const reactId = React37.useId().replace(/:/g, "");
|
|
10526
10782
|
const baseId = name ? `select-${name}` : `select-${reactId}`;
|
|
10527
10783
|
const triggerId = `${baseId}-trigger`;
|
|
10528
10784
|
const labelId = `${baseId}-label`;
|
|
@@ -10532,7 +10788,7 @@ function useSelectIds({ name, hasValue, error, hideErrorMessage }) {
|
|
|
10532
10788
|
const listboxId = `${baseId}-listbox`;
|
|
10533
10789
|
const describedErrorId = error && !hideErrorMessage ? errorId : void 0;
|
|
10534
10790
|
const describedBy = [!hasValue ? helperTextId : null, describedErrorId].filter(Boolean).join(" ") || void 0;
|
|
10535
|
-
const getOptionId2 =
|
|
10791
|
+
const getOptionId2 = React37.useCallback(
|
|
10536
10792
|
(index) => `${baseId}-option-${index}`,
|
|
10537
10793
|
[baseId]
|
|
10538
10794
|
);
|
|
@@ -10549,61 +10805,9 @@ function useSelectIds({ name, hasValue, error, hideErrorMessage }) {
|
|
|
10549
10805
|
};
|
|
10550
10806
|
}
|
|
10551
10807
|
|
|
10552
|
-
// src/lib/use-outside-click.ts
|
|
10553
|
-
var import_react46 = require("react");
|
|
10554
|
-
function useOutsideClick(elementRef, onOutsideClick, nested) {
|
|
10555
|
-
const handleOutsideClick = (0, import_react46.useRef)(onOutsideClick);
|
|
10556
|
-
handleOutsideClick.current = onOutsideClick;
|
|
10557
|
-
const checkNestedElements = (0, import_react46.useCallback)(
|
|
10558
|
-
(event) => {
|
|
10559
|
-
const checkIsElementClickedBySelector = (selector) => {
|
|
10560
|
-
const nestedElement = getDocument().querySelector(selector);
|
|
10561
|
-
return nestedElement?.contains(event.target);
|
|
10562
|
-
};
|
|
10563
|
-
const checkDataAttribute = () => {
|
|
10564
|
-
const target = event.target;
|
|
10565
|
-
if (!target || !(target instanceof HTMLElement)) {
|
|
10566
|
-
return false;
|
|
10567
|
-
}
|
|
10568
|
-
let current = target;
|
|
10569
|
-
while (current) {
|
|
10570
|
-
if (current.hasAttribute("data-exclude-from-outside-click")) {
|
|
10571
|
-
return true;
|
|
10572
|
-
}
|
|
10573
|
-
current = current.parentElement;
|
|
10574
|
-
}
|
|
10575
|
-
return false;
|
|
10576
|
-
};
|
|
10577
|
-
if (nested) {
|
|
10578
|
-
if (typeof nested === "string") {
|
|
10579
|
-
if (checkIsElementClickedBySelector(nested)) return true;
|
|
10580
|
-
} else {
|
|
10581
|
-
if (nested.some(checkIsElementClickedBySelector)) return true;
|
|
10582
|
-
}
|
|
10583
|
-
}
|
|
10584
|
-
return checkDataAttribute();
|
|
10585
|
-
},
|
|
10586
|
-
[nested]
|
|
10587
|
-
);
|
|
10588
|
-
(0, import_react46.useEffect)(() => {
|
|
10589
|
-
function handleClickOutside(event) {
|
|
10590
|
-
const isNestedElement = checkNestedElements(event);
|
|
10591
|
-
if (elementRef?.current && !elementRef.current.contains(event.target) && !isNestedElement) {
|
|
10592
|
-
handleOutsideClick.current?.(event);
|
|
10593
|
-
}
|
|
10594
|
-
}
|
|
10595
|
-
getDocument().addEventListener("mousedown", handleClickOutside, true);
|
|
10596
|
-
getDocument().addEventListener("touchstart", handleClickOutside, true);
|
|
10597
|
-
return () => {
|
|
10598
|
-
getDocument().removeEventListener("mousedown", handleClickOutside, true);
|
|
10599
|
-
getDocument().removeEventListener("touchstart", handleClickOutside, true);
|
|
10600
|
-
};
|
|
10601
|
-
}, [checkNestedElements, elementRef]);
|
|
10602
|
-
}
|
|
10603
|
-
|
|
10604
10808
|
// src/airbnb/select/Select.tsx
|
|
10605
10809
|
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
10606
|
-
var AirbnbSelect =
|
|
10810
|
+
var AirbnbSelect = React38.forwardRef(function AirbnbSelect2({
|
|
10607
10811
|
options = [],
|
|
10608
10812
|
value,
|
|
10609
10813
|
onChange,
|
|
@@ -10630,8 +10834,8 @@ var AirbnbSelect = React37.forwardRef(function AirbnbSelect2({
|
|
|
10630
10834
|
noOptionsMessage
|
|
10631
10835
|
}, ref) {
|
|
10632
10836
|
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
10633
|
-
const [isOpen, setIsOpen] =
|
|
10634
|
-
const containerRef =
|
|
10837
|
+
const [isOpen, setIsOpen] = React38.useState(false);
|
|
10838
|
+
const containerRef = React38.useRef(null);
|
|
10635
10839
|
const hasValue = Boolean(value);
|
|
10636
10840
|
const helperText = placeholder ?? label;
|
|
10637
10841
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
@@ -10685,12 +10889,12 @@ var AirbnbSelect = React37.forwardRef(function AirbnbSelect2({
|
|
|
10685
10889
|
const activeMobileIndex = getOptionIndex(options, pendingValue);
|
|
10686
10890
|
const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
|
|
10687
10891
|
useOutsideClick(containerRef, isOpen && !isMobile ? () => setIsOpen(false) : null);
|
|
10688
|
-
|
|
10892
|
+
React38.useEffect(() => {
|
|
10689
10893
|
if (isBlocked) {
|
|
10690
10894
|
setIsOpen(false);
|
|
10691
10895
|
}
|
|
10692
10896
|
}, [isBlocked]);
|
|
10693
|
-
|
|
10897
|
+
React38.useEffect(
|
|
10694
10898
|
function setCorrectOptionIfThereIsOnlyValue() {
|
|
10695
10899
|
if (value?.value === void 0 || value.value === null || value.label !== "") {
|
|
10696
10900
|
return;
|
|
@@ -10702,7 +10906,7 @@ var AirbnbSelect = React37.forwardRef(function AirbnbSelect2({
|
|
|
10702
10906
|
},
|
|
10703
10907
|
[onChange, options, value]
|
|
10704
10908
|
);
|
|
10705
|
-
const handleMobileOpenChange =
|
|
10909
|
+
const handleMobileOpenChange = React38.useCallback(
|
|
10706
10910
|
(nextOpen) => {
|
|
10707
10911
|
if (isBlocked && nextOpen) return;
|
|
10708
10912
|
setIsOpen(nextOpen);
|
|
@@ -10713,7 +10917,7 @@ var AirbnbSelect = React37.forwardRef(function AirbnbSelect2({
|
|
|
10713
10917
|
},
|
|
10714
10918
|
[focusTrigger, isBlocked, syncPendingValue, value]
|
|
10715
10919
|
);
|
|
10716
|
-
const handleMobileDone =
|
|
10920
|
+
const handleMobileDone = React38.useCallback(() => {
|
|
10717
10921
|
if (isBlocked) return;
|
|
10718
10922
|
const finalOption = pendingValue;
|
|
10719
10923
|
if (finalOption && finalOption.value !== value?.value) {
|
|
@@ -10722,7 +10926,7 @@ var AirbnbSelect = React37.forwardRef(function AirbnbSelect2({
|
|
|
10722
10926
|
setIsOpen(false);
|
|
10723
10927
|
focusTrigger();
|
|
10724
10928
|
}, [focusTrigger, isBlocked, onChange, pendingValue, value]);
|
|
10725
|
-
const handleTriggerClick =
|
|
10929
|
+
const handleTriggerClick = React38.useCallback(() => {
|
|
10726
10930
|
if (isBlocked) return;
|
|
10727
10931
|
setIsOpen((prev) => {
|
|
10728
10932
|
const nextOpen = !prev;
|
|
@@ -10891,7 +11095,7 @@ var AirbnbSelect = React37.forwardRef(function AirbnbSelect2({
|
|
|
10891
11095
|
|
|
10892
11096
|
// src/airbnb/phone-field/PhoneField.tsx
|
|
10893
11097
|
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
10894
|
-
var PhoneField =
|
|
11098
|
+
var PhoneField = React39.forwardRef(
|
|
10895
11099
|
({
|
|
10896
11100
|
variant = "default",
|
|
10897
11101
|
label,
|
|
@@ -10915,8 +11119,8 @@ var PhoneField = React38.forwardRef(
|
|
|
10915
11119
|
mobileTitle,
|
|
10916
11120
|
codePlaceholder = "+00"
|
|
10917
11121
|
}, ref) => {
|
|
10918
|
-
const inputId =
|
|
10919
|
-
const codeOptions =
|
|
11122
|
+
const inputId = React39.useId();
|
|
11123
|
+
const codeOptions = React39.useMemo(
|
|
10920
11124
|
() => options.map((option) => ({
|
|
10921
11125
|
value: option.value,
|
|
10922
11126
|
label: `${option.label} (${option.value})`,
|
|
@@ -10924,7 +11128,7 @@ var PhoneField = React38.forwardRef(
|
|
|
10924
11128
|
})),
|
|
10925
11129
|
[options]
|
|
10926
11130
|
);
|
|
10927
|
-
const selectedCodeOption =
|
|
11131
|
+
const selectedCodeOption = React39.useMemo(
|
|
10928
11132
|
() => codeOptions.find((option) => option.value === value?.code) ?? null,
|
|
10929
11133
|
[codeOptions, value?.code]
|
|
10930
11134
|
);
|
|
@@ -11066,11 +11270,11 @@ var PhoneField = React38.forwardRef(
|
|
|
11066
11270
|
PhoneField.displayName = "PhoneField";
|
|
11067
11271
|
|
|
11068
11272
|
// src/airbnb/search-input/SearchInput.tsx
|
|
11069
|
-
var
|
|
11273
|
+
var React40 = __toESM(require("react"), 1);
|
|
11070
11274
|
var import_react_i18next23 = require("react-i18next");
|
|
11071
11275
|
var import_lucide_react45 = require("lucide-react");
|
|
11072
11276
|
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
11073
|
-
var AirbnbSearchInput =
|
|
11277
|
+
var AirbnbSearchInput = React40.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
|
|
11074
11278
|
const { t } = (0, import_react_i18next23.useTranslation)();
|
|
11075
11279
|
const placeholderText = placeholder || t("search_property") + "...";
|
|
11076
11280
|
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
|
|
@@ -11108,28 +11312,10 @@ var AirbnbSearchInput = React39.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
11108
11312
|
AirbnbSearchInput.displayName = "SearchInput";
|
|
11109
11313
|
|
|
11110
11314
|
// src/searchable-select/SearchableSelect.tsx
|
|
11111
|
-
var
|
|
11315
|
+
var React41 = __toESM(require("react"), 1);
|
|
11112
11316
|
var import_lucide_react46 = require("lucide-react");
|
|
11113
11317
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
11114
|
-
var
|
|
11115
|
-
|
|
11116
|
-
// src/lib/use-event.ts
|
|
11117
|
-
var import_react47 = require("react");
|
|
11118
|
-
function useEvent(fn) {
|
|
11119
|
-
const fnRef = (0, import_react47.useRef)(fn);
|
|
11120
|
-
(0, import_react47.useLayoutEffect)(() => {
|
|
11121
|
-
fnRef.current = fn;
|
|
11122
|
-
}, [fn]);
|
|
11123
|
-
const eventCb = (0, import_react47.useCallback)(
|
|
11124
|
-
(...args) => {
|
|
11125
|
-
return fnRef.current?.apply(null, args);
|
|
11126
|
-
},
|
|
11127
|
-
[fnRef]
|
|
11128
|
-
);
|
|
11129
|
-
return eventCb;
|
|
11130
|
-
}
|
|
11131
|
-
|
|
11132
|
-
// src/searchable-select/SearchableSelect.tsx
|
|
11318
|
+
var import_react56 = require("react");
|
|
11133
11319
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
11134
11320
|
var ROW_HEIGHT = 48;
|
|
11135
11321
|
var DESKTOP_LIST_HEIGHT = 280;
|
|
@@ -11171,13 +11357,13 @@ var SearchableSelectInternal = ({
|
|
|
11171
11357
|
loadingMessage
|
|
11172
11358
|
}, ref) => {
|
|
11173
11359
|
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
11174
|
-
const reactId =
|
|
11175
|
-
const [open, setOpen] =
|
|
11176
|
-
const [internalSearchValue, setInternalSearchValue] =
|
|
11177
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
11178
|
-
const containerRef =
|
|
11179
|
-
const triggerRef =
|
|
11180
|
-
const inputRef =
|
|
11360
|
+
const reactId = React41.useId();
|
|
11361
|
+
const [open, setOpen] = React41.useState(false);
|
|
11362
|
+
const [internalSearchValue, setInternalSearchValue] = React41.useState("");
|
|
11363
|
+
const [highlightedIndex, setHighlightedIndex] = React41.useState(-1);
|
|
11364
|
+
const containerRef = React41.useRef(null);
|
|
11365
|
+
const triggerRef = React41.useRef(null);
|
|
11366
|
+
const inputRef = React41.useRef(null);
|
|
11181
11367
|
const listboxId = `${reactId}-listbox`;
|
|
11182
11368
|
const labelId = `${reactId}-label`;
|
|
11183
11369
|
const valueId = `${reactId}-value`;
|
|
@@ -11186,13 +11372,13 @@ var SearchableSelectInternal = ({
|
|
|
11186
11372
|
const searchInputId = `${reactId}-search`;
|
|
11187
11373
|
const effectiveSearchValue = searchValue ?? internalSearchValue;
|
|
11188
11374
|
const shouldFilterLocally = !onSearchChange && filterOption !== null;
|
|
11189
|
-
const visibleOptions =
|
|
11375
|
+
const visibleOptions = React41.useMemo(() => {
|
|
11190
11376
|
if (!shouldFilterLocally || !effectiveSearchValue) {
|
|
11191
11377
|
return options;
|
|
11192
11378
|
}
|
|
11193
11379
|
return options.filter((option) => filterOption(option, effectiveSearchValue));
|
|
11194
11380
|
}, [effectiveSearchValue, filterOption, options, shouldFilterLocally]);
|
|
11195
|
-
const selectedIndex =
|
|
11381
|
+
const selectedIndex = React41.useMemo(
|
|
11196
11382
|
() => visibleOptions.findIndex((option) => option.value === value?.value),
|
|
11197
11383
|
[value?.value, visibleOptions]
|
|
11198
11384
|
);
|
|
@@ -11204,7 +11390,7 @@ var SearchableSelectInternal = ({
|
|
|
11204
11390
|
const activeOptionId = highlightedIndex >= 0 ? getOptionId(reactId, highlightedIndex) : void 0;
|
|
11205
11391
|
useOutsideClick(containerRef, open && !isMobile ? () => closeSelect() : null);
|
|
11206
11392
|
const handleOnOpenChange = useEvent(onOpenChange);
|
|
11207
|
-
const setSelectOpen = (0,
|
|
11393
|
+
const setSelectOpen = (0, import_react56.useCallback)(
|
|
11208
11394
|
(nextOpen, options2) => {
|
|
11209
11395
|
setOpen(nextOpen);
|
|
11210
11396
|
handleOnOpenChange?.(nextOpen);
|
|
@@ -11214,7 +11400,7 @@ var SearchableSelectInternal = ({
|
|
|
11214
11400
|
},
|
|
11215
11401
|
[handleOnOpenChange]
|
|
11216
11402
|
);
|
|
11217
|
-
|
|
11403
|
+
React41.useEffect(() => {
|
|
11218
11404
|
if (isBlocked) {
|
|
11219
11405
|
setSelectOpen(false);
|
|
11220
11406
|
return;
|
|
@@ -11227,7 +11413,7 @@ var SearchableSelectInternal = ({
|
|
|
11227
11413
|
window.cancelAnimationFrame(frameId);
|
|
11228
11414
|
};
|
|
11229
11415
|
}, [isBlocked, open, setSelectOpen]);
|
|
11230
|
-
|
|
11416
|
+
React41.useEffect(() => {
|
|
11231
11417
|
if (!open) {
|
|
11232
11418
|
setHighlightedIndex(-1);
|
|
11233
11419
|
return;
|
|
@@ -11322,7 +11508,7 @@ var SearchableSelectInternal = ({
|
|
|
11322
11508
|
onOptionHover: setHighlightedIndex
|
|
11323
11509
|
}
|
|
11324
11510
|
);
|
|
11325
|
-
|
|
11511
|
+
React41.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
11326
11512
|
return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
|
|
11327
11513
|
"div",
|
|
11328
11514
|
{
|
|
@@ -11408,7 +11594,7 @@ var SearchableSelectInternal = ({
|
|
|
11408
11594
|
}
|
|
11409
11595
|
);
|
|
11410
11596
|
};
|
|
11411
|
-
var SearchableSelect =
|
|
11597
|
+
var SearchableSelect = React41.forwardRef(
|
|
11412
11598
|
SearchableSelectInternal
|
|
11413
11599
|
);
|
|
11414
11600
|
function SearchableSelectContent({
|
|
@@ -11435,9 +11621,9 @@ function SearchableSelectContent({
|
|
|
11435
11621
|
onOptionClick,
|
|
11436
11622
|
onOptionHover
|
|
11437
11623
|
}) {
|
|
11438
|
-
const listRef =
|
|
11439
|
-
const lastLoadMoreOptionsLengthRef =
|
|
11440
|
-
const previousHighlightedIndexRef =
|
|
11624
|
+
const listRef = React41.useRef(null);
|
|
11625
|
+
const lastLoadMoreOptionsLengthRef = React41.useRef(null);
|
|
11626
|
+
const previousHighlightedIndexRef = React41.useRef(highlightedIndex);
|
|
11441
11627
|
const rowCount = options.length + (loading && options.length > 0 ? 1 : 0);
|
|
11442
11628
|
const virtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
11443
11629
|
count: rowCount,
|
|
@@ -11448,7 +11634,7 @@ function SearchableSelectContent({
|
|
|
11448
11634
|
const virtualItems = virtualizer.getVirtualItems();
|
|
11449
11635
|
const emptyMessage = noOptionsMessage?.() ?? "No matches found";
|
|
11450
11636
|
const loadingText = loadingMessage?.() ?? "Loading...";
|
|
11451
|
-
|
|
11637
|
+
React41.useEffect(() => {
|
|
11452
11638
|
const lastItem = virtualItems[virtualItems.length - 1];
|
|
11453
11639
|
const shouldLoadMore = !!lastItem && hasNextPage && !loading && lastItem.index >= options.length - LOAD_MORE_THRESHOLD;
|
|
11454
11640
|
if (shouldLoadMore && lastLoadMoreOptionsLengthRef.current !== options.length) {
|
|
@@ -11456,7 +11642,7 @@ function SearchableSelectContent({
|
|
|
11456
11642
|
onLoadMore?.();
|
|
11457
11643
|
}
|
|
11458
11644
|
}, [hasNextPage, loading, onLoadMore, options.length, virtualItems]);
|
|
11459
|
-
|
|
11645
|
+
React41.useEffect(() => {
|
|
11460
11646
|
const hasHighlightedIndexChanged = previousHighlightedIndexRef.current !== highlightedIndex;
|
|
11461
11647
|
previousHighlightedIndexRef.current = highlightedIndex;
|
|
11462
11648
|
if (highlightedIndex >= 0 && hasHighlightedIndexChanged) {
|
|
@@ -11837,10 +12023,26 @@ function getNextEnabledIndex(options, startIndex, step) {
|
|
|
11837
12023
|
toggleVariants,
|
|
11838
12024
|
uiKitI18nResources,
|
|
11839
12025
|
uiKitTranslations,
|
|
12026
|
+
useAbortController,
|
|
12027
|
+
useClickEscape,
|
|
12028
|
+
useCombinedRef,
|
|
12029
|
+
useDebounce,
|
|
12030
|
+
useEvent,
|
|
12031
|
+
useHover,
|
|
12032
|
+
useIsMobile,
|
|
12033
|
+
useIsMounted,
|
|
12034
|
+
useModalControls,
|
|
12035
|
+
useOutsideClick,
|
|
12036
|
+
usePrevious,
|
|
11840
12037
|
useRadioOptions,
|
|
12038
|
+
useScreenResize,
|
|
12039
|
+
useScrollFrameIntoView,
|
|
12040
|
+
useScrollToTop,
|
|
11841
12041
|
useSidebar,
|
|
11842
12042
|
useSidebarMenuButton,
|
|
11843
12043
|
useSidebarSafe,
|
|
12044
|
+
useTimeout,
|
|
12045
|
+
useTimer,
|
|
11844
12046
|
useUpdateToast
|
|
11845
12047
|
});
|
|
11846
12048
|
//# sourceMappingURL=index.cjs.map
|