@chekinapp/ui 0.0.18 → 0.0.20
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 +614 -483
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +586 -456
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -66,6 +66,7 @@ __export(index_exports, {
|
|
|
66
66
|
ChannelSelector: () => ChannelSelector,
|
|
67
67
|
Checkbox: () => Checkbox,
|
|
68
68
|
CheckboxGroup: () => CheckboxGroup,
|
|
69
|
+
CircularLoader: () => CircularLoader,
|
|
69
70
|
CommingSoonBadge: () => CommingSoonBadge,
|
|
70
71
|
ConfirmationDialog: () => ConfirmationDialog,
|
|
71
72
|
CopyIcon: () => CopyIcon,
|
|
@@ -1422,6 +1423,20 @@ var getDocument = () => {
|
|
|
1422
1423
|
function getCustomContainer() {
|
|
1423
1424
|
return getDocument()?.body;
|
|
1424
1425
|
}
|
|
1426
|
+
var isNumeric = (n) => n !== "" && !isNaN(n);
|
|
1427
|
+
function toCssSize(size) {
|
|
1428
|
+
if (!size) {
|
|
1429
|
+
return;
|
|
1430
|
+
} else if (size === "auto") {
|
|
1431
|
+
return size;
|
|
1432
|
+
} else if (typeof size === "number" || isNumeric(size)) {
|
|
1433
|
+
return `${size}px`;
|
|
1434
|
+
} else if (size.slice(-2) === "px") {
|
|
1435
|
+
return size;
|
|
1436
|
+
} else {
|
|
1437
|
+
return size;
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1425
1440
|
|
|
1426
1441
|
// src/tooltip/Tooltip.tsx
|
|
1427
1442
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
@@ -2318,7 +2333,7 @@ function DialogPortal({ ...props }) {
|
|
|
2318
2333
|
function DialogClose({ ...props }) {
|
|
2319
2334
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
2320
2335
|
}
|
|
2321
|
-
var dialogOverlayClasses = "fixed inset-0 z-50 bg-
|
|
2336
|
+
var dialogOverlayClasses = "fixed inset-0 z-50 bg-[var(--dialog-overlay-bg)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0";
|
|
2322
2337
|
var scrollableOverlayClasses = "fixed inset-0 z-50 flex flex-col items-center overflow-y-auto overscroll-none pb-[19px] pt-[20px]";
|
|
2323
2338
|
var DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2324
2339
|
DialogPrimitive.Overlay,
|
|
@@ -2330,8 +2345,8 @@ var DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
2330
2345
|
}
|
|
2331
2346
|
));
|
|
2332
2347
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
2333
|
-
var dialogContentClasses = "relative z-50 my-auto w-full max-w-[calc(100%-2rem)] rounded-
|
|
2334
|
-
var dialogCloseButtonClasses = "absolute right-4 top-4 rounded-
|
|
2348
|
+
var dialogContentClasses = "relative z-50 my-auto w-full max-w-[calc(100%-2rem)] rounded-[var(--dialog-content-radius)] border border-[var(--dialog-content-border)] bg-[var(--dialog-content-bg)] p-6 text-[var(--dialog-content-text)] shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:max-w-2xl";
|
|
2349
|
+
var dialogCloseButtonClasses = "absolute right-4 top-4 rounded-[var(--dialog-close-radius)] opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:shadow-chekin-focus disabled:pointer-events-none [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0";
|
|
2335
2350
|
var DialogContent = React10.forwardRef(
|
|
2336
2351
|
({ className, showCloseButton = true, children, container, lockScroll = true, ...props }, ref) => {
|
|
2337
2352
|
const contentElement = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
@@ -2400,7 +2415,7 @@ var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /*
|
|
|
2400
2415
|
{
|
|
2401
2416
|
ref,
|
|
2402
2417
|
"data-slot": "dialog-description",
|
|
2403
|
-
className: cn("text-sm text-
|
|
2418
|
+
className: cn("text-sm text-[var(--dialog-description-text)]", className),
|
|
2404
2419
|
...props
|
|
2405
2420
|
}
|
|
2406
2421
|
));
|
|
@@ -7043,11 +7058,107 @@ SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
|
|
|
7043
7058
|
var VALUE_PART = 1;
|
|
7044
7059
|
var getSidebarState = (stateName) => document.cookie.split("; ").find((row) => row.startsWith(`${stateName}=`))?.split("=")[VALUE_PART] === "true";
|
|
7045
7060
|
|
|
7061
|
+
// src/circular-loader/CircularLoader.tsx
|
|
7062
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
7063
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
7064
|
+
var CircularLoader = import_react37.default.memo(
|
|
7065
|
+
({ visible = true, height, width, position, label, className }) => {
|
|
7066
|
+
if (!visible) return null;
|
|
7067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
7068
|
+
"div",
|
|
7069
|
+
{
|
|
7070
|
+
className: cn(
|
|
7071
|
+
"main-loader flex flex-col items-center justify-center gap-2",
|
|
7072
|
+
position === "center" && "h-full",
|
|
7073
|
+
className
|
|
7074
|
+
),
|
|
7075
|
+
children: [
|
|
7076
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
7077
|
+
"svg",
|
|
7078
|
+
{
|
|
7079
|
+
viewBox: "25 25 50 50",
|
|
7080
|
+
className: "main-loader__svg text-[var(--circular-loader-color)]",
|
|
7081
|
+
style: {
|
|
7082
|
+
width: toCssSize(width),
|
|
7083
|
+
height: toCssSize(height)
|
|
7084
|
+
},
|
|
7085
|
+
children: [
|
|
7086
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
7087
|
+
"circle",
|
|
7088
|
+
{
|
|
7089
|
+
r: "20",
|
|
7090
|
+
cy: "50",
|
|
7091
|
+
cx: "50",
|
|
7092
|
+
className: "cover fill-none stroke-current opacity-5",
|
|
7093
|
+
strokeWidth: "7"
|
|
7094
|
+
}
|
|
7095
|
+
),
|
|
7096
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
7097
|
+
"circle",
|
|
7098
|
+
{
|
|
7099
|
+
r: "20",
|
|
7100
|
+
cy: "50",
|
|
7101
|
+
cx: "50",
|
|
7102
|
+
className: "circle fill-none stroke-current",
|
|
7103
|
+
strokeDasharray: "1 200",
|
|
7104
|
+
strokeDashoffset: "0",
|
|
7105
|
+
strokeLinecap: "round",
|
|
7106
|
+
strokeWidth: "7",
|
|
7107
|
+
children: [
|
|
7108
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
7109
|
+
"animateTransform",
|
|
7110
|
+
{
|
|
7111
|
+
attributeName: "transform",
|
|
7112
|
+
dur: "2.25s",
|
|
7113
|
+
from: "0 50 50",
|
|
7114
|
+
repeatCount: "indefinite",
|
|
7115
|
+
to: "360 50 50",
|
|
7116
|
+
type: "rotate"
|
|
7117
|
+
}
|
|
7118
|
+
),
|
|
7119
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
7120
|
+
"animate",
|
|
7121
|
+
{
|
|
7122
|
+
attributeName: "stroke-dasharray",
|
|
7123
|
+
calcMode: "spline",
|
|
7124
|
+
dur: "1.8s",
|
|
7125
|
+
keyTimes: "0;0.5;1",
|
|
7126
|
+
keySplines: "0.42 0 0.58 1;0.42 0 0.58 1",
|
|
7127
|
+
repeatCount: "indefinite",
|
|
7128
|
+
values: "1 200;90 200;90 200"
|
|
7129
|
+
}
|
|
7130
|
+
),
|
|
7131
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
7132
|
+
"animate",
|
|
7133
|
+
{
|
|
7134
|
+
attributeName: "stroke-dashoffset",
|
|
7135
|
+
calcMode: "spline",
|
|
7136
|
+
dur: "1.8s",
|
|
7137
|
+
keyTimes: "0;0.5;1",
|
|
7138
|
+
keySplines: "0.42 0 0.58 1;0.42 0 0.58 1",
|
|
7139
|
+
repeatCount: "indefinite",
|
|
7140
|
+
values: "0;-35;-125"
|
|
7141
|
+
}
|
|
7142
|
+
)
|
|
7143
|
+
]
|
|
7144
|
+
}
|
|
7145
|
+
)
|
|
7146
|
+
]
|
|
7147
|
+
}
|
|
7148
|
+
),
|
|
7149
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: "text-sm font-medium text-chekin-gray-1", children: label })
|
|
7150
|
+
]
|
|
7151
|
+
}
|
|
7152
|
+
);
|
|
7153
|
+
}
|
|
7154
|
+
);
|
|
7155
|
+
CircularLoader.displayName = "CircularLoader";
|
|
7156
|
+
|
|
7046
7157
|
// src/small-grid-single-item/SmallGridSingleItem.tsx
|
|
7047
|
-
var
|
|
7158
|
+
var import_react38 = require("react");
|
|
7048
7159
|
var import_lucide_react34 = require("lucide-react");
|
|
7049
|
-
var
|
|
7050
|
-
var SmallGridSingleItem = (0,
|
|
7160
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
7161
|
+
var SmallGridSingleItem = (0, import_react38.memo)(
|
|
7051
7162
|
({
|
|
7052
7163
|
title,
|
|
7053
7164
|
subtitle,
|
|
@@ -7062,7 +7173,7 @@ var SmallGridSingleItem = (0, import_react37.memo)(
|
|
|
7062
7173
|
const handleClick = (event) => {
|
|
7063
7174
|
if (!disabled && onClick) onClick(event);
|
|
7064
7175
|
};
|
|
7065
|
-
return /* @__PURE__ */ (0,
|
|
7176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
|
|
7066
7177
|
"div",
|
|
7067
7178
|
{
|
|
7068
7179
|
onClick: handleClick,
|
|
@@ -7076,33 +7187,33 @@ var SmallGridSingleItem = (0, import_react37.memo)(
|
|
|
7076
7187
|
className
|
|
7077
7188
|
),
|
|
7078
7189
|
children: [
|
|
7079
|
-
/* @__PURE__ */ (0,
|
|
7080
|
-
/* @__PURE__ */ (0,
|
|
7081
|
-
subtitle && /* @__PURE__ */ (0,
|
|
7190
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { children: [
|
|
7191
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: "line-clamp-2 overflow-hidden text-ellipsis break-all", children: title }),
|
|
7192
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: "line-clamp-2 overflow-hidden text-ellipsis text-[15px] font-medium leading-6 text-chekin-gray-2", children: subtitle })
|
|
7082
7193
|
] }),
|
|
7083
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
7084
|
-
onDelete && /* @__PURE__ */ (0,
|
|
7194
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "flex h-full items-center justify-end gap-2", children: [
|
|
7195
|
+
onDelete && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
7085
7196
|
Button,
|
|
7086
7197
|
{
|
|
7087
7198
|
disabled,
|
|
7088
7199
|
onClick: onDelete,
|
|
7089
7200
|
size: "icon",
|
|
7090
7201
|
variant: "secondary",
|
|
7091
|
-
children: /* @__PURE__ */ (0,
|
|
7202
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_lucide_react34.Trash2, { className: "h-5 w-5 text-chekin-red" })
|
|
7092
7203
|
}
|
|
7093
7204
|
),
|
|
7094
|
-
onEdit && /* @__PURE__ */ (0,
|
|
7205
|
+
onEdit && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
7095
7206
|
Button,
|
|
7096
7207
|
{
|
|
7097
7208
|
disabled,
|
|
7098
7209
|
onClick: onEdit,
|
|
7099
7210
|
size: "icon",
|
|
7100
7211
|
variant: "secondary",
|
|
7101
|
-
children: /* @__PURE__ */ (0,
|
|
7212
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_lucide_react34.Pencil, { className: "h-5 w-5 text-chekin-blue" })
|
|
7102
7213
|
}
|
|
7103
7214
|
)
|
|
7104
7215
|
] }),
|
|
7105
|
-
error && /* @__PURE__ */ (0,
|
|
7216
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: "absolute bottom-1 right-2 text-xs text-chekin-red", children: error })
|
|
7106
7217
|
]
|
|
7107
7218
|
}
|
|
7108
7219
|
);
|
|
@@ -7113,7 +7224,7 @@ SmallGridSingleItem.displayName = "SmallGridSingleItem";
|
|
|
7113
7224
|
// src/sorting-action/SortingAction.tsx
|
|
7114
7225
|
var import_react_i18next19 = require("react-i18next");
|
|
7115
7226
|
var import_lucide_react35 = require("lucide-react");
|
|
7116
|
-
var
|
|
7227
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
7117
7228
|
function SortingAction({
|
|
7118
7229
|
value,
|
|
7119
7230
|
onSortChange,
|
|
@@ -7123,8 +7234,8 @@ function SortingAction({
|
|
|
7123
7234
|
onOpenChange
|
|
7124
7235
|
}) {
|
|
7125
7236
|
const { t } = (0, import_react_i18next19.useTranslation)();
|
|
7126
|
-
return /* @__PURE__ */ (0,
|
|
7127
|
-
/* @__PURE__ */ (0,
|
|
7237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(DropdownMenu, { open, onOpenChange, children: [
|
|
7238
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
7128
7239
|
"button",
|
|
7129
7240
|
{
|
|
7130
7241
|
type: "button",
|
|
@@ -7133,34 +7244,34 @@ function SortingAction({
|
|
|
7133
7244
|
className
|
|
7134
7245
|
),
|
|
7135
7246
|
"aria-label": "Open sorting menu",
|
|
7136
|
-
children: /* @__PURE__ */ (0,
|
|
7247
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_lucide_react35.ArrowDownUpIcon, { className: "h-4 w-4 text-chekin-gray-1 group-hover/trigger:text-chekin-navy" })
|
|
7137
7248
|
}
|
|
7138
7249
|
) }),
|
|
7139
|
-
/* @__PURE__ */ (0,
|
|
7140
|
-
/* @__PURE__ */ (0,
|
|
7250
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(DropdownMenuContent, { className: "w-full max-w-[256px]", align: "start", children: [
|
|
7251
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
|
|
7141
7252
|
DropdownMenuItem,
|
|
7142
7253
|
{
|
|
7143
7254
|
className: cn(value === "asc" && "bg-chekin-surface-pressed text-chekin-blue"),
|
|
7144
7255
|
onClick: () => onSortChange?.("asc"),
|
|
7145
7256
|
children: [
|
|
7146
|
-
/* @__PURE__ */ (0,
|
|
7257
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_lucide_react35.ArrowUp, { className: "h-4 w-4" }),
|
|
7147
7258
|
variant === "by_text" ? t("sort_a_z") : t("sort_in_asc")
|
|
7148
7259
|
]
|
|
7149
7260
|
}
|
|
7150
7261
|
),
|
|
7151
|
-
/* @__PURE__ */ (0,
|
|
7262
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
|
|
7152
7263
|
DropdownMenuItem,
|
|
7153
7264
|
{
|
|
7154
7265
|
className: cn(value === "desc" && "bg-chekin-surface-pressed text-chekin-blue"),
|
|
7155
7266
|
onClick: () => onSortChange?.("desc"),
|
|
7156
7267
|
children: [
|
|
7157
|
-
/* @__PURE__ */ (0,
|
|
7268
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_lucide_react35.ArrowDown, { className: "h-4 w-4" }),
|
|
7158
7269
|
variant === "by_text" ? t("sort_z_a") : t("sort_in_desc")
|
|
7159
7270
|
]
|
|
7160
7271
|
}
|
|
7161
7272
|
),
|
|
7162
|
-
value && /* @__PURE__ */ (0,
|
|
7163
|
-
/* @__PURE__ */ (0,
|
|
7273
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(DropdownMenuItem, { onClick: () => onSortChange?.(null), children: [
|
|
7274
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_lucide_react35.Minus, { className: "h-4 w-4" }),
|
|
7164
7275
|
t("clear_sorting")
|
|
7165
7276
|
] })
|
|
7166
7277
|
] })
|
|
@@ -7168,10 +7279,10 @@ function SortingAction({
|
|
|
7168
7279
|
}
|
|
7169
7280
|
|
|
7170
7281
|
// src/status-button/StatusButton.tsx
|
|
7171
|
-
var
|
|
7282
|
+
var import_react39 = require("react");
|
|
7172
7283
|
var import_react_i18next20 = require("react-i18next");
|
|
7173
7284
|
var import_lucide_react36 = require("lucide-react");
|
|
7174
|
-
var
|
|
7285
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
7175
7286
|
function StatusButton({
|
|
7176
7287
|
hidden,
|
|
7177
7288
|
status,
|
|
@@ -7186,10 +7297,10 @@ function StatusButton({
|
|
|
7186
7297
|
...props
|
|
7187
7298
|
}) {
|
|
7188
7299
|
const { t } = (0, import_react_i18next20.useTranslation)();
|
|
7189
|
-
const configMap = (0,
|
|
7300
|
+
const configMap = (0, import_react39.useMemo)(() => {
|
|
7190
7301
|
const defaultLoadingConfig = {
|
|
7191
7302
|
text: loadingText ?? `${t("saving")}...`,
|
|
7192
|
-
icon: /* @__PURE__ */ (0,
|
|
7303
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react36.Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
7193
7304
|
variant,
|
|
7194
7305
|
isLoading: true
|
|
7195
7306
|
};
|
|
@@ -7199,13 +7310,13 @@ function StatusButton({
|
|
|
7199
7310
|
validating: { ...defaultLoadingConfig, text: t("validating") },
|
|
7200
7311
|
error: {
|
|
7201
7312
|
text: t("error"),
|
|
7202
|
-
icon: /* @__PURE__ */ (0,
|
|
7313
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react36.AlertCircle, { className: "h-4 w-4" }),
|
|
7203
7314
|
variant: "destructive",
|
|
7204
7315
|
isLoading: false
|
|
7205
7316
|
},
|
|
7206
7317
|
success: {
|
|
7207
7318
|
text: successText ?? t("saved_exclamation"),
|
|
7208
|
-
icon: /* @__PURE__ */ (0,
|
|
7319
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react36.CheckCircle, { className: "h-4 w-4" }),
|
|
7209
7320
|
variant,
|
|
7210
7321
|
isLoading: false
|
|
7211
7322
|
},
|
|
@@ -7221,7 +7332,7 @@ function StatusButton({
|
|
|
7221
7332
|
if (hidden) {
|
|
7222
7333
|
return null;
|
|
7223
7334
|
}
|
|
7224
|
-
return /* @__PURE__ */ (0,
|
|
7335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
7225
7336
|
Button,
|
|
7226
7337
|
{
|
|
7227
7338
|
className: cn(
|
|
@@ -7237,7 +7348,7 @@ function StatusButton({
|
|
|
7237
7348
|
...props,
|
|
7238
7349
|
children: [
|
|
7239
7350
|
config.icon,
|
|
7240
|
-
/* @__PURE__ */ (0,
|
|
7351
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { children: config.text })
|
|
7241
7352
|
]
|
|
7242
7353
|
}
|
|
7243
7354
|
);
|
|
@@ -7245,37 +7356,37 @@ function StatusButton({
|
|
|
7245
7356
|
|
|
7246
7357
|
// src/status-box/StatusBox.tsx
|
|
7247
7358
|
var import_lucide_react37 = require("lucide-react");
|
|
7248
|
-
var
|
|
7359
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
7249
7360
|
function StatusBox({ status, title, text }) {
|
|
7250
7361
|
if (status === "success") {
|
|
7251
|
-
return /* @__PURE__ */ (0,
|
|
7252
|
-
/* @__PURE__ */ (0,
|
|
7253
|
-
/* @__PURE__ */ (0,
|
|
7254
|
-
/* @__PURE__ */ (0,
|
|
7255
|
-
/* @__PURE__ */ (0,
|
|
7362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "flex items-center gap-3 rounded-lg border border-green-100 bg-green-50 p-4", children: [
|
|
7363
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: "rounded-full bg-green-100 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_lucide_react37.CheckIcon, { className: "h-5 w-5 text-green-600" }) }),
|
|
7364
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { children: [
|
|
7365
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("p", { className: "font-semibold text-green-800", children: title }),
|
|
7366
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("p", { className: "text-sm text-green-700", children: text })
|
|
7256
7367
|
] })
|
|
7257
7368
|
] });
|
|
7258
7369
|
}
|
|
7259
7370
|
if (status === "failed") {
|
|
7260
|
-
return /* @__PURE__ */ (0,
|
|
7261
|
-
/* @__PURE__ */ (0,
|
|
7262
|
-
/* @__PURE__ */ (0,
|
|
7263
|
-
/* @__PURE__ */ (0,
|
|
7264
|
-
/* @__PURE__ */ (0,
|
|
7371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "flex items-center gap-3 rounded-lg border border-red-100 bg-red-50 p-4", children: [
|
|
7372
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: "rounded-full bg-red-100 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_lucide_react37.XIcon, { className: "h-5 w-5 text-red-600" }) }),
|
|
7373
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { children: [
|
|
7374
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("p", { className: "font-semibold text-red-800", children: title }),
|
|
7375
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("p", { className: "text-sm text-red-700", children: text })
|
|
7265
7376
|
] })
|
|
7266
7377
|
] });
|
|
7267
7378
|
}
|
|
7268
|
-
return /* @__PURE__ */ (0,
|
|
7269
|
-
/* @__PURE__ */ (0,
|
|
7270
|
-
/* @__PURE__ */ (0,
|
|
7271
|
-
/* @__PURE__ */ (0,
|
|
7272
|
-
/* @__PURE__ */ (0,
|
|
7379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "flex items-center gap-3 rounded-lg border border-amber-100 bg-amber-50 p-4", children: [
|
|
7380
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: "rounded-full bg-amber-100 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_lucide_react37.AlertTriangleIcon, { className: "h-5 w-5 text-amber-600" }) }),
|
|
7381
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { children: [
|
|
7382
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("p", { className: "font-semibold text-amber-800", children: title }),
|
|
7383
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("p", { className: "text-sm text-amber-700", children: text })
|
|
7273
7384
|
] })
|
|
7274
7385
|
] });
|
|
7275
7386
|
}
|
|
7276
7387
|
|
|
7277
7388
|
// src/stepper/Stepper.tsx
|
|
7278
|
-
var
|
|
7389
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
7279
7390
|
function Stepper({
|
|
7280
7391
|
totalSteps,
|
|
7281
7392
|
activeStep,
|
|
@@ -7284,7 +7395,7 @@ function Stepper({
|
|
|
7284
7395
|
}) {
|
|
7285
7396
|
if (totalSteps <= 0) return null;
|
|
7286
7397
|
const clampedActiveStep = Math.max(1, Math.min(totalSteps, activeStep));
|
|
7287
|
-
return /* @__PURE__ */ (0,
|
|
7398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
7288
7399
|
"div",
|
|
7289
7400
|
{
|
|
7290
7401
|
className: cn("flex w-full items-center gap-2", className),
|
|
@@ -7295,7 +7406,7 @@ function Stepper({
|
|
|
7295
7406
|
children: new Array(totalSteps).fill(null).map((_, stepIndex) => {
|
|
7296
7407
|
const stepNumber = stepIndex + 1;
|
|
7297
7408
|
const isActive = cumulative ? stepNumber <= clampedActiveStep : stepNumber === clampedActiveStep;
|
|
7298
|
-
return /* @__PURE__ */ (0,
|
|
7409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
7299
7410
|
"span",
|
|
7300
7411
|
{
|
|
7301
7412
|
className: cn(
|
|
@@ -7311,15 +7422,15 @@ function Stepper({
|
|
|
7311
7422
|
}
|
|
7312
7423
|
|
|
7313
7424
|
// src/switch-blocks/SwitchBlocks.tsx
|
|
7314
|
-
var
|
|
7315
|
-
var
|
|
7316
|
-
var SwitchBlocksInternal = (0,
|
|
7317
|
-
({ options, value, onChange, disabled, className }, ref) => /* @__PURE__ */ (0,
|
|
7425
|
+
var import_react40 = require("react");
|
|
7426
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
7427
|
+
var SwitchBlocksInternal = (0, import_react40.forwardRef)(
|
|
7428
|
+
({ options, value, onChange, disabled, className }, ref) => /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
7318
7429
|
"div",
|
|
7319
7430
|
{
|
|
7320
7431
|
ref,
|
|
7321
7432
|
className: cn("flex flex-wrap items-center justify-start gap-4", className),
|
|
7322
|
-
children: options.map((option) => /* @__PURE__ */ (0,
|
|
7433
|
+
children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
7323
7434
|
BoxOptionSelector,
|
|
7324
7435
|
{
|
|
7325
7436
|
id: option.id,
|
|
@@ -7337,12 +7448,12 @@ var SwitchBlocksInternal = (0, import_react39.forwardRef)(
|
|
|
7337
7448
|
)
|
|
7338
7449
|
);
|
|
7339
7450
|
SwitchBlocksInternal.displayName = "SwitchBlocks";
|
|
7340
|
-
var SwitchBlocks = (0,
|
|
7451
|
+
var SwitchBlocks = (0, import_react40.memo)(SwitchBlocksInternal);
|
|
7341
7452
|
|
|
7342
7453
|
// src/switch-group/SwitchGroup.tsx
|
|
7343
|
-
var
|
|
7344
|
-
var
|
|
7345
|
-
var SwitchGroup =
|
|
7454
|
+
var React25 = __toESM(require("react"), 1);
|
|
7455
|
+
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
7456
|
+
var SwitchGroup = React25.forwardRef(
|
|
7346
7457
|
({ options, value = [], onChange, disabled = false, className, error, ...props }, ref) => {
|
|
7347
7458
|
const handleOptionChange = (optionValue, checked) => {
|
|
7348
7459
|
if (!onChange) return;
|
|
@@ -7352,9 +7463,9 @@ var SwitchGroup = React24.forwardRef(
|
|
|
7352
7463
|
}
|
|
7353
7464
|
onChange(value.filter((selectedValue) => selectedValue !== optionValue));
|
|
7354
7465
|
};
|
|
7355
|
-
return /* @__PURE__ */ (0,
|
|
7356
|
-
options.map((option) => /* @__PURE__ */ (0,
|
|
7357
|
-
/* @__PURE__ */ (0,
|
|
7466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { ref, className: cn("w-full space-y-4", className), ...props, children: [
|
|
7467
|
+
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
7468
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: "flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
|
|
7358
7469
|
Label,
|
|
7359
7470
|
{
|
|
7360
7471
|
className: cn(
|
|
@@ -7363,7 +7474,7 @@ var SwitchGroup = React24.forwardRef(
|
|
|
7363
7474
|
),
|
|
7364
7475
|
children: [
|
|
7365
7476
|
option.label,
|
|
7366
|
-
option.description && /* @__PURE__ */ (0,
|
|
7477
|
+
option.description && /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
|
|
7367
7478
|
"span",
|
|
7368
7479
|
{
|
|
7369
7480
|
className: cn(
|
|
@@ -7380,7 +7491,7 @@ var SwitchGroup = React24.forwardRef(
|
|
|
7380
7491
|
]
|
|
7381
7492
|
}
|
|
7382
7493
|
) }),
|
|
7383
|
-
/* @__PURE__ */ (0,
|
|
7494
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
7384
7495
|
Switch,
|
|
7385
7496
|
{
|
|
7386
7497
|
value: value.includes(option.value),
|
|
@@ -7390,17 +7501,17 @@ var SwitchGroup = React24.forwardRef(
|
|
|
7390
7501
|
}
|
|
7391
7502
|
)
|
|
7392
7503
|
] }, option.value)),
|
|
7393
|
-
error && /* @__PURE__ */ (0,
|
|
7504
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(ErrorMessage, { disabled, children: error })
|
|
7394
7505
|
] });
|
|
7395
7506
|
}
|
|
7396
7507
|
);
|
|
7397
7508
|
SwitchGroup.displayName = "SwitchGroup";
|
|
7398
7509
|
|
|
7399
7510
|
// src/tabs/Tabs.tsx
|
|
7400
|
-
var
|
|
7511
|
+
var import_react41 = require("react");
|
|
7401
7512
|
var TabsPrimitive2 = __toESM(require("@radix-ui/react-tabs"), 1);
|
|
7402
7513
|
var import_class_variance_authority12 = require("class-variance-authority");
|
|
7403
|
-
var
|
|
7514
|
+
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
7404
7515
|
var Tabs = TabsPrimitive2.Root;
|
|
7405
7516
|
var tabsListVariants = (0, import_class_variance_authority12.cva)("inline-flex items-center", {
|
|
7406
7517
|
variants: {
|
|
@@ -7413,8 +7524,8 @@ var tabsListVariants = (0, import_class_variance_authority12.cva)("inline-flex i
|
|
|
7413
7524
|
variant: "default"
|
|
7414
7525
|
}
|
|
7415
7526
|
});
|
|
7416
|
-
var TabsList = (0,
|
|
7417
|
-
({ className, variant, ...props }, ref) => /* @__PURE__ */ (0,
|
|
7527
|
+
var TabsList = (0, import_react41.forwardRef)(
|
|
7528
|
+
({ className, variant, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
7418
7529
|
TabsPrimitive2.List,
|
|
7419
7530
|
{
|
|
7420
7531
|
ref,
|
|
@@ -7438,7 +7549,7 @@ var tabsTriggerVariants = (0, import_class_variance_authority12.cva)(
|
|
|
7438
7549
|
}
|
|
7439
7550
|
}
|
|
7440
7551
|
);
|
|
7441
|
-
var TabsTrigger = (0,
|
|
7552
|
+
var TabsTrigger = (0, import_react41.forwardRef)(({ className, variant, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
7442
7553
|
TabsPrimitive2.Trigger,
|
|
7443
7554
|
{
|
|
7444
7555
|
ref,
|
|
@@ -7447,11 +7558,11 @@ var TabsTrigger = (0, import_react40.forwardRef)(({ className, variant, ...props
|
|
|
7447
7558
|
}
|
|
7448
7559
|
));
|
|
7449
7560
|
TabsTrigger.displayName = TabsPrimitive2.Trigger.displayName;
|
|
7450
|
-
var TabsContent = (0,
|
|
7561
|
+
var TabsContent = (0, import_react41.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(TabsPrimitive2.Content, { ref, className, tabIndex: -1, ...props }));
|
|
7451
7562
|
TabsContent.displayName = TabsPrimitive2.Content.displayName;
|
|
7452
7563
|
|
|
7453
7564
|
// src/tabbed-section/TabbedSection.tsx
|
|
7454
|
-
var
|
|
7565
|
+
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
7455
7566
|
function TabbedSection({
|
|
7456
7567
|
triggers,
|
|
7457
7568
|
value,
|
|
@@ -7473,8 +7584,8 @@ function TabbedSection({
|
|
|
7473
7584
|
"[&>div:first-child]:gap-chekin-3",
|
|
7474
7585
|
className
|
|
7475
7586
|
);
|
|
7476
|
-
return /* @__PURE__ */ (0,
|
|
7477
|
-
/* @__PURE__ */ (0,
|
|
7587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(Tabs, { value: activeTab, onValueChange: onTabChange, className: "w-full", children: [
|
|
7588
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
7478
7589
|
BookmarkTabsList,
|
|
7479
7590
|
{
|
|
7480
7591
|
variant,
|
|
@@ -7482,12 +7593,12 @@ function TabbedSection({
|
|
|
7482
7593
|
children: triggers
|
|
7483
7594
|
}
|
|
7484
7595
|
),
|
|
7485
|
-
/* @__PURE__ */ (0,
|
|
7596
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: contentContainerClassName, children })
|
|
7486
7597
|
] });
|
|
7487
7598
|
}
|
|
7488
7599
|
|
|
7489
7600
|
// src/table-placeholder/TablePlaceholder.tsx
|
|
7490
|
-
var
|
|
7601
|
+
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
7491
7602
|
function TablePlaceholder({
|
|
7492
7603
|
children,
|
|
7493
7604
|
text,
|
|
@@ -7500,16 +7611,16 @@ function TablePlaceholder({
|
|
|
7500
7611
|
if (!visible) {
|
|
7501
7612
|
return null;
|
|
7502
7613
|
}
|
|
7503
|
-
const content = /* @__PURE__ */ (0,
|
|
7504
|
-
iconSlot && /* @__PURE__ */ (0,
|
|
7505
|
-
title && /* @__PURE__ */ (0,
|
|
7506
|
-
text && /* @__PURE__ */ (0,
|
|
7507
|
-
children && /* @__PURE__ */ (0,
|
|
7614
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "flex flex-col items-center justify-center px-4 py-14 text-center", children: [
|
|
7615
|
+
iconSlot && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "mb-6", children: iconSlot }),
|
|
7616
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("h3", { className: "mb-2 text-lg font-semibold", children: title }),
|
|
7617
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("p", { className: "text-md max-w-sm font-medium", children: text }),
|
|
7618
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "mt-6", children })
|
|
7508
7619
|
] });
|
|
7509
7620
|
if (insideTable) {
|
|
7510
|
-
return /* @__PURE__ */ (0,
|
|
7621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("td", { colSpan: 100, className, children: content }) });
|
|
7511
7622
|
}
|
|
7512
|
-
return /* @__PURE__ */ (0,
|
|
7623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className, children: content });
|
|
7513
7624
|
}
|
|
7514
7625
|
|
|
7515
7626
|
// src/task-card/TaskCard.tsx
|
|
@@ -7519,7 +7630,7 @@ var import_lucide_react38 = require("lucide-react");
|
|
|
7519
7630
|
var TaskCard_default = {};
|
|
7520
7631
|
|
|
7521
7632
|
// src/task-card/TaskCard.tsx
|
|
7522
|
-
var
|
|
7633
|
+
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
7523
7634
|
function TaskCard({
|
|
7524
7635
|
title,
|
|
7525
7636
|
description,
|
|
@@ -7530,7 +7641,7 @@ function TaskCard({
|
|
|
7530
7641
|
}) {
|
|
7531
7642
|
const shouldShowCount = count !== void 0 && count > 1;
|
|
7532
7643
|
const shouldShowActions = shouldShowCount || onClick;
|
|
7533
|
-
return /* @__PURE__ */ (0,
|
|
7644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(
|
|
7534
7645
|
"div",
|
|
7535
7646
|
{
|
|
7536
7647
|
className: cn(
|
|
@@ -7543,13 +7654,13 @@ function TaskCard({
|
|
|
7543
7654
|
role: onClick ? "button" : void 0,
|
|
7544
7655
|
tabIndex: onClick ? 0 : void 0,
|
|
7545
7656
|
children: [
|
|
7546
|
-
/* @__PURE__ */ (0,
|
|
7547
|
-
/* @__PURE__ */ (0,
|
|
7548
|
-
/* @__PURE__ */ (0,
|
|
7549
|
-
/* @__PURE__ */ (0,
|
|
7657
|
+
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: TaskCard_default.TaskCard__indicator }),
|
|
7658
|
+
/* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: TaskCard_default.TaskCard__content, children: [
|
|
7659
|
+
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)("h4", { className: TaskCard_default.TaskCard__title, children: title }),
|
|
7660
|
+
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)("p", { className: TaskCard_default.TaskCard__date, children: description })
|
|
7550
7661
|
] }),
|
|
7551
|
-
shouldShowActions && /* @__PURE__ */ (0,
|
|
7552
|
-
shouldShowCount && /* @__PURE__ */ (0,
|
|
7662
|
+
shouldShowActions && /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: TaskCard_default.TaskCard__actions, children: [
|
|
7663
|
+
shouldShowCount && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
7553
7664
|
"div",
|
|
7554
7665
|
{
|
|
7555
7666
|
className: cn(
|
|
@@ -7559,7 +7670,7 @@ function TaskCard({
|
|
|
7559
7670
|
children: count
|
|
7560
7671
|
}
|
|
7561
7672
|
),
|
|
7562
|
-
onClick && /* @__PURE__ */ (0,
|
|
7673
|
+
onClick && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
7563
7674
|
"button",
|
|
7564
7675
|
{
|
|
7565
7676
|
className: TaskCard_default.TaskCard__arrowButton,
|
|
@@ -7569,7 +7680,7 @@ function TaskCard({
|
|
|
7569
7680
|
},
|
|
7570
7681
|
"aria-label": "View details",
|
|
7571
7682
|
type: "button",
|
|
7572
|
-
children: /* @__PURE__ */ (0,
|
|
7683
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_lucide_react38.ArrowRight, { className: "h-5 w-5" })
|
|
7573
7684
|
}
|
|
7574
7685
|
)
|
|
7575
7686
|
] })
|
|
@@ -7588,11 +7699,11 @@ var TASK_VARIANTS = {
|
|
|
7588
7699
|
var import_sonner2 = require("sonner");
|
|
7589
7700
|
|
|
7590
7701
|
// src/toaster/useUpdateToast.ts
|
|
7591
|
-
var
|
|
7702
|
+
var import_react42 = require("react");
|
|
7592
7703
|
var import_sonner = require("sonner");
|
|
7593
7704
|
function useUpdateToast({ id }) {
|
|
7594
|
-
const toastIdRef = (0,
|
|
7595
|
-
const getToastOptions = (0,
|
|
7705
|
+
const toastIdRef = (0, import_react42.useRef)("");
|
|
7706
|
+
const getToastOptions = (0, import_react42.useCallback)(
|
|
7596
7707
|
(options) => ({
|
|
7597
7708
|
id: toastIdRef.current,
|
|
7598
7709
|
dismissible: false,
|
|
@@ -7624,7 +7735,7 @@ function useUpdateToast({ id }) {
|
|
|
7624
7735
|
}
|
|
7625
7736
|
|
|
7626
7737
|
// src/toggle-group/ToggleGroup.tsx
|
|
7627
|
-
var
|
|
7738
|
+
var React26 = __toESM(require("react"), 1);
|
|
7628
7739
|
var ToggleGroupPrimitive = __toESM(require("@radix-ui/react-toggle-group"), 1);
|
|
7629
7740
|
|
|
7630
7741
|
// src/toggle-group/style.ts
|
|
@@ -7657,15 +7768,15 @@ var toggleVariants = (0, import_class_variance_authority13.cva)(
|
|
|
7657
7768
|
);
|
|
7658
7769
|
|
|
7659
7770
|
// src/toggle-group/ToggleGroup.tsx
|
|
7660
|
-
var
|
|
7661
|
-
var ToggleGroupContext =
|
|
7771
|
+
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
7772
|
+
var ToggleGroupContext = React26.createContext({
|
|
7662
7773
|
size: "default",
|
|
7663
7774
|
variant: "default",
|
|
7664
7775
|
theme: "default"
|
|
7665
7776
|
});
|
|
7666
|
-
var ToggleGroup =
|
|
7777
|
+
var ToggleGroup = React26.forwardRef(({ className, variant, size, theme, children, ...props }, ref) => {
|
|
7667
7778
|
const isTabVariant = variant === "tab";
|
|
7668
|
-
return /* @__PURE__ */ (0,
|
|
7779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
7669
7780
|
ToggleGroupPrimitive.Root,
|
|
7670
7781
|
{
|
|
7671
7782
|
ref,
|
|
@@ -7675,16 +7786,16 @@ var ToggleGroup = React25.forwardRef(({ className, variant, size, theme, childre
|
|
|
7675
7786
|
className
|
|
7676
7787
|
),
|
|
7677
7788
|
...props,
|
|
7678
|
-
children: /* @__PURE__ */ (0,
|
|
7789
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ToggleGroupContext.Provider, { value: { variant, size, theme }, children })
|
|
7679
7790
|
}
|
|
7680
7791
|
);
|
|
7681
7792
|
});
|
|
7682
7793
|
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
7683
|
-
var ToggleGroupItem =
|
|
7684
|
-
const context =
|
|
7794
|
+
var ToggleGroupItem = React26.forwardRef(({ className, children, variant, size, theme, ...props }, ref) => {
|
|
7795
|
+
const context = React26.useContext(ToggleGroupContext);
|
|
7685
7796
|
const resolvedVariant = context.variant || variant;
|
|
7686
7797
|
const isTabVariant = resolvedVariant === "tab";
|
|
7687
|
-
return /* @__PURE__ */ (0,
|
|
7798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
7688
7799
|
ToggleGroupPrimitive.Item,
|
|
7689
7800
|
{
|
|
7690
7801
|
ref,
|
|
@@ -7697,9 +7808,9 @@ var ToggleGroupItem = React25.forwardRef(({ className, children, variant, size,
|
|
|
7697
7808
|
className
|
|
7698
7809
|
),
|
|
7699
7810
|
...props,
|
|
7700
|
-
children: isTabVariant ? /* @__PURE__ */ (0,
|
|
7701
|
-
/* @__PURE__ */ (0,
|
|
7702
|
-
/* @__PURE__ */ (0,
|
|
7811
|
+
children: isTabVariant ? /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("span", { className: "inline-grid", children: [
|
|
7812
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "invisible col-start-1 row-start-1 font-semibold", children }),
|
|
7813
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "col-start-1 row-start-1", children })
|
|
7703
7814
|
] }) : children
|
|
7704
7815
|
}
|
|
7705
7816
|
);
|
|
@@ -7707,8 +7818,8 @@ var ToggleGroupItem = React25.forwardRef(({ className, children, variant, size,
|
|
|
7707
7818
|
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
7708
7819
|
|
|
7709
7820
|
// src/toggle-group/Toggles.tsx
|
|
7710
|
-
var
|
|
7711
|
-
var
|
|
7821
|
+
var import_react43 = require("react");
|
|
7822
|
+
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
7712
7823
|
var getValueArray2 = (value) => {
|
|
7713
7824
|
if (value) {
|
|
7714
7825
|
return Array.isArray(value) ? value : [value];
|
|
@@ -7782,7 +7893,7 @@ function TogglesInternal({
|
|
|
7782
7893
|
}
|
|
7783
7894
|
};
|
|
7784
7895
|
const isAnyActive = getValueArray2(value).length > 0;
|
|
7785
|
-
(0,
|
|
7896
|
+
(0, import_react43.useEffect)(() => {
|
|
7786
7897
|
onAnySelectorActive?.(isAnyActive);
|
|
7787
7898
|
}, [isAnyActive, onAnySelectorActive]);
|
|
7788
7899
|
const currentValue = getValueArray2(value).map((item) => String(item));
|
|
@@ -7793,14 +7904,14 @@ function TogglesInternal({
|
|
|
7793
7904
|
onValueChange: handleValueChange,
|
|
7794
7905
|
...multiple ? { type: "multiple", value: currentValue } : { type: "single", value: currentValue[0] ?? "" }
|
|
7795
7906
|
};
|
|
7796
|
-
return /* @__PURE__ */ (0,
|
|
7797
|
-
label && /* @__PURE__ */ (0,
|
|
7798
|
-
/* @__PURE__ */ (0,
|
|
7907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("div", { ref, className, children: [
|
|
7908
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: "mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: "select-none text-base font-normal text-chekin-navy", children: label }) }),
|
|
7909
|
+
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)(ToggleGroup, { className: groupClassName, ...toggleGroupProps, children: options.map((option, index) => {
|
|
7799
7910
|
const isSelected = getValueArray2(value).includes(option.value);
|
|
7800
7911
|
const isDisabled = disabled || disabledItems?.includes(option.value) || option.disabled;
|
|
7801
7912
|
const isMinSelected = getValueArray2(value).length <= minSelected;
|
|
7802
7913
|
const isItemReadOnly = readOnly || isMinSelected && isSelected;
|
|
7803
|
-
return /* @__PURE__ */ (0,
|
|
7914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
7804
7915
|
ToggleGroupItem,
|
|
7805
7916
|
{
|
|
7806
7917
|
value: String(option.value),
|
|
@@ -7813,31 +7924,31 @@ function TogglesInternal({
|
|
|
7813
7924
|
}) })
|
|
7814
7925
|
] });
|
|
7815
7926
|
}
|
|
7816
|
-
var Toggles = (0,
|
|
7927
|
+
var Toggles = (0, import_react43.forwardRef)(TogglesInternal);
|
|
7817
7928
|
|
|
7818
7929
|
// src/text-field/TextField.tsx
|
|
7819
|
-
var
|
|
7930
|
+
var React27 = __toESM(require("react"), 1);
|
|
7820
7931
|
var LabelPrimitive2 = __toESM(require("@radix-ui/react-label"), 1);
|
|
7821
7932
|
var import_class_variance_authority14 = require("class-variance-authority");
|
|
7822
7933
|
var import_react_i18next21 = require("react-i18next");
|
|
7823
7934
|
|
|
7824
7935
|
// src/text-field/EndIcon.tsx
|
|
7825
|
-
var
|
|
7826
|
-
var EndIcon = ({ children }) => /* @__PURE__ */ (0,
|
|
7936
|
+
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
7937
|
+
var EndIcon = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime111.jsx)("div", { className: "pointer-events-none absolute right-3.5 top-1/2 -translate-y-1/2 [&>*]:pointer-events-auto", children });
|
|
7827
7938
|
|
|
7828
7939
|
// src/text-field/FieldError.tsx
|
|
7829
|
-
var
|
|
7830
|
-
var FieldError = ({ id, children }) => /* @__PURE__ */ (0,
|
|
7940
|
+
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
7941
|
+
var FieldError = ({ id, children }) => /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { id, className: "mt-1 text-right text-xs font-medium text-chekin-red", role: "alert", children });
|
|
7831
7942
|
|
|
7832
7943
|
// src/text-field/SupportingText.tsx
|
|
7833
|
-
var
|
|
7834
|
-
var SupportingText = ({ id, children }) => /* @__PURE__ */ (0,
|
|
7944
|
+
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
7945
|
+
var SupportingText = ({ id, children }) => /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("p", { id, className: "mt-1 text-xs italic text-chekin-gray-2", children });
|
|
7835
7946
|
|
|
7836
7947
|
// src/text-field/textField.module.css
|
|
7837
7948
|
var textField_default = {};
|
|
7838
7949
|
|
|
7839
7950
|
// src/text-field/TextField.tsx
|
|
7840
|
-
var
|
|
7951
|
+
var import_jsx_runtime114 = require("react/jsx-runtime");
|
|
7841
7952
|
var inputVariants = (0, import_class_variance_authority14.cva)(
|
|
7842
7953
|
[
|
|
7843
7954
|
"flex w-full border text-base font-medium leading-5 outline-none transition-colors",
|
|
@@ -7910,7 +8021,7 @@ var floatingLabelClasses = [
|
|
|
7910
8021
|
"peer-focus:to-[var(--text-field-bg-filled)]",
|
|
7911
8022
|
"peer-focus:to-50%"
|
|
7912
8023
|
];
|
|
7913
|
-
var TextField =
|
|
8024
|
+
var TextField = React27.forwardRef(
|
|
7914
8025
|
({
|
|
7915
8026
|
className,
|
|
7916
8027
|
wrapperClassName,
|
|
@@ -7929,7 +8040,7 @@ var TextField = React26.forwardRef(
|
|
|
7929
8040
|
}, ref) => {
|
|
7930
8041
|
const { t } = (0, import_react_i18next21.useTranslation)();
|
|
7931
8042
|
const hasError = Boolean(error);
|
|
7932
|
-
const autoId =
|
|
8043
|
+
const autoId = React27.useId();
|
|
7933
8044
|
const inputId = props.id || autoId;
|
|
7934
8045
|
const inputClasses = cn(
|
|
7935
8046
|
inputVariants({ variant, error: hasError, readOnly: Boolean(readOnly) }),
|
|
@@ -7941,13 +8052,13 @@ var TextField = React26.forwardRef(
|
|
|
7941
8052
|
const errorId = error ? `${inputId}-error` : void 0;
|
|
7942
8053
|
const ariaDescribedBy = errorId || descriptionId || void 0;
|
|
7943
8054
|
if (variant === "floating") {
|
|
7944
|
-
return /* @__PURE__ */ (0,
|
|
8055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(
|
|
7945
8056
|
"div",
|
|
7946
8057
|
{
|
|
7947
8058
|
className: cn("relative flex w-full flex-col", textField_default.root, wrapperClassName),
|
|
7948
8059
|
children: [
|
|
7949
|
-
/* @__PURE__ */ (0,
|
|
7950
|
-
/* @__PURE__ */ (0,
|
|
8060
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "relative", children: [
|
|
8061
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
7951
8062
|
"input",
|
|
7952
8063
|
{
|
|
7953
8064
|
id: inputId,
|
|
@@ -7961,7 +8072,7 @@ var TextField = React26.forwardRef(
|
|
|
7961
8072
|
...props
|
|
7962
8073
|
}
|
|
7963
8074
|
),
|
|
7964
|
-
label && /* @__PURE__ */ (0,
|
|
8075
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
7965
8076
|
LabelPrimitive2.Root,
|
|
7966
8077
|
{
|
|
7967
8078
|
htmlFor: inputId,
|
|
@@ -7975,17 +8086,17 @@ var TextField = React26.forwardRef(
|
|
|
7975
8086
|
children: label
|
|
7976
8087
|
}
|
|
7977
8088
|
),
|
|
7978
|
-
endIcon && /* @__PURE__ */ (0,
|
|
8089
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(EndIcon, { children: endIcon })
|
|
7979
8090
|
] }),
|
|
7980
|
-
supportingText && !hasError && /* @__PURE__ */ (0,
|
|
7981
|
-
hasError && /* @__PURE__ */ (0,
|
|
8091
|
+
supportingText && !hasError && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(SupportingText, { id: descriptionId, children: supportingText }),
|
|
8092
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(FieldError, { id: errorId, children: error })
|
|
7982
8093
|
]
|
|
7983
8094
|
}
|
|
7984
8095
|
);
|
|
7985
8096
|
}
|
|
7986
|
-
return /* @__PURE__ */ (0,
|
|
7987
|
-
label && /* @__PURE__ */ (0,
|
|
7988
|
-
/* @__PURE__ */ (0,
|
|
8097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: cn("flex w-full flex-col", textField_default.root, wrapperClassName), children: [
|
|
8098
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "mb-1 flex items-center gap-1", children: [
|
|
8099
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
7989
8100
|
LabelPrimitive2.Root,
|
|
7990
8101
|
{
|
|
7991
8102
|
htmlFor: inputId,
|
|
@@ -7993,14 +8104,14 @@ var TextField = React26.forwardRef(
|
|
|
7993
8104
|
children: label
|
|
7994
8105
|
}
|
|
7995
8106
|
),
|
|
7996
|
-
optional && /* @__PURE__ */ (0,
|
|
7997
|
-
/* @__PURE__ */ (0,
|
|
7998
|
-
/* @__PURE__ */ (0,
|
|
8107
|
+
optional && /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("span", { className: "text-base leading-4", children: [
|
|
8108
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)("span", { className: "text-chekin-navy", children: "- " }),
|
|
8109
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)("span", { className: "italic text-chekin-gray-2", children: optionalLabel || t("optional") })
|
|
7999
8110
|
] }),
|
|
8000
8111
|
tooltip
|
|
8001
8112
|
] }),
|
|
8002
|
-
/* @__PURE__ */ (0,
|
|
8003
|
-
/* @__PURE__ */ (0,
|
|
8113
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "relative", children: [
|
|
8114
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
8004
8115
|
"input",
|
|
8005
8116
|
{
|
|
8006
8117
|
id: inputId,
|
|
@@ -8014,28 +8125,28 @@ var TextField = React26.forwardRef(
|
|
|
8014
8125
|
...props
|
|
8015
8126
|
}
|
|
8016
8127
|
),
|
|
8017
|
-
endIcon && /* @__PURE__ */ (0,
|
|
8128
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(EndIcon, { children: endIcon })
|
|
8018
8129
|
] }),
|
|
8019
|
-
supportingText && !hasError && /* @__PURE__ */ (0,
|
|
8020
|
-
hasError && /* @__PURE__ */ (0,
|
|
8130
|
+
supportingText && !hasError && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(SupportingText, { id: descriptionId, children: supportingText }),
|
|
8131
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(FieldError, { id: errorId, children: error })
|
|
8021
8132
|
] });
|
|
8022
8133
|
}
|
|
8023
8134
|
);
|
|
8024
8135
|
TextField.displayName = "TextField";
|
|
8025
8136
|
|
|
8026
8137
|
// src/textarea/Textarea.tsx
|
|
8027
|
-
var
|
|
8138
|
+
var import_react44 = require("react");
|
|
8028
8139
|
|
|
8029
8140
|
// src/textarea/styles.module.css
|
|
8030
8141
|
var styles_default9 = {};
|
|
8031
8142
|
|
|
8032
8143
|
// src/textarea/Textarea.tsx
|
|
8033
|
-
var
|
|
8034
|
-
var Textarea = (0,
|
|
8144
|
+
var import_jsx_runtime115 = require("react/jsx-runtime");
|
|
8145
|
+
var Textarea = (0, import_react44.forwardRef)(
|
|
8035
8146
|
({ className, textareaClassName, label, disabled, name, invalid, ...textareaProps }, ref) => {
|
|
8036
|
-
const inputId = (0,
|
|
8037
|
-
return /* @__PURE__ */ (0,
|
|
8038
|
-
/* @__PURE__ */ (0,
|
|
8147
|
+
const inputId = (0, import_react44.useId)();
|
|
8148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: cn(styles_default9.container, className), children: [
|
|
8149
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
|
|
8039
8150
|
"textarea",
|
|
8040
8151
|
{
|
|
8041
8152
|
ref,
|
|
@@ -8049,7 +8160,7 @@ var Textarea = (0, import_react43.forwardRef)(
|
|
|
8049
8160
|
...textareaProps
|
|
8050
8161
|
}
|
|
8051
8162
|
),
|
|
8052
|
-
label && /* @__PURE__ */ (0,
|
|
8163
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
|
|
8053
8164
|
"label",
|
|
8054
8165
|
{
|
|
8055
8166
|
htmlFor: inputId,
|
|
@@ -8076,16 +8187,16 @@ var LABEL_PLACEMENT = /* @__PURE__ */ ((LABEL_PLACEMENT2) => {
|
|
|
8076
8187
|
var styles_default10 = {};
|
|
8077
8188
|
|
|
8078
8189
|
// src/three-dots-loader/ThreeDotsLoader.tsx
|
|
8079
|
-
var
|
|
8190
|
+
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
8080
8191
|
function Dots({
|
|
8081
8192
|
height,
|
|
8082
8193
|
width,
|
|
8083
8194
|
color
|
|
8084
8195
|
}) {
|
|
8085
|
-
return /* @__PURE__ */ (0,
|
|
8086
|
-
/* @__PURE__ */ (0,
|
|
8087
|
-
/* @__PURE__ */ (0,
|
|
8088
|
-
/* @__PURE__ */ (0,
|
|
8196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("span", { className: styles_default10.dots, style: { height, width }, "aria-hidden": "true", children: [
|
|
8197
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: styles_default10.dot, style: { backgroundColor: color } }),
|
|
8198
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: styles_default10.dot, style: { backgroundColor: color } }),
|
|
8199
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: styles_default10.dot, style: { backgroundColor: color } })
|
|
8089
8200
|
] });
|
|
8090
8201
|
}
|
|
8091
8202
|
function ThreeDotsLoader({
|
|
@@ -8096,22 +8207,22 @@ function ThreeDotsLoader({
|
|
|
8096
8207
|
className,
|
|
8097
8208
|
labelPlacement = 0 /* right */
|
|
8098
8209
|
}) {
|
|
8099
|
-
const dots = /* @__PURE__ */ (0,
|
|
8210
|
+
const dots = /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Dots, { color, height, width });
|
|
8100
8211
|
if (label) {
|
|
8101
|
-
return /* @__PURE__ */ (0,
|
|
8212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { className: cn(styles_default10.Loader, className), children: labelPlacement === 0 /* right */ ? /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(import_jsx_runtime116.Fragment, { children: [
|
|
8102
8213
|
dots,
|
|
8103
|
-
/* @__PURE__ */ (0,
|
|
8104
|
-
] }) : /* @__PURE__ */ (0,
|
|
8105
|
-
/* @__PURE__ */ (0,
|
|
8214
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { children: label })
|
|
8215
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(import_jsx_runtime116.Fragment, { children: [
|
|
8216
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { children: label }),
|
|
8106
8217
|
dots
|
|
8107
8218
|
] }) });
|
|
8108
8219
|
}
|
|
8109
|
-
return /* @__PURE__ */ (0,
|
|
8220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { className, children: dots });
|
|
8110
8221
|
}
|
|
8111
8222
|
|
|
8112
8223
|
// src/uploaded-files-list/UploadedFilesList.tsx
|
|
8113
8224
|
var import_lucide_react39 = require("lucide-react");
|
|
8114
|
-
var
|
|
8225
|
+
var import_jsx_runtime117 = require("react/jsx-runtime");
|
|
8115
8226
|
function UploadedFilesList({
|
|
8116
8227
|
files,
|
|
8117
8228
|
onRemoveFile,
|
|
@@ -8120,20 +8231,20 @@ function UploadedFilesList({
|
|
|
8120
8231
|
if (!files.length) {
|
|
8121
8232
|
return null;
|
|
8122
8233
|
}
|
|
8123
|
-
return /* @__PURE__ */ (0,
|
|
8234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: cn("flex flex-wrap gap-2.5", className), children: files.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(
|
|
8124
8235
|
"div",
|
|
8125
8236
|
{
|
|
8126
8237
|
className: "flex cursor-default items-center gap-2 rounded border border-chekin-gray-2 bg-chekin-surface-pressed py-1.5 pl-3 pr-1.5",
|
|
8127
8238
|
children: [
|
|
8128
|
-
/* @__PURE__ */ (0,
|
|
8129
|
-
/* @__PURE__ */ (0,
|
|
8239
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)("span", { className: "text-nowrap text-sm font-medium leading-5 text-chekin-navy", children: file.name }),
|
|
8240
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
8130
8241
|
"button",
|
|
8131
8242
|
{
|
|
8132
8243
|
type: "button",
|
|
8133
8244
|
onClick: () => onRemoveFile(file.name),
|
|
8134
8245
|
className: "flex h-[18px] w-[18px] shrink-0 cursor-pointer items-center justify-center rounded bg-chekin-gray-1 transition-all hover:shadow-md active:opacity-95",
|
|
8135
8246
|
"aria-label": `Remove ${file.name}`,
|
|
8136
|
-
children: /* @__PURE__ */ (0,
|
|
8247
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_lucide_react39.X, { className: "h-3.5 w-3.5 text-white", strokeWidth: 3 })
|
|
8137
8248
|
}
|
|
8138
8249
|
)
|
|
8139
8250
|
]
|
|
@@ -8143,9 +8254,9 @@ function UploadedFilesList({
|
|
|
8143
8254
|
}
|
|
8144
8255
|
|
|
8145
8256
|
// src/wide-button/WideButton.tsx
|
|
8146
|
-
var
|
|
8257
|
+
var import_jsx_runtime118 = require("react/jsx-runtime");
|
|
8147
8258
|
function WideButton({ className, disabled, ...props }) {
|
|
8148
|
-
return /* @__PURE__ */ (0,
|
|
8259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
8149
8260
|
Button,
|
|
8150
8261
|
{
|
|
8151
8262
|
variant: "ghost",
|
|
@@ -8162,29 +8273,29 @@ function WideButton({ className, disabled, ...props }) {
|
|
|
8162
8273
|
}
|
|
8163
8274
|
|
|
8164
8275
|
// src/datepicker/DatePicker.tsx
|
|
8165
|
-
var
|
|
8276
|
+
var React31 = __toESM(require("react"), 1);
|
|
8166
8277
|
var import_lucide_react42 = require("lucide-react");
|
|
8167
8278
|
|
|
8168
8279
|
// src/drawer/Drawer.tsx
|
|
8169
|
-
var
|
|
8280
|
+
var React28 = __toESM(require("react"), 1);
|
|
8170
8281
|
var DialogPrimitive2 = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
8171
8282
|
var import_react_draggable = __toESM(require("react-draggable"), 1);
|
|
8172
|
-
var
|
|
8283
|
+
var import_jsx_runtime119 = require("react/jsx-runtime");
|
|
8173
8284
|
var DRAWER_CLOSE_THRESHOLD = 72;
|
|
8174
8285
|
var DRAWER_MIN_OVERLAY_OPACITY = 0.1;
|
|
8175
8286
|
function Drawer({ ...props }) {
|
|
8176
|
-
return /* @__PURE__ */ (0,
|
|
8287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(DialogPrimitive2.Root, { "data-slot": "drawer", ...props });
|
|
8177
8288
|
}
|
|
8178
8289
|
function DrawerTrigger({ ...props }) {
|
|
8179
|
-
return /* @__PURE__ */ (0,
|
|
8290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(DialogPrimitive2.Trigger, { "data-slot": "drawer-trigger", ...props });
|
|
8180
8291
|
}
|
|
8181
8292
|
function DrawerPortal({ ...props }) {
|
|
8182
|
-
return /* @__PURE__ */ (0,
|
|
8293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(DialogPrimitive2.Portal, { "data-slot": "drawer-portal", ...props });
|
|
8183
8294
|
}
|
|
8184
8295
|
function DrawerClose({ ...props }) {
|
|
8185
|
-
return /* @__PURE__ */ (0,
|
|
8296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(DialogPrimitive2.Close, { "data-slot": "drawer-close", ...props });
|
|
8186
8297
|
}
|
|
8187
|
-
var DrawerOverlay =
|
|
8298
|
+
var DrawerOverlay = React28.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
8188
8299
|
DialogPrimitive2.Overlay,
|
|
8189
8300
|
{
|
|
8190
8301
|
ref,
|
|
@@ -8198,7 +8309,7 @@ var DrawerOverlay = React27.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
8198
8309
|
));
|
|
8199
8310
|
DrawerOverlay.displayName = DialogPrimitive2.Overlay.displayName;
|
|
8200
8311
|
var DrawerOverlayClasses = "fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0";
|
|
8201
|
-
var DrawerContent =
|
|
8312
|
+
var DrawerContent = React28.forwardRef(
|
|
8202
8313
|
({
|
|
8203
8314
|
className,
|
|
8204
8315
|
children,
|
|
@@ -8210,19 +8321,19 @@ var DrawerContent = React27.forwardRef(
|
|
|
8210
8321
|
...props
|
|
8211
8322
|
}, ref) => {
|
|
8212
8323
|
const finalContainer = container || getCustomContainer() || void 0;
|
|
8213
|
-
const nodeRef =
|
|
8214
|
-
const [dragOffsetY, setDragOffsetY] =
|
|
8324
|
+
const nodeRef = React28.useRef(null);
|
|
8325
|
+
const [dragOffsetY, setDragOffsetY] = React28.useState(0);
|
|
8215
8326
|
const overlayOpacity = Math.max(
|
|
8216
8327
|
DRAWER_MIN_OVERLAY_OPACITY,
|
|
8217
8328
|
1 - dragOffsetY / (DRAWER_CLOSE_THRESHOLD * 2)
|
|
8218
8329
|
);
|
|
8219
|
-
const handleDrag =
|
|
8330
|
+
const handleDrag = React28.useCallback(
|
|
8220
8331
|
(_event, data) => {
|
|
8221
8332
|
setDragOffsetY(Math.max(0, data.y));
|
|
8222
8333
|
},
|
|
8223
8334
|
[]
|
|
8224
8335
|
);
|
|
8225
|
-
const handleStop =
|
|
8336
|
+
const handleStop = React28.useCallback(
|
|
8226
8337
|
(_event, data) => {
|
|
8227
8338
|
if (data.y > DRAWER_CLOSE_THRESHOLD) {
|
|
8228
8339
|
setDragOffsetY(0);
|
|
@@ -8233,14 +8344,14 @@ var DrawerContent = React27.forwardRef(
|
|
|
8233
8344
|
},
|
|
8234
8345
|
[onClose]
|
|
8235
8346
|
);
|
|
8236
|
-
return /* @__PURE__ */ (0,
|
|
8237
|
-
lockScroll ? /* @__PURE__ */ (0,
|
|
8347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(DrawerPortal, { container: finalContainer, children: [
|
|
8348
|
+
lockScroll ? /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
8238
8349
|
DrawerOverlay,
|
|
8239
8350
|
{
|
|
8240
8351
|
style: { opacity: overlayOpacity },
|
|
8241
8352
|
onClick: closeOnOverlayClick ? onClose : void 0
|
|
8242
8353
|
}
|
|
8243
|
-
) : /* @__PURE__ */ (0,
|
|
8354
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
8244
8355
|
"div",
|
|
8245
8356
|
{
|
|
8246
8357
|
className: cn(DrawerOverlayClasses),
|
|
@@ -8248,7 +8359,7 @@ var DrawerContent = React27.forwardRef(
|
|
|
8248
8359
|
onClick: closeOnOverlayClick ? onClose : void 0
|
|
8249
8360
|
}
|
|
8250
8361
|
),
|
|
8251
|
-
/* @__PURE__ */ (0,
|
|
8362
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
8252
8363
|
DialogPrimitive2.Content,
|
|
8253
8364
|
{
|
|
8254
8365
|
asChild: true,
|
|
@@ -8264,7 +8375,7 @@ var DrawerContent = React27.forwardRef(
|
|
|
8264
8375
|
}
|
|
8265
8376
|
},
|
|
8266
8377
|
...props,
|
|
8267
|
-
children: /* @__PURE__ */ (0,
|
|
8378
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "fixed inset-x-0 bottom-0 top-auto z-50 outline-none", children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
8268
8379
|
import_react_draggable.default,
|
|
8269
8380
|
{
|
|
8270
8381
|
axis: "y",
|
|
@@ -8274,7 +8385,7 @@ var DrawerContent = React27.forwardRef(
|
|
|
8274
8385
|
onDrag: handleDrag,
|
|
8275
8386
|
onStop: handleStop,
|
|
8276
8387
|
position: { x: 0, y: dragOffsetY },
|
|
8277
|
-
children: /* @__PURE__ */ (0,
|
|
8388
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
|
|
8278
8389
|
"div",
|
|
8279
8390
|
{
|
|
8280
8391
|
ref: nodeRef,
|
|
@@ -8283,15 +8394,15 @@ var DrawerContent = React27.forwardRef(
|
|
|
8283
8394
|
className
|
|
8284
8395
|
),
|
|
8285
8396
|
children: [
|
|
8286
|
-
showHandle && /* @__PURE__ */ (0,
|
|
8397
|
+
showHandle && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
8287
8398
|
"div",
|
|
8288
8399
|
{
|
|
8289
8400
|
"data-drawer-handle": true,
|
|
8290
8401
|
className: "mx-auto flex h-8 w-24 cursor-grab touch-none items-center justify-center active:cursor-grabbing",
|
|
8291
|
-
children: /* @__PURE__ */ (0,
|
|
8402
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "block h-1.5 w-12 rounded-full bg-[#D9D7D3]" })
|
|
8292
8403
|
}
|
|
8293
8404
|
),
|
|
8294
|
-
/* @__PURE__ */ (0,
|
|
8405
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", children })
|
|
8295
8406
|
]
|
|
8296
8407
|
}
|
|
8297
8408
|
)
|
|
@@ -8303,7 +8414,7 @@ var DrawerContent = React27.forwardRef(
|
|
|
8303
8414
|
}
|
|
8304
8415
|
);
|
|
8305
8416
|
DrawerContent.displayName = DialogPrimitive2.Content.displayName;
|
|
8306
|
-
var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
8417
|
+
var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
8307
8418
|
"div",
|
|
8308
8419
|
{
|
|
8309
8420
|
className: cn("flex flex-col gap-2 px-5 pt-2 text-center", className),
|
|
@@ -8311,9 +8422,9 @@ var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
8311
8422
|
}
|
|
8312
8423
|
);
|
|
8313
8424
|
DrawerHeader.displayName = "DrawerHeader";
|
|
8314
|
-
var DrawerFooter = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
8425
|
+
var DrawerFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: cn("flex flex-col gap-2 p-5", className), ...props });
|
|
8315
8426
|
DrawerFooter.displayName = "DrawerFooter";
|
|
8316
|
-
var DrawerTitle =
|
|
8427
|
+
var DrawerTitle = React28.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
8317
8428
|
DialogPrimitive2.Title,
|
|
8318
8429
|
{
|
|
8319
8430
|
ref,
|
|
@@ -8323,7 +8434,7 @@ var DrawerTitle = React27.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
8323
8434
|
}
|
|
8324
8435
|
));
|
|
8325
8436
|
DrawerTitle.displayName = DialogPrimitive2.Title.displayName;
|
|
8326
|
-
var DrawerDescription =
|
|
8437
|
+
var DrawerDescription = React28.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
8327
8438
|
DialogPrimitive2.Description,
|
|
8328
8439
|
{
|
|
8329
8440
|
ref,
|
|
@@ -8335,7 +8446,7 @@ var DrawerDescription = React27.forwardRef(({ className, ...props }, ref) => /*
|
|
|
8335
8446
|
DrawerDescription.displayName = DialogPrimitive2.Description.displayName;
|
|
8336
8447
|
|
|
8337
8448
|
// src/datepicker/useDatePickerWheel.ts
|
|
8338
|
-
var
|
|
8449
|
+
var React29 = __toESM(require("react"), 1);
|
|
8339
8450
|
|
|
8340
8451
|
// src/datepicker/datePicker.utils.ts
|
|
8341
8452
|
var DISPLAY_PAD_LENGTH = 2;
|
|
@@ -8486,21 +8597,21 @@ function useDatePickerWheel({
|
|
|
8486
8597
|
minDate,
|
|
8487
8598
|
maxDate
|
|
8488
8599
|
}) {
|
|
8489
|
-
const years =
|
|
8490
|
-
const [draftDate, setDraftDate] =
|
|
8600
|
+
const years = React29.useMemo(() => getYearRange(minDate, maxDate), [maxDate, minDate]);
|
|
8601
|
+
const [draftDate, setDraftDate] = React29.useState(
|
|
8491
8602
|
() => resolveInitialDate({ value, defaultValue, minDate, maxDate })
|
|
8492
8603
|
);
|
|
8493
8604
|
const draftYear = draftDate.getFullYear();
|
|
8494
8605
|
const draftMonth = draftDate.getMonth();
|
|
8495
|
-
const [monthScrollTop, setMonthScrollTop] =
|
|
8496
|
-
const [dayScrollTop, setDayScrollTop] =
|
|
8497
|
-
const [yearScrollTop, setYearScrollTop] =
|
|
8498
|
-
const monthListRef =
|
|
8499
|
-
const dayListRef =
|
|
8500
|
-
const yearListRef =
|
|
8501
|
-
const settleTimeoutsRef =
|
|
8502
|
-
const animationFramesRef =
|
|
8503
|
-
const columnRefs =
|
|
8606
|
+
const [monthScrollTop, setMonthScrollTop] = React29.useState(0);
|
|
8607
|
+
const [dayScrollTop, setDayScrollTop] = React29.useState(0);
|
|
8608
|
+
const [yearScrollTop, setYearScrollTop] = React29.useState(0);
|
|
8609
|
+
const monthListRef = React29.useRef(null);
|
|
8610
|
+
const dayListRef = React29.useRef(null);
|
|
8611
|
+
const yearListRef = React29.useRef(null);
|
|
8612
|
+
const settleTimeoutsRef = React29.useRef({});
|
|
8613
|
+
const animationFramesRef = React29.useRef({});
|
|
8614
|
+
const columnRefs = React29.useMemo(
|
|
8504
8615
|
() => ({
|
|
8505
8616
|
month: monthListRef,
|
|
8506
8617
|
day: dayListRef,
|
|
@@ -8508,7 +8619,7 @@ function useDatePickerWheel({
|
|
|
8508
8619
|
}),
|
|
8509
8620
|
[]
|
|
8510
8621
|
);
|
|
8511
|
-
const setColumnScrollTop =
|
|
8622
|
+
const setColumnScrollTop = React29.useCallback(
|
|
8512
8623
|
(column, nextScrollTop) => {
|
|
8513
8624
|
if (column === "month") {
|
|
8514
8625
|
setMonthScrollTop(nextScrollTop);
|
|
@@ -8522,19 +8633,19 @@ function useDatePickerWheel({
|
|
|
8522
8633
|
},
|
|
8523
8634
|
[]
|
|
8524
8635
|
);
|
|
8525
|
-
const clearSettleTimeout =
|
|
8636
|
+
const clearSettleTimeout = React29.useCallback((column) => {
|
|
8526
8637
|
const timeoutId = settleTimeoutsRef.current[column];
|
|
8527
8638
|
if (timeoutId === void 0) return;
|
|
8528
8639
|
window.clearTimeout(timeoutId);
|
|
8529
8640
|
delete settleTimeoutsRef.current[column];
|
|
8530
8641
|
}, []);
|
|
8531
|
-
const clearAnimationFrame =
|
|
8642
|
+
const clearAnimationFrame = React29.useCallback((column) => {
|
|
8532
8643
|
const frameId = animationFramesRef.current[column];
|
|
8533
8644
|
if (frameId === void 0) return;
|
|
8534
8645
|
window.cancelAnimationFrame(frameId);
|
|
8535
8646
|
delete animationFramesRef.current[column];
|
|
8536
8647
|
}, []);
|
|
8537
|
-
|
|
8648
|
+
React29.useEffect(
|
|
8538
8649
|
() => () => {
|
|
8539
8650
|
["month", "day", "year"].forEach((column) => {
|
|
8540
8651
|
clearSettleTimeout(column);
|
|
@@ -8543,22 +8654,22 @@ function useDatePickerWheel({
|
|
|
8543
8654
|
},
|
|
8544
8655
|
[clearAnimationFrame, clearSettleTimeout]
|
|
8545
8656
|
);
|
|
8546
|
-
|
|
8657
|
+
React29.useEffect(() => {
|
|
8547
8658
|
if (isOpen) return;
|
|
8548
8659
|
setDraftDate(resolveInitialDate({ value, defaultValue, minDate, maxDate }));
|
|
8549
8660
|
}, [defaultValue, isOpen, maxDate, minDate, value]);
|
|
8550
|
-
const months =
|
|
8661
|
+
const months = React29.useMemo(
|
|
8551
8662
|
() => getAllowedMonths(draftYear, minDate, maxDate),
|
|
8552
8663
|
[draftYear, maxDate, minDate]
|
|
8553
8664
|
);
|
|
8554
|
-
const days =
|
|
8665
|
+
const days = React29.useMemo(
|
|
8555
8666
|
() => getAllowedDays(draftYear, draftMonth, minDate, maxDate),
|
|
8556
8667
|
[draftMonth, draftYear, maxDate, minDate]
|
|
8557
8668
|
);
|
|
8558
8669
|
const monthIndex = months.findIndex((month) => month === draftMonth);
|
|
8559
8670
|
const dayIndex = days.findIndex((day) => day === draftDate.getDate());
|
|
8560
8671
|
const yearIndex = years.findIndex((year) => year === draftYear);
|
|
8561
|
-
const syncScrollPositions =
|
|
8672
|
+
const syncScrollPositions = React29.useCallback(
|
|
8562
8673
|
(nextDate, behavior = "auto") => {
|
|
8563
8674
|
const nextMonths = getAllowedMonths(nextDate.getFullYear(), minDate, maxDate);
|
|
8564
8675
|
const nextMonthIndex = nextMonths.findIndex((month) => month === nextDate.getMonth());
|
|
@@ -8582,7 +8693,7 @@ function useDatePickerWheel({
|
|
|
8582
8693
|
},
|
|
8583
8694
|
[maxDate, minDate, years]
|
|
8584
8695
|
);
|
|
8585
|
-
|
|
8696
|
+
React29.useLayoutEffect(() => {
|
|
8586
8697
|
if (!isOpen) return;
|
|
8587
8698
|
const nextDate = resolveInitialDate({ value, defaultValue, minDate, maxDate });
|
|
8588
8699
|
setDraftDate(nextDate);
|
|
@@ -8593,7 +8704,7 @@ function useDatePickerWheel({
|
|
|
8593
8704
|
window.cancelAnimationFrame(frameId);
|
|
8594
8705
|
};
|
|
8595
8706
|
}, [defaultValue, isOpen, maxDate, minDate, syncScrollPositions, value]);
|
|
8596
|
-
const updateDraftDate =
|
|
8707
|
+
const updateDraftDate = React29.useCallback(
|
|
8597
8708
|
(column, targetIndex, behavior = "smooth") => {
|
|
8598
8709
|
const currentDate = stripTime(draftDate);
|
|
8599
8710
|
const currentYear = currentDate.getFullYear();
|
|
@@ -8638,7 +8749,7 @@ function useDatePickerWheel({
|
|
|
8638
8749
|
},
|
|
8639
8750
|
[days, draftDate, maxDate, minDate, months, syncScrollPositions, years]
|
|
8640
8751
|
);
|
|
8641
|
-
const settleColumnScroll =
|
|
8752
|
+
const settleColumnScroll = React29.useCallback(
|
|
8642
8753
|
(column) => {
|
|
8643
8754
|
const list = columnRefs[column].current;
|
|
8644
8755
|
if (!list) return;
|
|
@@ -8651,7 +8762,7 @@ function useDatePickerWheel({
|
|
|
8651
8762
|
},
|
|
8652
8763
|
[columnRefs, days.length, months.length, updateDraftDate, years.length]
|
|
8653
8764
|
);
|
|
8654
|
-
const scheduleScrollSettle =
|
|
8765
|
+
const scheduleScrollSettle = React29.useCallback(
|
|
8655
8766
|
(column) => {
|
|
8656
8767
|
clearSettleTimeout(column);
|
|
8657
8768
|
settleTimeoutsRef.current[column] = window.setTimeout(() => {
|
|
@@ -8660,7 +8771,7 @@ function useDatePickerWheel({
|
|
|
8660
8771
|
},
|
|
8661
8772
|
[clearSettleTimeout, settleColumnScroll]
|
|
8662
8773
|
);
|
|
8663
|
-
const handleColumnScroll =
|
|
8774
|
+
const handleColumnScroll = React29.useCallback(
|
|
8664
8775
|
(column) => {
|
|
8665
8776
|
const list = columnRefs[column].current;
|
|
8666
8777
|
if (!list) return;
|
|
@@ -8674,13 +8785,13 @@ function useDatePickerWheel({
|
|
|
8674
8785
|
},
|
|
8675
8786
|
[clearAnimationFrame, columnRefs, scheduleScrollSettle, setColumnScrollTop]
|
|
8676
8787
|
);
|
|
8677
|
-
const handleOptionSelect =
|
|
8788
|
+
const handleOptionSelect = React29.useCallback(
|
|
8678
8789
|
(column, targetIndex) => {
|
|
8679
8790
|
updateDraftDate(column, targetIndex, "smooth");
|
|
8680
8791
|
},
|
|
8681
8792
|
[updateDraftDate]
|
|
8682
8793
|
);
|
|
8683
|
-
const focusAdjacentColumn =
|
|
8794
|
+
const focusAdjacentColumn = React29.useCallback(
|
|
8684
8795
|
(column, direction) => {
|
|
8685
8796
|
const order = ["month", "day", "year"];
|
|
8686
8797
|
const currentIndex = order.indexOf(column);
|
|
@@ -8690,7 +8801,7 @@ function useDatePickerWheel({
|
|
|
8690
8801
|
},
|
|
8691
8802
|
[columnRefs]
|
|
8692
8803
|
);
|
|
8693
|
-
const handleColumnKeyDown =
|
|
8804
|
+
const handleColumnKeyDown = React29.useCallback(
|
|
8694
8805
|
(column, event) => {
|
|
8695
8806
|
const currentIndex = column === "month" ? monthIndex : column === "day" ? dayIndex : yearIndex;
|
|
8696
8807
|
const maxIndex = column === "month" ? months.length - 1 : column === "day" ? days.length - 1 : years.length - 1;
|
|
@@ -8756,7 +8867,7 @@ function useDatePickerWheel({
|
|
|
8756
8867
|
}
|
|
8757
8868
|
|
|
8758
8869
|
// src/datepicker/DatePickerWheelColumn.tsx
|
|
8759
|
-
var
|
|
8870
|
+
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
8760
8871
|
var spacerHeight = DATE_PICKER_OPTION_HEIGHT * DATE_PICKER_WHEEL_BUFFER_OPTIONS;
|
|
8761
8872
|
function DatePickerWheelColumn({
|
|
8762
8873
|
id,
|
|
@@ -8770,7 +8881,7 @@ function DatePickerWheelColumn({
|
|
|
8770
8881
|
onOptionSelect,
|
|
8771
8882
|
column
|
|
8772
8883
|
}) {
|
|
8773
|
-
return /* @__PURE__ */ (0,
|
|
8884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "relative z-10 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(
|
|
8774
8885
|
"div",
|
|
8775
8886
|
{
|
|
8776
8887
|
id,
|
|
@@ -8787,14 +8898,14 @@ function DatePickerWheelColumn({
|
|
|
8787
8898
|
WebkitOverflowScrolling: "touch"
|
|
8788
8899
|
},
|
|
8789
8900
|
children: [
|
|
8790
|
-
/* @__PURE__ */ (0,
|
|
8901
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { style: { height: `${spacerHeight}px` } }),
|
|
8791
8902
|
items.map((item, index) => {
|
|
8792
8903
|
const { style } = getWheelOptionStyles(
|
|
8793
8904
|
index,
|
|
8794
8905
|
scrollTop,
|
|
8795
8906
|
DATE_PICKER_OPTION_HEIGHT
|
|
8796
8907
|
);
|
|
8797
|
-
return /* @__PURE__ */ (0,
|
|
8908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
8798
8909
|
"button",
|
|
8799
8910
|
{
|
|
8800
8911
|
id: `${id}-option-${index}`,
|
|
@@ -8810,14 +8921,14 @@ function DatePickerWheelColumn({
|
|
|
8810
8921
|
`${column}-${item}-${index}`
|
|
8811
8922
|
);
|
|
8812
8923
|
}),
|
|
8813
|
-
/* @__PURE__ */ (0,
|
|
8924
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { style: { height: `${spacerHeight}px` } })
|
|
8814
8925
|
]
|
|
8815
8926
|
}
|
|
8816
8927
|
) });
|
|
8817
8928
|
}
|
|
8818
8929
|
|
|
8819
8930
|
// src/datepicker/DatePickerContent.tsx
|
|
8820
|
-
var
|
|
8931
|
+
var import_jsx_runtime121 = require("react/jsx-runtime");
|
|
8821
8932
|
function DatePickerBody({
|
|
8822
8933
|
baseId,
|
|
8823
8934
|
label,
|
|
@@ -8839,19 +8950,19 @@ function DatePickerBody({
|
|
|
8839
8950
|
onOptionSelect,
|
|
8840
8951
|
onDone
|
|
8841
8952
|
}) {
|
|
8842
|
-
return /* @__PURE__ */ (0,
|
|
8843
|
-
/* @__PURE__ */ (0,
|
|
8844
|
-
/* @__PURE__ */ (0,
|
|
8845
|
-
/* @__PURE__ */ (0,
|
|
8846
|
-
/* @__PURE__ */ (0,
|
|
8953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "px-6 pb-4 pt-1 bg-white", children: [
|
|
8954
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "relative overflow-hidden rounded-[24px]", children: [
|
|
8955
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "pointer-events-none absolute inset-x-0 top-0 z-20 h-16 bg-gradient-to-b from-white via-white/80 to-transparent" }),
|
|
8956
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 z-20 h-16 bg-gradient-to-t from-white via-white/80 to-transparent" }),
|
|
8957
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
8847
8958
|
"div",
|
|
8848
8959
|
{
|
|
8849
8960
|
"aria-hidden": true,
|
|
8850
8961
|
className: "pointer-events-none absolute inset-x-0 top-1/2 z-0 h-8 -translate-y-1/2 rounded-[12px] bg-black/[0.04]"
|
|
8851
8962
|
}
|
|
8852
8963
|
),
|
|
8853
|
-
/* @__PURE__ */ (0,
|
|
8854
|
-
/* @__PURE__ */ (0,
|
|
8964
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "relative grid grid-cols-[1.35fr_0.7fr_1fr] gap-1", children: [
|
|
8965
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
8855
8966
|
DatePickerWheelColumn,
|
|
8856
8967
|
{
|
|
8857
8968
|
id: `${baseId}-month`,
|
|
@@ -8866,7 +8977,7 @@ function DatePickerBody({
|
|
|
8866
8977
|
onOptionSelect
|
|
8867
8978
|
}
|
|
8868
8979
|
),
|
|
8869
|
-
/* @__PURE__ */ (0,
|
|
8980
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
8870
8981
|
DatePickerWheelColumn,
|
|
8871
8982
|
{
|
|
8872
8983
|
id: `${baseId}-day`,
|
|
@@ -8881,7 +8992,7 @@ function DatePickerBody({
|
|
|
8881
8992
|
onOptionSelect
|
|
8882
8993
|
}
|
|
8883
8994
|
),
|
|
8884
|
-
/* @__PURE__ */ (0,
|
|
8995
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
8885
8996
|
DatePickerWheelColumn,
|
|
8886
8997
|
{
|
|
8887
8998
|
id: `${baseId}-year`,
|
|
@@ -8898,7 +9009,7 @@ function DatePickerBody({
|
|
|
8898
9009
|
)
|
|
8899
9010
|
] })
|
|
8900
9011
|
] }),
|
|
8901
|
-
/* @__PURE__ */ (0,
|
|
9012
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
8902
9013
|
] });
|
|
8903
9014
|
}
|
|
8904
9015
|
function DatePickerContent({
|
|
@@ -8926,7 +9037,7 @@ function DatePickerContent({
|
|
|
8926
9037
|
onColumnKeyDown,
|
|
8927
9038
|
onOptionSelect
|
|
8928
9039
|
}) {
|
|
8929
|
-
const body = /* @__PURE__ */ (0,
|
|
9040
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
8930
9041
|
DatePickerBody,
|
|
8931
9042
|
{
|
|
8932
9043
|
baseId,
|
|
@@ -8951,27 +9062,27 @@ function DatePickerContent({
|
|
|
8951
9062
|
}
|
|
8952
9063
|
);
|
|
8953
9064
|
if (isMobile) {
|
|
8954
|
-
return /* @__PURE__ */ (0,
|
|
9065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Drawer, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
8955
9066
|
DrawerContent,
|
|
8956
9067
|
{
|
|
8957
9068
|
onClose: () => onOpenChange(false),
|
|
8958
9069
|
className: "rounded-none rounded-t-[32px] border-0 p-0",
|
|
8959
9070
|
children: [
|
|
8960
|
-
/* @__PURE__ */ (0,
|
|
8961
|
-
/* @__PURE__ */ (0,
|
|
9071
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(DrawerTitle, { className: "sr-only", children: title }),
|
|
9072
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(DrawerDescription, { className: "sr-only", children: label }),
|
|
8962
9073
|
body
|
|
8963
9074
|
]
|
|
8964
9075
|
}
|
|
8965
9076
|
) });
|
|
8966
9077
|
}
|
|
8967
|
-
return /* @__PURE__ */ (0,
|
|
9078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
8968
9079
|
DialogContent,
|
|
8969
9080
|
{
|
|
8970
9081
|
className: "max-w-[520px] rounded-[28px] border-0 p-0 shadow-xl",
|
|
8971
9082
|
showCloseButton: false,
|
|
8972
9083
|
children: [
|
|
8973
|
-
/* @__PURE__ */ (0,
|
|
8974
|
-
/* @__PURE__ */ (0,
|
|
9084
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(DialogTitle, { className: "sr-only", children: title }),
|
|
9085
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(DialogDescription, { className: "sr-only", children: label }),
|
|
8975
9086
|
body
|
|
8976
9087
|
]
|
|
8977
9088
|
}
|
|
@@ -8979,18 +9090,18 @@ function DatePickerContent({
|
|
|
8979
9090
|
}
|
|
8980
9091
|
|
|
8981
9092
|
// src/lib/use-screen-resize.ts
|
|
8982
|
-
var
|
|
9093
|
+
var import_react45 = require("react");
|
|
8983
9094
|
var eventName = "resize";
|
|
8984
9095
|
function useScreenResize(maxWidth) {
|
|
8985
|
-
const [isInitialized, setIsInitialized] = (0,
|
|
8986
|
-
const [isMatch, setIsMatch] = (0,
|
|
8987
|
-
const handleResizeEvent = (0,
|
|
9096
|
+
const [isInitialized, setIsInitialized] = (0, import_react45.useState)(false);
|
|
9097
|
+
const [isMatch, setIsMatch] = (0, import_react45.useState)(false);
|
|
9098
|
+
const handleResizeEvent = (0, import_react45.useCallback)(() => {
|
|
8988
9099
|
const adjustedMaxWidth = `${parseInt(maxWidth, 10) - 1}px`;
|
|
8989
9100
|
const media = getWindow().matchMedia(`(max-width: ${adjustedMaxWidth})`);
|
|
8990
9101
|
setIsInitialized(true);
|
|
8991
9102
|
setIsMatch(!!media?.matches);
|
|
8992
9103
|
}, [maxWidth]);
|
|
8993
|
-
(0,
|
|
9104
|
+
(0, import_react45.useLayoutEffect)(() => {
|
|
8994
9105
|
handleResizeEvent();
|
|
8995
9106
|
getWindow().addEventListener(eventName, handleResizeEvent);
|
|
8996
9107
|
return () => {
|
|
@@ -9016,13 +9127,13 @@ var DEVICE = {
|
|
|
9016
9127
|
};
|
|
9017
9128
|
|
|
9018
9129
|
// src/field-trigger/FieldTrigger.tsx
|
|
9019
|
-
var
|
|
9130
|
+
var React30 = __toESM(require("react"), 1);
|
|
9020
9131
|
var import_lucide_react41 = require("lucide-react");
|
|
9021
9132
|
var import_react_i18next22 = require("react-i18next");
|
|
9022
9133
|
|
|
9023
9134
|
// src/field-error-message/FieldErrorMessage.tsx
|
|
9024
9135
|
var import_lucide_react40 = require("lucide-react");
|
|
9025
|
-
var
|
|
9136
|
+
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
9026
9137
|
function FieldErrorMessage({
|
|
9027
9138
|
id,
|
|
9028
9139
|
message,
|
|
@@ -9033,7 +9144,7 @@ function FieldErrorMessage({
|
|
|
9033
9144
|
}) {
|
|
9034
9145
|
const content = message ?? children;
|
|
9035
9146
|
if (!content) return null;
|
|
9036
|
-
return /* @__PURE__ */ (0,
|
|
9147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
9037
9148
|
"p",
|
|
9038
9149
|
{
|
|
9039
9150
|
id,
|
|
@@ -9045,22 +9156,22 @@ function FieldErrorMessage({
|
|
|
9045
9156
|
),
|
|
9046
9157
|
...props,
|
|
9047
9158
|
children: [
|
|
9048
|
-
/* @__PURE__ */ (0,
|
|
9159
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9049
9160
|
import_lucide_react40.AlertCircle,
|
|
9050
9161
|
{
|
|
9051
9162
|
className: "h-[18px] w-[18px] shrink-0 text-white",
|
|
9052
9163
|
fill: "var(--status-danger)"
|
|
9053
9164
|
}
|
|
9054
9165
|
),
|
|
9055
|
-
/* @__PURE__ */ (0,
|
|
9166
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { children: content })
|
|
9056
9167
|
]
|
|
9057
9168
|
}
|
|
9058
9169
|
);
|
|
9059
9170
|
}
|
|
9060
9171
|
|
|
9061
9172
|
// src/field-trigger/FieldTrigger.tsx
|
|
9062
|
-
var
|
|
9063
|
-
var FieldTrigger =
|
|
9173
|
+
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
9174
|
+
var FieldTrigger = React30.forwardRef(
|
|
9064
9175
|
({
|
|
9065
9176
|
as = "button",
|
|
9066
9177
|
variant = "airbnb",
|
|
@@ -9097,14 +9208,14 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9097
9208
|
const optionalLabel = optional ? typeof optional === "string" ? optional : t("optional") : void 0;
|
|
9098
9209
|
const visibleLabelText = labelText ?? label;
|
|
9099
9210
|
const hasLabelMeta = Boolean(optionalLabel) || Boolean(tooltip);
|
|
9100
|
-
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */ (0,
|
|
9101
|
-
/* @__PURE__ */ (0,
|
|
9102
|
-
optionalLabel && /* @__PURE__ */ (0,
|
|
9211
|
+
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("span", { className: "inline-flex max-w-full items-center gap-1.5 align-middle", children: [
|
|
9212
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { className: "min-w-0 truncate", children: visibleLabelText }),
|
|
9213
|
+
optionalLabel && /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("span", { className: "shrink-0 text-[12px] relative top-[1px] font-normal leading-4 text-current opacity-70", children: [
|
|
9103
9214
|
"(",
|
|
9104
9215
|
optionalLabel,
|
|
9105
9216
|
")"
|
|
9106
9217
|
] }),
|
|
9107
|
-
tooltip && /* @__PURE__ */ (0,
|
|
9218
|
+
tooltip && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9108
9219
|
HelpTooltip,
|
|
9109
9220
|
{
|
|
9110
9221
|
content: tooltip,
|
|
@@ -9120,9 +9231,9 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9120
9231
|
const hasInvalidState = Boolean(error);
|
|
9121
9232
|
const errorMessage = typeof error === "string" ? error : void 0;
|
|
9122
9233
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
9123
|
-
const resolvedTrailingAdornment = loading || trailingAdornment ? /* @__PURE__ */ (0,
|
|
9234
|
+
const resolvedTrailingAdornment = loading || trailingAdornment ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
9124
9235
|
trailingAdornment,
|
|
9125
|
-
loading && /* @__PURE__ */ (0,
|
|
9236
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_lucide_react41.Loader2, { "aria-hidden": "true", className: "h-5 w-5 animate-spin text-[#7A8399]" })
|
|
9126
9237
|
] }) : void 0;
|
|
9127
9238
|
const sharedClasses = cn(
|
|
9128
9239
|
"relative flex border w-full items-center bg-[var(--form-background-color,#fff)] text-left transition-colors focus-visible:outline-none",
|
|
@@ -9132,8 +9243,8 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9132
9243
|
disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : isAirbnbVariant ? "cursor-pointer" : "cursor-text",
|
|
9133
9244
|
className
|
|
9134
9245
|
);
|
|
9135
|
-
const sharedContent = /* @__PURE__ */ (0,
|
|
9136
|
-
/* @__PURE__ */ (0,
|
|
9246
|
+
const sharedContent = /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_jsx_runtime123.Fragment, { children: [
|
|
9247
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
9137
9248
|
"span",
|
|
9138
9249
|
{
|
|
9139
9250
|
className: cn(
|
|
@@ -9142,7 +9253,7 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9142
9253
|
contentClassName
|
|
9143
9254
|
),
|
|
9144
9255
|
children: [
|
|
9145
|
-
/* @__PURE__ */ (0,
|
|
9256
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9146
9257
|
"span",
|
|
9147
9258
|
{
|
|
9148
9259
|
id: labelId,
|
|
@@ -9155,7 +9266,7 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9155
9266
|
children: animatedLabel
|
|
9156
9267
|
}
|
|
9157
9268
|
),
|
|
9158
|
-
children ? children : hasValue ? /* @__PURE__ */ (0,
|
|
9269
|
+
children ? children : hasValue ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9159
9270
|
"span",
|
|
9160
9271
|
{
|
|
9161
9272
|
id: valueId,
|
|
@@ -9166,11 +9277,11 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9166
9277
|
),
|
|
9167
9278
|
children: valueText
|
|
9168
9279
|
}
|
|
9169
|
-
) : /* @__PURE__ */ (0,
|
|
9280
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { id: helperTextId, className: "sr-only", children: placeholder ?? label })
|
|
9170
9281
|
]
|
|
9171
9282
|
}
|
|
9172
9283
|
),
|
|
9173
|
-
resolvedTrailingAdornment && /* @__PURE__ */ (0,
|
|
9284
|
+
resolvedTrailingAdornment && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9174
9285
|
"span",
|
|
9175
9286
|
{
|
|
9176
9287
|
"aria-hidden": "true",
|
|
@@ -9182,9 +9293,9 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9182
9293
|
}
|
|
9183
9294
|
)
|
|
9184
9295
|
] });
|
|
9185
|
-
return /* @__PURE__ */ (0,
|
|
9186
|
-
topLabel && /* @__PURE__ */ (0,
|
|
9187
|
-
as === "button" ? /* @__PURE__ */ (0,
|
|
9296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "w-full", children: [
|
|
9297
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("p", { className: "mb-[var(--form-label-input-gap,12px)] text-[16px] font-semibold leading-5 text-[var(--form-section-title-color,#222222)]", children: topLabel }),
|
|
9298
|
+
as === "button" ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9188
9299
|
"button",
|
|
9189
9300
|
{
|
|
9190
9301
|
id,
|
|
@@ -9201,7 +9312,7 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9201
9312
|
...props,
|
|
9202
9313
|
children: sharedContent
|
|
9203
9314
|
}
|
|
9204
|
-
) : /* @__PURE__ */ (0,
|
|
9315
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9205
9316
|
"div",
|
|
9206
9317
|
{
|
|
9207
9318
|
id,
|
|
@@ -9218,16 +9329,16 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9218
9329
|
children: sharedContent
|
|
9219
9330
|
}
|
|
9220
9331
|
),
|
|
9221
|
-
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
9332
|
+
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(FieldErrorMessage, { id: errorId, message: errorMessage })
|
|
9222
9333
|
] });
|
|
9223
9334
|
}
|
|
9224
9335
|
);
|
|
9225
9336
|
FieldTrigger.displayName = "FieldTrigger";
|
|
9226
9337
|
|
|
9227
9338
|
// src/datepicker/DatePicker.tsx
|
|
9228
|
-
var
|
|
9339
|
+
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
9229
9340
|
var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
|
|
9230
|
-
var DatePicker =
|
|
9341
|
+
var DatePicker = React31.forwardRef(
|
|
9231
9342
|
({
|
|
9232
9343
|
variant = "default",
|
|
9233
9344
|
label,
|
|
@@ -9253,24 +9364,24 @@ var DatePicker = React30.forwardRef(
|
|
|
9253
9364
|
formatValue = formatDateValue
|
|
9254
9365
|
}, ref) => {
|
|
9255
9366
|
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
9256
|
-
const [isOpen, setIsOpen] =
|
|
9257
|
-
const triggerId =
|
|
9258
|
-
const pickerId =
|
|
9259
|
-
const labelId =
|
|
9260
|
-
const valueId =
|
|
9261
|
-
const helperTextId =
|
|
9262
|
-
const errorId =
|
|
9263
|
-
const internalRef =
|
|
9367
|
+
const [isOpen, setIsOpen] = React31.useState(false);
|
|
9368
|
+
const triggerId = React31.useId();
|
|
9369
|
+
const pickerId = React31.useId();
|
|
9370
|
+
const labelId = React31.useId();
|
|
9371
|
+
const valueId = React31.useId();
|
|
9372
|
+
const helperTextId = React31.useId();
|
|
9373
|
+
const errorId = React31.useId();
|
|
9374
|
+
const internalRef = React31.useRef(null);
|
|
9264
9375
|
const combinedRef = useCombinedRef(ref, internalRef);
|
|
9265
|
-
const monthLabels =
|
|
9266
|
-
const resolvedMinDate =
|
|
9267
|
-
const resolvedMaxDate =
|
|
9268
|
-
const normalizedValue =
|
|
9269
|
-
const normalizedDefaultValue =
|
|
9376
|
+
const monthLabels = React31.useMemo(() => getMonthLabels(locale), [locale]);
|
|
9377
|
+
const resolvedMinDate = React31.useMemo(() => minDate ?? DEFAULT_MIN_DATE, [minDate]);
|
|
9378
|
+
const resolvedMaxDate = React31.useMemo(() => maxDate ?? /* @__PURE__ */ new Date(), [maxDate]);
|
|
9379
|
+
const normalizedValue = React31.useMemo(() => normalizeDateValue(value), [value]);
|
|
9380
|
+
const normalizedDefaultValue = React31.useMemo(
|
|
9270
9381
|
() => normalizeDateValue(defaultValue),
|
|
9271
9382
|
[defaultValue]
|
|
9272
9383
|
);
|
|
9273
|
-
const resolvedValue =
|
|
9384
|
+
const resolvedValue = React31.useMemo(
|
|
9274
9385
|
() => normalizedValue ? clampDate(normalizedValue, resolvedMinDate, resolvedMaxDate) : null,
|
|
9275
9386
|
[normalizedValue, resolvedMaxDate, resolvedMinDate]
|
|
9276
9387
|
);
|
|
@@ -9301,7 +9412,7 @@ var DatePicker = React30.forwardRef(
|
|
|
9301
9412
|
minDate: resolvedMinDate,
|
|
9302
9413
|
maxDate: resolvedMaxDate
|
|
9303
9414
|
});
|
|
9304
|
-
const handleOpenChange =
|
|
9415
|
+
const handleOpenChange = React31.useCallback(
|
|
9305
9416
|
(nextOpen) => {
|
|
9306
9417
|
if (isBlocked && nextOpen) return;
|
|
9307
9418
|
setIsOpen(nextOpen);
|
|
@@ -9311,7 +9422,7 @@ var DatePicker = React30.forwardRef(
|
|
|
9311
9422
|
},
|
|
9312
9423
|
[isBlocked]
|
|
9313
9424
|
);
|
|
9314
|
-
const handleDone =
|
|
9425
|
+
const handleDone = React31.useCallback(() => {
|
|
9315
9426
|
if (isBlocked) return;
|
|
9316
9427
|
onChange(clampDate(draftDate, resolvedMinDate, resolvedMaxDate));
|
|
9317
9428
|
handleOpenChange(false);
|
|
@@ -9323,11 +9434,11 @@ var DatePicker = React30.forwardRef(
|
|
|
9323
9434
|
resolvedMaxDate,
|
|
9324
9435
|
resolvedMinDate
|
|
9325
9436
|
]);
|
|
9326
|
-
const handleTriggerClick =
|
|
9437
|
+
const handleTriggerClick = React31.useCallback(() => {
|
|
9327
9438
|
if (isBlocked) return;
|
|
9328
9439
|
setIsOpen(true);
|
|
9329
9440
|
}, [isBlocked]);
|
|
9330
|
-
const handleTriggerKeyDown =
|
|
9441
|
+
const handleTriggerKeyDown = React31.useCallback(
|
|
9331
9442
|
(event) => {
|
|
9332
9443
|
if (isBlocked) return;
|
|
9333
9444
|
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
@@ -9337,13 +9448,13 @@ var DatePicker = React30.forwardRef(
|
|
|
9337
9448
|
},
|
|
9338
9449
|
[isBlocked]
|
|
9339
9450
|
);
|
|
9340
|
-
|
|
9451
|
+
React31.useEffect(() => {
|
|
9341
9452
|
if (isBlocked) {
|
|
9342
9453
|
setIsOpen(false);
|
|
9343
9454
|
}
|
|
9344
9455
|
}, [isBlocked]);
|
|
9345
|
-
return /* @__PURE__ */ (0,
|
|
9346
|
-
name && /* @__PURE__ */ (0,
|
|
9456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: cn("relative w-full max-w-[var(--max-field-width)]", className), children: [
|
|
9457
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
9347
9458
|
"input",
|
|
9348
9459
|
{
|
|
9349
9460
|
type: "hidden",
|
|
@@ -9351,7 +9462,7 @@ var DatePicker = React30.forwardRef(
|
|
|
9351
9462
|
value: resolvedValue ? formatDateInputValue(resolvedValue) : ""
|
|
9352
9463
|
}
|
|
9353
9464
|
),
|
|
9354
|
-
/* @__PURE__ */ (0,
|
|
9465
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
9355
9466
|
FieldTrigger,
|
|
9356
9467
|
{
|
|
9357
9468
|
id: triggerId,
|
|
@@ -9378,10 +9489,10 @@ var DatePicker = React30.forwardRef(
|
|
|
9378
9489
|
onClick: handleTriggerClick,
|
|
9379
9490
|
onKeyDown: handleTriggerKeyDown,
|
|
9380
9491
|
onBlur,
|
|
9381
|
-
trailingAdornment: /* @__PURE__ */ (0,
|
|
9492
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_lucide_react42.Calendar, { className: "h-5 w-5 text-[#1F1F1B]", strokeWidth: 2 })
|
|
9382
9493
|
}
|
|
9383
9494
|
),
|
|
9384
|
-
/* @__PURE__ */ (0,
|
|
9495
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
9385
9496
|
DatePickerContent,
|
|
9386
9497
|
{
|
|
9387
9498
|
baseId: pickerId,
|
|
@@ -9415,7 +9526,7 @@ var DatePicker = React30.forwardRef(
|
|
|
9415
9526
|
DatePicker.displayName = "DatePicker";
|
|
9416
9527
|
|
|
9417
9528
|
// src/responsive-sheet/ResponsiveSheet.tsx
|
|
9418
|
-
var
|
|
9529
|
+
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
9419
9530
|
function ResponsiveSheet({
|
|
9420
9531
|
open,
|
|
9421
9532
|
onClose,
|
|
@@ -9450,7 +9561,7 @@ function ResponsiveSheet({
|
|
|
9450
9561
|
event.preventDefault();
|
|
9451
9562
|
}
|
|
9452
9563
|
};
|
|
9453
|
-
const content = /* @__PURE__ */ (0,
|
|
9564
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
|
|
9454
9565
|
"div",
|
|
9455
9566
|
{
|
|
9456
9567
|
className: cn(
|
|
@@ -9458,7 +9569,7 @@ function ResponsiveSheet({
|
|
|
9458
9569
|
contentClassName
|
|
9459
9570
|
),
|
|
9460
9571
|
children: [
|
|
9461
|
-
title ? /* @__PURE__ */ (0,
|
|
9572
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
9462
9573
|
"div",
|
|
9463
9574
|
{
|
|
9464
9575
|
className: cn(
|
|
@@ -9468,7 +9579,7 @@ function ResponsiveSheet({
|
|
|
9468
9579
|
children: title
|
|
9469
9580
|
}
|
|
9470
9581
|
) : null,
|
|
9471
|
-
description ? /* @__PURE__ */ (0,
|
|
9582
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
9472
9583
|
"p",
|
|
9473
9584
|
{
|
|
9474
9585
|
className: cn(
|
|
@@ -9483,7 +9594,7 @@ function ResponsiveSheet({
|
|
|
9483
9594
|
}
|
|
9484
9595
|
);
|
|
9485
9596
|
if (isMobileMode) {
|
|
9486
|
-
return /* @__PURE__ */ (0,
|
|
9597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Drawer, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
|
|
9487
9598
|
DrawerContent,
|
|
9488
9599
|
{
|
|
9489
9600
|
onClose,
|
|
@@ -9493,14 +9604,14 @@ function ResponsiveSheet({
|
|
|
9493
9604
|
onEscapeKeyDown: handleEscapeKeyDown,
|
|
9494
9605
|
className: cn(className, drawerClassName),
|
|
9495
9606
|
children: [
|
|
9496
|
-
title ? /* @__PURE__ */ (0,
|
|
9497
|
-
description ? /* @__PURE__ */ (0,
|
|
9607
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(DrawerTitle, { className: "sr-only", children: title }) : null,
|
|
9608
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(DrawerDescription, { className: "sr-only", children: description }) : null,
|
|
9498
9609
|
content
|
|
9499
9610
|
]
|
|
9500
9611
|
}
|
|
9501
9612
|
) });
|
|
9502
9613
|
}
|
|
9503
|
-
return /* @__PURE__ */ (0,
|
|
9614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Dialog, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
|
|
9504
9615
|
DialogContent,
|
|
9505
9616
|
{
|
|
9506
9617
|
showCloseButton,
|
|
@@ -9510,8 +9621,8 @@ function ResponsiveSheet({
|
|
|
9510
9621
|
className: cn("max-w-[560px] border-0 p-0 shadow-xl", className, dialogClassName),
|
|
9511
9622
|
lockScroll: false,
|
|
9512
9623
|
children: [
|
|
9513
|
-
title ? /* @__PURE__ */ (0,
|
|
9514
|
-
description ? /* @__PURE__ */ (0,
|
|
9624
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(DialogTitle, { className: "sr-only", children: title }) : null,
|
|
9625
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(DialogDescription, { className: "sr-only", children: description }) : null,
|
|
9515
9626
|
content
|
|
9516
9627
|
]
|
|
9517
9628
|
}
|
|
@@ -9519,10 +9630,10 @@ function ResponsiveSheet({
|
|
|
9519
9630
|
}
|
|
9520
9631
|
|
|
9521
9632
|
// src/airbnb/input/Input.tsx
|
|
9522
|
-
var
|
|
9523
|
-
var
|
|
9633
|
+
var React32 = __toESM(require("react"), 1);
|
|
9634
|
+
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
9524
9635
|
var getInputValue = (value) => value != null ? String(value) : "";
|
|
9525
|
-
var AirbnbInput =
|
|
9636
|
+
var AirbnbInput = React32.forwardRef(
|
|
9526
9637
|
({
|
|
9527
9638
|
variant = "default",
|
|
9528
9639
|
label,
|
|
@@ -9551,15 +9662,15 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9551
9662
|
placeholder,
|
|
9552
9663
|
...props
|
|
9553
9664
|
}, ref) => {
|
|
9554
|
-
const generatedId =
|
|
9555
|
-
const inputRef =
|
|
9665
|
+
const generatedId = React32.useId();
|
|
9666
|
+
const inputRef = React32.useRef(null);
|
|
9556
9667
|
const inputId = id ?? generatedId;
|
|
9557
9668
|
const fieldId = `${inputId}-field`;
|
|
9558
9669
|
const labelId = `${inputId}-label`;
|
|
9559
9670
|
const errorId = `${inputId}-error`;
|
|
9560
9671
|
const accessibleLabel = placeholder ?? label;
|
|
9561
|
-
const [isFocused, setIsFocused] =
|
|
9562
|
-
const [currentValue, setCurrentValue] =
|
|
9672
|
+
const [isFocused, setIsFocused] = React32.useState(false);
|
|
9673
|
+
const [currentValue, setCurrentValue] = React32.useState(
|
|
9563
9674
|
() => value != null ? getInputValue(value) : getInputValue(defaultValue)
|
|
9564
9675
|
);
|
|
9565
9676
|
const resolvedValue = value != null ? getInputValue(value) : currentValue;
|
|
@@ -9569,11 +9680,11 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9569
9680
|
const triggerError = error ?? invalid;
|
|
9570
9681
|
const hasLabelMeta = Boolean(optional) || Boolean(tooltip);
|
|
9571
9682
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
9572
|
-
|
|
9683
|
+
React32.useLayoutEffect(() => {
|
|
9573
9684
|
const nextValue = value != null ? getInputValue(value) : getInputValue(inputRef.current?.value);
|
|
9574
9685
|
setCurrentValue((prevValue) => prevValue === nextValue ? prevValue : nextValue);
|
|
9575
9686
|
}, [value]);
|
|
9576
|
-
const setRefs =
|
|
9687
|
+
const setRefs = React32.useCallback(
|
|
9577
9688
|
(node) => {
|
|
9578
9689
|
inputRef.current = node;
|
|
9579
9690
|
if (node && value == null) {
|
|
@@ -9603,7 +9714,7 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9603
9714
|
setIsFocused(false);
|
|
9604
9715
|
onBlur?.(event);
|
|
9605
9716
|
};
|
|
9606
|
-
return /* @__PURE__ */ (0,
|
|
9717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("div", { className: cn("w-full max-w-[var(--max-field-width)]", wrapperClassName), children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
9607
9718
|
FieldTrigger,
|
|
9608
9719
|
{
|
|
9609
9720
|
as: "div",
|
|
@@ -9635,7 +9746,7 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9635
9746
|
forceFloatingLabel: shouldShowLabel,
|
|
9636
9747
|
forceLabelText: hasLabelMeta,
|
|
9637
9748
|
hideErrorMessage: !renderErrorMessage,
|
|
9638
|
-
children: /* @__PURE__ */ (0,
|
|
9749
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
9639
9750
|
"input",
|
|
9640
9751
|
{
|
|
9641
9752
|
...props,
|
|
@@ -9671,14 +9782,14 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9671
9782
|
AirbnbInput.displayName = "Input";
|
|
9672
9783
|
|
|
9673
9784
|
// src/airbnb/phone-field/PhoneField.tsx
|
|
9674
|
-
var
|
|
9785
|
+
var React38 = __toESM(require("react"), 1);
|
|
9675
9786
|
var import_lucide_react44 = require("lucide-react");
|
|
9676
9787
|
|
|
9677
9788
|
// src/airbnb/select/Select.tsx
|
|
9678
|
-
var
|
|
9789
|
+
var React37 = __toESM(require("react"), 1);
|
|
9679
9790
|
|
|
9680
9791
|
// src/airbnb/select/SelectDesktopMenu.tsx
|
|
9681
|
-
var
|
|
9792
|
+
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
9682
9793
|
function SelectDesktopMenu({
|
|
9683
9794
|
id,
|
|
9684
9795
|
options,
|
|
@@ -9697,7 +9808,7 @@ function SelectDesktopMenu({
|
|
|
9697
9808
|
noOptionsMessage
|
|
9698
9809
|
}) {
|
|
9699
9810
|
const emptyMessage = noOptionsMessage?.();
|
|
9700
|
-
return /* @__PURE__ */ (0,
|
|
9811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
|
|
9701
9812
|
"div",
|
|
9702
9813
|
{
|
|
9703
9814
|
id,
|
|
@@ -9710,12 +9821,12 @@ function SelectDesktopMenu({
|
|
|
9710
9821
|
onKeyDown,
|
|
9711
9822
|
className: cn("max-h-[280px] overflow-y-auto p-2 outline-none", menuClassName),
|
|
9712
9823
|
children: [
|
|
9713
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */ (0,
|
|
9824
|
+
options.length === 0 && emptyMessage ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "px-4 py-3 text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : null,
|
|
9714
9825
|
options.map((option, index) => {
|
|
9715
9826
|
const isSelected = selectedValue?.value === option.value;
|
|
9716
9827
|
const isHighlighted = index === highlightedIndex;
|
|
9717
9828
|
const optionKey = `${String(option.value)}-${index}`;
|
|
9718
|
-
return /* @__PURE__ */ (0,
|
|
9829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
9719
9830
|
"button",
|
|
9720
9831
|
{
|
|
9721
9832
|
id: getOptionId2(index),
|
|
@@ -9747,7 +9858,7 @@ function SelectDesktopMenu({
|
|
|
9747
9858
|
}
|
|
9748
9859
|
|
|
9749
9860
|
// src/airbnb/select/SelectDesktopContent.tsx
|
|
9750
|
-
var
|
|
9861
|
+
var import_jsx_runtime128 = require("react/jsx-runtime");
|
|
9751
9862
|
function SelectDesktopContent({
|
|
9752
9863
|
isOpen,
|
|
9753
9864
|
listboxId,
|
|
@@ -9768,14 +9879,14 @@ function SelectDesktopContent({
|
|
|
9768
9879
|
noOptionsMessage
|
|
9769
9880
|
}) {
|
|
9770
9881
|
if (!isOpen) return null;
|
|
9771
|
-
return /* @__PURE__ */ (0,
|
|
9882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
9772
9883
|
"div",
|
|
9773
9884
|
{
|
|
9774
9885
|
className: cn(
|
|
9775
9886
|
"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)]",
|
|
9776
9887
|
dropdownClassName
|
|
9777
9888
|
),
|
|
9778
|
-
children: /* @__PURE__ */ (0,
|
|
9889
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
9779
9890
|
SelectDesktopMenu,
|
|
9780
9891
|
{
|
|
9781
9892
|
id: listboxId,
|
|
@@ -9873,7 +9984,7 @@ function getMobileOptionStyles(index, scrollTop) {
|
|
|
9873
9984
|
}
|
|
9874
9985
|
|
|
9875
9986
|
// src/airbnb/select/SelectMobileWheel.tsx
|
|
9876
|
-
var
|
|
9987
|
+
var import_jsx_runtime129 = require("react/jsx-runtime");
|
|
9877
9988
|
function SelectMobileWheel({
|
|
9878
9989
|
id,
|
|
9879
9990
|
options,
|
|
@@ -9892,7 +10003,7 @@ function SelectMobileWheel({
|
|
|
9892
10003
|
}) {
|
|
9893
10004
|
const spacerHeight2 = getWheelSpacerHeight();
|
|
9894
10005
|
const emptyMessage = noOptionsMessage?.();
|
|
9895
|
-
return /* @__PURE__ */ (0,
|
|
10006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
|
|
9896
10007
|
"div",
|
|
9897
10008
|
{
|
|
9898
10009
|
id,
|
|
@@ -9904,10 +10015,10 @@ function SelectMobileWheel({
|
|
|
9904
10015
|
onKeyDown,
|
|
9905
10016
|
className: cn("relative overflow-hidden outline-none", menuClassName),
|
|
9906
10017
|
children: [
|
|
9907
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */ (0,
|
|
9908
|
-
/* @__PURE__ */ (0,
|
|
9909
|
-
/* @__PURE__ */ (0,
|
|
9910
|
-
/* @__PURE__ */ (0,
|
|
10018
|
+
options.length === 0 && emptyMessage ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { className: "flex min-h-[160px] items-center justify-center px-4 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : null,
|
|
10019
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { className: "pointer-events-none absolute inset-x-0 top-0 h-16 bg-gradient-to-b from-white via-white/80 to-transparent" }),
|
|
10020
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-white via-white/80 to-transparent" }),
|
|
10021
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
9911
10022
|
"div",
|
|
9912
10023
|
{
|
|
9913
10024
|
"aria-hidden": true,
|
|
@@ -9917,7 +10028,7 @@ function SelectMobileWheel({
|
|
|
9917
10028
|
)
|
|
9918
10029
|
}
|
|
9919
10030
|
),
|
|
9920
|
-
/* @__PURE__ */ (0,
|
|
10031
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
|
|
9921
10032
|
"div",
|
|
9922
10033
|
{
|
|
9923
10034
|
ref: listRef,
|
|
@@ -9932,11 +10043,11 @@ function SelectMobileWheel({
|
|
|
9932
10043
|
WebkitOverflowScrolling: "touch"
|
|
9933
10044
|
},
|
|
9934
10045
|
children: [
|
|
9935
|
-
/* @__PURE__ */ (0,
|
|
10046
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { style: { height: `${spacerHeight2}px` } }),
|
|
9936
10047
|
options.map((option, index) => {
|
|
9937
10048
|
const { distance, style } = getMobileOptionStyles(index, scrollTop);
|
|
9938
10049
|
const optionKey = `${String(option.value)}-${index}`;
|
|
9939
|
-
return /* @__PURE__ */ (0,
|
|
10050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
9940
10051
|
"button",
|
|
9941
10052
|
{
|
|
9942
10053
|
id: getOptionId2(index),
|
|
@@ -9957,7 +10068,7 @@ function SelectMobileWheel({
|
|
|
9957
10068
|
optionKey
|
|
9958
10069
|
);
|
|
9959
10070
|
}),
|
|
9960
|
-
/* @__PURE__ */ (0,
|
|
10071
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { style: { height: `${spacerHeight2}px` } })
|
|
9961
10072
|
]
|
|
9962
10073
|
}
|
|
9963
10074
|
)
|
|
@@ -9967,7 +10078,7 @@ function SelectMobileWheel({
|
|
|
9967
10078
|
}
|
|
9968
10079
|
|
|
9969
10080
|
// src/airbnb/select/SelectMobileContent.tsx
|
|
9970
|
-
var
|
|
10081
|
+
var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
9971
10082
|
function SelectMobileContent({
|
|
9972
10083
|
open,
|
|
9973
10084
|
onOpenChange,
|
|
@@ -9991,11 +10102,11 @@ function SelectMobileContent({
|
|
|
9991
10102
|
getOptionId: getOptionId2,
|
|
9992
10103
|
noOptionsMessage
|
|
9993
10104
|
}) {
|
|
9994
|
-
return /* @__PURE__ */ (0,
|
|
9995
|
-
/* @__PURE__ */ (0,
|
|
9996
|
-
/* @__PURE__ */ (0,
|
|
9997
|
-
/* @__PURE__ */ (0,
|
|
9998
|
-
/* @__PURE__ */ (0,
|
|
10105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Drawer, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(DrawerContent, { onClose, lockScroll: false, children: [
|
|
10106
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
10107
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(DrawerDescription, { className: "sr-only", children: label }),
|
|
10108
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { className: "px-6 pb-4 pt-1", children: [
|
|
10109
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
9999
10110
|
SelectMobileWheel,
|
|
10000
10111
|
{
|
|
10001
10112
|
id: listboxId,
|
|
@@ -10014,16 +10125,16 @@ function SelectMobileContent({
|
|
|
10014
10125
|
noOptionsMessage
|
|
10015
10126
|
}
|
|
10016
10127
|
),
|
|
10017
|
-
/* @__PURE__ */ (0,
|
|
10128
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
10018
10129
|
] })
|
|
10019
10130
|
] }) });
|
|
10020
10131
|
}
|
|
10021
10132
|
|
|
10022
10133
|
// src/airbnb/select/SelectTrigger.tsx
|
|
10023
|
-
var
|
|
10134
|
+
var React33 = __toESM(require("react"), 1);
|
|
10024
10135
|
var import_lucide_react43 = require("lucide-react");
|
|
10025
|
-
var
|
|
10026
|
-
var SelectTrigger2 =
|
|
10136
|
+
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
10137
|
+
var SelectTrigger2 = React33.forwardRef(
|
|
10027
10138
|
({
|
|
10028
10139
|
id,
|
|
10029
10140
|
open,
|
|
@@ -10048,7 +10159,7 @@ var SelectTrigger2 = React32.forwardRef(
|
|
|
10048
10159
|
onKeyDown,
|
|
10049
10160
|
onBlur
|
|
10050
10161
|
}, ref) => {
|
|
10051
|
-
return /* @__PURE__ */ (0,
|
|
10162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
10052
10163
|
FieldTrigger,
|
|
10053
10164
|
{
|
|
10054
10165
|
id,
|
|
@@ -10077,7 +10188,7 @@ var SelectTrigger2 = React32.forwardRef(
|
|
|
10077
10188
|
onClick,
|
|
10078
10189
|
onKeyDown,
|
|
10079
10190
|
onBlur,
|
|
10080
|
-
trailingAdornment: /* @__PURE__ */ (0,
|
|
10191
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
10081
10192
|
import_lucide_react43.ChevronDown,
|
|
10082
10193
|
{
|
|
10083
10194
|
className: open ? "h-6 w-6 rotate-180 text-[#1F1F1B] transition-transform" : "h-6 w-6 text-[#1F1F1B] transition-transform"
|
|
@@ -10090,7 +10201,7 @@ var SelectTrigger2 = React32.forwardRef(
|
|
|
10090
10201
|
SelectTrigger2.displayName = "SelectTrigger";
|
|
10091
10202
|
|
|
10092
10203
|
// src/airbnb/select/useDesktopSelect.ts
|
|
10093
|
-
var
|
|
10204
|
+
var React34 = __toESM(require("react"), 1);
|
|
10094
10205
|
function useDesktopSelect({
|
|
10095
10206
|
isMobile,
|
|
10096
10207
|
isOpen,
|
|
@@ -10099,12 +10210,12 @@ function useDesktopSelect({
|
|
|
10099
10210
|
disabled,
|
|
10100
10211
|
onChange
|
|
10101
10212
|
}) {
|
|
10102
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
10103
|
-
const triggerRef =
|
|
10104
|
-
const listRef =
|
|
10105
|
-
const optionRefs =
|
|
10213
|
+
const [highlightedIndex, setHighlightedIndex] = React34.useState(-1);
|
|
10214
|
+
const triggerRef = React34.useRef(null);
|
|
10215
|
+
const listRef = React34.useRef(null);
|
|
10216
|
+
const optionRefs = React34.useRef([]);
|
|
10106
10217
|
const selectedIndex = getOptionIndex(options, value);
|
|
10107
|
-
|
|
10218
|
+
React34.useEffect(() => {
|
|
10108
10219
|
if (!isOpen || isMobile) return;
|
|
10109
10220
|
setHighlightedIndex((currentIndex) => {
|
|
10110
10221
|
if (currentIndex >= 0) {
|
|
@@ -10119,34 +10230,34 @@ function useDesktopSelect({
|
|
|
10119
10230
|
window.cancelAnimationFrame(frameId);
|
|
10120
10231
|
};
|
|
10121
10232
|
}, [isMobile, isOpen, options, selectedIndex]);
|
|
10122
|
-
|
|
10233
|
+
React34.useEffect(() => {
|
|
10123
10234
|
if (!isOpen || isMobile || highlightedIndex < 0) return;
|
|
10124
10235
|
optionRefs.current[highlightedIndex]?.scrollIntoView({
|
|
10125
10236
|
block: "nearest"
|
|
10126
10237
|
});
|
|
10127
10238
|
}, [highlightedIndex, isMobile, isOpen]);
|
|
10128
|
-
|
|
10239
|
+
React34.useEffect(() => {
|
|
10129
10240
|
if (isOpen) return;
|
|
10130
10241
|
setHighlightedIndex(-1);
|
|
10131
10242
|
}, [isOpen]);
|
|
10132
|
-
const focusTrigger =
|
|
10243
|
+
const focusTrigger = React34.useCallback(() => {
|
|
10133
10244
|
triggerRef.current?.focus();
|
|
10134
10245
|
}, []);
|
|
10135
|
-
const handleSelect =
|
|
10246
|
+
const handleSelect = React34.useCallback(
|
|
10136
10247
|
(option) => {
|
|
10137
10248
|
if (option.isDisabled || disabled) return;
|
|
10138
10249
|
onChange(option);
|
|
10139
10250
|
},
|
|
10140
10251
|
[disabled, onChange]
|
|
10141
10252
|
);
|
|
10142
|
-
const openMenu =
|
|
10253
|
+
const openMenu = React34.useCallback(
|
|
10143
10254
|
(targetIndex) => {
|
|
10144
10255
|
const fallbackIndex = selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex(options);
|
|
10145
10256
|
setHighlightedIndex(targetIndex ?? fallbackIndex);
|
|
10146
10257
|
},
|
|
10147
10258
|
[options, selectedIndex]
|
|
10148
10259
|
);
|
|
10149
|
-
const handleTriggerKeyDown =
|
|
10260
|
+
const handleTriggerKeyDown = React34.useCallback(
|
|
10150
10261
|
(event, onOpen) => {
|
|
10151
10262
|
if (disabled) return;
|
|
10152
10263
|
if (event.key === "ArrowDown") {
|
|
@@ -10171,7 +10282,7 @@ function useDesktopSelect({
|
|
|
10171
10282
|
},
|
|
10172
10283
|
[disabled, openMenu, options, selectedIndex]
|
|
10173
10284
|
);
|
|
10174
|
-
const handleMenuKeyDown =
|
|
10285
|
+
const handleMenuKeyDown = React34.useCallback(
|
|
10175
10286
|
(event, onClose) => {
|
|
10176
10287
|
if (event.key === "Escape") {
|
|
10177
10288
|
event.preventDefault();
|
|
@@ -10221,7 +10332,7 @@ function useDesktopSelect({
|
|
|
10221
10332
|
},
|
|
10222
10333
|
[focusTrigger, highlightedIndex, onChange, options]
|
|
10223
10334
|
);
|
|
10224
|
-
const setOptionRef =
|
|
10335
|
+
const setOptionRef = React34.useCallback(
|
|
10225
10336
|
(index, node) => {
|
|
10226
10337
|
optionRefs.current[index] = node;
|
|
10227
10338
|
},
|
|
@@ -10241,23 +10352,23 @@ function useDesktopSelect({
|
|
|
10241
10352
|
}
|
|
10242
10353
|
|
|
10243
10354
|
// src/airbnb/select/useMobileSelectWheel.ts
|
|
10244
|
-
var
|
|
10355
|
+
var React35 = __toESM(require("react"), 1);
|
|
10245
10356
|
function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
10246
|
-
const [pendingValue, setPendingValue] =
|
|
10357
|
+
const [pendingValue, setPendingValue] = React35.useState(
|
|
10247
10358
|
value ?? null
|
|
10248
10359
|
);
|
|
10249
|
-
const [mobileScrollTop, setMobileScrollTop] =
|
|
10250
|
-
const mobileListRef =
|
|
10251
|
-
const scrollSettleTimeoutRef =
|
|
10252
|
-
const scrollAnimationFrameRef =
|
|
10253
|
-
const getTargetIndex =
|
|
10360
|
+
const [mobileScrollTop, setMobileScrollTop] = React35.useState(0);
|
|
10361
|
+
const mobileListRef = React35.useRef(null);
|
|
10362
|
+
const scrollSettleTimeoutRef = React35.useRef(null);
|
|
10363
|
+
const scrollAnimationFrameRef = React35.useRef(null);
|
|
10364
|
+
const getTargetIndex = React35.useCallback(
|
|
10254
10365
|
(targetValue) => {
|
|
10255
10366
|
const selectedIndex = getOptionIndex(options, targetValue);
|
|
10256
10367
|
return selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex(options);
|
|
10257
10368
|
},
|
|
10258
10369
|
[options]
|
|
10259
10370
|
);
|
|
10260
|
-
const syncScrollPosition =
|
|
10371
|
+
const syncScrollPosition = React35.useCallback(
|
|
10261
10372
|
(targetValue, behavior = "instant") => {
|
|
10262
10373
|
const targetIndex = getTargetIndex(targetValue);
|
|
10263
10374
|
if (targetIndex < 0) return;
|
|
@@ -10276,27 +10387,27 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10276
10387
|
},
|
|
10277
10388
|
[getTargetIndex, options]
|
|
10278
10389
|
);
|
|
10279
|
-
const clearScrollSettleTimeout =
|
|
10390
|
+
const clearScrollSettleTimeout = React35.useCallback(() => {
|
|
10280
10391
|
if (scrollSettleTimeoutRef.current === null) return;
|
|
10281
10392
|
window.clearTimeout(scrollSettleTimeoutRef.current);
|
|
10282
10393
|
scrollSettleTimeoutRef.current = null;
|
|
10283
10394
|
}, []);
|
|
10284
|
-
const clearScrollAnimationFrame =
|
|
10395
|
+
const clearScrollAnimationFrame = React35.useCallback(() => {
|
|
10285
10396
|
if (scrollAnimationFrameRef.current === null) return;
|
|
10286
10397
|
window.cancelAnimationFrame(scrollAnimationFrameRef.current);
|
|
10287
10398
|
scrollAnimationFrameRef.current = null;
|
|
10288
10399
|
}, []);
|
|
10289
|
-
|
|
10400
|
+
React35.useEffect(
|
|
10290
10401
|
() => () => {
|
|
10291
10402
|
clearScrollSettleTimeout();
|
|
10292
10403
|
clearScrollAnimationFrame();
|
|
10293
10404
|
},
|
|
10294
10405
|
[clearScrollAnimationFrame, clearScrollSettleTimeout]
|
|
10295
10406
|
);
|
|
10296
|
-
|
|
10407
|
+
React35.useEffect(() => {
|
|
10297
10408
|
setPendingValue(value ?? null);
|
|
10298
10409
|
}, [value]);
|
|
10299
|
-
|
|
10410
|
+
React35.useLayoutEffect(() => {
|
|
10300
10411
|
if (!isMobile || !isOpen) return;
|
|
10301
10412
|
const frameId = window.requestAnimationFrame(() => {
|
|
10302
10413
|
syncScrollPosition(value ?? null, "instant");
|
|
@@ -10305,7 +10416,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10305
10416
|
window.cancelAnimationFrame(frameId);
|
|
10306
10417
|
};
|
|
10307
10418
|
}, [isMobile, isOpen, syncScrollPosition, value]);
|
|
10308
|
-
const settleScroll =
|
|
10419
|
+
const settleScroll = React35.useCallback(() => {
|
|
10309
10420
|
if (!mobileListRef.current) return;
|
|
10310
10421
|
const nextIndex = Math.round(mobileListRef.current.scrollTop / MOBILE_OPTION_HEIGHT);
|
|
10311
10422
|
const nextOption = options[nextIndex];
|
|
@@ -10317,13 +10428,13 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10317
10428
|
}
|
|
10318
10429
|
setPendingValue(nextOption);
|
|
10319
10430
|
}, [options, pendingValue]);
|
|
10320
|
-
const scheduleScrollSettle =
|
|
10431
|
+
const scheduleScrollSettle = React35.useCallback(() => {
|
|
10321
10432
|
clearScrollSettleTimeout();
|
|
10322
10433
|
scrollSettleTimeoutRef.current = window.setTimeout(() => {
|
|
10323
10434
|
settleScroll();
|
|
10324
10435
|
}, MOBILE_SCROLL_SETTLE_DELAY);
|
|
10325
10436
|
}, [clearScrollSettleTimeout, settleScroll]);
|
|
10326
|
-
const handleScroll =
|
|
10437
|
+
const handleScroll = React35.useCallback(() => {
|
|
10327
10438
|
if (!mobileListRef.current) return;
|
|
10328
10439
|
const nextScrollTop = mobileListRef.current.scrollTop;
|
|
10329
10440
|
clearScrollAnimationFrame();
|
|
@@ -10333,7 +10444,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10333
10444
|
});
|
|
10334
10445
|
scheduleScrollSettle();
|
|
10335
10446
|
}, [clearScrollAnimationFrame, scheduleScrollSettle]);
|
|
10336
|
-
const focusOptionByIndex =
|
|
10447
|
+
const focusOptionByIndex = React35.useCallback(
|
|
10337
10448
|
(index, behavior = "instant", updatePendingImmediately = behavior === "instant") => {
|
|
10338
10449
|
if (!mobileListRef.current || index < 0 || index >= options.length) return;
|
|
10339
10450
|
const option = options[index];
|
|
@@ -10351,7 +10462,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10351
10462
|
},
|
|
10352
10463
|
[options, scheduleScrollSettle]
|
|
10353
10464
|
);
|
|
10354
|
-
const handleOptionClick =
|
|
10465
|
+
const handleOptionClick = React35.useCallback(
|
|
10355
10466
|
(option) => {
|
|
10356
10467
|
if (!mobileListRef.current || disabled || option.isDisabled) return;
|
|
10357
10468
|
const optionIndex = getOptionIndex(options, option);
|
|
@@ -10360,7 +10471,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10360
10471
|
},
|
|
10361
10472
|
[disabled, focusOptionByIndex, options]
|
|
10362
10473
|
);
|
|
10363
|
-
const moveByStep =
|
|
10474
|
+
const moveByStep = React35.useCallback(
|
|
10364
10475
|
(step) => {
|
|
10365
10476
|
const currentIndex = getOptionIndex(options, pendingValue);
|
|
10366
10477
|
const fallbackIndex = step === 1 ? getFirstEnabledOptionIndex(options) : getLastEnabledOptionIndex(options);
|
|
@@ -10372,7 +10483,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10372
10483
|
},
|
|
10373
10484
|
[focusOptionByIndex, options, pendingValue]
|
|
10374
10485
|
);
|
|
10375
|
-
const moveToBoundary =
|
|
10486
|
+
const moveToBoundary = React35.useCallback(
|
|
10376
10487
|
(boundary) => {
|
|
10377
10488
|
const targetIndex = boundary === "start" ? getFirstEnabledOptionIndex(options) : getLastEnabledOptionIndex(options);
|
|
10378
10489
|
if (targetIndex >= 0) {
|
|
@@ -10381,7 +10492,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10381
10492
|
},
|
|
10382
10493
|
[focusOptionByIndex, options]
|
|
10383
10494
|
);
|
|
10384
|
-
const syncPendingValue =
|
|
10495
|
+
const syncPendingValue = React35.useCallback(
|
|
10385
10496
|
(nextValue) => {
|
|
10386
10497
|
const normalizedValue = nextValue ?? null;
|
|
10387
10498
|
const matchedIndex = getOptionIndex(options, normalizedValue);
|
|
@@ -10409,9 +10520,9 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10409
10520
|
}
|
|
10410
10521
|
|
|
10411
10522
|
// src/airbnb/select/useSelectIds.ts
|
|
10412
|
-
var
|
|
10523
|
+
var React36 = __toESM(require("react"), 1);
|
|
10413
10524
|
function useSelectIds({ name, hasValue, error, hideErrorMessage }) {
|
|
10414
|
-
const reactId =
|
|
10525
|
+
const reactId = React36.useId().replace(/:/g, "");
|
|
10415
10526
|
const baseId = name ? `select-${name}` : `select-${reactId}`;
|
|
10416
10527
|
const triggerId = `${baseId}-trigger`;
|
|
10417
10528
|
const labelId = `${baseId}-label`;
|
|
@@ -10421,7 +10532,7 @@ function useSelectIds({ name, hasValue, error, hideErrorMessage }) {
|
|
|
10421
10532
|
const listboxId = `${baseId}-listbox`;
|
|
10422
10533
|
const describedErrorId = error && !hideErrorMessage ? errorId : void 0;
|
|
10423
10534
|
const describedBy = [!hasValue ? helperTextId : null, describedErrorId].filter(Boolean).join(" ") || void 0;
|
|
10424
|
-
const getOptionId2 =
|
|
10535
|
+
const getOptionId2 = React36.useCallback(
|
|
10425
10536
|
(index) => `${baseId}-option-${index}`,
|
|
10426
10537
|
[baseId]
|
|
10427
10538
|
);
|
|
@@ -10439,11 +10550,11 @@ function useSelectIds({ name, hasValue, error, hideErrorMessage }) {
|
|
|
10439
10550
|
}
|
|
10440
10551
|
|
|
10441
10552
|
// src/lib/use-outside-click.ts
|
|
10442
|
-
var
|
|
10553
|
+
var import_react46 = require("react");
|
|
10443
10554
|
function useOutsideClick(elementRef, onOutsideClick, nested) {
|
|
10444
|
-
const handleOutsideClick = (0,
|
|
10555
|
+
const handleOutsideClick = (0, import_react46.useRef)(onOutsideClick);
|
|
10445
10556
|
handleOutsideClick.current = onOutsideClick;
|
|
10446
|
-
const checkNestedElements = (0,
|
|
10557
|
+
const checkNestedElements = (0, import_react46.useCallback)(
|
|
10447
10558
|
(event) => {
|
|
10448
10559
|
const checkIsElementClickedBySelector = (selector) => {
|
|
10449
10560
|
const nestedElement = getDocument().querySelector(selector);
|
|
@@ -10474,7 +10585,7 @@ function useOutsideClick(elementRef, onOutsideClick, nested) {
|
|
|
10474
10585
|
},
|
|
10475
10586
|
[nested]
|
|
10476
10587
|
);
|
|
10477
|
-
(0,
|
|
10588
|
+
(0, import_react46.useEffect)(() => {
|
|
10478
10589
|
function handleClickOutside(event) {
|
|
10479
10590
|
const isNestedElement = checkNestedElements(event);
|
|
10480
10591
|
if (elementRef?.current && !elementRef.current.contains(event.target) && !isNestedElement) {
|
|
@@ -10491,8 +10602,8 @@ function useOutsideClick(elementRef, onOutsideClick, nested) {
|
|
|
10491
10602
|
}
|
|
10492
10603
|
|
|
10493
10604
|
// src/airbnb/select/Select.tsx
|
|
10494
|
-
var
|
|
10495
|
-
var AirbnbSelect =
|
|
10605
|
+
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
10606
|
+
var AirbnbSelect = React37.forwardRef(function AirbnbSelect2({
|
|
10496
10607
|
options = [],
|
|
10497
10608
|
value,
|
|
10498
10609
|
onChange,
|
|
@@ -10519,8 +10630,8 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10519
10630
|
noOptionsMessage
|
|
10520
10631
|
}, ref) {
|
|
10521
10632
|
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
10522
|
-
const [isOpen, setIsOpen] =
|
|
10523
|
-
const containerRef =
|
|
10633
|
+
const [isOpen, setIsOpen] = React37.useState(false);
|
|
10634
|
+
const containerRef = React37.useRef(null);
|
|
10524
10635
|
const hasValue = Boolean(value);
|
|
10525
10636
|
const helperText = placeholder ?? label;
|
|
10526
10637
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
@@ -10574,12 +10685,12 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10574
10685
|
const activeMobileIndex = getOptionIndex(options, pendingValue);
|
|
10575
10686
|
const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
|
|
10576
10687
|
useOutsideClick(containerRef, isOpen && !isMobile ? () => setIsOpen(false) : null);
|
|
10577
|
-
|
|
10688
|
+
React37.useEffect(() => {
|
|
10578
10689
|
if (isBlocked) {
|
|
10579
10690
|
setIsOpen(false);
|
|
10580
10691
|
}
|
|
10581
10692
|
}, [isBlocked]);
|
|
10582
|
-
|
|
10693
|
+
React37.useEffect(
|
|
10583
10694
|
function setCorrectOptionIfThereIsOnlyValue() {
|
|
10584
10695
|
if (value?.value === void 0 || value.value === null || value.label !== "") {
|
|
10585
10696
|
return;
|
|
@@ -10591,7 +10702,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10591
10702
|
},
|
|
10592
10703
|
[onChange, options, value]
|
|
10593
10704
|
);
|
|
10594
|
-
const handleMobileOpenChange =
|
|
10705
|
+
const handleMobileOpenChange = React37.useCallback(
|
|
10595
10706
|
(nextOpen) => {
|
|
10596
10707
|
if (isBlocked && nextOpen) return;
|
|
10597
10708
|
setIsOpen(nextOpen);
|
|
@@ -10602,7 +10713,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10602
10713
|
},
|
|
10603
10714
|
[focusTrigger, isBlocked, syncPendingValue, value]
|
|
10604
10715
|
);
|
|
10605
|
-
const handleMobileDone =
|
|
10716
|
+
const handleMobileDone = React37.useCallback(() => {
|
|
10606
10717
|
if (isBlocked) return;
|
|
10607
10718
|
const finalOption = pendingValue;
|
|
10608
10719
|
if (finalOption && finalOption.value !== value?.value) {
|
|
@@ -10611,7 +10722,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10611
10722
|
setIsOpen(false);
|
|
10612
10723
|
focusTrigger();
|
|
10613
10724
|
}, [focusTrigger, isBlocked, onChange, pendingValue, value]);
|
|
10614
|
-
const handleTriggerClick =
|
|
10725
|
+
const handleTriggerClick = React37.useCallback(() => {
|
|
10615
10726
|
if (isBlocked) return;
|
|
10616
10727
|
setIsOpen((prev) => {
|
|
10617
10728
|
const nextOpen = !prev;
|
|
@@ -10664,13 +10775,13 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10664
10775
|
handleMobileOpenChange(false);
|
|
10665
10776
|
}
|
|
10666
10777
|
};
|
|
10667
|
-
return /* @__PURE__ */ (0,
|
|
10778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
|
|
10668
10779
|
"div",
|
|
10669
10780
|
{
|
|
10670
10781
|
ref: containerRef,
|
|
10671
10782
|
className: cn("relative w-full max-w-[var(--max-field-width)]", className),
|
|
10672
10783
|
children: [
|
|
10673
|
-
name && /* @__PURE__ */ (0,
|
|
10784
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
10674
10785
|
renderTrigger ? renderTrigger({
|
|
10675
10786
|
id: triggerId,
|
|
10676
10787
|
open: isOpen,
|
|
@@ -10692,7 +10803,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10692
10803
|
onClick: handleTriggerClick,
|
|
10693
10804
|
onKeyDown: handleRootTriggerKeyDown,
|
|
10694
10805
|
onBlur
|
|
10695
|
-
}) : /* @__PURE__ */ (0,
|
|
10806
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10696
10807
|
SelectTrigger2,
|
|
10697
10808
|
{
|
|
10698
10809
|
id: triggerId,
|
|
@@ -10720,7 +10831,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10720
10831
|
onBlur
|
|
10721
10832
|
}
|
|
10722
10833
|
),
|
|
10723
|
-
isMobile ? /* @__PURE__ */ (0,
|
|
10834
|
+
isMobile ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10724
10835
|
SelectMobileContent,
|
|
10725
10836
|
{
|
|
10726
10837
|
open: isOpen,
|
|
@@ -10745,7 +10856,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10745
10856
|
getOptionId: getOptionId2,
|
|
10746
10857
|
noOptionsMessage
|
|
10747
10858
|
}
|
|
10748
|
-
) : /* @__PURE__ */ (0,
|
|
10859
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10749
10860
|
SelectDesktopContent,
|
|
10750
10861
|
{
|
|
10751
10862
|
isOpen,
|
|
@@ -10779,8 +10890,8 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10779
10890
|
});
|
|
10780
10891
|
|
|
10781
10892
|
// src/airbnb/phone-field/PhoneField.tsx
|
|
10782
|
-
var
|
|
10783
|
-
var PhoneField =
|
|
10893
|
+
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
10894
|
+
var PhoneField = React38.forwardRef(
|
|
10784
10895
|
({
|
|
10785
10896
|
variant = "default",
|
|
10786
10897
|
label,
|
|
@@ -10804,8 +10915,8 @@ var PhoneField = React37.forwardRef(
|
|
|
10804
10915
|
mobileTitle,
|
|
10805
10916
|
codePlaceholder = "+00"
|
|
10806
10917
|
}, ref) => {
|
|
10807
|
-
const inputId =
|
|
10808
|
-
const codeOptions =
|
|
10918
|
+
const inputId = React38.useId();
|
|
10919
|
+
const codeOptions = React38.useMemo(
|
|
10809
10920
|
() => options.map((option) => ({
|
|
10810
10921
|
value: option.value,
|
|
10811
10922
|
label: `${option.label} (${option.value})`,
|
|
@@ -10813,7 +10924,7 @@ var PhoneField = React37.forwardRef(
|
|
|
10813
10924
|
})),
|
|
10814
10925
|
[options]
|
|
10815
10926
|
);
|
|
10816
|
-
const selectedCodeOption =
|
|
10927
|
+
const selectedCodeOption = React38.useMemo(
|
|
10817
10928
|
() => codeOptions.find((option) => option.value === value?.code) ?? null,
|
|
10818
10929
|
[codeOptions, value?.code]
|
|
10819
10930
|
);
|
|
@@ -10821,9 +10932,9 @@ var PhoneField = React37.forwardRef(
|
|
|
10821
10932
|
const hasInvalidState = Boolean(error) || Boolean(invalid);
|
|
10822
10933
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
10823
10934
|
const isCodeBlocked = isBlocked || Boolean(codeReadOnly);
|
|
10824
|
-
return /* @__PURE__ */ (0,
|
|
10825
|
-
name && /* @__PURE__ */ (0,
|
|
10826
|
-
codeName && /* @__PURE__ */ (0,
|
|
10935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: cn("w-full max-w-[var(--max-field-width)]", className), children: [
|
|
10936
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
10937
|
+
codeName && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10827
10938
|
"input",
|
|
10828
10939
|
{
|
|
10829
10940
|
type: "hidden",
|
|
@@ -10832,7 +10943,7 @@ var PhoneField = React37.forwardRef(
|
|
|
10832
10943
|
disabled
|
|
10833
10944
|
}
|
|
10834
10945
|
),
|
|
10835
|
-
numberName && /* @__PURE__ */ (0,
|
|
10946
|
+
numberName && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10836
10947
|
"input",
|
|
10837
10948
|
{
|
|
10838
10949
|
type: "hidden",
|
|
@@ -10841,7 +10952,7 @@ var PhoneField = React37.forwardRef(
|
|
|
10841
10952
|
disabled
|
|
10842
10953
|
}
|
|
10843
10954
|
),
|
|
10844
|
-
topLabel && /* @__PURE__ */ (0,
|
|
10955
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10845
10956
|
"label",
|
|
10846
10957
|
{
|
|
10847
10958
|
htmlFor: inputId,
|
|
@@ -10849,8 +10960,8 @@ var PhoneField = React37.forwardRef(
|
|
|
10849
10960
|
children: topLabel
|
|
10850
10961
|
}
|
|
10851
10962
|
),
|
|
10852
|
-
/* @__PURE__ */ (0,
|
|
10853
|
-
/* @__PURE__ */ (0,
|
|
10963
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex items-stretch", children: [
|
|
10964
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10854
10965
|
AirbnbSelect,
|
|
10855
10966
|
{
|
|
10856
10967
|
ref,
|
|
@@ -10881,7 +10992,7 @@ var PhoneField = React37.forwardRef(
|
|
|
10881
10992
|
onClick,
|
|
10882
10993
|
onKeyDown,
|
|
10883
10994
|
valueLabel
|
|
10884
|
-
}) => /* @__PURE__ */ (0,
|
|
10995
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
|
|
10885
10996
|
"button",
|
|
10886
10997
|
{
|
|
10887
10998
|
id,
|
|
@@ -10903,8 +11014,8 @@ var PhoneField = React37.forwardRef(
|
|
|
10903
11014
|
triggerDisabled ? "cursor-not-allowed opacity-50" : triggerLoading ? "cursor-progress" : "cursor-pointer"
|
|
10904
11015
|
),
|
|
10905
11016
|
children: [
|
|
10906
|
-
/* @__PURE__ */ (0,
|
|
10907
|
-
/* @__PURE__ */ (0,
|
|
11017
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { children: valueLabel ?? codePlaceholder }),
|
|
11018
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10908
11019
|
import_lucide_react44.ChevronDown,
|
|
10909
11020
|
{
|
|
10910
11021
|
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
@@ -10916,7 +11027,7 @@ var PhoneField = React37.forwardRef(
|
|
|
10916
11027
|
)
|
|
10917
11028
|
}
|
|
10918
11029
|
),
|
|
10919
|
-
/* @__PURE__ */ (0,
|
|
11030
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10920
11031
|
AirbnbInput,
|
|
10921
11032
|
{
|
|
10922
11033
|
id: inputId,
|
|
@@ -10948,23 +11059,23 @@ var PhoneField = React37.forwardRef(
|
|
|
10948
11059
|
}
|
|
10949
11060
|
)
|
|
10950
11061
|
] }),
|
|
10951
|
-
error && /* @__PURE__ */ (0,
|
|
11062
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(FieldErrorMessage, { message: error })
|
|
10952
11063
|
] });
|
|
10953
11064
|
}
|
|
10954
11065
|
);
|
|
10955
11066
|
PhoneField.displayName = "PhoneField";
|
|
10956
11067
|
|
|
10957
11068
|
// src/airbnb/search-input/SearchInput.tsx
|
|
10958
|
-
var
|
|
11069
|
+
var React39 = __toESM(require("react"), 1);
|
|
10959
11070
|
var import_react_i18next23 = require("react-i18next");
|
|
10960
11071
|
var import_lucide_react45 = require("lucide-react");
|
|
10961
|
-
var
|
|
10962
|
-
var AirbnbSearchInput =
|
|
11072
|
+
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
11073
|
+
var AirbnbSearchInput = React39.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
|
|
10963
11074
|
const { t } = (0, import_react_i18next23.useTranslation)();
|
|
10964
11075
|
const placeholderText = placeholder || t("search_property") + "...";
|
|
10965
|
-
return /* @__PURE__ */ (0,
|
|
10966
|
-
/* @__PURE__ */ (0,
|
|
10967
|
-
/* @__PURE__ */ (0,
|
|
11076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
|
|
11077
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_lucide_react45.Search, { className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]" }),
|
|
11078
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
10968
11079
|
"input",
|
|
10969
11080
|
{
|
|
10970
11081
|
...props,
|
|
@@ -10983,13 +11094,13 @@ var AirbnbSearchInput = React38.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
10983
11094
|
)
|
|
10984
11095
|
}
|
|
10985
11096
|
),
|
|
10986
|
-
onReset && /* @__PURE__ */ (0,
|
|
11097
|
+
onReset && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
10987
11098
|
Button,
|
|
10988
11099
|
{
|
|
10989
11100
|
variant: "ghost",
|
|
10990
11101
|
onClick: onReset,
|
|
10991
11102
|
className: "absolute right-0 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]",
|
|
10992
|
-
children: /* @__PURE__ */ (0,
|
|
11103
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_lucide_react45.X, { className: "h-5 w-5" })
|
|
10993
11104
|
}
|
|
10994
11105
|
)
|
|
10995
11106
|
] });
|
|
@@ -10997,11 +11108,29 @@ var AirbnbSearchInput = React38.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
10997
11108
|
AirbnbSearchInput.displayName = "SearchInput";
|
|
10998
11109
|
|
|
10999
11110
|
// src/searchable-select/SearchableSelect.tsx
|
|
11000
|
-
var
|
|
11111
|
+
var React40 = __toESM(require("react"), 1);
|
|
11001
11112
|
var import_lucide_react46 = require("lucide-react");
|
|
11002
11113
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
11003
|
-
var
|
|
11004
|
-
|
|
11114
|
+
var import_react48 = require("react");
|
|
11115
|
+
|
|
11116
|
+
// src/lib/use-event.ts
|
|
11117
|
+
var import_react47 = require("react");
|
|
11118
|
+
function useEvent(fn) {
|
|
11119
|
+
const fnRef = (0, import_react47.useRef)(fn);
|
|
11120
|
+
(0, import_react47.useLayoutEffect)(() => {
|
|
11121
|
+
fnRef.current = fn;
|
|
11122
|
+
}, [fn]);
|
|
11123
|
+
const eventCb = (0, import_react47.useCallback)(
|
|
11124
|
+
(...args) => {
|
|
11125
|
+
return fnRef.current?.apply(null, args);
|
|
11126
|
+
},
|
|
11127
|
+
[fnRef]
|
|
11128
|
+
);
|
|
11129
|
+
return eventCb;
|
|
11130
|
+
}
|
|
11131
|
+
|
|
11132
|
+
// src/searchable-select/SearchableSelect.tsx
|
|
11133
|
+
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
11005
11134
|
var ROW_HEIGHT = 48;
|
|
11006
11135
|
var DESKTOP_LIST_HEIGHT = 280;
|
|
11007
11136
|
var MOBILE_LIST_HEIGHT = 420;
|
|
@@ -11042,13 +11171,13 @@ var SearchableSelectInternal = ({
|
|
|
11042
11171
|
loadingMessage
|
|
11043
11172
|
}, ref) => {
|
|
11044
11173
|
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
11045
|
-
const reactId =
|
|
11046
|
-
const [open, setOpen] =
|
|
11047
|
-
const [internalSearchValue, setInternalSearchValue] =
|
|
11048
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
11049
|
-
const containerRef =
|
|
11050
|
-
const triggerRef =
|
|
11051
|
-
const inputRef =
|
|
11174
|
+
const reactId = React40.useId();
|
|
11175
|
+
const [open, setOpen] = React40.useState(false);
|
|
11176
|
+
const [internalSearchValue, setInternalSearchValue] = React40.useState("");
|
|
11177
|
+
const [highlightedIndex, setHighlightedIndex] = React40.useState(-1);
|
|
11178
|
+
const containerRef = React40.useRef(null);
|
|
11179
|
+
const triggerRef = React40.useRef(null);
|
|
11180
|
+
const inputRef = React40.useRef(null);
|
|
11052
11181
|
const listboxId = `${reactId}-listbox`;
|
|
11053
11182
|
const labelId = `${reactId}-label`;
|
|
11054
11183
|
const valueId = `${reactId}-value`;
|
|
@@ -11057,13 +11186,13 @@ var SearchableSelectInternal = ({
|
|
|
11057
11186
|
const searchInputId = `${reactId}-search`;
|
|
11058
11187
|
const effectiveSearchValue = searchValue ?? internalSearchValue;
|
|
11059
11188
|
const shouldFilterLocally = !onSearchChange && filterOption !== null;
|
|
11060
|
-
const visibleOptions =
|
|
11189
|
+
const visibleOptions = React40.useMemo(() => {
|
|
11061
11190
|
if (!shouldFilterLocally || !effectiveSearchValue) {
|
|
11062
11191
|
return options;
|
|
11063
11192
|
}
|
|
11064
11193
|
return options.filter((option) => filterOption(option, effectiveSearchValue));
|
|
11065
11194
|
}, [effectiveSearchValue, filterOption, options, shouldFilterLocally]);
|
|
11066
|
-
const selectedIndex =
|
|
11195
|
+
const selectedIndex = React40.useMemo(
|
|
11067
11196
|
() => visibleOptions.findIndex((option) => option.value === value?.value),
|
|
11068
11197
|
[value?.value, visibleOptions]
|
|
11069
11198
|
);
|
|
@@ -11074,17 +11203,18 @@ var SearchableSelectInternal = ({
|
|
|
11074
11203
|
const describedBy = error && !hideErrorMessage ? errorId : void 0;
|
|
11075
11204
|
const activeOptionId = highlightedIndex >= 0 ? getOptionId(reactId, highlightedIndex) : void 0;
|
|
11076
11205
|
useOutsideClick(containerRef, open && !isMobile ? () => closeSelect() : null);
|
|
11077
|
-
const
|
|
11206
|
+
const handleOnOpenChange = useEvent(onOpenChange);
|
|
11207
|
+
const setSelectOpen = (0, import_react48.useCallback)(
|
|
11078
11208
|
(nextOpen, options2) => {
|
|
11079
11209
|
setOpen(nextOpen);
|
|
11080
|
-
|
|
11210
|
+
handleOnOpenChange?.(nextOpen);
|
|
11081
11211
|
if (!nextOpen && options2?.restoreFocus) {
|
|
11082
11212
|
triggerRef.current?.focus();
|
|
11083
11213
|
}
|
|
11084
11214
|
},
|
|
11085
|
-
[]
|
|
11215
|
+
[handleOnOpenChange]
|
|
11086
11216
|
);
|
|
11087
|
-
|
|
11217
|
+
React40.useEffect(() => {
|
|
11088
11218
|
if (isBlocked) {
|
|
11089
11219
|
setSelectOpen(false);
|
|
11090
11220
|
return;
|
|
@@ -11097,7 +11227,7 @@ var SearchableSelectInternal = ({
|
|
|
11097
11227
|
window.cancelAnimationFrame(frameId);
|
|
11098
11228
|
};
|
|
11099
11229
|
}, [isBlocked, open, setSelectOpen]);
|
|
11100
|
-
|
|
11230
|
+
React40.useEffect(() => {
|
|
11101
11231
|
if (!open) {
|
|
11102
11232
|
setHighlightedIndex(-1);
|
|
11103
11233
|
return;
|
|
@@ -11165,7 +11295,7 @@ var SearchableSelectInternal = ({
|
|
|
11165
11295
|
}
|
|
11166
11296
|
}
|
|
11167
11297
|
}
|
|
11168
|
-
const content = /* @__PURE__ */ (0,
|
|
11298
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
11169
11299
|
SearchableSelectContent,
|
|
11170
11300
|
{
|
|
11171
11301
|
inputId: searchInputId,
|
|
@@ -11192,15 +11322,15 @@ var SearchableSelectInternal = ({
|
|
|
11192
11322
|
onOptionHover: setHighlightedIndex
|
|
11193
11323
|
}
|
|
11194
11324
|
);
|
|
11195
|
-
|
|
11196
|
-
return /* @__PURE__ */ (0,
|
|
11325
|
+
React40.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
11326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
|
|
11197
11327
|
"div",
|
|
11198
11328
|
{
|
|
11199
11329
|
ref: containerRef,
|
|
11200
11330
|
className: cn("relative w-full max-w-[var(--max-field-width)]", className),
|
|
11201
11331
|
children: [
|
|
11202
|
-
name && /* @__PURE__ */ (0,
|
|
11203
|
-
/* @__PURE__ */ (0,
|
|
11332
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
11333
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
11204
11334
|
FieldTrigger,
|
|
11205
11335
|
{
|
|
11206
11336
|
id: `${reactId}-trigger`,
|
|
@@ -11235,7 +11365,7 @@ var SearchableSelectInternal = ({
|
|
|
11235
11365
|
},
|
|
11236
11366
|
onKeyDown: handleTriggerKeyDown,
|
|
11237
11367
|
onBlur,
|
|
11238
|
-
trailingAdornment: /* @__PURE__ */ (0,
|
|
11368
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
11239
11369
|
import_lucide_react46.ChevronDown,
|
|
11240
11370
|
{
|
|
11241
11371
|
className: cn(
|
|
@@ -11246,7 +11376,7 @@ var SearchableSelectInternal = ({
|
|
|
11246
11376
|
)
|
|
11247
11377
|
}
|
|
11248
11378
|
),
|
|
11249
|
-
isMobile ? /* @__PURE__ */ (0,
|
|
11379
|
+
isMobile ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
11250
11380
|
Drawer,
|
|
11251
11381
|
{
|
|
11252
11382
|
open,
|
|
@@ -11258,13 +11388,13 @@ var SearchableSelectInternal = ({
|
|
|
11258
11388
|
}
|
|
11259
11389
|
closeSelect();
|
|
11260
11390
|
},
|
|
11261
|
-
children: /* @__PURE__ */ (0,
|
|
11262
|
-
/* @__PURE__ */ (0,
|
|
11263
|
-
/* @__PURE__ */ (0,
|
|
11264
|
-
/* @__PURE__ */ (0,
|
|
11391
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(DrawerContent, { onClose: closeSelect, lockScroll: false, children: [
|
|
11392
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
11393
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(DrawerDescription, { className: "sr-only", children: label }),
|
|
11394
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "px-5 pb-5 pt-1", children: content })
|
|
11265
11395
|
] })
|
|
11266
11396
|
}
|
|
11267
|
-
) : open ? /* @__PURE__ */ (0,
|
|
11397
|
+
) : open ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
11268
11398
|
"div",
|
|
11269
11399
|
{
|
|
11270
11400
|
className: cn(
|
|
@@ -11278,7 +11408,7 @@ var SearchableSelectInternal = ({
|
|
|
11278
11408
|
}
|
|
11279
11409
|
);
|
|
11280
11410
|
};
|
|
11281
|
-
var SearchableSelect =
|
|
11411
|
+
var SearchableSelect = React40.forwardRef(
|
|
11282
11412
|
SearchableSelectInternal
|
|
11283
11413
|
);
|
|
11284
11414
|
function SearchableSelectContent({
|
|
@@ -11305,9 +11435,9 @@ function SearchableSelectContent({
|
|
|
11305
11435
|
onOptionClick,
|
|
11306
11436
|
onOptionHover
|
|
11307
11437
|
}) {
|
|
11308
|
-
const listRef =
|
|
11309
|
-
const lastLoadMoreOptionsLengthRef =
|
|
11310
|
-
const previousHighlightedIndexRef =
|
|
11438
|
+
const listRef = React40.useRef(null);
|
|
11439
|
+
const lastLoadMoreOptionsLengthRef = React40.useRef(null);
|
|
11440
|
+
const previousHighlightedIndexRef = React40.useRef(highlightedIndex);
|
|
11311
11441
|
const rowCount = options.length + (loading && options.length > 0 ? 1 : 0);
|
|
11312
11442
|
const virtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
11313
11443
|
count: rowCount,
|
|
@@ -11318,7 +11448,7 @@ function SearchableSelectContent({
|
|
|
11318
11448
|
const virtualItems = virtualizer.getVirtualItems();
|
|
11319
11449
|
const emptyMessage = noOptionsMessage?.() ?? "No matches found";
|
|
11320
11450
|
const loadingText = loadingMessage?.() ?? "Loading...";
|
|
11321
|
-
|
|
11451
|
+
React40.useEffect(() => {
|
|
11322
11452
|
const lastItem = virtualItems[virtualItems.length - 1];
|
|
11323
11453
|
const shouldLoadMore = !!lastItem && hasNextPage && !loading && lastItem.index >= options.length - LOAD_MORE_THRESHOLD;
|
|
11324
11454
|
if (shouldLoadMore && lastLoadMoreOptionsLengthRef.current !== options.length) {
|
|
@@ -11326,23 +11456,23 @@ function SearchableSelectContent({
|
|
|
11326
11456
|
onLoadMore?.();
|
|
11327
11457
|
}
|
|
11328
11458
|
}, [hasNextPage, loading, onLoadMore, options.length, virtualItems]);
|
|
11329
|
-
|
|
11459
|
+
React40.useEffect(() => {
|
|
11330
11460
|
const hasHighlightedIndexChanged = previousHighlightedIndexRef.current !== highlightedIndex;
|
|
11331
11461
|
previousHighlightedIndexRef.current = highlightedIndex;
|
|
11332
11462
|
if (highlightedIndex >= 0 && hasHighlightedIndexChanged) {
|
|
11333
11463
|
virtualizer.scrollToIndex(highlightedIndex, { align: "auto" });
|
|
11334
11464
|
}
|
|
11335
11465
|
}, [highlightedIndex, virtualizer]);
|
|
11336
|
-
return /* @__PURE__ */ (0,
|
|
11337
|
-
/* @__PURE__ */ (0,
|
|
11338
|
-
/* @__PURE__ */ (0,
|
|
11466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "p-2", children: [
|
|
11467
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "relative mb-2", children: [
|
|
11468
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
11339
11469
|
import_lucide_react46.Search,
|
|
11340
11470
|
{
|
|
11341
11471
|
"aria-hidden": "true",
|
|
11342
11472
|
className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 text-[#9696B9]"
|
|
11343
11473
|
}
|
|
11344
11474
|
),
|
|
11345
|
-
/* @__PURE__ */ (0,
|
|
11475
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
11346
11476
|
"input",
|
|
11347
11477
|
{
|
|
11348
11478
|
id: inputId,
|
|
@@ -11361,7 +11491,7 @@ function SearchableSelectContent({
|
|
|
11361
11491
|
}
|
|
11362
11492
|
)
|
|
11363
11493
|
] }),
|
|
11364
|
-
loading && options.length === 0 ? /* @__PURE__ */ (0,
|
|
11494
|
+
loading && options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: loadingText }) : options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
11365
11495
|
"div",
|
|
11366
11496
|
{
|
|
11367
11497
|
id: listboxId,
|
|
@@ -11370,7 +11500,7 @@ function SearchableSelectContent({
|
|
|
11370
11500
|
"aria-labelledby": labelId,
|
|
11371
11501
|
className: cn("overflow-y-auto outline-none", menuClassName),
|
|
11372
11502
|
style: { height: Math.min(height, rowCount * ROW_HEIGHT) },
|
|
11373
|
-
children: /* @__PURE__ */ (0,
|
|
11503
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
11374
11504
|
"div",
|
|
11375
11505
|
{
|
|
11376
11506
|
className: "relative w-full",
|
|
@@ -11378,7 +11508,7 @@ function SearchableSelectContent({
|
|
|
11378
11508
|
children: virtualItems.map((virtualItem) => {
|
|
11379
11509
|
const option = options[virtualItem.index];
|
|
11380
11510
|
if (!option) {
|
|
11381
|
-
return /* @__PURE__ */ (0,
|
|
11511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
11382
11512
|
"div",
|
|
11383
11513
|
{
|
|
11384
11514
|
className: "absolute left-0 top-0 flex w-full items-center px-4 text-base leading-6 text-[#6C6C6C]",
|
|
@@ -11393,7 +11523,7 @@ function SearchableSelectContent({
|
|
|
11393
11523
|
}
|
|
11394
11524
|
const isSelected = value?.value === option.value;
|
|
11395
11525
|
const isHighlighted = virtualItem.index === highlightedIndex;
|
|
11396
|
-
return /* @__PURE__ */ (0,
|
|
11526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
11397
11527
|
"button",
|
|
11398
11528
|
{
|
|
11399
11529
|
id: getOptionId(idPrefix, virtualItem.index),
|
|
@@ -11415,7 +11545,7 @@ function SearchableSelectContent({
|
|
|
11415
11545
|
height: `${virtualItem.size}px`,
|
|
11416
11546
|
transform: `translateY(${virtualItem.start}px)`
|
|
11417
11547
|
},
|
|
11418
|
-
children: /* @__PURE__ */ (0,
|
|
11548
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("span", { className: "truncate text-center", children: String(option.label) })
|
|
11419
11549
|
},
|
|
11420
11550
|
`${String(option.value)}-${virtualItem.index}`
|
|
11421
11551
|
);
|
|
@@ -11480,6 +11610,7 @@ function getNextEnabledIndex(options, startIndex, step) {
|
|
|
11480
11610
|
ChannelSelector,
|
|
11481
11611
|
Checkbox,
|
|
11482
11612
|
CheckboxGroup,
|
|
11613
|
+
CircularLoader,
|
|
11483
11614
|
CommingSoonBadge,
|
|
11484
11615
|
ConfirmationDialog,
|
|
11485
11616
|
CopyIcon,
|