@chekinapp/ui 0.0.142 → 0.0.144
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 +777 -732
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +714 -670
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -11970,7 +11970,7 @@ function Fieldset({
|
|
|
11970
11970
|
htmlFor,
|
|
11971
11971
|
className: cn(
|
|
11972
11972
|
"block cursor-[inherit] truncate transition-all duration-100 ease-in",
|
|
11973
|
-
raised ? "text-[
|
|
11973
|
+
raised ? "text-[length:var(--field-label-raised-font-size)] font-[var(--field-label-raised-font-weight)]" : "text-[length:var(--field-label-font-size)] font-[var(--field-label-font-weight)]"
|
|
11974
11974
|
),
|
|
11975
11975
|
children: label
|
|
11976
11976
|
}
|
|
@@ -11992,10 +11992,10 @@ function Fieldset({
|
|
|
11992
11992
|
"aria-hidden": "true",
|
|
11993
11993
|
className: cn(
|
|
11994
11994
|
"pointer-events-none absolute -top-[5px] bottom-0 left-0 right-0 m-0 min-w-0 rounded-[6px] border px-[13px] text-left transition-colors duration-75",
|
|
11995
|
-
"border-[var(--
|
|
11996
|
-
isActivated && "border-[var(--
|
|
11997
|
-
isFocused && "border-[var(--
|
|
11998
|
-
invalid && "border-[var(--
|
|
11995
|
+
"border-[var(--field-border)]",
|
|
11996
|
+
isActivated && "border-[var(--field-border-activated)]",
|
|
11997
|
+
isFocused && "border-[var(--field-border-focused)]",
|
|
11998
|
+
invalid && "border-[var(--field-border-invalid)]",
|
|
11999
11999
|
className
|
|
12000
12000
|
),
|
|
12001
12001
|
children: /* @__PURE__ */ jsxs88(
|
|
@@ -12012,8 +12012,8 @@ function Fieldset({
|
|
|
12012
12012
|
"span",
|
|
12013
12013
|
{
|
|
12014
12014
|
className: cn(
|
|
12015
|
-
"visible inline-block px-1 text-[
|
|
12016
|
-
raised ? "font-
|
|
12015
|
+
"visible inline-block px-1 text-[length:var(--field-label-raised-font-size)] opacity-0",
|
|
12016
|
+
raised ? "font-[var(--field-label-raised-font-weight)]" : "font-[var(--field-label-font-weight)]"
|
|
12017
12017
|
),
|
|
12018
12018
|
children: legend || label
|
|
12019
12019
|
}
|
|
@@ -12142,7 +12142,7 @@ var Input = React44.forwardRef(
|
|
|
12142
12142
|
"label",
|
|
12143
12143
|
{
|
|
12144
12144
|
htmlFor: inputId,
|
|
12145
|
-
className: "input__top-label mb-2 block text-[
|
|
12145
|
+
className: "input__top-label mb-2 block text-[length:var(--field-top-label-font-size)] font-[var(--field-top-label-font-weight)] text-[var(--chekin-color-brand-navy)]",
|
|
12146
12146
|
children: topLabel
|
|
12147
12147
|
}
|
|
12148
12148
|
),
|
|
@@ -12303,13 +12303,42 @@ var Input = React44.forwardRef(
|
|
|
12303
12303
|
);
|
|
12304
12304
|
Input.displayName = "Input";
|
|
12305
12305
|
|
|
12306
|
+
// src/dashboard/copy-input/CopyInput.tsx
|
|
12307
|
+
import * as React45 from "react";
|
|
12308
|
+
import { jsx as jsx143 } from "react/jsx-runtime";
|
|
12309
|
+
var CopyInput = React45.forwardRef(
|
|
12310
|
+
({ value = "", copyTooltip, copySize, copyVariant = "ghost", onCopy, ...props }, ref) => {
|
|
12311
|
+
return /* @__PURE__ */ jsx143(
|
|
12312
|
+
Input,
|
|
12313
|
+
{
|
|
12314
|
+
...props,
|
|
12315
|
+
ref,
|
|
12316
|
+
value,
|
|
12317
|
+
readOnly: true,
|
|
12318
|
+
trailingAdornment: /* @__PURE__ */ jsx143("span", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx143(
|
|
12319
|
+
CopyIcon,
|
|
12320
|
+
{
|
|
12321
|
+
textToCopy: value,
|
|
12322
|
+
tooltipText: copyTooltip,
|
|
12323
|
+
size: copySize,
|
|
12324
|
+
variant: copyVariant,
|
|
12325
|
+
onClick: onCopy
|
|
12326
|
+
}
|
|
12327
|
+
) }),
|
|
12328
|
+
inputClassName: cn("pr-12", props.inputClassName)
|
|
12329
|
+
}
|
|
12330
|
+
);
|
|
12331
|
+
}
|
|
12332
|
+
);
|
|
12333
|
+
CopyInput.displayName = "CopyInput";
|
|
12334
|
+
|
|
12306
12335
|
// src/dashboard/phone-input/PhoneInput.tsx
|
|
12307
|
-
import * as
|
|
12336
|
+
import * as React51 from "react";
|
|
12308
12337
|
import { useTranslation as useTranslation33 } from "react-i18next";
|
|
12309
12338
|
|
|
12310
12339
|
// src/dashboard/_select-internals/SelectFieldShell.tsx
|
|
12311
12340
|
import { useTranslation as useTranslation26 } from "react-i18next";
|
|
12312
|
-
import { jsx as
|
|
12341
|
+
import { jsx as jsx144, jsxs as jsxs90 } from "react/jsx-runtime";
|
|
12313
12342
|
var FOCUSABLE_TRIGGER_SELECTOR = 'input:not([type="hidden"]):not([disabled]):not([readonly]), button:not([disabled])';
|
|
12314
12343
|
function SelectFieldShell({
|
|
12315
12344
|
containerRef,
|
|
@@ -12353,20 +12382,20 @@ function SelectFieldShell({
|
|
|
12353
12382
|
),
|
|
12354
12383
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
12355
12384
|
children: [
|
|
12356
|
-
name && /* @__PURE__ */
|
|
12385
|
+
name && /* @__PURE__ */ jsx144("input", { type: "hidden", name, value: hiddenValue ?? "" }),
|
|
12357
12386
|
/* @__PURE__ */ jsxs90("div", { className: "relative min-h-[var(--field-min-height,48px)] w-full", children: [
|
|
12358
|
-
topLabel && /* @__PURE__ */
|
|
12387
|
+
topLabel && /* @__PURE__ */ jsx144(
|
|
12359
12388
|
"label",
|
|
12360
12389
|
{
|
|
12361
12390
|
htmlFor: triggerId,
|
|
12362
|
-
className: "mb-2 block text-[
|
|
12391
|
+
className: "mb-2 block text-[length:var(--field-top-label-font-size)] font-[var(--field-top-label-font-weight)] text-[var(--chekin-color-brand-navy)]",
|
|
12363
12392
|
children: topLabel
|
|
12364
12393
|
}
|
|
12365
12394
|
),
|
|
12366
|
-
/* @__PURE__ */
|
|
12367
|
-
!errorMessage && optional && /* @__PURE__ */
|
|
12368
|
-
!errorMessage && helperText && /* @__PURE__ */
|
|
12369
|
-
errorMessage && !hideErrorMessage && /* @__PURE__ */
|
|
12395
|
+
/* @__PURE__ */ jsx144("div", { className: "relative w-full", children }),
|
|
12396
|
+
!errorMessage && optional && /* @__PURE__ */ jsx144("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
12397
|
+
!errorMessage && helperText && /* @__PURE__ */ jsx144("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
12398
|
+
errorMessage && !hideErrorMessage && /* @__PURE__ */ jsx144(
|
|
12370
12399
|
FieldErrorMessage,
|
|
12371
12400
|
{
|
|
12372
12401
|
id: errorId,
|
|
@@ -12382,7 +12411,7 @@ function SelectFieldShell({
|
|
|
12382
12411
|
}
|
|
12383
12412
|
|
|
12384
12413
|
// src/dashboard/_select-internals/SelectMenu.tsx
|
|
12385
|
-
import * as
|
|
12414
|
+
import * as React46 from "react";
|
|
12386
12415
|
import { useTranslation as useTranslation27 } from "react-i18next";
|
|
12387
12416
|
|
|
12388
12417
|
// src/dashboard/_select-internals/utils.ts
|
|
@@ -12477,7 +12506,7 @@ function countriesFilter(option, inputValue) {
|
|
|
12477
12506
|
|
|
12478
12507
|
// src/dashboard/_select-internals/slots/DefaultOption.tsx
|
|
12479
12508
|
import { Check as Check6 } from "lucide-react";
|
|
12480
|
-
import { jsx as
|
|
12509
|
+
import { jsx as jsx145, jsxs as jsxs91 } from "react/jsx-runtime";
|
|
12481
12510
|
function DefaultOption(props) {
|
|
12482
12511
|
const {
|
|
12483
12512
|
option,
|
|
@@ -12520,9 +12549,9 @@ function DefaultOption(props) {
|
|
|
12520
12549
|
isDisabled && "cursor-not-allowed text-[var(--chekin-color-gray-2)]"
|
|
12521
12550
|
),
|
|
12522
12551
|
children: [
|
|
12523
|
-
/* @__PURE__ */
|
|
12524
|
-
option.description && /* @__PURE__ */
|
|
12525
|
-
isSelected && /* @__PURE__ */
|
|
12552
|
+
/* @__PURE__ */ jsx145("span", { className: "block min-w-0 break-words", children: labelContent }),
|
|
12553
|
+
option.description && /* @__PURE__ */ jsx145("span", { className: "ml-auto shrink-0 self-center text-[12px] font-medium italic text-[var(--chekin-color-gray-1)]", children: option.description }),
|
|
12554
|
+
isSelected && /* @__PURE__ */ jsx145(
|
|
12526
12555
|
Check6,
|
|
12527
12556
|
{
|
|
12528
12557
|
"aria-hidden": "true",
|
|
@@ -12539,7 +12568,7 @@ function DefaultOption(props) {
|
|
|
12539
12568
|
}
|
|
12540
12569
|
|
|
12541
12570
|
// src/dashboard/_select-internals/SelectMenu.tsx
|
|
12542
|
-
import { jsx as
|
|
12571
|
+
import { jsx as jsx146, jsxs as jsxs92 } from "react/jsx-runtime";
|
|
12543
12572
|
function buildMenuEntries(groupedOptions, options, formatGroupLabel, listboxId) {
|
|
12544
12573
|
if (!groupedOptions || !groupedOptions.some((item) => isOptionGroup(item))) {
|
|
12545
12574
|
return options.map((option, index) => ({
|
|
@@ -12620,11 +12649,11 @@ function SelectMenu({
|
|
|
12620
12649
|
const hasOptions = options.length > 0;
|
|
12621
12650
|
const Option = components?.Option ?? DefaultOption;
|
|
12622
12651
|
const lastIndex = options.length - 1;
|
|
12623
|
-
const selectedList =
|
|
12652
|
+
const selectedList = React46.useMemo(
|
|
12624
12653
|
() => selectedValues ?? (selectedValue ? [selectedValue] : []),
|
|
12625
12654
|
[selectedValues, selectedValue]
|
|
12626
12655
|
);
|
|
12627
|
-
const entries =
|
|
12656
|
+
const entries = React46.useMemo(
|
|
12628
12657
|
() => buildMenuEntries(groupedOptions, options, formatGroupLabel, id),
|
|
12629
12658
|
[groupedOptions, options, formatGroupLabel, id]
|
|
12630
12659
|
);
|
|
@@ -12635,7 +12664,7 @@ function SelectMenu({
|
|
|
12635
12664
|
const optionDisabled = Boolean(
|
|
12636
12665
|
disabled || option.isDisabled || isOptionDisabled?.(option)
|
|
12637
12666
|
);
|
|
12638
|
-
return /* @__PURE__ */
|
|
12667
|
+
return /* @__PURE__ */ jsx146(
|
|
12639
12668
|
Option,
|
|
12640
12669
|
{
|
|
12641
12670
|
id: getOptionId2(flatIndex),
|
|
@@ -12656,8 +12685,8 @@ function SelectMenu({
|
|
|
12656
12685
|
key
|
|
12657
12686
|
);
|
|
12658
12687
|
};
|
|
12659
|
-
const wasAtBottomRef =
|
|
12660
|
-
const handleScroll =
|
|
12688
|
+
const wasAtBottomRef = React46.useRef(false);
|
|
12689
|
+
const handleScroll = React46.useCallback(
|
|
12661
12690
|
(event) => {
|
|
12662
12691
|
if (!onMenuScrollToBottom) return;
|
|
12663
12692
|
const target = event.currentTarget;
|
|
@@ -12688,11 +12717,11 @@ function SelectMenu({
|
|
|
12688
12717
|
menuClassName
|
|
12689
12718
|
),
|
|
12690
12719
|
children: [
|
|
12691
|
-
!hasOptions && (emptyContent ?? /* @__PURE__ */
|
|
12720
|
+
!hasOptions && (emptyContent ?? /* @__PURE__ */ jsx146("div", { className: "px-3 py-3 text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: emptyMessage })),
|
|
12692
12721
|
entries.map((entry) => {
|
|
12693
12722
|
if (entry.kind === "group") {
|
|
12694
12723
|
return /* @__PURE__ */ jsxs92("div", { role: "group", "aria-labelledby": entry.labelId, children: [
|
|
12695
|
-
/* @__PURE__ */
|
|
12724
|
+
/* @__PURE__ */ jsx146(
|
|
12696
12725
|
"div",
|
|
12697
12726
|
{
|
|
12698
12727
|
id: entry.labelId,
|
|
@@ -12713,7 +12742,7 @@ function SelectMenu({
|
|
|
12713
12742
|
|
|
12714
12743
|
// src/dashboard/_select-internals/SelectMenuPanel.tsx
|
|
12715
12744
|
import { useTranslation as useTranslation28 } from "react-i18next";
|
|
12716
|
-
import { jsx as
|
|
12745
|
+
import { jsx as jsx147, jsxs as jsxs93 } from "react/jsx-runtime";
|
|
12717
12746
|
function SelectMenuPanel({
|
|
12718
12747
|
isOpen,
|
|
12719
12748
|
isMobile: isMobile3,
|
|
@@ -12731,7 +12760,7 @@ function SelectMenuPanel({
|
|
|
12731
12760
|
const fallbackTitle = t("select_option");
|
|
12732
12761
|
const titleText = typeof title === "string" || typeof title === "number" ? String(title) : fallbackTitle;
|
|
12733
12762
|
const descriptionText = typeof description === "string" || typeof description === "number" ? String(description) : titleText;
|
|
12734
|
-
return /* @__PURE__ */
|
|
12763
|
+
return /* @__PURE__ */ jsx147(
|
|
12735
12764
|
Drawer,
|
|
12736
12765
|
{
|
|
12737
12766
|
open: isOpen,
|
|
@@ -12745,9 +12774,9 @@ function SelectMenuPanel({
|
|
|
12745
12774
|
lockScroll: false,
|
|
12746
12775
|
className: cn("max-h-[calc(100vh-1rem)]", drawerClassName),
|
|
12747
12776
|
children: [
|
|
12748
|
-
/* @__PURE__ */
|
|
12749
|
-
/* @__PURE__ */
|
|
12750
|
-
/* @__PURE__ */
|
|
12777
|
+
/* @__PURE__ */ jsx147(DrawerTitle, { className: "sr-only", children: titleText }),
|
|
12778
|
+
/* @__PURE__ */ jsx147(DrawerDescription, { className: "sr-only", children: descriptionText }),
|
|
12779
|
+
/* @__PURE__ */ jsx147(
|
|
12751
12780
|
"div",
|
|
12752
12781
|
{
|
|
12753
12782
|
className: cn(
|
|
@@ -12763,7 +12792,7 @@ function SelectMenuPanel({
|
|
|
12763
12792
|
}
|
|
12764
12793
|
);
|
|
12765
12794
|
}
|
|
12766
|
-
return /* @__PURE__ */
|
|
12795
|
+
return /* @__PURE__ */ jsx147(
|
|
12767
12796
|
"div",
|
|
12768
12797
|
{
|
|
12769
12798
|
className: cn(
|
|
@@ -12777,7 +12806,7 @@ function SelectMenuPanel({
|
|
|
12777
12806
|
|
|
12778
12807
|
// src/dashboard/_select-internals/SelectSearchInput.tsx
|
|
12779
12808
|
import { Search as Search3 } from "lucide-react";
|
|
12780
|
-
import { jsx as
|
|
12809
|
+
import { jsx as jsx148, jsxs as jsxs94 } from "react/jsx-runtime";
|
|
12781
12810
|
function SelectSearchInput({
|
|
12782
12811
|
inputRef,
|
|
12783
12812
|
value,
|
|
@@ -12787,15 +12816,15 @@ function SelectSearchInput({
|
|
|
12787
12816
|
onChange,
|
|
12788
12817
|
onKeyDown
|
|
12789
12818
|
}) {
|
|
12790
|
-
return /* @__PURE__ */
|
|
12791
|
-
/* @__PURE__ */
|
|
12819
|
+
return /* @__PURE__ */ jsx148("div", { className: "border-b border-[var(--chekin-color-gray-3)] bg-white p-2", children: /* @__PURE__ */ jsxs94("div", { className: "relative", children: [
|
|
12820
|
+
/* @__PURE__ */ jsx148(
|
|
12792
12821
|
Search3,
|
|
12793
12822
|
{
|
|
12794
12823
|
"aria-hidden": "true",
|
|
12795
12824
|
className: "pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-[var(--chekin-color-gray-2)]"
|
|
12796
12825
|
}
|
|
12797
12826
|
),
|
|
12798
|
-
/* @__PURE__ */
|
|
12827
|
+
/* @__PURE__ */ jsx148(
|
|
12799
12828
|
"input",
|
|
12800
12829
|
{
|
|
12801
12830
|
ref: inputRef,
|
|
@@ -12815,7 +12844,7 @@ function SelectSearchInput({
|
|
|
12815
12844
|
|
|
12816
12845
|
// src/dashboard/_select-internals/SelectTrigger.tsx
|
|
12817
12846
|
import { ChevronDown as ChevronDown2 } from "lucide-react";
|
|
12818
|
-
import { jsx as
|
|
12847
|
+
import { jsx as jsx149, jsxs as jsxs95 } from "react/jsx-runtime";
|
|
12819
12848
|
function SelectTrigger({
|
|
12820
12849
|
triggerRef,
|
|
12821
12850
|
triggerId,
|
|
@@ -12870,9 +12899,9 @@ function SelectTrigger({
|
|
|
12870
12899
|
loading && "!cursor-progress"
|
|
12871
12900
|
),
|
|
12872
12901
|
children: [
|
|
12873
|
-
leftIcon && /* @__PURE__ */
|
|
12874
|
-
/* @__PURE__ */
|
|
12875
|
-
/* @__PURE__ */
|
|
12902
|
+
leftIcon && /* @__PURE__ */ jsx149("span", { className: "pointer-events-none absolute left-0 top-0 flex h-full max-w-10 items-center justify-center text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ jsx149("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
12903
|
+
/* @__PURE__ */ jsx149("span", { id: valueId, className: "block min-w-0 flex-1 truncate text-left", children: hasValue ? valueLabel : showPlaceholderWhenIdle || isOpen ? placeholder : null }),
|
|
12904
|
+
/* @__PURE__ */ jsx149("span", { className: "flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: !hideIndicator && /* @__PURE__ */ jsx149(
|
|
12876
12905
|
ChevronDown2,
|
|
12877
12906
|
{
|
|
12878
12907
|
size: 16,
|
|
@@ -12888,9 +12917,9 @@ function SelectTrigger({
|
|
|
12888
12917
|
}
|
|
12889
12918
|
|
|
12890
12919
|
// src/dashboard/_select-internals/ComboboxTrigger.tsx
|
|
12891
|
-
import { SquareX as SquareX2 } from "lucide-react";
|
|
12920
|
+
import { Search as Search4, SquareX as SquareX2 } from "lucide-react";
|
|
12892
12921
|
import { useTranslation as useTranslation29 } from "react-i18next";
|
|
12893
|
-
import { jsx as
|
|
12922
|
+
import { jsx as jsx150, jsxs as jsxs96 } from "react/jsx-runtime";
|
|
12894
12923
|
function ComboboxTrigger({
|
|
12895
12924
|
triggerId,
|
|
12896
12925
|
listboxId,
|
|
@@ -12958,13 +12987,14 @@ function ComboboxTrigger({
|
|
|
12958
12987
|
containerClassName
|
|
12959
12988
|
),
|
|
12960
12989
|
children: [
|
|
12961
|
-
leftIcon && /* @__PURE__ */
|
|
12990
|
+
leftIcon && /* @__PURE__ */ jsx150("span", { className: "pointer-events-none absolute left-0 top-0 flex h-full max-w-10 items-center justify-center text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ jsx150("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
12991
|
+
!leftIcon && searchable && (isFocused || isOpen) && /* @__PURE__ */ jsx150("span", { className: "pointer-events-none absolute left-0 top-0 flex h-full max-w-10 items-center justify-center text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ jsx150("span", { className: "flex h-full w-10 items-center justify-center", children: /* @__PURE__ */ jsx150(Search4, { size: 16, "aria-hidden": "true" }) }) }),
|
|
12962
12992
|
/* @__PURE__ */ jsxs96(
|
|
12963
12993
|
"div",
|
|
12964
12994
|
{
|
|
12965
12995
|
className: cn(
|
|
12966
12996
|
"flex min-w-0 flex-1 items-center gap-2 py-[10px]",
|
|
12967
|
-
leftIcon ? "pl-10" : "pl-4",
|
|
12997
|
+
leftIcon || searchable && (isFocused || isOpen) ? "pl-10" : "pl-4",
|
|
12968
12998
|
isMulti && "flex-wrap"
|
|
12969
12999
|
),
|
|
12970
13000
|
children: [
|
|
@@ -12978,7 +13008,7 @@ function ComboboxTrigger({
|
|
|
12978
13008
|
!searchable && "sr-only"
|
|
12979
13009
|
),
|
|
12980
13010
|
children: [
|
|
12981
|
-
/* @__PURE__ */
|
|
13011
|
+
/* @__PURE__ */ jsx150(
|
|
12982
13012
|
"span",
|
|
12983
13013
|
{
|
|
12984
13014
|
"aria-hidden": "true",
|
|
@@ -12986,7 +13016,7 @@ function ComboboxTrigger({
|
|
|
12986
13016
|
children: inputMeasureValue
|
|
12987
13017
|
}
|
|
12988
13018
|
),
|
|
12989
|
-
/* @__PURE__ */
|
|
13019
|
+
/* @__PURE__ */ jsx150(
|
|
12990
13020
|
"input",
|
|
12991
13021
|
{
|
|
12992
13022
|
ref: inputRef,
|
|
@@ -13021,17 +13051,17 @@ function ComboboxTrigger({
|
|
|
13021
13051
|
}
|
|
13022
13052
|
),
|
|
13023
13053
|
/* @__PURE__ */ jsxs96("span", { className: "flex h-12 shrink-0 items-center gap-2 self-start pl-2 pr-4 text-[var(--chekin-color-gray-2)]", children: [
|
|
13024
|
-
showClear && /* @__PURE__ */
|
|
13054
|
+
showClear && /* @__PURE__ */ jsx150(
|
|
13025
13055
|
"button",
|
|
13026
13056
|
{
|
|
13027
13057
|
type: "button",
|
|
13028
13058
|
onClick: onClear,
|
|
13029
13059
|
className: "flex h-5 w-5 items-center justify-center rounded-[3px] border-0 bg-transparent p-0 text-[#9696b9] hover:shadow-[0_3px_3px_#0f477734]",
|
|
13030
13060
|
"aria-label": clearLabel,
|
|
13031
|
-
children: /* @__PURE__ */
|
|
13061
|
+
children: /* @__PURE__ */ jsx150(SquareX2, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
13032
13062
|
}
|
|
13033
13063
|
),
|
|
13034
|
-
!hideIndicator && /* @__PURE__ */
|
|
13064
|
+
!hideIndicator && /* @__PURE__ */ jsx150(
|
|
13035
13065
|
RotateArrow,
|
|
13036
13066
|
{
|
|
13037
13067
|
shouldRotate: isOpen,
|
|
@@ -13047,14 +13077,14 @@ function ComboboxTrigger({
|
|
|
13047
13077
|
}
|
|
13048
13078
|
|
|
13049
13079
|
// src/dashboard/_select-internals/useSelectIds.ts
|
|
13050
|
-
import * as
|
|
13080
|
+
import * as React47 from "react";
|
|
13051
13081
|
function useSelectIds({
|
|
13052
13082
|
name,
|
|
13053
13083
|
hasValue,
|
|
13054
13084
|
error,
|
|
13055
13085
|
hideErrorMessage
|
|
13056
13086
|
}) {
|
|
13057
|
-
const reactId =
|
|
13087
|
+
const reactId = React47.useId().replace(/:/g, "");
|
|
13058
13088
|
const baseId = name ? `dash-select-${name}` : `dash-select-${reactId}`;
|
|
13059
13089
|
const triggerId = `${baseId}-trigger`;
|
|
13060
13090
|
const labelId = `${baseId}-label`;
|
|
@@ -13064,7 +13094,7 @@ function useSelectIds({
|
|
|
13064
13094
|
const listboxId = `${baseId}-listbox`;
|
|
13065
13095
|
const describedErrorId = error && !hideErrorMessage ? errorId : void 0;
|
|
13066
13096
|
const describedBy = [!hasValue ? helperTextId : null, describedErrorId].filter(Boolean).join(" ") || void 0;
|
|
13067
|
-
const getOptionId2 =
|
|
13097
|
+
const getOptionId2 = React47.useCallback(
|
|
13068
13098
|
(index) => `${baseId}-option-${index}`,
|
|
13069
13099
|
[baseId]
|
|
13070
13100
|
);
|
|
@@ -13082,7 +13112,7 @@ function useSelectIds({
|
|
|
13082
13112
|
}
|
|
13083
13113
|
|
|
13084
13114
|
// src/dashboard/_select-internals/useSelectMenuState.ts
|
|
13085
|
-
import * as
|
|
13115
|
+
import * as React48 from "react";
|
|
13086
13116
|
function useSelectMenuState({
|
|
13087
13117
|
isBlocked,
|
|
13088
13118
|
isMobile: isMobile3,
|
|
@@ -13090,14 +13120,14 @@ function useSelectMenuState({
|
|
|
13090
13120
|
controlledIsOpen,
|
|
13091
13121
|
onMenuOpenChange
|
|
13092
13122
|
}) {
|
|
13093
|
-
const containerRef =
|
|
13094
|
-
const [internalIsOpen, setInternalIsOpen] =
|
|
13095
|
-
const [hasClosedControlledOpen, setHasClosedControlledOpen] =
|
|
13123
|
+
const containerRef = React48.useRef(null);
|
|
13124
|
+
const [internalIsOpen, setInternalIsOpen] = React48.useState(false);
|
|
13125
|
+
const [hasClosedControlledOpen, setHasClosedControlledOpen] = React48.useState(false);
|
|
13096
13126
|
const isOpen = controlledIsOpen === false ? false : controlledIsOpen === true ? !hasClosedControlledOpen : internalIsOpen;
|
|
13097
|
-
|
|
13127
|
+
React48.useEffect(() => {
|
|
13098
13128
|
if (controlledIsOpen !== true) setHasClosedControlledOpen(false);
|
|
13099
13129
|
}, [controlledIsOpen]);
|
|
13100
|
-
const setIsOpen =
|
|
13130
|
+
const setIsOpen = React48.useCallback(
|
|
13101
13131
|
(next) => {
|
|
13102
13132
|
const value = typeof next === "function" ? next(isOpen) : next;
|
|
13103
13133
|
if (controlledIsOpen === true) setHasClosedControlledOpen(!value);
|
|
@@ -13106,13 +13136,13 @@ function useSelectMenuState({
|
|
|
13106
13136
|
},
|
|
13107
13137
|
[isOpen, controlledIsOpen, onMenuOpenChange]
|
|
13108
13138
|
);
|
|
13109
|
-
const openMenu =
|
|
13139
|
+
const openMenu = React48.useCallback(() => {
|
|
13110
13140
|
setIsOpen(true);
|
|
13111
13141
|
}, [setIsOpen]);
|
|
13112
|
-
const closeMenu =
|
|
13142
|
+
const closeMenu = React48.useCallback(() => {
|
|
13113
13143
|
setIsOpen(false);
|
|
13114
13144
|
}, [setIsOpen]);
|
|
13115
|
-
const toggleMenu =
|
|
13145
|
+
const toggleMenu = React48.useCallback(() => {
|
|
13116
13146
|
if (isBlocked) return;
|
|
13117
13147
|
setIsOpen((prev) => !prev);
|
|
13118
13148
|
}, [isBlocked, setIsOpen]);
|
|
@@ -13124,14 +13154,14 @@ function useSelectMenuState({
|
|
|
13124
13154
|
},
|
|
13125
13155
|
isDisabled: !isOpen || isMobile3
|
|
13126
13156
|
});
|
|
13127
|
-
|
|
13157
|
+
React48.useEffect(() => {
|
|
13128
13158
|
if (isBlocked) setIsOpen(false);
|
|
13129
13159
|
}, [isBlocked, setIsOpen]);
|
|
13130
13160
|
return { containerRef, isOpen, openMenu, closeMenu, toggleMenu, setIsOpen };
|
|
13131
13161
|
}
|
|
13132
13162
|
|
|
13133
13163
|
// src/dashboard/_select-internals/useSelectState.ts
|
|
13134
|
-
import * as
|
|
13164
|
+
import * as React49 from "react";
|
|
13135
13165
|
function resolveValueLabel(option, getValueLabel) {
|
|
13136
13166
|
if (!option) return "";
|
|
13137
13167
|
return getValueLabel?.(option) ?? String(option.label);
|
|
@@ -13167,25 +13197,25 @@ function useSelectState(params) {
|
|
|
13167
13197
|
isSearchInDropdown,
|
|
13168
13198
|
searchable = true
|
|
13169
13199
|
} = params;
|
|
13170
|
-
const inputRef =
|
|
13171
|
-
const mobileSearchInputRef =
|
|
13172
|
-
const listRef =
|
|
13173
|
-
const optionRefs =
|
|
13200
|
+
const inputRef = React49.useRef(null);
|
|
13201
|
+
const mobileSearchInputRef = React49.useRef(null);
|
|
13202
|
+
const listRef = React49.useRef(null);
|
|
13203
|
+
const optionRefs = React49.useRef([]);
|
|
13174
13204
|
const isMobile3 = useIsMobile();
|
|
13175
|
-
const [isFocused, setIsFocused] =
|
|
13176
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
13205
|
+
const [isFocused, setIsFocused] = React49.useState(false);
|
|
13206
|
+
const [highlightedIndex, setHighlightedIndex] = React49.useState(-1);
|
|
13177
13207
|
const singleSelected = isMulti ? void 0 : selectedOptions[0];
|
|
13178
|
-
const valueLabel =
|
|
13208
|
+
const valueLabel = React49.useMemo(
|
|
13179
13209
|
() => resolveValueLabel(singleSelected, getValueLabel),
|
|
13180
13210
|
[singleSelected, getValueLabel]
|
|
13181
13211
|
);
|
|
13182
13212
|
const isSearchOnlyInput = searchable && (isMulti || Boolean(isSearchInDropdown));
|
|
13183
13213
|
const isInputControlled = controlledInputValue !== void 0;
|
|
13184
|
-
const [internalInputValue, setInternalInputValue] =
|
|
13214
|
+
const [internalInputValue, setInternalInputValue] = React49.useState(
|
|
13185
13215
|
searchable && !isSearchOnlyInput ? valueLabel : ""
|
|
13186
13216
|
);
|
|
13187
13217
|
const inputValue = isInputControlled ? controlledInputValue : internalInputValue;
|
|
13188
|
-
const setInputValue =
|
|
13218
|
+
const setInputValue = React49.useCallback(
|
|
13189
13219
|
(next) => {
|
|
13190
13220
|
if (!isInputControlled) setInternalInputValue(next);
|
|
13191
13221
|
},
|
|
@@ -13204,12 +13234,12 @@ function useSelectState(params) {
|
|
|
13204
13234
|
});
|
|
13205
13235
|
const ids = useSelectIds({ name, hasValue, error, hideErrorMessage });
|
|
13206
13236
|
const { listboxId, getOptionId: getOptionId2 } = ids;
|
|
13207
|
-
|
|
13237
|
+
React49.useEffect(() => {
|
|
13208
13238
|
if (!searchable) return;
|
|
13209
13239
|
if (isSearchOnlyInput) return;
|
|
13210
13240
|
if (!isFocused) setInputValue(valueLabel);
|
|
13211
13241
|
}, [valueLabel, isFocused, isSearchOnlyInput, searchable]);
|
|
13212
|
-
|
|
13242
|
+
React49.useEffect(() => {
|
|
13213
13243
|
if (!isSearchOnlyInput) return;
|
|
13214
13244
|
if (!isOpen) {
|
|
13215
13245
|
setInputValue("");
|
|
@@ -13218,11 +13248,11 @@ function useSelectState(params) {
|
|
|
13218
13248
|
}, [isOpen, isSearchOnlyInput]);
|
|
13219
13249
|
const trimmedInput = inputValue.trim();
|
|
13220
13250
|
const isFiltering = searchable && (isSearchOnlyInput ? trimmedInput.length > 0 : trimmedInput.length > 0 && trimmedInput.toLowerCase() !== valueLabel.toLowerCase());
|
|
13221
|
-
const filteredOptions =
|
|
13251
|
+
const filteredOptions = React49.useMemo(() => {
|
|
13222
13252
|
if (!isFiltering) return options;
|
|
13223
13253
|
return options.filter((option) => filterOption(option, trimmedInput));
|
|
13224
13254
|
}, [options, isFiltering, trimmedInput, filterOption]);
|
|
13225
|
-
const canCreateNewOption =
|
|
13255
|
+
const canCreateNewOption = React49.useMemo(() => {
|
|
13226
13256
|
if (!isCreatable || !trimmedInput) return false;
|
|
13227
13257
|
if (isValidNewOption) {
|
|
13228
13258
|
return isValidNewOption(trimmedInput, selectedOptions, options);
|
|
@@ -13236,7 +13266,7 @@ function useSelectState(params) {
|
|
|
13236
13266
|
);
|
|
13237
13267
|
return !existsInOptions && !existsInSelected;
|
|
13238
13268
|
}, [isCreatable, trimmedInput, isValidNewOption, options, selectedOptions]);
|
|
13239
|
-
|
|
13269
|
+
React49.useEffect(() => {
|
|
13240
13270
|
if (!isOpen || filteredOptions.length === 0) {
|
|
13241
13271
|
setHighlightedIndex(-1);
|
|
13242
13272
|
return;
|
|
@@ -13246,23 +13276,23 @@ function useSelectState(params) {
|
|
|
13246
13276
|
return getFirstEnabledOptionIndex(filteredOptions, isOptionDisabled);
|
|
13247
13277
|
});
|
|
13248
13278
|
}, [isOpen, filteredOptions, isOptionDisabled]);
|
|
13249
|
-
|
|
13279
|
+
React49.useEffect(() => {
|
|
13250
13280
|
if (!isOpen || highlightedIndex < 0) return;
|
|
13251
13281
|
optionRefs.current[highlightedIndex]?.scrollIntoView?.({ block: "nearest" });
|
|
13252
13282
|
}, [highlightedIndex, isOpen]);
|
|
13253
13283
|
const inMenuSearchVisible = searchable && (isMobile3 || Boolean(isSearchInDropdown));
|
|
13254
|
-
|
|
13284
|
+
React49.useEffect(() => {
|
|
13255
13285
|
if (!isOpen || !inMenuSearchVisible) return;
|
|
13256
13286
|
const frame = window.requestAnimationFrame(
|
|
13257
13287
|
() => mobileSearchInputRef.current?.focus()
|
|
13258
13288
|
);
|
|
13259
13289
|
return () => window.cancelAnimationFrame(frame);
|
|
13260
13290
|
}, [isOpen, inMenuSearchVisible]);
|
|
13261
|
-
const isValueSelected =
|
|
13291
|
+
const isValueSelected = React49.useCallback(
|
|
13262
13292
|
(option) => isOptionSelected2(option, selectedOptions),
|
|
13263
13293
|
[isOptionSelected2, selectedOptions]
|
|
13264
13294
|
);
|
|
13265
|
-
const selectOption =
|
|
13295
|
+
const selectOption = React49.useCallback(
|
|
13266
13296
|
(option) => {
|
|
13267
13297
|
if (!isOptionEnabled(option, isOptionDisabled)) return;
|
|
13268
13298
|
if (isMulti) {
|
|
@@ -13298,7 +13328,7 @@ function useSelectState(params) {
|
|
|
13298
13328
|
searchable
|
|
13299
13329
|
]
|
|
13300
13330
|
);
|
|
13301
|
-
const removeOption =
|
|
13331
|
+
const removeOption = React49.useCallback(
|
|
13302
13332
|
(option) => {
|
|
13303
13333
|
if (isBlocked) return;
|
|
13304
13334
|
onSelectionChange(
|
|
@@ -13309,7 +13339,7 @@ function useSelectState(params) {
|
|
|
13309
13339
|
},
|
|
13310
13340
|
[isBlocked, onSelectionChange, selectedOptions]
|
|
13311
13341
|
);
|
|
13312
|
-
const clearSelection =
|
|
13342
|
+
const clearSelection = React49.useCallback(
|
|
13313
13343
|
(event) => {
|
|
13314
13344
|
event?.stopPropagation();
|
|
13315
13345
|
if (isBlocked) return;
|
|
@@ -13319,7 +13349,7 @@ function useSelectState(params) {
|
|
|
13319
13349
|
},
|
|
13320
13350
|
[isBlocked, onSelectionChange]
|
|
13321
13351
|
);
|
|
13322
|
-
const createOption =
|
|
13352
|
+
const createOption = React49.useCallback(() => {
|
|
13323
13353
|
if (!canCreateNewOption) return;
|
|
13324
13354
|
const newOption = onCreateOption?.(trimmedInput) ?? { value: trimmedInput, label: trimmedInput };
|
|
13325
13355
|
if (isMulti) {
|
|
@@ -13349,7 +13379,7 @@ function useSelectState(params) {
|
|
|
13349
13379
|
isSearchInDropdown,
|
|
13350
13380
|
searchable
|
|
13351
13381
|
]);
|
|
13352
|
-
const handleInputChange =
|
|
13382
|
+
const handleInputChange = React49.useCallback(
|
|
13353
13383
|
(event) => {
|
|
13354
13384
|
if (!searchable) return;
|
|
13355
13385
|
const nextValue = event.target.value;
|
|
@@ -13359,7 +13389,7 @@ function useSelectState(params) {
|
|
|
13359
13389
|
},
|
|
13360
13390
|
[isOpen, onInputChange, searchable, setIsOpen, setInputValue]
|
|
13361
13391
|
);
|
|
13362
|
-
const handleInputFocus =
|
|
13392
|
+
const handleInputFocus = React49.useCallback(
|
|
13363
13393
|
(event) => {
|
|
13364
13394
|
if (isBlocked) return;
|
|
13365
13395
|
onFocus?.(event);
|
|
@@ -13371,17 +13401,17 @@ function useSelectState(params) {
|
|
|
13371
13401
|
},
|
|
13372
13402
|
[isBlocked, onFocus, openMenuOnFocus, setIsOpen, searchable, isMulti]
|
|
13373
13403
|
);
|
|
13374
|
-
const handleTriggerFocus =
|
|
13404
|
+
const handleTriggerFocus = React49.useCallback(() => {
|
|
13375
13405
|
if (isBlocked) return;
|
|
13376
13406
|
setIsFocused(true);
|
|
13377
13407
|
if (openMenuOnFocus) setIsOpen(true);
|
|
13378
13408
|
}, [isBlocked, openMenuOnFocus, setIsOpen]);
|
|
13379
|
-
const handleContainerClick =
|
|
13409
|
+
const handleContainerClick = React49.useCallback(() => {
|
|
13380
13410
|
if (isBlocked) return;
|
|
13381
13411
|
inputRef.current?.focus();
|
|
13382
13412
|
setIsOpen(true);
|
|
13383
13413
|
}, [isBlocked, setIsOpen]);
|
|
13384
|
-
const handleBlur =
|
|
13414
|
+
const handleBlur = React49.useCallback(
|
|
13385
13415
|
(event) => {
|
|
13386
13416
|
if (containerRef.current?.contains(event.relatedTarget)) return;
|
|
13387
13417
|
setIsFocused(false);
|
|
@@ -13390,7 +13420,7 @@ function useSelectState(params) {
|
|
|
13390
13420
|
},
|
|
13391
13421
|
[containerRef, isSearchOnlyInput, searchable, valueLabel, onBlur]
|
|
13392
13422
|
);
|
|
13393
|
-
const handleInputKeyDown =
|
|
13423
|
+
const handleInputKeyDown = React49.useCallback(
|
|
13394
13424
|
(event) => {
|
|
13395
13425
|
onKeyDown?.(event);
|
|
13396
13426
|
if (event.defaultPrevented) return;
|
|
@@ -13467,7 +13497,7 @@ function useSelectState(params) {
|
|
|
13467
13497
|
]
|
|
13468
13498
|
);
|
|
13469
13499
|
const isEmpty = !hasValue && !inputValue;
|
|
13470
|
-
|
|
13500
|
+
React49.useDebugValue({ isOpen, isMulti, highlightedIndex, selectedOptions });
|
|
13471
13501
|
return {
|
|
13472
13502
|
// ids
|
|
13473
13503
|
ids,
|
|
@@ -13529,7 +13559,7 @@ function useSelectState(params) {
|
|
|
13529
13559
|
// src/dashboard/_select-internals/slots/DefaultMultiValueChip.tsx
|
|
13530
13560
|
import { X as X10 } from "lucide-react";
|
|
13531
13561
|
import { useTranslation as useTranslation30 } from "react-i18next";
|
|
13532
|
-
import { jsx as
|
|
13562
|
+
import { jsx as jsx151, jsxs as jsxs97 } from "react/jsx-runtime";
|
|
13533
13563
|
function DefaultMultiValueChip({
|
|
13534
13564
|
option,
|
|
13535
13565
|
readOnly,
|
|
@@ -13538,8 +13568,8 @@ function DefaultMultiValueChip({
|
|
|
13538
13568
|
const { t } = useTranslation30();
|
|
13539
13569
|
const labelText = typeof option.label === "string" ? option.label : String(option.value);
|
|
13540
13570
|
return /* @__PURE__ */ jsxs97("span", { className: "inline-flex items-center gap-1 rounded-md border border-[var(--chekin-color-gray-3)] bg-[var(--chekin-color-surface-pressed)] py-0.5 pl-2 pr-1 text-[13px] font-medium text-[var(--chekin-color-brand-navy)] transition-colors", children: [
|
|
13541
|
-
/* @__PURE__ */
|
|
13542
|
-
!readOnly && /* @__PURE__ */
|
|
13571
|
+
/* @__PURE__ */ jsx151("span", { className: "whitespace-nowrap leading-5", children: option.label }),
|
|
13572
|
+
!readOnly && /* @__PURE__ */ jsx151(
|
|
13543
13573
|
"button",
|
|
13544
13574
|
{
|
|
13545
13575
|
type: "button",
|
|
@@ -13549,14 +13579,14 @@ function DefaultMultiValueChip({
|
|
|
13549
13579
|
},
|
|
13550
13580
|
className: "flex h-4 w-4 items-center justify-center rounded-sm border-0 bg-transparent p-0 text-[var(--chekin-color-gray-1)] outline-none transition-colors hover:bg-white/70 hover:text-[var(--chekin-color-brand-navy)] focus-visible:ring-2 focus-visible:ring-[var(--chekin-color-brand-blue)]/30",
|
|
13551
13581
|
"aria-label": t("remove_item", { label: labelText }),
|
|
13552
|
-
children: /* @__PURE__ */
|
|
13582
|
+
children: /* @__PURE__ */ jsx151(X10, { size: 12, strokeWidth: 2.5 })
|
|
13553
13583
|
}
|
|
13554
13584
|
)
|
|
13555
13585
|
] });
|
|
13556
13586
|
}
|
|
13557
13587
|
|
|
13558
13588
|
// src/dashboard/_select-internals/slots/DefaultControl.tsx
|
|
13559
|
-
import { jsx as
|
|
13589
|
+
import { jsx as jsx152 } from "react/jsx-runtime";
|
|
13560
13590
|
function DefaultControl(props) {
|
|
13561
13591
|
const {
|
|
13562
13592
|
triggerId,
|
|
@@ -13599,7 +13629,7 @@ function DefaultControl(props) {
|
|
|
13599
13629
|
const Chip = components.MultiValueChip ?? DefaultMultiValueChip;
|
|
13600
13630
|
const showClear = Boolean(clearable) && hasValue && !readOnly && !disabled;
|
|
13601
13631
|
const placeholderText = isMulti ? !hasValue ? placeholder : "" : placeholder;
|
|
13602
|
-
return /* @__PURE__ */
|
|
13632
|
+
return /* @__PURE__ */ jsx152(
|
|
13603
13633
|
ComboboxTrigger,
|
|
13604
13634
|
{
|
|
13605
13635
|
triggerId,
|
|
@@ -13635,7 +13665,7 @@ function DefaultControl(props) {
|
|
|
13635
13665
|
autoFocus,
|
|
13636
13666
|
leftIcon,
|
|
13637
13667
|
searchable,
|
|
13638
|
-
leadingContent: isMulti ? selectedOptions.map((option) => /* @__PURE__ */
|
|
13668
|
+
leadingContent: isMulti ? selectedOptions.map((option) => /* @__PURE__ */ jsx152(
|
|
13639
13669
|
Chip,
|
|
13640
13670
|
{
|
|
13641
13671
|
option,
|
|
@@ -13650,7 +13680,7 @@ function DefaultControl(props) {
|
|
|
13650
13680
|
|
|
13651
13681
|
// src/dashboard/_select-internals/slots/StaticControl.tsx
|
|
13652
13682
|
import { SquareX as SquareX3 } from "lucide-react";
|
|
13653
|
-
import { jsx as
|
|
13683
|
+
import { jsx as jsx153, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
13654
13684
|
function StaticControl(props) {
|
|
13655
13685
|
const {
|
|
13656
13686
|
triggerId,
|
|
@@ -13679,7 +13709,7 @@ function StaticControl(props) {
|
|
|
13679
13709
|
} = props;
|
|
13680
13710
|
const showClear = Boolean(clearable) && hasValue && !readOnly && !disabled;
|
|
13681
13711
|
return /* @__PURE__ */ jsxs98("div", { className: "relative", children: [
|
|
13682
|
-
/* @__PURE__ */
|
|
13712
|
+
/* @__PURE__ */ jsx153(
|
|
13683
13713
|
SelectTrigger,
|
|
13684
13714
|
{
|
|
13685
13715
|
triggerId,
|
|
@@ -13705,21 +13735,21 @@ function StaticControl(props) {
|
|
|
13705
13735
|
onFocus: onTriggerFocus
|
|
13706
13736
|
}
|
|
13707
13737
|
),
|
|
13708
|
-
showClear && /* @__PURE__ */
|
|
13738
|
+
showClear && /* @__PURE__ */ jsx153(
|
|
13709
13739
|
"button",
|
|
13710
13740
|
{
|
|
13711
13741
|
type: "button",
|
|
13712
13742
|
onClick: onClear,
|
|
13713
13743
|
className: "absolute right-9 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-[3px] border-0 bg-transparent p-0 text-[#9696b9] hover:shadow-[0_3px_3px_#0f477734]",
|
|
13714
13744
|
"aria-label": clearLabel,
|
|
13715
|
-
children: /* @__PURE__ */
|
|
13745
|
+
children: /* @__PURE__ */ jsx153(SquareX3, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
13716
13746
|
}
|
|
13717
13747
|
)
|
|
13718
13748
|
] });
|
|
13719
13749
|
}
|
|
13720
13750
|
|
|
13721
13751
|
// src/dashboard/_select-internals/slots/DefaultMenuList.tsx
|
|
13722
|
-
import { jsx as
|
|
13752
|
+
import { jsx as jsx154 } from "react/jsx-runtime";
|
|
13723
13753
|
function DefaultMenuList(props) {
|
|
13724
13754
|
const {
|
|
13725
13755
|
id,
|
|
@@ -13748,7 +13778,7 @@ function DefaultMenuList(props) {
|
|
|
13748
13778
|
groupedOptions,
|
|
13749
13779
|
formatGroupLabel
|
|
13750
13780
|
} = props;
|
|
13751
|
-
return /* @__PURE__ */
|
|
13781
|
+
return /* @__PURE__ */ jsx154(
|
|
13752
13782
|
SelectMenu,
|
|
13753
13783
|
{
|
|
13754
13784
|
id,
|
|
@@ -13783,14 +13813,14 @@ function DefaultMenuList(props) {
|
|
|
13783
13813
|
|
|
13784
13814
|
// src/dashboard/_select-internals/slots/DefaultCreateOption.tsx
|
|
13785
13815
|
import { useTranslation as useTranslation31 } from "react-i18next";
|
|
13786
|
-
import { jsx as
|
|
13816
|
+
import { jsx as jsx155 } from "react/jsx-runtime";
|
|
13787
13817
|
function DefaultCreateOption({
|
|
13788
13818
|
inputValue,
|
|
13789
13819
|
onCreate,
|
|
13790
13820
|
formatCreateLabel
|
|
13791
13821
|
}) {
|
|
13792
13822
|
const { t } = useTranslation31();
|
|
13793
|
-
return /* @__PURE__ */
|
|
13823
|
+
return /* @__PURE__ */ jsx155(
|
|
13794
13824
|
"button",
|
|
13795
13825
|
{
|
|
13796
13826
|
type: "button",
|
|
@@ -13824,7 +13854,7 @@ function mergeComponents(overrides) {
|
|
|
13824
13854
|
}
|
|
13825
13855
|
|
|
13826
13856
|
// src/dashboard/select/Select.tsx
|
|
13827
|
-
import * as
|
|
13857
|
+
import * as React50 from "react";
|
|
13828
13858
|
import { useTranslation as useTranslation32 } from "react-i18next";
|
|
13829
13859
|
|
|
13830
13860
|
// src/dashboard/select/useSetCorrectOptionIfThereIsOnlyValue.ts
|
|
@@ -13843,7 +13873,7 @@ function useSetCorrectOptionIfThereIsOnlyValue({ value, options, onChange, enabl
|
|
|
13843
13873
|
}
|
|
13844
13874
|
|
|
13845
13875
|
// src/dashboard/select/Select.tsx
|
|
13846
|
-
import { jsx as
|
|
13876
|
+
import { jsx as jsx156, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
13847
13877
|
function SelectInternal(props, ref) {
|
|
13848
13878
|
const {
|
|
13849
13879
|
options = [],
|
|
@@ -13901,7 +13931,7 @@ function SelectInternal(props, ref) {
|
|
|
13901
13931
|
const closeMenuOnSelect = isMulti ? props.closeMenuOnSelect ?? false : void 0;
|
|
13902
13932
|
const { t } = useTranslation32();
|
|
13903
13933
|
const isControlled = props.value !== void 0;
|
|
13904
|
-
const [internalValue, setInternalValue] =
|
|
13934
|
+
const [internalValue, setInternalValue] = React50.useState(() => {
|
|
13905
13935
|
if (isMulti) return props.defaultValue ?? [];
|
|
13906
13936
|
return props.defaultValue ?? null;
|
|
13907
13937
|
});
|
|
@@ -13912,11 +13942,11 @@ function SelectInternal(props, ref) {
|
|
|
13912
13942
|
options,
|
|
13913
13943
|
onChange: !isMulti ? props.onChange : void 0
|
|
13914
13944
|
});
|
|
13915
|
-
const selectedOptions =
|
|
13945
|
+
const selectedOptions = React50.useMemo(() => {
|
|
13916
13946
|
if (isMulti) return currentValue ?? [];
|
|
13917
13947
|
return currentValue ? [currentValue] : [];
|
|
13918
13948
|
}, [isMulti, currentValue]);
|
|
13919
|
-
const onSelectionChange =
|
|
13949
|
+
const onSelectionChange = React50.useCallback(
|
|
13920
13950
|
(next, meta) => {
|
|
13921
13951
|
if (isMulti) {
|
|
13922
13952
|
if (!isControlled) setInternalValue(next);
|
|
@@ -13929,7 +13959,7 @@ function SelectInternal(props, ref) {
|
|
|
13929
13959
|
},
|
|
13930
13960
|
[isMulti, isControlled, props.onChange]
|
|
13931
13961
|
);
|
|
13932
|
-
const flatOptions =
|
|
13962
|
+
const flatOptions = React50.useMemo(() => flattenGroupedOptions(options), [options]);
|
|
13933
13963
|
const state = useSelectState({
|
|
13934
13964
|
isMulti,
|
|
13935
13965
|
options: flatOptions,
|
|
@@ -13960,14 +13990,14 @@ function SelectInternal(props, ref) {
|
|
|
13960
13990
|
isSearchInDropdown,
|
|
13961
13991
|
searchable
|
|
13962
13992
|
});
|
|
13963
|
-
const components =
|
|
13993
|
+
const components = React50.useMemo(() => {
|
|
13964
13994
|
const merged = mergeComponents(userComponents);
|
|
13965
13995
|
if ((isSearchInDropdown || !searchable && !isMulti) && !userComponents?.Control) {
|
|
13966
13996
|
return { ...merged, Control: StaticControl };
|
|
13967
13997
|
}
|
|
13968
13998
|
return merged;
|
|
13969
13999
|
}, [userComponents, isSearchInDropdown, searchable, isMulti]);
|
|
13970
|
-
|
|
14000
|
+
React50.useImperativeHandle(
|
|
13971
14001
|
ref,
|
|
13972
14002
|
() => state.containerRef.current
|
|
13973
14003
|
);
|
|
@@ -13975,6 +14005,7 @@ function SelectInternal(props, ref) {
|
|
|
13975
14005
|
const resolvedTitle = label ?? placeholder;
|
|
13976
14006
|
const accessibleLabel = !hasLabel && typeof placeholder === "string" ? placeholder : void 0;
|
|
13977
14007
|
const hasInvalidState = state.hasInvalidState || Boolean(invalid);
|
|
14008
|
+
const hasLeadingIcon = Boolean(leftIcon);
|
|
13978
14009
|
const hiddenValue = isMulti ? selectedOptions.map((item) => String(item.value)).join(",") : selectedOptions[0] ? String(selectedOptions[0].value) : "";
|
|
13979
14010
|
const handleClear = (event) => {
|
|
13980
14011
|
state.clearSelection(event);
|
|
@@ -14000,7 +14031,7 @@ function SelectInternal(props, ref) {
|
|
|
14000
14031
|
hiddenValue,
|
|
14001
14032
|
onBlur: state.handleBlur,
|
|
14002
14033
|
children: [
|
|
14003
|
-
/* @__PURE__ */
|
|
14034
|
+
/* @__PURE__ */ jsx156(
|
|
14004
14035
|
Control,
|
|
14005
14036
|
{
|
|
14006
14037
|
triggerId: state.ids.triggerId,
|
|
@@ -14043,7 +14074,7 @@ function SelectInternal(props, ref) {
|
|
|
14043
14074
|
components
|
|
14044
14075
|
}
|
|
14045
14076
|
),
|
|
14046
|
-
/* @__PURE__ */
|
|
14077
|
+
/* @__PURE__ */ jsx156(
|
|
14047
14078
|
Fieldset,
|
|
14048
14079
|
{
|
|
14049
14080
|
isFocused: state.isFocused || state.isOpen,
|
|
@@ -14059,7 +14090,7 @@ function SelectInternal(props, ref) {
|
|
|
14059
14090
|
label,
|
|
14060
14091
|
tooltip,
|
|
14061
14092
|
onClick: state.handleContainerClick,
|
|
14062
|
-
labelClassName:
|
|
14093
|
+
labelClassName: hasLeadingIcon ? "pl-[28px]" : void 0,
|
|
14063
14094
|
className: fieldsetClassName
|
|
14064
14095
|
}
|
|
14065
14096
|
),
|
|
@@ -14076,7 +14107,7 @@ function SelectInternal(props, ref) {
|
|
|
14076
14107
|
className: dropdownClassName,
|
|
14077
14108
|
drawerClassName,
|
|
14078
14109
|
children: [
|
|
14079
|
-
state.inMenuSearchVisible && /* @__PURE__ */
|
|
14110
|
+
state.inMenuSearchVisible && /* @__PURE__ */ jsx156(
|
|
14080
14111
|
SelectSearchInput,
|
|
14081
14112
|
{
|
|
14082
14113
|
inputRef: state.mobileSearchInputRef,
|
|
@@ -14089,7 +14120,7 @@ function SelectInternal(props, ref) {
|
|
|
14089
14120
|
}
|
|
14090
14121
|
),
|
|
14091
14122
|
menuHeader,
|
|
14092
|
-
/* @__PURE__ */
|
|
14123
|
+
/* @__PURE__ */ jsx156(
|
|
14093
14124
|
MenuList,
|
|
14094
14125
|
{
|
|
14095
14126
|
id: state.ids.listboxId,
|
|
@@ -14117,7 +14148,7 @@ function SelectInternal(props, ref) {
|
|
|
14117
14148
|
formatGroupLabel
|
|
14118
14149
|
}
|
|
14119
14150
|
),
|
|
14120
|
-
state.canCreateNewOption && /* @__PURE__ */
|
|
14151
|
+
state.canCreateNewOption && /* @__PURE__ */ jsx156(
|
|
14121
14152
|
CreateOption,
|
|
14122
14153
|
{
|
|
14123
14154
|
inputValue: state.trimmedInput,
|
|
@@ -14132,7 +14163,7 @@ function SelectInternal(props, ref) {
|
|
|
14132
14163
|
}
|
|
14133
14164
|
);
|
|
14134
14165
|
}
|
|
14135
|
-
var Select =
|
|
14166
|
+
var Select = React50.forwardRef(SelectInternal);
|
|
14136
14167
|
|
|
14137
14168
|
// src/dashboard/phone-input/utils.ts
|
|
14138
14169
|
var PREFIX_REGEX = /^\+/;
|
|
@@ -14202,14 +14233,17 @@ function formatPhoneCodeOptionLabel(option) {
|
|
|
14202
14233
|
}
|
|
14203
14234
|
|
|
14204
14235
|
// src/dashboard/phone-input/PhoneInput.tsx
|
|
14205
|
-
import { jsx as
|
|
14206
|
-
var PhoneInput =
|
|
14236
|
+
import { jsx as jsx157, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
14237
|
+
var PhoneInput = React51.forwardRef(
|
|
14207
14238
|
function PhoneInput2({
|
|
14208
14239
|
options,
|
|
14209
14240
|
value,
|
|
14210
14241
|
onChange,
|
|
14211
14242
|
onFocus,
|
|
14212
14243
|
onBlur,
|
|
14244
|
+
onKeyDown,
|
|
14245
|
+
onFieldFocus,
|
|
14246
|
+
onFieldBlur,
|
|
14213
14247
|
name,
|
|
14214
14248
|
codeName,
|
|
14215
14249
|
numberName,
|
|
@@ -14233,10 +14267,10 @@ var PhoneInput = React50.forwardRef(
|
|
|
14233
14267
|
defaultNumber
|
|
14234
14268
|
}, ref) {
|
|
14235
14269
|
const { t } = useTranslation33();
|
|
14236
|
-
const groupLabelId =
|
|
14237
|
-
const errorMsgId =
|
|
14238
|
-
const numberInputRef =
|
|
14239
|
-
const [codeSearchValue, setCodeSearchValue] =
|
|
14270
|
+
const groupLabelId = React51.useId();
|
|
14271
|
+
const errorMsgId = React51.useId();
|
|
14272
|
+
const numberInputRef = React51.useRef(null);
|
|
14273
|
+
const [codeSearchValue, setCodeSearchValue] = React51.useState("");
|
|
14240
14274
|
const safeValue = toPhoneValue(value, defaultCode, defaultNumber);
|
|
14241
14275
|
const effectiveCode = safeValue.code || defaultCode || "";
|
|
14242
14276
|
const resolvedLabel = label ?? "";
|
|
@@ -14245,7 +14279,7 @@ var PhoneInput = React50.forwardRef(
|
|
|
14245
14279
|
const hasInvalidState = hasExternalError || Boolean(invalid) || isPrefixRequired;
|
|
14246
14280
|
const errorMessage = error ?? (isPrefixRequired ? t("prefix_required") : void 0);
|
|
14247
14281
|
const combinedValue = effectiveCode || safeValue.number ? `${effectiveCode}${safeValue.number}` : "";
|
|
14248
|
-
const codeOptions =
|
|
14282
|
+
const codeOptions = React51.useMemo(
|
|
14249
14283
|
() => options.map((option) => ({
|
|
14250
14284
|
value: option.value,
|
|
14251
14285
|
label: formatPhoneCodeOptionLabel(option),
|
|
@@ -14254,11 +14288,11 @@ var PhoneInput = React50.forwardRef(
|
|
|
14254
14288
|
})),
|
|
14255
14289
|
[options]
|
|
14256
14290
|
);
|
|
14257
|
-
const selectedCodeOption =
|
|
14291
|
+
const selectedCodeOption = React51.useMemo(
|
|
14258
14292
|
() => codeOptions.find((option) => option.value === effectiveCode) ?? null,
|
|
14259
14293
|
[codeOptions, effectiveCode]
|
|
14260
14294
|
);
|
|
14261
|
-
const parsePhoneValue =
|
|
14295
|
+
const parsePhoneValue = React51.useMemo(
|
|
14262
14296
|
() => parsePhoneValueWithOptions(options),
|
|
14263
14297
|
[options]
|
|
14264
14298
|
);
|
|
@@ -14287,17 +14321,17 @@ var PhoneInput = React50.forwardRef(
|
|
|
14287
14321
|
}
|
|
14288
14322
|
emitChange({ code: effectiveCode, number: cleanedNumber });
|
|
14289
14323
|
};
|
|
14290
|
-
const effectiveCodeRef =
|
|
14291
|
-
const numberValueRef =
|
|
14292
|
-
const codeSearchValueRef =
|
|
14293
|
-
const onChangeRef =
|
|
14294
|
-
const nameRef =
|
|
14324
|
+
const effectiveCodeRef = React51.useRef(effectiveCode);
|
|
14325
|
+
const numberValueRef = React51.useRef(safeValue.number);
|
|
14326
|
+
const codeSearchValueRef = React51.useRef(codeSearchValue);
|
|
14327
|
+
const onChangeRef = React51.useRef(onChange);
|
|
14328
|
+
const nameRef = React51.useRef(name);
|
|
14295
14329
|
effectiveCodeRef.current = effectiveCode;
|
|
14296
14330
|
numberValueRef.current = safeValue.number;
|
|
14297
14331
|
codeSearchValueRef.current = codeSearchValue;
|
|
14298
14332
|
onChangeRef.current = onChange;
|
|
14299
14333
|
nameRef.current = name;
|
|
14300
|
-
|
|
14334
|
+
React51.useImperativeHandle(
|
|
14301
14335
|
ref,
|
|
14302
14336
|
() => ({
|
|
14303
14337
|
getCodeSearchValue: () => codeSearchValueRef.current,
|
|
@@ -14324,8 +14358,8 @@ var PhoneInput = React50.forwardRef(
|
|
|
14324
14358
|
className
|
|
14325
14359
|
),
|
|
14326
14360
|
children: [
|
|
14327
|
-
name && /* @__PURE__ */
|
|
14328
|
-
codeName && /* @__PURE__ */
|
|
14361
|
+
name && /* @__PURE__ */ jsx157("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
14362
|
+
codeName && /* @__PURE__ */ jsx157(
|
|
14329
14363
|
"input",
|
|
14330
14364
|
{
|
|
14331
14365
|
type: "hidden",
|
|
@@ -14334,7 +14368,7 @@ var PhoneInput = React50.forwardRef(
|
|
|
14334
14368
|
disabled
|
|
14335
14369
|
}
|
|
14336
14370
|
),
|
|
14337
|
-
numberName && /* @__PURE__ */
|
|
14371
|
+
numberName && /* @__PURE__ */ jsx157(
|
|
14338
14372
|
"input",
|
|
14339
14373
|
{
|
|
14340
14374
|
type: "hidden",
|
|
@@ -14343,11 +14377,11 @@ var PhoneInput = React50.forwardRef(
|
|
|
14343
14377
|
disabled
|
|
14344
14378
|
}
|
|
14345
14379
|
),
|
|
14346
|
-
topLabel && /* @__PURE__ */
|
|
14380
|
+
topLabel && /* @__PURE__ */ jsx157(
|
|
14347
14381
|
"span",
|
|
14348
14382
|
{
|
|
14349
14383
|
id: groupLabelId,
|
|
14350
|
-
className: "mb-2 block text-[
|
|
14384
|
+
className: "mb-2 block text-[length:var(--field-top-label-font-size)] font-[var(--field-top-label-font-weight)] text-[var(--chekin-color-brand-navy)]",
|
|
14351
14385
|
children: topLabel
|
|
14352
14386
|
}
|
|
14353
14387
|
),
|
|
@@ -14358,7 +14392,7 @@ var PhoneInput = React50.forwardRef(
|
|
|
14358
14392
|
"aria-labelledby": topLabel ? groupLabelId : void 0,
|
|
14359
14393
|
className: "grid grid-cols-[96px_minmax(0,1fr)] gap-2",
|
|
14360
14394
|
children: [
|
|
14361
|
-
/* @__PURE__ */
|
|
14395
|
+
/* @__PURE__ */ jsx157(
|
|
14362
14396
|
Select,
|
|
14363
14397
|
{
|
|
14364
14398
|
options: codeOptions,
|
|
@@ -14379,10 +14413,12 @@ var PhoneInput = React50.forwardRef(
|
|
|
14379
14413
|
className: "max-w-none w-auto",
|
|
14380
14414
|
dropdownClassName: "right-auto w-[280px]",
|
|
14381
14415
|
inputValue: searchable ? codeSearchValue : void 0,
|
|
14382
|
-
onInputChange: setCodeSearchValue
|
|
14416
|
+
onInputChange: setCodeSearchValue,
|
|
14417
|
+
onFocus: () => onFieldFocus?.("code"),
|
|
14418
|
+
onBlur: () => onFieldBlur?.("code")
|
|
14383
14419
|
}
|
|
14384
14420
|
),
|
|
14385
|
-
/* @__PURE__ */
|
|
14421
|
+
/* @__PURE__ */ jsx157(
|
|
14386
14422
|
Input,
|
|
14387
14423
|
{
|
|
14388
14424
|
ref: numberInputRef,
|
|
@@ -14400,8 +14436,15 @@ var PhoneInput = React50.forwardRef(
|
|
|
14400
14436
|
"aria-label": resolvedLabel || name,
|
|
14401
14437
|
"aria-describedby": errorMessage ? errorMsgId : void 0,
|
|
14402
14438
|
onChange: handleNumberChange,
|
|
14403
|
-
|
|
14404
|
-
|
|
14439
|
+
onKeyDown,
|
|
14440
|
+
onFocus: (event) => {
|
|
14441
|
+
onFocus?.(event);
|
|
14442
|
+
onFieldFocus?.("number");
|
|
14443
|
+
},
|
|
14444
|
+
onBlur: (event) => {
|
|
14445
|
+
onBlur?.(event);
|
|
14446
|
+
onFieldBlur?.("number");
|
|
14447
|
+
},
|
|
14405
14448
|
renderErrorMessage: false,
|
|
14406
14449
|
wrapperClassName: "max-w-none w-auto",
|
|
14407
14450
|
contentClassName: readOnly ? "!cursor-default" : void 0,
|
|
@@ -14411,8 +14454,8 @@ var PhoneInput = React50.forwardRef(
|
|
|
14411
14454
|
]
|
|
14412
14455
|
}
|
|
14413
14456
|
),
|
|
14414
|
-
!errorMessage && optional && /* @__PURE__ */
|
|
14415
|
-
errorMessage && /* @__PURE__ */
|
|
14457
|
+
!errorMessage && optional && /* @__PURE__ */ jsx157("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
14458
|
+
errorMessage && /* @__PURE__ */ jsx157(
|
|
14416
14459
|
FieldErrorMessage,
|
|
14417
14460
|
{
|
|
14418
14461
|
id: errorMsgId,
|
|
@@ -14429,41 +14472,41 @@ var PhoneInput = React50.forwardRef(
|
|
|
14429
14472
|
PhoneInput.displayName = "PhoneInput";
|
|
14430
14473
|
|
|
14431
14474
|
// src/dashboard/creatable-select/CreatableSelect.tsx
|
|
14432
|
-
import * as React51 from "react";
|
|
14433
|
-
import { jsx as jsx157 } from "react/jsx-runtime";
|
|
14434
|
-
var CreatableSelect = React51.forwardRef(function CreatableSelect2(props, ref) {
|
|
14435
|
-
return /* @__PURE__ */ jsx157(Select, { ref, ...props, isCreatable: true });
|
|
14436
|
-
});
|
|
14437
|
-
|
|
14438
|
-
// src/dashboard/multi-select/MultiSelect.tsx
|
|
14439
14475
|
import * as React52 from "react";
|
|
14440
14476
|
import { jsx as jsx158 } from "react/jsx-runtime";
|
|
14441
|
-
var
|
|
14442
|
-
return /* @__PURE__ */ jsx158(Select, { ref, ...props,
|
|
14477
|
+
var CreatableSelect = React52.forwardRef(function CreatableSelect2(props, ref) {
|
|
14478
|
+
return /* @__PURE__ */ jsx158(Select, { ref, ...props, isCreatable: true });
|
|
14443
14479
|
});
|
|
14444
14480
|
|
|
14445
|
-
// src/dashboard/
|
|
14481
|
+
// src/dashboard/multi-select/MultiSelect.tsx
|
|
14446
14482
|
import * as React53 from "react";
|
|
14447
14483
|
import { jsx as jsx159 } from "react/jsx-runtime";
|
|
14448
|
-
var
|
|
14449
|
-
return /* @__PURE__ */ jsx159(Select, { ref, ...props, isMulti: true
|
|
14484
|
+
var MultiSelect = React53.forwardRef(function MultiSelect2(props, ref) {
|
|
14485
|
+
return /* @__PURE__ */ jsx159(Select, { ref, ...props, isMulti: true });
|
|
14486
|
+
});
|
|
14487
|
+
|
|
14488
|
+
// src/dashboard/creatable-multi-select/CreatableMultiSelect.tsx
|
|
14489
|
+
import * as React54 from "react";
|
|
14490
|
+
import { jsx as jsx160 } from "react/jsx-runtime";
|
|
14491
|
+
var CreatableMultiSelect = React54.forwardRef(function CreatableMultiSelect2(props, ref) {
|
|
14492
|
+
return /* @__PURE__ */ jsx160(Select, { ref, ...props, isMulti: true, isCreatable: true });
|
|
14450
14493
|
});
|
|
14451
14494
|
|
|
14452
14495
|
// src/dashboard/infinite-scroll-select/InfiniteScrollSelect.tsx
|
|
14453
|
-
import * as
|
|
14496
|
+
import * as React57 from "react";
|
|
14454
14497
|
|
|
14455
14498
|
// src/dashboard/infinite-scroll-select/VirtualMenuList.tsx
|
|
14456
|
-
import * as
|
|
14499
|
+
import * as React56 from "react";
|
|
14457
14500
|
import { useTranslation as useTranslation34 } from "react-i18next";
|
|
14458
14501
|
import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
|
|
14459
14502
|
|
|
14460
14503
|
// src/dashboard/infinite-scroll-select/InfiniteScrollContext.tsx
|
|
14461
|
-
import * as
|
|
14462
|
-
var InfiniteScrollContext =
|
|
14504
|
+
import * as React55 from "react";
|
|
14505
|
+
var InfiniteScrollContext = React55.createContext(
|
|
14463
14506
|
null
|
|
14464
14507
|
);
|
|
14465
14508
|
function useInfiniteScrollContext() {
|
|
14466
|
-
const ctx =
|
|
14509
|
+
const ctx = React55.useContext(InfiniteScrollContext);
|
|
14467
14510
|
if (!ctx) {
|
|
14468
14511
|
throw new Error(
|
|
14469
14512
|
"useInfiniteScrollContext must be used within an InfiniteScrollContext.Provider"
|
|
@@ -14473,7 +14516,7 @@ function useInfiniteScrollContext() {
|
|
|
14473
14516
|
}
|
|
14474
14517
|
|
|
14475
14518
|
// src/dashboard/infinite-scroll-select/VirtualMenuList.tsx
|
|
14476
|
-
import { jsx as
|
|
14519
|
+
import { jsx as jsx161, jsxs as jsxs101 } from "react/jsx-runtime";
|
|
14477
14520
|
function VirtualMenuList(props) {
|
|
14478
14521
|
const {
|
|
14479
14522
|
id,
|
|
@@ -14508,9 +14551,9 @@ function VirtualMenuList(props) {
|
|
|
14508
14551
|
} = useInfiniteScrollContext();
|
|
14509
14552
|
const Option = components?.Option ?? DefaultOption;
|
|
14510
14553
|
const { t } = useTranslation34();
|
|
14511
|
-
const scrollRef =
|
|
14512
|
-
const lastLoadMoreOptionsLengthRef =
|
|
14513
|
-
const previousHighlightedIndexRef =
|
|
14554
|
+
const scrollRef = React56.useRef(null);
|
|
14555
|
+
const lastLoadMoreOptionsLengthRef = React56.useRef(null);
|
|
14556
|
+
const previousHighlightedIndexRef = React56.useRef(-1);
|
|
14514
14557
|
const showLoaderRow = Boolean(canLoadMore || isLoadingMore);
|
|
14515
14558
|
const itemCount = options.length + (showLoaderRow ? 1 : 0);
|
|
14516
14559
|
const virtualizer = useVirtualizer2({
|
|
@@ -14523,7 +14566,7 @@ function VirtualMenuList(props) {
|
|
|
14523
14566
|
const totalSize = virtualizer.getTotalSize();
|
|
14524
14567
|
const measuredListHeight = Math.min(listHeight, Math.max(totalSize, itemHeight));
|
|
14525
14568
|
const resolvedLoadingMoreText = loadingMoreText ?? t("loading_more");
|
|
14526
|
-
|
|
14569
|
+
React56.useEffect(() => {
|
|
14527
14570
|
if (!canLoadMore || isLoadingMore || !loadMoreItems) return;
|
|
14528
14571
|
if (virtualItems.length === 0) return;
|
|
14529
14572
|
const lastItem = virtualItems[virtualItems.length - 1];
|
|
@@ -14539,7 +14582,7 @@ function VirtualMenuList(props) {
|
|
|
14539
14582
|
loadMoreItems,
|
|
14540
14583
|
loadMoreThreshold
|
|
14541
14584
|
]);
|
|
14542
|
-
|
|
14585
|
+
React56.useEffect(() => {
|
|
14543
14586
|
const changed = previousHighlightedIndexRef.current !== highlightedIndex;
|
|
14544
14587
|
previousHighlightedIndexRef.current = highlightedIndex;
|
|
14545
14588
|
if (highlightedIndex < 0 || !changed) return;
|
|
@@ -14549,8 +14592,8 @@ function VirtualMenuList(props) {
|
|
|
14549
14592
|
const lastOptionIndex = options.length - 1;
|
|
14550
14593
|
const emptyMessage = noOptionsMessage?.() ?? t("no_options");
|
|
14551
14594
|
const isOptionSelected2 = (option) => isOptionSelectedProp ? isOptionSelectedProp(option, selectedOptions) : selectedOptions.some((s) => s.value === option.value);
|
|
14552
|
-
const wasAtBottomRef =
|
|
14553
|
-
const handleScroll =
|
|
14595
|
+
const wasAtBottomRef = React56.useRef(false);
|
|
14596
|
+
const handleScroll = React56.useCallback(
|
|
14554
14597
|
(event) => {
|
|
14555
14598
|
if (!onMenuScrollToBottom) return;
|
|
14556
14599
|
const target = event.currentTarget;
|
|
@@ -14563,7 +14606,7 @@ function VirtualMenuList(props) {
|
|
|
14563
14606
|
[onMenuScrollToBottom]
|
|
14564
14607
|
);
|
|
14565
14608
|
if (options.length === 0) {
|
|
14566
|
-
return /* @__PURE__ */
|
|
14609
|
+
return /* @__PURE__ */ jsx161("div", { className: "min-h-[75px] px-4 pb-[19px] pt-[17px]", children: isLoadingMore ? /* @__PURE__ */ jsxs101(
|
|
14567
14610
|
"div",
|
|
14568
14611
|
{
|
|
14569
14612
|
role: "status",
|
|
@@ -14571,8 +14614,8 @@ function VirtualMenuList(props) {
|
|
|
14571
14614
|
"aria-live": "polite",
|
|
14572
14615
|
className: "flex flex-col gap-2",
|
|
14573
14616
|
children: [
|
|
14574
|
-
/* @__PURE__ */
|
|
14575
|
-
Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */
|
|
14617
|
+
/* @__PURE__ */ jsx161("span", { className: "sr-only", children: resolvedLoadingMoreText }),
|
|
14618
|
+
Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsx161(
|
|
14576
14619
|
Skeleton,
|
|
14577
14620
|
{
|
|
14578
14621
|
className: "h-10 w-full rounded-md",
|
|
@@ -14582,16 +14625,16 @@ function VirtualMenuList(props) {
|
|
|
14582
14625
|
))
|
|
14583
14626
|
]
|
|
14584
14627
|
}
|
|
14585
|
-
) : /* @__PURE__ */
|
|
14628
|
+
) : /* @__PURE__ */ jsx161("div", { className: "flex min-h-[40px] items-center text-[16px] font-medium text-[var(--chekin-color-brand-navy)]", children: emptyMessage }) });
|
|
14586
14629
|
}
|
|
14587
|
-
return /* @__PURE__ */
|
|
14630
|
+
return /* @__PURE__ */ jsx161("div", { className: "min-h-[75px] px-4 pb-[19px] pt-[17px]", children: /* @__PURE__ */ jsx161(
|
|
14588
14631
|
"div",
|
|
14589
14632
|
{
|
|
14590
14633
|
ref: scrollRef,
|
|
14591
14634
|
className: cn("overflow-y-auto", menuClassName),
|
|
14592
14635
|
style: { height: `${measuredListHeight}px` },
|
|
14593
14636
|
onScroll: onMenuScrollToBottom ? handleScroll : void 0,
|
|
14594
|
-
children: /* @__PURE__ */
|
|
14637
|
+
children: /* @__PURE__ */ jsx161(
|
|
14595
14638
|
"div",
|
|
14596
14639
|
{
|
|
14597
14640
|
id,
|
|
@@ -14611,7 +14654,7 @@ function VirtualMenuList(props) {
|
|
|
14611
14654
|
disabled || option?.isDisabled || option && isOptionDisabled?.(option)
|
|
14612
14655
|
);
|
|
14613
14656
|
const isLastOption = !isLoaderRow && virtualItem.index === lastOptionIndex && !canLoadMore;
|
|
14614
|
-
return /* @__PURE__ */
|
|
14657
|
+
return /* @__PURE__ */ jsx161(
|
|
14615
14658
|
"div",
|
|
14616
14659
|
{
|
|
14617
14660
|
"data-index": virtualItem.index,
|
|
@@ -14628,8 +14671,8 @@ function VirtualMenuList(props) {
|
|
|
14628
14671
|
"aria-live": "polite",
|
|
14629
14672
|
className: "flex h-full items-center justify-center",
|
|
14630
14673
|
children: [
|
|
14631
|
-
/* @__PURE__ */
|
|
14632
|
-
/* @__PURE__ */
|
|
14674
|
+
/* @__PURE__ */ jsx161("span", { className: "sr-only", children: resolvedLoadingMoreText }),
|
|
14675
|
+
/* @__PURE__ */ jsx161(
|
|
14633
14676
|
ThreeDotsLoader,
|
|
14634
14677
|
{
|
|
14635
14678
|
height: 24,
|
|
@@ -14639,7 +14682,7 @@ function VirtualMenuList(props) {
|
|
|
14639
14682
|
)
|
|
14640
14683
|
]
|
|
14641
14684
|
}
|
|
14642
|
-
) : option ? /* @__PURE__ */
|
|
14685
|
+
) : option ? /* @__PURE__ */ jsx161(
|
|
14643
14686
|
Option,
|
|
14644
14687
|
{
|
|
14645
14688
|
id: getOptionId2(virtualItem.index),
|
|
@@ -14669,7 +14712,7 @@ function VirtualMenuList(props) {
|
|
|
14669
14712
|
}
|
|
14670
14713
|
|
|
14671
14714
|
// src/dashboard/infinite-scroll-select/InfiniteScrollSelect.tsx
|
|
14672
|
-
import { jsx as
|
|
14715
|
+
import { jsx as jsx162 } from "react/jsx-runtime";
|
|
14673
14716
|
var DEFAULT_ITEM_HEIGHT = 60;
|
|
14674
14717
|
var DEFAULT_LIST_HEIGHT = 322;
|
|
14675
14718
|
var DEFAULT_OVERSCAN = 5;
|
|
@@ -14697,8 +14740,8 @@ function InfiniteScrollSelectInternal(props, ref) {
|
|
|
14697
14740
|
const getFullSearchOption = isMulti ? void 0 : getFullSearchOptionProp;
|
|
14698
14741
|
const isPaginated = canLoadMore !== void 0 || isLoadingMore !== void 0 || loadMoreItems !== void 0 || onSearchChange !== void 0 || getFullSearchOption !== void 0;
|
|
14699
14742
|
const filterOption = userFilterOption ?? (isPaginated ? passthroughFilter : defaultFilterOption);
|
|
14700
|
-
const [inputValue, setInputValue] =
|
|
14701
|
-
const filteredOptions =
|
|
14743
|
+
const [inputValue, setInputValue] = React57.useState("");
|
|
14744
|
+
const filteredOptions = React57.useMemo(() => {
|
|
14702
14745
|
const trimmed = inputValue.trim();
|
|
14703
14746
|
const valueLabel = (() => {
|
|
14704
14747
|
if (isMulti) return "";
|
|
@@ -14717,7 +14760,7 @@ function InfiniteScrollSelectInternal(props, ref) {
|
|
|
14717
14760
|
}
|
|
14718
14761
|
return list;
|
|
14719
14762
|
}, [rawOptions, inputValue, filterOption, getFullSearchOption, isMulti, rest]);
|
|
14720
|
-
const contextValue =
|
|
14763
|
+
const contextValue = React57.useMemo(
|
|
14721
14764
|
() => ({
|
|
14722
14765
|
canLoadMore,
|
|
14723
14766
|
isLoadingMore,
|
|
@@ -14739,11 +14782,11 @@ function InfiniteScrollSelectInternal(props, ref) {
|
|
|
14739
14782
|
loadMoreThreshold
|
|
14740
14783
|
]
|
|
14741
14784
|
);
|
|
14742
|
-
const components =
|
|
14785
|
+
const components = React57.useMemo(
|
|
14743
14786
|
() => ({ ...userComponents, MenuList: VirtualMenuList }),
|
|
14744
14787
|
[userComponents]
|
|
14745
14788
|
);
|
|
14746
|
-
const handleInputChange =
|
|
14789
|
+
const handleInputChange = React57.useCallback(
|
|
14747
14790
|
(value) => {
|
|
14748
14791
|
setInputValue(value);
|
|
14749
14792
|
onSearchChange?.(value);
|
|
@@ -14757,7 +14800,7 @@ function InfiniteScrollSelectInternal(props, ref) {
|
|
|
14757
14800
|
components,
|
|
14758
14801
|
onInputChange: handleInputChange
|
|
14759
14802
|
};
|
|
14760
|
-
return /* @__PURE__ */
|
|
14803
|
+
return /* @__PURE__ */ jsx162(InfiniteScrollContext.Provider, { value: contextValue, children: isMulti ? /* @__PURE__ */ jsx162(
|
|
14761
14804
|
Select,
|
|
14762
14805
|
{
|
|
14763
14806
|
ref,
|
|
@@ -14765,7 +14808,7 @@ function InfiniteScrollSelectInternal(props, ref) {
|
|
|
14765
14808
|
...selectExtras,
|
|
14766
14809
|
isMulti: true
|
|
14767
14810
|
}
|
|
14768
|
-
) : /* @__PURE__ */
|
|
14811
|
+
) : /* @__PURE__ */ jsx162(
|
|
14769
14812
|
Select,
|
|
14770
14813
|
{
|
|
14771
14814
|
ref,
|
|
@@ -14775,27 +14818,27 @@ function InfiniteScrollSelectInternal(props, ref) {
|
|
|
14775
14818
|
}
|
|
14776
14819
|
) });
|
|
14777
14820
|
}
|
|
14778
|
-
var InfiniteScrollSelect =
|
|
14821
|
+
var InfiniteScrollSelect = React57.forwardRef(
|
|
14779
14822
|
InfiniteScrollSelectInternal
|
|
14780
14823
|
);
|
|
14781
14824
|
|
|
14782
14825
|
// src/dashboard/infinite-scroll-multi-select/InfiniteScrollMultiSelect.tsx
|
|
14783
|
-
import * as
|
|
14784
|
-
import { jsx as
|
|
14785
|
-
var InfiniteScrollMultiSelect =
|
|
14826
|
+
import * as React58 from "react";
|
|
14827
|
+
import { jsx as jsx163 } from "react/jsx-runtime";
|
|
14828
|
+
var InfiniteScrollMultiSelect = React58.forwardRef(function InfiniteScrollMultiSelect2(props, ref) {
|
|
14786
14829
|
const Forwarded = InfiniteScrollSelect;
|
|
14787
|
-
return /* @__PURE__ */
|
|
14830
|
+
return /* @__PURE__ */ jsx163(Forwarded, { ...props, ref, isMulti: true });
|
|
14788
14831
|
});
|
|
14789
14832
|
|
|
14790
14833
|
// src/dashboard/select-checkboxes/SelectCheckboxes.tsx
|
|
14791
|
-
import * as
|
|
14834
|
+
import * as React59 from "react";
|
|
14792
14835
|
import { useTranslation as useTranslation36 } from "react-i18next";
|
|
14793
14836
|
|
|
14794
14837
|
// src/dashboard/select-checkboxes/VisualCheckbox.tsx
|
|
14795
14838
|
import { Check as Check7 } from "lucide-react";
|
|
14796
|
-
import { jsx as
|
|
14839
|
+
import { jsx as jsx164 } from "react/jsx-runtime";
|
|
14797
14840
|
function VisualCheckbox({ checked, disabled, className }) {
|
|
14798
|
-
return /* @__PURE__ */
|
|
14841
|
+
return /* @__PURE__ */ jsx164(
|
|
14799
14842
|
"span",
|
|
14800
14843
|
{
|
|
14801
14844
|
"aria-hidden": "true",
|
|
@@ -14806,13 +14849,13 @@ function VisualCheckbox({ checked, disabled, className }) {
|
|
|
14806
14849
|
disabled && "opacity-50",
|
|
14807
14850
|
className
|
|
14808
14851
|
),
|
|
14809
|
-
children: checked && /* @__PURE__ */
|
|
14852
|
+
children: checked && /* @__PURE__ */ jsx164(Check7, { className: "checkbox__icon h-3 w-3" })
|
|
14810
14853
|
}
|
|
14811
14854
|
);
|
|
14812
14855
|
}
|
|
14813
14856
|
|
|
14814
14857
|
// src/dashboard/select-checkboxes/SelectCheckboxOption.tsx
|
|
14815
|
-
import { jsx as
|
|
14858
|
+
import { jsx as jsx165, jsxs as jsxs102 } from "react/jsx-runtime";
|
|
14816
14859
|
function SelectCheckboxOption(props) {
|
|
14817
14860
|
const {
|
|
14818
14861
|
option,
|
|
@@ -14846,10 +14889,10 @@ function SelectCheckboxOption(props) {
|
|
|
14846
14889
|
isDisabled && "cursor-not-allowed text-[var(--chekin-color-gray-2)]"
|
|
14847
14890
|
),
|
|
14848
14891
|
children: [
|
|
14849
|
-
/* @__PURE__ */
|
|
14892
|
+
/* @__PURE__ */ jsx165(VisualCheckbox, { checked: isSelected, disabled: isDisabled }),
|
|
14850
14893
|
/* @__PURE__ */ jsxs102("span", { className: "flex min-w-0 flex-1 items-center justify-between gap-2", children: [
|
|
14851
|
-
/* @__PURE__ */
|
|
14852
|
-
option.description && /* @__PURE__ */
|
|
14894
|
+
/* @__PURE__ */ jsx165("span", { className: "block break-words", children: option.label }),
|
|
14895
|
+
option.description && /* @__PURE__ */ jsx165("span", { className: "shrink-0 text-[12px] font-medium italic text-[var(--chekin-color-gray-1)]", children: option.description })
|
|
14853
14896
|
] })
|
|
14854
14897
|
]
|
|
14855
14898
|
}
|
|
@@ -14859,7 +14902,7 @@ function SelectCheckboxOption(props) {
|
|
|
14859
14902
|
// src/dashboard/select-checkboxes/CountTrigger.tsx
|
|
14860
14903
|
import { ChevronDown as ChevronDown3 } from "lucide-react";
|
|
14861
14904
|
import { useTranslation as useTranslation35 } from "react-i18next";
|
|
14862
|
-
import { jsx as
|
|
14905
|
+
import { jsx as jsx166, jsxs as jsxs103 } from "react/jsx-runtime";
|
|
14863
14906
|
function createCountTrigger(opts) {
|
|
14864
14907
|
const { getValueText, getTotalCount } = opts;
|
|
14865
14908
|
function CountTrigger(props) {
|
|
@@ -14912,9 +14955,9 @@ function createCountTrigger(opts) {
|
|
|
14912
14955
|
loading && "!cursor-progress"
|
|
14913
14956
|
),
|
|
14914
14957
|
children: [
|
|
14915
|
-
leftIcon && /* @__PURE__ */
|
|
14916
|
-
/* @__PURE__ */
|
|
14917
|
-
/* @__PURE__ */
|
|
14958
|
+
leftIcon && /* @__PURE__ */ jsx166("span", { className: "pointer-events-none absolute left-0 top-0 flex h-full max-w-10 items-center justify-center text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ jsx166("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
14959
|
+
/* @__PURE__ */ jsx166("span", { id: valueId, className: "block min-w-0 flex-1 truncate text-left", children: display }),
|
|
14960
|
+
/* @__PURE__ */ jsx166("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ jsx166(
|
|
14918
14961
|
ChevronDown3,
|
|
14919
14962
|
{
|
|
14920
14963
|
size: 16,
|
|
@@ -14932,7 +14975,7 @@ function createCountTrigger(opts) {
|
|
|
14932
14975
|
}
|
|
14933
14976
|
|
|
14934
14977
|
// src/dashboard/select-checkboxes/SelectAllRow.tsx
|
|
14935
|
-
import { jsx as
|
|
14978
|
+
import { jsx as jsx167, jsxs as jsxs104 } from "react/jsx-runtime";
|
|
14936
14979
|
function SelectAllRow({ label, checked, disabled, onToggle }) {
|
|
14937
14980
|
return /* @__PURE__ */ jsxs104(
|
|
14938
14981
|
"button",
|
|
@@ -14945,21 +14988,21 @@ function SelectAllRow({ label, checked, disabled, onToggle }) {
|
|
|
14945
14988
|
disabled && "cursor-default opacity-40"
|
|
14946
14989
|
),
|
|
14947
14990
|
children: [
|
|
14948
|
-
/* @__PURE__ */
|
|
14949
|
-
/* @__PURE__ */
|
|
14991
|
+
/* @__PURE__ */ jsx167(VisualCheckbox, { checked, disabled }),
|
|
14992
|
+
/* @__PURE__ */ jsx167("span", { className: "flex-1", children: label })
|
|
14950
14993
|
]
|
|
14951
14994
|
}
|
|
14952
14995
|
);
|
|
14953
14996
|
}
|
|
14954
14997
|
|
|
14955
14998
|
// src/dashboard/select-checkboxes/SelectCheckboxes.tsx
|
|
14956
|
-
import { Fragment as Fragment16, jsx as
|
|
14999
|
+
import { Fragment as Fragment16, jsx as jsx168 } from "react/jsx-runtime";
|
|
14957
15000
|
function hasPaginationProps(props) {
|
|
14958
15001
|
return props.canLoadMore !== void 0 || props.isLoadingMore !== void 0 || props.loadMoreItems !== void 0 || props.onSearchChange !== void 0;
|
|
14959
15002
|
}
|
|
14960
15003
|
function makeTriggerSlot(render) {
|
|
14961
15004
|
function CustomTrigger(props) {
|
|
14962
|
-
return /* @__PURE__ */
|
|
15005
|
+
return /* @__PURE__ */ jsx168(Fragment16, { children: render(props.isOpen, props.onContainerClick) });
|
|
14963
15006
|
}
|
|
14964
15007
|
return CustomTrigger;
|
|
14965
15008
|
}
|
|
@@ -14985,25 +15028,25 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
14985
15028
|
const isPaginated = hasPaginationProps(
|
|
14986
15029
|
paginationAndRest
|
|
14987
15030
|
);
|
|
14988
|
-
const [inputValue, setInputValue] =
|
|
15031
|
+
const [inputValue, setInputValue] = React59.useState("");
|
|
14989
15032
|
const isControlled = value !== void 0;
|
|
14990
|
-
const [internalValue, setInternalValue] =
|
|
15033
|
+
const [internalValue, setInternalValue] = React59.useState(
|
|
14991
15034
|
() => defaultValue ?? []
|
|
14992
15035
|
);
|
|
14993
15036
|
const currentValue = isControlled ? value : internalValue;
|
|
14994
|
-
const selected =
|
|
14995
|
-
const handleChange =
|
|
15037
|
+
const selected = React59.useMemo(() => currentValue ?? [], [currentValue]);
|
|
15038
|
+
const handleChange = React59.useCallback(
|
|
14996
15039
|
(next, meta) => {
|
|
14997
15040
|
if (!isControlled) setInternalValue(next);
|
|
14998
15041
|
onChange?.(next, meta);
|
|
14999
15042
|
},
|
|
15000
15043
|
[isControlled, onChange]
|
|
15001
15044
|
);
|
|
15002
|
-
const flatRawOptions =
|
|
15045
|
+
const flatRawOptions = React59.useMemo(
|
|
15003
15046
|
() => flattenGroupedOptions(rawOptions),
|
|
15004
15047
|
[rawOptions]
|
|
15005
15048
|
);
|
|
15006
|
-
const filteredGrouped =
|
|
15049
|
+
const filteredGrouped = React59.useMemo(() => {
|
|
15007
15050
|
const trimmed = inputValue.trim();
|
|
15008
15051
|
if (!trimmed) return rawOptions;
|
|
15009
15052
|
return rawOptions.map((item) => {
|
|
@@ -15014,7 +15057,7 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15014
15057
|
return filterOption(item, trimmed) ? item : null;
|
|
15015
15058
|
}).filter((item) => item !== null);
|
|
15016
15059
|
}, [rawOptions, inputValue, filterOption]);
|
|
15017
|
-
const filteredFlat =
|
|
15060
|
+
const filteredFlat = React59.useMemo(
|
|
15018
15061
|
() => flattenGroupedOptions(filteredGrouped),
|
|
15019
15062
|
[filteredGrouped]
|
|
15020
15063
|
);
|
|
@@ -15022,7 +15065,7 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15022
15065
|
return acc + (selected.some((s) => s.value === option.value) ? 1 : 0);
|
|
15023
15066
|
}, 0);
|
|
15024
15067
|
const allVisibleSelected = filteredFlat.length > 0 && visibleSelectedCount === filteredFlat.length;
|
|
15025
|
-
const handleToggleAll =
|
|
15068
|
+
const handleToggleAll = React59.useCallback(() => {
|
|
15026
15069
|
if (allVisibleSelected) {
|
|
15027
15070
|
const visibleValues = new Set(filteredFlat.map((option) => option.value));
|
|
15028
15071
|
handleChange(
|
|
@@ -15037,18 +15080,18 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15037
15080
|
}
|
|
15038
15081
|
handleChange(merged, { action: "select" });
|
|
15039
15082
|
}, [allVisibleSelected, filteredFlat, handleChange, selected]);
|
|
15040
|
-
const valueTextRef =
|
|
15041
|
-
const totalCountRef =
|
|
15083
|
+
const valueTextRef = React59.useRef(valueText);
|
|
15084
|
+
const totalCountRef = React59.useRef(flatRawOptions.length);
|
|
15042
15085
|
valueTextRef.current = valueText;
|
|
15043
15086
|
totalCountRef.current = flatRawOptions.length;
|
|
15044
|
-
const Control =
|
|
15087
|
+
const Control = React59.useMemo(() => {
|
|
15045
15088
|
if (trigger) return makeTriggerSlot(trigger);
|
|
15046
15089
|
return createCountTrigger({
|
|
15047
15090
|
getValueText: () => valueTextRef.current,
|
|
15048
15091
|
getTotalCount: () => totalCountRef.current
|
|
15049
15092
|
});
|
|
15050
15093
|
}, [trigger]);
|
|
15051
|
-
const components =
|
|
15094
|
+
const components = React59.useMemo(
|
|
15052
15095
|
() => ({
|
|
15053
15096
|
...userComponents,
|
|
15054
15097
|
Control,
|
|
@@ -15056,7 +15099,7 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15056
15099
|
}),
|
|
15057
15100
|
[userComponents, Control]
|
|
15058
15101
|
);
|
|
15059
|
-
const menuHeader = allowSelectAll ? /* @__PURE__ */
|
|
15102
|
+
const menuHeader = allowSelectAll ? /* @__PURE__ */ jsx168(
|
|
15060
15103
|
SelectAllRow,
|
|
15061
15104
|
{
|
|
15062
15105
|
label: selectAllLabel ?? t("select_all", { defaultValue: "Select All" }),
|
|
@@ -15064,7 +15107,7 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15064
15107
|
onToggle: handleToggleAll
|
|
15065
15108
|
}
|
|
15066
15109
|
) : void 0;
|
|
15067
|
-
const handleInputChange =
|
|
15110
|
+
const handleInputChange = React59.useCallback(
|
|
15068
15111
|
(next) => {
|
|
15069
15112
|
setInputValue(next);
|
|
15070
15113
|
onSearchChange?.(next);
|
|
@@ -15085,7 +15128,7 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15085
15128
|
isMulti: true
|
|
15086
15129
|
};
|
|
15087
15130
|
if (isPaginated) {
|
|
15088
|
-
return /* @__PURE__ */
|
|
15131
|
+
return /* @__PURE__ */ jsx168(
|
|
15089
15132
|
InfiniteScrollSelect,
|
|
15090
15133
|
{
|
|
15091
15134
|
ref,
|
|
@@ -15096,7 +15139,7 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15096
15139
|
}
|
|
15097
15140
|
);
|
|
15098
15141
|
}
|
|
15099
|
-
return /* @__PURE__ */
|
|
15142
|
+
return /* @__PURE__ */ jsx168(
|
|
15100
15143
|
Select,
|
|
15101
15144
|
{
|
|
15102
15145
|
ref,
|
|
@@ -15107,16 +15150,16 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15107
15150
|
}
|
|
15108
15151
|
);
|
|
15109
15152
|
}
|
|
15110
|
-
var SelectCheckboxes =
|
|
15153
|
+
var SelectCheckboxes = React59.forwardRef(
|
|
15111
15154
|
SelectCheckboxesInternal
|
|
15112
15155
|
);
|
|
15113
15156
|
|
|
15114
15157
|
// src/dashboard/textarea/Textarea.tsx
|
|
15115
|
-
import * as
|
|
15158
|
+
import * as React61 from "react";
|
|
15116
15159
|
import { useTranslation as useTranslation37 } from "react-i18next";
|
|
15117
15160
|
|
|
15118
15161
|
// src/dashboard/textarea/useTextareaValueState.ts
|
|
15119
|
-
import * as
|
|
15162
|
+
import * as React60 from "react";
|
|
15120
15163
|
var isEmptyValue2 = (value) => {
|
|
15121
15164
|
if (value === void 0 || value === null) return true;
|
|
15122
15165
|
return String(value).length === 0;
|
|
@@ -15135,12 +15178,12 @@ function useTextareaValueState({
|
|
|
15135
15178
|
value,
|
|
15136
15179
|
defaultValue
|
|
15137
15180
|
}) {
|
|
15138
|
-
const textareaRef =
|
|
15181
|
+
const textareaRef = React60.useRef(null);
|
|
15139
15182
|
const isControlled = typeof empty !== "undefined" || typeof value !== "undefined";
|
|
15140
15183
|
const propsAreEmpty = getTextareaEmptyState({ empty, value, defaultValue });
|
|
15141
|
-
const [nativeIsEmpty, setNativeIsEmpty] =
|
|
15184
|
+
const [nativeIsEmpty, setNativeIsEmpty] = React60.useState(propsAreEmpty);
|
|
15142
15185
|
const isEmpty = isControlled ? propsAreEmpty : nativeIsEmpty;
|
|
15143
|
-
const setNativeValue =
|
|
15186
|
+
const setNativeValue = React60.useCallback(
|
|
15144
15187
|
(nextValue) => {
|
|
15145
15188
|
if (isControlled) return;
|
|
15146
15189
|
const nextIsEmpty = nextValue.length === 0;
|
|
@@ -15150,14 +15193,14 @@ function useTextareaValueState({
|
|
|
15150
15193
|
},
|
|
15151
15194
|
[isControlled]
|
|
15152
15195
|
);
|
|
15153
|
-
const syncValueState =
|
|
15196
|
+
const syncValueState = React60.useCallback(() => {
|
|
15154
15197
|
if (!textareaRef.current) return;
|
|
15155
15198
|
setNativeValue(textareaRef.current.value);
|
|
15156
15199
|
}, [setNativeValue]);
|
|
15157
|
-
|
|
15200
|
+
React60.useLayoutEffect(() => {
|
|
15158
15201
|
syncValueState();
|
|
15159
15202
|
});
|
|
15160
|
-
|
|
15203
|
+
React60.useEffect(() => {
|
|
15161
15204
|
const textarea = textareaRef.current;
|
|
15162
15205
|
const form = textarea?.form;
|
|
15163
15206
|
if (isControlled || !form) return;
|
|
@@ -15181,10 +15224,10 @@ function useTextareaValueState({
|
|
|
15181
15224
|
}
|
|
15182
15225
|
|
|
15183
15226
|
// src/dashboard/textarea/Textarea.tsx
|
|
15184
|
-
import { jsx as
|
|
15227
|
+
import { jsx as jsx169, jsxs as jsxs105 } from "react/jsx-runtime";
|
|
15185
15228
|
var LINE_HEIGHT = 20;
|
|
15186
15229
|
var VERTICAL_PADDING = 32;
|
|
15187
|
-
var Textarea =
|
|
15230
|
+
var Textarea = React61.forwardRef(function Textarea2({
|
|
15188
15231
|
className,
|
|
15189
15232
|
textareaClassName,
|
|
15190
15233
|
label,
|
|
@@ -15212,12 +15255,12 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15212
15255
|
}, ref) {
|
|
15213
15256
|
const { textareaRef, isControlled, isEmpty, setNativeValue, syncValueState } = useTextareaValueState({ empty, value, defaultValue });
|
|
15214
15257
|
const combinedRef = useCombinedRef(ref, textareaRef);
|
|
15215
|
-
const reactId =
|
|
15258
|
+
const reactId = React61.useId();
|
|
15216
15259
|
const textareaId = id ?? name ?? `dash-textarea-${reactId}`;
|
|
15217
15260
|
const { t } = useTranslation37();
|
|
15218
15261
|
const isInvalid = Boolean(invalid || error);
|
|
15219
15262
|
const isBlocked = Boolean(disabled);
|
|
15220
|
-
const resize =
|
|
15263
|
+
const resize = React61.useCallback(() => {
|
|
15221
15264
|
const el = textareaRef.current;
|
|
15222
15265
|
if (!el || !autosize) return;
|
|
15223
15266
|
el.style.height = "auto";
|
|
@@ -15227,7 +15270,7 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15227
15270
|
el.style.height = `${nextHeight}px`;
|
|
15228
15271
|
el.style.overflowY = el.scrollHeight > nextHeight ? "auto" : "hidden";
|
|
15229
15272
|
}, [autosize, maxRows, minRows, textareaRef]);
|
|
15230
|
-
|
|
15273
|
+
React61.useLayoutEffect(() => {
|
|
15231
15274
|
resize();
|
|
15232
15275
|
}, [resize, value]);
|
|
15233
15276
|
const handleInput = (event) => {
|
|
@@ -15264,14 +15307,14 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15264
15307
|
"label",
|
|
15265
15308
|
{
|
|
15266
15309
|
htmlFor: textareaId,
|
|
15267
|
-
className: "mb-2 flex select-none items-center text-[
|
|
15310
|
+
className: "mb-2 flex select-none items-center text-[length:var(--field-label-font-size)] font-[var(--field-label-font-weight)] text-[var(--chekin-color-brand-navy)]",
|
|
15268
15311
|
children: [
|
|
15269
15312
|
label,
|
|
15270
|
-
tooltip && /* @__PURE__ */
|
|
15313
|
+
tooltip && /* @__PURE__ */ jsx169("span", { className: "ml-1 inline-flex", children: /* @__PURE__ */ jsx169(HelpTooltip, { content: tooltip, size: 16 }) })
|
|
15271
15314
|
]
|
|
15272
15315
|
}
|
|
15273
15316
|
),
|
|
15274
|
-
/* @__PURE__ */
|
|
15317
|
+
/* @__PURE__ */ jsx169(
|
|
15275
15318
|
"textarea",
|
|
15276
15319
|
{
|
|
15277
15320
|
ref: combinedRef,
|
|
@@ -15290,10 +15333,10 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15290
15333
|
onBlur: handleBlur,
|
|
15291
15334
|
className: cn(
|
|
15292
15335
|
"m-0 box-border block w-full resize-none rounded-[6px] border bg-white px-4 py-4 text-[16px] font-medium leading-5 text-[var(--chekin-color-brand-navy)] outline-none transition-colors duration-100 ease-in-out",
|
|
15293
|
-
"border-[var(--
|
|
15294
|
-
!isBlocked && "focus:border-[var(--
|
|
15295
|
-
isEmpty && "border-[var(--
|
|
15296
|
-
isInvalid && "border-[var(--
|
|
15336
|
+
"border-[var(--field-border)] placeholder:font-medium placeholder:text-[var(--chekin-color-gray-1)]",
|
|
15337
|
+
!isBlocked && "focus:border-[var(--field-border-focused)]",
|
|
15338
|
+
isEmpty && "border-[var(--field-border)] bg-[var(--empty-field-background)] text-[var(--chekin-color-gray-1)]",
|
|
15339
|
+
isInvalid && "border-[var(--field-border-invalid)] focus:border-[var(--field-border-invalid)]",
|
|
15297
15340
|
(readOnly || isBlocked) && "cursor-default",
|
|
15298
15341
|
isBlocked && "cursor-not-allowed",
|
|
15299
15342
|
loading && "cursor-progress",
|
|
@@ -15303,7 +15346,7 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15303
15346
|
...textareaProps
|
|
15304
15347
|
}
|
|
15305
15348
|
),
|
|
15306
|
-
error && /* @__PURE__ */
|
|
15349
|
+
error && /* @__PURE__ */ jsx169(
|
|
15307
15350
|
FieldErrorMessage,
|
|
15308
15351
|
{
|
|
15309
15352
|
id: `${textareaId}-error`,
|
|
@@ -15311,20 +15354,20 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15311
15354
|
className: "mt-[1px] text-[14px]"
|
|
15312
15355
|
}
|
|
15313
15356
|
),
|
|
15314
|
-
!error && optional && /* @__PURE__ */
|
|
15315
|
-
!error && helperText && /* @__PURE__ */
|
|
15357
|
+
!error && optional && /* @__PURE__ */ jsx169("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
15358
|
+
!error && helperText && /* @__PURE__ */ jsx169("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText })
|
|
15316
15359
|
]
|
|
15317
15360
|
}
|
|
15318
15361
|
);
|
|
15319
15362
|
});
|
|
15320
15363
|
|
|
15321
15364
|
// src/dashboard/datepicker/Datepicker.tsx
|
|
15322
|
-
import * as
|
|
15365
|
+
import * as React63 from "react";
|
|
15323
15366
|
import { ChevronDown as ChevronDown4 } from "lucide-react";
|
|
15324
15367
|
import { useTranslation as useTranslation38 } from "react-i18next";
|
|
15325
15368
|
|
|
15326
15369
|
// src/airbnb-fields/datepicker/useDatePickerWheel.ts
|
|
15327
|
-
import * as
|
|
15370
|
+
import * as React62 from "react";
|
|
15328
15371
|
|
|
15329
15372
|
// src/airbnb-fields/datepicker/datePicker.utils.ts
|
|
15330
15373
|
var DISPLAY_PAD_LENGTH = 2;
|
|
@@ -15475,21 +15518,21 @@ function useDatePickerWheel({
|
|
|
15475
15518
|
minDate,
|
|
15476
15519
|
maxDate
|
|
15477
15520
|
}) {
|
|
15478
|
-
const years =
|
|
15479
|
-
const [draftDate, setDraftDate] =
|
|
15521
|
+
const years = React62.useMemo(() => getYearRange(minDate, maxDate), [maxDate, minDate]);
|
|
15522
|
+
const [draftDate, setDraftDate] = React62.useState(
|
|
15480
15523
|
() => resolveInitialDate({ value, defaultValue, minDate, maxDate })
|
|
15481
15524
|
);
|
|
15482
15525
|
const draftYear = draftDate.getFullYear();
|
|
15483
15526
|
const draftMonth = draftDate.getMonth();
|
|
15484
|
-
const [monthScrollTop, setMonthScrollTop] =
|
|
15485
|
-
const [dayScrollTop, setDayScrollTop] =
|
|
15486
|
-
const [yearScrollTop, setYearScrollTop] =
|
|
15487
|
-
const monthListRef =
|
|
15488
|
-
const dayListRef =
|
|
15489
|
-
const yearListRef =
|
|
15490
|
-
const settleTimeoutsRef =
|
|
15491
|
-
const animationFramesRef =
|
|
15492
|
-
const columnRefs =
|
|
15527
|
+
const [monthScrollTop, setMonthScrollTop] = React62.useState(0);
|
|
15528
|
+
const [dayScrollTop, setDayScrollTop] = React62.useState(0);
|
|
15529
|
+
const [yearScrollTop, setYearScrollTop] = React62.useState(0);
|
|
15530
|
+
const monthListRef = React62.useRef(null);
|
|
15531
|
+
const dayListRef = React62.useRef(null);
|
|
15532
|
+
const yearListRef = React62.useRef(null);
|
|
15533
|
+
const settleTimeoutsRef = React62.useRef({});
|
|
15534
|
+
const animationFramesRef = React62.useRef({});
|
|
15535
|
+
const columnRefs = React62.useMemo(
|
|
15493
15536
|
() => ({
|
|
15494
15537
|
month: monthListRef,
|
|
15495
15538
|
day: dayListRef,
|
|
@@ -15497,7 +15540,7 @@ function useDatePickerWheel({
|
|
|
15497
15540
|
}),
|
|
15498
15541
|
[]
|
|
15499
15542
|
);
|
|
15500
|
-
const setColumnScrollTop =
|
|
15543
|
+
const setColumnScrollTop = React62.useCallback(
|
|
15501
15544
|
(column, nextScrollTop) => {
|
|
15502
15545
|
if (column === "month") {
|
|
15503
15546
|
setMonthScrollTop(nextScrollTop);
|
|
@@ -15511,19 +15554,19 @@ function useDatePickerWheel({
|
|
|
15511
15554
|
},
|
|
15512
15555
|
[]
|
|
15513
15556
|
);
|
|
15514
|
-
const clearSettleTimeout =
|
|
15557
|
+
const clearSettleTimeout = React62.useCallback((column) => {
|
|
15515
15558
|
const timeoutId = settleTimeoutsRef.current[column];
|
|
15516
15559
|
if (timeoutId === void 0) return;
|
|
15517
15560
|
window.clearTimeout(timeoutId);
|
|
15518
15561
|
delete settleTimeoutsRef.current[column];
|
|
15519
15562
|
}, []);
|
|
15520
|
-
const clearAnimationFrame =
|
|
15563
|
+
const clearAnimationFrame = React62.useCallback((column) => {
|
|
15521
15564
|
const frameId = animationFramesRef.current[column];
|
|
15522
15565
|
if (frameId === void 0) return;
|
|
15523
15566
|
window.cancelAnimationFrame(frameId);
|
|
15524
15567
|
delete animationFramesRef.current[column];
|
|
15525
15568
|
}, []);
|
|
15526
|
-
|
|
15569
|
+
React62.useEffect(
|
|
15527
15570
|
() => () => {
|
|
15528
15571
|
["month", "day", "year"].forEach((column) => {
|
|
15529
15572
|
clearSettleTimeout(column);
|
|
@@ -15532,22 +15575,22 @@ function useDatePickerWheel({
|
|
|
15532
15575
|
},
|
|
15533
15576
|
[clearAnimationFrame, clearSettleTimeout]
|
|
15534
15577
|
);
|
|
15535
|
-
|
|
15578
|
+
React62.useEffect(() => {
|
|
15536
15579
|
if (isOpen) return;
|
|
15537
15580
|
setDraftDate(resolveInitialDate({ value, defaultValue, minDate, maxDate }));
|
|
15538
15581
|
}, [defaultValue, isOpen, maxDate, minDate, value]);
|
|
15539
|
-
const months =
|
|
15582
|
+
const months = React62.useMemo(
|
|
15540
15583
|
() => getAllowedMonths(draftYear, minDate, maxDate),
|
|
15541
15584
|
[draftYear, maxDate, minDate]
|
|
15542
15585
|
);
|
|
15543
|
-
const days =
|
|
15586
|
+
const days = React62.useMemo(
|
|
15544
15587
|
() => getAllowedDays(draftYear, draftMonth, minDate, maxDate),
|
|
15545
15588
|
[draftMonth, draftYear, maxDate, minDate]
|
|
15546
15589
|
);
|
|
15547
15590
|
const monthIndex = months.findIndex((month) => month === draftMonth);
|
|
15548
15591
|
const dayIndex = days.findIndex((day) => day === draftDate.getDate());
|
|
15549
15592
|
const yearIndex = years.findIndex((year) => year === draftYear);
|
|
15550
|
-
const syncScrollPositions =
|
|
15593
|
+
const syncScrollPositions = React62.useCallback(
|
|
15551
15594
|
(nextDate, behavior = "auto") => {
|
|
15552
15595
|
const nextMonths = getAllowedMonths(nextDate.getFullYear(), minDate, maxDate);
|
|
15553
15596
|
const nextMonthIndex = nextMonths.findIndex((month) => month === nextDate.getMonth());
|
|
@@ -15571,7 +15614,7 @@ function useDatePickerWheel({
|
|
|
15571
15614
|
},
|
|
15572
15615
|
[maxDate, minDate, years]
|
|
15573
15616
|
);
|
|
15574
|
-
|
|
15617
|
+
React62.useLayoutEffect(() => {
|
|
15575
15618
|
if (!isOpen) return;
|
|
15576
15619
|
const nextDate = resolveInitialDate({ value, defaultValue, minDate, maxDate });
|
|
15577
15620
|
setDraftDate(nextDate);
|
|
@@ -15582,7 +15625,7 @@ function useDatePickerWheel({
|
|
|
15582
15625
|
window.cancelAnimationFrame(frameId);
|
|
15583
15626
|
};
|
|
15584
15627
|
}, [defaultValue, isOpen, maxDate, minDate, syncScrollPositions, value]);
|
|
15585
|
-
const updateDraftDate =
|
|
15628
|
+
const updateDraftDate = React62.useCallback(
|
|
15586
15629
|
(column, targetIndex, behavior = "smooth") => {
|
|
15587
15630
|
const currentDate = stripTime(draftDate);
|
|
15588
15631
|
const currentYear = currentDate.getFullYear();
|
|
@@ -15627,7 +15670,7 @@ function useDatePickerWheel({
|
|
|
15627
15670
|
},
|
|
15628
15671
|
[days, draftDate, maxDate, minDate, months, syncScrollPositions, years]
|
|
15629
15672
|
);
|
|
15630
|
-
const settleColumnScroll =
|
|
15673
|
+
const settleColumnScroll = React62.useCallback(
|
|
15631
15674
|
(column) => {
|
|
15632
15675
|
const list = columnRefs[column].current;
|
|
15633
15676
|
if (!list) return;
|
|
@@ -15640,7 +15683,7 @@ function useDatePickerWheel({
|
|
|
15640
15683
|
},
|
|
15641
15684
|
[columnRefs, days.length, months.length, updateDraftDate, years.length]
|
|
15642
15685
|
);
|
|
15643
|
-
const scheduleScrollSettle =
|
|
15686
|
+
const scheduleScrollSettle = React62.useCallback(
|
|
15644
15687
|
(column) => {
|
|
15645
15688
|
clearSettleTimeout(column);
|
|
15646
15689
|
settleTimeoutsRef.current[column] = window.setTimeout(() => {
|
|
@@ -15649,7 +15692,7 @@ function useDatePickerWheel({
|
|
|
15649
15692
|
},
|
|
15650
15693
|
[clearSettleTimeout, settleColumnScroll]
|
|
15651
15694
|
);
|
|
15652
|
-
const handleColumnScroll =
|
|
15695
|
+
const handleColumnScroll = React62.useCallback(
|
|
15653
15696
|
(column) => {
|
|
15654
15697
|
const list = columnRefs[column].current;
|
|
15655
15698
|
if (!list) return;
|
|
@@ -15663,13 +15706,13 @@ function useDatePickerWheel({
|
|
|
15663
15706
|
},
|
|
15664
15707
|
[clearAnimationFrame, columnRefs, scheduleScrollSettle, setColumnScrollTop]
|
|
15665
15708
|
);
|
|
15666
|
-
const handleOptionSelect =
|
|
15709
|
+
const handleOptionSelect = React62.useCallback(
|
|
15667
15710
|
(column, targetIndex) => {
|
|
15668
15711
|
updateDraftDate(column, targetIndex, "smooth");
|
|
15669
15712
|
},
|
|
15670
15713
|
[updateDraftDate]
|
|
15671
15714
|
);
|
|
15672
|
-
const focusAdjacentColumn =
|
|
15715
|
+
const focusAdjacentColumn = React62.useCallback(
|
|
15673
15716
|
(column, direction) => {
|
|
15674
15717
|
const order = ["month", "day", "year"];
|
|
15675
15718
|
const currentIndex = order.indexOf(column);
|
|
@@ -15679,7 +15722,7 @@ function useDatePickerWheel({
|
|
|
15679
15722
|
},
|
|
15680
15723
|
[columnRefs]
|
|
15681
15724
|
);
|
|
15682
|
-
const handleColumnKeyDown =
|
|
15725
|
+
const handleColumnKeyDown = React62.useCallback(
|
|
15683
15726
|
(column, event) => {
|
|
15684
15727
|
const currentIndex = column === "month" ? monthIndex : column === "day" ? dayIndex : yearIndex;
|
|
15685
15728
|
const maxIndex = column === "month" ? months.length - 1 : column === "day" ? days.length - 1 : years.length - 1;
|
|
@@ -15745,7 +15788,7 @@ function useDatePickerWheel({
|
|
|
15745
15788
|
}
|
|
15746
15789
|
|
|
15747
15790
|
// src/airbnb-fields/datepicker/DatePickerWheelColumn.tsx
|
|
15748
|
-
import { jsx as
|
|
15791
|
+
import { jsx as jsx170, jsxs as jsxs106 } from "react/jsx-runtime";
|
|
15749
15792
|
var spacerHeight = DATE_PICKER_OPTION_HEIGHT * DATE_PICKER_WHEEL_BUFFER_OPTIONS;
|
|
15750
15793
|
function AirbnbDatePickerWheelColumn({
|
|
15751
15794
|
id,
|
|
@@ -15759,7 +15802,7 @@ function AirbnbDatePickerWheelColumn({
|
|
|
15759
15802
|
onOptionSelect,
|
|
15760
15803
|
column
|
|
15761
15804
|
}) {
|
|
15762
|
-
return /* @__PURE__ */
|
|
15805
|
+
return /* @__PURE__ */ jsx170("div", { className: "relative z-10 min-w-0", children: /* @__PURE__ */ jsxs106(
|
|
15763
15806
|
"div",
|
|
15764
15807
|
{
|
|
15765
15808
|
id,
|
|
@@ -15776,14 +15819,14 @@ function AirbnbDatePickerWheelColumn({
|
|
|
15776
15819
|
WebkitOverflowScrolling: "touch"
|
|
15777
15820
|
},
|
|
15778
15821
|
children: [
|
|
15779
|
-
/* @__PURE__ */
|
|
15822
|
+
/* @__PURE__ */ jsx170("div", { style: { height: `${spacerHeight}px` } }),
|
|
15780
15823
|
items.map((item, index) => {
|
|
15781
15824
|
const { style } = getWheelOptionStyles(
|
|
15782
15825
|
index,
|
|
15783
15826
|
scrollTop,
|
|
15784
15827
|
DATE_PICKER_OPTION_HEIGHT
|
|
15785
15828
|
);
|
|
15786
|
-
return /* @__PURE__ */
|
|
15829
|
+
return /* @__PURE__ */ jsx170(
|
|
15787
15830
|
"button",
|
|
15788
15831
|
{
|
|
15789
15832
|
id: `${id}-option-${index}`,
|
|
@@ -15799,14 +15842,14 @@ function AirbnbDatePickerWheelColumn({
|
|
|
15799
15842
|
`${column}-${item}-${index}`
|
|
15800
15843
|
);
|
|
15801
15844
|
}),
|
|
15802
|
-
/* @__PURE__ */
|
|
15845
|
+
/* @__PURE__ */ jsx170("div", { style: { height: `${spacerHeight}px` } })
|
|
15803
15846
|
]
|
|
15804
15847
|
}
|
|
15805
15848
|
) });
|
|
15806
15849
|
}
|
|
15807
15850
|
|
|
15808
15851
|
// src/airbnb-fields/datepicker/DatePickerContent.tsx
|
|
15809
|
-
import { jsx as
|
|
15852
|
+
import { jsx as jsx171, jsxs as jsxs107 } from "react/jsx-runtime";
|
|
15810
15853
|
function AirbnbDatePickerBody({
|
|
15811
15854
|
baseId,
|
|
15812
15855
|
label,
|
|
@@ -15830,9 +15873,9 @@ function AirbnbDatePickerBody({
|
|
|
15830
15873
|
}) {
|
|
15831
15874
|
return /* @__PURE__ */ jsxs107("div", { className: "px-6 pb-4 pt-1 bg-white", children: [
|
|
15832
15875
|
/* @__PURE__ */ jsxs107("div", { className: "relative overflow-hidden rounded-[24px]", children: [
|
|
15833
|
-
/* @__PURE__ */
|
|
15834
|
-
/* @__PURE__ */
|
|
15835
|
-
/* @__PURE__ */
|
|
15876
|
+
/* @__PURE__ */ jsx171("div", { className: "pointer-events-none absolute inset-x-0 top-0 z-20 h-16 bg-gradient-to-b from-white via-white/80 to-transparent" }),
|
|
15877
|
+
/* @__PURE__ */ jsx171("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 z-20 h-16 bg-gradient-to-t from-white via-white/80 to-transparent" }),
|
|
15878
|
+
/* @__PURE__ */ jsx171(
|
|
15836
15879
|
"div",
|
|
15837
15880
|
{
|
|
15838
15881
|
"aria-hidden": true,
|
|
@@ -15840,7 +15883,7 @@ function AirbnbDatePickerBody({
|
|
|
15840
15883
|
}
|
|
15841
15884
|
),
|
|
15842
15885
|
/* @__PURE__ */ jsxs107("div", { className: "relative grid grid-cols-[1.35fr_0.7fr_1fr] gap-1", children: [
|
|
15843
|
-
/* @__PURE__ */
|
|
15886
|
+
/* @__PURE__ */ jsx171(
|
|
15844
15887
|
AirbnbDatePickerWheelColumn,
|
|
15845
15888
|
{
|
|
15846
15889
|
id: `${baseId}-month`,
|
|
@@ -15855,7 +15898,7 @@ function AirbnbDatePickerBody({
|
|
|
15855
15898
|
onOptionSelect
|
|
15856
15899
|
}
|
|
15857
15900
|
),
|
|
15858
|
-
/* @__PURE__ */
|
|
15901
|
+
/* @__PURE__ */ jsx171(
|
|
15859
15902
|
AirbnbDatePickerWheelColumn,
|
|
15860
15903
|
{
|
|
15861
15904
|
id: `${baseId}-day`,
|
|
@@ -15870,7 +15913,7 @@ function AirbnbDatePickerBody({
|
|
|
15870
15913
|
onOptionSelect
|
|
15871
15914
|
}
|
|
15872
15915
|
),
|
|
15873
|
-
/* @__PURE__ */
|
|
15916
|
+
/* @__PURE__ */ jsx171(
|
|
15874
15917
|
AirbnbDatePickerWheelColumn,
|
|
15875
15918
|
{
|
|
15876
15919
|
id: `${baseId}-year`,
|
|
@@ -15887,7 +15930,7 @@ function AirbnbDatePickerBody({
|
|
|
15887
15930
|
)
|
|
15888
15931
|
] })
|
|
15889
15932
|
] }),
|
|
15890
|
-
/* @__PURE__ */
|
|
15933
|
+
/* @__PURE__ */ jsx171(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
15891
15934
|
] });
|
|
15892
15935
|
}
|
|
15893
15936
|
function AirbnbDatePickerContent({
|
|
@@ -15915,7 +15958,7 @@ function AirbnbDatePickerContent({
|
|
|
15915
15958
|
onColumnKeyDown,
|
|
15916
15959
|
onOptionSelect
|
|
15917
15960
|
}) {
|
|
15918
|
-
const body = /* @__PURE__ */
|
|
15961
|
+
const body = /* @__PURE__ */ jsx171(
|
|
15919
15962
|
AirbnbDatePickerBody,
|
|
15920
15963
|
{
|
|
15921
15964
|
baseId,
|
|
@@ -15940,27 +15983,27 @@ function AirbnbDatePickerContent({
|
|
|
15940
15983
|
}
|
|
15941
15984
|
);
|
|
15942
15985
|
if (isMobile3) {
|
|
15943
|
-
return /* @__PURE__ */
|
|
15986
|
+
return /* @__PURE__ */ jsx171(Drawer, { open, onOpenChange, children: /* @__PURE__ */ jsxs107(
|
|
15944
15987
|
DrawerContent,
|
|
15945
15988
|
{
|
|
15946
15989
|
onClose: () => onOpenChange(false),
|
|
15947
15990
|
className: "rounded-none rounded-t-[32px] border-0 p-0",
|
|
15948
15991
|
children: [
|
|
15949
|
-
/* @__PURE__ */
|
|
15950
|
-
/* @__PURE__ */
|
|
15992
|
+
/* @__PURE__ */ jsx171(DrawerTitle, { className: "sr-only", children: title }),
|
|
15993
|
+
/* @__PURE__ */ jsx171(DrawerDescription, { className: "sr-only", children: label }),
|
|
15951
15994
|
body
|
|
15952
15995
|
]
|
|
15953
15996
|
}
|
|
15954
15997
|
) });
|
|
15955
15998
|
}
|
|
15956
|
-
return /* @__PURE__ */
|
|
15999
|
+
return /* @__PURE__ */ jsx171(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs107(
|
|
15957
16000
|
DialogContent,
|
|
15958
16001
|
{
|
|
15959
16002
|
className: "max-w-[520px] rounded-[28px] border-0 p-0 shadow-xl",
|
|
15960
16003
|
showCloseButton: false,
|
|
15961
16004
|
children: [
|
|
15962
|
-
/* @__PURE__ */
|
|
15963
|
-
/* @__PURE__ */
|
|
16005
|
+
/* @__PURE__ */ jsx171(DialogTitle, { className: "sr-only", children: title }),
|
|
16006
|
+
/* @__PURE__ */ jsx171(DialogDescription, { className: "sr-only", children: label }),
|
|
15964
16007
|
body
|
|
15965
16008
|
]
|
|
15966
16009
|
}
|
|
@@ -15968,7 +16011,7 @@ function AirbnbDatePickerContent({
|
|
|
15968
16011
|
}
|
|
15969
16012
|
|
|
15970
16013
|
// src/dashboard/datepicker/Datepicker.tsx
|
|
15971
|
-
import { jsx as
|
|
16014
|
+
import { jsx as jsx172, jsxs as jsxs108 } from "react/jsx-runtime";
|
|
15972
16015
|
var MONTHS_IN_YEAR2 = 12;
|
|
15973
16016
|
function getMonthLabels2(locale) {
|
|
15974
16017
|
const formatter = new Intl.DateTimeFormat(locale, { month: "long" });
|
|
@@ -16001,7 +16044,7 @@ function dateFromParts(day, monthIndex, year) {
|
|
|
16001
16044
|
if (!isValidCalendarDate(yearNum, monthIndex, dayNum)) return null;
|
|
16002
16045
|
return new Date(yearNum, monthIndex, dayNum);
|
|
16003
16046
|
}
|
|
16004
|
-
var Datepicker =
|
|
16047
|
+
var Datepicker = React63.forwardRef(
|
|
16005
16048
|
function Datepicker2({
|
|
16006
16049
|
label,
|
|
16007
16050
|
value,
|
|
@@ -16034,14 +16077,14 @@ var Datepicker = React62.forwardRef(
|
|
|
16034
16077
|
maxDate,
|
|
16035
16078
|
formatValue
|
|
16036
16079
|
}, ref) {
|
|
16037
|
-
const containerRef =
|
|
16038
|
-
const dayInputRef =
|
|
16039
|
-
const monthInputRef =
|
|
16040
|
-
const monthListRef =
|
|
16041
|
-
const yearInputRef =
|
|
16042
|
-
const mobileTriggerRef =
|
|
16043
|
-
const wheelBaseId =
|
|
16044
|
-
const reactId =
|
|
16080
|
+
const containerRef = React63.useRef(null);
|
|
16081
|
+
const dayInputRef = React63.useRef(null);
|
|
16082
|
+
const monthInputRef = React63.useRef(null);
|
|
16083
|
+
const monthListRef = React63.useRef(null);
|
|
16084
|
+
const yearInputRef = React63.useRef(null);
|
|
16085
|
+
const mobileTriggerRef = React63.useRef(null);
|
|
16086
|
+
const wheelBaseId = React63.useId();
|
|
16087
|
+
const reactId = React63.useId();
|
|
16045
16088
|
const baseId = name ?? `dash-datepicker-${reactId}`;
|
|
16046
16089
|
const dayId = `${baseId}-day`;
|
|
16047
16090
|
const monthId = `${baseId}-month`;
|
|
@@ -16050,38 +16093,38 @@ var Datepicker = React62.forwardRef(
|
|
|
16050
16093
|
const errorId = `${baseId}-error`;
|
|
16051
16094
|
const { t, i18n } = useTranslation38();
|
|
16052
16095
|
const resolvedLocale = locale ?? i18n.resolvedLanguage ?? i18n.language ?? "en-US";
|
|
16053
|
-
const resolvedMonthLabels =
|
|
16096
|
+
const resolvedMonthLabels = React63.useMemo(
|
|
16054
16097
|
() => monthLabels ?? getMonthLabels2(resolvedLocale),
|
|
16055
16098
|
[resolvedLocale, monthLabels]
|
|
16056
16099
|
);
|
|
16057
16100
|
const resolvedMonthPlaceholder = monthPlaceholder ?? t("month");
|
|
16058
16101
|
const resolvedDoneLabel = doneLabel ?? t("done");
|
|
16059
16102
|
const isControlled = value !== void 0;
|
|
16060
|
-
const initialParts =
|
|
16103
|
+
const initialParts = React63.useMemo(
|
|
16061
16104
|
() => partsFromDate(value ?? defaultValue ?? null),
|
|
16062
16105
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16063
16106
|
[]
|
|
16064
16107
|
);
|
|
16065
|
-
const [day, setDay] =
|
|
16066
|
-
const [monthIndex, setMonthIndex] =
|
|
16108
|
+
const [day, setDay] = React63.useState(initialParts.day);
|
|
16109
|
+
const [monthIndex, setMonthIndex] = React63.useState(
|
|
16067
16110
|
initialParts.monthIndex
|
|
16068
16111
|
);
|
|
16069
|
-
const [year, setYear] =
|
|
16070
|
-
const [isMonthOpen, setIsMonthOpen] =
|
|
16071
|
-
const [isWheelOpen, setIsWheelOpen] =
|
|
16072
|
-
const [focusedField, setFocusedField] =
|
|
16073
|
-
const [monthInputValue, setMonthInputValue] =
|
|
16074
|
-
const [monthHighlightIndex, setMonthHighlightIndex] =
|
|
16112
|
+
const [year, setYear] = React63.useState(initialParts.year);
|
|
16113
|
+
const [isMonthOpen, setIsMonthOpen] = React63.useState(false);
|
|
16114
|
+
const [isWheelOpen, setIsWheelOpen] = React63.useState(false);
|
|
16115
|
+
const [focusedField, setFocusedField] = React63.useState(null);
|
|
16116
|
+
const [monthInputValue, setMonthInputValue] = React63.useState("");
|
|
16117
|
+
const [monthHighlightIndex, setMonthHighlightIndex] = React63.useState(-1);
|
|
16075
16118
|
const isMobile3 = useIsMobile();
|
|
16076
|
-
const emitChangeRef =
|
|
16119
|
+
const emitChangeRef = React63.useRef(() => {
|
|
16077
16120
|
});
|
|
16078
|
-
const dayStateRef =
|
|
16079
|
-
const yearStateRef =
|
|
16080
|
-
const monthIndexRef =
|
|
16121
|
+
const dayStateRef = React63.useRef(day);
|
|
16122
|
+
const yearStateRef = React63.useRef(year);
|
|
16123
|
+
const monthIndexRef = React63.useRef(monthIndex);
|
|
16081
16124
|
dayStateRef.current = day;
|
|
16082
16125
|
yearStateRef.current = year;
|
|
16083
16126
|
monthIndexRef.current = monthIndex;
|
|
16084
|
-
|
|
16127
|
+
React63.useImperativeHandle(
|
|
16085
16128
|
ref,
|
|
16086
16129
|
() => ({
|
|
16087
16130
|
getDayValue: () => dayStateRef.current,
|
|
@@ -16099,27 +16142,27 @@ var Datepicker = React62.forwardRef(
|
|
|
16099
16142
|
}),
|
|
16100
16143
|
[]
|
|
16101
16144
|
);
|
|
16102
|
-
|
|
16145
|
+
React63.useEffect(() => {
|
|
16103
16146
|
if (!isControlled) return;
|
|
16104
16147
|
const next = partsFromDate(value ?? null);
|
|
16105
16148
|
setDay(next.day);
|
|
16106
16149
|
setMonthIndex(next.monthIndex);
|
|
16107
16150
|
setYear(next.year);
|
|
16108
16151
|
}, [isControlled, value]);
|
|
16109
|
-
|
|
16152
|
+
React63.useEffect(() => {
|
|
16110
16153
|
if (focusedField === "month") return;
|
|
16111
16154
|
setMonthInputValue(
|
|
16112
16155
|
monthIndex !== null ? resolvedMonthLabels[monthIndex] ?? "" : ""
|
|
16113
16156
|
);
|
|
16114
16157
|
}, [monthIndex, resolvedMonthLabels, focusedField]);
|
|
16115
|
-
const filteredMonths =
|
|
16158
|
+
const filteredMonths = React63.useMemo(() => {
|
|
16116
16159
|
const all = resolvedMonthLabels.map((label2, index) => ({ label: label2, index }));
|
|
16117
16160
|
const query = monthInputValue.trim().toLowerCase();
|
|
16118
16161
|
const currentLabel = monthIndex !== null ? resolvedMonthLabels[monthIndex] ?? "" : "";
|
|
16119
16162
|
if (!query || monthInputValue === currentLabel) return all;
|
|
16120
16163
|
return all.filter((opt) => opt.label.toLowerCase().includes(query));
|
|
16121
16164
|
}, [monthInputValue, monthIndex, resolvedMonthLabels]);
|
|
16122
|
-
|
|
16165
|
+
React63.useEffect(() => {
|
|
16123
16166
|
if (!isMonthOpen) {
|
|
16124
16167
|
setMonthHighlightIndex(-1);
|
|
16125
16168
|
return;
|
|
@@ -16140,7 +16183,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16140
16183
|
const isFocused = focusedField !== null || isMonthOpen || isWheelOpen;
|
|
16141
16184
|
const isInvalid = Boolean(invalid || error);
|
|
16142
16185
|
const wrapperWidth = toCssSize(width);
|
|
16143
|
-
const currentDate =
|
|
16186
|
+
const currentDate = React63.useMemo(
|
|
16144
16187
|
() => dateFromParts(day, monthIndex, year),
|
|
16145
16188
|
[day, monthIndex, year]
|
|
16146
16189
|
);
|
|
@@ -16149,7 +16192,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16149
16192
|
onOutsideClick: () => setIsMonthOpen(false),
|
|
16150
16193
|
isDisabled: !isMonthOpen || isMobile3
|
|
16151
16194
|
});
|
|
16152
|
-
const emitChange =
|
|
16195
|
+
const emitChange = React63.useCallback(
|
|
16153
16196
|
(nextDay, nextMonth, nextYear) => {
|
|
16154
16197
|
if (!onChange) return;
|
|
16155
16198
|
const date = dateFromParts(nextDay, nextMonth, nextYear);
|
|
@@ -16185,7 +16228,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16185
16228
|
setIsMonthOpen(true);
|
|
16186
16229
|
setMonthHighlightIndex(0);
|
|
16187
16230
|
};
|
|
16188
|
-
const commitMonthInput =
|
|
16231
|
+
const commitMonthInput = React63.useCallback(() => {
|
|
16189
16232
|
const query = monthInputValue.trim().toLowerCase();
|
|
16190
16233
|
if (!query) {
|
|
16191
16234
|
if (monthIndex !== null) {
|
|
@@ -16245,15 +16288,15 @@ var Datepicker = React62.forwardRef(
|
|
|
16245
16288
|
setIsMonthOpen(false);
|
|
16246
16289
|
}
|
|
16247
16290
|
};
|
|
16248
|
-
const focusDayInput =
|
|
16291
|
+
const focusDayInput = React63.useCallback(() => {
|
|
16249
16292
|
if (isBlocked || readOnly) return;
|
|
16250
16293
|
dayInputRef.current?.focus();
|
|
16251
16294
|
}, [isBlocked, readOnly]);
|
|
16252
|
-
const openWheel =
|
|
16295
|
+
const openWheel = React63.useCallback(() => {
|
|
16253
16296
|
if (isBlocked || readOnly) return;
|
|
16254
16297
|
setIsWheelOpen(true);
|
|
16255
16298
|
}, [isBlocked, readOnly]);
|
|
16256
|
-
const closeWheel =
|
|
16299
|
+
const closeWheel = React63.useCallback(() => {
|
|
16257
16300
|
setIsWheelOpen(false);
|
|
16258
16301
|
mobileTriggerRef.current?.focus();
|
|
16259
16302
|
}, []);
|
|
@@ -16265,7 +16308,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16265
16308
|
minDate,
|
|
16266
16309
|
maxDate
|
|
16267
16310
|
});
|
|
16268
|
-
const handleWheelDone =
|
|
16311
|
+
const handleWheelDone = React63.useCallback(() => {
|
|
16269
16312
|
const next = wheel.draftDate;
|
|
16270
16313
|
setDay(String(next.getDate()));
|
|
16271
16314
|
setMonthIndex(next.getMonth());
|
|
@@ -16274,14 +16317,14 @@ var Datepicker = React62.forwardRef(
|
|
|
16274
16317
|
setIsWheelOpen(false);
|
|
16275
16318
|
mobileTriggerRef.current?.focus();
|
|
16276
16319
|
}, [name, onChange, wheel.draftDate]);
|
|
16277
|
-
const defaultFormatValue =
|
|
16320
|
+
const defaultFormatValue = React63.useCallback(
|
|
16278
16321
|
(date) => `${date.getDate()} ${resolvedMonthLabels[date.getMonth()]} ${date.getFullYear()}`,
|
|
16279
16322
|
[resolvedMonthLabels]
|
|
16280
16323
|
);
|
|
16281
16324
|
const triggerText = currentDate ? (formatValue ?? defaultFormatValue)(currentDate) : void 0;
|
|
16282
16325
|
const monthListboxId = `${monthId}-listbox`;
|
|
16283
16326
|
const getMonthOptionId = (index) => `${monthId}-option-${index}`;
|
|
16284
|
-
const monthPanelContent = filteredMonths.length === 0 ? /* @__PURE__ */
|
|
16327
|
+
const monthPanelContent = filteredMonths.length === 0 ? /* @__PURE__ */ jsx172("div", { className: "px-4 py-3 text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: t("no_options") }) : /* @__PURE__ */ jsx172(
|
|
16285
16328
|
"ul",
|
|
16286
16329
|
{
|
|
16287
16330
|
ref: monthListRef,
|
|
@@ -16292,7 +16335,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16292
16335
|
children: filteredMonths.map((option, position) => {
|
|
16293
16336
|
const isSelected = option.index === monthIndex;
|
|
16294
16337
|
const isHighlighted = position === monthHighlightIndex;
|
|
16295
|
-
return /* @__PURE__ */
|
|
16338
|
+
return /* @__PURE__ */ jsx172("li", { role: "presentation", children: /* @__PURE__ */ jsx172(
|
|
16296
16339
|
"button",
|
|
16297
16340
|
{
|
|
16298
16341
|
id: getMonthOptionId(option.index),
|
|
@@ -16319,7 +16362,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16319
16362
|
isBlocked && "cursor-not-allowed",
|
|
16320
16363
|
loading && "cursor-progress"
|
|
16321
16364
|
);
|
|
16322
|
-
return /* @__PURE__ */
|
|
16365
|
+
return /* @__PURE__ */ jsx172(
|
|
16323
16366
|
"div",
|
|
16324
16367
|
{
|
|
16325
16368
|
ref: containerRef,
|
|
@@ -16352,8 +16395,8 @@ var Datepicker = React62.forwardRef(
|
|
|
16352
16395
|
(isBlocked || readOnly) && "cursor-not-allowed"
|
|
16353
16396
|
),
|
|
16354
16397
|
children: [
|
|
16355
|
-
/* @__PURE__ */
|
|
16356
|
-
/* @__PURE__ */
|
|
16398
|
+
/* @__PURE__ */ jsx172("span", { className: "block min-w-0 flex-1 truncate text-left", children: triggerText ?? (isWheelOpen ? mobilePlaceholder : null) }),
|
|
16399
|
+
/* @__PURE__ */ jsx172("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ jsx172(
|
|
16357
16400
|
ChevronDown4,
|
|
16358
16401
|
{
|
|
16359
16402
|
size: 16,
|
|
@@ -16372,7 +16415,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16372
16415
|
"relative box-border grid h-12 w-full grid-cols-[minmax(0,1fr)_minmax(96px,140px)_minmax(0,1fr)] items-center rounded-[6px] text-[16px] font-medium text-[var(--chekin-color-brand-navy)]"
|
|
16373
16416
|
),
|
|
16374
16417
|
children: [
|
|
16375
|
-
/* @__PURE__ */
|
|
16418
|
+
/* @__PURE__ */ jsx172("div", { className: "flex h-full min-w-0 items-center px-2 sm:px-4", children: /* @__PURE__ */ jsx172(
|
|
16376
16419
|
"input",
|
|
16377
16420
|
{
|
|
16378
16421
|
ref: dayInputRef,
|
|
@@ -16402,7 +16445,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16402
16445
|
}
|
|
16403
16446
|
) }),
|
|
16404
16447
|
/* @__PURE__ */ jsxs108("div", { className: "relative flex h-full min-w-0 items-center gap-1 px-2 before:absolute before:inset-y-3 before:left-0 before:w-px before:bg-[var(--chekin-color-gray-3)] before:content-[''] after:absolute after:inset-y-3 after:right-0 after:w-px after:bg-[var(--chekin-color-gray-3)] after:content-[''] sm:px-3", children: [
|
|
16405
|
-
/* @__PURE__ */
|
|
16448
|
+
/* @__PURE__ */ jsx172(
|
|
16406
16449
|
"input",
|
|
16407
16450
|
{
|
|
16408
16451
|
ref: monthInputRef,
|
|
@@ -16448,7 +16491,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16448
16491
|
)
|
|
16449
16492
|
}
|
|
16450
16493
|
),
|
|
16451
|
-
/* @__PURE__ */
|
|
16494
|
+
/* @__PURE__ */ jsx172(
|
|
16452
16495
|
ChevronDown4,
|
|
16453
16496
|
{
|
|
16454
16497
|
size: 14,
|
|
@@ -16465,7 +16508,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16465
16508
|
}
|
|
16466
16509
|
)
|
|
16467
16510
|
] }),
|
|
16468
|
-
/* @__PURE__ */
|
|
16511
|
+
/* @__PURE__ */ jsx172("div", { className: "flex h-full min-w-0 items-center px-2 sm:px-4", children: /* @__PURE__ */ jsx172(
|
|
16469
16512
|
"input",
|
|
16470
16513
|
{
|
|
16471
16514
|
ref: yearInputRef,
|
|
@@ -16497,7 +16540,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16497
16540
|
]
|
|
16498
16541
|
}
|
|
16499
16542
|
),
|
|
16500
|
-
showCoverage && /* @__PURE__ */
|
|
16543
|
+
showCoverage && /* @__PURE__ */ jsx172(
|
|
16501
16544
|
"div",
|
|
16502
16545
|
{
|
|
16503
16546
|
className: "absolute inset-0 cursor-text rounded-[6px] bg-[var(--empty-field-background)]",
|
|
@@ -16505,7 +16548,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16505
16548
|
"aria-hidden": "true"
|
|
16506
16549
|
}
|
|
16507
16550
|
),
|
|
16508
|
-
/* @__PURE__ */
|
|
16551
|
+
/* @__PURE__ */ jsx172(
|
|
16509
16552
|
Fieldset,
|
|
16510
16553
|
{
|
|
16511
16554
|
isFocused,
|
|
@@ -16523,9 +16566,9 @@ var Datepicker = React62.forwardRef(
|
|
|
16523
16566
|
onClick: isMobile3 ? openWheel : showCoverage ? focusDayInput : void 0
|
|
16524
16567
|
}
|
|
16525
16568
|
),
|
|
16526
|
-
isMonthOpen && !isMobile3 && /* @__PURE__ */
|
|
16569
|
+
isMonthOpen && !isMobile3 && /* @__PURE__ */ jsx172("div", { className: "absolute left-0 right-0 top-full z-30 mx-auto mt-1 w-full max-w-[260px] overflow-hidden rounded-md bg-white shadow-[0_30px_30px_0_rgba(33,72,255,0.2)] sm:left-1/2 sm:right-auto sm:-translate-x-1/2", children: monthPanelContent })
|
|
16527
16570
|
] }),
|
|
16528
|
-
isMobile3 && /* @__PURE__ */
|
|
16571
|
+
isMobile3 && /* @__PURE__ */ jsx172(
|
|
16529
16572
|
AirbnbDatePickerContent,
|
|
16530
16573
|
{
|
|
16531
16574
|
baseId: wheelBaseId,
|
|
@@ -16553,9 +16596,9 @@ var Datepicker = React62.forwardRef(
|
|
|
16553
16596
|
onOptionSelect: wheel.handleOptionSelect
|
|
16554
16597
|
}
|
|
16555
16598
|
),
|
|
16556
|
-
!error && optional && /* @__PURE__ */
|
|
16557
|
-
!error && helperText && /* @__PURE__ */
|
|
16558
|
-
error && !hideErrorMessage && /* @__PURE__ */
|
|
16599
|
+
!error && optional && /* @__PURE__ */ jsx172("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
16600
|
+
!error && helperText && /* @__PURE__ */ jsx172("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
16601
|
+
error && !hideErrorMessage && /* @__PURE__ */ jsx172(
|
|
16559
16602
|
FieldErrorMessage,
|
|
16560
16603
|
{
|
|
16561
16604
|
id: errorId,
|
|
@@ -16570,7 +16613,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16570
16613
|
);
|
|
16571
16614
|
|
|
16572
16615
|
// src/dashboard/date-range-picker/DateRangePicker.tsx
|
|
16573
|
-
import * as
|
|
16616
|
+
import * as React67 from "react";
|
|
16574
16617
|
import { useTranslation as useTranslation39 } from "react-i18next";
|
|
16575
16618
|
|
|
16576
16619
|
// src/dashboard/date-range-picker/isDayBlocked.ts
|
|
@@ -16649,7 +16692,7 @@ var createDisabledMatchers = ({
|
|
|
16649
16692
|
};
|
|
16650
16693
|
|
|
16651
16694
|
// src/dashboard/date-range-picker/hooks/useRangeValue.ts
|
|
16652
|
-
import * as
|
|
16695
|
+
import * as React64 from "react";
|
|
16653
16696
|
var getRangeKey = (range) => `${range?.from?.getTime() ?? ""}-${range?.to?.getTime() ?? ""}`;
|
|
16654
16697
|
function useRangeValue({
|
|
16655
16698
|
value: externalValue,
|
|
@@ -16658,10 +16701,10 @@ function useRangeValue({
|
|
|
16658
16701
|
name
|
|
16659
16702
|
}) {
|
|
16660
16703
|
const isControlled = externalValue !== void 0;
|
|
16661
|
-
const [draft, setDraft] =
|
|
16704
|
+
const [draft, setDraft] = React64.useState(
|
|
16662
16705
|
isControlled ? externalValue : defaultValue
|
|
16663
16706
|
);
|
|
16664
|
-
const lastExternalKeyRef =
|
|
16707
|
+
const lastExternalKeyRef = React64.useRef(getRangeKey(externalValue));
|
|
16665
16708
|
if (isControlled) {
|
|
16666
16709
|
const externalKey = getRangeKey(externalValue);
|
|
16667
16710
|
if (externalKey !== lastExternalKeyRef.current) {
|
|
@@ -16669,7 +16712,7 @@ function useRangeValue({
|
|
|
16669
16712
|
setDraft(externalValue);
|
|
16670
16713
|
}
|
|
16671
16714
|
}
|
|
16672
|
-
const commit =
|
|
16715
|
+
const commit = React64.useCallback(
|
|
16673
16716
|
(next) => {
|
|
16674
16717
|
setDraft(next);
|
|
16675
16718
|
if (next === void 0) {
|
|
@@ -16684,7 +16727,7 @@ function useRangeValue({
|
|
|
16684
16727
|
}
|
|
16685
16728
|
|
|
16686
16729
|
// src/dashboard/date-range-picker/hooks/useRangeTextInputs.ts
|
|
16687
|
-
import * as
|
|
16730
|
+
import * as React65 from "react";
|
|
16688
16731
|
|
|
16689
16732
|
// src/dashboard/date-range-picker/utils/inputFormat.ts
|
|
16690
16733
|
function parseDateInputFormat(format2) {
|
|
@@ -16774,18 +16817,18 @@ function useRangeTextInputs({
|
|
|
16774
16817
|
onFromComplete,
|
|
16775
16818
|
onToComplete
|
|
16776
16819
|
}) {
|
|
16777
|
-
const tokens =
|
|
16820
|
+
const tokens = React65.useMemo(
|
|
16778
16821
|
() => parseDateInputFormat(displayFormat),
|
|
16779
16822
|
[displayFormat]
|
|
16780
16823
|
);
|
|
16781
|
-
const maxDigits =
|
|
16782
|
-
const [fromText, setFromText] =
|
|
16783
|
-
const [toText, setToText] =
|
|
16784
|
-
|
|
16824
|
+
const maxDigits = React65.useMemo(() => getMaxDigits(tokens), [tokens]);
|
|
16825
|
+
const [fromText, setFromText] = React65.useState(value?.from ? format2(value.from) : "");
|
|
16826
|
+
const [toText, setToText] = React65.useState(value?.to ? format2(value.to) : "");
|
|
16827
|
+
React65.useEffect(() => {
|
|
16785
16828
|
setFromText(value?.from ? format2(value.from) : "");
|
|
16786
16829
|
setToText(value?.to ? format2(value.to) : "");
|
|
16787
16830
|
}, [format2, value?.from, value?.to]);
|
|
16788
|
-
const handleFromChange =
|
|
16831
|
+
const handleFromChange = React65.useCallback(
|
|
16789
16832
|
(raw) => {
|
|
16790
16833
|
const formatted = autoFormatDateInput(raw, tokens);
|
|
16791
16834
|
const wasComplete = countDigits(fromText) === maxDigits;
|
|
@@ -16797,7 +16840,7 @@ function useRangeTextInputs({
|
|
|
16797
16840
|
},
|
|
16798
16841
|
[fromText, maxDigits, onFromComplete, parse3, tokens]
|
|
16799
16842
|
);
|
|
16800
|
-
const handleToChange =
|
|
16843
|
+
const handleToChange = React65.useCallback(
|
|
16801
16844
|
(raw) => {
|
|
16802
16845
|
const formatted = autoFormatDateInput(raw, tokens);
|
|
16803
16846
|
const wasComplete = countDigits(toText) === maxDigits;
|
|
@@ -16809,7 +16852,7 @@ function useRangeTextInputs({
|
|
|
16809
16852
|
},
|
|
16810
16853
|
[maxDigits, onToComplete, parse3, toText, tokens]
|
|
16811
16854
|
);
|
|
16812
|
-
const handleFromBlur =
|
|
16855
|
+
const handleFromBlur = React65.useCallback(() => {
|
|
16813
16856
|
if (!fromText) {
|
|
16814
16857
|
const next = { from: void 0, to: value?.to };
|
|
16815
16858
|
onCommit(next);
|
|
@@ -16826,7 +16869,7 @@ function useRangeTextInputs({
|
|
|
16826
16869
|
setFromText(value?.from ? format2(value.from) : "");
|
|
16827
16870
|
return void 0;
|
|
16828
16871
|
}, [format2, fromText, onBlur, onCommit, parse3, value]);
|
|
16829
|
-
const handleToBlur =
|
|
16872
|
+
const handleToBlur = React65.useCallback(() => {
|
|
16830
16873
|
if (!toText) {
|
|
16831
16874
|
const next = { from: value?.from, to: void 0 };
|
|
16832
16875
|
onCommit(next);
|
|
@@ -16855,21 +16898,21 @@ function useRangeTextInputs({
|
|
|
16855
16898
|
}
|
|
16856
16899
|
|
|
16857
16900
|
// src/dashboard/date-range-picker/hooks/useRangeMonthSync.ts
|
|
16858
|
-
import * as
|
|
16901
|
+
import * as React66 from "react";
|
|
16859
16902
|
function useRangeMonthSync(value) {
|
|
16860
|
-
const isPreloadedRef =
|
|
16861
|
-
const [month, setMonth] =
|
|
16862
|
-
|
|
16903
|
+
const isPreloadedRef = React66.useRef(false);
|
|
16904
|
+
const [month, setMonth] = React66.useState(value?.from ?? /* @__PURE__ */ new Date());
|
|
16905
|
+
React66.useEffect(() => {
|
|
16863
16906
|
if (value?.from && !isPreloadedRef.current) {
|
|
16864
16907
|
setMonth(value.from);
|
|
16865
16908
|
isPreloadedRef.current = true;
|
|
16866
16909
|
}
|
|
16867
16910
|
}, [value?.from]);
|
|
16868
|
-
const syncMonthToValue =
|
|
16911
|
+
const syncMonthToValue = React66.useCallback((next) => {
|
|
16869
16912
|
isPreloadedRef.current = true;
|
|
16870
16913
|
if (next?.from) setMonth(next.from);
|
|
16871
16914
|
}, []);
|
|
16872
|
-
const resetPreload =
|
|
16915
|
+
const resetPreload = React66.useCallback(() => {
|
|
16873
16916
|
isPreloadedRef.current = false;
|
|
16874
16917
|
}, []);
|
|
16875
16918
|
return { month, setMonth, syncMonthToValue, resetPreload };
|
|
@@ -16895,7 +16938,7 @@ function resolveRangeSelection({
|
|
|
16895
16938
|
|
|
16896
16939
|
// src/dashboard/date-range-picker/components/DateRangeInputs.tsx
|
|
16897
16940
|
import { CalendarDays, SquareX as SquareX4 } from "lucide-react";
|
|
16898
|
-
import { jsx as
|
|
16941
|
+
import { jsx as jsx173, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
16899
16942
|
var DEFAULT_PLACEHOLDER = "00-00-0000";
|
|
16900
16943
|
var inputBaseClass = "m-0 box-border h-full w-full min-w-0 border-0 bg-transparent text-[16px] font-medium leading-5 text-[var(--chekin-color-brand-navy)] outline-none placeholder:text-[var(--chekin-color-gray-1)]";
|
|
16901
16944
|
var iconButtonClass = "flex h-5 w-5 items-center justify-center rounded-[3px] border-0 bg-transparent p-0 text-[#9696b9] outline-none hover:shadow-[0_3px_3px_#0f477734] disabled:cursor-not-allowed";
|
|
@@ -16946,7 +16989,7 @@ function DateRangeInputs({
|
|
|
16946
16989
|
),
|
|
16947
16990
|
onClick: onRowClick,
|
|
16948
16991
|
children: [
|
|
16949
|
-
/* @__PURE__ */
|
|
16992
|
+
/* @__PURE__ */ jsx173(
|
|
16950
16993
|
"input",
|
|
16951
16994
|
{
|
|
16952
16995
|
ref: fromInputRef,
|
|
@@ -16971,7 +17014,7 @@ function DateRangeInputs({
|
|
|
16971
17014
|
)
|
|
16972
17015
|
}
|
|
16973
17016
|
),
|
|
16974
|
-
/* @__PURE__ */
|
|
17017
|
+
/* @__PURE__ */ jsx173(
|
|
16975
17018
|
"span",
|
|
16976
17019
|
{
|
|
16977
17020
|
"aria-hidden": "true",
|
|
@@ -16982,7 +17025,7 @@ function DateRangeInputs({
|
|
|
16982
17025
|
children: "\u2192"
|
|
16983
17026
|
}
|
|
16984
17027
|
),
|
|
16985
|
-
/* @__PURE__ */
|
|
17028
|
+
/* @__PURE__ */ jsx173(
|
|
16986
17029
|
"input",
|
|
16987
17030
|
{
|
|
16988
17031
|
ref: toInputRef,
|
|
@@ -17008,7 +17051,7 @@ function DateRangeInputs({
|
|
|
17008
17051
|
}
|
|
17009
17052
|
),
|
|
17010
17053
|
/* @__PURE__ */ jsxs109("span", { className: "ml-auto flex shrink-0 items-center gap-2 pl-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
17011
|
-
!readOnly && !hideClearDates && !isEmpty && /* @__PURE__ */
|
|
17054
|
+
!readOnly && !hideClearDates && !isEmpty && /* @__PURE__ */ jsx173(
|
|
17012
17055
|
"button",
|
|
17013
17056
|
{
|
|
17014
17057
|
type: "button",
|
|
@@ -17016,10 +17059,10 @@ function DateRangeInputs({
|
|
|
17016
17059
|
onClick: onReset,
|
|
17017
17060
|
className: iconButtonClass,
|
|
17018
17061
|
"aria-label": clearLabel,
|
|
17019
|
-
children: /* @__PURE__ */
|
|
17062
|
+
children: /* @__PURE__ */ jsx173(SquareX4, { size: 16, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
17020
17063
|
}
|
|
17021
17064
|
),
|
|
17022
|
-
!readOnly && !hideCalendarIcon && /* @__PURE__ */
|
|
17065
|
+
!readOnly && !hideCalendarIcon && /* @__PURE__ */ jsx173(
|
|
17023
17066
|
"button",
|
|
17024
17067
|
{
|
|
17025
17068
|
type: "button",
|
|
@@ -17031,7 +17074,7 @@ function DateRangeInputs({
|
|
|
17031
17074
|
focusedInput !== null || isOpen ? "text-[var(--chekin-color-brand-blue)]" : "text-[var(--chekin-color-gray-2)]"
|
|
17032
17075
|
),
|
|
17033
17076
|
"aria-label": openCalendarLabel,
|
|
17034
|
-
children: /* @__PURE__ */
|
|
17077
|
+
children: /* @__PURE__ */ jsx173(CalendarDays, { size: 18 })
|
|
17035
17078
|
}
|
|
17036
17079
|
)
|
|
17037
17080
|
] })
|
|
@@ -17041,7 +17084,7 @@ function DateRangeInputs({
|
|
|
17041
17084
|
}
|
|
17042
17085
|
|
|
17043
17086
|
// src/dashboard/date-range-picker/components/DateRangeCalendar.tsx
|
|
17044
|
-
import { jsx as
|
|
17087
|
+
import { jsx as jsx174 } from "react/jsx-runtime";
|
|
17045
17088
|
function DateRangeCalendar({
|
|
17046
17089
|
value,
|
|
17047
17090
|
month,
|
|
@@ -17057,7 +17100,7 @@ function DateRangeCalendar({
|
|
|
17057
17100
|
components,
|
|
17058
17101
|
...dayPickerProps
|
|
17059
17102
|
}) {
|
|
17060
|
-
return /* @__PURE__ */
|
|
17103
|
+
return /* @__PURE__ */ jsx174(
|
|
17061
17104
|
Calendar,
|
|
17062
17105
|
{
|
|
17063
17106
|
mode: "range",
|
|
@@ -17080,7 +17123,7 @@ function DateRangeCalendar({
|
|
|
17080
17123
|
}
|
|
17081
17124
|
|
|
17082
17125
|
// src/dashboard/date-range-picker/components/DateRangePopover.tsx
|
|
17083
|
-
import { jsx as
|
|
17126
|
+
import { jsx as jsx175, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
17084
17127
|
function DateRangePopover({
|
|
17085
17128
|
isOpen,
|
|
17086
17129
|
isMobile: isMobile3,
|
|
@@ -17092,7 +17135,7 @@ function DateRangePopover({
|
|
|
17092
17135
|
}) {
|
|
17093
17136
|
if (!isOpen) return null;
|
|
17094
17137
|
if (isMobile3) {
|
|
17095
|
-
return /* @__PURE__ */
|
|
17138
|
+
return /* @__PURE__ */ jsx175(
|
|
17096
17139
|
Drawer,
|
|
17097
17140
|
{
|
|
17098
17141
|
open: isOpen,
|
|
@@ -17106,16 +17149,16 @@ function DateRangePopover({
|
|
|
17106
17149
|
lockScroll: false,
|
|
17107
17150
|
className: "max-h-[calc(100vh-1rem)]",
|
|
17108
17151
|
children: [
|
|
17109
|
-
/* @__PURE__ */
|
|
17110
|
-
/* @__PURE__ */
|
|
17111
|
-
/* @__PURE__ */
|
|
17152
|
+
/* @__PURE__ */ jsx175(DrawerTitle, { className: "sr-only", children: drawerTitle }),
|
|
17153
|
+
/* @__PURE__ */ jsx175(DrawerDescription, { className: "sr-only", children: drawerDescription }),
|
|
17154
|
+
/* @__PURE__ */ jsx175("div", { className: "flex items-start justify-center overflow-x-auto px-2 pb-4 pt-1", children })
|
|
17112
17155
|
]
|
|
17113
17156
|
}
|
|
17114
17157
|
)
|
|
17115
17158
|
}
|
|
17116
17159
|
);
|
|
17117
17160
|
}
|
|
17118
|
-
return /* @__PURE__ */
|
|
17161
|
+
return /* @__PURE__ */ jsx175(
|
|
17119
17162
|
"div",
|
|
17120
17163
|
{
|
|
17121
17164
|
className: cn(
|
|
@@ -17128,8 +17171,8 @@ function DateRangePopover({
|
|
|
17128
17171
|
}
|
|
17129
17172
|
|
|
17130
17173
|
// src/dashboard/date-range-picker/DateRangePicker.tsx
|
|
17131
|
-
import { jsx as
|
|
17132
|
-
var DateRangePicker =
|
|
17174
|
+
import { jsx as jsx176, jsxs as jsxs111 } from "react/jsx-runtime";
|
|
17175
|
+
var DateRangePicker = React67.forwardRef(function DateRangePicker2({
|
|
17133
17176
|
label,
|
|
17134
17177
|
value: externalValue,
|
|
17135
17178
|
defaultValue,
|
|
@@ -17164,20 +17207,20 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17164
17207
|
components: customComponents,
|
|
17165
17208
|
...dayPickerProps
|
|
17166
17209
|
}, ref) {
|
|
17167
|
-
const containerRef =
|
|
17168
|
-
const fromInputRef =
|
|
17169
|
-
const toInputRef =
|
|
17170
|
-
const reactId =
|
|
17210
|
+
const containerRef = React67.useRef(null);
|
|
17211
|
+
const fromInputRef = React67.useRef(null);
|
|
17212
|
+
const toInputRef = React67.useRef(null);
|
|
17213
|
+
const reactId = React67.useId();
|
|
17171
17214
|
const baseId = name ?? `dash-daterange-${reactId}`;
|
|
17172
17215
|
const fromId = `${baseId}-from`;
|
|
17173
17216
|
const toId = `${baseId}-to`;
|
|
17174
17217
|
const labelId = `${baseId}-label`;
|
|
17175
17218
|
const errorId = `${baseId}-error`;
|
|
17176
|
-
const normalizedValue =
|
|
17219
|
+
const normalizedValue = React67.useMemo(() => {
|
|
17177
17220
|
if (externalValue === void 0) return void 0;
|
|
17178
17221
|
return { from: toDate(externalValue?.from), to: toDate(externalValue?.to) };
|
|
17179
17222
|
}, [externalValue]);
|
|
17180
|
-
const normalizedDefaultValue =
|
|
17223
|
+
const normalizedDefaultValue = React67.useMemo(() => {
|
|
17181
17224
|
if (defaultValue === void 0) return void 0;
|
|
17182
17225
|
return { from: toDate(defaultValue?.from), to: toDate(defaultValue?.to) };
|
|
17183
17226
|
}, [defaultValue]);
|
|
@@ -17187,16 +17230,16 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17187
17230
|
onChange,
|
|
17188
17231
|
name
|
|
17189
17232
|
});
|
|
17190
|
-
const normalizedMinDate =
|
|
17191
|
-
const normalizedMaxDate =
|
|
17192
|
-
const formatter =
|
|
17193
|
-
const parser =
|
|
17194
|
-
const closeCalendarRef =
|
|
17233
|
+
const normalizedMinDate = React67.useMemo(() => toDate(minDate), [minDate]);
|
|
17234
|
+
const normalizedMaxDate = React67.useMemo(() => toDate(maxDate), [maxDate]);
|
|
17235
|
+
const formatter = React67.useMemo(() => formatDate(displayFormat), [displayFormat]);
|
|
17236
|
+
const parser = React67.useMemo(() => parseDate(displayFormat), [displayFormat]);
|
|
17237
|
+
const closeCalendarRef = React67.useRef(() => {
|
|
17195
17238
|
});
|
|
17196
|
-
const handleFromComplete =
|
|
17239
|
+
const handleFromComplete = React67.useCallback(() => {
|
|
17197
17240
|
toInputRef.current?.focus();
|
|
17198
17241
|
}, []);
|
|
17199
|
-
const handleToComplete =
|
|
17242
|
+
const handleToComplete = React67.useCallback(() => {
|
|
17200
17243
|
toInputRef.current?.blur();
|
|
17201
17244
|
closeCalendarRef.current();
|
|
17202
17245
|
}, []);
|
|
@@ -17220,9 +17263,9 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17220
17263
|
onToComplete: handleToComplete
|
|
17221
17264
|
});
|
|
17222
17265
|
const { month, setMonth, syncMonthToValue } = useRangeMonthSync(value);
|
|
17223
|
-
const [isOpen, setIsOpen] =
|
|
17224
|
-
const [focusedInput, setFocusedInput] =
|
|
17225
|
-
const [autoFocus, setAutoFocus] =
|
|
17266
|
+
const [isOpen, setIsOpen] = React67.useState(false);
|
|
17267
|
+
const [focusedInput, setFocusedInput] = React67.useState(null);
|
|
17268
|
+
const [autoFocus, setAutoFocus] = React67.useState(false);
|
|
17226
17269
|
const isMobile3 = useIsMobile();
|
|
17227
17270
|
const { t } = useTranslation39();
|
|
17228
17271
|
const drawerTitle = label ?? t("select_dates");
|
|
@@ -17233,14 +17276,14 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17233
17276
|
const isFocused = focusedInput !== null || isOpen;
|
|
17234
17277
|
const wrapperWidth = toCssSize(width);
|
|
17235
17278
|
const monthsToShow = numberOfMonths ?? (isMobile3 ? 1 : 2);
|
|
17236
|
-
const closeCalendar =
|
|
17279
|
+
const closeCalendar = React67.useCallback(() => {
|
|
17237
17280
|
setIsOpen(false);
|
|
17238
17281
|
setFocusedInput(null);
|
|
17239
17282
|
setAutoFocus(false);
|
|
17240
17283
|
if (value?.from) setMonth(value.from);
|
|
17241
17284
|
}, [setMonth, value?.from]);
|
|
17242
17285
|
closeCalendarRef.current = closeCalendar;
|
|
17243
|
-
const openCalendar =
|
|
17286
|
+
const openCalendar = React67.useCallback(() => {
|
|
17244
17287
|
if (isBlocked || readOnly) return;
|
|
17245
17288
|
setIsOpen(true);
|
|
17246
17289
|
}, [isBlocked, readOnly]);
|
|
@@ -17249,7 +17292,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17249
17292
|
onOutsideClick: closeCalendar,
|
|
17250
17293
|
isDisabled: !isOpen || isMobile3
|
|
17251
17294
|
});
|
|
17252
|
-
const handlePickerChange =
|
|
17295
|
+
const handlePickerChange = React67.useCallback(
|
|
17253
17296
|
(range, pickedDate) => {
|
|
17254
17297
|
const { next, shouldClose } = resolveRangeSelection({
|
|
17255
17298
|
previous: value,
|
|
@@ -17270,7 +17313,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17270
17313
|
setToText("");
|
|
17271
17314
|
setMonth(/* @__PURE__ */ new Date());
|
|
17272
17315
|
};
|
|
17273
|
-
const disabledMatchers =
|
|
17316
|
+
const disabledMatchers = React67.useMemo(
|
|
17274
17317
|
() => createDisabledMatchers({
|
|
17275
17318
|
minDate: normalizedMinDate,
|
|
17276
17319
|
maxDate: normalizedMaxDate,
|
|
@@ -17289,7 +17332,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17289
17332
|
openCalendar();
|
|
17290
17333
|
if (autoFocusOnOpen) setAutoFocus(true);
|
|
17291
17334
|
};
|
|
17292
|
-
|
|
17335
|
+
React67.useImperativeHandle(
|
|
17293
17336
|
ref,
|
|
17294
17337
|
() => ({
|
|
17295
17338
|
setDateRange: (range) => {
|
|
@@ -17312,7 +17355,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17312
17355
|
syncMonthToValue
|
|
17313
17356
|
]
|
|
17314
17357
|
);
|
|
17315
|
-
return /* @__PURE__ */
|
|
17358
|
+
return /* @__PURE__ */ jsx176(
|
|
17316
17359
|
"div",
|
|
17317
17360
|
{
|
|
17318
17361
|
ref: containerRef,
|
|
@@ -17325,7 +17368,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17325
17368
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
17326
17369
|
children: /* @__PURE__ */ jsxs111("div", { className: "relative min-h-[var(--field-min-height,48px)] w-full", children: [
|
|
17327
17370
|
/* @__PURE__ */ jsxs111("div", { className: "relative w-full", children: [
|
|
17328
|
-
/* @__PURE__ */
|
|
17371
|
+
/* @__PURE__ */ jsx176(
|
|
17329
17372
|
DateRangeInputs,
|
|
17330
17373
|
{
|
|
17331
17374
|
fromId,
|
|
@@ -17378,7 +17421,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17378
17421
|
onToggleCalendar: toggleCalendar
|
|
17379
17422
|
}
|
|
17380
17423
|
),
|
|
17381
|
-
/* @__PURE__ */
|
|
17424
|
+
/* @__PURE__ */ jsx176(
|
|
17382
17425
|
Fieldset,
|
|
17383
17426
|
{
|
|
17384
17427
|
isFocused,
|
|
@@ -17395,7 +17438,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17395
17438
|
tooltip
|
|
17396
17439
|
}
|
|
17397
17440
|
),
|
|
17398
|
-
/* @__PURE__ */
|
|
17441
|
+
/* @__PURE__ */ jsx176(
|
|
17399
17442
|
DateRangePopover,
|
|
17400
17443
|
{
|
|
17401
17444
|
isOpen: isOpen && !isMobile3,
|
|
@@ -17404,7 +17447,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17404
17447
|
drawerTitle,
|
|
17405
17448
|
drawerDescription,
|
|
17406
17449
|
onClose: closeCalendar,
|
|
17407
|
-
children: /* @__PURE__ */
|
|
17450
|
+
children: /* @__PURE__ */ jsx176(
|
|
17408
17451
|
DateRangeCalendar,
|
|
17409
17452
|
{
|
|
17410
17453
|
value,
|
|
@@ -17425,7 +17468,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17425
17468
|
}
|
|
17426
17469
|
)
|
|
17427
17470
|
] }),
|
|
17428
|
-
/* @__PURE__ */
|
|
17471
|
+
/* @__PURE__ */ jsx176(
|
|
17429
17472
|
DateRangePopover,
|
|
17430
17473
|
{
|
|
17431
17474
|
isOpen: isOpen && isMobile3,
|
|
@@ -17434,7 +17477,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17434
17477
|
drawerTitle,
|
|
17435
17478
|
drawerDescription,
|
|
17436
17479
|
onClose: closeCalendar,
|
|
17437
|
-
children: /* @__PURE__ */
|
|
17480
|
+
children: /* @__PURE__ */ jsx176(
|
|
17438
17481
|
DateRangeCalendar,
|
|
17439
17482
|
{
|
|
17440
17483
|
value,
|
|
@@ -17454,9 +17497,9 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17454
17497
|
)
|
|
17455
17498
|
}
|
|
17456
17499
|
),
|
|
17457
|
-
!error && optional && /* @__PURE__ */
|
|
17458
|
-
!error && helperText && /* @__PURE__ */
|
|
17459
|
-
error && !hideErrorMessage && /* @__PURE__ */
|
|
17500
|
+
!error && optional && /* @__PURE__ */ jsx176("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
17501
|
+
!error && helperText && /* @__PURE__ */ jsx176("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
17502
|
+
error && !hideErrorMessage && /* @__PURE__ */ jsx176(
|
|
17460
17503
|
FieldErrorMessage,
|
|
17461
17504
|
{
|
|
17462
17505
|
id: errorId,
|
|
@@ -17470,7 +17513,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17470
17513
|
});
|
|
17471
17514
|
|
|
17472
17515
|
// src/dashboard/date-range-picker/useValidateDates.ts
|
|
17473
|
-
import * as
|
|
17516
|
+
import * as React68 from "react";
|
|
17474
17517
|
import { useTranslation as useTranslation40 } from "react-i18next";
|
|
17475
17518
|
import { differenceInDays as differenceInDays2, isAfter as isAfter2, isBefore as isBefore3 } from "date-fns";
|
|
17476
17519
|
import {
|
|
@@ -17496,11 +17539,11 @@ function useValidateDates({
|
|
|
17496
17539
|
const { t } = useTranslation40();
|
|
17497
17540
|
const handleError = useEvent(onError);
|
|
17498
17541
|
const handleSuccess = useEvent(onSuccess);
|
|
17499
|
-
const errorFormatter =
|
|
17542
|
+
const errorFormatter = React68.useMemo(
|
|
17500
17543
|
() => formatDate(displayFormat ?? DEFAULT_DISPLAY_FORMAT),
|
|
17501
17544
|
[displayFormat]
|
|
17502
17545
|
);
|
|
17503
|
-
const validateDates =
|
|
17546
|
+
const validateDates = React68.useCallback(
|
|
17504
17547
|
(dates) => {
|
|
17505
17548
|
const startDate = dates?.from;
|
|
17506
17549
|
const endDate = dates?.to;
|
|
@@ -17550,9 +17593,9 @@ function useValidateDates({
|
|
|
17550
17593
|
}
|
|
17551
17594
|
|
|
17552
17595
|
// src/dashboard/time-picker/TimePicker.tsx
|
|
17553
|
-
import * as
|
|
17596
|
+
import * as React69 from "react";
|
|
17554
17597
|
import { addDays, addHours, addMinutes, format, parse as parse2 } from "date-fns";
|
|
17555
|
-
import { jsx as
|
|
17598
|
+
import { jsx as jsx177 } from "react/jsx-runtime";
|
|
17556
17599
|
var SHORT_TIME_FORMAT = "HH:mm";
|
|
17557
17600
|
function parseTime(value) {
|
|
17558
17601
|
return parse2(value, SHORT_TIME_FORMAT, /* @__PURE__ */ new Date());
|
|
@@ -17594,24 +17637,24 @@ var FORMAT_SETTINGS = {
|
|
|
17594
17637
|
},
|
|
17595
17638
|
hours: { interval_unit: "H", interval: 1, min_time: "00:00", max_time: "23:00" }
|
|
17596
17639
|
};
|
|
17597
|
-
var TimePicker =
|
|
17598
|
-
const resolvedOptions =
|
|
17640
|
+
var TimePicker = React69.forwardRef(function TimePicker2({ format: formatName = "time", timeSettings, options, ...selectProps }, ref) {
|
|
17641
|
+
const resolvedOptions = React69.useMemo(() => {
|
|
17599
17642
|
if (options) return options;
|
|
17600
17643
|
const settings = timeSettings ?? FORMAT_SETTINGS[formatName];
|
|
17601
17644
|
return buildOptions(settings);
|
|
17602
17645
|
}, [formatName, options, timeSettings]);
|
|
17603
|
-
return /* @__PURE__ */
|
|
17646
|
+
return /* @__PURE__ */ jsx177(Select, { ref, ...selectProps, options: resolvedOptions });
|
|
17604
17647
|
});
|
|
17605
17648
|
|
|
17606
17649
|
// src/dashboard/file-input/FileInput.tsx
|
|
17607
|
-
import * as
|
|
17650
|
+
import * as React70 from "react";
|
|
17608
17651
|
import { Download, Paperclip, SquareX as SquareX5 } from "lucide-react";
|
|
17609
17652
|
import { useTranslation as useTranslation41 } from "react-i18next";
|
|
17610
|
-
import { jsx as
|
|
17653
|
+
import { jsx as jsx178, jsxs as jsxs112 } from "react/jsx-runtime";
|
|
17611
17654
|
function defaultDownload(url) {
|
|
17612
17655
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
17613
17656
|
}
|
|
17614
|
-
var FileInput =
|
|
17657
|
+
var FileInput = React70.forwardRef(function FileInput2({
|
|
17615
17658
|
label,
|
|
17616
17659
|
value,
|
|
17617
17660
|
onChange,
|
|
@@ -17634,12 +17677,12 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
17634
17677
|
width,
|
|
17635
17678
|
downloadLabel
|
|
17636
17679
|
}, ref) {
|
|
17637
|
-
const internalRef =
|
|
17680
|
+
const internalRef = React70.useRef(null);
|
|
17638
17681
|
const inputRef = useCombinedRef(ref, internalRef);
|
|
17639
17682
|
const { t } = useTranslation41();
|
|
17640
17683
|
const resolvedLabel = label ?? t("upload_file");
|
|
17641
17684
|
const resolvedDownloadLabel = downloadLabel ?? t("download_attachment");
|
|
17642
|
-
const reactId =
|
|
17685
|
+
const reactId = React70.useId();
|
|
17643
17686
|
const inputId = `${name || "dash-file"}-${reactId}`;
|
|
17644
17687
|
const labelId = `${inputId}-label`;
|
|
17645
17688
|
const errorId = `${inputId}-error`;
|
|
@@ -17678,7 +17721,7 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
17678
17721
|
),
|
|
17679
17722
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
17680
17723
|
children: [
|
|
17681
|
-
/* @__PURE__ */
|
|
17724
|
+
/* @__PURE__ */ jsx178(
|
|
17682
17725
|
"input",
|
|
17683
17726
|
{
|
|
17684
17727
|
ref: inputRef,
|
|
@@ -17718,12 +17761,12 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
17718
17761
|
onClick: handleDownload,
|
|
17719
17762
|
className: "inline-flex items-center gap-[7px] truncate border-0 bg-transparent p-0 text-[14px] font-medium text-[var(--chekin-color-brand-navy)] outline-none",
|
|
17720
17763
|
children: [
|
|
17721
|
-
/* @__PURE__ */
|
|
17722
|
-
/* @__PURE__ */
|
|
17764
|
+
/* @__PURE__ */ jsx178("span", { className: "truncate", children: resolvedDownloadLabel }),
|
|
17765
|
+
/* @__PURE__ */ jsx178(Download, { size: 15 })
|
|
17723
17766
|
]
|
|
17724
17767
|
}
|
|
17725
|
-
) : /* @__PURE__ */
|
|
17726
|
-
/* @__PURE__ */
|
|
17768
|
+
) : /* @__PURE__ */ jsx178("span", { className: "truncate text-[14px] font-medium text-[var(--chekin-color-brand-navy)]", children: value.name }),
|
|
17769
|
+
/* @__PURE__ */ jsx178(
|
|
17727
17770
|
"button",
|
|
17728
17771
|
{
|
|
17729
17772
|
type: "button",
|
|
@@ -17731,17 +17774,17 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
17731
17774
|
onClick: handleClear,
|
|
17732
17775
|
className: "ml-2 flex h-[15px] w-[15px] items-center justify-center rounded-[3px] border-0 bg-transparent p-0 text-[#9696b9] outline-none hover:shadow-[0_3px_3px_#0f477734]",
|
|
17733
17776
|
"aria-label": t("remove_file"),
|
|
17734
|
-
children: /* @__PURE__ */
|
|
17777
|
+
children: /* @__PURE__ */ jsx178(SquareX5, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
17735
17778
|
}
|
|
17736
17779
|
)
|
|
17737
17780
|
]
|
|
17738
17781
|
}
|
|
17739
|
-
) : /* @__PURE__ */
|
|
17740
|
-
/* @__PURE__ */
|
|
17782
|
+
) : /* @__PURE__ */ jsx178("span", { className: "block min-w-0 flex-1 truncate text-left text-[var(--chekin-color-gray-1)]", children: placeholder ?? "" }),
|
|
17783
|
+
/* @__PURE__ */ jsx178("span", { className: "ml-auto flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ jsx178(Paperclip, { size: 20 }) })
|
|
17741
17784
|
]
|
|
17742
17785
|
}
|
|
17743
17786
|
),
|
|
17744
|
-
/* @__PURE__ */
|
|
17787
|
+
/* @__PURE__ */ jsx178(
|
|
17745
17788
|
Fieldset,
|
|
17746
17789
|
{
|
|
17747
17790
|
isFocused: false,
|
|
@@ -17759,9 +17802,9 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
17759
17802
|
}
|
|
17760
17803
|
)
|
|
17761
17804
|
] }),
|
|
17762
|
-
!error && optional && /* @__PURE__ */
|
|
17763
|
-
!error && helperText && /* @__PURE__ */
|
|
17764
|
-
error && !hideErrorMessage && /* @__PURE__ */
|
|
17805
|
+
!error && optional && /* @__PURE__ */ jsx178("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
17806
|
+
!error && helperText && /* @__PURE__ */ jsx178("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
17807
|
+
error && !hideErrorMessage && /* @__PURE__ */ jsx178(
|
|
17765
17808
|
FieldErrorMessage,
|
|
17766
17809
|
{
|
|
17767
17810
|
id: errorId,
|
|
@@ -17776,10 +17819,10 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
17776
17819
|
});
|
|
17777
17820
|
|
|
17778
17821
|
// src/dashboard/select-icons-box/SelectIconsBox.tsx
|
|
17779
|
-
import * as
|
|
17780
|
-
import { jsx as
|
|
17822
|
+
import * as React71 from "react";
|
|
17823
|
+
import { jsx as jsx179, jsxs as jsxs113 } from "react/jsx-runtime";
|
|
17781
17824
|
var FOCUSABLE_TRIGGER_SELECTOR2 = 'input:not([type="hidden"]):not([disabled]):not([readonly]), button:not([disabled])';
|
|
17782
|
-
var SelectIconsBox =
|
|
17825
|
+
var SelectIconsBox = React71.forwardRef(
|
|
17783
17826
|
function SelectIconsBox2({
|
|
17784
17827
|
children,
|
|
17785
17828
|
icons,
|
|
@@ -17795,10 +17838,10 @@ var SelectIconsBox = React70.forwardRef(
|
|
|
17795
17838
|
className,
|
|
17796
17839
|
boxClassName
|
|
17797
17840
|
}, ref) {
|
|
17798
|
-
const containerRef =
|
|
17841
|
+
const containerRef = React71.useRef(null);
|
|
17799
17842
|
const combinedContainerRef = useCombinedRef(containerRef, ref);
|
|
17800
17843
|
const isControlled = controlledOpen !== void 0;
|
|
17801
|
-
const [internalOpen, setInternalOpen] =
|
|
17844
|
+
const [internalOpen, setInternalOpen] = React71.useState(defaultOpen);
|
|
17802
17845
|
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
17803
17846
|
const setOpen = (next) => {
|
|
17804
17847
|
if (!isControlled) setInternalOpen(next);
|
|
@@ -17835,7 +17878,7 @@ var SelectIconsBox = React70.forwardRef(
|
|
|
17835
17878
|
className: cn("relative inline-block outline-none", className),
|
|
17836
17879
|
children: [
|
|
17837
17880
|
children,
|
|
17838
|
-
isOpen && /* @__PURE__ */
|
|
17881
|
+
isOpen && /* @__PURE__ */ jsx179(
|
|
17839
17882
|
"div",
|
|
17840
17883
|
{
|
|
17841
17884
|
className: cn(
|
|
@@ -17846,7 +17889,7 @@ var SelectIconsBox = React70.forwardRef(
|
|
|
17846
17889
|
boxClassName
|
|
17847
17890
|
),
|
|
17848
17891
|
style: { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` },
|
|
17849
|
-
children: icons.map((iconName) => /* @__PURE__ */
|
|
17892
|
+
children: icons.map((iconName) => /* @__PURE__ */ jsx179(
|
|
17850
17893
|
"button",
|
|
17851
17894
|
{
|
|
17852
17895
|
type: "button",
|
|
@@ -17929,14 +17972,14 @@ function getErrorMessage(error) {
|
|
|
17929
17972
|
|
|
17930
17973
|
// src/lib/toastResponseError.tsx
|
|
17931
17974
|
import i18next from "i18next";
|
|
17932
|
-
import { jsx as
|
|
17975
|
+
import { jsx as jsx180, jsxs as jsxs114 } from "react/jsx-runtime";
|
|
17933
17976
|
function addSupportEmailToMessage(message, prefixText) {
|
|
17934
17977
|
if (typeof message !== "string") {
|
|
17935
17978
|
return message;
|
|
17936
17979
|
}
|
|
17937
17980
|
const builtMessage = `${prefixText ? `${prefixText} ` : ""}${message}`;
|
|
17938
17981
|
return /* @__PURE__ */ jsxs114("div", { children: [
|
|
17939
|
-
/* @__PURE__ */
|
|
17982
|
+
/* @__PURE__ */ jsx180("div", { children: builtMessage }),
|
|
17940
17983
|
i18next.t("reach_us_at_email")
|
|
17941
17984
|
] });
|
|
17942
17985
|
}
|
|
@@ -17951,13 +17994,13 @@ function toastResponseError(error, options = {}) {
|
|
|
17951
17994
|
}
|
|
17952
17995
|
|
|
17953
17996
|
// src/legacy-fields/textarea/Textarea.tsx
|
|
17954
|
-
import { forwardRef as
|
|
17955
|
-
import { jsx as
|
|
17956
|
-
var LegacyTextarea =
|
|
17997
|
+
import { forwardRef as forwardRef73, useId as useId15 } from "react";
|
|
17998
|
+
import { jsx as jsx181, jsxs as jsxs115 } from "react/jsx-runtime";
|
|
17999
|
+
var LegacyTextarea = forwardRef73(
|
|
17957
18000
|
({ className, textareaClassName, label, disabled, name, invalid, ...textareaProps }, ref) => {
|
|
17958
18001
|
const inputId = useId15();
|
|
17959
18002
|
return /* @__PURE__ */ jsxs115("div", { className: cn("relative", className), children: [
|
|
17960
|
-
/* @__PURE__ */
|
|
18003
|
+
/* @__PURE__ */ jsx181(
|
|
17961
18004
|
"textarea",
|
|
17962
18005
|
{
|
|
17963
18006
|
ref,
|
|
@@ -17973,7 +18016,7 @@ var LegacyTextarea = forwardRef72(
|
|
|
17973
18016
|
...textareaProps
|
|
17974
18017
|
}
|
|
17975
18018
|
),
|
|
17976
|
-
label && /* @__PURE__ */
|
|
18019
|
+
label && /* @__PURE__ */ jsx181(
|
|
17977
18020
|
"label",
|
|
17978
18021
|
{
|
|
17979
18022
|
htmlFor: inputId,
|
|
@@ -17991,15 +18034,15 @@ var LegacyTextarea = forwardRef72(
|
|
|
17991
18034
|
LegacyTextarea.displayName = "LegacyTextarea";
|
|
17992
18035
|
|
|
17993
18036
|
// src/airbnb-fields/datepicker/DatePicker.tsx
|
|
17994
|
-
import * as
|
|
18037
|
+
import * as React73 from "react";
|
|
17995
18038
|
import { Calendar as Calendar2 } from "lucide-react";
|
|
17996
18039
|
|
|
17997
18040
|
// src/airbnb-fields/field-trigger/FieldTrigger.tsx
|
|
17998
|
-
import * as
|
|
18041
|
+
import * as React72 from "react";
|
|
17999
18042
|
import { Loader2 as Loader24 } from "lucide-react";
|
|
18000
18043
|
import { useTranslation as useTranslation42 } from "react-i18next";
|
|
18001
|
-
import { Fragment as Fragment17, jsx as
|
|
18002
|
-
var AirbnbFieldTrigger =
|
|
18044
|
+
import { Fragment as Fragment17, jsx as jsx182, jsxs as jsxs116 } from "react/jsx-runtime";
|
|
18045
|
+
var AirbnbFieldTrigger = React72.forwardRef(
|
|
18003
18046
|
({
|
|
18004
18047
|
as = "button",
|
|
18005
18048
|
id,
|
|
@@ -18036,13 +18079,13 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18036
18079
|
const visibleLabelText = labelText ?? label;
|
|
18037
18080
|
const hasLabelMeta = Boolean(optionalLabel) || Boolean(tooltip);
|
|
18038
18081
|
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */ jsxs116("span", { className: "inline-flex max-w-full items-center gap-1.5 align-middle", children: [
|
|
18039
|
-
/* @__PURE__ */
|
|
18082
|
+
/* @__PURE__ */ jsx182("span", { className: "min-w-0 truncate", children: visibleLabelText }),
|
|
18040
18083
|
optionalLabel && /* @__PURE__ */ jsxs116("span", { className: "text-current opacity-70 lowercase", children: [
|
|
18041
18084
|
"(",
|
|
18042
18085
|
optionalLabel,
|
|
18043
18086
|
")"
|
|
18044
18087
|
] }),
|
|
18045
|
-
tooltip && /* @__PURE__ */
|
|
18088
|
+
tooltip && /* @__PURE__ */ jsx182(
|
|
18046
18089
|
HelpTooltip,
|
|
18047
18090
|
{
|
|
18048
18091
|
content: tooltip,
|
|
@@ -18059,7 +18102,7 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18059
18102
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
18060
18103
|
const resolvedTrailingAdornment = loading || trailingAdornment ? /* @__PURE__ */ jsxs116("span", { className: "flex items-center gap-2", children: [
|
|
18061
18104
|
trailingAdornment,
|
|
18062
|
-
loading && /* @__PURE__ */
|
|
18105
|
+
loading && /* @__PURE__ */ jsx182(
|
|
18063
18106
|
Loader24,
|
|
18064
18107
|
{
|
|
18065
18108
|
"aria-hidden": "true",
|
|
@@ -18085,7 +18128,7 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18085
18128
|
contentClassName
|
|
18086
18129
|
),
|
|
18087
18130
|
children: [
|
|
18088
|
-
/* @__PURE__ */
|
|
18131
|
+
/* @__PURE__ */ jsx182(
|
|
18089
18132
|
"span",
|
|
18090
18133
|
{
|
|
18091
18134
|
id: labelId,
|
|
@@ -18098,7 +18141,7 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18098
18141
|
children: animatedLabel
|
|
18099
18142
|
}
|
|
18100
18143
|
),
|
|
18101
|
-
children ? children : hasValue ? /* @__PURE__ */
|
|
18144
|
+
children ? children : hasValue ? /* @__PURE__ */ jsx182(
|
|
18102
18145
|
"span",
|
|
18103
18146
|
{
|
|
18104
18147
|
id: valueId,
|
|
@@ -18109,11 +18152,11 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18109
18152
|
),
|
|
18110
18153
|
children: valueText
|
|
18111
18154
|
}
|
|
18112
|
-
) : /* @__PURE__ */
|
|
18155
|
+
) : /* @__PURE__ */ jsx182("span", { id: helperTextId, className: "sr-only", children: placeholder ?? label })
|
|
18113
18156
|
]
|
|
18114
18157
|
}
|
|
18115
18158
|
),
|
|
18116
|
-
resolvedTrailingAdornment && /* @__PURE__ */
|
|
18159
|
+
resolvedTrailingAdornment && /* @__PURE__ */ jsx182(
|
|
18117
18160
|
"span",
|
|
18118
18161
|
{
|
|
18119
18162
|
"aria-hidden": "true",
|
|
@@ -18123,8 +18166,8 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18123
18166
|
)
|
|
18124
18167
|
] });
|
|
18125
18168
|
return /* @__PURE__ */ jsxs116("div", { className: "w-full", children: [
|
|
18126
|
-
topLabel && /* @__PURE__ */
|
|
18127
|
-
as === "button" ? /* @__PURE__ */
|
|
18169
|
+
topLabel && /* @__PURE__ */ jsx182("p", { className: "mb-3 text-[16px] font-semibold leading-5 text-[#222222]", children: topLabel }),
|
|
18170
|
+
as === "button" ? /* @__PURE__ */ jsx182(
|
|
18128
18171
|
"button",
|
|
18129
18172
|
{
|
|
18130
18173
|
id,
|
|
@@ -18141,7 +18184,7 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18141
18184
|
...props,
|
|
18142
18185
|
children: sharedContent
|
|
18143
18186
|
}
|
|
18144
|
-
) : /* @__PURE__ */
|
|
18187
|
+
) : /* @__PURE__ */ jsx182(
|
|
18145
18188
|
"div",
|
|
18146
18189
|
{
|
|
18147
18190
|
id,
|
|
@@ -18158,16 +18201,16 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18158
18201
|
children: sharedContent
|
|
18159
18202
|
}
|
|
18160
18203
|
),
|
|
18161
|
-
errorMessage && !hideErrorMessage && /* @__PURE__ */
|
|
18204
|
+
errorMessage && !hideErrorMessage && /* @__PURE__ */ jsx182(FieldErrorMessage, { id: errorId, message: errorMessage })
|
|
18162
18205
|
] });
|
|
18163
18206
|
}
|
|
18164
18207
|
);
|
|
18165
18208
|
AirbnbFieldTrigger.displayName = "AirbnbFieldTrigger";
|
|
18166
18209
|
|
|
18167
18210
|
// src/airbnb-fields/datepicker/DatePicker.tsx
|
|
18168
|
-
import { jsx as
|
|
18211
|
+
import { jsx as jsx183, jsxs as jsxs117 } from "react/jsx-runtime";
|
|
18169
18212
|
var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
|
|
18170
|
-
var AirbnbDatePicker =
|
|
18213
|
+
var AirbnbDatePicker = React73.forwardRef(
|
|
18171
18214
|
({
|
|
18172
18215
|
label,
|
|
18173
18216
|
topLabel,
|
|
@@ -18192,24 +18235,24 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18192
18235
|
formatValue = formatDateValue
|
|
18193
18236
|
}, ref) => {
|
|
18194
18237
|
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
18195
|
-
const [isOpen, setIsOpen] =
|
|
18196
|
-
const triggerId =
|
|
18197
|
-
const pickerId =
|
|
18198
|
-
const labelId =
|
|
18199
|
-
const valueId =
|
|
18200
|
-
const helperTextId =
|
|
18201
|
-
const errorId =
|
|
18202
|
-
const internalRef =
|
|
18238
|
+
const [isOpen, setIsOpen] = React73.useState(false);
|
|
18239
|
+
const triggerId = React73.useId();
|
|
18240
|
+
const pickerId = React73.useId();
|
|
18241
|
+
const labelId = React73.useId();
|
|
18242
|
+
const valueId = React73.useId();
|
|
18243
|
+
const helperTextId = React73.useId();
|
|
18244
|
+
const errorId = React73.useId();
|
|
18245
|
+
const internalRef = React73.useRef(null);
|
|
18203
18246
|
const combinedRef = useCombinedRef(ref, internalRef);
|
|
18204
|
-
const monthLabels =
|
|
18205
|
-
const resolvedMinDate =
|
|
18206
|
-
const resolvedMaxDate =
|
|
18207
|
-
const normalizedValue =
|
|
18208
|
-
const normalizedDefaultValue =
|
|
18247
|
+
const monthLabels = React73.useMemo(() => getMonthLabels(locale), [locale]);
|
|
18248
|
+
const resolvedMinDate = React73.useMemo(() => minDate ?? DEFAULT_MIN_DATE, [minDate]);
|
|
18249
|
+
const resolvedMaxDate = React73.useMemo(() => maxDate ?? /* @__PURE__ */ new Date(), [maxDate]);
|
|
18250
|
+
const normalizedValue = React73.useMemo(() => normalizeDateValue(value), [value]);
|
|
18251
|
+
const normalizedDefaultValue = React73.useMemo(
|
|
18209
18252
|
() => normalizeDateValue(defaultValue),
|
|
18210
18253
|
[defaultValue]
|
|
18211
18254
|
);
|
|
18212
|
-
const resolvedValue =
|
|
18255
|
+
const resolvedValue = React73.useMemo(
|
|
18213
18256
|
() => normalizedValue ? clampDate(normalizedValue, resolvedMinDate, resolvedMaxDate) : null,
|
|
18214
18257
|
[normalizedValue, resolvedMaxDate, resolvedMinDate]
|
|
18215
18258
|
);
|
|
@@ -18240,7 +18283,7 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18240
18283
|
minDate: resolvedMinDate,
|
|
18241
18284
|
maxDate: resolvedMaxDate
|
|
18242
18285
|
});
|
|
18243
|
-
const handleOpenChange =
|
|
18286
|
+
const handleOpenChange = React73.useCallback(
|
|
18244
18287
|
(nextOpen) => {
|
|
18245
18288
|
if (isBlocked && nextOpen) return;
|
|
18246
18289
|
setIsOpen(nextOpen);
|
|
@@ -18250,7 +18293,7 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18250
18293
|
},
|
|
18251
18294
|
[isBlocked]
|
|
18252
18295
|
);
|
|
18253
|
-
const handleDone =
|
|
18296
|
+
const handleDone = React73.useCallback(() => {
|
|
18254
18297
|
if (isBlocked) return;
|
|
18255
18298
|
onChange(clampDate(draftDate, resolvedMinDate, resolvedMaxDate));
|
|
18256
18299
|
handleOpenChange(false);
|
|
@@ -18262,11 +18305,11 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18262
18305
|
resolvedMaxDate,
|
|
18263
18306
|
resolvedMinDate
|
|
18264
18307
|
]);
|
|
18265
|
-
const handleTriggerClick =
|
|
18308
|
+
const handleTriggerClick = React73.useCallback(() => {
|
|
18266
18309
|
if (isBlocked) return;
|
|
18267
18310
|
setIsOpen(true);
|
|
18268
18311
|
}, [isBlocked]);
|
|
18269
|
-
const handleTriggerKeyDown =
|
|
18312
|
+
const handleTriggerKeyDown = React73.useCallback(
|
|
18270
18313
|
(event) => {
|
|
18271
18314
|
if (isBlocked) return;
|
|
18272
18315
|
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
@@ -18276,13 +18319,13 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18276
18319
|
},
|
|
18277
18320
|
[isBlocked]
|
|
18278
18321
|
);
|
|
18279
|
-
|
|
18322
|
+
React73.useEffect(() => {
|
|
18280
18323
|
if (isBlocked) {
|
|
18281
18324
|
setIsOpen(false);
|
|
18282
18325
|
}
|
|
18283
18326
|
}, [isBlocked]);
|
|
18284
18327
|
return /* @__PURE__ */ jsxs117("div", { className: cn("relative w-full max-w-[var(--max-field-width)]", className), children: [
|
|
18285
|
-
name && /* @__PURE__ */
|
|
18328
|
+
name && /* @__PURE__ */ jsx183(
|
|
18286
18329
|
"input",
|
|
18287
18330
|
{
|
|
18288
18331
|
type: "hidden",
|
|
@@ -18290,7 +18333,7 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18290
18333
|
value: resolvedValue ? formatDateInputValue(resolvedValue) : ""
|
|
18291
18334
|
}
|
|
18292
18335
|
),
|
|
18293
|
-
/* @__PURE__ */
|
|
18336
|
+
/* @__PURE__ */ jsx183(
|
|
18294
18337
|
AirbnbFieldTrigger,
|
|
18295
18338
|
{
|
|
18296
18339
|
id: triggerId,
|
|
@@ -18316,10 +18359,10 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18316
18359
|
onClick: handleTriggerClick,
|
|
18317
18360
|
onKeyDown: handleTriggerKeyDown,
|
|
18318
18361
|
onBlur,
|
|
18319
|
-
trailingAdornment: /* @__PURE__ */
|
|
18362
|
+
trailingAdornment: /* @__PURE__ */ jsx183(Calendar2, { className: "h-5 w-5 text-[#1F1F1B]", strokeWidth: 2 })
|
|
18320
18363
|
}
|
|
18321
18364
|
),
|
|
18322
|
-
/* @__PURE__ */
|
|
18365
|
+
/* @__PURE__ */ jsx183(
|
|
18323
18366
|
AirbnbDatePickerContent,
|
|
18324
18367
|
{
|
|
18325
18368
|
baseId: pickerId,
|
|
@@ -18353,12 +18396,12 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18353
18396
|
AirbnbDatePicker.displayName = "AirbnbDatePicker";
|
|
18354
18397
|
|
|
18355
18398
|
// src/airbnb-fields/input/Input.tsx
|
|
18356
|
-
import * as
|
|
18399
|
+
import * as React74 from "react";
|
|
18357
18400
|
import { Eye as Eye2 } from "lucide-react";
|
|
18358
18401
|
import { useTranslation as useTranslation43 } from "react-i18next";
|
|
18359
|
-
import { jsx as
|
|
18402
|
+
import { jsx as jsx184, jsxs as jsxs118 } from "react/jsx-runtime";
|
|
18360
18403
|
var getInputValue = (value) => value != null ? String(value) : "";
|
|
18361
|
-
var AirbnbInput =
|
|
18404
|
+
var AirbnbInput = React74.forwardRef(
|
|
18362
18405
|
({
|
|
18363
18406
|
label,
|
|
18364
18407
|
topLabel,
|
|
@@ -18387,16 +18430,16 @@ var AirbnbInput = React73.forwardRef(
|
|
|
18387
18430
|
...props
|
|
18388
18431
|
}, ref) => {
|
|
18389
18432
|
const { t } = useTranslation43();
|
|
18390
|
-
const generatedId =
|
|
18391
|
-
const inputRef =
|
|
18433
|
+
const generatedId = React74.useId();
|
|
18434
|
+
const inputRef = React74.useRef(null);
|
|
18392
18435
|
const inputId = id ?? generatedId;
|
|
18393
18436
|
const fieldId = `${inputId}-field`;
|
|
18394
18437
|
const labelId = `${inputId}-label`;
|
|
18395
18438
|
const errorId = `${inputId}-error`;
|
|
18396
18439
|
const accessibleLabel = placeholder ?? label;
|
|
18397
|
-
const [isFocused, setIsFocused] =
|
|
18398
|
-
const [isPasswordRevealed, setIsPasswordRevealed] =
|
|
18399
|
-
const [currentValue, setCurrentValue] =
|
|
18440
|
+
const [isFocused, setIsFocused] = React74.useState(false);
|
|
18441
|
+
const [isPasswordRevealed, setIsPasswordRevealed] = React74.useState(false);
|
|
18442
|
+
const [currentValue, setCurrentValue] = React74.useState(
|
|
18400
18443
|
() => value != null ? getInputValue(value) : getInputValue(defaultValue)
|
|
18401
18444
|
);
|
|
18402
18445
|
const resolvedValue = value != null ? getInputValue(value) : currentValue;
|
|
@@ -18409,16 +18452,16 @@ var AirbnbInput = React73.forwardRef(
|
|
|
18409
18452
|
const triggerError = error ?? invalid;
|
|
18410
18453
|
const hasLabelMeta = Boolean(optional) || Boolean(tooltip);
|
|
18411
18454
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
18412
|
-
|
|
18455
|
+
React74.useLayoutEffect(() => {
|
|
18413
18456
|
const nextValue = value != null ? getInputValue(value) : getInputValue(inputRef.current?.value);
|
|
18414
18457
|
setCurrentValue((prevValue) => prevValue === nextValue ? prevValue : nextValue);
|
|
18415
18458
|
}, [value]);
|
|
18416
|
-
|
|
18459
|
+
React74.useEffect(() => {
|
|
18417
18460
|
if (!isPasswordInput) {
|
|
18418
18461
|
setIsPasswordRevealed(false);
|
|
18419
18462
|
}
|
|
18420
18463
|
}, [isPasswordInput]);
|
|
18421
|
-
const setRefs =
|
|
18464
|
+
const setRefs = React74.useCallback(
|
|
18422
18465
|
(node) => {
|
|
18423
18466
|
inputRef.current = node;
|
|
18424
18467
|
if (node && value == null) {
|
|
@@ -18451,7 +18494,7 @@ var AirbnbInput = React73.forwardRef(
|
|
|
18451
18494
|
const togglePasswordReveal = () => {
|
|
18452
18495
|
setIsPasswordRevealed((isRevealed) => !isRevealed);
|
|
18453
18496
|
};
|
|
18454
|
-
return /* @__PURE__ */
|
|
18497
|
+
return /* @__PURE__ */ jsx184("div", { className: cn("w-full max-w-[var(--max-field-width)]", wrapperClassName), children: /* @__PURE__ */ jsxs118(
|
|
18455
18498
|
AirbnbFieldTrigger,
|
|
18456
18499
|
{
|
|
18457
18500
|
as: "div",
|
|
@@ -18480,7 +18523,7 @@ var AirbnbInput = React73.forwardRef(
|
|
|
18480
18523
|
forceLabelText: hasLabelMeta,
|
|
18481
18524
|
hideErrorMessage: !renderErrorMessage,
|
|
18482
18525
|
children: [
|
|
18483
|
-
/* @__PURE__ */
|
|
18526
|
+
/* @__PURE__ */ jsx184(
|
|
18484
18527
|
"input",
|
|
18485
18528
|
{
|
|
18486
18529
|
...props,
|
|
@@ -18510,7 +18553,7 @@ var AirbnbInput = React73.forwardRef(
|
|
|
18510
18553
|
)
|
|
18511
18554
|
}
|
|
18512
18555
|
),
|
|
18513
|
-
shouldShowPasswordReveal && /* @__PURE__ */
|
|
18556
|
+
shouldShowPasswordReveal && /* @__PURE__ */ jsx184(
|
|
18514
18557
|
"button",
|
|
18515
18558
|
{
|
|
18516
18559
|
type: "button",
|
|
@@ -18518,7 +18561,7 @@ var AirbnbInput = React73.forwardRef(
|
|
|
18518
18561
|
disabled: isBlocked,
|
|
18519
18562
|
className: "absolute bottom-0 right-0 flex h-6 w-6 items-center justify-center border-0 bg-transparent p-0 text-[#7A8399] hover:text-[#1F1F1B] hover:opacity-85 disabled:cursor-not-allowed disabled:opacity-50",
|
|
18520
18563
|
"aria-label": isPasswordRevealed ? t("hide_password") : t("show_password"),
|
|
18521
|
-
children: /* @__PURE__ */
|
|
18564
|
+
children: /* @__PURE__ */ jsx184(
|
|
18522
18565
|
Eye2,
|
|
18523
18566
|
{
|
|
18524
18567
|
size: 18,
|
|
@@ -18536,14 +18579,14 @@ var AirbnbInput = React73.forwardRef(
|
|
|
18536
18579
|
AirbnbInput.displayName = "AirbnbInput";
|
|
18537
18580
|
|
|
18538
18581
|
// src/airbnb-fields/phone-field/PhoneField.tsx
|
|
18539
|
-
import * as
|
|
18582
|
+
import * as React80 from "react";
|
|
18540
18583
|
import { ChevronDown as ChevronDown6 } from "lucide-react";
|
|
18541
18584
|
|
|
18542
18585
|
// src/airbnb-fields/select/Select.tsx
|
|
18543
|
-
import * as
|
|
18586
|
+
import * as React79 from "react";
|
|
18544
18587
|
|
|
18545
18588
|
// src/airbnb-fields/select/SelectDesktopMenu.tsx
|
|
18546
|
-
import { jsx as
|
|
18589
|
+
import { jsx as jsx185, jsxs as jsxs119 } from "react/jsx-runtime";
|
|
18547
18590
|
function AirbnbSelectDesktopMenu({
|
|
18548
18591
|
id,
|
|
18549
18592
|
options,
|
|
@@ -18575,12 +18618,12 @@ function AirbnbSelectDesktopMenu({
|
|
|
18575
18618
|
onKeyDown,
|
|
18576
18619
|
className: cn("max-h-[280px] overflow-y-auto p-2 outline-none", menuClassName),
|
|
18577
18620
|
children: [
|
|
18578
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */
|
|
18621
|
+
options.length === 0 && emptyMessage ? /* @__PURE__ */ jsx185("div", { className: "px-4 py-3 text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : null,
|
|
18579
18622
|
options.map((option, index) => {
|
|
18580
18623
|
const isSelected = selectedValue?.value === option.value;
|
|
18581
18624
|
const isHighlighted = index === highlightedIndex;
|
|
18582
18625
|
const optionKey = `${String(option.value)}-${index}`;
|
|
18583
|
-
return /* @__PURE__ */
|
|
18626
|
+
return /* @__PURE__ */ jsx185(
|
|
18584
18627
|
"button",
|
|
18585
18628
|
{
|
|
18586
18629
|
id: getOptionId2(index),
|
|
@@ -18612,7 +18655,7 @@ function AirbnbSelectDesktopMenu({
|
|
|
18612
18655
|
}
|
|
18613
18656
|
|
|
18614
18657
|
// src/airbnb-fields/select/SelectDesktopContent.tsx
|
|
18615
|
-
import { jsx as
|
|
18658
|
+
import { jsx as jsx186 } from "react/jsx-runtime";
|
|
18616
18659
|
function AirbnbSelectDesktopContent({
|
|
18617
18660
|
isOpen,
|
|
18618
18661
|
listboxId,
|
|
@@ -18633,14 +18676,14 @@ function AirbnbSelectDesktopContent({
|
|
|
18633
18676
|
noOptionsMessage
|
|
18634
18677
|
}) {
|
|
18635
18678
|
if (!isOpen) return null;
|
|
18636
|
-
return /* @__PURE__ */
|
|
18679
|
+
return /* @__PURE__ */ jsx186(
|
|
18637
18680
|
"div",
|
|
18638
18681
|
{
|
|
18639
18682
|
className: cn(
|
|
18640
18683
|
"absolute left-0 right-0 top-[calc(100%+8px)] z-20 overflow-hidden rounded-[20px] border border-[#DEDAD2] bg-white shadow-[0_14px_30px_rgba(18,18,18,0.08)]",
|
|
18641
18684
|
dropdownClassName
|
|
18642
18685
|
),
|
|
18643
|
-
children: /* @__PURE__ */
|
|
18686
|
+
children: /* @__PURE__ */ jsx186(
|
|
18644
18687
|
AirbnbSelectDesktopMenu,
|
|
18645
18688
|
{
|
|
18646
18689
|
id: listboxId,
|
|
@@ -18738,7 +18781,7 @@ function getMobileOptionStyles(index, scrollTop) {
|
|
|
18738
18781
|
}
|
|
18739
18782
|
|
|
18740
18783
|
// src/airbnb-fields/select/SelectMobileWheel.tsx
|
|
18741
|
-
import { jsx as
|
|
18784
|
+
import { jsx as jsx187, jsxs as jsxs120 } from "react/jsx-runtime";
|
|
18742
18785
|
function AirbnbSelectMobileWheel({
|
|
18743
18786
|
id,
|
|
18744
18787
|
options,
|
|
@@ -18769,10 +18812,10 @@ function AirbnbSelectMobileWheel({
|
|
|
18769
18812
|
onKeyDown,
|
|
18770
18813
|
className: cn("relative overflow-hidden outline-none", menuClassName),
|
|
18771
18814
|
children: [
|
|
18772
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */
|
|
18773
|
-
/* @__PURE__ */
|
|
18774
|
-
/* @__PURE__ */
|
|
18775
|
-
/* @__PURE__ */
|
|
18815
|
+
options.length === 0 && emptyMessage ? /* @__PURE__ */ jsx187("div", { className: "flex min-h-[160px] items-center justify-center px-4 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : null,
|
|
18816
|
+
/* @__PURE__ */ jsx187("div", { className: "pointer-events-none absolute inset-x-0 top-0 h-16 bg-gradient-to-b from-white via-white/80 to-transparent" }),
|
|
18817
|
+
/* @__PURE__ */ jsx187("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-white via-white/80 to-transparent" }),
|
|
18818
|
+
/* @__PURE__ */ jsx187(
|
|
18776
18819
|
"div",
|
|
18777
18820
|
{
|
|
18778
18821
|
"aria-hidden": true,
|
|
@@ -18797,11 +18840,11 @@ function AirbnbSelectMobileWheel({
|
|
|
18797
18840
|
WebkitOverflowScrolling: "touch"
|
|
18798
18841
|
},
|
|
18799
18842
|
children: [
|
|
18800
|
-
/* @__PURE__ */
|
|
18843
|
+
/* @__PURE__ */ jsx187("div", { style: { height: `${spacerHeight2}px` } }),
|
|
18801
18844
|
options.map((option, index) => {
|
|
18802
18845
|
const { distance, style } = getMobileOptionStyles(index, scrollTop);
|
|
18803
18846
|
const optionKey = `${String(option.value)}-${index}`;
|
|
18804
|
-
return /* @__PURE__ */
|
|
18847
|
+
return /* @__PURE__ */ jsx187(
|
|
18805
18848
|
"button",
|
|
18806
18849
|
{
|
|
18807
18850
|
id: getOptionId2(index),
|
|
@@ -18822,7 +18865,7 @@ function AirbnbSelectMobileWheel({
|
|
|
18822
18865
|
optionKey
|
|
18823
18866
|
);
|
|
18824
18867
|
}),
|
|
18825
|
-
/* @__PURE__ */
|
|
18868
|
+
/* @__PURE__ */ jsx187("div", { style: { height: `${spacerHeight2}px` } })
|
|
18826
18869
|
]
|
|
18827
18870
|
}
|
|
18828
18871
|
)
|
|
@@ -18832,7 +18875,7 @@ function AirbnbSelectMobileWheel({
|
|
|
18832
18875
|
}
|
|
18833
18876
|
|
|
18834
18877
|
// src/airbnb-fields/select/SelectMobileContent.tsx
|
|
18835
|
-
import { jsx as
|
|
18878
|
+
import { jsx as jsx188, jsxs as jsxs121 } from "react/jsx-runtime";
|
|
18836
18879
|
function AirbnbSelectMobileContent({
|
|
18837
18880
|
open,
|
|
18838
18881
|
onOpenChange,
|
|
@@ -18856,11 +18899,11 @@ function AirbnbSelectMobileContent({
|
|
|
18856
18899
|
getOptionId: getOptionId2,
|
|
18857
18900
|
noOptionsMessage
|
|
18858
18901
|
}) {
|
|
18859
|
-
return /* @__PURE__ */
|
|
18860
|
-
/* @__PURE__ */
|
|
18861
|
-
/* @__PURE__ */
|
|
18902
|
+
return /* @__PURE__ */ jsx188(Drawer, { open, onOpenChange, children: /* @__PURE__ */ jsxs121(DrawerContent, { onClose, lockScroll: false, children: [
|
|
18903
|
+
/* @__PURE__ */ jsx188(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
18904
|
+
/* @__PURE__ */ jsx188(DrawerDescription, { className: "sr-only", children: label }),
|
|
18862
18905
|
/* @__PURE__ */ jsxs121("div", { className: "px-6 pb-4 pt-1", children: [
|
|
18863
|
-
/* @__PURE__ */
|
|
18906
|
+
/* @__PURE__ */ jsx188(
|
|
18864
18907
|
AirbnbSelectMobileWheel,
|
|
18865
18908
|
{
|
|
18866
18909
|
id: listboxId,
|
|
@@ -18879,16 +18922,16 @@ function AirbnbSelectMobileContent({
|
|
|
18879
18922
|
noOptionsMessage
|
|
18880
18923
|
}
|
|
18881
18924
|
),
|
|
18882
|
-
/* @__PURE__ */
|
|
18925
|
+
/* @__PURE__ */ jsx188(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
18883
18926
|
] })
|
|
18884
18927
|
] }) });
|
|
18885
18928
|
}
|
|
18886
18929
|
|
|
18887
18930
|
// src/airbnb-fields/select/SelectTrigger.tsx
|
|
18888
|
-
import * as
|
|
18931
|
+
import * as React75 from "react";
|
|
18889
18932
|
import { ChevronDown as ChevronDown5 } from "lucide-react";
|
|
18890
|
-
import { jsx as
|
|
18891
|
-
var AirbnbSelectTrigger =
|
|
18933
|
+
import { jsx as jsx189 } from "react/jsx-runtime";
|
|
18934
|
+
var AirbnbSelectTrigger = React75.forwardRef(
|
|
18892
18935
|
({
|
|
18893
18936
|
id,
|
|
18894
18937
|
open,
|
|
@@ -18912,7 +18955,7 @@ var AirbnbSelectTrigger = React74.forwardRef(
|
|
|
18912
18955
|
onKeyDown,
|
|
18913
18956
|
onBlur
|
|
18914
18957
|
}, ref) => {
|
|
18915
|
-
return /* @__PURE__ */
|
|
18958
|
+
return /* @__PURE__ */ jsx189(
|
|
18916
18959
|
AirbnbFieldTrigger,
|
|
18917
18960
|
{
|
|
18918
18961
|
id,
|
|
@@ -18940,7 +18983,7 @@ var AirbnbSelectTrigger = React74.forwardRef(
|
|
|
18940
18983
|
onClick,
|
|
18941
18984
|
onKeyDown,
|
|
18942
18985
|
onBlur,
|
|
18943
|
-
trailingAdornment: /* @__PURE__ */
|
|
18986
|
+
trailingAdornment: /* @__PURE__ */ jsx189(
|
|
18944
18987
|
ChevronDown5,
|
|
18945
18988
|
{
|
|
18946
18989
|
className: open ? "h-6 w-6 rotate-180 text-[#1F1F1B] transition-transform" : "h-6 w-6 text-[#1F1F1B] transition-transform"
|
|
@@ -18953,7 +18996,7 @@ var AirbnbSelectTrigger = React74.forwardRef(
|
|
|
18953
18996
|
AirbnbSelectTrigger.displayName = "AirbnbSelectTrigger";
|
|
18954
18997
|
|
|
18955
18998
|
// src/airbnb-fields/select/useDesktopSelect.ts
|
|
18956
|
-
import * as
|
|
18999
|
+
import * as React76 from "react";
|
|
18957
19000
|
function useDesktopSelect({
|
|
18958
19001
|
isMobile: isMobile3,
|
|
18959
19002
|
isOpen,
|
|
@@ -18962,12 +19005,12 @@ function useDesktopSelect({
|
|
|
18962
19005
|
disabled,
|
|
18963
19006
|
onChange
|
|
18964
19007
|
}) {
|
|
18965
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
18966
|
-
const triggerRef =
|
|
18967
|
-
const listRef =
|
|
18968
|
-
const optionRefs =
|
|
19008
|
+
const [highlightedIndex, setHighlightedIndex] = React76.useState(-1);
|
|
19009
|
+
const triggerRef = React76.useRef(null);
|
|
19010
|
+
const listRef = React76.useRef(null);
|
|
19011
|
+
const optionRefs = React76.useRef([]);
|
|
18969
19012
|
const selectedIndex = getOptionIndex2(options, value);
|
|
18970
|
-
|
|
19013
|
+
React76.useEffect(() => {
|
|
18971
19014
|
if (!isOpen || isMobile3) return;
|
|
18972
19015
|
setHighlightedIndex((currentIndex) => {
|
|
18973
19016
|
if (currentIndex >= 0) {
|
|
@@ -18982,34 +19025,34 @@ function useDesktopSelect({
|
|
|
18982
19025
|
window.cancelAnimationFrame(frameId);
|
|
18983
19026
|
};
|
|
18984
19027
|
}, [isMobile3, isOpen, options, selectedIndex]);
|
|
18985
|
-
|
|
19028
|
+
React76.useEffect(() => {
|
|
18986
19029
|
if (!isOpen || isMobile3 || highlightedIndex < 0) return;
|
|
18987
19030
|
optionRefs.current[highlightedIndex]?.scrollIntoView({
|
|
18988
19031
|
block: "nearest"
|
|
18989
19032
|
});
|
|
18990
19033
|
}, [highlightedIndex, isMobile3, isOpen]);
|
|
18991
|
-
|
|
19034
|
+
React76.useEffect(() => {
|
|
18992
19035
|
if (isOpen) return;
|
|
18993
19036
|
setHighlightedIndex(-1);
|
|
18994
19037
|
}, [isOpen]);
|
|
18995
|
-
const focusTrigger =
|
|
19038
|
+
const focusTrigger = React76.useCallback(() => {
|
|
18996
19039
|
triggerRef.current?.focus();
|
|
18997
19040
|
}, []);
|
|
18998
|
-
const handleSelect =
|
|
19041
|
+
const handleSelect = React76.useCallback(
|
|
18999
19042
|
(option) => {
|
|
19000
19043
|
if (option.isDisabled || disabled) return;
|
|
19001
19044
|
onChange?.(option);
|
|
19002
19045
|
},
|
|
19003
19046
|
[disabled, onChange]
|
|
19004
19047
|
);
|
|
19005
|
-
const openMenu =
|
|
19048
|
+
const openMenu = React76.useCallback(
|
|
19006
19049
|
(targetIndex) => {
|
|
19007
19050
|
const fallbackIndex = selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex2(options);
|
|
19008
19051
|
setHighlightedIndex(targetIndex ?? fallbackIndex);
|
|
19009
19052
|
},
|
|
19010
19053
|
[options, selectedIndex]
|
|
19011
19054
|
);
|
|
19012
|
-
const handleTriggerKeyDown =
|
|
19055
|
+
const handleTriggerKeyDown = React76.useCallback(
|
|
19013
19056
|
(event, onOpen) => {
|
|
19014
19057
|
if (disabled) return;
|
|
19015
19058
|
if (event.key === "ArrowDown") {
|
|
@@ -19034,7 +19077,7 @@ function useDesktopSelect({
|
|
|
19034
19077
|
},
|
|
19035
19078
|
[disabled, openMenu, options, selectedIndex]
|
|
19036
19079
|
);
|
|
19037
|
-
const handleMenuKeyDown =
|
|
19080
|
+
const handleMenuKeyDown = React76.useCallback(
|
|
19038
19081
|
(event, onClose) => {
|
|
19039
19082
|
if (event.key === "Escape") {
|
|
19040
19083
|
event.preventDefault();
|
|
@@ -19084,7 +19127,7 @@ function useDesktopSelect({
|
|
|
19084
19127
|
},
|
|
19085
19128
|
[focusTrigger, highlightedIndex, onChange, options]
|
|
19086
19129
|
);
|
|
19087
|
-
const setOptionRef =
|
|
19130
|
+
const setOptionRef = React76.useCallback(
|
|
19088
19131
|
(index, node) => {
|
|
19089
19132
|
optionRefs.current[index] = node;
|
|
19090
19133
|
},
|
|
@@ -19104,23 +19147,23 @@ function useDesktopSelect({
|
|
|
19104
19147
|
}
|
|
19105
19148
|
|
|
19106
19149
|
// src/airbnb-fields/select/useMobileSelectWheel.ts
|
|
19107
|
-
import * as
|
|
19150
|
+
import * as React77 from "react";
|
|
19108
19151
|
function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, disabled }) {
|
|
19109
|
-
const [pendingValue, setPendingValue] =
|
|
19152
|
+
const [pendingValue, setPendingValue] = React77.useState(
|
|
19110
19153
|
value ?? null
|
|
19111
19154
|
);
|
|
19112
|
-
const [mobileScrollTop, setMobileScrollTop] =
|
|
19113
|
-
const mobileListRef =
|
|
19114
|
-
const scrollSettleTimeoutRef =
|
|
19115
|
-
const scrollAnimationFrameRef =
|
|
19116
|
-
const getTargetIndex =
|
|
19155
|
+
const [mobileScrollTop, setMobileScrollTop] = React77.useState(0);
|
|
19156
|
+
const mobileListRef = React77.useRef(null);
|
|
19157
|
+
const scrollSettleTimeoutRef = React77.useRef(null);
|
|
19158
|
+
const scrollAnimationFrameRef = React77.useRef(null);
|
|
19159
|
+
const getTargetIndex = React77.useCallback(
|
|
19117
19160
|
(targetValue) => {
|
|
19118
19161
|
const selectedIndex = getOptionIndex2(options, targetValue);
|
|
19119
19162
|
return selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex2(options);
|
|
19120
19163
|
},
|
|
19121
19164
|
[options]
|
|
19122
19165
|
);
|
|
19123
|
-
const syncScrollPosition =
|
|
19166
|
+
const syncScrollPosition = React77.useCallback(
|
|
19124
19167
|
(targetValue, behavior = "instant") => {
|
|
19125
19168
|
const targetIndex = getTargetIndex(targetValue);
|
|
19126
19169
|
if (targetIndex < 0) return;
|
|
@@ -19139,27 +19182,27 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19139
19182
|
},
|
|
19140
19183
|
[getTargetIndex, options]
|
|
19141
19184
|
);
|
|
19142
|
-
const clearScrollSettleTimeout =
|
|
19185
|
+
const clearScrollSettleTimeout = React77.useCallback(() => {
|
|
19143
19186
|
if (scrollSettleTimeoutRef.current === null) return;
|
|
19144
19187
|
window.clearTimeout(scrollSettleTimeoutRef.current);
|
|
19145
19188
|
scrollSettleTimeoutRef.current = null;
|
|
19146
19189
|
}, []);
|
|
19147
|
-
const clearScrollAnimationFrame =
|
|
19190
|
+
const clearScrollAnimationFrame = React77.useCallback(() => {
|
|
19148
19191
|
if (scrollAnimationFrameRef.current === null) return;
|
|
19149
19192
|
window.cancelAnimationFrame(scrollAnimationFrameRef.current);
|
|
19150
19193
|
scrollAnimationFrameRef.current = null;
|
|
19151
19194
|
}, []);
|
|
19152
|
-
|
|
19195
|
+
React77.useEffect(
|
|
19153
19196
|
() => () => {
|
|
19154
19197
|
clearScrollSettleTimeout();
|
|
19155
19198
|
clearScrollAnimationFrame();
|
|
19156
19199
|
},
|
|
19157
19200
|
[clearScrollAnimationFrame, clearScrollSettleTimeout]
|
|
19158
19201
|
);
|
|
19159
|
-
|
|
19202
|
+
React77.useEffect(() => {
|
|
19160
19203
|
setPendingValue(value ?? null);
|
|
19161
19204
|
}, [value]);
|
|
19162
|
-
|
|
19205
|
+
React77.useLayoutEffect(() => {
|
|
19163
19206
|
if (!isMobile3 || !isOpen) return;
|
|
19164
19207
|
const frameId = window.requestAnimationFrame(() => {
|
|
19165
19208
|
syncScrollPosition(value ?? null, "instant");
|
|
@@ -19168,7 +19211,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19168
19211
|
window.cancelAnimationFrame(frameId);
|
|
19169
19212
|
};
|
|
19170
19213
|
}, [isMobile3, isOpen, syncScrollPosition, value]);
|
|
19171
|
-
const settleScroll =
|
|
19214
|
+
const settleScroll = React77.useCallback(() => {
|
|
19172
19215
|
if (!mobileListRef.current) return;
|
|
19173
19216
|
const nextIndex = Math.round(mobileListRef.current.scrollTop / MOBILE_OPTION_HEIGHT);
|
|
19174
19217
|
const nextOption = options[nextIndex];
|
|
@@ -19180,13 +19223,13 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19180
19223
|
}
|
|
19181
19224
|
setPendingValue(nextOption);
|
|
19182
19225
|
}, [options, pendingValue]);
|
|
19183
|
-
const scheduleScrollSettle =
|
|
19226
|
+
const scheduleScrollSettle = React77.useCallback(() => {
|
|
19184
19227
|
clearScrollSettleTimeout();
|
|
19185
19228
|
scrollSettleTimeoutRef.current = window.setTimeout(() => {
|
|
19186
19229
|
settleScroll();
|
|
19187
19230
|
}, MOBILE_SCROLL_SETTLE_DELAY);
|
|
19188
19231
|
}, [clearScrollSettleTimeout, settleScroll]);
|
|
19189
|
-
const handleScroll =
|
|
19232
|
+
const handleScroll = React77.useCallback(() => {
|
|
19190
19233
|
if (!mobileListRef.current) return;
|
|
19191
19234
|
const nextScrollTop = mobileListRef.current.scrollTop;
|
|
19192
19235
|
clearScrollAnimationFrame();
|
|
@@ -19196,7 +19239,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19196
19239
|
});
|
|
19197
19240
|
scheduleScrollSettle();
|
|
19198
19241
|
}, [clearScrollAnimationFrame, scheduleScrollSettle]);
|
|
19199
|
-
const focusOptionByIndex =
|
|
19242
|
+
const focusOptionByIndex = React77.useCallback(
|
|
19200
19243
|
(index, behavior = "instant", updatePendingImmediately = behavior === "instant") => {
|
|
19201
19244
|
if (!mobileListRef.current || index < 0 || index >= options.length) return;
|
|
19202
19245
|
const option = options[index];
|
|
@@ -19214,7 +19257,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19214
19257
|
},
|
|
19215
19258
|
[options, scheduleScrollSettle]
|
|
19216
19259
|
);
|
|
19217
|
-
const handleOptionClick =
|
|
19260
|
+
const handleOptionClick = React77.useCallback(
|
|
19218
19261
|
(option) => {
|
|
19219
19262
|
if (!mobileListRef.current || disabled || option.isDisabled) return;
|
|
19220
19263
|
const optionIndex = getOptionIndex2(options, option);
|
|
@@ -19223,7 +19266,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19223
19266
|
},
|
|
19224
19267
|
[disabled, focusOptionByIndex, options]
|
|
19225
19268
|
);
|
|
19226
|
-
const moveByStep =
|
|
19269
|
+
const moveByStep = React77.useCallback(
|
|
19227
19270
|
(step) => {
|
|
19228
19271
|
const currentIndex = getOptionIndex2(options, pendingValue);
|
|
19229
19272
|
const fallbackIndex = step === 1 ? getFirstEnabledOptionIndex2(options) : getLastEnabledOptionIndex2(options);
|
|
@@ -19235,7 +19278,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19235
19278
|
},
|
|
19236
19279
|
[focusOptionByIndex, options, pendingValue]
|
|
19237
19280
|
);
|
|
19238
|
-
const moveToBoundary =
|
|
19281
|
+
const moveToBoundary = React77.useCallback(
|
|
19239
19282
|
(boundary) => {
|
|
19240
19283
|
const targetIndex = boundary === "start" ? getFirstEnabledOptionIndex2(options) : getLastEnabledOptionIndex2(options);
|
|
19241
19284
|
if (targetIndex >= 0) {
|
|
@@ -19244,7 +19287,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19244
19287
|
},
|
|
19245
19288
|
[focusOptionByIndex, options]
|
|
19246
19289
|
);
|
|
19247
|
-
const syncPendingValue =
|
|
19290
|
+
const syncPendingValue = React77.useCallback(
|
|
19248
19291
|
(nextValue) => {
|
|
19249
19292
|
const normalizedValue = nextValue ?? null;
|
|
19250
19293
|
const matchedIndex = getOptionIndex2(options, normalizedValue);
|
|
@@ -19272,9 +19315,9 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19272
19315
|
}
|
|
19273
19316
|
|
|
19274
19317
|
// src/airbnb-fields/select/useSelectIds.ts
|
|
19275
|
-
import * as
|
|
19318
|
+
import * as React78 from "react";
|
|
19276
19319
|
function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
19277
|
-
const reactId =
|
|
19320
|
+
const reactId = React78.useId().replace(/:/g, "");
|
|
19278
19321
|
const baseId = name ? `select-${name}` : `select-${reactId}`;
|
|
19279
19322
|
const triggerId = `${baseId}-trigger`;
|
|
19280
19323
|
const labelId = `${baseId}-label`;
|
|
@@ -19284,7 +19327,7 @@ function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
|
19284
19327
|
const listboxId = `${baseId}-listbox`;
|
|
19285
19328
|
const describedErrorId = error && !hideErrorMessage ? errorId : void 0;
|
|
19286
19329
|
const describedBy = [!hasValue ? helperTextId : null, describedErrorId].filter(Boolean).join(" ") || void 0;
|
|
19287
|
-
const getOptionId2 =
|
|
19330
|
+
const getOptionId2 = React78.useCallback(
|
|
19288
19331
|
(index) => `${baseId}-option-${index}`,
|
|
19289
19332
|
[baseId]
|
|
19290
19333
|
);
|
|
@@ -19302,8 +19345,8 @@ function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
|
19302
19345
|
}
|
|
19303
19346
|
|
|
19304
19347
|
// src/airbnb-fields/select/Select.tsx
|
|
19305
|
-
import { jsx as
|
|
19306
|
-
var AirbnbSelect =
|
|
19348
|
+
import { jsx as jsx190, jsxs as jsxs122 } from "react/jsx-runtime";
|
|
19349
|
+
var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
19307
19350
|
options = [],
|
|
19308
19351
|
value,
|
|
19309
19352
|
onChange,
|
|
@@ -19330,8 +19373,8 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19330
19373
|
filterOption
|
|
19331
19374
|
}, ref) {
|
|
19332
19375
|
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
19333
|
-
const [isOpen, setIsOpen] =
|
|
19334
|
-
const containerRef =
|
|
19376
|
+
const [isOpen, setIsOpen] = React79.useState(false);
|
|
19377
|
+
const containerRef = React79.useRef(null);
|
|
19335
19378
|
const filteredOptions = filterOption ? options.filter(filterOption) : options;
|
|
19336
19379
|
const hasValue = Boolean(value);
|
|
19337
19380
|
const helperText = placeholder ?? label;
|
|
@@ -19393,12 +19436,12 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19393
19436
|
onOutsideClick: () => setIsOpen(false),
|
|
19394
19437
|
isDisabled: !isOpen || isMobile3
|
|
19395
19438
|
});
|
|
19396
|
-
|
|
19439
|
+
React79.useEffect(() => {
|
|
19397
19440
|
if (isBlocked) {
|
|
19398
19441
|
setIsOpen(false);
|
|
19399
19442
|
}
|
|
19400
19443
|
}, [isBlocked]);
|
|
19401
|
-
|
|
19444
|
+
React79.useEffect(
|
|
19402
19445
|
function setCorrectOptionIfThereIsOnlyValue() {
|
|
19403
19446
|
if (value?.value === void 0 || value.value === null || value.label !== "") {
|
|
19404
19447
|
return;
|
|
@@ -19410,7 +19453,7 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19410
19453
|
},
|
|
19411
19454
|
[onChange, filteredOptions, value]
|
|
19412
19455
|
);
|
|
19413
|
-
const handleMobileOpenChange =
|
|
19456
|
+
const handleMobileOpenChange = React79.useCallback(
|
|
19414
19457
|
(nextOpen) => {
|
|
19415
19458
|
if (isBlocked && nextOpen) return;
|
|
19416
19459
|
setIsOpen(nextOpen);
|
|
@@ -19421,7 +19464,7 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19421
19464
|
},
|
|
19422
19465
|
[focusTrigger, isBlocked, syncPendingValue, value]
|
|
19423
19466
|
);
|
|
19424
|
-
const handleMobileDone =
|
|
19467
|
+
const handleMobileDone = React79.useCallback(() => {
|
|
19425
19468
|
if (isBlocked) return;
|
|
19426
19469
|
const finalOption = pendingValue;
|
|
19427
19470
|
if (finalOption && finalOption.value !== value?.value) {
|
|
@@ -19430,7 +19473,7 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19430
19473
|
setIsOpen(false);
|
|
19431
19474
|
focusTrigger();
|
|
19432
19475
|
}, [focusTrigger, isBlocked, onChange, pendingValue, value]);
|
|
19433
|
-
const handleTriggerClick =
|
|
19476
|
+
const handleTriggerClick = React79.useCallback(() => {
|
|
19434
19477
|
if (isBlocked) return;
|
|
19435
19478
|
setIsOpen((prev) => {
|
|
19436
19479
|
const nextOpen = !prev;
|
|
@@ -19489,7 +19532,7 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19489
19532
|
ref: containerRef,
|
|
19490
19533
|
className: cn("relative w-full max-w-[var(--max-field-width)]", className),
|
|
19491
19534
|
children: [
|
|
19492
|
-
name && /* @__PURE__ */
|
|
19535
|
+
name && /* @__PURE__ */ jsx190("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
19493
19536
|
renderTrigger ? renderTrigger({
|
|
19494
19537
|
id: triggerId,
|
|
19495
19538
|
open: isOpen,
|
|
@@ -19510,7 +19553,7 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19510
19553
|
onClick: handleTriggerClick,
|
|
19511
19554
|
onKeyDown: handleRootTriggerKeyDown,
|
|
19512
19555
|
onBlur
|
|
19513
|
-
}) : /* @__PURE__ */
|
|
19556
|
+
}) : /* @__PURE__ */ jsx190(
|
|
19514
19557
|
AirbnbSelectTrigger,
|
|
19515
19558
|
{
|
|
19516
19559
|
id: triggerId,
|
|
@@ -19537,7 +19580,7 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19537
19580
|
onBlur
|
|
19538
19581
|
}
|
|
19539
19582
|
),
|
|
19540
|
-
isMobile3 ? /* @__PURE__ */
|
|
19583
|
+
isMobile3 ? /* @__PURE__ */ jsx190(
|
|
19541
19584
|
AirbnbSelectMobileContent,
|
|
19542
19585
|
{
|
|
19543
19586
|
open: isOpen,
|
|
@@ -19562,7 +19605,7 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19562
19605
|
getOptionId: getOptionId2,
|
|
19563
19606
|
noOptionsMessage
|
|
19564
19607
|
}
|
|
19565
|
-
) : /* @__PURE__ */
|
|
19608
|
+
) : /* @__PURE__ */ jsx190(
|
|
19566
19609
|
AirbnbSelectDesktopContent,
|
|
19567
19610
|
{
|
|
19568
19611
|
isOpen,
|
|
@@ -19596,13 +19639,13 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19596
19639
|
});
|
|
19597
19640
|
|
|
19598
19641
|
// src/airbnb-fields/phone-field/PhoneField.tsx
|
|
19599
|
-
import { jsx as
|
|
19642
|
+
import { jsx as jsx191, jsxs as jsxs123 } from "react/jsx-runtime";
|
|
19600
19643
|
function formatPhoneCodeOptionLabel2(option) {
|
|
19601
19644
|
const label = String(option.label);
|
|
19602
19645
|
const value = String(option.value);
|
|
19603
19646
|
return label.includes(value) ? label : `${label} (${value})`;
|
|
19604
19647
|
}
|
|
19605
|
-
var AirbnbPhoneField =
|
|
19648
|
+
var AirbnbPhoneField = React80.forwardRef(
|
|
19606
19649
|
({
|
|
19607
19650
|
label,
|
|
19608
19651
|
topLabel,
|
|
@@ -19626,9 +19669,9 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
19626
19669
|
codePlaceholder = "+00",
|
|
19627
19670
|
defaultCode
|
|
19628
19671
|
}, ref) => {
|
|
19629
|
-
const inputId =
|
|
19672
|
+
const inputId = React80.useId();
|
|
19630
19673
|
const effectiveCode = value?.code || defaultCode || "";
|
|
19631
|
-
const codeOptions =
|
|
19674
|
+
const codeOptions = React80.useMemo(
|
|
19632
19675
|
() => options.map((option) => ({
|
|
19633
19676
|
value: option.value,
|
|
19634
19677
|
label: formatPhoneCodeOptionLabel2(option),
|
|
@@ -19636,7 +19679,7 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
19636
19679
|
})),
|
|
19637
19680
|
[options]
|
|
19638
19681
|
);
|
|
19639
|
-
const selectedCodeOption =
|
|
19682
|
+
const selectedCodeOption = React80.useMemo(
|
|
19640
19683
|
() => codeOptions.find((option) => option.value === effectiveCode) ?? null,
|
|
19641
19684
|
[codeOptions, effectiveCode]
|
|
19642
19685
|
);
|
|
@@ -19645,8 +19688,8 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
19645
19688
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
19646
19689
|
const isCodeBlocked = isBlocked || Boolean(codeReadOnly);
|
|
19647
19690
|
return /* @__PURE__ */ jsxs123("div", { className: cn("w-full max-w-[var(--max-field-width)]", className), children: [
|
|
19648
|
-
name && /* @__PURE__ */
|
|
19649
|
-
codeName && /* @__PURE__ */
|
|
19691
|
+
name && /* @__PURE__ */ jsx191("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
19692
|
+
codeName && /* @__PURE__ */ jsx191(
|
|
19650
19693
|
"input",
|
|
19651
19694
|
{
|
|
19652
19695
|
type: "hidden",
|
|
@@ -19655,7 +19698,7 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
19655
19698
|
disabled
|
|
19656
19699
|
}
|
|
19657
19700
|
),
|
|
19658
|
-
numberName && /* @__PURE__ */
|
|
19701
|
+
numberName && /* @__PURE__ */ jsx191(
|
|
19659
19702
|
"input",
|
|
19660
19703
|
{
|
|
19661
19704
|
type: "hidden",
|
|
@@ -19664,7 +19707,7 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
19664
19707
|
disabled
|
|
19665
19708
|
}
|
|
19666
19709
|
),
|
|
19667
|
-
topLabel && /* @__PURE__ */
|
|
19710
|
+
topLabel && /* @__PURE__ */ jsx191(
|
|
19668
19711
|
"label",
|
|
19669
19712
|
{
|
|
19670
19713
|
htmlFor: inputId,
|
|
@@ -19673,7 +19716,7 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
19673
19716
|
}
|
|
19674
19717
|
),
|
|
19675
19718
|
/* @__PURE__ */ jsxs123("div", { className: "flex items-stretch", children: [
|
|
19676
|
-
/* @__PURE__ */
|
|
19719
|
+
/* @__PURE__ */ jsx191(
|
|
19677
19720
|
AirbnbSelect,
|
|
19678
19721
|
{
|
|
19679
19722
|
ref,
|
|
@@ -19723,8 +19766,8 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
19723
19766
|
triggerDisabled ? "cursor-not-allowed opacity-50" : triggerLoading ? "cursor-progress" : "cursor-pointer"
|
|
19724
19767
|
),
|
|
19725
19768
|
children: [
|
|
19726
|
-
/* @__PURE__ */
|
|
19727
|
-
/* @__PURE__ */
|
|
19769
|
+
/* @__PURE__ */ jsx191("span", { children: valueLabel ?? codePlaceholder }),
|
|
19770
|
+
/* @__PURE__ */ jsx191(
|
|
19728
19771
|
ChevronDown6,
|
|
19729
19772
|
{
|
|
19730
19773
|
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
@@ -19736,7 +19779,7 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
19736
19779
|
)
|
|
19737
19780
|
}
|
|
19738
19781
|
),
|
|
19739
|
-
/* @__PURE__ */
|
|
19782
|
+
/* @__PURE__ */ jsx191(
|
|
19740
19783
|
AirbnbInput,
|
|
19741
19784
|
{
|
|
19742
19785
|
id: inputId,
|
|
@@ -19765,18 +19808,18 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
19765
19808
|
}
|
|
19766
19809
|
)
|
|
19767
19810
|
] }),
|
|
19768
|
-
error && /* @__PURE__ */
|
|
19811
|
+
error && /* @__PURE__ */ jsx191(FieldErrorMessage, { message: error })
|
|
19769
19812
|
] });
|
|
19770
19813
|
}
|
|
19771
19814
|
);
|
|
19772
19815
|
AirbnbPhoneField.displayName = "AirbnbPhoneField";
|
|
19773
19816
|
|
|
19774
19817
|
// src/airbnb-fields/searchable-select/SearchableSelect.tsx
|
|
19775
|
-
import * as
|
|
19776
|
-
import { ChevronDown as ChevronDown7, Search as
|
|
19818
|
+
import * as React81 from "react";
|
|
19819
|
+
import { ChevronDown as ChevronDown7, Search as Search5 } from "lucide-react";
|
|
19777
19820
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
19778
19821
|
import { useCallback as useCallback57 } from "react";
|
|
19779
|
-
import { jsx as
|
|
19822
|
+
import { jsx as jsx192, jsxs as jsxs124 } from "react/jsx-runtime";
|
|
19780
19823
|
var ROW_HEIGHT = 48;
|
|
19781
19824
|
var DESKTOP_LIST_HEIGHT = 280;
|
|
19782
19825
|
var MOBILE_LIST_HEIGHT = 420;
|
|
@@ -19816,13 +19859,13 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
19816
19859
|
loadingMessage
|
|
19817
19860
|
}, ref) => {
|
|
19818
19861
|
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
19819
|
-
const reactId =
|
|
19820
|
-
const [open, setOpen] =
|
|
19821
|
-
const [internalSearchValue, setInternalSearchValue] =
|
|
19822
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
19823
|
-
const containerRef =
|
|
19824
|
-
const triggerRef =
|
|
19825
|
-
const inputRef =
|
|
19862
|
+
const reactId = React81.useId();
|
|
19863
|
+
const [open, setOpen] = React81.useState(false);
|
|
19864
|
+
const [internalSearchValue, setInternalSearchValue] = React81.useState("");
|
|
19865
|
+
const [highlightedIndex, setHighlightedIndex] = React81.useState(-1);
|
|
19866
|
+
const containerRef = React81.useRef(null);
|
|
19867
|
+
const triggerRef = React81.useRef(null);
|
|
19868
|
+
const inputRef = React81.useRef(null);
|
|
19826
19869
|
const listboxId = `${reactId}-listbox`;
|
|
19827
19870
|
const labelId = `${reactId}-label`;
|
|
19828
19871
|
const valueId = `${reactId}-value`;
|
|
@@ -19831,13 +19874,13 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
19831
19874
|
const searchInputId = `${reactId}-search`;
|
|
19832
19875
|
const effectiveSearchValue = searchValue ?? internalSearchValue;
|
|
19833
19876
|
const shouldFilterLocally = !onSearchChange && filterOption !== null;
|
|
19834
|
-
const visibleOptions =
|
|
19877
|
+
const visibleOptions = React81.useMemo(() => {
|
|
19835
19878
|
if (!shouldFilterLocally || !effectiveSearchValue) {
|
|
19836
19879
|
return options;
|
|
19837
19880
|
}
|
|
19838
19881
|
return options.filter((option) => filterOption(option, effectiveSearchValue));
|
|
19839
19882
|
}, [effectiveSearchValue, filterOption, options, shouldFilterLocally]);
|
|
19840
|
-
const selectedIndex =
|
|
19883
|
+
const selectedIndex = React81.useMemo(
|
|
19841
19884
|
() => visibleOptions.findIndex((option) => option.value === value?.value),
|
|
19842
19885
|
[value?.value, visibleOptions]
|
|
19843
19886
|
);
|
|
@@ -19863,7 +19906,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
19863
19906
|
},
|
|
19864
19907
|
[handleOnOpenChange]
|
|
19865
19908
|
);
|
|
19866
|
-
|
|
19909
|
+
React81.useEffect(() => {
|
|
19867
19910
|
if (isBlocked) {
|
|
19868
19911
|
setSelectOpen(false);
|
|
19869
19912
|
return;
|
|
@@ -19876,7 +19919,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
19876
19919
|
window.cancelAnimationFrame(frameId);
|
|
19877
19920
|
};
|
|
19878
19921
|
}, [isBlocked, open, setSelectOpen]);
|
|
19879
|
-
|
|
19922
|
+
React81.useEffect(() => {
|
|
19880
19923
|
if (!open) {
|
|
19881
19924
|
setHighlightedIndex(-1);
|
|
19882
19925
|
return;
|
|
@@ -19944,7 +19987,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
19944
19987
|
}
|
|
19945
19988
|
}
|
|
19946
19989
|
}
|
|
19947
|
-
const content = /* @__PURE__ */
|
|
19990
|
+
const content = /* @__PURE__ */ jsx192(
|
|
19948
19991
|
AirbnbSearchableSelectContent,
|
|
19949
19992
|
{
|
|
19950
19993
|
inputId: searchInputId,
|
|
@@ -19971,10 +20014,10 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
19971
20014
|
onOptionHover: setHighlightedIndex
|
|
19972
20015
|
}
|
|
19973
20016
|
);
|
|
19974
|
-
|
|
20017
|
+
React81.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
19975
20018
|
return /* @__PURE__ */ jsxs124("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
|
|
19976
|
-
name && /* @__PURE__ */
|
|
19977
|
-
/* @__PURE__ */
|
|
20019
|
+
name && /* @__PURE__ */ jsx192("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
20020
|
+
/* @__PURE__ */ jsx192(
|
|
19978
20021
|
AirbnbFieldTrigger,
|
|
19979
20022
|
{
|
|
19980
20023
|
id: `${reactId}-trigger`,
|
|
@@ -20008,7 +20051,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20008
20051
|
},
|
|
20009
20052
|
onKeyDown: handleTriggerKeyDown,
|
|
20010
20053
|
onBlur,
|
|
20011
|
-
trailingAdornment: /* @__PURE__ */
|
|
20054
|
+
trailingAdornment: /* @__PURE__ */ jsx192(
|
|
20012
20055
|
ChevronDown7,
|
|
20013
20056
|
{
|
|
20014
20057
|
className: cn(
|
|
@@ -20019,7 +20062,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20019
20062
|
)
|
|
20020
20063
|
}
|
|
20021
20064
|
),
|
|
20022
|
-
isMobile3 ? /* @__PURE__ */
|
|
20065
|
+
isMobile3 ? /* @__PURE__ */ jsx192(
|
|
20023
20066
|
Drawer,
|
|
20024
20067
|
{
|
|
20025
20068
|
open,
|
|
@@ -20032,12 +20075,12 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20032
20075
|
closeSelect();
|
|
20033
20076
|
},
|
|
20034
20077
|
children: /* @__PURE__ */ jsxs124(DrawerContent, { onClose: closeSelect, lockScroll: false, children: [
|
|
20035
|
-
/* @__PURE__ */
|
|
20036
|
-
/* @__PURE__ */
|
|
20037
|
-
/* @__PURE__ */
|
|
20078
|
+
/* @__PURE__ */ jsx192(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
20079
|
+
/* @__PURE__ */ jsx192(DrawerDescription, { className: "sr-only", children: label }),
|
|
20080
|
+
/* @__PURE__ */ jsx192("div", { className: "px-5 pb-5 pt-1", children: content })
|
|
20038
20081
|
] })
|
|
20039
20082
|
}
|
|
20040
|
-
) : open ? /* @__PURE__ */
|
|
20083
|
+
) : open ? /* @__PURE__ */ jsx192(
|
|
20041
20084
|
"div",
|
|
20042
20085
|
{
|
|
20043
20086
|
className: cn(
|
|
@@ -20049,7 +20092,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20049
20092
|
) : null
|
|
20050
20093
|
] });
|
|
20051
20094
|
};
|
|
20052
|
-
var AirbnbSearchableSelect =
|
|
20095
|
+
var AirbnbSearchableSelect = React81.forwardRef(
|
|
20053
20096
|
AirbnbSearchableSelectInternal
|
|
20054
20097
|
);
|
|
20055
20098
|
function AirbnbSearchableSelectContent({
|
|
@@ -20076,9 +20119,9 @@ function AirbnbSearchableSelectContent({
|
|
|
20076
20119
|
onOptionClick,
|
|
20077
20120
|
onOptionHover
|
|
20078
20121
|
}) {
|
|
20079
|
-
const listRef =
|
|
20080
|
-
const lastLoadMoreOptionsLengthRef =
|
|
20081
|
-
const previousHighlightedIndexRef =
|
|
20122
|
+
const listRef = React81.useRef(null);
|
|
20123
|
+
const lastLoadMoreOptionsLengthRef = React81.useRef(null);
|
|
20124
|
+
const previousHighlightedIndexRef = React81.useRef(highlightedIndex);
|
|
20082
20125
|
const rowCount = options.length + (loading && options.length > 0 ? 1 : 0);
|
|
20083
20126
|
const virtualizer = useVirtualizer3({
|
|
20084
20127
|
count: rowCount,
|
|
@@ -20089,7 +20132,7 @@ function AirbnbSearchableSelectContent({
|
|
|
20089
20132
|
const virtualItems = virtualizer.getVirtualItems();
|
|
20090
20133
|
const emptyMessage = noOptionsMessage?.() ?? "No matches found";
|
|
20091
20134
|
const loadingText = loadingMessage?.() ?? "Loading...";
|
|
20092
|
-
|
|
20135
|
+
React81.useEffect(() => {
|
|
20093
20136
|
const lastItem = virtualItems[virtualItems.length - 1];
|
|
20094
20137
|
const shouldLoadMore = !!lastItem && hasNextPage && !loading && lastItem.index >= options.length - LOAD_MORE_THRESHOLD;
|
|
20095
20138
|
if (shouldLoadMore && lastLoadMoreOptionsLengthRef.current !== options.length) {
|
|
@@ -20097,7 +20140,7 @@ function AirbnbSearchableSelectContent({
|
|
|
20097
20140
|
onLoadMore?.();
|
|
20098
20141
|
}
|
|
20099
20142
|
}, [hasNextPage, loading, onLoadMore, options.length, virtualItems]);
|
|
20100
|
-
|
|
20143
|
+
React81.useEffect(() => {
|
|
20101
20144
|
const hasHighlightedIndexChanged = previousHighlightedIndexRef.current !== highlightedIndex;
|
|
20102
20145
|
previousHighlightedIndexRef.current = highlightedIndex;
|
|
20103
20146
|
if (highlightedIndex >= 0 && hasHighlightedIndexChanged) {
|
|
@@ -20106,14 +20149,14 @@ function AirbnbSearchableSelectContent({
|
|
|
20106
20149
|
}, [highlightedIndex, virtualizer]);
|
|
20107
20150
|
return /* @__PURE__ */ jsxs124("div", { className: "p-2", children: [
|
|
20108
20151
|
/* @__PURE__ */ jsxs124("div", { className: "relative mb-2", children: [
|
|
20109
|
-
/* @__PURE__ */
|
|
20110
|
-
|
|
20152
|
+
/* @__PURE__ */ jsx192(
|
|
20153
|
+
Search5,
|
|
20111
20154
|
{
|
|
20112
20155
|
"aria-hidden": "true",
|
|
20113
20156
|
className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 text-[#9696B9]"
|
|
20114
20157
|
}
|
|
20115
20158
|
),
|
|
20116
|
-
/* @__PURE__ */
|
|
20159
|
+
/* @__PURE__ */ jsx192(
|
|
20117
20160
|
"input",
|
|
20118
20161
|
{
|
|
20119
20162
|
id: inputId,
|
|
@@ -20132,7 +20175,7 @@ function AirbnbSearchableSelectContent({
|
|
|
20132
20175
|
}
|
|
20133
20176
|
)
|
|
20134
20177
|
] }),
|
|
20135
|
-
loading && options.length === 0 ? /* @__PURE__ */
|
|
20178
|
+
loading && options.length === 0 ? /* @__PURE__ */ jsx192("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: loadingText }) : options.length === 0 ? /* @__PURE__ */ jsx192("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : /* @__PURE__ */ jsx192(
|
|
20136
20179
|
"div",
|
|
20137
20180
|
{
|
|
20138
20181
|
id: listboxId,
|
|
@@ -20141,7 +20184,7 @@ function AirbnbSearchableSelectContent({
|
|
|
20141
20184
|
"aria-labelledby": labelId,
|
|
20142
20185
|
className: cn("overflow-y-auto outline-none", menuClassName),
|
|
20143
20186
|
style: { height: Math.min(height, rowCount * ROW_HEIGHT) },
|
|
20144
|
-
children: /* @__PURE__ */
|
|
20187
|
+
children: /* @__PURE__ */ jsx192(
|
|
20145
20188
|
"div",
|
|
20146
20189
|
{
|
|
20147
20190
|
className: "relative w-full",
|
|
@@ -20149,7 +20192,7 @@ function AirbnbSearchableSelectContent({
|
|
|
20149
20192
|
children: virtualItems.map((virtualItem) => {
|
|
20150
20193
|
const option = options[virtualItem.index];
|
|
20151
20194
|
if (!option) {
|
|
20152
|
-
return /* @__PURE__ */
|
|
20195
|
+
return /* @__PURE__ */ jsx192(
|
|
20153
20196
|
"div",
|
|
20154
20197
|
{
|
|
20155
20198
|
className: "absolute left-0 top-0 flex w-full items-center px-4 text-base leading-6 text-[#6C6C6C]",
|
|
@@ -20164,7 +20207,7 @@ function AirbnbSearchableSelectContent({
|
|
|
20164
20207
|
}
|
|
20165
20208
|
const isSelected = value?.value === option.value;
|
|
20166
20209
|
const isHighlighted = virtualItem.index === highlightedIndex;
|
|
20167
|
-
return /* @__PURE__ */
|
|
20210
|
+
return /* @__PURE__ */ jsx192(
|
|
20168
20211
|
"button",
|
|
20169
20212
|
{
|
|
20170
20213
|
id: getOptionId(idPrefix, virtualItem.index),
|
|
@@ -20186,7 +20229,7 @@ function AirbnbSearchableSelectContent({
|
|
|
20186
20229
|
height: `${virtualItem.size}px`,
|
|
20187
20230
|
transform: `translateY(${virtualItem.start}px)`
|
|
20188
20231
|
},
|
|
20189
|
-
children: /* @__PURE__ */
|
|
20232
|
+
children: /* @__PURE__ */ jsx192("span", { className: "truncate text-center", children: String(option.label) })
|
|
20190
20233
|
},
|
|
20191
20234
|
`${String(option.value)}-${virtualItem.index}`
|
|
20192
20235
|
);
|
|
@@ -20215,16 +20258,16 @@ function getNextEnabledIndex(options, startIndex, step) {
|
|
|
20215
20258
|
}
|
|
20216
20259
|
|
|
20217
20260
|
// src/airbnb-fields/search-input/SearchInput.tsx
|
|
20218
|
-
import * as
|
|
20261
|
+
import * as React82 from "react";
|
|
20219
20262
|
import { useTranslation as useTranslation44 } from "react-i18next";
|
|
20220
|
-
import { Search as
|
|
20221
|
-
import { jsx as
|
|
20222
|
-
var AirbnbSearchInput =
|
|
20263
|
+
import { Search as Search6, X as X11 } from "lucide-react";
|
|
20264
|
+
import { jsx as jsx193, jsxs as jsxs125 } from "react/jsx-runtime";
|
|
20265
|
+
var AirbnbSearchInput = React82.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
|
|
20223
20266
|
const { t } = useTranslation44();
|
|
20224
20267
|
const placeholderText = placeholder || t("search_property") + "...";
|
|
20225
20268
|
return /* @__PURE__ */ jsxs125("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
|
|
20226
|
-
/* @__PURE__ */
|
|
20227
|
-
/* @__PURE__ */
|
|
20269
|
+
/* @__PURE__ */ jsx193(Search6, { className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]" }),
|
|
20270
|
+
/* @__PURE__ */ jsx193(
|
|
20228
20271
|
"input",
|
|
20229
20272
|
{
|
|
20230
20273
|
...props,
|
|
@@ -20243,13 +20286,13 @@ var AirbnbSearchInput = React81.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
20243
20286
|
)
|
|
20244
20287
|
}
|
|
20245
20288
|
),
|
|
20246
|
-
onReset && /* @__PURE__ */
|
|
20289
|
+
onReset && /* @__PURE__ */ jsx193(
|
|
20247
20290
|
Button,
|
|
20248
20291
|
{
|
|
20249
20292
|
variant: "ghost",
|
|
20250
20293
|
onClick: onReset,
|
|
20251
20294
|
className: "absolute right-0 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]",
|
|
20252
|
-
children: /* @__PURE__ */
|
|
20295
|
+
children: /* @__PURE__ */ jsx193(X11, { className: "h-5 w-5" })
|
|
20253
20296
|
}
|
|
20254
20297
|
)
|
|
20255
20298
|
] });
|
|
@@ -20257,11 +20300,11 @@ var AirbnbSearchInput = React81.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
20257
20300
|
AirbnbSearchInput.displayName = "AirbnbSearchInput";
|
|
20258
20301
|
|
|
20259
20302
|
// src/airbnb-fields/switch/Switch.tsx
|
|
20260
|
-
import * as
|
|
20303
|
+
import * as React83 from "react";
|
|
20261
20304
|
import * as SwitchPrimitives2 from "@radix-ui/react-switch";
|
|
20262
20305
|
import { Check as Check8 } from "lucide-react";
|
|
20263
|
-
import { Fragment as Fragment18, jsx as
|
|
20264
|
-
var AirbnbSwitch =
|
|
20306
|
+
import { Fragment as Fragment18, jsx as jsx194, jsxs as jsxs126 } from "react/jsx-runtime";
|
|
20307
|
+
var AirbnbSwitch = React83.forwardRef(
|
|
20265
20308
|
({
|
|
20266
20309
|
className,
|
|
20267
20310
|
value,
|
|
@@ -20275,9 +20318,9 @@ var AirbnbSwitch = React82.forwardRef(
|
|
|
20275
20318
|
wrapperClassName,
|
|
20276
20319
|
...props
|
|
20277
20320
|
}, ref) => {
|
|
20278
|
-
const generatedId =
|
|
20321
|
+
const generatedId = React83.useId();
|
|
20279
20322
|
const fieldId = id || generatedId;
|
|
20280
|
-
const switchElement = /* @__PURE__ */
|
|
20323
|
+
const switchElement = /* @__PURE__ */ jsx194(
|
|
20281
20324
|
SwitchPrimitives2.Root,
|
|
20282
20325
|
{
|
|
20283
20326
|
ref,
|
|
@@ -20297,14 +20340,14 @@ var AirbnbSwitch = React82.forwardRef(
|
|
|
20297
20340
|
"aria-busy": loading,
|
|
20298
20341
|
"aria-readonly": readOnly,
|
|
20299
20342
|
...props,
|
|
20300
|
-
children: /* @__PURE__ */
|
|
20343
|
+
children: /* @__PURE__ */ jsx194(
|
|
20301
20344
|
SwitchPrimitives2.Thumb,
|
|
20302
20345
|
{
|
|
20303
20346
|
className: cn(
|
|
20304
20347
|
"flex h-[20px] w-[20px] items-center justify-center rounded-full bg-white shadow-[0_1px_3px_rgba(0,0,0,0.22)] transition-transform duration-200",
|
|
20305
20348
|
"data-[state=checked]:translate-x-[12px] data-[state=unchecked]:translate-x-0"
|
|
20306
20349
|
),
|
|
20307
|
-
children: /* @__PURE__ */
|
|
20350
|
+
children: /* @__PURE__ */ jsx194(
|
|
20308
20351
|
Check8,
|
|
20309
20352
|
{
|
|
20310
20353
|
"aria-hidden": "true",
|
|
@@ -20322,7 +20365,7 @@ var AirbnbSwitch = React82.forwardRef(
|
|
|
20322
20365
|
return /* @__PURE__ */ jsxs126(Fragment18, { children: [
|
|
20323
20366
|
/* @__PURE__ */ jsxs126("div", { className: cn("flex items-center gap-x-3 gap-y-1.5", wrapperClassName), children: [
|
|
20324
20367
|
switchElement,
|
|
20325
|
-
label && /* @__PURE__ */
|
|
20368
|
+
label && /* @__PURE__ */ jsx194(
|
|
20326
20369
|
Label,
|
|
20327
20370
|
{
|
|
20328
20371
|
htmlFor: fieldId,
|
|
@@ -20334,7 +20377,7 @@ var AirbnbSwitch = React82.forwardRef(
|
|
|
20334
20377
|
}
|
|
20335
20378
|
)
|
|
20336
20379
|
] }),
|
|
20337
|
-
error && /* @__PURE__ */
|
|
20380
|
+
error && /* @__PURE__ */ jsx194(ErrorMessage, { disabled, children: error })
|
|
20338
20381
|
] });
|
|
20339
20382
|
}
|
|
20340
20383
|
);
|
|
@@ -20401,6 +20444,7 @@ export {
|
|
|
20401
20444
|
CommingSoonBadge,
|
|
20402
20445
|
ConfirmationDialog,
|
|
20403
20446
|
CopyIcon,
|
|
20447
|
+
CopyInput,
|
|
20404
20448
|
CopyLinkButton,
|
|
20405
20449
|
CopyString,
|
|
20406
20450
|
Counter,
|