@chekinapp/ui 0.0.86 → 0.0.87
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 +622 -520
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -2
- package/dist/index.d.ts +26 -2
- package/dist/index.js +622 -521
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3400,7 +3400,7 @@ var DialogContent = React15.forwardRef(
|
|
|
3400
3400
|
]
|
|
3401
3401
|
}
|
|
3402
3402
|
);
|
|
3403
|
-
const portalContainer = container || (
|
|
3403
|
+
const portalContainer = container || getCustomContainer();
|
|
3404
3404
|
return /* @__PURE__ */ jsx34(DialogPortal, { "data-slot": "dialog-portal", container: portalContainer, children: lockScroll ? /* @__PURE__ */ jsx34(
|
|
3405
3405
|
DialogOverlay,
|
|
3406
3406
|
{
|
|
@@ -5732,8 +5732,8 @@ function Modal({
|
|
|
5732
5732
|
onClose,
|
|
5733
5733
|
children,
|
|
5734
5734
|
withCloseButton = true,
|
|
5735
|
-
closeOnDocumentClick =
|
|
5736
|
-
closeOnEscape =
|
|
5735
|
+
closeOnDocumentClick = false,
|
|
5736
|
+
closeOnEscape = false,
|
|
5737
5737
|
scrollableOverlay,
|
|
5738
5738
|
className,
|
|
5739
5739
|
title,
|
|
@@ -5742,6 +5742,7 @@ function Modal({
|
|
|
5742
5742
|
iconSrc,
|
|
5743
5743
|
iconAlt,
|
|
5744
5744
|
iconProps = { width: 84 },
|
|
5745
|
+
iconClassName,
|
|
5745
5746
|
buttons,
|
|
5746
5747
|
lockScroll = true,
|
|
5747
5748
|
container,
|
|
@@ -5787,7 +5788,7 @@ function Modal({
|
|
|
5787
5788
|
children: /* @__PURE__ */ jsx70(X4, { className: "h-5 w-5" })
|
|
5788
5789
|
}
|
|
5789
5790
|
),
|
|
5790
|
-
(icon || iconSrc || iconProps?.src) && /* @__PURE__ */ jsx70("div", { className: "modal__icon mx-auto mt-4 select-none", children: icon ?? /* @__PURE__ */ jsx70("img", { src: iconSrc, alt: iconAlt ?? "", ...iconProps }) }),
|
|
5791
|
+
(icon || iconSrc || iconProps?.src) && /* @__PURE__ */ jsx70("div", { className: cn("modal__icon mx-auto mt-4 select-none", iconClassName), children: icon ?? /* @__PURE__ */ jsx70("img", { src: iconSrc, alt: iconAlt ?? "", ...iconProps }) }),
|
|
5791
5792
|
title ? /* @__PURE__ */ jsx70(DialogTitle, { className: cn("modal__title", "px-6 text-lg font-bold"), children: title }) : /* @__PURE__ */ jsx70(DialogVisuallyHidden, { children: /* @__PURE__ */ jsx70(DialogTitle, { children: "Dialog" }) }),
|
|
5792
5793
|
text && /* @__PURE__ */ jsx70(DialogDescription, { className: cn("modal__text", "text-base"), children: text }),
|
|
5793
5794
|
children,
|
|
@@ -11949,11 +11950,110 @@ function ResponsiveSheet({
|
|
|
11949
11950
|
) });
|
|
11950
11951
|
}
|
|
11951
11952
|
|
|
11952
|
-
// src/
|
|
11953
|
+
// src/responsive-dropdown/ResponsiveDropdown.tsx
|
|
11953
11954
|
import * as React46 from "react";
|
|
11954
|
-
import { jsx as jsx143 } from "react/jsx-runtime";
|
|
11955
|
+
import { Fragment as Fragment15, jsx as jsx143, jsxs as jsxs90 } from "react/jsx-runtime";
|
|
11956
|
+
function ResponsiveDropdown({
|
|
11957
|
+
trigger,
|
|
11958
|
+
options,
|
|
11959
|
+
children,
|
|
11960
|
+
side,
|
|
11961
|
+
align,
|
|
11962
|
+
disabled,
|
|
11963
|
+
title,
|
|
11964
|
+
className,
|
|
11965
|
+
dropdownClassName,
|
|
11966
|
+
drawerClassName
|
|
11967
|
+
}) {
|
|
11968
|
+
const { isMatch: isMobile2 } = useScreenResize(DEVICE.mobileXL);
|
|
11969
|
+
const isMobileMode = isMobile2 && isMobileModalModeAvailable();
|
|
11970
|
+
const [open, setOpen] = React46.useState(false);
|
|
11971
|
+
const visibleOptions = options?.filter((option) => !option.hidden) ?? [];
|
|
11972
|
+
const renderTrigger = (isOpen) => typeof trigger === "function" ? trigger(isOpen) : trigger;
|
|
11973
|
+
const handleOpenChange = (nextOpen) => {
|
|
11974
|
+
if (disabled) {
|
|
11975
|
+
return;
|
|
11976
|
+
}
|
|
11977
|
+
setOpen(nextOpen);
|
|
11978
|
+
};
|
|
11979
|
+
const handleOptionClick = (option) => (event) => {
|
|
11980
|
+
if (disabled || option.disabled) {
|
|
11981
|
+
return;
|
|
11982
|
+
}
|
|
11983
|
+
option.onClick?.(event);
|
|
11984
|
+
setOpen(false);
|
|
11985
|
+
};
|
|
11986
|
+
if (isMobileMode) {
|
|
11987
|
+
return /* @__PURE__ */ jsxs90(Fragment15, { children: [
|
|
11988
|
+
/* @__PURE__ */ jsx143(
|
|
11989
|
+
"div",
|
|
11990
|
+
{
|
|
11991
|
+
className: "responsive-dropdown__mobile-trigger",
|
|
11992
|
+
onClick: () => handleOpenChange(true),
|
|
11993
|
+
children: renderTrigger(open)
|
|
11994
|
+
}
|
|
11995
|
+
),
|
|
11996
|
+
/* @__PURE__ */ jsx143(Drawer, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs90(
|
|
11997
|
+
DrawerContent,
|
|
11998
|
+
{
|
|
11999
|
+
onClose: () => setOpen(false),
|
|
12000
|
+
lockScroll: false,
|
|
12001
|
+
className: cn("px-0 pb-2", className, drawerClassName),
|
|
12002
|
+
children: [
|
|
12003
|
+
title ? /* @__PURE__ */ jsx143(DrawerTitle, { className: "sr-only", children: title }) : null,
|
|
12004
|
+
/* @__PURE__ */ jsxs90("div", { className: "flex flex-col", children: [
|
|
12005
|
+
visibleOptions.map((option) => /* @__PURE__ */ jsx143(
|
|
12006
|
+
"div",
|
|
12007
|
+
{
|
|
12008
|
+
role: "button",
|
|
12009
|
+
tabIndex: 0,
|
|
12010
|
+
"aria-disabled": option.disabled,
|
|
12011
|
+
onClick: handleOptionClick(option),
|
|
12012
|
+
className: cn(
|
|
12013
|
+
"cursor-pointer px-5 py-3 text-base font-medium text-[var(--chekin-color-brand-navy)] outline-none hover:bg-gray-50",
|
|
12014
|
+
option.disabled && "pointer-events-none opacity-50"
|
|
12015
|
+
),
|
|
12016
|
+
children: option.label
|
|
12017
|
+
},
|
|
12018
|
+
option.id
|
|
12019
|
+
)),
|
|
12020
|
+
children
|
|
12021
|
+
] })
|
|
12022
|
+
]
|
|
12023
|
+
}
|
|
12024
|
+
) })
|
|
12025
|
+
] });
|
|
12026
|
+
}
|
|
12027
|
+
return /* @__PURE__ */ jsxs90(DropdownMenu, { open, onOpenChange: handleOpenChange, children: [
|
|
12028
|
+
/* @__PURE__ */ jsx143(DropdownMenuTrigger, { asChild: true, disabled, children: renderTrigger(open) }),
|
|
12029
|
+
/* @__PURE__ */ jsxs90(
|
|
12030
|
+
DropdownMenuContent,
|
|
12031
|
+
{
|
|
12032
|
+
side,
|
|
12033
|
+
align,
|
|
12034
|
+
className: cn("min-w-[295px]", className, dropdownClassName),
|
|
12035
|
+
children: [
|
|
12036
|
+
visibleOptions.map((option) => /* @__PURE__ */ jsx143(
|
|
12037
|
+
DropdownMenuItem,
|
|
12038
|
+
{
|
|
12039
|
+
disabled: option.disabled,
|
|
12040
|
+
onClick: handleOptionClick(option),
|
|
12041
|
+
children: option.label
|
|
12042
|
+
},
|
|
12043
|
+
option.id
|
|
12044
|
+
)),
|
|
12045
|
+
children
|
|
12046
|
+
]
|
|
12047
|
+
}
|
|
12048
|
+
)
|
|
12049
|
+
] });
|
|
12050
|
+
}
|
|
12051
|
+
|
|
12052
|
+
// src/airbnb/input/Input.tsx
|
|
12053
|
+
import * as React47 from "react";
|
|
12054
|
+
import { jsx as jsx144 } from "react/jsx-runtime";
|
|
11955
12055
|
var getInputValue = (value) => value != null ? String(value) : "";
|
|
11956
|
-
var AirbnbInput =
|
|
12056
|
+
var AirbnbInput = React47.forwardRef(
|
|
11957
12057
|
({
|
|
11958
12058
|
variant = "default",
|
|
11959
12059
|
label,
|
|
@@ -11982,15 +12082,15 @@ var AirbnbInput = React46.forwardRef(
|
|
|
11982
12082
|
placeholder,
|
|
11983
12083
|
...props
|
|
11984
12084
|
}, ref) => {
|
|
11985
|
-
const generatedId =
|
|
11986
|
-
const inputRef =
|
|
12085
|
+
const generatedId = React47.useId();
|
|
12086
|
+
const inputRef = React47.useRef(null);
|
|
11987
12087
|
const inputId = id ?? generatedId;
|
|
11988
12088
|
const fieldId = `${inputId}-field`;
|
|
11989
12089
|
const labelId = `${inputId}-label`;
|
|
11990
12090
|
const errorId = `${inputId}-error`;
|
|
11991
12091
|
const accessibleLabel = placeholder ?? label;
|
|
11992
|
-
const [isFocused, setIsFocused] =
|
|
11993
|
-
const [currentValue, setCurrentValue] =
|
|
12092
|
+
const [isFocused, setIsFocused] = React47.useState(false);
|
|
12093
|
+
const [currentValue, setCurrentValue] = React47.useState(
|
|
11994
12094
|
() => value != null ? getInputValue(value) : getInputValue(defaultValue)
|
|
11995
12095
|
);
|
|
11996
12096
|
const resolvedValue = value != null ? getInputValue(value) : currentValue;
|
|
@@ -12000,11 +12100,11 @@ var AirbnbInput = React46.forwardRef(
|
|
|
12000
12100
|
const triggerError = error ?? invalid;
|
|
12001
12101
|
const hasLabelMeta = Boolean(optional) || Boolean(tooltip);
|
|
12002
12102
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
12003
|
-
|
|
12103
|
+
React47.useLayoutEffect(() => {
|
|
12004
12104
|
const nextValue = value != null ? getInputValue(value) : getInputValue(inputRef.current?.value);
|
|
12005
12105
|
setCurrentValue((prevValue) => prevValue === nextValue ? prevValue : nextValue);
|
|
12006
12106
|
}, [value]);
|
|
12007
|
-
const setRefs =
|
|
12107
|
+
const setRefs = React47.useCallback(
|
|
12008
12108
|
(node) => {
|
|
12009
12109
|
inputRef.current = node;
|
|
12010
12110
|
if (node && value == null) {
|
|
@@ -12034,7 +12134,7 @@ var AirbnbInput = React46.forwardRef(
|
|
|
12034
12134
|
setIsFocused(false);
|
|
12035
12135
|
onBlur?.(event);
|
|
12036
12136
|
};
|
|
12037
|
-
return /* @__PURE__ */
|
|
12137
|
+
return /* @__PURE__ */ jsx144("div", { className: cn("w-full max-w-[var(--max-field-width)]", wrapperClassName), children: /* @__PURE__ */ jsx144(
|
|
12038
12138
|
FieldTrigger,
|
|
12039
12139
|
{
|
|
12040
12140
|
as: "div",
|
|
@@ -12066,7 +12166,7 @@ var AirbnbInput = React46.forwardRef(
|
|
|
12066
12166
|
forceFloatingLabel: shouldShowLabel,
|
|
12067
12167
|
forceLabelText: hasLabelMeta,
|
|
12068
12168
|
hideErrorMessage: !renderErrorMessage,
|
|
12069
|
-
children: /* @__PURE__ */
|
|
12169
|
+
children: /* @__PURE__ */ jsx144(
|
|
12070
12170
|
"input",
|
|
12071
12171
|
{
|
|
12072
12172
|
...props,
|
|
@@ -12102,14 +12202,14 @@ var AirbnbInput = React46.forwardRef(
|
|
|
12102
12202
|
AirbnbInput.displayName = "Input";
|
|
12103
12203
|
|
|
12104
12204
|
// src/airbnb/phone-field/PhoneField.tsx
|
|
12105
|
-
import * as
|
|
12205
|
+
import * as React53 from "react";
|
|
12106
12206
|
import { ChevronDown as ChevronDown3 } from "lucide-react";
|
|
12107
12207
|
|
|
12108
12208
|
// src/airbnb/select/Select.tsx
|
|
12109
|
-
import * as
|
|
12209
|
+
import * as React52 from "react";
|
|
12110
12210
|
|
|
12111
12211
|
// src/airbnb/select/SelectDesktopMenu.tsx
|
|
12112
|
-
import { jsx as
|
|
12212
|
+
import { jsx as jsx145, jsxs as jsxs91 } from "react/jsx-runtime";
|
|
12113
12213
|
function SelectDesktopMenu({
|
|
12114
12214
|
id,
|
|
12115
12215
|
options,
|
|
@@ -12128,7 +12228,7 @@ function SelectDesktopMenu({
|
|
|
12128
12228
|
noOptionsMessage
|
|
12129
12229
|
}) {
|
|
12130
12230
|
const emptyMessage = noOptionsMessage?.();
|
|
12131
|
-
return /* @__PURE__ */
|
|
12231
|
+
return /* @__PURE__ */ jsxs91(
|
|
12132
12232
|
"div",
|
|
12133
12233
|
{
|
|
12134
12234
|
id,
|
|
@@ -12141,12 +12241,12 @@ function SelectDesktopMenu({
|
|
|
12141
12241
|
onKeyDown,
|
|
12142
12242
|
className: cn("max-h-[280px] overflow-y-auto p-2 outline-none", menuClassName),
|
|
12143
12243
|
children: [
|
|
12144
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */
|
|
12244
|
+
options.length === 0 && emptyMessage ? /* @__PURE__ */ jsx145("div", { className: "px-4 py-3 text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : null,
|
|
12145
12245
|
options.map((option, index) => {
|
|
12146
12246
|
const isSelected = selectedValue?.value === option.value;
|
|
12147
12247
|
const isHighlighted = index === highlightedIndex;
|
|
12148
12248
|
const optionKey = `${String(option.value)}-${index}`;
|
|
12149
|
-
return /* @__PURE__ */
|
|
12249
|
+
return /* @__PURE__ */ jsx145(
|
|
12150
12250
|
"button",
|
|
12151
12251
|
{
|
|
12152
12252
|
id: getOptionId2(index),
|
|
@@ -12178,7 +12278,7 @@ function SelectDesktopMenu({
|
|
|
12178
12278
|
}
|
|
12179
12279
|
|
|
12180
12280
|
// src/airbnb/select/SelectDesktopContent.tsx
|
|
12181
|
-
import { jsx as
|
|
12281
|
+
import { jsx as jsx146 } from "react/jsx-runtime";
|
|
12182
12282
|
function SelectDesktopContent({
|
|
12183
12283
|
isOpen,
|
|
12184
12284
|
listboxId,
|
|
@@ -12199,14 +12299,14 @@ function SelectDesktopContent({
|
|
|
12199
12299
|
noOptionsMessage
|
|
12200
12300
|
}) {
|
|
12201
12301
|
if (!isOpen) return null;
|
|
12202
|
-
return /* @__PURE__ */
|
|
12302
|
+
return /* @__PURE__ */ jsx146(
|
|
12203
12303
|
"div",
|
|
12204
12304
|
{
|
|
12205
12305
|
className: cn(
|
|
12206
12306
|
"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)]",
|
|
12207
12307
|
dropdownClassName
|
|
12208
12308
|
),
|
|
12209
|
-
children: /* @__PURE__ */
|
|
12309
|
+
children: /* @__PURE__ */ jsx146(
|
|
12210
12310
|
SelectDesktopMenu,
|
|
12211
12311
|
{
|
|
12212
12312
|
id: listboxId,
|
|
@@ -12304,7 +12404,7 @@ function getMobileOptionStyles(index, scrollTop) {
|
|
|
12304
12404
|
}
|
|
12305
12405
|
|
|
12306
12406
|
// src/airbnb/select/SelectMobileWheel.tsx
|
|
12307
|
-
import { jsx as
|
|
12407
|
+
import { jsx as jsx147, jsxs as jsxs92 } from "react/jsx-runtime";
|
|
12308
12408
|
function SelectMobileWheel({
|
|
12309
12409
|
id,
|
|
12310
12410
|
options,
|
|
@@ -12323,7 +12423,7 @@ function SelectMobileWheel({
|
|
|
12323
12423
|
}) {
|
|
12324
12424
|
const spacerHeight2 = getWheelSpacerHeight();
|
|
12325
12425
|
const emptyMessage = noOptionsMessage?.();
|
|
12326
|
-
return /* @__PURE__ */
|
|
12426
|
+
return /* @__PURE__ */ jsxs92(
|
|
12327
12427
|
"div",
|
|
12328
12428
|
{
|
|
12329
12429
|
id,
|
|
@@ -12335,10 +12435,10 @@ function SelectMobileWheel({
|
|
|
12335
12435
|
onKeyDown,
|
|
12336
12436
|
className: cn("relative overflow-hidden outline-none", menuClassName),
|
|
12337
12437
|
children: [
|
|
12338
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */
|
|
12339
|
-
/* @__PURE__ */
|
|
12340
|
-
/* @__PURE__ */
|
|
12341
|
-
/* @__PURE__ */
|
|
12438
|
+
options.length === 0 && emptyMessage ? /* @__PURE__ */ jsx147("div", { className: "flex min-h-[160px] items-center justify-center px-4 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : null,
|
|
12439
|
+
/* @__PURE__ */ jsx147("div", { className: "pointer-events-none absolute inset-x-0 top-0 h-16 bg-gradient-to-b from-white via-white/80 to-transparent" }),
|
|
12440
|
+
/* @__PURE__ */ jsx147("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-white via-white/80 to-transparent" }),
|
|
12441
|
+
/* @__PURE__ */ jsx147(
|
|
12342
12442
|
"div",
|
|
12343
12443
|
{
|
|
12344
12444
|
"aria-hidden": true,
|
|
@@ -12348,7 +12448,7 @@ function SelectMobileWheel({
|
|
|
12348
12448
|
)
|
|
12349
12449
|
}
|
|
12350
12450
|
),
|
|
12351
|
-
/* @__PURE__ */
|
|
12451
|
+
/* @__PURE__ */ jsxs92(
|
|
12352
12452
|
"div",
|
|
12353
12453
|
{
|
|
12354
12454
|
ref: listRef,
|
|
@@ -12363,11 +12463,11 @@ function SelectMobileWheel({
|
|
|
12363
12463
|
WebkitOverflowScrolling: "touch"
|
|
12364
12464
|
},
|
|
12365
12465
|
children: [
|
|
12366
|
-
/* @__PURE__ */
|
|
12466
|
+
/* @__PURE__ */ jsx147("div", { style: { height: `${spacerHeight2}px` } }),
|
|
12367
12467
|
options.map((option, index) => {
|
|
12368
12468
|
const { distance, style } = getMobileOptionStyles(index, scrollTop);
|
|
12369
12469
|
const optionKey = `${String(option.value)}-${index}`;
|
|
12370
|
-
return /* @__PURE__ */
|
|
12470
|
+
return /* @__PURE__ */ jsx147(
|
|
12371
12471
|
"button",
|
|
12372
12472
|
{
|
|
12373
12473
|
id: getOptionId2(index),
|
|
@@ -12388,7 +12488,7 @@ function SelectMobileWheel({
|
|
|
12388
12488
|
optionKey
|
|
12389
12489
|
);
|
|
12390
12490
|
}),
|
|
12391
|
-
/* @__PURE__ */
|
|
12491
|
+
/* @__PURE__ */ jsx147("div", { style: { height: `${spacerHeight2}px` } })
|
|
12392
12492
|
]
|
|
12393
12493
|
}
|
|
12394
12494
|
)
|
|
@@ -12398,7 +12498,7 @@ function SelectMobileWheel({
|
|
|
12398
12498
|
}
|
|
12399
12499
|
|
|
12400
12500
|
// src/airbnb/select/SelectMobileContent.tsx
|
|
12401
|
-
import { jsx as
|
|
12501
|
+
import { jsx as jsx148, jsxs as jsxs93 } from "react/jsx-runtime";
|
|
12402
12502
|
function SelectMobileContent({
|
|
12403
12503
|
open,
|
|
12404
12504
|
onOpenChange,
|
|
@@ -12422,11 +12522,11 @@ function SelectMobileContent({
|
|
|
12422
12522
|
getOptionId: getOptionId2,
|
|
12423
12523
|
noOptionsMessage
|
|
12424
12524
|
}) {
|
|
12425
|
-
return /* @__PURE__ */
|
|
12426
|
-
/* @__PURE__ */
|
|
12427
|
-
/* @__PURE__ */
|
|
12428
|
-
/* @__PURE__ */
|
|
12429
|
-
/* @__PURE__ */
|
|
12525
|
+
return /* @__PURE__ */ jsx148(Drawer, { open, onOpenChange, children: /* @__PURE__ */ jsxs93(DrawerContent, { onClose, lockScroll: false, children: [
|
|
12526
|
+
/* @__PURE__ */ jsx148(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
12527
|
+
/* @__PURE__ */ jsx148(DrawerDescription, { className: "sr-only", children: label }),
|
|
12528
|
+
/* @__PURE__ */ jsxs93("div", { className: "px-6 pb-4 pt-1", children: [
|
|
12529
|
+
/* @__PURE__ */ jsx148(
|
|
12430
12530
|
SelectMobileWheel,
|
|
12431
12531
|
{
|
|
12432
12532
|
id: listboxId,
|
|
@@ -12445,16 +12545,16 @@ function SelectMobileContent({
|
|
|
12445
12545
|
noOptionsMessage
|
|
12446
12546
|
}
|
|
12447
12547
|
),
|
|
12448
|
-
/* @__PURE__ */
|
|
12548
|
+
/* @__PURE__ */ jsx148(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
12449
12549
|
] })
|
|
12450
12550
|
] }) });
|
|
12451
12551
|
}
|
|
12452
12552
|
|
|
12453
12553
|
// src/airbnb/select/SelectTrigger.tsx
|
|
12454
|
-
import * as
|
|
12554
|
+
import * as React48 from "react";
|
|
12455
12555
|
import { ChevronDown as ChevronDown2 } from "lucide-react";
|
|
12456
|
-
import { jsx as
|
|
12457
|
-
var SelectTrigger2 =
|
|
12556
|
+
import { jsx as jsx149 } from "react/jsx-runtime";
|
|
12557
|
+
var SelectTrigger2 = React48.forwardRef(
|
|
12458
12558
|
({
|
|
12459
12559
|
id,
|
|
12460
12560
|
open,
|
|
@@ -12479,7 +12579,7 @@ var SelectTrigger2 = React47.forwardRef(
|
|
|
12479
12579
|
onKeyDown,
|
|
12480
12580
|
onBlur
|
|
12481
12581
|
}, ref) => {
|
|
12482
|
-
return /* @__PURE__ */
|
|
12582
|
+
return /* @__PURE__ */ jsx149(
|
|
12483
12583
|
FieldTrigger,
|
|
12484
12584
|
{
|
|
12485
12585
|
id,
|
|
@@ -12508,7 +12608,7 @@ var SelectTrigger2 = React47.forwardRef(
|
|
|
12508
12608
|
onClick,
|
|
12509
12609
|
onKeyDown,
|
|
12510
12610
|
onBlur,
|
|
12511
|
-
trailingAdornment: /* @__PURE__ */
|
|
12611
|
+
trailingAdornment: /* @__PURE__ */ jsx149(
|
|
12512
12612
|
ChevronDown2,
|
|
12513
12613
|
{
|
|
12514
12614
|
className: open ? "h-6 w-6 rotate-180 text-[#1F1F1B] transition-transform" : "h-6 w-6 text-[#1F1F1B] transition-transform"
|
|
@@ -12521,7 +12621,7 @@ var SelectTrigger2 = React47.forwardRef(
|
|
|
12521
12621
|
SelectTrigger2.displayName = "SelectTrigger";
|
|
12522
12622
|
|
|
12523
12623
|
// src/airbnb/select/useDesktopSelect.ts
|
|
12524
|
-
import * as
|
|
12624
|
+
import * as React49 from "react";
|
|
12525
12625
|
function useDesktopSelect({
|
|
12526
12626
|
isMobile: isMobile2,
|
|
12527
12627
|
isOpen,
|
|
@@ -12530,12 +12630,12 @@ function useDesktopSelect({
|
|
|
12530
12630
|
disabled,
|
|
12531
12631
|
onChange
|
|
12532
12632
|
}) {
|
|
12533
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
12534
|
-
const triggerRef =
|
|
12535
|
-
const listRef =
|
|
12536
|
-
const optionRefs =
|
|
12633
|
+
const [highlightedIndex, setHighlightedIndex] = React49.useState(-1);
|
|
12634
|
+
const triggerRef = React49.useRef(null);
|
|
12635
|
+
const listRef = React49.useRef(null);
|
|
12636
|
+
const optionRefs = React49.useRef([]);
|
|
12537
12637
|
const selectedIndex = getOptionIndex(options, value);
|
|
12538
|
-
|
|
12638
|
+
React49.useEffect(() => {
|
|
12539
12639
|
if (!isOpen || isMobile2) return;
|
|
12540
12640
|
setHighlightedIndex((currentIndex) => {
|
|
12541
12641
|
if (currentIndex >= 0) {
|
|
@@ -12550,34 +12650,34 @@ function useDesktopSelect({
|
|
|
12550
12650
|
window.cancelAnimationFrame(frameId);
|
|
12551
12651
|
};
|
|
12552
12652
|
}, [isMobile2, isOpen, options, selectedIndex]);
|
|
12553
|
-
|
|
12653
|
+
React49.useEffect(() => {
|
|
12554
12654
|
if (!isOpen || isMobile2 || highlightedIndex < 0) return;
|
|
12555
12655
|
optionRefs.current[highlightedIndex]?.scrollIntoView({
|
|
12556
12656
|
block: "nearest"
|
|
12557
12657
|
});
|
|
12558
12658
|
}, [highlightedIndex, isMobile2, isOpen]);
|
|
12559
|
-
|
|
12659
|
+
React49.useEffect(() => {
|
|
12560
12660
|
if (isOpen) return;
|
|
12561
12661
|
setHighlightedIndex(-1);
|
|
12562
12662
|
}, [isOpen]);
|
|
12563
|
-
const focusTrigger =
|
|
12663
|
+
const focusTrigger = React49.useCallback(() => {
|
|
12564
12664
|
triggerRef.current?.focus();
|
|
12565
12665
|
}, []);
|
|
12566
|
-
const handleSelect =
|
|
12666
|
+
const handleSelect = React49.useCallback(
|
|
12567
12667
|
(option) => {
|
|
12568
12668
|
if (option.isDisabled || disabled) return;
|
|
12569
12669
|
onChange(option);
|
|
12570
12670
|
},
|
|
12571
12671
|
[disabled, onChange]
|
|
12572
12672
|
);
|
|
12573
|
-
const openMenu =
|
|
12673
|
+
const openMenu = React49.useCallback(
|
|
12574
12674
|
(targetIndex) => {
|
|
12575
12675
|
const fallbackIndex = selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex(options);
|
|
12576
12676
|
setHighlightedIndex(targetIndex ?? fallbackIndex);
|
|
12577
12677
|
},
|
|
12578
12678
|
[options, selectedIndex]
|
|
12579
12679
|
);
|
|
12580
|
-
const handleTriggerKeyDown =
|
|
12680
|
+
const handleTriggerKeyDown = React49.useCallback(
|
|
12581
12681
|
(event, onOpen) => {
|
|
12582
12682
|
if (disabled) return;
|
|
12583
12683
|
if (event.key === "ArrowDown") {
|
|
@@ -12602,7 +12702,7 @@ function useDesktopSelect({
|
|
|
12602
12702
|
},
|
|
12603
12703
|
[disabled, openMenu, options, selectedIndex]
|
|
12604
12704
|
);
|
|
12605
|
-
const handleMenuKeyDown =
|
|
12705
|
+
const handleMenuKeyDown = React49.useCallback(
|
|
12606
12706
|
(event, onClose) => {
|
|
12607
12707
|
if (event.key === "Escape") {
|
|
12608
12708
|
event.preventDefault();
|
|
@@ -12652,7 +12752,7 @@ function useDesktopSelect({
|
|
|
12652
12752
|
},
|
|
12653
12753
|
[focusTrigger, highlightedIndex, onChange, options]
|
|
12654
12754
|
);
|
|
12655
|
-
const setOptionRef =
|
|
12755
|
+
const setOptionRef = React49.useCallback(
|
|
12656
12756
|
(index, node) => {
|
|
12657
12757
|
optionRefs.current[index] = node;
|
|
12658
12758
|
},
|
|
@@ -12672,23 +12772,23 @@ function useDesktopSelect({
|
|
|
12672
12772
|
}
|
|
12673
12773
|
|
|
12674
12774
|
// src/airbnb/select/useMobileSelectWheel.ts
|
|
12675
|
-
import * as
|
|
12775
|
+
import * as React50 from "react";
|
|
12676
12776
|
function useMobileSelectWheel({ isMobile: isMobile2, isOpen, options, value, disabled }) {
|
|
12677
|
-
const [pendingValue, setPendingValue] =
|
|
12777
|
+
const [pendingValue, setPendingValue] = React50.useState(
|
|
12678
12778
|
value ?? null
|
|
12679
12779
|
);
|
|
12680
|
-
const [mobileScrollTop, setMobileScrollTop] =
|
|
12681
|
-
const mobileListRef =
|
|
12682
|
-
const scrollSettleTimeoutRef =
|
|
12683
|
-
const scrollAnimationFrameRef =
|
|
12684
|
-
const getTargetIndex =
|
|
12780
|
+
const [mobileScrollTop, setMobileScrollTop] = React50.useState(0);
|
|
12781
|
+
const mobileListRef = React50.useRef(null);
|
|
12782
|
+
const scrollSettleTimeoutRef = React50.useRef(null);
|
|
12783
|
+
const scrollAnimationFrameRef = React50.useRef(null);
|
|
12784
|
+
const getTargetIndex = React50.useCallback(
|
|
12685
12785
|
(targetValue) => {
|
|
12686
12786
|
const selectedIndex = getOptionIndex(options, targetValue);
|
|
12687
12787
|
return selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex(options);
|
|
12688
12788
|
},
|
|
12689
12789
|
[options]
|
|
12690
12790
|
);
|
|
12691
|
-
const syncScrollPosition =
|
|
12791
|
+
const syncScrollPosition = React50.useCallback(
|
|
12692
12792
|
(targetValue, behavior = "instant") => {
|
|
12693
12793
|
const targetIndex = getTargetIndex(targetValue);
|
|
12694
12794
|
if (targetIndex < 0) return;
|
|
@@ -12707,27 +12807,27 @@ function useMobileSelectWheel({ isMobile: isMobile2, isOpen, options, value, dis
|
|
|
12707
12807
|
},
|
|
12708
12808
|
[getTargetIndex, options]
|
|
12709
12809
|
);
|
|
12710
|
-
const clearScrollSettleTimeout =
|
|
12810
|
+
const clearScrollSettleTimeout = React50.useCallback(() => {
|
|
12711
12811
|
if (scrollSettleTimeoutRef.current === null) return;
|
|
12712
12812
|
window.clearTimeout(scrollSettleTimeoutRef.current);
|
|
12713
12813
|
scrollSettleTimeoutRef.current = null;
|
|
12714
12814
|
}, []);
|
|
12715
|
-
const clearScrollAnimationFrame =
|
|
12815
|
+
const clearScrollAnimationFrame = React50.useCallback(() => {
|
|
12716
12816
|
if (scrollAnimationFrameRef.current === null) return;
|
|
12717
12817
|
window.cancelAnimationFrame(scrollAnimationFrameRef.current);
|
|
12718
12818
|
scrollAnimationFrameRef.current = null;
|
|
12719
12819
|
}, []);
|
|
12720
|
-
|
|
12820
|
+
React50.useEffect(
|
|
12721
12821
|
() => () => {
|
|
12722
12822
|
clearScrollSettleTimeout();
|
|
12723
12823
|
clearScrollAnimationFrame();
|
|
12724
12824
|
},
|
|
12725
12825
|
[clearScrollAnimationFrame, clearScrollSettleTimeout]
|
|
12726
12826
|
);
|
|
12727
|
-
|
|
12827
|
+
React50.useEffect(() => {
|
|
12728
12828
|
setPendingValue(value ?? null);
|
|
12729
12829
|
}, [value]);
|
|
12730
|
-
|
|
12830
|
+
React50.useLayoutEffect(() => {
|
|
12731
12831
|
if (!isMobile2 || !isOpen) return;
|
|
12732
12832
|
const frameId = window.requestAnimationFrame(() => {
|
|
12733
12833
|
syncScrollPosition(value ?? null, "instant");
|
|
@@ -12736,7 +12836,7 @@ function useMobileSelectWheel({ isMobile: isMobile2, isOpen, options, value, dis
|
|
|
12736
12836
|
window.cancelAnimationFrame(frameId);
|
|
12737
12837
|
};
|
|
12738
12838
|
}, [isMobile2, isOpen, syncScrollPosition, value]);
|
|
12739
|
-
const settleScroll =
|
|
12839
|
+
const settleScroll = React50.useCallback(() => {
|
|
12740
12840
|
if (!mobileListRef.current) return;
|
|
12741
12841
|
const nextIndex = Math.round(mobileListRef.current.scrollTop / MOBILE_OPTION_HEIGHT);
|
|
12742
12842
|
const nextOption = options[nextIndex];
|
|
@@ -12748,13 +12848,13 @@ function useMobileSelectWheel({ isMobile: isMobile2, isOpen, options, value, dis
|
|
|
12748
12848
|
}
|
|
12749
12849
|
setPendingValue(nextOption);
|
|
12750
12850
|
}, [options, pendingValue]);
|
|
12751
|
-
const scheduleScrollSettle =
|
|
12851
|
+
const scheduleScrollSettle = React50.useCallback(() => {
|
|
12752
12852
|
clearScrollSettleTimeout();
|
|
12753
12853
|
scrollSettleTimeoutRef.current = window.setTimeout(() => {
|
|
12754
12854
|
settleScroll();
|
|
12755
12855
|
}, MOBILE_SCROLL_SETTLE_DELAY);
|
|
12756
12856
|
}, [clearScrollSettleTimeout, settleScroll]);
|
|
12757
|
-
const handleScroll =
|
|
12857
|
+
const handleScroll = React50.useCallback(() => {
|
|
12758
12858
|
if (!mobileListRef.current) return;
|
|
12759
12859
|
const nextScrollTop = mobileListRef.current.scrollTop;
|
|
12760
12860
|
clearScrollAnimationFrame();
|
|
@@ -12764,7 +12864,7 @@ function useMobileSelectWheel({ isMobile: isMobile2, isOpen, options, value, dis
|
|
|
12764
12864
|
});
|
|
12765
12865
|
scheduleScrollSettle();
|
|
12766
12866
|
}, [clearScrollAnimationFrame, scheduleScrollSettle]);
|
|
12767
|
-
const focusOptionByIndex =
|
|
12867
|
+
const focusOptionByIndex = React50.useCallback(
|
|
12768
12868
|
(index, behavior = "instant", updatePendingImmediately = behavior === "instant") => {
|
|
12769
12869
|
if (!mobileListRef.current || index < 0 || index >= options.length) return;
|
|
12770
12870
|
const option = options[index];
|
|
@@ -12782,7 +12882,7 @@ function useMobileSelectWheel({ isMobile: isMobile2, isOpen, options, value, dis
|
|
|
12782
12882
|
},
|
|
12783
12883
|
[options, scheduleScrollSettle]
|
|
12784
12884
|
);
|
|
12785
|
-
const handleOptionClick =
|
|
12885
|
+
const handleOptionClick = React50.useCallback(
|
|
12786
12886
|
(option) => {
|
|
12787
12887
|
if (!mobileListRef.current || disabled || option.isDisabled) return;
|
|
12788
12888
|
const optionIndex = getOptionIndex(options, option);
|
|
@@ -12791,7 +12891,7 @@ function useMobileSelectWheel({ isMobile: isMobile2, isOpen, options, value, dis
|
|
|
12791
12891
|
},
|
|
12792
12892
|
[disabled, focusOptionByIndex, options]
|
|
12793
12893
|
);
|
|
12794
|
-
const moveByStep =
|
|
12894
|
+
const moveByStep = React50.useCallback(
|
|
12795
12895
|
(step) => {
|
|
12796
12896
|
const currentIndex = getOptionIndex(options, pendingValue);
|
|
12797
12897
|
const fallbackIndex = step === 1 ? getFirstEnabledOptionIndex(options) : getLastEnabledOptionIndex(options);
|
|
@@ -12803,7 +12903,7 @@ function useMobileSelectWheel({ isMobile: isMobile2, isOpen, options, value, dis
|
|
|
12803
12903
|
},
|
|
12804
12904
|
[focusOptionByIndex, options, pendingValue]
|
|
12805
12905
|
);
|
|
12806
|
-
const moveToBoundary =
|
|
12906
|
+
const moveToBoundary = React50.useCallback(
|
|
12807
12907
|
(boundary) => {
|
|
12808
12908
|
const targetIndex = boundary === "start" ? getFirstEnabledOptionIndex(options) : getLastEnabledOptionIndex(options);
|
|
12809
12909
|
if (targetIndex >= 0) {
|
|
@@ -12812,7 +12912,7 @@ function useMobileSelectWheel({ isMobile: isMobile2, isOpen, options, value, dis
|
|
|
12812
12912
|
},
|
|
12813
12913
|
[focusOptionByIndex, options]
|
|
12814
12914
|
);
|
|
12815
|
-
const syncPendingValue =
|
|
12915
|
+
const syncPendingValue = React50.useCallback(
|
|
12816
12916
|
(nextValue) => {
|
|
12817
12917
|
const normalizedValue = nextValue ?? null;
|
|
12818
12918
|
const matchedIndex = getOptionIndex(options, normalizedValue);
|
|
@@ -12840,9 +12940,9 @@ function useMobileSelectWheel({ isMobile: isMobile2, isOpen, options, value, dis
|
|
|
12840
12940
|
}
|
|
12841
12941
|
|
|
12842
12942
|
// src/airbnb/select/useSelectIds.ts
|
|
12843
|
-
import * as
|
|
12943
|
+
import * as React51 from "react";
|
|
12844
12944
|
function useSelectIds({ name, hasValue, error, hideErrorMessage }) {
|
|
12845
|
-
const reactId =
|
|
12945
|
+
const reactId = React51.useId().replace(/:/g, "");
|
|
12846
12946
|
const baseId = name ? `select-${name}` : `select-${reactId}`;
|
|
12847
12947
|
const triggerId = `${baseId}-trigger`;
|
|
12848
12948
|
const labelId = `${baseId}-label`;
|
|
@@ -12852,7 +12952,7 @@ function useSelectIds({ name, hasValue, error, hideErrorMessage }) {
|
|
|
12852
12952
|
const listboxId = `${baseId}-listbox`;
|
|
12853
12953
|
const describedErrorId = error && !hideErrorMessage ? errorId : void 0;
|
|
12854
12954
|
const describedBy = [!hasValue ? helperTextId : null, describedErrorId].filter(Boolean).join(" ") || void 0;
|
|
12855
|
-
const getOptionId2 =
|
|
12955
|
+
const getOptionId2 = React51.useCallback(
|
|
12856
12956
|
(index) => `${baseId}-option-${index}`,
|
|
12857
12957
|
[baseId]
|
|
12858
12958
|
);
|
|
@@ -12870,8 +12970,8 @@ function useSelectIds({ name, hasValue, error, hideErrorMessage }) {
|
|
|
12870
12970
|
}
|
|
12871
12971
|
|
|
12872
12972
|
// src/airbnb/select/Select.tsx
|
|
12873
|
-
import { jsx as
|
|
12874
|
-
var AirbnbSelect =
|
|
12973
|
+
import { jsx as jsx150, jsxs as jsxs94 } from "react/jsx-runtime";
|
|
12974
|
+
var AirbnbSelect = React52.forwardRef(function AirbnbSelect2({
|
|
12875
12975
|
options = [],
|
|
12876
12976
|
value,
|
|
12877
12977
|
onChange,
|
|
@@ -12898,8 +12998,8 @@ var AirbnbSelect = React51.forwardRef(function AirbnbSelect2({
|
|
|
12898
12998
|
noOptionsMessage
|
|
12899
12999
|
}, ref) {
|
|
12900
13000
|
const { isMatch: isMobile2 } = useScreenResize(DEVICE.mobileXL);
|
|
12901
|
-
const [isOpen, setIsOpen] =
|
|
12902
|
-
const containerRef =
|
|
13001
|
+
const [isOpen, setIsOpen] = React52.useState(false);
|
|
13002
|
+
const containerRef = React52.useRef(null);
|
|
12903
13003
|
const hasValue = Boolean(value);
|
|
12904
13004
|
const helperText = placeholder ?? label;
|
|
12905
13005
|
const shouldDescribeHelperText = !hasValue && helperText !== label;
|
|
@@ -12960,12 +13060,12 @@ var AirbnbSelect = React51.forwardRef(function AirbnbSelect2({
|
|
|
12960
13060
|
onOutsideClick: () => setIsOpen(false),
|
|
12961
13061
|
isDisabled: !isOpen || isMobile2
|
|
12962
13062
|
});
|
|
12963
|
-
|
|
13063
|
+
React52.useEffect(() => {
|
|
12964
13064
|
if (isBlocked) {
|
|
12965
13065
|
setIsOpen(false);
|
|
12966
13066
|
}
|
|
12967
13067
|
}, [isBlocked]);
|
|
12968
|
-
|
|
13068
|
+
React52.useEffect(
|
|
12969
13069
|
function setCorrectOptionIfThereIsOnlyValue() {
|
|
12970
13070
|
if (value?.value === void 0 || value.value === null || value.label !== "") {
|
|
12971
13071
|
return;
|
|
@@ -12977,7 +13077,7 @@ var AirbnbSelect = React51.forwardRef(function AirbnbSelect2({
|
|
|
12977
13077
|
},
|
|
12978
13078
|
[onChange, options, value]
|
|
12979
13079
|
);
|
|
12980
|
-
const handleMobileOpenChange =
|
|
13080
|
+
const handleMobileOpenChange = React52.useCallback(
|
|
12981
13081
|
(nextOpen) => {
|
|
12982
13082
|
if (isBlocked && nextOpen) return;
|
|
12983
13083
|
setIsOpen(nextOpen);
|
|
@@ -12988,7 +13088,7 @@ var AirbnbSelect = React51.forwardRef(function AirbnbSelect2({
|
|
|
12988
13088
|
},
|
|
12989
13089
|
[focusTrigger, isBlocked, syncPendingValue, value]
|
|
12990
13090
|
);
|
|
12991
|
-
const handleMobileDone =
|
|
13091
|
+
const handleMobileDone = React52.useCallback(() => {
|
|
12992
13092
|
if (isBlocked) return;
|
|
12993
13093
|
const finalOption = pendingValue;
|
|
12994
13094
|
if (finalOption && finalOption.value !== value?.value) {
|
|
@@ -12997,7 +13097,7 @@ var AirbnbSelect = React51.forwardRef(function AirbnbSelect2({
|
|
|
12997
13097
|
setIsOpen(false);
|
|
12998
13098
|
focusTrigger();
|
|
12999
13099
|
}, [focusTrigger, isBlocked, onChange, pendingValue, value]);
|
|
13000
|
-
const handleTriggerClick =
|
|
13100
|
+
const handleTriggerClick = React52.useCallback(() => {
|
|
13001
13101
|
if (isBlocked) return;
|
|
13002
13102
|
setIsOpen((prev) => {
|
|
13003
13103
|
const nextOpen = !prev;
|
|
@@ -13050,13 +13150,13 @@ var AirbnbSelect = React51.forwardRef(function AirbnbSelect2({
|
|
|
13050
13150
|
handleMobileOpenChange(false);
|
|
13051
13151
|
}
|
|
13052
13152
|
};
|
|
13053
|
-
return /* @__PURE__ */
|
|
13153
|
+
return /* @__PURE__ */ jsxs94(
|
|
13054
13154
|
"div",
|
|
13055
13155
|
{
|
|
13056
13156
|
ref: containerRef,
|
|
13057
13157
|
className: cn("relative w-full max-w-[var(--max-field-width)]", className),
|
|
13058
13158
|
children: [
|
|
13059
|
-
name && /* @__PURE__ */
|
|
13159
|
+
name && /* @__PURE__ */ jsx150("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
13060
13160
|
renderTrigger ? renderTrigger({
|
|
13061
13161
|
id: triggerId,
|
|
13062
13162
|
open: isOpen,
|
|
@@ -13078,7 +13178,7 @@ var AirbnbSelect = React51.forwardRef(function AirbnbSelect2({
|
|
|
13078
13178
|
onClick: handleTriggerClick,
|
|
13079
13179
|
onKeyDown: handleRootTriggerKeyDown,
|
|
13080
13180
|
onBlur
|
|
13081
|
-
}) : /* @__PURE__ */
|
|
13181
|
+
}) : /* @__PURE__ */ jsx150(
|
|
13082
13182
|
SelectTrigger2,
|
|
13083
13183
|
{
|
|
13084
13184
|
id: triggerId,
|
|
@@ -13106,7 +13206,7 @@ var AirbnbSelect = React51.forwardRef(function AirbnbSelect2({
|
|
|
13106
13206
|
onBlur
|
|
13107
13207
|
}
|
|
13108
13208
|
),
|
|
13109
|
-
isMobile2 ? /* @__PURE__ */
|
|
13209
|
+
isMobile2 ? /* @__PURE__ */ jsx150(
|
|
13110
13210
|
SelectMobileContent,
|
|
13111
13211
|
{
|
|
13112
13212
|
open: isOpen,
|
|
@@ -13131,7 +13231,7 @@ var AirbnbSelect = React51.forwardRef(function AirbnbSelect2({
|
|
|
13131
13231
|
getOptionId: getOptionId2,
|
|
13132
13232
|
noOptionsMessage
|
|
13133
13233
|
}
|
|
13134
|
-
) : /* @__PURE__ */
|
|
13234
|
+
) : /* @__PURE__ */ jsx150(
|
|
13135
13235
|
SelectDesktopContent,
|
|
13136
13236
|
{
|
|
13137
13237
|
isOpen,
|
|
@@ -13165,13 +13265,13 @@ var AirbnbSelect = React51.forwardRef(function AirbnbSelect2({
|
|
|
13165
13265
|
});
|
|
13166
13266
|
|
|
13167
13267
|
// src/airbnb/phone-field/PhoneField.tsx
|
|
13168
|
-
import { jsx as
|
|
13268
|
+
import { jsx as jsx151, jsxs as jsxs95 } from "react/jsx-runtime";
|
|
13169
13269
|
function formatPhoneCodeOptionLabel(option) {
|
|
13170
13270
|
const label = String(option.label);
|
|
13171
13271
|
const value = String(option.value);
|
|
13172
13272
|
return label.includes(value) ? label : `${label} (${value})`;
|
|
13173
13273
|
}
|
|
13174
|
-
var PhoneField =
|
|
13274
|
+
var PhoneField = React53.forwardRef(
|
|
13175
13275
|
({
|
|
13176
13276
|
variant = "default",
|
|
13177
13277
|
label,
|
|
@@ -13195,8 +13295,8 @@ var PhoneField = React52.forwardRef(
|
|
|
13195
13295
|
mobileTitle,
|
|
13196
13296
|
codePlaceholder = "+00"
|
|
13197
13297
|
}, ref) => {
|
|
13198
|
-
const inputId =
|
|
13199
|
-
const codeOptions =
|
|
13298
|
+
const inputId = React53.useId();
|
|
13299
|
+
const codeOptions = React53.useMemo(
|
|
13200
13300
|
() => options.map((option) => ({
|
|
13201
13301
|
value: option.value,
|
|
13202
13302
|
label: formatPhoneCodeOptionLabel(option),
|
|
@@ -13204,7 +13304,7 @@ var PhoneField = React52.forwardRef(
|
|
|
13204
13304
|
})),
|
|
13205
13305
|
[options]
|
|
13206
13306
|
);
|
|
13207
|
-
const selectedCodeOption =
|
|
13307
|
+
const selectedCodeOption = React53.useMemo(
|
|
13208
13308
|
() => codeOptions.find((option) => option.value === value?.code) ?? null,
|
|
13209
13309
|
[codeOptions, value?.code]
|
|
13210
13310
|
);
|
|
@@ -13212,9 +13312,9 @@ var PhoneField = React52.forwardRef(
|
|
|
13212
13312
|
const hasInvalidState = Boolean(error) || Boolean(invalid);
|
|
13213
13313
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
13214
13314
|
const isCodeBlocked = isBlocked || Boolean(codeReadOnly);
|
|
13215
|
-
return /* @__PURE__ */
|
|
13216
|
-
name && /* @__PURE__ */
|
|
13217
|
-
codeName && /* @__PURE__ */
|
|
13315
|
+
return /* @__PURE__ */ jsxs95("div", { className: cn("w-full max-w-[var(--max-field-width)]", className), children: [
|
|
13316
|
+
name && /* @__PURE__ */ jsx151("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
13317
|
+
codeName && /* @__PURE__ */ jsx151(
|
|
13218
13318
|
"input",
|
|
13219
13319
|
{
|
|
13220
13320
|
type: "hidden",
|
|
@@ -13223,7 +13323,7 @@ var PhoneField = React52.forwardRef(
|
|
|
13223
13323
|
disabled
|
|
13224
13324
|
}
|
|
13225
13325
|
),
|
|
13226
|
-
numberName && /* @__PURE__ */
|
|
13326
|
+
numberName && /* @__PURE__ */ jsx151(
|
|
13227
13327
|
"input",
|
|
13228
13328
|
{
|
|
13229
13329
|
type: "hidden",
|
|
@@ -13232,7 +13332,7 @@ var PhoneField = React52.forwardRef(
|
|
|
13232
13332
|
disabled
|
|
13233
13333
|
}
|
|
13234
13334
|
),
|
|
13235
|
-
topLabel && /* @__PURE__ */
|
|
13335
|
+
topLabel && /* @__PURE__ */ jsx151(
|
|
13236
13336
|
"label",
|
|
13237
13337
|
{
|
|
13238
13338
|
htmlFor: inputId,
|
|
@@ -13240,8 +13340,8 @@ var PhoneField = React52.forwardRef(
|
|
|
13240
13340
|
children: topLabel
|
|
13241
13341
|
}
|
|
13242
13342
|
),
|
|
13243
|
-
/* @__PURE__ */
|
|
13244
|
-
/* @__PURE__ */
|
|
13343
|
+
/* @__PURE__ */ jsxs95("div", { className: "flex items-stretch", children: [
|
|
13344
|
+
/* @__PURE__ */ jsx151(
|
|
13245
13345
|
AirbnbSelect,
|
|
13246
13346
|
{
|
|
13247
13347
|
ref,
|
|
@@ -13272,7 +13372,7 @@ var PhoneField = React52.forwardRef(
|
|
|
13272
13372
|
onClick,
|
|
13273
13373
|
onKeyDown,
|
|
13274
13374
|
valueLabel
|
|
13275
|
-
}) => /* @__PURE__ */
|
|
13375
|
+
}) => /* @__PURE__ */ jsxs95(
|
|
13276
13376
|
"button",
|
|
13277
13377
|
{
|
|
13278
13378
|
id,
|
|
@@ -13294,8 +13394,8 @@ var PhoneField = React52.forwardRef(
|
|
|
13294
13394
|
triggerDisabled ? "cursor-not-allowed opacity-50" : triggerLoading ? "cursor-progress" : "cursor-pointer"
|
|
13295
13395
|
),
|
|
13296
13396
|
children: [
|
|
13297
|
-
/* @__PURE__ */
|
|
13298
|
-
/* @__PURE__ */
|
|
13397
|
+
/* @__PURE__ */ jsx151("span", { children: valueLabel ?? codePlaceholder }),
|
|
13398
|
+
/* @__PURE__ */ jsx151(
|
|
13299
13399
|
ChevronDown3,
|
|
13300
13400
|
{
|
|
13301
13401
|
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
@@ -13307,7 +13407,7 @@ var PhoneField = React52.forwardRef(
|
|
|
13307
13407
|
)
|
|
13308
13408
|
}
|
|
13309
13409
|
),
|
|
13310
|
-
/* @__PURE__ */
|
|
13410
|
+
/* @__PURE__ */ jsx151(
|
|
13311
13411
|
AirbnbInput,
|
|
13312
13412
|
{
|
|
13313
13413
|
id: inputId,
|
|
@@ -13339,23 +13439,23 @@ var PhoneField = React52.forwardRef(
|
|
|
13339
13439
|
}
|
|
13340
13440
|
)
|
|
13341
13441
|
] }),
|
|
13342
|
-
error && /* @__PURE__ */
|
|
13442
|
+
error && /* @__PURE__ */ jsx151(FieldErrorMessage, { message: error })
|
|
13343
13443
|
] });
|
|
13344
13444
|
}
|
|
13345
13445
|
);
|
|
13346
13446
|
PhoneField.displayName = "PhoneField";
|
|
13347
13447
|
|
|
13348
13448
|
// src/airbnb/search-input/SearchInput.tsx
|
|
13349
|
-
import * as
|
|
13449
|
+
import * as React54 from "react";
|
|
13350
13450
|
import { useTranslation as useTranslation25 } from "react-i18next";
|
|
13351
13451
|
import { Search as Search3, X as X9 } from "lucide-react";
|
|
13352
|
-
import { jsx as
|
|
13353
|
-
var AirbnbSearchInput =
|
|
13452
|
+
import { jsx as jsx152, jsxs as jsxs96 } from "react/jsx-runtime";
|
|
13453
|
+
var AirbnbSearchInput = React54.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
|
|
13354
13454
|
const { t } = useTranslation25();
|
|
13355
13455
|
const placeholderText = placeholder || t("search_property") + "...";
|
|
13356
|
-
return /* @__PURE__ */
|
|
13357
|
-
/* @__PURE__ */
|
|
13358
|
-
/* @__PURE__ */
|
|
13456
|
+
return /* @__PURE__ */ jsxs96("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
|
|
13457
|
+
/* @__PURE__ */ jsx152(Search3, { className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]" }),
|
|
13458
|
+
/* @__PURE__ */ jsx152(
|
|
13359
13459
|
"input",
|
|
13360
13460
|
{
|
|
13361
13461
|
...props,
|
|
@@ -13374,13 +13474,13 @@ var AirbnbSearchInput = React53.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
13374
13474
|
)
|
|
13375
13475
|
}
|
|
13376
13476
|
),
|
|
13377
|
-
onReset && /* @__PURE__ */
|
|
13477
|
+
onReset && /* @__PURE__ */ jsx152(
|
|
13378
13478
|
Button,
|
|
13379
13479
|
{
|
|
13380
13480
|
variant: "ghost",
|
|
13381
13481
|
onClick: onReset,
|
|
13382
13482
|
className: "absolute right-0 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]",
|
|
13383
|
-
children: /* @__PURE__ */
|
|
13483
|
+
children: /* @__PURE__ */ jsx152(X9, { className: "h-5 w-5" })
|
|
13384
13484
|
}
|
|
13385
13485
|
)
|
|
13386
13486
|
] });
|
|
@@ -13388,12 +13488,12 @@ var AirbnbSearchInput = React53.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
13388
13488
|
AirbnbSearchInput.displayName = "SearchInput";
|
|
13389
13489
|
|
|
13390
13490
|
// src/dashboard/input/Input.tsx
|
|
13391
|
-
import * as
|
|
13491
|
+
import * as React55 from "react";
|
|
13392
13492
|
import { Eye, Minus as Minus3, Plus as Plus2, X as X10 } from "lucide-react";
|
|
13393
13493
|
import { useTranslation as useTranslation26 } from "react-i18next";
|
|
13394
13494
|
|
|
13395
13495
|
// src/dashboard/_fieldset/Fieldset.tsx
|
|
13396
|
-
import { Fragment as
|
|
13496
|
+
import { Fragment as Fragment16, jsx as jsx153, jsxs as jsxs97 } from "react/jsx-runtime";
|
|
13397
13497
|
function Fieldset({
|
|
13398
13498
|
isActivated,
|
|
13399
13499
|
isFocused,
|
|
@@ -13413,8 +13513,8 @@ function Fieldset({
|
|
|
13413
13513
|
}) {
|
|
13414
13514
|
const showLegendText = Boolean(legend || typeof label === "string");
|
|
13415
13515
|
const raised = !isEmpty || isFocused;
|
|
13416
|
-
return /* @__PURE__ */
|
|
13417
|
-
/* @__PURE__ */
|
|
13516
|
+
return /* @__PURE__ */ jsxs97(Fragment16, { children: [
|
|
13517
|
+
/* @__PURE__ */ jsxs97(
|
|
13418
13518
|
"div",
|
|
13419
13519
|
{
|
|
13420
13520
|
onClick,
|
|
@@ -13430,7 +13530,7 @@ function Fieldset({
|
|
|
13430
13530
|
labelClassName
|
|
13431
13531
|
),
|
|
13432
13532
|
children: [
|
|
13433
|
-
/* @__PURE__ */
|
|
13533
|
+
/* @__PURE__ */ jsx153(
|
|
13434
13534
|
"label",
|
|
13435
13535
|
{
|
|
13436
13536
|
id: labelId,
|
|
@@ -13442,7 +13542,7 @@ function Fieldset({
|
|
|
13442
13542
|
children: label
|
|
13443
13543
|
}
|
|
13444
13544
|
),
|
|
13445
|
-
tooltip && /* @__PURE__ */
|
|
13545
|
+
tooltip && /* @__PURE__ */ jsx153("span", { className: "ml-1 inline-flex", children: /* @__PURE__ */ jsx153(
|
|
13446
13546
|
HelpTooltip,
|
|
13447
13547
|
{
|
|
13448
13548
|
content: tooltip,
|
|
@@ -13453,7 +13553,7 @@ function Fieldset({
|
|
|
13453
13553
|
]
|
|
13454
13554
|
}
|
|
13455
13555
|
),
|
|
13456
|
-
/* @__PURE__ */
|
|
13556
|
+
/* @__PURE__ */ jsx153(
|
|
13457
13557
|
"fieldset",
|
|
13458
13558
|
{
|
|
13459
13559
|
"aria-hidden": "true",
|
|
@@ -13465,7 +13565,7 @@ function Fieldset({
|
|
|
13465
13565
|
invalid && "border-[var(--error-message-color)]",
|
|
13466
13566
|
className
|
|
13467
13567
|
),
|
|
13468
|
-
children: /* @__PURE__ */
|
|
13568
|
+
children: /* @__PURE__ */ jsxs97(
|
|
13469
13569
|
"legend",
|
|
13470
13570
|
{
|
|
13471
13571
|
className: cn(
|
|
@@ -13475,8 +13575,8 @@ function Fieldset({
|
|
|
13475
13575
|
!label && "w-0"
|
|
13476
13576
|
),
|
|
13477
13577
|
children: [
|
|
13478
|
-
showLegendText && /* @__PURE__ */
|
|
13479
|
-
tooltip && /* @__PURE__ */
|
|
13578
|
+
showLegendText && /* @__PURE__ */ jsx153("span", { className: "visible inline-block pr-[6px] text-[14px] font-medium opacity-0", children: legend || label }),
|
|
13579
|
+
tooltip && /* @__PURE__ */ jsx153("span", { className: "visible inline-block w-[20px] opacity-0", children: /* @__PURE__ */ jsx153("span", { className: "inline-block h-4 w-4" }) })
|
|
13480
13580
|
]
|
|
13481
13581
|
}
|
|
13482
13582
|
)
|
|
@@ -13486,7 +13586,7 @@ function Fieldset({
|
|
|
13486
13586
|
}
|
|
13487
13587
|
|
|
13488
13588
|
// src/dashboard/input/Input.tsx
|
|
13489
|
-
import { jsx as
|
|
13589
|
+
import { jsx as jsx154, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
13490
13590
|
var checkIfEmpty = ({
|
|
13491
13591
|
empty,
|
|
13492
13592
|
defaultValue,
|
|
@@ -13496,7 +13596,7 @@ var checkIfEmpty = ({
|
|
|
13496
13596
|
if (value === 0 || defaultValue === 0) return false;
|
|
13497
13597
|
return !value && !defaultValue;
|
|
13498
13598
|
};
|
|
13499
|
-
var DashboardInput =
|
|
13599
|
+
var DashboardInput = React55.forwardRef(
|
|
13500
13600
|
({
|
|
13501
13601
|
value,
|
|
13502
13602
|
defaultValue,
|
|
@@ -13535,14 +13635,14 @@ var DashboardInput = React54.forwardRef(
|
|
|
13535
13635
|
renderErrorMessage = true,
|
|
13536
13636
|
...props
|
|
13537
13637
|
}, ref) => {
|
|
13538
|
-
const generatedId =
|
|
13638
|
+
const generatedId = React55.useId();
|
|
13539
13639
|
const inputId = id ?? name ?? generatedId;
|
|
13540
13640
|
const errorId = `${inputId}-error`;
|
|
13541
13641
|
const { t } = useTranslation26();
|
|
13542
13642
|
const isEmpty = checkIfEmpty({ empty, value, defaultValue });
|
|
13543
|
-
const [inputType, setInputType] =
|
|
13544
|
-
const [isPasswordRevealed, setIsPasswordRevealed] =
|
|
13545
|
-
const [isFocused, setIsFocused] =
|
|
13643
|
+
const [inputType, setInputType] = React55.useState(type);
|
|
13644
|
+
const [isPasswordRevealed, setIsPasswordRevealed] = React55.useState(false);
|
|
13645
|
+
const [isFocused, setIsFocused] = React55.useState(false);
|
|
13546
13646
|
const prevInputType = usePrevious(inputType);
|
|
13547
13647
|
const isPasswordReveal = (prevInputType === "password" || type === "password") && !isEmpty;
|
|
13548
13648
|
const hasInvalidState = Boolean(invalid) || Boolean(error) && error !== "NONE";
|
|
@@ -13557,7 +13657,7 @@ var DashboardInput = React54.forwardRef(
|
|
|
13557
13657
|
setIsPasswordRevealed(true);
|
|
13558
13658
|
}
|
|
13559
13659
|
};
|
|
13560
|
-
|
|
13660
|
+
React55.useEffect(() => {
|
|
13561
13661
|
setInputType(type);
|
|
13562
13662
|
}, [type]);
|
|
13563
13663
|
const handleChange = (event) => {
|
|
@@ -13579,7 +13679,7 @@ var DashboardInput = React54.forwardRef(
|
|
|
13579
13679
|
};
|
|
13580
13680
|
const showRightPaddingForReset = Boolean(onReset);
|
|
13581
13681
|
const showRightPaddingForReveal = isPasswordReveal;
|
|
13582
|
-
return /* @__PURE__ */
|
|
13682
|
+
return /* @__PURE__ */ jsxs98(
|
|
13583
13683
|
"div",
|
|
13584
13684
|
{
|
|
13585
13685
|
className: cn(
|
|
@@ -13591,7 +13691,7 @@ var DashboardInput = React54.forwardRef(
|
|
|
13591
13691
|
),
|
|
13592
13692
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
13593
13693
|
children: [
|
|
13594
|
-
topLabel && /* @__PURE__ */
|
|
13694
|
+
topLabel && /* @__PURE__ */ jsx154(
|
|
13595
13695
|
"label",
|
|
13596
13696
|
{
|
|
13597
13697
|
htmlFor: inputId,
|
|
@@ -13599,7 +13699,7 @@ var DashboardInput = React54.forwardRef(
|
|
|
13599
13699
|
children: topLabel
|
|
13600
13700
|
}
|
|
13601
13701
|
),
|
|
13602
|
-
/* @__PURE__ */
|
|
13702
|
+
/* @__PURE__ */ jsxs98(
|
|
13603
13703
|
"div",
|
|
13604
13704
|
{
|
|
13605
13705
|
className: cn(
|
|
@@ -13608,8 +13708,8 @@ var DashboardInput = React54.forwardRef(
|
|
|
13608
13708
|
fieldClassName
|
|
13609
13709
|
),
|
|
13610
13710
|
children: [
|
|
13611
|
-
/* @__PURE__ */
|
|
13612
|
-
/* @__PURE__ */
|
|
13711
|
+
/* @__PURE__ */ jsxs98("div", { className: cn("relative w-full cursor-text", contentClassName), children: [
|
|
13712
|
+
/* @__PURE__ */ jsx154(
|
|
13613
13713
|
Fieldset,
|
|
13614
13714
|
{
|
|
13615
13715
|
isFocused: isFocused && !readOnly,
|
|
@@ -13630,8 +13730,8 @@ var DashboardInput = React54.forwardRef(
|
|
|
13630
13730
|
})
|
|
13631
13731
|
}
|
|
13632
13732
|
),
|
|
13633
|
-
leftIcon && /* @__PURE__ */
|
|
13634
|
-
/* @__PURE__ */
|
|
13733
|
+
leftIcon && /* @__PURE__ */ jsx154("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__ */ jsx154("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
13734
|
+
/* @__PURE__ */ jsx154(
|
|
13635
13735
|
"input",
|
|
13636
13736
|
{
|
|
13637
13737
|
...props,
|
|
@@ -13668,9 +13768,9 @@ var DashboardInput = React54.forwardRef(
|
|
|
13668
13768
|
)
|
|
13669
13769
|
}
|
|
13670
13770
|
),
|
|
13671
|
-
sign && /* @__PURE__ */
|
|
13672
|
-
trailingAdornment && /* @__PURE__ */
|
|
13673
|
-
onReset && !isEmpty && /* @__PURE__ */
|
|
13771
|
+
sign && /* @__PURE__ */ jsx154("span", { className: "pointer-events-none absolute right-[14px] top-0 flex h-full items-center text-[18px] font-medium leading-6 text-[var(--chekin-color-brand-navy)]", children: sign }),
|
|
13772
|
+
trailingAdornment && /* @__PURE__ */ jsx154("span", { className: "pointer-events-none absolute right-[14px] top-0 flex h-full items-center", children: trailingAdornment }),
|
|
13773
|
+
onReset && !isEmpty && /* @__PURE__ */ jsx154(
|
|
13674
13774
|
"button",
|
|
13675
13775
|
{
|
|
13676
13776
|
type: "button",
|
|
@@ -13678,17 +13778,17 @@ var DashboardInput = React54.forwardRef(
|
|
|
13678
13778
|
disabled,
|
|
13679
13779
|
className: "absolute right-0 top-0 flex h-full w-10 items-center justify-center border-0 bg-transparent p-0 text-[#9696b9] hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50",
|
|
13680
13780
|
"aria-label": "Reset",
|
|
13681
|
-
children: /* @__PURE__ */
|
|
13781
|
+
children: /* @__PURE__ */ jsx154(X10, { size: 14 })
|
|
13682
13782
|
}
|
|
13683
13783
|
),
|
|
13684
|
-
isPasswordReveal && /* @__PURE__ */
|
|
13784
|
+
isPasswordReveal && /* @__PURE__ */ jsx154(
|
|
13685
13785
|
"button",
|
|
13686
13786
|
{
|
|
13687
13787
|
type: "button",
|
|
13688
13788
|
onClick: togglePasswordReveal,
|
|
13689
13789
|
className: "absolute right-[14px] top-[18px] flex h-[13px] w-[21px] cursor-pointer items-center justify-center border-0 bg-transparent p-0 hover:opacity-85",
|
|
13690
13790
|
"aria-label": isPasswordRevealed ? "Hide password" : "Show password",
|
|
13691
|
-
children: /* @__PURE__ */
|
|
13791
|
+
children: /* @__PURE__ */ jsx154(
|
|
13692
13792
|
Eye,
|
|
13693
13793
|
{
|
|
13694
13794
|
size: 20,
|
|
@@ -13700,32 +13800,32 @@ var DashboardInput = React54.forwardRef(
|
|
|
13700
13800
|
}
|
|
13701
13801
|
)
|
|
13702
13802
|
] }),
|
|
13703
|
-
type === "number" && showNumberButtons && /* @__PURE__ */
|
|
13704
|
-
/* @__PURE__ */
|
|
13803
|
+
type === "number" && showNumberButtons && /* @__PURE__ */ jsxs98("div", { className: "absolute right-[18px] top-[13px] inline-flex items-center text-right", children: [
|
|
13804
|
+
/* @__PURE__ */ jsx154(
|
|
13705
13805
|
"button",
|
|
13706
13806
|
{
|
|
13707
13807
|
type: "button",
|
|
13708
13808
|
onClick: onDecrement,
|
|
13709
13809
|
className: "mr-2 inline-flex h-[23px] w-8 cursor-pointer items-center justify-center rounded-[3px] border-0 bg-[var(--chekin-color-brand-blue)] p-0 text-[20px] font-bold text-white outline-none hover:opacity-90 active:opacity-100",
|
|
13710
13810
|
"aria-label": "Decrement",
|
|
13711
|
-
children: /* @__PURE__ */
|
|
13811
|
+
children: /* @__PURE__ */ jsx154(Minus3, { size: 16, strokeWidth: 3, "aria-hidden": true })
|
|
13712
13812
|
}
|
|
13713
13813
|
),
|
|
13714
|
-
/* @__PURE__ */
|
|
13814
|
+
/* @__PURE__ */ jsx154(
|
|
13715
13815
|
"button",
|
|
13716
13816
|
{
|
|
13717
13817
|
type: "button",
|
|
13718
13818
|
onClick: onIncrement,
|
|
13719
13819
|
className: "inline-flex h-[23px] w-8 cursor-pointer items-center justify-center rounded-[3px] border-0 bg-[var(--chekin-color-brand-blue)] p-0 text-[20px] font-bold text-white outline-none hover:opacity-90 active:opacity-100",
|
|
13720
13820
|
"aria-label": "Increment",
|
|
13721
|
-
children: /* @__PURE__ */
|
|
13821
|
+
children: /* @__PURE__ */ jsx154(Plus2, { size: 16, strokeWidth: 3, "aria-hidden": true })
|
|
13722
13822
|
}
|
|
13723
13823
|
)
|
|
13724
13824
|
] })
|
|
13725
13825
|
]
|
|
13726
13826
|
}
|
|
13727
13827
|
),
|
|
13728
|
-
!errorMessage && optional && /* @__PURE__ */
|
|
13828
|
+
!errorMessage && optional && /* @__PURE__ */ jsx154(
|
|
13729
13829
|
"span",
|
|
13730
13830
|
{
|
|
13731
13831
|
"data-testid": `${name}-optional`,
|
|
@@ -13733,8 +13833,8 @@ var DashboardInput = React54.forwardRef(
|
|
|
13733
13833
|
children: typeof optional === "string" ? optional : t("optional")
|
|
13734
13834
|
}
|
|
13735
13835
|
),
|
|
13736
|
-
!errorMessage && helperText && /* @__PURE__ */
|
|
13737
|
-
errorMessage && renderErrorMessage && /* @__PURE__ */
|
|
13836
|
+
!errorMessage && helperText && /* @__PURE__ */ jsx154("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
13837
|
+
errorMessage && renderErrorMessage && /* @__PURE__ */ jsx154(
|
|
13738
13838
|
FieldErrorMessage,
|
|
13739
13839
|
{
|
|
13740
13840
|
id: errorId,
|
|
@@ -13752,12 +13852,12 @@ var DashboardInput = React54.forwardRef(
|
|
|
13752
13852
|
DashboardInput.displayName = "DashboardInput";
|
|
13753
13853
|
|
|
13754
13854
|
// src/dashboard/select/Select.tsx
|
|
13755
|
-
import * as
|
|
13855
|
+
import * as React59 from "react";
|
|
13756
13856
|
import { useTranslation as useTranslation30 } from "react-i18next";
|
|
13757
13857
|
|
|
13758
13858
|
// src/dashboard/_select-internals/SelectFieldShell.tsx
|
|
13759
13859
|
import { useTranslation as useTranslation27 } from "react-i18next";
|
|
13760
|
-
import { jsx as
|
|
13860
|
+
import { jsx as jsx155, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
13761
13861
|
function SelectFieldShell({
|
|
13762
13862
|
containerRef,
|
|
13763
13863
|
className,
|
|
@@ -13778,7 +13878,7 @@ function SelectFieldShell({
|
|
|
13778
13878
|
}) {
|
|
13779
13879
|
const { t } = useTranslation27();
|
|
13780
13880
|
const wrapperWidth = toCssSize(width);
|
|
13781
|
-
return /* @__PURE__ */
|
|
13881
|
+
return /* @__PURE__ */ jsxs99(
|
|
13782
13882
|
"div",
|
|
13783
13883
|
{
|
|
13784
13884
|
ref: containerRef,
|
|
@@ -13791,9 +13891,9 @@ function SelectFieldShell({
|
|
|
13791
13891
|
),
|
|
13792
13892
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
13793
13893
|
children: [
|
|
13794
|
-
name && /* @__PURE__ */
|
|
13795
|
-
/* @__PURE__ */
|
|
13796
|
-
topLabel && /* @__PURE__ */
|
|
13894
|
+
name && /* @__PURE__ */ jsx155("input", { type: "hidden", name, value: hiddenValue ?? "" }),
|
|
13895
|
+
/* @__PURE__ */ jsxs99("div", { className: "relative min-h-[68px] w-full", children: [
|
|
13896
|
+
topLabel && /* @__PURE__ */ jsx155(
|
|
13797
13897
|
"label",
|
|
13798
13898
|
{
|
|
13799
13899
|
htmlFor: triggerId,
|
|
@@ -13801,10 +13901,10 @@ function SelectFieldShell({
|
|
|
13801
13901
|
children: topLabel
|
|
13802
13902
|
}
|
|
13803
13903
|
),
|
|
13804
|
-
/* @__PURE__ */
|
|
13805
|
-
!errorMessage && optional && /* @__PURE__ */
|
|
13806
|
-
!errorMessage && helperText && /* @__PURE__ */
|
|
13807
|
-
errorMessage && !hideErrorMessage && /* @__PURE__ */
|
|
13904
|
+
/* @__PURE__ */ jsx155("div", { className: "relative w-full", children }),
|
|
13905
|
+
!errorMessage && optional && /* @__PURE__ */ jsx155("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
13906
|
+
!errorMessage && helperText && /* @__PURE__ */ jsx155("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
13907
|
+
errorMessage && !hideErrorMessage && /* @__PURE__ */ jsx155(
|
|
13808
13908
|
FieldErrorMessage,
|
|
13809
13909
|
{
|
|
13810
13910
|
id: errorId,
|
|
@@ -13850,7 +13950,7 @@ function isOptionSelected(option, selectedValue, selectedValues) {
|
|
|
13850
13950
|
}
|
|
13851
13951
|
|
|
13852
13952
|
// src/dashboard/_select-internals/SelectMenu.tsx
|
|
13853
|
-
import { jsx as
|
|
13953
|
+
import { jsx as jsx156, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
13854
13954
|
function SelectMenu({
|
|
13855
13955
|
id,
|
|
13856
13956
|
options,
|
|
@@ -13875,7 +13975,7 @@ function SelectMenu({
|
|
|
13875
13975
|
const { t } = useTranslation28();
|
|
13876
13976
|
const emptyMessage = noOptionsMessage?.() ?? t("no_options");
|
|
13877
13977
|
const hasOptions = options.length > 0;
|
|
13878
|
-
return /* @__PURE__ */
|
|
13978
|
+
return /* @__PURE__ */ jsxs100(
|
|
13879
13979
|
"div",
|
|
13880
13980
|
{
|
|
13881
13981
|
id,
|
|
@@ -13892,13 +13992,13 @@ function SelectMenu({
|
|
|
13892
13992
|
menuClassName
|
|
13893
13993
|
),
|
|
13894
13994
|
children: [
|
|
13895
|
-
!hasOptions && (emptyContent ?? /* @__PURE__ */
|
|
13995
|
+
!hasOptions && (emptyContent ?? /* @__PURE__ */ jsx156("div", { className: "mt-[10px] text-left text-[16px] text-[var(--chekin-color-brand-navy)]", children: emptyMessage })),
|
|
13896
13996
|
options.map((option, index) => {
|
|
13897
13997
|
const isSelected = isOptionSelected(option, selectedValue, selectedValues);
|
|
13898
13998
|
const isHighlighted = index === highlightedIndex;
|
|
13899
13999
|
const optionKey = `${String(option.value)}-${index}`;
|
|
13900
14000
|
const isOptionDisabled = Boolean(disabled || option.isDisabled);
|
|
13901
|
-
return /* @__PURE__ */
|
|
14001
|
+
return /* @__PURE__ */ jsxs100(
|
|
13902
14002
|
"button",
|
|
13903
14003
|
{
|
|
13904
14004
|
id: getOptionId2(index),
|
|
@@ -13921,8 +14021,8 @@ function SelectMenu({
|
|
|
13921
14021
|
isOptionDisabled && "cursor-default opacity-30"
|
|
13922
14022
|
),
|
|
13923
14023
|
children: [
|
|
13924
|
-
/* @__PURE__ */
|
|
13925
|
-
option.description && /* @__PURE__ */
|
|
14024
|
+
/* @__PURE__ */ jsx156("span", { className: "block break-words", children: option.label }),
|
|
14025
|
+
option.description && /* @__PURE__ */ jsx156("span", { className: "ml-2 mt-[3px] shrink-0 text-[12px] font-bold italic text-[#777e91]", children: option.description })
|
|
13926
14026
|
]
|
|
13927
14027
|
},
|
|
13928
14028
|
optionKey
|
|
@@ -13936,7 +14036,7 @@ function SelectMenu({
|
|
|
13936
14036
|
|
|
13937
14037
|
// src/dashboard/_select-internals/SelectMenuPanel.tsx
|
|
13938
14038
|
import { useTranslation as useTranslation29 } from "react-i18next";
|
|
13939
|
-
import { jsx as
|
|
14039
|
+
import { jsx as jsx157, jsxs as jsxs101 } from "react/jsx-runtime";
|
|
13940
14040
|
function SelectMenuPanel({
|
|
13941
14041
|
isOpen,
|
|
13942
14042
|
isMobile: isMobile2,
|
|
@@ -13954,23 +14054,23 @@ function SelectMenuPanel({
|
|
|
13954
14054
|
const fallbackTitle = t("select_option");
|
|
13955
14055
|
const titleText = typeof title === "string" || typeof title === "number" ? String(title) : fallbackTitle;
|
|
13956
14056
|
const descriptionText = typeof description === "string" || typeof description === "number" ? String(description) : titleText;
|
|
13957
|
-
return /* @__PURE__ */
|
|
14057
|
+
return /* @__PURE__ */ jsx157(
|
|
13958
14058
|
Drawer,
|
|
13959
14059
|
{
|
|
13960
14060
|
open: isOpen,
|
|
13961
14061
|
onOpenChange: (next) => {
|
|
13962
14062
|
if (!next) onClose();
|
|
13963
14063
|
},
|
|
13964
|
-
children: /* @__PURE__ */
|
|
14064
|
+
children: /* @__PURE__ */ jsxs101(
|
|
13965
14065
|
DrawerContent,
|
|
13966
14066
|
{
|
|
13967
14067
|
onClose,
|
|
13968
14068
|
lockScroll: false,
|
|
13969
14069
|
className: cn("max-h-[calc(100vh-1rem)]", drawerClassName),
|
|
13970
14070
|
children: [
|
|
13971
|
-
/* @__PURE__ */
|
|
13972
|
-
/* @__PURE__ */
|
|
13973
|
-
/* @__PURE__ */
|
|
14071
|
+
/* @__PURE__ */ jsx157(DrawerTitle, { className: "sr-only", children: titleText }),
|
|
14072
|
+
/* @__PURE__ */ jsx157(DrawerDescription, { className: "sr-only", children: descriptionText }),
|
|
14073
|
+
/* @__PURE__ */ jsx157(
|
|
13974
14074
|
"div",
|
|
13975
14075
|
{
|
|
13976
14076
|
className: cn(
|
|
@@ -13986,7 +14086,7 @@ function SelectMenuPanel({
|
|
|
13986
14086
|
}
|
|
13987
14087
|
);
|
|
13988
14088
|
}
|
|
13989
|
-
return /* @__PURE__ */
|
|
14089
|
+
return /* @__PURE__ */ jsx157(
|
|
13990
14090
|
"div",
|
|
13991
14091
|
{
|
|
13992
14092
|
className: cn(
|
|
@@ -13999,7 +14099,7 @@ function SelectMenuPanel({
|
|
|
13999
14099
|
}
|
|
14000
14100
|
|
|
14001
14101
|
// src/dashboard/_select-internals/SelectSearchInput.tsx
|
|
14002
|
-
import { jsx as
|
|
14102
|
+
import { jsx as jsx158 } from "react/jsx-runtime";
|
|
14003
14103
|
function SelectSearchInput({
|
|
14004
14104
|
inputRef,
|
|
14005
14105
|
value,
|
|
@@ -14009,7 +14109,7 @@ function SelectSearchInput({
|
|
|
14009
14109
|
onChange,
|
|
14010
14110
|
onKeyDown
|
|
14011
14111
|
}) {
|
|
14012
|
-
return /* @__PURE__ */
|
|
14112
|
+
return /* @__PURE__ */ jsx158("div", { className: "border-b border-[#f2f4f8] px-4 pb-2 pt-3", children: /* @__PURE__ */ jsx158(
|
|
14013
14113
|
"input",
|
|
14014
14114
|
{
|
|
14015
14115
|
ref: inputRef,
|
|
@@ -14028,7 +14128,7 @@ function SelectSearchInput({
|
|
|
14028
14128
|
|
|
14029
14129
|
// src/dashboard/_select-internals/SelectTrigger.tsx
|
|
14030
14130
|
import { ChevronDown as ChevronDown4 } from "lucide-react";
|
|
14031
|
-
import { jsx as
|
|
14131
|
+
import { jsx as jsx159, jsxs as jsxs102 } from "react/jsx-runtime";
|
|
14032
14132
|
function SelectTrigger3({
|
|
14033
14133
|
triggerRef,
|
|
14034
14134
|
triggerId,
|
|
@@ -14049,7 +14149,7 @@ function SelectTrigger3({
|
|
|
14049
14149
|
onBlur
|
|
14050
14150
|
}) {
|
|
14051
14151
|
const isEmpty = !hasValue;
|
|
14052
|
-
return /* @__PURE__ */
|
|
14152
|
+
return /* @__PURE__ */ jsxs102(
|
|
14053
14153
|
"button",
|
|
14054
14154
|
{
|
|
14055
14155
|
id: triggerId,
|
|
@@ -14073,10 +14173,10 @@ function SelectTrigger3({
|
|
|
14073
14173
|
loading && "cursor-progress"
|
|
14074
14174
|
),
|
|
14075
14175
|
children: [
|
|
14076
|
-
/* @__PURE__ */
|
|
14077
|
-
/* @__PURE__ */
|
|
14078
|
-
loading && /* @__PURE__ */
|
|
14079
|
-
/* @__PURE__ */
|
|
14176
|
+
/* @__PURE__ */ jsx159("span", { id: valueId, className: "block min-w-0 flex-1 truncate text-left", children: valueLabel ?? (isOpen ? placeholder : null) }),
|
|
14177
|
+
/* @__PURE__ */ jsxs102("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
14178
|
+
loading && /* @__PURE__ */ jsx159(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
14179
|
+
/* @__PURE__ */ jsx159(
|
|
14080
14180
|
ChevronDown4,
|
|
14081
14181
|
{
|
|
14082
14182
|
size: 16,
|
|
@@ -14093,14 +14193,14 @@ function SelectTrigger3({
|
|
|
14093
14193
|
}
|
|
14094
14194
|
|
|
14095
14195
|
// src/dashboard/_select-internals/useSelectIds.ts
|
|
14096
|
-
import * as
|
|
14196
|
+
import * as React56 from "react";
|
|
14097
14197
|
function useSelectIds2({
|
|
14098
14198
|
name,
|
|
14099
14199
|
hasValue,
|
|
14100
14200
|
error,
|
|
14101
14201
|
hideErrorMessage
|
|
14102
14202
|
}) {
|
|
14103
|
-
const reactId =
|
|
14203
|
+
const reactId = React56.useId().replace(/:/g, "");
|
|
14104
14204
|
const baseId = name ? `dash-select-${name}` : `dash-select-${reactId}`;
|
|
14105
14205
|
const triggerId = `${baseId}-trigger`;
|
|
14106
14206
|
const labelId = `${baseId}-label`;
|
|
@@ -14110,7 +14210,7 @@ function useSelectIds2({
|
|
|
14110
14210
|
const listboxId = `${baseId}-listbox`;
|
|
14111
14211
|
const describedErrorId = error && !hideErrorMessage ? errorId : void 0;
|
|
14112
14212
|
const describedBy = [!hasValue ? helperTextId : null, describedErrorId].filter(Boolean).join(" ") || void 0;
|
|
14113
|
-
const getOptionId2 =
|
|
14213
|
+
const getOptionId2 = React56.useCallback(
|
|
14114
14214
|
(index) => `${baseId}-option-${index}`,
|
|
14115
14215
|
[baseId]
|
|
14116
14216
|
);
|
|
@@ -14128,21 +14228,21 @@ function useSelectIds2({
|
|
|
14128
14228
|
}
|
|
14129
14229
|
|
|
14130
14230
|
// src/dashboard/_select-internals/useSelectMenuState.ts
|
|
14131
|
-
import * as
|
|
14231
|
+
import * as React57 from "react";
|
|
14132
14232
|
function useSelectMenuState({
|
|
14133
14233
|
isBlocked,
|
|
14134
14234
|
isMobile: isMobile2,
|
|
14135
14235
|
onOutsideClick
|
|
14136
14236
|
}) {
|
|
14137
|
-
const containerRef =
|
|
14138
|
-
const [isOpen, setIsOpen] =
|
|
14139
|
-
const openMenu =
|
|
14237
|
+
const containerRef = React57.useRef(null);
|
|
14238
|
+
const [isOpen, setIsOpen] = React57.useState(false);
|
|
14239
|
+
const openMenu = React57.useCallback(() => {
|
|
14140
14240
|
setIsOpen(true);
|
|
14141
14241
|
}, []);
|
|
14142
|
-
const closeMenu =
|
|
14242
|
+
const closeMenu = React57.useCallback(() => {
|
|
14143
14243
|
setIsOpen(false);
|
|
14144
14244
|
}, []);
|
|
14145
|
-
const toggleMenu =
|
|
14245
|
+
const toggleMenu = React57.useCallback(() => {
|
|
14146
14246
|
if (isBlocked) return;
|
|
14147
14247
|
setIsOpen((prev) => !prev);
|
|
14148
14248
|
}, [isBlocked]);
|
|
@@ -14154,30 +14254,30 @@ function useSelectMenuState({
|
|
|
14154
14254
|
},
|
|
14155
14255
|
isDisabled: !isOpen || isMobile2
|
|
14156
14256
|
});
|
|
14157
|
-
|
|
14257
|
+
React57.useEffect(() => {
|
|
14158
14258
|
if (isBlocked) setIsOpen(false);
|
|
14159
14259
|
}, [isBlocked]);
|
|
14160
14260
|
return { containerRef, isOpen, openMenu, closeMenu, toggleMenu, setIsOpen };
|
|
14161
14261
|
}
|
|
14162
14262
|
|
|
14163
14263
|
// src/dashboard/_select-internals/useSelectSearch.ts
|
|
14164
|
-
import * as
|
|
14264
|
+
import * as React58 from "react";
|
|
14165
14265
|
function useSelectSearch({
|
|
14166
14266
|
options,
|
|
14167
14267
|
searchable = true,
|
|
14168
14268
|
filterOption = defaultFilterOption
|
|
14169
14269
|
}) {
|
|
14170
|
-
const [searchValue, setSearchValue] =
|
|
14171
|
-
const filteredOptions =
|
|
14270
|
+
const [searchValue, setSearchValue] = React58.useState("");
|
|
14271
|
+
const filteredOptions = React58.useMemo(() => {
|
|
14172
14272
|
if (!searchable || !searchValue) return options;
|
|
14173
14273
|
return options.filter((option) => filterOption(option, searchValue));
|
|
14174
14274
|
}, [options, searchable, searchValue, filterOption]);
|
|
14175
|
-
const clearSearch =
|
|
14275
|
+
const clearSearch = React58.useCallback(() => setSearchValue(""), []);
|
|
14176
14276
|
return { searchValue, setSearchValue, filteredOptions, clearSearch };
|
|
14177
14277
|
}
|
|
14178
14278
|
|
|
14179
14279
|
// src/dashboard/select/Select.tsx
|
|
14180
|
-
import { jsx as
|
|
14280
|
+
import { jsx as jsx160, jsxs as jsxs103 } from "react/jsx-runtime";
|
|
14181
14281
|
function DashboardSelectInternal({
|
|
14182
14282
|
options = [],
|
|
14183
14283
|
value,
|
|
@@ -14206,11 +14306,11 @@ function DashboardSelectInternal({
|
|
|
14206
14306
|
filterOption,
|
|
14207
14307
|
helperText
|
|
14208
14308
|
}, ref) {
|
|
14209
|
-
const triggerRef =
|
|
14210
|
-
const searchInputRef =
|
|
14211
|
-
const listRef =
|
|
14212
|
-
const optionRefs =
|
|
14213
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
14309
|
+
const triggerRef = React59.useRef(null);
|
|
14310
|
+
const searchInputRef = React59.useRef(null);
|
|
14311
|
+
const listRef = React59.useRef(null);
|
|
14312
|
+
const optionRefs = React59.useRef([]);
|
|
14313
|
+
const [highlightedIndex, setHighlightedIndex] = React59.useState(-1);
|
|
14214
14314
|
const isMobile2 = useIsMobile();
|
|
14215
14315
|
const { t } = useTranslation30();
|
|
14216
14316
|
const resolvedSearchPlaceholder = searchPlaceholder ?? t("search_placeholder");
|
|
@@ -14230,8 +14330,8 @@ function DashboardSelectInternal({
|
|
|
14230
14330
|
searchable,
|
|
14231
14331
|
filterOption
|
|
14232
14332
|
});
|
|
14233
|
-
|
|
14234
|
-
|
|
14333
|
+
React59.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
14334
|
+
React59.useEffect(() => {
|
|
14235
14335
|
if (!isOpen) {
|
|
14236
14336
|
setSearchValue("");
|
|
14237
14337
|
setHighlightedIndex(-1);
|
|
@@ -14246,11 +14346,11 @@ function DashboardSelectInternal({
|
|
|
14246
14346
|
return () => window.cancelAnimationFrame(frame);
|
|
14247
14347
|
}
|
|
14248
14348
|
}, [isOpen, filteredOptions, searchable, value, setSearchValue]);
|
|
14249
|
-
|
|
14349
|
+
React59.useEffect(() => {
|
|
14250
14350
|
if (!isOpen || highlightedIndex < 0) return;
|
|
14251
14351
|
optionRefs.current[highlightedIndex]?.scrollIntoView({ block: "nearest" });
|
|
14252
14352
|
}, [highlightedIndex, isOpen]);
|
|
14253
|
-
|
|
14353
|
+
React59.useEffect(
|
|
14254
14354
|
function setCorrectOptionIfThereIsOnlyValue() {
|
|
14255
14355
|
if (value?.value === void 0 || value.value === null || value.label !== "")
|
|
14256
14356
|
return;
|
|
@@ -14301,7 +14401,7 @@ function DashboardSelectInternal({
|
|
|
14301
14401
|
setIsOpen(false);
|
|
14302
14402
|
}
|
|
14303
14403
|
};
|
|
14304
|
-
return /* @__PURE__ */
|
|
14404
|
+
return /* @__PURE__ */ jsxs103(
|
|
14305
14405
|
SelectFieldShell,
|
|
14306
14406
|
{
|
|
14307
14407
|
containerRef,
|
|
@@ -14319,7 +14419,7 @@ function DashboardSelectInternal({
|
|
|
14319
14419
|
name,
|
|
14320
14420
|
hiddenValue: value ? String(value.value) : "",
|
|
14321
14421
|
children: [
|
|
14322
|
-
/* @__PURE__ */
|
|
14422
|
+
/* @__PURE__ */ jsx160(
|
|
14323
14423
|
SelectTrigger3,
|
|
14324
14424
|
{
|
|
14325
14425
|
triggerRef,
|
|
@@ -14341,7 +14441,7 @@ function DashboardSelectInternal({
|
|
|
14341
14441
|
onBlur
|
|
14342
14442
|
}
|
|
14343
14443
|
),
|
|
14344
|
-
/* @__PURE__ */
|
|
14444
|
+
/* @__PURE__ */ jsx160(
|
|
14345
14445
|
Fieldset,
|
|
14346
14446
|
{
|
|
14347
14447
|
isFocused: isOpen,
|
|
@@ -14358,7 +14458,7 @@ function DashboardSelectInternal({
|
|
|
14358
14458
|
onClick: !isBlocked ? toggleMenu : void 0
|
|
14359
14459
|
}
|
|
14360
14460
|
),
|
|
14361
|
-
/* @__PURE__ */
|
|
14461
|
+
/* @__PURE__ */ jsxs103(
|
|
14362
14462
|
SelectMenuPanel,
|
|
14363
14463
|
{
|
|
14364
14464
|
isOpen,
|
|
@@ -14368,7 +14468,7 @@ function DashboardSelectInternal({
|
|
|
14368
14468
|
className: dropdownClassName,
|
|
14369
14469
|
drawerClassName,
|
|
14370
14470
|
children: [
|
|
14371
|
-
searchable && /* @__PURE__ */
|
|
14471
|
+
searchable && /* @__PURE__ */ jsx160(
|
|
14372
14472
|
SelectSearchInput,
|
|
14373
14473
|
{
|
|
14374
14474
|
inputRef: searchInputRef,
|
|
@@ -14380,7 +14480,7 @@ function DashboardSelectInternal({
|
|
|
14380
14480
|
onKeyDown: handleSearchKeyDown
|
|
14381
14481
|
}
|
|
14382
14482
|
),
|
|
14383
|
-
/* @__PURE__ */
|
|
14483
|
+
/* @__PURE__ */ jsx160(
|
|
14384
14484
|
SelectMenu,
|
|
14385
14485
|
{
|
|
14386
14486
|
id: listboxId,
|
|
@@ -14408,19 +14508,19 @@ function DashboardSelectInternal({
|
|
|
14408
14508
|
}
|
|
14409
14509
|
);
|
|
14410
14510
|
}
|
|
14411
|
-
var DashboardSelect =
|
|
14511
|
+
var DashboardSelect = React59.forwardRef(
|
|
14412
14512
|
DashboardSelectInternal
|
|
14413
14513
|
);
|
|
14414
14514
|
|
|
14415
14515
|
// src/dashboard/multi-select/MultiSelect.tsx
|
|
14416
|
-
import * as
|
|
14516
|
+
import * as React60 from "react";
|
|
14417
14517
|
import { SquareX as SquareX3 } from "lucide-react";
|
|
14418
14518
|
import { useTranslation as useTranslation32 } from "react-i18next";
|
|
14419
14519
|
|
|
14420
14520
|
// src/dashboard/multi-select/MultiSelectChip.tsx
|
|
14421
14521
|
import { SquareX as SquareX2 } from "lucide-react";
|
|
14422
14522
|
import { useTranslation as useTranslation31 } from "react-i18next";
|
|
14423
|
-
import { jsx as
|
|
14523
|
+
import { jsx as jsx161, jsxs as jsxs104 } from "react/jsx-runtime";
|
|
14424
14524
|
function MultiSelectChip({
|
|
14425
14525
|
option,
|
|
14426
14526
|
readOnly,
|
|
@@ -14428,9 +14528,9 @@ function MultiSelectChip({
|
|
|
14428
14528
|
}) {
|
|
14429
14529
|
const { t } = useTranslation31();
|
|
14430
14530
|
const labelText = typeof option.label === "string" ? option.label : String(option.value);
|
|
14431
|
-
return /* @__PURE__ */
|
|
14432
|
-
/* @__PURE__ */
|
|
14433
|
-
!readOnly && /* @__PURE__ */
|
|
14531
|
+
return /* @__PURE__ */ jsxs104("span", { className: "inline-flex items-center gap-2 rounded-[4px] border border-[#acacd5] bg-[#f0f0f8] py-[2px] pl-[10px] pr-1 text-[12px] font-medium text-[var(--chekin-color-brand-navy)]", children: [
|
|
14532
|
+
/* @__PURE__ */ jsx161("span", { className: "whitespace-nowrap", children: option.label }),
|
|
14533
|
+
!readOnly && /* @__PURE__ */ jsx161(
|
|
14434
14534
|
"button",
|
|
14435
14535
|
{
|
|
14436
14536
|
type: "button",
|
|
@@ -14440,14 +14540,14 @@ function MultiSelectChip({
|
|
|
14440
14540
|
},
|
|
14441
14541
|
className: "flex h-[15px] w-[15px] items-center justify-center rounded-[3px] border-0 bg-transparent p-0 text-[#9696b9] hover:shadow-[0_3px_3px_#0f477734]",
|
|
14442
14542
|
"aria-label": t("remove_item", { label: labelText }),
|
|
14443
|
-
children: /* @__PURE__ */
|
|
14543
|
+
children: /* @__PURE__ */ jsx161(SquareX2, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
14444
14544
|
}
|
|
14445
14545
|
)
|
|
14446
14546
|
] });
|
|
14447
14547
|
}
|
|
14448
14548
|
|
|
14449
14549
|
// src/dashboard/multi-select/MultiSelect.tsx
|
|
14450
|
-
import { jsx as
|
|
14550
|
+
import { jsx as jsx162, jsxs as jsxs105 } from "react/jsx-runtime";
|
|
14451
14551
|
var isValueSelected = (selected, option) => selected.some((item) => item.value === option.value);
|
|
14452
14552
|
function DashboardMultiSelectInternal({
|
|
14453
14553
|
options = [],
|
|
@@ -14481,15 +14581,15 @@ function DashboardMultiSelectInternal({
|
|
|
14481
14581
|
formatCreateLabel = (input) => `Create "${input}"`,
|
|
14482
14582
|
isValidNewOption
|
|
14483
14583
|
}, ref) {
|
|
14484
|
-
const inputRef =
|
|
14485
|
-
const mobileSearchInputRef =
|
|
14486
|
-
const listRef =
|
|
14487
|
-
const optionRefs =
|
|
14488
|
-
const [isFocused, setIsFocused] =
|
|
14489
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
14584
|
+
const inputRef = React60.useRef(null);
|
|
14585
|
+
const mobileSearchInputRef = React60.useRef(null);
|
|
14586
|
+
const listRef = React60.useRef(null);
|
|
14587
|
+
const optionRefs = React60.useRef([]);
|
|
14588
|
+
const [isFocused, setIsFocused] = React60.useState(false);
|
|
14589
|
+
const [highlightedIndex, setHighlightedIndex] = React60.useState(-1);
|
|
14490
14590
|
const isMobile2 = useIsMobile();
|
|
14491
14591
|
const { t } = useTranslation32();
|
|
14492
|
-
const selectedValues =
|
|
14592
|
+
const selectedValues = React60.useMemo(() => value ?? [], [value]);
|
|
14493
14593
|
const hasValue = selectedValues.length > 0;
|
|
14494
14594
|
const isEmpty = !hasValue;
|
|
14495
14595
|
const isBlocked = Boolean(disabled) || Boolean(loading) || Boolean(readOnly);
|
|
@@ -14507,7 +14607,7 @@ function DashboardMultiSelectInternal({
|
|
|
14507
14607
|
filterOption
|
|
14508
14608
|
});
|
|
14509
14609
|
const trimmedSearch = searchValue.trim();
|
|
14510
|
-
const canCreateNewOption =
|
|
14610
|
+
const canCreateNewOption = React60.useMemo(() => {
|
|
14511
14611
|
if (!isCreatable || !trimmedSearch) return false;
|
|
14512
14612
|
if (isValidNewOption) return isValidNewOption(trimmedSearch, selectedValues, options);
|
|
14513
14613
|
const lower = trimmedSearch.toLowerCase();
|
|
@@ -14519,17 +14619,17 @@ function DashboardMultiSelectInternal({
|
|
|
14519
14619
|
);
|
|
14520
14620
|
return !existsInOptions && !existsInSelected;
|
|
14521
14621
|
}, [isCreatable, trimmedSearch, isValidNewOption, options, selectedValues]);
|
|
14522
|
-
|
|
14622
|
+
React60.useImperativeHandle(
|
|
14523
14623
|
ref,
|
|
14524
14624
|
() => containerRef.current
|
|
14525
14625
|
);
|
|
14526
|
-
|
|
14626
|
+
React60.useEffect(() => {
|
|
14527
14627
|
if (!isOpen) {
|
|
14528
14628
|
clearSearch();
|
|
14529
14629
|
setHighlightedIndex(-1);
|
|
14530
14630
|
}
|
|
14531
14631
|
}, [isOpen, clearSearch]);
|
|
14532
|
-
|
|
14632
|
+
React60.useEffect(() => {
|
|
14533
14633
|
if (!isOpen || filteredOptions.length === 0) {
|
|
14534
14634
|
setHighlightedIndex(-1);
|
|
14535
14635
|
return;
|
|
@@ -14539,7 +14639,7 @@ function DashboardMultiSelectInternal({
|
|
|
14539
14639
|
return getFirstEnabledOptionIndex2(filteredOptions);
|
|
14540
14640
|
});
|
|
14541
14641
|
}, [isOpen, filteredOptions]);
|
|
14542
|
-
|
|
14642
|
+
React60.useEffect(() => {
|
|
14543
14643
|
if (!isOpen || !isMobile2) return;
|
|
14544
14644
|
const frame = window.requestAnimationFrame(
|
|
14545
14645
|
() => mobileSearchInputRef.current?.focus()
|
|
@@ -14573,7 +14673,7 @@ function DashboardMultiSelectInternal({
|
|
|
14573
14673
|
onChange([]);
|
|
14574
14674
|
inputRef.current?.focus();
|
|
14575
14675
|
};
|
|
14576
|
-
const createOption =
|
|
14676
|
+
const createOption = React60.useCallback(() => {
|
|
14577
14677
|
if (!canCreateNewOption) return;
|
|
14578
14678
|
const newOption = onCreateOption?.(trimmedSearch) ?? { value: trimmedSearch, label: trimmedSearch };
|
|
14579
14679
|
onChange([...selectedValues, newOption]);
|
|
@@ -14642,7 +14742,7 @@ function DashboardMultiSelectInternal({
|
|
|
14642
14742
|
setIsFocused(false);
|
|
14643
14743
|
onBlur?.(event);
|
|
14644
14744
|
};
|
|
14645
|
-
return /* @__PURE__ */
|
|
14745
|
+
return /* @__PURE__ */ jsxs105(
|
|
14646
14746
|
SelectFieldShell,
|
|
14647
14747
|
{
|
|
14648
14748
|
containerRef,
|
|
@@ -14661,7 +14761,7 @@ function DashboardMultiSelectInternal({
|
|
|
14661
14761
|
hiddenValue: selectedValues.map((item) => String(item.value)).join(","),
|
|
14662
14762
|
onBlur: handleInputBlur,
|
|
14663
14763
|
children: [
|
|
14664
|
-
/* @__PURE__ */
|
|
14764
|
+
/* @__PURE__ */ jsxs105(
|
|
14665
14765
|
"div",
|
|
14666
14766
|
{
|
|
14667
14767
|
id: triggerId,
|
|
@@ -14684,7 +14784,7 @@ function DashboardMultiSelectInternal({
|
|
|
14684
14784
|
),
|
|
14685
14785
|
children: [
|
|
14686
14786
|
selectedValues.map(
|
|
14687
|
-
(option) => renderChip ? /* @__PURE__ */
|
|
14787
|
+
(option) => renderChip ? /* @__PURE__ */ jsx162(React60.Fragment, { children: renderChip(option, () => removeOption(option)) }, String(option.value)) : /* @__PURE__ */ jsx162(
|
|
14688
14788
|
MultiSelectChip,
|
|
14689
14789
|
{
|
|
14690
14790
|
option,
|
|
@@ -14694,7 +14794,7 @@ function DashboardMultiSelectInternal({
|
|
|
14694
14794
|
String(option.value)
|
|
14695
14795
|
)
|
|
14696
14796
|
),
|
|
14697
|
-
/* @__PURE__ */
|
|
14797
|
+
/* @__PURE__ */ jsx162(
|
|
14698
14798
|
"input",
|
|
14699
14799
|
{
|
|
14700
14800
|
ref: inputRef,
|
|
@@ -14723,9 +14823,9 @@ function DashboardMultiSelectInternal({
|
|
|
14723
14823
|
"aria-activedescendant": isOpen && highlightedIndex >= 0 ? getOptionId2(highlightedIndex) : void 0
|
|
14724
14824
|
}
|
|
14725
14825
|
),
|
|
14726
|
-
/* @__PURE__ */
|
|
14727
|
-
loading && /* @__PURE__ */
|
|
14728
|
-
hasValue && !readOnly && /* @__PURE__ */
|
|
14826
|
+
/* @__PURE__ */ jsxs105("span", { className: "ml-auto flex items-center gap-2 pl-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
14827
|
+
loading && /* @__PURE__ */ jsx162(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
14828
|
+
hasValue && !readOnly && /* @__PURE__ */ jsx162(
|
|
14729
14829
|
"button",
|
|
14730
14830
|
{
|
|
14731
14831
|
type: "button",
|
|
@@ -14735,10 +14835,10 @@ function DashboardMultiSelectInternal({
|
|
|
14735
14835
|
},
|
|
14736
14836
|
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]",
|
|
14737
14837
|
"aria-label": t("clear_all"),
|
|
14738
|
-
children: /* @__PURE__ */
|
|
14838
|
+
children: /* @__PURE__ */ jsx162(SquareX3, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
14739
14839
|
}
|
|
14740
14840
|
),
|
|
14741
|
-
/* @__PURE__ */
|
|
14841
|
+
/* @__PURE__ */ jsx162(
|
|
14742
14842
|
RotateArrow,
|
|
14743
14843
|
{
|
|
14744
14844
|
shouldRotate: isOpen,
|
|
@@ -14751,7 +14851,7 @@ function DashboardMultiSelectInternal({
|
|
|
14751
14851
|
]
|
|
14752
14852
|
}
|
|
14753
14853
|
),
|
|
14754
|
-
/* @__PURE__ */
|
|
14854
|
+
/* @__PURE__ */ jsx162(
|
|
14755
14855
|
Fieldset,
|
|
14756
14856
|
{
|
|
14757
14857
|
isFocused: isFocused || isOpen,
|
|
@@ -14769,7 +14869,7 @@ function DashboardMultiSelectInternal({
|
|
|
14769
14869
|
onClick: handleContainerClick
|
|
14770
14870
|
}
|
|
14771
14871
|
),
|
|
14772
|
-
/* @__PURE__ */
|
|
14872
|
+
/* @__PURE__ */ jsxs105(
|
|
14773
14873
|
SelectMenuPanel,
|
|
14774
14874
|
{
|
|
14775
14875
|
isOpen,
|
|
@@ -14782,7 +14882,7 @@ function DashboardMultiSelectInternal({
|
|
|
14782
14882
|
className: dropdownClassName,
|
|
14783
14883
|
drawerClassName,
|
|
14784
14884
|
children: [
|
|
14785
|
-
isMobile2 && /* @__PURE__ */
|
|
14885
|
+
isMobile2 && /* @__PURE__ */ jsx162("div", { className: "border-b border-[#f2f4f8] px-4 pb-2 pt-3", children: /* @__PURE__ */ jsx162(
|
|
14786
14886
|
"input",
|
|
14787
14887
|
{
|
|
14788
14888
|
ref: mobileSearchInputRef,
|
|
@@ -14797,7 +14897,7 @@ function DashboardMultiSelectInternal({
|
|
|
14797
14897
|
className: "m-0 box-border h-9 w-full rounded-md border border-[var(--chekin-color-gray-3)] bg-white px-3 text-[16px] font-medium text-[var(--chekin-color-brand-navy)] outline-none transition-colors placeholder:text-[var(--chekin-color-gray-1)] focus:border-[var(--chekin-color-brand-blue)]"
|
|
14798
14898
|
}
|
|
14799
14899
|
) }),
|
|
14800
|
-
/* @__PURE__ */
|
|
14900
|
+
/* @__PURE__ */ jsx162(
|
|
14801
14901
|
SelectMenu,
|
|
14802
14902
|
{
|
|
14803
14903
|
id: listboxId,
|
|
@@ -14819,7 +14919,7 @@ function DashboardMultiSelectInternal({
|
|
|
14819
14919
|
isMulti: true
|
|
14820
14920
|
}
|
|
14821
14921
|
),
|
|
14822
|
-
canCreateNewOption && /* @__PURE__ */
|
|
14922
|
+
canCreateNewOption && /* @__PURE__ */ jsx162(
|
|
14823
14923
|
"button",
|
|
14824
14924
|
{
|
|
14825
14925
|
type: "button",
|
|
@@ -14835,26 +14935,26 @@ function DashboardMultiSelectInternal({
|
|
|
14835
14935
|
}
|
|
14836
14936
|
);
|
|
14837
14937
|
}
|
|
14838
|
-
var DashboardMultiSelect =
|
|
14938
|
+
var DashboardMultiSelect = React60.forwardRef(
|
|
14839
14939
|
DashboardMultiSelectInternal
|
|
14840
14940
|
);
|
|
14841
14941
|
|
|
14842
14942
|
// src/dashboard/creatable-multi-select/CreatableMultiSelect.tsx
|
|
14843
|
-
import * as
|
|
14844
|
-
import { jsx as
|
|
14845
|
-
var DashboardCreatableMultiSelect =
|
|
14943
|
+
import * as React61 from "react";
|
|
14944
|
+
import { jsx as jsx163 } from "react/jsx-runtime";
|
|
14945
|
+
var DashboardCreatableMultiSelect = React61.forwardRef(
|
|
14846
14946
|
function DashboardCreatableMultiSelect2(props, ref) {
|
|
14847
|
-
return /* @__PURE__ */
|
|
14947
|
+
return /* @__PURE__ */ jsx163(DashboardMultiSelect, { ref, ...props, isCreatable: true });
|
|
14848
14948
|
}
|
|
14849
14949
|
);
|
|
14850
14950
|
|
|
14851
14951
|
// src/dashboard/infinite-scroll-select/InfiniteScrollSelect.tsx
|
|
14852
|
-
import * as
|
|
14952
|
+
import * as React62 from "react";
|
|
14853
14953
|
import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
|
|
14854
14954
|
import { useTranslation as useTranslation33 } from "react-i18next";
|
|
14855
14955
|
|
|
14856
14956
|
// src/dashboard/infinite-scroll-select/InfiniteScrollList.tsx
|
|
14857
|
-
import { jsx as
|
|
14957
|
+
import { jsx as jsx164, jsxs as jsxs106 } from "react/jsx-runtime";
|
|
14858
14958
|
function InfiniteScrollList({
|
|
14859
14959
|
scrollRef,
|
|
14860
14960
|
listboxId,
|
|
@@ -14875,13 +14975,13 @@ function InfiniteScrollList({
|
|
|
14875
14975
|
onHighlight
|
|
14876
14976
|
}) {
|
|
14877
14977
|
const virtualItems = virtualizer.getVirtualItems();
|
|
14878
|
-
return /* @__PURE__ */
|
|
14978
|
+
return /* @__PURE__ */ jsx164(
|
|
14879
14979
|
"div",
|
|
14880
14980
|
{
|
|
14881
14981
|
ref: scrollRef,
|
|
14882
14982
|
className: cn("overflow-y-auto", menuClassName),
|
|
14883
14983
|
style: { height: `${height}px` },
|
|
14884
|
-
children: /* @__PURE__ */
|
|
14984
|
+
children: /* @__PURE__ */ jsx164(
|
|
14885
14985
|
"div",
|
|
14886
14986
|
{
|
|
14887
14987
|
id: listboxId,
|
|
@@ -14898,7 +14998,7 @@ function InfiniteScrollList({
|
|
|
14898
14998
|
const isSelected = !isLoaderRow && option ? option.value === value?.value : false;
|
|
14899
14999
|
const isHighlighted = virtualItem.index === highlightedIndex;
|
|
14900
15000
|
const isOptionDisabled = Boolean(isBlocked || option?.isDisabled);
|
|
14901
|
-
return /* @__PURE__ */
|
|
15001
|
+
return /* @__PURE__ */ jsx164(
|
|
14902
15002
|
"div",
|
|
14903
15003
|
{
|
|
14904
15004
|
"data-index": virtualItem.index,
|
|
@@ -14907,10 +15007,10 @@ function InfiniteScrollList({
|
|
|
14907
15007
|
height: `${virtualItem.size}px`,
|
|
14908
15008
|
transform: `translateY(${virtualItem.start}px)`
|
|
14909
15009
|
},
|
|
14910
|
-
children: isLoaderRow ? /* @__PURE__ */
|
|
14911
|
-
/* @__PURE__ */
|
|
14912
|
-
/* @__PURE__ */
|
|
14913
|
-
] }) : /* @__PURE__ */
|
|
15010
|
+
children: isLoaderRow ? /* @__PURE__ */ jsxs106("div", { className: "flex h-full items-center justify-center gap-2 px-4 text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: [
|
|
15011
|
+
/* @__PURE__ */ jsx164(ThreeDotsLoader, { height: 36, width: 36 }),
|
|
15012
|
+
/* @__PURE__ */ jsx164("span", { children: loadingMoreText })
|
|
15013
|
+
] }) : /* @__PURE__ */ jsxs106(
|
|
14914
15014
|
"button",
|
|
14915
15015
|
{
|
|
14916
15016
|
id: getOptionId2(virtualItem.index),
|
|
@@ -14929,8 +15029,8 @@ function InfiniteScrollList({
|
|
|
14929
15029
|
isOptionDisabled && "cursor-default opacity-30"
|
|
14930
15030
|
),
|
|
14931
15031
|
children: [
|
|
14932
|
-
/* @__PURE__ */
|
|
14933
|
-
option?.description && /* @__PURE__ */
|
|
15032
|
+
/* @__PURE__ */ jsx164("span", { className: "block break-words", children: option?.label }),
|
|
15033
|
+
option?.description && /* @__PURE__ */ jsx164("span", { className: "ml-2 mt-[3px] shrink-0 text-[12px] font-bold italic text-[#777e91]", children: option.description })
|
|
14934
15034
|
]
|
|
14935
15035
|
}
|
|
14936
15036
|
)
|
|
@@ -14945,7 +15045,7 @@ function InfiniteScrollList({
|
|
|
14945
15045
|
}
|
|
14946
15046
|
|
|
14947
15047
|
// src/dashboard/infinite-scroll-select/InfiniteScrollSelect.tsx
|
|
14948
|
-
import { jsx as
|
|
15048
|
+
import { jsx as jsx165, jsxs as jsxs107 } from "react/jsx-runtime";
|
|
14949
15049
|
var DEFAULT_ITEM_HEIGHT = 60;
|
|
14950
15050
|
var DEFAULT_LIST_HEIGHT = 322;
|
|
14951
15051
|
var DEFAULT_OVERSCAN = 5;
|
|
@@ -14987,12 +15087,12 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
14987
15087
|
overscan = DEFAULT_OVERSCAN,
|
|
14988
15088
|
loadMoreThreshold = DEFAULT_LOAD_MORE_THRESHOLD
|
|
14989
15089
|
}, ref) {
|
|
14990
|
-
const triggerRef =
|
|
14991
|
-
const searchInputRef =
|
|
14992
|
-
const scrollRef =
|
|
14993
|
-
const previousHighlightedIndexRef =
|
|
14994
|
-
const lastLoadMoreOptionsLengthRef =
|
|
14995
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
15090
|
+
const triggerRef = React62.useRef(null);
|
|
15091
|
+
const searchInputRef = React62.useRef(null);
|
|
15092
|
+
const scrollRef = React62.useRef(null);
|
|
15093
|
+
const previousHighlightedIndexRef = React62.useRef(-1);
|
|
15094
|
+
const lastLoadMoreOptionsLengthRef = React62.useRef(null);
|
|
15095
|
+
const [highlightedIndex, setHighlightedIndex] = React62.useState(-1);
|
|
14996
15096
|
const isMobile2 = useIsMobile();
|
|
14997
15097
|
const { t } = useTranslation33();
|
|
14998
15098
|
const resolvedSearchPlaceholder = searchPlaceholder ?? t("search_placeholder");
|
|
@@ -15020,15 +15120,15 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
15020
15120
|
estimateSize: () => itemHeight,
|
|
15021
15121
|
overscan
|
|
15022
15122
|
});
|
|
15023
|
-
|
|
15024
|
-
|
|
15123
|
+
React62.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
15124
|
+
React62.useEffect(() => {
|
|
15025
15125
|
if (isOpen) return;
|
|
15026
15126
|
setSearchValue("");
|
|
15027
15127
|
setHighlightedIndex(-1);
|
|
15028
15128
|
previousHighlightedIndexRef.current = -1;
|
|
15029
15129
|
lastLoadMoreOptionsLengthRef.current = null;
|
|
15030
15130
|
}, [isOpen, setSearchValue]);
|
|
15031
|
-
|
|
15131
|
+
React62.useEffect(() => {
|
|
15032
15132
|
if (!isOpen) return;
|
|
15033
15133
|
setHighlightedIndex((current) => {
|
|
15034
15134
|
const option = current >= 0 ? filteredOptions[current] : void 0;
|
|
@@ -15037,13 +15137,13 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
15037
15137
|
return selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex2(filteredOptions);
|
|
15038
15138
|
});
|
|
15039
15139
|
}, [isOpen, filteredOptions, value]);
|
|
15040
|
-
|
|
15140
|
+
React62.useEffect(() => {
|
|
15041
15141
|
if (!isOpen || !searchable) return;
|
|
15042
15142
|
const frame = window.requestAnimationFrame(() => searchInputRef.current?.focus());
|
|
15043
15143
|
return () => window.cancelAnimationFrame(frame);
|
|
15044
15144
|
}, [isOpen, searchable]);
|
|
15045
15145
|
const virtualItems = virtualizer.getVirtualItems();
|
|
15046
|
-
|
|
15146
|
+
React62.useEffect(() => {
|
|
15047
15147
|
if (!isOpen || !canLoadMore || isLoadingMore || !loadMoreItems) return;
|
|
15048
15148
|
if (virtualItems.length === 0) return;
|
|
15049
15149
|
const lastItem = virtualItems[virtualItems.length - 1];
|
|
@@ -15060,7 +15160,7 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
15060
15160
|
loadMoreThreshold,
|
|
15061
15161
|
virtualItems
|
|
15062
15162
|
]);
|
|
15063
|
-
|
|
15163
|
+
React62.useEffect(() => {
|
|
15064
15164
|
const changed = previousHighlightedIndexRef.current !== highlightedIndex;
|
|
15065
15165
|
previousHighlightedIndexRef.current = highlightedIndex;
|
|
15066
15166
|
if (!isOpen || highlightedIndex < 0 || !changed) return;
|
|
@@ -15118,7 +15218,7 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
15118
15218
|
const totalSize = virtualizer.getTotalSize();
|
|
15119
15219
|
const measuredListHeight = Math.min(listHeight, Math.max(totalSize, itemHeight));
|
|
15120
15220
|
const activeOptionId = highlightedIndex >= 0 ? getOptionId2(highlightedIndex) : void 0;
|
|
15121
|
-
return /* @__PURE__ */
|
|
15221
|
+
return /* @__PURE__ */ jsxs107(
|
|
15122
15222
|
SelectFieldShell,
|
|
15123
15223
|
{
|
|
15124
15224
|
containerRef,
|
|
@@ -15136,7 +15236,7 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
15136
15236
|
name,
|
|
15137
15237
|
hiddenValue: value ? String(value.value) : "",
|
|
15138
15238
|
children: [
|
|
15139
|
-
/* @__PURE__ */
|
|
15239
|
+
/* @__PURE__ */ jsx165(
|
|
15140
15240
|
SelectTrigger3,
|
|
15141
15241
|
{
|
|
15142
15242
|
triggerRef,
|
|
@@ -15158,7 +15258,7 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
15158
15258
|
onBlur
|
|
15159
15259
|
}
|
|
15160
15260
|
),
|
|
15161
|
-
/* @__PURE__ */
|
|
15261
|
+
/* @__PURE__ */ jsx165(
|
|
15162
15262
|
Fieldset,
|
|
15163
15263
|
{
|
|
15164
15264
|
isFocused: isOpen,
|
|
@@ -15175,7 +15275,7 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
15175
15275
|
onClick: !isBlocked ? toggleMenu : void 0
|
|
15176
15276
|
}
|
|
15177
15277
|
),
|
|
15178
|
-
/* @__PURE__ */
|
|
15278
|
+
/* @__PURE__ */ jsxs107(
|
|
15179
15279
|
SelectMenuPanel,
|
|
15180
15280
|
{
|
|
15181
15281
|
isOpen,
|
|
@@ -15185,7 +15285,7 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
15185
15285
|
className: dropdownClassName,
|
|
15186
15286
|
drawerClassName,
|
|
15187
15287
|
children: [
|
|
15188
|
-
searchable && /* @__PURE__ */
|
|
15288
|
+
searchable && /* @__PURE__ */ jsx165(
|
|
15189
15289
|
SelectSearchInput,
|
|
15190
15290
|
{
|
|
15191
15291
|
inputRef: searchInputRef,
|
|
@@ -15197,10 +15297,10 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
15197
15297
|
onKeyDown: handleSearchKeyDown
|
|
15198
15298
|
}
|
|
15199
15299
|
),
|
|
15200
|
-
filteredOptions.length === 0 && isLoadingMore ? /* @__PURE__ */
|
|
15201
|
-
/* @__PURE__ */
|
|
15202
|
-
/* @__PURE__ */
|
|
15203
|
-
] }) : filteredOptions.length === 0 ? /* @__PURE__ */
|
|
15300
|
+
filteredOptions.length === 0 && isLoadingMore ? /* @__PURE__ */ jsxs107("div", { className: "flex items-center justify-center gap-2 px-4 py-[20px] text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: [
|
|
15301
|
+
/* @__PURE__ */ jsx165(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
15302
|
+
/* @__PURE__ */ jsx165("span", { children: resolvedLoadingMoreText })
|
|
15303
|
+
] }) : filteredOptions.length === 0 ? /* @__PURE__ */ jsx165("div", { className: "px-4 py-[20px] text-left text-[16px] text-[var(--chekin-color-brand-navy)]", children: emptyMessage ?? t("no_options") }) : /* @__PURE__ */ jsx165(
|
|
15204
15304
|
InfiniteScrollList,
|
|
15205
15305
|
{
|
|
15206
15306
|
scrollRef,
|
|
@@ -15229,14 +15329,14 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
15229
15329
|
}
|
|
15230
15330
|
);
|
|
15231
15331
|
}
|
|
15232
|
-
var DashboardInfiniteScrollSelect =
|
|
15332
|
+
var DashboardInfiniteScrollSelect = React62.forwardRef(
|
|
15233
15333
|
DashboardInfiniteScrollSelectInternal
|
|
15234
15334
|
);
|
|
15235
15335
|
|
|
15236
15336
|
// src/dashboard/textarea/Textarea.tsx
|
|
15237
|
-
import * as
|
|
15337
|
+
import * as React63 from "react";
|
|
15238
15338
|
import { useTranslation as useTranslation34 } from "react-i18next";
|
|
15239
|
-
import { jsx as
|
|
15339
|
+
import { jsx as jsx166, jsxs as jsxs108 } from "react/jsx-runtime";
|
|
15240
15340
|
var LINE_HEIGHT = 20;
|
|
15241
15341
|
var VERTICAL_PADDING = 32;
|
|
15242
15342
|
function getEmptyState(empty, value, defaultValue) {
|
|
@@ -15244,7 +15344,7 @@ function getEmptyState(empty, value, defaultValue) {
|
|
|
15244
15344
|
if (value !== void 0) return !String(value);
|
|
15245
15345
|
return !defaultValue;
|
|
15246
15346
|
}
|
|
15247
|
-
var DashboardTextarea =
|
|
15347
|
+
var DashboardTextarea = React63.forwardRef(
|
|
15248
15348
|
function DashboardTextarea2({
|
|
15249
15349
|
className,
|
|
15250
15350
|
textareaClassName,
|
|
@@ -15268,15 +15368,15 @@ var DashboardTextarea = React62.forwardRef(
|
|
|
15268
15368
|
onInput,
|
|
15269
15369
|
...textareaProps
|
|
15270
15370
|
}, ref) {
|
|
15271
|
-
const innerRef =
|
|
15371
|
+
const innerRef = React63.useRef(null);
|
|
15272
15372
|
const combinedRef = useCombinedRef(ref, innerRef);
|
|
15273
|
-
const reactId =
|
|
15373
|
+
const reactId = React63.useId();
|
|
15274
15374
|
const textareaId = id ?? name ?? `dash-textarea-${reactId}`;
|
|
15275
15375
|
const { t } = useTranslation34();
|
|
15276
15376
|
const isInvalid = Boolean(invalid || error);
|
|
15277
15377
|
const isEmpty = getEmptyState(empty, value, defaultValue);
|
|
15278
15378
|
const isBlocked = Boolean(disabled);
|
|
15279
|
-
const resize =
|
|
15379
|
+
const resize = React63.useCallback(() => {
|
|
15280
15380
|
const el = innerRef.current;
|
|
15281
15381
|
if (!el || !autosize) return;
|
|
15282
15382
|
el.style.height = "auto";
|
|
@@ -15286,14 +15386,14 @@ var DashboardTextarea = React62.forwardRef(
|
|
|
15286
15386
|
el.style.height = `${nextHeight}px`;
|
|
15287
15387
|
el.style.overflowY = el.scrollHeight > nextHeight ? "auto" : "hidden";
|
|
15288
15388
|
}, [autosize, maxRows, minRows]);
|
|
15289
|
-
|
|
15389
|
+
React63.useLayoutEffect(() => {
|
|
15290
15390
|
resize();
|
|
15291
15391
|
}, [resize, value]);
|
|
15292
15392
|
const handleInput = (event) => {
|
|
15293
15393
|
resize();
|
|
15294
15394
|
onInput?.(event);
|
|
15295
15395
|
};
|
|
15296
|
-
return /* @__PURE__ */
|
|
15396
|
+
return /* @__PURE__ */ jsxs108(
|
|
15297
15397
|
"div",
|
|
15298
15398
|
{
|
|
15299
15399
|
className: cn(
|
|
@@ -15303,18 +15403,18 @@ var DashboardTextarea = React62.forwardRef(
|
|
|
15303
15403
|
className
|
|
15304
15404
|
),
|
|
15305
15405
|
children: [
|
|
15306
|
-
label && /* @__PURE__ */
|
|
15406
|
+
label && /* @__PURE__ */ jsxs108(
|
|
15307
15407
|
"label",
|
|
15308
15408
|
{
|
|
15309
15409
|
htmlFor: textareaId,
|
|
15310
15410
|
className: "mb-2 flex select-none items-center text-[16px] font-medium text-[var(--chekin-color-brand-navy)]",
|
|
15311
15411
|
children: [
|
|
15312
15412
|
label,
|
|
15313
|
-
tooltip && /* @__PURE__ */
|
|
15413
|
+
tooltip && /* @__PURE__ */ jsx166("span", { className: "ml-1 inline-flex", children: /* @__PURE__ */ jsx166(HelpTooltip, { content: tooltip, size: 16 }) })
|
|
15314
15414
|
]
|
|
15315
15415
|
}
|
|
15316
15416
|
),
|
|
15317
|
-
/* @__PURE__ */
|
|
15417
|
+
/* @__PURE__ */ jsx166(
|
|
15318
15418
|
"textarea",
|
|
15319
15419
|
{
|
|
15320
15420
|
ref: combinedRef,
|
|
@@ -15343,7 +15443,7 @@ var DashboardTextarea = React62.forwardRef(
|
|
|
15343
15443
|
...textareaProps
|
|
15344
15444
|
}
|
|
15345
15445
|
),
|
|
15346
|
-
error && /* @__PURE__ */
|
|
15446
|
+
error && /* @__PURE__ */ jsx166(
|
|
15347
15447
|
FieldErrorMessage,
|
|
15348
15448
|
{
|
|
15349
15449
|
id: `${textareaId}-error`,
|
|
@@ -15351,8 +15451,8 @@ var DashboardTextarea = React62.forwardRef(
|
|
|
15351
15451
|
className: "mt-[1px] text-[14px]"
|
|
15352
15452
|
}
|
|
15353
15453
|
),
|
|
15354
|
-
!error && optional && /* @__PURE__ */
|
|
15355
|
-
!error && helperText && /* @__PURE__ */
|
|
15454
|
+
!error && optional && /* @__PURE__ */ jsx166("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
15455
|
+
!error && helperText && /* @__PURE__ */ jsx166("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText })
|
|
15356
15456
|
]
|
|
15357
15457
|
}
|
|
15358
15458
|
);
|
|
@@ -15360,10 +15460,10 @@ var DashboardTextarea = React62.forwardRef(
|
|
|
15360
15460
|
);
|
|
15361
15461
|
|
|
15362
15462
|
// src/dashboard/datepicker/Datepicker.tsx
|
|
15363
|
-
import * as
|
|
15463
|
+
import * as React64 from "react";
|
|
15364
15464
|
import { ChevronDown as ChevronDown5 } from "lucide-react";
|
|
15365
15465
|
import { useTranslation as useTranslation35 } from "react-i18next";
|
|
15366
|
-
import { jsx as
|
|
15466
|
+
import { jsx as jsx167, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
15367
15467
|
var MONTHS_IN_YEAR2 = 12;
|
|
15368
15468
|
var DEFAULT_MIN_DATE2 = new Date(1920, 0, 1);
|
|
15369
15469
|
function getMonthLabels2(locale) {
|
|
@@ -15397,7 +15497,7 @@ function dateFromParts(day, monthIndex, year) {
|
|
|
15397
15497
|
if (!isValidCalendarDate(yearNum, monthIndex, dayNum)) return null;
|
|
15398
15498
|
return new Date(yearNum, monthIndex, dayNum);
|
|
15399
15499
|
}
|
|
15400
|
-
var DashboardDatepicker =
|
|
15500
|
+
var DashboardDatepicker = React64.forwardRef(
|
|
15401
15501
|
function DashboardDatepicker2({
|
|
15402
15502
|
label,
|
|
15403
15503
|
value,
|
|
@@ -15427,14 +15527,14 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15427
15527
|
maxDate,
|
|
15428
15528
|
formatValue
|
|
15429
15529
|
}, ref) {
|
|
15430
|
-
const containerRef =
|
|
15431
|
-
const dayInputRef =
|
|
15432
|
-
const monthInputRef =
|
|
15433
|
-
const monthListRef =
|
|
15434
|
-
const yearInputRef =
|
|
15435
|
-
const mobileTriggerRef =
|
|
15436
|
-
const wheelBaseId =
|
|
15437
|
-
const reactId =
|
|
15530
|
+
const containerRef = React64.useRef(null);
|
|
15531
|
+
const dayInputRef = React64.useRef(null);
|
|
15532
|
+
const monthInputRef = React64.useRef(null);
|
|
15533
|
+
const monthListRef = React64.useRef(null);
|
|
15534
|
+
const yearInputRef = React64.useRef(null);
|
|
15535
|
+
const mobileTriggerRef = React64.useRef(null);
|
|
15536
|
+
const wheelBaseId = React64.useId();
|
|
15537
|
+
const reactId = React64.useId();
|
|
15438
15538
|
const baseId = name ?? `dash-datepicker-${reactId}`;
|
|
15439
15539
|
const dayId = `${baseId}-day`;
|
|
15440
15540
|
const monthId = `${baseId}-month`;
|
|
@@ -15442,51 +15542,51 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15442
15542
|
const labelId = `${baseId}-label`;
|
|
15443
15543
|
const errorId = `${baseId}-error`;
|
|
15444
15544
|
const { t } = useTranslation35();
|
|
15445
|
-
const resolvedMonthLabels =
|
|
15545
|
+
const resolvedMonthLabels = React64.useMemo(
|
|
15446
15546
|
() => monthLabels ?? getMonthLabels2(locale),
|
|
15447
15547
|
[locale, monthLabels]
|
|
15448
15548
|
);
|
|
15449
15549
|
const resolvedMonthPlaceholder = monthPlaceholder ?? t("month");
|
|
15450
15550
|
const resolvedDoneLabel = doneLabel ?? t("done");
|
|
15451
15551
|
const isControlled = value !== void 0;
|
|
15452
|
-
const initialParts =
|
|
15552
|
+
const initialParts = React64.useMemo(
|
|
15453
15553
|
() => partsFromDate(value ?? defaultValue ?? null),
|
|
15454
15554
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15455
15555
|
[]
|
|
15456
15556
|
);
|
|
15457
|
-
const [day, setDay] =
|
|
15458
|
-
const [monthIndex, setMonthIndex] =
|
|
15557
|
+
const [day, setDay] = React64.useState(initialParts.day);
|
|
15558
|
+
const [monthIndex, setMonthIndex] = React64.useState(
|
|
15459
15559
|
initialParts.monthIndex
|
|
15460
15560
|
);
|
|
15461
|
-
const [year, setYear] =
|
|
15462
|
-
const [isMonthOpen, setIsMonthOpen] =
|
|
15463
|
-
const [isWheelOpen, setIsWheelOpen] =
|
|
15464
|
-
const [focusedField, setFocusedField] =
|
|
15465
|
-
const [monthInputValue, setMonthInputValue] =
|
|
15466
|
-
const [monthHighlightIndex, setMonthHighlightIndex] =
|
|
15561
|
+
const [year, setYear] = React64.useState(initialParts.year);
|
|
15562
|
+
const [isMonthOpen, setIsMonthOpen] = React64.useState(false);
|
|
15563
|
+
const [isWheelOpen, setIsWheelOpen] = React64.useState(false);
|
|
15564
|
+
const [focusedField, setFocusedField] = React64.useState(null);
|
|
15565
|
+
const [monthInputValue, setMonthInputValue] = React64.useState("");
|
|
15566
|
+
const [monthHighlightIndex, setMonthHighlightIndex] = React64.useState(-1);
|
|
15467
15567
|
const isMobile2 = useIsMobile();
|
|
15468
|
-
|
|
15469
|
-
|
|
15568
|
+
React64.useImperativeHandle(ref, () => dayInputRef.current, []);
|
|
15569
|
+
React64.useEffect(() => {
|
|
15470
15570
|
if (!isControlled) return;
|
|
15471
15571
|
const next = partsFromDate(value ?? null);
|
|
15472
15572
|
setDay(next.day);
|
|
15473
15573
|
setMonthIndex(next.monthIndex);
|
|
15474
15574
|
setYear(next.year);
|
|
15475
15575
|
}, [isControlled, value]);
|
|
15476
|
-
|
|
15576
|
+
React64.useEffect(() => {
|
|
15477
15577
|
if (focusedField === "month") return;
|
|
15478
15578
|
setMonthInputValue(
|
|
15479
15579
|
monthIndex !== null ? resolvedMonthLabels[monthIndex] ?? "" : ""
|
|
15480
15580
|
);
|
|
15481
15581
|
}, [monthIndex, resolvedMonthLabels, focusedField]);
|
|
15482
|
-
const filteredMonths =
|
|
15582
|
+
const filteredMonths = React64.useMemo(() => {
|
|
15483
15583
|
const all = resolvedMonthLabels.map((label2, index) => ({ label: label2, index }));
|
|
15484
15584
|
const query = monthInputValue.trim().toLowerCase();
|
|
15485
15585
|
const currentLabel = monthIndex !== null ? resolvedMonthLabels[monthIndex] ?? "" : "";
|
|
15486
15586
|
if (!query || monthInputValue === currentLabel) return all;
|
|
15487
15587
|
return all.filter((opt) => opt.label.toLowerCase().includes(query));
|
|
15488
15588
|
}, [monthInputValue, monthIndex, resolvedMonthLabels]);
|
|
15489
|
-
|
|
15589
|
+
React64.useEffect(() => {
|
|
15490
15590
|
if (!isMonthOpen) {
|
|
15491
15591
|
setMonthHighlightIndex(-1);
|
|
15492
15592
|
return;
|
|
@@ -15507,7 +15607,7 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15507
15607
|
const isFocused = focusedField !== null || isMonthOpen || isWheelOpen;
|
|
15508
15608
|
const isInvalid = Boolean(invalid || error);
|
|
15509
15609
|
const wrapperWidth = toCssSize(width);
|
|
15510
|
-
const currentDate =
|
|
15610
|
+
const currentDate = React64.useMemo(
|
|
15511
15611
|
() => dateFromParts(day, monthIndex, year),
|
|
15512
15612
|
[day, monthIndex, year]
|
|
15513
15613
|
);
|
|
@@ -15516,7 +15616,7 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15516
15616
|
onOutsideClick: () => setIsMonthOpen(false),
|
|
15517
15617
|
isDisabled: !isMonthOpen || isMobile2
|
|
15518
15618
|
});
|
|
15519
|
-
const emitChange =
|
|
15619
|
+
const emitChange = React64.useCallback(
|
|
15520
15620
|
(nextDay, nextMonth, nextYear) => {
|
|
15521
15621
|
if (!onChange) return;
|
|
15522
15622
|
const date = dateFromParts(nextDay, nextMonth, nextYear);
|
|
@@ -15551,7 +15651,7 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15551
15651
|
setIsMonthOpen(true);
|
|
15552
15652
|
setMonthHighlightIndex(0);
|
|
15553
15653
|
};
|
|
15554
|
-
const commitMonthInput =
|
|
15654
|
+
const commitMonthInput = React64.useCallback(() => {
|
|
15555
15655
|
const query = monthInputValue.trim().toLowerCase();
|
|
15556
15656
|
if (!query) {
|
|
15557
15657
|
if (monthIndex !== null) {
|
|
@@ -15611,15 +15711,15 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15611
15711
|
setIsMonthOpen(false);
|
|
15612
15712
|
}
|
|
15613
15713
|
};
|
|
15614
|
-
const focusDayInput =
|
|
15714
|
+
const focusDayInput = React64.useCallback(() => {
|
|
15615
15715
|
if (isBlocked || readOnly) return;
|
|
15616
15716
|
dayInputRef.current?.focus();
|
|
15617
15717
|
}, [isBlocked, readOnly]);
|
|
15618
|
-
const openWheel =
|
|
15718
|
+
const openWheel = React64.useCallback(() => {
|
|
15619
15719
|
if (isBlocked || readOnly) return;
|
|
15620
15720
|
setIsWheelOpen(true);
|
|
15621
15721
|
}, [isBlocked, readOnly]);
|
|
15622
|
-
const closeWheel =
|
|
15722
|
+
const closeWheel = React64.useCallback(() => {
|
|
15623
15723
|
setIsWheelOpen(false);
|
|
15624
15724
|
mobileTriggerRef.current?.focus();
|
|
15625
15725
|
}, []);
|
|
@@ -15632,7 +15732,7 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15632
15732
|
minDate,
|
|
15633
15733
|
maxDate
|
|
15634
15734
|
});
|
|
15635
|
-
const handleWheelDone =
|
|
15735
|
+
const handleWheelDone = React64.useCallback(() => {
|
|
15636
15736
|
const next = wheel.draftDate;
|
|
15637
15737
|
setDay(String(next.getDate()));
|
|
15638
15738
|
setMonthIndex(next.getMonth());
|
|
@@ -15641,14 +15741,14 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15641
15741
|
setIsWheelOpen(false);
|
|
15642
15742
|
mobileTriggerRef.current?.focus();
|
|
15643
15743
|
}, [name, onChange, wheel.draftDate]);
|
|
15644
|
-
const defaultFormatValue =
|
|
15744
|
+
const defaultFormatValue = React64.useCallback(
|
|
15645
15745
|
(date) => `${date.getDate()} ${resolvedMonthLabels[date.getMonth()]} ${date.getFullYear()}`,
|
|
15646
15746
|
[resolvedMonthLabels]
|
|
15647
15747
|
);
|
|
15648
15748
|
const triggerText = currentDate ? (formatValue ?? defaultFormatValue)(currentDate) : void 0;
|
|
15649
15749
|
const monthListboxId = `${monthId}-listbox`;
|
|
15650
15750
|
const getMonthOptionId = (index) => `${monthId}-option-${index}`;
|
|
15651
|
-
const monthPanelContent = filteredMonths.length === 0 ? /* @__PURE__ */
|
|
15751
|
+
const monthPanelContent = filteredMonths.length === 0 ? /* @__PURE__ */ jsx167("div", { className: "px-4 py-3 text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: t("no_options") }) : /* @__PURE__ */ jsx167(
|
|
15652
15752
|
"ul",
|
|
15653
15753
|
{
|
|
15654
15754
|
ref: monthListRef,
|
|
@@ -15659,7 +15759,7 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15659
15759
|
children: filteredMonths.map((option, position) => {
|
|
15660
15760
|
const isSelected = option.index === monthIndex;
|
|
15661
15761
|
const isHighlighted = position === monthHighlightIndex;
|
|
15662
|
-
return /* @__PURE__ */
|
|
15762
|
+
return /* @__PURE__ */ jsx167("li", { role: "presentation", children: /* @__PURE__ */ jsx167(
|
|
15663
15763
|
"button",
|
|
15664
15764
|
{
|
|
15665
15765
|
id: getMonthOptionId(option.index),
|
|
@@ -15686,7 +15786,7 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15686
15786
|
isBlocked && "cursor-not-allowed",
|
|
15687
15787
|
loading && "cursor-progress"
|
|
15688
15788
|
);
|
|
15689
|
-
return /* @__PURE__ */
|
|
15789
|
+
return /* @__PURE__ */ jsx167(
|
|
15690
15790
|
"div",
|
|
15691
15791
|
{
|
|
15692
15792
|
ref: containerRef,
|
|
@@ -15697,9 +15797,9 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15697
15797
|
className
|
|
15698
15798
|
),
|
|
15699
15799
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
15700
|
-
children: /* @__PURE__ */
|
|
15701
|
-
/* @__PURE__ */
|
|
15702
|
-
isMobile2 ? /* @__PURE__ */
|
|
15800
|
+
children: /* @__PURE__ */ jsxs109("div", { className: "relative min-h-[68px] w-full", children: [
|
|
15801
|
+
/* @__PURE__ */ jsxs109("div", { className: "relative w-full", children: [
|
|
15802
|
+
isMobile2 ? /* @__PURE__ */ jsxs109(
|
|
15703
15803
|
"button",
|
|
15704
15804
|
{
|
|
15705
15805
|
ref: mobileTriggerRef,
|
|
@@ -15718,10 +15818,10 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15718
15818
|
(isBlocked || readOnly) && "cursor-not-allowed"
|
|
15719
15819
|
),
|
|
15720
15820
|
children: [
|
|
15721
|
-
/* @__PURE__ */
|
|
15722
|
-
/* @__PURE__ */
|
|
15723
|
-
loading && /* @__PURE__ */
|
|
15724
|
-
/* @__PURE__ */
|
|
15821
|
+
/* @__PURE__ */ jsx167("span", { className: "block min-w-0 flex-1 truncate text-left", children: triggerText ?? (isWheelOpen ? mobilePlaceholder : null) }),
|
|
15822
|
+
/* @__PURE__ */ jsxs109("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
15823
|
+
loading && /* @__PURE__ */ jsx167(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
15824
|
+
/* @__PURE__ */ jsx167(
|
|
15725
15825
|
ChevronDown5,
|
|
15726
15826
|
{
|
|
15727
15827
|
size: 16,
|
|
@@ -15734,14 +15834,14 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15734
15834
|
] })
|
|
15735
15835
|
]
|
|
15736
15836
|
}
|
|
15737
|
-
) : /* @__PURE__ */
|
|
15837
|
+
) : /* @__PURE__ */ jsxs109(
|
|
15738
15838
|
"div",
|
|
15739
15839
|
{
|
|
15740
15840
|
className: cn(
|
|
15741
15841
|
"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)]"
|
|
15742
15842
|
),
|
|
15743
15843
|
children: [
|
|
15744
|
-
/* @__PURE__ */
|
|
15844
|
+
/* @__PURE__ */ jsx167("div", { className: "flex h-full min-w-0 items-center px-2 sm:px-4", children: /* @__PURE__ */ jsx167(
|
|
15745
15845
|
"input",
|
|
15746
15846
|
{
|
|
15747
15847
|
ref: dayInputRef,
|
|
@@ -15763,8 +15863,8 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15763
15863
|
className: subInputClass
|
|
15764
15864
|
}
|
|
15765
15865
|
) }),
|
|
15766
|
-
/* @__PURE__ */
|
|
15767
|
-
/* @__PURE__ */
|
|
15866
|
+
/* @__PURE__ */ jsxs109("div", { className: "relative flex h-full min-w-0 items-center gap-1 border-x border-[var(--chekin-color-gray-3)] px-2 sm:px-3", children: [
|
|
15867
|
+
/* @__PURE__ */ jsx167(
|
|
15768
15868
|
"input",
|
|
15769
15869
|
{
|
|
15770
15870
|
ref: monthInputRef,
|
|
@@ -15807,7 +15907,7 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15807
15907
|
)
|
|
15808
15908
|
}
|
|
15809
15909
|
),
|
|
15810
|
-
/* @__PURE__ */
|
|
15910
|
+
/* @__PURE__ */ jsx167(
|
|
15811
15911
|
ChevronDown5,
|
|
15812
15912
|
{
|
|
15813
15913
|
size: 14,
|
|
@@ -15824,8 +15924,8 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15824
15924
|
}
|
|
15825
15925
|
)
|
|
15826
15926
|
] }),
|
|
15827
|
-
/* @__PURE__ */
|
|
15828
|
-
/* @__PURE__ */
|
|
15927
|
+
/* @__PURE__ */ jsxs109("div", { className: "flex h-full min-w-0 items-center px-2 sm:px-4", children: [
|
|
15928
|
+
/* @__PURE__ */ jsx167(
|
|
15829
15929
|
"input",
|
|
15830
15930
|
{
|
|
15831
15931
|
ref: yearInputRef,
|
|
@@ -15847,7 +15947,7 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15847
15947
|
className: subInputClass
|
|
15848
15948
|
}
|
|
15849
15949
|
),
|
|
15850
|
-
loading && /* @__PURE__ */
|
|
15950
|
+
loading && /* @__PURE__ */ jsx167(
|
|
15851
15951
|
ThreeDotsLoader,
|
|
15852
15952
|
{
|
|
15853
15953
|
height: 18,
|
|
@@ -15859,7 +15959,7 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15859
15959
|
]
|
|
15860
15960
|
}
|
|
15861
15961
|
),
|
|
15862
|
-
showCoverage && /* @__PURE__ */
|
|
15962
|
+
showCoverage && /* @__PURE__ */ jsx167(
|
|
15863
15963
|
"div",
|
|
15864
15964
|
{
|
|
15865
15965
|
className: "absolute inset-0 cursor-text rounded-[6px] bg-[var(--chekin-color-surface-input-empty)]",
|
|
@@ -15867,7 +15967,7 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15867
15967
|
"aria-hidden": "true"
|
|
15868
15968
|
}
|
|
15869
15969
|
),
|
|
15870
|
-
/* @__PURE__ */
|
|
15970
|
+
/* @__PURE__ */ jsx167(
|
|
15871
15971
|
Fieldset,
|
|
15872
15972
|
{
|
|
15873
15973
|
isFocused,
|
|
@@ -15885,9 +15985,9 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15885
15985
|
onClick: isMobile2 ? openWheel : showCoverage ? focusDayInput : void 0
|
|
15886
15986
|
}
|
|
15887
15987
|
),
|
|
15888
|
-
isMonthOpen && !isMobile2 && /* @__PURE__ */
|
|
15988
|
+
isMonthOpen && !isMobile2 && /* @__PURE__ */ jsx167("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 })
|
|
15889
15989
|
] }),
|
|
15890
|
-
isMobile2 && /* @__PURE__ */
|
|
15990
|
+
isMobile2 && /* @__PURE__ */ jsx167(
|
|
15891
15991
|
DatePickerContent,
|
|
15892
15992
|
{
|
|
15893
15993
|
baseId: wheelBaseId,
|
|
@@ -15915,9 +16015,9 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15915
16015
|
onOptionSelect: wheel.handleOptionSelect
|
|
15916
16016
|
}
|
|
15917
16017
|
),
|
|
15918
|
-
!error && optional && /* @__PURE__ */
|
|
15919
|
-
!error && helperText && /* @__PURE__ */
|
|
15920
|
-
error && !hideErrorMessage && /* @__PURE__ */
|
|
16018
|
+
!error && optional && /* @__PURE__ */ jsx167("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
16019
|
+
!error && helperText && /* @__PURE__ */ jsx167("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
16020
|
+
error && !hideErrorMessage && /* @__PURE__ */ jsx167(
|
|
15921
16021
|
FieldErrorMessage,
|
|
15922
16022
|
{
|
|
15923
16023
|
id: errorId,
|
|
@@ -15932,7 +16032,7 @@ var DashboardDatepicker = React63.forwardRef(
|
|
|
15932
16032
|
);
|
|
15933
16033
|
|
|
15934
16034
|
// src/dashboard/date-range-picker/DateRangePicker.tsx
|
|
15935
|
-
import * as
|
|
16035
|
+
import * as React68 from "react";
|
|
15936
16036
|
import { useTranslation as useTranslation36 } from "react-i18next";
|
|
15937
16037
|
|
|
15938
16038
|
// src/dashboard/date-range-picker/isDayBlocked.ts
|
|
@@ -16011,7 +16111,7 @@ var createDisabledMatchers = ({
|
|
|
16011
16111
|
};
|
|
16012
16112
|
|
|
16013
16113
|
// src/dashboard/date-range-picker/hooks/useRangeValue.ts
|
|
16014
|
-
import * as
|
|
16114
|
+
import * as React65 from "react";
|
|
16015
16115
|
var getRangeKey = (range) => `${range?.from?.getTime() ?? ""}-${range?.to?.getTime() ?? ""}`;
|
|
16016
16116
|
function useRangeValue({
|
|
16017
16117
|
value: externalValue,
|
|
@@ -16020,10 +16120,10 @@ function useRangeValue({
|
|
|
16020
16120
|
name
|
|
16021
16121
|
}) {
|
|
16022
16122
|
const isControlled = externalValue !== void 0;
|
|
16023
|
-
const [draft, setDraft] =
|
|
16123
|
+
const [draft, setDraft] = React65.useState(
|
|
16024
16124
|
isControlled ? externalValue : defaultValue
|
|
16025
16125
|
);
|
|
16026
|
-
const lastExternalKeyRef =
|
|
16126
|
+
const lastExternalKeyRef = React65.useRef(getRangeKey(externalValue));
|
|
16027
16127
|
if (isControlled) {
|
|
16028
16128
|
const externalKey = getRangeKey(externalValue);
|
|
16029
16129
|
if (externalKey !== lastExternalKeyRef.current) {
|
|
@@ -16031,7 +16131,7 @@ function useRangeValue({
|
|
|
16031
16131
|
setDraft(externalValue);
|
|
16032
16132
|
}
|
|
16033
16133
|
}
|
|
16034
|
-
const commit =
|
|
16134
|
+
const commit = React65.useCallback(
|
|
16035
16135
|
(next) => {
|
|
16036
16136
|
setDraft(next);
|
|
16037
16137
|
if (next === void 0) {
|
|
@@ -16046,7 +16146,7 @@ function useRangeValue({
|
|
|
16046
16146
|
}
|
|
16047
16147
|
|
|
16048
16148
|
// src/dashboard/date-range-picker/hooks/useRangeTextInputs.ts
|
|
16049
|
-
import * as
|
|
16149
|
+
import * as React66 from "react";
|
|
16050
16150
|
function useRangeTextInputs({
|
|
16051
16151
|
value,
|
|
16052
16152
|
format: format2,
|
|
@@ -16054,13 +16154,13 @@ function useRangeTextInputs({
|
|
|
16054
16154
|
onCommit,
|
|
16055
16155
|
onBlur
|
|
16056
16156
|
}) {
|
|
16057
|
-
const [fromText, setFromText] =
|
|
16058
|
-
const [toText, setToText] =
|
|
16059
|
-
|
|
16157
|
+
const [fromText, setFromText] = React66.useState(value?.from ? format2(value.from) : "");
|
|
16158
|
+
const [toText, setToText] = React66.useState(value?.to ? format2(value.to) : "");
|
|
16159
|
+
React66.useEffect(() => {
|
|
16060
16160
|
setFromText(value?.from ? format2(value.from) : "");
|
|
16061
16161
|
setToText(value?.to ? format2(value.to) : "");
|
|
16062
16162
|
}, [format2, value?.from, value?.to]);
|
|
16063
|
-
const handleFromBlur =
|
|
16163
|
+
const handleFromBlur = React66.useCallback(() => {
|
|
16064
16164
|
if (!fromText) {
|
|
16065
16165
|
const next = { from: void 0, to: value?.to };
|
|
16066
16166
|
onCommit(next);
|
|
@@ -16077,7 +16177,7 @@ function useRangeTextInputs({
|
|
|
16077
16177
|
setFromText(value?.from ? format2(value.from) : "");
|
|
16078
16178
|
return void 0;
|
|
16079
16179
|
}, [format2, fromText, onBlur, onCommit, parse3, value?.from, value?.to]);
|
|
16080
|
-
const handleToBlur =
|
|
16180
|
+
const handleToBlur = React66.useCallback(() => {
|
|
16081
16181
|
if (!toText) {
|
|
16082
16182
|
const next = { from: value?.from, to: void 0 };
|
|
16083
16183
|
onCommit(next);
|
|
@@ -16104,21 +16204,21 @@ function useRangeTextInputs({
|
|
|
16104
16204
|
}
|
|
16105
16205
|
|
|
16106
16206
|
// src/dashboard/date-range-picker/hooks/useRangeMonthSync.ts
|
|
16107
|
-
import * as
|
|
16207
|
+
import * as React67 from "react";
|
|
16108
16208
|
function useRangeMonthSync(value) {
|
|
16109
|
-
const isPreloadedRef =
|
|
16110
|
-
const [month, setMonth] =
|
|
16111
|
-
|
|
16209
|
+
const isPreloadedRef = React67.useRef(false);
|
|
16210
|
+
const [month, setMonth] = React67.useState(value?.from ?? /* @__PURE__ */ new Date());
|
|
16211
|
+
React67.useEffect(() => {
|
|
16112
16212
|
if (value?.from && !isPreloadedRef.current) {
|
|
16113
16213
|
setMonth(value.from);
|
|
16114
16214
|
isPreloadedRef.current = true;
|
|
16115
16215
|
}
|
|
16116
16216
|
}, [value?.from]);
|
|
16117
|
-
const syncMonthToValue =
|
|
16217
|
+
const syncMonthToValue = React67.useCallback((next) => {
|
|
16118
16218
|
isPreloadedRef.current = true;
|
|
16119
16219
|
if (next?.from) setMonth(next.from);
|
|
16120
16220
|
}, []);
|
|
16121
|
-
const resetPreload =
|
|
16221
|
+
const resetPreload = React67.useCallback(() => {
|
|
16122
16222
|
isPreloadedRef.current = false;
|
|
16123
16223
|
}, []);
|
|
16124
16224
|
return { month, setMonth, syncMonthToValue, resetPreload };
|
|
@@ -16144,7 +16244,7 @@ function resolveRangeSelection({
|
|
|
16144
16244
|
|
|
16145
16245
|
// src/dashboard/date-range-picker/components/DateRangeInputs.tsx
|
|
16146
16246
|
import { CalendarDays, SquareX as SquareX4 } from "lucide-react";
|
|
16147
|
-
import { jsx as
|
|
16247
|
+
import { jsx as jsx168, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
16148
16248
|
var DEFAULT_PLACEHOLDER = "00-00-0000";
|
|
16149
16249
|
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)]";
|
|
16150
16250
|
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";
|
|
@@ -16186,7 +16286,7 @@ function DateRangeInputs({
|
|
|
16186
16286
|
isBlocked && "cursor-not-allowed",
|
|
16187
16287
|
loading && "cursor-progress"
|
|
16188
16288
|
);
|
|
16189
|
-
return /* @__PURE__ */
|
|
16289
|
+
return /* @__PURE__ */ jsxs110(
|
|
16190
16290
|
"div",
|
|
16191
16291
|
{
|
|
16192
16292
|
className: cn(
|
|
@@ -16195,7 +16295,7 @@ function DateRangeInputs({
|
|
|
16195
16295
|
),
|
|
16196
16296
|
onClick: onRowClick,
|
|
16197
16297
|
children: [
|
|
16198
|
-
/* @__PURE__ */
|
|
16298
|
+
/* @__PURE__ */ jsx168(
|
|
16199
16299
|
"input",
|
|
16200
16300
|
{
|
|
16201
16301
|
ref: fromInputRef,
|
|
@@ -16219,7 +16319,7 @@ function DateRangeInputs({
|
|
|
16219
16319
|
)
|
|
16220
16320
|
}
|
|
16221
16321
|
),
|
|
16222
|
-
/* @__PURE__ */
|
|
16322
|
+
/* @__PURE__ */ jsx168(
|
|
16223
16323
|
"span",
|
|
16224
16324
|
{
|
|
16225
16325
|
"aria-hidden": "true",
|
|
@@ -16230,7 +16330,7 @@ function DateRangeInputs({
|
|
|
16230
16330
|
children: "\u2192"
|
|
16231
16331
|
}
|
|
16232
16332
|
),
|
|
16233
|
-
/* @__PURE__ */
|
|
16333
|
+
/* @__PURE__ */ jsx168(
|
|
16234
16334
|
"input",
|
|
16235
16335
|
{
|
|
16236
16336
|
ref: toInputRef,
|
|
@@ -16254,9 +16354,9 @@ function DateRangeInputs({
|
|
|
16254
16354
|
)
|
|
16255
16355
|
}
|
|
16256
16356
|
),
|
|
16257
|
-
/* @__PURE__ */
|
|
16258
|
-
loading && /* @__PURE__ */
|
|
16259
|
-
!readOnly && !hideClearDates && !isEmpty && /* @__PURE__ */
|
|
16357
|
+
/* @__PURE__ */ jsxs110("span", { className: "ml-auto flex shrink-0 items-center gap-2 pl-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
16358
|
+
loading && /* @__PURE__ */ jsx168(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
16359
|
+
!readOnly && !hideClearDates && !isEmpty && /* @__PURE__ */ jsx168(
|
|
16260
16360
|
"button",
|
|
16261
16361
|
{
|
|
16262
16362
|
type: "button",
|
|
@@ -16264,10 +16364,10 @@ function DateRangeInputs({
|
|
|
16264
16364
|
onClick: onReset,
|
|
16265
16365
|
className: iconButtonClass,
|
|
16266
16366
|
"aria-label": clearLabel,
|
|
16267
|
-
children: /* @__PURE__ */
|
|
16367
|
+
children: /* @__PURE__ */ jsx168(SquareX4, { size: 16, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
16268
16368
|
}
|
|
16269
16369
|
),
|
|
16270
|
-
!readOnly && !hideCalendarIcon && /* @__PURE__ */
|
|
16370
|
+
!readOnly && !hideCalendarIcon && /* @__PURE__ */ jsx168(
|
|
16271
16371
|
"button",
|
|
16272
16372
|
{
|
|
16273
16373
|
type: "button",
|
|
@@ -16279,7 +16379,7 @@ function DateRangeInputs({
|
|
|
16279
16379
|
focusedInput !== null || isOpen ? "text-[var(--chekin-color-brand-blue)]" : "text-[var(--chekin-color-gray-2)]"
|
|
16280
16380
|
),
|
|
16281
16381
|
"aria-label": openCalendarLabel,
|
|
16282
|
-
children: /* @__PURE__ */
|
|
16382
|
+
children: /* @__PURE__ */ jsx168(CalendarDays, { size: 18 })
|
|
16283
16383
|
}
|
|
16284
16384
|
)
|
|
16285
16385
|
] })
|
|
@@ -16289,7 +16389,7 @@ function DateRangeInputs({
|
|
|
16289
16389
|
}
|
|
16290
16390
|
|
|
16291
16391
|
// src/dashboard/date-range-picker/components/DateRangeCalendar.tsx
|
|
16292
|
-
import { jsx as
|
|
16392
|
+
import { jsx as jsx169 } from "react/jsx-runtime";
|
|
16293
16393
|
function DateRangeCalendar({
|
|
16294
16394
|
value,
|
|
16295
16395
|
month,
|
|
@@ -16305,7 +16405,7 @@ function DateRangeCalendar({
|
|
|
16305
16405
|
components,
|
|
16306
16406
|
...dayPickerProps
|
|
16307
16407
|
}) {
|
|
16308
|
-
return /* @__PURE__ */
|
|
16408
|
+
return /* @__PURE__ */ jsx169(
|
|
16309
16409
|
Calendar,
|
|
16310
16410
|
{
|
|
16311
16411
|
mode: "range",
|
|
@@ -16328,7 +16428,7 @@ function DateRangeCalendar({
|
|
|
16328
16428
|
}
|
|
16329
16429
|
|
|
16330
16430
|
// src/dashboard/date-range-picker/components/DateRangePopover.tsx
|
|
16331
|
-
import { jsx as
|
|
16431
|
+
import { jsx as jsx170, jsxs as jsxs111 } from "react/jsx-runtime";
|
|
16332
16432
|
function DateRangePopover({
|
|
16333
16433
|
isOpen,
|
|
16334
16434
|
isMobile: isMobile2,
|
|
@@ -16340,30 +16440,30 @@ function DateRangePopover({
|
|
|
16340
16440
|
}) {
|
|
16341
16441
|
if (!isOpen) return null;
|
|
16342
16442
|
if (isMobile2) {
|
|
16343
|
-
return /* @__PURE__ */
|
|
16443
|
+
return /* @__PURE__ */ jsx170(
|
|
16344
16444
|
Drawer,
|
|
16345
16445
|
{
|
|
16346
16446
|
open: isOpen,
|
|
16347
16447
|
onOpenChange: (next) => {
|
|
16348
16448
|
if (!next) onClose();
|
|
16349
16449
|
},
|
|
16350
|
-
children: /* @__PURE__ */
|
|
16450
|
+
children: /* @__PURE__ */ jsxs111(
|
|
16351
16451
|
DrawerContent,
|
|
16352
16452
|
{
|
|
16353
16453
|
onClose,
|
|
16354
16454
|
lockScroll: false,
|
|
16355
16455
|
className: "max-h-[calc(100vh-1rem)]",
|
|
16356
16456
|
children: [
|
|
16357
|
-
/* @__PURE__ */
|
|
16358
|
-
/* @__PURE__ */
|
|
16359
|
-
/* @__PURE__ */
|
|
16457
|
+
/* @__PURE__ */ jsx170(DrawerTitle, { className: "sr-only", children: drawerTitle }),
|
|
16458
|
+
/* @__PURE__ */ jsx170(DrawerDescription, { className: "sr-only", children: drawerDescription }),
|
|
16459
|
+
/* @__PURE__ */ jsx170("div", { className: "flex items-start justify-center overflow-x-auto px-2 pb-4 pt-1", children })
|
|
16360
16460
|
]
|
|
16361
16461
|
}
|
|
16362
16462
|
)
|
|
16363
16463
|
}
|
|
16364
16464
|
);
|
|
16365
16465
|
}
|
|
16366
|
-
return /* @__PURE__ */
|
|
16466
|
+
return /* @__PURE__ */ jsx170(
|
|
16367
16467
|
"div",
|
|
16368
16468
|
{
|
|
16369
16469
|
className: cn(
|
|
@@ -16376,8 +16476,8 @@ function DateRangePopover({
|
|
|
16376
16476
|
}
|
|
16377
16477
|
|
|
16378
16478
|
// src/dashboard/date-range-picker/DateRangePicker.tsx
|
|
16379
|
-
import { jsx as
|
|
16380
|
-
var DashboardDateRangePicker =
|
|
16479
|
+
import { jsx as jsx171, jsxs as jsxs112 } from "react/jsx-runtime";
|
|
16480
|
+
var DashboardDateRangePicker = React68.forwardRef(function DashboardDateRangePicker2({
|
|
16381
16481
|
label,
|
|
16382
16482
|
value: externalValue,
|
|
16383
16483
|
defaultValue,
|
|
@@ -16411,20 +16511,20 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16411
16511
|
components: customComponents,
|
|
16412
16512
|
...dayPickerProps
|
|
16413
16513
|
}, ref) {
|
|
16414
|
-
const containerRef =
|
|
16415
|
-
const fromInputRef =
|
|
16416
|
-
const toInputRef =
|
|
16417
|
-
const reactId =
|
|
16514
|
+
const containerRef = React68.useRef(null);
|
|
16515
|
+
const fromInputRef = React68.useRef(null);
|
|
16516
|
+
const toInputRef = React68.useRef(null);
|
|
16517
|
+
const reactId = React68.useId();
|
|
16418
16518
|
const baseId = name ?? `dash-daterange-${reactId}`;
|
|
16419
16519
|
const fromId = `${baseId}-from`;
|
|
16420
16520
|
const toId = `${baseId}-to`;
|
|
16421
16521
|
const labelId = `${baseId}-label`;
|
|
16422
16522
|
const errorId = `${baseId}-error`;
|
|
16423
|
-
const normalizedValue =
|
|
16523
|
+
const normalizedValue = React68.useMemo(() => {
|
|
16424
16524
|
if (externalValue === void 0) return void 0;
|
|
16425
16525
|
return { from: toDate(externalValue?.from), to: toDate(externalValue?.to) };
|
|
16426
16526
|
}, [externalValue]);
|
|
16427
|
-
const normalizedDefaultValue =
|
|
16527
|
+
const normalizedDefaultValue = React68.useMemo(() => {
|
|
16428
16528
|
if (defaultValue === void 0) return void 0;
|
|
16429
16529
|
return { from: toDate(defaultValue?.from), to: toDate(defaultValue?.to) };
|
|
16430
16530
|
}, [defaultValue]);
|
|
@@ -16434,10 +16534,10 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16434
16534
|
onChange,
|
|
16435
16535
|
name
|
|
16436
16536
|
});
|
|
16437
|
-
const normalizedMinDate =
|
|
16438
|
-
const normalizedMaxDate =
|
|
16439
|
-
const formatter =
|
|
16440
|
-
const parser =
|
|
16537
|
+
const normalizedMinDate = React68.useMemo(() => toDate(minDate), [minDate]);
|
|
16538
|
+
const normalizedMaxDate = React68.useMemo(() => toDate(maxDate), [maxDate]);
|
|
16539
|
+
const formatter = React68.useMemo(() => formatDate(displayFormat), [displayFormat]);
|
|
16540
|
+
const parser = React68.useMemo(() => parseDate(displayFormat), [displayFormat]);
|
|
16441
16541
|
const { fromText, toText, setFromText, setToText, handleFromBlur, handleToBlur } = useRangeTextInputs({
|
|
16442
16542
|
value,
|
|
16443
16543
|
format: formatter,
|
|
@@ -16446,9 +16546,9 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16446
16546
|
onBlur
|
|
16447
16547
|
});
|
|
16448
16548
|
const { month, setMonth, syncMonthToValue } = useRangeMonthSync(value);
|
|
16449
|
-
const [isOpen, setIsOpen] =
|
|
16450
|
-
const [focusedInput, setFocusedInput] =
|
|
16451
|
-
const [autoFocus, setAutoFocus] =
|
|
16549
|
+
const [isOpen, setIsOpen] = React68.useState(false);
|
|
16550
|
+
const [focusedInput, setFocusedInput] = React68.useState(null);
|
|
16551
|
+
const [autoFocus, setAutoFocus] = React68.useState(false);
|
|
16452
16552
|
const isMobile2 = useIsMobile();
|
|
16453
16553
|
const { t } = useTranslation36();
|
|
16454
16554
|
const drawerTitle = label ?? t("select_dates");
|
|
@@ -16459,13 +16559,13 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16459
16559
|
const isFocused = focusedInput !== null || isOpen;
|
|
16460
16560
|
const wrapperWidth = toCssSize(width);
|
|
16461
16561
|
const monthsToShow = numberOfMonths ?? (isMobile2 ? 1 : 2);
|
|
16462
|
-
const closeCalendar =
|
|
16562
|
+
const closeCalendar = React68.useCallback(() => {
|
|
16463
16563
|
setIsOpen(false);
|
|
16464
16564
|
setFocusedInput(null);
|
|
16465
16565
|
setAutoFocus(false);
|
|
16466
16566
|
if (value?.from) setMonth(value.from);
|
|
16467
16567
|
}, [setMonth, value?.from]);
|
|
16468
|
-
const openCalendar =
|
|
16568
|
+
const openCalendar = React68.useCallback(() => {
|
|
16469
16569
|
if (isBlocked || readOnly) return;
|
|
16470
16570
|
setIsOpen(true);
|
|
16471
16571
|
}, [isBlocked, readOnly]);
|
|
@@ -16474,7 +16574,7 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16474
16574
|
onOutsideClick: closeCalendar,
|
|
16475
16575
|
isDisabled: !isOpen || isMobile2
|
|
16476
16576
|
});
|
|
16477
|
-
const handlePickerChange =
|
|
16577
|
+
const handlePickerChange = React68.useCallback(
|
|
16478
16578
|
(range, pickedDate) => {
|
|
16479
16579
|
const { next, shouldClose } = resolveRangeSelection({
|
|
16480
16580
|
previous: value,
|
|
@@ -16495,7 +16595,7 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16495
16595
|
setToText("");
|
|
16496
16596
|
setMonth(/* @__PURE__ */ new Date());
|
|
16497
16597
|
};
|
|
16498
|
-
const disabledMatchers =
|
|
16598
|
+
const disabledMatchers = React68.useMemo(
|
|
16499
16599
|
() => createDisabledMatchers({
|
|
16500
16600
|
minDate: normalizedMinDate,
|
|
16501
16601
|
maxDate: normalizedMaxDate,
|
|
@@ -16514,7 +16614,7 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16514
16614
|
openCalendar();
|
|
16515
16615
|
if (autoFocusOnOpen) setAutoFocus(true);
|
|
16516
16616
|
};
|
|
16517
|
-
|
|
16617
|
+
React68.useImperativeHandle(
|
|
16518
16618
|
ref,
|
|
16519
16619
|
() => ({
|
|
16520
16620
|
setDateRange: (range) => {
|
|
@@ -16537,7 +16637,7 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16537
16637
|
syncMonthToValue
|
|
16538
16638
|
]
|
|
16539
16639
|
);
|
|
16540
|
-
return /* @__PURE__ */
|
|
16640
|
+
return /* @__PURE__ */ jsx171(
|
|
16541
16641
|
"div",
|
|
16542
16642
|
{
|
|
16543
16643
|
ref: containerRef,
|
|
@@ -16548,9 +16648,9 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16548
16648
|
className
|
|
16549
16649
|
),
|
|
16550
16650
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
16551
|
-
children: /* @__PURE__ */
|
|
16552
|
-
/* @__PURE__ */
|
|
16553
|
-
/* @__PURE__ */
|
|
16651
|
+
children: /* @__PURE__ */ jsxs112("div", { className: "relative min-h-[68px] w-full", children: [
|
|
16652
|
+
/* @__PURE__ */ jsxs112("div", { className: "relative w-full", children: [
|
|
16653
|
+
/* @__PURE__ */ jsx171(
|
|
16554
16654
|
DateRangeInputs,
|
|
16555
16655
|
{
|
|
16556
16656
|
fromId,
|
|
@@ -16601,7 +16701,7 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16601
16701
|
onToggleCalendar: toggleCalendar
|
|
16602
16702
|
}
|
|
16603
16703
|
),
|
|
16604
|
-
/* @__PURE__ */
|
|
16704
|
+
/* @__PURE__ */ jsx171(
|
|
16605
16705
|
Fieldset,
|
|
16606
16706
|
{
|
|
16607
16707
|
isFocused,
|
|
@@ -16618,7 +16718,7 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16618
16718
|
tooltip
|
|
16619
16719
|
}
|
|
16620
16720
|
),
|
|
16621
|
-
/* @__PURE__ */
|
|
16721
|
+
/* @__PURE__ */ jsx171(
|
|
16622
16722
|
DateRangePopover,
|
|
16623
16723
|
{
|
|
16624
16724
|
isOpen: isOpen && !isMobile2,
|
|
@@ -16627,7 +16727,7 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16627
16727
|
drawerTitle,
|
|
16628
16728
|
drawerDescription,
|
|
16629
16729
|
onClose: closeCalendar,
|
|
16630
|
-
children: /* @__PURE__ */
|
|
16730
|
+
children: /* @__PURE__ */ jsx171(
|
|
16631
16731
|
DateRangeCalendar,
|
|
16632
16732
|
{
|
|
16633
16733
|
value,
|
|
@@ -16648,7 +16748,7 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16648
16748
|
}
|
|
16649
16749
|
)
|
|
16650
16750
|
] }),
|
|
16651
|
-
/* @__PURE__ */
|
|
16751
|
+
/* @__PURE__ */ jsx171(
|
|
16652
16752
|
DateRangePopover,
|
|
16653
16753
|
{
|
|
16654
16754
|
isOpen: isOpen && isMobile2,
|
|
@@ -16657,7 +16757,7 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16657
16757
|
drawerTitle,
|
|
16658
16758
|
drawerDescription,
|
|
16659
16759
|
onClose: closeCalendar,
|
|
16660
|
-
children: /* @__PURE__ */
|
|
16760
|
+
children: /* @__PURE__ */ jsx171(
|
|
16661
16761
|
DateRangeCalendar,
|
|
16662
16762
|
{
|
|
16663
16763
|
value,
|
|
@@ -16677,9 +16777,9 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16677
16777
|
)
|
|
16678
16778
|
}
|
|
16679
16779
|
),
|
|
16680
|
-
!error && optional && /* @__PURE__ */
|
|
16681
|
-
!error && helperText && /* @__PURE__ */
|
|
16682
|
-
error && !hideErrorMessage && /* @__PURE__ */
|
|
16780
|
+
!error && optional && /* @__PURE__ */ jsx171("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
16781
|
+
!error && helperText && /* @__PURE__ */ jsx171("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
16782
|
+
error && !hideErrorMessage && /* @__PURE__ */ jsx171(
|
|
16683
16783
|
FieldErrorMessage,
|
|
16684
16784
|
{
|
|
16685
16785
|
id: errorId,
|
|
@@ -16693,7 +16793,7 @@ var DashboardDateRangePicker = React67.forwardRef(function DashboardDateRangePic
|
|
|
16693
16793
|
});
|
|
16694
16794
|
|
|
16695
16795
|
// src/dashboard/date-range-picker/useValidateDates.ts
|
|
16696
|
-
import * as
|
|
16796
|
+
import * as React69 from "react";
|
|
16697
16797
|
import { useTranslation as useTranslation37 } from "react-i18next";
|
|
16698
16798
|
import { differenceInDays as differenceInDays2, isAfter as isAfter2, isBefore as isBefore3 } from "date-fns";
|
|
16699
16799
|
import {
|
|
@@ -16719,11 +16819,11 @@ function useValidateDates({
|
|
|
16719
16819
|
const { t } = useTranslation37();
|
|
16720
16820
|
const handleError = useEvent(onError);
|
|
16721
16821
|
const handleSuccess = useEvent(onSuccess);
|
|
16722
|
-
const errorFormatter =
|
|
16822
|
+
const errorFormatter = React69.useMemo(
|
|
16723
16823
|
() => formatDate(displayFormat ?? DEFAULT_DISPLAY_FORMAT),
|
|
16724
16824
|
[displayFormat]
|
|
16725
16825
|
);
|
|
16726
|
-
const validateDates =
|
|
16826
|
+
const validateDates = React69.useCallback(
|
|
16727
16827
|
(dates) => {
|
|
16728
16828
|
const startDate = dates?.from;
|
|
16729
16829
|
const endDate = dates?.to;
|
|
@@ -16773,9 +16873,9 @@ function useValidateDates({
|
|
|
16773
16873
|
}
|
|
16774
16874
|
|
|
16775
16875
|
// src/dashboard/time-picker/TimePicker.tsx
|
|
16776
|
-
import * as
|
|
16876
|
+
import * as React70 from "react";
|
|
16777
16877
|
import { addDays, addHours, addMinutes, format, parse as parse2 } from "date-fns";
|
|
16778
|
-
import { jsx as
|
|
16878
|
+
import { jsx as jsx172 } from "react/jsx-runtime";
|
|
16779
16879
|
var SHORT_TIME_FORMAT = "HH:mm";
|
|
16780
16880
|
function parseTime(value) {
|
|
16781
16881
|
return parse2(value, SHORT_TIME_FORMAT, /* @__PURE__ */ new Date());
|
|
@@ -16817,22 +16917,22 @@ var FORMAT_SETTINGS = {
|
|
|
16817
16917
|
},
|
|
16818
16918
|
hours: { intervalUnit: "H", interval: 1, minTime: "00:00", maxTime: "23:00" }
|
|
16819
16919
|
};
|
|
16820
|
-
var DashboardTimePicker =
|
|
16920
|
+
var DashboardTimePicker = React70.forwardRef(
|
|
16821
16921
|
function DashboardTimePicker2({ format: formatName = "time", timeSettings, options, ...selectProps }, ref) {
|
|
16822
|
-
const resolvedOptions =
|
|
16922
|
+
const resolvedOptions = React70.useMemo(() => {
|
|
16823
16923
|
if (options) return options;
|
|
16824
16924
|
const settings = timeSettings ?? FORMAT_SETTINGS[formatName];
|
|
16825
16925
|
return buildOptions(settings);
|
|
16826
16926
|
}, [formatName, options, timeSettings]);
|
|
16827
|
-
return /* @__PURE__ */
|
|
16927
|
+
return /* @__PURE__ */ jsx172(DashboardSelect, { ref, ...selectProps, options: resolvedOptions });
|
|
16828
16928
|
}
|
|
16829
16929
|
);
|
|
16830
16930
|
|
|
16831
16931
|
// src/dashboard/file-input/FileInput.tsx
|
|
16832
|
-
import * as
|
|
16932
|
+
import * as React71 from "react";
|
|
16833
16933
|
import { Download, Paperclip, SquareX as SquareX5 } from "lucide-react";
|
|
16834
16934
|
import { useTranslation as useTranslation38 } from "react-i18next";
|
|
16835
|
-
import { jsx as
|
|
16935
|
+
import { jsx as jsx173, jsxs as jsxs113 } from "react/jsx-runtime";
|
|
16836
16936
|
function defaultFileNameFromUrl(url) {
|
|
16837
16937
|
try {
|
|
16838
16938
|
const parsed = new URL(url);
|
|
@@ -16845,7 +16945,7 @@ function defaultFileNameFromUrl(url) {
|
|
|
16845
16945
|
function defaultDownload(url) {
|
|
16846
16946
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
16847
16947
|
}
|
|
16848
|
-
var DashboardFileInput =
|
|
16948
|
+
var DashboardFileInput = React71.forwardRef(
|
|
16849
16949
|
function DashboardFileInput2({
|
|
16850
16950
|
label,
|
|
16851
16951
|
value,
|
|
@@ -16869,12 +16969,12 @@ var DashboardFileInput = React70.forwardRef(
|
|
|
16869
16969
|
downloadLabel,
|
|
16870
16970
|
fileNameFromUrl = defaultFileNameFromUrl
|
|
16871
16971
|
}, ref) {
|
|
16872
|
-
const internalRef =
|
|
16972
|
+
const internalRef = React71.useRef(null);
|
|
16873
16973
|
const inputRef = useCombinedRef(ref, internalRef);
|
|
16874
16974
|
const { t } = useTranslation38();
|
|
16875
16975
|
const resolvedLabel = label ?? t("upload_file");
|
|
16876
16976
|
const resolvedDownloadLabel = downloadLabel ?? t("download_attachment");
|
|
16877
|
-
const reactId =
|
|
16977
|
+
const reactId = React71.useId();
|
|
16878
16978
|
const inputId = `${name || "dash-file"}-${reactId}`;
|
|
16879
16979
|
const labelId = `${inputId}-label`;
|
|
16880
16980
|
const errorId = `${inputId}-error`;
|
|
@@ -16900,7 +17000,7 @@ var DashboardFileInput = React70.forwardRef(
|
|
|
16900
17000
|
event.stopPropagation();
|
|
16901
17001
|
if (isUrl) onDownload(value);
|
|
16902
17002
|
};
|
|
16903
|
-
return /* @__PURE__ */
|
|
17003
|
+
return /* @__PURE__ */ jsxs113(
|
|
16904
17004
|
"label",
|
|
16905
17005
|
{
|
|
16906
17006
|
htmlFor: inputId,
|
|
@@ -16913,7 +17013,7 @@ var DashboardFileInput = React70.forwardRef(
|
|
|
16913
17013
|
),
|
|
16914
17014
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
16915
17015
|
children: [
|
|
16916
|
-
/* @__PURE__ */
|
|
17016
|
+
/* @__PURE__ */ jsx173(
|
|
16917
17017
|
"input",
|
|
16918
17018
|
{
|
|
16919
17019
|
ref: inputRef,
|
|
@@ -16929,9 +17029,9 @@ var DashboardFileInput = React70.forwardRef(
|
|
|
16929
17029
|
"aria-invalid": isInvalid
|
|
16930
17030
|
}
|
|
16931
17031
|
),
|
|
16932
|
-
/* @__PURE__ */
|
|
16933
|
-
/* @__PURE__ */
|
|
16934
|
-
/* @__PURE__ */
|
|
17032
|
+
/* @__PURE__ */ jsxs113("div", { className: "relative min-h-[68px] w-full", children: [
|
|
17033
|
+
/* @__PURE__ */ jsxs113("div", { className: "relative w-full", children: [
|
|
17034
|
+
/* @__PURE__ */ jsxs113(
|
|
16935
17035
|
"div",
|
|
16936
17036
|
{
|
|
16937
17037
|
className: cn(
|
|
@@ -16939,25 +17039,25 @@ var DashboardFileInput = React70.forwardRef(
|
|
|
16939
17039
|
isEmpty && "bg-[var(--chekin-color-surface-input-empty)]"
|
|
16940
17040
|
),
|
|
16941
17041
|
children: [
|
|
16942
|
-
hasFileChip ? /* @__PURE__ */
|
|
17042
|
+
hasFileChip ? /* @__PURE__ */ jsxs113(
|
|
16943
17043
|
"div",
|
|
16944
17044
|
{
|
|
16945
17045
|
className: "inline-flex h-6 max-w-[85%] items-center rounded-[4px] border border-[#acacd5] bg-[#f0f0f8] pl-[10px] pr-1",
|
|
16946
17046
|
onClick: (event) => event.preventDefault(),
|
|
16947
17047
|
children: [
|
|
16948
|
-
isUrl ? /* @__PURE__ */
|
|
17048
|
+
isUrl ? /* @__PURE__ */ jsxs113(
|
|
16949
17049
|
"button",
|
|
16950
17050
|
{
|
|
16951
17051
|
type: "button",
|
|
16952
17052
|
onClick: handleDownload,
|
|
16953
17053
|
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",
|
|
16954
17054
|
children: [
|
|
16955
|
-
/* @__PURE__ */
|
|
16956
|
-
/* @__PURE__ */
|
|
17055
|
+
/* @__PURE__ */ jsx173("span", { className: "truncate", children: resolvedDownloadLabel }),
|
|
17056
|
+
/* @__PURE__ */ jsx173(Download, { size: 15 })
|
|
16957
17057
|
]
|
|
16958
17058
|
}
|
|
16959
|
-
) : /* @__PURE__ */
|
|
16960
|
-
/* @__PURE__ */
|
|
17059
|
+
) : /* @__PURE__ */ jsx173("span", { className: "truncate text-[14px] font-medium text-[var(--chekin-color-brand-navy)]", children: value.name }),
|
|
17060
|
+
/* @__PURE__ */ jsx173(
|
|
16961
17061
|
"button",
|
|
16962
17062
|
{
|
|
16963
17063
|
type: "button",
|
|
@@ -16965,20 +17065,20 @@ var DashboardFileInput = React70.forwardRef(
|
|
|
16965
17065
|
onClick: handleClear,
|
|
16966
17066
|
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]",
|
|
16967
17067
|
"aria-label": t("remove_file"),
|
|
16968
|
-
children: /* @__PURE__ */
|
|
17068
|
+
children: /* @__PURE__ */ jsx173(SquareX5, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
16969
17069
|
}
|
|
16970
17070
|
)
|
|
16971
17071
|
]
|
|
16972
17072
|
}
|
|
16973
|
-
) : /* @__PURE__ */
|
|
16974
|
-
/* @__PURE__ */
|
|
16975
|
-
loading && /* @__PURE__ */
|
|
16976
|
-
/* @__PURE__ */
|
|
17073
|
+
) : /* @__PURE__ */ jsx173("span", { className: "block min-w-0 flex-1 truncate text-left text-[var(--chekin-color-gray-1)]", children: placeholder ?? "" }),
|
|
17074
|
+
/* @__PURE__ */ jsxs113("span", { className: "ml-auto flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
17075
|
+
loading && /* @__PURE__ */ jsx173(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
17076
|
+
/* @__PURE__ */ jsx173(Paperclip, { size: 20 })
|
|
16977
17077
|
] })
|
|
16978
17078
|
]
|
|
16979
17079
|
}
|
|
16980
17080
|
),
|
|
16981
|
-
/* @__PURE__ */
|
|
17081
|
+
/* @__PURE__ */ jsx173(
|
|
16982
17082
|
Fieldset,
|
|
16983
17083
|
{
|
|
16984
17084
|
isFocused: false,
|
|
@@ -16996,9 +17096,9 @@ var DashboardFileInput = React70.forwardRef(
|
|
|
16996
17096
|
}
|
|
16997
17097
|
)
|
|
16998
17098
|
] }),
|
|
16999
|
-
!error && optional && /* @__PURE__ */
|
|
17000
|
-
!error && helperText && /* @__PURE__ */
|
|
17001
|
-
error && !hideErrorMessage && /* @__PURE__ */
|
|
17099
|
+
!error && optional && /* @__PURE__ */ jsx173("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
17100
|
+
!error && helperText && /* @__PURE__ */ jsx173("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
17101
|
+
error && !hideErrorMessage && /* @__PURE__ */ jsx173(
|
|
17002
17102
|
FieldErrorMessage,
|
|
17003
17103
|
{
|
|
17004
17104
|
id: errorId,
|
|
@@ -17014,8 +17114,8 @@ var DashboardFileInput = React70.forwardRef(
|
|
|
17014
17114
|
);
|
|
17015
17115
|
|
|
17016
17116
|
// src/dashboard/select-icons-box/SelectIconsBox.tsx
|
|
17017
|
-
import * as
|
|
17018
|
-
import { jsx as
|
|
17117
|
+
import * as React72 from "react";
|
|
17118
|
+
import { jsx as jsx174, jsxs as jsxs114 } from "react/jsx-runtime";
|
|
17019
17119
|
function DashboardSelectIconsBox({
|
|
17020
17120
|
children,
|
|
17021
17121
|
icons,
|
|
@@ -17030,9 +17130,9 @@ function DashboardSelectIconsBox({
|
|
|
17030
17130
|
className,
|
|
17031
17131
|
boxClassName
|
|
17032
17132
|
}) {
|
|
17033
|
-
const containerRef =
|
|
17133
|
+
const containerRef = React72.useRef(null);
|
|
17034
17134
|
const isControlled = controlledOpen !== void 0;
|
|
17035
|
-
const [internalOpen, setInternalOpen] =
|
|
17135
|
+
const [internalOpen, setInternalOpen] = React72.useState(defaultOpen);
|
|
17036
17136
|
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
17037
17137
|
const setOpen = (next) => {
|
|
17038
17138
|
if (!isControlled) setInternalOpen(next);
|
|
@@ -17051,7 +17151,7 @@ function DashboardSelectIconsBox({
|
|
|
17051
17151
|
onSelect(iconName);
|
|
17052
17152
|
setOpen(false);
|
|
17053
17153
|
};
|
|
17054
|
-
return /* @__PURE__ */
|
|
17154
|
+
return /* @__PURE__ */ jsxs114(
|
|
17055
17155
|
"div",
|
|
17056
17156
|
{
|
|
17057
17157
|
ref: containerRef,
|
|
@@ -17059,7 +17159,7 @@ function DashboardSelectIconsBox({
|
|
|
17059
17159
|
className: cn("relative inline-block", className),
|
|
17060
17160
|
children: [
|
|
17061
17161
|
children,
|
|
17062
|
-
isOpen && /* @__PURE__ */
|
|
17162
|
+
isOpen && /* @__PURE__ */ jsx174(
|
|
17063
17163
|
"div",
|
|
17064
17164
|
{
|
|
17065
17165
|
className: cn(
|
|
@@ -17070,7 +17170,7 @@ function DashboardSelectIconsBox({
|
|
|
17070
17170
|
boxClassName
|
|
17071
17171
|
),
|
|
17072
17172
|
style: { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` },
|
|
17073
|
-
children: icons.map((iconName) => /* @__PURE__ */
|
|
17173
|
+
children: icons.map((iconName) => /* @__PURE__ */ jsx174(
|
|
17074
17174
|
"button",
|
|
17075
17175
|
{
|
|
17076
17176
|
type: "button",
|
|
@@ -17090,11 +17190,11 @@ function DashboardSelectIconsBox({
|
|
|
17090
17190
|
}
|
|
17091
17191
|
|
|
17092
17192
|
// src/searchable-select/SearchableSelect.tsx
|
|
17093
|
-
import * as
|
|
17193
|
+
import * as React73 from "react";
|
|
17094
17194
|
import { ChevronDown as ChevronDown6, Search as Search4 } from "lucide-react";
|
|
17095
17195
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
17096
17196
|
import { useCallback as useCallback44 } from "react";
|
|
17097
|
-
import { jsx as
|
|
17197
|
+
import { jsx as jsx175, jsxs as jsxs115 } from "react/jsx-runtime";
|
|
17098
17198
|
var ROW_HEIGHT = 48;
|
|
17099
17199
|
var DESKTOP_LIST_HEIGHT = 280;
|
|
17100
17200
|
var MOBILE_LIST_HEIGHT = 420;
|
|
@@ -17135,13 +17235,13 @@ var SearchableSelectInternal = ({
|
|
|
17135
17235
|
loadingMessage
|
|
17136
17236
|
}, ref) => {
|
|
17137
17237
|
const { isMatch: isMobile2 } = useScreenResize(DEVICE.mobileXL);
|
|
17138
|
-
const reactId =
|
|
17139
|
-
const [open, setOpen] =
|
|
17140
|
-
const [internalSearchValue, setInternalSearchValue] =
|
|
17141
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
17142
|
-
const containerRef =
|
|
17143
|
-
const triggerRef =
|
|
17144
|
-
const inputRef =
|
|
17238
|
+
const reactId = React73.useId();
|
|
17239
|
+
const [open, setOpen] = React73.useState(false);
|
|
17240
|
+
const [internalSearchValue, setInternalSearchValue] = React73.useState("");
|
|
17241
|
+
const [highlightedIndex, setHighlightedIndex] = React73.useState(-1);
|
|
17242
|
+
const containerRef = React73.useRef(null);
|
|
17243
|
+
const triggerRef = React73.useRef(null);
|
|
17244
|
+
const inputRef = React73.useRef(null);
|
|
17145
17245
|
const listboxId = `${reactId}-listbox`;
|
|
17146
17246
|
const labelId = `${reactId}-label`;
|
|
17147
17247
|
const valueId = `${reactId}-value`;
|
|
@@ -17150,13 +17250,13 @@ var SearchableSelectInternal = ({
|
|
|
17150
17250
|
const searchInputId = `${reactId}-search`;
|
|
17151
17251
|
const effectiveSearchValue = searchValue ?? internalSearchValue;
|
|
17152
17252
|
const shouldFilterLocally = !onSearchChange && filterOption !== null;
|
|
17153
|
-
const visibleOptions =
|
|
17253
|
+
const visibleOptions = React73.useMemo(() => {
|
|
17154
17254
|
if (!shouldFilterLocally || !effectiveSearchValue) {
|
|
17155
17255
|
return options;
|
|
17156
17256
|
}
|
|
17157
17257
|
return options.filter((option) => filterOption(option, effectiveSearchValue));
|
|
17158
17258
|
}, [effectiveSearchValue, filterOption, options, shouldFilterLocally]);
|
|
17159
|
-
const selectedIndex =
|
|
17259
|
+
const selectedIndex = React73.useMemo(
|
|
17160
17260
|
() => visibleOptions.findIndex((option) => option.value === value?.value),
|
|
17161
17261
|
[value?.value, visibleOptions]
|
|
17162
17262
|
);
|
|
@@ -17182,7 +17282,7 @@ var SearchableSelectInternal = ({
|
|
|
17182
17282
|
},
|
|
17183
17283
|
[handleOnOpenChange]
|
|
17184
17284
|
);
|
|
17185
|
-
|
|
17285
|
+
React73.useEffect(() => {
|
|
17186
17286
|
if (isBlocked) {
|
|
17187
17287
|
setSelectOpen(false);
|
|
17188
17288
|
return;
|
|
@@ -17195,7 +17295,7 @@ var SearchableSelectInternal = ({
|
|
|
17195
17295
|
window.cancelAnimationFrame(frameId);
|
|
17196
17296
|
};
|
|
17197
17297
|
}, [isBlocked, open, setSelectOpen]);
|
|
17198
|
-
|
|
17298
|
+
React73.useEffect(() => {
|
|
17199
17299
|
if (!open) {
|
|
17200
17300
|
setHighlightedIndex(-1);
|
|
17201
17301
|
return;
|
|
@@ -17263,7 +17363,7 @@ var SearchableSelectInternal = ({
|
|
|
17263
17363
|
}
|
|
17264
17364
|
}
|
|
17265
17365
|
}
|
|
17266
|
-
const content = /* @__PURE__ */
|
|
17366
|
+
const content = /* @__PURE__ */ jsx175(
|
|
17267
17367
|
SearchableSelectContent,
|
|
17268
17368
|
{
|
|
17269
17369
|
inputId: searchInputId,
|
|
@@ -17290,10 +17390,10 @@ var SearchableSelectInternal = ({
|
|
|
17290
17390
|
onOptionHover: setHighlightedIndex
|
|
17291
17391
|
}
|
|
17292
17392
|
);
|
|
17293
|
-
|
|
17294
|
-
return /* @__PURE__ */
|
|
17295
|
-
name && /* @__PURE__ */
|
|
17296
|
-
/* @__PURE__ */
|
|
17393
|
+
React73.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
17394
|
+
return /* @__PURE__ */ jsxs115("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
|
|
17395
|
+
name && /* @__PURE__ */ jsx175("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
17396
|
+
/* @__PURE__ */ jsx175(
|
|
17297
17397
|
FieldTrigger,
|
|
17298
17398
|
{
|
|
17299
17399
|
id: `${reactId}-trigger`,
|
|
@@ -17328,7 +17428,7 @@ var SearchableSelectInternal = ({
|
|
|
17328
17428
|
},
|
|
17329
17429
|
onKeyDown: handleTriggerKeyDown,
|
|
17330
17430
|
onBlur,
|
|
17331
|
-
trailingAdornment: /* @__PURE__ */
|
|
17431
|
+
trailingAdornment: /* @__PURE__ */ jsx175(
|
|
17332
17432
|
ChevronDown6,
|
|
17333
17433
|
{
|
|
17334
17434
|
className: cn(
|
|
@@ -17339,7 +17439,7 @@ var SearchableSelectInternal = ({
|
|
|
17339
17439
|
)
|
|
17340
17440
|
}
|
|
17341
17441
|
),
|
|
17342
|
-
isMobile2 ? /* @__PURE__ */
|
|
17442
|
+
isMobile2 ? /* @__PURE__ */ jsx175(
|
|
17343
17443
|
Drawer,
|
|
17344
17444
|
{
|
|
17345
17445
|
open,
|
|
@@ -17351,13 +17451,13 @@ var SearchableSelectInternal = ({
|
|
|
17351
17451
|
}
|
|
17352
17452
|
closeSelect();
|
|
17353
17453
|
},
|
|
17354
|
-
children: /* @__PURE__ */
|
|
17355
|
-
/* @__PURE__ */
|
|
17356
|
-
/* @__PURE__ */
|
|
17357
|
-
/* @__PURE__ */
|
|
17454
|
+
children: /* @__PURE__ */ jsxs115(DrawerContent, { onClose: closeSelect, lockScroll: false, children: [
|
|
17455
|
+
/* @__PURE__ */ jsx175(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
17456
|
+
/* @__PURE__ */ jsx175(DrawerDescription, { className: "sr-only", children: label }),
|
|
17457
|
+
/* @__PURE__ */ jsx175("div", { className: "px-5 pb-5 pt-1", children: content })
|
|
17358
17458
|
] })
|
|
17359
17459
|
}
|
|
17360
|
-
) : open ? /* @__PURE__ */
|
|
17460
|
+
) : open ? /* @__PURE__ */ jsx175(
|
|
17361
17461
|
"div",
|
|
17362
17462
|
{
|
|
17363
17463
|
className: cn(
|
|
@@ -17369,7 +17469,7 @@ var SearchableSelectInternal = ({
|
|
|
17369
17469
|
) : null
|
|
17370
17470
|
] });
|
|
17371
17471
|
};
|
|
17372
|
-
var SearchableSelect =
|
|
17472
|
+
var SearchableSelect = React73.forwardRef(
|
|
17373
17473
|
SearchableSelectInternal
|
|
17374
17474
|
);
|
|
17375
17475
|
function SearchableSelectContent({
|
|
@@ -17396,9 +17496,9 @@ function SearchableSelectContent({
|
|
|
17396
17496
|
onOptionClick,
|
|
17397
17497
|
onOptionHover
|
|
17398
17498
|
}) {
|
|
17399
|
-
const listRef =
|
|
17400
|
-
const lastLoadMoreOptionsLengthRef =
|
|
17401
|
-
const previousHighlightedIndexRef =
|
|
17499
|
+
const listRef = React73.useRef(null);
|
|
17500
|
+
const lastLoadMoreOptionsLengthRef = React73.useRef(null);
|
|
17501
|
+
const previousHighlightedIndexRef = React73.useRef(highlightedIndex);
|
|
17402
17502
|
const rowCount = options.length + (loading && options.length > 0 ? 1 : 0);
|
|
17403
17503
|
const virtualizer = useVirtualizer3({
|
|
17404
17504
|
count: rowCount,
|
|
@@ -17409,7 +17509,7 @@ function SearchableSelectContent({
|
|
|
17409
17509
|
const virtualItems = virtualizer.getVirtualItems();
|
|
17410
17510
|
const emptyMessage = noOptionsMessage?.() ?? "No matches found";
|
|
17411
17511
|
const loadingText = loadingMessage?.() ?? "Loading...";
|
|
17412
|
-
|
|
17512
|
+
React73.useEffect(() => {
|
|
17413
17513
|
const lastItem = virtualItems[virtualItems.length - 1];
|
|
17414
17514
|
const shouldLoadMore = !!lastItem && hasNextPage && !loading && lastItem.index >= options.length - LOAD_MORE_THRESHOLD;
|
|
17415
17515
|
if (shouldLoadMore && lastLoadMoreOptionsLengthRef.current !== options.length) {
|
|
@@ -17417,23 +17517,23 @@ function SearchableSelectContent({
|
|
|
17417
17517
|
onLoadMore?.();
|
|
17418
17518
|
}
|
|
17419
17519
|
}, [hasNextPage, loading, onLoadMore, options.length, virtualItems]);
|
|
17420
|
-
|
|
17520
|
+
React73.useEffect(() => {
|
|
17421
17521
|
const hasHighlightedIndexChanged = previousHighlightedIndexRef.current !== highlightedIndex;
|
|
17422
17522
|
previousHighlightedIndexRef.current = highlightedIndex;
|
|
17423
17523
|
if (highlightedIndex >= 0 && hasHighlightedIndexChanged) {
|
|
17424
17524
|
virtualizer.scrollToIndex(highlightedIndex, { align: "auto" });
|
|
17425
17525
|
}
|
|
17426
17526
|
}, [highlightedIndex, virtualizer]);
|
|
17427
|
-
return /* @__PURE__ */
|
|
17428
|
-
/* @__PURE__ */
|
|
17429
|
-
/* @__PURE__ */
|
|
17527
|
+
return /* @__PURE__ */ jsxs115("div", { className: "p-2", children: [
|
|
17528
|
+
/* @__PURE__ */ jsxs115("div", { className: "relative mb-2", children: [
|
|
17529
|
+
/* @__PURE__ */ jsx175(
|
|
17430
17530
|
Search4,
|
|
17431
17531
|
{
|
|
17432
17532
|
"aria-hidden": "true",
|
|
17433
17533
|
className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 text-[#9696B9]"
|
|
17434
17534
|
}
|
|
17435
17535
|
),
|
|
17436
|
-
/* @__PURE__ */
|
|
17536
|
+
/* @__PURE__ */ jsx175(
|
|
17437
17537
|
"input",
|
|
17438
17538
|
{
|
|
17439
17539
|
id: inputId,
|
|
@@ -17452,7 +17552,7 @@ function SearchableSelectContent({
|
|
|
17452
17552
|
}
|
|
17453
17553
|
)
|
|
17454
17554
|
] }),
|
|
17455
|
-
loading && options.length === 0 ? /* @__PURE__ */
|
|
17555
|
+
loading && options.length === 0 ? /* @__PURE__ */ jsx175("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: loadingText }) : options.length === 0 ? /* @__PURE__ */ jsx175("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : /* @__PURE__ */ jsx175(
|
|
17456
17556
|
"div",
|
|
17457
17557
|
{
|
|
17458
17558
|
id: listboxId,
|
|
@@ -17461,7 +17561,7 @@ function SearchableSelectContent({
|
|
|
17461
17561
|
"aria-labelledby": labelId,
|
|
17462
17562
|
className: cn("overflow-y-auto outline-none", menuClassName),
|
|
17463
17563
|
style: { height: Math.min(height, rowCount * ROW_HEIGHT) },
|
|
17464
|
-
children: /* @__PURE__ */
|
|
17564
|
+
children: /* @__PURE__ */ jsx175(
|
|
17465
17565
|
"div",
|
|
17466
17566
|
{
|
|
17467
17567
|
className: "relative w-full",
|
|
@@ -17469,7 +17569,7 @@ function SearchableSelectContent({
|
|
|
17469
17569
|
children: virtualItems.map((virtualItem) => {
|
|
17470
17570
|
const option = options[virtualItem.index];
|
|
17471
17571
|
if (!option) {
|
|
17472
|
-
return /* @__PURE__ */
|
|
17572
|
+
return /* @__PURE__ */ jsx175(
|
|
17473
17573
|
"div",
|
|
17474
17574
|
{
|
|
17475
17575
|
className: "absolute left-0 top-0 flex w-full items-center px-4 text-base leading-6 text-[#6C6C6C]",
|
|
@@ -17484,7 +17584,7 @@ function SearchableSelectContent({
|
|
|
17484
17584
|
}
|
|
17485
17585
|
const isSelected = value?.value === option.value;
|
|
17486
17586
|
const isHighlighted = virtualItem.index === highlightedIndex;
|
|
17487
|
-
return /* @__PURE__ */
|
|
17587
|
+
return /* @__PURE__ */ jsx175(
|
|
17488
17588
|
"button",
|
|
17489
17589
|
{
|
|
17490
17590
|
id: getOptionId(idPrefix, virtualItem.index),
|
|
@@ -17506,7 +17606,7 @@ function SearchableSelectContent({
|
|
|
17506
17606
|
height: `${virtualItem.size}px`,
|
|
17507
17607
|
transform: `translateY(${virtualItem.start}px)`
|
|
17508
17608
|
},
|
|
17509
|
-
children: /* @__PURE__ */
|
|
17609
|
+
children: /* @__PURE__ */ jsx175("span", { className: "truncate text-center", children: String(option.label) })
|
|
17510
17610
|
},
|
|
17511
17611
|
`${String(option.value)}-${virtualItem.index}`
|
|
17512
17612
|
);
|
|
@@ -17596,14 +17696,14 @@ function getErrorMessage(error) {
|
|
|
17596
17696
|
|
|
17597
17697
|
// src/lib/toastResponseError.tsx
|
|
17598
17698
|
import i18next from "i18next";
|
|
17599
|
-
import { jsx as
|
|
17699
|
+
import { jsx as jsx176, jsxs as jsxs116 } from "react/jsx-runtime";
|
|
17600
17700
|
function addSupportEmailToMessage(message, prefixText) {
|
|
17601
17701
|
if (typeof message !== "string") {
|
|
17602
17702
|
return message;
|
|
17603
17703
|
}
|
|
17604
17704
|
const builtMessage = `${prefixText ? `${prefixText} ` : ""}${message}`;
|
|
17605
|
-
return /* @__PURE__ */
|
|
17606
|
-
/* @__PURE__ */
|
|
17705
|
+
return /* @__PURE__ */ jsxs116("div", { children: [
|
|
17706
|
+
/* @__PURE__ */ jsx176("div", { children: builtMessage }),
|
|
17607
17707
|
i18next.t("reach_us_at_email")
|
|
17608
17708
|
] });
|
|
17609
17709
|
}
|
|
@@ -17790,6 +17890,7 @@ export {
|
|
|
17790
17890
|
RatingProgress,
|
|
17791
17891
|
RatingRadioGroup,
|
|
17792
17892
|
RatingStars,
|
|
17893
|
+
ResponsiveDropdown,
|
|
17793
17894
|
ResponsiveSheet,
|
|
17794
17895
|
RotateArrow,
|
|
17795
17896
|
ScrollArea,
|