@chekinapp/ui 0.0.142 → 0.0.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +777 -732
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +714 -670
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -91,6 +91,7 @@ __export(index_exports, {
|
|
|
91
91
|
CommingSoonBadge: () => CommingSoonBadge,
|
|
92
92
|
ConfirmationDialog: () => ConfirmationDialog,
|
|
93
93
|
CopyIcon: () => CopyIcon,
|
|
94
|
+
CopyInput: () => CopyInput,
|
|
94
95
|
CopyLinkButton: () => CopyLinkButton,
|
|
95
96
|
CopyString: () => CopyString,
|
|
96
97
|
Counter: () => Counter,
|
|
@@ -12335,7 +12336,7 @@ function Fieldset({
|
|
|
12335
12336
|
htmlFor,
|
|
12336
12337
|
className: cn(
|
|
12337
12338
|
"block cursor-[inherit] truncate transition-all duration-100 ease-in",
|
|
12338
|
-
raised ? "text-[
|
|
12339
|
+
raised ? "text-[length:var(--field-label-raised-font-size)] font-[var(--field-label-raised-font-weight)]" : "text-[length:var(--field-label-font-size)] font-[var(--field-label-font-weight)]"
|
|
12339
12340
|
),
|
|
12340
12341
|
children: label
|
|
12341
12342
|
}
|
|
@@ -12357,10 +12358,10 @@ function Fieldset({
|
|
|
12357
12358
|
"aria-hidden": "true",
|
|
12358
12359
|
className: cn(
|
|
12359
12360
|
"pointer-events-none absolute -top-[5px] bottom-0 left-0 right-0 m-0 min-w-0 rounded-[6px] border px-[13px] text-left transition-colors duration-75",
|
|
12360
|
-
"border-[var(--
|
|
12361
|
-
isActivated && "border-[var(--
|
|
12362
|
-
isFocused && "border-[var(--
|
|
12363
|
-
invalid && "border-[var(--
|
|
12361
|
+
"border-[var(--field-border)]",
|
|
12362
|
+
isActivated && "border-[var(--field-border-activated)]",
|
|
12363
|
+
isFocused && "border-[var(--field-border-focused)]",
|
|
12364
|
+
invalid && "border-[var(--field-border-invalid)]",
|
|
12364
12365
|
className
|
|
12365
12366
|
),
|
|
12366
12367
|
children: /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(
|
|
@@ -12377,8 +12378,8 @@ function Fieldset({
|
|
|
12377
12378
|
"span",
|
|
12378
12379
|
{
|
|
12379
12380
|
className: cn(
|
|
12380
|
-
"visible inline-block px-1 text-[
|
|
12381
|
-
raised ? "font-
|
|
12381
|
+
"visible inline-block px-1 text-[length:var(--field-label-raised-font-size)] opacity-0",
|
|
12382
|
+
raised ? "font-[var(--field-label-raised-font-weight)]" : "font-[var(--field-label-font-weight)]"
|
|
12382
12383
|
),
|
|
12383
12384
|
children: legend || label
|
|
12384
12385
|
}
|
|
@@ -12507,7 +12508,7 @@ var Input = React44.forwardRef(
|
|
|
12507
12508
|
"label",
|
|
12508
12509
|
{
|
|
12509
12510
|
htmlFor: inputId,
|
|
12510
|
-
className: "input__top-label mb-2 block text-[
|
|
12511
|
+
className: "input__top-label mb-2 block text-[length:var(--field-top-label-font-size)] font-[var(--field-top-label-font-weight)] text-[var(--chekin-color-brand-navy)]",
|
|
12511
12512
|
children: topLabel
|
|
12512
12513
|
}
|
|
12513
12514
|
),
|
|
@@ -12668,13 +12669,42 @@ var Input = React44.forwardRef(
|
|
|
12668
12669
|
);
|
|
12669
12670
|
Input.displayName = "Input";
|
|
12670
12671
|
|
|
12672
|
+
// src/dashboard/copy-input/CopyInput.tsx
|
|
12673
|
+
var React45 = __toESM(require("react"), 1);
|
|
12674
|
+
var import_jsx_runtime145 = require("react/jsx-runtime");
|
|
12675
|
+
var CopyInput = React45.forwardRef(
|
|
12676
|
+
({ value = "", copyTooltip, copySize, copyVariant = "ghost", onCopy, ...props }, ref) => {
|
|
12677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
12678
|
+
Input,
|
|
12679
|
+
{
|
|
12680
|
+
...props,
|
|
12681
|
+
ref,
|
|
12682
|
+
value,
|
|
12683
|
+
readOnly: true,
|
|
12684
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("span", { className: "pointer-events-auto", children: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
12685
|
+
CopyIcon,
|
|
12686
|
+
{
|
|
12687
|
+
textToCopy: value,
|
|
12688
|
+
tooltipText: copyTooltip,
|
|
12689
|
+
size: copySize,
|
|
12690
|
+
variant: copyVariant,
|
|
12691
|
+
onClick: onCopy
|
|
12692
|
+
}
|
|
12693
|
+
) }),
|
|
12694
|
+
inputClassName: cn("pr-12", props.inputClassName)
|
|
12695
|
+
}
|
|
12696
|
+
);
|
|
12697
|
+
}
|
|
12698
|
+
);
|
|
12699
|
+
CopyInput.displayName = "CopyInput";
|
|
12700
|
+
|
|
12671
12701
|
// src/dashboard/phone-input/PhoneInput.tsx
|
|
12672
|
-
var
|
|
12702
|
+
var React51 = __toESM(require("react"), 1);
|
|
12673
12703
|
var import_react_i18next33 = require("react-i18next");
|
|
12674
12704
|
|
|
12675
12705
|
// src/dashboard/_select-internals/SelectFieldShell.tsx
|
|
12676
12706
|
var import_react_i18next26 = require("react-i18next");
|
|
12677
|
-
var
|
|
12707
|
+
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
12678
12708
|
var FOCUSABLE_TRIGGER_SELECTOR = 'input:not([type="hidden"]):not([disabled]):not([readonly]), button:not([disabled])';
|
|
12679
12709
|
function SelectFieldShell({
|
|
12680
12710
|
containerRef,
|
|
@@ -12703,7 +12733,7 @@ function SelectFieldShell({
|
|
|
12703
12733
|
);
|
|
12704
12734
|
focusable?.focus();
|
|
12705
12735
|
};
|
|
12706
|
-
return /* @__PURE__ */ (0,
|
|
12736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(
|
|
12707
12737
|
"div",
|
|
12708
12738
|
{
|
|
12709
12739
|
ref: containerRef,
|
|
@@ -12718,20 +12748,20 @@ function SelectFieldShell({
|
|
|
12718
12748
|
),
|
|
12719
12749
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
12720
12750
|
children: [
|
|
12721
|
-
name && /* @__PURE__ */ (0,
|
|
12722
|
-
/* @__PURE__ */ (0,
|
|
12723
|
-
topLabel && /* @__PURE__ */ (0,
|
|
12751
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("input", { type: "hidden", name, value: hiddenValue ?? "" }),
|
|
12752
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("div", { className: "relative min-h-[var(--field-min-height,48px)] w-full", children: [
|
|
12753
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
12724
12754
|
"label",
|
|
12725
12755
|
{
|
|
12726
12756
|
htmlFor: triggerId,
|
|
12727
|
-
className: "mb-2 block text-[
|
|
12757
|
+
className: "mb-2 block text-[length:var(--field-top-label-font-size)] font-[var(--field-top-label-font-weight)] text-[var(--chekin-color-brand-navy)]",
|
|
12728
12758
|
children: topLabel
|
|
12729
12759
|
}
|
|
12730
12760
|
),
|
|
12731
|
-
/* @__PURE__ */ (0,
|
|
12732
|
-
!errorMessage && optional && /* @__PURE__ */ (0,
|
|
12733
|
-
!errorMessage && helperText && /* @__PURE__ */ (0,
|
|
12734
|
-
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
12761
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)("div", { className: "relative w-full", children }),
|
|
12762
|
+
!errorMessage && optional && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
12763
|
+
!errorMessage && helperText && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
12764
|
+
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
12735
12765
|
FieldErrorMessage,
|
|
12736
12766
|
{
|
|
12737
12767
|
id: errorId,
|
|
@@ -12747,7 +12777,7 @@ function SelectFieldShell({
|
|
|
12747
12777
|
}
|
|
12748
12778
|
|
|
12749
12779
|
// src/dashboard/_select-internals/SelectMenu.tsx
|
|
12750
|
-
var
|
|
12780
|
+
var React46 = __toESM(require("react"), 1);
|
|
12751
12781
|
var import_react_i18next27 = require("react-i18next");
|
|
12752
12782
|
|
|
12753
12783
|
// src/dashboard/_select-internals/utils.ts
|
|
@@ -12842,7 +12872,7 @@ function countriesFilter(option, inputValue) {
|
|
|
12842
12872
|
|
|
12843
12873
|
// src/dashboard/_select-internals/slots/DefaultOption.tsx
|
|
12844
12874
|
var import_lucide_react42 = require("lucide-react");
|
|
12845
|
-
var
|
|
12875
|
+
var import_jsx_runtime147 = require("react/jsx-runtime");
|
|
12846
12876
|
function DefaultOption(props) {
|
|
12847
12877
|
const {
|
|
12848
12878
|
option,
|
|
@@ -12864,7 +12894,7 @@ function DefaultOption(props) {
|
|
|
12864
12894
|
inputValue,
|
|
12865
12895
|
selectValue: selectedOptions
|
|
12866
12896
|
}) : option.label;
|
|
12867
|
-
return /* @__PURE__ */ (0,
|
|
12897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(
|
|
12868
12898
|
"button",
|
|
12869
12899
|
{
|
|
12870
12900
|
id,
|
|
@@ -12885,9 +12915,9 @@ function DefaultOption(props) {
|
|
|
12885
12915
|
isDisabled && "cursor-not-allowed text-[var(--chekin-color-gray-2)]"
|
|
12886
12916
|
),
|
|
12887
12917
|
children: [
|
|
12888
|
-
/* @__PURE__ */ (0,
|
|
12889
|
-
option.description && /* @__PURE__ */ (0,
|
|
12890
|
-
isSelected && /* @__PURE__ */ (0,
|
|
12918
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("span", { className: "block min-w-0 break-words", children: labelContent }),
|
|
12919
|
+
option.description && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("span", { className: "ml-auto shrink-0 self-center text-[12px] font-medium italic text-[var(--chekin-color-gray-1)]", children: option.description }),
|
|
12920
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
|
|
12891
12921
|
import_lucide_react42.Check,
|
|
12892
12922
|
{
|
|
12893
12923
|
"aria-hidden": "true",
|
|
@@ -12904,7 +12934,7 @@ function DefaultOption(props) {
|
|
|
12904
12934
|
}
|
|
12905
12935
|
|
|
12906
12936
|
// src/dashboard/_select-internals/SelectMenu.tsx
|
|
12907
|
-
var
|
|
12937
|
+
var import_jsx_runtime148 = require("react/jsx-runtime");
|
|
12908
12938
|
function buildMenuEntries(groupedOptions, options, formatGroupLabel, listboxId) {
|
|
12909
12939
|
if (!groupedOptions || !groupedOptions.some((item) => isOptionGroup(item))) {
|
|
12910
12940
|
return options.map((option, index) => ({
|
|
@@ -12985,11 +13015,11 @@ function SelectMenu({
|
|
|
12985
13015
|
const hasOptions = options.length > 0;
|
|
12986
13016
|
const Option = components?.Option ?? DefaultOption;
|
|
12987
13017
|
const lastIndex = options.length - 1;
|
|
12988
|
-
const selectedList =
|
|
13018
|
+
const selectedList = React46.useMemo(
|
|
12989
13019
|
() => selectedValues ?? (selectedValue ? [selectedValue] : []),
|
|
12990
13020
|
[selectedValues, selectedValue]
|
|
12991
13021
|
);
|
|
12992
|
-
const entries =
|
|
13022
|
+
const entries = React46.useMemo(
|
|
12993
13023
|
() => buildMenuEntries(groupedOptions, options, formatGroupLabel, id),
|
|
12994
13024
|
[groupedOptions, options, formatGroupLabel, id]
|
|
12995
13025
|
);
|
|
@@ -13000,7 +13030,7 @@ function SelectMenu({
|
|
|
13000
13030
|
const optionDisabled = Boolean(
|
|
13001
13031
|
disabled || option.isDisabled || isOptionDisabled?.(option)
|
|
13002
13032
|
);
|
|
13003
|
-
return /* @__PURE__ */ (0,
|
|
13033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
|
|
13004
13034
|
Option,
|
|
13005
13035
|
{
|
|
13006
13036
|
id: getOptionId2(flatIndex),
|
|
@@ -13021,8 +13051,8 @@ function SelectMenu({
|
|
|
13021
13051
|
key
|
|
13022
13052
|
);
|
|
13023
13053
|
};
|
|
13024
|
-
const wasAtBottomRef =
|
|
13025
|
-
const handleScroll =
|
|
13054
|
+
const wasAtBottomRef = React46.useRef(false);
|
|
13055
|
+
const handleScroll = React46.useCallback(
|
|
13026
13056
|
(event) => {
|
|
13027
13057
|
if (!onMenuScrollToBottom) return;
|
|
13028
13058
|
const target = event.currentTarget;
|
|
@@ -13034,7 +13064,7 @@ function SelectMenu({
|
|
|
13034
13064
|
},
|
|
13035
13065
|
[onMenuScrollToBottom]
|
|
13036
13066
|
);
|
|
13037
|
-
return /* @__PURE__ */ (0,
|
|
13067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
|
|
13038
13068
|
"div",
|
|
13039
13069
|
{
|
|
13040
13070
|
id,
|
|
@@ -13053,11 +13083,11 @@ function SelectMenu({
|
|
|
13053
13083
|
menuClassName
|
|
13054
13084
|
),
|
|
13055
13085
|
children: [
|
|
13056
|
-
!hasOptions && (emptyContent ?? /* @__PURE__ */ (0,
|
|
13086
|
+
!hasOptions && (emptyContent ?? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "px-3 py-3 text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: emptyMessage })),
|
|
13057
13087
|
entries.map((entry) => {
|
|
13058
13088
|
if (entry.kind === "group") {
|
|
13059
|
-
return /* @__PURE__ */ (0,
|
|
13060
|
-
/* @__PURE__ */ (0,
|
|
13089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { role: "group", "aria-labelledby": entry.labelId, children: [
|
|
13090
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
|
|
13061
13091
|
"div",
|
|
13062
13092
|
{
|
|
13063
13093
|
id: entry.labelId,
|
|
@@ -13078,7 +13108,7 @@ function SelectMenu({
|
|
|
13078
13108
|
|
|
13079
13109
|
// src/dashboard/_select-internals/SelectMenuPanel.tsx
|
|
13080
13110
|
var import_react_i18next28 = require("react-i18next");
|
|
13081
|
-
var
|
|
13111
|
+
var import_jsx_runtime149 = require("react/jsx-runtime");
|
|
13082
13112
|
function SelectMenuPanel({
|
|
13083
13113
|
isOpen,
|
|
13084
13114
|
isMobile: isMobile3,
|
|
@@ -13096,23 +13126,23 @@ function SelectMenuPanel({
|
|
|
13096
13126
|
const fallbackTitle = t("select_option");
|
|
13097
13127
|
const titleText = typeof title === "string" || typeof title === "number" ? String(title) : fallbackTitle;
|
|
13098
13128
|
const descriptionText = typeof description === "string" || typeof description === "number" ? String(description) : titleText;
|
|
13099
|
-
return /* @__PURE__ */ (0,
|
|
13129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
|
|
13100
13130
|
Drawer,
|
|
13101
13131
|
{
|
|
13102
13132
|
open: isOpen,
|
|
13103
13133
|
onOpenChange: (next) => {
|
|
13104
13134
|
if (!next) onClose();
|
|
13105
13135
|
},
|
|
13106
|
-
children: /* @__PURE__ */ (0,
|
|
13136
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)(
|
|
13107
13137
|
DrawerContent,
|
|
13108
13138
|
{
|
|
13109
13139
|
onClose,
|
|
13110
13140
|
lockScroll: false,
|
|
13111
13141
|
className: cn("max-h-[calc(100vh-1rem)]", drawerClassName),
|
|
13112
13142
|
children: [
|
|
13113
|
-
/* @__PURE__ */ (0,
|
|
13114
|
-
/* @__PURE__ */ (0,
|
|
13115
|
-
/* @__PURE__ */ (0,
|
|
13143
|
+
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)(DrawerTitle, { className: "sr-only", children: titleText }),
|
|
13144
|
+
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)(DrawerDescription, { className: "sr-only", children: descriptionText }),
|
|
13145
|
+
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
|
|
13116
13146
|
"div",
|
|
13117
13147
|
{
|
|
13118
13148
|
className: cn(
|
|
@@ -13128,7 +13158,7 @@ function SelectMenuPanel({
|
|
|
13128
13158
|
}
|
|
13129
13159
|
);
|
|
13130
13160
|
}
|
|
13131
|
-
return /* @__PURE__ */ (0,
|
|
13161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
|
|
13132
13162
|
"div",
|
|
13133
13163
|
{
|
|
13134
13164
|
className: cn(
|
|
@@ -13142,7 +13172,7 @@ function SelectMenuPanel({
|
|
|
13142
13172
|
|
|
13143
13173
|
// src/dashboard/_select-internals/SelectSearchInput.tsx
|
|
13144
13174
|
var import_lucide_react43 = require("lucide-react");
|
|
13145
|
-
var
|
|
13175
|
+
var import_jsx_runtime150 = require("react/jsx-runtime");
|
|
13146
13176
|
function SelectSearchInput({
|
|
13147
13177
|
inputRef,
|
|
13148
13178
|
value,
|
|
@@ -13152,15 +13182,15 @@ function SelectSearchInput({
|
|
|
13152
13182
|
onChange,
|
|
13153
13183
|
onKeyDown
|
|
13154
13184
|
}) {
|
|
13155
|
-
return /* @__PURE__ */ (0,
|
|
13156
|
-
/* @__PURE__ */ (0,
|
|
13185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { className: "border-b border-[var(--chekin-color-gray-3)] bg-white p-2", children: /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "relative", children: [
|
|
13186
|
+
/* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
|
|
13157
13187
|
import_lucide_react43.Search,
|
|
13158
13188
|
{
|
|
13159
13189
|
"aria-hidden": "true",
|
|
13160
13190
|
className: "pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-[var(--chekin-color-gray-2)]"
|
|
13161
13191
|
}
|
|
13162
13192
|
),
|
|
13163
|
-
/* @__PURE__ */ (0,
|
|
13193
|
+
/* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
|
|
13164
13194
|
"input",
|
|
13165
13195
|
{
|
|
13166
13196
|
ref: inputRef,
|
|
@@ -13180,7 +13210,7 @@ function SelectSearchInput({
|
|
|
13180
13210
|
|
|
13181
13211
|
// src/dashboard/_select-internals/SelectTrigger.tsx
|
|
13182
13212
|
var import_lucide_react44 = require("lucide-react");
|
|
13183
|
-
var
|
|
13213
|
+
var import_jsx_runtime151 = require("react/jsx-runtime");
|
|
13184
13214
|
function SelectTrigger({
|
|
13185
13215
|
triggerRef,
|
|
13186
13216
|
triggerId,
|
|
@@ -13207,7 +13237,7 @@ function SelectTrigger({
|
|
|
13207
13237
|
onFocus
|
|
13208
13238
|
}) {
|
|
13209
13239
|
const isEmpty = !hasValue;
|
|
13210
|
-
return /* @__PURE__ */ (0,
|
|
13240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(
|
|
13211
13241
|
"button",
|
|
13212
13242
|
{
|
|
13213
13243
|
id: triggerId,
|
|
@@ -13235,9 +13265,9 @@ function SelectTrigger({
|
|
|
13235
13265
|
loading && "!cursor-progress"
|
|
13236
13266
|
),
|
|
13237
13267
|
children: [
|
|
13238
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
13239
|
-
/* @__PURE__ */ (0,
|
|
13240
|
-
/* @__PURE__ */ (0,
|
|
13268
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "pointer-events-none absolute left-0 top-0 flex h-full max-w-10 items-center justify-center text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
13269
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { id: valueId, className: "block min-w-0 flex-1 truncate text-left", children: hasValue ? valueLabel : showPlaceholderWhenIdle || isOpen ? placeholder : null }),
|
|
13270
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: !hideIndicator && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
|
|
13241
13271
|
import_lucide_react44.ChevronDown,
|
|
13242
13272
|
{
|
|
13243
13273
|
size: 16,
|
|
@@ -13255,7 +13285,7 @@ function SelectTrigger({
|
|
|
13255
13285
|
// src/dashboard/_select-internals/ComboboxTrigger.tsx
|
|
13256
13286
|
var import_lucide_react45 = require("lucide-react");
|
|
13257
13287
|
var import_react_i18next29 = require("react-i18next");
|
|
13258
|
-
var
|
|
13288
|
+
var import_jsx_runtime152 = require("react/jsx-runtime");
|
|
13259
13289
|
function ComboboxTrigger({
|
|
13260
13290
|
triggerId,
|
|
13261
13291
|
listboxId,
|
|
@@ -13299,7 +13329,7 @@ function ComboboxTrigger({
|
|
|
13299
13329
|
const visiblePlaceholder = searchable && (showPlaceholderWhenIdle || isFocused || isOpen) ? resolvedPlaceholder : "";
|
|
13300
13330
|
const inputMeasureValue = inputValue || visiblePlaceholder || " ";
|
|
13301
13331
|
const activeOptionId = isOpen && highlightedIndex !== void 0 && highlightedIndex >= 0 && getOptionId2 ? getOptionId2(highlightedIndex) : void 0;
|
|
13302
|
-
return /* @__PURE__ */ (0,
|
|
13332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
|
|
13303
13333
|
"div",
|
|
13304
13334
|
{
|
|
13305
13335
|
role: "combobox",
|
|
@@ -13323,18 +13353,19 @@ function ComboboxTrigger({
|
|
|
13323
13353
|
containerClassName
|
|
13324
13354
|
),
|
|
13325
13355
|
children: [
|
|
13326
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
13327
|
-
/* @__PURE__ */ (0,
|
|
13356
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "pointer-events-none absolute left-0 top-0 flex h-full max-w-10 items-center justify-center text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
13357
|
+
!leftIcon && searchable && (isFocused || isOpen) && /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "pointer-events-none absolute left-0 top-0 flex h-full max-w-10 items-center justify-center text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "flex h-full w-10 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(import_lucide_react45.Search, { size: 16, "aria-hidden": "true" }) }) }),
|
|
13358
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
|
|
13328
13359
|
"div",
|
|
13329
13360
|
{
|
|
13330
13361
|
className: cn(
|
|
13331
13362
|
"flex min-w-0 flex-1 items-center gap-2 py-[10px]",
|
|
13332
|
-
leftIcon ? "pl-10" : "pl-4",
|
|
13363
|
+
leftIcon || searchable && (isFocused || isOpen) ? "pl-10" : "pl-4",
|
|
13333
13364
|
isMulti && "flex-wrap"
|
|
13334
13365
|
),
|
|
13335
13366
|
children: [
|
|
13336
13367
|
leadingContent,
|
|
13337
|
-
/* @__PURE__ */ (0,
|
|
13368
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
|
|
13338
13369
|
"span",
|
|
13339
13370
|
{
|
|
13340
13371
|
className: cn(
|
|
@@ -13343,7 +13374,7 @@ function ComboboxTrigger({
|
|
|
13343
13374
|
!searchable && "sr-only"
|
|
13344
13375
|
),
|
|
13345
13376
|
children: [
|
|
13346
|
-
/* @__PURE__ */ (0,
|
|
13377
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
13347
13378
|
"span",
|
|
13348
13379
|
{
|
|
13349
13380
|
"aria-hidden": "true",
|
|
@@ -13351,7 +13382,7 @@ function ComboboxTrigger({
|
|
|
13351
13382
|
children: inputMeasureValue
|
|
13352
13383
|
}
|
|
13353
13384
|
),
|
|
13354
|
-
/* @__PURE__ */ (0,
|
|
13385
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
13355
13386
|
"input",
|
|
13356
13387
|
{
|
|
13357
13388
|
ref: inputRef,
|
|
@@ -13385,18 +13416,18 @@ function ComboboxTrigger({
|
|
|
13385
13416
|
]
|
|
13386
13417
|
}
|
|
13387
13418
|
),
|
|
13388
|
-
/* @__PURE__ */ (0,
|
|
13389
|
-
showClear && /* @__PURE__ */ (0,
|
|
13419
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("span", { className: "flex h-12 shrink-0 items-center gap-2 self-start pl-2 pr-4 text-[var(--chekin-color-gray-2)]", children: [
|
|
13420
|
+
showClear && /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
13390
13421
|
"button",
|
|
13391
13422
|
{
|
|
13392
13423
|
type: "button",
|
|
13393
13424
|
onClick: onClear,
|
|
13394
13425
|
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]",
|
|
13395
13426
|
"aria-label": clearLabel,
|
|
13396
|
-
children: /* @__PURE__ */ (0,
|
|
13427
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(import_lucide_react45.SquareX, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
13397
13428
|
}
|
|
13398
13429
|
),
|
|
13399
|
-
!hideIndicator && /* @__PURE__ */ (0,
|
|
13430
|
+
!hideIndicator && /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
13400
13431
|
RotateArrow,
|
|
13401
13432
|
{
|
|
13402
13433
|
shouldRotate: isOpen,
|
|
@@ -13412,14 +13443,14 @@ function ComboboxTrigger({
|
|
|
13412
13443
|
}
|
|
13413
13444
|
|
|
13414
13445
|
// src/dashboard/_select-internals/useSelectIds.ts
|
|
13415
|
-
var
|
|
13446
|
+
var React47 = __toESM(require("react"), 1);
|
|
13416
13447
|
function useSelectIds({
|
|
13417
13448
|
name,
|
|
13418
13449
|
hasValue,
|
|
13419
13450
|
error,
|
|
13420
13451
|
hideErrorMessage
|
|
13421
13452
|
}) {
|
|
13422
|
-
const reactId =
|
|
13453
|
+
const reactId = React47.useId().replace(/:/g, "");
|
|
13423
13454
|
const baseId = name ? `dash-select-${name}` : `dash-select-${reactId}`;
|
|
13424
13455
|
const triggerId = `${baseId}-trigger`;
|
|
13425
13456
|
const labelId = `${baseId}-label`;
|
|
@@ -13429,7 +13460,7 @@ function useSelectIds({
|
|
|
13429
13460
|
const listboxId = `${baseId}-listbox`;
|
|
13430
13461
|
const describedErrorId = error && !hideErrorMessage ? errorId : void 0;
|
|
13431
13462
|
const describedBy = [!hasValue ? helperTextId : null, describedErrorId].filter(Boolean).join(" ") || void 0;
|
|
13432
|
-
const getOptionId2 =
|
|
13463
|
+
const getOptionId2 = React47.useCallback(
|
|
13433
13464
|
(index) => `${baseId}-option-${index}`,
|
|
13434
13465
|
[baseId]
|
|
13435
13466
|
);
|
|
@@ -13447,7 +13478,7 @@ function useSelectIds({
|
|
|
13447
13478
|
}
|
|
13448
13479
|
|
|
13449
13480
|
// src/dashboard/_select-internals/useSelectMenuState.ts
|
|
13450
|
-
var
|
|
13481
|
+
var React48 = __toESM(require("react"), 1);
|
|
13451
13482
|
function useSelectMenuState({
|
|
13452
13483
|
isBlocked,
|
|
13453
13484
|
isMobile: isMobile3,
|
|
@@ -13455,14 +13486,14 @@ function useSelectMenuState({
|
|
|
13455
13486
|
controlledIsOpen,
|
|
13456
13487
|
onMenuOpenChange
|
|
13457
13488
|
}) {
|
|
13458
|
-
const containerRef =
|
|
13459
|
-
const [internalIsOpen, setInternalIsOpen] =
|
|
13460
|
-
const [hasClosedControlledOpen, setHasClosedControlledOpen] =
|
|
13489
|
+
const containerRef = React48.useRef(null);
|
|
13490
|
+
const [internalIsOpen, setInternalIsOpen] = React48.useState(false);
|
|
13491
|
+
const [hasClosedControlledOpen, setHasClosedControlledOpen] = React48.useState(false);
|
|
13461
13492
|
const isOpen = controlledIsOpen === false ? false : controlledIsOpen === true ? !hasClosedControlledOpen : internalIsOpen;
|
|
13462
|
-
|
|
13493
|
+
React48.useEffect(() => {
|
|
13463
13494
|
if (controlledIsOpen !== true) setHasClosedControlledOpen(false);
|
|
13464
13495
|
}, [controlledIsOpen]);
|
|
13465
|
-
const setIsOpen =
|
|
13496
|
+
const setIsOpen = React48.useCallback(
|
|
13466
13497
|
(next) => {
|
|
13467
13498
|
const value = typeof next === "function" ? next(isOpen) : next;
|
|
13468
13499
|
if (controlledIsOpen === true) setHasClosedControlledOpen(!value);
|
|
@@ -13471,13 +13502,13 @@ function useSelectMenuState({
|
|
|
13471
13502
|
},
|
|
13472
13503
|
[isOpen, controlledIsOpen, onMenuOpenChange]
|
|
13473
13504
|
);
|
|
13474
|
-
const openMenu =
|
|
13505
|
+
const openMenu = React48.useCallback(() => {
|
|
13475
13506
|
setIsOpen(true);
|
|
13476
13507
|
}, [setIsOpen]);
|
|
13477
|
-
const closeMenu =
|
|
13508
|
+
const closeMenu = React48.useCallback(() => {
|
|
13478
13509
|
setIsOpen(false);
|
|
13479
13510
|
}, [setIsOpen]);
|
|
13480
|
-
const toggleMenu =
|
|
13511
|
+
const toggleMenu = React48.useCallback(() => {
|
|
13481
13512
|
if (isBlocked) return;
|
|
13482
13513
|
setIsOpen((prev) => !prev);
|
|
13483
13514
|
}, [isBlocked, setIsOpen]);
|
|
@@ -13489,14 +13520,14 @@ function useSelectMenuState({
|
|
|
13489
13520
|
},
|
|
13490
13521
|
isDisabled: !isOpen || isMobile3
|
|
13491
13522
|
});
|
|
13492
|
-
|
|
13523
|
+
React48.useEffect(() => {
|
|
13493
13524
|
if (isBlocked) setIsOpen(false);
|
|
13494
13525
|
}, [isBlocked, setIsOpen]);
|
|
13495
13526
|
return { containerRef, isOpen, openMenu, closeMenu, toggleMenu, setIsOpen };
|
|
13496
13527
|
}
|
|
13497
13528
|
|
|
13498
13529
|
// src/dashboard/_select-internals/useSelectState.ts
|
|
13499
|
-
var
|
|
13530
|
+
var React49 = __toESM(require("react"), 1);
|
|
13500
13531
|
function resolveValueLabel(option, getValueLabel) {
|
|
13501
13532
|
if (!option) return "";
|
|
13502
13533
|
return getValueLabel?.(option) ?? String(option.label);
|
|
@@ -13532,25 +13563,25 @@ function useSelectState(params) {
|
|
|
13532
13563
|
isSearchInDropdown,
|
|
13533
13564
|
searchable = true
|
|
13534
13565
|
} = params;
|
|
13535
|
-
const inputRef =
|
|
13536
|
-
const mobileSearchInputRef =
|
|
13537
|
-
const listRef =
|
|
13538
|
-
const optionRefs =
|
|
13566
|
+
const inputRef = React49.useRef(null);
|
|
13567
|
+
const mobileSearchInputRef = React49.useRef(null);
|
|
13568
|
+
const listRef = React49.useRef(null);
|
|
13569
|
+
const optionRefs = React49.useRef([]);
|
|
13539
13570
|
const isMobile3 = useIsMobile();
|
|
13540
|
-
const [isFocused, setIsFocused] =
|
|
13541
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
13571
|
+
const [isFocused, setIsFocused] = React49.useState(false);
|
|
13572
|
+
const [highlightedIndex, setHighlightedIndex] = React49.useState(-1);
|
|
13542
13573
|
const singleSelected = isMulti ? void 0 : selectedOptions[0];
|
|
13543
|
-
const valueLabel =
|
|
13574
|
+
const valueLabel = React49.useMemo(
|
|
13544
13575
|
() => resolveValueLabel(singleSelected, getValueLabel),
|
|
13545
13576
|
[singleSelected, getValueLabel]
|
|
13546
13577
|
);
|
|
13547
13578
|
const isSearchOnlyInput = searchable && (isMulti || Boolean(isSearchInDropdown));
|
|
13548
13579
|
const isInputControlled = controlledInputValue !== void 0;
|
|
13549
|
-
const [internalInputValue, setInternalInputValue] =
|
|
13580
|
+
const [internalInputValue, setInternalInputValue] = React49.useState(
|
|
13550
13581
|
searchable && !isSearchOnlyInput ? valueLabel : ""
|
|
13551
13582
|
);
|
|
13552
13583
|
const inputValue = isInputControlled ? controlledInputValue : internalInputValue;
|
|
13553
|
-
const setInputValue =
|
|
13584
|
+
const setInputValue = React49.useCallback(
|
|
13554
13585
|
(next) => {
|
|
13555
13586
|
if (!isInputControlled) setInternalInputValue(next);
|
|
13556
13587
|
},
|
|
@@ -13569,12 +13600,12 @@ function useSelectState(params) {
|
|
|
13569
13600
|
});
|
|
13570
13601
|
const ids = useSelectIds({ name, hasValue, error, hideErrorMessage });
|
|
13571
13602
|
const { listboxId, getOptionId: getOptionId2 } = ids;
|
|
13572
|
-
|
|
13603
|
+
React49.useEffect(() => {
|
|
13573
13604
|
if (!searchable) return;
|
|
13574
13605
|
if (isSearchOnlyInput) return;
|
|
13575
13606
|
if (!isFocused) setInputValue(valueLabel);
|
|
13576
13607
|
}, [valueLabel, isFocused, isSearchOnlyInput, searchable]);
|
|
13577
|
-
|
|
13608
|
+
React49.useEffect(() => {
|
|
13578
13609
|
if (!isSearchOnlyInput) return;
|
|
13579
13610
|
if (!isOpen) {
|
|
13580
13611
|
setInputValue("");
|
|
@@ -13583,11 +13614,11 @@ function useSelectState(params) {
|
|
|
13583
13614
|
}, [isOpen, isSearchOnlyInput]);
|
|
13584
13615
|
const trimmedInput = inputValue.trim();
|
|
13585
13616
|
const isFiltering = searchable && (isSearchOnlyInput ? trimmedInput.length > 0 : trimmedInput.length > 0 && trimmedInput.toLowerCase() !== valueLabel.toLowerCase());
|
|
13586
|
-
const filteredOptions =
|
|
13617
|
+
const filteredOptions = React49.useMemo(() => {
|
|
13587
13618
|
if (!isFiltering) return options;
|
|
13588
13619
|
return options.filter((option) => filterOption(option, trimmedInput));
|
|
13589
13620
|
}, [options, isFiltering, trimmedInput, filterOption]);
|
|
13590
|
-
const canCreateNewOption =
|
|
13621
|
+
const canCreateNewOption = React49.useMemo(() => {
|
|
13591
13622
|
if (!isCreatable || !trimmedInput) return false;
|
|
13592
13623
|
if (isValidNewOption) {
|
|
13593
13624
|
return isValidNewOption(trimmedInput, selectedOptions, options);
|
|
@@ -13601,7 +13632,7 @@ function useSelectState(params) {
|
|
|
13601
13632
|
);
|
|
13602
13633
|
return !existsInOptions && !existsInSelected;
|
|
13603
13634
|
}, [isCreatable, trimmedInput, isValidNewOption, options, selectedOptions]);
|
|
13604
|
-
|
|
13635
|
+
React49.useEffect(() => {
|
|
13605
13636
|
if (!isOpen || filteredOptions.length === 0) {
|
|
13606
13637
|
setHighlightedIndex(-1);
|
|
13607
13638
|
return;
|
|
@@ -13611,23 +13642,23 @@ function useSelectState(params) {
|
|
|
13611
13642
|
return getFirstEnabledOptionIndex(filteredOptions, isOptionDisabled);
|
|
13612
13643
|
});
|
|
13613
13644
|
}, [isOpen, filteredOptions, isOptionDisabled]);
|
|
13614
|
-
|
|
13645
|
+
React49.useEffect(() => {
|
|
13615
13646
|
if (!isOpen || highlightedIndex < 0) return;
|
|
13616
13647
|
optionRefs.current[highlightedIndex]?.scrollIntoView?.({ block: "nearest" });
|
|
13617
13648
|
}, [highlightedIndex, isOpen]);
|
|
13618
13649
|
const inMenuSearchVisible = searchable && (isMobile3 || Boolean(isSearchInDropdown));
|
|
13619
|
-
|
|
13650
|
+
React49.useEffect(() => {
|
|
13620
13651
|
if (!isOpen || !inMenuSearchVisible) return;
|
|
13621
13652
|
const frame = window.requestAnimationFrame(
|
|
13622
13653
|
() => mobileSearchInputRef.current?.focus()
|
|
13623
13654
|
);
|
|
13624
13655
|
return () => window.cancelAnimationFrame(frame);
|
|
13625
13656
|
}, [isOpen, inMenuSearchVisible]);
|
|
13626
|
-
const isValueSelected =
|
|
13657
|
+
const isValueSelected = React49.useCallback(
|
|
13627
13658
|
(option) => isOptionSelected2(option, selectedOptions),
|
|
13628
13659
|
[isOptionSelected2, selectedOptions]
|
|
13629
13660
|
);
|
|
13630
|
-
const selectOption =
|
|
13661
|
+
const selectOption = React49.useCallback(
|
|
13631
13662
|
(option) => {
|
|
13632
13663
|
if (!isOptionEnabled(option, isOptionDisabled)) return;
|
|
13633
13664
|
if (isMulti) {
|
|
@@ -13663,7 +13694,7 @@ function useSelectState(params) {
|
|
|
13663
13694
|
searchable
|
|
13664
13695
|
]
|
|
13665
13696
|
);
|
|
13666
|
-
const removeOption =
|
|
13697
|
+
const removeOption = React49.useCallback(
|
|
13667
13698
|
(option) => {
|
|
13668
13699
|
if (isBlocked) return;
|
|
13669
13700
|
onSelectionChange(
|
|
@@ -13674,7 +13705,7 @@ function useSelectState(params) {
|
|
|
13674
13705
|
},
|
|
13675
13706
|
[isBlocked, onSelectionChange, selectedOptions]
|
|
13676
13707
|
);
|
|
13677
|
-
const clearSelection =
|
|
13708
|
+
const clearSelection = React49.useCallback(
|
|
13678
13709
|
(event) => {
|
|
13679
13710
|
event?.stopPropagation();
|
|
13680
13711
|
if (isBlocked) return;
|
|
@@ -13684,7 +13715,7 @@ function useSelectState(params) {
|
|
|
13684
13715
|
},
|
|
13685
13716
|
[isBlocked, onSelectionChange]
|
|
13686
13717
|
);
|
|
13687
|
-
const createOption =
|
|
13718
|
+
const createOption = React49.useCallback(() => {
|
|
13688
13719
|
if (!canCreateNewOption) return;
|
|
13689
13720
|
const newOption = onCreateOption?.(trimmedInput) ?? { value: trimmedInput, label: trimmedInput };
|
|
13690
13721
|
if (isMulti) {
|
|
@@ -13714,7 +13745,7 @@ function useSelectState(params) {
|
|
|
13714
13745
|
isSearchInDropdown,
|
|
13715
13746
|
searchable
|
|
13716
13747
|
]);
|
|
13717
|
-
const handleInputChange =
|
|
13748
|
+
const handleInputChange = React49.useCallback(
|
|
13718
13749
|
(event) => {
|
|
13719
13750
|
if (!searchable) return;
|
|
13720
13751
|
const nextValue = event.target.value;
|
|
@@ -13724,7 +13755,7 @@ function useSelectState(params) {
|
|
|
13724
13755
|
},
|
|
13725
13756
|
[isOpen, onInputChange, searchable, setIsOpen, setInputValue]
|
|
13726
13757
|
);
|
|
13727
|
-
const handleInputFocus =
|
|
13758
|
+
const handleInputFocus = React49.useCallback(
|
|
13728
13759
|
(event) => {
|
|
13729
13760
|
if (isBlocked) return;
|
|
13730
13761
|
onFocus?.(event);
|
|
@@ -13736,17 +13767,17 @@ function useSelectState(params) {
|
|
|
13736
13767
|
},
|
|
13737
13768
|
[isBlocked, onFocus, openMenuOnFocus, setIsOpen, searchable, isMulti]
|
|
13738
13769
|
);
|
|
13739
|
-
const handleTriggerFocus =
|
|
13770
|
+
const handleTriggerFocus = React49.useCallback(() => {
|
|
13740
13771
|
if (isBlocked) return;
|
|
13741
13772
|
setIsFocused(true);
|
|
13742
13773
|
if (openMenuOnFocus) setIsOpen(true);
|
|
13743
13774
|
}, [isBlocked, openMenuOnFocus, setIsOpen]);
|
|
13744
|
-
const handleContainerClick =
|
|
13775
|
+
const handleContainerClick = React49.useCallback(() => {
|
|
13745
13776
|
if (isBlocked) return;
|
|
13746
13777
|
inputRef.current?.focus();
|
|
13747
13778
|
setIsOpen(true);
|
|
13748
13779
|
}, [isBlocked, setIsOpen]);
|
|
13749
|
-
const handleBlur =
|
|
13780
|
+
const handleBlur = React49.useCallback(
|
|
13750
13781
|
(event) => {
|
|
13751
13782
|
if (containerRef.current?.contains(event.relatedTarget)) return;
|
|
13752
13783
|
setIsFocused(false);
|
|
@@ -13755,7 +13786,7 @@ function useSelectState(params) {
|
|
|
13755
13786
|
},
|
|
13756
13787
|
[containerRef, isSearchOnlyInput, searchable, valueLabel, onBlur]
|
|
13757
13788
|
);
|
|
13758
|
-
const handleInputKeyDown =
|
|
13789
|
+
const handleInputKeyDown = React49.useCallback(
|
|
13759
13790
|
(event) => {
|
|
13760
13791
|
onKeyDown?.(event);
|
|
13761
13792
|
if (event.defaultPrevented) return;
|
|
@@ -13832,7 +13863,7 @@ function useSelectState(params) {
|
|
|
13832
13863
|
]
|
|
13833
13864
|
);
|
|
13834
13865
|
const isEmpty = !hasValue && !inputValue;
|
|
13835
|
-
|
|
13866
|
+
React49.useDebugValue({ isOpen, isMulti, highlightedIndex, selectedOptions });
|
|
13836
13867
|
return {
|
|
13837
13868
|
// ids
|
|
13838
13869
|
ids,
|
|
@@ -13894,7 +13925,7 @@ function useSelectState(params) {
|
|
|
13894
13925
|
// src/dashboard/_select-internals/slots/DefaultMultiValueChip.tsx
|
|
13895
13926
|
var import_lucide_react46 = require("lucide-react");
|
|
13896
13927
|
var import_react_i18next30 = require("react-i18next");
|
|
13897
|
-
var
|
|
13928
|
+
var import_jsx_runtime153 = require("react/jsx-runtime");
|
|
13898
13929
|
function DefaultMultiValueChip({
|
|
13899
13930
|
option,
|
|
13900
13931
|
readOnly,
|
|
@@ -13902,9 +13933,9 @@ function DefaultMultiValueChip({
|
|
|
13902
13933
|
}) {
|
|
13903
13934
|
const { t } = (0, import_react_i18next30.useTranslation)();
|
|
13904
13935
|
const labelText = typeof option.label === "string" ? option.label : String(option.value);
|
|
13905
|
-
return /* @__PURE__ */ (0,
|
|
13906
|
-
/* @__PURE__ */ (0,
|
|
13907
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("span", { className: "inline-flex items-center gap-1 rounded-md border border-[var(--chekin-color-gray-3)] bg-[var(--chekin-color-surface-pressed)] py-0.5 pl-2 pr-1 text-[13px] font-medium text-[var(--chekin-color-brand-navy)] transition-colors", children: [
|
|
13937
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "whitespace-nowrap leading-5", children: option.label }),
|
|
13938
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
13908
13939
|
"button",
|
|
13909
13940
|
{
|
|
13910
13941
|
type: "button",
|
|
@@ -13914,14 +13945,14 @@ function DefaultMultiValueChip({
|
|
|
13914
13945
|
},
|
|
13915
13946
|
className: "flex h-4 w-4 items-center justify-center rounded-sm border-0 bg-transparent p-0 text-[var(--chekin-color-gray-1)] outline-none transition-colors hover:bg-white/70 hover:text-[var(--chekin-color-brand-navy)] focus-visible:ring-2 focus-visible:ring-[var(--chekin-color-brand-blue)]/30",
|
|
13916
13947
|
"aria-label": t("remove_item", { label: labelText }),
|
|
13917
|
-
children: /* @__PURE__ */ (0,
|
|
13948
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_lucide_react46.X, { size: 12, strokeWidth: 2.5 })
|
|
13918
13949
|
}
|
|
13919
13950
|
)
|
|
13920
13951
|
] });
|
|
13921
13952
|
}
|
|
13922
13953
|
|
|
13923
13954
|
// src/dashboard/_select-internals/slots/DefaultControl.tsx
|
|
13924
|
-
var
|
|
13955
|
+
var import_jsx_runtime154 = require("react/jsx-runtime");
|
|
13925
13956
|
function DefaultControl(props) {
|
|
13926
13957
|
const {
|
|
13927
13958
|
triggerId,
|
|
@@ -13964,7 +13995,7 @@ function DefaultControl(props) {
|
|
|
13964
13995
|
const Chip = components.MultiValueChip ?? DefaultMultiValueChip;
|
|
13965
13996
|
const showClear = Boolean(clearable) && hasValue && !readOnly && !disabled;
|
|
13966
13997
|
const placeholderText = isMulti ? !hasValue ? placeholder : "" : placeholder;
|
|
13967
|
-
return /* @__PURE__ */ (0,
|
|
13998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
13968
13999
|
ComboboxTrigger,
|
|
13969
14000
|
{
|
|
13970
14001
|
triggerId,
|
|
@@ -14000,7 +14031,7 @@ function DefaultControl(props) {
|
|
|
14000
14031
|
autoFocus,
|
|
14001
14032
|
leftIcon,
|
|
14002
14033
|
searchable,
|
|
14003
|
-
leadingContent: isMulti ? selectedOptions.map((option) => /* @__PURE__ */ (0,
|
|
14034
|
+
leadingContent: isMulti ? selectedOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
14004
14035
|
Chip,
|
|
14005
14036
|
{
|
|
14006
14037
|
option,
|
|
@@ -14015,7 +14046,7 @@ function DefaultControl(props) {
|
|
|
14015
14046
|
|
|
14016
14047
|
// src/dashboard/_select-internals/slots/StaticControl.tsx
|
|
14017
14048
|
var import_lucide_react47 = require("lucide-react");
|
|
14018
|
-
var
|
|
14049
|
+
var import_jsx_runtime155 = require("react/jsx-runtime");
|
|
14019
14050
|
function StaticControl(props) {
|
|
14020
14051
|
const {
|
|
14021
14052
|
triggerId,
|
|
@@ -14043,8 +14074,8 @@ function StaticControl(props) {
|
|
|
14043
14074
|
leftIcon
|
|
14044
14075
|
} = props;
|
|
14045
14076
|
const showClear = Boolean(clearable) && hasValue && !readOnly && !disabled;
|
|
14046
|
-
return /* @__PURE__ */ (0,
|
|
14047
|
-
/* @__PURE__ */ (0,
|
|
14077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("div", { className: "relative", children: [
|
|
14078
|
+
/* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
14048
14079
|
SelectTrigger,
|
|
14049
14080
|
{
|
|
14050
14081
|
triggerId,
|
|
@@ -14070,21 +14101,21 @@ function StaticControl(props) {
|
|
|
14070
14101
|
onFocus: onTriggerFocus
|
|
14071
14102
|
}
|
|
14072
14103
|
),
|
|
14073
|
-
showClear && /* @__PURE__ */ (0,
|
|
14104
|
+
showClear && /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
14074
14105
|
"button",
|
|
14075
14106
|
{
|
|
14076
14107
|
type: "button",
|
|
14077
14108
|
onClick: onClear,
|
|
14078
14109
|
className: "absolute right-9 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-[3px] border-0 bg-transparent p-0 text-[#9696b9] hover:shadow-[0_3px_3px_#0f477734]",
|
|
14079
14110
|
"aria-label": clearLabel,
|
|
14080
|
-
children: /* @__PURE__ */ (0,
|
|
14111
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(import_lucide_react47.SquareX, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
14081
14112
|
}
|
|
14082
14113
|
)
|
|
14083
14114
|
] });
|
|
14084
14115
|
}
|
|
14085
14116
|
|
|
14086
14117
|
// src/dashboard/_select-internals/slots/DefaultMenuList.tsx
|
|
14087
|
-
var
|
|
14118
|
+
var import_jsx_runtime156 = require("react/jsx-runtime");
|
|
14088
14119
|
function DefaultMenuList(props) {
|
|
14089
14120
|
const {
|
|
14090
14121
|
id,
|
|
@@ -14113,7 +14144,7 @@ function DefaultMenuList(props) {
|
|
|
14113
14144
|
groupedOptions,
|
|
14114
14145
|
formatGroupLabel
|
|
14115
14146
|
} = props;
|
|
14116
|
-
return /* @__PURE__ */ (0,
|
|
14147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
|
|
14117
14148
|
SelectMenu,
|
|
14118
14149
|
{
|
|
14119
14150
|
id,
|
|
@@ -14148,14 +14179,14 @@ function DefaultMenuList(props) {
|
|
|
14148
14179
|
|
|
14149
14180
|
// src/dashboard/_select-internals/slots/DefaultCreateOption.tsx
|
|
14150
14181
|
var import_react_i18next31 = require("react-i18next");
|
|
14151
|
-
var
|
|
14182
|
+
var import_jsx_runtime157 = require("react/jsx-runtime");
|
|
14152
14183
|
function DefaultCreateOption({
|
|
14153
14184
|
inputValue,
|
|
14154
14185
|
onCreate,
|
|
14155
14186
|
formatCreateLabel
|
|
14156
14187
|
}) {
|
|
14157
14188
|
const { t } = (0, import_react_i18next31.useTranslation)();
|
|
14158
|
-
return /* @__PURE__ */ (0,
|
|
14189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
14159
14190
|
"button",
|
|
14160
14191
|
{
|
|
14161
14192
|
type: "button",
|
|
@@ -14189,7 +14220,7 @@ function mergeComponents(overrides) {
|
|
|
14189
14220
|
}
|
|
14190
14221
|
|
|
14191
14222
|
// src/dashboard/select/Select.tsx
|
|
14192
|
-
var
|
|
14223
|
+
var React50 = __toESM(require("react"), 1);
|
|
14193
14224
|
var import_react_i18next32 = require("react-i18next");
|
|
14194
14225
|
|
|
14195
14226
|
// src/dashboard/select/useSetCorrectOptionIfThereIsOnlyValue.ts
|
|
@@ -14208,7 +14239,7 @@ function useSetCorrectOptionIfThereIsOnlyValue({ value, options, onChange, enabl
|
|
|
14208
14239
|
}
|
|
14209
14240
|
|
|
14210
14241
|
// src/dashboard/select/Select.tsx
|
|
14211
|
-
var
|
|
14242
|
+
var import_jsx_runtime158 = require("react/jsx-runtime");
|
|
14212
14243
|
function SelectInternal(props, ref) {
|
|
14213
14244
|
const {
|
|
14214
14245
|
options = [],
|
|
@@ -14266,7 +14297,7 @@ function SelectInternal(props, ref) {
|
|
|
14266
14297
|
const closeMenuOnSelect = isMulti ? props.closeMenuOnSelect ?? false : void 0;
|
|
14267
14298
|
const { t } = (0, import_react_i18next32.useTranslation)();
|
|
14268
14299
|
const isControlled = props.value !== void 0;
|
|
14269
|
-
const [internalValue, setInternalValue] =
|
|
14300
|
+
const [internalValue, setInternalValue] = React50.useState(() => {
|
|
14270
14301
|
if (isMulti) return props.defaultValue ?? [];
|
|
14271
14302
|
return props.defaultValue ?? null;
|
|
14272
14303
|
});
|
|
@@ -14277,11 +14308,11 @@ function SelectInternal(props, ref) {
|
|
|
14277
14308
|
options,
|
|
14278
14309
|
onChange: !isMulti ? props.onChange : void 0
|
|
14279
14310
|
});
|
|
14280
|
-
const selectedOptions =
|
|
14311
|
+
const selectedOptions = React50.useMemo(() => {
|
|
14281
14312
|
if (isMulti) return currentValue ?? [];
|
|
14282
14313
|
return currentValue ? [currentValue] : [];
|
|
14283
14314
|
}, [isMulti, currentValue]);
|
|
14284
|
-
const onSelectionChange =
|
|
14315
|
+
const onSelectionChange = React50.useCallback(
|
|
14285
14316
|
(next, meta) => {
|
|
14286
14317
|
if (isMulti) {
|
|
14287
14318
|
if (!isControlled) setInternalValue(next);
|
|
@@ -14294,7 +14325,7 @@ function SelectInternal(props, ref) {
|
|
|
14294
14325
|
},
|
|
14295
14326
|
[isMulti, isControlled, props.onChange]
|
|
14296
14327
|
);
|
|
14297
|
-
const flatOptions =
|
|
14328
|
+
const flatOptions = React50.useMemo(() => flattenGroupedOptions(options), [options]);
|
|
14298
14329
|
const state = useSelectState({
|
|
14299
14330
|
isMulti,
|
|
14300
14331
|
options: flatOptions,
|
|
@@ -14325,14 +14356,14 @@ function SelectInternal(props, ref) {
|
|
|
14325
14356
|
isSearchInDropdown,
|
|
14326
14357
|
searchable
|
|
14327
14358
|
});
|
|
14328
|
-
const components =
|
|
14359
|
+
const components = React50.useMemo(() => {
|
|
14329
14360
|
const merged = mergeComponents(userComponents);
|
|
14330
14361
|
if ((isSearchInDropdown || !searchable && !isMulti) && !userComponents?.Control) {
|
|
14331
14362
|
return { ...merged, Control: StaticControl };
|
|
14332
14363
|
}
|
|
14333
14364
|
return merged;
|
|
14334
14365
|
}, [userComponents, isSearchInDropdown, searchable, isMulti]);
|
|
14335
|
-
|
|
14366
|
+
React50.useImperativeHandle(
|
|
14336
14367
|
ref,
|
|
14337
14368
|
() => state.containerRef.current
|
|
14338
14369
|
);
|
|
@@ -14340,13 +14371,14 @@ function SelectInternal(props, ref) {
|
|
|
14340
14371
|
const resolvedTitle = label ?? placeholder;
|
|
14341
14372
|
const accessibleLabel = !hasLabel && typeof placeholder === "string" ? placeholder : void 0;
|
|
14342
14373
|
const hasInvalidState = state.hasInvalidState || Boolean(invalid);
|
|
14374
|
+
const hasLeadingIcon = Boolean(leftIcon);
|
|
14343
14375
|
const hiddenValue = isMulti ? selectedOptions.map((item) => String(item.value)).join(",") : selectedOptions[0] ? String(selectedOptions[0].value) : "";
|
|
14344
14376
|
const handleClear = (event) => {
|
|
14345
14377
|
state.clearSelection(event);
|
|
14346
14378
|
onReset?.();
|
|
14347
14379
|
};
|
|
14348
14380
|
const { Control, MenuList, CreateOption } = components;
|
|
14349
|
-
return /* @__PURE__ */ (0,
|
|
14381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
|
|
14350
14382
|
SelectFieldShell,
|
|
14351
14383
|
{
|
|
14352
14384
|
containerRef: state.containerRef,
|
|
@@ -14365,7 +14397,7 @@ function SelectInternal(props, ref) {
|
|
|
14365
14397
|
hiddenValue,
|
|
14366
14398
|
onBlur: state.handleBlur,
|
|
14367
14399
|
children: [
|
|
14368
|
-
/* @__PURE__ */ (0,
|
|
14400
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
14369
14401
|
Control,
|
|
14370
14402
|
{
|
|
14371
14403
|
triggerId: state.ids.triggerId,
|
|
@@ -14408,7 +14440,7 @@ function SelectInternal(props, ref) {
|
|
|
14408
14440
|
components
|
|
14409
14441
|
}
|
|
14410
14442
|
),
|
|
14411
|
-
/* @__PURE__ */ (0,
|
|
14443
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
14412
14444
|
Fieldset,
|
|
14413
14445
|
{
|
|
14414
14446
|
isFocused: state.isFocused || state.isOpen,
|
|
@@ -14424,11 +14456,11 @@ function SelectInternal(props, ref) {
|
|
|
14424
14456
|
label,
|
|
14425
14457
|
tooltip,
|
|
14426
14458
|
onClick: state.handleContainerClick,
|
|
14427
|
-
labelClassName:
|
|
14459
|
+
labelClassName: hasLeadingIcon ? "pl-[28px]" : void 0,
|
|
14428
14460
|
className: fieldsetClassName
|
|
14429
14461
|
}
|
|
14430
14462
|
),
|
|
14431
|
-
/* @__PURE__ */ (0,
|
|
14463
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
|
|
14432
14464
|
SelectMenuPanel,
|
|
14433
14465
|
{
|
|
14434
14466
|
isOpen: state.isOpen,
|
|
@@ -14441,7 +14473,7 @@ function SelectInternal(props, ref) {
|
|
|
14441
14473
|
className: dropdownClassName,
|
|
14442
14474
|
drawerClassName,
|
|
14443
14475
|
children: [
|
|
14444
|
-
state.inMenuSearchVisible && /* @__PURE__ */ (0,
|
|
14476
|
+
state.inMenuSearchVisible && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
14445
14477
|
SelectSearchInput,
|
|
14446
14478
|
{
|
|
14447
14479
|
inputRef: state.mobileSearchInputRef,
|
|
@@ -14454,7 +14486,7 @@ function SelectInternal(props, ref) {
|
|
|
14454
14486
|
}
|
|
14455
14487
|
),
|
|
14456
14488
|
menuHeader,
|
|
14457
|
-
/* @__PURE__ */ (0,
|
|
14489
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
14458
14490
|
MenuList,
|
|
14459
14491
|
{
|
|
14460
14492
|
id: state.ids.listboxId,
|
|
@@ -14482,7 +14514,7 @@ function SelectInternal(props, ref) {
|
|
|
14482
14514
|
formatGroupLabel
|
|
14483
14515
|
}
|
|
14484
14516
|
),
|
|
14485
|
-
state.canCreateNewOption && /* @__PURE__ */ (0,
|
|
14517
|
+
state.canCreateNewOption && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
14486
14518
|
CreateOption,
|
|
14487
14519
|
{
|
|
14488
14520
|
inputValue: state.trimmedInput,
|
|
@@ -14497,7 +14529,7 @@ function SelectInternal(props, ref) {
|
|
|
14497
14529
|
}
|
|
14498
14530
|
);
|
|
14499
14531
|
}
|
|
14500
|
-
var Select =
|
|
14532
|
+
var Select = React50.forwardRef(SelectInternal);
|
|
14501
14533
|
|
|
14502
14534
|
// src/dashboard/phone-input/utils.ts
|
|
14503
14535
|
var PREFIX_REGEX = /^\+/;
|
|
@@ -14567,14 +14599,17 @@ function formatPhoneCodeOptionLabel(option) {
|
|
|
14567
14599
|
}
|
|
14568
14600
|
|
|
14569
14601
|
// src/dashboard/phone-input/PhoneInput.tsx
|
|
14570
|
-
var
|
|
14571
|
-
var PhoneInput =
|
|
14602
|
+
var import_jsx_runtime159 = require("react/jsx-runtime");
|
|
14603
|
+
var PhoneInput = React51.forwardRef(
|
|
14572
14604
|
function PhoneInput2({
|
|
14573
14605
|
options,
|
|
14574
14606
|
value,
|
|
14575
14607
|
onChange,
|
|
14576
14608
|
onFocus,
|
|
14577
14609
|
onBlur,
|
|
14610
|
+
onKeyDown,
|
|
14611
|
+
onFieldFocus,
|
|
14612
|
+
onFieldBlur,
|
|
14578
14613
|
name,
|
|
14579
14614
|
codeName,
|
|
14580
14615
|
numberName,
|
|
@@ -14598,10 +14633,10 @@ var PhoneInput = React50.forwardRef(
|
|
|
14598
14633
|
defaultNumber
|
|
14599
14634
|
}, ref) {
|
|
14600
14635
|
const { t } = (0, import_react_i18next33.useTranslation)();
|
|
14601
|
-
const groupLabelId =
|
|
14602
|
-
const errorMsgId =
|
|
14603
|
-
const numberInputRef =
|
|
14604
|
-
const [codeSearchValue, setCodeSearchValue] =
|
|
14636
|
+
const groupLabelId = React51.useId();
|
|
14637
|
+
const errorMsgId = React51.useId();
|
|
14638
|
+
const numberInputRef = React51.useRef(null);
|
|
14639
|
+
const [codeSearchValue, setCodeSearchValue] = React51.useState("");
|
|
14605
14640
|
const safeValue = toPhoneValue(value, defaultCode, defaultNumber);
|
|
14606
14641
|
const effectiveCode = safeValue.code || defaultCode || "";
|
|
14607
14642
|
const resolvedLabel = label ?? "";
|
|
@@ -14610,7 +14645,7 @@ var PhoneInput = React50.forwardRef(
|
|
|
14610
14645
|
const hasInvalidState = hasExternalError || Boolean(invalid) || isPrefixRequired;
|
|
14611
14646
|
const errorMessage = error ?? (isPrefixRequired ? t("prefix_required") : void 0);
|
|
14612
14647
|
const combinedValue = effectiveCode || safeValue.number ? `${effectiveCode}${safeValue.number}` : "";
|
|
14613
|
-
const codeOptions =
|
|
14648
|
+
const codeOptions = React51.useMemo(
|
|
14614
14649
|
() => options.map((option) => ({
|
|
14615
14650
|
value: option.value,
|
|
14616
14651
|
label: formatPhoneCodeOptionLabel(option),
|
|
@@ -14619,11 +14654,11 @@ var PhoneInput = React50.forwardRef(
|
|
|
14619
14654
|
})),
|
|
14620
14655
|
[options]
|
|
14621
14656
|
);
|
|
14622
|
-
const selectedCodeOption =
|
|
14657
|
+
const selectedCodeOption = React51.useMemo(
|
|
14623
14658
|
() => codeOptions.find((option) => option.value === effectiveCode) ?? null,
|
|
14624
14659
|
[codeOptions, effectiveCode]
|
|
14625
14660
|
);
|
|
14626
|
-
const parsePhoneValue =
|
|
14661
|
+
const parsePhoneValue = React51.useMemo(
|
|
14627
14662
|
() => parsePhoneValueWithOptions(options),
|
|
14628
14663
|
[options]
|
|
14629
14664
|
);
|
|
@@ -14652,17 +14687,17 @@ var PhoneInput = React50.forwardRef(
|
|
|
14652
14687
|
}
|
|
14653
14688
|
emitChange({ code: effectiveCode, number: cleanedNumber });
|
|
14654
14689
|
};
|
|
14655
|
-
const effectiveCodeRef =
|
|
14656
|
-
const numberValueRef =
|
|
14657
|
-
const codeSearchValueRef =
|
|
14658
|
-
const onChangeRef =
|
|
14659
|
-
const nameRef =
|
|
14690
|
+
const effectiveCodeRef = React51.useRef(effectiveCode);
|
|
14691
|
+
const numberValueRef = React51.useRef(safeValue.number);
|
|
14692
|
+
const codeSearchValueRef = React51.useRef(codeSearchValue);
|
|
14693
|
+
const onChangeRef = React51.useRef(onChange);
|
|
14694
|
+
const nameRef = React51.useRef(name);
|
|
14660
14695
|
effectiveCodeRef.current = effectiveCode;
|
|
14661
14696
|
numberValueRef.current = safeValue.number;
|
|
14662
14697
|
codeSearchValueRef.current = codeSearchValue;
|
|
14663
14698
|
onChangeRef.current = onChange;
|
|
14664
14699
|
nameRef.current = name;
|
|
14665
|
-
|
|
14700
|
+
React51.useImperativeHandle(
|
|
14666
14701
|
ref,
|
|
14667
14702
|
() => ({
|
|
14668
14703
|
getCodeSearchValue: () => codeSearchValueRef.current,
|
|
@@ -14679,7 +14714,7 @@ var PhoneInput = React50.forwardRef(
|
|
|
14679
14714
|
}),
|
|
14680
14715
|
[]
|
|
14681
14716
|
);
|
|
14682
|
-
return /* @__PURE__ */ (0,
|
|
14717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)(
|
|
14683
14718
|
"div",
|
|
14684
14719
|
{
|
|
14685
14720
|
className: cn(
|
|
@@ -14689,8 +14724,8 @@ var PhoneInput = React50.forwardRef(
|
|
|
14689
14724
|
className
|
|
14690
14725
|
),
|
|
14691
14726
|
children: [
|
|
14692
|
-
name && /* @__PURE__ */ (0,
|
|
14693
|
-
codeName && /* @__PURE__ */ (0,
|
|
14727
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
14728
|
+
codeName && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
|
|
14694
14729
|
"input",
|
|
14695
14730
|
{
|
|
14696
14731
|
type: "hidden",
|
|
@@ -14699,7 +14734,7 @@ var PhoneInput = React50.forwardRef(
|
|
|
14699
14734
|
disabled
|
|
14700
14735
|
}
|
|
14701
14736
|
),
|
|
14702
|
-
numberName && /* @__PURE__ */ (0,
|
|
14737
|
+
numberName && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
|
|
14703
14738
|
"input",
|
|
14704
14739
|
{
|
|
14705
14740
|
type: "hidden",
|
|
@@ -14708,22 +14743,22 @@ var PhoneInput = React50.forwardRef(
|
|
|
14708
14743
|
disabled
|
|
14709
14744
|
}
|
|
14710
14745
|
),
|
|
14711
|
-
topLabel && /* @__PURE__ */ (0,
|
|
14746
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
|
|
14712
14747
|
"span",
|
|
14713
14748
|
{
|
|
14714
14749
|
id: groupLabelId,
|
|
14715
|
-
className: "mb-2 block text-[
|
|
14750
|
+
className: "mb-2 block text-[length:var(--field-top-label-font-size)] font-[var(--field-top-label-font-weight)] text-[var(--chekin-color-brand-navy)]",
|
|
14716
14751
|
children: topLabel
|
|
14717
14752
|
}
|
|
14718
14753
|
),
|
|
14719
|
-
/* @__PURE__ */ (0,
|
|
14754
|
+
/* @__PURE__ */ (0, import_jsx_runtime159.jsxs)(
|
|
14720
14755
|
"div",
|
|
14721
14756
|
{
|
|
14722
14757
|
role: "group",
|
|
14723
14758
|
"aria-labelledby": topLabel ? groupLabelId : void 0,
|
|
14724
14759
|
className: "grid grid-cols-[96px_minmax(0,1fr)] gap-2",
|
|
14725
14760
|
children: [
|
|
14726
|
-
/* @__PURE__ */ (0,
|
|
14761
|
+
/* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
|
|
14727
14762
|
Select,
|
|
14728
14763
|
{
|
|
14729
14764
|
options: codeOptions,
|
|
@@ -14744,10 +14779,12 @@ var PhoneInput = React50.forwardRef(
|
|
|
14744
14779
|
className: "max-w-none w-auto",
|
|
14745
14780
|
dropdownClassName: "right-auto w-[280px]",
|
|
14746
14781
|
inputValue: searchable ? codeSearchValue : void 0,
|
|
14747
|
-
onInputChange: setCodeSearchValue
|
|
14782
|
+
onInputChange: setCodeSearchValue,
|
|
14783
|
+
onFocus: () => onFieldFocus?.("code"),
|
|
14784
|
+
onBlur: () => onFieldBlur?.("code")
|
|
14748
14785
|
}
|
|
14749
14786
|
),
|
|
14750
|
-
/* @__PURE__ */ (0,
|
|
14787
|
+
/* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
|
|
14751
14788
|
Input,
|
|
14752
14789
|
{
|
|
14753
14790
|
ref: numberInputRef,
|
|
@@ -14765,8 +14802,15 @@ var PhoneInput = React50.forwardRef(
|
|
|
14765
14802
|
"aria-label": resolvedLabel || name,
|
|
14766
14803
|
"aria-describedby": errorMessage ? errorMsgId : void 0,
|
|
14767
14804
|
onChange: handleNumberChange,
|
|
14768
|
-
|
|
14769
|
-
|
|
14805
|
+
onKeyDown,
|
|
14806
|
+
onFocus: (event) => {
|
|
14807
|
+
onFocus?.(event);
|
|
14808
|
+
onFieldFocus?.("number");
|
|
14809
|
+
},
|
|
14810
|
+
onBlur: (event) => {
|
|
14811
|
+
onBlur?.(event);
|
|
14812
|
+
onFieldBlur?.("number");
|
|
14813
|
+
},
|
|
14770
14814
|
renderErrorMessage: false,
|
|
14771
14815
|
wrapperClassName: "max-w-none w-auto",
|
|
14772
14816
|
contentClassName: readOnly ? "!cursor-default" : void 0,
|
|
@@ -14776,8 +14820,8 @@ var PhoneInput = React50.forwardRef(
|
|
|
14776
14820
|
]
|
|
14777
14821
|
}
|
|
14778
14822
|
),
|
|
14779
|
-
!errorMessage && optional && /* @__PURE__ */ (0,
|
|
14780
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
14823
|
+
!errorMessage && optional && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
14824
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
|
|
14781
14825
|
FieldErrorMessage,
|
|
14782
14826
|
{
|
|
14783
14827
|
id: errorMsgId,
|
|
@@ -14794,41 +14838,41 @@ var PhoneInput = React50.forwardRef(
|
|
|
14794
14838
|
PhoneInput.displayName = "PhoneInput";
|
|
14795
14839
|
|
|
14796
14840
|
// src/dashboard/creatable-select/CreatableSelect.tsx
|
|
14797
|
-
var React51 = __toESM(require("react"), 1);
|
|
14798
|
-
var import_jsx_runtime159 = require("react/jsx-runtime");
|
|
14799
|
-
var CreatableSelect = React51.forwardRef(function CreatableSelect2(props, ref) {
|
|
14800
|
-
return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(Select, { ref, ...props, isCreatable: true });
|
|
14801
|
-
});
|
|
14802
|
-
|
|
14803
|
-
// src/dashboard/multi-select/MultiSelect.tsx
|
|
14804
14841
|
var React52 = __toESM(require("react"), 1);
|
|
14805
14842
|
var import_jsx_runtime160 = require("react/jsx-runtime");
|
|
14806
|
-
var
|
|
14807
|
-
return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(Select, { ref, ...props,
|
|
14843
|
+
var CreatableSelect = React52.forwardRef(function CreatableSelect2(props, ref) {
|
|
14844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(Select, { ref, ...props, isCreatable: true });
|
|
14808
14845
|
});
|
|
14809
14846
|
|
|
14810
|
-
// src/dashboard/
|
|
14847
|
+
// src/dashboard/multi-select/MultiSelect.tsx
|
|
14811
14848
|
var React53 = __toESM(require("react"), 1);
|
|
14812
14849
|
var import_jsx_runtime161 = require("react/jsx-runtime");
|
|
14813
|
-
var
|
|
14814
|
-
return /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(Select, { ref, ...props, isMulti: true
|
|
14850
|
+
var MultiSelect = React53.forwardRef(function MultiSelect2(props, ref) {
|
|
14851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(Select, { ref, ...props, isMulti: true });
|
|
14852
|
+
});
|
|
14853
|
+
|
|
14854
|
+
// src/dashboard/creatable-multi-select/CreatableMultiSelect.tsx
|
|
14855
|
+
var React54 = __toESM(require("react"), 1);
|
|
14856
|
+
var import_jsx_runtime162 = require("react/jsx-runtime");
|
|
14857
|
+
var CreatableMultiSelect = React54.forwardRef(function CreatableMultiSelect2(props, ref) {
|
|
14858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(Select, { ref, ...props, isMulti: true, isCreatable: true });
|
|
14815
14859
|
});
|
|
14816
14860
|
|
|
14817
14861
|
// src/dashboard/infinite-scroll-select/InfiniteScrollSelect.tsx
|
|
14818
|
-
var
|
|
14862
|
+
var React57 = __toESM(require("react"), 1);
|
|
14819
14863
|
|
|
14820
14864
|
// src/dashboard/infinite-scroll-select/VirtualMenuList.tsx
|
|
14821
|
-
var
|
|
14865
|
+
var React56 = __toESM(require("react"), 1);
|
|
14822
14866
|
var import_react_i18next34 = require("react-i18next");
|
|
14823
14867
|
var import_react_virtual2 = require("@tanstack/react-virtual");
|
|
14824
14868
|
|
|
14825
14869
|
// src/dashboard/infinite-scroll-select/InfiniteScrollContext.tsx
|
|
14826
|
-
var
|
|
14827
|
-
var InfiniteScrollContext =
|
|
14870
|
+
var React55 = __toESM(require("react"), 1);
|
|
14871
|
+
var InfiniteScrollContext = React55.createContext(
|
|
14828
14872
|
null
|
|
14829
14873
|
);
|
|
14830
14874
|
function useInfiniteScrollContext() {
|
|
14831
|
-
const ctx =
|
|
14875
|
+
const ctx = React55.useContext(InfiniteScrollContext);
|
|
14832
14876
|
if (!ctx) {
|
|
14833
14877
|
throw new Error(
|
|
14834
14878
|
"useInfiniteScrollContext must be used within an InfiniteScrollContext.Provider"
|
|
@@ -14838,7 +14882,7 @@ function useInfiniteScrollContext() {
|
|
|
14838
14882
|
}
|
|
14839
14883
|
|
|
14840
14884
|
// src/dashboard/infinite-scroll-select/VirtualMenuList.tsx
|
|
14841
|
-
var
|
|
14885
|
+
var import_jsx_runtime163 = require("react/jsx-runtime");
|
|
14842
14886
|
function VirtualMenuList(props) {
|
|
14843
14887
|
const {
|
|
14844
14888
|
id,
|
|
@@ -14873,9 +14917,9 @@ function VirtualMenuList(props) {
|
|
|
14873
14917
|
} = useInfiniteScrollContext();
|
|
14874
14918
|
const Option = components?.Option ?? DefaultOption;
|
|
14875
14919
|
const { t } = (0, import_react_i18next34.useTranslation)();
|
|
14876
|
-
const scrollRef =
|
|
14877
|
-
const lastLoadMoreOptionsLengthRef =
|
|
14878
|
-
const previousHighlightedIndexRef =
|
|
14920
|
+
const scrollRef = React56.useRef(null);
|
|
14921
|
+
const lastLoadMoreOptionsLengthRef = React56.useRef(null);
|
|
14922
|
+
const previousHighlightedIndexRef = React56.useRef(-1);
|
|
14879
14923
|
const showLoaderRow = Boolean(canLoadMore || isLoadingMore);
|
|
14880
14924
|
const itemCount = options.length + (showLoaderRow ? 1 : 0);
|
|
14881
14925
|
const virtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
@@ -14888,7 +14932,7 @@ function VirtualMenuList(props) {
|
|
|
14888
14932
|
const totalSize = virtualizer.getTotalSize();
|
|
14889
14933
|
const measuredListHeight = Math.min(listHeight, Math.max(totalSize, itemHeight));
|
|
14890
14934
|
const resolvedLoadingMoreText = loadingMoreText ?? t("loading_more");
|
|
14891
|
-
|
|
14935
|
+
React56.useEffect(() => {
|
|
14892
14936
|
if (!canLoadMore || isLoadingMore || !loadMoreItems) return;
|
|
14893
14937
|
if (virtualItems.length === 0) return;
|
|
14894
14938
|
const lastItem = virtualItems[virtualItems.length - 1];
|
|
@@ -14904,7 +14948,7 @@ function VirtualMenuList(props) {
|
|
|
14904
14948
|
loadMoreItems,
|
|
14905
14949
|
loadMoreThreshold
|
|
14906
14950
|
]);
|
|
14907
|
-
|
|
14951
|
+
React56.useEffect(() => {
|
|
14908
14952
|
const changed = previousHighlightedIndexRef.current !== highlightedIndex;
|
|
14909
14953
|
previousHighlightedIndexRef.current = highlightedIndex;
|
|
14910
14954
|
if (highlightedIndex < 0 || !changed) return;
|
|
@@ -14914,8 +14958,8 @@ function VirtualMenuList(props) {
|
|
|
14914
14958
|
const lastOptionIndex = options.length - 1;
|
|
14915
14959
|
const emptyMessage = noOptionsMessage?.() ?? t("no_options");
|
|
14916
14960
|
const isOptionSelected2 = (option) => isOptionSelectedProp ? isOptionSelectedProp(option, selectedOptions) : selectedOptions.some((s) => s.value === option.value);
|
|
14917
|
-
const wasAtBottomRef =
|
|
14918
|
-
const handleScroll =
|
|
14961
|
+
const wasAtBottomRef = React56.useRef(false);
|
|
14962
|
+
const handleScroll = React56.useCallback(
|
|
14919
14963
|
(event) => {
|
|
14920
14964
|
if (!onMenuScrollToBottom) return;
|
|
14921
14965
|
const target = event.currentTarget;
|
|
@@ -14928,7 +14972,7 @@ function VirtualMenuList(props) {
|
|
|
14928
14972
|
[onMenuScrollToBottom]
|
|
14929
14973
|
);
|
|
14930
14974
|
if (options.length === 0) {
|
|
14931
|
-
return /* @__PURE__ */ (0,
|
|
14975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)("div", { className: "min-h-[75px] px-4 pb-[19px] pt-[17px]", children: isLoadingMore ? /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(
|
|
14932
14976
|
"div",
|
|
14933
14977
|
{
|
|
14934
14978
|
role: "status",
|
|
@@ -14936,8 +14980,8 @@ function VirtualMenuList(props) {
|
|
|
14936
14980
|
"aria-live": "polite",
|
|
14937
14981
|
className: "flex flex-col gap-2",
|
|
14938
14982
|
children: [
|
|
14939
|
-
/* @__PURE__ */ (0,
|
|
14940
|
-
Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ (0,
|
|
14983
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("span", { className: "sr-only", children: resolvedLoadingMoreText }),
|
|
14984
|
+
Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
14941
14985
|
Skeleton,
|
|
14942
14986
|
{
|
|
14943
14987
|
className: "h-10 w-full rounded-md",
|
|
@@ -14947,16 +14991,16 @@ function VirtualMenuList(props) {
|
|
|
14947
14991
|
))
|
|
14948
14992
|
]
|
|
14949
14993
|
}
|
|
14950
|
-
) : /* @__PURE__ */ (0,
|
|
14994
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime163.jsx)("div", { className: "flex min-h-[40px] items-center text-[16px] font-medium text-[var(--chekin-color-brand-navy)]", children: emptyMessage }) });
|
|
14951
14995
|
}
|
|
14952
|
-
return /* @__PURE__ */ (0,
|
|
14996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)("div", { className: "min-h-[75px] px-4 pb-[19px] pt-[17px]", children: /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
14953
14997
|
"div",
|
|
14954
14998
|
{
|
|
14955
14999
|
ref: scrollRef,
|
|
14956
15000
|
className: cn("overflow-y-auto", menuClassName),
|
|
14957
15001
|
style: { height: `${measuredListHeight}px` },
|
|
14958
15002
|
onScroll: onMenuScrollToBottom ? handleScroll : void 0,
|
|
14959
|
-
children: /* @__PURE__ */ (0,
|
|
15003
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
14960
15004
|
"div",
|
|
14961
15005
|
{
|
|
14962
15006
|
id,
|
|
@@ -14976,7 +15020,7 @@ function VirtualMenuList(props) {
|
|
|
14976
15020
|
disabled || option?.isDisabled || option && isOptionDisabled?.(option)
|
|
14977
15021
|
);
|
|
14978
15022
|
const isLastOption = !isLoaderRow && virtualItem.index === lastOptionIndex && !canLoadMore;
|
|
14979
|
-
return /* @__PURE__ */ (0,
|
|
15023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
14980
15024
|
"div",
|
|
14981
15025
|
{
|
|
14982
15026
|
"data-index": virtualItem.index,
|
|
@@ -14985,7 +15029,7 @@ function VirtualMenuList(props) {
|
|
|
14985
15029
|
height: `${virtualItem.size}px`,
|
|
14986
15030
|
transform: `translateY(${virtualItem.start}px)`
|
|
14987
15031
|
},
|
|
14988
|
-
children: isLoaderRow ? /* @__PURE__ */ (0,
|
|
15032
|
+
children: isLoaderRow ? /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(
|
|
14989
15033
|
"div",
|
|
14990
15034
|
{
|
|
14991
15035
|
role: "status",
|
|
@@ -14993,8 +15037,8 @@ function VirtualMenuList(props) {
|
|
|
14993
15037
|
"aria-live": "polite",
|
|
14994
15038
|
className: "flex h-full items-center justify-center",
|
|
14995
15039
|
children: [
|
|
14996
|
-
/* @__PURE__ */ (0,
|
|
14997
|
-
/* @__PURE__ */ (0,
|
|
15040
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)("span", { className: "sr-only", children: resolvedLoadingMoreText }),
|
|
15041
|
+
/* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
14998
15042
|
ThreeDotsLoader,
|
|
14999
15043
|
{
|
|
15000
15044
|
height: 24,
|
|
@@ -15004,7 +15048,7 @@ function VirtualMenuList(props) {
|
|
|
15004
15048
|
)
|
|
15005
15049
|
]
|
|
15006
15050
|
}
|
|
15007
|
-
) : option ? /* @__PURE__ */ (0,
|
|
15051
|
+
) : option ? /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
15008
15052
|
Option,
|
|
15009
15053
|
{
|
|
15010
15054
|
id: getOptionId2(virtualItem.index),
|
|
@@ -15034,7 +15078,7 @@ function VirtualMenuList(props) {
|
|
|
15034
15078
|
}
|
|
15035
15079
|
|
|
15036
15080
|
// src/dashboard/infinite-scroll-select/InfiniteScrollSelect.tsx
|
|
15037
|
-
var
|
|
15081
|
+
var import_jsx_runtime164 = require("react/jsx-runtime");
|
|
15038
15082
|
var DEFAULT_ITEM_HEIGHT = 60;
|
|
15039
15083
|
var DEFAULT_LIST_HEIGHT = 322;
|
|
15040
15084
|
var DEFAULT_OVERSCAN = 5;
|
|
@@ -15062,8 +15106,8 @@ function InfiniteScrollSelectInternal(props, ref) {
|
|
|
15062
15106
|
const getFullSearchOption = isMulti ? void 0 : getFullSearchOptionProp;
|
|
15063
15107
|
const isPaginated = canLoadMore !== void 0 || isLoadingMore !== void 0 || loadMoreItems !== void 0 || onSearchChange !== void 0 || getFullSearchOption !== void 0;
|
|
15064
15108
|
const filterOption = userFilterOption ?? (isPaginated ? passthroughFilter : defaultFilterOption);
|
|
15065
|
-
const [inputValue, setInputValue] =
|
|
15066
|
-
const filteredOptions =
|
|
15109
|
+
const [inputValue, setInputValue] = React57.useState("");
|
|
15110
|
+
const filteredOptions = React57.useMemo(() => {
|
|
15067
15111
|
const trimmed = inputValue.trim();
|
|
15068
15112
|
const valueLabel = (() => {
|
|
15069
15113
|
if (isMulti) return "";
|
|
@@ -15082,7 +15126,7 @@ function InfiniteScrollSelectInternal(props, ref) {
|
|
|
15082
15126
|
}
|
|
15083
15127
|
return list;
|
|
15084
15128
|
}, [rawOptions, inputValue, filterOption, getFullSearchOption, isMulti, rest]);
|
|
15085
|
-
const contextValue =
|
|
15129
|
+
const contextValue = React57.useMemo(
|
|
15086
15130
|
() => ({
|
|
15087
15131
|
canLoadMore,
|
|
15088
15132
|
isLoadingMore,
|
|
@@ -15104,11 +15148,11 @@ function InfiniteScrollSelectInternal(props, ref) {
|
|
|
15104
15148
|
loadMoreThreshold
|
|
15105
15149
|
]
|
|
15106
15150
|
);
|
|
15107
|
-
const components =
|
|
15151
|
+
const components = React57.useMemo(
|
|
15108
15152
|
() => ({ ...userComponents, MenuList: VirtualMenuList }),
|
|
15109
15153
|
[userComponents]
|
|
15110
15154
|
);
|
|
15111
|
-
const handleInputChange =
|
|
15155
|
+
const handleInputChange = React57.useCallback(
|
|
15112
15156
|
(value) => {
|
|
15113
15157
|
setInputValue(value);
|
|
15114
15158
|
onSearchChange?.(value);
|
|
@@ -15122,7 +15166,7 @@ function InfiniteScrollSelectInternal(props, ref) {
|
|
|
15122
15166
|
components,
|
|
15123
15167
|
onInputChange: handleInputChange
|
|
15124
15168
|
};
|
|
15125
|
-
return /* @__PURE__ */ (0,
|
|
15169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(InfiniteScrollContext.Provider, { value: contextValue, children: isMulti ? /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
|
|
15126
15170
|
Select,
|
|
15127
15171
|
{
|
|
15128
15172
|
ref,
|
|
@@ -15130,7 +15174,7 @@ function InfiniteScrollSelectInternal(props, ref) {
|
|
|
15130
15174
|
...selectExtras,
|
|
15131
15175
|
isMulti: true
|
|
15132
15176
|
}
|
|
15133
|
-
) : /* @__PURE__ */ (0,
|
|
15177
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
|
|
15134
15178
|
Select,
|
|
15135
15179
|
{
|
|
15136
15180
|
ref,
|
|
@@ -15140,27 +15184,27 @@ function InfiniteScrollSelectInternal(props, ref) {
|
|
|
15140
15184
|
}
|
|
15141
15185
|
) });
|
|
15142
15186
|
}
|
|
15143
|
-
var InfiniteScrollSelect =
|
|
15187
|
+
var InfiniteScrollSelect = React57.forwardRef(
|
|
15144
15188
|
InfiniteScrollSelectInternal
|
|
15145
15189
|
);
|
|
15146
15190
|
|
|
15147
15191
|
// src/dashboard/infinite-scroll-multi-select/InfiniteScrollMultiSelect.tsx
|
|
15148
|
-
var
|
|
15149
|
-
var
|
|
15150
|
-
var InfiniteScrollMultiSelect =
|
|
15192
|
+
var React58 = __toESM(require("react"), 1);
|
|
15193
|
+
var import_jsx_runtime165 = require("react/jsx-runtime");
|
|
15194
|
+
var InfiniteScrollMultiSelect = React58.forwardRef(function InfiniteScrollMultiSelect2(props, ref) {
|
|
15151
15195
|
const Forwarded = InfiniteScrollSelect;
|
|
15152
|
-
return /* @__PURE__ */ (0,
|
|
15196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(Forwarded, { ...props, ref, isMulti: true });
|
|
15153
15197
|
});
|
|
15154
15198
|
|
|
15155
15199
|
// src/dashboard/select-checkboxes/SelectCheckboxes.tsx
|
|
15156
|
-
var
|
|
15200
|
+
var React59 = __toESM(require("react"), 1);
|
|
15157
15201
|
var import_react_i18next36 = require("react-i18next");
|
|
15158
15202
|
|
|
15159
15203
|
// src/dashboard/select-checkboxes/VisualCheckbox.tsx
|
|
15160
15204
|
var import_lucide_react48 = require("lucide-react");
|
|
15161
|
-
var
|
|
15205
|
+
var import_jsx_runtime166 = require("react/jsx-runtime");
|
|
15162
15206
|
function VisualCheckbox({ checked, disabled, className }) {
|
|
15163
|
-
return /* @__PURE__ */ (0,
|
|
15207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
|
|
15164
15208
|
"span",
|
|
15165
15209
|
{
|
|
15166
15210
|
"aria-hidden": "true",
|
|
@@ -15171,13 +15215,13 @@ function VisualCheckbox({ checked, disabled, className }) {
|
|
|
15171
15215
|
disabled && "opacity-50",
|
|
15172
15216
|
className
|
|
15173
15217
|
),
|
|
15174
|
-
children: checked && /* @__PURE__ */ (0,
|
|
15218
|
+
children: checked && /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(import_lucide_react48.Check, { className: "checkbox__icon h-3 w-3" })
|
|
15175
15219
|
}
|
|
15176
15220
|
);
|
|
15177
15221
|
}
|
|
15178
15222
|
|
|
15179
15223
|
// src/dashboard/select-checkboxes/SelectCheckboxOption.tsx
|
|
15180
|
-
var
|
|
15224
|
+
var import_jsx_runtime167 = require("react/jsx-runtime");
|
|
15181
15225
|
function SelectCheckboxOption(props) {
|
|
15182
15226
|
const {
|
|
15183
15227
|
option,
|
|
@@ -15190,7 +15234,7 @@ function SelectCheckboxOption(props) {
|
|
|
15190
15234
|
onHover,
|
|
15191
15235
|
innerRef
|
|
15192
15236
|
} = props;
|
|
15193
|
-
return /* @__PURE__ */ (0,
|
|
15237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
|
|
15194
15238
|
"button",
|
|
15195
15239
|
{
|
|
15196
15240
|
id,
|
|
@@ -15211,10 +15255,10 @@ function SelectCheckboxOption(props) {
|
|
|
15211
15255
|
isDisabled && "cursor-not-allowed text-[var(--chekin-color-gray-2)]"
|
|
15212
15256
|
),
|
|
15213
15257
|
children: [
|
|
15214
|
-
/* @__PURE__ */ (0,
|
|
15215
|
-
/* @__PURE__ */ (0,
|
|
15216
|
-
/* @__PURE__ */ (0,
|
|
15217
|
-
option.description && /* @__PURE__ */ (0,
|
|
15258
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)(VisualCheckbox, { checked: isSelected, disabled: isDisabled }),
|
|
15259
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("span", { className: "flex min-w-0 flex-1 items-center justify-between gap-2", children: [
|
|
15260
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { className: "block break-words", children: option.label }),
|
|
15261
|
+
option.description && /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { className: "shrink-0 text-[12px] font-medium italic text-[var(--chekin-color-gray-1)]", children: option.description })
|
|
15218
15262
|
] })
|
|
15219
15263
|
]
|
|
15220
15264
|
}
|
|
@@ -15224,7 +15268,7 @@ function SelectCheckboxOption(props) {
|
|
|
15224
15268
|
// src/dashboard/select-checkboxes/CountTrigger.tsx
|
|
15225
15269
|
var import_lucide_react49 = require("lucide-react");
|
|
15226
15270
|
var import_react_i18next35 = require("react-i18next");
|
|
15227
|
-
var
|
|
15271
|
+
var import_jsx_runtime168 = require("react/jsx-runtime");
|
|
15228
15272
|
function createCountTrigger(opts) {
|
|
15229
15273
|
const { getValueText, getTotalCount } = opts;
|
|
15230
15274
|
function CountTrigger(props) {
|
|
@@ -15254,7 +15298,7 @@ function createCountTrigger(opts) {
|
|
|
15254
15298
|
const computedText = typeof valueText === "function" ? valueText(count, total) : valueText ?? (count > 0 ? t("n_selected", { count, defaultValue: `${count} selected` }) : "");
|
|
15255
15299
|
const display = hasValue ? computedText : isOpen ? placeholder ?? null : null;
|
|
15256
15300
|
const isEmpty = !hasValue;
|
|
15257
|
-
return /* @__PURE__ */ (0,
|
|
15301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
|
|
15258
15302
|
"button",
|
|
15259
15303
|
{
|
|
15260
15304
|
id: triggerId,
|
|
@@ -15277,9 +15321,9 @@ function createCountTrigger(opts) {
|
|
|
15277
15321
|
loading && "!cursor-progress"
|
|
15278
15322
|
),
|
|
15279
15323
|
children: [
|
|
15280
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
15281
|
-
/* @__PURE__ */ (0,
|
|
15282
|
-
/* @__PURE__ */ (0,
|
|
15324
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "pointer-events-none absolute left-0 top-0 flex h-full max-w-10 items-center justify-center text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
15325
|
+
/* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { id: valueId, className: "block min-w-0 flex-1 truncate text-left", children: display }),
|
|
15326
|
+
/* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
|
|
15283
15327
|
import_lucide_react49.ChevronDown,
|
|
15284
15328
|
{
|
|
15285
15329
|
size: 16,
|
|
@@ -15297,9 +15341,9 @@ function createCountTrigger(opts) {
|
|
|
15297
15341
|
}
|
|
15298
15342
|
|
|
15299
15343
|
// src/dashboard/select-checkboxes/SelectAllRow.tsx
|
|
15300
|
-
var
|
|
15344
|
+
var import_jsx_runtime169 = require("react/jsx-runtime");
|
|
15301
15345
|
function SelectAllRow({ label, checked, disabled, onToggle }) {
|
|
15302
|
-
return /* @__PURE__ */ (0,
|
|
15346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)(
|
|
15303
15347
|
"button",
|
|
15304
15348
|
{
|
|
15305
15349
|
type: "button",
|
|
@@ -15310,21 +15354,21 @@ function SelectAllRow({ label, checked, disabled, onToggle }) {
|
|
|
15310
15354
|
disabled && "cursor-default opacity-40"
|
|
15311
15355
|
),
|
|
15312
15356
|
children: [
|
|
15313
|
-
/* @__PURE__ */ (0,
|
|
15314
|
-
/* @__PURE__ */ (0,
|
|
15357
|
+
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)(VisualCheckbox, { checked, disabled }),
|
|
15358
|
+
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)("span", { className: "flex-1", children: label })
|
|
15315
15359
|
]
|
|
15316
15360
|
}
|
|
15317
15361
|
);
|
|
15318
15362
|
}
|
|
15319
15363
|
|
|
15320
15364
|
// src/dashboard/select-checkboxes/SelectCheckboxes.tsx
|
|
15321
|
-
var
|
|
15365
|
+
var import_jsx_runtime170 = require("react/jsx-runtime");
|
|
15322
15366
|
function hasPaginationProps(props) {
|
|
15323
15367
|
return props.canLoadMore !== void 0 || props.isLoadingMore !== void 0 || props.loadMoreItems !== void 0 || props.onSearchChange !== void 0;
|
|
15324
15368
|
}
|
|
15325
15369
|
function makeTriggerSlot(render) {
|
|
15326
15370
|
function CustomTrigger(props) {
|
|
15327
|
-
return /* @__PURE__ */ (0,
|
|
15371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(import_jsx_runtime170.Fragment, { children: render(props.isOpen, props.onContainerClick) });
|
|
15328
15372
|
}
|
|
15329
15373
|
return CustomTrigger;
|
|
15330
15374
|
}
|
|
@@ -15350,25 +15394,25 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15350
15394
|
const isPaginated = hasPaginationProps(
|
|
15351
15395
|
paginationAndRest
|
|
15352
15396
|
);
|
|
15353
|
-
const [inputValue, setInputValue] =
|
|
15397
|
+
const [inputValue, setInputValue] = React59.useState("");
|
|
15354
15398
|
const isControlled = value !== void 0;
|
|
15355
|
-
const [internalValue, setInternalValue] =
|
|
15399
|
+
const [internalValue, setInternalValue] = React59.useState(
|
|
15356
15400
|
() => defaultValue ?? []
|
|
15357
15401
|
);
|
|
15358
15402
|
const currentValue = isControlled ? value : internalValue;
|
|
15359
|
-
const selected =
|
|
15360
|
-
const handleChange =
|
|
15403
|
+
const selected = React59.useMemo(() => currentValue ?? [], [currentValue]);
|
|
15404
|
+
const handleChange = React59.useCallback(
|
|
15361
15405
|
(next, meta) => {
|
|
15362
15406
|
if (!isControlled) setInternalValue(next);
|
|
15363
15407
|
onChange?.(next, meta);
|
|
15364
15408
|
},
|
|
15365
15409
|
[isControlled, onChange]
|
|
15366
15410
|
);
|
|
15367
|
-
const flatRawOptions =
|
|
15411
|
+
const flatRawOptions = React59.useMemo(
|
|
15368
15412
|
() => flattenGroupedOptions(rawOptions),
|
|
15369
15413
|
[rawOptions]
|
|
15370
15414
|
);
|
|
15371
|
-
const filteredGrouped =
|
|
15415
|
+
const filteredGrouped = React59.useMemo(() => {
|
|
15372
15416
|
const trimmed = inputValue.trim();
|
|
15373
15417
|
if (!trimmed) return rawOptions;
|
|
15374
15418
|
return rawOptions.map((item) => {
|
|
@@ -15379,7 +15423,7 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15379
15423
|
return filterOption(item, trimmed) ? item : null;
|
|
15380
15424
|
}).filter((item) => item !== null);
|
|
15381
15425
|
}, [rawOptions, inputValue, filterOption]);
|
|
15382
|
-
const filteredFlat =
|
|
15426
|
+
const filteredFlat = React59.useMemo(
|
|
15383
15427
|
() => flattenGroupedOptions(filteredGrouped),
|
|
15384
15428
|
[filteredGrouped]
|
|
15385
15429
|
);
|
|
@@ -15387,7 +15431,7 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15387
15431
|
return acc + (selected.some((s) => s.value === option.value) ? 1 : 0);
|
|
15388
15432
|
}, 0);
|
|
15389
15433
|
const allVisibleSelected = filteredFlat.length > 0 && visibleSelectedCount === filteredFlat.length;
|
|
15390
|
-
const handleToggleAll =
|
|
15434
|
+
const handleToggleAll = React59.useCallback(() => {
|
|
15391
15435
|
if (allVisibleSelected) {
|
|
15392
15436
|
const visibleValues = new Set(filteredFlat.map((option) => option.value));
|
|
15393
15437
|
handleChange(
|
|
@@ -15402,18 +15446,18 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15402
15446
|
}
|
|
15403
15447
|
handleChange(merged, { action: "select" });
|
|
15404
15448
|
}, [allVisibleSelected, filteredFlat, handleChange, selected]);
|
|
15405
|
-
const valueTextRef =
|
|
15406
|
-
const totalCountRef =
|
|
15449
|
+
const valueTextRef = React59.useRef(valueText);
|
|
15450
|
+
const totalCountRef = React59.useRef(flatRawOptions.length);
|
|
15407
15451
|
valueTextRef.current = valueText;
|
|
15408
15452
|
totalCountRef.current = flatRawOptions.length;
|
|
15409
|
-
const Control =
|
|
15453
|
+
const Control = React59.useMemo(() => {
|
|
15410
15454
|
if (trigger) return makeTriggerSlot(trigger);
|
|
15411
15455
|
return createCountTrigger({
|
|
15412
15456
|
getValueText: () => valueTextRef.current,
|
|
15413
15457
|
getTotalCount: () => totalCountRef.current
|
|
15414
15458
|
});
|
|
15415
15459
|
}, [trigger]);
|
|
15416
|
-
const components =
|
|
15460
|
+
const components = React59.useMemo(
|
|
15417
15461
|
() => ({
|
|
15418
15462
|
...userComponents,
|
|
15419
15463
|
Control,
|
|
@@ -15421,7 +15465,7 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15421
15465
|
}),
|
|
15422
15466
|
[userComponents, Control]
|
|
15423
15467
|
);
|
|
15424
|
-
const menuHeader = allowSelectAll ? /* @__PURE__ */ (0,
|
|
15468
|
+
const menuHeader = allowSelectAll ? /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
15425
15469
|
SelectAllRow,
|
|
15426
15470
|
{
|
|
15427
15471
|
label: selectAllLabel ?? t("select_all", { defaultValue: "Select All" }),
|
|
@@ -15429,7 +15473,7 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15429
15473
|
onToggle: handleToggleAll
|
|
15430
15474
|
}
|
|
15431
15475
|
) : void 0;
|
|
15432
|
-
const handleInputChange =
|
|
15476
|
+
const handleInputChange = React59.useCallback(
|
|
15433
15477
|
(next) => {
|
|
15434
15478
|
setInputValue(next);
|
|
15435
15479
|
onSearchChange?.(next);
|
|
@@ -15450,7 +15494,7 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15450
15494
|
isMulti: true
|
|
15451
15495
|
};
|
|
15452
15496
|
if (isPaginated) {
|
|
15453
|
-
return /* @__PURE__ */ (0,
|
|
15497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
15454
15498
|
InfiniteScrollSelect,
|
|
15455
15499
|
{
|
|
15456
15500
|
ref,
|
|
@@ -15461,7 +15505,7 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15461
15505
|
}
|
|
15462
15506
|
);
|
|
15463
15507
|
}
|
|
15464
|
-
return /* @__PURE__ */ (0,
|
|
15508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
15465
15509
|
Select,
|
|
15466
15510
|
{
|
|
15467
15511
|
ref,
|
|
@@ -15472,16 +15516,16 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15472
15516
|
}
|
|
15473
15517
|
);
|
|
15474
15518
|
}
|
|
15475
|
-
var SelectCheckboxes =
|
|
15519
|
+
var SelectCheckboxes = React59.forwardRef(
|
|
15476
15520
|
SelectCheckboxesInternal
|
|
15477
15521
|
);
|
|
15478
15522
|
|
|
15479
15523
|
// src/dashboard/textarea/Textarea.tsx
|
|
15480
|
-
var
|
|
15524
|
+
var React61 = __toESM(require("react"), 1);
|
|
15481
15525
|
var import_react_i18next37 = require("react-i18next");
|
|
15482
15526
|
|
|
15483
15527
|
// src/dashboard/textarea/useTextareaValueState.ts
|
|
15484
|
-
var
|
|
15528
|
+
var React60 = __toESM(require("react"), 1);
|
|
15485
15529
|
var isEmptyValue2 = (value) => {
|
|
15486
15530
|
if (value === void 0 || value === null) return true;
|
|
15487
15531
|
return String(value).length === 0;
|
|
@@ -15500,12 +15544,12 @@ function useTextareaValueState({
|
|
|
15500
15544
|
value,
|
|
15501
15545
|
defaultValue
|
|
15502
15546
|
}) {
|
|
15503
|
-
const textareaRef =
|
|
15547
|
+
const textareaRef = React60.useRef(null);
|
|
15504
15548
|
const isControlled = typeof empty !== "undefined" || typeof value !== "undefined";
|
|
15505
15549
|
const propsAreEmpty = getTextareaEmptyState({ empty, value, defaultValue });
|
|
15506
|
-
const [nativeIsEmpty, setNativeIsEmpty] =
|
|
15550
|
+
const [nativeIsEmpty, setNativeIsEmpty] = React60.useState(propsAreEmpty);
|
|
15507
15551
|
const isEmpty = isControlled ? propsAreEmpty : nativeIsEmpty;
|
|
15508
|
-
const setNativeValue =
|
|
15552
|
+
const setNativeValue = React60.useCallback(
|
|
15509
15553
|
(nextValue) => {
|
|
15510
15554
|
if (isControlled) return;
|
|
15511
15555
|
const nextIsEmpty = nextValue.length === 0;
|
|
@@ -15515,14 +15559,14 @@ function useTextareaValueState({
|
|
|
15515
15559
|
},
|
|
15516
15560
|
[isControlled]
|
|
15517
15561
|
);
|
|
15518
|
-
const syncValueState =
|
|
15562
|
+
const syncValueState = React60.useCallback(() => {
|
|
15519
15563
|
if (!textareaRef.current) return;
|
|
15520
15564
|
setNativeValue(textareaRef.current.value);
|
|
15521
15565
|
}, [setNativeValue]);
|
|
15522
|
-
|
|
15566
|
+
React60.useLayoutEffect(() => {
|
|
15523
15567
|
syncValueState();
|
|
15524
15568
|
});
|
|
15525
|
-
|
|
15569
|
+
React60.useEffect(() => {
|
|
15526
15570
|
const textarea = textareaRef.current;
|
|
15527
15571
|
const form = textarea?.form;
|
|
15528
15572
|
if (isControlled || !form) return;
|
|
@@ -15546,10 +15590,10 @@ function useTextareaValueState({
|
|
|
15546
15590
|
}
|
|
15547
15591
|
|
|
15548
15592
|
// src/dashboard/textarea/Textarea.tsx
|
|
15549
|
-
var
|
|
15593
|
+
var import_jsx_runtime171 = require("react/jsx-runtime");
|
|
15550
15594
|
var LINE_HEIGHT = 20;
|
|
15551
15595
|
var VERTICAL_PADDING = 32;
|
|
15552
|
-
var Textarea =
|
|
15596
|
+
var Textarea = React61.forwardRef(function Textarea2({
|
|
15553
15597
|
className,
|
|
15554
15598
|
textareaClassName,
|
|
15555
15599
|
label,
|
|
@@ -15577,12 +15621,12 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15577
15621
|
}, ref) {
|
|
15578
15622
|
const { textareaRef, isControlled, isEmpty, setNativeValue, syncValueState } = useTextareaValueState({ empty, value, defaultValue });
|
|
15579
15623
|
const combinedRef = useCombinedRef(ref, textareaRef);
|
|
15580
|
-
const reactId =
|
|
15624
|
+
const reactId = React61.useId();
|
|
15581
15625
|
const textareaId = id ?? name ?? `dash-textarea-${reactId}`;
|
|
15582
15626
|
const { t } = (0, import_react_i18next37.useTranslation)();
|
|
15583
15627
|
const isInvalid = Boolean(invalid || error);
|
|
15584
15628
|
const isBlocked = Boolean(disabled);
|
|
15585
|
-
const resize =
|
|
15629
|
+
const resize = React61.useCallback(() => {
|
|
15586
15630
|
const el = textareaRef.current;
|
|
15587
15631
|
if (!el || !autosize) return;
|
|
15588
15632
|
el.style.height = "auto";
|
|
@@ -15592,7 +15636,7 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15592
15636
|
el.style.height = `${nextHeight}px`;
|
|
15593
15637
|
el.style.overflowY = el.scrollHeight > nextHeight ? "auto" : "hidden";
|
|
15594
15638
|
}, [autosize, maxRows, minRows, textareaRef]);
|
|
15595
|
-
|
|
15639
|
+
React61.useLayoutEffect(() => {
|
|
15596
15640
|
resize();
|
|
15597
15641
|
}, [resize, value]);
|
|
15598
15642
|
const handleInput = (event) => {
|
|
@@ -15615,7 +15659,7 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15615
15659
|
onBlur?.(event);
|
|
15616
15660
|
syncValueState();
|
|
15617
15661
|
};
|
|
15618
|
-
return /* @__PURE__ */ (0,
|
|
15662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(
|
|
15619
15663
|
"div",
|
|
15620
15664
|
{
|
|
15621
15665
|
className: cn(
|
|
@@ -15625,18 +15669,18 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15625
15669
|
className
|
|
15626
15670
|
),
|
|
15627
15671
|
children: [
|
|
15628
|
-
label && /* @__PURE__ */ (0,
|
|
15672
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(
|
|
15629
15673
|
"label",
|
|
15630
15674
|
{
|
|
15631
15675
|
htmlFor: textareaId,
|
|
15632
|
-
className: "mb-2 flex select-none items-center text-[
|
|
15676
|
+
className: "mb-2 flex select-none items-center text-[length:var(--field-label-font-size)] font-[var(--field-label-font-weight)] text-[var(--chekin-color-brand-navy)]",
|
|
15633
15677
|
children: [
|
|
15634
15678
|
label,
|
|
15635
|
-
tooltip && /* @__PURE__ */ (0,
|
|
15679
|
+
tooltip && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "ml-1 inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(HelpTooltip, { content: tooltip, size: 16 }) })
|
|
15636
15680
|
]
|
|
15637
15681
|
}
|
|
15638
15682
|
),
|
|
15639
|
-
/* @__PURE__ */ (0,
|
|
15683
|
+
/* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
15640
15684
|
"textarea",
|
|
15641
15685
|
{
|
|
15642
15686
|
ref: combinedRef,
|
|
@@ -15655,10 +15699,10 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15655
15699
|
onBlur: handleBlur,
|
|
15656
15700
|
className: cn(
|
|
15657
15701
|
"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",
|
|
15658
|
-
"border-[var(--
|
|
15659
|
-
!isBlocked && "focus:border-[var(--
|
|
15660
|
-
isEmpty && "border-[var(--
|
|
15661
|
-
isInvalid && "border-[var(--
|
|
15702
|
+
"border-[var(--field-border)] placeholder:font-medium placeholder:text-[var(--chekin-color-gray-1)]",
|
|
15703
|
+
!isBlocked && "focus:border-[var(--field-border-focused)]",
|
|
15704
|
+
isEmpty && "border-[var(--field-border)] bg-[var(--empty-field-background)] text-[var(--chekin-color-gray-1)]",
|
|
15705
|
+
isInvalid && "border-[var(--field-border-invalid)] focus:border-[var(--field-border-invalid)]",
|
|
15662
15706
|
(readOnly || isBlocked) && "cursor-default",
|
|
15663
15707
|
isBlocked && "cursor-not-allowed",
|
|
15664
15708
|
loading && "cursor-progress",
|
|
@@ -15668,7 +15712,7 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15668
15712
|
...textareaProps
|
|
15669
15713
|
}
|
|
15670
15714
|
),
|
|
15671
|
-
error && /* @__PURE__ */ (0,
|
|
15715
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
15672
15716
|
FieldErrorMessage,
|
|
15673
15717
|
{
|
|
15674
15718
|
id: `${textareaId}-error`,
|
|
@@ -15676,20 +15720,20 @@ var Textarea = React60.forwardRef(function Textarea2({
|
|
|
15676
15720
|
className: "mt-[1px] text-[14px]"
|
|
15677
15721
|
}
|
|
15678
15722
|
),
|
|
15679
|
-
!error && optional && /* @__PURE__ */ (0,
|
|
15680
|
-
!error && helperText && /* @__PURE__ */ (0,
|
|
15723
|
+
!error && optional && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
15724
|
+
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText })
|
|
15681
15725
|
]
|
|
15682
15726
|
}
|
|
15683
15727
|
);
|
|
15684
15728
|
});
|
|
15685
15729
|
|
|
15686
15730
|
// src/dashboard/datepicker/Datepicker.tsx
|
|
15687
|
-
var
|
|
15731
|
+
var React63 = __toESM(require("react"), 1);
|
|
15688
15732
|
var import_lucide_react50 = require("lucide-react");
|
|
15689
15733
|
var import_react_i18next38 = require("react-i18next");
|
|
15690
15734
|
|
|
15691
15735
|
// src/airbnb-fields/datepicker/useDatePickerWheel.ts
|
|
15692
|
-
var
|
|
15736
|
+
var React62 = __toESM(require("react"), 1);
|
|
15693
15737
|
|
|
15694
15738
|
// src/airbnb-fields/datepicker/datePicker.utils.ts
|
|
15695
15739
|
var DISPLAY_PAD_LENGTH = 2;
|
|
@@ -15840,21 +15884,21 @@ function useDatePickerWheel({
|
|
|
15840
15884
|
minDate,
|
|
15841
15885
|
maxDate
|
|
15842
15886
|
}) {
|
|
15843
|
-
const years =
|
|
15844
|
-
const [draftDate, setDraftDate] =
|
|
15887
|
+
const years = React62.useMemo(() => getYearRange(minDate, maxDate), [maxDate, minDate]);
|
|
15888
|
+
const [draftDate, setDraftDate] = React62.useState(
|
|
15845
15889
|
() => resolveInitialDate({ value, defaultValue, minDate, maxDate })
|
|
15846
15890
|
);
|
|
15847
15891
|
const draftYear = draftDate.getFullYear();
|
|
15848
15892
|
const draftMonth = draftDate.getMonth();
|
|
15849
|
-
const [monthScrollTop, setMonthScrollTop] =
|
|
15850
|
-
const [dayScrollTop, setDayScrollTop] =
|
|
15851
|
-
const [yearScrollTop, setYearScrollTop] =
|
|
15852
|
-
const monthListRef =
|
|
15853
|
-
const dayListRef =
|
|
15854
|
-
const yearListRef =
|
|
15855
|
-
const settleTimeoutsRef =
|
|
15856
|
-
const animationFramesRef =
|
|
15857
|
-
const columnRefs =
|
|
15893
|
+
const [monthScrollTop, setMonthScrollTop] = React62.useState(0);
|
|
15894
|
+
const [dayScrollTop, setDayScrollTop] = React62.useState(0);
|
|
15895
|
+
const [yearScrollTop, setYearScrollTop] = React62.useState(0);
|
|
15896
|
+
const monthListRef = React62.useRef(null);
|
|
15897
|
+
const dayListRef = React62.useRef(null);
|
|
15898
|
+
const yearListRef = React62.useRef(null);
|
|
15899
|
+
const settleTimeoutsRef = React62.useRef({});
|
|
15900
|
+
const animationFramesRef = React62.useRef({});
|
|
15901
|
+
const columnRefs = React62.useMemo(
|
|
15858
15902
|
() => ({
|
|
15859
15903
|
month: monthListRef,
|
|
15860
15904
|
day: dayListRef,
|
|
@@ -15862,7 +15906,7 @@ function useDatePickerWheel({
|
|
|
15862
15906
|
}),
|
|
15863
15907
|
[]
|
|
15864
15908
|
);
|
|
15865
|
-
const setColumnScrollTop =
|
|
15909
|
+
const setColumnScrollTop = React62.useCallback(
|
|
15866
15910
|
(column, nextScrollTop) => {
|
|
15867
15911
|
if (column === "month") {
|
|
15868
15912
|
setMonthScrollTop(nextScrollTop);
|
|
@@ -15876,19 +15920,19 @@ function useDatePickerWheel({
|
|
|
15876
15920
|
},
|
|
15877
15921
|
[]
|
|
15878
15922
|
);
|
|
15879
|
-
const clearSettleTimeout =
|
|
15923
|
+
const clearSettleTimeout = React62.useCallback((column) => {
|
|
15880
15924
|
const timeoutId = settleTimeoutsRef.current[column];
|
|
15881
15925
|
if (timeoutId === void 0) return;
|
|
15882
15926
|
window.clearTimeout(timeoutId);
|
|
15883
15927
|
delete settleTimeoutsRef.current[column];
|
|
15884
15928
|
}, []);
|
|
15885
|
-
const clearAnimationFrame =
|
|
15929
|
+
const clearAnimationFrame = React62.useCallback((column) => {
|
|
15886
15930
|
const frameId = animationFramesRef.current[column];
|
|
15887
15931
|
if (frameId === void 0) return;
|
|
15888
15932
|
window.cancelAnimationFrame(frameId);
|
|
15889
15933
|
delete animationFramesRef.current[column];
|
|
15890
15934
|
}, []);
|
|
15891
|
-
|
|
15935
|
+
React62.useEffect(
|
|
15892
15936
|
() => () => {
|
|
15893
15937
|
["month", "day", "year"].forEach((column) => {
|
|
15894
15938
|
clearSettleTimeout(column);
|
|
@@ -15897,22 +15941,22 @@ function useDatePickerWheel({
|
|
|
15897
15941
|
},
|
|
15898
15942
|
[clearAnimationFrame, clearSettleTimeout]
|
|
15899
15943
|
);
|
|
15900
|
-
|
|
15944
|
+
React62.useEffect(() => {
|
|
15901
15945
|
if (isOpen) return;
|
|
15902
15946
|
setDraftDate(resolveInitialDate({ value, defaultValue, minDate, maxDate }));
|
|
15903
15947
|
}, [defaultValue, isOpen, maxDate, minDate, value]);
|
|
15904
|
-
const months =
|
|
15948
|
+
const months = React62.useMemo(
|
|
15905
15949
|
() => getAllowedMonths(draftYear, minDate, maxDate),
|
|
15906
15950
|
[draftYear, maxDate, minDate]
|
|
15907
15951
|
);
|
|
15908
|
-
const days =
|
|
15952
|
+
const days = React62.useMemo(
|
|
15909
15953
|
() => getAllowedDays(draftYear, draftMonth, minDate, maxDate),
|
|
15910
15954
|
[draftMonth, draftYear, maxDate, minDate]
|
|
15911
15955
|
);
|
|
15912
15956
|
const monthIndex = months.findIndex((month) => month === draftMonth);
|
|
15913
15957
|
const dayIndex = days.findIndex((day) => day === draftDate.getDate());
|
|
15914
15958
|
const yearIndex = years.findIndex((year) => year === draftYear);
|
|
15915
|
-
const syncScrollPositions =
|
|
15959
|
+
const syncScrollPositions = React62.useCallback(
|
|
15916
15960
|
(nextDate, behavior = "auto") => {
|
|
15917
15961
|
const nextMonths = getAllowedMonths(nextDate.getFullYear(), minDate, maxDate);
|
|
15918
15962
|
const nextMonthIndex = nextMonths.findIndex((month) => month === nextDate.getMonth());
|
|
@@ -15936,7 +15980,7 @@ function useDatePickerWheel({
|
|
|
15936
15980
|
},
|
|
15937
15981
|
[maxDate, minDate, years]
|
|
15938
15982
|
);
|
|
15939
|
-
|
|
15983
|
+
React62.useLayoutEffect(() => {
|
|
15940
15984
|
if (!isOpen) return;
|
|
15941
15985
|
const nextDate = resolveInitialDate({ value, defaultValue, minDate, maxDate });
|
|
15942
15986
|
setDraftDate(nextDate);
|
|
@@ -15947,7 +15991,7 @@ function useDatePickerWheel({
|
|
|
15947
15991
|
window.cancelAnimationFrame(frameId);
|
|
15948
15992
|
};
|
|
15949
15993
|
}, [defaultValue, isOpen, maxDate, minDate, syncScrollPositions, value]);
|
|
15950
|
-
const updateDraftDate =
|
|
15994
|
+
const updateDraftDate = React62.useCallback(
|
|
15951
15995
|
(column, targetIndex, behavior = "smooth") => {
|
|
15952
15996
|
const currentDate = stripTime(draftDate);
|
|
15953
15997
|
const currentYear = currentDate.getFullYear();
|
|
@@ -15992,7 +16036,7 @@ function useDatePickerWheel({
|
|
|
15992
16036
|
},
|
|
15993
16037
|
[days, draftDate, maxDate, minDate, months, syncScrollPositions, years]
|
|
15994
16038
|
);
|
|
15995
|
-
const settleColumnScroll =
|
|
16039
|
+
const settleColumnScroll = React62.useCallback(
|
|
15996
16040
|
(column) => {
|
|
15997
16041
|
const list = columnRefs[column].current;
|
|
15998
16042
|
if (!list) return;
|
|
@@ -16005,7 +16049,7 @@ function useDatePickerWheel({
|
|
|
16005
16049
|
},
|
|
16006
16050
|
[columnRefs, days.length, months.length, updateDraftDate, years.length]
|
|
16007
16051
|
);
|
|
16008
|
-
const scheduleScrollSettle =
|
|
16052
|
+
const scheduleScrollSettle = React62.useCallback(
|
|
16009
16053
|
(column) => {
|
|
16010
16054
|
clearSettleTimeout(column);
|
|
16011
16055
|
settleTimeoutsRef.current[column] = window.setTimeout(() => {
|
|
@@ -16014,7 +16058,7 @@ function useDatePickerWheel({
|
|
|
16014
16058
|
},
|
|
16015
16059
|
[clearSettleTimeout, settleColumnScroll]
|
|
16016
16060
|
);
|
|
16017
|
-
const handleColumnScroll =
|
|
16061
|
+
const handleColumnScroll = React62.useCallback(
|
|
16018
16062
|
(column) => {
|
|
16019
16063
|
const list = columnRefs[column].current;
|
|
16020
16064
|
if (!list) return;
|
|
@@ -16028,13 +16072,13 @@ function useDatePickerWheel({
|
|
|
16028
16072
|
},
|
|
16029
16073
|
[clearAnimationFrame, columnRefs, scheduleScrollSettle, setColumnScrollTop]
|
|
16030
16074
|
);
|
|
16031
|
-
const handleOptionSelect =
|
|
16075
|
+
const handleOptionSelect = React62.useCallback(
|
|
16032
16076
|
(column, targetIndex) => {
|
|
16033
16077
|
updateDraftDate(column, targetIndex, "smooth");
|
|
16034
16078
|
},
|
|
16035
16079
|
[updateDraftDate]
|
|
16036
16080
|
);
|
|
16037
|
-
const focusAdjacentColumn =
|
|
16081
|
+
const focusAdjacentColumn = React62.useCallback(
|
|
16038
16082
|
(column, direction) => {
|
|
16039
16083
|
const order = ["month", "day", "year"];
|
|
16040
16084
|
const currentIndex = order.indexOf(column);
|
|
@@ -16044,7 +16088,7 @@ function useDatePickerWheel({
|
|
|
16044
16088
|
},
|
|
16045
16089
|
[columnRefs]
|
|
16046
16090
|
);
|
|
16047
|
-
const handleColumnKeyDown =
|
|
16091
|
+
const handleColumnKeyDown = React62.useCallback(
|
|
16048
16092
|
(column, event) => {
|
|
16049
16093
|
const currentIndex = column === "month" ? monthIndex : column === "day" ? dayIndex : yearIndex;
|
|
16050
16094
|
const maxIndex = column === "month" ? months.length - 1 : column === "day" ? days.length - 1 : years.length - 1;
|
|
@@ -16110,7 +16154,7 @@ function useDatePickerWheel({
|
|
|
16110
16154
|
}
|
|
16111
16155
|
|
|
16112
16156
|
// src/airbnb-fields/datepicker/DatePickerWheelColumn.tsx
|
|
16113
|
-
var
|
|
16157
|
+
var import_jsx_runtime172 = require("react/jsx-runtime");
|
|
16114
16158
|
var spacerHeight = DATE_PICKER_OPTION_HEIGHT * DATE_PICKER_WHEEL_BUFFER_OPTIONS;
|
|
16115
16159
|
function AirbnbDatePickerWheelColumn({
|
|
16116
16160
|
id,
|
|
@@ -16124,7 +16168,7 @@ function AirbnbDatePickerWheelColumn({
|
|
|
16124
16168
|
onOptionSelect,
|
|
16125
16169
|
column
|
|
16126
16170
|
}) {
|
|
16127
|
-
return /* @__PURE__ */ (0,
|
|
16171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "relative z-10 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
|
|
16128
16172
|
"div",
|
|
16129
16173
|
{
|
|
16130
16174
|
id,
|
|
@@ -16141,14 +16185,14 @@ function AirbnbDatePickerWheelColumn({
|
|
|
16141
16185
|
WebkitOverflowScrolling: "touch"
|
|
16142
16186
|
},
|
|
16143
16187
|
children: [
|
|
16144
|
-
/* @__PURE__ */ (0,
|
|
16188
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { style: { height: `${spacerHeight}px` } }),
|
|
16145
16189
|
items.map((item, index) => {
|
|
16146
16190
|
const { style } = getWheelOptionStyles(
|
|
16147
16191
|
index,
|
|
16148
16192
|
scrollTop,
|
|
16149
16193
|
DATE_PICKER_OPTION_HEIGHT
|
|
16150
16194
|
);
|
|
16151
|
-
return /* @__PURE__ */ (0,
|
|
16195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
16152
16196
|
"button",
|
|
16153
16197
|
{
|
|
16154
16198
|
id: `${id}-option-${index}`,
|
|
@@ -16164,14 +16208,14 @@ function AirbnbDatePickerWheelColumn({
|
|
|
16164
16208
|
`${column}-${item}-${index}`
|
|
16165
16209
|
);
|
|
16166
16210
|
}),
|
|
16167
|
-
/* @__PURE__ */ (0,
|
|
16211
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { style: { height: `${spacerHeight}px` } })
|
|
16168
16212
|
]
|
|
16169
16213
|
}
|
|
16170
16214
|
) });
|
|
16171
16215
|
}
|
|
16172
16216
|
|
|
16173
16217
|
// src/airbnb-fields/datepicker/DatePickerContent.tsx
|
|
16174
|
-
var
|
|
16218
|
+
var import_jsx_runtime173 = require("react/jsx-runtime");
|
|
16175
16219
|
function AirbnbDatePickerBody({
|
|
16176
16220
|
baseId,
|
|
16177
16221
|
label,
|
|
@@ -16193,19 +16237,19 @@ function AirbnbDatePickerBody({
|
|
|
16193
16237
|
onOptionSelect,
|
|
16194
16238
|
onDone
|
|
16195
16239
|
}) {
|
|
16196
|
-
return /* @__PURE__ */ (0,
|
|
16197
|
-
/* @__PURE__ */ (0,
|
|
16198
|
-
/* @__PURE__ */ (0,
|
|
16199
|
-
/* @__PURE__ */ (0,
|
|
16200
|
-
/* @__PURE__ */ (0,
|
|
16240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "px-6 pb-4 pt-1 bg-white", children: [
|
|
16241
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "relative overflow-hidden rounded-[24px]", children: [
|
|
16242
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)("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" }),
|
|
16243
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)("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" }),
|
|
16244
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
|
|
16201
16245
|
"div",
|
|
16202
16246
|
{
|
|
16203
16247
|
"aria-hidden": true,
|
|
16204
16248
|
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]"
|
|
16205
16249
|
}
|
|
16206
16250
|
),
|
|
16207
|
-
/* @__PURE__ */ (0,
|
|
16208
|
-
/* @__PURE__ */ (0,
|
|
16251
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "relative grid grid-cols-[1.35fr_0.7fr_1fr] gap-1", children: [
|
|
16252
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
|
|
16209
16253
|
AirbnbDatePickerWheelColumn,
|
|
16210
16254
|
{
|
|
16211
16255
|
id: `${baseId}-month`,
|
|
@@ -16220,7 +16264,7 @@ function AirbnbDatePickerBody({
|
|
|
16220
16264
|
onOptionSelect
|
|
16221
16265
|
}
|
|
16222
16266
|
),
|
|
16223
|
-
/* @__PURE__ */ (0,
|
|
16267
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
|
|
16224
16268
|
AirbnbDatePickerWheelColumn,
|
|
16225
16269
|
{
|
|
16226
16270
|
id: `${baseId}-day`,
|
|
@@ -16235,7 +16279,7 @@ function AirbnbDatePickerBody({
|
|
|
16235
16279
|
onOptionSelect
|
|
16236
16280
|
}
|
|
16237
16281
|
),
|
|
16238
|
-
/* @__PURE__ */ (0,
|
|
16282
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
|
|
16239
16283
|
AirbnbDatePickerWheelColumn,
|
|
16240
16284
|
{
|
|
16241
16285
|
id: `${baseId}-year`,
|
|
@@ -16252,7 +16296,7 @@ function AirbnbDatePickerBody({
|
|
|
16252
16296
|
)
|
|
16253
16297
|
] })
|
|
16254
16298
|
] }),
|
|
16255
|
-
/* @__PURE__ */ (0,
|
|
16299
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
16256
16300
|
] });
|
|
16257
16301
|
}
|
|
16258
16302
|
function AirbnbDatePickerContent({
|
|
@@ -16280,7 +16324,7 @@ function AirbnbDatePickerContent({
|
|
|
16280
16324
|
onColumnKeyDown,
|
|
16281
16325
|
onOptionSelect
|
|
16282
16326
|
}) {
|
|
16283
|
-
const body = /* @__PURE__ */ (0,
|
|
16327
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
|
|
16284
16328
|
AirbnbDatePickerBody,
|
|
16285
16329
|
{
|
|
16286
16330
|
baseId,
|
|
@@ -16305,27 +16349,27 @@ function AirbnbDatePickerContent({
|
|
|
16305
16349
|
}
|
|
16306
16350
|
);
|
|
16307
16351
|
if (isMobile3) {
|
|
16308
|
-
return /* @__PURE__ */ (0,
|
|
16352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(Drawer, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(
|
|
16309
16353
|
DrawerContent,
|
|
16310
16354
|
{
|
|
16311
16355
|
onClose: () => onOpenChange(false),
|
|
16312
16356
|
className: "rounded-none rounded-t-[32px] border-0 p-0",
|
|
16313
16357
|
children: [
|
|
16314
|
-
/* @__PURE__ */ (0,
|
|
16315
|
-
/* @__PURE__ */ (0,
|
|
16358
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(DrawerTitle, { className: "sr-only", children: title }),
|
|
16359
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(DrawerDescription, { className: "sr-only", children: label }),
|
|
16316
16360
|
body
|
|
16317
16361
|
]
|
|
16318
16362
|
}
|
|
16319
16363
|
) });
|
|
16320
16364
|
}
|
|
16321
|
-
return /* @__PURE__ */ (0,
|
|
16365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(
|
|
16322
16366
|
DialogContent,
|
|
16323
16367
|
{
|
|
16324
16368
|
className: "max-w-[520px] rounded-[28px] border-0 p-0 shadow-xl",
|
|
16325
16369
|
showCloseButton: false,
|
|
16326
16370
|
children: [
|
|
16327
|
-
/* @__PURE__ */ (0,
|
|
16328
|
-
/* @__PURE__ */ (0,
|
|
16371
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(DialogTitle, { className: "sr-only", children: title }),
|
|
16372
|
+
/* @__PURE__ */ (0, import_jsx_runtime173.jsx)(DialogDescription, { className: "sr-only", children: label }),
|
|
16329
16373
|
body
|
|
16330
16374
|
]
|
|
16331
16375
|
}
|
|
@@ -16333,7 +16377,7 @@ function AirbnbDatePickerContent({
|
|
|
16333
16377
|
}
|
|
16334
16378
|
|
|
16335
16379
|
// src/dashboard/datepicker/Datepicker.tsx
|
|
16336
|
-
var
|
|
16380
|
+
var import_jsx_runtime174 = require("react/jsx-runtime");
|
|
16337
16381
|
var MONTHS_IN_YEAR2 = 12;
|
|
16338
16382
|
function getMonthLabels2(locale) {
|
|
16339
16383
|
const formatter = new Intl.DateTimeFormat(locale, { month: "long" });
|
|
@@ -16366,7 +16410,7 @@ function dateFromParts(day, monthIndex, year) {
|
|
|
16366
16410
|
if (!isValidCalendarDate(yearNum, monthIndex, dayNum)) return null;
|
|
16367
16411
|
return new Date(yearNum, monthIndex, dayNum);
|
|
16368
16412
|
}
|
|
16369
|
-
var Datepicker =
|
|
16413
|
+
var Datepicker = React63.forwardRef(
|
|
16370
16414
|
function Datepicker2({
|
|
16371
16415
|
label,
|
|
16372
16416
|
value,
|
|
@@ -16399,14 +16443,14 @@ var Datepicker = React62.forwardRef(
|
|
|
16399
16443
|
maxDate,
|
|
16400
16444
|
formatValue
|
|
16401
16445
|
}, ref) {
|
|
16402
|
-
const containerRef =
|
|
16403
|
-
const dayInputRef =
|
|
16404
|
-
const monthInputRef =
|
|
16405
|
-
const monthListRef =
|
|
16406
|
-
const yearInputRef =
|
|
16407
|
-
const mobileTriggerRef =
|
|
16408
|
-
const wheelBaseId =
|
|
16409
|
-
const reactId =
|
|
16446
|
+
const containerRef = React63.useRef(null);
|
|
16447
|
+
const dayInputRef = React63.useRef(null);
|
|
16448
|
+
const monthInputRef = React63.useRef(null);
|
|
16449
|
+
const monthListRef = React63.useRef(null);
|
|
16450
|
+
const yearInputRef = React63.useRef(null);
|
|
16451
|
+
const mobileTriggerRef = React63.useRef(null);
|
|
16452
|
+
const wheelBaseId = React63.useId();
|
|
16453
|
+
const reactId = React63.useId();
|
|
16410
16454
|
const baseId = name ?? `dash-datepicker-${reactId}`;
|
|
16411
16455
|
const dayId = `${baseId}-day`;
|
|
16412
16456
|
const monthId = `${baseId}-month`;
|
|
@@ -16415,38 +16459,38 @@ var Datepicker = React62.forwardRef(
|
|
|
16415
16459
|
const errorId = `${baseId}-error`;
|
|
16416
16460
|
const { t, i18n } = (0, import_react_i18next38.useTranslation)();
|
|
16417
16461
|
const resolvedLocale = locale ?? i18n.resolvedLanguage ?? i18n.language ?? "en-US";
|
|
16418
|
-
const resolvedMonthLabels =
|
|
16462
|
+
const resolvedMonthLabels = React63.useMemo(
|
|
16419
16463
|
() => monthLabels ?? getMonthLabels2(resolvedLocale),
|
|
16420
16464
|
[resolvedLocale, monthLabels]
|
|
16421
16465
|
);
|
|
16422
16466
|
const resolvedMonthPlaceholder = monthPlaceholder ?? t("month");
|
|
16423
16467
|
const resolvedDoneLabel = doneLabel ?? t("done");
|
|
16424
16468
|
const isControlled = value !== void 0;
|
|
16425
|
-
const initialParts =
|
|
16469
|
+
const initialParts = React63.useMemo(
|
|
16426
16470
|
() => partsFromDate(value ?? defaultValue ?? null),
|
|
16427
16471
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16428
16472
|
[]
|
|
16429
16473
|
);
|
|
16430
|
-
const [day, setDay] =
|
|
16431
|
-
const [monthIndex, setMonthIndex] =
|
|
16474
|
+
const [day, setDay] = React63.useState(initialParts.day);
|
|
16475
|
+
const [monthIndex, setMonthIndex] = React63.useState(
|
|
16432
16476
|
initialParts.monthIndex
|
|
16433
16477
|
);
|
|
16434
|
-
const [year, setYear] =
|
|
16435
|
-
const [isMonthOpen, setIsMonthOpen] =
|
|
16436
|
-
const [isWheelOpen, setIsWheelOpen] =
|
|
16437
|
-
const [focusedField, setFocusedField] =
|
|
16438
|
-
const [monthInputValue, setMonthInputValue] =
|
|
16439
|
-
const [monthHighlightIndex, setMonthHighlightIndex] =
|
|
16478
|
+
const [year, setYear] = React63.useState(initialParts.year);
|
|
16479
|
+
const [isMonthOpen, setIsMonthOpen] = React63.useState(false);
|
|
16480
|
+
const [isWheelOpen, setIsWheelOpen] = React63.useState(false);
|
|
16481
|
+
const [focusedField, setFocusedField] = React63.useState(null);
|
|
16482
|
+
const [monthInputValue, setMonthInputValue] = React63.useState("");
|
|
16483
|
+
const [monthHighlightIndex, setMonthHighlightIndex] = React63.useState(-1);
|
|
16440
16484
|
const isMobile3 = useIsMobile();
|
|
16441
|
-
const emitChangeRef =
|
|
16485
|
+
const emitChangeRef = React63.useRef(() => {
|
|
16442
16486
|
});
|
|
16443
|
-
const dayStateRef =
|
|
16444
|
-
const yearStateRef =
|
|
16445
|
-
const monthIndexRef =
|
|
16487
|
+
const dayStateRef = React63.useRef(day);
|
|
16488
|
+
const yearStateRef = React63.useRef(year);
|
|
16489
|
+
const monthIndexRef = React63.useRef(monthIndex);
|
|
16446
16490
|
dayStateRef.current = day;
|
|
16447
16491
|
yearStateRef.current = year;
|
|
16448
16492
|
monthIndexRef.current = monthIndex;
|
|
16449
|
-
|
|
16493
|
+
React63.useImperativeHandle(
|
|
16450
16494
|
ref,
|
|
16451
16495
|
() => ({
|
|
16452
16496
|
getDayValue: () => dayStateRef.current,
|
|
@@ -16464,27 +16508,27 @@ var Datepicker = React62.forwardRef(
|
|
|
16464
16508
|
}),
|
|
16465
16509
|
[]
|
|
16466
16510
|
);
|
|
16467
|
-
|
|
16511
|
+
React63.useEffect(() => {
|
|
16468
16512
|
if (!isControlled) return;
|
|
16469
16513
|
const next = partsFromDate(value ?? null);
|
|
16470
16514
|
setDay(next.day);
|
|
16471
16515
|
setMonthIndex(next.monthIndex);
|
|
16472
16516
|
setYear(next.year);
|
|
16473
16517
|
}, [isControlled, value]);
|
|
16474
|
-
|
|
16518
|
+
React63.useEffect(() => {
|
|
16475
16519
|
if (focusedField === "month") return;
|
|
16476
16520
|
setMonthInputValue(
|
|
16477
16521
|
monthIndex !== null ? resolvedMonthLabels[monthIndex] ?? "" : ""
|
|
16478
16522
|
);
|
|
16479
16523
|
}, [monthIndex, resolvedMonthLabels, focusedField]);
|
|
16480
|
-
const filteredMonths =
|
|
16524
|
+
const filteredMonths = React63.useMemo(() => {
|
|
16481
16525
|
const all = resolvedMonthLabels.map((label2, index) => ({ label: label2, index }));
|
|
16482
16526
|
const query = monthInputValue.trim().toLowerCase();
|
|
16483
16527
|
const currentLabel = monthIndex !== null ? resolvedMonthLabels[monthIndex] ?? "" : "";
|
|
16484
16528
|
if (!query || monthInputValue === currentLabel) return all;
|
|
16485
16529
|
return all.filter((opt) => opt.label.toLowerCase().includes(query));
|
|
16486
16530
|
}, [monthInputValue, monthIndex, resolvedMonthLabels]);
|
|
16487
|
-
|
|
16531
|
+
React63.useEffect(() => {
|
|
16488
16532
|
if (!isMonthOpen) {
|
|
16489
16533
|
setMonthHighlightIndex(-1);
|
|
16490
16534
|
return;
|
|
@@ -16505,7 +16549,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16505
16549
|
const isFocused = focusedField !== null || isMonthOpen || isWheelOpen;
|
|
16506
16550
|
const isInvalid = Boolean(invalid || error);
|
|
16507
16551
|
const wrapperWidth = toCssSize(width);
|
|
16508
|
-
const currentDate =
|
|
16552
|
+
const currentDate = React63.useMemo(
|
|
16509
16553
|
() => dateFromParts(day, monthIndex, year),
|
|
16510
16554
|
[day, monthIndex, year]
|
|
16511
16555
|
);
|
|
@@ -16514,7 +16558,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16514
16558
|
onOutsideClick: () => setIsMonthOpen(false),
|
|
16515
16559
|
isDisabled: !isMonthOpen || isMobile3
|
|
16516
16560
|
});
|
|
16517
|
-
const emitChange =
|
|
16561
|
+
const emitChange = React63.useCallback(
|
|
16518
16562
|
(nextDay, nextMonth, nextYear) => {
|
|
16519
16563
|
if (!onChange) return;
|
|
16520
16564
|
const date = dateFromParts(nextDay, nextMonth, nextYear);
|
|
@@ -16550,7 +16594,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16550
16594
|
setIsMonthOpen(true);
|
|
16551
16595
|
setMonthHighlightIndex(0);
|
|
16552
16596
|
};
|
|
16553
|
-
const commitMonthInput =
|
|
16597
|
+
const commitMonthInput = React63.useCallback(() => {
|
|
16554
16598
|
const query = monthInputValue.trim().toLowerCase();
|
|
16555
16599
|
if (!query) {
|
|
16556
16600
|
if (monthIndex !== null) {
|
|
@@ -16610,15 +16654,15 @@ var Datepicker = React62.forwardRef(
|
|
|
16610
16654
|
setIsMonthOpen(false);
|
|
16611
16655
|
}
|
|
16612
16656
|
};
|
|
16613
|
-
const focusDayInput =
|
|
16657
|
+
const focusDayInput = React63.useCallback(() => {
|
|
16614
16658
|
if (isBlocked || readOnly) return;
|
|
16615
16659
|
dayInputRef.current?.focus();
|
|
16616
16660
|
}, [isBlocked, readOnly]);
|
|
16617
|
-
const openWheel =
|
|
16661
|
+
const openWheel = React63.useCallback(() => {
|
|
16618
16662
|
if (isBlocked || readOnly) return;
|
|
16619
16663
|
setIsWheelOpen(true);
|
|
16620
16664
|
}, [isBlocked, readOnly]);
|
|
16621
|
-
const closeWheel =
|
|
16665
|
+
const closeWheel = React63.useCallback(() => {
|
|
16622
16666
|
setIsWheelOpen(false);
|
|
16623
16667
|
mobileTriggerRef.current?.focus();
|
|
16624
16668
|
}, []);
|
|
@@ -16630,7 +16674,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16630
16674
|
minDate,
|
|
16631
16675
|
maxDate
|
|
16632
16676
|
});
|
|
16633
|
-
const handleWheelDone =
|
|
16677
|
+
const handleWheelDone = React63.useCallback(() => {
|
|
16634
16678
|
const next = wheel.draftDate;
|
|
16635
16679
|
setDay(String(next.getDate()));
|
|
16636
16680
|
setMonthIndex(next.getMonth());
|
|
@@ -16639,14 +16683,14 @@ var Datepicker = React62.forwardRef(
|
|
|
16639
16683
|
setIsWheelOpen(false);
|
|
16640
16684
|
mobileTriggerRef.current?.focus();
|
|
16641
16685
|
}, [name, onChange, wheel.draftDate]);
|
|
16642
|
-
const defaultFormatValue =
|
|
16686
|
+
const defaultFormatValue = React63.useCallback(
|
|
16643
16687
|
(date) => `${date.getDate()} ${resolvedMonthLabels[date.getMonth()]} ${date.getFullYear()}`,
|
|
16644
16688
|
[resolvedMonthLabels]
|
|
16645
16689
|
);
|
|
16646
16690
|
const triggerText = currentDate ? (formatValue ?? defaultFormatValue)(currentDate) : void 0;
|
|
16647
16691
|
const monthListboxId = `${monthId}-listbox`;
|
|
16648
16692
|
const getMonthOptionId = (index) => `${monthId}-option-${index}`;
|
|
16649
|
-
const monthPanelContent = filteredMonths.length === 0 ? /* @__PURE__ */ (0,
|
|
16693
|
+
const monthPanelContent = filteredMonths.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("div", { className: "px-4 py-3 text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: t("no_options") }) : /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
16650
16694
|
"ul",
|
|
16651
16695
|
{
|
|
16652
16696
|
ref: monthListRef,
|
|
@@ -16657,7 +16701,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16657
16701
|
children: filteredMonths.map((option, position) => {
|
|
16658
16702
|
const isSelected = option.index === monthIndex;
|
|
16659
16703
|
const isHighlighted = position === monthHighlightIndex;
|
|
16660
|
-
return /* @__PURE__ */ (0,
|
|
16704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("li", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
16661
16705
|
"button",
|
|
16662
16706
|
{
|
|
16663
16707
|
id: getMonthOptionId(option.index),
|
|
@@ -16684,7 +16728,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16684
16728
|
isBlocked && "cursor-not-allowed",
|
|
16685
16729
|
loading && "cursor-progress"
|
|
16686
16730
|
);
|
|
16687
|
-
return /* @__PURE__ */ (0,
|
|
16731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
16688
16732
|
"div",
|
|
16689
16733
|
{
|
|
16690
16734
|
ref: containerRef,
|
|
@@ -16695,9 +16739,9 @@ var Datepicker = React62.forwardRef(
|
|
|
16695
16739
|
className
|
|
16696
16740
|
),
|
|
16697
16741
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
16698
|
-
children: /* @__PURE__ */ (0,
|
|
16699
|
-
/* @__PURE__ */ (0,
|
|
16700
|
-
isMobile3 ? /* @__PURE__ */ (0,
|
|
16742
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)("div", { className: "relative min-h-[var(--field-min-height,48px)] w-full", children: [
|
|
16743
|
+
/* @__PURE__ */ (0, import_jsx_runtime174.jsxs)("div", { className: "relative w-full", children: [
|
|
16744
|
+
isMobile3 ? /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(
|
|
16701
16745
|
"button",
|
|
16702
16746
|
{
|
|
16703
16747
|
ref: mobileTriggerRef,
|
|
@@ -16717,8 +16761,8 @@ var Datepicker = React62.forwardRef(
|
|
|
16717
16761
|
(isBlocked || readOnly) && "cursor-not-allowed"
|
|
16718
16762
|
),
|
|
16719
16763
|
children: [
|
|
16720
|
-
/* @__PURE__ */ (0,
|
|
16721
|
-
/* @__PURE__ */ (0,
|
|
16764
|
+
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)("span", { className: "block min-w-0 flex-1 truncate text-left", children: triggerText ?? (isWheelOpen ? mobilePlaceholder : null) }),
|
|
16765
|
+
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
16722
16766
|
import_lucide_react50.ChevronDown,
|
|
16723
16767
|
{
|
|
16724
16768
|
size: 16,
|
|
@@ -16730,14 +16774,14 @@ var Datepicker = React62.forwardRef(
|
|
|
16730
16774
|
) })
|
|
16731
16775
|
]
|
|
16732
16776
|
}
|
|
16733
|
-
) : /* @__PURE__ */ (0,
|
|
16777
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(
|
|
16734
16778
|
"div",
|
|
16735
16779
|
{
|
|
16736
16780
|
className: cn(
|
|
16737
16781
|
"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)]"
|
|
16738
16782
|
),
|
|
16739
16783
|
children: [
|
|
16740
|
-
/* @__PURE__ */ (0,
|
|
16784
|
+
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)("div", { className: "flex h-full min-w-0 items-center px-2 sm:px-4", children: /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
16741
16785
|
"input",
|
|
16742
16786
|
{
|
|
16743
16787
|
ref: dayInputRef,
|
|
@@ -16766,8 +16810,8 @@ var Datepicker = React62.forwardRef(
|
|
|
16766
16810
|
className: subInputClass
|
|
16767
16811
|
}
|
|
16768
16812
|
) }),
|
|
16769
|
-
/* @__PURE__ */ (0,
|
|
16770
|
-
/* @__PURE__ */ (0,
|
|
16813
|
+
/* @__PURE__ */ (0, import_jsx_runtime174.jsxs)("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: [
|
|
16814
|
+
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
16771
16815
|
"input",
|
|
16772
16816
|
{
|
|
16773
16817
|
ref: monthInputRef,
|
|
@@ -16813,7 +16857,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16813
16857
|
)
|
|
16814
16858
|
}
|
|
16815
16859
|
),
|
|
16816
|
-
/* @__PURE__ */ (0,
|
|
16860
|
+
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
16817
16861
|
import_lucide_react50.ChevronDown,
|
|
16818
16862
|
{
|
|
16819
16863
|
size: 14,
|
|
@@ -16830,7 +16874,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16830
16874
|
}
|
|
16831
16875
|
)
|
|
16832
16876
|
] }),
|
|
16833
|
-
/* @__PURE__ */ (0,
|
|
16877
|
+
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)("div", { className: "flex h-full min-w-0 items-center px-2 sm:px-4", children: /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
16834
16878
|
"input",
|
|
16835
16879
|
{
|
|
16836
16880
|
ref: yearInputRef,
|
|
@@ -16862,7 +16906,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16862
16906
|
]
|
|
16863
16907
|
}
|
|
16864
16908
|
),
|
|
16865
|
-
showCoverage && /* @__PURE__ */ (0,
|
|
16909
|
+
showCoverage && /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
16866
16910
|
"div",
|
|
16867
16911
|
{
|
|
16868
16912
|
className: "absolute inset-0 cursor-text rounded-[6px] bg-[var(--empty-field-background)]",
|
|
@@ -16870,7 +16914,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16870
16914
|
"aria-hidden": "true"
|
|
16871
16915
|
}
|
|
16872
16916
|
),
|
|
16873
|
-
/* @__PURE__ */ (0,
|
|
16917
|
+
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
16874
16918
|
Fieldset,
|
|
16875
16919
|
{
|
|
16876
16920
|
isFocused,
|
|
@@ -16888,9 +16932,9 @@ var Datepicker = React62.forwardRef(
|
|
|
16888
16932
|
onClick: isMobile3 ? openWheel : showCoverage ? focusDayInput : void 0
|
|
16889
16933
|
}
|
|
16890
16934
|
),
|
|
16891
|
-
isMonthOpen && !isMobile3 && /* @__PURE__ */ (0,
|
|
16935
|
+
isMonthOpen && !isMobile3 && /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("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 })
|
|
16892
16936
|
] }),
|
|
16893
|
-
isMobile3 && /* @__PURE__ */ (0,
|
|
16937
|
+
isMobile3 && /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
16894
16938
|
AirbnbDatePickerContent,
|
|
16895
16939
|
{
|
|
16896
16940
|
baseId: wheelBaseId,
|
|
@@ -16918,9 +16962,9 @@ var Datepicker = React62.forwardRef(
|
|
|
16918
16962
|
onOptionSelect: wheel.handleOptionSelect
|
|
16919
16963
|
}
|
|
16920
16964
|
),
|
|
16921
|
-
!error && optional && /* @__PURE__ */ (0,
|
|
16922
|
-
!error && helperText && /* @__PURE__ */ (0,
|
|
16923
|
-
error && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
16965
|
+
!error && optional && /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
16966
|
+
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
16967
|
+
error && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
16924
16968
|
FieldErrorMessage,
|
|
16925
16969
|
{
|
|
16926
16970
|
id: errorId,
|
|
@@ -16935,7 +16979,7 @@ var Datepicker = React62.forwardRef(
|
|
|
16935
16979
|
);
|
|
16936
16980
|
|
|
16937
16981
|
// src/dashboard/date-range-picker/DateRangePicker.tsx
|
|
16938
|
-
var
|
|
16982
|
+
var React67 = __toESM(require("react"), 1);
|
|
16939
16983
|
var import_react_i18next39 = require("react-i18next");
|
|
16940
16984
|
|
|
16941
16985
|
// src/dashboard/date-range-picker/isDayBlocked.ts
|
|
@@ -17014,7 +17058,7 @@ var createDisabledMatchers = ({
|
|
|
17014
17058
|
};
|
|
17015
17059
|
|
|
17016
17060
|
// src/dashboard/date-range-picker/hooks/useRangeValue.ts
|
|
17017
|
-
var
|
|
17061
|
+
var React64 = __toESM(require("react"), 1);
|
|
17018
17062
|
var getRangeKey = (range) => `${range?.from?.getTime() ?? ""}-${range?.to?.getTime() ?? ""}`;
|
|
17019
17063
|
function useRangeValue({
|
|
17020
17064
|
value: externalValue,
|
|
@@ -17023,10 +17067,10 @@ function useRangeValue({
|
|
|
17023
17067
|
name
|
|
17024
17068
|
}) {
|
|
17025
17069
|
const isControlled = externalValue !== void 0;
|
|
17026
|
-
const [draft, setDraft] =
|
|
17070
|
+
const [draft, setDraft] = React64.useState(
|
|
17027
17071
|
isControlled ? externalValue : defaultValue
|
|
17028
17072
|
);
|
|
17029
|
-
const lastExternalKeyRef =
|
|
17073
|
+
const lastExternalKeyRef = React64.useRef(getRangeKey(externalValue));
|
|
17030
17074
|
if (isControlled) {
|
|
17031
17075
|
const externalKey = getRangeKey(externalValue);
|
|
17032
17076
|
if (externalKey !== lastExternalKeyRef.current) {
|
|
@@ -17034,7 +17078,7 @@ function useRangeValue({
|
|
|
17034
17078
|
setDraft(externalValue);
|
|
17035
17079
|
}
|
|
17036
17080
|
}
|
|
17037
|
-
const commit =
|
|
17081
|
+
const commit = React64.useCallback(
|
|
17038
17082
|
(next) => {
|
|
17039
17083
|
setDraft(next);
|
|
17040
17084
|
if (next === void 0) {
|
|
@@ -17049,7 +17093,7 @@ function useRangeValue({
|
|
|
17049
17093
|
}
|
|
17050
17094
|
|
|
17051
17095
|
// src/dashboard/date-range-picker/hooks/useRangeTextInputs.ts
|
|
17052
|
-
var
|
|
17096
|
+
var React65 = __toESM(require("react"), 1);
|
|
17053
17097
|
|
|
17054
17098
|
// src/dashboard/date-range-picker/utils/inputFormat.ts
|
|
17055
17099
|
function parseDateInputFormat(format2) {
|
|
@@ -17139,18 +17183,18 @@ function useRangeTextInputs({
|
|
|
17139
17183
|
onFromComplete,
|
|
17140
17184
|
onToComplete
|
|
17141
17185
|
}) {
|
|
17142
|
-
const tokens =
|
|
17186
|
+
const tokens = React65.useMemo(
|
|
17143
17187
|
() => parseDateInputFormat(displayFormat),
|
|
17144
17188
|
[displayFormat]
|
|
17145
17189
|
);
|
|
17146
|
-
const maxDigits =
|
|
17147
|
-
const [fromText, setFromText] =
|
|
17148
|
-
const [toText, setToText] =
|
|
17149
|
-
|
|
17190
|
+
const maxDigits = React65.useMemo(() => getMaxDigits(tokens), [tokens]);
|
|
17191
|
+
const [fromText, setFromText] = React65.useState(value?.from ? format2(value.from) : "");
|
|
17192
|
+
const [toText, setToText] = React65.useState(value?.to ? format2(value.to) : "");
|
|
17193
|
+
React65.useEffect(() => {
|
|
17150
17194
|
setFromText(value?.from ? format2(value.from) : "");
|
|
17151
17195
|
setToText(value?.to ? format2(value.to) : "");
|
|
17152
17196
|
}, [format2, value?.from, value?.to]);
|
|
17153
|
-
const handleFromChange =
|
|
17197
|
+
const handleFromChange = React65.useCallback(
|
|
17154
17198
|
(raw) => {
|
|
17155
17199
|
const formatted = autoFormatDateInput(raw, tokens);
|
|
17156
17200
|
const wasComplete = countDigits(fromText) === maxDigits;
|
|
@@ -17162,7 +17206,7 @@ function useRangeTextInputs({
|
|
|
17162
17206
|
},
|
|
17163
17207
|
[fromText, maxDigits, onFromComplete, parse3, tokens]
|
|
17164
17208
|
);
|
|
17165
|
-
const handleToChange =
|
|
17209
|
+
const handleToChange = React65.useCallback(
|
|
17166
17210
|
(raw) => {
|
|
17167
17211
|
const formatted = autoFormatDateInput(raw, tokens);
|
|
17168
17212
|
const wasComplete = countDigits(toText) === maxDigits;
|
|
@@ -17174,7 +17218,7 @@ function useRangeTextInputs({
|
|
|
17174
17218
|
},
|
|
17175
17219
|
[maxDigits, onToComplete, parse3, toText, tokens]
|
|
17176
17220
|
);
|
|
17177
|
-
const handleFromBlur =
|
|
17221
|
+
const handleFromBlur = React65.useCallback(() => {
|
|
17178
17222
|
if (!fromText) {
|
|
17179
17223
|
const next = { from: void 0, to: value?.to };
|
|
17180
17224
|
onCommit(next);
|
|
@@ -17191,7 +17235,7 @@ function useRangeTextInputs({
|
|
|
17191
17235
|
setFromText(value?.from ? format2(value.from) : "");
|
|
17192
17236
|
return void 0;
|
|
17193
17237
|
}, [format2, fromText, onBlur, onCommit, parse3, value]);
|
|
17194
|
-
const handleToBlur =
|
|
17238
|
+
const handleToBlur = React65.useCallback(() => {
|
|
17195
17239
|
if (!toText) {
|
|
17196
17240
|
const next = { from: value?.from, to: void 0 };
|
|
17197
17241
|
onCommit(next);
|
|
@@ -17220,21 +17264,21 @@ function useRangeTextInputs({
|
|
|
17220
17264
|
}
|
|
17221
17265
|
|
|
17222
17266
|
// src/dashboard/date-range-picker/hooks/useRangeMonthSync.ts
|
|
17223
|
-
var
|
|
17267
|
+
var React66 = __toESM(require("react"), 1);
|
|
17224
17268
|
function useRangeMonthSync(value) {
|
|
17225
|
-
const isPreloadedRef =
|
|
17226
|
-
const [month, setMonth] =
|
|
17227
|
-
|
|
17269
|
+
const isPreloadedRef = React66.useRef(false);
|
|
17270
|
+
const [month, setMonth] = React66.useState(value?.from ?? /* @__PURE__ */ new Date());
|
|
17271
|
+
React66.useEffect(() => {
|
|
17228
17272
|
if (value?.from && !isPreloadedRef.current) {
|
|
17229
17273
|
setMonth(value.from);
|
|
17230
17274
|
isPreloadedRef.current = true;
|
|
17231
17275
|
}
|
|
17232
17276
|
}, [value?.from]);
|
|
17233
|
-
const syncMonthToValue =
|
|
17277
|
+
const syncMonthToValue = React66.useCallback((next) => {
|
|
17234
17278
|
isPreloadedRef.current = true;
|
|
17235
17279
|
if (next?.from) setMonth(next.from);
|
|
17236
17280
|
}, []);
|
|
17237
|
-
const resetPreload =
|
|
17281
|
+
const resetPreload = React66.useCallback(() => {
|
|
17238
17282
|
isPreloadedRef.current = false;
|
|
17239
17283
|
}, []);
|
|
17240
17284
|
return { month, setMonth, syncMonthToValue, resetPreload };
|
|
@@ -17260,7 +17304,7 @@ function resolveRangeSelection({
|
|
|
17260
17304
|
|
|
17261
17305
|
// src/dashboard/date-range-picker/components/DateRangeInputs.tsx
|
|
17262
17306
|
var import_lucide_react51 = require("lucide-react");
|
|
17263
|
-
var
|
|
17307
|
+
var import_jsx_runtime175 = require("react/jsx-runtime");
|
|
17264
17308
|
var DEFAULT_PLACEHOLDER = "00-00-0000";
|
|
17265
17309
|
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)]";
|
|
17266
17310
|
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";
|
|
@@ -17302,7 +17346,7 @@ function DateRangeInputs({
|
|
|
17302
17346
|
isBlocked && "cursor-not-allowed",
|
|
17303
17347
|
loading && "cursor-progress"
|
|
17304
17348
|
);
|
|
17305
|
-
return /* @__PURE__ */ (0,
|
|
17349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(
|
|
17306
17350
|
"div",
|
|
17307
17351
|
{
|
|
17308
17352
|
className: cn(
|
|
@@ -17311,7 +17355,7 @@ function DateRangeInputs({
|
|
|
17311
17355
|
),
|
|
17312
17356
|
onClick: onRowClick,
|
|
17313
17357
|
children: [
|
|
17314
|
-
/* @__PURE__ */ (0,
|
|
17358
|
+
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
17315
17359
|
"input",
|
|
17316
17360
|
{
|
|
17317
17361
|
ref: fromInputRef,
|
|
@@ -17336,7 +17380,7 @@ function DateRangeInputs({
|
|
|
17336
17380
|
)
|
|
17337
17381
|
}
|
|
17338
17382
|
),
|
|
17339
|
-
/* @__PURE__ */ (0,
|
|
17383
|
+
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
17340
17384
|
"span",
|
|
17341
17385
|
{
|
|
17342
17386
|
"aria-hidden": "true",
|
|
@@ -17347,7 +17391,7 @@ function DateRangeInputs({
|
|
|
17347
17391
|
children: "\u2192"
|
|
17348
17392
|
}
|
|
17349
17393
|
),
|
|
17350
|
-
/* @__PURE__ */ (0,
|
|
17394
|
+
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
17351
17395
|
"input",
|
|
17352
17396
|
{
|
|
17353
17397
|
ref: toInputRef,
|
|
@@ -17372,8 +17416,8 @@ function DateRangeInputs({
|
|
|
17372
17416
|
)
|
|
17373
17417
|
}
|
|
17374
17418
|
),
|
|
17375
|
-
/* @__PURE__ */ (0,
|
|
17376
|
-
!readOnly && !hideClearDates && !isEmpty && /* @__PURE__ */ (0,
|
|
17419
|
+
/* @__PURE__ */ (0, import_jsx_runtime175.jsxs)("span", { className: "ml-auto flex shrink-0 items-center gap-2 pl-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
17420
|
+
!readOnly && !hideClearDates && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
17377
17421
|
"button",
|
|
17378
17422
|
{
|
|
17379
17423
|
type: "button",
|
|
@@ -17381,10 +17425,10 @@ function DateRangeInputs({
|
|
|
17381
17425
|
onClick: onReset,
|
|
17382
17426
|
className: iconButtonClass,
|
|
17383
17427
|
"aria-label": clearLabel,
|
|
17384
|
-
children: /* @__PURE__ */ (0,
|
|
17428
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(import_lucide_react51.SquareX, { size: 16, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
17385
17429
|
}
|
|
17386
17430
|
),
|
|
17387
|
-
!readOnly && !hideCalendarIcon && /* @__PURE__ */ (0,
|
|
17431
|
+
!readOnly && !hideCalendarIcon && /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
17388
17432
|
"button",
|
|
17389
17433
|
{
|
|
17390
17434
|
type: "button",
|
|
@@ -17396,7 +17440,7 @@ function DateRangeInputs({
|
|
|
17396
17440
|
focusedInput !== null || isOpen ? "text-[var(--chekin-color-brand-blue)]" : "text-[var(--chekin-color-gray-2)]"
|
|
17397
17441
|
),
|
|
17398
17442
|
"aria-label": openCalendarLabel,
|
|
17399
|
-
children: /* @__PURE__ */ (0,
|
|
17443
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(import_lucide_react51.CalendarDays, { size: 18 })
|
|
17400
17444
|
}
|
|
17401
17445
|
)
|
|
17402
17446
|
] })
|
|
@@ -17406,7 +17450,7 @@ function DateRangeInputs({
|
|
|
17406
17450
|
}
|
|
17407
17451
|
|
|
17408
17452
|
// src/dashboard/date-range-picker/components/DateRangeCalendar.tsx
|
|
17409
|
-
var
|
|
17453
|
+
var import_jsx_runtime176 = require("react/jsx-runtime");
|
|
17410
17454
|
function DateRangeCalendar({
|
|
17411
17455
|
value,
|
|
17412
17456
|
month,
|
|
@@ -17422,7 +17466,7 @@ function DateRangeCalendar({
|
|
|
17422
17466
|
components,
|
|
17423
17467
|
...dayPickerProps
|
|
17424
17468
|
}) {
|
|
17425
|
-
return /* @__PURE__ */ (0,
|
|
17469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
17426
17470
|
Calendar,
|
|
17427
17471
|
{
|
|
17428
17472
|
mode: "range",
|
|
@@ -17445,7 +17489,7 @@ function DateRangeCalendar({
|
|
|
17445
17489
|
}
|
|
17446
17490
|
|
|
17447
17491
|
// src/dashboard/date-range-picker/components/DateRangePopover.tsx
|
|
17448
|
-
var
|
|
17492
|
+
var import_jsx_runtime177 = require("react/jsx-runtime");
|
|
17449
17493
|
function DateRangePopover({
|
|
17450
17494
|
isOpen,
|
|
17451
17495
|
isMobile: isMobile3,
|
|
@@ -17457,30 +17501,30 @@ function DateRangePopover({
|
|
|
17457
17501
|
}) {
|
|
17458
17502
|
if (!isOpen) return null;
|
|
17459
17503
|
if (isMobile3) {
|
|
17460
|
-
return /* @__PURE__ */ (0,
|
|
17504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
|
|
17461
17505
|
Drawer,
|
|
17462
17506
|
{
|
|
17463
17507
|
open: isOpen,
|
|
17464
17508
|
onOpenChange: (next) => {
|
|
17465
17509
|
if (!next) onClose();
|
|
17466
17510
|
},
|
|
17467
|
-
children: /* @__PURE__ */ (0,
|
|
17511
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(
|
|
17468
17512
|
DrawerContent,
|
|
17469
17513
|
{
|
|
17470
17514
|
onClose,
|
|
17471
17515
|
lockScroll: false,
|
|
17472
17516
|
className: "max-h-[calc(100vh-1rem)]",
|
|
17473
17517
|
children: [
|
|
17474
|
-
/* @__PURE__ */ (0,
|
|
17475
|
-
/* @__PURE__ */ (0,
|
|
17476
|
-
/* @__PURE__ */ (0,
|
|
17518
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(DrawerTitle, { className: "sr-only", children: drawerTitle }),
|
|
17519
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(DrawerDescription, { className: "sr-only", children: drawerDescription }),
|
|
17520
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)("div", { className: "flex items-start justify-center overflow-x-auto px-2 pb-4 pt-1", children })
|
|
17477
17521
|
]
|
|
17478
17522
|
}
|
|
17479
17523
|
)
|
|
17480
17524
|
}
|
|
17481
17525
|
);
|
|
17482
17526
|
}
|
|
17483
|
-
return /* @__PURE__ */ (0,
|
|
17527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
|
|
17484
17528
|
"div",
|
|
17485
17529
|
{
|
|
17486
17530
|
className: cn(
|
|
@@ -17493,8 +17537,8 @@ function DateRangePopover({
|
|
|
17493
17537
|
}
|
|
17494
17538
|
|
|
17495
17539
|
// src/dashboard/date-range-picker/DateRangePicker.tsx
|
|
17496
|
-
var
|
|
17497
|
-
var DateRangePicker =
|
|
17540
|
+
var import_jsx_runtime178 = require("react/jsx-runtime");
|
|
17541
|
+
var DateRangePicker = React67.forwardRef(function DateRangePicker2({
|
|
17498
17542
|
label,
|
|
17499
17543
|
value: externalValue,
|
|
17500
17544
|
defaultValue,
|
|
@@ -17529,20 +17573,20 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17529
17573
|
components: customComponents,
|
|
17530
17574
|
...dayPickerProps
|
|
17531
17575
|
}, ref) {
|
|
17532
|
-
const containerRef =
|
|
17533
|
-
const fromInputRef =
|
|
17534
|
-
const toInputRef =
|
|
17535
|
-
const reactId =
|
|
17576
|
+
const containerRef = React67.useRef(null);
|
|
17577
|
+
const fromInputRef = React67.useRef(null);
|
|
17578
|
+
const toInputRef = React67.useRef(null);
|
|
17579
|
+
const reactId = React67.useId();
|
|
17536
17580
|
const baseId = name ?? `dash-daterange-${reactId}`;
|
|
17537
17581
|
const fromId = `${baseId}-from`;
|
|
17538
17582
|
const toId = `${baseId}-to`;
|
|
17539
17583
|
const labelId = `${baseId}-label`;
|
|
17540
17584
|
const errorId = `${baseId}-error`;
|
|
17541
|
-
const normalizedValue =
|
|
17585
|
+
const normalizedValue = React67.useMemo(() => {
|
|
17542
17586
|
if (externalValue === void 0) return void 0;
|
|
17543
17587
|
return { from: toDate(externalValue?.from), to: toDate(externalValue?.to) };
|
|
17544
17588
|
}, [externalValue]);
|
|
17545
|
-
const normalizedDefaultValue =
|
|
17589
|
+
const normalizedDefaultValue = React67.useMemo(() => {
|
|
17546
17590
|
if (defaultValue === void 0) return void 0;
|
|
17547
17591
|
return { from: toDate(defaultValue?.from), to: toDate(defaultValue?.to) };
|
|
17548
17592
|
}, [defaultValue]);
|
|
@@ -17552,16 +17596,16 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17552
17596
|
onChange,
|
|
17553
17597
|
name
|
|
17554
17598
|
});
|
|
17555
|
-
const normalizedMinDate =
|
|
17556
|
-
const normalizedMaxDate =
|
|
17557
|
-
const formatter =
|
|
17558
|
-
const parser =
|
|
17559
|
-
const closeCalendarRef =
|
|
17599
|
+
const normalizedMinDate = React67.useMemo(() => toDate(minDate), [minDate]);
|
|
17600
|
+
const normalizedMaxDate = React67.useMemo(() => toDate(maxDate), [maxDate]);
|
|
17601
|
+
const formatter = React67.useMemo(() => formatDate(displayFormat), [displayFormat]);
|
|
17602
|
+
const parser = React67.useMemo(() => parseDate(displayFormat), [displayFormat]);
|
|
17603
|
+
const closeCalendarRef = React67.useRef(() => {
|
|
17560
17604
|
});
|
|
17561
|
-
const handleFromComplete =
|
|
17605
|
+
const handleFromComplete = React67.useCallback(() => {
|
|
17562
17606
|
toInputRef.current?.focus();
|
|
17563
17607
|
}, []);
|
|
17564
|
-
const handleToComplete =
|
|
17608
|
+
const handleToComplete = React67.useCallback(() => {
|
|
17565
17609
|
toInputRef.current?.blur();
|
|
17566
17610
|
closeCalendarRef.current();
|
|
17567
17611
|
}, []);
|
|
@@ -17585,9 +17629,9 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17585
17629
|
onToComplete: handleToComplete
|
|
17586
17630
|
});
|
|
17587
17631
|
const { month, setMonth, syncMonthToValue } = useRangeMonthSync(value);
|
|
17588
|
-
const [isOpen, setIsOpen] =
|
|
17589
|
-
const [focusedInput, setFocusedInput] =
|
|
17590
|
-
const [autoFocus, setAutoFocus] =
|
|
17632
|
+
const [isOpen, setIsOpen] = React67.useState(false);
|
|
17633
|
+
const [focusedInput, setFocusedInput] = React67.useState(null);
|
|
17634
|
+
const [autoFocus, setAutoFocus] = React67.useState(false);
|
|
17591
17635
|
const isMobile3 = useIsMobile();
|
|
17592
17636
|
const { t } = (0, import_react_i18next39.useTranslation)();
|
|
17593
17637
|
const drawerTitle = label ?? t("select_dates");
|
|
@@ -17598,14 +17642,14 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17598
17642
|
const isFocused = focusedInput !== null || isOpen;
|
|
17599
17643
|
const wrapperWidth = toCssSize(width);
|
|
17600
17644
|
const monthsToShow = numberOfMonths ?? (isMobile3 ? 1 : 2);
|
|
17601
|
-
const closeCalendar =
|
|
17645
|
+
const closeCalendar = React67.useCallback(() => {
|
|
17602
17646
|
setIsOpen(false);
|
|
17603
17647
|
setFocusedInput(null);
|
|
17604
17648
|
setAutoFocus(false);
|
|
17605
17649
|
if (value?.from) setMonth(value.from);
|
|
17606
17650
|
}, [setMonth, value?.from]);
|
|
17607
17651
|
closeCalendarRef.current = closeCalendar;
|
|
17608
|
-
const openCalendar =
|
|
17652
|
+
const openCalendar = React67.useCallback(() => {
|
|
17609
17653
|
if (isBlocked || readOnly) return;
|
|
17610
17654
|
setIsOpen(true);
|
|
17611
17655
|
}, [isBlocked, readOnly]);
|
|
@@ -17614,7 +17658,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17614
17658
|
onOutsideClick: closeCalendar,
|
|
17615
17659
|
isDisabled: !isOpen || isMobile3
|
|
17616
17660
|
});
|
|
17617
|
-
const handlePickerChange =
|
|
17661
|
+
const handlePickerChange = React67.useCallback(
|
|
17618
17662
|
(range, pickedDate) => {
|
|
17619
17663
|
const { next, shouldClose } = resolveRangeSelection({
|
|
17620
17664
|
previous: value,
|
|
@@ -17635,7 +17679,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17635
17679
|
setToText("");
|
|
17636
17680
|
setMonth(/* @__PURE__ */ new Date());
|
|
17637
17681
|
};
|
|
17638
|
-
const disabledMatchers =
|
|
17682
|
+
const disabledMatchers = React67.useMemo(
|
|
17639
17683
|
() => createDisabledMatchers({
|
|
17640
17684
|
minDate: normalizedMinDate,
|
|
17641
17685
|
maxDate: normalizedMaxDate,
|
|
@@ -17654,7 +17698,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17654
17698
|
openCalendar();
|
|
17655
17699
|
if (autoFocusOnOpen) setAutoFocus(true);
|
|
17656
17700
|
};
|
|
17657
|
-
|
|
17701
|
+
React67.useImperativeHandle(
|
|
17658
17702
|
ref,
|
|
17659
17703
|
() => ({
|
|
17660
17704
|
setDateRange: (range) => {
|
|
@@ -17677,7 +17721,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17677
17721
|
syncMonthToValue
|
|
17678
17722
|
]
|
|
17679
17723
|
);
|
|
17680
|
-
return /* @__PURE__ */ (0,
|
|
17724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
17681
17725
|
"div",
|
|
17682
17726
|
{
|
|
17683
17727
|
ref: containerRef,
|
|
@@ -17688,9 +17732,9 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17688
17732
|
className
|
|
17689
17733
|
),
|
|
17690
17734
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
17691
|
-
children: /* @__PURE__ */ (0,
|
|
17692
|
-
/* @__PURE__ */ (0,
|
|
17693
|
-
/* @__PURE__ */ (0,
|
|
17735
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime178.jsxs)("div", { className: "relative min-h-[var(--field-min-height,48px)] w-full", children: [
|
|
17736
|
+
/* @__PURE__ */ (0, import_jsx_runtime178.jsxs)("div", { className: "relative w-full", children: [
|
|
17737
|
+
/* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
17694
17738
|
DateRangeInputs,
|
|
17695
17739
|
{
|
|
17696
17740
|
fromId,
|
|
@@ -17743,7 +17787,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17743
17787
|
onToggleCalendar: toggleCalendar
|
|
17744
17788
|
}
|
|
17745
17789
|
),
|
|
17746
|
-
/* @__PURE__ */ (0,
|
|
17790
|
+
/* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
17747
17791
|
Fieldset,
|
|
17748
17792
|
{
|
|
17749
17793
|
isFocused,
|
|
@@ -17760,7 +17804,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17760
17804
|
tooltip
|
|
17761
17805
|
}
|
|
17762
17806
|
),
|
|
17763
|
-
/* @__PURE__ */ (0,
|
|
17807
|
+
/* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
17764
17808
|
DateRangePopover,
|
|
17765
17809
|
{
|
|
17766
17810
|
isOpen: isOpen && !isMobile3,
|
|
@@ -17769,7 +17813,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17769
17813
|
drawerTitle,
|
|
17770
17814
|
drawerDescription,
|
|
17771
17815
|
onClose: closeCalendar,
|
|
17772
|
-
children: /* @__PURE__ */ (0,
|
|
17816
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
17773
17817
|
DateRangeCalendar,
|
|
17774
17818
|
{
|
|
17775
17819
|
value,
|
|
@@ -17790,7 +17834,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17790
17834
|
}
|
|
17791
17835
|
)
|
|
17792
17836
|
] }),
|
|
17793
|
-
/* @__PURE__ */ (0,
|
|
17837
|
+
/* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
17794
17838
|
DateRangePopover,
|
|
17795
17839
|
{
|
|
17796
17840
|
isOpen: isOpen && isMobile3,
|
|
@@ -17799,7 +17843,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17799
17843
|
drawerTitle,
|
|
17800
17844
|
drawerDescription,
|
|
17801
17845
|
onClose: closeCalendar,
|
|
17802
|
-
children: /* @__PURE__ */ (0,
|
|
17846
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
17803
17847
|
DateRangeCalendar,
|
|
17804
17848
|
{
|
|
17805
17849
|
value,
|
|
@@ -17819,9 +17863,9 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17819
17863
|
)
|
|
17820
17864
|
}
|
|
17821
17865
|
),
|
|
17822
|
-
!error && optional && /* @__PURE__ */ (0,
|
|
17823
|
-
!error && helperText && /* @__PURE__ */ (0,
|
|
17824
|
-
error && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
17866
|
+
!error && optional && /* @__PURE__ */ (0, import_jsx_runtime178.jsx)("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
17867
|
+
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime178.jsx)("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
17868
|
+
error && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
17825
17869
|
FieldErrorMessage,
|
|
17826
17870
|
{
|
|
17827
17871
|
id: errorId,
|
|
@@ -17835,7 +17879,7 @@ var DateRangePicker = React66.forwardRef(function DateRangePicker2({
|
|
|
17835
17879
|
});
|
|
17836
17880
|
|
|
17837
17881
|
// src/dashboard/date-range-picker/useValidateDates.ts
|
|
17838
|
-
var
|
|
17882
|
+
var React68 = __toESM(require("react"), 1);
|
|
17839
17883
|
var import_react_i18next40 = require("react-i18next");
|
|
17840
17884
|
var import_date_fns4 = require("date-fns");
|
|
17841
17885
|
var import_react_day_picker2 = require("react-day-picker");
|
|
@@ -17858,11 +17902,11 @@ function useValidateDates({
|
|
|
17858
17902
|
const { t } = (0, import_react_i18next40.useTranslation)();
|
|
17859
17903
|
const handleError = useEvent(onError);
|
|
17860
17904
|
const handleSuccess = useEvent(onSuccess);
|
|
17861
|
-
const errorFormatter =
|
|
17905
|
+
const errorFormatter = React68.useMemo(
|
|
17862
17906
|
() => formatDate(displayFormat ?? DEFAULT_DISPLAY_FORMAT),
|
|
17863
17907
|
[displayFormat]
|
|
17864
17908
|
);
|
|
17865
|
-
const validateDates =
|
|
17909
|
+
const validateDates = React68.useCallback(
|
|
17866
17910
|
(dates) => {
|
|
17867
17911
|
const startDate = dates?.from;
|
|
17868
17912
|
const endDate = dates?.to;
|
|
@@ -17912,9 +17956,9 @@ function useValidateDates({
|
|
|
17912
17956
|
}
|
|
17913
17957
|
|
|
17914
17958
|
// src/dashboard/time-picker/TimePicker.tsx
|
|
17915
|
-
var
|
|
17959
|
+
var React69 = __toESM(require("react"), 1);
|
|
17916
17960
|
var import_date_fns5 = require("date-fns");
|
|
17917
|
-
var
|
|
17961
|
+
var import_jsx_runtime179 = require("react/jsx-runtime");
|
|
17918
17962
|
var SHORT_TIME_FORMAT = "HH:mm";
|
|
17919
17963
|
function parseTime(value) {
|
|
17920
17964
|
return (0, import_date_fns5.parse)(value, SHORT_TIME_FORMAT, /* @__PURE__ */ new Date());
|
|
@@ -17956,24 +18000,24 @@ var FORMAT_SETTINGS = {
|
|
|
17956
18000
|
},
|
|
17957
18001
|
hours: { interval_unit: "H", interval: 1, min_time: "00:00", max_time: "23:00" }
|
|
17958
18002
|
};
|
|
17959
|
-
var TimePicker =
|
|
17960
|
-
const resolvedOptions =
|
|
18003
|
+
var TimePicker = React69.forwardRef(function TimePicker2({ format: formatName = "time", timeSettings, options, ...selectProps }, ref) {
|
|
18004
|
+
const resolvedOptions = React69.useMemo(() => {
|
|
17961
18005
|
if (options) return options;
|
|
17962
18006
|
const settings = timeSettings ?? FORMAT_SETTINGS[formatName];
|
|
17963
18007
|
return buildOptions(settings);
|
|
17964
18008
|
}, [formatName, options, timeSettings]);
|
|
17965
|
-
return /* @__PURE__ */ (0,
|
|
18009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(Select, { ref, ...selectProps, options: resolvedOptions });
|
|
17966
18010
|
});
|
|
17967
18011
|
|
|
17968
18012
|
// src/dashboard/file-input/FileInput.tsx
|
|
17969
|
-
var
|
|
18013
|
+
var React70 = __toESM(require("react"), 1);
|
|
17970
18014
|
var import_lucide_react52 = require("lucide-react");
|
|
17971
18015
|
var import_react_i18next41 = require("react-i18next");
|
|
17972
|
-
var
|
|
18016
|
+
var import_jsx_runtime180 = require("react/jsx-runtime");
|
|
17973
18017
|
function defaultDownload(url) {
|
|
17974
18018
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
17975
18019
|
}
|
|
17976
|
-
var FileInput =
|
|
18020
|
+
var FileInput = React70.forwardRef(function FileInput2({
|
|
17977
18021
|
label,
|
|
17978
18022
|
value,
|
|
17979
18023
|
onChange,
|
|
@@ -17996,12 +18040,12 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
17996
18040
|
width,
|
|
17997
18041
|
downloadLabel
|
|
17998
18042
|
}, ref) {
|
|
17999
|
-
const internalRef =
|
|
18043
|
+
const internalRef = React70.useRef(null);
|
|
18000
18044
|
const inputRef = useCombinedRef(ref, internalRef);
|
|
18001
18045
|
const { t } = (0, import_react_i18next41.useTranslation)();
|
|
18002
18046
|
const resolvedLabel = label ?? t("upload_file");
|
|
18003
18047
|
const resolvedDownloadLabel = downloadLabel ?? t("download_attachment");
|
|
18004
|
-
const reactId =
|
|
18048
|
+
const reactId = React70.useId();
|
|
18005
18049
|
const inputId = `${name || "dash-file"}-${reactId}`;
|
|
18006
18050
|
const labelId = `${inputId}-label`;
|
|
18007
18051
|
const errorId = `${inputId}-error`;
|
|
@@ -18027,7 +18071,7 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
18027
18071
|
event.stopPropagation();
|
|
18028
18072
|
if (isUrl) onDownload(value);
|
|
18029
18073
|
};
|
|
18030
|
-
return /* @__PURE__ */ (0,
|
|
18074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(
|
|
18031
18075
|
"label",
|
|
18032
18076
|
{
|
|
18033
18077
|
htmlFor: inputId,
|
|
@@ -18040,7 +18084,7 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
18040
18084
|
),
|
|
18041
18085
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
18042
18086
|
children: [
|
|
18043
|
-
/* @__PURE__ */ (0,
|
|
18087
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
18044
18088
|
"input",
|
|
18045
18089
|
{
|
|
18046
18090
|
ref: inputRef,
|
|
@@ -18057,9 +18101,9 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
18057
18101
|
"aria-invalid": isInvalid
|
|
18058
18102
|
}
|
|
18059
18103
|
),
|
|
18060
|
-
/* @__PURE__ */ (0,
|
|
18061
|
-
/* @__PURE__ */ (0,
|
|
18062
|
-
/* @__PURE__ */ (0,
|
|
18104
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsxs)("div", { className: "relative w-full", children: [
|
|
18105
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsxs)("div", { className: "relative w-full", children: [
|
|
18106
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(
|
|
18063
18107
|
"div",
|
|
18064
18108
|
{
|
|
18065
18109
|
className: cn(
|
|
@@ -18067,25 +18111,25 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
18067
18111
|
isEmpty && "bg-[var(--empty-field-background)]"
|
|
18068
18112
|
),
|
|
18069
18113
|
children: [
|
|
18070
|
-
hasFileChip ? /* @__PURE__ */ (0,
|
|
18114
|
+
hasFileChip ? /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(
|
|
18071
18115
|
"div",
|
|
18072
18116
|
{
|
|
18073
18117
|
className: "inline-flex h-6 max-w-[85%] items-center rounded-[4px] border border-[#acacd5] bg-[#f0f0f8] pl-[10px] pr-1",
|
|
18074
18118
|
onClick: (event) => event.preventDefault(),
|
|
18075
18119
|
children: [
|
|
18076
|
-
isUrl ? /* @__PURE__ */ (0,
|
|
18120
|
+
isUrl ? /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(
|
|
18077
18121
|
"button",
|
|
18078
18122
|
{
|
|
18079
18123
|
type: "button",
|
|
18080
18124
|
onClick: handleDownload,
|
|
18081
18125
|
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",
|
|
18082
18126
|
children: [
|
|
18083
|
-
/* @__PURE__ */ (0,
|
|
18084
|
-
/* @__PURE__ */ (0,
|
|
18127
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)("span", { className: "truncate", children: resolvedDownloadLabel }),
|
|
18128
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_lucide_react52.Download, { size: 15 })
|
|
18085
18129
|
]
|
|
18086
18130
|
}
|
|
18087
|
-
) : /* @__PURE__ */ (0,
|
|
18088
|
-
/* @__PURE__ */ (0,
|
|
18131
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("span", { className: "truncate text-[14px] font-medium text-[var(--chekin-color-brand-navy)]", children: value.name }),
|
|
18132
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
18089
18133
|
"button",
|
|
18090
18134
|
{
|
|
18091
18135
|
type: "button",
|
|
@@ -18093,17 +18137,17 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
18093
18137
|
onClick: handleClear,
|
|
18094
18138
|
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]",
|
|
18095
18139
|
"aria-label": t("remove_file"),
|
|
18096
|
-
children: /* @__PURE__ */ (0,
|
|
18140
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_lucide_react52.SquareX, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
18097
18141
|
}
|
|
18098
18142
|
)
|
|
18099
18143
|
]
|
|
18100
18144
|
}
|
|
18101
|
-
) : /* @__PURE__ */ (0,
|
|
18102
|
-
/* @__PURE__ */ (0,
|
|
18145
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("span", { className: "block min-w-0 flex-1 truncate text-left text-[var(--chekin-color-gray-1)]", children: placeholder ?? "" }),
|
|
18146
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)("span", { className: "ml-auto flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_lucide_react52.Paperclip, { size: 20 }) })
|
|
18103
18147
|
]
|
|
18104
18148
|
}
|
|
18105
18149
|
),
|
|
18106
|
-
/* @__PURE__ */ (0,
|
|
18150
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
18107
18151
|
Fieldset,
|
|
18108
18152
|
{
|
|
18109
18153
|
isFocused: false,
|
|
@@ -18121,9 +18165,9 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
18121
18165
|
}
|
|
18122
18166
|
)
|
|
18123
18167
|
] }),
|
|
18124
|
-
!error && optional && /* @__PURE__ */ (0,
|
|
18125
|
-
!error && helperText && /* @__PURE__ */ (0,
|
|
18126
|
-
error && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
18168
|
+
!error && optional && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
18169
|
+
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
18170
|
+
error && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
18127
18171
|
FieldErrorMessage,
|
|
18128
18172
|
{
|
|
18129
18173
|
id: errorId,
|
|
@@ -18138,10 +18182,10 @@ var FileInput = React69.forwardRef(function FileInput2({
|
|
|
18138
18182
|
});
|
|
18139
18183
|
|
|
18140
18184
|
// src/dashboard/select-icons-box/SelectIconsBox.tsx
|
|
18141
|
-
var
|
|
18142
|
-
var
|
|
18185
|
+
var React71 = __toESM(require("react"), 1);
|
|
18186
|
+
var import_jsx_runtime181 = require("react/jsx-runtime");
|
|
18143
18187
|
var FOCUSABLE_TRIGGER_SELECTOR2 = 'input:not([type="hidden"]):not([disabled]):not([readonly]), button:not([disabled])';
|
|
18144
|
-
var SelectIconsBox =
|
|
18188
|
+
var SelectIconsBox = React71.forwardRef(
|
|
18145
18189
|
function SelectIconsBox2({
|
|
18146
18190
|
children,
|
|
18147
18191
|
icons,
|
|
@@ -18157,10 +18201,10 @@ var SelectIconsBox = React70.forwardRef(
|
|
|
18157
18201
|
className,
|
|
18158
18202
|
boxClassName
|
|
18159
18203
|
}, ref) {
|
|
18160
|
-
const containerRef =
|
|
18204
|
+
const containerRef = React71.useRef(null);
|
|
18161
18205
|
const combinedContainerRef = useCombinedRef(containerRef, ref);
|
|
18162
18206
|
const isControlled = controlledOpen !== void 0;
|
|
18163
|
-
const [internalOpen, setInternalOpen] =
|
|
18207
|
+
const [internalOpen, setInternalOpen] = React71.useState(defaultOpen);
|
|
18164
18208
|
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
18165
18209
|
const setOpen = (next) => {
|
|
18166
18210
|
if (!isControlled) setInternalOpen(next);
|
|
@@ -18187,7 +18231,7 @@ var SelectIconsBox = React70.forwardRef(
|
|
|
18187
18231
|
);
|
|
18188
18232
|
focusable?.focus();
|
|
18189
18233
|
};
|
|
18190
|
-
return /* @__PURE__ */ (0,
|
|
18234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime181.jsxs)(
|
|
18191
18235
|
"div",
|
|
18192
18236
|
{
|
|
18193
18237
|
ref: combinedContainerRef,
|
|
@@ -18197,7 +18241,7 @@ var SelectIconsBox = React70.forwardRef(
|
|
|
18197
18241
|
className: cn("relative inline-block outline-none", className),
|
|
18198
18242
|
children: [
|
|
18199
18243
|
children,
|
|
18200
|
-
isOpen && /* @__PURE__ */ (0,
|
|
18244
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18201
18245
|
"div",
|
|
18202
18246
|
{
|
|
18203
18247
|
className: cn(
|
|
@@ -18208,7 +18252,7 @@ var SelectIconsBox = React70.forwardRef(
|
|
|
18208
18252
|
boxClassName
|
|
18209
18253
|
),
|
|
18210
18254
|
style: { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` },
|
|
18211
|
-
children: icons.map((iconName) => /* @__PURE__ */ (0,
|
|
18255
|
+
children: icons.map((iconName) => /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18212
18256
|
"button",
|
|
18213
18257
|
{
|
|
18214
18258
|
type: "button",
|
|
@@ -18291,14 +18335,14 @@ function getErrorMessage(error) {
|
|
|
18291
18335
|
|
|
18292
18336
|
// src/lib/toastResponseError.tsx
|
|
18293
18337
|
var import_i18next = __toESM(require("i18next"), 1);
|
|
18294
|
-
var
|
|
18338
|
+
var import_jsx_runtime182 = require("react/jsx-runtime");
|
|
18295
18339
|
function addSupportEmailToMessage(message, prefixText) {
|
|
18296
18340
|
if (typeof message !== "string") {
|
|
18297
18341
|
return message;
|
|
18298
18342
|
}
|
|
18299
18343
|
const builtMessage = `${prefixText ? `${prefixText} ` : ""}${message}`;
|
|
18300
|
-
return /* @__PURE__ */ (0,
|
|
18301
|
-
/* @__PURE__ */ (0,
|
|
18344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { children: [
|
|
18345
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("div", { children: builtMessage }),
|
|
18302
18346
|
import_i18next.default.t("reach_us_at_email")
|
|
18303
18347
|
] });
|
|
18304
18348
|
}
|
|
@@ -18314,12 +18358,12 @@ function toastResponseError(error, options = {}) {
|
|
|
18314
18358
|
|
|
18315
18359
|
// src/legacy-fields/textarea/Textarea.tsx
|
|
18316
18360
|
var import_react89 = require("react");
|
|
18317
|
-
var
|
|
18361
|
+
var import_jsx_runtime183 = require("react/jsx-runtime");
|
|
18318
18362
|
var LegacyTextarea = (0, import_react89.forwardRef)(
|
|
18319
18363
|
({ className, textareaClassName, label, disabled, name, invalid, ...textareaProps }, ref) => {
|
|
18320
18364
|
const inputId = (0, import_react89.useId)();
|
|
18321
|
-
return /* @__PURE__ */ (0,
|
|
18322
|
-
/* @__PURE__ */ (0,
|
|
18365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)("div", { className: cn("relative", className), children: [
|
|
18366
|
+
/* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
|
|
18323
18367
|
"textarea",
|
|
18324
18368
|
{
|
|
18325
18369
|
ref,
|
|
@@ -18335,7 +18379,7 @@ var LegacyTextarea = (0, import_react89.forwardRef)(
|
|
|
18335
18379
|
...textareaProps
|
|
18336
18380
|
}
|
|
18337
18381
|
),
|
|
18338
|
-
label && /* @__PURE__ */ (0,
|
|
18382
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
|
|
18339
18383
|
"label",
|
|
18340
18384
|
{
|
|
18341
18385
|
htmlFor: inputId,
|
|
@@ -18353,15 +18397,15 @@ var LegacyTextarea = (0, import_react89.forwardRef)(
|
|
|
18353
18397
|
LegacyTextarea.displayName = "LegacyTextarea";
|
|
18354
18398
|
|
|
18355
18399
|
// src/airbnb-fields/datepicker/DatePicker.tsx
|
|
18356
|
-
var
|
|
18400
|
+
var React73 = __toESM(require("react"), 1);
|
|
18357
18401
|
var import_lucide_react54 = require("lucide-react");
|
|
18358
18402
|
|
|
18359
18403
|
// src/airbnb-fields/field-trigger/FieldTrigger.tsx
|
|
18360
|
-
var
|
|
18404
|
+
var React72 = __toESM(require("react"), 1);
|
|
18361
18405
|
var import_lucide_react53 = require("lucide-react");
|
|
18362
18406
|
var import_react_i18next42 = require("react-i18next");
|
|
18363
|
-
var
|
|
18364
|
-
var AirbnbFieldTrigger =
|
|
18407
|
+
var import_jsx_runtime184 = require("react/jsx-runtime");
|
|
18408
|
+
var AirbnbFieldTrigger = React72.forwardRef(
|
|
18365
18409
|
({
|
|
18366
18410
|
as = "button",
|
|
18367
18411
|
id,
|
|
@@ -18397,14 +18441,14 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18397
18441
|
const optionalLabel = optional ? typeof optional === "string" ? optional : t("optional") : void 0;
|
|
18398
18442
|
const visibleLabelText = labelText ?? label;
|
|
18399
18443
|
const hasLabelMeta = Boolean(optionalLabel) || Boolean(tooltip);
|
|
18400
|
-
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */ (0,
|
|
18401
|
-
/* @__PURE__ */ (0,
|
|
18402
|
-
optionalLabel && /* @__PURE__ */ (0,
|
|
18444
|
+
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("span", { className: "inline-flex max-w-full items-center gap-1.5 align-middle", children: [
|
|
18445
|
+
/* @__PURE__ */ (0, import_jsx_runtime184.jsx)("span", { className: "min-w-0 truncate", children: visibleLabelText }),
|
|
18446
|
+
optionalLabel && /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("span", { className: "text-current opacity-70 lowercase", children: [
|
|
18403
18447
|
"(",
|
|
18404
18448
|
optionalLabel,
|
|
18405
18449
|
")"
|
|
18406
18450
|
] }),
|
|
18407
|
-
tooltip && /* @__PURE__ */ (0,
|
|
18451
|
+
tooltip && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
|
|
18408
18452
|
HelpTooltip,
|
|
18409
18453
|
{
|
|
18410
18454
|
content: tooltip,
|
|
@@ -18419,9 +18463,9 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18419
18463
|
const hasInvalidState = Boolean(error);
|
|
18420
18464
|
const errorMessage = typeof error === "string" ? error : void 0;
|
|
18421
18465
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
18422
|
-
const resolvedTrailingAdornment = loading || trailingAdornment ? /* @__PURE__ */ (0,
|
|
18466
|
+
const resolvedTrailingAdornment = loading || trailingAdornment ? /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
18423
18467
|
trailingAdornment,
|
|
18424
|
-
loading && /* @__PURE__ */ (0,
|
|
18468
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
|
|
18425
18469
|
import_lucide_react53.Loader2,
|
|
18426
18470
|
{
|
|
18427
18471
|
"aria-hidden": "true",
|
|
@@ -18437,8 +18481,8 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18437
18481
|
disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : "cursor-pointer",
|
|
18438
18482
|
className
|
|
18439
18483
|
);
|
|
18440
|
-
const sharedContent = /* @__PURE__ */ (0,
|
|
18441
|
-
/* @__PURE__ */ (0,
|
|
18484
|
+
const sharedContent = /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(import_jsx_runtime184.Fragment, { children: [
|
|
18485
|
+
/* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(
|
|
18442
18486
|
"span",
|
|
18443
18487
|
{
|
|
18444
18488
|
className: cn(
|
|
@@ -18447,7 +18491,7 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18447
18491
|
contentClassName
|
|
18448
18492
|
),
|
|
18449
18493
|
children: [
|
|
18450
|
-
/* @__PURE__ */ (0,
|
|
18494
|
+
/* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
|
|
18451
18495
|
"span",
|
|
18452
18496
|
{
|
|
18453
18497
|
id: labelId,
|
|
@@ -18460,7 +18504,7 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18460
18504
|
children: animatedLabel
|
|
18461
18505
|
}
|
|
18462
18506
|
),
|
|
18463
|
-
children ? children : hasValue ? /* @__PURE__ */ (0,
|
|
18507
|
+
children ? children : hasValue ? /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
|
|
18464
18508
|
"span",
|
|
18465
18509
|
{
|
|
18466
18510
|
id: valueId,
|
|
@@ -18471,11 +18515,11 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18471
18515
|
),
|
|
18472
18516
|
children: valueText
|
|
18473
18517
|
}
|
|
18474
|
-
) : /* @__PURE__ */ (0,
|
|
18518
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("span", { id: helperTextId, className: "sr-only", children: placeholder ?? label })
|
|
18475
18519
|
]
|
|
18476
18520
|
}
|
|
18477
18521
|
),
|
|
18478
|
-
resolvedTrailingAdornment && /* @__PURE__ */ (0,
|
|
18522
|
+
resolvedTrailingAdornment && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
|
|
18479
18523
|
"span",
|
|
18480
18524
|
{
|
|
18481
18525
|
"aria-hidden": "true",
|
|
@@ -18484,9 +18528,9 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18484
18528
|
}
|
|
18485
18529
|
)
|
|
18486
18530
|
] });
|
|
18487
|
-
return /* @__PURE__ */ (0,
|
|
18488
|
-
topLabel && /* @__PURE__ */ (0,
|
|
18489
|
-
as === "button" ? /* @__PURE__ */ (0,
|
|
18531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("div", { className: "w-full", children: [
|
|
18532
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("p", { className: "mb-3 text-[16px] font-semibold leading-5 text-[#222222]", children: topLabel }),
|
|
18533
|
+
as === "button" ? /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
|
|
18490
18534
|
"button",
|
|
18491
18535
|
{
|
|
18492
18536
|
id,
|
|
@@ -18503,7 +18547,7 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18503
18547
|
...props,
|
|
18504
18548
|
children: sharedContent
|
|
18505
18549
|
}
|
|
18506
|
-
) : /* @__PURE__ */ (0,
|
|
18550
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
|
|
18507
18551
|
"div",
|
|
18508
18552
|
{
|
|
18509
18553
|
id,
|
|
@@ -18520,16 +18564,16 @@ var AirbnbFieldTrigger = React71.forwardRef(
|
|
|
18520
18564
|
children: sharedContent
|
|
18521
18565
|
}
|
|
18522
18566
|
),
|
|
18523
|
-
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
18567
|
+
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(FieldErrorMessage, { id: errorId, message: errorMessage })
|
|
18524
18568
|
] });
|
|
18525
18569
|
}
|
|
18526
18570
|
);
|
|
18527
18571
|
AirbnbFieldTrigger.displayName = "AirbnbFieldTrigger";
|
|
18528
18572
|
|
|
18529
18573
|
// src/airbnb-fields/datepicker/DatePicker.tsx
|
|
18530
|
-
var
|
|
18574
|
+
var import_jsx_runtime185 = require("react/jsx-runtime");
|
|
18531
18575
|
var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
|
|
18532
|
-
var AirbnbDatePicker =
|
|
18576
|
+
var AirbnbDatePicker = React73.forwardRef(
|
|
18533
18577
|
({
|
|
18534
18578
|
label,
|
|
18535
18579
|
topLabel,
|
|
@@ -18554,24 +18598,24 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18554
18598
|
formatValue = formatDateValue
|
|
18555
18599
|
}, ref) => {
|
|
18556
18600
|
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
18557
|
-
const [isOpen, setIsOpen] =
|
|
18558
|
-
const triggerId =
|
|
18559
|
-
const pickerId =
|
|
18560
|
-
const labelId =
|
|
18561
|
-
const valueId =
|
|
18562
|
-
const helperTextId =
|
|
18563
|
-
const errorId =
|
|
18564
|
-
const internalRef =
|
|
18601
|
+
const [isOpen, setIsOpen] = React73.useState(false);
|
|
18602
|
+
const triggerId = React73.useId();
|
|
18603
|
+
const pickerId = React73.useId();
|
|
18604
|
+
const labelId = React73.useId();
|
|
18605
|
+
const valueId = React73.useId();
|
|
18606
|
+
const helperTextId = React73.useId();
|
|
18607
|
+
const errorId = React73.useId();
|
|
18608
|
+
const internalRef = React73.useRef(null);
|
|
18565
18609
|
const combinedRef = useCombinedRef(ref, internalRef);
|
|
18566
|
-
const monthLabels =
|
|
18567
|
-
const resolvedMinDate =
|
|
18568
|
-
const resolvedMaxDate =
|
|
18569
|
-
const normalizedValue =
|
|
18570
|
-
const normalizedDefaultValue =
|
|
18610
|
+
const monthLabels = React73.useMemo(() => getMonthLabels(locale), [locale]);
|
|
18611
|
+
const resolvedMinDate = React73.useMemo(() => minDate ?? DEFAULT_MIN_DATE, [minDate]);
|
|
18612
|
+
const resolvedMaxDate = React73.useMemo(() => maxDate ?? /* @__PURE__ */ new Date(), [maxDate]);
|
|
18613
|
+
const normalizedValue = React73.useMemo(() => normalizeDateValue(value), [value]);
|
|
18614
|
+
const normalizedDefaultValue = React73.useMemo(
|
|
18571
18615
|
() => normalizeDateValue(defaultValue),
|
|
18572
18616
|
[defaultValue]
|
|
18573
18617
|
);
|
|
18574
|
-
const resolvedValue =
|
|
18618
|
+
const resolvedValue = React73.useMemo(
|
|
18575
18619
|
() => normalizedValue ? clampDate(normalizedValue, resolvedMinDate, resolvedMaxDate) : null,
|
|
18576
18620
|
[normalizedValue, resolvedMaxDate, resolvedMinDate]
|
|
18577
18621
|
);
|
|
@@ -18602,7 +18646,7 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18602
18646
|
minDate: resolvedMinDate,
|
|
18603
18647
|
maxDate: resolvedMaxDate
|
|
18604
18648
|
});
|
|
18605
|
-
const handleOpenChange =
|
|
18649
|
+
const handleOpenChange = React73.useCallback(
|
|
18606
18650
|
(nextOpen) => {
|
|
18607
18651
|
if (isBlocked && nextOpen) return;
|
|
18608
18652
|
setIsOpen(nextOpen);
|
|
@@ -18612,7 +18656,7 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18612
18656
|
},
|
|
18613
18657
|
[isBlocked]
|
|
18614
18658
|
);
|
|
18615
|
-
const handleDone =
|
|
18659
|
+
const handleDone = React73.useCallback(() => {
|
|
18616
18660
|
if (isBlocked) return;
|
|
18617
18661
|
onChange(clampDate(draftDate, resolvedMinDate, resolvedMaxDate));
|
|
18618
18662
|
handleOpenChange(false);
|
|
@@ -18624,11 +18668,11 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18624
18668
|
resolvedMaxDate,
|
|
18625
18669
|
resolvedMinDate
|
|
18626
18670
|
]);
|
|
18627
|
-
const handleTriggerClick =
|
|
18671
|
+
const handleTriggerClick = React73.useCallback(() => {
|
|
18628
18672
|
if (isBlocked) return;
|
|
18629
18673
|
setIsOpen(true);
|
|
18630
18674
|
}, [isBlocked]);
|
|
18631
|
-
const handleTriggerKeyDown =
|
|
18675
|
+
const handleTriggerKeyDown = React73.useCallback(
|
|
18632
18676
|
(event) => {
|
|
18633
18677
|
if (isBlocked) return;
|
|
18634
18678
|
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
@@ -18638,13 +18682,13 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18638
18682
|
},
|
|
18639
18683
|
[isBlocked]
|
|
18640
18684
|
);
|
|
18641
|
-
|
|
18685
|
+
React73.useEffect(() => {
|
|
18642
18686
|
if (isBlocked) {
|
|
18643
18687
|
setIsOpen(false);
|
|
18644
18688
|
}
|
|
18645
18689
|
}, [isBlocked]);
|
|
18646
|
-
return /* @__PURE__ */ (0,
|
|
18647
|
-
name && /* @__PURE__ */ (0,
|
|
18690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)("div", { className: cn("relative w-full max-w-[var(--max-field-width)]", className), children: [
|
|
18691
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
|
|
18648
18692
|
"input",
|
|
18649
18693
|
{
|
|
18650
18694
|
type: "hidden",
|
|
@@ -18652,7 +18696,7 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18652
18696
|
value: resolvedValue ? formatDateInputValue(resolvedValue) : ""
|
|
18653
18697
|
}
|
|
18654
18698
|
),
|
|
18655
|
-
/* @__PURE__ */ (0,
|
|
18699
|
+
/* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
|
|
18656
18700
|
AirbnbFieldTrigger,
|
|
18657
18701
|
{
|
|
18658
18702
|
id: triggerId,
|
|
@@ -18678,10 +18722,10 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18678
18722
|
onClick: handleTriggerClick,
|
|
18679
18723
|
onKeyDown: handleTriggerKeyDown,
|
|
18680
18724
|
onBlur,
|
|
18681
|
-
trailingAdornment: /* @__PURE__ */ (0,
|
|
18725
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(import_lucide_react54.Calendar, { className: "h-5 w-5 text-[#1F1F1B]", strokeWidth: 2 })
|
|
18682
18726
|
}
|
|
18683
18727
|
),
|
|
18684
|
-
/* @__PURE__ */ (0,
|
|
18728
|
+
/* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
|
|
18685
18729
|
AirbnbDatePickerContent,
|
|
18686
18730
|
{
|
|
18687
18731
|
baseId: pickerId,
|
|
@@ -18715,12 +18759,12 @@ var AirbnbDatePicker = React72.forwardRef(
|
|
|
18715
18759
|
AirbnbDatePicker.displayName = "AirbnbDatePicker";
|
|
18716
18760
|
|
|
18717
18761
|
// src/airbnb-fields/input/Input.tsx
|
|
18718
|
-
var
|
|
18762
|
+
var React74 = __toESM(require("react"), 1);
|
|
18719
18763
|
var import_lucide_react55 = require("lucide-react");
|
|
18720
18764
|
var import_react_i18next43 = require("react-i18next");
|
|
18721
|
-
var
|
|
18765
|
+
var import_jsx_runtime186 = require("react/jsx-runtime");
|
|
18722
18766
|
var getInputValue = (value) => value != null ? String(value) : "";
|
|
18723
|
-
var AirbnbInput =
|
|
18767
|
+
var AirbnbInput = React74.forwardRef(
|
|
18724
18768
|
({
|
|
18725
18769
|
label,
|
|
18726
18770
|
topLabel,
|
|
@@ -18749,16 +18793,16 @@ var AirbnbInput = React73.forwardRef(
|
|
|
18749
18793
|
...props
|
|
18750
18794
|
}, ref) => {
|
|
18751
18795
|
const { t } = (0, import_react_i18next43.useTranslation)();
|
|
18752
|
-
const generatedId =
|
|
18753
|
-
const inputRef =
|
|
18796
|
+
const generatedId = React74.useId();
|
|
18797
|
+
const inputRef = React74.useRef(null);
|
|
18754
18798
|
const inputId = id ?? generatedId;
|
|
18755
18799
|
const fieldId = `${inputId}-field`;
|
|
18756
18800
|
const labelId = `${inputId}-label`;
|
|
18757
18801
|
const errorId = `${inputId}-error`;
|
|
18758
18802
|
const accessibleLabel = placeholder ?? label;
|
|
18759
|
-
const [isFocused, setIsFocused] =
|
|
18760
|
-
const [isPasswordRevealed, setIsPasswordRevealed] =
|
|
18761
|
-
const [currentValue, setCurrentValue] =
|
|
18803
|
+
const [isFocused, setIsFocused] = React74.useState(false);
|
|
18804
|
+
const [isPasswordRevealed, setIsPasswordRevealed] = React74.useState(false);
|
|
18805
|
+
const [currentValue, setCurrentValue] = React74.useState(
|
|
18762
18806
|
() => value != null ? getInputValue(value) : getInputValue(defaultValue)
|
|
18763
18807
|
);
|
|
18764
18808
|
const resolvedValue = value != null ? getInputValue(value) : currentValue;
|
|
@@ -18771,16 +18815,16 @@ var AirbnbInput = React73.forwardRef(
|
|
|
18771
18815
|
const triggerError = error ?? invalid;
|
|
18772
18816
|
const hasLabelMeta = Boolean(optional) || Boolean(tooltip);
|
|
18773
18817
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
18774
|
-
|
|
18818
|
+
React74.useLayoutEffect(() => {
|
|
18775
18819
|
const nextValue = value != null ? getInputValue(value) : getInputValue(inputRef.current?.value);
|
|
18776
18820
|
setCurrentValue((prevValue) => prevValue === nextValue ? prevValue : nextValue);
|
|
18777
18821
|
}, [value]);
|
|
18778
|
-
|
|
18822
|
+
React74.useEffect(() => {
|
|
18779
18823
|
if (!isPasswordInput) {
|
|
18780
18824
|
setIsPasswordRevealed(false);
|
|
18781
18825
|
}
|
|
18782
18826
|
}, [isPasswordInput]);
|
|
18783
|
-
const setRefs =
|
|
18827
|
+
const setRefs = React74.useCallback(
|
|
18784
18828
|
(node) => {
|
|
18785
18829
|
inputRef.current = node;
|
|
18786
18830
|
if (node && value == null) {
|
|
@@ -18813,7 +18857,7 @@ var AirbnbInput = React73.forwardRef(
|
|
|
18813
18857
|
const togglePasswordReveal = () => {
|
|
18814
18858
|
setIsPasswordRevealed((isRevealed) => !isRevealed);
|
|
18815
18859
|
};
|
|
18816
|
-
return /* @__PURE__ */ (0,
|
|
18860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)("div", { className: cn("w-full max-w-[var(--max-field-width)]", wrapperClassName), children: /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)(
|
|
18817
18861
|
AirbnbFieldTrigger,
|
|
18818
18862
|
{
|
|
18819
18863
|
as: "div",
|
|
@@ -18842,7 +18886,7 @@ var AirbnbInput = React73.forwardRef(
|
|
|
18842
18886
|
forceLabelText: hasLabelMeta,
|
|
18843
18887
|
hideErrorMessage: !renderErrorMessage,
|
|
18844
18888
|
children: [
|
|
18845
|
-
/* @__PURE__ */ (0,
|
|
18889
|
+
/* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
|
|
18846
18890
|
"input",
|
|
18847
18891
|
{
|
|
18848
18892
|
...props,
|
|
@@ -18872,7 +18916,7 @@ var AirbnbInput = React73.forwardRef(
|
|
|
18872
18916
|
)
|
|
18873
18917
|
}
|
|
18874
18918
|
),
|
|
18875
|
-
shouldShowPasswordReveal && /* @__PURE__ */ (0,
|
|
18919
|
+
shouldShowPasswordReveal && /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
|
|
18876
18920
|
"button",
|
|
18877
18921
|
{
|
|
18878
18922
|
type: "button",
|
|
@@ -18880,7 +18924,7 @@ var AirbnbInput = React73.forwardRef(
|
|
|
18880
18924
|
disabled: isBlocked,
|
|
18881
18925
|
className: "absolute bottom-0 right-0 flex h-6 w-6 items-center justify-center border-0 bg-transparent p-0 text-[#7A8399] hover:text-[#1F1F1B] hover:opacity-85 disabled:cursor-not-allowed disabled:opacity-50",
|
|
18882
18926
|
"aria-label": isPasswordRevealed ? t("hide_password") : t("show_password"),
|
|
18883
|
-
children: /* @__PURE__ */ (0,
|
|
18927
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
|
|
18884
18928
|
import_lucide_react55.Eye,
|
|
18885
18929
|
{
|
|
18886
18930
|
size: 18,
|
|
@@ -18898,14 +18942,14 @@ var AirbnbInput = React73.forwardRef(
|
|
|
18898
18942
|
AirbnbInput.displayName = "AirbnbInput";
|
|
18899
18943
|
|
|
18900
18944
|
// src/airbnb-fields/phone-field/PhoneField.tsx
|
|
18901
|
-
var
|
|
18945
|
+
var React80 = __toESM(require("react"), 1);
|
|
18902
18946
|
var import_lucide_react57 = require("lucide-react");
|
|
18903
18947
|
|
|
18904
18948
|
// src/airbnb-fields/select/Select.tsx
|
|
18905
|
-
var
|
|
18949
|
+
var React79 = __toESM(require("react"), 1);
|
|
18906
18950
|
|
|
18907
18951
|
// src/airbnb-fields/select/SelectDesktopMenu.tsx
|
|
18908
|
-
var
|
|
18952
|
+
var import_jsx_runtime187 = require("react/jsx-runtime");
|
|
18909
18953
|
function AirbnbSelectDesktopMenu({
|
|
18910
18954
|
id,
|
|
18911
18955
|
options,
|
|
@@ -18924,7 +18968,7 @@ function AirbnbSelectDesktopMenu({
|
|
|
18924
18968
|
noOptionsMessage
|
|
18925
18969
|
}) {
|
|
18926
18970
|
const emptyMessage = noOptionsMessage?.();
|
|
18927
|
-
return /* @__PURE__ */ (0,
|
|
18971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(
|
|
18928
18972
|
"div",
|
|
18929
18973
|
{
|
|
18930
18974
|
id,
|
|
@@ -18937,12 +18981,12 @@ function AirbnbSelectDesktopMenu({
|
|
|
18937
18981
|
onKeyDown,
|
|
18938
18982
|
className: cn("max-h-[280px] overflow-y-auto p-2 outline-none", menuClassName),
|
|
18939
18983
|
children: [
|
|
18940
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */ (0,
|
|
18984
|
+
options.length === 0 && emptyMessage ? /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("div", { className: "px-4 py-3 text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : null,
|
|
18941
18985
|
options.map((option, index) => {
|
|
18942
18986
|
const isSelected = selectedValue?.value === option.value;
|
|
18943
18987
|
const isHighlighted = index === highlightedIndex;
|
|
18944
18988
|
const optionKey = `${String(option.value)}-${index}`;
|
|
18945
|
-
return /* @__PURE__ */ (0,
|
|
18989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
|
|
18946
18990
|
"button",
|
|
18947
18991
|
{
|
|
18948
18992
|
id: getOptionId2(index),
|
|
@@ -18974,7 +19018,7 @@ function AirbnbSelectDesktopMenu({
|
|
|
18974
19018
|
}
|
|
18975
19019
|
|
|
18976
19020
|
// src/airbnb-fields/select/SelectDesktopContent.tsx
|
|
18977
|
-
var
|
|
19021
|
+
var import_jsx_runtime188 = require("react/jsx-runtime");
|
|
18978
19022
|
function AirbnbSelectDesktopContent({
|
|
18979
19023
|
isOpen,
|
|
18980
19024
|
listboxId,
|
|
@@ -18995,14 +19039,14 @@ function AirbnbSelectDesktopContent({
|
|
|
18995
19039
|
noOptionsMessage
|
|
18996
19040
|
}) {
|
|
18997
19041
|
if (!isOpen) return null;
|
|
18998
|
-
return /* @__PURE__ */ (0,
|
|
19042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(
|
|
18999
19043
|
"div",
|
|
19000
19044
|
{
|
|
19001
19045
|
className: cn(
|
|
19002
19046
|
"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)]",
|
|
19003
19047
|
dropdownClassName
|
|
19004
19048
|
),
|
|
19005
|
-
children: /* @__PURE__ */ (0,
|
|
19049
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(
|
|
19006
19050
|
AirbnbSelectDesktopMenu,
|
|
19007
19051
|
{
|
|
19008
19052
|
id: listboxId,
|
|
@@ -19100,7 +19144,7 @@ function getMobileOptionStyles(index, scrollTop) {
|
|
|
19100
19144
|
}
|
|
19101
19145
|
|
|
19102
19146
|
// src/airbnb-fields/select/SelectMobileWheel.tsx
|
|
19103
|
-
var
|
|
19147
|
+
var import_jsx_runtime189 = require("react/jsx-runtime");
|
|
19104
19148
|
function AirbnbSelectMobileWheel({
|
|
19105
19149
|
id,
|
|
19106
19150
|
options,
|
|
@@ -19119,7 +19163,7 @@ function AirbnbSelectMobileWheel({
|
|
|
19119
19163
|
}) {
|
|
19120
19164
|
const spacerHeight2 = getWheelSpacerHeight();
|
|
19121
19165
|
const emptyMessage = noOptionsMessage?.();
|
|
19122
|
-
return /* @__PURE__ */ (0,
|
|
19166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)(
|
|
19123
19167
|
"div",
|
|
19124
19168
|
{
|
|
19125
19169
|
id,
|
|
@@ -19131,10 +19175,10 @@ function AirbnbSelectMobileWheel({
|
|
|
19131
19175
|
onKeyDown,
|
|
19132
19176
|
className: cn("relative overflow-hidden outline-none", menuClassName),
|
|
19133
19177
|
children: [
|
|
19134
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */ (0,
|
|
19135
|
-
/* @__PURE__ */ (0,
|
|
19136
|
-
/* @__PURE__ */ (0,
|
|
19137
|
-
/* @__PURE__ */ (0,
|
|
19178
|
+
options.length === 0 && emptyMessage ? /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("div", { className: "flex min-h-[160px] items-center justify-center px-4 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : null,
|
|
19179
|
+
/* @__PURE__ */ (0, import_jsx_runtime189.jsx)("div", { className: "pointer-events-none absolute inset-x-0 top-0 h-16 bg-gradient-to-b from-white via-white/80 to-transparent" }),
|
|
19180
|
+
/* @__PURE__ */ (0, import_jsx_runtime189.jsx)("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-white via-white/80 to-transparent" }),
|
|
19181
|
+
/* @__PURE__ */ (0, import_jsx_runtime189.jsx)(
|
|
19138
19182
|
"div",
|
|
19139
19183
|
{
|
|
19140
19184
|
"aria-hidden": true,
|
|
@@ -19144,7 +19188,7 @@ function AirbnbSelectMobileWheel({
|
|
|
19144
19188
|
)
|
|
19145
19189
|
}
|
|
19146
19190
|
),
|
|
19147
|
-
/* @__PURE__ */ (0,
|
|
19191
|
+
/* @__PURE__ */ (0, import_jsx_runtime189.jsxs)(
|
|
19148
19192
|
"div",
|
|
19149
19193
|
{
|
|
19150
19194
|
ref: listRef,
|
|
@@ -19159,11 +19203,11 @@ function AirbnbSelectMobileWheel({
|
|
|
19159
19203
|
WebkitOverflowScrolling: "touch"
|
|
19160
19204
|
},
|
|
19161
19205
|
children: [
|
|
19162
|
-
/* @__PURE__ */ (0,
|
|
19206
|
+
/* @__PURE__ */ (0, import_jsx_runtime189.jsx)("div", { style: { height: `${spacerHeight2}px` } }),
|
|
19163
19207
|
options.map((option, index) => {
|
|
19164
19208
|
const { distance, style } = getMobileOptionStyles(index, scrollTop);
|
|
19165
19209
|
const optionKey = `${String(option.value)}-${index}`;
|
|
19166
|
-
return /* @__PURE__ */ (0,
|
|
19210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(
|
|
19167
19211
|
"button",
|
|
19168
19212
|
{
|
|
19169
19213
|
id: getOptionId2(index),
|
|
@@ -19184,7 +19228,7 @@ function AirbnbSelectMobileWheel({
|
|
|
19184
19228
|
optionKey
|
|
19185
19229
|
);
|
|
19186
19230
|
}),
|
|
19187
|
-
/* @__PURE__ */ (0,
|
|
19231
|
+
/* @__PURE__ */ (0, import_jsx_runtime189.jsx)("div", { style: { height: `${spacerHeight2}px` } })
|
|
19188
19232
|
]
|
|
19189
19233
|
}
|
|
19190
19234
|
)
|
|
@@ -19194,7 +19238,7 @@ function AirbnbSelectMobileWheel({
|
|
|
19194
19238
|
}
|
|
19195
19239
|
|
|
19196
19240
|
// src/airbnb-fields/select/SelectMobileContent.tsx
|
|
19197
|
-
var
|
|
19241
|
+
var import_jsx_runtime190 = require("react/jsx-runtime");
|
|
19198
19242
|
function AirbnbSelectMobileContent({
|
|
19199
19243
|
open,
|
|
19200
19244
|
onOpenChange,
|
|
@@ -19218,11 +19262,11 @@ function AirbnbSelectMobileContent({
|
|
|
19218
19262
|
getOptionId: getOptionId2,
|
|
19219
19263
|
noOptionsMessage
|
|
19220
19264
|
}) {
|
|
19221
|
-
return /* @__PURE__ */ (0,
|
|
19222
|
-
/* @__PURE__ */ (0,
|
|
19223
|
-
/* @__PURE__ */ (0,
|
|
19224
|
-
/* @__PURE__ */ (0,
|
|
19225
|
-
/* @__PURE__ */ (0,
|
|
19265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(Drawer, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(DrawerContent, { onClose, lockScroll: false, children: [
|
|
19266
|
+
/* @__PURE__ */ (0, import_jsx_runtime190.jsx)(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
19267
|
+
/* @__PURE__ */ (0, import_jsx_runtime190.jsx)(DrawerDescription, { className: "sr-only", children: label }),
|
|
19268
|
+
/* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: "px-6 pb-4 pt-1", children: [
|
|
19269
|
+
/* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
|
|
19226
19270
|
AirbnbSelectMobileWheel,
|
|
19227
19271
|
{
|
|
19228
19272
|
id: listboxId,
|
|
@@ -19241,16 +19285,16 @@ function AirbnbSelectMobileContent({
|
|
|
19241
19285
|
noOptionsMessage
|
|
19242
19286
|
}
|
|
19243
19287
|
),
|
|
19244
|
-
/* @__PURE__ */ (0,
|
|
19288
|
+
/* @__PURE__ */ (0, import_jsx_runtime190.jsx)(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
19245
19289
|
] })
|
|
19246
19290
|
] }) });
|
|
19247
19291
|
}
|
|
19248
19292
|
|
|
19249
19293
|
// src/airbnb-fields/select/SelectTrigger.tsx
|
|
19250
|
-
var
|
|
19294
|
+
var React75 = __toESM(require("react"), 1);
|
|
19251
19295
|
var import_lucide_react56 = require("lucide-react");
|
|
19252
|
-
var
|
|
19253
|
-
var AirbnbSelectTrigger =
|
|
19296
|
+
var import_jsx_runtime191 = require("react/jsx-runtime");
|
|
19297
|
+
var AirbnbSelectTrigger = React75.forwardRef(
|
|
19254
19298
|
({
|
|
19255
19299
|
id,
|
|
19256
19300
|
open,
|
|
@@ -19274,7 +19318,7 @@ var AirbnbSelectTrigger = React74.forwardRef(
|
|
|
19274
19318
|
onKeyDown,
|
|
19275
19319
|
onBlur
|
|
19276
19320
|
}, ref) => {
|
|
19277
|
-
return /* @__PURE__ */ (0,
|
|
19321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
|
|
19278
19322
|
AirbnbFieldTrigger,
|
|
19279
19323
|
{
|
|
19280
19324
|
id,
|
|
@@ -19302,7 +19346,7 @@ var AirbnbSelectTrigger = React74.forwardRef(
|
|
|
19302
19346
|
onClick,
|
|
19303
19347
|
onKeyDown,
|
|
19304
19348
|
onBlur,
|
|
19305
|
-
trailingAdornment: /* @__PURE__ */ (0,
|
|
19349
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
|
|
19306
19350
|
import_lucide_react56.ChevronDown,
|
|
19307
19351
|
{
|
|
19308
19352
|
className: open ? "h-6 w-6 rotate-180 text-[#1F1F1B] transition-transform" : "h-6 w-6 text-[#1F1F1B] transition-transform"
|
|
@@ -19315,7 +19359,7 @@ var AirbnbSelectTrigger = React74.forwardRef(
|
|
|
19315
19359
|
AirbnbSelectTrigger.displayName = "AirbnbSelectTrigger";
|
|
19316
19360
|
|
|
19317
19361
|
// src/airbnb-fields/select/useDesktopSelect.ts
|
|
19318
|
-
var
|
|
19362
|
+
var React76 = __toESM(require("react"), 1);
|
|
19319
19363
|
function useDesktopSelect({
|
|
19320
19364
|
isMobile: isMobile3,
|
|
19321
19365
|
isOpen,
|
|
@@ -19324,12 +19368,12 @@ function useDesktopSelect({
|
|
|
19324
19368
|
disabled,
|
|
19325
19369
|
onChange
|
|
19326
19370
|
}) {
|
|
19327
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
19328
|
-
const triggerRef =
|
|
19329
|
-
const listRef =
|
|
19330
|
-
const optionRefs =
|
|
19371
|
+
const [highlightedIndex, setHighlightedIndex] = React76.useState(-1);
|
|
19372
|
+
const triggerRef = React76.useRef(null);
|
|
19373
|
+
const listRef = React76.useRef(null);
|
|
19374
|
+
const optionRefs = React76.useRef([]);
|
|
19331
19375
|
const selectedIndex = getOptionIndex2(options, value);
|
|
19332
|
-
|
|
19376
|
+
React76.useEffect(() => {
|
|
19333
19377
|
if (!isOpen || isMobile3) return;
|
|
19334
19378
|
setHighlightedIndex((currentIndex) => {
|
|
19335
19379
|
if (currentIndex >= 0) {
|
|
@@ -19344,34 +19388,34 @@ function useDesktopSelect({
|
|
|
19344
19388
|
window.cancelAnimationFrame(frameId);
|
|
19345
19389
|
};
|
|
19346
19390
|
}, [isMobile3, isOpen, options, selectedIndex]);
|
|
19347
|
-
|
|
19391
|
+
React76.useEffect(() => {
|
|
19348
19392
|
if (!isOpen || isMobile3 || highlightedIndex < 0) return;
|
|
19349
19393
|
optionRefs.current[highlightedIndex]?.scrollIntoView({
|
|
19350
19394
|
block: "nearest"
|
|
19351
19395
|
});
|
|
19352
19396
|
}, [highlightedIndex, isMobile3, isOpen]);
|
|
19353
|
-
|
|
19397
|
+
React76.useEffect(() => {
|
|
19354
19398
|
if (isOpen) return;
|
|
19355
19399
|
setHighlightedIndex(-1);
|
|
19356
19400
|
}, [isOpen]);
|
|
19357
|
-
const focusTrigger =
|
|
19401
|
+
const focusTrigger = React76.useCallback(() => {
|
|
19358
19402
|
triggerRef.current?.focus();
|
|
19359
19403
|
}, []);
|
|
19360
|
-
const handleSelect =
|
|
19404
|
+
const handleSelect = React76.useCallback(
|
|
19361
19405
|
(option) => {
|
|
19362
19406
|
if (option.isDisabled || disabled) return;
|
|
19363
19407
|
onChange?.(option);
|
|
19364
19408
|
},
|
|
19365
19409
|
[disabled, onChange]
|
|
19366
19410
|
);
|
|
19367
|
-
const openMenu =
|
|
19411
|
+
const openMenu = React76.useCallback(
|
|
19368
19412
|
(targetIndex) => {
|
|
19369
19413
|
const fallbackIndex = selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex2(options);
|
|
19370
19414
|
setHighlightedIndex(targetIndex ?? fallbackIndex);
|
|
19371
19415
|
},
|
|
19372
19416
|
[options, selectedIndex]
|
|
19373
19417
|
);
|
|
19374
|
-
const handleTriggerKeyDown =
|
|
19418
|
+
const handleTriggerKeyDown = React76.useCallback(
|
|
19375
19419
|
(event, onOpen) => {
|
|
19376
19420
|
if (disabled) return;
|
|
19377
19421
|
if (event.key === "ArrowDown") {
|
|
@@ -19396,7 +19440,7 @@ function useDesktopSelect({
|
|
|
19396
19440
|
},
|
|
19397
19441
|
[disabled, openMenu, options, selectedIndex]
|
|
19398
19442
|
);
|
|
19399
|
-
const handleMenuKeyDown =
|
|
19443
|
+
const handleMenuKeyDown = React76.useCallback(
|
|
19400
19444
|
(event, onClose) => {
|
|
19401
19445
|
if (event.key === "Escape") {
|
|
19402
19446
|
event.preventDefault();
|
|
@@ -19446,7 +19490,7 @@ function useDesktopSelect({
|
|
|
19446
19490
|
},
|
|
19447
19491
|
[focusTrigger, highlightedIndex, onChange, options]
|
|
19448
19492
|
);
|
|
19449
|
-
const setOptionRef =
|
|
19493
|
+
const setOptionRef = React76.useCallback(
|
|
19450
19494
|
(index, node) => {
|
|
19451
19495
|
optionRefs.current[index] = node;
|
|
19452
19496
|
},
|
|
@@ -19466,23 +19510,23 @@ function useDesktopSelect({
|
|
|
19466
19510
|
}
|
|
19467
19511
|
|
|
19468
19512
|
// src/airbnb-fields/select/useMobileSelectWheel.ts
|
|
19469
|
-
var
|
|
19513
|
+
var React77 = __toESM(require("react"), 1);
|
|
19470
19514
|
function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, disabled }) {
|
|
19471
|
-
const [pendingValue, setPendingValue] =
|
|
19515
|
+
const [pendingValue, setPendingValue] = React77.useState(
|
|
19472
19516
|
value ?? null
|
|
19473
19517
|
);
|
|
19474
|
-
const [mobileScrollTop, setMobileScrollTop] =
|
|
19475
|
-
const mobileListRef =
|
|
19476
|
-
const scrollSettleTimeoutRef =
|
|
19477
|
-
const scrollAnimationFrameRef =
|
|
19478
|
-
const getTargetIndex =
|
|
19518
|
+
const [mobileScrollTop, setMobileScrollTop] = React77.useState(0);
|
|
19519
|
+
const mobileListRef = React77.useRef(null);
|
|
19520
|
+
const scrollSettleTimeoutRef = React77.useRef(null);
|
|
19521
|
+
const scrollAnimationFrameRef = React77.useRef(null);
|
|
19522
|
+
const getTargetIndex = React77.useCallback(
|
|
19479
19523
|
(targetValue) => {
|
|
19480
19524
|
const selectedIndex = getOptionIndex2(options, targetValue);
|
|
19481
19525
|
return selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex2(options);
|
|
19482
19526
|
},
|
|
19483
19527
|
[options]
|
|
19484
19528
|
);
|
|
19485
|
-
const syncScrollPosition =
|
|
19529
|
+
const syncScrollPosition = React77.useCallback(
|
|
19486
19530
|
(targetValue, behavior = "instant") => {
|
|
19487
19531
|
const targetIndex = getTargetIndex(targetValue);
|
|
19488
19532
|
if (targetIndex < 0) return;
|
|
@@ -19501,27 +19545,27 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19501
19545
|
},
|
|
19502
19546
|
[getTargetIndex, options]
|
|
19503
19547
|
);
|
|
19504
|
-
const clearScrollSettleTimeout =
|
|
19548
|
+
const clearScrollSettleTimeout = React77.useCallback(() => {
|
|
19505
19549
|
if (scrollSettleTimeoutRef.current === null) return;
|
|
19506
19550
|
window.clearTimeout(scrollSettleTimeoutRef.current);
|
|
19507
19551
|
scrollSettleTimeoutRef.current = null;
|
|
19508
19552
|
}, []);
|
|
19509
|
-
const clearScrollAnimationFrame =
|
|
19553
|
+
const clearScrollAnimationFrame = React77.useCallback(() => {
|
|
19510
19554
|
if (scrollAnimationFrameRef.current === null) return;
|
|
19511
19555
|
window.cancelAnimationFrame(scrollAnimationFrameRef.current);
|
|
19512
19556
|
scrollAnimationFrameRef.current = null;
|
|
19513
19557
|
}, []);
|
|
19514
|
-
|
|
19558
|
+
React77.useEffect(
|
|
19515
19559
|
() => () => {
|
|
19516
19560
|
clearScrollSettleTimeout();
|
|
19517
19561
|
clearScrollAnimationFrame();
|
|
19518
19562
|
},
|
|
19519
19563
|
[clearScrollAnimationFrame, clearScrollSettleTimeout]
|
|
19520
19564
|
);
|
|
19521
|
-
|
|
19565
|
+
React77.useEffect(() => {
|
|
19522
19566
|
setPendingValue(value ?? null);
|
|
19523
19567
|
}, [value]);
|
|
19524
|
-
|
|
19568
|
+
React77.useLayoutEffect(() => {
|
|
19525
19569
|
if (!isMobile3 || !isOpen) return;
|
|
19526
19570
|
const frameId = window.requestAnimationFrame(() => {
|
|
19527
19571
|
syncScrollPosition(value ?? null, "instant");
|
|
@@ -19530,7 +19574,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19530
19574
|
window.cancelAnimationFrame(frameId);
|
|
19531
19575
|
};
|
|
19532
19576
|
}, [isMobile3, isOpen, syncScrollPosition, value]);
|
|
19533
|
-
const settleScroll =
|
|
19577
|
+
const settleScroll = React77.useCallback(() => {
|
|
19534
19578
|
if (!mobileListRef.current) return;
|
|
19535
19579
|
const nextIndex = Math.round(mobileListRef.current.scrollTop / MOBILE_OPTION_HEIGHT);
|
|
19536
19580
|
const nextOption = options[nextIndex];
|
|
@@ -19542,13 +19586,13 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19542
19586
|
}
|
|
19543
19587
|
setPendingValue(nextOption);
|
|
19544
19588
|
}, [options, pendingValue]);
|
|
19545
|
-
const scheduleScrollSettle =
|
|
19589
|
+
const scheduleScrollSettle = React77.useCallback(() => {
|
|
19546
19590
|
clearScrollSettleTimeout();
|
|
19547
19591
|
scrollSettleTimeoutRef.current = window.setTimeout(() => {
|
|
19548
19592
|
settleScroll();
|
|
19549
19593
|
}, MOBILE_SCROLL_SETTLE_DELAY);
|
|
19550
19594
|
}, [clearScrollSettleTimeout, settleScroll]);
|
|
19551
|
-
const handleScroll =
|
|
19595
|
+
const handleScroll = React77.useCallback(() => {
|
|
19552
19596
|
if (!mobileListRef.current) return;
|
|
19553
19597
|
const nextScrollTop = mobileListRef.current.scrollTop;
|
|
19554
19598
|
clearScrollAnimationFrame();
|
|
@@ -19558,7 +19602,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19558
19602
|
});
|
|
19559
19603
|
scheduleScrollSettle();
|
|
19560
19604
|
}, [clearScrollAnimationFrame, scheduleScrollSettle]);
|
|
19561
|
-
const focusOptionByIndex =
|
|
19605
|
+
const focusOptionByIndex = React77.useCallback(
|
|
19562
19606
|
(index, behavior = "instant", updatePendingImmediately = behavior === "instant") => {
|
|
19563
19607
|
if (!mobileListRef.current || index < 0 || index >= options.length) return;
|
|
19564
19608
|
const option = options[index];
|
|
@@ -19576,7 +19620,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19576
19620
|
},
|
|
19577
19621
|
[options, scheduleScrollSettle]
|
|
19578
19622
|
);
|
|
19579
|
-
const handleOptionClick =
|
|
19623
|
+
const handleOptionClick = React77.useCallback(
|
|
19580
19624
|
(option) => {
|
|
19581
19625
|
if (!mobileListRef.current || disabled || option.isDisabled) return;
|
|
19582
19626
|
const optionIndex = getOptionIndex2(options, option);
|
|
@@ -19585,7 +19629,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19585
19629
|
},
|
|
19586
19630
|
[disabled, focusOptionByIndex, options]
|
|
19587
19631
|
);
|
|
19588
|
-
const moveByStep =
|
|
19632
|
+
const moveByStep = React77.useCallback(
|
|
19589
19633
|
(step) => {
|
|
19590
19634
|
const currentIndex = getOptionIndex2(options, pendingValue);
|
|
19591
19635
|
const fallbackIndex = step === 1 ? getFirstEnabledOptionIndex2(options) : getLastEnabledOptionIndex2(options);
|
|
@@ -19597,7 +19641,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19597
19641
|
},
|
|
19598
19642
|
[focusOptionByIndex, options, pendingValue]
|
|
19599
19643
|
);
|
|
19600
|
-
const moveToBoundary =
|
|
19644
|
+
const moveToBoundary = React77.useCallback(
|
|
19601
19645
|
(boundary) => {
|
|
19602
19646
|
const targetIndex = boundary === "start" ? getFirstEnabledOptionIndex2(options) : getLastEnabledOptionIndex2(options);
|
|
19603
19647
|
if (targetIndex >= 0) {
|
|
@@ -19606,7 +19650,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19606
19650
|
},
|
|
19607
19651
|
[focusOptionByIndex, options]
|
|
19608
19652
|
);
|
|
19609
|
-
const syncPendingValue =
|
|
19653
|
+
const syncPendingValue = React77.useCallback(
|
|
19610
19654
|
(nextValue) => {
|
|
19611
19655
|
const normalizedValue = nextValue ?? null;
|
|
19612
19656
|
const matchedIndex = getOptionIndex2(options, normalizedValue);
|
|
@@ -19634,9 +19678,9 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
19634
19678
|
}
|
|
19635
19679
|
|
|
19636
19680
|
// src/airbnb-fields/select/useSelectIds.ts
|
|
19637
|
-
var
|
|
19681
|
+
var React78 = __toESM(require("react"), 1);
|
|
19638
19682
|
function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
19639
|
-
const reactId =
|
|
19683
|
+
const reactId = React78.useId().replace(/:/g, "");
|
|
19640
19684
|
const baseId = name ? `select-${name}` : `select-${reactId}`;
|
|
19641
19685
|
const triggerId = `${baseId}-trigger`;
|
|
19642
19686
|
const labelId = `${baseId}-label`;
|
|
@@ -19646,7 +19690,7 @@ function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
|
19646
19690
|
const listboxId = `${baseId}-listbox`;
|
|
19647
19691
|
const describedErrorId = error && !hideErrorMessage ? errorId : void 0;
|
|
19648
19692
|
const describedBy = [!hasValue ? helperTextId : null, describedErrorId].filter(Boolean).join(" ") || void 0;
|
|
19649
|
-
const getOptionId2 =
|
|
19693
|
+
const getOptionId2 = React78.useCallback(
|
|
19650
19694
|
(index) => `${baseId}-option-${index}`,
|
|
19651
19695
|
[baseId]
|
|
19652
19696
|
);
|
|
@@ -19664,8 +19708,8 @@ function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
|
19664
19708
|
}
|
|
19665
19709
|
|
|
19666
19710
|
// src/airbnb-fields/select/Select.tsx
|
|
19667
|
-
var
|
|
19668
|
-
var AirbnbSelect =
|
|
19711
|
+
var import_jsx_runtime192 = require("react/jsx-runtime");
|
|
19712
|
+
var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
19669
19713
|
options = [],
|
|
19670
19714
|
value,
|
|
19671
19715
|
onChange,
|
|
@@ -19692,8 +19736,8 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19692
19736
|
filterOption
|
|
19693
19737
|
}, ref) {
|
|
19694
19738
|
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
19695
|
-
const [isOpen, setIsOpen] =
|
|
19696
|
-
const containerRef =
|
|
19739
|
+
const [isOpen, setIsOpen] = React79.useState(false);
|
|
19740
|
+
const containerRef = React79.useRef(null);
|
|
19697
19741
|
const filteredOptions = filterOption ? options.filter(filterOption) : options;
|
|
19698
19742
|
const hasValue = Boolean(value);
|
|
19699
19743
|
const helperText = placeholder ?? label;
|
|
@@ -19755,12 +19799,12 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19755
19799
|
onOutsideClick: () => setIsOpen(false),
|
|
19756
19800
|
isDisabled: !isOpen || isMobile3
|
|
19757
19801
|
});
|
|
19758
|
-
|
|
19802
|
+
React79.useEffect(() => {
|
|
19759
19803
|
if (isBlocked) {
|
|
19760
19804
|
setIsOpen(false);
|
|
19761
19805
|
}
|
|
19762
19806
|
}, [isBlocked]);
|
|
19763
|
-
|
|
19807
|
+
React79.useEffect(
|
|
19764
19808
|
function setCorrectOptionIfThereIsOnlyValue() {
|
|
19765
19809
|
if (value?.value === void 0 || value.value === null || value.label !== "") {
|
|
19766
19810
|
return;
|
|
@@ -19772,7 +19816,7 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19772
19816
|
},
|
|
19773
19817
|
[onChange, filteredOptions, value]
|
|
19774
19818
|
);
|
|
19775
|
-
const handleMobileOpenChange =
|
|
19819
|
+
const handleMobileOpenChange = React79.useCallback(
|
|
19776
19820
|
(nextOpen) => {
|
|
19777
19821
|
if (isBlocked && nextOpen) return;
|
|
19778
19822
|
setIsOpen(nextOpen);
|
|
@@ -19783,7 +19827,7 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19783
19827
|
},
|
|
19784
19828
|
[focusTrigger, isBlocked, syncPendingValue, value]
|
|
19785
19829
|
);
|
|
19786
|
-
const handleMobileDone =
|
|
19830
|
+
const handleMobileDone = React79.useCallback(() => {
|
|
19787
19831
|
if (isBlocked) return;
|
|
19788
19832
|
const finalOption = pendingValue;
|
|
19789
19833
|
if (finalOption && finalOption.value !== value?.value) {
|
|
@@ -19792,7 +19836,7 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19792
19836
|
setIsOpen(false);
|
|
19793
19837
|
focusTrigger();
|
|
19794
19838
|
}, [focusTrigger, isBlocked, onChange, pendingValue, value]);
|
|
19795
|
-
const handleTriggerClick =
|
|
19839
|
+
const handleTriggerClick = React79.useCallback(() => {
|
|
19796
19840
|
if (isBlocked) return;
|
|
19797
19841
|
setIsOpen((prev) => {
|
|
19798
19842
|
const nextOpen = !prev;
|
|
@@ -19845,13 +19889,13 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19845
19889
|
handleMobileOpenChange(false);
|
|
19846
19890
|
}
|
|
19847
19891
|
};
|
|
19848
|
-
return /* @__PURE__ */ (0,
|
|
19892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
|
|
19849
19893
|
"div",
|
|
19850
19894
|
{
|
|
19851
19895
|
ref: containerRef,
|
|
19852
19896
|
className: cn("relative w-full max-w-[var(--max-field-width)]", className),
|
|
19853
19897
|
children: [
|
|
19854
|
-
name && /* @__PURE__ */ (0,
|
|
19898
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
19855
19899
|
renderTrigger ? renderTrigger({
|
|
19856
19900
|
id: triggerId,
|
|
19857
19901
|
open: isOpen,
|
|
@@ -19872,7 +19916,7 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19872
19916
|
onClick: handleTriggerClick,
|
|
19873
19917
|
onKeyDown: handleRootTriggerKeyDown,
|
|
19874
19918
|
onBlur
|
|
19875
|
-
}) : /* @__PURE__ */ (0,
|
|
19919
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
|
|
19876
19920
|
AirbnbSelectTrigger,
|
|
19877
19921
|
{
|
|
19878
19922
|
id: triggerId,
|
|
@@ -19899,7 +19943,7 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19899
19943
|
onBlur
|
|
19900
19944
|
}
|
|
19901
19945
|
),
|
|
19902
|
-
isMobile3 ? /* @__PURE__ */ (0,
|
|
19946
|
+
isMobile3 ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
|
|
19903
19947
|
AirbnbSelectMobileContent,
|
|
19904
19948
|
{
|
|
19905
19949
|
open: isOpen,
|
|
@@ -19924,7 +19968,7 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19924
19968
|
getOptionId: getOptionId2,
|
|
19925
19969
|
noOptionsMessage
|
|
19926
19970
|
}
|
|
19927
|
-
) : /* @__PURE__ */ (0,
|
|
19971
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
|
|
19928
19972
|
AirbnbSelectDesktopContent,
|
|
19929
19973
|
{
|
|
19930
19974
|
isOpen,
|
|
@@ -19958,13 +20002,13 @@ var AirbnbSelect = React78.forwardRef(function AirbnbSelect2({
|
|
|
19958
20002
|
});
|
|
19959
20003
|
|
|
19960
20004
|
// src/airbnb-fields/phone-field/PhoneField.tsx
|
|
19961
|
-
var
|
|
20005
|
+
var import_jsx_runtime193 = require("react/jsx-runtime");
|
|
19962
20006
|
function formatPhoneCodeOptionLabel2(option) {
|
|
19963
20007
|
const label = String(option.label);
|
|
19964
20008
|
const value = String(option.value);
|
|
19965
20009
|
return label.includes(value) ? label : `${label} (${value})`;
|
|
19966
20010
|
}
|
|
19967
|
-
var AirbnbPhoneField =
|
|
20011
|
+
var AirbnbPhoneField = React80.forwardRef(
|
|
19968
20012
|
({
|
|
19969
20013
|
label,
|
|
19970
20014
|
topLabel,
|
|
@@ -19988,9 +20032,9 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
19988
20032
|
codePlaceholder = "+00",
|
|
19989
20033
|
defaultCode
|
|
19990
20034
|
}, ref) => {
|
|
19991
|
-
const inputId =
|
|
20035
|
+
const inputId = React80.useId();
|
|
19992
20036
|
const effectiveCode = value?.code || defaultCode || "";
|
|
19993
|
-
const codeOptions =
|
|
20037
|
+
const codeOptions = React80.useMemo(
|
|
19994
20038
|
() => options.map((option) => ({
|
|
19995
20039
|
value: option.value,
|
|
19996
20040
|
label: formatPhoneCodeOptionLabel2(option),
|
|
@@ -19998,7 +20042,7 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
19998
20042
|
})),
|
|
19999
20043
|
[options]
|
|
20000
20044
|
);
|
|
20001
|
-
const selectedCodeOption =
|
|
20045
|
+
const selectedCodeOption = React80.useMemo(
|
|
20002
20046
|
() => codeOptions.find((option) => option.value === effectiveCode) ?? null,
|
|
20003
20047
|
[codeOptions, effectiveCode]
|
|
20004
20048
|
);
|
|
@@ -20006,9 +20050,9 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
20006
20050
|
const hasInvalidState = Boolean(error) || Boolean(invalid);
|
|
20007
20051
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
20008
20052
|
const isCodeBlocked = isBlocked || Boolean(codeReadOnly);
|
|
20009
|
-
return /* @__PURE__ */ (0,
|
|
20010
|
-
name && /* @__PURE__ */ (0,
|
|
20011
|
-
codeName && /* @__PURE__ */ (0,
|
|
20053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)("div", { className: cn("w-full max-w-[var(--max-field-width)]", className), children: [
|
|
20054
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
20055
|
+
codeName && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
|
|
20012
20056
|
"input",
|
|
20013
20057
|
{
|
|
20014
20058
|
type: "hidden",
|
|
@@ -20017,7 +20061,7 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
20017
20061
|
disabled
|
|
20018
20062
|
}
|
|
20019
20063
|
),
|
|
20020
|
-
numberName && /* @__PURE__ */ (0,
|
|
20064
|
+
numberName && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
|
|
20021
20065
|
"input",
|
|
20022
20066
|
{
|
|
20023
20067
|
type: "hidden",
|
|
@@ -20026,7 +20070,7 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
20026
20070
|
disabled
|
|
20027
20071
|
}
|
|
20028
20072
|
),
|
|
20029
|
-
topLabel && /* @__PURE__ */ (0,
|
|
20073
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
|
|
20030
20074
|
"label",
|
|
20031
20075
|
{
|
|
20032
20076
|
htmlFor: inputId,
|
|
@@ -20034,8 +20078,8 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
20034
20078
|
children: topLabel
|
|
20035
20079
|
}
|
|
20036
20080
|
),
|
|
20037
|
-
/* @__PURE__ */ (0,
|
|
20038
|
-
/* @__PURE__ */ (0,
|
|
20081
|
+
/* @__PURE__ */ (0, import_jsx_runtime193.jsxs)("div", { className: "flex items-stretch", children: [
|
|
20082
|
+
/* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
|
|
20039
20083
|
AirbnbSelect,
|
|
20040
20084
|
{
|
|
20041
20085
|
ref,
|
|
@@ -20064,7 +20108,7 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
20064
20108
|
onClick,
|
|
20065
20109
|
onKeyDown,
|
|
20066
20110
|
valueLabel
|
|
20067
|
-
}) => /* @__PURE__ */ (0,
|
|
20111
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
|
|
20068
20112
|
"button",
|
|
20069
20113
|
{
|
|
20070
20114
|
id,
|
|
@@ -20085,8 +20129,8 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
20085
20129
|
triggerDisabled ? "cursor-not-allowed opacity-50" : triggerLoading ? "cursor-progress" : "cursor-pointer"
|
|
20086
20130
|
),
|
|
20087
20131
|
children: [
|
|
20088
|
-
/* @__PURE__ */ (0,
|
|
20089
|
-
/* @__PURE__ */ (0,
|
|
20132
|
+
/* @__PURE__ */ (0, import_jsx_runtime193.jsx)("span", { children: valueLabel ?? codePlaceholder }),
|
|
20133
|
+
/* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
|
|
20090
20134
|
import_lucide_react57.ChevronDown,
|
|
20091
20135
|
{
|
|
20092
20136
|
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
@@ -20098,7 +20142,7 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
20098
20142
|
)
|
|
20099
20143
|
}
|
|
20100
20144
|
),
|
|
20101
|
-
/* @__PURE__ */ (0,
|
|
20145
|
+
/* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
|
|
20102
20146
|
AirbnbInput,
|
|
20103
20147
|
{
|
|
20104
20148
|
id: inputId,
|
|
@@ -20127,18 +20171,18 @@ var AirbnbPhoneField = React79.forwardRef(
|
|
|
20127
20171
|
}
|
|
20128
20172
|
)
|
|
20129
20173
|
] }),
|
|
20130
|
-
error && /* @__PURE__ */ (0,
|
|
20174
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(FieldErrorMessage, { message: error })
|
|
20131
20175
|
] });
|
|
20132
20176
|
}
|
|
20133
20177
|
);
|
|
20134
20178
|
AirbnbPhoneField.displayName = "AirbnbPhoneField";
|
|
20135
20179
|
|
|
20136
20180
|
// src/airbnb-fields/searchable-select/SearchableSelect.tsx
|
|
20137
|
-
var
|
|
20181
|
+
var React81 = __toESM(require("react"), 1);
|
|
20138
20182
|
var import_lucide_react58 = require("lucide-react");
|
|
20139
20183
|
var import_react_virtual3 = require("@tanstack/react-virtual");
|
|
20140
20184
|
var import_react90 = require("react");
|
|
20141
|
-
var
|
|
20185
|
+
var import_jsx_runtime194 = require("react/jsx-runtime");
|
|
20142
20186
|
var ROW_HEIGHT = 48;
|
|
20143
20187
|
var DESKTOP_LIST_HEIGHT = 280;
|
|
20144
20188
|
var MOBILE_LIST_HEIGHT = 420;
|
|
@@ -20178,13 +20222,13 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20178
20222
|
loadingMessage
|
|
20179
20223
|
}, ref) => {
|
|
20180
20224
|
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
20181
|
-
const reactId =
|
|
20182
|
-
const [open, setOpen] =
|
|
20183
|
-
const [internalSearchValue, setInternalSearchValue] =
|
|
20184
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
20185
|
-
const containerRef =
|
|
20186
|
-
const triggerRef =
|
|
20187
|
-
const inputRef =
|
|
20225
|
+
const reactId = React81.useId();
|
|
20226
|
+
const [open, setOpen] = React81.useState(false);
|
|
20227
|
+
const [internalSearchValue, setInternalSearchValue] = React81.useState("");
|
|
20228
|
+
const [highlightedIndex, setHighlightedIndex] = React81.useState(-1);
|
|
20229
|
+
const containerRef = React81.useRef(null);
|
|
20230
|
+
const triggerRef = React81.useRef(null);
|
|
20231
|
+
const inputRef = React81.useRef(null);
|
|
20188
20232
|
const listboxId = `${reactId}-listbox`;
|
|
20189
20233
|
const labelId = `${reactId}-label`;
|
|
20190
20234
|
const valueId = `${reactId}-value`;
|
|
@@ -20193,13 +20237,13 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20193
20237
|
const searchInputId = `${reactId}-search`;
|
|
20194
20238
|
const effectiveSearchValue = searchValue ?? internalSearchValue;
|
|
20195
20239
|
const shouldFilterLocally = !onSearchChange && filterOption !== null;
|
|
20196
|
-
const visibleOptions =
|
|
20240
|
+
const visibleOptions = React81.useMemo(() => {
|
|
20197
20241
|
if (!shouldFilterLocally || !effectiveSearchValue) {
|
|
20198
20242
|
return options;
|
|
20199
20243
|
}
|
|
20200
20244
|
return options.filter((option) => filterOption(option, effectiveSearchValue));
|
|
20201
20245
|
}, [effectiveSearchValue, filterOption, options, shouldFilterLocally]);
|
|
20202
|
-
const selectedIndex =
|
|
20246
|
+
const selectedIndex = React81.useMemo(
|
|
20203
20247
|
() => visibleOptions.findIndex((option) => option.value === value?.value),
|
|
20204
20248
|
[value?.value, visibleOptions]
|
|
20205
20249
|
);
|
|
@@ -20225,7 +20269,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20225
20269
|
},
|
|
20226
20270
|
[handleOnOpenChange]
|
|
20227
20271
|
);
|
|
20228
|
-
|
|
20272
|
+
React81.useEffect(() => {
|
|
20229
20273
|
if (isBlocked) {
|
|
20230
20274
|
setSelectOpen(false);
|
|
20231
20275
|
return;
|
|
@@ -20238,7 +20282,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20238
20282
|
window.cancelAnimationFrame(frameId);
|
|
20239
20283
|
};
|
|
20240
20284
|
}, [isBlocked, open, setSelectOpen]);
|
|
20241
|
-
|
|
20285
|
+
React81.useEffect(() => {
|
|
20242
20286
|
if (!open) {
|
|
20243
20287
|
setHighlightedIndex(-1);
|
|
20244
20288
|
return;
|
|
@@ -20306,7 +20350,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20306
20350
|
}
|
|
20307
20351
|
}
|
|
20308
20352
|
}
|
|
20309
|
-
const content = /* @__PURE__ */ (0,
|
|
20353
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
|
|
20310
20354
|
AirbnbSearchableSelectContent,
|
|
20311
20355
|
{
|
|
20312
20356
|
inputId: searchInputId,
|
|
@@ -20333,10 +20377,10 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20333
20377
|
onOptionHover: setHighlightedIndex
|
|
20334
20378
|
}
|
|
20335
20379
|
);
|
|
20336
|
-
|
|
20337
|
-
return /* @__PURE__ */ (0,
|
|
20338
|
-
name && /* @__PURE__ */ (0,
|
|
20339
|
-
/* @__PURE__ */ (0,
|
|
20380
|
+
React81.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
20381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
|
|
20382
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
20383
|
+
/* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
|
|
20340
20384
|
AirbnbFieldTrigger,
|
|
20341
20385
|
{
|
|
20342
20386
|
id: `${reactId}-trigger`,
|
|
@@ -20370,7 +20414,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20370
20414
|
},
|
|
20371
20415
|
onKeyDown: handleTriggerKeyDown,
|
|
20372
20416
|
onBlur,
|
|
20373
|
-
trailingAdornment: /* @__PURE__ */ (0,
|
|
20417
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
|
|
20374
20418
|
import_lucide_react58.ChevronDown,
|
|
20375
20419
|
{
|
|
20376
20420
|
className: cn(
|
|
@@ -20381,7 +20425,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20381
20425
|
)
|
|
20382
20426
|
}
|
|
20383
20427
|
),
|
|
20384
|
-
isMobile3 ? /* @__PURE__ */ (0,
|
|
20428
|
+
isMobile3 ? /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
|
|
20385
20429
|
Drawer,
|
|
20386
20430
|
{
|
|
20387
20431
|
open,
|
|
@@ -20393,13 +20437,13 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20393
20437
|
}
|
|
20394
20438
|
closeSelect();
|
|
20395
20439
|
},
|
|
20396
|
-
children: /* @__PURE__ */ (0,
|
|
20397
|
-
/* @__PURE__ */ (0,
|
|
20398
|
-
/* @__PURE__ */ (0,
|
|
20399
|
-
/* @__PURE__ */ (0,
|
|
20440
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)(DrawerContent, { onClose: closeSelect, lockScroll: false, children: [
|
|
20441
|
+
/* @__PURE__ */ (0, import_jsx_runtime194.jsx)(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
20442
|
+
/* @__PURE__ */ (0, import_jsx_runtime194.jsx)(DrawerDescription, { className: "sr-only", children: label }),
|
|
20443
|
+
/* @__PURE__ */ (0, import_jsx_runtime194.jsx)("div", { className: "px-5 pb-5 pt-1", children: content })
|
|
20400
20444
|
] })
|
|
20401
20445
|
}
|
|
20402
|
-
) : open ? /* @__PURE__ */ (0,
|
|
20446
|
+
) : open ? /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
|
|
20403
20447
|
"div",
|
|
20404
20448
|
{
|
|
20405
20449
|
className: cn(
|
|
@@ -20411,7 +20455,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20411
20455
|
) : null
|
|
20412
20456
|
] });
|
|
20413
20457
|
};
|
|
20414
|
-
var AirbnbSearchableSelect =
|
|
20458
|
+
var AirbnbSearchableSelect = React81.forwardRef(
|
|
20415
20459
|
AirbnbSearchableSelectInternal
|
|
20416
20460
|
);
|
|
20417
20461
|
function AirbnbSearchableSelectContent({
|
|
@@ -20438,9 +20482,9 @@ function AirbnbSearchableSelectContent({
|
|
|
20438
20482
|
onOptionClick,
|
|
20439
20483
|
onOptionHover
|
|
20440
20484
|
}) {
|
|
20441
|
-
const listRef =
|
|
20442
|
-
const lastLoadMoreOptionsLengthRef =
|
|
20443
|
-
const previousHighlightedIndexRef =
|
|
20485
|
+
const listRef = React81.useRef(null);
|
|
20486
|
+
const lastLoadMoreOptionsLengthRef = React81.useRef(null);
|
|
20487
|
+
const previousHighlightedIndexRef = React81.useRef(highlightedIndex);
|
|
20444
20488
|
const rowCount = options.length + (loading && options.length > 0 ? 1 : 0);
|
|
20445
20489
|
const virtualizer = (0, import_react_virtual3.useVirtualizer)({
|
|
20446
20490
|
count: rowCount,
|
|
@@ -20451,7 +20495,7 @@ function AirbnbSearchableSelectContent({
|
|
|
20451
20495
|
const virtualItems = virtualizer.getVirtualItems();
|
|
20452
20496
|
const emptyMessage = noOptionsMessage?.() ?? "No matches found";
|
|
20453
20497
|
const loadingText = loadingMessage?.() ?? "Loading...";
|
|
20454
|
-
|
|
20498
|
+
React81.useEffect(() => {
|
|
20455
20499
|
const lastItem = virtualItems[virtualItems.length - 1];
|
|
20456
20500
|
const shouldLoadMore = !!lastItem && hasNextPage && !loading && lastItem.index >= options.length - LOAD_MORE_THRESHOLD;
|
|
20457
20501
|
if (shouldLoadMore && lastLoadMoreOptionsLengthRef.current !== options.length) {
|
|
@@ -20459,23 +20503,23 @@ function AirbnbSearchableSelectContent({
|
|
|
20459
20503
|
onLoadMore?.();
|
|
20460
20504
|
}
|
|
20461
20505
|
}, [hasNextPage, loading, onLoadMore, options.length, virtualItems]);
|
|
20462
|
-
|
|
20506
|
+
React81.useEffect(() => {
|
|
20463
20507
|
const hasHighlightedIndexChanged = previousHighlightedIndexRef.current !== highlightedIndex;
|
|
20464
20508
|
previousHighlightedIndexRef.current = highlightedIndex;
|
|
20465
20509
|
if (highlightedIndex >= 0 && hasHighlightedIndexChanged) {
|
|
20466
20510
|
virtualizer.scrollToIndex(highlightedIndex, { align: "auto" });
|
|
20467
20511
|
}
|
|
20468
20512
|
}, [highlightedIndex, virtualizer]);
|
|
20469
|
-
return /* @__PURE__ */ (0,
|
|
20470
|
-
/* @__PURE__ */ (0,
|
|
20471
|
-
/* @__PURE__ */ (0,
|
|
20513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { className: "p-2", children: [
|
|
20514
|
+
/* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { className: "relative mb-2", children: [
|
|
20515
|
+
/* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
|
|
20472
20516
|
import_lucide_react58.Search,
|
|
20473
20517
|
{
|
|
20474
20518
|
"aria-hidden": "true",
|
|
20475
20519
|
className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 text-[#9696B9]"
|
|
20476
20520
|
}
|
|
20477
20521
|
),
|
|
20478
|
-
/* @__PURE__ */ (0,
|
|
20522
|
+
/* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
|
|
20479
20523
|
"input",
|
|
20480
20524
|
{
|
|
20481
20525
|
id: inputId,
|
|
@@ -20494,7 +20538,7 @@ function AirbnbSearchableSelectContent({
|
|
|
20494
20538
|
}
|
|
20495
20539
|
)
|
|
20496
20540
|
] }),
|
|
20497
|
-
loading && options.length === 0 ? /* @__PURE__ */ (0,
|
|
20541
|
+
loading && options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: loadingText }) : options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
|
|
20498
20542
|
"div",
|
|
20499
20543
|
{
|
|
20500
20544
|
id: listboxId,
|
|
@@ -20503,7 +20547,7 @@ function AirbnbSearchableSelectContent({
|
|
|
20503
20547
|
"aria-labelledby": labelId,
|
|
20504
20548
|
className: cn("overflow-y-auto outline-none", menuClassName),
|
|
20505
20549
|
style: { height: Math.min(height, rowCount * ROW_HEIGHT) },
|
|
20506
|
-
children: /* @__PURE__ */ (0,
|
|
20550
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
|
|
20507
20551
|
"div",
|
|
20508
20552
|
{
|
|
20509
20553
|
className: "relative w-full",
|
|
@@ -20511,7 +20555,7 @@ function AirbnbSearchableSelectContent({
|
|
|
20511
20555
|
children: virtualItems.map((virtualItem) => {
|
|
20512
20556
|
const option = options[virtualItem.index];
|
|
20513
20557
|
if (!option) {
|
|
20514
|
-
return /* @__PURE__ */ (0,
|
|
20558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
|
|
20515
20559
|
"div",
|
|
20516
20560
|
{
|
|
20517
20561
|
className: "absolute left-0 top-0 flex w-full items-center px-4 text-base leading-6 text-[#6C6C6C]",
|
|
@@ -20526,7 +20570,7 @@ function AirbnbSearchableSelectContent({
|
|
|
20526
20570
|
}
|
|
20527
20571
|
const isSelected = value?.value === option.value;
|
|
20528
20572
|
const isHighlighted = virtualItem.index === highlightedIndex;
|
|
20529
|
-
return /* @__PURE__ */ (0,
|
|
20573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
|
|
20530
20574
|
"button",
|
|
20531
20575
|
{
|
|
20532
20576
|
id: getOptionId(idPrefix, virtualItem.index),
|
|
@@ -20548,7 +20592,7 @@ function AirbnbSearchableSelectContent({
|
|
|
20548
20592
|
height: `${virtualItem.size}px`,
|
|
20549
20593
|
transform: `translateY(${virtualItem.start}px)`
|
|
20550
20594
|
},
|
|
20551
|
-
children: /* @__PURE__ */ (0,
|
|
20595
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("span", { className: "truncate text-center", children: String(option.label) })
|
|
20552
20596
|
},
|
|
20553
20597
|
`${String(option.value)}-${virtualItem.index}`
|
|
20554
20598
|
);
|
|
@@ -20577,16 +20621,16 @@ function getNextEnabledIndex(options, startIndex, step) {
|
|
|
20577
20621
|
}
|
|
20578
20622
|
|
|
20579
20623
|
// src/airbnb-fields/search-input/SearchInput.tsx
|
|
20580
|
-
var
|
|
20624
|
+
var React82 = __toESM(require("react"), 1);
|
|
20581
20625
|
var import_react_i18next44 = require("react-i18next");
|
|
20582
20626
|
var import_lucide_react59 = require("lucide-react");
|
|
20583
|
-
var
|
|
20584
|
-
var AirbnbSearchInput =
|
|
20627
|
+
var import_jsx_runtime195 = require("react/jsx-runtime");
|
|
20628
|
+
var AirbnbSearchInput = React82.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
|
|
20585
20629
|
const { t } = (0, import_react_i18next44.useTranslation)();
|
|
20586
20630
|
const placeholderText = placeholder || t("search_property") + "...";
|
|
20587
|
-
return /* @__PURE__ */ (0,
|
|
20588
|
-
/* @__PURE__ */ (0,
|
|
20589
|
-
/* @__PURE__ */ (0,
|
|
20631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
|
|
20632
|
+
/* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_lucide_react59.Search, { className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]" }),
|
|
20633
|
+
/* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
|
|
20590
20634
|
"input",
|
|
20591
20635
|
{
|
|
20592
20636
|
...props,
|
|
@@ -20605,13 +20649,13 @@ var AirbnbSearchInput = React81.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
20605
20649
|
)
|
|
20606
20650
|
}
|
|
20607
20651
|
),
|
|
20608
|
-
onReset && /* @__PURE__ */ (0,
|
|
20652
|
+
onReset && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
|
|
20609
20653
|
Button,
|
|
20610
20654
|
{
|
|
20611
20655
|
variant: "ghost",
|
|
20612
20656
|
onClick: onReset,
|
|
20613
20657
|
className: "absolute right-0 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]",
|
|
20614
|
-
children: /* @__PURE__ */ (0,
|
|
20658
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_lucide_react59.X, { className: "h-5 w-5" })
|
|
20615
20659
|
}
|
|
20616
20660
|
)
|
|
20617
20661
|
] });
|
|
@@ -20619,11 +20663,11 @@ var AirbnbSearchInput = React81.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
20619
20663
|
AirbnbSearchInput.displayName = "AirbnbSearchInput";
|
|
20620
20664
|
|
|
20621
20665
|
// src/airbnb-fields/switch/Switch.tsx
|
|
20622
|
-
var
|
|
20666
|
+
var React83 = __toESM(require("react"), 1);
|
|
20623
20667
|
var SwitchPrimitives2 = __toESM(require("@radix-ui/react-switch"), 1);
|
|
20624
20668
|
var import_lucide_react60 = require("lucide-react");
|
|
20625
|
-
var
|
|
20626
|
-
var AirbnbSwitch =
|
|
20669
|
+
var import_jsx_runtime196 = require("react/jsx-runtime");
|
|
20670
|
+
var AirbnbSwitch = React83.forwardRef(
|
|
20627
20671
|
({
|
|
20628
20672
|
className,
|
|
20629
20673
|
value,
|
|
@@ -20637,9 +20681,9 @@ var AirbnbSwitch = React82.forwardRef(
|
|
|
20637
20681
|
wrapperClassName,
|
|
20638
20682
|
...props
|
|
20639
20683
|
}, ref) => {
|
|
20640
|
-
const generatedId =
|
|
20684
|
+
const generatedId = React83.useId();
|
|
20641
20685
|
const fieldId = id || generatedId;
|
|
20642
|
-
const switchElement = /* @__PURE__ */ (0,
|
|
20686
|
+
const switchElement = /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20643
20687
|
SwitchPrimitives2.Root,
|
|
20644
20688
|
{
|
|
20645
20689
|
ref,
|
|
@@ -20659,14 +20703,14 @@ var AirbnbSwitch = React82.forwardRef(
|
|
|
20659
20703
|
"aria-busy": loading,
|
|
20660
20704
|
"aria-readonly": readOnly,
|
|
20661
20705
|
...props,
|
|
20662
|
-
children: /* @__PURE__ */ (0,
|
|
20706
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20663
20707
|
SwitchPrimitives2.Thumb,
|
|
20664
20708
|
{
|
|
20665
20709
|
className: cn(
|
|
20666
20710
|
"flex h-[20px] w-[20px] items-center justify-center rounded-full bg-white shadow-[0_1px_3px_rgba(0,0,0,0.22)] transition-transform duration-200",
|
|
20667
20711
|
"data-[state=checked]:translate-x-[12px] data-[state=unchecked]:translate-x-0"
|
|
20668
20712
|
),
|
|
20669
|
-
children: /* @__PURE__ */ (0,
|
|
20713
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20670
20714
|
import_lucide_react60.Check,
|
|
20671
20715
|
{
|
|
20672
20716
|
"aria-hidden": "true",
|
|
@@ -20681,10 +20725,10 @@ var AirbnbSwitch = React82.forwardRef(
|
|
|
20681
20725
|
if (!label && !error) {
|
|
20682
20726
|
return switchElement;
|
|
20683
20727
|
}
|
|
20684
|
-
return /* @__PURE__ */ (0,
|
|
20685
|
-
/* @__PURE__ */ (0,
|
|
20728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)(import_jsx_runtime196.Fragment, { children: [
|
|
20729
|
+
/* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: cn("flex items-center gap-x-3 gap-y-1.5", wrapperClassName), children: [
|
|
20686
20730
|
switchElement,
|
|
20687
|
-
label && /* @__PURE__ */ (0,
|
|
20731
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20688
20732
|
Label,
|
|
20689
20733
|
{
|
|
20690
20734
|
htmlFor: fieldId,
|
|
@@ -20696,7 +20740,7 @@ var AirbnbSwitch = React82.forwardRef(
|
|
|
20696
20740
|
}
|
|
20697
20741
|
)
|
|
20698
20742
|
] }),
|
|
20699
|
-
error && /* @__PURE__ */ (0,
|
|
20743
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(ErrorMessage, { disabled, children: error })
|
|
20700
20744
|
] });
|
|
20701
20745
|
}
|
|
20702
20746
|
);
|
|
@@ -20764,6 +20808,7 @@ AirbnbSwitch.displayName = "AirbnbSwitch";
|
|
|
20764
20808
|
CommingSoonBadge,
|
|
20765
20809
|
ConfirmationDialog,
|
|
20766
20810
|
CopyIcon,
|
|
20811
|
+
CopyInput,
|
|
20767
20812
|
CopyLinkButton,
|
|
20768
20813
|
CopyString,
|
|
20769
20814
|
Counter,
|