@chekinapp/ui 0.0.1 → 0.0.2
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 +211 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +208 -50
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -157,6 +157,7 @@ __export(index_exports, {
|
|
|
157
157
|
OverlayLoader: () => OverlayLoader,
|
|
158
158
|
PageLoader: () => PageLoader,
|
|
159
159
|
Pagination: () => Pagination,
|
|
160
|
+
PhoneField: () => PhoneField,
|
|
160
161
|
Popover: () => Popover,
|
|
161
162
|
PopoverAnchor: () => PopoverAnchor,
|
|
162
163
|
PopoverClose: () => PopoverClose,
|
|
@@ -9389,6 +9390,10 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9389
9390
|
);
|
|
9390
9391
|
AirbnbInput.displayName = "Input";
|
|
9391
9392
|
|
|
9393
|
+
// src/airbnb/phone-field/PhoneField.tsx
|
|
9394
|
+
var React37 = __toESM(require("react"), 1);
|
|
9395
|
+
var import_lucide_react43 = require("lucide-react");
|
|
9396
|
+
|
|
9392
9397
|
// src/airbnb/select/Select.tsx
|
|
9393
9398
|
var React36 = __toESM(require("react"), 1);
|
|
9394
9399
|
|
|
@@ -10453,17 +10458,170 @@ function AirbnbSelect({
|
|
|
10453
10458
|
] });
|
|
10454
10459
|
}
|
|
10455
10460
|
|
|
10461
|
+
// src/airbnb/phone-field/PhoneField.tsx
|
|
10462
|
+
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
10463
|
+
function PhoneField({
|
|
10464
|
+
variant = "default",
|
|
10465
|
+
label,
|
|
10466
|
+
topLabel,
|
|
10467
|
+
value,
|
|
10468
|
+
onChange,
|
|
10469
|
+
options,
|
|
10470
|
+
placeholder = "Phone number",
|
|
10471
|
+
disabled,
|
|
10472
|
+
error,
|
|
10473
|
+
className,
|
|
10474
|
+
name,
|
|
10475
|
+
codeName,
|
|
10476
|
+
numberName,
|
|
10477
|
+
mobileTitle,
|
|
10478
|
+
codePlaceholder = "+00"
|
|
10479
|
+
}) {
|
|
10480
|
+
const inputId = React37.useId();
|
|
10481
|
+
const codeOptions = React37.useMemo(
|
|
10482
|
+
() => options.map((option) => ({
|
|
10483
|
+
value: option.value,
|
|
10484
|
+
label: option.label,
|
|
10485
|
+
disabled: option.disabled
|
|
10486
|
+
})),
|
|
10487
|
+
[options]
|
|
10488
|
+
);
|
|
10489
|
+
const selectedCodeOption = React37.useMemo(
|
|
10490
|
+
() => codeOptions.find((option) => option.value === value?.code) ?? null,
|
|
10491
|
+
[codeOptions, value?.code]
|
|
10492
|
+
);
|
|
10493
|
+
const combinedValue = value?.code || value?.number ? `${value?.code ?? ""}${value?.number ?? ""}` : "";
|
|
10494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { className: cn("w-full max-w-[480px]", className), children: [
|
|
10495
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
10496
|
+
codeName && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
10497
|
+
"input",
|
|
10498
|
+
{
|
|
10499
|
+
type: "hidden",
|
|
10500
|
+
name: codeName,
|
|
10501
|
+
value: value?.code ?? "",
|
|
10502
|
+
disabled
|
|
10503
|
+
}
|
|
10504
|
+
),
|
|
10505
|
+
numberName && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
10506
|
+
"input",
|
|
10507
|
+
{
|
|
10508
|
+
type: "hidden",
|
|
10509
|
+
name: numberName,
|
|
10510
|
+
value: value?.number ?? "",
|
|
10511
|
+
disabled
|
|
10512
|
+
}
|
|
10513
|
+
),
|
|
10514
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
10515
|
+
"label",
|
|
10516
|
+
{
|
|
10517
|
+
htmlFor: inputId,
|
|
10518
|
+
className: "mb-3 block text-[16px] font-medium leading-5 text-[#1F1F1B]",
|
|
10519
|
+
children: topLabel
|
|
10520
|
+
}
|
|
10521
|
+
),
|
|
10522
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { className: "flex items-stretch", children: [
|
|
10523
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
10524
|
+
AirbnbSelect,
|
|
10525
|
+
{
|
|
10526
|
+
variant,
|
|
10527
|
+
options: codeOptions,
|
|
10528
|
+
value: selectedCodeOption,
|
|
10529
|
+
onChange: (option) => onChange({
|
|
10530
|
+
code: String(option.value),
|
|
10531
|
+
number: value?.number ?? ""
|
|
10532
|
+
}),
|
|
10533
|
+
label: `${label} country code`,
|
|
10534
|
+
placeholder: codePlaceholder,
|
|
10535
|
+
disabled,
|
|
10536
|
+
className: "max-w-none shrink-0 basis-[96px]",
|
|
10537
|
+
mobileTitle: mobileTitle ?? "Select country code",
|
|
10538
|
+
dropdownClassName: "right-auto w-[280px]",
|
|
10539
|
+
getValueLabel: (option) => String(option.value),
|
|
10540
|
+
renderTrigger: ({
|
|
10541
|
+
id,
|
|
10542
|
+
open,
|
|
10543
|
+
variant: selectVariant,
|
|
10544
|
+
disabled: triggerDisabled,
|
|
10545
|
+
listboxId,
|
|
10546
|
+
triggerRef,
|
|
10547
|
+
onClick,
|
|
10548
|
+
onKeyDown,
|
|
10549
|
+
valueLabel
|
|
10550
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
|
|
10551
|
+
"button",
|
|
10552
|
+
{
|
|
10553
|
+
id,
|
|
10554
|
+
ref: triggerRef,
|
|
10555
|
+
type: "button",
|
|
10556
|
+
"aria-label": `${label} country code`,
|
|
10557
|
+
"aria-haspopup": "listbox",
|
|
10558
|
+
"aria-expanded": open,
|
|
10559
|
+
"aria-controls": listboxId,
|
|
10560
|
+
disabled: triggerDisabled,
|
|
10561
|
+
onClick,
|
|
10562
|
+
onKeyDown,
|
|
10563
|
+
className: cn(
|
|
10564
|
+
"flex w-full items-center justify-center gap-2 border border-r-0 text-[16px] font-medium leading-6 transition-colors focus-visible:outline-none",
|
|
10565
|
+
selectVariant === "airbnb" ? "h-full min-h-[60px] rounded-l-[16px] rounded-r-none px-4 focus-visible:ring-2 focus-visible:ring-[#1F1F1B] focus-visible:ring-offset-2" : "min-h-[48px] rounded-l-[10px] rounded-r-none px-3.5 focus-visible:border-[#315EFB]",
|
|
10566
|
+
error ? "border-[var(--status-danger)] bg-[#F2F2F2] text-[var(--status-danger)]" : selectVariant === "airbnb" ? "border-[#8C8C8C] bg-[#F4F4F2] text-[#1F1F1B]" : "border-[#A8A8A4] bg-white text-[#1F1F1B]",
|
|
10567
|
+
triggerDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
10568
|
+
),
|
|
10569
|
+
children: [
|
|
10570
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { children: valueLabel ?? codePlaceholder }),
|
|
10571
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
10572
|
+
import_lucide_react43.ChevronDown,
|
|
10573
|
+
{
|
|
10574
|
+
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
10575
|
+
strokeWidth: 2
|
|
10576
|
+
}
|
|
10577
|
+
)
|
|
10578
|
+
]
|
|
10579
|
+
}
|
|
10580
|
+
)
|
|
10581
|
+
}
|
|
10582
|
+
),
|
|
10583
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
10584
|
+
AirbnbInput,
|
|
10585
|
+
{
|
|
10586
|
+
id: inputId,
|
|
10587
|
+
variant,
|
|
10588
|
+
type: "tel",
|
|
10589
|
+
inputMode: "tel",
|
|
10590
|
+
label,
|
|
10591
|
+
helperText: placeholder,
|
|
10592
|
+
value: value?.number ?? "",
|
|
10593
|
+
placeholder,
|
|
10594
|
+
disabled,
|
|
10595
|
+
error,
|
|
10596
|
+
renderErrorMessage: false,
|
|
10597
|
+
wrapperClassName: "min-w-0 flex-1",
|
|
10598
|
+
fieldClassName: cn(
|
|
10599
|
+
variant === "airbnb" ? "min-h-[60px] rounded-l-none rounded-r-[16px] border-l-0" : "rounded-l-none rounded-r-[10px] border-l-0"
|
|
10600
|
+
),
|
|
10601
|
+
contentClassName: cn(variant === "airbnb" ? "h-[40px] py-2" : "h-[48px]"),
|
|
10602
|
+
inputClassName: "text-[16px] leading-7",
|
|
10603
|
+
onChange: (event) => onChange({
|
|
10604
|
+
code: value?.code ?? "",
|
|
10605
|
+
number: event.target.value
|
|
10606
|
+
})
|
|
10607
|
+
}
|
|
10608
|
+
)
|
|
10609
|
+
] }),
|
|
10610
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(FieldErrorMessage, { message: error })
|
|
10611
|
+
] });
|
|
10612
|
+
}
|
|
10613
|
+
|
|
10456
10614
|
// src/airbnb/search-input/SearchInput.tsx
|
|
10457
|
-
var
|
|
10615
|
+
var React38 = __toESM(require("react"), 1);
|
|
10458
10616
|
var import_react_i18next22 = require("react-i18next");
|
|
10459
|
-
var
|
|
10460
|
-
var
|
|
10461
|
-
var AirbnbSearchInput =
|
|
10617
|
+
var import_lucide_react44 = require("lucide-react");
|
|
10618
|
+
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
10619
|
+
var AirbnbSearchInput = React38.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
|
|
10462
10620
|
const { t } = (0, import_react_i18next22.useTranslation)();
|
|
10463
10621
|
const placeholderText = placeholder || t("search_property") + "...";
|
|
10464
|
-
return /* @__PURE__ */ (0,
|
|
10465
|
-
/* @__PURE__ */ (0,
|
|
10466
|
-
/* @__PURE__ */ (0,
|
|
10622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
|
|
10623
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react44.Search, { className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]" }),
|
|
10624
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10467
10625
|
"input",
|
|
10468
10626
|
{
|
|
10469
10627
|
...props,
|
|
@@ -10482,13 +10640,13 @@ var AirbnbSearchInput = React37.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
10482
10640
|
)
|
|
10483
10641
|
}
|
|
10484
10642
|
),
|
|
10485
|
-
onReset && /* @__PURE__ */ (0,
|
|
10643
|
+
onReset && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10486
10644
|
Button,
|
|
10487
10645
|
{
|
|
10488
10646
|
variant: "ghost",
|
|
10489
10647
|
onClick: onReset,
|
|
10490
10648
|
className: "absolute right-0 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]",
|
|
10491
|
-
children: /* @__PURE__ */ (0,
|
|
10649
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_lucide_react44.X, { className: "h-5 w-5" })
|
|
10492
10650
|
}
|
|
10493
10651
|
)
|
|
10494
10652
|
] });
|
|
@@ -10496,10 +10654,10 @@ var AirbnbSearchInput = React37.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
10496
10654
|
AirbnbSearchInput.displayName = "SearchInput";
|
|
10497
10655
|
|
|
10498
10656
|
// src/searchable-select/SearchableSelect.tsx
|
|
10499
|
-
var
|
|
10500
|
-
var
|
|
10657
|
+
var React39 = __toESM(require("react"), 1);
|
|
10658
|
+
var import_lucide_react45 = require("lucide-react");
|
|
10501
10659
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
10502
|
-
var
|
|
10660
|
+
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
10503
10661
|
var ROW_HEIGHT = 48;
|
|
10504
10662
|
var DESKTOP_LIST_HEIGHT = 280;
|
|
10505
10663
|
var MOBILE_LIST_HEIGHT = 420;
|
|
@@ -10536,13 +10694,13 @@ var SearchableSelectInternal = ({
|
|
|
10536
10694
|
loadingMessage
|
|
10537
10695
|
}, ref) => {
|
|
10538
10696
|
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
10539
|
-
const reactId =
|
|
10540
|
-
const [open, setOpen] =
|
|
10541
|
-
const [internalSearchValue, setInternalSearchValue] =
|
|
10542
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
10543
|
-
const containerRef =
|
|
10544
|
-
const triggerRef =
|
|
10545
|
-
const inputRef =
|
|
10697
|
+
const reactId = React39.useId();
|
|
10698
|
+
const [open, setOpen] = React39.useState(false);
|
|
10699
|
+
const [internalSearchValue, setInternalSearchValue] = React39.useState("");
|
|
10700
|
+
const [highlightedIndex, setHighlightedIndex] = React39.useState(-1);
|
|
10701
|
+
const containerRef = React39.useRef(null);
|
|
10702
|
+
const triggerRef = React39.useRef(null);
|
|
10703
|
+
const inputRef = React39.useRef(null);
|
|
10546
10704
|
const listboxId = `${reactId}-listbox`;
|
|
10547
10705
|
const labelId = `${reactId}-label`;
|
|
10548
10706
|
const valueId = `${reactId}-value`;
|
|
@@ -10551,13 +10709,13 @@ var SearchableSelectInternal = ({
|
|
|
10551
10709
|
const searchInputId = `${reactId}-search`;
|
|
10552
10710
|
const effectiveSearchValue = searchValue ?? internalSearchValue;
|
|
10553
10711
|
const shouldFilterLocally = !onSearchChange && filterOption !== null;
|
|
10554
|
-
const visibleOptions =
|
|
10712
|
+
const visibleOptions = React39.useMemo(() => {
|
|
10555
10713
|
if (!shouldFilterLocally || !effectiveSearchValue) {
|
|
10556
10714
|
return options;
|
|
10557
10715
|
}
|
|
10558
10716
|
return options.filter((option) => filterOption(option, effectiveSearchValue));
|
|
10559
10717
|
}, [effectiveSearchValue, filterOption, options, shouldFilterLocally]);
|
|
10560
|
-
const selectedIndex =
|
|
10718
|
+
const selectedIndex = React39.useMemo(
|
|
10561
10719
|
() => visibleOptions.findIndex((option) => option.value === value?.value),
|
|
10562
10720
|
[value?.value, visibleOptions]
|
|
10563
10721
|
);
|
|
@@ -10566,7 +10724,7 @@ var SearchableSelectInternal = ({
|
|
|
10566
10724
|
const describedBy = error && !hideErrorMessage ? errorId : void 0;
|
|
10567
10725
|
const activeOptionId = highlightedIndex >= 0 ? getOptionId(reactId, highlightedIndex) : void 0;
|
|
10568
10726
|
useOutsideClick(containerRef, open && !isMobile ? () => closeSelect() : null);
|
|
10569
|
-
|
|
10727
|
+
React39.useEffect(() => {
|
|
10570
10728
|
if (!open) return;
|
|
10571
10729
|
const frameId = window.requestAnimationFrame(() => {
|
|
10572
10730
|
inputRef.current?.focus();
|
|
@@ -10575,7 +10733,7 @@ var SearchableSelectInternal = ({
|
|
|
10575
10733
|
window.cancelAnimationFrame(frameId);
|
|
10576
10734
|
};
|
|
10577
10735
|
}, [open]);
|
|
10578
|
-
|
|
10736
|
+
React39.useEffect(() => {
|
|
10579
10737
|
if (!open) {
|
|
10580
10738
|
setHighlightedIndex(-1);
|
|
10581
10739
|
return;
|
|
@@ -10650,7 +10808,7 @@ var SearchableSelectInternal = ({
|
|
|
10650
10808
|
}
|
|
10651
10809
|
}
|
|
10652
10810
|
}
|
|
10653
|
-
const content = /* @__PURE__ */ (0,
|
|
10811
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10654
10812
|
SearchableSelectContent,
|
|
10655
10813
|
{
|
|
10656
10814
|
inputId: searchInputId,
|
|
@@ -10677,10 +10835,10 @@ var SearchableSelectInternal = ({
|
|
|
10677
10835
|
onOptionHover: setHighlightedIndex
|
|
10678
10836
|
}
|
|
10679
10837
|
);
|
|
10680
|
-
|
|
10681
|
-
return /* @__PURE__ */ (0,
|
|
10682
|
-
name && /* @__PURE__ */ (0,
|
|
10683
|
-
/* @__PURE__ */ (0,
|
|
10838
|
+
React39.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
10839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { ref: containerRef, className: cn("relative w-full max-w-[480px]", className), children: [
|
|
10840
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
10841
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10684
10842
|
FieldTrigger,
|
|
10685
10843
|
{
|
|
10686
10844
|
id: `${reactId}-trigger`,
|
|
@@ -10710,8 +10868,8 @@ var SearchableSelectInternal = ({
|
|
|
10710
10868
|
openSelect();
|
|
10711
10869
|
},
|
|
10712
10870
|
onKeyDown: handleTriggerKeyDown,
|
|
10713
|
-
trailingAdornment: /* @__PURE__ */ (0,
|
|
10714
|
-
|
|
10871
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10872
|
+
import_lucide_react45.ChevronDown,
|
|
10715
10873
|
{
|
|
10716
10874
|
className: cn(
|
|
10717
10875
|
"h-6 w-6 text-[#1F1F1B] transition-transform",
|
|
@@ -10721,7 +10879,7 @@ var SearchableSelectInternal = ({
|
|
|
10721
10879
|
)
|
|
10722
10880
|
}
|
|
10723
10881
|
),
|
|
10724
|
-
isMobile ? /* @__PURE__ */ (0,
|
|
10882
|
+
isMobile ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10725
10883
|
Drawer,
|
|
10726
10884
|
{
|
|
10727
10885
|
open,
|
|
@@ -10732,13 +10890,13 @@ var SearchableSelectInternal = ({
|
|
|
10732
10890
|
}
|
|
10733
10891
|
closeSelect();
|
|
10734
10892
|
},
|
|
10735
|
-
children: /* @__PURE__ */ (0,
|
|
10736
|
-
/* @__PURE__ */ (0,
|
|
10737
|
-
/* @__PURE__ */ (0,
|
|
10738
|
-
/* @__PURE__ */ (0,
|
|
10893
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(DrawerContent, { onClose: closeSelect, lockScroll: false, children: [
|
|
10894
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
10895
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DrawerDescription, { className: "sr-only", children: label }),
|
|
10896
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: "px-5 pb-5 pt-1", children: content })
|
|
10739
10897
|
] })
|
|
10740
10898
|
}
|
|
10741
|
-
) : open ? /* @__PURE__ */ (0,
|
|
10899
|
+
) : open ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10742
10900
|
"div",
|
|
10743
10901
|
{
|
|
10744
10902
|
className: cn(
|
|
@@ -10750,7 +10908,7 @@ var SearchableSelectInternal = ({
|
|
|
10750
10908
|
) : null
|
|
10751
10909
|
] });
|
|
10752
10910
|
};
|
|
10753
|
-
var SearchableSelect =
|
|
10911
|
+
var SearchableSelect = React39.forwardRef(
|
|
10754
10912
|
SearchableSelectInternal
|
|
10755
10913
|
);
|
|
10756
10914
|
function SearchableSelectContent({
|
|
@@ -10777,9 +10935,9 @@ function SearchableSelectContent({
|
|
|
10777
10935
|
onOptionClick,
|
|
10778
10936
|
onOptionHover
|
|
10779
10937
|
}) {
|
|
10780
|
-
const listRef =
|
|
10781
|
-
const lastLoadMoreOptionsLengthRef =
|
|
10782
|
-
const previousHighlightedIndexRef =
|
|
10938
|
+
const listRef = React39.useRef(null);
|
|
10939
|
+
const lastLoadMoreOptionsLengthRef = React39.useRef(null);
|
|
10940
|
+
const previousHighlightedIndexRef = React39.useRef(highlightedIndex);
|
|
10783
10941
|
const rowCount = options.length + (loading && options.length > 0 ? 1 : 0);
|
|
10784
10942
|
const virtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
10785
10943
|
count: rowCount,
|
|
@@ -10790,7 +10948,7 @@ function SearchableSelectContent({
|
|
|
10790
10948
|
const virtualItems = virtualizer.getVirtualItems();
|
|
10791
10949
|
const emptyMessage = noOptionsMessage?.() ?? "No matches found";
|
|
10792
10950
|
const loadingText = loadingMessage?.() ?? "Loading...";
|
|
10793
|
-
|
|
10951
|
+
React39.useEffect(() => {
|
|
10794
10952
|
const lastItem = virtualItems[virtualItems.length - 1];
|
|
10795
10953
|
const shouldLoadMore = !!lastItem && hasNextPage && !loading && lastItem.index >= options.length - LOAD_MORE_THRESHOLD;
|
|
10796
10954
|
if (shouldLoadMore && lastLoadMoreOptionsLengthRef.current !== options.length) {
|
|
@@ -10798,23 +10956,23 @@ function SearchableSelectContent({
|
|
|
10798
10956
|
onLoadMore?.();
|
|
10799
10957
|
}
|
|
10800
10958
|
}, [hasNextPage, loading, onLoadMore, options.length, virtualItems]);
|
|
10801
|
-
|
|
10959
|
+
React39.useEffect(() => {
|
|
10802
10960
|
const hasHighlightedIndexChanged = previousHighlightedIndexRef.current !== highlightedIndex;
|
|
10803
10961
|
previousHighlightedIndexRef.current = highlightedIndex;
|
|
10804
10962
|
if (highlightedIndex >= 0 && hasHighlightedIndexChanged) {
|
|
10805
10963
|
virtualizer.scrollToIndex(highlightedIndex, { align: "auto" });
|
|
10806
10964
|
}
|
|
10807
10965
|
}, [highlightedIndex, virtualizer]);
|
|
10808
|
-
return /* @__PURE__ */ (0,
|
|
10809
|
-
/* @__PURE__ */ (0,
|
|
10810
|
-
/* @__PURE__ */ (0,
|
|
10811
|
-
|
|
10966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "p-2", children: [
|
|
10967
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "relative mb-2", children: [
|
|
10968
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10969
|
+
import_lucide_react45.Search,
|
|
10812
10970
|
{
|
|
10813
10971
|
"aria-hidden": "true",
|
|
10814
10972
|
className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 text-[#9696B9]"
|
|
10815
10973
|
}
|
|
10816
10974
|
),
|
|
10817
|
-
/* @__PURE__ */ (0,
|
|
10975
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10818
10976
|
"input",
|
|
10819
10977
|
{
|
|
10820
10978
|
id: inputId,
|
|
@@ -10833,7 +10991,7 @@ function SearchableSelectContent({
|
|
|
10833
10991
|
}
|
|
10834
10992
|
)
|
|
10835
10993
|
] }),
|
|
10836
|
-
loading && options.length === 0 ? /* @__PURE__ */ (0,
|
|
10994
|
+
loading && options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: loadingText }) : options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10837
10995
|
"div",
|
|
10838
10996
|
{
|
|
10839
10997
|
id: listboxId,
|
|
@@ -10842,7 +11000,7 @@ function SearchableSelectContent({
|
|
|
10842
11000
|
"aria-labelledby": labelId,
|
|
10843
11001
|
className: cn("overflow-y-auto outline-none", menuClassName),
|
|
10844
11002
|
style: { height: Math.min(height, rowCount * ROW_HEIGHT) },
|
|
10845
|
-
children: /* @__PURE__ */ (0,
|
|
11003
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10846
11004
|
"div",
|
|
10847
11005
|
{
|
|
10848
11006
|
className: "relative w-full",
|
|
@@ -10850,7 +11008,7 @@ function SearchableSelectContent({
|
|
|
10850
11008
|
children: virtualItems.map((virtualItem) => {
|
|
10851
11009
|
const option = options[virtualItem.index];
|
|
10852
11010
|
if (!option) {
|
|
10853
|
-
return /* @__PURE__ */ (0,
|
|
11011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10854
11012
|
"div",
|
|
10855
11013
|
{
|
|
10856
11014
|
className: "absolute left-0 top-0 flex w-full items-center px-4 text-base leading-6 text-[#6C6C6C]",
|
|
@@ -10865,7 +11023,7 @@ function SearchableSelectContent({
|
|
|
10865
11023
|
}
|
|
10866
11024
|
const isSelected = value?.value === option.value;
|
|
10867
11025
|
const isHighlighted = virtualItem.index === highlightedIndex;
|
|
10868
|
-
return /* @__PURE__ */ (0,
|
|
11026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10869
11027
|
"button",
|
|
10870
11028
|
{
|
|
10871
11029
|
id: getOptionId(idPrefix, virtualItem.index),
|
|
@@ -10887,7 +11045,7 @@ function SearchableSelectContent({
|
|
|
10887
11045
|
height: `${virtualItem.size}px`,
|
|
10888
11046
|
transform: `translateY(${virtualItem.start}px)`
|
|
10889
11047
|
},
|
|
10890
|
-
children: /* @__PURE__ */ (0,
|
|
11048
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "truncate text-center", children: String(option.label) })
|
|
10891
11049
|
},
|
|
10892
11050
|
`${String(option.value)}-${virtualItem.index}`
|
|
10893
11051
|
);
|
|
@@ -11043,6 +11201,7 @@ function getNextEnabledIndex(options, startIndex, step) {
|
|
|
11043
11201
|
OverlayLoader,
|
|
11044
11202
|
PageLoader,
|
|
11045
11203
|
Pagination,
|
|
11204
|
+
PhoneField,
|
|
11046
11205
|
Popover,
|
|
11047
11206
|
PopoverAnchor,
|
|
11048
11207
|
PopoverClose,
|