@chekinapp/ui 0.0.109 → 0.0.110
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 +1752 -1028
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -10
- package/dist/index.d.ts +112 -10
- package/dist/index.js +1754 -1038
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2722,7 +2722,15 @@ function useLoadMore({
|
|
|
2722
2722
|
observer.observe(element);
|
|
2723
2723
|
observerRef.current = observer;
|
|
2724
2724
|
},
|
|
2725
|
-
[
|
|
2725
|
+
[
|
|
2726
|
+
cleanupObserver,
|
|
2727
|
+
disabled,
|
|
2728
|
+
handleLoadMore,
|
|
2729
|
+
hasNextPage,
|
|
2730
|
+
loading,
|
|
2731
|
+
rootMargin,
|
|
2732
|
+
threshold
|
|
2733
|
+
]
|
|
2726
2734
|
);
|
|
2727
2735
|
const loadMoreRef = useCallback5(
|
|
2728
2736
|
(element) => {
|
|
@@ -5671,7 +5679,15 @@ var translation_default2 = {
|
|
|
5671
5679
|
show_less: "Show less",
|
|
5672
5680
|
show_more: "Show more",
|
|
5673
5681
|
tap_here_to_sign: "Tap here to sign",
|
|
5674
|
-
click_here_to_sign: "Click here to sign"
|
|
5682
|
+
click_here_to_sign: "Click here to sign",
|
|
5683
|
+
prefix: "Prefix",
|
|
5684
|
+
prefix_required: "Prefix is required",
|
|
5685
|
+
reset: "Reset",
|
|
5686
|
+
show_password: "Show password",
|
|
5687
|
+
hide_password: "Hide password",
|
|
5688
|
+
increment: "Increment",
|
|
5689
|
+
decrement: "Decrement",
|
|
5690
|
+
create_option: 'Create "{{input}}"'
|
|
5675
5691
|
};
|
|
5676
5692
|
|
|
5677
5693
|
// src/locales/es/translation.json
|
|
@@ -12071,7 +12087,7 @@ function Fieldset({
|
|
|
12071
12087
|
className: cn(
|
|
12072
12088
|
"absolute box-border inline-flex max-w-full cursor-text items-center pl-[3px] pr-5 transition-all duration-100 ease-in",
|
|
12073
12089
|
"left-[13px] text-[var(--chekin-color-gray-1)]",
|
|
12074
|
-
isEmpty && !isFocused ? "top-[
|
|
12090
|
+
isEmpty && !isFocused ? "top-[12px]" : "top-[-10px] !pl-1 !pr-[22px]",
|
|
12075
12091
|
isFocused && "text-[var(--chekin-color-brand-blue)]",
|
|
12076
12092
|
raised && invalid && "text-[var(--error-message-color)]",
|
|
12077
12093
|
readOnly && "cursor-default",
|
|
@@ -12325,7 +12341,7 @@ var Input = React44.forwardRef(
|
|
|
12325
12341
|
onClick: onReset,
|
|
12326
12342
|
disabled,
|
|
12327
12343
|
className: "absolute right-0 top-0 flex h-full w-10 items-center justify-center border-0 bg-transparent p-0 text-[#9696b9] hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50",
|
|
12328
|
-
"aria-label": "
|
|
12344
|
+
"aria-label": t("reset"),
|
|
12329
12345
|
children: /* @__PURE__ */ jsx143(X9, { size: 14 })
|
|
12330
12346
|
}
|
|
12331
12347
|
),
|
|
@@ -12335,7 +12351,7 @@ var Input = React44.forwardRef(
|
|
|
12335
12351
|
type: "button",
|
|
12336
12352
|
onClick: togglePasswordReveal,
|
|
12337
12353
|
className: "absolute right-[14px] top-[18px] flex h-[13px] w-[21px] cursor-pointer items-center justify-center border-0 bg-transparent p-0 hover:opacity-85",
|
|
12338
|
-
"aria-label": isPasswordRevealed ? "
|
|
12354
|
+
"aria-label": isPasswordRevealed ? t("hide_password") : t("show_password"),
|
|
12339
12355
|
children: /* @__PURE__ */ jsx143(
|
|
12340
12356
|
Eye,
|
|
12341
12357
|
{
|
|
@@ -12355,7 +12371,7 @@ var Input = React44.forwardRef(
|
|
|
12355
12371
|
type: "button",
|
|
12356
12372
|
onClick: onDecrement,
|
|
12357
12373
|
className: "mr-2 inline-flex h-[23px] w-8 cursor-pointer items-center justify-center rounded-[3px] border-0 bg-[var(--chekin-color-brand-blue)] p-0 text-[20px] font-bold text-white outline-none hover:opacity-90 active:opacity-100",
|
|
12358
|
-
"aria-label": "
|
|
12374
|
+
"aria-label": t("decrement"),
|
|
12359
12375
|
children: /* @__PURE__ */ jsx143(Minus4, { size: 16, strokeWidth: 3, "aria-hidden": true })
|
|
12360
12376
|
}
|
|
12361
12377
|
),
|
|
@@ -12365,7 +12381,7 @@ var Input = React44.forwardRef(
|
|
|
12365
12381
|
type: "button",
|
|
12366
12382
|
onClick: onIncrement,
|
|
12367
12383
|
className: "inline-flex h-[23px] w-8 cursor-pointer items-center justify-center rounded-[3px] border-0 bg-[var(--chekin-color-brand-blue)] p-0 text-[20px] font-bold text-white outline-none hover:opacity-90 active:opacity-100",
|
|
12368
|
-
"aria-label": "
|
|
12384
|
+
"aria-label": t("increment"),
|
|
12369
12385
|
children: /* @__PURE__ */ jsx143(Plus3, { size: 16, strokeWidth: 3, "aria-hidden": true })
|
|
12370
12386
|
}
|
|
12371
12387
|
)
|
|
@@ -12399,7 +12415,11 @@ var Input = React44.forwardRef(
|
|
|
12399
12415
|
);
|
|
12400
12416
|
Input.displayName = "Input";
|
|
12401
12417
|
|
|
12402
|
-
// src/dashboard/
|
|
12418
|
+
// src/dashboard/phone-input/PhoneInput.tsx
|
|
12419
|
+
import * as React49 from "react";
|
|
12420
|
+
import { useTranslation as useTranslation31 } from "react-i18next";
|
|
12421
|
+
|
|
12422
|
+
// src/dashboard/searchable-select/SearchableSelect.tsx
|
|
12403
12423
|
import * as React48 from "react";
|
|
12404
12424
|
import { useTranslation as useTranslation30 } from "react-i18next";
|
|
12405
12425
|
|
|
@@ -12750,6 +12770,128 @@ function SelectTrigger({
|
|
|
12750
12770
|
);
|
|
12751
12771
|
}
|
|
12752
12772
|
|
|
12773
|
+
// src/dashboard/_select-internals/ComboboxTrigger.tsx
|
|
12774
|
+
import { SquareX as SquareX2 } from "lucide-react";
|
|
12775
|
+
import { jsx as jsx149, jsxs as jsxs96 } from "react/jsx-runtime";
|
|
12776
|
+
function ComboboxTrigger({
|
|
12777
|
+
triggerId,
|
|
12778
|
+
listboxId,
|
|
12779
|
+
labelId,
|
|
12780
|
+
valueId,
|
|
12781
|
+
describedErrorId,
|
|
12782
|
+
isOpen,
|
|
12783
|
+
isFocused,
|
|
12784
|
+
isBlocked,
|
|
12785
|
+
hasValue,
|
|
12786
|
+
isEmpty,
|
|
12787
|
+
disabled,
|
|
12788
|
+
readOnly,
|
|
12789
|
+
loading,
|
|
12790
|
+
invalid,
|
|
12791
|
+
isMulti,
|
|
12792
|
+
inputRef,
|
|
12793
|
+
inputValue,
|
|
12794
|
+
placeholder,
|
|
12795
|
+
highlightedIndex,
|
|
12796
|
+
getOptionId: getOptionId2,
|
|
12797
|
+
onInputChange,
|
|
12798
|
+
onInputFocus,
|
|
12799
|
+
onInputKeyDown,
|
|
12800
|
+
onContainerClick,
|
|
12801
|
+
showClear,
|
|
12802
|
+
onClear,
|
|
12803
|
+
clearLabel,
|
|
12804
|
+
leadingContent,
|
|
12805
|
+
containerClassName,
|
|
12806
|
+
inputClassName
|
|
12807
|
+
}) {
|
|
12808
|
+
const activeOptionId = isOpen && highlightedIndex !== void 0 && highlightedIndex >= 0 && getOptionId2 ? getOptionId2(highlightedIndex) : void 0;
|
|
12809
|
+
return /* @__PURE__ */ jsxs96(
|
|
12810
|
+
"div",
|
|
12811
|
+
{
|
|
12812
|
+
role: "combobox",
|
|
12813
|
+
"aria-haspopup": "listbox",
|
|
12814
|
+
"aria-expanded": isOpen,
|
|
12815
|
+
"aria-controls": listboxId,
|
|
12816
|
+
"aria-labelledby": hasValue && valueId ? `${labelId} ${valueId}` : labelId,
|
|
12817
|
+
"aria-describedby": describedErrorId,
|
|
12818
|
+
"aria-invalid": invalid,
|
|
12819
|
+
"aria-busy": loading,
|
|
12820
|
+
"aria-disabled": isBlocked,
|
|
12821
|
+
onClick: onContainerClick,
|
|
12822
|
+
className: cn(
|
|
12823
|
+
"relative box-border flex w-full cursor-text rounded-[6px] border-0 text-left text-[16px] font-medium leading-5 outline-none transition-colors duration-200",
|
|
12824
|
+
"min-h-12",
|
|
12825
|
+
isEmpty && !isFocused ? "bg-[var(--chekin-color-surface-input-empty)]" : "bg-transparent",
|
|
12826
|
+
disabled && "cursor-not-allowed",
|
|
12827
|
+
loading && "cursor-progress",
|
|
12828
|
+
containerClassName
|
|
12829
|
+
),
|
|
12830
|
+
children: [
|
|
12831
|
+
/* @__PURE__ */ jsxs96(
|
|
12832
|
+
"div",
|
|
12833
|
+
{
|
|
12834
|
+
className: cn(
|
|
12835
|
+
"flex min-w-0 flex-1 items-center gap-2 py-[10px] pl-4",
|
|
12836
|
+
isMulti && "flex-wrap"
|
|
12837
|
+
),
|
|
12838
|
+
children: [
|
|
12839
|
+
leadingContent,
|
|
12840
|
+
/* @__PURE__ */ jsx149(
|
|
12841
|
+
"input",
|
|
12842
|
+
{
|
|
12843
|
+
ref: inputRef,
|
|
12844
|
+
id: triggerId,
|
|
12845
|
+
type: "text",
|
|
12846
|
+
value: inputValue,
|
|
12847
|
+
onChange: onInputChange,
|
|
12848
|
+
onFocus: onInputFocus,
|
|
12849
|
+
onKeyDown: onInputKeyDown,
|
|
12850
|
+
disabled: isBlocked,
|
|
12851
|
+
readOnly,
|
|
12852
|
+
placeholder: isFocused || isOpen ? placeholder ?? "" : "",
|
|
12853
|
+
autoComplete: "off",
|
|
12854
|
+
"aria-autocomplete": "list",
|
|
12855
|
+
"aria-controls": listboxId,
|
|
12856
|
+
"aria-activedescendant": activeOptionId,
|
|
12857
|
+
className: cn(
|
|
12858
|
+
"m-0 box-border min-w-0 flex-1 border-0 bg-transparent p-0 text-[16px] font-medium leading-5 text-[var(--chekin-color-brand-navy)] outline-none placeholder:text-[var(--chekin-color-gray-1)]",
|
|
12859
|
+
isMulti && "min-w-[40px]",
|
|
12860
|
+
isBlocked && "cursor-not-allowed",
|
|
12861
|
+
inputClassName
|
|
12862
|
+
)
|
|
12863
|
+
}
|
|
12864
|
+
)
|
|
12865
|
+
]
|
|
12866
|
+
}
|
|
12867
|
+
),
|
|
12868
|
+
/* @__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: [
|
|
12869
|
+
loading && /* @__PURE__ */ jsx149(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
12870
|
+
showClear && /* @__PURE__ */ jsx149(
|
|
12871
|
+
"button",
|
|
12872
|
+
{
|
|
12873
|
+
type: "button",
|
|
12874
|
+
onClick: onClear,
|
|
12875
|
+
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]",
|
|
12876
|
+
"aria-label": clearLabel,
|
|
12877
|
+
children: /* @__PURE__ */ jsx149(SquareX2, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
12878
|
+
}
|
|
12879
|
+
),
|
|
12880
|
+
/* @__PURE__ */ jsx149(
|
|
12881
|
+
RotateArrow,
|
|
12882
|
+
{
|
|
12883
|
+
shouldRotate: isOpen,
|
|
12884
|
+
className: cn(
|
|
12885
|
+
isFocused || isOpen ? "text-[var(--chekin-color-brand-blue)]" : "text-[var(--chekin-color-gray-2)]"
|
|
12886
|
+
)
|
|
12887
|
+
}
|
|
12888
|
+
)
|
|
12889
|
+
] })
|
|
12890
|
+
]
|
|
12891
|
+
}
|
|
12892
|
+
);
|
|
12893
|
+
}
|
|
12894
|
+
|
|
12753
12895
|
// src/dashboard/_select-internals/useSelectIds.ts
|
|
12754
12896
|
import * as React45 from "react";
|
|
12755
12897
|
function useSelectIds({
|
|
@@ -12834,9 +12976,9 @@ function useSelectSearch({
|
|
|
12834
12976
|
return { searchValue, setSearchValue, filteredOptions, clearSearch };
|
|
12835
12977
|
}
|
|
12836
12978
|
|
|
12837
|
-
// src/dashboard/select/
|
|
12838
|
-
import { jsx as
|
|
12839
|
-
function
|
|
12979
|
+
// src/dashboard/searchable-select/SearchableSelect.tsx
|
|
12980
|
+
import { jsx as jsx150, jsxs as jsxs97 } from "react/jsx-runtime";
|
|
12981
|
+
function SearchableSelectInternal({
|
|
12840
12982
|
options = [],
|
|
12841
12983
|
value,
|
|
12842
12984
|
onChange,
|
|
@@ -12959,7 +13101,7 @@ function SelectInternal({
|
|
|
12959
13101
|
setIsOpen(false);
|
|
12960
13102
|
}
|
|
12961
13103
|
};
|
|
12962
|
-
return /* @__PURE__ */
|
|
13104
|
+
return /* @__PURE__ */ jsxs97(
|
|
12963
13105
|
SelectFieldShell,
|
|
12964
13106
|
{
|
|
12965
13107
|
containerRef,
|
|
@@ -12977,7 +13119,7 @@ function SelectInternal({
|
|
|
12977
13119
|
name,
|
|
12978
13120
|
hiddenValue: value ? String(value.value) : "",
|
|
12979
13121
|
children: [
|
|
12980
|
-
/* @__PURE__ */
|
|
13122
|
+
/* @__PURE__ */ jsx150(
|
|
12981
13123
|
SelectTrigger,
|
|
12982
13124
|
{
|
|
12983
13125
|
triggerRef,
|
|
@@ -12999,7 +13141,7 @@ function SelectInternal({
|
|
|
12999
13141
|
onBlur
|
|
13000
13142
|
}
|
|
13001
13143
|
),
|
|
13002
|
-
/* @__PURE__ */
|
|
13144
|
+
/* @__PURE__ */ jsx150(
|
|
13003
13145
|
Fieldset,
|
|
13004
13146
|
{
|
|
13005
13147
|
isFocused: isOpen,
|
|
@@ -13013,10 +13155,10 @@ function SelectInternal({
|
|
|
13013
13155
|
legend: typeof label === "string" ? label : void 0,
|
|
13014
13156
|
label,
|
|
13015
13157
|
tooltip,
|
|
13016
|
-
|
|
13158
|
+
labelClassName: "cursor-pointer"
|
|
13017
13159
|
}
|
|
13018
13160
|
),
|
|
13019
|
-
/* @__PURE__ */
|
|
13161
|
+
/* @__PURE__ */ jsxs97(
|
|
13020
13162
|
SelectMenuPanel,
|
|
13021
13163
|
{
|
|
13022
13164
|
isOpen,
|
|
@@ -13026,7 +13168,7 @@ function SelectInternal({
|
|
|
13026
13168
|
className: dropdownClassName,
|
|
13027
13169
|
drawerClassName,
|
|
13028
13170
|
children: [
|
|
13029
|
-
searchable && /* @__PURE__ */
|
|
13171
|
+
searchable && /* @__PURE__ */ jsx150(
|
|
13030
13172
|
SelectSearchInput,
|
|
13031
13173
|
{
|
|
13032
13174
|
inputRef: searchInputRef,
|
|
@@ -13038,7 +13180,7 @@ function SelectInternal({
|
|
|
13038
13180
|
onKeyDown: handleSearchKeyDown
|
|
13039
13181
|
}
|
|
13040
13182
|
),
|
|
13041
|
-
/* @__PURE__ */
|
|
13183
|
+
/* @__PURE__ */ jsx150(
|
|
13042
13184
|
SelectMenu,
|
|
13043
13185
|
{
|
|
13044
13186
|
id: listboxId,
|
|
@@ -13066,48 +13208,224 @@ function SelectInternal({
|
|
|
13066
13208
|
}
|
|
13067
13209
|
);
|
|
13068
13210
|
}
|
|
13069
|
-
var
|
|
13070
|
-
|
|
13211
|
+
var SearchableSelect = React48.forwardRef(
|
|
13212
|
+
SearchableSelectInternal
|
|
13071
13213
|
);
|
|
13072
13214
|
|
|
13073
|
-
// src/dashboard/
|
|
13074
|
-
|
|
13075
|
-
|
|
13076
|
-
|
|
13215
|
+
// src/dashboard/phone-input/utils.ts
|
|
13216
|
+
var PREFIX_REGEX = /^\+/;
|
|
13217
|
+
function clearPhoneNumber(value) {
|
|
13218
|
+
return value.replace(/[^0-9]/g, "");
|
|
13219
|
+
}
|
|
13220
|
+
function findPhoneCode(value, codeSet) {
|
|
13221
|
+
const hasPrefix = PREFIX_REGEX.test(value);
|
|
13222
|
+
const maxLength = hasPrefix ? 4 : 3;
|
|
13223
|
+
const minLength = hasPrefix ? 2 : 1;
|
|
13224
|
+
for (let length = minLength; length <= maxLength; length += 1) {
|
|
13225
|
+
const candidate = value.slice(0, length);
|
|
13226
|
+
const normalized = hasPrefix ? candidate : `+${candidate}`;
|
|
13227
|
+
if (codeSet.has(normalized)) {
|
|
13228
|
+
return normalized;
|
|
13229
|
+
}
|
|
13230
|
+
}
|
|
13231
|
+
return void 0;
|
|
13232
|
+
}
|
|
13233
|
+
function parsePhoneValueWithOptions(options) {
|
|
13234
|
+
const codeSet = new Set(options.map((option) => option.value));
|
|
13235
|
+
return (value) => {
|
|
13236
|
+
if (!PREFIX_REGEX.test(value)) {
|
|
13237
|
+
return { code: "", number: value };
|
|
13238
|
+
}
|
|
13239
|
+
const code = findPhoneCode(value, codeSet);
|
|
13240
|
+
if (!code) {
|
|
13241
|
+
return { code: "", number: value };
|
|
13242
|
+
}
|
|
13243
|
+
return {
|
|
13244
|
+
code,
|
|
13245
|
+
number: value.slice(code.length)
|
|
13246
|
+
};
|
|
13247
|
+
};
|
|
13248
|
+
}
|
|
13249
|
+
function findPhoneCodeOption(options, code) {
|
|
13250
|
+
return options.find((option) => option.value === code);
|
|
13251
|
+
}
|
|
13252
|
+
function formatPhoneCodeOptionLabel(option) {
|
|
13253
|
+
const label = String(option.label);
|
|
13254
|
+
const value = String(option.value);
|
|
13255
|
+
return label.includes(value) ? label : `${label} ${value}`;
|
|
13256
|
+
}
|
|
13077
13257
|
|
|
13078
|
-
// src/dashboard/
|
|
13079
|
-
import {
|
|
13080
|
-
|
|
13081
|
-
|
|
13082
|
-
function
|
|
13083
|
-
|
|
13084
|
-
|
|
13085
|
-
|
|
13086
|
-
|
|
13087
|
-
|
|
13088
|
-
|
|
13089
|
-
|
|
13090
|
-
|
|
13091
|
-
|
|
13092
|
-
|
|
13258
|
+
// src/dashboard/phone-input/PhoneInput.tsx
|
|
13259
|
+
import { jsx as jsx151, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
13260
|
+
var EMPTY_VALUE = { code: "", number: "" };
|
|
13261
|
+
var PhoneInput = React49.forwardRef(
|
|
13262
|
+
function PhoneInput2({
|
|
13263
|
+
options,
|
|
13264
|
+
value,
|
|
13265
|
+
onChange,
|
|
13266
|
+
onBlur,
|
|
13267
|
+
name,
|
|
13268
|
+
codeName,
|
|
13269
|
+
numberName,
|
|
13270
|
+
label,
|
|
13271
|
+
topLabel,
|
|
13272
|
+
prefixLabel,
|
|
13273
|
+
placeholder,
|
|
13274
|
+
codePlaceholder = "+00",
|
|
13275
|
+
disabled,
|
|
13276
|
+
loading,
|
|
13277
|
+
readOnly,
|
|
13278
|
+
codeReadOnly,
|
|
13279
|
+
optional,
|
|
13280
|
+
tooltip,
|
|
13281
|
+
error,
|
|
13282
|
+
invalid,
|
|
13283
|
+
className,
|
|
13284
|
+
autoDetectCode = true,
|
|
13285
|
+
searchable = true
|
|
13286
|
+
}, ref) {
|
|
13287
|
+
const { t } = useTranslation31();
|
|
13288
|
+
const safeValue = value ?? EMPTY_VALUE;
|
|
13289
|
+
const resolvedLabel = label ?? "";
|
|
13290
|
+
const resolvedPrefixLabel = prefixLabel ?? t("prefix");
|
|
13291
|
+
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
13292
|
+
const isCodeBlocked = isBlocked || Boolean(readOnly) || Boolean(codeReadOnly);
|
|
13293
|
+
const hasExternalError = Boolean(error);
|
|
13294
|
+
const isPrefixRequired = autoDetectCode && Boolean(safeValue.number) && !safeValue.code;
|
|
13295
|
+
const hasInvalidState = hasExternalError || Boolean(invalid) || isPrefixRequired;
|
|
13296
|
+
const errorMessage = error ?? (isPrefixRequired ? t("prefix_required") : void 0);
|
|
13297
|
+
const combinedValue = safeValue.code || safeValue.number ? `${safeValue.code}${safeValue.number}` : "";
|
|
13298
|
+
const codeOptions = React49.useMemo(
|
|
13299
|
+
() => options.map((option) => ({
|
|
13300
|
+
value: option.value,
|
|
13301
|
+
label: formatPhoneCodeOptionLabel(option),
|
|
13302
|
+
data: option.data,
|
|
13303
|
+
isDisabled: option.disabled
|
|
13304
|
+
})),
|
|
13305
|
+
[options]
|
|
13306
|
+
);
|
|
13307
|
+
const selectedCodeOption = React49.useMemo(
|
|
13308
|
+
() => codeOptions.find((option) => option.value === safeValue.code) ?? null,
|
|
13309
|
+
[codeOptions, safeValue.code]
|
|
13310
|
+
);
|
|
13311
|
+
const parsePhoneValue = React49.useMemo(
|
|
13312
|
+
() => parsePhoneValueWithOptions(options),
|
|
13313
|
+
[options]
|
|
13314
|
+
);
|
|
13315
|
+
const emitChange = (next) => {
|
|
13316
|
+
onChange?.(next, name);
|
|
13317
|
+
};
|
|
13318
|
+
const handleCodeChange = (option) => {
|
|
13319
|
+
emitChange({ code: option.value, number: safeValue.number });
|
|
13320
|
+
};
|
|
13321
|
+
const handleNumberChange = (event) => {
|
|
13322
|
+
if (readOnly || disabled) return;
|
|
13323
|
+
const rawValue = event.target.value;
|
|
13324
|
+
if (!autoDetectCode) {
|
|
13325
|
+
emitChange({ code: safeValue.code, number: clearPhoneNumber(rawValue) });
|
|
13326
|
+
return;
|
|
13327
|
+
}
|
|
13328
|
+
const parsed = parsePhoneValue(rawValue);
|
|
13329
|
+
const cleanedNumber = clearPhoneNumber(parsed.number);
|
|
13330
|
+
if (parsed.code) {
|
|
13331
|
+
emitChange({ code: parsed.code, number: cleanedNumber });
|
|
13332
|
+
return;
|
|
13333
|
+
}
|
|
13334
|
+
emitChange({ code: safeValue.code, number: cleanedNumber });
|
|
13335
|
+
};
|
|
13336
|
+
return /* @__PURE__ */ jsxs98(
|
|
13337
|
+
"div",
|
|
13093
13338
|
{
|
|
13094
|
-
|
|
13095
|
-
|
|
13096
|
-
|
|
13097
|
-
|
|
13098
|
-
|
|
13099
|
-
|
|
13100
|
-
|
|
13101
|
-
|
|
13339
|
+
className: cn(
|
|
13340
|
+
"relative w-full max-w-[var(--field-max-width,296px)]",
|
|
13341
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
13342
|
+
loading && "cursor-progress",
|
|
13343
|
+
className
|
|
13344
|
+
),
|
|
13345
|
+
children: [
|
|
13346
|
+
name && /* @__PURE__ */ jsx151("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
13347
|
+
codeName && /* @__PURE__ */ jsx151(
|
|
13348
|
+
"input",
|
|
13349
|
+
{
|
|
13350
|
+
type: "hidden",
|
|
13351
|
+
name: codeName,
|
|
13352
|
+
value: safeValue.code,
|
|
13353
|
+
disabled
|
|
13354
|
+
}
|
|
13355
|
+
),
|
|
13356
|
+
numberName && /* @__PURE__ */ jsx151(
|
|
13357
|
+
"input",
|
|
13358
|
+
{
|
|
13359
|
+
type: "hidden",
|
|
13360
|
+
name: numberName,
|
|
13361
|
+
value: safeValue.number,
|
|
13362
|
+
disabled
|
|
13363
|
+
}
|
|
13364
|
+
),
|
|
13365
|
+
topLabel && /* @__PURE__ */ jsx151("label", { className: "mb-2 block text-[14px] font-medium text-[var(--chekin-color-brand-navy)]", children: topLabel }),
|
|
13366
|
+
/* @__PURE__ */ jsxs98("div", { className: "grid grid-cols-[96px_minmax(0,1fr)] gap-2", children: [
|
|
13367
|
+
/* @__PURE__ */ jsx151(
|
|
13368
|
+
SearchableSelect,
|
|
13369
|
+
{
|
|
13370
|
+
options: codeOptions,
|
|
13371
|
+
value: selectedCodeOption,
|
|
13372
|
+
onChange: handleCodeChange,
|
|
13373
|
+
label: resolvedPrefixLabel,
|
|
13374
|
+
placeholder: codePlaceholder,
|
|
13375
|
+
disabled: isCodeBlocked,
|
|
13376
|
+
loading,
|
|
13377
|
+
invalid: hasInvalidState,
|
|
13378
|
+
hideErrorMessage: true,
|
|
13379
|
+
searchable,
|
|
13380
|
+
getValueLabel: (option) => option.value,
|
|
13381
|
+
className: "!max-w-none",
|
|
13382
|
+
dropdownClassName: "right-auto w-[280px]"
|
|
13383
|
+
}
|
|
13384
|
+
),
|
|
13385
|
+
/* @__PURE__ */ jsx151(
|
|
13386
|
+
Input,
|
|
13387
|
+
{
|
|
13388
|
+
ref,
|
|
13389
|
+
type: "tel",
|
|
13390
|
+
inputMode: "tel",
|
|
13391
|
+
autoComplete: "tel-national",
|
|
13392
|
+
label: resolvedLabel,
|
|
13393
|
+
value: safeValue.number,
|
|
13394
|
+
placeholder,
|
|
13395
|
+
disabled,
|
|
13396
|
+
readOnly,
|
|
13397
|
+
loading,
|
|
13398
|
+
invalid: hasInvalidState,
|
|
13399
|
+
tooltip,
|
|
13400
|
+
"aria-label": resolvedLabel || name,
|
|
13401
|
+
onChange: handleNumberChange,
|
|
13402
|
+
onBlur,
|
|
13403
|
+
renderErrorMessage: false,
|
|
13404
|
+
wrapperClassName: "!max-w-none"
|
|
13405
|
+
}
|
|
13406
|
+
)
|
|
13407
|
+
] }),
|
|
13408
|
+
!errorMessage && optional && /* @__PURE__ */ jsx151("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
13409
|
+
errorMessage && /* @__PURE__ */ jsx151(
|
|
13410
|
+
FieldErrorMessage,
|
|
13411
|
+
{
|
|
13412
|
+
message: errorMessage,
|
|
13413
|
+
"data-testid": name ? `${name}-error` : void 0,
|
|
13414
|
+
className: "mt-[1px] text-[14px]"
|
|
13415
|
+
}
|
|
13416
|
+
)
|
|
13417
|
+
]
|
|
13102
13418
|
}
|
|
13103
|
-
)
|
|
13104
|
-
|
|
13105
|
-
|
|
13419
|
+
);
|
|
13420
|
+
}
|
|
13421
|
+
);
|
|
13422
|
+
PhoneInput.displayName = "PhoneInput";
|
|
13106
13423
|
|
|
13107
|
-
// src/dashboard/
|
|
13108
|
-
import
|
|
13109
|
-
|
|
13110
|
-
|
|
13424
|
+
// src/dashboard/select/Select.tsx
|
|
13425
|
+
import * as React50 from "react";
|
|
13426
|
+
import { useTranslation as useTranslation32 } from "react-i18next";
|
|
13427
|
+
import { jsx as jsx152, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
13428
|
+
function SelectInternal({
|
|
13111
13429
|
options = [],
|
|
13112
13430
|
value,
|
|
13113
13431
|
onChange,
|
|
@@ -13115,6 +13433,7 @@ function MultiSelectInternal({
|
|
|
13115
13433
|
label,
|
|
13116
13434
|
topLabel,
|
|
13117
13435
|
placeholder,
|
|
13436
|
+
getValueLabel,
|
|
13118
13437
|
disabled,
|
|
13119
13438
|
readOnly,
|
|
13120
13439
|
loading,
|
|
@@ -13130,29 +13449,32 @@ function MultiSelectInternal({
|
|
|
13130
13449
|
name,
|
|
13131
13450
|
width,
|
|
13132
13451
|
noOptionsMessage,
|
|
13133
|
-
filterOption,
|
|
13134
|
-
closeMenuOnSelect = false,
|
|
13135
|
-
renderChip,
|
|
13452
|
+
filterOption = defaultFilterOption,
|
|
13136
13453
|
helperText,
|
|
13454
|
+
clearable = true,
|
|
13137
13455
|
isCreatable = false,
|
|
13138
13456
|
onCreateOption,
|
|
13139
|
-
formatCreateLabel
|
|
13457
|
+
formatCreateLabel,
|
|
13140
13458
|
isValidNewOption
|
|
13141
13459
|
}, ref) {
|
|
13142
|
-
const inputRef =
|
|
13143
|
-
const mobileSearchInputRef =
|
|
13144
|
-
const listRef =
|
|
13145
|
-
const optionRefs =
|
|
13146
|
-
const [isFocused, setIsFocused] =
|
|
13147
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
13460
|
+
const inputRef = React50.useRef(null);
|
|
13461
|
+
const mobileSearchInputRef = React50.useRef(null);
|
|
13462
|
+
const listRef = React50.useRef(null);
|
|
13463
|
+
const optionRefs = React50.useRef([]);
|
|
13464
|
+
const [isFocused, setIsFocused] = React50.useState(false);
|
|
13465
|
+
const [highlightedIndex, setHighlightedIndex] = React50.useState(-1);
|
|
13148
13466
|
const isMobile3 = useIsMobile();
|
|
13149
13467
|
const { t } = useTranslation32();
|
|
13150
|
-
const
|
|
13151
|
-
|
|
13152
|
-
|
|
13468
|
+
const resolveLabel = React50.useCallback(
|
|
13469
|
+
(option) => option ? getValueLabel?.(option) ?? String(option.label) : "",
|
|
13470
|
+
[getValueLabel]
|
|
13471
|
+
);
|
|
13472
|
+
const valueLabel = resolveLabel(value);
|
|
13473
|
+
const [inputValue, setInputValue] = React50.useState(valueLabel);
|
|
13474
|
+
const hasValue = Boolean(value);
|
|
13475
|
+
const isEmpty = !hasValue && !inputValue;
|
|
13153
13476
|
const isBlocked = Boolean(disabled) || Boolean(loading) || Boolean(readOnly);
|
|
13154
|
-
const
|
|
13155
|
-
const hasInvalidState = Boolean(triggerError);
|
|
13477
|
+
const hasInvalidState = Boolean(error) || Boolean(invalid);
|
|
13156
13478
|
const errorMessage = typeof error === "string" ? error : void 0;
|
|
13157
13479
|
const { containerRef, isOpen, closeMenu, setIsOpen } = useSelectMenuState({
|
|
13158
13480
|
isBlocked,
|
|
@@ -13160,34 +13482,30 @@ function MultiSelectInternal({
|
|
|
13160
13482
|
onOutsideClick: () => setIsFocused(false)
|
|
13161
13483
|
});
|
|
13162
13484
|
const { triggerId, labelId, valueId, listboxId, describedErrorId, errorId, getOptionId: getOptionId2 } = useSelectIds({ name, hasValue, error, hideErrorMessage });
|
|
13163
|
-
|
|
13164
|
-
|
|
13165
|
-
|
|
13166
|
-
|
|
13167
|
-
const
|
|
13168
|
-
const
|
|
13169
|
-
if (!
|
|
13170
|
-
|
|
13171
|
-
|
|
13485
|
+
React50.useEffect(() => {
|
|
13486
|
+
if (!isFocused) setInputValue(valueLabel);
|
|
13487
|
+
}, [valueLabel, isFocused]);
|
|
13488
|
+
const trimmedInput = inputValue.trim();
|
|
13489
|
+
const isFiltering = trimmedInput.length > 0 && trimmedInput.toLowerCase() !== valueLabel.toLowerCase();
|
|
13490
|
+
const filteredOptions = React50.useMemo(() => {
|
|
13491
|
+
if (!isFiltering) return options;
|
|
13492
|
+
return options.filter((option) => filterOption(option, trimmedInput));
|
|
13493
|
+
}, [options, isFiltering, trimmedInput, filterOption]);
|
|
13494
|
+
const canCreateNewOption = React50.useMemo(() => {
|
|
13495
|
+
if (!isCreatable || !trimmedInput) return false;
|
|
13496
|
+
if (isValidNewOption) return isValidNewOption(trimmedInput, value, options);
|
|
13497
|
+
const lower = trimmedInput.toLowerCase();
|
|
13172
13498
|
const existsInOptions = options.some(
|
|
13173
13499
|
(option) => typeof option.label === "string" && option.label.toLowerCase() === lower
|
|
13174
13500
|
);
|
|
13175
|
-
const
|
|
13176
|
-
|
|
13177
|
-
|
|
13178
|
-
|
|
13179
|
-
}, [isCreatable, trimmedSearch, isValidNewOption, options, selectedValues]);
|
|
13180
|
-
React49.useImperativeHandle(
|
|
13501
|
+
const matchesSelected = valueLabel.toLowerCase() === lower;
|
|
13502
|
+
return !existsInOptions && !matchesSelected;
|
|
13503
|
+
}, [isCreatable, trimmedInput, isValidNewOption, value, options, valueLabel]);
|
|
13504
|
+
React50.useImperativeHandle(
|
|
13181
13505
|
ref,
|
|
13182
13506
|
() => containerRef.current
|
|
13183
13507
|
);
|
|
13184
|
-
|
|
13185
|
-
if (!isOpen) {
|
|
13186
|
-
clearSearch();
|
|
13187
|
-
setHighlightedIndex(-1);
|
|
13188
|
-
}
|
|
13189
|
-
}, [isOpen, clearSearch]);
|
|
13190
|
-
React49.useEffect(() => {
|
|
13508
|
+
React50.useEffect(() => {
|
|
13191
13509
|
if (!isOpen || filteredOptions.length === 0) {
|
|
13192
13510
|
setHighlightedIndex(-1);
|
|
13193
13511
|
return;
|
|
@@ -13197,17 +13515,377 @@ function MultiSelectInternal({
|
|
|
13197
13515
|
return getFirstEnabledOptionIndex(filteredOptions);
|
|
13198
13516
|
});
|
|
13199
13517
|
}, [isOpen, filteredOptions]);
|
|
13200
|
-
|
|
13518
|
+
React50.useEffect(() => {
|
|
13519
|
+
if (!isOpen) return;
|
|
13520
|
+
if (highlightedIndex < 0) return;
|
|
13521
|
+
optionRefs.current[highlightedIndex]?.scrollIntoView({ block: "nearest" });
|
|
13522
|
+
}, [highlightedIndex, isOpen]);
|
|
13523
|
+
React50.useEffect(() => {
|
|
13201
13524
|
if (!isOpen || !isMobile3) return;
|
|
13202
13525
|
const frame = window.requestAnimationFrame(
|
|
13203
13526
|
() => mobileSearchInputRef.current?.focus()
|
|
13204
13527
|
);
|
|
13205
13528
|
return () => window.cancelAnimationFrame(frame);
|
|
13206
13529
|
}, [isOpen, isMobile3]);
|
|
13207
|
-
const
|
|
13208
|
-
if (
|
|
13209
|
-
|
|
13210
|
-
|
|
13530
|
+
const commitSelection = (option) => {
|
|
13531
|
+
if (option.isDisabled) return;
|
|
13532
|
+
onChange(option);
|
|
13533
|
+
setInputValue(resolveLabel(option));
|
|
13534
|
+
setIsOpen(false);
|
|
13535
|
+
setIsFocused(false);
|
|
13536
|
+
inputRef.current?.blur();
|
|
13537
|
+
};
|
|
13538
|
+
const commitCreate = () => {
|
|
13539
|
+
if (!canCreateNewOption) return;
|
|
13540
|
+
const newOption = onCreateOption?.(trimmedInput) ?? { value: trimmedInput, label: trimmedInput };
|
|
13541
|
+
onChange(newOption);
|
|
13542
|
+
setInputValue(resolveLabel(newOption));
|
|
13543
|
+
setIsOpen(false);
|
|
13544
|
+
setIsFocused(false);
|
|
13545
|
+
inputRef.current?.blur();
|
|
13546
|
+
};
|
|
13547
|
+
const clearSelection = (event) => {
|
|
13548
|
+
event.stopPropagation();
|
|
13549
|
+
if (isBlocked) return;
|
|
13550
|
+
onChange(null);
|
|
13551
|
+
setInputValue("");
|
|
13552
|
+
inputRef.current?.focus();
|
|
13553
|
+
};
|
|
13554
|
+
const handleInputFocus = () => {
|
|
13555
|
+
if (isBlocked) return;
|
|
13556
|
+
setIsFocused(true);
|
|
13557
|
+
setIsOpen(true);
|
|
13558
|
+
requestAnimationFrame(() => inputRef.current?.select());
|
|
13559
|
+
};
|
|
13560
|
+
const handleBlur = (event) => {
|
|
13561
|
+
if (containerRef.current?.contains(event.relatedTarget)) return;
|
|
13562
|
+
setIsFocused(false);
|
|
13563
|
+
setInputValue(valueLabel);
|
|
13564
|
+
onBlur?.(event);
|
|
13565
|
+
};
|
|
13566
|
+
const handleInputKeyDown = (event) => {
|
|
13567
|
+
if (event.key === "ArrowDown") {
|
|
13568
|
+
event.preventDefault();
|
|
13569
|
+
if (!isOpen) {
|
|
13570
|
+
setIsOpen(true);
|
|
13571
|
+
return;
|
|
13572
|
+
}
|
|
13573
|
+
const next = getNextEnabledOptionIndex(filteredOptions, highlightedIndex + 1, 1);
|
|
13574
|
+
if (next >= 0) setHighlightedIndex(next);
|
|
13575
|
+
return;
|
|
13576
|
+
}
|
|
13577
|
+
if (event.key === "ArrowUp") {
|
|
13578
|
+
event.preventDefault();
|
|
13579
|
+
if (!isOpen) {
|
|
13580
|
+
setIsOpen(true);
|
|
13581
|
+
return;
|
|
13582
|
+
}
|
|
13583
|
+
const next = getNextEnabledOptionIndex(filteredOptions, highlightedIndex - 1, -1);
|
|
13584
|
+
if (next >= 0) setHighlightedIndex(next);
|
|
13585
|
+
return;
|
|
13586
|
+
}
|
|
13587
|
+
if (event.key === "Enter") {
|
|
13588
|
+
if (!isOpen) return;
|
|
13589
|
+
event.preventDefault();
|
|
13590
|
+
const option = filteredOptions[highlightedIndex];
|
|
13591
|
+
if (option && !option.isDisabled) {
|
|
13592
|
+
commitSelection(option);
|
|
13593
|
+
} else if (canCreateNewOption) {
|
|
13594
|
+
commitCreate();
|
|
13595
|
+
}
|
|
13596
|
+
return;
|
|
13597
|
+
}
|
|
13598
|
+
if (event.key === "Escape") {
|
|
13599
|
+
event.preventDefault();
|
|
13600
|
+
setInputValue(valueLabel);
|
|
13601
|
+
setIsOpen(false);
|
|
13602
|
+
inputRef.current?.blur();
|
|
13603
|
+
}
|
|
13604
|
+
};
|
|
13605
|
+
const handleContainerClick = () => {
|
|
13606
|
+
if (isBlocked) return;
|
|
13607
|
+
inputRef.current?.focus();
|
|
13608
|
+
setIsOpen(true);
|
|
13609
|
+
};
|
|
13610
|
+
return /* @__PURE__ */ jsxs99(
|
|
13611
|
+
SelectFieldShell,
|
|
13612
|
+
{
|
|
13613
|
+
containerRef,
|
|
13614
|
+
className,
|
|
13615
|
+
width,
|
|
13616
|
+
disabled,
|
|
13617
|
+
loading,
|
|
13618
|
+
topLabel,
|
|
13619
|
+
triggerId,
|
|
13620
|
+
errorId,
|
|
13621
|
+
errorMessage,
|
|
13622
|
+
hideErrorMessage,
|
|
13623
|
+
optional,
|
|
13624
|
+
helperText,
|
|
13625
|
+
name,
|
|
13626
|
+
hiddenValue: value ? String(value.value) : "",
|
|
13627
|
+
onBlur: handleBlur,
|
|
13628
|
+
children: [
|
|
13629
|
+
/* @__PURE__ */ jsx152(
|
|
13630
|
+
ComboboxTrigger,
|
|
13631
|
+
{
|
|
13632
|
+
triggerId,
|
|
13633
|
+
listboxId,
|
|
13634
|
+
labelId,
|
|
13635
|
+
valueId,
|
|
13636
|
+
describedErrorId,
|
|
13637
|
+
isOpen,
|
|
13638
|
+
isFocused,
|
|
13639
|
+
isBlocked,
|
|
13640
|
+
hasValue,
|
|
13641
|
+
isEmpty,
|
|
13642
|
+
disabled,
|
|
13643
|
+
readOnly,
|
|
13644
|
+
loading,
|
|
13645
|
+
invalid: hasInvalidState,
|
|
13646
|
+
inputRef,
|
|
13647
|
+
inputValue,
|
|
13648
|
+
placeholder,
|
|
13649
|
+
highlightedIndex,
|
|
13650
|
+
getOptionId: getOptionId2,
|
|
13651
|
+
onInputChange: (event) => {
|
|
13652
|
+
setInputValue(event.target.value);
|
|
13653
|
+
if (!isOpen) setIsOpen(true);
|
|
13654
|
+
},
|
|
13655
|
+
onInputFocus: handleInputFocus,
|
|
13656
|
+
onInputKeyDown: handleInputKeyDown,
|
|
13657
|
+
onContainerClick: handleContainerClick,
|
|
13658
|
+
showClear: clearable && hasValue && !readOnly && !disabled,
|
|
13659
|
+
onClear: clearSelection,
|
|
13660
|
+
clearLabel: t("clear")
|
|
13661
|
+
}
|
|
13662
|
+
),
|
|
13663
|
+
/* @__PURE__ */ jsx152(
|
|
13664
|
+
Fieldset,
|
|
13665
|
+
{
|
|
13666
|
+
isFocused: isFocused || isOpen,
|
|
13667
|
+
invalid: hasInvalidState,
|
|
13668
|
+
isEmpty: isEmpty && !inputValue,
|
|
13669
|
+
isActivated: !isEmpty || isFocused || isOpen || Boolean(inputValue),
|
|
13670
|
+
disabled,
|
|
13671
|
+
loading,
|
|
13672
|
+
readOnly,
|
|
13673
|
+
htmlFor: triggerId,
|
|
13674
|
+
labelId,
|
|
13675
|
+
legend: typeof label === "string" ? label : void 0,
|
|
13676
|
+
label,
|
|
13677
|
+
tooltip,
|
|
13678
|
+
onClick: handleContainerClick
|
|
13679
|
+
}
|
|
13680
|
+
),
|
|
13681
|
+
/* @__PURE__ */ jsxs99(
|
|
13682
|
+
SelectMenuPanel,
|
|
13683
|
+
{
|
|
13684
|
+
isOpen,
|
|
13685
|
+
isMobile: isMobile3,
|
|
13686
|
+
onClose: () => {
|
|
13687
|
+
closeMenu();
|
|
13688
|
+
setIsFocused(false);
|
|
13689
|
+
},
|
|
13690
|
+
title: typeof label === "string" ? label : void 0,
|
|
13691
|
+
className: dropdownClassName,
|
|
13692
|
+
drawerClassName,
|
|
13693
|
+
children: [
|
|
13694
|
+
isMobile3 && /* @__PURE__ */ jsx152(
|
|
13695
|
+
SelectSearchInput,
|
|
13696
|
+
{
|
|
13697
|
+
inputRef: mobileSearchInputRef,
|
|
13698
|
+
value: inputValue,
|
|
13699
|
+
placeholder: t("search_placeholder"),
|
|
13700
|
+
listboxId,
|
|
13701
|
+
activeOptionId: highlightedIndex >= 0 ? getOptionId2(highlightedIndex) : void 0,
|
|
13702
|
+
onChange: (event) => setInputValue(event.target.value),
|
|
13703
|
+
onKeyDown: handleInputKeyDown
|
|
13704
|
+
}
|
|
13705
|
+
),
|
|
13706
|
+
/* @__PURE__ */ jsx152(
|
|
13707
|
+
SelectMenu,
|
|
13708
|
+
{
|
|
13709
|
+
id: listboxId,
|
|
13710
|
+
options: filteredOptions,
|
|
13711
|
+
labelledBy: labelId,
|
|
13712
|
+
describedBy: describedErrorId,
|
|
13713
|
+
selectedValue: value,
|
|
13714
|
+
highlightedIndex,
|
|
13715
|
+
onOptionClick: commitSelection,
|
|
13716
|
+
onOptionHover: setHighlightedIndex,
|
|
13717
|
+
disabled: isBlocked,
|
|
13718
|
+
menuClassName,
|
|
13719
|
+
listRef,
|
|
13720
|
+
selectedOptionRef: (index, node) => {
|
|
13721
|
+
optionRefs.current[index] = node;
|
|
13722
|
+
},
|
|
13723
|
+
getOptionId: getOptionId2,
|
|
13724
|
+
noOptionsMessage
|
|
13725
|
+
}
|
|
13726
|
+
),
|
|
13727
|
+
canCreateNewOption && /* @__PURE__ */ jsx152(
|
|
13728
|
+
"button",
|
|
13729
|
+
{
|
|
13730
|
+
type: "button",
|
|
13731
|
+
onClick: commitCreate,
|
|
13732
|
+
className: "flex w-full items-center justify-start border-0 border-t border-[#f2f4f8] bg-white px-4 py-[16px] text-left text-[16px] font-medium leading-5 text-[var(--chekin-color-brand-blue)] outline-none hover:bg-[var(--chekin-color-surface-pressed)]",
|
|
13733
|
+
children: formatCreateLabel ? formatCreateLabel(trimmedInput) : t("create_option", { input: trimmedInput })
|
|
13734
|
+
}
|
|
13735
|
+
)
|
|
13736
|
+
]
|
|
13737
|
+
}
|
|
13738
|
+
)
|
|
13739
|
+
]
|
|
13740
|
+
}
|
|
13741
|
+
);
|
|
13742
|
+
}
|
|
13743
|
+
var Select = React50.forwardRef(SelectInternal);
|
|
13744
|
+
|
|
13745
|
+
// src/dashboard/creatable-select/CreatableSelect.tsx
|
|
13746
|
+
import * as React51 from "react";
|
|
13747
|
+
import { jsx as jsx153 } from "react/jsx-runtime";
|
|
13748
|
+
var CreatableSelect = React51.forwardRef(function CreatableSelect2(props, ref) {
|
|
13749
|
+
return /* @__PURE__ */ jsx153(Select, { ref, ...props, isCreatable: true });
|
|
13750
|
+
});
|
|
13751
|
+
|
|
13752
|
+
// src/dashboard/multi-select/MultiSelect.tsx
|
|
13753
|
+
import * as React52 from "react";
|
|
13754
|
+
import { useTranslation as useTranslation34 } from "react-i18next";
|
|
13755
|
+
|
|
13756
|
+
// src/dashboard/multi-select/MultiSelectChip.tsx
|
|
13757
|
+
import { SquareX as SquareX3 } from "lucide-react";
|
|
13758
|
+
import { useTranslation as useTranslation33 } from "react-i18next";
|
|
13759
|
+
import { jsx as jsx154, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
13760
|
+
function MultiSelectChip({
|
|
13761
|
+
option,
|
|
13762
|
+
readOnly,
|
|
13763
|
+
onRemove
|
|
13764
|
+
}) {
|
|
13765
|
+
const { t } = useTranslation33();
|
|
13766
|
+
const labelText = typeof option.label === "string" ? option.label : String(option.value);
|
|
13767
|
+
return /* @__PURE__ */ jsxs100("span", { className: "inline-flex items-center gap-2 rounded-[4px] border border-[#acacd5] bg-[#f0f0f8] py-[2px] pl-[10px] pr-1 text-[12px] font-medium text-[var(--chekin-color-brand-navy)]", children: [
|
|
13768
|
+
/* @__PURE__ */ jsx154("span", { className: "whitespace-nowrap", children: option.label }),
|
|
13769
|
+
!readOnly && /* @__PURE__ */ jsx154(
|
|
13770
|
+
"button",
|
|
13771
|
+
{
|
|
13772
|
+
type: "button",
|
|
13773
|
+
onClick: (event) => {
|
|
13774
|
+
event.stopPropagation();
|
|
13775
|
+
onRemove();
|
|
13776
|
+
},
|
|
13777
|
+
className: "flex h-[15px] w-[15px] items-center justify-center rounded-[3px] border-0 bg-transparent p-0 text-[#9696b9] hover:shadow-[0_3px_3px_#0f477734]",
|
|
13778
|
+
"aria-label": t("remove_item", { label: labelText }),
|
|
13779
|
+
children: /* @__PURE__ */ jsx154(SquareX3, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
13780
|
+
}
|
|
13781
|
+
)
|
|
13782
|
+
] });
|
|
13783
|
+
}
|
|
13784
|
+
|
|
13785
|
+
// src/dashboard/multi-select/MultiSelect.tsx
|
|
13786
|
+
import { jsx as jsx155, jsxs as jsxs101 } from "react/jsx-runtime";
|
|
13787
|
+
var isValueSelected = (selected, option) => selected.some((item) => item.value === option.value);
|
|
13788
|
+
function MultiSelectInternal({
|
|
13789
|
+
options = [],
|
|
13790
|
+
value,
|
|
13791
|
+
onChange,
|
|
13792
|
+
onBlur,
|
|
13793
|
+
label,
|
|
13794
|
+
topLabel,
|
|
13795
|
+
placeholder,
|
|
13796
|
+
disabled,
|
|
13797
|
+
readOnly,
|
|
13798
|
+
loading,
|
|
13799
|
+
optional,
|
|
13800
|
+
tooltip,
|
|
13801
|
+
error,
|
|
13802
|
+
invalid,
|
|
13803
|
+
hideErrorMessage,
|
|
13804
|
+
className,
|
|
13805
|
+
menuClassName,
|
|
13806
|
+
dropdownClassName,
|
|
13807
|
+
drawerClassName,
|
|
13808
|
+
name,
|
|
13809
|
+
width,
|
|
13810
|
+
noOptionsMessage,
|
|
13811
|
+
filterOption,
|
|
13812
|
+
closeMenuOnSelect = false,
|
|
13813
|
+
renderChip,
|
|
13814
|
+
helperText,
|
|
13815
|
+
isCreatable = false,
|
|
13816
|
+
onCreateOption,
|
|
13817
|
+
formatCreateLabel,
|
|
13818
|
+
isValidNewOption
|
|
13819
|
+
}, ref) {
|
|
13820
|
+
const inputRef = React52.useRef(null);
|
|
13821
|
+
const mobileSearchInputRef = React52.useRef(null);
|
|
13822
|
+
const listRef = React52.useRef(null);
|
|
13823
|
+
const optionRefs = React52.useRef([]);
|
|
13824
|
+
const [isFocused, setIsFocused] = React52.useState(false);
|
|
13825
|
+
const [highlightedIndex, setHighlightedIndex] = React52.useState(-1);
|
|
13826
|
+
const isMobile3 = useIsMobile();
|
|
13827
|
+
const { t } = useTranslation34();
|
|
13828
|
+
const selectedValues = React52.useMemo(() => value ?? [], [value]);
|
|
13829
|
+
const hasValue = selectedValues.length > 0;
|
|
13830
|
+
const isEmpty = !hasValue;
|
|
13831
|
+
const isBlocked = Boolean(disabled) || Boolean(loading) || Boolean(readOnly);
|
|
13832
|
+
const triggerError = error ?? invalid;
|
|
13833
|
+
const hasInvalidState = Boolean(triggerError);
|
|
13834
|
+
const errorMessage = typeof error === "string" ? error : void 0;
|
|
13835
|
+
const { containerRef, isOpen, closeMenu, setIsOpen } = useSelectMenuState({
|
|
13836
|
+
isBlocked,
|
|
13837
|
+
isMobile: isMobile3,
|
|
13838
|
+
onOutsideClick: () => setIsFocused(false)
|
|
13839
|
+
});
|
|
13840
|
+
const { triggerId, labelId, valueId, listboxId, describedErrorId, errorId, getOptionId: getOptionId2 } = useSelectIds({ name, hasValue, error, hideErrorMessage });
|
|
13841
|
+
const { searchValue, setSearchValue, filteredOptions, clearSearch } = useSelectSearch({
|
|
13842
|
+
options,
|
|
13843
|
+
filterOption
|
|
13844
|
+
});
|
|
13845
|
+
const trimmedSearch = searchValue.trim();
|
|
13846
|
+
const canCreateNewOption = React52.useMemo(() => {
|
|
13847
|
+
if (!isCreatable || !trimmedSearch) return false;
|
|
13848
|
+
if (isValidNewOption) return isValidNewOption(trimmedSearch, selectedValues, options);
|
|
13849
|
+
const lower = trimmedSearch.toLowerCase();
|
|
13850
|
+
const existsInOptions = options.some(
|
|
13851
|
+
(option) => typeof option.label === "string" && option.label.toLowerCase() === lower
|
|
13852
|
+
);
|
|
13853
|
+
const existsInSelected = selectedValues.some(
|
|
13854
|
+
(option) => typeof option.label === "string" && option.label.toLowerCase() === lower
|
|
13855
|
+
);
|
|
13856
|
+
return !existsInOptions && !existsInSelected;
|
|
13857
|
+
}, [isCreatable, trimmedSearch, isValidNewOption, options, selectedValues]);
|
|
13858
|
+
React52.useImperativeHandle(
|
|
13859
|
+
ref,
|
|
13860
|
+
() => containerRef.current
|
|
13861
|
+
);
|
|
13862
|
+
React52.useEffect(() => {
|
|
13863
|
+
if (!isOpen) {
|
|
13864
|
+
clearSearch();
|
|
13865
|
+
setHighlightedIndex(-1);
|
|
13866
|
+
}
|
|
13867
|
+
}, [isOpen, clearSearch]);
|
|
13868
|
+
React52.useEffect(() => {
|
|
13869
|
+
if (!isOpen || filteredOptions.length === 0) {
|
|
13870
|
+
setHighlightedIndex(-1);
|
|
13871
|
+
return;
|
|
13872
|
+
}
|
|
13873
|
+
setHighlightedIndex((current) => {
|
|
13874
|
+
if (current >= 0 && current < filteredOptions.length) return current;
|
|
13875
|
+
return getFirstEnabledOptionIndex(filteredOptions);
|
|
13876
|
+
});
|
|
13877
|
+
}, [isOpen, filteredOptions]);
|
|
13878
|
+
React52.useEffect(() => {
|
|
13879
|
+
if (!isOpen || !isMobile3) return;
|
|
13880
|
+
const frame = window.requestAnimationFrame(
|
|
13881
|
+
() => mobileSearchInputRef.current?.focus()
|
|
13882
|
+
);
|
|
13883
|
+
return () => window.cancelAnimationFrame(frame);
|
|
13884
|
+
}, [isOpen, isMobile3]);
|
|
13885
|
+
const openMenu = () => {
|
|
13886
|
+
if (isBlocked) return;
|
|
13887
|
+
setIsOpen(true);
|
|
13888
|
+
setIsFocused(true);
|
|
13211
13889
|
};
|
|
13212
13890
|
const toggleOption = (option) => {
|
|
13213
13891
|
if (option.isDisabled) return;
|
|
@@ -13231,7 +13909,7 @@ function MultiSelectInternal({
|
|
|
13231
13909
|
onChange([]);
|
|
13232
13910
|
inputRef.current?.focus();
|
|
13233
13911
|
};
|
|
13234
|
-
const createOption =
|
|
13912
|
+
const createOption = React52.useCallback(() => {
|
|
13235
13913
|
if (!canCreateNewOption) return;
|
|
13236
13914
|
const newOption = onCreateOption?.(trimmedSearch) ?? { value: trimmedSearch, label: trimmedSearch };
|
|
13237
13915
|
onChange([...selectedValues, newOption]);
|
|
@@ -13300,7 +13978,7 @@ function MultiSelectInternal({
|
|
|
13300
13978
|
setIsFocused(false);
|
|
13301
13979
|
onBlur?.(event);
|
|
13302
13980
|
};
|
|
13303
|
-
return /* @__PURE__ */
|
|
13981
|
+
return /* @__PURE__ */ jsxs101(
|
|
13304
13982
|
SelectFieldShell,
|
|
13305
13983
|
{
|
|
13306
13984
|
containerRef,
|
|
@@ -13319,104 +13997,59 @@ function MultiSelectInternal({
|
|
|
13319
13997
|
hiddenValue: selectedValues.map((item) => String(item.value)).join(","),
|
|
13320
13998
|
onBlur: handleInputBlur,
|
|
13321
13999
|
children: [
|
|
13322
|
-
/* @__PURE__ */
|
|
13323
|
-
|
|
14000
|
+
/* @__PURE__ */ jsx155(
|
|
14001
|
+
ComboboxTrigger,
|
|
13324
14002
|
{
|
|
13325
|
-
|
|
13326
|
-
|
|
13327
|
-
|
|
13328
|
-
|
|
13329
|
-
|
|
13330
|
-
|
|
13331
|
-
|
|
13332
|
-
|
|
13333
|
-
|
|
13334
|
-
|
|
13335
|
-
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
|
|
13356
|
-
|
|
13357
|
-
|
|
13358
|
-
|
|
13359
|
-
|
|
13360
|
-
|
|
13361
|
-
|
|
13362
|
-
/* @__PURE__ */
|
|
13363
|
-
|
|
14003
|
+
triggerId,
|
|
14004
|
+
listboxId,
|
|
14005
|
+
labelId,
|
|
14006
|
+
valueId,
|
|
14007
|
+
describedErrorId,
|
|
14008
|
+
isOpen,
|
|
14009
|
+
isFocused,
|
|
14010
|
+
isBlocked,
|
|
14011
|
+
hasValue,
|
|
14012
|
+
isEmpty,
|
|
14013
|
+
disabled,
|
|
14014
|
+
readOnly,
|
|
14015
|
+
loading,
|
|
14016
|
+
invalid: hasInvalidState,
|
|
14017
|
+
isMulti: true,
|
|
14018
|
+
inputRef,
|
|
14019
|
+
inputValue: searchValue,
|
|
14020
|
+
placeholder: !hasValue ? placeholder : "",
|
|
14021
|
+
highlightedIndex,
|
|
14022
|
+
getOptionId: getOptionId2,
|
|
14023
|
+
onInputChange: (event) => {
|
|
14024
|
+
setSearchValue(event.target.value);
|
|
14025
|
+
if (!isOpen) setIsOpen(true);
|
|
14026
|
+
},
|
|
14027
|
+
onInputFocus: () => {
|
|
14028
|
+
setIsFocused(true);
|
|
14029
|
+
if (!isBlocked) setIsOpen(true);
|
|
14030
|
+
},
|
|
14031
|
+
onInputKeyDown: handleInputKeyDown,
|
|
14032
|
+
onContainerClick: handleContainerClick,
|
|
14033
|
+
showClear: hasValue && !readOnly && !disabled,
|
|
14034
|
+
onClear: (event) => {
|
|
14035
|
+
event.stopPropagation();
|
|
14036
|
+
clearAll();
|
|
14037
|
+
},
|
|
14038
|
+
clearLabel: t("clear_all"),
|
|
14039
|
+
leadingContent: selectedValues.map(
|
|
14040
|
+
(option) => renderChip ? /* @__PURE__ */ jsx155(React52.Fragment, { children: renderChip(option, () => removeOption(option)) }, String(option.value)) : /* @__PURE__ */ jsx155(
|
|
14041
|
+
MultiSelectChip,
|
|
13364
14042
|
{
|
|
13365
|
-
|
|
13366
|
-
type: "text",
|
|
13367
|
-
id: `${triggerId}-input`,
|
|
13368
|
-
value: searchValue,
|
|
13369
|
-
onChange: (event) => {
|
|
13370
|
-
setSearchValue(event.target.value);
|
|
13371
|
-
if (!isOpen) setIsOpen(true);
|
|
13372
|
-
},
|
|
13373
|
-
onFocus: () => {
|
|
13374
|
-
setIsFocused(true);
|
|
13375
|
-
if (!isBlocked) setIsOpen(true);
|
|
13376
|
-
},
|
|
13377
|
-
onKeyDown: handleInputKeyDown,
|
|
13378
|
-
disabled: isBlocked,
|
|
14043
|
+
option,
|
|
13379
14044
|
readOnly,
|
|
13380
|
-
|
|
13381
|
-
|
|
13382
|
-
|
|
13383
|
-
|
|
13384
|
-
|
|
13385
|
-
),
|
|
13386
|
-
"aria-autocomplete": "list",
|
|
13387
|
-
"aria-controls": listboxId,
|
|
13388
|
-
"aria-activedescendant": isOpen && highlightedIndex >= 0 ? getOptionId2(highlightedIndex) : void 0
|
|
13389
|
-
}
|
|
13390
|
-
),
|
|
13391
|
-
/* @__PURE__ */ jsxs98("span", { className: "ml-auto flex items-center gap-2 pl-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
13392
|
-
loading && /* @__PURE__ */ jsx151(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
13393
|
-
hasValue && !readOnly && /* @__PURE__ */ jsx151(
|
|
13394
|
-
"button",
|
|
13395
|
-
{
|
|
13396
|
-
type: "button",
|
|
13397
|
-
onClick: (event) => {
|
|
13398
|
-
event.stopPropagation();
|
|
13399
|
-
clearAll();
|
|
13400
|
-
},
|
|
13401
|
-
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]",
|
|
13402
|
-
"aria-label": t("clear_all"),
|
|
13403
|
-
children: /* @__PURE__ */ jsx151(SquareX3, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
13404
|
-
}
|
|
13405
|
-
),
|
|
13406
|
-
/* @__PURE__ */ jsx151(
|
|
13407
|
-
RotateArrow,
|
|
13408
|
-
{
|
|
13409
|
-
shouldRotate: isOpen,
|
|
13410
|
-
className: cn(
|
|
13411
|
-
isFocused || isOpen ? "text-[var(--chekin-color-brand-blue)]" : "text-[var(--chekin-color-gray-2)]"
|
|
13412
|
-
)
|
|
13413
|
-
}
|
|
13414
|
-
)
|
|
13415
|
-
] })
|
|
13416
|
-
]
|
|
14045
|
+
onRemove: () => removeOption(option)
|
|
14046
|
+
},
|
|
14047
|
+
String(option.value)
|
|
14048
|
+
)
|
|
14049
|
+
)
|
|
13417
14050
|
}
|
|
13418
14051
|
),
|
|
13419
|
-
/* @__PURE__ */
|
|
14052
|
+
/* @__PURE__ */ jsx155(
|
|
13420
14053
|
Fieldset,
|
|
13421
14054
|
{
|
|
13422
14055
|
isFocused: isFocused || isOpen,
|
|
@@ -13426,7 +14059,7 @@ function MultiSelectInternal({
|
|
|
13426
14059
|
disabled,
|
|
13427
14060
|
loading,
|
|
13428
14061
|
readOnly,
|
|
13429
|
-
htmlFor:
|
|
14062
|
+
htmlFor: triggerId,
|
|
13430
14063
|
labelId,
|
|
13431
14064
|
legend: typeof label === "string" ? label : void 0,
|
|
13432
14065
|
label,
|
|
@@ -13434,7 +14067,7 @@ function MultiSelectInternal({
|
|
|
13434
14067
|
onClick: handleContainerClick
|
|
13435
14068
|
}
|
|
13436
14069
|
),
|
|
13437
|
-
/* @__PURE__ */
|
|
14070
|
+
/* @__PURE__ */ jsxs101(
|
|
13438
14071
|
SelectMenuPanel,
|
|
13439
14072
|
{
|
|
13440
14073
|
isOpen,
|
|
@@ -13447,31 +14080,19 @@ function MultiSelectInternal({
|
|
|
13447
14080
|
className: dropdownClassName,
|
|
13448
14081
|
drawerClassName,
|
|
13449
14082
|
children: [
|
|
13450
|
-
isMobile3 && /* @__PURE__ */
|
|
13451
|
-
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
value: searchValue,
|
|
13464
|
-
placeholder: placeholder ?? "",
|
|
13465
|
-
onChange: (event) => setSearchValue(event.target.value),
|
|
13466
|
-
onKeyDown: handleInputKeyDown,
|
|
13467
|
-
autoComplete: "off",
|
|
13468
|
-
"aria-controls": listboxId,
|
|
13469
|
-
"aria-activedescendant": highlightedIndex >= 0 ? getOptionId2(highlightedIndex) : void 0,
|
|
13470
|
-
className: "m-0 box-border h-9 w-full rounded-md border border-[var(--chekin-color-gray-3)] bg-white px-9 text-[16px] font-medium text-[var(--chekin-color-brand-navy)] outline-none transition-colors placeholder:text-[var(--chekin-color-gray-1)] focus:border-[var(--chekin-color-brand-blue)]"
|
|
13471
|
-
}
|
|
13472
|
-
)
|
|
13473
|
-
] }) }),
|
|
13474
|
-
/* @__PURE__ */ jsx151(
|
|
14083
|
+
isMobile3 && /* @__PURE__ */ jsx155(
|
|
14084
|
+
SelectSearchInput,
|
|
14085
|
+
{
|
|
14086
|
+
inputRef: mobileSearchInputRef,
|
|
14087
|
+
value: searchValue,
|
|
14088
|
+
placeholder: t("search_placeholder"),
|
|
14089
|
+
listboxId,
|
|
14090
|
+
activeOptionId: highlightedIndex >= 0 ? getOptionId2(highlightedIndex) : void 0,
|
|
14091
|
+
onChange: (event) => setSearchValue(event.target.value),
|
|
14092
|
+
onKeyDown: handleInputKeyDown
|
|
14093
|
+
}
|
|
14094
|
+
),
|
|
14095
|
+
/* @__PURE__ */ jsx155(
|
|
13475
14096
|
SelectMenu,
|
|
13476
14097
|
{
|
|
13477
14098
|
id: listboxId,
|
|
@@ -13493,13 +14114,13 @@ function MultiSelectInternal({
|
|
|
13493
14114
|
isMulti: true
|
|
13494
14115
|
}
|
|
13495
14116
|
),
|
|
13496
|
-
canCreateNewOption && /* @__PURE__ */
|
|
14117
|
+
canCreateNewOption && /* @__PURE__ */ jsx155(
|
|
13497
14118
|
"button",
|
|
13498
14119
|
{
|
|
13499
14120
|
type: "button",
|
|
13500
14121
|
onClick: createOption,
|
|
13501
14122
|
className: "flex w-full items-center justify-start border-0 border-t border-[#f2f4f8] bg-white px-4 py-[16px] text-left text-[16px] font-medium leading-5 text-[var(--chekin-color-brand-blue)] outline-none hover:bg-[var(--chekin-color-surface-pressed)]",
|
|
13502
|
-
children: formatCreateLabel(trimmedSearch)
|
|
14123
|
+
children: formatCreateLabel ? formatCreateLabel(trimmedSearch) : t("create_option", { input: trimmedSearch })
|
|
13503
14124
|
}
|
|
13504
14125
|
)
|
|
13505
14126
|
]
|
|
@@ -13509,26 +14130,24 @@ function MultiSelectInternal({
|
|
|
13509
14130
|
}
|
|
13510
14131
|
);
|
|
13511
14132
|
}
|
|
13512
|
-
var MultiSelect =
|
|
14133
|
+
var MultiSelect = React52.forwardRef(
|
|
13513
14134
|
MultiSelectInternal
|
|
13514
14135
|
);
|
|
13515
14136
|
|
|
13516
14137
|
// src/dashboard/creatable-multi-select/CreatableMultiSelect.tsx
|
|
13517
|
-
import * as
|
|
13518
|
-
import { jsx as
|
|
13519
|
-
var CreatableMultiSelect =
|
|
13520
|
-
|
|
13521
|
-
|
|
13522
|
-
}
|
|
13523
|
-
);
|
|
14138
|
+
import * as React53 from "react";
|
|
14139
|
+
import { jsx as jsx156 } from "react/jsx-runtime";
|
|
14140
|
+
var CreatableMultiSelect = React53.forwardRef(function CreatableMultiSelect2(props, ref) {
|
|
14141
|
+
return /* @__PURE__ */ jsx156(MultiSelect, { ref, ...props, isCreatable: true });
|
|
14142
|
+
});
|
|
13524
14143
|
|
|
13525
14144
|
// src/dashboard/infinite-scroll-select/InfiniteScrollSelect.tsx
|
|
13526
|
-
import * as
|
|
14145
|
+
import * as React54 from "react";
|
|
13527
14146
|
import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
|
|
13528
|
-
import { useTranslation as
|
|
14147
|
+
import { useTranslation as useTranslation35 } from "react-i18next";
|
|
13529
14148
|
|
|
13530
14149
|
// src/dashboard/infinite-scroll-select/InfiniteScrollList.tsx
|
|
13531
|
-
import { jsx as
|
|
14150
|
+
import { jsx as jsx157, jsxs as jsxs102 } from "react/jsx-runtime";
|
|
13532
14151
|
function InfiniteScrollList({
|
|
13533
14152
|
scrollRef,
|
|
13534
14153
|
listboxId,
|
|
@@ -13545,17 +14164,19 @@ function InfiniteScrollList({
|
|
|
13545
14164
|
loadingMoreText,
|
|
13546
14165
|
activeOptionId,
|
|
13547
14166
|
getOptionId: getOptionId2,
|
|
14167
|
+
canLoadMore,
|
|
13548
14168
|
onSelect,
|
|
13549
14169
|
onHighlight
|
|
13550
14170
|
}) {
|
|
13551
14171
|
const virtualItems = virtualizer.getVirtualItems();
|
|
13552
|
-
|
|
14172
|
+
const lastOptionIndex = options.length - 1;
|
|
14173
|
+
return /* @__PURE__ */ jsx157(
|
|
13553
14174
|
"div",
|
|
13554
14175
|
{
|
|
13555
14176
|
ref: scrollRef,
|
|
13556
14177
|
className: cn("overflow-y-auto", menuClassName),
|
|
13557
14178
|
style: { height: `${height}px` },
|
|
13558
|
-
children: /* @__PURE__ */
|
|
14179
|
+
children: /* @__PURE__ */ jsx157(
|
|
13559
14180
|
"div",
|
|
13560
14181
|
{
|
|
13561
14182
|
id: listboxId,
|
|
@@ -13572,7 +14193,8 @@ function InfiniteScrollList({
|
|
|
13572
14193
|
const isSelected = !isLoaderRow && option ? option.value === value?.value : false;
|
|
13573
14194
|
const isHighlighted = virtualItem.index === highlightedIndex;
|
|
13574
14195
|
const isOptionDisabled = Boolean(isBlocked || option?.isDisabled);
|
|
13575
|
-
|
|
14196
|
+
const isLastOption = !isLoaderRow && virtualItem.index === lastOptionIndex && !canLoadMore;
|
|
14197
|
+
return /* @__PURE__ */ jsx157(
|
|
13576
14198
|
"div",
|
|
13577
14199
|
{
|
|
13578
14200
|
"data-index": virtualItem.index,
|
|
@@ -13581,10 +14203,26 @@ function InfiniteScrollList({
|
|
|
13581
14203
|
height: `${virtualItem.size}px`,
|
|
13582
14204
|
transform: `translateY(${virtualItem.start}px)`
|
|
13583
14205
|
},
|
|
13584
|
-
children: isLoaderRow ? /* @__PURE__ */
|
|
13585
|
-
|
|
13586
|
-
|
|
13587
|
-
|
|
14206
|
+
children: isLoaderRow ? /* @__PURE__ */ jsxs102(
|
|
14207
|
+
"div",
|
|
14208
|
+
{
|
|
14209
|
+
role: "status",
|
|
14210
|
+
"aria-busy": "true",
|
|
14211
|
+
"aria-live": "polite",
|
|
14212
|
+
className: "flex h-full items-center justify-center",
|
|
14213
|
+
children: [
|
|
14214
|
+
/* @__PURE__ */ jsx157("span", { className: "sr-only", children: loadingMoreText }),
|
|
14215
|
+
/* @__PURE__ */ jsx157(
|
|
14216
|
+
ThreeDotsLoader,
|
|
14217
|
+
{
|
|
14218
|
+
height: 24,
|
|
14219
|
+
width: 24,
|
|
14220
|
+
color: "var(--chekin-color-brand-blue)"
|
|
14221
|
+
}
|
|
14222
|
+
)
|
|
14223
|
+
]
|
|
14224
|
+
}
|
|
14225
|
+
) : /* @__PURE__ */ jsxs102(
|
|
13588
14226
|
"button",
|
|
13589
14227
|
{
|
|
13590
14228
|
id: getOptionId2(virtualItem.index),
|
|
@@ -13597,14 +14235,15 @@ function InfiniteScrollList({
|
|
|
13597
14235
|
onClick: () => option && onSelect(option),
|
|
13598
14236
|
onMouseMove: () => onHighlight(virtualItem.index),
|
|
13599
14237
|
className: cn(
|
|
13600
|
-
"flex h-full w-full items-
|
|
14238
|
+
"flex h-full w-full items-center justify-between border-0 border-b border-[#f2f4f8] bg-white text-left text-[16px] font-medium leading-5 text-[var(--chekin-color-brand-navy)] outline-none transition-colors",
|
|
14239
|
+
isLastOption && "border-b-transparent",
|
|
13601
14240
|
isHighlighted && !isSelected && "cursor-pointer text-[var(--chekin-color-brand-blue)]",
|
|
13602
14241
|
isSelected && "cursor-default font-bold text-[var(--chekin-color-brand-navy)]",
|
|
13603
14242
|
isOptionDisabled && "cursor-default opacity-30"
|
|
13604
14243
|
),
|
|
13605
14244
|
children: [
|
|
13606
|
-
/* @__PURE__ */
|
|
13607
|
-
option?.description && /* @__PURE__ */
|
|
14245
|
+
/* @__PURE__ */ jsx157("span", { className: "block break-words", children: option?.label }),
|
|
14246
|
+
option?.description && /* @__PURE__ */ jsx157("span", { className: "ml-2 shrink-0 text-[12px] font-bold italic text-[#777e91]", children: option.description })
|
|
13608
14247
|
]
|
|
13609
14248
|
}
|
|
13610
14249
|
)
|
|
@@ -13619,7 +14258,7 @@ function InfiniteScrollList({
|
|
|
13619
14258
|
}
|
|
13620
14259
|
|
|
13621
14260
|
// src/dashboard/infinite-scroll-select/InfiniteScrollSelect.tsx
|
|
13622
|
-
import { jsx as
|
|
14261
|
+
import { jsx as jsx158, jsxs as jsxs103 } from "react/jsx-runtime";
|
|
13623
14262
|
var DEFAULT_ITEM_HEIGHT = 60;
|
|
13624
14263
|
var DEFAULT_LIST_HEIGHT = 322;
|
|
13625
14264
|
var DEFAULT_OVERSCAN = 5;
|
|
@@ -13634,6 +14273,7 @@ function InfiniteScrollSelectInternal({
|
|
|
13634
14273
|
placeholder,
|
|
13635
14274
|
getValueLabel,
|
|
13636
14275
|
disabled,
|
|
14276
|
+
readOnly,
|
|
13637
14277
|
loading,
|
|
13638
14278
|
optional,
|
|
13639
14279
|
tooltip,
|
|
@@ -13647,10 +14287,9 @@ function InfiniteScrollSelectInternal({
|
|
|
13647
14287
|
name,
|
|
13648
14288
|
width,
|
|
13649
14289
|
noOptionsMessage,
|
|
13650
|
-
|
|
13651
|
-
searchPlaceholder,
|
|
13652
|
-
filterOption,
|
|
14290
|
+
filterOption = defaultFilterOption,
|
|
13653
14291
|
helperText,
|
|
14292
|
+
clearable = true,
|
|
13654
14293
|
canLoadMore,
|
|
13655
14294
|
isLoadingMore,
|
|
13656
14295
|
loadMoreItems,
|
|
@@ -13661,32 +14300,42 @@ function InfiniteScrollSelectInternal({
|
|
|
13661
14300
|
overscan = DEFAULT_OVERSCAN,
|
|
13662
14301
|
loadMoreThreshold = DEFAULT_LOAD_MORE_THRESHOLD
|
|
13663
14302
|
}, ref) {
|
|
13664
|
-
const
|
|
13665
|
-
const
|
|
13666
|
-
const scrollRef =
|
|
13667
|
-
const previousHighlightedIndexRef =
|
|
13668
|
-
const lastLoadMoreOptionsLengthRef =
|
|
13669
|
-
const [
|
|
14303
|
+
const inputRef = React54.useRef(null);
|
|
14304
|
+
const mobileSearchInputRef = React54.useRef(null);
|
|
14305
|
+
const scrollRef = React54.useRef(null);
|
|
14306
|
+
const previousHighlightedIndexRef = React54.useRef(-1);
|
|
14307
|
+
const lastLoadMoreOptionsLengthRef = React54.useRef(null);
|
|
14308
|
+
const [isFocused, setIsFocused] = React54.useState(false);
|
|
14309
|
+
const [highlightedIndex, setHighlightedIndex] = React54.useState(-1);
|
|
13670
14310
|
const isMobile3 = useIsMobile();
|
|
13671
|
-
const { t } =
|
|
13672
|
-
const resolvedSearchPlaceholder = searchPlaceholder ?? t("search_placeholder");
|
|
14311
|
+
const { t } = useTranslation35();
|
|
13673
14312
|
const resolvedLoadingMoreText = loadingMoreText ?? t("loading_more");
|
|
14313
|
+
const resolveLabel = React54.useCallback(
|
|
14314
|
+
(option) => option ? getValueLabel?.(option) ?? String(option.label) : "",
|
|
14315
|
+
[getValueLabel]
|
|
14316
|
+
);
|
|
14317
|
+
const valueLabel = resolveLabel(value);
|
|
14318
|
+
const [inputValue, setInputValue] = React54.useState(valueLabel);
|
|
13674
14319
|
const hasValue = Boolean(value);
|
|
13675
|
-
const
|
|
13676
|
-
const
|
|
13677
|
-
const hasInvalidState = Boolean(
|
|
14320
|
+
const isEmpty = !hasValue && !inputValue;
|
|
14321
|
+
const isBlocked = Boolean(disabled) || Boolean(loading) || Boolean(readOnly);
|
|
14322
|
+
const hasInvalidState = Boolean(error) || Boolean(invalid);
|
|
13678
14323
|
const errorMessage = typeof error === "string" ? error : void 0;
|
|
13679
|
-
const
|
|
13680
|
-
const { containerRef, isOpen, closeMenu, toggleMenu, setIsOpen } = useSelectMenuState({
|
|
14324
|
+
const { containerRef, isOpen, closeMenu, setIsOpen } = useSelectMenuState({
|
|
13681
14325
|
isBlocked,
|
|
13682
|
-
isMobile: isMobile3
|
|
14326
|
+
isMobile: isMobile3,
|
|
14327
|
+
onOutsideClick: () => setIsFocused(false)
|
|
13683
14328
|
});
|
|
13684
14329
|
const { triggerId, labelId, valueId, listboxId, describedErrorId, errorId, getOptionId: getOptionId2 } = useSelectIds({ name, hasValue, error, hideErrorMessage });
|
|
13685
|
-
|
|
13686
|
-
|
|
13687
|
-
|
|
13688
|
-
|
|
13689
|
-
|
|
14330
|
+
React54.useEffect(() => {
|
|
14331
|
+
if (!isFocused) setInputValue(valueLabel);
|
|
14332
|
+
}, [valueLabel, isFocused]);
|
|
14333
|
+
const trimmedInput = inputValue.trim();
|
|
14334
|
+
const isFiltering = trimmedInput.length > 0 && trimmedInput.toLowerCase() !== valueLabel.toLowerCase();
|
|
14335
|
+
const filteredOptions = React54.useMemo(() => {
|
|
14336
|
+
if (!isFiltering) return options;
|
|
14337
|
+
return options.filter((option) => filterOption(option, trimmedInput));
|
|
14338
|
+
}, [options, isFiltering, trimmedInput, filterOption]);
|
|
13690
14339
|
const itemCount = filteredOptions.length + (canLoadMore || isLoadingMore ? 1 : 0);
|
|
13691
14340
|
const virtualizer = useVirtualizer2({
|
|
13692
14341
|
count: itemCount,
|
|
@@ -13694,15 +14343,17 @@ function InfiniteScrollSelectInternal({
|
|
|
13694
14343
|
estimateSize: () => itemHeight,
|
|
13695
14344
|
overscan
|
|
13696
14345
|
});
|
|
13697
|
-
|
|
13698
|
-
|
|
14346
|
+
React54.useImperativeHandle(
|
|
14347
|
+
ref,
|
|
14348
|
+
() => containerRef.current
|
|
14349
|
+
);
|
|
14350
|
+
React54.useEffect(() => {
|
|
13699
14351
|
if (isOpen) return;
|
|
13700
|
-
setSearchValue("");
|
|
13701
14352
|
setHighlightedIndex(-1);
|
|
13702
14353
|
previousHighlightedIndexRef.current = -1;
|
|
13703
14354
|
lastLoadMoreOptionsLengthRef.current = null;
|
|
13704
|
-
}, [isOpen
|
|
13705
|
-
|
|
14355
|
+
}, [isOpen]);
|
|
14356
|
+
React54.useEffect(() => {
|
|
13706
14357
|
if (!isOpen) return;
|
|
13707
14358
|
setHighlightedIndex((current) => {
|
|
13708
14359
|
const option = current >= 0 ? filteredOptions[current] : void 0;
|
|
@@ -13711,13 +14362,15 @@ function InfiniteScrollSelectInternal({
|
|
|
13711
14362
|
return selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex(filteredOptions);
|
|
13712
14363
|
});
|
|
13713
14364
|
}, [isOpen, filteredOptions, value]);
|
|
13714
|
-
|
|
13715
|
-
if (!isOpen || !
|
|
13716
|
-
const frame = window.requestAnimationFrame(
|
|
14365
|
+
React54.useEffect(() => {
|
|
14366
|
+
if (!isOpen || !isMobile3) return;
|
|
14367
|
+
const frame = window.requestAnimationFrame(
|
|
14368
|
+
() => mobileSearchInputRef.current?.focus()
|
|
14369
|
+
);
|
|
13717
14370
|
return () => window.cancelAnimationFrame(frame);
|
|
13718
|
-
}, [isOpen,
|
|
14371
|
+
}, [isOpen, isMobile3]);
|
|
13719
14372
|
const virtualItems = virtualizer.getVirtualItems();
|
|
13720
|
-
|
|
14373
|
+
React54.useEffect(() => {
|
|
13721
14374
|
if (!isOpen || !canLoadMore || isLoadingMore || !loadMoreItems) return;
|
|
13722
14375
|
if (virtualItems.length === 0) return;
|
|
13723
14376
|
const lastItem = virtualItems[virtualItems.length - 1];
|
|
@@ -13734,65 +14387,92 @@ function InfiniteScrollSelectInternal({
|
|
|
13734
14387
|
loadMoreThreshold,
|
|
13735
14388
|
virtualItems
|
|
13736
14389
|
]);
|
|
13737
|
-
|
|
14390
|
+
React54.useEffect(() => {
|
|
13738
14391
|
const changed = previousHighlightedIndexRef.current !== highlightedIndex;
|
|
13739
14392
|
previousHighlightedIndexRef.current = highlightedIndex;
|
|
13740
14393
|
if (!isOpen || highlightedIndex < 0 || !changed) return;
|
|
13741
14394
|
virtualizer.scrollToIndex(highlightedIndex, { align: "auto" });
|
|
13742
14395
|
}, [highlightedIndex, isOpen, virtualizer]);
|
|
13743
|
-
const
|
|
14396
|
+
const commitSelection = (option) => {
|
|
13744
14397
|
if (option.isDisabled) return;
|
|
13745
14398
|
onChange(option);
|
|
14399
|
+
setInputValue(resolveLabel(option));
|
|
13746
14400
|
setIsOpen(false);
|
|
13747
|
-
|
|
14401
|
+
setIsFocused(false);
|
|
14402
|
+
inputRef.current?.blur();
|
|
13748
14403
|
};
|
|
13749
|
-
const
|
|
14404
|
+
const clearSelection = (event) => {
|
|
14405
|
+
event.stopPropagation();
|
|
13750
14406
|
if (isBlocked) return;
|
|
13751
|
-
|
|
13752
|
-
|
|
13753
|
-
|
|
13754
|
-
|
|
14407
|
+
onChange(null);
|
|
14408
|
+
setInputValue("");
|
|
14409
|
+
onSearchChange?.("");
|
|
14410
|
+
inputRef.current?.focus();
|
|
13755
14411
|
};
|
|
13756
|
-
const
|
|
14412
|
+
const handleInputFocus = () => {
|
|
14413
|
+
if (isBlocked) return;
|
|
14414
|
+
setIsFocused(true);
|
|
14415
|
+
setIsOpen(true);
|
|
14416
|
+
requestAnimationFrame(() => inputRef.current?.select());
|
|
14417
|
+
};
|
|
14418
|
+
const handleBlur = (event) => {
|
|
14419
|
+
if (containerRef.current?.contains(event.relatedTarget)) return;
|
|
14420
|
+
setIsFocused(false);
|
|
14421
|
+
setInputValue(valueLabel);
|
|
14422
|
+
onBlur?.(event);
|
|
14423
|
+
};
|
|
14424
|
+
const handleInputChange = (event) => {
|
|
14425
|
+
const next = event.target.value;
|
|
14426
|
+
setInputValue(next);
|
|
14427
|
+
lastLoadMoreOptionsLengthRef.current = null;
|
|
14428
|
+
onSearchChange?.(next);
|
|
14429
|
+
if (!isOpen) setIsOpen(true);
|
|
14430
|
+
};
|
|
14431
|
+
const handleInputKeyDown = (event) => {
|
|
13757
14432
|
if (event.key === "ArrowDown") {
|
|
13758
14433
|
event.preventDefault();
|
|
14434
|
+
if (!isOpen) {
|
|
14435
|
+
setIsOpen(true);
|
|
14436
|
+
return;
|
|
14437
|
+
}
|
|
13759
14438
|
const next = getNextEnabledOptionIndex(filteredOptions, highlightedIndex + 1, 1);
|
|
13760
14439
|
if (next >= 0) setHighlightedIndex(next);
|
|
13761
14440
|
return;
|
|
13762
14441
|
}
|
|
13763
14442
|
if (event.key === "ArrowUp") {
|
|
13764
14443
|
event.preventDefault();
|
|
14444
|
+
if (!isOpen) {
|
|
14445
|
+
setIsOpen(true);
|
|
14446
|
+
return;
|
|
14447
|
+
}
|
|
13765
14448
|
const next = getNextEnabledOptionIndex(filteredOptions, highlightedIndex - 1, -1);
|
|
13766
14449
|
if (next >= 0) setHighlightedIndex(next);
|
|
13767
14450
|
return;
|
|
13768
14451
|
}
|
|
13769
14452
|
if (event.key === "Enter") {
|
|
14453
|
+
if (!isOpen) return;
|
|
13770
14454
|
event.preventDefault();
|
|
13771
14455
|
const option = filteredOptions[highlightedIndex];
|
|
13772
|
-
if (option && !option.isDisabled)
|
|
14456
|
+
if (option && !option.isDisabled) commitSelection(option);
|
|
13773
14457
|
return;
|
|
13774
14458
|
}
|
|
13775
14459
|
if (event.key === "Escape") {
|
|
13776
14460
|
event.preventDefault();
|
|
14461
|
+
setInputValue(valueLabel);
|
|
13777
14462
|
setIsOpen(false);
|
|
13778
|
-
|
|
13779
|
-
return;
|
|
13780
|
-
}
|
|
13781
|
-
if (event.key === "Tab") {
|
|
13782
|
-
setIsOpen(false);
|
|
14463
|
+
inputRef.current?.blur();
|
|
13783
14464
|
}
|
|
13784
14465
|
};
|
|
13785
|
-
const
|
|
13786
|
-
|
|
13787
|
-
|
|
13788
|
-
|
|
13789
|
-
onSearchChange?.(next);
|
|
14466
|
+
const handleContainerClick = () => {
|
|
14467
|
+
if (isBlocked) return;
|
|
14468
|
+
inputRef.current?.focus();
|
|
14469
|
+
setIsOpen(true);
|
|
13790
14470
|
};
|
|
13791
14471
|
const emptyMessage = noOptionsMessage?.();
|
|
13792
14472
|
const totalSize = virtualizer.getTotalSize();
|
|
13793
14473
|
const measuredListHeight = Math.min(listHeight, Math.max(totalSize, itemHeight));
|
|
13794
14474
|
const activeOptionId = highlightedIndex >= 0 ? getOptionId2(highlightedIndex) : void 0;
|
|
13795
|
-
return /* @__PURE__ */
|
|
14475
|
+
return /* @__PURE__ */ jsxs103(
|
|
13796
14476
|
SelectFieldShell,
|
|
13797
14477
|
{
|
|
13798
14478
|
containerRef,
|
|
@@ -13809,72 +14489,105 @@ function InfiniteScrollSelectInternal({
|
|
|
13809
14489
|
helperText,
|
|
13810
14490
|
name,
|
|
13811
14491
|
hiddenValue: value ? String(value.value) : "",
|
|
14492
|
+
onBlur: handleBlur,
|
|
13812
14493
|
children: [
|
|
13813
|
-
/* @__PURE__ */
|
|
13814
|
-
|
|
14494
|
+
/* @__PURE__ */ jsx158(
|
|
14495
|
+
ComboboxTrigger,
|
|
13815
14496
|
{
|
|
13816
|
-
triggerRef,
|
|
13817
14497
|
triggerId,
|
|
13818
14498
|
listboxId,
|
|
13819
14499
|
labelId,
|
|
13820
14500
|
valueId,
|
|
13821
14501
|
describedErrorId,
|
|
13822
|
-
hasValue,
|
|
13823
14502
|
isOpen,
|
|
14503
|
+
isFocused,
|
|
13824
14504
|
isBlocked,
|
|
14505
|
+
hasValue,
|
|
14506
|
+
isEmpty,
|
|
13825
14507
|
disabled,
|
|
14508
|
+
readOnly,
|
|
13826
14509
|
loading,
|
|
13827
14510
|
invalid: hasInvalidState,
|
|
14511
|
+
inputRef,
|
|
14512
|
+
inputValue,
|
|
13828
14513
|
placeholder,
|
|
13829
|
-
|
|
13830
|
-
|
|
13831
|
-
|
|
13832
|
-
|
|
14514
|
+
highlightedIndex,
|
|
14515
|
+
getOptionId: getOptionId2,
|
|
14516
|
+
onInputChange: handleInputChange,
|
|
14517
|
+
onInputFocus: handleInputFocus,
|
|
14518
|
+
onInputKeyDown: handleInputKeyDown,
|
|
14519
|
+
onContainerClick: handleContainerClick,
|
|
14520
|
+
showClear: clearable && hasValue && !readOnly && !disabled,
|
|
14521
|
+
onClear: clearSelection,
|
|
14522
|
+
clearLabel: t("clear")
|
|
13833
14523
|
}
|
|
13834
14524
|
),
|
|
13835
|
-
/* @__PURE__ */
|
|
14525
|
+
/* @__PURE__ */ jsx158(
|
|
13836
14526
|
Fieldset,
|
|
13837
14527
|
{
|
|
13838
|
-
isFocused: isOpen,
|
|
14528
|
+
isFocused: isFocused || isOpen,
|
|
13839
14529
|
invalid: hasInvalidState,
|
|
13840
|
-
isEmpty: !
|
|
13841
|
-
isActivated:
|
|
14530
|
+
isEmpty: isEmpty && !inputValue,
|
|
14531
|
+
isActivated: !isEmpty || isFocused || isOpen || Boolean(inputValue),
|
|
13842
14532
|
disabled,
|
|
13843
14533
|
loading,
|
|
14534
|
+
readOnly,
|
|
13844
14535
|
htmlFor: triggerId,
|
|
13845
14536
|
labelId,
|
|
13846
14537
|
legend: typeof label === "string" ? label : void 0,
|
|
13847
14538
|
label,
|
|
13848
14539
|
tooltip,
|
|
13849
|
-
onClick:
|
|
14540
|
+
onClick: handleContainerClick
|
|
13850
14541
|
}
|
|
13851
14542
|
),
|
|
13852
|
-
/* @__PURE__ */
|
|
14543
|
+
/* @__PURE__ */ jsxs103(
|
|
13853
14544
|
SelectMenuPanel,
|
|
13854
14545
|
{
|
|
13855
14546
|
isOpen,
|
|
13856
14547
|
isMobile: isMobile3,
|
|
13857
|
-
onClose:
|
|
14548
|
+
onClose: () => {
|
|
14549
|
+
closeMenu();
|
|
14550
|
+
setIsFocused(false);
|
|
14551
|
+
},
|
|
13858
14552
|
title: typeof label === "string" ? label : void 0,
|
|
13859
14553
|
className: dropdownClassName,
|
|
13860
14554
|
drawerClassName,
|
|
13861
14555
|
children: [
|
|
13862
|
-
|
|
14556
|
+
isMobile3 && /* @__PURE__ */ jsx158(
|
|
13863
14557
|
SelectSearchInput,
|
|
13864
14558
|
{
|
|
13865
|
-
inputRef:
|
|
13866
|
-
value:
|
|
13867
|
-
placeholder:
|
|
14559
|
+
inputRef: mobileSearchInputRef,
|
|
14560
|
+
value: inputValue,
|
|
14561
|
+
placeholder: t("search_placeholder"),
|
|
13868
14562
|
listboxId,
|
|
13869
14563
|
activeOptionId,
|
|
13870
|
-
onChange:
|
|
13871
|
-
onKeyDown:
|
|
14564
|
+
onChange: handleInputChange,
|
|
14565
|
+
onKeyDown: handleInputKeyDown
|
|
13872
14566
|
}
|
|
13873
14567
|
),
|
|
13874
|
-
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
|
|
14568
|
+
/* @__PURE__ */ jsx158("div", { className: "min-h-[75px] px-4 pb-[19px] pt-[17px]", children: filteredOptions.length === 0 ? isLoadingMore ? /* @__PURE__ */ jsxs103(
|
|
14569
|
+
"div",
|
|
14570
|
+
{
|
|
14571
|
+
role: "status",
|
|
14572
|
+
"aria-busy": "true",
|
|
14573
|
+
"aria-live": "polite",
|
|
14574
|
+
className: "flex flex-col gap-2",
|
|
14575
|
+
children: [
|
|
14576
|
+
/* @__PURE__ */ jsx158("span", { className: "sr-only", children: resolvedLoadingMoreText }),
|
|
14577
|
+
Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsx158(
|
|
14578
|
+
Skeleton,
|
|
14579
|
+
{
|
|
14580
|
+
className: "h-10 w-full rounded-md",
|
|
14581
|
+
style: {
|
|
14582
|
+
animationDelay: `${index * 120}ms`,
|
|
14583
|
+
opacity: 1 - index * 0.2
|
|
14584
|
+
}
|
|
14585
|
+
},
|
|
14586
|
+
index
|
|
14587
|
+
))
|
|
14588
|
+
]
|
|
14589
|
+
}
|
|
14590
|
+
) : /* @__PURE__ */ jsx158("div", { className: "flex min-h-[40px] items-center text-[16px] font-medium text-[var(--chekin-color-brand-navy)]", children: emptyMessage ?? t("no_options") }) : /* @__PURE__ */ jsx158(
|
|
13878
14591
|
InfiniteScrollList,
|
|
13879
14592
|
{
|
|
13880
14593
|
scrollRef,
|
|
@@ -13892,10 +14605,11 @@ function InfiniteScrollSelectInternal({
|
|
|
13892
14605
|
loadingMoreText: resolvedLoadingMoreText,
|
|
13893
14606
|
activeOptionId,
|
|
13894
14607
|
getOptionId: getOptionId2,
|
|
13895
|
-
|
|
14608
|
+
canLoadMore: Boolean(canLoadMore || isLoadingMore),
|
|
14609
|
+
onSelect: commitSelection,
|
|
13896
14610
|
onHighlight: setHighlightedIndex
|
|
13897
14611
|
}
|
|
13898
|
-
)
|
|
14612
|
+
) })
|
|
13899
14613
|
]
|
|
13900
14614
|
}
|
|
13901
14615
|
)
|
|
@@ -13903,14 +14617,14 @@ function InfiniteScrollSelectInternal({
|
|
|
13903
14617
|
}
|
|
13904
14618
|
);
|
|
13905
14619
|
}
|
|
13906
|
-
var InfiniteScrollSelect =
|
|
14620
|
+
var InfiniteScrollSelect = React54.forwardRef(
|
|
13907
14621
|
InfiniteScrollSelectInternal
|
|
13908
14622
|
);
|
|
13909
14623
|
|
|
13910
14624
|
// src/dashboard/textarea/Textarea.tsx
|
|
13911
|
-
import * as
|
|
13912
|
-
import { useTranslation as
|
|
13913
|
-
import { jsx as
|
|
14625
|
+
import * as React55 from "react";
|
|
14626
|
+
import { useTranslation as useTranslation36 } from "react-i18next";
|
|
14627
|
+
import { jsx as jsx159, jsxs as jsxs104 } from "react/jsx-runtime";
|
|
13914
14628
|
var LINE_HEIGHT = 20;
|
|
13915
14629
|
var VERTICAL_PADDING = 32;
|
|
13916
14630
|
function getEmptyState(empty, value, defaultValue) {
|
|
@@ -13918,128 +14632,126 @@ function getEmptyState(empty, value, defaultValue) {
|
|
|
13918
14632
|
if (value !== void 0) return !String(value);
|
|
13919
14633
|
return !defaultValue;
|
|
13920
14634
|
}
|
|
13921
|
-
var Textarea =
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
13925
|
-
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
13934
|
-
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
|
|
13952
|
-
|
|
13953
|
-
const
|
|
13954
|
-
|
|
13955
|
-
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13959
|
-
|
|
13960
|
-
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
label
|
|
13981
|
-
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
|
|
14009
|
-
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
|
|
14022
|
-
{
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
14030
|
-
|
|
14031
|
-
|
|
14032
|
-
|
|
14033
|
-
}
|
|
14034
|
-
);
|
|
14635
|
+
var Textarea = React55.forwardRef(function Textarea2({
|
|
14636
|
+
className,
|
|
14637
|
+
textareaClassName,
|
|
14638
|
+
label,
|
|
14639
|
+
invalid,
|
|
14640
|
+
error,
|
|
14641
|
+
empty,
|
|
14642
|
+
optional,
|
|
14643
|
+
disabled,
|
|
14644
|
+
readOnly,
|
|
14645
|
+
loading,
|
|
14646
|
+
tooltip,
|
|
14647
|
+
name,
|
|
14648
|
+
id,
|
|
14649
|
+
helperText,
|
|
14650
|
+
minRows = 3,
|
|
14651
|
+
maxRows,
|
|
14652
|
+
autosize = true,
|
|
14653
|
+
value,
|
|
14654
|
+
defaultValue,
|
|
14655
|
+
onInput,
|
|
14656
|
+
...textareaProps
|
|
14657
|
+
}, ref) {
|
|
14658
|
+
const innerRef = React55.useRef(null);
|
|
14659
|
+
const combinedRef = useCombinedRef(ref, innerRef);
|
|
14660
|
+
const reactId = React55.useId();
|
|
14661
|
+
const textareaId = id ?? name ?? `dash-textarea-${reactId}`;
|
|
14662
|
+
const { t } = useTranslation36();
|
|
14663
|
+
const isInvalid = Boolean(invalid || error);
|
|
14664
|
+
const isEmpty = getEmptyState(empty, value, defaultValue);
|
|
14665
|
+
const isBlocked = Boolean(disabled);
|
|
14666
|
+
const resize = React55.useCallback(() => {
|
|
14667
|
+
const el = innerRef.current;
|
|
14668
|
+
if (!el || !autosize) return;
|
|
14669
|
+
el.style.height = "auto";
|
|
14670
|
+
const minHeight = minRows * LINE_HEIGHT + VERTICAL_PADDING;
|
|
14671
|
+
const maxHeight = maxRows ? maxRows * LINE_HEIGHT + VERTICAL_PADDING : Infinity;
|
|
14672
|
+
const nextHeight = Math.min(Math.max(el.scrollHeight, minHeight), maxHeight);
|
|
14673
|
+
el.style.height = `${nextHeight}px`;
|
|
14674
|
+
el.style.overflowY = el.scrollHeight > nextHeight ? "auto" : "hidden";
|
|
14675
|
+
}, [autosize, maxRows, minRows]);
|
|
14676
|
+
React55.useLayoutEffect(() => {
|
|
14677
|
+
resize();
|
|
14678
|
+
}, [resize, value]);
|
|
14679
|
+
const handleInput = (event) => {
|
|
14680
|
+
resize();
|
|
14681
|
+
onInput?.(event);
|
|
14682
|
+
};
|
|
14683
|
+
return /* @__PURE__ */ jsxs104(
|
|
14684
|
+
"div",
|
|
14685
|
+
{
|
|
14686
|
+
className: cn(
|
|
14687
|
+
"relative block min-h-[88px] w-full max-w-[var(--field-max-width,296px)]",
|
|
14688
|
+
isBlocked && "cursor-not-allowed opacity-50",
|
|
14689
|
+
loading && "cursor-progress opacity-50",
|
|
14690
|
+
className
|
|
14691
|
+
),
|
|
14692
|
+
children: [
|
|
14693
|
+
label && /* @__PURE__ */ jsxs104(
|
|
14694
|
+
"label",
|
|
14695
|
+
{
|
|
14696
|
+
htmlFor: textareaId,
|
|
14697
|
+
className: "mb-2 flex select-none items-center text-[16px] font-medium text-[var(--chekin-color-brand-navy)]",
|
|
14698
|
+
children: [
|
|
14699
|
+
label,
|
|
14700
|
+
tooltip && /* @__PURE__ */ jsx159("span", { className: "ml-1 inline-flex", children: /* @__PURE__ */ jsx159(HelpTooltip, { content: tooltip, size: 16 }) })
|
|
14701
|
+
]
|
|
14702
|
+
}
|
|
14703
|
+
),
|
|
14704
|
+
/* @__PURE__ */ jsx159(
|
|
14705
|
+
"textarea",
|
|
14706
|
+
{
|
|
14707
|
+
ref: combinedRef,
|
|
14708
|
+
id: textareaId,
|
|
14709
|
+
name,
|
|
14710
|
+
value,
|
|
14711
|
+
defaultValue,
|
|
14712
|
+
rows: minRows,
|
|
14713
|
+
disabled: isBlocked || loading,
|
|
14714
|
+
readOnly: isBlocked || readOnly,
|
|
14715
|
+
"aria-invalid": isInvalid,
|
|
14716
|
+
"aria-busy": loading,
|
|
14717
|
+
onInput: handleInput,
|
|
14718
|
+
className: cn(
|
|
14719
|
+
"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",
|
|
14720
|
+
"border-[var(--chekin-color-gray-3)] placeholder:font-medium placeholder:text-[var(--chekin-color-gray-1)]",
|
|
14721
|
+
!isBlocked && "focus:border-[var(--chekin-color-brand-blue)]",
|
|
14722
|
+
isEmpty && "border-[var(--chekin-color-gray-3)] bg-[var(--chekin-color-surface-input-empty)] text-[var(--chekin-color-gray-1)]",
|
|
14723
|
+
isInvalid && "border-[var(--error-message-color)] focus:border-[var(--error-message-color)]",
|
|
14724
|
+
(readOnly || isBlocked) && "cursor-default",
|
|
14725
|
+
isBlocked && "cursor-not-allowed",
|
|
14726
|
+
loading && "cursor-progress",
|
|
14727
|
+
textareaClassName
|
|
14728
|
+
),
|
|
14729
|
+
style: autosize ? { minHeight: minRows * LINE_HEIGHT + VERTICAL_PADDING } : void 0,
|
|
14730
|
+
...textareaProps
|
|
14731
|
+
}
|
|
14732
|
+
),
|
|
14733
|
+
error && /* @__PURE__ */ jsx159(
|
|
14734
|
+
FieldErrorMessage,
|
|
14735
|
+
{
|
|
14736
|
+
id: `${textareaId}-error`,
|
|
14737
|
+
message: error,
|
|
14738
|
+
className: "mt-[1px] text-[14px]"
|
|
14739
|
+
}
|
|
14740
|
+
),
|
|
14741
|
+
!error && optional && /* @__PURE__ */ jsx159("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
14742
|
+
!error && helperText && /* @__PURE__ */ jsx159("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText })
|
|
14743
|
+
]
|
|
14744
|
+
}
|
|
14745
|
+
);
|
|
14746
|
+
});
|
|
14035
14747
|
|
|
14036
14748
|
// src/dashboard/datepicker/Datepicker.tsx
|
|
14037
|
-
import * as
|
|
14749
|
+
import * as React57 from "react";
|
|
14038
14750
|
import { ChevronDown as ChevronDown3 } from "lucide-react";
|
|
14039
|
-
import { useTranslation as
|
|
14751
|
+
import { useTranslation as useTranslation37 } from "react-i18next";
|
|
14040
14752
|
|
|
14041
14753
|
// src/airbnb-fields/datepicker/useDatePickerWheel.ts
|
|
14042
|
-
import * as
|
|
14754
|
+
import * as React56 from "react";
|
|
14043
14755
|
|
|
14044
14756
|
// src/airbnb-fields/datepicker/datePicker.utils.ts
|
|
14045
14757
|
var DISPLAY_PAD_LENGTH = 2;
|
|
@@ -14190,21 +14902,21 @@ function useDatePickerWheel({
|
|
|
14190
14902
|
minDate,
|
|
14191
14903
|
maxDate
|
|
14192
14904
|
}) {
|
|
14193
|
-
const years =
|
|
14194
|
-
const [draftDate, setDraftDate] =
|
|
14905
|
+
const years = React56.useMemo(() => getYearRange(minDate, maxDate), [maxDate, minDate]);
|
|
14906
|
+
const [draftDate, setDraftDate] = React56.useState(
|
|
14195
14907
|
() => resolveInitialDate({ value, defaultValue, minDate, maxDate })
|
|
14196
14908
|
);
|
|
14197
14909
|
const draftYear = draftDate.getFullYear();
|
|
14198
14910
|
const draftMonth = draftDate.getMonth();
|
|
14199
|
-
const [monthScrollTop, setMonthScrollTop] =
|
|
14200
|
-
const [dayScrollTop, setDayScrollTop] =
|
|
14201
|
-
const [yearScrollTop, setYearScrollTop] =
|
|
14202
|
-
const monthListRef =
|
|
14203
|
-
const dayListRef =
|
|
14204
|
-
const yearListRef =
|
|
14205
|
-
const settleTimeoutsRef =
|
|
14206
|
-
const animationFramesRef =
|
|
14207
|
-
const columnRefs =
|
|
14911
|
+
const [monthScrollTop, setMonthScrollTop] = React56.useState(0);
|
|
14912
|
+
const [dayScrollTop, setDayScrollTop] = React56.useState(0);
|
|
14913
|
+
const [yearScrollTop, setYearScrollTop] = React56.useState(0);
|
|
14914
|
+
const monthListRef = React56.useRef(null);
|
|
14915
|
+
const dayListRef = React56.useRef(null);
|
|
14916
|
+
const yearListRef = React56.useRef(null);
|
|
14917
|
+
const settleTimeoutsRef = React56.useRef({});
|
|
14918
|
+
const animationFramesRef = React56.useRef({});
|
|
14919
|
+
const columnRefs = React56.useMemo(
|
|
14208
14920
|
() => ({
|
|
14209
14921
|
month: monthListRef,
|
|
14210
14922
|
day: dayListRef,
|
|
@@ -14212,7 +14924,7 @@ function useDatePickerWheel({
|
|
|
14212
14924
|
}),
|
|
14213
14925
|
[]
|
|
14214
14926
|
);
|
|
14215
|
-
const setColumnScrollTop =
|
|
14927
|
+
const setColumnScrollTop = React56.useCallback(
|
|
14216
14928
|
(column, nextScrollTop) => {
|
|
14217
14929
|
if (column === "month") {
|
|
14218
14930
|
setMonthScrollTop(nextScrollTop);
|
|
@@ -14226,19 +14938,19 @@ function useDatePickerWheel({
|
|
|
14226
14938
|
},
|
|
14227
14939
|
[]
|
|
14228
14940
|
);
|
|
14229
|
-
const clearSettleTimeout =
|
|
14941
|
+
const clearSettleTimeout = React56.useCallback((column) => {
|
|
14230
14942
|
const timeoutId = settleTimeoutsRef.current[column];
|
|
14231
14943
|
if (timeoutId === void 0) return;
|
|
14232
14944
|
window.clearTimeout(timeoutId);
|
|
14233
14945
|
delete settleTimeoutsRef.current[column];
|
|
14234
14946
|
}, []);
|
|
14235
|
-
const clearAnimationFrame =
|
|
14947
|
+
const clearAnimationFrame = React56.useCallback((column) => {
|
|
14236
14948
|
const frameId = animationFramesRef.current[column];
|
|
14237
14949
|
if (frameId === void 0) return;
|
|
14238
14950
|
window.cancelAnimationFrame(frameId);
|
|
14239
14951
|
delete animationFramesRef.current[column];
|
|
14240
14952
|
}, []);
|
|
14241
|
-
|
|
14953
|
+
React56.useEffect(
|
|
14242
14954
|
() => () => {
|
|
14243
14955
|
["month", "day", "year"].forEach((column) => {
|
|
14244
14956
|
clearSettleTimeout(column);
|
|
@@ -14247,22 +14959,22 @@ function useDatePickerWheel({
|
|
|
14247
14959
|
},
|
|
14248
14960
|
[clearAnimationFrame, clearSettleTimeout]
|
|
14249
14961
|
);
|
|
14250
|
-
|
|
14962
|
+
React56.useEffect(() => {
|
|
14251
14963
|
if (isOpen) return;
|
|
14252
14964
|
setDraftDate(resolveInitialDate({ value, defaultValue, minDate, maxDate }));
|
|
14253
14965
|
}, [defaultValue, isOpen, maxDate, minDate, value]);
|
|
14254
|
-
const months =
|
|
14966
|
+
const months = React56.useMemo(
|
|
14255
14967
|
() => getAllowedMonths(draftYear, minDate, maxDate),
|
|
14256
14968
|
[draftYear, maxDate, minDate]
|
|
14257
14969
|
);
|
|
14258
|
-
const days =
|
|
14970
|
+
const days = React56.useMemo(
|
|
14259
14971
|
() => getAllowedDays(draftYear, draftMonth, minDate, maxDate),
|
|
14260
14972
|
[draftMonth, draftYear, maxDate, minDate]
|
|
14261
14973
|
);
|
|
14262
14974
|
const monthIndex = months.findIndex((month) => month === draftMonth);
|
|
14263
14975
|
const dayIndex = days.findIndex((day) => day === draftDate.getDate());
|
|
14264
14976
|
const yearIndex = years.findIndex((year) => year === draftYear);
|
|
14265
|
-
const syncScrollPositions =
|
|
14977
|
+
const syncScrollPositions = React56.useCallback(
|
|
14266
14978
|
(nextDate, behavior = "auto") => {
|
|
14267
14979
|
const nextMonths = getAllowedMonths(nextDate.getFullYear(), minDate, maxDate);
|
|
14268
14980
|
const nextMonthIndex = nextMonths.findIndex((month) => month === nextDate.getMonth());
|
|
@@ -14286,7 +14998,7 @@ function useDatePickerWheel({
|
|
|
14286
14998
|
},
|
|
14287
14999
|
[maxDate, minDate, years]
|
|
14288
15000
|
);
|
|
14289
|
-
|
|
15001
|
+
React56.useLayoutEffect(() => {
|
|
14290
15002
|
if (!isOpen) return;
|
|
14291
15003
|
const nextDate = resolveInitialDate({ value, defaultValue, minDate, maxDate });
|
|
14292
15004
|
setDraftDate(nextDate);
|
|
@@ -14297,7 +15009,7 @@ function useDatePickerWheel({
|
|
|
14297
15009
|
window.cancelAnimationFrame(frameId);
|
|
14298
15010
|
};
|
|
14299
15011
|
}, [defaultValue, isOpen, maxDate, minDate, syncScrollPositions, value]);
|
|
14300
|
-
const updateDraftDate =
|
|
15012
|
+
const updateDraftDate = React56.useCallback(
|
|
14301
15013
|
(column, targetIndex, behavior = "smooth") => {
|
|
14302
15014
|
const currentDate = stripTime(draftDate);
|
|
14303
15015
|
const currentYear = currentDate.getFullYear();
|
|
@@ -14342,7 +15054,7 @@ function useDatePickerWheel({
|
|
|
14342
15054
|
},
|
|
14343
15055
|
[days, draftDate, maxDate, minDate, months, syncScrollPositions, years]
|
|
14344
15056
|
);
|
|
14345
|
-
const settleColumnScroll =
|
|
15057
|
+
const settleColumnScroll = React56.useCallback(
|
|
14346
15058
|
(column) => {
|
|
14347
15059
|
const list = columnRefs[column].current;
|
|
14348
15060
|
if (!list) return;
|
|
@@ -14355,7 +15067,7 @@ function useDatePickerWheel({
|
|
|
14355
15067
|
},
|
|
14356
15068
|
[columnRefs, days.length, months.length, updateDraftDate, years.length]
|
|
14357
15069
|
);
|
|
14358
|
-
const scheduleScrollSettle =
|
|
15070
|
+
const scheduleScrollSettle = React56.useCallback(
|
|
14359
15071
|
(column) => {
|
|
14360
15072
|
clearSettleTimeout(column);
|
|
14361
15073
|
settleTimeoutsRef.current[column] = window.setTimeout(() => {
|
|
@@ -14364,7 +15076,7 @@ function useDatePickerWheel({
|
|
|
14364
15076
|
},
|
|
14365
15077
|
[clearSettleTimeout, settleColumnScroll]
|
|
14366
15078
|
);
|
|
14367
|
-
const handleColumnScroll =
|
|
15079
|
+
const handleColumnScroll = React56.useCallback(
|
|
14368
15080
|
(column) => {
|
|
14369
15081
|
const list = columnRefs[column].current;
|
|
14370
15082
|
if (!list) return;
|
|
@@ -14378,13 +15090,13 @@ function useDatePickerWheel({
|
|
|
14378
15090
|
},
|
|
14379
15091
|
[clearAnimationFrame, columnRefs, scheduleScrollSettle, setColumnScrollTop]
|
|
14380
15092
|
);
|
|
14381
|
-
const handleOptionSelect =
|
|
15093
|
+
const handleOptionSelect = React56.useCallback(
|
|
14382
15094
|
(column, targetIndex) => {
|
|
14383
15095
|
updateDraftDate(column, targetIndex, "smooth");
|
|
14384
15096
|
},
|
|
14385
15097
|
[updateDraftDate]
|
|
14386
15098
|
);
|
|
14387
|
-
const focusAdjacentColumn =
|
|
15099
|
+
const focusAdjacentColumn = React56.useCallback(
|
|
14388
15100
|
(column, direction) => {
|
|
14389
15101
|
const order = ["month", "day", "year"];
|
|
14390
15102
|
const currentIndex = order.indexOf(column);
|
|
@@ -14394,7 +15106,7 @@ function useDatePickerWheel({
|
|
|
14394
15106
|
},
|
|
14395
15107
|
[columnRefs]
|
|
14396
15108
|
);
|
|
14397
|
-
const handleColumnKeyDown =
|
|
15109
|
+
const handleColumnKeyDown = React56.useCallback(
|
|
14398
15110
|
(column, event) => {
|
|
14399
15111
|
const currentIndex = column === "month" ? monthIndex : column === "day" ? dayIndex : yearIndex;
|
|
14400
15112
|
const maxIndex = column === "month" ? months.length - 1 : column === "day" ? days.length - 1 : years.length - 1;
|
|
@@ -14460,7 +15172,7 @@ function useDatePickerWheel({
|
|
|
14460
15172
|
}
|
|
14461
15173
|
|
|
14462
15174
|
// src/airbnb-fields/datepicker/DatePickerWheelColumn.tsx
|
|
14463
|
-
import { jsx as
|
|
15175
|
+
import { jsx as jsx160, jsxs as jsxs105 } from "react/jsx-runtime";
|
|
14464
15176
|
var spacerHeight = DATE_PICKER_OPTION_HEIGHT * DATE_PICKER_WHEEL_BUFFER_OPTIONS;
|
|
14465
15177
|
function AirbnbDatePickerWheelColumn({
|
|
14466
15178
|
id,
|
|
@@ -14474,7 +15186,7 @@ function AirbnbDatePickerWheelColumn({
|
|
|
14474
15186
|
onOptionSelect,
|
|
14475
15187
|
column
|
|
14476
15188
|
}) {
|
|
14477
|
-
return /* @__PURE__ */
|
|
15189
|
+
return /* @__PURE__ */ jsx160("div", { className: "relative z-10 min-w-0", children: /* @__PURE__ */ jsxs105(
|
|
14478
15190
|
"div",
|
|
14479
15191
|
{
|
|
14480
15192
|
id,
|
|
@@ -14491,14 +15203,14 @@ function AirbnbDatePickerWheelColumn({
|
|
|
14491
15203
|
WebkitOverflowScrolling: "touch"
|
|
14492
15204
|
},
|
|
14493
15205
|
children: [
|
|
14494
|
-
/* @__PURE__ */
|
|
15206
|
+
/* @__PURE__ */ jsx160("div", { style: { height: `${spacerHeight}px` } }),
|
|
14495
15207
|
items.map((item, index) => {
|
|
14496
15208
|
const { style } = getWheelOptionStyles(
|
|
14497
15209
|
index,
|
|
14498
15210
|
scrollTop,
|
|
14499
15211
|
DATE_PICKER_OPTION_HEIGHT
|
|
14500
15212
|
);
|
|
14501
|
-
return /* @__PURE__ */
|
|
15213
|
+
return /* @__PURE__ */ jsx160(
|
|
14502
15214
|
"button",
|
|
14503
15215
|
{
|
|
14504
15216
|
id: `${id}-option-${index}`,
|
|
@@ -14514,14 +15226,14 @@ function AirbnbDatePickerWheelColumn({
|
|
|
14514
15226
|
`${column}-${item}-${index}`
|
|
14515
15227
|
);
|
|
14516
15228
|
}),
|
|
14517
|
-
/* @__PURE__ */
|
|
15229
|
+
/* @__PURE__ */ jsx160("div", { style: { height: `${spacerHeight}px` } })
|
|
14518
15230
|
]
|
|
14519
15231
|
}
|
|
14520
15232
|
) });
|
|
14521
15233
|
}
|
|
14522
15234
|
|
|
14523
15235
|
// src/airbnb-fields/datepicker/DatePickerContent.tsx
|
|
14524
|
-
import { jsx as
|
|
15236
|
+
import { jsx as jsx161, jsxs as jsxs106 } from "react/jsx-runtime";
|
|
14525
15237
|
function AirbnbDatePickerBody({
|
|
14526
15238
|
baseId,
|
|
14527
15239
|
label,
|
|
@@ -14543,19 +15255,19 @@ function AirbnbDatePickerBody({
|
|
|
14543
15255
|
onOptionSelect,
|
|
14544
15256
|
onDone
|
|
14545
15257
|
}) {
|
|
14546
|
-
return /* @__PURE__ */
|
|
14547
|
-
/* @__PURE__ */
|
|
14548
|
-
/* @__PURE__ */
|
|
14549
|
-
/* @__PURE__ */
|
|
14550
|
-
/* @__PURE__ */
|
|
15258
|
+
return /* @__PURE__ */ jsxs106("div", { className: "px-6 pb-4 pt-1 bg-white", children: [
|
|
15259
|
+
/* @__PURE__ */ jsxs106("div", { className: "relative overflow-hidden rounded-[24px]", children: [
|
|
15260
|
+
/* @__PURE__ */ jsx161("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" }),
|
|
15261
|
+
/* @__PURE__ */ jsx161("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" }),
|
|
15262
|
+
/* @__PURE__ */ jsx161(
|
|
14551
15263
|
"div",
|
|
14552
15264
|
{
|
|
14553
15265
|
"aria-hidden": true,
|
|
14554
15266
|
className: "pointer-events-none absolute inset-x-0 top-1/2 z-0 h-8 -translate-y-1/2 rounded-[12px] bg-black/[0.04]"
|
|
14555
15267
|
}
|
|
14556
15268
|
),
|
|
14557
|
-
/* @__PURE__ */
|
|
14558
|
-
/* @__PURE__ */
|
|
15269
|
+
/* @__PURE__ */ jsxs106("div", { className: "relative grid grid-cols-[1.35fr_0.7fr_1fr] gap-1", children: [
|
|
15270
|
+
/* @__PURE__ */ jsx161(
|
|
14559
15271
|
AirbnbDatePickerWheelColumn,
|
|
14560
15272
|
{
|
|
14561
15273
|
id: `${baseId}-month`,
|
|
@@ -14570,7 +15282,7 @@ function AirbnbDatePickerBody({
|
|
|
14570
15282
|
onOptionSelect
|
|
14571
15283
|
}
|
|
14572
15284
|
),
|
|
14573
|
-
/* @__PURE__ */
|
|
15285
|
+
/* @__PURE__ */ jsx161(
|
|
14574
15286
|
AirbnbDatePickerWheelColumn,
|
|
14575
15287
|
{
|
|
14576
15288
|
id: `${baseId}-day`,
|
|
@@ -14585,7 +15297,7 @@ function AirbnbDatePickerBody({
|
|
|
14585
15297
|
onOptionSelect
|
|
14586
15298
|
}
|
|
14587
15299
|
),
|
|
14588
|
-
/* @__PURE__ */
|
|
15300
|
+
/* @__PURE__ */ jsx161(
|
|
14589
15301
|
AirbnbDatePickerWheelColumn,
|
|
14590
15302
|
{
|
|
14591
15303
|
id: `${baseId}-year`,
|
|
@@ -14602,7 +15314,7 @@ function AirbnbDatePickerBody({
|
|
|
14602
15314
|
)
|
|
14603
15315
|
] })
|
|
14604
15316
|
] }),
|
|
14605
|
-
/* @__PURE__ */
|
|
15317
|
+
/* @__PURE__ */ jsx161(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
14606
15318
|
] });
|
|
14607
15319
|
}
|
|
14608
15320
|
function AirbnbDatePickerContent({
|
|
@@ -14630,7 +15342,7 @@ function AirbnbDatePickerContent({
|
|
|
14630
15342
|
onColumnKeyDown,
|
|
14631
15343
|
onOptionSelect
|
|
14632
15344
|
}) {
|
|
14633
|
-
const body = /* @__PURE__ */
|
|
15345
|
+
const body = /* @__PURE__ */ jsx161(
|
|
14634
15346
|
AirbnbDatePickerBody,
|
|
14635
15347
|
{
|
|
14636
15348
|
baseId,
|
|
@@ -14655,27 +15367,27 @@ function AirbnbDatePickerContent({
|
|
|
14655
15367
|
}
|
|
14656
15368
|
);
|
|
14657
15369
|
if (isMobile3) {
|
|
14658
|
-
return /* @__PURE__ */
|
|
15370
|
+
return /* @__PURE__ */ jsx161(Drawer, { open, onOpenChange, children: /* @__PURE__ */ jsxs106(
|
|
14659
15371
|
DrawerContent,
|
|
14660
15372
|
{
|
|
14661
15373
|
onClose: () => onOpenChange(false),
|
|
14662
15374
|
className: "rounded-none rounded-t-[32px] border-0 p-0",
|
|
14663
15375
|
children: [
|
|
14664
|
-
/* @__PURE__ */
|
|
14665
|
-
/* @__PURE__ */
|
|
15376
|
+
/* @__PURE__ */ jsx161(DrawerTitle, { className: "sr-only", children: title }),
|
|
15377
|
+
/* @__PURE__ */ jsx161(DrawerDescription, { className: "sr-only", children: label }),
|
|
14666
15378
|
body
|
|
14667
15379
|
]
|
|
14668
15380
|
}
|
|
14669
15381
|
) });
|
|
14670
15382
|
}
|
|
14671
|
-
return /* @__PURE__ */
|
|
15383
|
+
return /* @__PURE__ */ jsx161(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs106(
|
|
14672
15384
|
DialogContent,
|
|
14673
15385
|
{
|
|
14674
15386
|
className: "max-w-[520px] rounded-[28px] border-0 p-0 shadow-xl",
|
|
14675
15387
|
showCloseButton: false,
|
|
14676
15388
|
children: [
|
|
14677
|
-
/* @__PURE__ */
|
|
14678
|
-
/* @__PURE__ */
|
|
15389
|
+
/* @__PURE__ */ jsx161(DialogTitle, { className: "sr-only", children: title }),
|
|
15390
|
+
/* @__PURE__ */ jsx161(DialogDescription, { className: "sr-only", children: label }),
|
|
14679
15391
|
body
|
|
14680
15392
|
]
|
|
14681
15393
|
}
|
|
@@ -14683,7 +15395,7 @@ function AirbnbDatePickerContent({
|
|
|
14683
15395
|
}
|
|
14684
15396
|
|
|
14685
15397
|
// src/dashboard/datepicker/Datepicker.tsx
|
|
14686
|
-
import { jsx as
|
|
15398
|
+
import { jsx as jsx162, jsxs as jsxs107 } from "react/jsx-runtime";
|
|
14687
15399
|
var MONTHS_IN_YEAR2 = 12;
|
|
14688
15400
|
function getMonthLabels2(locale) {
|
|
14689
15401
|
const formatter = new Intl.DateTimeFormat(locale, { month: "long" });
|
|
@@ -14716,7 +15428,7 @@ function dateFromParts(day, monthIndex, year) {
|
|
|
14716
15428
|
if (!isValidCalendarDate(yearNum, monthIndex, dayNum)) return null;
|
|
14717
15429
|
return new Date(yearNum, monthIndex, dayNum);
|
|
14718
15430
|
}
|
|
14719
|
-
var Datepicker =
|
|
15431
|
+
var Datepicker = React57.forwardRef(
|
|
14720
15432
|
function Datepicker2({
|
|
14721
15433
|
label,
|
|
14722
15434
|
value,
|
|
@@ -14746,66 +15458,66 @@ var Datepicker = React54.forwardRef(
|
|
|
14746
15458
|
maxDate,
|
|
14747
15459
|
formatValue
|
|
14748
15460
|
}, ref) {
|
|
14749
|
-
const containerRef =
|
|
14750
|
-
const dayInputRef =
|
|
14751
|
-
const monthInputRef =
|
|
14752
|
-
const monthListRef =
|
|
14753
|
-
const yearInputRef =
|
|
14754
|
-
const mobileTriggerRef =
|
|
14755
|
-
const wheelBaseId =
|
|
14756
|
-
const reactId =
|
|
15461
|
+
const containerRef = React57.useRef(null);
|
|
15462
|
+
const dayInputRef = React57.useRef(null);
|
|
15463
|
+
const monthInputRef = React57.useRef(null);
|
|
15464
|
+
const monthListRef = React57.useRef(null);
|
|
15465
|
+
const yearInputRef = React57.useRef(null);
|
|
15466
|
+
const mobileTriggerRef = React57.useRef(null);
|
|
15467
|
+
const wheelBaseId = React57.useId();
|
|
15468
|
+
const reactId = React57.useId();
|
|
14757
15469
|
const baseId = name ?? `dash-datepicker-${reactId}`;
|
|
14758
15470
|
const dayId = `${baseId}-day`;
|
|
14759
15471
|
const monthId = `${baseId}-month`;
|
|
14760
15472
|
const yearId = `${baseId}-year`;
|
|
14761
15473
|
const labelId = `${baseId}-label`;
|
|
14762
15474
|
const errorId = `${baseId}-error`;
|
|
14763
|
-
const { t } =
|
|
14764
|
-
const resolvedMonthLabels =
|
|
15475
|
+
const { t } = useTranslation37();
|
|
15476
|
+
const resolvedMonthLabels = React57.useMemo(
|
|
14765
15477
|
() => monthLabels ?? getMonthLabels2(locale),
|
|
14766
15478
|
[locale, monthLabels]
|
|
14767
15479
|
);
|
|
14768
15480
|
const resolvedMonthPlaceholder = monthPlaceholder ?? t("month");
|
|
14769
15481
|
const resolvedDoneLabel = doneLabel ?? t("done");
|
|
14770
15482
|
const isControlled = value !== void 0;
|
|
14771
|
-
const initialParts =
|
|
15483
|
+
const initialParts = React57.useMemo(
|
|
14772
15484
|
() => partsFromDate(value ?? defaultValue ?? null),
|
|
14773
15485
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14774
15486
|
[]
|
|
14775
15487
|
);
|
|
14776
|
-
const [day, setDay] =
|
|
14777
|
-
const [monthIndex, setMonthIndex] =
|
|
15488
|
+
const [day, setDay] = React57.useState(initialParts.day);
|
|
15489
|
+
const [monthIndex, setMonthIndex] = React57.useState(
|
|
14778
15490
|
initialParts.monthIndex
|
|
14779
15491
|
);
|
|
14780
|
-
const [year, setYear] =
|
|
14781
|
-
const [isMonthOpen, setIsMonthOpen] =
|
|
14782
|
-
const [isWheelOpen, setIsWheelOpen] =
|
|
14783
|
-
const [focusedField, setFocusedField] =
|
|
14784
|
-
const [monthInputValue, setMonthInputValue] =
|
|
14785
|
-
const [monthHighlightIndex, setMonthHighlightIndex] =
|
|
15492
|
+
const [year, setYear] = React57.useState(initialParts.year);
|
|
15493
|
+
const [isMonthOpen, setIsMonthOpen] = React57.useState(false);
|
|
15494
|
+
const [isWheelOpen, setIsWheelOpen] = React57.useState(false);
|
|
15495
|
+
const [focusedField, setFocusedField] = React57.useState(null);
|
|
15496
|
+
const [monthInputValue, setMonthInputValue] = React57.useState("");
|
|
15497
|
+
const [monthHighlightIndex, setMonthHighlightIndex] = React57.useState(-1);
|
|
14786
15498
|
const isMobile3 = useIsMobile();
|
|
14787
|
-
|
|
14788
|
-
|
|
15499
|
+
React57.useImperativeHandle(ref, () => dayInputRef.current, []);
|
|
15500
|
+
React57.useEffect(() => {
|
|
14789
15501
|
if (!isControlled) return;
|
|
14790
15502
|
const next = partsFromDate(value ?? null);
|
|
14791
15503
|
setDay(next.day);
|
|
14792
15504
|
setMonthIndex(next.monthIndex);
|
|
14793
15505
|
setYear(next.year);
|
|
14794
15506
|
}, [isControlled, value]);
|
|
14795
|
-
|
|
15507
|
+
React57.useEffect(() => {
|
|
14796
15508
|
if (focusedField === "month") return;
|
|
14797
15509
|
setMonthInputValue(
|
|
14798
15510
|
monthIndex !== null ? resolvedMonthLabels[monthIndex] ?? "" : ""
|
|
14799
15511
|
);
|
|
14800
15512
|
}, [monthIndex, resolvedMonthLabels, focusedField]);
|
|
14801
|
-
const filteredMonths =
|
|
15513
|
+
const filteredMonths = React57.useMemo(() => {
|
|
14802
15514
|
const all = resolvedMonthLabels.map((label2, index) => ({ label: label2, index }));
|
|
14803
15515
|
const query = monthInputValue.trim().toLowerCase();
|
|
14804
15516
|
const currentLabel = monthIndex !== null ? resolvedMonthLabels[monthIndex] ?? "" : "";
|
|
14805
15517
|
if (!query || monthInputValue === currentLabel) return all;
|
|
14806
15518
|
return all.filter((opt) => opt.label.toLowerCase().includes(query));
|
|
14807
15519
|
}, [monthInputValue, monthIndex, resolvedMonthLabels]);
|
|
14808
|
-
|
|
15520
|
+
React57.useEffect(() => {
|
|
14809
15521
|
if (!isMonthOpen) {
|
|
14810
15522
|
setMonthHighlightIndex(-1);
|
|
14811
15523
|
return;
|
|
@@ -14826,7 +15538,7 @@ var Datepicker = React54.forwardRef(
|
|
|
14826
15538
|
const isFocused = focusedField !== null || isMonthOpen || isWheelOpen;
|
|
14827
15539
|
const isInvalid = Boolean(invalid || error);
|
|
14828
15540
|
const wrapperWidth = toCssSize(width);
|
|
14829
|
-
const currentDate =
|
|
15541
|
+
const currentDate = React57.useMemo(
|
|
14830
15542
|
() => dateFromParts(day, monthIndex, year),
|
|
14831
15543
|
[day, monthIndex, year]
|
|
14832
15544
|
);
|
|
@@ -14835,7 +15547,7 @@ var Datepicker = React54.forwardRef(
|
|
|
14835
15547
|
onOutsideClick: () => setIsMonthOpen(false),
|
|
14836
15548
|
isDisabled: !isMonthOpen || isMobile3
|
|
14837
15549
|
});
|
|
14838
|
-
const emitChange =
|
|
15550
|
+
const emitChange = React57.useCallback(
|
|
14839
15551
|
(nextDay, nextMonth, nextYear) => {
|
|
14840
15552
|
if (!onChange) return;
|
|
14841
15553
|
const date = dateFromParts(nextDay, nextMonth, nextYear);
|
|
@@ -14870,7 +15582,7 @@ var Datepicker = React54.forwardRef(
|
|
|
14870
15582
|
setIsMonthOpen(true);
|
|
14871
15583
|
setMonthHighlightIndex(0);
|
|
14872
15584
|
};
|
|
14873
|
-
const commitMonthInput =
|
|
15585
|
+
const commitMonthInput = React57.useCallback(() => {
|
|
14874
15586
|
const query = monthInputValue.trim().toLowerCase();
|
|
14875
15587
|
if (!query) {
|
|
14876
15588
|
if (monthIndex !== null) {
|
|
@@ -14930,15 +15642,15 @@ var Datepicker = React54.forwardRef(
|
|
|
14930
15642
|
setIsMonthOpen(false);
|
|
14931
15643
|
}
|
|
14932
15644
|
};
|
|
14933
|
-
const focusDayInput =
|
|
15645
|
+
const focusDayInput = React57.useCallback(() => {
|
|
14934
15646
|
if (isBlocked || readOnly) return;
|
|
14935
15647
|
dayInputRef.current?.focus();
|
|
14936
15648
|
}, [isBlocked, readOnly]);
|
|
14937
|
-
const openWheel =
|
|
15649
|
+
const openWheel = React57.useCallback(() => {
|
|
14938
15650
|
if (isBlocked || readOnly) return;
|
|
14939
15651
|
setIsWheelOpen(true);
|
|
14940
15652
|
}, [isBlocked, readOnly]);
|
|
14941
|
-
const closeWheel =
|
|
15653
|
+
const closeWheel = React57.useCallback(() => {
|
|
14942
15654
|
setIsWheelOpen(false);
|
|
14943
15655
|
mobileTriggerRef.current?.focus();
|
|
14944
15656
|
}, []);
|
|
@@ -14950,7 +15662,7 @@ var Datepicker = React54.forwardRef(
|
|
|
14950
15662
|
minDate,
|
|
14951
15663
|
maxDate
|
|
14952
15664
|
});
|
|
14953
|
-
const handleWheelDone =
|
|
15665
|
+
const handleWheelDone = React57.useCallback(() => {
|
|
14954
15666
|
const next = wheel.draftDate;
|
|
14955
15667
|
setDay(String(next.getDate()));
|
|
14956
15668
|
setMonthIndex(next.getMonth());
|
|
@@ -14959,14 +15671,14 @@ var Datepicker = React54.forwardRef(
|
|
|
14959
15671
|
setIsWheelOpen(false);
|
|
14960
15672
|
mobileTriggerRef.current?.focus();
|
|
14961
15673
|
}, [name, onChange, wheel.draftDate]);
|
|
14962
|
-
const defaultFormatValue =
|
|
15674
|
+
const defaultFormatValue = React57.useCallback(
|
|
14963
15675
|
(date) => `${date.getDate()} ${resolvedMonthLabels[date.getMonth()]} ${date.getFullYear()}`,
|
|
14964
15676
|
[resolvedMonthLabels]
|
|
14965
15677
|
);
|
|
14966
15678
|
const triggerText = currentDate ? (formatValue ?? defaultFormatValue)(currentDate) : void 0;
|
|
14967
15679
|
const monthListboxId = `${monthId}-listbox`;
|
|
14968
15680
|
const getMonthOptionId = (index) => `${monthId}-option-${index}`;
|
|
14969
|
-
const monthPanelContent = filteredMonths.length === 0 ? /* @__PURE__ */
|
|
15681
|
+
const monthPanelContent = filteredMonths.length === 0 ? /* @__PURE__ */ jsx162("div", { className: "px-4 py-3 text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: t("no_options") }) : /* @__PURE__ */ jsx162(
|
|
14970
15682
|
"ul",
|
|
14971
15683
|
{
|
|
14972
15684
|
ref: monthListRef,
|
|
@@ -14977,7 +15689,7 @@ var Datepicker = React54.forwardRef(
|
|
|
14977
15689
|
children: filteredMonths.map((option, position) => {
|
|
14978
15690
|
const isSelected = option.index === monthIndex;
|
|
14979
15691
|
const isHighlighted = position === monthHighlightIndex;
|
|
14980
|
-
return /* @__PURE__ */
|
|
15692
|
+
return /* @__PURE__ */ jsx162("li", { role: "presentation", children: /* @__PURE__ */ jsx162(
|
|
14981
15693
|
"button",
|
|
14982
15694
|
{
|
|
14983
15695
|
id: getMonthOptionId(option.index),
|
|
@@ -15004,7 +15716,7 @@ var Datepicker = React54.forwardRef(
|
|
|
15004
15716
|
isBlocked && "cursor-not-allowed",
|
|
15005
15717
|
loading && "cursor-progress"
|
|
15006
15718
|
);
|
|
15007
|
-
return /* @__PURE__ */
|
|
15719
|
+
return /* @__PURE__ */ jsx162(
|
|
15008
15720
|
"div",
|
|
15009
15721
|
{
|
|
15010
15722
|
ref: containerRef,
|
|
@@ -15015,9 +15727,9 @@ var Datepicker = React54.forwardRef(
|
|
|
15015
15727
|
className
|
|
15016
15728
|
),
|
|
15017
15729
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
15018
|
-
children: /* @__PURE__ */
|
|
15019
|
-
/* @__PURE__ */
|
|
15020
|
-
isMobile3 ? /* @__PURE__ */
|
|
15730
|
+
children: /* @__PURE__ */ jsxs107("div", { className: "relative min-h-[68px] w-full", children: [
|
|
15731
|
+
/* @__PURE__ */ jsxs107("div", { className: "relative w-full", children: [
|
|
15732
|
+
isMobile3 ? /* @__PURE__ */ jsxs107(
|
|
15021
15733
|
"button",
|
|
15022
15734
|
{
|
|
15023
15735
|
ref: mobileTriggerRef,
|
|
@@ -15036,10 +15748,10 @@ var Datepicker = React54.forwardRef(
|
|
|
15036
15748
|
(isBlocked || readOnly) && "cursor-not-allowed"
|
|
15037
15749
|
),
|
|
15038
15750
|
children: [
|
|
15039
|
-
/* @__PURE__ */
|
|
15040
|
-
/* @__PURE__ */
|
|
15041
|
-
loading && /* @__PURE__ */
|
|
15042
|
-
/* @__PURE__ */
|
|
15751
|
+
/* @__PURE__ */ jsx162("span", { className: "block min-w-0 flex-1 truncate text-left", children: triggerText ?? (isWheelOpen ? mobilePlaceholder : null) }),
|
|
15752
|
+
/* @__PURE__ */ jsxs107("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
15753
|
+
loading && /* @__PURE__ */ jsx162(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
15754
|
+
/* @__PURE__ */ jsx162(
|
|
15043
15755
|
ChevronDown3,
|
|
15044
15756
|
{
|
|
15045
15757
|
size: 16,
|
|
@@ -15052,14 +15764,14 @@ var Datepicker = React54.forwardRef(
|
|
|
15052
15764
|
] })
|
|
15053
15765
|
]
|
|
15054
15766
|
}
|
|
15055
|
-
) : /* @__PURE__ */
|
|
15767
|
+
) : /* @__PURE__ */ jsxs107(
|
|
15056
15768
|
"div",
|
|
15057
15769
|
{
|
|
15058
15770
|
className: cn(
|
|
15059
15771
|
"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)]"
|
|
15060
15772
|
),
|
|
15061
15773
|
children: [
|
|
15062
|
-
/* @__PURE__ */
|
|
15774
|
+
/* @__PURE__ */ jsx162("div", { className: "flex h-full min-w-0 items-center px-2 sm:px-4", children: /* @__PURE__ */ jsx162(
|
|
15063
15775
|
"input",
|
|
15064
15776
|
{
|
|
15065
15777
|
ref: dayInputRef,
|
|
@@ -15081,8 +15793,8 @@ var Datepicker = React54.forwardRef(
|
|
|
15081
15793
|
className: subInputClass
|
|
15082
15794
|
}
|
|
15083
15795
|
) }),
|
|
15084
|
-
/* @__PURE__ */
|
|
15085
|
-
/* @__PURE__ */
|
|
15796
|
+
/* @__PURE__ */ jsxs107("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: [
|
|
15797
|
+
/* @__PURE__ */ jsx162(
|
|
15086
15798
|
"input",
|
|
15087
15799
|
{
|
|
15088
15800
|
ref: monthInputRef,
|
|
@@ -15125,7 +15837,7 @@ var Datepicker = React54.forwardRef(
|
|
|
15125
15837
|
)
|
|
15126
15838
|
}
|
|
15127
15839
|
),
|
|
15128
|
-
/* @__PURE__ */
|
|
15840
|
+
/* @__PURE__ */ jsx162(
|
|
15129
15841
|
ChevronDown3,
|
|
15130
15842
|
{
|
|
15131
15843
|
size: 14,
|
|
@@ -15142,8 +15854,8 @@ var Datepicker = React54.forwardRef(
|
|
|
15142
15854
|
}
|
|
15143
15855
|
)
|
|
15144
15856
|
] }),
|
|
15145
|
-
/* @__PURE__ */
|
|
15146
|
-
/* @__PURE__ */
|
|
15857
|
+
/* @__PURE__ */ jsxs107("div", { className: "flex h-full min-w-0 items-center px-2 sm:px-4", children: [
|
|
15858
|
+
/* @__PURE__ */ jsx162(
|
|
15147
15859
|
"input",
|
|
15148
15860
|
{
|
|
15149
15861
|
ref: yearInputRef,
|
|
@@ -15165,7 +15877,7 @@ var Datepicker = React54.forwardRef(
|
|
|
15165
15877
|
className: subInputClass
|
|
15166
15878
|
}
|
|
15167
15879
|
),
|
|
15168
|
-
loading && /* @__PURE__ */
|
|
15880
|
+
loading && /* @__PURE__ */ jsx162(
|
|
15169
15881
|
ThreeDotsLoader,
|
|
15170
15882
|
{
|
|
15171
15883
|
height: 18,
|
|
@@ -15177,7 +15889,7 @@ var Datepicker = React54.forwardRef(
|
|
|
15177
15889
|
]
|
|
15178
15890
|
}
|
|
15179
15891
|
),
|
|
15180
|
-
showCoverage && /* @__PURE__ */
|
|
15892
|
+
showCoverage && /* @__PURE__ */ jsx162(
|
|
15181
15893
|
"div",
|
|
15182
15894
|
{
|
|
15183
15895
|
className: "absolute inset-0 cursor-text rounded-[6px] bg-[var(--chekin-color-surface-input-empty)]",
|
|
@@ -15185,7 +15897,7 @@ var Datepicker = React54.forwardRef(
|
|
|
15185
15897
|
"aria-hidden": "true"
|
|
15186
15898
|
}
|
|
15187
15899
|
),
|
|
15188
|
-
/* @__PURE__ */
|
|
15900
|
+
/* @__PURE__ */ jsx162(
|
|
15189
15901
|
Fieldset,
|
|
15190
15902
|
{
|
|
15191
15903
|
isFocused,
|
|
@@ -15203,9 +15915,9 @@ var Datepicker = React54.forwardRef(
|
|
|
15203
15915
|
onClick: isMobile3 ? openWheel : showCoverage ? focusDayInput : void 0
|
|
15204
15916
|
}
|
|
15205
15917
|
),
|
|
15206
|
-
isMonthOpen && !isMobile3 && /* @__PURE__ */
|
|
15918
|
+
isMonthOpen && !isMobile3 && /* @__PURE__ */ jsx162("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 })
|
|
15207
15919
|
] }),
|
|
15208
|
-
isMobile3 && /* @__PURE__ */
|
|
15920
|
+
isMobile3 && /* @__PURE__ */ jsx162(
|
|
15209
15921
|
AirbnbDatePickerContent,
|
|
15210
15922
|
{
|
|
15211
15923
|
baseId: wheelBaseId,
|
|
@@ -15233,9 +15945,9 @@ var Datepicker = React54.forwardRef(
|
|
|
15233
15945
|
onOptionSelect: wheel.handleOptionSelect
|
|
15234
15946
|
}
|
|
15235
15947
|
),
|
|
15236
|
-
!error && optional && /* @__PURE__ */
|
|
15237
|
-
!error && helperText && /* @__PURE__ */
|
|
15238
|
-
error && !hideErrorMessage && /* @__PURE__ */
|
|
15948
|
+
!error && optional && /* @__PURE__ */ jsx162("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
15949
|
+
!error && helperText && /* @__PURE__ */ jsx162("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
15950
|
+
error && !hideErrorMessage && /* @__PURE__ */ jsx162(
|
|
15239
15951
|
FieldErrorMessage,
|
|
15240
15952
|
{
|
|
15241
15953
|
id: errorId,
|
|
@@ -15250,8 +15962,8 @@ var Datepicker = React54.forwardRef(
|
|
|
15250
15962
|
);
|
|
15251
15963
|
|
|
15252
15964
|
// src/dashboard/date-range-picker/DateRangePicker.tsx
|
|
15253
|
-
import * as
|
|
15254
|
-
import { useTranslation as
|
|
15965
|
+
import * as React61 from "react";
|
|
15966
|
+
import { useTranslation as useTranslation38 } from "react-i18next";
|
|
15255
15967
|
|
|
15256
15968
|
// src/dashboard/date-range-picker/isDayBlocked.ts
|
|
15257
15969
|
import { differenceInDays, isAfter, isBefore, isSameDay } from "date-fns";
|
|
@@ -15329,7 +16041,7 @@ var createDisabledMatchers = ({
|
|
|
15329
16041
|
};
|
|
15330
16042
|
|
|
15331
16043
|
// src/dashboard/date-range-picker/hooks/useRangeValue.ts
|
|
15332
|
-
import * as
|
|
16044
|
+
import * as React58 from "react";
|
|
15333
16045
|
var getRangeKey = (range) => `${range?.from?.getTime() ?? ""}-${range?.to?.getTime() ?? ""}`;
|
|
15334
16046
|
function useRangeValue({
|
|
15335
16047
|
value: externalValue,
|
|
@@ -15338,10 +16050,10 @@ function useRangeValue({
|
|
|
15338
16050
|
name
|
|
15339
16051
|
}) {
|
|
15340
16052
|
const isControlled = externalValue !== void 0;
|
|
15341
|
-
const [draft, setDraft] =
|
|
16053
|
+
const [draft, setDraft] = React58.useState(
|
|
15342
16054
|
isControlled ? externalValue : defaultValue
|
|
15343
16055
|
);
|
|
15344
|
-
const lastExternalKeyRef =
|
|
16056
|
+
const lastExternalKeyRef = React58.useRef(getRangeKey(externalValue));
|
|
15345
16057
|
if (isControlled) {
|
|
15346
16058
|
const externalKey = getRangeKey(externalValue);
|
|
15347
16059
|
if (externalKey !== lastExternalKeyRef.current) {
|
|
@@ -15349,7 +16061,7 @@ function useRangeValue({
|
|
|
15349
16061
|
setDraft(externalValue);
|
|
15350
16062
|
}
|
|
15351
16063
|
}
|
|
15352
|
-
const commit =
|
|
16064
|
+
const commit = React58.useCallback(
|
|
15353
16065
|
(next) => {
|
|
15354
16066
|
setDraft(next);
|
|
15355
16067
|
if (next === void 0) {
|
|
@@ -15364,7 +16076,7 @@ function useRangeValue({
|
|
|
15364
16076
|
}
|
|
15365
16077
|
|
|
15366
16078
|
// src/dashboard/date-range-picker/hooks/useRangeTextInputs.ts
|
|
15367
|
-
import * as
|
|
16079
|
+
import * as React59 from "react";
|
|
15368
16080
|
function useRangeTextInputs({
|
|
15369
16081
|
value,
|
|
15370
16082
|
format: format2,
|
|
@@ -15372,13 +16084,13 @@ function useRangeTextInputs({
|
|
|
15372
16084
|
onCommit,
|
|
15373
16085
|
onBlur
|
|
15374
16086
|
}) {
|
|
15375
|
-
const [fromText, setFromText] =
|
|
15376
|
-
const [toText, setToText] =
|
|
15377
|
-
|
|
16087
|
+
const [fromText, setFromText] = React59.useState(value?.from ? format2(value.from) : "");
|
|
16088
|
+
const [toText, setToText] = React59.useState(value?.to ? format2(value.to) : "");
|
|
16089
|
+
React59.useEffect(() => {
|
|
15378
16090
|
setFromText(value?.from ? format2(value.from) : "");
|
|
15379
16091
|
setToText(value?.to ? format2(value.to) : "");
|
|
15380
16092
|
}, [format2, value?.from, value?.to]);
|
|
15381
|
-
const handleFromBlur =
|
|
16093
|
+
const handleFromBlur = React59.useCallback(() => {
|
|
15382
16094
|
if (!fromText) {
|
|
15383
16095
|
const next = { from: void 0, to: value?.to };
|
|
15384
16096
|
onCommit(next);
|
|
@@ -15395,7 +16107,7 @@ function useRangeTextInputs({
|
|
|
15395
16107
|
setFromText(value?.from ? format2(value.from) : "");
|
|
15396
16108
|
return void 0;
|
|
15397
16109
|
}, [format2, fromText, onBlur, onCommit, parse3, value]);
|
|
15398
|
-
const handleToBlur =
|
|
16110
|
+
const handleToBlur = React59.useCallback(() => {
|
|
15399
16111
|
if (!toText) {
|
|
15400
16112
|
const next = { from: value?.from, to: void 0 };
|
|
15401
16113
|
onCommit(next);
|
|
@@ -15422,21 +16134,21 @@ function useRangeTextInputs({
|
|
|
15422
16134
|
}
|
|
15423
16135
|
|
|
15424
16136
|
// src/dashboard/date-range-picker/hooks/useRangeMonthSync.ts
|
|
15425
|
-
import * as
|
|
16137
|
+
import * as React60 from "react";
|
|
15426
16138
|
function useRangeMonthSync(value) {
|
|
15427
|
-
const isPreloadedRef =
|
|
15428
|
-
const [month, setMonth] =
|
|
15429
|
-
|
|
16139
|
+
const isPreloadedRef = React60.useRef(false);
|
|
16140
|
+
const [month, setMonth] = React60.useState(value?.from ?? /* @__PURE__ */ new Date());
|
|
16141
|
+
React60.useEffect(() => {
|
|
15430
16142
|
if (value?.from && !isPreloadedRef.current) {
|
|
15431
16143
|
setMonth(value.from);
|
|
15432
16144
|
isPreloadedRef.current = true;
|
|
15433
16145
|
}
|
|
15434
16146
|
}, [value?.from]);
|
|
15435
|
-
const syncMonthToValue =
|
|
16147
|
+
const syncMonthToValue = React60.useCallback((next) => {
|
|
15436
16148
|
isPreloadedRef.current = true;
|
|
15437
16149
|
if (next?.from) setMonth(next.from);
|
|
15438
16150
|
}, []);
|
|
15439
|
-
const resetPreload =
|
|
16151
|
+
const resetPreload = React60.useCallback(() => {
|
|
15440
16152
|
isPreloadedRef.current = false;
|
|
15441
16153
|
}, []);
|
|
15442
16154
|
return { month, setMonth, syncMonthToValue, resetPreload };
|
|
@@ -15462,7 +16174,7 @@ function resolveRangeSelection({
|
|
|
15462
16174
|
|
|
15463
16175
|
// src/dashboard/date-range-picker/components/DateRangeInputs.tsx
|
|
15464
16176
|
import { CalendarDays, SquareX as SquareX4 } from "lucide-react";
|
|
15465
|
-
import { jsx as
|
|
16177
|
+
import { jsx as jsx163, jsxs as jsxs108 } from "react/jsx-runtime";
|
|
15466
16178
|
var DEFAULT_PLACEHOLDER = "00-00-0000";
|
|
15467
16179
|
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)]";
|
|
15468
16180
|
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";
|
|
@@ -15504,7 +16216,7 @@ function DateRangeInputs({
|
|
|
15504
16216
|
isBlocked && "cursor-not-allowed",
|
|
15505
16217
|
loading && "cursor-progress"
|
|
15506
16218
|
);
|
|
15507
|
-
return /* @__PURE__ */
|
|
16219
|
+
return /* @__PURE__ */ jsxs108(
|
|
15508
16220
|
"div",
|
|
15509
16221
|
{
|
|
15510
16222
|
className: cn(
|
|
@@ -15513,7 +16225,7 @@ function DateRangeInputs({
|
|
|
15513
16225
|
),
|
|
15514
16226
|
onClick: onRowClick,
|
|
15515
16227
|
children: [
|
|
15516
|
-
/* @__PURE__ */
|
|
16228
|
+
/* @__PURE__ */ jsx163(
|
|
15517
16229
|
"input",
|
|
15518
16230
|
{
|
|
15519
16231
|
ref: fromInputRef,
|
|
@@ -15537,7 +16249,7 @@ function DateRangeInputs({
|
|
|
15537
16249
|
)
|
|
15538
16250
|
}
|
|
15539
16251
|
),
|
|
15540
|
-
/* @__PURE__ */
|
|
16252
|
+
/* @__PURE__ */ jsx163(
|
|
15541
16253
|
"span",
|
|
15542
16254
|
{
|
|
15543
16255
|
"aria-hidden": "true",
|
|
@@ -15548,7 +16260,7 @@ function DateRangeInputs({
|
|
|
15548
16260
|
children: "\u2192"
|
|
15549
16261
|
}
|
|
15550
16262
|
),
|
|
15551
|
-
/* @__PURE__ */
|
|
16263
|
+
/* @__PURE__ */ jsx163(
|
|
15552
16264
|
"input",
|
|
15553
16265
|
{
|
|
15554
16266
|
ref: toInputRef,
|
|
@@ -15572,9 +16284,9 @@ function DateRangeInputs({
|
|
|
15572
16284
|
)
|
|
15573
16285
|
}
|
|
15574
16286
|
),
|
|
15575
|
-
/* @__PURE__ */
|
|
15576
|
-
loading && /* @__PURE__ */
|
|
15577
|
-
!readOnly && !hideClearDates && !isEmpty && /* @__PURE__ */
|
|
16287
|
+
/* @__PURE__ */ jsxs108("span", { className: "ml-auto flex shrink-0 items-center gap-2 pl-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
16288
|
+
loading && /* @__PURE__ */ jsx163(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
16289
|
+
!readOnly && !hideClearDates && !isEmpty && /* @__PURE__ */ jsx163(
|
|
15578
16290
|
"button",
|
|
15579
16291
|
{
|
|
15580
16292
|
type: "button",
|
|
@@ -15582,10 +16294,10 @@ function DateRangeInputs({
|
|
|
15582
16294
|
onClick: onReset,
|
|
15583
16295
|
className: iconButtonClass,
|
|
15584
16296
|
"aria-label": clearLabel,
|
|
15585
|
-
children: /* @__PURE__ */
|
|
16297
|
+
children: /* @__PURE__ */ jsx163(SquareX4, { size: 16, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
15586
16298
|
}
|
|
15587
16299
|
),
|
|
15588
|
-
!readOnly && !hideCalendarIcon && /* @__PURE__ */
|
|
16300
|
+
!readOnly && !hideCalendarIcon && /* @__PURE__ */ jsx163(
|
|
15589
16301
|
"button",
|
|
15590
16302
|
{
|
|
15591
16303
|
type: "button",
|
|
@@ -15597,7 +16309,7 @@ function DateRangeInputs({
|
|
|
15597
16309
|
focusedInput !== null || isOpen ? "text-[var(--chekin-color-brand-blue)]" : "text-[var(--chekin-color-gray-2)]"
|
|
15598
16310
|
),
|
|
15599
16311
|
"aria-label": openCalendarLabel,
|
|
15600
|
-
children: /* @__PURE__ */
|
|
16312
|
+
children: /* @__PURE__ */ jsx163(CalendarDays, { size: 18 })
|
|
15601
16313
|
}
|
|
15602
16314
|
)
|
|
15603
16315
|
] })
|
|
@@ -15607,7 +16319,7 @@ function DateRangeInputs({
|
|
|
15607
16319
|
}
|
|
15608
16320
|
|
|
15609
16321
|
// src/dashboard/date-range-picker/components/DateRangeCalendar.tsx
|
|
15610
|
-
import { jsx as
|
|
16322
|
+
import { jsx as jsx164 } from "react/jsx-runtime";
|
|
15611
16323
|
function DateRangeCalendar({
|
|
15612
16324
|
value,
|
|
15613
16325
|
month,
|
|
@@ -15623,7 +16335,7 @@ function DateRangeCalendar({
|
|
|
15623
16335
|
components,
|
|
15624
16336
|
...dayPickerProps
|
|
15625
16337
|
}) {
|
|
15626
|
-
return /* @__PURE__ */
|
|
16338
|
+
return /* @__PURE__ */ jsx164(
|
|
15627
16339
|
Calendar,
|
|
15628
16340
|
{
|
|
15629
16341
|
mode: "range",
|
|
@@ -15646,7 +16358,7 @@ function DateRangeCalendar({
|
|
|
15646
16358
|
}
|
|
15647
16359
|
|
|
15648
16360
|
// src/dashboard/date-range-picker/components/DateRangePopover.tsx
|
|
15649
|
-
import { jsx as
|
|
16361
|
+
import { jsx as jsx165, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
15650
16362
|
function DateRangePopover({
|
|
15651
16363
|
isOpen,
|
|
15652
16364
|
isMobile: isMobile3,
|
|
@@ -15658,30 +16370,30 @@ function DateRangePopover({
|
|
|
15658
16370
|
}) {
|
|
15659
16371
|
if (!isOpen) return null;
|
|
15660
16372
|
if (isMobile3) {
|
|
15661
|
-
return /* @__PURE__ */
|
|
16373
|
+
return /* @__PURE__ */ jsx165(
|
|
15662
16374
|
Drawer,
|
|
15663
16375
|
{
|
|
15664
16376
|
open: isOpen,
|
|
15665
16377
|
onOpenChange: (next) => {
|
|
15666
16378
|
if (!next) onClose();
|
|
15667
16379
|
},
|
|
15668
|
-
children: /* @__PURE__ */
|
|
16380
|
+
children: /* @__PURE__ */ jsxs109(
|
|
15669
16381
|
DrawerContent,
|
|
15670
16382
|
{
|
|
15671
16383
|
onClose,
|
|
15672
16384
|
lockScroll: false,
|
|
15673
16385
|
className: "max-h-[calc(100vh-1rem)]",
|
|
15674
16386
|
children: [
|
|
15675
|
-
/* @__PURE__ */
|
|
15676
|
-
/* @__PURE__ */
|
|
15677
|
-
/* @__PURE__ */
|
|
16387
|
+
/* @__PURE__ */ jsx165(DrawerTitle, { className: "sr-only", children: drawerTitle }),
|
|
16388
|
+
/* @__PURE__ */ jsx165(DrawerDescription, { className: "sr-only", children: drawerDescription }),
|
|
16389
|
+
/* @__PURE__ */ jsx165("div", { className: "flex items-start justify-center overflow-x-auto px-2 pb-4 pt-1", children })
|
|
15678
16390
|
]
|
|
15679
16391
|
}
|
|
15680
16392
|
)
|
|
15681
16393
|
}
|
|
15682
16394
|
);
|
|
15683
16395
|
}
|
|
15684
|
-
return /* @__PURE__ */
|
|
16396
|
+
return /* @__PURE__ */ jsx165(
|
|
15685
16397
|
"div",
|
|
15686
16398
|
{
|
|
15687
16399
|
className: cn(
|
|
@@ -15694,8 +16406,8 @@ function DateRangePopover({
|
|
|
15694
16406
|
}
|
|
15695
16407
|
|
|
15696
16408
|
// src/dashboard/date-range-picker/DateRangePicker.tsx
|
|
15697
|
-
import { jsx as
|
|
15698
|
-
var DateRangePicker =
|
|
16409
|
+
import { jsx as jsx166, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
16410
|
+
var DateRangePicker = React61.forwardRef(function DateRangePicker2({
|
|
15699
16411
|
label,
|
|
15700
16412
|
value: externalValue,
|
|
15701
16413
|
defaultValue,
|
|
@@ -15729,20 +16441,20 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15729
16441
|
components: customComponents,
|
|
15730
16442
|
...dayPickerProps
|
|
15731
16443
|
}, ref) {
|
|
15732
|
-
const containerRef =
|
|
15733
|
-
const fromInputRef =
|
|
15734
|
-
const toInputRef =
|
|
15735
|
-
const reactId =
|
|
16444
|
+
const containerRef = React61.useRef(null);
|
|
16445
|
+
const fromInputRef = React61.useRef(null);
|
|
16446
|
+
const toInputRef = React61.useRef(null);
|
|
16447
|
+
const reactId = React61.useId();
|
|
15736
16448
|
const baseId = name ?? `dash-daterange-${reactId}`;
|
|
15737
16449
|
const fromId = `${baseId}-from`;
|
|
15738
16450
|
const toId = `${baseId}-to`;
|
|
15739
16451
|
const labelId = `${baseId}-label`;
|
|
15740
16452
|
const errorId = `${baseId}-error`;
|
|
15741
|
-
const normalizedValue =
|
|
16453
|
+
const normalizedValue = React61.useMemo(() => {
|
|
15742
16454
|
if (externalValue === void 0) return void 0;
|
|
15743
16455
|
return { from: toDate(externalValue?.from), to: toDate(externalValue?.to) };
|
|
15744
16456
|
}, [externalValue]);
|
|
15745
|
-
const normalizedDefaultValue =
|
|
16457
|
+
const normalizedDefaultValue = React61.useMemo(() => {
|
|
15746
16458
|
if (defaultValue === void 0) return void 0;
|
|
15747
16459
|
return { from: toDate(defaultValue?.from), to: toDate(defaultValue?.to) };
|
|
15748
16460
|
}, [defaultValue]);
|
|
@@ -15752,10 +16464,10 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15752
16464
|
onChange,
|
|
15753
16465
|
name
|
|
15754
16466
|
});
|
|
15755
|
-
const normalizedMinDate =
|
|
15756
|
-
const normalizedMaxDate =
|
|
15757
|
-
const formatter =
|
|
15758
|
-
const parser =
|
|
16467
|
+
const normalizedMinDate = React61.useMemo(() => toDate(minDate), [minDate]);
|
|
16468
|
+
const normalizedMaxDate = React61.useMemo(() => toDate(maxDate), [maxDate]);
|
|
16469
|
+
const formatter = React61.useMemo(() => formatDate(displayFormat), [displayFormat]);
|
|
16470
|
+
const parser = React61.useMemo(() => parseDate(displayFormat), [displayFormat]);
|
|
15759
16471
|
const { fromText, toText, setFromText, setToText, handleFromBlur, handleToBlur } = useRangeTextInputs({
|
|
15760
16472
|
value,
|
|
15761
16473
|
format: formatter,
|
|
@@ -15764,11 +16476,11 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15764
16476
|
onBlur
|
|
15765
16477
|
});
|
|
15766
16478
|
const { month, setMonth, syncMonthToValue } = useRangeMonthSync(value);
|
|
15767
|
-
const [isOpen, setIsOpen] =
|
|
15768
|
-
const [focusedInput, setFocusedInput] =
|
|
15769
|
-
const [autoFocus, setAutoFocus] =
|
|
16479
|
+
const [isOpen, setIsOpen] = React61.useState(false);
|
|
16480
|
+
const [focusedInput, setFocusedInput] = React61.useState(null);
|
|
16481
|
+
const [autoFocus, setAutoFocus] = React61.useState(false);
|
|
15770
16482
|
const isMobile3 = useIsMobile();
|
|
15771
|
-
const { t } =
|
|
16483
|
+
const { t } = useTranslation38();
|
|
15772
16484
|
const drawerTitle = label ?? t("select_dates");
|
|
15773
16485
|
const drawerDescription = label ?? t("pick_date_range");
|
|
15774
16486
|
const isEmpty = !value?.from && !value?.to;
|
|
@@ -15777,13 +16489,13 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15777
16489
|
const isFocused = focusedInput !== null || isOpen;
|
|
15778
16490
|
const wrapperWidth = toCssSize(width);
|
|
15779
16491
|
const monthsToShow = numberOfMonths ?? (isMobile3 ? 1 : 2);
|
|
15780
|
-
const closeCalendar =
|
|
16492
|
+
const closeCalendar = React61.useCallback(() => {
|
|
15781
16493
|
setIsOpen(false);
|
|
15782
16494
|
setFocusedInput(null);
|
|
15783
16495
|
setAutoFocus(false);
|
|
15784
16496
|
if (value?.from) setMonth(value.from);
|
|
15785
16497
|
}, [setMonth, value?.from]);
|
|
15786
|
-
const openCalendar =
|
|
16498
|
+
const openCalendar = React61.useCallback(() => {
|
|
15787
16499
|
if (isBlocked || readOnly) return;
|
|
15788
16500
|
setIsOpen(true);
|
|
15789
16501
|
}, [isBlocked, readOnly]);
|
|
@@ -15792,7 +16504,7 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15792
16504
|
onOutsideClick: closeCalendar,
|
|
15793
16505
|
isDisabled: !isOpen || isMobile3
|
|
15794
16506
|
});
|
|
15795
|
-
const handlePickerChange =
|
|
16507
|
+
const handlePickerChange = React61.useCallback(
|
|
15796
16508
|
(range, pickedDate) => {
|
|
15797
16509
|
const { next, shouldClose } = resolveRangeSelection({
|
|
15798
16510
|
previous: value,
|
|
@@ -15813,7 +16525,7 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15813
16525
|
setToText("");
|
|
15814
16526
|
setMonth(/* @__PURE__ */ new Date());
|
|
15815
16527
|
};
|
|
15816
|
-
const disabledMatchers =
|
|
16528
|
+
const disabledMatchers = React61.useMemo(
|
|
15817
16529
|
() => createDisabledMatchers({
|
|
15818
16530
|
minDate: normalizedMinDate,
|
|
15819
16531
|
maxDate: normalizedMaxDate,
|
|
@@ -15832,7 +16544,7 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15832
16544
|
openCalendar();
|
|
15833
16545
|
if (autoFocusOnOpen) setAutoFocus(true);
|
|
15834
16546
|
};
|
|
15835
|
-
|
|
16547
|
+
React61.useImperativeHandle(
|
|
15836
16548
|
ref,
|
|
15837
16549
|
() => ({
|
|
15838
16550
|
setDateRange: (range) => {
|
|
@@ -15855,7 +16567,7 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15855
16567
|
syncMonthToValue
|
|
15856
16568
|
]
|
|
15857
16569
|
);
|
|
15858
|
-
return /* @__PURE__ */
|
|
16570
|
+
return /* @__PURE__ */ jsx166(
|
|
15859
16571
|
"div",
|
|
15860
16572
|
{
|
|
15861
16573
|
ref: containerRef,
|
|
@@ -15866,9 +16578,9 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15866
16578
|
className
|
|
15867
16579
|
),
|
|
15868
16580
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
15869
|
-
children: /* @__PURE__ */
|
|
15870
|
-
/* @__PURE__ */
|
|
15871
|
-
/* @__PURE__ */
|
|
16581
|
+
children: /* @__PURE__ */ jsxs110("div", { className: "relative min-h-[68px] w-full", children: [
|
|
16582
|
+
/* @__PURE__ */ jsxs110("div", { className: "relative w-full", children: [
|
|
16583
|
+
/* @__PURE__ */ jsx166(
|
|
15872
16584
|
DateRangeInputs,
|
|
15873
16585
|
{
|
|
15874
16586
|
fromId,
|
|
@@ -15919,7 +16631,7 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15919
16631
|
onToggleCalendar: toggleCalendar
|
|
15920
16632
|
}
|
|
15921
16633
|
),
|
|
15922
|
-
/* @__PURE__ */
|
|
16634
|
+
/* @__PURE__ */ jsx166(
|
|
15923
16635
|
Fieldset,
|
|
15924
16636
|
{
|
|
15925
16637
|
isFocused,
|
|
@@ -15936,7 +16648,7 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15936
16648
|
tooltip
|
|
15937
16649
|
}
|
|
15938
16650
|
),
|
|
15939
|
-
/* @__PURE__ */
|
|
16651
|
+
/* @__PURE__ */ jsx166(
|
|
15940
16652
|
DateRangePopover,
|
|
15941
16653
|
{
|
|
15942
16654
|
isOpen: isOpen && !isMobile3,
|
|
@@ -15945,7 +16657,7 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15945
16657
|
drawerTitle,
|
|
15946
16658
|
drawerDescription,
|
|
15947
16659
|
onClose: closeCalendar,
|
|
15948
|
-
children: /* @__PURE__ */
|
|
16660
|
+
children: /* @__PURE__ */ jsx166(
|
|
15949
16661
|
DateRangeCalendar,
|
|
15950
16662
|
{
|
|
15951
16663
|
value,
|
|
@@ -15966,7 +16678,7 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15966
16678
|
}
|
|
15967
16679
|
)
|
|
15968
16680
|
] }),
|
|
15969
|
-
/* @__PURE__ */
|
|
16681
|
+
/* @__PURE__ */ jsx166(
|
|
15970
16682
|
DateRangePopover,
|
|
15971
16683
|
{
|
|
15972
16684
|
isOpen: isOpen && isMobile3,
|
|
@@ -15975,7 +16687,7 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15975
16687
|
drawerTitle,
|
|
15976
16688
|
drawerDescription,
|
|
15977
16689
|
onClose: closeCalendar,
|
|
15978
|
-
children: /* @__PURE__ */
|
|
16690
|
+
children: /* @__PURE__ */ jsx166(
|
|
15979
16691
|
DateRangeCalendar,
|
|
15980
16692
|
{
|
|
15981
16693
|
value,
|
|
@@ -15995,9 +16707,9 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
15995
16707
|
)
|
|
15996
16708
|
}
|
|
15997
16709
|
),
|
|
15998
|
-
!error && optional && /* @__PURE__ */
|
|
15999
|
-
!error && helperText && /* @__PURE__ */
|
|
16000
|
-
error && !hideErrorMessage && /* @__PURE__ */
|
|
16710
|
+
!error && optional && /* @__PURE__ */ jsx166("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
16711
|
+
!error && helperText && /* @__PURE__ */ jsx166("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
16712
|
+
error && !hideErrorMessage && /* @__PURE__ */ jsx166(
|
|
16001
16713
|
FieldErrorMessage,
|
|
16002
16714
|
{
|
|
16003
16715
|
id: errorId,
|
|
@@ -16011,8 +16723,8 @@ var DateRangePicker = React58.forwardRef(function DateRangePicker2({
|
|
|
16011
16723
|
});
|
|
16012
16724
|
|
|
16013
16725
|
// src/dashboard/date-range-picker/useValidateDates.ts
|
|
16014
|
-
import * as
|
|
16015
|
-
import { useTranslation as
|
|
16726
|
+
import * as React62 from "react";
|
|
16727
|
+
import { useTranslation as useTranslation39 } from "react-i18next";
|
|
16016
16728
|
import { differenceInDays as differenceInDays2, isAfter as isAfter2, isBefore as isBefore3 } from "date-fns";
|
|
16017
16729
|
import {
|
|
16018
16730
|
dateMatchModifiers,
|
|
@@ -16034,14 +16746,14 @@ function useValidateDates({
|
|
|
16034
16746
|
onSuccess,
|
|
16035
16747
|
displayFormat
|
|
16036
16748
|
}) {
|
|
16037
|
-
const { t } =
|
|
16749
|
+
const { t } = useTranslation39();
|
|
16038
16750
|
const handleError = useEvent(onError);
|
|
16039
16751
|
const handleSuccess = useEvent(onSuccess);
|
|
16040
|
-
const errorFormatter =
|
|
16752
|
+
const errorFormatter = React62.useMemo(
|
|
16041
16753
|
() => formatDate(displayFormat ?? DEFAULT_DISPLAY_FORMAT),
|
|
16042
16754
|
[displayFormat]
|
|
16043
16755
|
);
|
|
16044
|
-
const validateDates =
|
|
16756
|
+
const validateDates = React62.useCallback(
|
|
16045
16757
|
(dates) => {
|
|
16046
16758
|
const startDate = dates?.from;
|
|
16047
16759
|
const endDate = dates?.to;
|
|
@@ -16091,9 +16803,9 @@ function useValidateDates({
|
|
|
16091
16803
|
}
|
|
16092
16804
|
|
|
16093
16805
|
// src/dashboard/time-picker/TimePicker.tsx
|
|
16094
|
-
import * as
|
|
16806
|
+
import * as React63 from "react";
|
|
16095
16807
|
import { addDays, addHours, addMinutes, format, parse as parse2 } from "date-fns";
|
|
16096
|
-
import { jsx as
|
|
16808
|
+
import { jsx as jsx167 } from "react/jsx-runtime";
|
|
16097
16809
|
var SHORT_TIME_FORMAT = "HH:mm";
|
|
16098
16810
|
function parseTime(value) {
|
|
16099
16811
|
return parse2(value, SHORT_TIME_FORMAT, /* @__PURE__ */ new Date());
|
|
@@ -16135,195 +16847,191 @@ var FORMAT_SETTINGS = {
|
|
|
16135
16847
|
},
|
|
16136
16848
|
hours: { intervalUnit: "H", interval: 1, minTime: "00:00", maxTime: "23:00" }
|
|
16137
16849
|
};
|
|
16138
|
-
var TimePicker =
|
|
16139
|
-
|
|
16140
|
-
|
|
16141
|
-
|
|
16142
|
-
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
}
|
|
16147
|
-
);
|
|
16850
|
+
var TimePicker = React63.forwardRef(function TimePicker2({ format: formatName = "time", timeSettings, options, ...selectProps }, ref) {
|
|
16851
|
+
const resolvedOptions = React63.useMemo(() => {
|
|
16852
|
+
if (options) return options;
|
|
16853
|
+
const settings = timeSettings ?? FORMAT_SETTINGS[formatName];
|
|
16854
|
+
return buildOptions(settings);
|
|
16855
|
+
}, [formatName, options, timeSettings]);
|
|
16856
|
+
return /* @__PURE__ */ jsx167(Select, { ref, ...selectProps, options: resolvedOptions });
|
|
16857
|
+
});
|
|
16148
16858
|
|
|
16149
16859
|
// src/dashboard/file-input/FileInput.tsx
|
|
16150
|
-
import * as
|
|
16860
|
+
import * as React64 from "react";
|
|
16151
16861
|
import { Download, Paperclip, SquareX as SquareX5 } from "lucide-react";
|
|
16152
|
-
import { useTranslation as
|
|
16153
|
-
import { jsx as
|
|
16862
|
+
import { useTranslation as useTranslation40 } from "react-i18next";
|
|
16863
|
+
import { jsx as jsx168, jsxs as jsxs111 } from "react/jsx-runtime";
|
|
16154
16864
|
function defaultDownload(url) {
|
|
16155
16865
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
16156
16866
|
}
|
|
16157
|
-
var FileInput =
|
|
16158
|
-
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
|
|
16166
|
-
|
|
16167
|
-
|
|
16168
|
-
|
|
16169
|
-
|
|
16170
|
-
|
|
16171
|
-
|
|
16172
|
-
|
|
16173
|
-
|
|
16174
|
-
|
|
16175
|
-
|
|
16176
|
-
|
|
16177
|
-
|
|
16178
|
-
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
|
|
16183
|
-
|
|
16184
|
-
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
|
|
16188
|
-
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
const
|
|
16197
|
-
|
|
16198
|
-
|
|
16199
|
-
|
|
16200
|
-
|
|
16201
|
-
|
|
16202
|
-
|
|
16203
|
-
|
|
16204
|
-
|
|
16205
|
-
|
|
16206
|
-
|
|
16207
|
-
|
|
16208
|
-
|
|
16209
|
-
|
|
16210
|
-
|
|
16211
|
-
|
|
16212
|
-
|
|
16213
|
-
|
|
16214
|
-
|
|
16215
|
-
|
|
16216
|
-
|
|
16217
|
-
|
|
16218
|
-
|
|
16219
|
-
|
|
16220
|
-
|
|
16867
|
+
var FileInput = React64.forwardRef(function FileInput2({
|
|
16868
|
+
label,
|
|
16869
|
+
value,
|
|
16870
|
+
onChange,
|
|
16871
|
+
onDownload = defaultDownload,
|
|
16872
|
+
name = "file",
|
|
16873
|
+
placeholder,
|
|
16874
|
+
accept,
|
|
16875
|
+
multiple,
|
|
16876
|
+
disabled,
|
|
16877
|
+
readOnly,
|
|
16878
|
+
loading,
|
|
16879
|
+
invalid,
|
|
16880
|
+
error,
|
|
16881
|
+
optional,
|
|
16882
|
+
tooltip,
|
|
16883
|
+
helperText,
|
|
16884
|
+
hideErrorMessage,
|
|
16885
|
+
className,
|
|
16886
|
+
width,
|
|
16887
|
+
downloadLabel
|
|
16888
|
+
}, ref) {
|
|
16889
|
+
const internalRef = React64.useRef(null);
|
|
16890
|
+
const inputRef = useCombinedRef(ref, internalRef);
|
|
16891
|
+
const { t } = useTranslation40();
|
|
16892
|
+
const resolvedLabel = label ?? t("upload_file");
|
|
16893
|
+
const resolvedDownloadLabel = downloadLabel ?? t("download_attachment");
|
|
16894
|
+
const reactId = React64.useId();
|
|
16895
|
+
const inputId = `${name || "dash-file"}-${reactId}`;
|
|
16896
|
+
const labelId = `${inputId}-label`;
|
|
16897
|
+
const errorId = `${inputId}-error`;
|
|
16898
|
+
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
16899
|
+
const isInvalid = Boolean(invalid || error);
|
|
16900
|
+
const isEmpty = !value;
|
|
16901
|
+
const wrapperWidth = toCssSize(width);
|
|
16902
|
+
const isUrl = typeof value === "string" && value.length > 0;
|
|
16903
|
+
const isFile = typeof File !== "undefined" && value instanceof File;
|
|
16904
|
+
const hasFileChip = isUrl || isFile;
|
|
16905
|
+
const handleFileChange = (event) => {
|
|
16906
|
+
const file = event.target.files?.[0] ?? null;
|
|
16907
|
+
onChange?.(file, event);
|
|
16908
|
+
};
|
|
16909
|
+
const handleClear = (event) => {
|
|
16910
|
+
event.preventDefault();
|
|
16911
|
+
event.stopPropagation();
|
|
16912
|
+
if (internalRef.current) internalRef.current.value = "";
|
|
16913
|
+
onChange?.(null);
|
|
16914
|
+
};
|
|
16915
|
+
const handleDownload = (event) => {
|
|
16916
|
+
event.preventDefault();
|
|
16917
|
+
event.stopPropagation();
|
|
16918
|
+
if (isUrl) onDownload(value);
|
|
16919
|
+
};
|
|
16920
|
+
return /* @__PURE__ */ jsxs111(
|
|
16921
|
+
"label",
|
|
16922
|
+
{
|
|
16923
|
+
htmlFor: inputId,
|
|
16924
|
+
className: cn(
|
|
16925
|
+
"relative block w-full max-w-[var(--field-max-width,296px)] cursor-pointer text-left",
|
|
16926
|
+
(disabled || readOnly) && "cursor-not-allowed",
|
|
16927
|
+
loading && "cursor-progress",
|
|
16928
|
+
disabled && "opacity-50",
|
|
16929
|
+
className
|
|
16930
|
+
),
|
|
16931
|
+
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
16932
|
+
children: [
|
|
16933
|
+
/* @__PURE__ */ jsx168(
|
|
16934
|
+
"input",
|
|
16935
|
+
{
|
|
16936
|
+
ref: inputRef,
|
|
16937
|
+
id: inputId,
|
|
16938
|
+
name,
|
|
16939
|
+
type: "file",
|
|
16940
|
+
accept,
|
|
16941
|
+
multiple,
|
|
16942
|
+
disabled: isBlocked || readOnly,
|
|
16943
|
+
onChange: handleFileChange,
|
|
16944
|
+
className: "absolute h-[0.1px] w-[0.1px] opacity-0",
|
|
16945
|
+
"aria-labelledby": labelId,
|
|
16946
|
+
"aria-invalid": isInvalid
|
|
16947
|
+
}
|
|
16221
16948
|
),
|
|
16222
|
-
|
|
16223
|
-
|
|
16224
|
-
|
|
16225
|
-
|
|
16226
|
-
|
|
16227
|
-
|
|
16228
|
-
|
|
16229
|
-
|
|
16230
|
-
|
|
16231
|
-
|
|
16232
|
-
|
|
16233
|
-
|
|
16234
|
-
|
|
16235
|
-
|
|
16236
|
-
|
|
16237
|
-
|
|
16238
|
-
|
|
16239
|
-
|
|
16240
|
-
|
|
16241
|
-
|
|
16242
|
-
|
|
16243
|
-
|
|
16244
|
-
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16248
|
-
|
|
16249
|
-
|
|
16250
|
-
|
|
16251
|
-
|
|
16252
|
-
|
|
16253
|
-
|
|
16254
|
-
|
|
16255
|
-
|
|
16256
|
-
|
|
16257
|
-
"
|
|
16258
|
-
{
|
|
16259
|
-
|
|
16260
|
-
|
|
16261
|
-
|
|
16262
|
-
|
|
16263
|
-
|
|
16264
|
-
|
|
16265
|
-
|
|
16266
|
-
|
|
16267
|
-
|
|
16268
|
-
|
|
16269
|
-
|
|
16270
|
-
|
|
16271
|
-
|
|
16272
|
-
|
|
16273
|
-
onClick: handleClear,
|
|
16274
|
-
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]",
|
|
16275
|
-
"aria-label": t("remove_file"),
|
|
16276
|
-
children: /* @__PURE__ */ jsx164(SquareX5, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
16277
|
-
}
|
|
16278
|
-
)
|
|
16279
|
-
]
|
|
16280
|
-
}
|
|
16281
|
-
) : /* @__PURE__ */ jsx164("span", { className: "block min-w-0 flex-1 truncate text-left text-[var(--chekin-color-gray-1)]", children: placeholder ?? "" }),
|
|
16282
|
-
/* @__PURE__ */ jsxs108("span", { className: "ml-auto flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
16283
|
-
loading && /* @__PURE__ */ jsx164(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
16284
|
-
/* @__PURE__ */ jsx164(Paperclip, { size: 20 })
|
|
16285
|
-
] })
|
|
16286
|
-
]
|
|
16287
|
-
}
|
|
16288
|
-
),
|
|
16289
|
-
/* @__PURE__ */ jsx164(
|
|
16290
|
-
Fieldset,
|
|
16291
|
-
{
|
|
16292
|
-
isFocused: false,
|
|
16293
|
-
invalid: isInvalid,
|
|
16294
|
-
isEmpty,
|
|
16295
|
-
isActivated: !isEmpty,
|
|
16296
|
-
disabled,
|
|
16297
|
-
loading,
|
|
16298
|
-
readOnly,
|
|
16299
|
-
htmlFor: inputId,
|
|
16300
|
-
labelId,
|
|
16301
|
-
legend: resolvedLabel,
|
|
16302
|
-
label: resolvedLabel,
|
|
16303
|
-
tooltip
|
|
16304
|
-
}
|
|
16305
|
-
)
|
|
16306
|
-
] }),
|
|
16307
|
-
!error && optional && /* @__PURE__ */ jsx164("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
16308
|
-
!error && helperText && /* @__PURE__ */ jsx164("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
16309
|
-
error && !hideErrorMessage && /* @__PURE__ */ jsx164(
|
|
16310
|
-
FieldErrorMessage,
|
|
16949
|
+
/* @__PURE__ */ jsxs111("div", { className: "relative min-h-[68px] w-full", children: [
|
|
16950
|
+
/* @__PURE__ */ jsxs111("div", { className: "relative w-full", children: [
|
|
16951
|
+
/* @__PURE__ */ jsxs111(
|
|
16952
|
+
"div",
|
|
16953
|
+
{
|
|
16954
|
+
className: cn(
|
|
16955
|
+
"relative box-border flex h-12 w-full items-center justify-between gap-2 rounded-[6px] px-4 text-[16px] font-medium text-[var(--chekin-color-brand-navy)]",
|
|
16956
|
+
isEmpty && "bg-[var(--chekin-color-surface-input-empty)]"
|
|
16957
|
+
),
|
|
16958
|
+
children: [
|
|
16959
|
+
hasFileChip ? /* @__PURE__ */ jsxs111(
|
|
16960
|
+
"div",
|
|
16961
|
+
{
|
|
16962
|
+
className: "inline-flex h-6 max-w-[85%] items-center rounded-[4px] border border-[#acacd5] bg-[#f0f0f8] pl-[10px] pr-1",
|
|
16963
|
+
onClick: (event) => event.preventDefault(),
|
|
16964
|
+
children: [
|
|
16965
|
+
isUrl ? /* @__PURE__ */ jsxs111(
|
|
16966
|
+
"button",
|
|
16967
|
+
{
|
|
16968
|
+
type: "button",
|
|
16969
|
+
onClick: handleDownload,
|
|
16970
|
+
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",
|
|
16971
|
+
children: [
|
|
16972
|
+
/* @__PURE__ */ jsx168("span", { className: "truncate", children: resolvedDownloadLabel }),
|
|
16973
|
+
/* @__PURE__ */ jsx168(Download, { size: 15 })
|
|
16974
|
+
]
|
|
16975
|
+
}
|
|
16976
|
+
) : /* @__PURE__ */ jsx168("span", { className: "truncate text-[14px] font-medium text-[var(--chekin-color-brand-navy)]", children: value.name }),
|
|
16977
|
+
/* @__PURE__ */ jsx168(
|
|
16978
|
+
"button",
|
|
16979
|
+
{
|
|
16980
|
+
type: "button",
|
|
16981
|
+
disabled: isBlocked || readOnly,
|
|
16982
|
+
onClick: handleClear,
|
|
16983
|
+
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]",
|
|
16984
|
+
"aria-label": t("remove_file"),
|
|
16985
|
+
children: /* @__PURE__ */ jsx168(SquareX5, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
16986
|
+
}
|
|
16987
|
+
)
|
|
16988
|
+
]
|
|
16989
|
+
}
|
|
16990
|
+
) : /* @__PURE__ */ jsx168("span", { className: "block min-w-0 flex-1 truncate text-left text-[var(--chekin-color-gray-1)]", children: placeholder ?? "" }),
|
|
16991
|
+
/* @__PURE__ */ jsxs111("span", { className: "ml-auto flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
16992
|
+
loading && /* @__PURE__ */ jsx168(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
16993
|
+
/* @__PURE__ */ jsx168(Paperclip, { size: 20 })
|
|
16994
|
+
] })
|
|
16995
|
+
]
|
|
16996
|
+
}
|
|
16997
|
+
),
|
|
16998
|
+
/* @__PURE__ */ jsx168(
|
|
16999
|
+
Fieldset,
|
|
16311
17000
|
{
|
|
16312
|
-
|
|
16313
|
-
|
|
16314
|
-
|
|
17001
|
+
isFocused: false,
|
|
17002
|
+
invalid: isInvalid,
|
|
17003
|
+
isEmpty,
|
|
17004
|
+
isActivated: !isEmpty,
|
|
17005
|
+
disabled,
|
|
17006
|
+
loading,
|
|
17007
|
+
readOnly,
|
|
17008
|
+
htmlFor: inputId,
|
|
17009
|
+
labelId,
|
|
17010
|
+
legend: resolvedLabel,
|
|
17011
|
+
label: resolvedLabel,
|
|
17012
|
+
tooltip
|
|
16315
17013
|
}
|
|
16316
17014
|
)
|
|
16317
|
-
] })
|
|
16318
|
-
|
|
16319
|
-
|
|
16320
|
-
|
|
16321
|
-
|
|
16322
|
-
|
|
17015
|
+
] }),
|
|
17016
|
+
!error && optional && /* @__PURE__ */ jsx168("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
17017
|
+
!error && helperText && /* @__PURE__ */ jsx168("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
17018
|
+
error && !hideErrorMessage && /* @__PURE__ */ jsx168(
|
|
17019
|
+
FieldErrorMessage,
|
|
17020
|
+
{
|
|
17021
|
+
id: errorId,
|
|
17022
|
+
message: error,
|
|
17023
|
+
className: "mt-[1px] text-[14px]"
|
|
17024
|
+
}
|
|
17025
|
+
)
|
|
17026
|
+
] })
|
|
17027
|
+
]
|
|
17028
|
+
}
|
|
17029
|
+
);
|
|
17030
|
+
});
|
|
16323
17031
|
|
|
16324
17032
|
// src/dashboard/select-icons-box/SelectIconsBox.tsx
|
|
16325
|
-
import * as
|
|
16326
|
-
import { jsx as
|
|
17033
|
+
import * as React65 from "react";
|
|
17034
|
+
import { jsx as jsx169, jsxs as jsxs112 } from "react/jsx-runtime";
|
|
16327
17035
|
function SelectIconsBox({
|
|
16328
17036
|
children,
|
|
16329
17037
|
icons,
|
|
@@ -16338,9 +17046,9 @@ function SelectIconsBox({
|
|
|
16338
17046
|
className,
|
|
16339
17047
|
boxClassName
|
|
16340
17048
|
}) {
|
|
16341
|
-
const containerRef =
|
|
17049
|
+
const containerRef = React65.useRef(null);
|
|
16342
17050
|
const isControlled = controlledOpen !== void 0;
|
|
16343
|
-
const [internalOpen, setInternalOpen] =
|
|
17051
|
+
const [internalOpen, setInternalOpen] = React65.useState(defaultOpen);
|
|
16344
17052
|
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
16345
17053
|
const setOpen = (next) => {
|
|
16346
17054
|
if (!isControlled) setInternalOpen(next);
|
|
@@ -16359,7 +17067,7 @@ function SelectIconsBox({
|
|
|
16359
17067
|
onSelect(iconName);
|
|
16360
17068
|
setOpen(false);
|
|
16361
17069
|
};
|
|
16362
|
-
return /* @__PURE__ */
|
|
17070
|
+
return /* @__PURE__ */ jsxs112(
|
|
16363
17071
|
"div",
|
|
16364
17072
|
{
|
|
16365
17073
|
ref: containerRef,
|
|
@@ -16367,7 +17075,7 @@ function SelectIconsBox({
|
|
|
16367
17075
|
className: cn("relative inline-block", className),
|
|
16368
17076
|
children: [
|
|
16369
17077
|
children,
|
|
16370
|
-
isOpen && /* @__PURE__ */
|
|
17078
|
+
isOpen && /* @__PURE__ */ jsx169(
|
|
16371
17079
|
"div",
|
|
16372
17080
|
{
|
|
16373
17081
|
className: cn(
|
|
@@ -16378,7 +17086,7 @@ function SelectIconsBox({
|
|
|
16378
17086
|
boxClassName
|
|
16379
17087
|
),
|
|
16380
17088
|
style: { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` },
|
|
16381
|
-
children: icons.map((iconName) => /* @__PURE__ */
|
|
17089
|
+
children: icons.map((iconName) => /* @__PURE__ */ jsx169(
|
|
16382
17090
|
"button",
|
|
16383
17091
|
{
|
|
16384
17092
|
type: "button",
|
|
@@ -16459,14 +17167,14 @@ function getErrorMessage(error) {
|
|
|
16459
17167
|
|
|
16460
17168
|
// src/lib/toastResponseError.tsx
|
|
16461
17169
|
import i18next from "i18next";
|
|
16462
|
-
import { jsx as
|
|
17170
|
+
import { jsx as jsx170, jsxs as jsxs113 } from "react/jsx-runtime";
|
|
16463
17171
|
function addSupportEmailToMessage(message, prefixText) {
|
|
16464
17172
|
if (typeof message !== "string") {
|
|
16465
17173
|
return message;
|
|
16466
17174
|
}
|
|
16467
17175
|
const builtMessage = `${prefixText ? `${prefixText} ` : ""}${message}`;
|
|
16468
|
-
return /* @__PURE__ */
|
|
16469
|
-
/* @__PURE__ */
|
|
17176
|
+
return /* @__PURE__ */ jsxs113("div", { children: [
|
|
17177
|
+
/* @__PURE__ */ jsx170("div", { children: builtMessage }),
|
|
16470
17178
|
i18next.t("reach_us_at_email")
|
|
16471
17179
|
] });
|
|
16472
17180
|
}
|
|
@@ -16481,13 +17189,13 @@ function toastResponseError(error, options = {}) {
|
|
|
16481
17189
|
}
|
|
16482
17190
|
|
|
16483
17191
|
// src/legacy-fields/textarea/Textarea.tsx
|
|
16484
|
-
import { forwardRef as
|
|
16485
|
-
import { jsx as
|
|
16486
|
-
var LegacyTextarea =
|
|
17192
|
+
import { forwardRef as forwardRef71, useId as useId15 } from "react";
|
|
17193
|
+
import { jsx as jsx171, jsxs as jsxs114 } from "react/jsx-runtime";
|
|
17194
|
+
var LegacyTextarea = forwardRef71(
|
|
16487
17195
|
({ className, textareaClassName, label, disabled, name, invalid, ...textareaProps }, ref) => {
|
|
16488
17196
|
const inputId = useId15();
|
|
16489
|
-
return /* @__PURE__ */
|
|
16490
|
-
/* @__PURE__ */
|
|
17197
|
+
return /* @__PURE__ */ jsxs114("div", { className: cn("relative", className), children: [
|
|
17198
|
+
/* @__PURE__ */ jsx171(
|
|
16491
17199
|
"textarea",
|
|
16492
17200
|
{
|
|
16493
17201
|
ref,
|
|
@@ -16503,7 +17211,7 @@ var LegacyTextarea = forwardRef68(
|
|
|
16503
17211
|
...textareaProps
|
|
16504
17212
|
}
|
|
16505
17213
|
),
|
|
16506
|
-
label && /* @__PURE__ */
|
|
17214
|
+
label && /* @__PURE__ */ jsx171(
|
|
16507
17215
|
"label",
|
|
16508
17216
|
{
|
|
16509
17217
|
htmlFor: inputId,
|
|
@@ -16521,15 +17229,15 @@ var LegacyTextarea = forwardRef68(
|
|
|
16521
17229
|
LegacyTextarea.displayName = "LegacyTextarea";
|
|
16522
17230
|
|
|
16523
17231
|
// src/airbnb-fields/datepicker/DatePicker.tsx
|
|
16524
|
-
import * as
|
|
17232
|
+
import * as React67 from "react";
|
|
16525
17233
|
import { Calendar as Calendar2 } from "lucide-react";
|
|
16526
17234
|
|
|
16527
17235
|
// src/airbnb-fields/field-trigger/FieldTrigger.tsx
|
|
16528
|
-
import * as
|
|
17236
|
+
import * as React66 from "react";
|
|
16529
17237
|
import { Loader2 as Loader24 } from "lucide-react";
|
|
16530
|
-
import { useTranslation as
|
|
16531
|
-
import { Fragment as Fragment17, jsx as
|
|
16532
|
-
var AirbnbFieldTrigger =
|
|
17238
|
+
import { useTranslation as useTranslation41 } from "react-i18next";
|
|
17239
|
+
import { Fragment as Fragment17, jsx as jsx172, jsxs as jsxs115 } from "react/jsx-runtime";
|
|
17240
|
+
var AirbnbFieldTrigger = React66.forwardRef(
|
|
16533
17241
|
({
|
|
16534
17242
|
as = "button",
|
|
16535
17243
|
variant = "airbnb",
|
|
@@ -16560,20 +17268,20 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16560
17268
|
onKeyDown,
|
|
16561
17269
|
...props
|
|
16562
17270
|
}, ref) => {
|
|
16563
|
-
const { t } =
|
|
17271
|
+
const { t } = useTranslation41();
|
|
16564
17272
|
const hasValue = Boolean(valueText);
|
|
16565
17273
|
const isRaised = hasValue || forceFloatingLabel;
|
|
16566
17274
|
const optionalLabel = optional ? typeof optional === "string" ? optional : t("optional") : void 0;
|
|
16567
17275
|
const visibleLabelText = labelText ?? label;
|
|
16568
17276
|
const hasLabelMeta = Boolean(optionalLabel) || Boolean(tooltip);
|
|
16569
|
-
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */
|
|
16570
|
-
/* @__PURE__ */
|
|
16571
|
-
optionalLabel && /* @__PURE__ */
|
|
17277
|
+
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */ jsxs115("span", { className: "inline-flex max-w-full items-center gap-1.5 align-middle", children: [
|
|
17278
|
+
/* @__PURE__ */ jsx172("span", { className: "min-w-0 truncate", children: visibleLabelText }),
|
|
17279
|
+
optionalLabel && /* @__PURE__ */ jsxs115("span", { className: "shrink-0 text-[12px] relative top-[1px] font-normal leading-4 text-current opacity-70", children: [
|
|
16572
17280
|
"(",
|
|
16573
17281
|
optionalLabel,
|
|
16574
17282
|
")"
|
|
16575
17283
|
] }),
|
|
16576
|
-
tooltip && /* @__PURE__ */
|
|
17284
|
+
tooltip && /* @__PURE__ */ jsx172(
|
|
16577
17285
|
HelpTooltip,
|
|
16578
17286
|
{
|
|
16579
17287
|
content: tooltip,
|
|
@@ -16589,9 +17297,9 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16589
17297
|
const hasInvalidState = Boolean(error);
|
|
16590
17298
|
const errorMessage = typeof error === "string" ? error : void 0;
|
|
16591
17299
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
16592
|
-
const resolvedTrailingAdornment = loading || trailingAdornment ? /* @__PURE__ */
|
|
17300
|
+
const resolvedTrailingAdornment = loading || trailingAdornment ? /* @__PURE__ */ jsxs115("span", { className: "flex items-center gap-2", children: [
|
|
16593
17301
|
trailingAdornment,
|
|
16594
|
-
loading && /* @__PURE__ */
|
|
17302
|
+
loading && /* @__PURE__ */ jsx172(
|
|
16595
17303
|
Loader24,
|
|
16596
17304
|
{
|
|
16597
17305
|
"aria-hidden": "true",
|
|
@@ -16607,8 +17315,8 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16607
17315
|
disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : isAirbnbVariant ? "cursor-pointer" : "cursor-text",
|
|
16608
17316
|
className
|
|
16609
17317
|
);
|
|
16610
|
-
const sharedContent = /* @__PURE__ */
|
|
16611
|
-
/* @__PURE__ */
|
|
17318
|
+
const sharedContent = /* @__PURE__ */ jsxs115(Fragment17, { children: [
|
|
17319
|
+
/* @__PURE__ */ jsxs115(
|
|
16612
17320
|
"span",
|
|
16613
17321
|
{
|
|
16614
17322
|
className: cn(
|
|
@@ -16617,7 +17325,7 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16617
17325
|
contentClassName
|
|
16618
17326
|
),
|
|
16619
17327
|
children: [
|
|
16620
|
-
/* @__PURE__ */
|
|
17328
|
+
/* @__PURE__ */ jsx172(
|
|
16621
17329
|
"span",
|
|
16622
17330
|
{
|
|
16623
17331
|
id: labelId,
|
|
@@ -16630,7 +17338,7 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16630
17338
|
children: animatedLabel
|
|
16631
17339
|
}
|
|
16632
17340
|
),
|
|
16633
|
-
children ? children : hasValue ? /* @__PURE__ */
|
|
17341
|
+
children ? children : hasValue ? /* @__PURE__ */ jsx172(
|
|
16634
17342
|
"span",
|
|
16635
17343
|
{
|
|
16636
17344
|
id: valueId,
|
|
@@ -16641,11 +17349,11 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16641
17349
|
),
|
|
16642
17350
|
children: valueText
|
|
16643
17351
|
}
|
|
16644
|
-
) : /* @__PURE__ */
|
|
17352
|
+
) : /* @__PURE__ */ jsx172("span", { id: helperTextId, className: "sr-only", children: placeholder ?? label })
|
|
16645
17353
|
]
|
|
16646
17354
|
}
|
|
16647
17355
|
),
|
|
16648
|
-
resolvedTrailingAdornment && /* @__PURE__ */
|
|
17356
|
+
resolvedTrailingAdornment && /* @__PURE__ */ jsx172(
|
|
16649
17357
|
"span",
|
|
16650
17358
|
{
|
|
16651
17359
|
"aria-hidden": "true",
|
|
@@ -16657,9 +17365,9 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16657
17365
|
}
|
|
16658
17366
|
)
|
|
16659
17367
|
] });
|
|
16660
|
-
return /* @__PURE__ */
|
|
16661
|
-
topLabel && /* @__PURE__ */
|
|
16662
|
-
as === "button" ? /* @__PURE__ */
|
|
17368
|
+
return /* @__PURE__ */ jsxs115("div", { className: "w-full", children: [
|
|
17369
|
+
topLabel && /* @__PURE__ */ jsx172("p", { className: "mb-3 text-[16px] font-semibold leading-5 text-[#222222]", children: topLabel }),
|
|
17370
|
+
as === "button" ? /* @__PURE__ */ jsx172(
|
|
16663
17371
|
"button",
|
|
16664
17372
|
{
|
|
16665
17373
|
id,
|
|
@@ -16676,7 +17384,7 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16676
17384
|
...props,
|
|
16677
17385
|
children: sharedContent
|
|
16678
17386
|
}
|
|
16679
|
-
) : /* @__PURE__ */
|
|
17387
|
+
) : /* @__PURE__ */ jsx172(
|
|
16680
17388
|
"div",
|
|
16681
17389
|
{
|
|
16682
17390
|
id,
|
|
@@ -16693,16 +17401,16 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16693
17401
|
children: sharedContent
|
|
16694
17402
|
}
|
|
16695
17403
|
),
|
|
16696
|
-
errorMessage && !hideErrorMessage && /* @__PURE__ */
|
|
17404
|
+
errorMessage && !hideErrorMessage && /* @__PURE__ */ jsx172(FieldErrorMessage, { id: errorId, message: errorMessage })
|
|
16697
17405
|
] });
|
|
16698
17406
|
}
|
|
16699
17407
|
);
|
|
16700
17408
|
AirbnbFieldTrigger.displayName = "AirbnbFieldTrigger";
|
|
16701
17409
|
|
|
16702
17410
|
// src/airbnb-fields/datepicker/DatePicker.tsx
|
|
16703
|
-
import { jsx as
|
|
17411
|
+
import { jsx as jsx173, jsxs as jsxs116 } from "react/jsx-runtime";
|
|
16704
17412
|
var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
|
|
16705
|
-
var AirbnbDatePicker =
|
|
17413
|
+
var AirbnbDatePicker = React67.forwardRef(
|
|
16706
17414
|
({
|
|
16707
17415
|
variant = "default",
|
|
16708
17416
|
label,
|
|
@@ -16728,24 +17436,24 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16728
17436
|
formatValue = formatDateValue
|
|
16729
17437
|
}, ref) => {
|
|
16730
17438
|
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
16731
|
-
const [isOpen, setIsOpen] =
|
|
16732
|
-
const triggerId =
|
|
16733
|
-
const pickerId =
|
|
16734
|
-
const labelId =
|
|
16735
|
-
const valueId =
|
|
16736
|
-
const helperTextId =
|
|
16737
|
-
const errorId =
|
|
16738
|
-
const internalRef =
|
|
17439
|
+
const [isOpen, setIsOpen] = React67.useState(false);
|
|
17440
|
+
const triggerId = React67.useId();
|
|
17441
|
+
const pickerId = React67.useId();
|
|
17442
|
+
const labelId = React67.useId();
|
|
17443
|
+
const valueId = React67.useId();
|
|
17444
|
+
const helperTextId = React67.useId();
|
|
17445
|
+
const errorId = React67.useId();
|
|
17446
|
+
const internalRef = React67.useRef(null);
|
|
16739
17447
|
const combinedRef = useCombinedRef(ref, internalRef);
|
|
16740
|
-
const monthLabels =
|
|
16741
|
-
const resolvedMinDate =
|
|
16742
|
-
const resolvedMaxDate =
|
|
16743
|
-
const normalizedValue =
|
|
16744
|
-
const normalizedDefaultValue =
|
|
17448
|
+
const monthLabels = React67.useMemo(() => getMonthLabels(locale), [locale]);
|
|
17449
|
+
const resolvedMinDate = React67.useMemo(() => minDate ?? DEFAULT_MIN_DATE, [minDate]);
|
|
17450
|
+
const resolvedMaxDate = React67.useMemo(() => maxDate ?? /* @__PURE__ */ new Date(), [maxDate]);
|
|
17451
|
+
const normalizedValue = React67.useMemo(() => normalizeDateValue(value), [value]);
|
|
17452
|
+
const normalizedDefaultValue = React67.useMemo(
|
|
16745
17453
|
() => normalizeDateValue(defaultValue),
|
|
16746
17454
|
[defaultValue]
|
|
16747
17455
|
);
|
|
16748
|
-
const resolvedValue =
|
|
17456
|
+
const resolvedValue = React67.useMemo(
|
|
16749
17457
|
() => normalizedValue ? clampDate(normalizedValue, resolvedMinDate, resolvedMaxDate) : null,
|
|
16750
17458
|
[normalizedValue, resolvedMaxDate, resolvedMinDate]
|
|
16751
17459
|
);
|
|
@@ -16776,7 +17484,7 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16776
17484
|
minDate: resolvedMinDate,
|
|
16777
17485
|
maxDate: resolvedMaxDate
|
|
16778
17486
|
});
|
|
16779
|
-
const handleOpenChange =
|
|
17487
|
+
const handleOpenChange = React67.useCallback(
|
|
16780
17488
|
(nextOpen) => {
|
|
16781
17489
|
if (isBlocked && nextOpen) return;
|
|
16782
17490
|
setIsOpen(nextOpen);
|
|
@@ -16786,7 +17494,7 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16786
17494
|
},
|
|
16787
17495
|
[isBlocked]
|
|
16788
17496
|
);
|
|
16789
|
-
const handleDone =
|
|
17497
|
+
const handleDone = React67.useCallback(() => {
|
|
16790
17498
|
if (isBlocked) return;
|
|
16791
17499
|
onChange(clampDate(draftDate, resolvedMinDate, resolvedMaxDate));
|
|
16792
17500
|
handleOpenChange(false);
|
|
@@ -16798,11 +17506,11 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16798
17506
|
resolvedMaxDate,
|
|
16799
17507
|
resolvedMinDate
|
|
16800
17508
|
]);
|
|
16801
|
-
const handleTriggerClick =
|
|
17509
|
+
const handleTriggerClick = React67.useCallback(() => {
|
|
16802
17510
|
if (isBlocked) return;
|
|
16803
17511
|
setIsOpen(true);
|
|
16804
17512
|
}, [isBlocked]);
|
|
16805
|
-
const handleTriggerKeyDown =
|
|
17513
|
+
const handleTriggerKeyDown = React67.useCallback(
|
|
16806
17514
|
(event) => {
|
|
16807
17515
|
if (isBlocked) return;
|
|
16808
17516
|
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
@@ -16812,13 +17520,13 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16812
17520
|
},
|
|
16813
17521
|
[isBlocked]
|
|
16814
17522
|
);
|
|
16815
|
-
|
|
17523
|
+
React67.useEffect(() => {
|
|
16816
17524
|
if (isBlocked) {
|
|
16817
17525
|
setIsOpen(false);
|
|
16818
17526
|
}
|
|
16819
17527
|
}, [isBlocked]);
|
|
16820
|
-
return /* @__PURE__ */
|
|
16821
|
-
name && /* @__PURE__ */
|
|
17528
|
+
return /* @__PURE__ */ jsxs116("div", { className: cn("relative w-full max-w-[var(--max-field-width)]", className), children: [
|
|
17529
|
+
name && /* @__PURE__ */ jsx173(
|
|
16822
17530
|
"input",
|
|
16823
17531
|
{
|
|
16824
17532
|
type: "hidden",
|
|
@@ -16826,7 +17534,7 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16826
17534
|
value: resolvedValue ? formatDateInputValue(resolvedValue) : ""
|
|
16827
17535
|
}
|
|
16828
17536
|
),
|
|
16829
|
-
/* @__PURE__ */
|
|
17537
|
+
/* @__PURE__ */ jsx173(
|
|
16830
17538
|
AirbnbFieldTrigger,
|
|
16831
17539
|
{
|
|
16832
17540
|
id: triggerId,
|
|
@@ -16853,10 +17561,10 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16853
17561
|
onClick: handleTriggerClick,
|
|
16854
17562
|
onKeyDown: handleTriggerKeyDown,
|
|
16855
17563
|
onBlur,
|
|
16856
|
-
trailingAdornment: /* @__PURE__ */
|
|
17564
|
+
trailingAdornment: /* @__PURE__ */ jsx173(Calendar2, { className: "h-5 w-5 text-[#1F1F1B]", strokeWidth: 2 })
|
|
16857
17565
|
}
|
|
16858
17566
|
),
|
|
16859
|
-
/* @__PURE__ */
|
|
17567
|
+
/* @__PURE__ */ jsx173(
|
|
16860
17568
|
AirbnbDatePickerContent,
|
|
16861
17569
|
{
|
|
16862
17570
|
baseId: pickerId,
|
|
@@ -16890,10 +17598,10 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16890
17598
|
AirbnbDatePicker.displayName = "AirbnbDatePicker";
|
|
16891
17599
|
|
|
16892
17600
|
// src/airbnb-fields/input/Input.tsx
|
|
16893
|
-
import * as
|
|
16894
|
-
import { jsx as
|
|
17601
|
+
import * as React68 from "react";
|
|
17602
|
+
import { jsx as jsx174 } from "react/jsx-runtime";
|
|
16895
17603
|
var getInputValue = (value) => value != null ? String(value) : "";
|
|
16896
|
-
var AirbnbInput =
|
|
17604
|
+
var AirbnbInput = React68.forwardRef(
|
|
16897
17605
|
({
|
|
16898
17606
|
variant = "default",
|
|
16899
17607
|
label,
|
|
@@ -16922,15 +17630,15 @@ var AirbnbInput = React65.forwardRef(
|
|
|
16922
17630
|
placeholder,
|
|
16923
17631
|
...props
|
|
16924
17632
|
}, ref) => {
|
|
16925
|
-
const generatedId =
|
|
16926
|
-
const inputRef =
|
|
17633
|
+
const generatedId = React68.useId();
|
|
17634
|
+
const inputRef = React68.useRef(null);
|
|
16927
17635
|
const inputId = id ?? generatedId;
|
|
16928
17636
|
const fieldId = `${inputId}-field`;
|
|
16929
17637
|
const labelId = `${inputId}-label`;
|
|
16930
17638
|
const errorId = `${inputId}-error`;
|
|
16931
17639
|
const accessibleLabel = placeholder ?? label;
|
|
16932
|
-
const [isFocused, setIsFocused] =
|
|
16933
|
-
const [currentValue, setCurrentValue] =
|
|
17640
|
+
const [isFocused, setIsFocused] = React68.useState(false);
|
|
17641
|
+
const [currentValue, setCurrentValue] = React68.useState(
|
|
16934
17642
|
() => value != null ? getInputValue(value) : getInputValue(defaultValue)
|
|
16935
17643
|
);
|
|
16936
17644
|
const resolvedValue = value != null ? getInputValue(value) : currentValue;
|
|
@@ -16940,11 +17648,11 @@ var AirbnbInput = React65.forwardRef(
|
|
|
16940
17648
|
const triggerError = error ?? invalid;
|
|
16941
17649
|
const hasLabelMeta = Boolean(optional) || Boolean(tooltip);
|
|
16942
17650
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
16943
|
-
|
|
17651
|
+
React68.useLayoutEffect(() => {
|
|
16944
17652
|
const nextValue = value != null ? getInputValue(value) : getInputValue(inputRef.current?.value);
|
|
16945
17653
|
setCurrentValue((prevValue) => prevValue === nextValue ? prevValue : nextValue);
|
|
16946
17654
|
}, [value]);
|
|
16947
|
-
const setRefs =
|
|
17655
|
+
const setRefs = React68.useCallback(
|
|
16948
17656
|
(node) => {
|
|
16949
17657
|
inputRef.current = node;
|
|
16950
17658
|
if (node && value == null) {
|
|
@@ -16974,7 +17682,7 @@ var AirbnbInput = React65.forwardRef(
|
|
|
16974
17682
|
setIsFocused(false);
|
|
16975
17683
|
onBlur?.(event);
|
|
16976
17684
|
};
|
|
16977
|
-
return /* @__PURE__ */
|
|
17685
|
+
return /* @__PURE__ */ jsx174("div", { className: cn("w-full max-w-[var(--max-field-width)]", wrapperClassName), children: /* @__PURE__ */ jsx174(
|
|
16978
17686
|
AirbnbFieldTrigger,
|
|
16979
17687
|
{
|
|
16980
17688
|
as: "div",
|
|
@@ -17006,7 +17714,7 @@ var AirbnbInput = React65.forwardRef(
|
|
|
17006
17714
|
forceFloatingLabel: shouldShowLabel,
|
|
17007
17715
|
forceLabelText: hasLabelMeta,
|
|
17008
17716
|
hideErrorMessage: !renderErrorMessage,
|
|
17009
|
-
children: /* @__PURE__ */
|
|
17717
|
+
children: /* @__PURE__ */ jsx174(
|
|
17010
17718
|
"input",
|
|
17011
17719
|
{
|
|
17012
17720
|
...props,
|
|
@@ -17042,14 +17750,14 @@ var AirbnbInput = React65.forwardRef(
|
|
|
17042
17750
|
AirbnbInput.displayName = "AirbnbInput";
|
|
17043
17751
|
|
|
17044
17752
|
// src/airbnb-fields/phone-field/PhoneField.tsx
|
|
17045
|
-
import * as
|
|
17753
|
+
import * as React74 from "react";
|
|
17046
17754
|
import { ChevronDown as ChevronDown5 } from "lucide-react";
|
|
17047
17755
|
|
|
17048
17756
|
// src/airbnb-fields/select/Select.tsx
|
|
17049
|
-
import * as
|
|
17757
|
+
import * as React73 from "react";
|
|
17050
17758
|
|
|
17051
17759
|
// src/airbnb-fields/select/SelectDesktopMenu.tsx
|
|
17052
|
-
import { jsx as
|
|
17760
|
+
import { jsx as jsx175, jsxs as jsxs117 } from "react/jsx-runtime";
|
|
17053
17761
|
function AirbnbSelectDesktopMenu({
|
|
17054
17762
|
id,
|
|
17055
17763
|
options,
|
|
@@ -17068,7 +17776,7 @@ function AirbnbSelectDesktopMenu({
|
|
|
17068
17776
|
noOptionsMessage
|
|
17069
17777
|
}) {
|
|
17070
17778
|
const emptyMessage = noOptionsMessage?.();
|
|
17071
|
-
return /* @__PURE__ */
|
|
17779
|
+
return /* @__PURE__ */ jsxs117(
|
|
17072
17780
|
"div",
|
|
17073
17781
|
{
|
|
17074
17782
|
id,
|
|
@@ -17081,12 +17789,12 @@ function AirbnbSelectDesktopMenu({
|
|
|
17081
17789
|
onKeyDown,
|
|
17082
17790
|
className: cn("max-h-[280px] overflow-y-auto p-2 outline-none", menuClassName),
|
|
17083
17791
|
children: [
|
|
17084
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */
|
|
17792
|
+
options.length === 0 && emptyMessage ? /* @__PURE__ */ jsx175("div", { className: "px-4 py-3 text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : null,
|
|
17085
17793
|
options.map((option, index) => {
|
|
17086
17794
|
const isSelected = selectedValue?.value === option.value;
|
|
17087
17795
|
const isHighlighted = index === highlightedIndex;
|
|
17088
17796
|
const optionKey = `${String(option.value)}-${index}`;
|
|
17089
|
-
return /* @__PURE__ */
|
|
17797
|
+
return /* @__PURE__ */ jsx175(
|
|
17090
17798
|
"button",
|
|
17091
17799
|
{
|
|
17092
17800
|
id: getOptionId2(index),
|
|
@@ -17118,7 +17826,7 @@ function AirbnbSelectDesktopMenu({
|
|
|
17118
17826
|
}
|
|
17119
17827
|
|
|
17120
17828
|
// src/airbnb-fields/select/SelectDesktopContent.tsx
|
|
17121
|
-
import { jsx as
|
|
17829
|
+
import { jsx as jsx176 } from "react/jsx-runtime";
|
|
17122
17830
|
function AirbnbSelectDesktopContent({
|
|
17123
17831
|
isOpen,
|
|
17124
17832
|
listboxId,
|
|
@@ -17139,14 +17847,14 @@ function AirbnbSelectDesktopContent({
|
|
|
17139
17847
|
noOptionsMessage
|
|
17140
17848
|
}) {
|
|
17141
17849
|
if (!isOpen) return null;
|
|
17142
|
-
return /* @__PURE__ */
|
|
17850
|
+
return /* @__PURE__ */ jsx176(
|
|
17143
17851
|
"div",
|
|
17144
17852
|
{
|
|
17145
17853
|
className: cn(
|
|
17146
17854
|
"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)]",
|
|
17147
17855
|
dropdownClassName
|
|
17148
17856
|
),
|
|
17149
|
-
children: /* @__PURE__ */
|
|
17857
|
+
children: /* @__PURE__ */ jsx176(
|
|
17150
17858
|
AirbnbSelectDesktopMenu,
|
|
17151
17859
|
{
|
|
17152
17860
|
id: listboxId,
|
|
@@ -17244,7 +17952,7 @@ function getMobileOptionStyles(index, scrollTop) {
|
|
|
17244
17952
|
}
|
|
17245
17953
|
|
|
17246
17954
|
// src/airbnb-fields/select/SelectMobileWheel.tsx
|
|
17247
|
-
import { jsx as
|
|
17955
|
+
import { jsx as jsx177, jsxs as jsxs118 } from "react/jsx-runtime";
|
|
17248
17956
|
function AirbnbSelectMobileWheel({
|
|
17249
17957
|
id,
|
|
17250
17958
|
options,
|
|
@@ -17263,7 +17971,7 @@ function AirbnbSelectMobileWheel({
|
|
|
17263
17971
|
}) {
|
|
17264
17972
|
const spacerHeight2 = getWheelSpacerHeight();
|
|
17265
17973
|
const emptyMessage = noOptionsMessage?.();
|
|
17266
|
-
return /* @__PURE__ */
|
|
17974
|
+
return /* @__PURE__ */ jsxs118(
|
|
17267
17975
|
"div",
|
|
17268
17976
|
{
|
|
17269
17977
|
id,
|
|
@@ -17275,10 +17983,10 @@ function AirbnbSelectMobileWheel({
|
|
|
17275
17983
|
onKeyDown,
|
|
17276
17984
|
className: cn("relative overflow-hidden outline-none", menuClassName),
|
|
17277
17985
|
children: [
|
|
17278
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */
|
|
17279
|
-
/* @__PURE__ */
|
|
17280
|
-
/* @__PURE__ */
|
|
17281
|
-
/* @__PURE__ */
|
|
17986
|
+
options.length === 0 && emptyMessage ? /* @__PURE__ */ jsx177("div", { className: "flex min-h-[160px] items-center justify-center px-4 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : null,
|
|
17987
|
+
/* @__PURE__ */ jsx177("div", { className: "pointer-events-none absolute inset-x-0 top-0 h-16 bg-gradient-to-b from-white via-white/80 to-transparent" }),
|
|
17988
|
+
/* @__PURE__ */ jsx177("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-white via-white/80 to-transparent" }),
|
|
17989
|
+
/* @__PURE__ */ jsx177(
|
|
17282
17990
|
"div",
|
|
17283
17991
|
{
|
|
17284
17992
|
"aria-hidden": true,
|
|
@@ -17288,7 +17996,7 @@ function AirbnbSelectMobileWheel({
|
|
|
17288
17996
|
)
|
|
17289
17997
|
}
|
|
17290
17998
|
),
|
|
17291
|
-
/* @__PURE__ */
|
|
17999
|
+
/* @__PURE__ */ jsxs118(
|
|
17292
18000
|
"div",
|
|
17293
18001
|
{
|
|
17294
18002
|
ref: listRef,
|
|
@@ -17303,11 +18011,11 @@ function AirbnbSelectMobileWheel({
|
|
|
17303
18011
|
WebkitOverflowScrolling: "touch"
|
|
17304
18012
|
},
|
|
17305
18013
|
children: [
|
|
17306
|
-
/* @__PURE__ */
|
|
18014
|
+
/* @__PURE__ */ jsx177("div", { style: { height: `${spacerHeight2}px` } }),
|
|
17307
18015
|
options.map((option, index) => {
|
|
17308
18016
|
const { distance, style } = getMobileOptionStyles(index, scrollTop);
|
|
17309
18017
|
const optionKey = `${String(option.value)}-${index}`;
|
|
17310
|
-
return /* @__PURE__ */
|
|
18018
|
+
return /* @__PURE__ */ jsx177(
|
|
17311
18019
|
"button",
|
|
17312
18020
|
{
|
|
17313
18021
|
id: getOptionId2(index),
|
|
@@ -17328,7 +18036,7 @@ function AirbnbSelectMobileWheel({
|
|
|
17328
18036
|
optionKey
|
|
17329
18037
|
);
|
|
17330
18038
|
}),
|
|
17331
|
-
/* @__PURE__ */
|
|
18039
|
+
/* @__PURE__ */ jsx177("div", { style: { height: `${spacerHeight2}px` } })
|
|
17332
18040
|
]
|
|
17333
18041
|
}
|
|
17334
18042
|
)
|
|
@@ -17338,7 +18046,7 @@ function AirbnbSelectMobileWheel({
|
|
|
17338
18046
|
}
|
|
17339
18047
|
|
|
17340
18048
|
// src/airbnb-fields/select/SelectMobileContent.tsx
|
|
17341
|
-
import { jsx as
|
|
18049
|
+
import { jsx as jsx178, jsxs as jsxs119 } from "react/jsx-runtime";
|
|
17342
18050
|
function AirbnbSelectMobileContent({
|
|
17343
18051
|
open,
|
|
17344
18052
|
onOpenChange,
|
|
@@ -17362,11 +18070,11 @@ function AirbnbSelectMobileContent({
|
|
|
17362
18070
|
getOptionId: getOptionId2,
|
|
17363
18071
|
noOptionsMessage
|
|
17364
18072
|
}) {
|
|
17365
|
-
return /* @__PURE__ */
|
|
17366
|
-
/* @__PURE__ */
|
|
17367
|
-
/* @__PURE__ */
|
|
17368
|
-
/* @__PURE__ */
|
|
17369
|
-
/* @__PURE__ */
|
|
18073
|
+
return /* @__PURE__ */ jsx178(Drawer, { open, onOpenChange, children: /* @__PURE__ */ jsxs119(DrawerContent, { onClose, lockScroll: false, children: [
|
|
18074
|
+
/* @__PURE__ */ jsx178(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
18075
|
+
/* @__PURE__ */ jsx178(DrawerDescription, { className: "sr-only", children: label }),
|
|
18076
|
+
/* @__PURE__ */ jsxs119("div", { className: "px-6 pb-4 pt-1", children: [
|
|
18077
|
+
/* @__PURE__ */ jsx178(
|
|
17370
18078
|
AirbnbSelectMobileWheel,
|
|
17371
18079
|
{
|
|
17372
18080
|
id: listboxId,
|
|
@@ -17385,16 +18093,16 @@ function AirbnbSelectMobileContent({
|
|
|
17385
18093
|
noOptionsMessage
|
|
17386
18094
|
}
|
|
17387
18095
|
),
|
|
17388
|
-
/* @__PURE__ */
|
|
18096
|
+
/* @__PURE__ */ jsx178(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
17389
18097
|
] })
|
|
17390
18098
|
] }) });
|
|
17391
18099
|
}
|
|
17392
18100
|
|
|
17393
18101
|
// src/airbnb-fields/select/SelectTrigger.tsx
|
|
17394
|
-
import * as
|
|
18102
|
+
import * as React69 from "react";
|
|
17395
18103
|
import { ChevronDown as ChevronDown4 } from "lucide-react";
|
|
17396
|
-
import { jsx as
|
|
17397
|
-
var AirbnbSelectTrigger =
|
|
18104
|
+
import { jsx as jsx179 } from "react/jsx-runtime";
|
|
18105
|
+
var AirbnbSelectTrigger = React69.forwardRef(
|
|
17398
18106
|
({
|
|
17399
18107
|
id,
|
|
17400
18108
|
open,
|
|
@@ -17419,7 +18127,7 @@ var AirbnbSelectTrigger = React66.forwardRef(
|
|
|
17419
18127
|
onKeyDown,
|
|
17420
18128
|
onBlur
|
|
17421
18129
|
}, ref) => {
|
|
17422
|
-
return /* @__PURE__ */
|
|
18130
|
+
return /* @__PURE__ */ jsx179(
|
|
17423
18131
|
AirbnbFieldTrigger,
|
|
17424
18132
|
{
|
|
17425
18133
|
id,
|
|
@@ -17448,7 +18156,7 @@ var AirbnbSelectTrigger = React66.forwardRef(
|
|
|
17448
18156
|
onClick,
|
|
17449
18157
|
onKeyDown,
|
|
17450
18158
|
onBlur,
|
|
17451
|
-
trailingAdornment: /* @__PURE__ */
|
|
18159
|
+
trailingAdornment: /* @__PURE__ */ jsx179(
|
|
17452
18160
|
ChevronDown4,
|
|
17453
18161
|
{
|
|
17454
18162
|
className: open ? "h-6 w-6 rotate-180 text-[#1F1F1B] transition-transform" : "h-6 w-6 text-[#1F1F1B] transition-transform"
|
|
@@ -17461,7 +18169,7 @@ var AirbnbSelectTrigger = React66.forwardRef(
|
|
|
17461
18169
|
AirbnbSelectTrigger.displayName = "AirbnbSelectTrigger";
|
|
17462
18170
|
|
|
17463
18171
|
// src/airbnb-fields/select/useDesktopSelect.ts
|
|
17464
|
-
import * as
|
|
18172
|
+
import * as React70 from "react";
|
|
17465
18173
|
function useDesktopSelect({
|
|
17466
18174
|
isMobile: isMobile3,
|
|
17467
18175
|
isOpen,
|
|
@@ -17470,12 +18178,12 @@ function useDesktopSelect({
|
|
|
17470
18178
|
disabled,
|
|
17471
18179
|
onChange
|
|
17472
18180
|
}) {
|
|
17473
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
17474
|
-
const triggerRef =
|
|
17475
|
-
const listRef =
|
|
17476
|
-
const optionRefs =
|
|
18181
|
+
const [highlightedIndex, setHighlightedIndex] = React70.useState(-1);
|
|
18182
|
+
const triggerRef = React70.useRef(null);
|
|
18183
|
+
const listRef = React70.useRef(null);
|
|
18184
|
+
const optionRefs = React70.useRef([]);
|
|
17477
18185
|
const selectedIndex = getOptionIndex2(options, value);
|
|
17478
|
-
|
|
18186
|
+
React70.useEffect(() => {
|
|
17479
18187
|
if (!isOpen || isMobile3) return;
|
|
17480
18188
|
setHighlightedIndex((currentIndex) => {
|
|
17481
18189
|
if (currentIndex >= 0) {
|
|
@@ -17490,34 +18198,34 @@ function useDesktopSelect({
|
|
|
17490
18198
|
window.cancelAnimationFrame(frameId);
|
|
17491
18199
|
};
|
|
17492
18200
|
}, [isMobile3, isOpen, options, selectedIndex]);
|
|
17493
|
-
|
|
18201
|
+
React70.useEffect(() => {
|
|
17494
18202
|
if (!isOpen || isMobile3 || highlightedIndex < 0) return;
|
|
17495
18203
|
optionRefs.current[highlightedIndex]?.scrollIntoView({
|
|
17496
18204
|
block: "nearest"
|
|
17497
18205
|
});
|
|
17498
18206
|
}, [highlightedIndex, isMobile3, isOpen]);
|
|
17499
|
-
|
|
18207
|
+
React70.useEffect(() => {
|
|
17500
18208
|
if (isOpen) return;
|
|
17501
18209
|
setHighlightedIndex(-1);
|
|
17502
18210
|
}, [isOpen]);
|
|
17503
|
-
const focusTrigger =
|
|
18211
|
+
const focusTrigger = React70.useCallback(() => {
|
|
17504
18212
|
triggerRef.current?.focus();
|
|
17505
18213
|
}, []);
|
|
17506
|
-
const handleSelect =
|
|
18214
|
+
const handleSelect = React70.useCallback(
|
|
17507
18215
|
(option) => {
|
|
17508
18216
|
if (option.isDisabled || disabled) return;
|
|
17509
18217
|
onChange(option);
|
|
17510
18218
|
},
|
|
17511
18219
|
[disabled, onChange]
|
|
17512
18220
|
);
|
|
17513
|
-
const openMenu =
|
|
18221
|
+
const openMenu = React70.useCallback(
|
|
17514
18222
|
(targetIndex) => {
|
|
17515
18223
|
const fallbackIndex = selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex2(options);
|
|
17516
18224
|
setHighlightedIndex(targetIndex ?? fallbackIndex);
|
|
17517
18225
|
},
|
|
17518
18226
|
[options, selectedIndex]
|
|
17519
18227
|
);
|
|
17520
|
-
const handleTriggerKeyDown =
|
|
18228
|
+
const handleTriggerKeyDown = React70.useCallback(
|
|
17521
18229
|
(event, onOpen) => {
|
|
17522
18230
|
if (disabled) return;
|
|
17523
18231
|
if (event.key === "ArrowDown") {
|
|
@@ -17542,7 +18250,7 @@ function useDesktopSelect({
|
|
|
17542
18250
|
},
|
|
17543
18251
|
[disabled, openMenu, options, selectedIndex]
|
|
17544
18252
|
);
|
|
17545
|
-
const handleMenuKeyDown =
|
|
18253
|
+
const handleMenuKeyDown = React70.useCallback(
|
|
17546
18254
|
(event, onClose) => {
|
|
17547
18255
|
if (event.key === "Escape") {
|
|
17548
18256
|
event.preventDefault();
|
|
@@ -17592,7 +18300,7 @@ function useDesktopSelect({
|
|
|
17592
18300
|
},
|
|
17593
18301
|
[focusTrigger, highlightedIndex, onChange, options]
|
|
17594
18302
|
);
|
|
17595
|
-
const setOptionRef =
|
|
18303
|
+
const setOptionRef = React70.useCallback(
|
|
17596
18304
|
(index, node) => {
|
|
17597
18305
|
optionRefs.current[index] = node;
|
|
17598
18306
|
},
|
|
@@ -17612,23 +18320,23 @@ function useDesktopSelect({
|
|
|
17612
18320
|
}
|
|
17613
18321
|
|
|
17614
18322
|
// src/airbnb-fields/select/useMobileSelectWheel.ts
|
|
17615
|
-
import * as
|
|
18323
|
+
import * as React71 from "react";
|
|
17616
18324
|
function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, disabled }) {
|
|
17617
|
-
const [pendingValue, setPendingValue] =
|
|
18325
|
+
const [pendingValue, setPendingValue] = React71.useState(
|
|
17618
18326
|
value ?? null
|
|
17619
18327
|
);
|
|
17620
|
-
const [mobileScrollTop, setMobileScrollTop] =
|
|
17621
|
-
const mobileListRef =
|
|
17622
|
-
const scrollSettleTimeoutRef =
|
|
17623
|
-
const scrollAnimationFrameRef =
|
|
17624
|
-
const getTargetIndex =
|
|
18328
|
+
const [mobileScrollTop, setMobileScrollTop] = React71.useState(0);
|
|
18329
|
+
const mobileListRef = React71.useRef(null);
|
|
18330
|
+
const scrollSettleTimeoutRef = React71.useRef(null);
|
|
18331
|
+
const scrollAnimationFrameRef = React71.useRef(null);
|
|
18332
|
+
const getTargetIndex = React71.useCallback(
|
|
17625
18333
|
(targetValue) => {
|
|
17626
18334
|
const selectedIndex = getOptionIndex2(options, targetValue);
|
|
17627
18335
|
return selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex2(options);
|
|
17628
18336
|
},
|
|
17629
18337
|
[options]
|
|
17630
18338
|
);
|
|
17631
|
-
const syncScrollPosition =
|
|
18339
|
+
const syncScrollPosition = React71.useCallback(
|
|
17632
18340
|
(targetValue, behavior = "instant") => {
|
|
17633
18341
|
const targetIndex = getTargetIndex(targetValue);
|
|
17634
18342
|
if (targetIndex < 0) return;
|
|
@@ -17647,27 +18355,27 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
17647
18355
|
},
|
|
17648
18356
|
[getTargetIndex, options]
|
|
17649
18357
|
);
|
|
17650
|
-
const clearScrollSettleTimeout =
|
|
18358
|
+
const clearScrollSettleTimeout = React71.useCallback(() => {
|
|
17651
18359
|
if (scrollSettleTimeoutRef.current === null) return;
|
|
17652
18360
|
window.clearTimeout(scrollSettleTimeoutRef.current);
|
|
17653
18361
|
scrollSettleTimeoutRef.current = null;
|
|
17654
18362
|
}, []);
|
|
17655
|
-
const clearScrollAnimationFrame =
|
|
18363
|
+
const clearScrollAnimationFrame = React71.useCallback(() => {
|
|
17656
18364
|
if (scrollAnimationFrameRef.current === null) return;
|
|
17657
18365
|
window.cancelAnimationFrame(scrollAnimationFrameRef.current);
|
|
17658
18366
|
scrollAnimationFrameRef.current = null;
|
|
17659
18367
|
}, []);
|
|
17660
|
-
|
|
18368
|
+
React71.useEffect(
|
|
17661
18369
|
() => () => {
|
|
17662
18370
|
clearScrollSettleTimeout();
|
|
17663
18371
|
clearScrollAnimationFrame();
|
|
17664
18372
|
},
|
|
17665
18373
|
[clearScrollAnimationFrame, clearScrollSettleTimeout]
|
|
17666
18374
|
);
|
|
17667
|
-
|
|
18375
|
+
React71.useEffect(() => {
|
|
17668
18376
|
setPendingValue(value ?? null);
|
|
17669
18377
|
}, [value]);
|
|
17670
|
-
|
|
18378
|
+
React71.useLayoutEffect(() => {
|
|
17671
18379
|
if (!isMobile3 || !isOpen) return;
|
|
17672
18380
|
const frameId = window.requestAnimationFrame(() => {
|
|
17673
18381
|
syncScrollPosition(value ?? null, "instant");
|
|
@@ -17676,7 +18384,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
17676
18384
|
window.cancelAnimationFrame(frameId);
|
|
17677
18385
|
};
|
|
17678
18386
|
}, [isMobile3, isOpen, syncScrollPosition, value]);
|
|
17679
|
-
const settleScroll =
|
|
18387
|
+
const settleScroll = React71.useCallback(() => {
|
|
17680
18388
|
if (!mobileListRef.current) return;
|
|
17681
18389
|
const nextIndex = Math.round(mobileListRef.current.scrollTop / MOBILE_OPTION_HEIGHT);
|
|
17682
18390
|
const nextOption = options[nextIndex];
|
|
@@ -17688,13 +18396,13 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
17688
18396
|
}
|
|
17689
18397
|
setPendingValue(nextOption);
|
|
17690
18398
|
}, [options, pendingValue]);
|
|
17691
|
-
const scheduleScrollSettle =
|
|
18399
|
+
const scheduleScrollSettle = React71.useCallback(() => {
|
|
17692
18400
|
clearScrollSettleTimeout();
|
|
17693
18401
|
scrollSettleTimeoutRef.current = window.setTimeout(() => {
|
|
17694
18402
|
settleScroll();
|
|
17695
18403
|
}, MOBILE_SCROLL_SETTLE_DELAY);
|
|
17696
18404
|
}, [clearScrollSettleTimeout, settleScroll]);
|
|
17697
|
-
const handleScroll =
|
|
18405
|
+
const handleScroll = React71.useCallback(() => {
|
|
17698
18406
|
if (!mobileListRef.current) return;
|
|
17699
18407
|
const nextScrollTop = mobileListRef.current.scrollTop;
|
|
17700
18408
|
clearScrollAnimationFrame();
|
|
@@ -17704,7 +18412,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
17704
18412
|
});
|
|
17705
18413
|
scheduleScrollSettle();
|
|
17706
18414
|
}, [clearScrollAnimationFrame, scheduleScrollSettle]);
|
|
17707
|
-
const focusOptionByIndex =
|
|
18415
|
+
const focusOptionByIndex = React71.useCallback(
|
|
17708
18416
|
(index, behavior = "instant", updatePendingImmediately = behavior === "instant") => {
|
|
17709
18417
|
if (!mobileListRef.current || index < 0 || index >= options.length) return;
|
|
17710
18418
|
const option = options[index];
|
|
@@ -17722,7 +18430,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
17722
18430
|
},
|
|
17723
18431
|
[options, scheduleScrollSettle]
|
|
17724
18432
|
);
|
|
17725
|
-
const handleOptionClick =
|
|
18433
|
+
const handleOptionClick = React71.useCallback(
|
|
17726
18434
|
(option) => {
|
|
17727
18435
|
if (!mobileListRef.current || disabled || option.isDisabled) return;
|
|
17728
18436
|
const optionIndex = getOptionIndex2(options, option);
|
|
@@ -17731,7 +18439,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
17731
18439
|
},
|
|
17732
18440
|
[disabled, focusOptionByIndex, options]
|
|
17733
18441
|
);
|
|
17734
|
-
const moveByStep =
|
|
18442
|
+
const moveByStep = React71.useCallback(
|
|
17735
18443
|
(step) => {
|
|
17736
18444
|
const currentIndex = getOptionIndex2(options, pendingValue);
|
|
17737
18445
|
const fallbackIndex = step === 1 ? getFirstEnabledOptionIndex2(options) : getLastEnabledOptionIndex2(options);
|
|
@@ -17743,7 +18451,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
17743
18451
|
},
|
|
17744
18452
|
[focusOptionByIndex, options, pendingValue]
|
|
17745
18453
|
);
|
|
17746
|
-
const moveToBoundary =
|
|
18454
|
+
const moveToBoundary = React71.useCallback(
|
|
17747
18455
|
(boundary) => {
|
|
17748
18456
|
const targetIndex = boundary === "start" ? getFirstEnabledOptionIndex2(options) : getLastEnabledOptionIndex2(options);
|
|
17749
18457
|
if (targetIndex >= 0) {
|
|
@@ -17752,7 +18460,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
17752
18460
|
},
|
|
17753
18461
|
[focusOptionByIndex, options]
|
|
17754
18462
|
);
|
|
17755
|
-
const syncPendingValue =
|
|
18463
|
+
const syncPendingValue = React71.useCallback(
|
|
17756
18464
|
(nextValue) => {
|
|
17757
18465
|
const normalizedValue = nextValue ?? null;
|
|
17758
18466
|
const matchedIndex = getOptionIndex2(options, normalizedValue);
|
|
@@ -17780,9 +18488,9 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
17780
18488
|
}
|
|
17781
18489
|
|
|
17782
18490
|
// src/airbnb-fields/select/useSelectIds.ts
|
|
17783
|
-
import * as
|
|
18491
|
+
import * as React72 from "react";
|
|
17784
18492
|
function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
17785
|
-
const reactId =
|
|
18493
|
+
const reactId = React72.useId().replace(/:/g, "");
|
|
17786
18494
|
const baseId = name ? `select-${name}` : `select-${reactId}`;
|
|
17787
18495
|
const triggerId = `${baseId}-trigger`;
|
|
17788
18496
|
const labelId = `${baseId}-label`;
|
|
@@ -17792,7 +18500,7 @@ function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
|
17792
18500
|
const listboxId = `${baseId}-listbox`;
|
|
17793
18501
|
const describedErrorId = error && !hideErrorMessage ? errorId : void 0;
|
|
17794
18502
|
const describedBy = [!hasValue ? helperTextId : null, describedErrorId].filter(Boolean).join(" ") || void 0;
|
|
17795
|
-
const getOptionId2 =
|
|
18503
|
+
const getOptionId2 = React72.useCallback(
|
|
17796
18504
|
(index) => `${baseId}-option-${index}`,
|
|
17797
18505
|
[baseId]
|
|
17798
18506
|
);
|
|
@@ -17810,8 +18518,8 @@ function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
|
17810
18518
|
}
|
|
17811
18519
|
|
|
17812
18520
|
// src/airbnb-fields/select/Select.tsx
|
|
17813
|
-
import { jsx as
|
|
17814
|
-
var AirbnbSelect =
|
|
18521
|
+
import { jsx as jsx180, jsxs as jsxs120 } from "react/jsx-runtime";
|
|
18522
|
+
var AirbnbSelect = React73.forwardRef(function AirbnbSelect2({
|
|
17815
18523
|
options = [],
|
|
17816
18524
|
value,
|
|
17817
18525
|
onChange,
|
|
@@ -17838,8 +18546,8 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17838
18546
|
noOptionsMessage
|
|
17839
18547
|
}, ref) {
|
|
17840
18548
|
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
17841
|
-
const [isOpen, setIsOpen] =
|
|
17842
|
-
const containerRef =
|
|
18549
|
+
const [isOpen, setIsOpen] = React73.useState(false);
|
|
18550
|
+
const containerRef = React73.useRef(null);
|
|
17843
18551
|
const hasValue = Boolean(value);
|
|
17844
18552
|
const helperText = placeholder ?? label;
|
|
17845
18553
|
const shouldDescribeHelperText = !hasValue && helperText !== label;
|
|
@@ -17900,12 +18608,12 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17900
18608
|
onOutsideClick: () => setIsOpen(false),
|
|
17901
18609
|
isDisabled: !isOpen || isMobile3
|
|
17902
18610
|
});
|
|
17903
|
-
|
|
18611
|
+
React73.useEffect(() => {
|
|
17904
18612
|
if (isBlocked) {
|
|
17905
18613
|
setIsOpen(false);
|
|
17906
18614
|
}
|
|
17907
18615
|
}, [isBlocked]);
|
|
17908
|
-
|
|
18616
|
+
React73.useEffect(
|
|
17909
18617
|
function setCorrectOptionIfThereIsOnlyValue() {
|
|
17910
18618
|
if (value?.value === void 0 || value.value === null || value.label !== "") {
|
|
17911
18619
|
return;
|
|
@@ -17917,7 +18625,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17917
18625
|
},
|
|
17918
18626
|
[onChange, options, value]
|
|
17919
18627
|
);
|
|
17920
|
-
const handleMobileOpenChange =
|
|
18628
|
+
const handleMobileOpenChange = React73.useCallback(
|
|
17921
18629
|
(nextOpen) => {
|
|
17922
18630
|
if (isBlocked && nextOpen) return;
|
|
17923
18631
|
setIsOpen(nextOpen);
|
|
@@ -17928,7 +18636,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17928
18636
|
},
|
|
17929
18637
|
[focusTrigger, isBlocked, syncPendingValue, value]
|
|
17930
18638
|
);
|
|
17931
|
-
const handleMobileDone =
|
|
18639
|
+
const handleMobileDone = React73.useCallback(() => {
|
|
17932
18640
|
if (isBlocked) return;
|
|
17933
18641
|
const finalOption = pendingValue;
|
|
17934
18642
|
if (finalOption && finalOption.value !== value?.value) {
|
|
@@ -17937,7 +18645,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17937
18645
|
setIsOpen(false);
|
|
17938
18646
|
focusTrigger();
|
|
17939
18647
|
}, [focusTrigger, isBlocked, onChange, pendingValue, value]);
|
|
17940
|
-
const handleTriggerClick =
|
|
18648
|
+
const handleTriggerClick = React73.useCallback(() => {
|
|
17941
18649
|
if (isBlocked) return;
|
|
17942
18650
|
setIsOpen((prev) => {
|
|
17943
18651
|
const nextOpen = !prev;
|
|
@@ -17990,13 +18698,13 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17990
18698
|
handleMobileOpenChange(false);
|
|
17991
18699
|
}
|
|
17992
18700
|
};
|
|
17993
|
-
return /* @__PURE__ */
|
|
18701
|
+
return /* @__PURE__ */ jsxs120(
|
|
17994
18702
|
"div",
|
|
17995
18703
|
{
|
|
17996
18704
|
ref: containerRef,
|
|
17997
18705
|
className: cn("relative w-full max-w-[var(--max-field-width)]", className),
|
|
17998
18706
|
children: [
|
|
17999
|
-
name && /* @__PURE__ */
|
|
18707
|
+
name && /* @__PURE__ */ jsx180("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
18000
18708
|
renderTrigger ? renderTrigger({
|
|
18001
18709
|
id: triggerId,
|
|
18002
18710
|
open: isOpen,
|
|
@@ -18018,7 +18726,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
18018
18726
|
onClick: handleTriggerClick,
|
|
18019
18727
|
onKeyDown: handleRootTriggerKeyDown,
|
|
18020
18728
|
onBlur
|
|
18021
|
-
}) : /* @__PURE__ */
|
|
18729
|
+
}) : /* @__PURE__ */ jsx180(
|
|
18022
18730
|
AirbnbSelectTrigger,
|
|
18023
18731
|
{
|
|
18024
18732
|
id: triggerId,
|
|
@@ -18046,7 +18754,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
18046
18754
|
onBlur
|
|
18047
18755
|
}
|
|
18048
18756
|
),
|
|
18049
|
-
isMobile3 ? /* @__PURE__ */
|
|
18757
|
+
isMobile3 ? /* @__PURE__ */ jsx180(
|
|
18050
18758
|
AirbnbSelectMobileContent,
|
|
18051
18759
|
{
|
|
18052
18760
|
open: isOpen,
|
|
@@ -18071,7 +18779,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
18071
18779
|
getOptionId: getOptionId2,
|
|
18072
18780
|
noOptionsMessage
|
|
18073
18781
|
}
|
|
18074
|
-
) : /* @__PURE__ */
|
|
18782
|
+
) : /* @__PURE__ */ jsx180(
|
|
18075
18783
|
AirbnbSelectDesktopContent,
|
|
18076
18784
|
{
|
|
18077
18785
|
isOpen,
|
|
@@ -18105,13 +18813,13 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
18105
18813
|
});
|
|
18106
18814
|
|
|
18107
18815
|
// src/airbnb-fields/phone-field/PhoneField.tsx
|
|
18108
|
-
import { jsx as
|
|
18109
|
-
function
|
|
18816
|
+
import { jsx as jsx181, jsxs as jsxs121 } from "react/jsx-runtime";
|
|
18817
|
+
function formatPhoneCodeOptionLabel2(option) {
|
|
18110
18818
|
const label = String(option.label);
|
|
18111
18819
|
const value = String(option.value);
|
|
18112
18820
|
return label.includes(value) ? label : `${label} (${value})`;
|
|
18113
18821
|
}
|
|
18114
|
-
var AirbnbPhoneField =
|
|
18822
|
+
var AirbnbPhoneField = React74.forwardRef(
|
|
18115
18823
|
({
|
|
18116
18824
|
variant = "default",
|
|
18117
18825
|
label,
|
|
@@ -18135,16 +18843,16 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
18135
18843
|
mobileTitle,
|
|
18136
18844
|
codePlaceholder = "+00"
|
|
18137
18845
|
}, ref) => {
|
|
18138
|
-
const inputId =
|
|
18139
|
-
const codeOptions =
|
|
18846
|
+
const inputId = React74.useId();
|
|
18847
|
+
const codeOptions = React74.useMemo(
|
|
18140
18848
|
() => options.map((option) => ({
|
|
18141
18849
|
value: option.value,
|
|
18142
|
-
label:
|
|
18850
|
+
label: formatPhoneCodeOptionLabel2(option),
|
|
18143
18851
|
disabled: option.disabled
|
|
18144
18852
|
})),
|
|
18145
18853
|
[options]
|
|
18146
18854
|
);
|
|
18147
|
-
const selectedCodeOption =
|
|
18855
|
+
const selectedCodeOption = React74.useMemo(
|
|
18148
18856
|
() => codeOptions.find((option) => option.value === value?.code) ?? null,
|
|
18149
18857
|
[codeOptions, value?.code]
|
|
18150
18858
|
);
|
|
@@ -18152,9 +18860,9 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
18152
18860
|
const hasInvalidState = Boolean(error) || Boolean(invalid);
|
|
18153
18861
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
18154
18862
|
const isCodeBlocked = isBlocked || Boolean(codeReadOnly);
|
|
18155
|
-
return /* @__PURE__ */
|
|
18156
|
-
name && /* @__PURE__ */
|
|
18157
|
-
codeName && /* @__PURE__ */
|
|
18863
|
+
return /* @__PURE__ */ jsxs121("div", { className: cn("w-full max-w-[var(--max-field-width)]", className), children: [
|
|
18864
|
+
name && /* @__PURE__ */ jsx181("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
18865
|
+
codeName && /* @__PURE__ */ jsx181(
|
|
18158
18866
|
"input",
|
|
18159
18867
|
{
|
|
18160
18868
|
type: "hidden",
|
|
@@ -18163,7 +18871,7 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
18163
18871
|
disabled
|
|
18164
18872
|
}
|
|
18165
18873
|
),
|
|
18166
|
-
numberName && /* @__PURE__ */
|
|
18874
|
+
numberName && /* @__PURE__ */ jsx181(
|
|
18167
18875
|
"input",
|
|
18168
18876
|
{
|
|
18169
18877
|
type: "hidden",
|
|
@@ -18172,7 +18880,7 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
18172
18880
|
disabled
|
|
18173
18881
|
}
|
|
18174
18882
|
),
|
|
18175
|
-
topLabel && /* @__PURE__ */
|
|
18883
|
+
topLabel && /* @__PURE__ */ jsx181(
|
|
18176
18884
|
"label",
|
|
18177
18885
|
{
|
|
18178
18886
|
htmlFor: inputId,
|
|
@@ -18180,8 +18888,8 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
18180
18888
|
children: topLabel
|
|
18181
18889
|
}
|
|
18182
18890
|
),
|
|
18183
|
-
/* @__PURE__ */
|
|
18184
|
-
/* @__PURE__ */
|
|
18891
|
+
/* @__PURE__ */ jsxs121("div", { className: "flex items-stretch", children: [
|
|
18892
|
+
/* @__PURE__ */ jsx181(
|
|
18185
18893
|
AirbnbSelect,
|
|
18186
18894
|
{
|
|
18187
18895
|
ref,
|
|
@@ -18212,7 +18920,7 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
18212
18920
|
onClick,
|
|
18213
18921
|
onKeyDown,
|
|
18214
18922
|
valueLabel
|
|
18215
|
-
}) => /* @__PURE__ */
|
|
18923
|
+
}) => /* @__PURE__ */ jsxs121(
|
|
18216
18924
|
"button",
|
|
18217
18925
|
{
|
|
18218
18926
|
id,
|
|
@@ -18234,8 +18942,8 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
18234
18942
|
triggerDisabled ? "cursor-not-allowed opacity-50" : triggerLoading ? "cursor-progress" : "cursor-pointer"
|
|
18235
18943
|
),
|
|
18236
18944
|
children: [
|
|
18237
|
-
/* @__PURE__ */
|
|
18238
|
-
/* @__PURE__ */
|
|
18945
|
+
/* @__PURE__ */ jsx181("span", { children: valueLabel ?? codePlaceholder }),
|
|
18946
|
+
/* @__PURE__ */ jsx181(
|
|
18239
18947
|
ChevronDown5,
|
|
18240
18948
|
{
|
|
18241
18949
|
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
@@ -18247,7 +18955,7 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
18247
18955
|
)
|
|
18248
18956
|
}
|
|
18249
18957
|
),
|
|
18250
|
-
/* @__PURE__ */
|
|
18958
|
+
/* @__PURE__ */ jsx181(
|
|
18251
18959
|
AirbnbInput,
|
|
18252
18960
|
{
|
|
18253
18961
|
id: inputId,
|
|
@@ -18279,18 +18987,18 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
18279
18987
|
}
|
|
18280
18988
|
)
|
|
18281
18989
|
] }),
|
|
18282
|
-
error && /* @__PURE__ */
|
|
18990
|
+
error && /* @__PURE__ */ jsx181(FieldErrorMessage, { message: error })
|
|
18283
18991
|
] });
|
|
18284
18992
|
}
|
|
18285
18993
|
);
|
|
18286
18994
|
AirbnbPhoneField.displayName = "AirbnbPhoneField";
|
|
18287
18995
|
|
|
18288
18996
|
// src/airbnb-fields/searchable-select/SearchableSelect.tsx
|
|
18289
|
-
import * as
|
|
18290
|
-
import { ChevronDown as ChevronDown6, Search as
|
|
18997
|
+
import * as React75 from "react";
|
|
18998
|
+
import { ChevronDown as ChevronDown6, Search as Search4 } from "lucide-react";
|
|
18291
18999
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
18292
|
-
import { useCallback as
|
|
18293
|
-
import { jsx as
|
|
19000
|
+
import { useCallback as useCallback54 } from "react";
|
|
19001
|
+
import { jsx as jsx182, jsxs as jsxs122 } from "react/jsx-runtime";
|
|
18294
19002
|
var ROW_HEIGHT = 48;
|
|
18295
19003
|
var DESKTOP_LIST_HEIGHT = 280;
|
|
18296
19004
|
var MOBILE_LIST_HEIGHT = 420;
|
|
@@ -18331,13 +19039,13 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18331
19039
|
loadingMessage
|
|
18332
19040
|
}, ref) => {
|
|
18333
19041
|
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
18334
|
-
const reactId =
|
|
18335
|
-
const [open, setOpen] =
|
|
18336
|
-
const [internalSearchValue, setInternalSearchValue] =
|
|
18337
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
18338
|
-
const containerRef =
|
|
18339
|
-
const triggerRef =
|
|
18340
|
-
const inputRef =
|
|
19042
|
+
const reactId = React75.useId();
|
|
19043
|
+
const [open, setOpen] = React75.useState(false);
|
|
19044
|
+
const [internalSearchValue, setInternalSearchValue] = React75.useState("");
|
|
19045
|
+
const [highlightedIndex, setHighlightedIndex] = React75.useState(-1);
|
|
19046
|
+
const containerRef = React75.useRef(null);
|
|
19047
|
+
const triggerRef = React75.useRef(null);
|
|
19048
|
+
const inputRef = React75.useRef(null);
|
|
18341
19049
|
const listboxId = `${reactId}-listbox`;
|
|
18342
19050
|
const labelId = `${reactId}-label`;
|
|
18343
19051
|
const valueId = `${reactId}-value`;
|
|
@@ -18346,13 +19054,13 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18346
19054
|
const searchInputId = `${reactId}-search`;
|
|
18347
19055
|
const effectiveSearchValue = searchValue ?? internalSearchValue;
|
|
18348
19056
|
const shouldFilterLocally = !onSearchChange && filterOption !== null;
|
|
18349
|
-
const visibleOptions =
|
|
19057
|
+
const visibleOptions = React75.useMemo(() => {
|
|
18350
19058
|
if (!shouldFilterLocally || !effectiveSearchValue) {
|
|
18351
19059
|
return options;
|
|
18352
19060
|
}
|
|
18353
19061
|
return options.filter((option) => filterOption(option, effectiveSearchValue));
|
|
18354
19062
|
}, [effectiveSearchValue, filterOption, options, shouldFilterLocally]);
|
|
18355
|
-
const selectedIndex =
|
|
19063
|
+
const selectedIndex = React75.useMemo(
|
|
18356
19064
|
() => visibleOptions.findIndex((option) => option.value === value?.value),
|
|
18357
19065
|
[value?.value, visibleOptions]
|
|
18358
19066
|
);
|
|
@@ -18368,7 +19076,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18368
19076
|
isDisabled: !open || isMobile3
|
|
18369
19077
|
});
|
|
18370
19078
|
const handleOnOpenChange = useEvent(onOpenChange);
|
|
18371
|
-
const setSelectOpen =
|
|
19079
|
+
const setSelectOpen = useCallback54(
|
|
18372
19080
|
(nextOpen, options2) => {
|
|
18373
19081
|
setOpen(nextOpen);
|
|
18374
19082
|
handleOnOpenChange?.(nextOpen);
|
|
@@ -18378,7 +19086,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18378
19086
|
},
|
|
18379
19087
|
[handleOnOpenChange]
|
|
18380
19088
|
);
|
|
18381
|
-
|
|
19089
|
+
React75.useEffect(() => {
|
|
18382
19090
|
if (isBlocked) {
|
|
18383
19091
|
setSelectOpen(false);
|
|
18384
19092
|
return;
|
|
@@ -18391,7 +19099,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18391
19099
|
window.cancelAnimationFrame(frameId);
|
|
18392
19100
|
};
|
|
18393
19101
|
}, [isBlocked, open, setSelectOpen]);
|
|
18394
|
-
|
|
19102
|
+
React75.useEffect(() => {
|
|
18395
19103
|
if (!open) {
|
|
18396
19104
|
setHighlightedIndex(-1);
|
|
18397
19105
|
return;
|
|
@@ -18459,7 +19167,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18459
19167
|
}
|
|
18460
19168
|
}
|
|
18461
19169
|
}
|
|
18462
|
-
const content = /* @__PURE__ */
|
|
19170
|
+
const content = /* @__PURE__ */ jsx182(
|
|
18463
19171
|
AirbnbSearchableSelectContent,
|
|
18464
19172
|
{
|
|
18465
19173
|
inputId: searchInputId,
|
|
@@ -18486,10 +19194,10 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18486
19194
|
onOptionHover: setHighlightedIndex
|
|
18487
19195
|
}
|
|
18488
19196
|
);
|
|
18489
|
-
|
|
18490
|
-
return /* @__PURE__ */
|
|
18491
|
-
name && /* @__PURE__ */
|
|
18492
|
-
/* @__PURE__ */
|
|
19197
|
+
React75.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
19198
|
+
return /* @__PURE__ */ jsxs122("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
|
|
19199
|
+
name && /* @__PURE__ */ jsx182("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
19200
|
+
/* @__PURE__ */ jsx182(
|
|
18493
19201
|
AirbnbFieldTrigger,
|
|
18494
19202
|
{
|
|
18495
19203
|
id: `${reactId}-trigger`,
|
|
@@ -18524,7 +19232,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18524
19232
|
},
|
|
18525
19233
|
onKeyDown: handleTriggerKeyDown,
|
|
18526
19234
|
onBlur,
|
|
18527
|
-
trailingAdornment: /* @__PURE__ */
|
|
19235
|
+
trailingAdornment: /* @__PURE__ */ jsx182(
|
|
18528
19236
|
ChevronDown6,
|
|
18529
19237
|
{
|
|
18530
19238
|
className: cn(
|
|
@@ -18535,7 +19243,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18535
19243
|
)
|
|
18536
19244
|
}
|
|
18537
19245
|
),
|
|
18538
|
-
isMobile3 ? /* @__PURE__ */
|
|
19246
|
+
isMobile3 ? /* @__PURE__ */ jsx182(
|
|
18539
19247
|
Drawer,
|
|
18540
19248
|
{
|
|
18541
19249
|
open,
|
|
@@ -18547,13 +19255,13 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18547
19255
|
}
|
|
18548
19256
|
closeSelect();
|
|
18549
19257
|
},
|
|
18550
|
-
children: /* @__PURE__ */
|
|
18551
|
-
/* @__PURE__ */
|
|
18552
|
-
/* @__PURE__ */
|
|
18553
|
-
/* @__PURE__ */
|
|
19258
|
+
children: /* @__PURE__ */ jsxs122(DrawerContent, { onClose: closeSelect, lockScroll: false, children: [
|
|
19259
|
+
/* @__PURE__ */ jsx182(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
19260
|
+
/* @__PURE__ */ jsx182(DrawerDescription, { className: "sr-only", children: label }),
|
|
19261
|
+
/* @__PURE__ */ jsx182("div", { className: "px-5 pb-5 pt-1", children: content })
|
|
18554
19262
|
] })
|
|
18555
19263
|
}
|
|
18556
|
-
) : open ? /* @__PURE__ */
|
|
19264
|
+
) : open ? /* @__PURE__ */ jsx182(
|
|
18557
19265
|
"div",
|
|
18558
19266
|
{
|
|
18559
19267
|
className: cn(
|
|
@@ -18565,7 +19273,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18565
19273
|
) : null
|
|
18566
19274
|
] });
|
|
18567
19275
|
};
|
|
18568
|
-
var AirbnbSearchableSelect =
|
|
19276
|
+
var AirbnbSearchableSelect = React75.forwardRef(
|
|
18569
19277
|
AirbnbSearchableSelectInternal
|
|
18570
19278
|
);
|
|
18571
19279
|
function AirbnbSearchableSelectContent({
|
|
@@ -18592,9 +19300,9 @@ function AirbnbSearchableSelectContent({
|
|
|
18592
19300
|
onOptionClick,
|
|
18593
19301
|
onOptionHover
|
|
18594
19302
|
}) {
|
|
18595
|
-
const listRef =
|
|
18596
|
-
const lastLoadMoreOptionsLengthRef =
|
|
18597
|
-
const previousHighlightedIndexRef =
|
|
19303
|
+
const listRef = React75.useRef(null);
|
|
19304
|
+
const lastLoadMoreOptionsLengthRef = React75.useRef(null);
|
|
19305
|
+
const previousHighlightedIndexRef = React75.useRef(highlightedIndex);
|
|
18598
19306
|
const rowCount = options.length + (loading && options.length > 0 ? 1 : 0);
|
|
18599
19307
|
const virtualizer = useVirtualizer3({
|
|
18600
19308
|
count: rowCount,
|
|
@@ -18605,7 +19313,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18605
19313
|
const virtualItems = virtualizer.getVirtualItems();
|
|
18606
19314
|
const emptyMessage = noOptionsMessage?.() ?? "No matches found";
|
|
18607
19315
|
const loadingText = loadingMessage?.() ?? "Loading...";
|
|
18608
|
-
|
|
19316
|
+
React75.useEffect(() => {
|
|
18609
19317
|
const lastItem = virtualItems[virtualItems.length - 1];
|
|
18610
19318
|
const shouldLoadMore = !!lastItem && hasNextPage && !loading && lastItem.index >= options.length - LOAD_MORE_THRESHOLD;
|
|
18611
19319
|
if (shouldLoadMore && lastLoadMoreOptionsLengthRef.current !== options.length) {
|
|
@@ -18613,23 +19321,23 @@ function AirbnbSearchableSelectContent({
|
|
|
18613
19321
|
onLoadMore?.();
|
|
18614
19322
|
}
|
|
18615
19323
|
}, [hasNextPage, loading, onLoadMore, options.length, virtualItems]);
|
|
18616
|
-
|
|
19324
|
+
React75.useEffect(() => {
|
|
18617
19325
|
const hasHighlightedIndexChanged = previousHighlightedIndexRef.current !== highlightedIndex;
|
|
18618
19326
|
previousHighlightedIndexRef.current = highlightedIndex;
|
|
18619
19327
|
if (highlightedIndex >= 0 && hasHighlightedIndexChanged) {
|
|
18620
19328
|
virtualizer.scrollToIndex(highlightedIndex, { align: "auto" });
|
|
18621
19329
|
}
|
|
18622
19330
|
}, [highlightedIndex, virtualizer]);
|
|
18623
|
-
return /* @__PURE__ */
|
|
18624
|
-
/* @__PURE__ */
|
|
18625
|
-
/* @__PURE__ */
|
|
18626
|
-
|
|
19331
|
+
return /* @__PURE__ */ jsxs122("div", { className: "p-2", children: [
|
|
19332
|
+
/* @__PURE__ */ jsxs122("div", { className: "relative mb-2", children: [
|
|
19333
|
+
/* @__PURE__ */ jsx182(
|
|
19334
|
+
Search4,
|
|
18627
19335
|
{
|
|
18628
19336
|
"aria-hidden": "true",
|
|
18629
19337
|
className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 text-[#9696B9]"
|
|
18630
19338
|
}
|
|
18631
19339
|
),
|
|
18632
|
-
/* @__PURE__ */
|
|
19340
|
+
/* @__PURE__ */ jsx182(
|
|
18633
19341
|
"input",
|
|
18634
19342
|
{
|
|
18635
19343
|
id: inputId,
|
|
@@ -18648,7 +19356,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18648
19356
|
}
|
|
18649
19357
|
)
|
|
18650
19358
|
] }),
|
|
18651
|
-
loading && options.length === 0 ? /* @__PURE__ */
|
|
19359
|
+
loading && options.length === 0 ? /* @__PURE__ */ jsx182("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: loadingText }) : options.length === 0 ? /* @__PURE__ */ jsx182("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : /* @__PURE__ */ jsx182(
|
|
18652
19360
|
"div",
|
|
18653
19361
|
{
|
|
18654
19362
|
id: listboxId,
|
|
@@ -18657,7 +19365,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18657
19365
|
"aria-labelledby": labelId,
|
|
18658
19366
|
className: cn("overflow-y-auto outline-none", menuClassName),
|
|
18659
19367
|
style: { height: Math.min(height, rowCount * ROW_HEIGHT) },
|
|
18660
|
-
children: /* @__PURE__ */
|
|
19368
|
+
children: /* @__PURE__ */ jsx182(
|
|
18661
19369
|
"div",
|
|
18662
19370
|
{
|
|
18663
19371
|
className: "relative w-full",
|
|
@@ -18665,7 +19373,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18665
19373
|
children: virtualItems.map((virtualItem) => {
|
|
18666
19374
|
const option = options[virtualItem.index];
|
|
18667
19375
|
if (!option) {
|
|
18668
|
-
return /* @__PURE__ */
|
|
19376
|
+
return /* @__PURE__ */ jsx182(
|
|
18669
19377
|
"div",
|
|
18670
19378
|
{
|
|
18671
19379
|
className: "absolute left-0 top-0 flex w-full items-center px-4 text-base leading-6 text-[#6C6C6C]",
|
|
@@ -18680,7 +19388,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18680
19388
|
}
|
|
18681
19389
|
const isSelected = value?.value === option.value;
|
|
18682
19390
|
const isHighlighted = virtualItem.index === highlightedIndex;
|
|
18683
|
-
return /* @__PURE__ */
|
|
19391
|
+
return /* @__PURE__ */ jsx182(
|
|
18684
19392
|
"button",
|
|
18685
19393
|
{
|
|
18686
19394
|
id: getOptionId(idPrefix, virtualItem.index),
|
|
@@ -18702,7 +19410,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18702
19410
|
height: `${virtualItem.size}px`,
|
|
18703
19411
|
transform: `translateY(${virtualItem.start}px)`
|
|
18704
19412
|
},
|
|
18705
|
-
children: /* @__PURE__ */
|
|
19413
|
+
children: /* @__PURE__ */ jsx182("span", { className: "truncate text-center", children: String(option.label) })
|
|
18706
19414
|
},
|
|
18707
19415
|
`${String(option.value)}-${virtualItem.index}`
|
|
18708
19416
|
);
|
|
@@ -18731,16 +19439,16 @@ function getNextEnabledIndex(options, startIndex, step) {
|
|
|
18731
19439
|
}
|
|
18732
19440
|
|
|
18733
19441
|
// src/airbnb-fields/search-input/SearchInput.tsx
|
|
18734
|
-
import * as
|
|
18735
|
-
import { useTranslation as
|
|
18736
|
-
import { Search as
|
|
18737
|
-
import { jsx as
|
|
18738
|
-
var AirbnbSearchInput =
|
|
18739
|
-
const { t } =
|
|
19442
|
+
import * as React76 from "react";
|
|
19443
|
+
import { useTranslation as useTranslation42 } from "react-i18next";
|
|
19444
|
+
import { Search as Search5, X as X10 } from "lucide-react";
|
|
19445
|
+
import { jsx as jsx183, jsxs as jsxs123 } from "react/jsx-runtime";
|
|
19446
|
+
var AirbnbSearchInput = React76.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
|
|
19447
|
+
const { t } = useTranslation42();
|
|
18740
19448
|
const placeholderText = placeholder || t("search_property") + "...";
|
|
18741
|
-
return /* @__PURE__ */
|
|
18742
|
-
/* @__PURE__ */
|
|
18743
|
-
/* @__PURE__ */
|
|
19449
|
+
return /* @__PURE__ */ jsxs123("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
|
|
19450
|
+
/* @__PURE__ */ jsx183(Search5, { className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]" }),
|
|
19451
|
+
/* @__PURE__ */ jsx183(
|
|
18744
19452
|
"input",
|
|
18745
19453
|
{
|
|
18746
19454
|
...props,
|
|
@@ -18759,13 +19467,13 @@ var AirbnbSearchInput = React73.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
18759
19467
|
)
|
|
18760
19468
|
}
|
|
18761
19469
|
),
|
|
18762
|
-
onReset && /* @__PURE__ */
|
|
19470
|
+
onReset && /* @__PURE__ */ jsx183(
|
|
18763
19471
|
Button,
|
|
18764
19472
|
{
|
|
18765
19473
|
variant: "ghost",
|
|
18766
19474
|
onClick: onReset,
|
|
18767
19475
|
className: "absolute right-0 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]",
|
|
18768
|
-
children: /* @__PURE__ */
|
|
19476
|
+
children: /* @__PURE__ */ jsx183(X10, { className: "h-5 w-5" })
|
|
18769
19477
|
}
|
|
18770
19478
|
)
|
|
18771
19479
|
] });
|
|
@@ -18837,6 +19545,7 @@ export {
|
|
|
18837
19545
|
Counter,
|
|
18838
19546
|
CounterSize,
|
|
18839
19547
|
CreatableMultiSelect,
|
|
19548
|
+
CreatableSelect,
|
|
18840
19549
|
CustomCheckboxDropdownGroup,
|
|
18841
19550
|
DEFAULT_DISPLAY_FORMAT,
|
|
18842
19551
|
DEVICE_BREAKPOINTS,
|
|
@@ -18948,6 +19657,7 @@ export {
|
|
|
18948
19657
|
NumberedList,
|
|
18949
19658
|
OverlayLoader,
|
|
18950
19659
|
Pagination,
|
|
19660
|
+
PhoneInput,
|
|
18951
19661
|
Popover,
|
|
18952
19662
|
PopoverAnchor,
|
|
18953
19663
|
PopoverClose,
|
|
@@ -18970,6 +19680,7 @@ export {
|
|
|
18970
19680
|
ScrollBar,
|
|
18971
19681
|
SearchButton,
|
|
18972
19682
|
SearchInput,
|
|
19683
|
+
SearchableSelect,
|
|
18973
19684
|
Section,
|
|
18974
19685
|
SectionGroup,
|
|
18975
19686
|
SectionTag,
|
|
@@ -19075,13 +19786,17 @@ export {
|
|
|
19075
19786
|
buttonGroupVariants,
|
|
19076
19787
|
buttonVariants,
|
|
19077
19788
|
calendarClassNames,
|
|
19789
|
+
clearPhoneNumber,
|
|
19078
19790
|
cn,
|
|
19079
19791
|
compressFile,
|
|
19080
19792
|
compressImage,
|
|
19081
19793
|
copyToClipboard,
|
|
19082
19794
|
createDisabledMatchers,
|
|
19083
19795
|
emptyMediaVariants,
|
|
19796
|
+
findPhoneCode,
|
|
19797
|
+
findPhoneCodeOption,
|
|
19084
19798
|
formatDate,
|
|
19799
|
+
formatPhoneCodeOptionLabel,
|
|
19085
19800
|
getErrorMessage,
|
|
19086
19801
|
getFileSizeMB,
|
|
19087
19802
|
getScrollableAreaState,
|
|
@@ -19090,6 +19805,7 @@ export {
|
|
|
19090
19805
|
isNumeric,
|
|
19091
19806
|
labelVariants,
|
|
19092
19807
|
parseDate,
|
|
19808
|
+
parsePhoneValueWithOptions,
|
|
19093
19809
|
registerUiKitI18n,
|
|
19094
19810
|
scrollToTop,
|
|
19095
19811
|
sectionTagVariants,
|