@chekinapp/ui 0.0.18 → 0.0.19
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.js
CHANGED
|
@@ -1125,6 +1125,20 @@ var getDocument = () => {
|
|
|
1125
1125
|
function getCustomContainer() {
|
|
1126
1126
|
return getDocument()?.body;
|
|
1127
1127
|
}
|
|
1128
|
+
var isNumeric = (n) => n !== "" && !isNaN(n);
|
|
1129
|
+
function toCssSize(size) {
|
|
1130
|
+
if (!size) {
|
|
1131
|
+
return;
|
|
1132
|
+
} else if (size === "auto") {
|
|
1133
|
+
return size;
|
|
1134
|
+
} else if (typeof size === "number" || isNumeric(size)) {
|
|
1135
|
+
return `${size}px`;
|
|
1136
|
+
} else if (size.slice(-2) === "px") {
|
|
1137
|
+
return size;
|
|
1138
|
+
} else {
|
|
1139
|
+
return size;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1128
1142
|
|
|
1129
1143
|
// src/tooltip/Tooltip.tsx
|
|
1130
1144
|
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
@@ -2027,7 +2041,7 @@ function DialogPortal({ ...props }) {
|
|
|
2027
2041
|
function DialogClose({ ...props }) {
|
|
2028
2042
|
return /* @__PURE__ */ jsx29(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
2029
2043
|
}
|
|
2030
|
-
var dialogOverlayClasses = "fixed inset-0 z-50 bg-
|
|
2044
|
+
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";
|
|
2031
2045
|
var scrollableOverlayClasses = "fixed inset-0 z-50 flex flex-col items-center overflow-y-auto overscroll-none pb-[19px] pt-[20px]";
|
|
2032
2046
|
var DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx29(
|
|
2033
2047
|
DialogPrimitive.Overlay,
|
|
@@ -2039,8 +2053,8 @@ var DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
2039
2053
|
}
|
|
2040
2054
|
));
|
|
2041
2055
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
2042
|
-
var dialogContentClasses = "relative z-50 my-auto w-full max-w-[calc(100%-2rem)] rounded-
|
|
2043
|
-
var dialogCloseButtonClasses = "absolute right-4 top-4 rounded-
|
|
2056
|
+
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";
|
|
2057
|
+
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";
|
|
2044
2058
|
var DialogContent = React10.forwardRef(
|
|
2045
2059
|
({ className, showCloseButton = true, children, container, lockScroll = true, ...props }, ref) => {
|
|
2046
2060
|
const contentElement = /* @__PURE__ */ jsxs22(
|
|
@@ -2109,7 +2123,7 @@ var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /*
|
|
|
2109
2123
|
{
|
|
2110
2124
|
ref,
|
|
2111
2125
|
"data-slot": "dialog-description",
|
|
2112
|
-
className: cn("text-sm text-
|
|
2126
|
+
className: cn("text-sm text-[var(--dialog-description-text)]", className),
|
|
2113
2127
|
...props
|
|
2114
2128
|
}
|
|
2115
2129
|
));
|
|
@@ -6777,10 +6791,106 @@ SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
|
|
|
6777
6791
|
var VALUE_PART = 1;
|
|
6778
6792
|
var getSidebarState = (stateName) => document.cookie.split("; ").find((row) => row.startsWith(`${stateName}=`))?.split("=")[VALUE_PART] === "true";
|
|
6779
6793
|
|
|
6794
|
+
// src/circular-loader/CircularLoader.tsx
|
|
6795
|
+
import React24 from "react";
|
|
6796
|
+
import { jsx as jsx95, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
6797
|
+
var CircularLoader = React24.memo(
|
|
6798
|
+
({ visible = true, height, width, position, label, className }) => {
|
|
6799
|
+
if (!visible) return null;
|
|
6800
|
+
return /* @__PURE__ */ jsxs59(
|
|
6801
|
+
"div",
|
|
6802
|
+
{
|
|
6803
|
+
className: cn(
|
|
6804
|
+
"main-loader flex flex-col items-center justify-center gap-2",
|
|
6805
|
+
position === "center" && "h-full",
|
|
6806
|
+
className
|
|
6807
|
+
),
|
|
6808
|
+
children: [
|
|
6809
|
+
/* @__PURE__ */ jsxs59(
|
|
6810
|
+
"svg",
|
|
6811
|
+
{
|
|
6812
|
+
viewBox: "25 25 50 50",
|
|
6813
|
+
className: "main-loader__svg text-chekin-navy",
|
|
6814
|
+
style: {
|
|
6815
|
+
width: toCssSize(width),
|
|
6816
|
+
height: toCssSize(height)
|
|
6817
|
+
},
|
|
6818
|
+
children: [
|
|
6819
|
+
/* @__PURE__ */ jsx95(
|
|
6820
|
+
"circle",
|
|
6821
|
+
{
|
|
6822
|
+
r: "20",
|
|
6823
|
+
cy: "50",
|
|
6824
|
+
cx: "50",
|
|
6825
|
+
className: "cover fill-none stroke-current opacity-5",
|
|
6826
|
+
strokeWidth: "7"
|
|
6827
|
+
}
|
|
6828
|
+
),
|
|
6829
|
+
/* @__PURE__ */ jsxs59(
|
|
6830
|
+
"circle",
|
|
6831
|
+
{
|
|
6832
|
+
r: "20",
|
|
6833
|
+
cy: "50",
|
|
6834
|
+
cx: "50",
|
|
6835
|
+
className: "circle fill-none stroke-current",
|
|
6836
|
+
strokeDasharray: "1 200",
|
|
6837
|
+
strokeDashoffset: "0",
|
|
6838
|
+
strokeLinecap: "round",
|
|
6839
|
+
strokeWidth: "7",
|
|
6840
|
+
children: [
|
|
6841
|
+
/* @__PURE__ */ jsx95(
|
|
6842
|
+
"animateTransform",
|
|
6843
|
+
{
|
|
6844
|
+
attributeName: "transform",
|
|
6845
|
+
dur: "2.25s",
|
|
6846
|
+
from: "0 50 50",
|
|
6847
|
+
repeatCount: "indefinite",
|
|
6848
|
+
to: "360 50 50",
|
|
6849
|
+
type: "rotate"
|
|
6850
|
+
}
|
|
6851
|
+
),
|
|
6852
|
+
/* @__PURE__ */ jsx95(
|
|
6853
|
+
"animate",
|
|
6854
|
+
{
|
|
6855
|
+
attributeName: "stroke-dasharray",
|
|
6856
|
+
calcMode: "spline",
|
|
6857
|
+
dur: "1.8s",
|
|
6858
|
+
keyTimes: "0;0.5;1",
|
|
6859
|
+
keySplines: "0.42 0 0.58 1;0.42 0 0.58 1",
|
|
6860
|
+
repeatCount: "indefinite",
|
|
6861
|
+
values: "1 200;90 200;90 200"
|
|
6862
|
+
}
|
|
6863
|
+
),
|
|
6864
|
+
/* @__PURE__ */ jsx95(
|
|
6865
|
+
"animate",
|
|
6866
|
+
{
|
|
6867
|
+
attributeName: "stroke-dashoffset",
|
|
6868
|
+
calcMode: "spline",
|
|
6869
|
+
dur: "1.8s",
|
|
6870
|
+
keyTimes: "0;0.5;1",
|
|
6871
|
+
keySplines: "0.42 0 0.58 1;0.42 0 0.58 1",
|
|
6872
|
+
repeatCount: "indefinite",
|
|
6873
|
+
values: "0;-35;-125"
|
|
6874
|
+
}
|
|
6875
|
+
)
|
|
6876
|
+
]
|
|
6877
|
+
}
|
|
6878
|
+
)
|
|
6879
|
+
]
|
|
6880
|
+
}
|
|
6881
|
+
),
|
|
6882
|
+
label && /* @__PURE__ */ jsx95("div", { className: "text-sm font-medium text-chekin-gray-1", children: label })
|
|
6883
|
+
]
|
|
6884
|
+
}
|
|
6885
|
+
);
|
|
6886
|
+
}
|
|
6887
|
+
);
|
|
6888
|
+
CircularLoader.displayName = "MainLoader";
|
|
6889
|
+
|
|
6780
6890
|
// src/small-grid-single-item/SmallGridSingleItem.tsx
|
|
6781
6891
|
import { memo as memo5 } from "react";
|
|
6782
6892
|
import { Pencil, Trash2 } from "lucide-react";
|
|
6783
|
-
import { jsx as
|
|
6893
|
+
import { jsx as jsx96, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
6784
6894
|
var SmallGridSingleItem = memo5(
|
|
6785
6895
|
({
|
|
6786
6896
|
title,
|
|
@@ -6796,7 +6906,7 @@ var SmallGridSingleItem = memo5(
|
|
|
6796
6906
|
const handleClick = (event) => {
|
|
6797
6907
|
if (!disabled && onClick) onClick(event);
|
|
6798
6908
|
};
|
|
6799
|
-
return /* @__PURE__ */
|
|
6909
|
+
return /* @__PURE__ */ jsxs60(
|
|
6800
6910
|
"div",
|
|
6801
6911
|
{
|
|
6802
6912
|
onClick: handleClick,
|
|
@@ -6810,33 +6920,33 @@ var SmallGridSingleItem = memo5(
|
|
|
6810
6920
|
className
|
|
6811
6921
|
),
|
|
6812
6922
|
children: [
|
|
6813
|
-
/* @__PURE__ */
|
|
6814
|
-
/* @__PURE__ */
|
|
6815
|
-
subtitle && /* @__PURE__ */
|
|
6923
|
+
/* @__PURE__ */ jsxs60("div", { children: [
|
|
6924
|
+
/* @__PURE__ */ jsx96("div", { className: "line-clamp-2 overflow-hidden text-ellipsis break-all", children: title }),
|
|
6925
|
+
subtitle && /* @__PURE__ */ jsx96("div", { className: "line-clamp-2 overflow-hidden text-ellipsis text-[15px] font-medium leading-6 text-chekin-gray-2", children: subtitle })
|
|
6816
6926
|
] }),
|
|
6817
|
-
!readOnly && /* @__PURE__ */
|
|
6818
|
-
onDelete && /* @__PURE__ */
|
|
6927
|
+
!readOnly && /* @__PURE__ */ jsxs60("div", { className: "flex h-full items-center justify-end gap-2", children: [
|
|
6928
|
+
onDelete && /* @__PURE__ */ jsx96(
|
|
6819
6929
|
Button,
|
|
6820
6930
|
{
|
|
6821
6931
|
disabled,
|
|
6822
6932
|
onClick: onDelete,
|
|
6823
6933
|
size: "icon",
|
|
6824
6934
|
variant: "secondary",
|
|
6825
|
-
children: /* @__PURE__ */
|
|
6935
|
+
children: /* @__PURE__ */ jsx96(Trash2, { className: "h-5 w-5 text-chekin-red" })
|
|
6826
6936
|
}
|
|
6827
6937
|
),
|
|
6828
|
-
onEdit && /* @__PURE__ */
|
|
6938
|
+
onEdit && /* @__PURE__ */ jsx96(
|
|
6829
6939
|
Button,
|
|
6830
6940
|
{
|
|
6831
6941
|
disabled,
|
|
6832
6942
|
onClick: onEdit,
|
|
6833
6943
|
size: "icon",
|
|
6834
6944
|
variant: "secondary",
|
|
6835
|
-
children: /* @__PURE__ */
|
|
6945
|
+
children: /* @__PURE__ */ jsx96(Pencil, { className: "h-5 w-5 text-chekin-blue" })
|
|
6836
6946
|
}
|
|
6837
6947
|
)
|
|
6838
6948
|
] }),
|
|
6839
|
-
error && /* @__PURE__ */
|
|
6949
|
+
error && /* @__PURE__ */ jsx96("div", { className: "absolute bottom-1 right-2 text-xs text-chekin-red", children: error })
|
|
6840
6950
|
]
|
|
6841
6951
|
}
|
|
6842
6952
|
);
|
|
@@ -6847,7 +6957,7 @@ SmallGridSingleItem.displayName = "SmallGridSingleItem";
|
|
|
6847
6957
|
// src/sorting-action/SortingAction.tsx
|
|
6848
6958
|
import { useTranslation as useTranslation19 } from "react-i18next";
|
|
6849
6959
|
import { ArrowDown, ArrowDownUpIcon, ArrowUp, Minus as Minus2 } from "lucide-react";
|
|
6850
|
-
import { jsx as
|
|
6960
|
+
import { jsx as jsx97, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
6851
6961
|
function SortingAction({
|
|
6852
6962
|
value,
|
|
6853
6963
|
onSortChange,
|
|
@@ -6857,8 +6967,8 @@ function SortingAction({
|
|
|
6857
6967
|
onOpenChange
|
|
6858
6968
|
}) {
|
|
6859
6969
|
const { t } = useTranslation19();
|
|
6860
|
-
return /* @__PURE__ */
|
|
6861
|
-
/* @__PURE__ */
|
|
6970
|
+
return /* @__PURE__ */ jsxs61(DropdownMenu, { open, onOpenChange, children: [
|
|
6971
|
+
/* @__PURE__ */ jsx97(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx97(
|
|
6862
6972
|
"button",
|
|
6863
6973
|
{
|
|
6864
6974
|
type: "button",
|
|
@@ -6867,34 +6977,34 @@ function SortingAction({
|
|
|
6867
6977
|
className
|
|
6868
6978
|
),
|
|
6869
6979
|
"aria-label": "Open sorting menu",
|
|
6870
|
-
children: /* @__PURE__ */
|
|
6980
|
+
children: /* @__PURE__ */ jsx97(ArrowDownUpIcon, { className: "h-4 w-4 text-chekin-gray-1 group-hover/trigger:text-chekin-navy" })
|
|
6871
6981
|
}
|
|
6872
6982
|
) }),
|
|
6873
|
-
/* @__PURE__ */
|
|
6874
|
-
/* @__PURE__ */
|
|
6983
|
+
/* @__PURE__ */ jsxs61(DropdownMenuContent, { className: "w-full max-w-[256px]", align: "start", children: [
|
|
6984
|
+
/* @__PURE__ */ jsxs61(
|
|
6875
6985
|
DropdownMenuItem,
|
|
6876
6986
|
{
|
|
6877
6987
|
className: cn(value === "asc" && "bg-chekin-surface-pressed text-chekin-blue"),
|
|
6878
6988
|
onClick: () => onSortChange?.("asc"),
|
|
6879
6989
|
children: [
|
|
6880
|
-
/* @__PURE__ */
|
|
6990
|
+
/* @__PURE__ */ jsx97(ArrowUp, { className: "h-4 w-4" }),
|
|
6881
6991
|
variant === "by_text" ? t("sort_a_z") : t("sort_in_asc")
|
|
6882
6992
|
]
|
|
6883
6993
|
}
|
|
6884
6994
|
),
|
|
6885
|
-
/* @__PURE__ */
|
|
6995
|
+
/* @__PURE__ */ jsxs61(
|
|
6886
6996
|
DropdownMenuItem,
|
|
6887
6997
|
{
|
|
6888
6998
|
className: cn(value === "desc" && "bg-chekin-surface-pressed text-chekin-blue"),
|
|
6889
6999
|
onClick: () => onSortChange?.("desc"),
|
|
6890
7000
|
children: [
|
|
6891
|
-
/* @__PURE__ */
|
|
7001
|
+
/* @__PURE__ */ jsx97(ArrowDown, { className: "h-4 w-4" }),
|
|
6892
7002
|
variant === "by_text" ? t("sort_z_a") : t("sort_in_desc")
|
|
6893
7003
|
]
|
|
6894
7004
|
}
|
|
6895
7005
|
),
|
|
6896
|
-
value && /* @__PURE__ */
|
|
6897
|
-
/* @__PURE__ */
|
|
7006
|
+
value && /* @__PURE__ */ jsxs61(DropdownMenuItem, { onClick: () => onSortChange?.(null), children: [
|
|
7007
|
+
/* @__PURE__ */ jsx97(Minus2, { className: "h-4 w-4" }),
|
|
6898
7008
|
t("clear_sorting")
|
|
6899
7009
|
] })
|
|
6900
7010
|
] })
|
|
@@ -6905,7 +7015,7 @@ function SortingAction({
|
|
|
6905
7015
|
import { useMemo as useMemo3 } from "react";
|
|
6906
7016
|
import { useTranslation as useTranslation20 } from "react-i18next";
|
|
6907
7017
|
import { AlertCircle as AlertCircle2, CheckCircle, Loader2 as Loader24 } from "lucide-react";
|
|
6908
|
-
import { jsx as
|
|
7018
|
+
import { jsx as jsx98, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
6909
7019
|
function StatusButton({
|
|
6910
7020
|
hidden,
|
|
6911
7021
|
status,
|
|
@@ -6923,7 +7033,7 @@ function StatusButton({
|
|
|
6923
7033
|
const configMap = useMemo3(() => {
|
|
6924
7034
|
const defaultLoadingConfig = {
|
|
6925
7035
|
text: loadingText ?? `${t("saving")}...`,
|
|
6926
|
-
icon: /* @__PURE__ */
|
|
7036
|
+
icon: /* @__PURE__ */ jsx98(Loader24, { className: "h-4 w-4 animate-spin" }),
|
|
6927
7037
|
variant,
|
|
6928
7038
|
isLoading: true
|
|
6929
7039
|
};
|
|
@@ -6933,13 +7043,13 @@ function StatusButton({
|
|
|
6933
7043
|
validating: { ...defaultLoadingConfig, text: t("validating") },
|
|
6934
7044
|
error: {
|
|
6935
7045
|
text: t("error"),
|
|
6936
|
-
icon: /* @__PURE__ */
|
|
7046
|
+
icon: /* @__PURE__ */ jsx98(AlertCircle2, { className: "h-4 w-4" }),
|
|
6937
7047
|
variant: "destructive",
|
|
6938
7048
|
isLoading: false
|
|
6939
7049
|
},
|
|
6940
7050
|
success: {
|
|
6941
7051
|
text: successText ?? t("saved_exclamation"),
|
|
6942
|
-
icon: /* @__PURE__ */
|
|
7052
|
+
icon: /* @__PURE__ */ jsx98(CheckCircle, { className: "h-4 w-4" }),
|
|
6943
7053
|
variant,
|
|
6944
7054
|
isLoading: false
|
|
6945
7055
|
},
|
|
@@ -6955,7 +7065,7 @@ function StatusButton({
|
|
|
6955
7065
|
if (hidden) {
|
|
6956
7066
|
return null;
|
|
6957
7067
|
}
|
|
6958
|
-
return /* @__PURE__ */
|
|
7068
|
+
return /* @__PURE__ */ jsxs62(
|
|
6959
7069
|
Button,
|
|
6960
7070
|
{
|
|
6961
7071
|
className: cn(
|
|
@@ -6971,7 +7081,7 @@ function StatusButton({
|
|
|
6971
7081
|
...props,
|
|
6972
7082
|
children: [
|
|
6973
7083
|
config.icon,
|
|
6974
|
-
/* @__PURE__ */
|
|
7084
|
+
/* @__PURE__ */ jsx98("span", { children: config.text })
|
|
6975
7085
|
]
|
|
6976
7086
|
}
|
|
6977
7087
|
);
|
|
@@ -6979,37 +7089,37 @@ function StatusButton({
|
|
|
6979
7089
|
|
|
6980
7090
|
// src/status-box/StatusBox.tsx
|
|
6981
7091
|
import { AlertTriangleIcon, CheckIcon as CheckIcon2, XIcon as XIcon3 } from "lucide-react";
|
|
6982
|
-
import { jsx as
|
|
7092
|
+
import { jsx as jsx99, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
6983
7093
|
function StatusBox({ status, title, text }) {
|
|
6984
7094
|
if (status === "success") {
|
|
6985
|
-
return /* @__PURE__ */
|
|
6986
|
-
/* @__PURE__ */
|
|
6987
|
-
/* @__PURE__ */
|
|
6988
|
-
/* @__PURE__ */
|
|
6989
|
-
/* @__PURE__ */
|
|
7095
|
+
return /* @__PURE__ */ jsxs63("div", { className: "flex items-center gap-3 rounded-lg border border-green-100 bg-green-50 p-4", children: [
|
|
7096
|
+
/* @__PURE__ */ jsx99("div", { className: "rounded-full bg-green-100 p-1", children: /* @__PURE__ */ jsx99(CheckIcon2, { className: "h-5 w-5 text-green-600" }) }),
|
|
7097
|
+
/* @__PURE__ */ jsxs63("div", { children: [
|
|
7098
|
+
/* @__PURE__ */ jsx99("p", { className: "font-semibold text-green-800", children: title }),
|
|
7099
|
+
/* @__PURE__ */ jsx99("p", { className: "text-sm text-green-700", children: text })
|
|
6990
7100
|
] })
|
|
6991
7101
|
] });
|
|
6992
7102
|
}
|
|
6993
7103
|
if (status === "failed") {
|
|
6994
|
-
return /* @__PURE__ */
|
|
6995
|
-
/* @__PURE__ */
|
|
6996
|
-
/* @__PURE__ */
|
|
6997
|
-
/* @__PURE__ */
|
|
6998
|
-
/* @__PURE__ */
|
|
7104
|
+
return /* @__PURE__ */ jsxs63("div", { className: "flex items-center gap-3 rounded-lg border border-red-100 bg-red-50 p-4", children: [
|
|
7105
|
+
/* @__PURE__ */ jsx99("div", { className: "rounded-full bg-red-100 p-1", children: /* @__PURE__ */ jsx99(XIcon3, { className: "h-5 w-5 text-red-600" }) }),
|
|
7106
|
+
/* @__PURE__ */ jsxs63("div", { children: [
|
|
7107
|
+
/* @__PURE__ */ jsx99("p", { className: "font-semibold text-red-800", children: title }),
|
|
7108
|
+
/* @__PURE__ */ jsx99("p", { className: "text-sm text-red-700", children: text })
|
|
6999
7109
|
] })
|
|
7000
7110
|
] });
|
|
7001
7111
|
}
|
|
7002
|
-
return /* @__PURE__ */
|
|
7003
|
-
/* @__PURE__ */
|
|
7004
|
-
/* @__PURE__ */
|
|
7005
|
-
/* @__PURE__ */
|
|
7006
|
-
/* @__PURE__ */
|
|
7112
|
+
return /* @__PURE__ */ jsxs63("div", { className: "flex items-center gap-3 rounded-lg border border-amber-100 bg-amber-50 p-4", children: [
|
|
7113
|
+
/* @__PURE__ */ jsx99("div", { className: "rounded-full bg-amber-100 p-1", children: /* @__PURE__ */ jsx99(AlertTriangleIcon, { className: "h-5 w-5 text-amber-600" }) }),
|
|
7114
|
+
/* @__PURE__ */ jsxs63("div", { children: [
|
|
7115
|
+
/* @__PURE__ */ jsx99("p", { className: "font-semibold text-amber-800", children: title }),
|
|
7116
|
+
/* @__PURE__ */ jsx99("p", { className: "text-sm text-amber-700", children: text })
|
|
7007
7117
|
] })
|
|
7008
7118
|
] });
|
|
7009
7119
|
}
|
|
7010
7120
|
|
|
7011
7121
|
// src/stepper/Stepper.tsx
|
|
7012
|
-
import { jsx as
|
|
7122
|
+
import { jsx as jsx100 } from "react/jsx-runtime";
|
|
7013
7123
|
function Stepper({
|
|
7014
7124
|
totalSteps,
|
|
7015
7125
|
activeStep,
|
|
@@ -7018,7 +7128,7 @@ function Stepper({
|
|
|
7018
7128
|
}) {
|
|
7019
7129
|
if (totalSteps <= 0) return null;
|
|
7020
7130
|
const clampedActiveStep = Math.max(1, Math.min(totalSteps, activeStep));
|
|
7021
|
-
return /* @__PURE__ */
|
|
7131
|
+
return /* @__PURE__ */ jsx100(
|
|
7022
7132
|
"div",
|
|
7023
7133
|
{
|
|
7024
7134
|
className: cn("flex w-full items-center gap-2", className),
|
|
@@ -7029,7 +7139,7 @@ function Stepper({
|
|
|
7029
7139
|
children: new Array(totalSteps).fill(null).map((_, stepIndex) => {
|
|
7030
7140
|
const stepNumber = stepIndex + 1;
|
|
7031
7141
|
const isActive = cumulative ? stepNumber <= clampedActiveStep : stepNumber === clampedActiveStep;
|
|
7032
|
-
return /* @__PURE__ */
|
|
7142
|
+
return /* @__PURE__ */ jsx100(
|
|
7033
7143
|
"span",
|
|
7034
7144
|
{
|
|
7035
7145
|
className: cn(
|
|
@@ -7046,14 +7156,14 @@ function Stepper({
|
|
|
7046
7156
|
|
|
7047
7157
|
// src/switch-blocks/SwitchBlocks.tsx
|
|
7048
7158
|
import { forwardRef as forwardRef36, memo as memo6 } from "react";
|
|
7049
|
-
import { jsx as
|
|
7159
|
+
import { jsx as jsx101 } from "react/jsx-runtime";
|
|
7050
7160
|
var SwitchBlocksInternal = forwardRef36(
|
|
7051
|
-
({ options, value, onChange, disabled, className }, ref) => /* @__PURE__ */
|
|
7161
|
+
({ options, value, onChange, disabled, className }, ref) => /* @__PURE__ */ jsx101(
|
|
7052
7162
|
"div",
|
|
7053
7163
|
{
|
|
7054
7164
|
ref,
|
|
7055
7165
|
className: cn("flex flex-wrap items-center justify-start gap-4", className),
|
|
7056
|
-
children: options.map((option) => /* @__PURE__ */
|
|
7166
|
+
children: options.map((option) => /* @__PURE__ */ jsx101(
|
|
7057
7167
|
BoxOptionSelector,
|
|
7058
7168
|
{
|
|
7059
7169
|
id: option.id,
|
|
@@ -7074,9 +7184,9 @@ SwitchBlocksInternal.displayName = "SwitchBlocks";
|
|
|
7074
7184
|
var SwitchBlocks = memo6(SwitchBlocksInternal);
|
|
7075
7185
|
|
|
7076
7186
|
// src/switch-group/SwitchGroup.tsx
|
|
7077
|
-
import * as
|
|
7078
|
-
import { jsx as
|
|
7079
|
-
var SwitchGroup =
|
|
7187
|
+
import * as React25 from "react";
|
|
7188
|
+
import { jsx as jsx102, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
7189
|
+
var SwitchGroup = React25.forwardRef(
|
|
7080
7190
|
({ options, value = [], onChange, disabled = false, className, error, ...props }, ref) => {
|
|
7081
7191
|
const handleOptionChange = (optionValue, checked) => {
|
|
7082
7192
|
if (!onChange) return;
|
|
@@ -7086,9 +7196,9 @@ var SwitchGroup = React24.forwardRef(
|
|
|
7086
7196
|
}
|
|
7087
7197
|
onChange(value.filter((selectedValue) => selectedValue !== optionValue));
|
|
7088
7198
|
};
|
|
7089
|
-
return /* @__PURE__ */
|
|
7090
|
-
options.map((option) => /* @__PURE__ */
|
|
7091
|
-
/* @__PURE__ */
|
|
7199
|
+
return /* @__PURE__ */ jsxs64("div", { ref, className: cn("w-full space-y-4", className), ...props, children: [
|
|
7200
|
+
options.map((option) => /* @__PURE__ */ jsxs64("div", { className: "flex items-center justify-between gap-4", children: [
|
|
7201
|
+
/* @__PURE__ */ jsx102("div", { className: "flex flex-col", children: /* @__PURE__ */ jsxs64(
|
|
7092
7202
|
Label,
|
|
7093
7203
|
{
|
|
7094
7204
|
className: cn(
|
|
@@ -7097,7 +7207,7 @@ var SwitchGroup = React24.forwardRef(
|
|
|
7097
7207
|
),
|
|
7098
7208
|
children: [
|
|
7099
7209
|
option.label,
|
|
7100
|
-
option.description && /* @__PURE__ */
|
|
7210
|
+
option.description && /* @__PURE__ */ jsxs64(
|
|
7101
7211
|
"span",
|
|
7102
7212
|
{
|
|
7103
7213
|
className: cn(
|
|
@@ -7114,7 +7224,7 @@ var SwitchGroup = React24.forwardRef(
|
|
|
7114
7224
|
]
|
|
7115
7225
|
}
|
|
7116
7226
|
) }),
|
|
7117
|
-
/* @__PURE__ */
|
|
7227
|
+
/* @__PURE__ */ jsx102(
|
|
7118
7228
|
Switch,
|
|
7119
7229
|
{
|
|
7120
7230
|
value: value.includes(option.value),
|
|
@@ -7124,7 +7234,7 @@ var SwitchGroup = React24.forwardRef(
|
|
|
7124
7234
|
}
|
|
7125
7235
|
)
|
|
7126
7236
|
] }, option.value)),
|
|
7127
|
-
error && /* @__PURE__ */
|
|
7237
|
+
error && /* @__PURE__ */ jsx102(ErrorMessage, { disabled, children: error })
|
|
7128
7238
|
] });
|
|
7129
7239
|
}
|
|
7130
7240
|
);
|
|
@@ -7134,7 +7244,7 @@ SwitchGroup.displayName = "SwitchGroup";
|
|
|
7134
7244
|
import { forwardRef as forwardRef38 } from "react";
|
|
7135
7245
|
import * as TabsPrimitive2 from "@radix-ui/react-tabs";
|
|
7136
7246
|
import { cva as cva12 } from "class-variance-authority";
|
|
7137
|
-
import { jsx as
|
|
7247
|
+
import { jsx as jsx103 } from "react/jsx-runtime";
|
|
7138
7248
|
var Tabs = TabsPrimitive2.Root;
|
|
7139
7249
|
var tabsListVariants = cva12("inline-flex items-center", {
|
|
7140
7250
|
variants: {
|
|
@@ -7148,7 +7258,7 @@ var tabsListVariants = cva12("inline-flex items-center", {
|
|
|
7148
7258
|
}
|
|
7149
7259
|
});
|
|
7150
7260
|
var TabsList = forwardRef38(
|
|
7151
|
-
({ className, variant, ...props }, ref) => /* @__PURE__ */
|
|
7261
|
+
({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx103(
|
|
7152
7262
|
TabsPrimitive2.List,
|
|
7153
7263
|
{
|
|
7154
7264
|
ref,
|
|
@@ -7172,7 +7282,7 @@ var tabsTriggerVariants = cva12(
|
|
|
7172
7282
|
}
|
|
7173
7283
|
}
|
|
7174
7284
|
);
|
|
7175
|
-
var TabsTrigger = forwardRef38(({ className, variant, ...props }, ref) => /* @__PURE__ */
|
|
7285
|
+
var TabsTrigger = forwardRef38(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx103(
|
|
7176
7286
|
TabsPrimitive2.Trigger,
|
|
7177
7287
|
{
|
|
7178
7288
|
ref,
|
|
@@ -7181,11 +7291,11 @@ var TabsTrigger = forwardRef38(({ className, variant, ...props }, ref) => /* @__
|
|
|
7181
7291
|
}
|
|
7182
7292
|
));
|
|
7183
7293
|
TabsTrigger.displayName = TabsPrimitive2.Trigger.displayName;
|
|
7184
|
-
var TabsContent = forwardRef38(({ className, ...props }, ref) => /* @__PURE__ */
|
|
7294
|
+
var TabsContent = forwardRef38(({ className, ...props }, ref) => /* @__PURE__ */ jsx103(TabsPrimitive2.Content, { ref, className, tabIndex: -1, ...props }));
|
|
7185
7295
|
TabsContent.displayName = TabsPrimitive2.Content.displayName;
|
|
7186
7296
|
|
|
7187
7297
|
// src/tabbed-section/TabbedSection.tsx
|
|
7188
|
-
import { jsx as
|
|
7298
|
+
import { jsx as jsx104, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
7189
7299
|
function TabbedSection({
|
|
7190
7300
|
triggers,
|
|
7191
7301
|
value,
|
|
@@ -7207,8 +7317,8 @@ function TabbedSection({
|
|
|
7207
7317
|
"[&>div:first-child]:gap-chekin-3",
|
|
7208
7318
|
className
|
|
7209
7319
|
);
|
|
7210
|
-
return /* @__PURE__ */
|
|
7211
|
-
/* @__PURE__ */
|
|
7320
|
+
return /* @__PURE__ */ jsxs65(Tabs, { value: activeTab, onValueChange: onTabChange, className: "w-full", children: [
|
|
7321
|
+
/* @__PURE__ */ jsx104(
|
|
7212
7322
|
BookmarkTabsList,
|
|
7213
7323
|
{
|
|
7214
7324
|
variant,
|
|
@@ -7216,12 +7326,12 @@ function TabbedSection({
|
|
|
7216
7326
|
children: triggers
|
|
7217
7327
|
}
|
|
7218
7328
|
),
|
|
7219
|
-
/* @__PURE__ */
|
|
7329
|
+
/* @__PURE__ */ jsx104("div", { className: contentContainerClassName, children })
|
|
7220
7330
|
] });
|
|
7221
7331
|
}
|
|
7222
7332
|
|
|
7223
7333
|
// src/table-placeholder/TablePlaceholder.tsx
|
|
7224
|
-
import { jsx as
|
|
7334
|
+
import { jsx as jsx105, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
7225
7335
|
function TablePlaceholder({
|
|
7226
7336
|
children,
|
|
7227
7337
|
text,
|
|
@@ -7234,16 +7344,16 @@ function TablePlaceholder({
|
|
|
7234
7344
|
if (!visible) {
|
|
7235
7345
|
return null;
|
|
7236
7346
|
}
|
|
7237
|
-
const content = /* @__PURE__ */
|
|
7238
|
-
iconSlot && /* @__PURE__ */
|
|
7239
|
-
title && /* @__PURE__ */
|
|
7240
|
-
text && /* @__PURE__ */
|
|
7241
|
-
children && /* @__PURE__ */
|
|
7347
|
+
const content = /* @__PURE__ */ jsxs66("div", { className: "flex flex-col items-center justify-center px-4 py-14 text-center", children: [
|
|
7348
|
+
iconSlot && /* @__PURE__ */ jsx105("div", { className: "mb-6", children: iconSlot }),
|
|
7349
|
+
title && /* @__PURE__ */ jsx105("h3", { className: "mb-2 text-lg font-semibold", children: title }),
|
|
7350
|
+
text && /* @__PURE__ */ jsx105("p", { className: "text-md max-w-sm font-medium", children: text }),
|
|
7351
|
+
children && /* @__PURE__ */ jsx105("div", { className: "mt-6", children })
|
|
7242
7352
|
] });
|
|
7243
7353
|
if (insideTable) {
|
|
7244
|
-
return /* @__PURE__ */
|
|
7354
|
+
return /* @__PURE__ */ jsx105("tr", { children: /* @__PURE__ */ jsx105("td", { colSpan: 100, className, children: content }) });
|
|
7245
7355
|
}
|
|
7246
|
-
return /* @__PURE__ */
|
|
7356
|
+
return /* @__PURE__ */ jsx105("div", { className, children: content });
|
|
7247
7357
|
}
|
|
7248
7358
|
|
|
7249
7359
|
// src/task-card/TaskCard.tsx
|
|
@@ -7253,7 +7363,7 @@ import { ArrowRight } from "lucide-react";
|
|
|
7253
7363
|
var TaskCard_default = {};
|
|
7254
7364
|
|
|
7255
7365
|
// src/task-card/TaskCard.tsx
|
|
7256
|
-
import { jsx as
|
|
7366
|
+
import { jsx as jsx106, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
7257
7367
|
function TaskCard({
|
|
7258
7368
|
title,
|
|
7259
7369
|
description,
|
|
@@ -7264,7 +7374,7 @@ function TaskCard({
|
|
|
7264
7374
|
}) {
|
|
7265
7375
|
const shouldShowCount = count !== void 0 && count > 1;
|
|
7266
7376
|
const shouldShowActions = shouldShowCount || onClick;
|
|
7267
|
-
return /* @__PURE__ */
|
|
7377
|
+
return /* @__PURE__ */ jsxs67(
|
|
7268
7378
|
"div",
|
|
7269
7379
|
{
|
|
7270
7380
|
className: cn(
|
|
@@ -7277,13 +7387,13 @@ function TaskCard({
|
|
|
7277
7387
|
role: onClick ? "button" : void 0,
|
|
7278
7388
|
tabIndex: onClick ? 0 : void 0,
|
|
7279
7389
|
children: [
|
|
7280
|
-
/* @__PURE__ */
|
|
7281
|
-
/* @__PURE__ */
|
|
7282
|
-
/* @__PURE__ */
|
|
7283
|
-
/* @__PURE__ */
|
|
7390
|
+
/* @__PURE__ */ jsx106("div", { className: TaskCard_default.TaskCard__indicator }),
|
|
7391
|
+
/* @__PURE__ */ jsxs67("div", { className: TaskCard_default.TaskCard__content, children: [
|
|
7392
|
+
/* @__PURE__ */ jsx106("h4", { className: TaskCard_default.TaskCard__title, children: title }),
|
|
7393
|
+
/* @__PURE__ */ jsx106("p", { className: TaskCard_default.TaskCard__date, children: description })
|
|
7284
7394
|
] }),
|
|
7285
|
-
shouldShowActions && /* @__PURE__ */
|
|
7286
|
-
shouldShowCount && /* @__PURE__ */
|
|
7395
|
+
shouldShowActions && /* @__PURE__ */ jsxs67("div", { className: TaskCard_default.TaskCard__actions, children: [
|
|
7396
|
+
shouldShowCount && /* @__PURE__ */ jsx106(
|
|
7287
7397
|
"div",
|
|
7288
7398
|
{
|
|
7289
7399
|
className: cn(
|
|
@@ -7293,7 +7403,7 @@ function TaskCard({
|
|
|
7293
7403
|
children: count
|
|
7294
7404
|
}
|
|
7295
7405
|
),
|
|
7296
|
-
onClick && /* @__PURE__ */
|
|
7406
|
+
onClick && /* @__PURE__ */ jsx106(
|
|
7297
7407
|
"button",
|
|
7298
7408
|
{
|
|
7299
7409
|
className: TaskCard_default.TaskCard__arrowButton,
|
|
@@ -7303,7 +7413,7 @@ function TaskCard({
|
|
|
7303
7413
|
},
|
|
7304
7414
|
"aria-label": "View details",
|
|
7305
7415
|
type: "button",
|
|
7306
|
-
children: /* @__PURE__ */
|
|
7416
|
+
children: /* @__PURE__ */ jsx106(ArrowRight, { className: "h-5 w-5" })
|
|
7307
7417
|
}
|
|
7308
7418
|
)
|
|
7309
7419
|
] })
|
|
@@ -7358,7 +7468,7 @@ function useUpdateToast({ id }) {
|
|
|
7358
7468
|
}
|
|
7359
7469
|
|
|
7360
7470
|
// src/toggle-group/ToggleGroup.tsx
|
|
7361
|
-
import * as
|
|
7471
|
+
import * as React26 from "react";
|
|
7362
7472
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
7363
7473
|
|
|
7364
7474
|
// src/toggle-group/style.ts
|
|
@@ -7391,15 +7501,15 @@ var toggleVariants = cva13(
|
|
|
7391
7501
|
);
|
|
7392
7502
|
|
|
7393
7503
|
// src/toggle-group/ToggleGroup.tsx
|
|
7394
|
-
import { jsx as
|
|
7395
|
-
var ToggleGroupContext =
|
|
7504
|
+
import { jsx as jsx107, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
7505
|
+
var ToggleGroupContext = React26.createContext({
|
|
7396
7506
|
size: "default",
|
|
7397
7507
|
variant: "default",
|
|
7398
7508
|
theme: "default"
|
|
7399
7509
|
});
|
|
7400
|
-
var ToggleGroup =
|
|
7510
|
+
var ToggleGroup = React26.forwardRef(({ className, variant, size, theme, children, ...props }, ref) => {
|
|
7401
7511
|
const isTabVariant = variant === "tab";
|
|
7402
|
-
return /* @__PURE__ */
|
|
7512
|
+
return /* @__PURE__ */ jsx107(
|
|
7403
7513
|
ToggleGroupPrimitive.Root,
|
|
7404
7514
|
{
|
|
7405
7515
|
ref,
|
|
@@ -7409,16 +7519,16 @@ var ToggleGroup = React25.forwardRef(({ className, variant, size, theme, childre
|
|
|
7409
7519
|
className
|
|
7410
7520
|
),
|
|
7411
7521
|
...props,
|
|
7412
|
-
children: /* @__PURE__ */
|
|
7522
|
+
children: /* @__PURE__ */ jsx107(ToggleGroupContext.Provider, { value: { variant, size, theme }, children })
|
|
7413
7523
|
}
|
|
7414
7524
|
);
|
|
7415
7525
|
});
|
|
7416
7526
|
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
7417
|
-
var ToggleGroupItem =
|
|
7418
|
-
const context =
|
|
7527
|
+
var ToggleGroupItem = React26.forwardRef(({ className, children, variant, size, theme, ...props }, ref) => {
|
|
7528
|
+
const context = React26.useContext(ToggleGroupContext);
|
|
7419
7529
|
const resolvedVariant = context.variant || variant;
|
|
7420
7530
|
const isTabVariant = resolvedVariant === "tab";
|
|
7421
|
-
return /* @__PURE__ */
|
|
7531
|
+
return /* @__PURE__ */ jsx107(
|
|
7422
7532
|
ToggleGroupPrimitive.Item,
|
|
7423
7533
|
{
|
|
7424
7534
|
ref,
|
|
@@ -7431,9 +7541,9 @@ var ToggleGroupItem = React25.forwardRef(({ className, children, variant, size,
|
|
|
7431
7541
|
className
|
|
7432
7542
|
),
|
|
7433
7543
|
...props,
|
|
7434
|
-
children: isTabVariant ? /* @__PURE__ */
|
|
7435
|
-
/* @__PURE__ */
|
|
7436
|
-
/* @__PURE__ */
|
|
7544
|
+
children: isTabVariant ? /* @__PURE__ */ jsxs68("span", { className: "inline-grid", children: [
|
|
7545
|
+
/* @__PURE__ */ jsx107("span", { className: "invisible col-start-1 row-start-1 font-semibold", children }),
|
|
7546
|
+
/* @__PURE__ */ jsx107("span", { className: "col-start-1 row-start-1", children })
|
|
7437
7547
|
] }) : children
|
|
7438
7548
|
}
|
|
7439
7549
|
);
|
|
@@ -7442,7 +7552,7 @@ ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
|
7442
7552
|
|
|
7443
7553
|
// src/toggle-group/Toggles.tsx
|
|
7444
7554
|
import { forwardRef as forwardRef40, useEffect as useEffect12 } from "react";
|
|
7445
|
-
import { jsx as
|
|
7555
|
+
import { jsx as jsx108, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
7446
7556
|
var getValueArray2 = (value) => {
|
|
7447
7557
|
if (value) {
|
|
7448
7558
|
return Array.isArray(value) ? value : [value];
|
|
@@ -7527,14 +7637,14 @@ function TogglesInternal({
|
|
|
7527
7637
|
onValueChange: handleValueChange,
|
|
7528
7638
|
...multiple ? { type: "multiple", value: currentValue } : { type: "single", value: currentValue[0] ?? "" }
|
|
7529
7639
|
};
|
|
7530
|
-
return /* @__PURE__ */
|
|
7531
|
-
label && /* @__PURE__ */
|
|
7532
|
-
/* @__PURE__ */
|
|
7640
|
+
return /* @__PURE__ */ jsxs69("div", { ref, className, children: [
|
|
7641
|
+
label && /* @__PURE__ */ jsx108("div", { className: "mb-2", children: /* @__PURE__ */ jsx108("div", { className: "select-none text-base font-normal text-chekin-navy", children: label }) }),
|
|
7642
|
+
/* @__PURE__ */ jsx108(ToggleGroup, { className: groupClassName, ...toggleGroupProps, children: options.map((option, index) => {
|
|
7533
7643
|
const isSelected = getValueArray2(value).includes(option.value);
|
|
7534
7644
|
const isDisabled = disabled || disabledItems?.includes(option.value) || option.disabled;
|
|
7535
7645
|
const isMinSelected = getValueArray2(value).length <= minSelected;
|
|
7536
7646
|
const isItemReadOnly = readOnly || isMinSelected && isSelected;
|
|
7537
|
-
return /* @__PURE__ */
|
|
7647
|
+
return /* @__PURE__ */ jsx108(
|
|
7538
7648
|
ToggleGroupItem,
|
|
7539
7649
|
{
|
|
7540
7650
|
value: String(option.value),
|
|
@@ -7550,28 +7660,28 @@ function TogglesInternal({
|
|
|
7550
7660
|
var Toggles = forwardRef40(TogglesInternal);
|
|
7551
7661
|
|
|
7552
7662
|
// src/text-field/TextField.tsx
|
|
7553
|
-
import * as
|
|
7663
|
+
import * as React27 from "react";
|
|
7554
7664
|
import * as LabelPrimitive2 from "@radix-ui/react-label";
|
|
7555
7665
|
import { cva as cva14 } from "class-variance-authority";
|
|
7556
7666
|
import { useTranslation as useTranslation21 } from "react-i18next";
|
|
7557
7667
|
|
|
7558
7668
|
// src/text-field/EndIcon.tsx
|
|
7559
|
-
import { jsx as
|
|
7560
|
-
var EndIcon = ({ children }) => /* @__PURE__ */
|
|
7669
|
+
import { jsx as jsx109 } from "react/jsx-runtime";
|
|
7670
|
+
var EndIcon = ({ children }) => /* @__PURE__ */ jsx109("div", { className: "pointer-events-none absolute right-3.5 top-1/2 -translate-y-1/2 [&>*]:pointer-events-auto", children });
|
|
7561
7671
|
|
|
7562
7672
|
// src/text-field/FieldError.tsx
|
|
7563
|
-
import { jsx as
|
|
7564
|
-
var FieldError = ({ id, children }) => /* @__PURE__ */
|
|
7673
|
+
import { jsx as jsx110 } from "react/jsx-runtime";
|
|
7674
|
+
var FieldError = ({ id, children }) => /* @__PURE__ */ jsx110("p", { id, className: "mt-1 text-right text-xs font-medium text-chekin-red", role: "alert", children });
|
|
7565
7675
|
|
|
7566
7676
|
// src/text-field/SupportingText.tsx
|
|
7567
|
-
import { jsx as
|
|
7568
|
-
var SupportingText = ({ id, children }) => /* @__PURE__ */
|
|
7677
|
+
import { jsx as jsx111 } from "react/jsx-runtime";
|
|
7678
|
+
var SupportingText = ({ id, children }) => /* @__PURE__ */ jsx111("p", { id, className: "mt-1 text-xs italic text-chekin-gray-2", children });
|
|
7569
7679
|
|
|
7570
7680
|
// src/text-field/textField.module.css
|
|
7571
7681
|
var textField_default = {};
|
|
7572
7682
|
|
|
7573
7683
|
// src/text-field/TextField.tsx
|
|
7574
|
-
import { jsx as
|
|
7684
|
+
import { jsx as jsx112, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
7575
7685
|
var inputVariants = cva14(
|
|
7576
7686
|
[
|
|
7577
7687
|
"flex w-full border text-base font-medium leading-5 outline-none transition-colors",
|
|
@@ -7644,7 +7754,7 @@ var floatingLabelClasses = [
|
|
|
7644
7754
|
"peer-focus:to-[var(--text-field-bg-filled)]",
|
|
7645
7755
|
"peer-focus:to-50%"
|
|
7646
7756
|
];
|
|
7647
|
-
var TextField =
|
|
7757
|
+
var TextField = React27.forwardRef(
|
|
7648
7758
|
({
|
|
7649
7759
|
className,
|
|
7650
7760
|
wrapperClassName,
|
|
@@ -7663,7 +7773,7 @@ var TextField = React26.forwardRef(
|
|
|
7663
7773
|
}, ref) => {
|
|
7664
7774
|
const { t } = useTranslation21();
|
|
7665
7775
|
const hasError = Boolean(error);
|
|
7666
|
-
const autoId =
|
|
7776
|
+
const autoId = React27.useId();
|
|
7667
7777
|
const inputId = props.id || autoId;
|
|
7668
7778
|
const inputClasses = cn(
|
|
7669
7779
|
inputVariants({ variant, error: hasError, readOnly: Boolean(readOnly) }),
|
|
@@ -7675,13 +7785,13 @@ var TextField = React26.forwardRef(
|
|
|
7675
7785
|
const errorId = error ? `${inputId}-error` : void 0;
|
|
7676
7786
|
const ariaDescribedBy = errorId || descriptionId || void 0;
|
|
7677
7787
|
if (variant === "floating") {
|
|
7678
|
-
return /* @__PURE__ */
|
|
7788
|
+
return /* @__PURE__ */ jsxs70(
|
|
7679
7789
|
"div",
|
|
7680
7790
|
{
|
|
7681
7791
|
className: cn("relative flex w-full flex-col", textField_default.root, wrapperClassName),
|
|
7682
7792
|
children: [
|
|
7683
|
-
/* @__PURE__ */
|
|
7684
|
-
/* @__PURE__ */
|
|
7793
|
+
/* @__PURE__ */ jsxs70("div", { className: "relative", children: [
|
|
7794
|
+
/* @__PURE__ */ jsx112(
|
|
7685
7795
|
"input",
|
|
7686
7796
|
{
|
|
7687
7797
|
id: inputId,
|
|
@@ -7695,7 +7805,7 @@ var TextField = React26.forwardRef(
|
|
|
7695
7805
|
...props
|
|
7696
7806
|
}
|
|
7697
7807
|
),
|
|
7698
|
-
label && /* @__PURE__ */
|
|
7808
|
+
label && /* @__PURE__ */ jsx112(
|
|
7699
7809
|
LabelPrimitive2.Root,
|
|
7700
7810
|
{
|
|
7701
7811
|
htmlFor: inputId,
|
|
@@ -7709,17 +7819,17 @@ var TextField = React26.forwardRef(
|
|
|
7709
7819
|
children: label
|
|
7710
7820
|
}
|
|
7711
7821
|
),
|
|
7712
|
-
endIcon && /* @__PURE__ */
|
|
7822
|
+
endIcon && /* @__PURE__ */ jsx112(EndIcon, { children: endIcon })
|
|
7713
7823
|
] }),
|
|
7714
|
-
supportingText && !hasError && /* @__PURE__ */
|
|
7715
|
-
hasError && /* @__PURE__ */
|
|
7824
|
+
supportingText && !hasError && /* @__PURE__ */ jsx112(SupportingText, { id: descriptionId, children: supportingText }),
|
|
7825
|
+
hasError && /* @__PURE__ */ jsx112(FieldError, { id: errorId, children: error })
|
|
7716
7826
|
]
|
|
7717
7827
|
}
|
|
7718
7828
|
);
|
|
7719
7829
|
}
|
|
7720
|
-
return /* @__PURE__ */
|
|
7721
|
-
label && /* @__PURE__ */
|
|
7722
|
-
/* @__PURE__ */
|
|
7830
|
+
return /* @__PURE__ */ jsxs70("div", { className: cn("flex w-full flex-col", textField_default.root, wrapperClassName), children: [
|
|
7831
|
+
label && /* @__PURE__ */ jsxs70("div", { className: "mb-1 flex items-center gap-1", children: [
|
|
7832
|
+
/* @__PURE__ */ jsx112(
|
|
7723
7833
|
LabelPrimitive2.Root,
|
|
7724
7834
|
{
|
|
7725
7835
|
htmlFor: inputId,
|
|
@@ -7727,14 +7837,14 @@ var TextField = React26.forwardRef(
|
|
|
7727
7837
|
children: label
|
|
7728
7838
|
}
|
|
7729
7839
|
),
|
|
7730
|
-
optional && /* @__PURE__ */
|
|
7731
|
-
/* @__PURE__ */
|
|
7732
|
-
/* @__PURE__ */
|
|
7840
|
+
optional && /* @__PURE__ */ jsxs70("span", { className: "text-base leading-4", children: [
|
|
7841
|
+
/* @__PURE__ */ jsx112("span", { className: "text-chekin-navy", children: "- " }),
|
|
7842
|
+
/* @__PURE__ */ jsx112("span", { className: "italic text-chekin-gray-2", children: optionalLabel || t("optional") })
|
|
7733
7843
|
] }),
|
|
7734
7844
|
tooltip
|
|
7735
7845
|
] }),
|
|
7736
|
-
/* @__PURE__ */
|
|
7737
|
-
/* @__PURE__ */
|
|
7846
|
+
/* @__PURE__ */ jsxs70("div", { className: "relative", children: [
|
|
7847
|
+
/* @__PURE__ */ jsx112(
|
|
7738
7848
|
"input",
|
|
7739
7849
|
{
|
|
7740
7850
|
id: inputId,
|
|
@@ -7748,10 +7858,10 @@ var TextField = React26.forwardRef(
|
|
|
7748
7858
|
...props
|
|
7749
7859
|
}
|
|
7750
7860
|
),
|
|
7751
|
-
endIcon && /* @__PURE__ */
|
|
7861
|
+
endIcon && /* @__PURE__ */ jsx112(EndIcon, { children: endIcon })
|
|
7752
7862
|
] }),
|
|
7753
|
-
supportingText && !hasError && /* @__PURE__ */
|
|
7754
|
-
hasError && /* @__PURE__ */
|
|
7863
|
+
supportingText && !hasError && /* @__PURE__ */ jsx112(SupportingText, { id: descriptionId, children: supportingText }),
|
|
7864
|
+
hasError && /* @__PURE__ */ jsx112(FieldError, { id: errorId, children: error })
|
|
7755
7865
|
] });
|
|
7756
7866
|
}
|
|
7757
7867
|
);
|
|
@@ -7764,12 +7874,12 @@ import { forwardRef as forwardRef42, useId as useId8 } from "react";
|
|
|
7764
7874
|
var styles_default9 = {};
|
|
7765
7875
|
|
|
7766
7876
|
// src/textarea/Textarea.tsx
|
|
7767
|
-
import { jsx as
|
|
7877
|
+
import { jsx as jsx113, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
7768
7878
|
var Textarea = forwardRef42(
|
|
7769
7879
|
({ className, textareaClassName, label, disabled, name, invalid, ...textareaProps }, ref) => {
|
|
7770
7880
|
const inputId = useId8();
|
|
7771
|
-
return /* @__PURE__ */
|
|
7772
|
-
/* @__PURE__ */
|
|
7881
|
+
return /* @__PURE__ */ jsxs71("div", { className: cn(styles_default9.container, className), children: [
|
|
7882
|
+
/* @__PURE__ */ jsx113(
|
|
7773
7883
|
"textarea",
|
|
7774
7884
|
{
|
|
7775
7885
|
ref,
|
|
@@ -7783,7 +7893,7 @@ var Textarea = forwardRef42(
|
|
|
7783
7893
|
...textareaProps
|
|
7784
7894
|
}
|
|
7785
7895
|
),
|
|
7786
|
-
label && /* @__PURE__ */
|
|
7896
|
+
label && /* @__PURE__ */ jsx113(
|
|
7787
7897
|
"label",
|
|
7788
7898
|
{
|
|
7789
7899
|
htmlFor: inputId,
|
|
@@ -7810,16 +7920,16 @@ var LABEL_PLACEMENT = /* @__PURE__ */ ((LABEL_PLACEMENT2) => {
|
|
|
7810
7920
|
var styles_default10 = {};
|
|
7811
7921
|
|
|
7812
7922
|
// src/three-dots-loader/ThreeDotsLoader.tsx
|
|
7813
|
-
import { Fragment as Fragment9, jsx as
|
|
7923
|
+
import { Fragment as Fragment9, jsx as jsx114, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
7814
7924
|
function Dots({
|
|
7815
7925
|
height,
|
|
7816
7926
|
width,
|
|
7817
7927
|
color
|
|
7818
7928
|
}) {
|
|
7819
|
-
return /* @__PURE__ */
|
|
7820
|
-
/* @__PURE__ */
|
|
7821
|
-
/* @__PURE__ */
|
|
7822
|
-
/* @__PURE__ */
|
|
7929
|
+
return /* @__PURE__ */ jsxs72("span", { className: styles_default10.dots, style: { height, width }, "aria-hidden": "true", children: [
|
|
7930
|
+
/* @__PURE__ */ jsx114("span", { className: styles_default10.dot, style: { backgroundColor: color } }),
|
|
7931
|
+
/* @__PURE__ */ jsx114("span", { className: styles_default10.dot, style: { backgroundColor: color } }),
|
|
7932
|
+
/* @__PURE__ */ jsx114("span", { className: styles_default10.dot, style: { backgroundColor: color } })
|
|
7823
7933
|
] });
|
|
7824
7934
|
}
|
|
7825
7935
|
function ThreeDotsLoader({
|
|
@@ -7830,22 +7940,22 @@ function ThreeDotsLoader({
|
|
|
7830
7940
|
className,
|
|
7831
7941
|
labelPlacement = 0 /* right */
|
|
7832
7942
|
}) {
|
|
7833
|
-
const dots = /* @__PURE__ */
|
|
7943
|
+
const dots = /* @__PURE__ */ jsx114(Dots, { color, height, width });
|
|
7834
7944
|
if (label) {
|
|
7835
|
-
return /* @__PURE__ */
|
|
7945
|
+
return /* @__PURE__ */ jsx114("div", { className: cn(styles_default10.Loader, className), children: labelPlacement === 0 /* right */ ? /* @__PURE__ */ jsxs72(Fragment9, { children: [
|
|
7836
7946
|
dots,
|
|
7837
|
-
/* @__PURE__ */
|
|
7838
|
-
] }) : /* @__PURE__ */
|
|
7839
|
-
/* @__PURE__ */
|
|
7947
|
+
/* @__PURE__ */ jsx114("div", { children: label })
|
|
7948
|
+
] }) : /* @__PURE__ */ jsxs72(Fragment9, { children: [
|
|
7949
|
+
/* @__PURE__ */ jsx114("div", { children: label }),
|
|
7840
7950
|
dots
|
|
7841
7951
|
] }) });
|
|
7842
7952
|
}
|
|
7843
|
-
return /* @__PURE__ */
|
|
7953
|
+
return /* @__PURE__ */ jsx114("div", { className, children: dots });
|
|
7844
7954
|
}
|
|
7845
7955
|
|
|
7846
7956
|
// src/uploaded-files-list/UploadedFilesList.tsx
|
|
7847
7957
|
import { X as X7 } from "lucide-react";
|
|
7848
|
-
import { jsx as
|
|
7958
|
+
import { jsx as jsx115, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
7849
7959
|
function UploadedFilesList({
|
|
7850
7960
|
files,
|
|
7851
7961
|
onRemoveFile,
|
|
@@ -7854,20 +7964,20 @@ function UploadedFilesList({
|
|
|
7854
7964
|
if (!files.length) {
|
|
7855
7965
|
return null;
|
|
7856
7966
|
}
|
|
7857
|
-
return /* @__PURE__ */
|
|
7967
|
+
return /* @__PURE__ */ jsx115("div", { className: cn("flex flex-wrap gap-2.5", className), children: files.map((file, index) => /* @__PURE__ */ jsxs73(
|
|
7858
7968
|
"div",
|
|
7859
7969
|
{
|
|
7860
7970
|
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",
|
|
7861
7971
|
children: [
|
|
7862
|
-
/* @__PURE__ */
|
|
7863
|
-
/* @__PURE__ */
|
|
7972
|
+
/* @__PURE__ */ jsx115("span", { className: "text-nowrap text-sm font-medium leading-5 text-chekin-navy", children: file.name }),
|
|
7973
|
+
/* @__PURE__ */ jsx115(
|
|
7864
7974
|
"button",
|
|
7865
7975
|
{
|
|
7866
7976
|
type: "button",
|
|
7867
7977
|
onClick: () => onRemoveFile(file.name),
|
|
7868
7978
|
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",
|
|
7869
7979
|
"aria-label": `Remove ${file.name}`,
|
|
7870
|
-
children: /* @__PURE__ */
|
|
7980
|
+
children: /* @__PURE__ */ jsx115(X7, { className: "h-3.5 w-3.5 text-white", strokeWidth: 3 })
|
|
7871
7981
|
}
|
|
7872
7982
|
)
|
|
7873
7983
|
]
|
|
@@ -7877,9 +7987,9 @@ function UploadedFilesList({
|
|
|
7877
7987
|
}
|
|
7878
7988
|
|
|
7879
7989
|
// src/wide-button/WideButton.tsx
|
|
7880
|
-
import { jsx as
|
|
7990
|
+
import { jsx as jsx116 } from "react/jsx-runtime";
|
|
7881
7991
|
function WideButton({ className, disabled, ...props }) {
|
|
7882
|
-
return /* @__PURE__ */
|
|
7992
|
+
return /* @__PURE__ */ jsx116(
|
|
7883
7993
|
Button,
|
|
7884
7994
|
{
|
|
7885
7995
|
variant: "ghost",
|
|
@@ -7896,29 +8006,29 @@ function WideButton({ className, disabled, ...props }) {
|
|
|
7896
8006
|
}
|
|
7897
8007
|
|
|
7898
8008
|
// src/datepicker/DatePicker.tsx
|
|
7899
|
-
import * as
|
|
8009
|
+
import * as React31 from "react";
|
|
7900
8010
|
import { Calendar as Calendar2 } from "lucide-react";
|
|
7901
8011
|
|
|
7902
8012
|
// src/drawer/Drawer.tsx
|
|
7903
|
-
import * as
|
|
8013
|
+
import * as React28 from "react";
|
|
7904
8014
|
import * as DialogPrimitive2 from "@radix-ui/react-dialog";
|
|
7905
8015
|
import Draggable from "react-draggable";
|
|
7906
|
-
import { jsx as
|
|
8016
|
+
import { jsx as jsx117, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
7907
8017
|
var DRAWER_CLOSE_THRESHOLD = 72;
|
|
7908
8018
|
var DRAWER_MIN_OVERLAY_OPACITY = 0.1;
|
|
7909
8019
|
function Drawer({ ...props }) {
|
|
7910
|
-
return /* @__PURE__ */
|
|
8020
|
+
return /* @__PURE__ */ jsx117(DialogPrimitive2.Root, { "data-slot": "drawer", ...props });
|
|
7911
8021
|
}
|
|
7912
8022
|
function DrawerTrigger({ ...props }) {
|
|
7913
|
-
return /* @__PURE__ */
|
|
8023
|
+
return /* @__PURE__ */ jsx117(DialogPrimitive2.Trigger, { "data-slot": "drawer-trigger", ...props });
|
|
7914
8024
|
}
|
|
7915
8025
|
function DrawerPortal({ ...props }) {
|
|
7916
|
-
return /* @__PURE__ */
|
|
8026
|
+
return /* @__PURE__ */ jsx117(DialogPrimitive2.Portal, { "data-slot": "drawer-portal", ...props });
|
|
7917
8027
|
}
|
|
7918
8028
|
function DrawerClose({ ...props }) {
|
|
7919
|
-
return /* @__PURE__ */
|
|
8029
|
+
return /* @__PURE__ */ jsx117(DialogPrimitive2.Close, { "data-slot": "drawer-close", ...props });
|
|
7920
8030
|
}
|
|
7921
|
-
var DrawerOverlay =
|
|
8031
|
+
var DrawerOverlay = React28.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx117(
|
|
7922
8032
|
DialogPrimitive2.Overlay,
|
|
7923
8033
|
{
|
|
7924
8034
|
ref,
|
|
@@ -7932,7 +8042,7 @@ var DrawerOverlay = React27.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
7932
8042
|
));
|
|
7933
8043
|
DrawerOverlay.displayName = DialogPrimitive2.Overlay.displayName;
|
|
7934
8044
|
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";
|
|
7935
|
-
var DrawerContent =
|
|
8045
|
+
var DrawerContent = React28.forwardRef(
|
|
7936
8046
|
({
|
|
7937
8047
|
className,
|
|
7938
8048
|
children,
|
|
@@ -7944,19 +8054,19 @@ var DrawerContent = React27.forwardRef(
|
|
|
7944
8054
|
...props
|
|
7945
8055
|
}, ref) => {
|
|
7946
8056
|
const finalContainer = container || getCustomContainer() || void 0;
|
|
7947
|
-
const nodeRef =
|
|
7948
|
-
const [dragOffsetY, setDragOffsetY] =
|
|
8057
|
+
const nodeRef = React28.useRef(null);
|
|
8058
|
+
const [dragOffsetY, setDragOffsetY] = React28.useState(0);
|
|
7949
8059
|
const overlayOpacity = Math.max(
|
|
7950
8060
|
DRAWER_MIN_OVERLAY_OPACITY,
|
|
7951
8061
|
1 - dragOffsetY / (DRAWER_CLOSE_THRESHOLD * 2)
|
|
7952
8062
|
);
|
|
7953
|
-
const handleDrag =
|
|
8063
|
+
const handleDrag = React28.useCallback(
|
|
7954
8064
|
(_event, data) => {
|
|
7955
8065
|
setDragOffsetY(Math.max(0, data.y));
|
|
7956
8066
|
},
|
|
7957
8067
|
[]
|
|
7958
8068
|
);
|
|
7959
|
-
const handleStop =
|
|
8069
|
+
const handleStop = React28.useCallback(
|
|
7960
8070
|
(_event, data) => {
|
|
7961
8071
|
if (data.y > DRAWER_CLOSE_THRESHOLD) {
|
|
7962
8072
|
setDragOffsetY(0);
|
|
@@ -7967,14 +8077,14 @@ var DrawerContent = React27.forwardRef(
|
|
|
7967
8077
|
},
|
|
7968
8078
|
[onClose]
|
|
7969
8079
|
);
|
|
7970
|
-
return /* @__PURE__ */
|
|
7971
|
-
lockScroll ? /* @__PURE__ */
|
|
8080
|
+
return /* @__PURE__ */ jsxs74(DrawerPortal, { container: finalContainer, children: [
|
|
8081
|
+
lockScroll ? /* @__PURE__ */ jsx117(
|
|
7972
8082
|
DrawerOverlay,
|
|
7973
8083
|
{
|
|
7974
8084
|
style: { opacity: overlayOpacity },
|
|
7975
8085
|
onClick: closeOnOverlayClick ? onClose : void 0
|
|
7976
8086
|
}
|
|
7977
|
-
) : /* @__PURE__ */
|
|
8087
|
+
) : /* @__PURE__ */ jsx117(
|
|
7978
8088
|
"div",
|
|
7979
8089
|
{
|
|
7980
8090
|
className: cn(DrawerOverlayClasses),
|
|
@@ -7982,7 +8092,7 @@ var DrawerContent = React27.forwardRef(
|
|
|
7982
8092
|
onClick: closeOnOverlayClick ? onClose : void 0
|
|
7983
8093
|
}
|
|
7984
8094
|
),
|
|
7985
|
-
/* @__PURE__ */
|
|
8095
|
+
/* @__PURE__ */ jsx117(
|
|
7986
8096
|
DialogPrimitive2.Content,
|
|
7987
8097
|
{
|
|
7988
8098
|
asChild: true,
|
|
@@ -7998,7 +8108,7 @@ var DrawerContent = React27.forwardRef(
|
|
|
7998
8108
|
}
|
|
7999
8109
|
},
|
|
8000
8110
|
...props,
|
|
8001
|
-
children: /* @__PURE__ */
|
|
8111
|
+
children: /* @__PURE__ */ jsx117("div", { className: "fixed inset-x-0 bottom-0 top-auto z-50 outline-none", children: /* @__PURE__ */ jsx117(
|
|
8002
8112
|
Draggable,
|
|
8003
8113
|
{
|
|
8004
8114
|
axis: "y",
|
|
@@ -8008,7 +8118,7 @@ var DrawerContent = React27.forwardRef(
|
|
|
8008
8118
|
onDrag: handleDrag,
|
|
8009
8119
|
onStop: handleStop,
|
|
8010
8120
|
position: { x: 0, y: dragOffsetY },
|
|
8011
|
-
children: /* @__PURE__ */
|
|
8121
|
+
children: /* @__PURE__ */ jsxs74(
|
|
8012
8122
|
"div",
|
|
8013
8123
|
{
|
|
8014
8124
|
ref: nodeRef,
|
|
@@ -8017,15 +8127,15 @@ var DrawerContent = React27.forwardRef(
|
|
|
8017
8127
|
className
|
|
8018
8128
|
),
|
|
8019
8129
|
children: [
|
|
8020
|
-
showHandle && /* @__PURE__ */
|
|
8130
|
+
showHandle && /* @__PURE__ */ jsx117(
|
|
8021
8131
|
"div",
|
|
8022
8132
|
{
|
|
8023
8133
|
"data-drawer-handle": true,
|
|
8024
8134
|
className: "mx-auto flex h-8 w-24 cursor-grab touch-none items-center justify-center active:cursor-grabbing",
|
|
8025
|
-
children: /* @__PURE__ */
|
|
8135
|
+
children: /* @__PURE__ */ jsx117("span", { className: "block h-1.5 w-12 rounded-full bg-[#D9D7D3]" })
|
|
8026
8136
|
}
|
|
8027
8137
|
),
|
|
8028
|
-
/* @__PURE__ */
|
|
8138
|
+
/* @__PURE__ */ jsx117("div", { className: "min-h-0 flex-1 overflow-y-auto", children })
|
|
8029
8139
|
]
|
|
8030
8140
|
}
|
|
8031
8141
|
)
|
|
@@ -8037,7 +8147,7 @@ var DrawerContent = React27.forwardRef(
|
|
|
8037
8147
|
}
|
|
8038
8148
|
);
|
|
8039
8149
|
DrawerContent.displayName = DialogPrimitive2.Content.displayName;
|
|
8040
|
-
var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
8150
|
+
var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */ jsx117(
|
|
8041
8151
|
"div",
|
|
8042
8152
|
{
|
|
8043
8153
|
className: cn("flex flex-col gap-2 px-5 pt-2 text-center", className),
|
|
@@ -8045,9 +8155,9 @@ var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */ jsx116(
|
|
|
8045
8155
|
}
|
|
8046
8156
|
);
|
|
8047
8157
|
DrawerHeader.displayName = "DrawerHeader";
|
|
8048
|
-
var DrawerFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
8158
|
+
var DrawerFooter = ({ className, ...props }) => /* @__PURE__ */ jsx117("div", { className: cn("flex flex-col gap-2 p-5", className), ...props });
|
|
8049
8159
|
DrawerFooter.displayName = "DrawerFooter";
|
|
8050
|
-
var DrawerTitle =
|
|
8160
|
+
var DrawerTitle = React28.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx117(
|
|
8051
8161
|
DialogPrimitive2.Title,
|
|
8052
8162
|
{
|
|
8053
8163
|
ref,
|
|
@@ -8057,7 +8167,7 @@ var DrawerTitle = React27.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
8057
8167
|
}
|
|
8058
8168
|
));
|
|
8059
8169
|
DrawerTitle.displayName = DialogPrimitive2.Title.displayName;
|
|
8060
|
-
var DrawerDescription =
|
|
8170
|
+
var DrawerDescription = React28.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx117(
|
|
8061
8171
|
DialogPrimitive2.Description,
|
|
8062
8172
|
{
|
|
8063
8173
|
ref,
|
|
@@ -8069,7 +8179,7 @@ var DrawerDescription = React27.forwardRef(({ className, ...props }, ref) => /*
|
|
|
8069
8179
|
DrawerDescription.displayName = DialogPrimitive2.Description.displayName;
|
|
8070
8180
|
|
|
8071
8181
|
// src/datepicker/useDatePickerWheel.ts
|
|
8072
|
-
import * as
|
|
8182
|
+
import * as React29 from "react";
|
|
8073
8183
|
|
|
8074
8184
|
// src/datepicker/datePicker.utils.ts
|
|
8075
8185
|
var DISPLAY_PAD_LENGTH = 2;
|
|
@@ -8220,21 +8330,21 @@ function useDatePickerWheel({
|
|
|
8220
8330
|
minDate,
|
|
8221
8331
|
maxDate
|
|
8222
8332
|
}) {
|
|
8223
|
-
const years =
|
|
8224
|
-
const [draftDate, setDraftDate] =
|
|
8333
|
+
const years = React29.useMemo(() => getYearRange(minDate, maxDate), [maxDate, minDate]);
|
|
8334
|
+
const [draftDate, setDraftDate] = React29.useState(
|
|
8225
8335
|
() => resolveInitialDate({ value, defaultValue, minDate, maxDate })
|
|
8226
8336
|
);
|
|
8227
8337
|
const draftYear = draftDate.getFullYear();
|
|
8228
8338
|
const draftMonth = draftDate.getMonth();
|
|
8229
|
-
const [monthScrollTop, setMonthScrollTop] =
|
|
8230
|
-
const [dayScrollTop, setDayScrollTop] =
|
|
8231
|
-
const [yearScrollTop, setYearScrollTop] =
|
|
8232
|
-
const monthListRef =
|
|
8233
|
-
const dayListRef =
|
|
8234
|
-
const yearListRef =
|
|
8235
|
-
const settleTimeoutsRef =
|
|
8236
|
-
const animationFramesRef =
|
|
8237
|
-
const columnRefs =
|
|
8339
|
+
const [monthScrollTop, setMonthScrollTop] = React29.useState(0);
|
|
8340
|
+
const [dayScrollTop, setDayScrollTop] = React29.useState(0);
|
|
8341
|
+
const [yearScrollTop, setYearScrollTop] = React29.useState(0);
|
|
8342
|
+
const monthListRef = React29.useRef(null);
|
|
8343
|
+
const dayListRef = React29.useRef(null);
|
|
8344
|
+
const yearListRef = React29.useRef(null);
|
|
8345
|
+
const settleTimeoutsRef = React29.useRef({});
|
|
8346
|
+
const animationFramesRef = React29.useRef({});
|
|
8347
|
+
const columnRefs = React29.useMemo(
|
|
8238
8348
|
() => ({
|
|
8239
8349
|
month: monthListRef,
|
|
8240
8350
|
day: dayListRef,
|
|
@@ -8242,7 +8352,7 @@ function useDatePickerWheel({
|
|
|
8242
8352
|
}),
|
|
8243
8353
|
[]
|
|
8244
8354
|
);
|
|
8245
|
-
const setColumnScrollTop =
|
|
8355
|
+
const setColumnScrollTop = React29.useCallback(
|
|
8246
8356
|
(column, nextScrollTop) => {
|
|
8247
8357
|
if (column === "month") {
|
|
8248
8358
|
setMonthScrollTop(nextScrollTop);
|
|
@@ -8256,19 +8366,19 @@ function useDatePickerWheel({
|
|
|
8256
8366
|
},
|
|
8257
8367
|
[]
|
|
8258
8368
|
);
|
|
8259
|
-
const clearSettleTimeout =
|
|
8369
|
+
const clearSettleTimeout = React29.useCallback((column) => {
|
|
8260
8370
|
const timeoutId = settleTimeoutsRef.current[column];
|
|
8261
8371
|
if (timeoutId === void 0) return;
|
|
8262
8372
|
window.clearTimeout(timeoutId);
|
|
8263
8373
|
delete settleTimeoutsRef.current[column];
|
|
8264
8374
|
}, []);
|
|
8265
|
-
const clearAnimationFrame =
|
|
8375
|
+
const clearAnimationFrame = React29.useCallback((column) => {
|
|
8266
8376
|
const frameId = animationFramesRef.current[column];
|
|
8267
8377
|
if (frameId === void 0) return;
|
|
8268
8378
|
window.cancelAnimationFrame(frameId);
|
|
8269
8379
|
delete animationFramesRef.current[column];
|
|
8270
8380
|
}, []);
|
|
8271
|
-
|
|
8381
|
+
React29.useEffect(
|
|
8272
8382
|
() => () => {
|
|
8273
8383
|
["month", "day", "year"].forEach((column) => {
|
|
8274
8384
|
clearSettleTimeout(column);
|
|
@@ -8277,22 +8387,22 @@ function useDatePickerWheel({
|
|
|
8277
8387
|
},
|
|
8278
8388
|
[clearAnimationFrame, clearSettleTimeout]
|
|
8279
8389
|
);
|
|
8280
|
-
|
|
8390
|
+
React29.useEffect(() => {
|
|
8281
8391
|
if (isOpen) return;
|
|
8282
8392
|
setDraftDate(resolveInitialDate({ value, defaultValue, minDate, maxDate }));
|
|
8283
8393
|
}, [defaultValue, isOpen, maxDate, minDate, value]);
|
|
8284
|
-
const months =
|
|
8394
|
+
const months = React29.useMemo(
|
|
8285
8395
|
() => getAllowedMonths(draftYear, minDate, maxDate),
|
|
8286
8396
|
[draftYear, maxDate, minDate]
|
|
8287
8397
|
);
|
|
8288
|
-
const days =
|
|
8398
|
+
const days = React29.useMemo(
|
|
8289
8399
|
() => getAllowedDays(draftYear, draftMonth, minDate, maxDate),
|
|
8290
8400
|
[draftMonth, draftYear, maxDate, minDate]
|
|
8291
8401
|
);
|
|
8292
8402
|
const monthIndex = months.findIndex((month) => month === draftMonth);
|
|
8293
8403
|
const dayIndex = days.findIndex((day) => day === draftDate.getDate());
|
|
8294
8404
|
const yearIndex = years.findIndex((year) => year === draftYear);
|
|
8295
|
-
const syncScrollPositions =
|
|
8405
|
+
const syncScrollPositions = React29.useCallback(
|
|
8296
8406
|
(nextDate, behavior = "auto") => {
|
|
8297
8407
|
const nextMonths = getAllowedMonths(nextDate.getFullYear(), minDate, maxDate);
|
|
8298
8408
|
const nextMonthIndex = nextMonths.findIndex((month) => month === nextDate.getMonth());
|
|
@@ -8316,7 +8426,7 @@ function useDatePickerWheel({
|
|
|
8316
8426
|
},
|
|
8317
8427
|
[maxDate, minDate, years]
|
|
8318
8428
|
);
|
|
8319
|
-
|
|
8429
|
+
React29.useLayoutEffect(() => {
|
|
8320
8430
|
if (!isOpen) return;
|
|
8321
8431
|
const nextDate = resolveInitialDate({ value, defaultValue, minDate, maxDate });
|
|
8322
8432
|
setDraftDate(nextDate);
|
|
@@ -8327,7 +8437,7 @@ function useDatePickerWheel({
|
|
|
8327
8437
|
window.cancelAnimationFrame(frameId);
|
|
8328
8438
|
};
|
|
8329
8439
|
}, [defaultValue, isOpen, maxDate, minDate, syncScrollPositions, value]);
|
|
8330
|
-
const updateDraftDate =
|
|
8440
|
+
const updateDraftDate = React29.useCallback(
|
|
8331
8441
|
(column, targetIndex, behavior = "smooth") => {
|
|
8332
8442
|
const currentDate = stripTime(draftDate);
|
|
8333
8443
|
const currentYear = currentDate.getFullYear();
|
|
@@ -8372,7 +8482,7 @@ function useDatePickerWheel({
|
|
|
8372
8482
|
},
|
|
8373
8483
|
[days, draftDate, maxDate, minDate, months, syncScrollPositions, years]
|
|
8374
8484
|
);
|
|
8375
|
-
const settleColumnScroll =
|
|
8485
|
+
const settleColumnScroll = React29.useCallback(
|
|
8376
8486
|
(column) => {
|
|
8377
8487
|
const list = columnRefs[column].current;
|
|
8378
8488
|
if (!list) return;
|
|
@@ -8385,7 +8495,7 @@ function useDatePickerWheel({
|
|
|
8385
8495
|
},
|
|
8386
8496
|
[columnRefs, days.length, months.length, updateDraftDate, years.length]
|
|
8387
8497
|
);
|
|
8388
|
-
const scheduleScrollSettle =
|
|
8498
|
+
const scheduleScrollSettle = React29.useCallback(
|
|
8389
8499
|
(column) => {
|
|
8390
8500
|
clearSettleTimeout(column);
|
|
8391
8501
|
settleTimeoutsRef.current[column] = window.setTimeout(() => {
|
|
@@ -8394,7 +8504,7 @@ function useDatePickerWheel({
|
|
|
8394
8504
|
},
|
|
8395
8505
|
[clearSettleTimeout, settleColumnScroll]
|
|
8396
8506
|
);
|
|
8397
|
-
const handleColumnScroll =
|
|
8507
|
+
const handleColumnScroll = React29.useCallback(
|
|
8398
8508
|
(column) => {
|
|
8399
8509
|
const list = columnRefs[column].current;
|
|
8400
8510
|
if (!list) return;
|
|
@@ -8408,13 +8518,13 @@ function useDatePickerWheel({
|
|
|
8408
8518
|
},
|
|
8409
8519
|
[clearAnimationFrame, columnRefs, scheduleScrollSettle, setColumnScrollTop]
|
|
8410
8520
|
);
|
|
8411
|
-
const handleOptionSelect =
|
|
8521
|
+
const handleOptionSelect = React29.useCallback(
|
|
8412
8522
|
(column, targetIndex) => {
|
|
8413
8523
|
updateDraftDate(column, targetIndex, "smooth");
|
|
8414
8524
|
},
|
|
8415
8525
|
[updateDraftDate]
|
|
8416
8526
|
);
|
|
8417
|
-
const focusAdjacentColumn =
|
|
8527
|
+
const focusAdjacentColumn = React29.useCallback(
|
|
8418
8528
|
(column, direction) => {
|
|
8419
8529
|
const order = ["month", "day", "year"];
|
|
8420
8530
|
const currentIndex = order.indexOf(column);
|
|
@@ -8424,7 +8534,7 @@ function useDatePickerWheel({
|
|
|
8424
8534
|
},
|
|
8425
8535
|
[columnRefs]
|
|
8426
8536
|
);
|
|
8427
|
-
const handleColumnKeyDown =
|
|
8537
|
+
const handleColumnKeyDown = React29.useCallback(
|
|
8428
8538
|
(column, event) => {
|
|
8429
8539
|
const currentIndex = column === "month" ? monthIndex : column === "day" ? dayIndex : yearIndex;
|
|
8430
8540
|
const maxIndex = column === "month" ? months.length - 1 : column === "day" ? days.length - 1 : years.length - 1;
|
|
@@ -8490,7 +8600,7 @@ function useDatePickerWheel({
|
|
|
8490
8600
|
}
|
|
8491
8601
|
|
|
8492
8602
|
// src/datepicker/DatePickerWheelColumn.tsx
|
|
8493
|
-
import { jsx as
|
|
8603
|
+
import { jsx as jsx118, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
8494
8604
|
var spacerHeight = DATE_PICKER_OPTION_HEIGHT * DATE_PICKER_WHEEL_BUFFER_OPTIONS;
|
|
8495
8605
|
function DatePickerWheelColumn({
|
|
8496
8606
|
id,
|
|
@@ -8504,7 +8614,7 @@ function DatePickerWheelColumn({
|
|
|
8504
8614
|
onOptionSelect,
|
|
8505
8615
|
column
|
|
8506
8616
|
}) {
|
|
8507
|
-
return /* @__PURE__ */
|
|
8617
|
+
return /* @__PURE__ */ jsx118("div", { className: "relative z-10 min-w-0", children: /* @__PURE__ */ jsxs75(
|
|
8508
8618
|
"div",
|
|
8509
8619
|
{
|
|
8510
8620
|
id,
|
|
@@ -8521,14 +8631,14 @@ function DatePickerWheelColumn({
|
|
|
8521
8631
|
WebkitOverflowScrolling: "touch"
|
|
8522
8632
|
},
|
|
8523
8633
|
children: [
|
|
8524
|
-
/* @__PURE__ */
|
|
8634
|
+
/* @__PURE__ */ jsx118("div", { style: { height: `${spacerHeight}px` } }),
|
|
8525
8635
|
items.map((item, index) => {
|
|
8526
8636
|
const { style } = getWheelOptionStyles(
|
|
8527
8637
|
index,
|
|
8528
8638
|
scrollTop,
|
|
8529
8639
|
DATE_PICKER_OPTION_HEIGHT
|
|
8530
8640
|
);
|
|
8531
|
-
return /* @__PURE__ */
|
|
8641
|
+
return /* @__PURE__ */ jsx118(
|
|
8532
8642
|
"button",
|
|
8533
8643
|
{
|
|
8534
8644
|
id: `${id}-option-${index}`,
|
|
@@ -8544,14 +8654,14 @@ function DatePickerWheelColumn({
|
|
|
8544
8654
|
`${column}-${item}-${index}`
|
|
8545
8655
|
);
|
|
8546
8656
|
}),
|
|
8547
|
-
/* @__PURE__ */
|
|
8657
|
+
/* @__PURE__ */ jsx118("div", { style: { height: `${spacerHeight}px` } })
|
|
8548
8658
|
]
|
|
8549
8659
|
}
|
|
8550
8660
|
) });
|
|
8551
8661
|
}
|
|
8552
8662
|
|
|
8553
8663
|
// src/datepicker/DatePickerContent.tsx
|
|
8554
|
-
import { jsx as
|
|
8664
|
+
import { jsx as jsx119, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
8555
8665
|
function DatePickerBody({
|
|
8556
8666
|
baseId,
|
|
8557
8667
|
label,
|
|
@@ -8573,19 +8683,19 @@ function DatePickerBody({
|
|
|
8573
8683
|
onOptionSelect,
|
|
8574
8684
|
onDone
|
|
8575
8685
|
}) {
|
|
8576
|
-
return /* @__PURE__ */
|
|
8577
|
-
/* @__PURE__ */
|
|
8578
|
-
/* @__PURE__ */
|
|
8579
|
-
/* @__PURE__ */
|
|
8580
|
-
/* @__PURE__ */
|
|
8686
|
+
return /* @__PURE__ */ jsxs76("div", { className: "px-6 pb-4 pt-1 bg-white", children: [
|
|
8687
|
+
/* @__PURE__ */ jsxs76("div", { className: "relative overflow-hidden rounded-[24px]", children: [
|
|
8688
|
+
/* @__PURE__ */ jsx119("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" }),
|
|
8689
|
+
/* @__PURE__ */ jsx119("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" }),
|
|
8690
|
+
/* @__PURE__ */ jsx119(
|
|
8581
8691
|
"div",
|
|
8582
8692
|
{
|
|
8583
8693
|
"aria-hidden": true,
|
|
8584
8694
|
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]"
|
|
8585
8695
|
}
|
|
8586
8696
|
),
|
|
8587
|
-
/* @__PURE__ */
|
|
8588
|
-
/* @__PURE__ */
|
|
8697
|
+
/* @__PURE__ */ jsxs76("div", { className: "relative grid grid-cols-[1.35fr_0.7fr_1fr] gap-1", children: [
|
|
8698
|
+
/* @__PURE__ */ jsx119(
|
|
8589
8699
|
DatePickerWheelColumn,
|
|
8590
8700
|
{
|
|
8591
8701
|
id: `${baseId}-month`,
|
|
@@ -8600,7 +8710,7 @@ function DatePickerBody({
|
|
|
8600
8710
|
onOptionSelect
|
|
8601
8711
|
}
|
|
8602
8712
|
),
|
|
8603
|
-
/* @__PURE__ */
|
|
8713
|
+
/* @__PURE__ */ jsx119(
|
|
8604
8714
|
DatePickerWheelColumn,
|
|
8605
8715
|
{
|
|
8606
8716
|
id: `${baseId}-day`,
|
|
@@ -8615,7 +8725,7 @@ function DatePickerBody({
|
|
|
8615
8725
|
onOptionSelect
|
|
8616
8726
|
}
|
|
8617
8727
|
),
|
|
8618
|
-
/* @__PURE__ */
|
|
8728
|
+
/* @__PURE__ */ jsx119(
|
|
8619
8729
|
DatePickerWheelColumn,
|
|
8620
8730
|
{
|
|
8621
8731
|
id: `${baseId}-year`,
|
|
@@ -8632,7 +8742,7 @@ function DatePickerBody({
|
|
|
8632
8742
|
)
|
|
8633
8743
|
] })
|
|
8634
8744
|
] }),
|
|
8635
|
-
/* @__PURE__ */
|
|
8745
|
+
/* @__PURE__ */ jsx119(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
8636
8746
|
] });
|
|
8637
8747
|
}
|
|
8638
8748
|
function DatePickerContent({
|
|
@@ -8660,7 +8770,7 @@ function DatePickerContent({
|
|
|
8660
8770
|
onColumnKeyDown,
|
|
8661
8771
|
onOptionSelect
|
|
8662
8772
|
}) {
|
|
8663
|
-
const body = /* @__PURE__ */
|
|
8773
|
+
const body = /* @__PURE__ */ jsx119(
|
|
8664
8774
|
DatePickerBody,
|
|
8665
8775
|
{
|
|
8666
8776
|
baseId,
|
|
@@ -8685,27 +8795,27 @@ function DatePickerContent({
|
|
|
8685
8795
|
}
|
|
8686
8796
|
);
|
|
8687
8797
|
if (isMobile) {
|
|
8688
|
-
return /* @__PURE__ */
|
|
8798
|
+
return /* @__PURE__ */ jsx119(Drawer, { open, onOpenChange, children: /* @__PURE__ */ jsxs76(
|
|
8689
8799
|
DrawerContent,
|
|
8690
8800
|
{
|
|
8691
8801
|
onClose: () => onOpenChange(false),
|
|
8692
8802
|
className: "rounded-none rounded-t-[32px] border-0 p-0",
|
|
8693
8803
|
children: [
|
|
8694
|
-
/* @__PURE__ */
|
|
8695
|
-
/* @__PURE__ */
|
|
8804
|
+
/* @__PURE__ */ jsx119(DrawerTitle, { className: "sr-only", children: title }),
|
|
8805
|
+
/* @__PURE__ */ jsx119(DrawerDescription, { className: "sr-only", children: label }),
|
|
8696
8806
|
body
|
|
8697
8807
|
]
|
|
8698
8808
|
}
|
|
8699
8809
|
) });
|
|
8700
8810
|
}
|
|
8701
|
-
return /* @__PURE__ */
|
|
8811
|
+
return /* @__PURE__ */ jsx119(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs76(
|
|
8702
8812
|
DialogContent,
|
|
8703
8813
|
{
|
|
8704
8814
|
className: "max-w-[520px] rounded-[28px] border-0 p-0 shadow-xl",
|
|
8705
8815
|
showCloseButton: false,
|
|
8706
8816
|
children: [
|
|
8707
|
-
/* @__PURE__ */
|
|
8708
|
-
/* @__PURE__ */
|
|
8817
|
+
/* @__PURE__ */ jsx119(DialogTitle, { className: "sr-only", children: title }),
|
|
8818
|
+
/* @__PURE__ */ jsx119(DialogDescription, { className: "sr-only", children: label }),
|
|
8709
8819
|
body
|
|
8710
8820
|
]
|
|
8711
8821
|
}
|
|
@@ -8750,13 +8860,13 @@ var DEVICE = {
|
|
|
8750
8860
|
};
|
|
8751
8861
|
|
|
8752
8862
|
// src/field-trigger/FieldTrigger.tsx
|
|
8753
|
-
import * as
|
|
8863
|
+
import * as React30 from "react";
|
|
8754
8864
|
import { Loader2 as Loader25 } from "lucide-react";
|
|
8755
8865
|
import { useTranslation as useTranslation22 } from "react-i18next";
|
|
8756
8866
|
|
|
8757
8867
|
// src/field-error-message/FieldErrorMessage.tsx
|
|
8758
8868
|
import { AlertCircle as AlertCircle3 } from "lucide-react";
|
|
8759
|
-
import { jsx as
|
|
8869
|
+
import { jsx as jsx120, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
8760
8870
|
function FieldErrorMessage({
|
|
8761
8871
|
id,
|
|
8762
8872
|
message,
|
|
@@ -8767,7 +8877,7 @@ function FieldErrorMessage({
|
|
|
8767
8877
|
}) {
|
|
8768
8878
|
const content = message ?? children;
|
|
8769
8879
|
if (!content) return null;
|
|
8770
|
-
return /* @__PURE__ */
|
|
8880
|
+
return /* @__PURE__ */ jsxs77(
|
|
8771
8881
|
"p",
|
|
8772
8882
|
{
|
|
8773
8883
|
id,
|
|
@@ -8779,22 +8889,22 @@ function FieldErrorMessage({
|
|
|
8779
8889
|
),
|
|
8780
8890
|
...props,
|
|
8781
8891
|
children: [
|
|
8782
|
-
/* @__PURE__ */
|
|
8892
|
+
/* @__PURE__ */ jsx120(
|
|
8783
8893
|
AlertCircle3,
|
|
8784
8894
|
{
|
|
8785
8895
|
className: "h-[18px] w-[18px] shrink-0 text-white",
|
|
8786
8896
|
fill: "var(--status-danger)"
|
|
8787
8897
|
}
|
|
8788
8898
|
),
|
|
8789
|
-
/* @__PURE__ */
|
|
8899
|
+
/* @__PURE__ */ jsx120("span", { children: content })
|
|
8790
8900
|
]
|
|
8791
8901
|
}
|
|
8792
8902
|
);
|
|
8793
8903
|
}
|
|
8794
8904
|
|
|
8795
8905
|
// src/field-trigger/FieldTrigger.tsx
|
|
8796
|
-
import { Fragment as Fragment10, jsx as
|
|
8797
|
-
var FieldTrigger =
|
|
8906
|
+
import { Fragment as Fragment10, jsx as jsx121, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
8907
|
+
var FieldTrigger = React30.forwardRef(
|
|
8798
8908
|
({
|
|
8799
8909
|
as = "button",
|
|
8800
8910
|
variant = "airbnb",
|
|
@@ -8831,14 +8941,14 @@ var FieldTrigger = React29.forwardRef(
|
|
|
8831
8941
|
const optionalLabel = optional ? typeof optional === "string" ? optional : t("optional") : void 0;
|
|
8832
8942
|
const visibleLabelText = labelText ?? label;
|
|
8833
8943
|
const hasLabelMeta = Boolean(optionalLabel) || Boolean(tooltip);
|
|
8834
|
-
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */
|
|
8835
|
-
/* @__PURE__ */
|
|
8836
|
-
optionalLabel && /* @__PURE__ */
|
|
8944
|
+
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */ jsxs78("span", { className: "inline-flex max-w-full items-center gap-1.5 align-middle", children: [
|
|
8945
|
+
/* @__PURE__ */ jsx121("span", { className: "min-w-0 truncate", children: visibleLabelText }),
|
|
8946
|
+
optionalLabel && /* @__PURE__ */ jsxs78("span", { className: "shrink-0 text-[12px] relative top-[1px] font-normal leading-4 text-current opacity-70", children: [
|
|
8837
8947
|
"(",
|
|
8838
8948
|
optionalLabel,
|
|
8839
8949
|
")"
|
|
8840
8950
|
] }),
|
|
8841
|
-
tooltip && /* @__PURE__ */
|
|
8951
|
+
tooltip && /* @__PURE__ */ jsx121(
|
|
8842
8952
|
HelpTooltip,
|
|
8843
8953
|
{
|
|
8844
8954
|
content: tooltip,
|
|
@@ -8854,9 +8964,9 @@ var FieldTrigger = React29.forwardRef(
|
|
|
8854
8964
|
const hasInvalidState = Boolean(error);
|
|
8855
8965
|
const errorMessage = typeof error === "string" ? error : void 0;
|
|
8856
8966
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
8857
|
-
const resolvedTrailingAdornment = loading || trailingAdornment ? /* @__PURE__ */
|
|
8967
|
+
const resolvedTrailingAdornment = loading || trailingAdornment ? /* @__PURE__ */ jsxs78("span", { className: "flex items-center gap-2", children: [
|
|
8858
8968
|
trailingAdornment,
|
|
8859
|
-
loading && /* @__PURE__ */
|
|
8969
|
+
loading && /* @__PURE__ */ jsx121(Loader25, { "aria-hidden": "true", className: "h-5 w-5 animate-spin text-[#7A8399]" })
|
|
8860
8970
|
] }) : void 0;
|
|
8861
8971
|
const sharedClasses = cn(
|
|
8862
8972
|
"relative flex border w-full items-center bg-[var(--form-background-color,#fff)] text-left transition-colors focus-visible:outline-none",
|
|
@@ -8866,8 +8976,8 @@ var FieldTrigger = React29.forwardRef(
|
|
|
8866
8976
|
disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : isAirbnbVariant ? "cursor-pointer" : "cursor-text",
|
|
8867
8977
|
className
|
|
8868
8978
|
);
|
|
8869
|
-
const sharedContent = /* @__PURE__ */
|
|
8870
|
-
/* @__PURE__ */
|
|
8979
|
+
const sharedContent = /* @__PURE__ */ jsxs78(Fragment10, { children: [
|
|
8980
|
+
/* @__PURE__ */ jsxs78(
|
|
8871
8981
|
"span",
|
|
8872
8982
|
{
|
|
8873
8983
|
className: cn(
|
|
@@ -8876,7 +8986,7 @@ var FieldTrigger = React29.forwardRef(
|
|
|
8876
8986
|
contentClassName
|
|
8877
8987
|
),
|
|
8878
8988
|
children: [
|
|
8879
|
-
/* @__PURE__ */
|
|
8989
|
+
/* @__PURE__ */ jsx121(
|
|
8880
8990
|
"span",
|
|
8881
8991
|
{
|
|
8882
8992
|
id: labelId,
|
|
@@ -8889,7 +8999,7 @@ var FieldTrigger = React29.forwardRef(
|
|
|
8889
8999
|
children: animatedLabel
|
|
8890
9000
|
}
|
|
8891
9001
|
),
|
|
8892
|
-
children ? children : hasValue ? /* @__PURE__ */
|
|
9002
|
+
children ? children : hasValue ? /* @__PURE__ */ jsx121(
|
|
8893
9003
|
"span",
|
|
8894
9004
|
{
|
|
8895
9005
|
id: valueId,
|
|
@@ -8900,11 +9010,11 @@ var FieldTrigger = React29.forwardRef(
|
|
|
8900
9010
|
),
|
|
8901
9011
|
children: valueText
|
|
8902
9012
|
}
|
|
8903
|
-
) : /* @__PURE__ */
|
|
9013
|
+
) : /* @__PURE__ */ jsx121("span", { id: helperTextId, className: "sr-only", children: placeholder ?? label })
|
|
8904
9014
|
]
|
|
8905
9015
|
}
|
|
8906
9016
|
),
|
|
8907
|
-
resolvedTrailingAdornment && /* @__PURE__ */
|
|
9017
|
+
resolvedTrailingAdornment && /* @__PURE__ */ jsx121(
|
|
8908
9018
|
"span",
|
|
8909
9019
|
{
|
|
8910
9020
|
"aria-hidden": "true",
|
|
@@ -8916,9 +9026,9 @@ var FieldTrigger = React29.forwardRef(
|
|
|
8916
9026
|
}
|
|
8917
9027
|
)
|
|
8918
9028
|
] });
|
|
8919
|
-
return /* @__PURE__ */
|
|
8920
|
-
topLabel && /* @__PURE__ */
|
|
8921
|
-
as === "button" ? /* @__PURE__ */
|
|
9029
|
+
return /* @__PURE__ */ jsxs78("div", { className: "w-full", children: [
|
|
9030
|
+
topLabel && /* @__PURE__ */ jsx121("p", { className: "mb-[var(--form-label-input-gap,12px)] text-[16px] font-semibold leading-5 text-[var(--form-section-title-color,#222222)]", children: topLabel }),
|
|
9031
|
+
as === "button" ? /* @__PURE__ */ jsx121(
|
|
8922
9032
|
"button",
|
|
8923
9033
|
{
|
|
8924
9034
|
id,
|
|
@@ -8935,7 +9045,7 @@ var FieldTrigger = React29.forwardRef(
|
|
|
8935
9045
|
...props,
|
|
8936
9046
|
children: sharedContent
|
|
8937
9047
|
}
|
|
8938
|
-
) : /* @__PURE__ */
|
|
9048
|
+
) : /* @__PURE__ */ jsx121(
|
|
8939
9049
|
"div",
|
|
8940
9050
|
{
|
|
8941
9051
|
id,
|
|
@@ -8952,16 +9062,16 @@ var FieldTrigger = React29.forwardRef(
|
|
|
8952
9062
|
children: sharedContent
|
|
8953
9063
|
}
|
|
8954
9064
|
),
|
|
8955
|
-
errorMessage && !hideErrorMessage && /* @__PURE__ */
|
|
9065
|
+
errorMessage && !hideErrorMessage && /* @__PURE__ */ jsx121(FieldErrorMessage, { id: errorId, message: errorMessage })
|
|
8956
9066
|
] });
|
|
8957
9067
|
}
|
|
8958
9068
|
);
|
|
8959
9069
|
FieldTrigger.displayName = "FieldTrigger";
|
|
8960
9070
|
|
|
8961
9071
|
// src/datepicker/DatePicker.tsx
|
|
8962
|
-
import { jsx as
|
|
9072
|
+
import { jsx as jsx122, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
8963
9073
|
var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
|
|
8964
|
-
var DatePicker =
|
|
9074
|
+
var DatePicker = React31.forwardRef(
|
|
8965
9075
|
({
|
|
8966
9076
|
variant = "default",
|
|
8967
9077
|
label,
|
|
@@ -8987,24 +9097,24 @@ var DatePicker = React30.forwardRef(
|
|
|
8987
9097
|
formatValue = formatDateValue
|
|
8988
9098
|
}, ref) => {
|
|
8989
9099
|
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
8990
|
-
const [isOpen, setIsOpen] =
|
|
8991
|
-
const triggerId =
|
|
8992
|
-
const pickerId =
|
|
8993
|
-
const labelId =
|
|
8994
|
-
const valueId =
|
|
8995
|
-
const helperTextId =
|
|
8996
|
-
const errorId =
|
|
8997
|
-
const internalRef =
|
|
9100
|
+
const [isOpen, setIsOpen] = React31.useState(false);
|
|
9101
|
+
const triggerId = React31.useId();
|
|
9102
|
+
const pickerId = React31.useId();
|
|
9103
|
+
const labelId = React31.useId();
|
|
9104
|
+
const valueId = React31.useId();
|
|
9105
|
+
const helperTextId = React31.useId();
|
|
9106
|
+
const errorId = React31.useId();
|
|
9107
|
+
const internalRef = React31.useRef(null);
|
|
8998
9108
|
const combinedRef = useCombinedRef(ref, internalRef);
|
|
8999
|
-
const monthLabels =
|
|
9000
|
-
const resolvedMinDate =
|
|
9001
|
-
const resolvedMaxDate =
|
|
9002
|
-
const normalizedValue =
|
|
9003
|
-
const normalizedDefaultValue =
|
|
9109
|
+
const monthLabels = React31.useMemo(() => getMonthLabels(locale), [locale]);
|
|
9110
|
+
const resolvedMinDate = React31.useMemo(() => minDate ?? DEFAULT_MIN_DATE, [minDate]);
|
|
9111
|
+
const resolvedMaxDate = React31.useMemo(() => maxDate ?? /* @__PURE__ */ new Date(), [maxDate]);
|
|
9112
|
+
const normalizedValue = React31.useMemo(() => normalizeDateValue(value), [value]);
|
|
9113
|
+
const normalizedDefaultValue = React31.useMemo(
|
|
9004
9114
|
() => normalizeDateValue(defaultValue),
|
|
9005
9115
|
[defaultValue]
|
|
9006
9116
|
);
|
|
9007
|
-
const resolvedValue =
|
|
9117
|
+
const resolvedValue = React31.useMemo(
|
|
9008
9118
|
() => normalizedValue ? clampDate(normalizedValue, resolvedMinDate, resolvedMaxDate) : null,
|
|
9009
9119
|
[normalizedValue, resolvedMaxDate, resolvedMinDate]
|
|
9010
9120
|
);
|
|
@@ -9035,7 +9145,7 @@ var DatePicker = React30.forwardRef(
|
|
|
9035
9145
|
minDate: resolvedMinDate,
|
|
9036
9146
|
maxDate: resolvedMaxDate
|
|
9037
9147
|
});
|
|
9038
|
-
const handleOpenChange =
|
|
9148
|
+
const handleOpenChange = React31.useCallback(
|
|
9039
9149
|
(nextOpen) => {
|
|
9040
9150
|
if (isBlocked && nextOpen) return;
|
|
9041
9151
|
setIsOpen(nextOpen);
|
|
@@ -9045,7 +9155,7 @@ var DatePicker = React30.forwardRef(
|
|
|
9045
9155
|
},
|
|
9046
9156
|
[isBlocked]
|
|
9047
9157
|
);
|
|
9048
|
-
const handleDone =
|
|
9158
|
+
const handleDone = React31.useCallback(() => {
|
|
9049
9159
|
if (isBlocked) return;
|
|
9050
9160
|
onChange(clampDate(draftDate, resolvedMinDate, resolvedMaxDate));
|
|
9051
9161
|
handleOpenChange(false);
|
|
@@ -9057,11 +9167,11 @@ var DatePicker = React30.forwardRef(
|
|
|
9057
9167
|
resolvedMaxDate,
|
|
9058
9168
|
resolvedMinDate
|
|
9059
9169
|
]);
|
|
9060
|
-
const handleTriggerClick =
|
|
9170
|
+
const handleTriggerClick = React31.useCallback(() => {
|
|
9061
9171
|
if (isBlocked) return;
|
|
9062
9172
|
setIsOpen(true);
|
|
9063
9173
|
}, [isBlocked]);
|
|
9064
|
-
const handleTriggerKeyDown =
|
|
9174
|
+
const handleTriggerKeyDown = React31.useCallback(
|
|
9065
9175
|
(event) => {
|
|
9066
9176
|
if (isBlocked) return;
|
|
9067
9177
|
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
@@ -9071,13 +9181,13 @@ var DatePicker = React30.forwardRef(
|
|
|
9071
9181
|
},
|
|
9072
9182
|
[isBlocked]
|
|
9073
9183
|
);
|
|
9074
|
-
|
|
9184
|
+
React31.useEffect(() => {
|
|
9075
9185
|
if (isBlocked) {
|
|
9076
9186
|
setIsOpen(false);
|
|
9077
9187
|
}
|
|
9078
9188
|
}, [isBlocked]);
|
|
9079
|
-
return /* @__PURE__ */
|
|
9080
|
-
name && /* @__PURE__ */
|
|
9189
|
+
return /* @__PURE__ */ jsxs79("div", { className: cn("relative w-full max-w-[var(--max-field-width)]", className), children: [
|
|
9190
|
+
name && /* @__PURE__ */ jsx122(
|
|
9081
9191
|
"input",
|
|
9082
9192
|
{
|
|
9083
9193
|
type: "hidden",
|
|
@@ -9085,7 +9195,7 @@ var DatePicker = React30.forwardRef(
|
|
|
9085
9195
|
value: resolvedValue ? formatDateInputValue(resolvedValue) : ""
|
|
9086
9196
|
}
|
|
9087
9197
|
),
|
|
9088
|
-
/* @__PURE__ */
|
|
9198
|
+
/* @__PURE__ */ jsx122(
|
|
9089
9199
|
FieldTrigger,
|
|
9090
9200
|
{
|
|
9091
9201
|
id: triggerId,
|
|
@@ -9112,10 +9222,10 @@ var DatePicker = React30.forwardRef(
|
|
|
9112
9222
|
onClick: handleTriggerClick,
|
|
9113
9223
|
onKeyDown: handleTriggerKeyDown,
|
|
9114
9224
|
onBlur,
|
|
9115
|
-
trailingAdornment: /* @__PURE__ */
|
|
9225
|
+
trailingAdornment: /* @__PURE__ */ jsx122(Calendar2, { className: "h-5 w-5 text-[#1F1F1B]", strokeWidth: 2 })
|
|
9116
9226
|
}
|
|
9117
9227
|
),
|
|
9118
|
-
/* @__PURE__ */
|
|
9228
|
+
/* @__PURE__ */ jsx122(
|
|
9119
9229
|
DatePickerContent,
|
|
9120
9230
|
{
|
|
9121
9231
|
baseId: pickerId,
|
|
@@ -9149,7 +9259,7 @@ var DatePicker = React30.forwardRef(
|
|
|
9149
9259
|
DatePicker.displayName = "DatePicker";
|
|
9150
9260
|
|
|
9151
9261
|
// src/responsive-sheet/ResponsiveSheet.tsx
|
|
9152
|
-
import { jsx as
|
|
9262
|
+
import { jsx as jsx123, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
9153
9263
|
function ResponsiveSheet({
|
|
9154
9264
|
open,
|
|
9155
9265
|
onClose,
|
|
@@ -9184,7 +9294,7 @@ function ResponsiveSheet({
|
|
|
9184
9294
|
event.preventDefault();
|
|
9185
9295
|
}
|
|
9186
9296
|
};
|
|
9187
|
-
const content = /* @__PURE__ */
|
|
9297
|
+
const content = /* @__PURE__ */ jsxs80(
|
|
9188
9298
|
"div",
|
|
9189
9299
|
{
|
|
9190
9300
|
className: cn(
|
|
@@ -9192,7 +9302,7 @@ function ResponsiveSheet({
|
|
|
9192
9302
|
contentClassName
|
|
9193
9303
|
),
|
|
9194
9304
|
children: [
|
|
9195
|
-
title ? /* @__PURE__ */
|
|
9305
|
+
title ? /* @__PURE__ */ jsx123(
|
|
9196
9306
|
"div",
|
|
9197
9307
|
{
|
|
9198
9308
|
className: cn(
|
|
@@ -9202,7 +9312,7 @@ function ResponsiveSheet({
|
|
|
9202
9312
|
children: title
|
|
9203
9313
|
}
|
|
9204
9314
|
) : null,
|
|
9205
|
-
description ? /* @__PURE__ */
|
|
9315
|
+
description ? /* @__PURE__ */ jsx123(
|
|
9206
9316
|
"p",
|
|
9207
9317
|
{
|
|
9208
9318
|
className: cn(
|
|
@@ -9217,7 +9327,7 @@ function ResponsiveSheet({
|
|
|
9217
9327
|
}
|
|
9218
9328
|
);
|
|
9219
9329
|
if (isMobileMode) {
|
|
9220
|
-
return /* @__PURE__ */
|
|
9330
|
+
return /* @__PURE__ */ jsx123(Drawer, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs80(
|
|
9221
9331
|
DrawerContent,
|
|
9222
9332
|
{
|
|
9223
9333
|
onClose,
|
|
@@ -9227,14 +9337,14 @@ function ResponsiveSheet({
|
|
|
9227
9337
|
onEscapeKeyDown: handleEscapeKeyDown,
|
|
9228
9338
|
className: cn(className, drawerClassName),
|
|
9229
9339
|
children: [
|
|
9230
|
-
title ? /* @__PURE__ */
|
|
9231
|
-
description ? /* @__PURE__ */
|
|
9340
|
+
title ? /* @__PURE__ */ jsx123(DrawerTitle, { className: "sr-only", children: title }) : null,
|
|
9341
|
+
description ? /* @__PURE__ */ jsx123(DrawerDescription, { className: "sr-only", children: description }) : null,
|
|
9232
9342
|
content
|
|
9233
9343
|
]
|
|
9234
9344
|
}
|
|
9235
9345
|
) });
|
|
9236
9346
|
}
|
|
9237
|
-
return /* @__PURE__ */
|
|
9347
|
+
return /* @__PURE__ */ jsx123(Dialog, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs80(
|
|
9238
9348
|
DialogContent,
|
|
9239
9349
|
{
|
|
9240
9350
|
showCloseButton,
|
|
@@ -9244,8 +9354,8 @@ function ResponsiveSheet({
|
|
|
9244
9354
|
className: cn("max-w-[560px] border-0 p-0 shadow-xl", className, dialogClassName),
|
|
9245
9355
|
lockScroll: false,
|
|
9246
9356
|
children: [
|
|
9247
|
-
title ? /* @__PURE__ */
|
|
9248
|
-
description ? /* @__PURE__ */
|
|
9357
|
+
title ? /* @__PURE__ */ jsx123(DialogTitle, { className: "sr-only", children: title }) : null,
|
|
9358
|
+
description ? /* @__PURE__ */ jsx123(DialogDescription, { className: "sr-only", children: description }) : null,
|
|
9249
9359
|
content
|
|
9250
9360
|
]
|
|
9251
9361
|
}
|
|
@@ -9253,10 +9363,10 @@ function ResponsiveSheet({
|
|
|
9253
9363
|
}
|
|
9254
9364
|
|
|
9255
9365
|
// src/airbnb/input/Input.tsx
|
|
9256
|
-
import * as
|
|
9257
|
-
import { jsx as
|
|
9366
|
+
import * as React32 from "react";
|
|
9367
|
+
import { jsx as jsx124 } from "react/jsx-runtime";
|
|
9258
9368
|
var getInputValue = (value) => value != null ? String(value) : "";
|
|
9259
|
-
var AirbnbInput =
|
|
9369
|
+
var AirbnbInput = React32.forwardRef(
|
|
9260
9370
|
({
|
|
9261
9371
|
variant = "default",
|
|
9262
9372
|
label,
|
|
@@ -9285,15 +9395,15 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9285
9395
|
placeholder,
|
|
9286
9396
|
...props
|
|
9287
9397
|
}, ref) => {
|
|
9288
|
-
const generatedId =
|
|
9289
|
-
const inputRef =
|
|
9398
|
+
const generatedId = React32.useId();
|
|
9399
|
+
const inputRef = React32.useRef(null);
|
|
9290
9400
|
const inputId = id ?? generatedId;
|
|
9291
9401
|
const fieldId = `${inputId}-field`;
|
|
9292
9402
|
const labelId = `${inputId}-label`;
|
|
9293
9403
|
const errorId = `${inputId}-error`;
|
|
9294
9404
|
const accessibleLabel = placeholder ?? label;
|
|
9295
|
-
const [isFocused, setIsFocused] =
|
|
9296
|
-
const [currentValue, setCurrentValue] =
|
|
9405
|
+
const [isFocused, setIsFocused] = React32.useState(false);
|
|
9406
|
+
const [currentValue, setCurrentValue] = React32.useState(
|
|
9297
9407
|
() => value != null ? getInputValue(value) : getInputValue(defaultValue)
|
|
9298
9408
|
);
|
|
9299
9409
|
const resolvedValue = value != null ? getInputValue(value) : currentValue;
|
|
@@ -9303,11 +9413,11 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9303
9413
|
const triggerError = error ?? invalid;
|
|
9304
9414
|
const hasLabelMeta = Boolean(optional) || Boolean(tooltip);
|
|
9305
9415
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
9306
|
-
|
|
9416
|
+
React32.useLayoutEffect(() => {
|
|
9307
9417
|
const nextValue = value != null ? getInputValue(value) : getInputValue(inputRef.current?.value);
|
|
9308
9418
|
setCurrentValue((prevValue) => prevValue === nextValue ? prevValue : nextValue);
|
|
9309
9419
|
}, [value]);
|
|
9310
|
-
const setRefs =
|
|
9420
|
+
const setRefs = React32.useCallback(
|
|
9311
9421
|
(node) => {
|
|
9312
9422
|
inputRef.current = node;
|
|
9313
9423
|
if (node && value == null) {
|
|
@@ -9337,7 +9447,7 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9337
9447
|
setIsFocused(false);
|
|
9338
9448
|
onBlur?.(event);
|
|
9339
9449
|
};
|
|
9340
|
-
return /* @__PURE__ */
|
|
9450
|
+
return /* @__PURE__ */ jsx124("div", { className: cn("w-full max-w-[var(--max-field-width)]", wrapperClassName), children: /* @__PURE__ */ jsx124(
|
|
9341
9451
|
FieldTrigger,
|
|
9342
9452
|
{
|
|
9343
9453
|
as: "div",
|
|
@@ -9369,7 +9479,7 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9369
9479
|
forceFloatingLabel: shouldShowLabel,
|
|
9370
9480
|
forceLabelText: hasLabelMeta,
|
|
9371
9481
|
hideErrorMessage: !renderErrorMessage,
|
|
9372
|
-
children: /* @__PURE__ */
|
|
9482
|
+
children: /* @__PURE__ */ jsx124(
|
|
9373
9483
|
"input",
|
|
9374
9484
|
{
|
|
9375
9485
|
...props,
|
|
@@ -9405,14 +9515,14 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9405
9515
|
AirbnbInput.displayName = "Input";
|
|
9406
9516
|
|
|
9407
9517
|
// src/airbnb/phone-field/PhoneField.tsx
|
|
9408
|
-
import * as
|
|
9518
|
+
import * as React38 from "react";
|
|
9409
9519
|
import { ChevronDown as ChevronDown2 } from "lucide-react";
|
|
9410
9520
|
|
|
9411
9521
|
// src/airbnb/select/Select.tsx
|
|
9412
|
-
import * as
|
|
9522
|
+
import * as React37 from "react";
|
|
9413
9523
|
|
|
9414
9524
|
// src/airbnb/select/SelectDesktopMenu.tsx
|
|
9415
|
-
import { jsx as
|
|
9525
|
+
import { jsx as jsx125, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
9416
9526
|
function SelectDesktopMenu({
|
|
9417
9527
|
id,
|
|
9418
9528
|
options,
|
|
@@ -9431,7 +9541,7 @@ function SelectDesktopMenu({
|
|
|
9431
9541
|
noOptionsMessage
|
|
9432
9542
|
}) {
|
|
9433
9543
|
const emptyMessage = noOptionsMessage?.();
|
|
9434
|
-
return /* @__PURE__ */
|
|
9544
|
+
return /* @__PURE__ */ jsxs81(
|
|
9435
9545
|
"div",
|
|
9436
9546
|
{
|
|
9437
9547
|
id,
|
|
@@ -9444,12 +9554,12 @@ function SelectDesktopMenu({
|
|
|
9444
9554
|
onKeyDown,
|
|
9445
9555
|
className: cn("max-h-[280px] overflow-y-auto p-2 outline-none", menuClassName),
|
|
9446
9556
|
children: [
|
|
9447
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */
|
|
9557
|
+
options.length === 0 && emptyMessage ? /* @__PURE__ */ jsx125("div", { className: "px-4 py-3 text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : null,
|
|
9448
9558
|
options.map((option, index) => {
|
|
9449
9559
|
const isSelected = selectedValue?.value === option.value;
|
|
9450
9560
|
const isHighlighted = index === highlightedIndex;
|
|
9451
9561
|
const optionKey = `${String(option.value)}-${index}`;
|
|
9452
|
-
return /* @__PURE__ */
|
|
9562
|
+
return /* @__PURE__ */ jsx125(
|
|
9453
9563
|
"button",
|
|
9454
9564
|
{
|
|
9455
9565
|
id: getOptionId2(index),
|
|
@@ -9481,7 +9591,7 @@ function SelectDesktopMenu({
|
|
|
9481
9591
|
}
|
|
9482
9592
|
|
|
9483
9593
|
// src/airbnb/select/SelectDesktopContent.tsx
|
|
9484
|
-
import { jsx as
|
|
9594
|
+
import { jsx as jsx126 } from "react/jsx-runtime";
|
|
9485
9595
|
function SelectDesktopContent({
|
|
9486
9596
|
isOpen,
|
|
9487
9597
|
listboxId,
|
|
@@ -9502,14 +9612,14 @@ function SelectDesktopContent({
|
|
|
9502
9612
|
noOptionsMessage
|
|
9503
9613
|
}) {
|
|
9504
9614
|
if (!isOpen) return null;
|
|
9505
|
-
return /* @__PURE__ */
|
|
9615
|
+
return /* @__PURE__ */ jsx126(
|
|
9506
9616
|
"div",
|
|
9507
9617
|
{
|
|
9508
9618
|
className: cn(
|
|
9509
9619
|
"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)]",
|
|
9510
9620
|
dropdownClassName
|
|
9511
9621
|
),
|
|
9512
|
-
children: /* @__PURE__ */
|
|
9622
|
+
children: /* @__PURE__ */ jsx126(
|
|
9513
9623
|
SelectDesktopMenu,
|
|
9514
9624
|
{
|
|
9515
9625
|
id: listboxId,
|
|
@@ -9607,7 +9717,7 @@ function getMobileOptionStyles(index, scrollTop) {
|
|
|
9607
9717
|
}
|
|
9608
9718
|
|
|
9609
9719
|
// src/airbnb/select/SelectMobileWheel.tsx
|
|
9610
|
-
import { jsx as
|
|
9720
|
+
import { jsx as jsx127, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
9611
9721
|
function SelectMobileWheel({
|
|
9612
9722
|
id,
|
|
9613
9723
|
options,
|
|
@@ -9626,7 +9736,7 @@ function SelectMobileWheel({
|
|
|
9626
9736
|
}) {
|
|
9627
9737
|
const spacerHeight2 = getWheelSpacerHeight();
|
|
9628
9738
|
const emptyMessage = noOptionsMessage?.();
|
|
9629
|
-
return /* @__PURE__ */
|
|
9739
|
+
return /* @__PURE__ */ jsxs82(
|
|
9630
9740
|
"div",
|
|
9631
9741
|
{
|
|
9632
9742
|
id,
|
|
@@ -9638,10 +9748,10 @@ function SelectMobileWheel({
|
|
|
9638
9748
|
onKeyDown,
|
|
9639
9749
|
className: cn("relative overflow-hidden outline-none", menuClassName),
|
|
9640
9750
|
children: [
|
|
9641
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */
|
|
9642
|
-
/* @__PURE__ */
|
|
9643
|
-
/* @__PURE__ */
|
|
9644
|
-
/* @__PURE__ */
|
|
9751
|
+
options.length === 0 && emptyMessage ? /* @__PURE__ */ jsx127("div", { className: "flex min-h-[160px] items-center justify-center px-4 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : null,
|
|
9752
|
+
/* @__PURE__ */ jsx127("div", { className: "pointer-events-none absolute inset-x-0 top-0 h-16 bg-gradient-to-b from-white via-white/80 to-transparent" }),
|
|
9753
|
+
/* @__PURE__ */ jsx127("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-white via-white/80 to-transparent" }),
|
|
9754
|
+
/* @__PURE__ */ jsx127(
|
|
9645
9755
|
"div",
|
|
9646
9756
|
{
|
|
9647
9757
|
"aria-hidden": true,
|
|
@@ -9651,7 +9761,7 @@ function SelectMobileWheel({
|
|
|
9651
9761
|
)
|
|
9652
9762
|
}
|
|
9653
9763
|
),
|
|
9654
|
-
/* @__PURE__ */
|
|
9764
|
+
/* @__PURE__ */ jsxs82(
|
|
9655
9765
|
"div",
|
|
9656
9766
|
{
|
|
9657
9767
|
ref: listRef,
|
|
@@ -9666,11 +9776,11 @@ function SelectMobileWheel({
|
|
|
9666
9776
|
WebkitOverflowScrolling: "touch"
|
|
9667
9777
|
},
|
|
9668
9778
|
children: [
|
|
9669
|
-
/* @__PURE__ */
|
|
9779
|
+
/* @__PURE__ */ jsx127("div", { style: { height: `${spacerHeight2}px` } }),
|
|
9670
9780
|
options.map((option, index) => {
|
|
9671
9781
|
const { distance, style } = getMobileOptionStyles(index, scrollTop);
|
|
9672
9782
|
const optionKey = `${String(option.value)}-${index}`;
|
|
9673
|
-
return /* @__PURE__ */
|
|
9783
|
+
return /* @__PURE__ */ jsx127(
|
|
9674
9784
|
"button",
|
|
9675
9785
|
{
|
|
9676
9786
|
id: getOptionId2(index),
|
|
@@ -9691,7 +9801,7 @@ function SelectMobileWheel({
|
|
|
9691
9801
|
optionKey
|
|
9692
9802
|
);
|
|
9693
9803
|
}),
|
|
9694
|
-
/* @__PURE__ */
|
|
9804
|
+
/* @__PURE__ */ jsx127("div", { style: { height: `${spacerHeight2}px` } })
|
|
9695
9805
|
]
|
|
9696
9806
|
}
|
|
9697
9807
|
)
|
|
@@ -9701,7 +9811,7 @@ function SelectMobileWheel({
|
|
|
9701
9811
|
}
|
|
9702
9812
|
|
|
9703
9813
|
// src/airbnb/select/SelectMobileContent.tsx
|
|
9704
|
-
import { jsx as
|
|
9814
|
+
import { jsx as jsx128, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
9705
9815
|
function SelectMobileContent({
|
|
9706
9816
|
open,
|
|
9707
9817
|
onOpenChange,
|
|
@@ -9725,11 +9835,11 @@ function SelectMobileContent({
|
|
|
9725
9835
|
getOptionId: getOptionId2,
|
|
9726
9836
|
noOptionsMessage
|
|
9727
9837
|
}) {
|
|
9728
|
-
return /* @__PURE__ */
|
|
9729
|
-
/* @__PURE__ */
|
|
9730
|
-
/* @__PURE__ */
|
|
9731
|
-
/* @__PURE__ */
|
|
9732
|
-
/* @__PURE__ */
|
|
9838
|
+
return /* @__PURE__ */ jsx128(Drawer, { open, onOpenChange, children: /* @__PURE__ */ jsxs83(DrawerContent, { onClose, lockScroll: false, children: [
|
|
9839
|
+
/* @__PURE__ */ jsx128(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
9840
|
+
/* @__PURE__ */ jsx128(DrawerDescription, { className: "sr-only", children: label }),
|
|
9841
|
+
/* @__PURE__ */ jsxs83("div", { className: "px-6 pb-4 pt-1", children: [
|
|
9842
|
+
/* @__PURE__ */ jsx128(
|
|
9733
9843
|
SelectMobileWheel,
|
|
9734
9844
|
{
|
|
9735
9845
|
id: listboxId,
|
|
@@ -9748,16 +9858,16 @@ function SelectMobileContent({
|
|
|
9748
9858
|
noOptionsMessage
|
|
9749
9859
|
}
|
|
9750
9860
|
),
|
|
9751
|
-
/* @__PURE__ */
|
|
9861
|
+
/* @__PURE__ */ jsx128(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
9752
9862
|
] })
|
|
9753
9863
|
] }) });
|
|
9754
9864
|
}
|
|
9755
9865
|
|
|
9756
9866
|
// src/airbnb/select/SelectTrigger.tsx
|
|
9757
|
-
import * as
|
|
9867
|
+
import * as React33 from "react";
|
|
9758
9868
|
import { ChevronDown } from "lucide-react";
|
|
9759
|
-
import { jsx as
|
|
9760
|
-
var SelectTrigger2 =
|
|
9869
|
+
import { jsx as jsx129 } from "react/jsx-runtime";
|
|
9870
|
+
var SelectTrigger2 = React33.forwardRef(
|
|
9761
9871
|
({
|
|
9762
9872
|
id,
|
|
9763
9873
|
open,
|
|
@@ -9782,7 +9892,7 @@ var SelectTrigger2 = React32.forwardRef(
|
|
|
9782
9892
|
onKeyDown,
|
|
9783
9893
|
onBlur
|
|
9784
9894
|
}, ref) => {
|
|
9785
|
-
return /* @__PURE__ */
|
|
9895
|
+
return /* @__PURE__ */ jsx129(
|
|
9786
9896
|
FieldTrigger,
|
|
9787
9897
|
{
|
|
9788
9898
|
id,
|
|
@@ -9811,7 +9921,7 @@ var SelectTrigger2 = React32.forwardRef(
|
|
|
9811
9921
|
onClick,
|
|
9812
9922
|
onKeyDown,
|
|
9813
9923
|
onBlur,
|
|
9814
|
-
trailingAdornment: /* @__PURE__ */
|
|
9924
|
+
trailingAdornment: /* @__PURE__ */ jsx129(
|
|
9815
9925
|
ChevronDown,
|
|
9816
9926
|
{
|
|
9817
9927
|
className: open ? "h-6 w-6 rotate-180 text-[#1F1F1B] transition-transform" : "h-6 w-6 text-[#1F1F1B] transition-transform"
|
|
@@ -9824,7 +9934,7 @@ var SelectTrigger2 = React32.forwardRef(
|
|
|
9824
9934
|
SelectTrigger2.displayName = "SelectTrigger";
|
|
9825
9935
|
|
|
9826
9936
|
// src/airbnb/select/useDesktopSelect.ts
|
|
9827
|
-
import * as
|
|
9937
|
+
import * as React34 from "react";
|
|
9828
9938
|
function useDesktopSelect({
|
|
9829
9939
|
isMobile,
|
|
9830
9940
|
isOpen,
|
|
@@ -9833,12 +9943,12 @@ function useDesktopSelect({
|
|
|
9833
9943
|
disabled,
|
|
9834
9944
|
onChange
|
|
9835
9945
|
}) {
|
|
9836
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
9837
|
-
const triggerRef =
|
|
9838
|
-
const listRef =
|
|
9839
|
-
const optionRefs =
|
|
9946
|
+
const [highlightedIndex, setHighlightedIndex] = React34.useState(-1);
|
|
9947
|
+
const triggerRef = React34.useRef(null);
|
|
9948
|
+
const listRef = React34.useRef(null);
|
|
9949
|
+
const optionRefs = React34.useRef([]);
|
|
9840
9950
|
const selectedIndex = getOptionIndex(options, value);
|
|
9841
|
-
|
|
9951
|
+
React34.useEffect(() => {
|
|
9842
9952
|
if (!isOpen || isMobile) return;
|
|
9843
9953
|
setHighlightedIndex((currentIndex) => {
|
|
9844
9954
|
if (currentIndex >= 0) {
|
|
@@ -9853,34 +9963,34 @@ function useDesktopSelect({
|
|
|
9853
9963
|
window.cancelAnimationFrame(frameId);
|
|
9854
9964
|
};
|
|
9855
9965
|
}, [isMobile, isOpen, options, selectedIndex]);
|
|
9856
|
-
|
|
9966
|
+
React34.useEffect(() => {
|
|
9857
9967
|
if (!isOpen || isMobile || highlightedIndex < 0) return;
|
|
9858
9968
|
optionRefs.current[highlightedIndex]?.scrollIntoView({
|
|
9859
9969
|
block: "nearest"
|
|
9860
9970
|
});
|
|
9861
9971
|
}, [highlightedIndex, isMobile, isOpen]);
|
|
9862
|
-
|
|
9972
|
+
React34.useEffect(() => {
|
|
9863
9973
|
if (isOpen) return;
|
|
9864
9974
|
setHighlightedIndex(-1);
|
|
9865
9975
|
}, [isOpen]);
|
|
9866
|
-
const focusTrigger =
|
|
9976
|
+
const focusTrigger = React34.useCallback(() => {
|
|
9867
9977
|
triggerRef.current?.focus();
|
|
9868
9978
|
}, []);
|
|
9869
|
-
const handleSelect =
|
|
9979
|
+
const handleSelect = React34.useCallback(
|
|
9870
9980
|
(option) => {
|
|
9871
9981
|
if (option.isDisabled || disabled) return;
|
|
9872
9982
|
onChange(option);
|
|
9873
9983
|
},
|
|
9874
9984
|
[disabled, onChange]
|
|
9875
9985
|
);
|
|
9876
|
-
const openMenu =
|
|
9986
|
+
const openMenu = React34.useCallback(
|
|
9877
9987
|
(targetIndex) => {
|
|
9878
9988
|
const fallbackIndex = selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex(options);
|
|
9879
9989
|
setHighlightedIndex(targetIndex ?? fallbackIndex);
|
|
9880
9990
|
},
|
|
9881
9991
|
[options, selectedIndex]
|
|
9882
9992
|
);
|
|
9883
|
-
const handleTriggerKeyDown =
|
|
9993
|
+
const handleTriggerKeyDown = React34.useCallback(
|
|
9884
9994
|
(event, onOpen) => {
|
|
9885
9995
|
if (disabled) return;
|
|
9886
9996
|
if (event.key === "ArrowDown") {
|
|
@@ -9905,7 +10015,7 @@ function useDesktopSelect({
|
|
|
9905
10015
|
},
|
|
9906
10016
|
[disabled, openMenu, options, selectedIndex]
|
|
9907
10017
|
);
|
|
9908
|
-
const handleMenuKeyDown =
|
|
10018
|
+
const handleMenuKeyDown = React34.useCallback(
|
|
9909
10019
|
(event, onClose) => {
|
|
9910
10020
|
if (event.key === "Escape") {
|
|
9911
10021
|
event.preventDefault();
|
|
@@ -9955,7 +10065,7 @@ function useDesktopSelect({
|
|
|
9955
10065
|
},
|
|
9956
10066
|
[focusTrigger, highlightedIndex, onChange, options]
|
|
9957
10067
|
);
|
|
9958
|
-
const setOptionRef =
|
|
10068
|
+
const setOptionRef = React34.useCallback(
|
|
9959
10069
|
(index, node) => {
|
|
9960
10070
|
optionRefs.current[index] = node;
|
|
9961
10071
|
},
|
|
@@ -9975,23 +10085,23 @@ function useDesktopSelect({
|
|
|
9975
10085
|
}
|
|
9976
10086
|
|
|
9977
10087
|
// src/airbnb/select/useMobileSelectWheel.ts
|
|
9978
|
-
import * as
|
|
10088
|
+
import * as React35 from "react";
|
|
9979
10089
|
function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
9980
|
-
const [pendingValue, setPendingValue] =
|
|
10090
|
+
const [pendingValue, setPendingValue] = React35.useState(
|
|
9981
10091
|
value ?? null
|
|
9982
10092
|
);
|
|
9983
|
-
const [mobileScrollTop, setMobileScrollTop] =
|
|
9984
|
-
const mobileListRef =
|
|
9985
|
-
const scrollSettleTimeoutRef =
|
|
9986
|
-
const scrollAnimationFrameRef =
|
|
9987
|
-
const getTargetIndex =
|
|
10093
|
+
const [mobileScrollTop, setMobileScrollTop] = React35.useState(0);
|
|
10094
|
+
const mobileListRef = React35.useRef(null);
|
|
10095
|
+
const scrollSettleTimeoutRef = React35.useRef(null);
|
|
10096
|
+
const scrollAnimationFrameRef = React35.useRef(null);
|
|
10097
|
+
const getTargetIndex = React35.useCallback(
|
|
9988
10098
|
(targetValue) => {
|
|
9989
10099
|
const selectedIndex = getOptionIndex(options, targetValue);
|
|
9990
10100
|
return selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex(options);
|
|
9991
10101
|
},
|
|
9992
10102
|
[options]
|
|
9993
10103
|
);
|
|
9994
|
-
const syncScrollPosition =
|
|
10104
|
+
const syncScrollPosition = React35.useCallback(
|
|
9995
10105
|
(targetValue, behavior = "instant") => {
|
|
9996
10106
|
const targetIndex = getTargetIndex(targetValue);
|
|
9997
10107
|
if (targetIndex < 0) return;
|
|
@@ -10010,27 +10120,27 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10010
10120
|
},
|
|
10011
10121
|
[getTargetIndex, options]
|
|
10012
10122
|
);
|
|
10013
|
-
const clearScrollSettleTimeout =
|
|
10123
|
+
const clearScrollSettleTimeout = React35.useCallback(() => {
|
|
10014
10124
|
if (scrollSettleTimeoutRef.current === null) return;
|
|
10015
10125
|
window.clearTimeout(scrollSettleTimeoutRef.current);
|
|
10016
10126
|
scrollSettleTimeoutRef.current = null;
|
|
10017
10127
|
}, []);
|
|
10018
|
-
const clearScrollAnimationFrame =
|
|
10128
|
+
const clearScrollAnimationFrame = React35.useCallback(() => {
|
|
10019
10129
|
if (scrollAnimationFrameRef.current === null) return;
|
|
10020
10130
|
window.cancelAnimationFrame(scrollAnimationFrameRef.current);
|
|
10021
10131
|
scrollAnimationFrameRef.current = null;
|
|
10022
10132
|
}, []);
|
|
10023
|
-
|
|
10133
|
+
React35.useEffect(
|
|
10024
10134
|
() => () => {
|
|
10025
10135
|
clearScrollSettleTimeout();
|
|
10026
10136
|
clearScrollAnimationFrame();
|
|
10027
10137
|
},
|
|
10028
10138
|
[clearScrollAnimationFrame, clearScrollSettleTimeout]
|
|
10029
10139
|
);
|
|
10030
|
-
|
|
10140
|
+
React35.useEffect(() => {
|
|
10031
10141
|
setPendingValue(value ?? null);
|
|
10032
10142
|
}, [value]);
|
|
10033
|
-
|
|
10143
|
+
React35.useLayoutEffect(() => {
|
|
10034
10144
|
if (!isMobile || !isOpen) return;
|
|
10035
10145
|
const frameId = window.requestAnimationFrame(() => {
|
|
10036
10146
|
syncScrollPosition(value ?? null, "instant");
|
|
@@ -10039,7 +10149,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10039
10149
|
window.cancelAnimationFrame(frameId);
|
|
10040
10150
|
};
|
|
10041
10151
|
}, [isMobile, isOpen, syncScrollPosition, value]);
|
|
10042
|
-
const settleScroll =
|
|
10152
|
+
const settleScroll = React35.useCallback(() => {
|
|
10043
10153
|
if (!mobileListRef.current) return;
|
|
10044
10154
|
const nextIndex = Math.round(mobileListRef.current.scrollTop / MOBILE_OPTION_HEIGHT);
|
|
10045
10155
|
const nextOption = options[nextIndex];
|
|
@@ -10051,13 +10161,13 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10051
10161
|
}
|
|
10052
10162
|
setPendingValue(nextOption);
|
|
10053
10163
|
}, [options, pendingValue]);
|
|
10054
|
-
const scheduleScrollSettle =
|
|
10164
|
+
const scheduleScrollSettle = React35.useCallback(() => {
|
|
10055
10165
|
clearScrollSettleTimeout();
|
|
10056
10166
|
scrollSettleTimeoutRef.current = window.setTimeout(() => {
|
|
10057
10167
|
settleScroll();
|
|
10058
10168
|
}, MOBILE_SCROLL_SETTLE_DELAY);
|
|
10059
10169
|
}, [clearScrollSettleTimeout, settleScroll]);
|
|
10060
|
-
const handleScroll =
|
|
10170
|
+
const handleScroll = React35.useCallback(() => {
|
|
10061
10171
|
if (!mobileListRef.current) return;
|
|
10062
10172
|
const nextScrollTop = mobileListRef.current.scrollTop;
|
|
10063
10173
|
clearScrollAnimationFrame();
|
|
@@ -10067,7 +10177,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10067
10177
|
});
|
|
10068
10178
|
scheduleScrollSettle();
|
|
10069
10179
|
}, [clearScrollAnimationFrame, scheduleScrollSettle]);
|
|
10070
|
-
const focusOptionByIndex =
|
|
10180
|
+
const focusOptionByIndex = React35.useCallback(
|
|
10071
10181
|
(index, behavior = "instant", updatePendingImmediately = behavior === "instant") => {
|
|
10072
10182
|
if (!mobileListRef.current || index < 0 || index >= options.length) return;
|
|
10073
10183
|
const option = options[index];
|
|
@@ -10085,7 +10195,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10085
10195
|
},
|
|
10086
10196
|
[options, scheduleScrollSettle]
|
|
10087
10197
|
);
|
|
10088
|
-
const handleOptionClick =
|
|
10198
|
+
const handleOptionClick = React35.useCallback(
|
|
10089
10199
|
(option) => {
|
|
10090
10200
|
if (!mobileListRef.current || disabled || option.isDisabled) return;
|
|
10091
10201
|
const optionIndex = getOptionIndex(options, option);
|
|
@@ -10094,7 +10204,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10094
10204
|
},
|
|
10095
10205
|
[disabled, focusOptionByIndex, options]
|
|
10096
10206
|
);
|
|
10097
|
-
const moveByStep =
|
|
10207
|
+
const moveByStep = React35.useCallback(
|
|
10098
10208
|
(step) => {
|
|
10099
10209
|
const currentIndex = getOptionIndex(options, pendingValue);
|
|
10100
10210
|
const fallbackIndex = step === 1 ? getFirstEnabledOptionIndex(options) : getLastEnabledOptionIndex(options);
|
|
@@ -10106,7 +10216,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10106
10216
|
},
|
|
10107
10217
|
[focusOptionByIndex, options, pendingValue]
|
|
10108
10218
|
);
|
|
10109
|
-
const moveToBoundary =
|
|
10219
|
+
const moveToBoundary = React35.useCallback(
|
|
10110
10220
|
(boundary) => {
|
|
10111
10221
|
const targetIndex = boundary === "start" ? getFirstEnabledOptionIndex(options) : getLastEnabledOptionIndex(options);
|
|
10112
10222
|
if (targetIndex >= 0) {
|
|
@@ -10115,7 +10225,7 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10115
10225
|
},
|
|
10116
10226
|
[focusOptionByIndex, options]
|
|
10117
10227
|
);
|
|
10118
|
-
const syncPendingValue =
|
|
10228
|
+
const syncPendingValue = React35.useCallback(
|
|
10119
10229
|
(nextValue) => {
|
|
10120
10230
|
const normalizedValue = nextValue ?? null;
|
|
10121
10231
|
const matchedIndex = getOptionIndex(options, normalizedValue);
|
|
@@ -10143,9 +10253,9 @@ function useMobileSelectWheel({ isMobile, isOpen, options, value, disabled }) {
|
|
|
10143
10253
|
}
|
|
10144
10254
|
|
|
10145
10255
|
// src/airbnb/select/useSelectIds.ts
|
|
10146
|
-
import * as
|
|
10256
|
+
import * as React36 from "react";
|
|
10147
10257
|
function useSelectIds({ name, hasValue, error, hideErrorMessage }) {
|
|
10148
|
-
const reactId =
|
|
10258
|
+
const reactId = React36.useId().replace(/:/g, "");
|
|
10149
10259
|
const baseId = name ? `select-${name}` : `select-${reactId}`;
|
|
10150
10260
|
const triggerId = `${baseId}-trigger`;
|
|
10151
10261
|
const labelId = `${baseId}-label`;
|
|
@@ -10155,7 +10265,7 @@ function useSelectIds({ name, hasValue, error, hideErrorMessage }) {
|
|
|
10155
10265
|
const listboxId = `${baseId}-listbox`;
|
|
10156
10266
|
const describedErrorId = error && !hideErrorMessage ? errorId : void 0;
|
|
10157
10267
|
const describedBy = [!hasValue ? helperTextId : null, describedErrorId].filter(Boolean).join(" ") || void 0;
|
|
10158
|
-
const getOptionId2 =
|
|
10268
|
+
const getOptionId2 = React36.useCallback(
|
|
10159
10269
|
(index) => `${baseId}-option-${index}`,
|
|
10160
10270
|
[baseId]
|
|
10161
10271
|
);
|
|
@@ -10225,8 +10335,8 @@ function useOutsideClick(elementRef, onOutsideClick, nested) {
|
|
|
10225
10335
|
}
|
|
10226
10336
|
|
|
10227
10337
|
// src/airbnb/select/Select.tsx
|
|
10228
|
-
import { jsx as
|
|
10229
|
-
var AirbnbSelect =
|
|
10338
|
+
import { jsx as jsx130, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
10339
|
+
var AirbnbSelect = React37.forwardRef(function AirbnbSelect2({
|
|
10230
10340
|
options = [],
|
|
10231
10341
|
value,
|
|
10232
10342
|
onChange,
|
|
@@ -10253,8 +10363,8 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10253
10363
|
noOptionsMessage
|
|
10254
10364
|
}, ref) {
|
|
10255
10365
|
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
10256
|
-
const [isOpen, setIsOpen] =
|
|
10257
|
-
const containerRef =
|
|
10366
|
+
const [isOpen, setIsOpen] = React37.useState(false);
|
|
10367
|
+
const containerRef = React37.useRef(null);
|
|
10258
10368
|
const hasValue = Boolean(value);
|
|
10259
10369
|
const helperText = placeholder ?? label;
|
|
10260
10370
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
@@ -10308,12 +10418,12 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10308
10418
|
const activeMobileIndex = getOptionIndex(options, pendingValue);
|
|
10309
10419
|
const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
|
|
10310
10420
|
useOutsideClick(containerRef, isOpen && !isMobile ? () => setIsOpen(false) : null);
|
|
10311
|
-
|
|
10421
|
+
React37.useEffect(() => {
|
|
10312
10422
|
if (isBlocked) {
|
|
10313
10423
|
setIsOpen(false);
|
|
10314
10424
|
}
|
|
10315
10425
|
}, [isBlocked]);
|
|
10316
|
-
|
|
10426
|
+
React37.useEffect(
|
|
10317
10427
|
function setCorrectOptionIfThereIsOnlyValue() {
|
|
10318
10428
|
if (value?.value === void 0 || value.value === null || value.label !== "") {
|
|
10319
10429
|
return;
|
|
@@ -10325,7 +10435,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10325
10435
|
},
|
|
10326
10436
|
[onChange, options, value]
|
|
10327
10437
|
);
|
|
10328
|
-
const handleMobileOpenChange =
|
|
10438
|
+
const handleMobileOpenChange = React37.useCallback(
|
|
10329
10439
|
(nextOpen) => {
|
|
10330
10440
|
if (isBlocked && nextOpen) return;
|
|
10331
10441
|
setIsOpen(nextOpen);
|
|
@@ -10336,7 +10446,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10336
10446
|
},
|
|
10337
10447
|
[focusTrigger, isBlocked, syncPendingValue, value]
|
|
10338
10448
|
);
|
|
10339
|
-
const handleMobileDone =
|
|
10449
|
+
const handleMobileDone = React37.useCallback(() => {
|
|
10340
10450
|
if (isBlocked) return;
|
|
10341
10451
|
const finalOption = pendingValue;
|
|
10342
10452
|
if (finalOption && finalOption.value !== value?.value) {
|
|
@@ -10345,7 +10455,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10345
10455
|
setIsOpen(false);
|
|
10346
10456
|
focusTrigger();
|
|
10347
10457
|
}, [focusTrigger, isBlocked, onChange, pendingValue, value]);
|
|
10348
|
-
const handleTriggerClick =
|
|
10458
|
+
const handleTriggerClick = React37.useCallback(() => {
|
|
10349
10459
|
if (isBlocked) return;
|
|
10350
10460
|
setIsOpen((prev) => {
|
|
10351
10461
|
const nextOpen = !prev;
|
|
@@ -10398,13 +10508,13 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10398
10508
|
handleMobileOpenChange(false);
|
|
10399
10509
|
}
|
|
10400
10510
|
};
|
|
10401
|
-
return /* @__PURE__ */
|
|
10511
|
+
return /* @__PURE__ */ jsxs84(
|
|
10402
10512
|
"div",
|
|
10403
10513
|
{
|
|
10404
10514
|
ref: containerRef,
|
|
10405
10515
|
className: cn("relative w-full max-w-[var(--max-field-width)]", className),
|
|
10406
10516
|
children: [
|
|
10407
|
-
name && /* @__PURE__ */
|
|
10517
|
+
name && /* @__PURE__ */ jsx130("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
10408
10518
|
renderTrigger ? renderTrigger({
|
|
10409
10519
|
id: triggerId,
|
|
10410
10520
|
open: isOpen,
|
|
@@ -10426,7 +10536,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10426
10536
|
onClick: handleTriggerClick,
|
|
10427
10537
|
onKeyDown: handleRootTriggerKeyDown,
|
|
10428
10538
|
onBlur
|
|
10429
|
-
}) : /* @__PURE__ */
|
|
10539
|
+
}) : /* @__PURE__ */ jsx130(
|
|
10430
10540
|
SelectTrigger2,
|
|
10431
10541
|
{
|
|
10432
10542
|
id: triggerId,
|
|
@@ -10454,7 +10564,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10454
10564
|
onBlur
|
|
10455
10565
|
}
|
|
10456
10566
|
),
|
|
10457
|
-
isMobile ? /* @__PURE__ */
|
|
10567
|
+
isMobile ? /* @__PURE__ */ jsx130(
|
|
10458
10568
|
SelectMobileContent,
|
|
10459
10569
|
{
|
|
10460
10570
|
open: isOpen,
|
|
@@ -10479,7 +10589,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10479
10589
|
getOptionId: getOptionId2,
|
|
10480
10590
|
noOptionsMessage
|
|
10481
10591
|
}
|
|
10482
|
-
) : /* @__PURE__ */
|
|
10592
|
+
) : /* @__PURE__ */ jsx130(
|
|
10483
10593
|
SelectDesktopContent,
|
|
10484
10594
|
{
|
|
10485
10595
|
isOpen,
|
|
@@ -10513,8 +10623,8 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10513
10623
|
});
|
|
10514
10624
|
|
|
10515
10625
|
// src/airbnb/phone-field/PhoneField.tsx
|
|
10516
|
-
import { jsx as
|
|
10517
|
-
var PhoneField =
|
|
10626
|
+
import { jsx as jsx131, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
10627
|
+
var PhoneField = React38.forwardRef(
|
|
10518
10628
|
({
|
|
10519
10629
|
variant = "default",
|
|
10520
10630
|
label,
|
|
@@ -10538,8 +10648,8 @@ var PhoneField = React37.forwardRef(
|
|
|
10538
10648
|
mobileTitle,
|
|
10539
10649
|
codePlaceholder = "+00"
|
|
10540
10650
|
}, ref) => {
|
|
10541
|
-
const inputId =
|
|
10542
|
-
const codeOptions =
|
|
10651
|
+
const inputId = React38.useId();
|
|
10652
|
+
const codeOptions = React38.useMemo(
|
|
10543
10653
|
() => options.map((option) => ({
|
|
10544
10654
|
value: option.value,
|
|
10545
10655
|
label: `${option.label} (${option.value})`,
|
|
@@ -10547,7 +10657,7 @@ var PhoneField = React37.forwardRef(
|
|
|
10547
10657
|
})),
|
|
10548
10658
|
[options]
|
|
10549
10659
|
);
|
|
10550
|
-
const selectedCodeOption =
|
|
10660
|
+
const selectedCodeOption = React38.useMemo(
|
|
10551
10661
|
() => codeOptions.find((option) => option.value === value?.code) ?? null,
|
|
10552
10662
|
[codeOptions, value?.code]
|
|
10553
10663
|
);
|
|
@@ -10555,9 +10665,9 @@ var PhoneField = React37.forwardRef(
|
|
|
10555
10665
|
const hasInvalidState = Boolean(error) || Boolean(invalid);
|
|
10556
10666
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
10557
10667
|
const isCodeBlocked = isBlocked || Boolean(codeReadOnly);
|
|
10558
|
-
return /* @__PURE__ */
|
|
10559
|
-
name && /* @__PURE__ */
|
|
10560
|
-
codeName && /* @__PURE__ */
|
|
10668
|
+
return /* @__PURE__ */ jsxs85("div", { className: cn("w-full max-w-[var(--max-field-width)]", className), children: [
|
|
10669
|
+
name && /* @__PURE__ */ jsx131("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
10670
|
+
codeName && /* @__PURE__ */ jsx131(
|
|
10561
10671
|
"input",
|
|
10562
10672
|
{
|
|
10563
10673
|
type: "hidden",
|
|
@@ -10566,7 +10676,7 @@ var PhoneField = React37.forwardRef(
|
|
|
10566
10676
|
disabled
|
|
10567
10677
|
}
|
|
10568
10678
|
),
|
|
10569
|
-
numberName && /* @__PURE__ */
|
|
10679
|
+
numberName && /* @__PURE__ */ jsx131(
|
|
10570
10680
|
"input",
|
|
10571
10681
|
{
|
|
10572
10682
|
type: "hidden",
|
|
@@ -10575,7 +10685,7 @@ var PhoneField = React37.forwardRef(
|
|
|
10575
10685
|
disabled
|
|
10576
10686
|
}
|
|
10577
10687
|
),
|
|
10578
|
-
topLabel && /* @__PURE__ */
|
|
10688
|
+
topLabel && /* @__PURE__ */ jsx131(
|
|
10579
10689
|
"label",
|
|
10580
10690
|
{
|
|
10581
10691
|
htmlFor: inputId,
|
|
@@ -10583,8 +10693,8 @@ var PhoneField = React37.forwardRef(
|
|
|
10583
10693
|
children: topLabel
|
|
10584
10694
|
}
|
|
10585
10695
|
),
|
|
10586
|
-
/* @__PURE__ */
|
|
10587
|
-
/* @__PURE__ */
|
|
10696
|
+
/* @__PURE__ */ jsxs85("div", { className: "flex items-stretch", children: [
|
|
10697
|
+
/* @__PURE__ */ jsx131(
|
|
10588
10698
|
AirbnbSelect,
|
|
10589
10699
|
{
|
|
10590
10700
|
ref,
|
|
@@ -10615,7 +10725,7 @@ var PhoneField = React37.forwardRef(
|
|
|
10615
10725
|
onClick,
|
|
10616
10726
|
onKeyDown,
|
|
10617
10727
|
valueLabel
|
|
10618
|
-
}) => /* @__PURE__ */
|
|
10728
|
+
}) => /* @__PURE__ */ jsxs85(
|
|
10619
10729
|
"button",
|
|
10620
10730
|
{
|
|
10621
10731
|
id,
|
|
@@ -10637,8 +10747,8 @@ var PhoneField = React37.forwardRef(
|
|
|
10637
10747
|
triggerDisabled ? "cursor-not-allowed opacity-50" : triggerLoading ? "cursor-progress" : "cursor-pointer"
|
|
10638
10748
|
),
|
|
10639
10749
|
children: [
|
|
10640
|
-
/* @__PURE__ */
|
|
10641
|
-
/* @__PURE__ */
|
|
10750
|
+
/* @__PURE__ */ jsx131("span", { children: valueLabel ?? codePlaceholder }),
|
|
10751
|
+
/* @__PURE__ */ jsx131(
|
|
10642
10752
|
ChevronDown2,
|
|
10643
10753
|
{
|
|
10644
10754
|
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
@@ -10650,7 +10760,7 @@ var PhoneField = React37.forwardRef(
|
|
|
10650
10760
|
)
|
|
10651
10761
|
}
|
|
10652
10762
|
),
|
|
10653
|
-
/* @__PURE__ */
|
|
10763
|
+
/* @__PURE__ */ jsx131(
|
|
10654
10764
|
AirbnbInput,
|
|
10655
10765
|
{
|
|
10656
10766
|
id: inputId,
|
|
@@ -10682,23 +10792,23 @@ var PhoneField = React37.forwardRef(
|
|
|
10682
10792
|
}
|
|
10683
10793
|
)
|
|
10684
10794
|
] }),
|
|
10685
|
-
error && /* @__PURE__ */
|
|
10795
|
+
error && /* @__PURE__ */ jsx131(FieldErrorMessage, { message: error })
|
|
10686
10796
|
] });
|
|
10687
10797
|
}
|
|
10688
10798
|
);
|
|
10689
10799
|
PhoneField.displayName = "PhoneField";
|
|
10690
10800
|
|
|
10691
10801
|
// src/airbnb/search-input/SearchInput.tsx
|
|
10692
|
-
import * as
|
|
10802
|
+
import * as React39 from "react";
|
|
10693
10803
|
import { useTranslation as useTranslation23 } from "react-i18next";
|
|
10694
10804
|
import { Search as Search3, X as X8 } from "lucide-react";
|
|
10695
|
-
import { jsx as
|
|
10696
|
-
var AirbnbSearchInput =
|
|
10805
|
+
import { jsx as jsx132, jsxs as jsxs86 } from "react/jsx-runtime";
|
|
10806
|
+
var AirbnbSearchInput = React39.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
|
|
10697
10807
|
const { t } = useTranslation23();
|
|
10698
10808
|
const placeholderText = placeholder || t("search_property") + "...";
|
|
10699
|
-
return /* @__PURE__ */
|
|
10700
|
-
/* @__PURE__ */
|
|
10701
|
-
/* @__PURE__ */
|
|
10809
|
+
return /* @__PURE__ */ jsxs86("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
|
|
10810
|
+
/* @__PURE__ */ jsx132(Search3, { className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]" }),
|
|
10811
|
+
/* @__PURE__ */ jsx132(
|
|
10702
10812
|
"input",
|
|
10703
10813
|
{
|
|
10704
10814
|
...props,
|
|
@@ -10717,13 +10827,13 @@ var AirbnbSearchInput = React38.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
10717
10827
|
)
|
|
10718
10828
|
}
|
|
10719
10829
|
),
|
|
10720
|
-
onReset && /* @__PURE__ */
|
|
10830
|
+
onReset && /* @__PURE__ */ jsx132(
|
|
10721
10831
|
Button,
|
|
10722
10832
|
{
|
|
10723
10833
|
variant: "ghost",
|
|
10724
10834
|
onClick: onReset,
|
|
10725
10835
|
className: "absolute right-0 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]",
|
|
10726
|
-
children: /* @__PURE__ */
|
|
10836
|
+
children: /* @__PURE__ */ jsx132(X8, { className: "h-5 w-5" })
|
|
10727
10837
|
}
|
|
10728
10838
|
)
|
|
10729
10839
|
] });
|
|
@@ -10731,11 +10841,29 @@ var AirbnbSearchInput = React38.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
10731
10841
|
AirbnbSearchInput.displayName = "SearchInput";
|
|
10732
10842
|
|
|
10733
10843
|
// src/searchable-select/SearchableSelect.tsx
|
|
10734
|
-
import * as
|
|
10844
|
+
import * as React40 from "react";
|
|
10735
10845
|
import { ChevronDown as ChevronDown3, Search as Search4 } from "lucide-react";
|
|
10736
10846
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
10737
|
-
import { useCallback as
|
|
10738
|
-
|
|
10847
|
+
import { useCallback as useCallback21 } from "react";
|
|
10848
|
+
|
|
10849
|
+
// src/lib/use-event.ts
|
|
10850
|
+
import { useCallback as useCallback20, useLayoutEffect as useLayoutEffect5, useRef as useRef18 } from "react";
|
|
10851
|
+
function useEvent(fn) {
|
|
10852
|
+
const fnRef = useRef18(fn);
|
|
10853
|
+
useLayoutEffect5(() => {
|
|
10854
|
+
fnRef.current = fn;
|
|
10855
|
+
}, [fn]);
|
|
10856
|
+
const eventCb = useCallback20(
|
|
10857
|
+
(...args) => {
|
|
10858
|
+
return fnRef.current?.apply(null, args);
|
|
10859
|
+
},
|
|
10860
|
+
[fnRef]
|
|
10861
|
+
);
|
|
10862
|
+
return eventCb;
|
|
10863
|
+
}
|
|
10864
|
+
|
|
10865
|
+
// src/searchable-select/SearchableSelect.tsx
|
|
10866
|
+
import { jsx as jsx133, jsxs as jsxs87 } from "react/jsx-runtime";
|
|
10739
10867
|
var ROW_HEIGHT = 48;
|
|
10740
10868
|
var DESKTOP_LIST_HEIGHT = 280;
|
|
10741
10869
|
var MOBILE_LIST_HEIGHT = 420;
|
|
@@ -10776,13 +10904,13 @@ var SearchableSelectInternal = ({
|
|
|
10776
10904
|
loadingMessage
|
|
10777
10905
|
}, ref) => {
|
|
10778
10906
|
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
10779
|
-
const reactId =
|
|
10780
|
-
const [open, setOpen] =
|
|
10781
|
-
const [internalSearchValue, setInternalSearchValue] =
|
|
10782
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
10783
|
-
const containerRef =
|
|
10784
|
-
const triggerRef =
|
|
10785
|
-
const inputRef =
|
|
10907
|
+
const reactId = React40.useId();
|
|
10908
|
+
const [open, setOpen] = React40.useState(false);
|
|
10909
|
+
const [internalSearchValue, setInternalSearchValue] = React40.useState("");
|
|
10910
|
+
const [highlightedIndex, setHighlightedIndex] = React40.useState(-1);
|
|
10911
|
+
const containerRef = React40.useRef(null);
|
|
10912
|
+
const triggerRef = React40.useRef(null);
|
|
10913
|
+
const inputRef = React40.useRef(null);
|
|
10786
10914
|
const listboxId = `${reactId}-listbox`;
|
|
10787
10915
|
const labelId = `${reactId}-label`;
|
|
10788
10916
|
const valueId = `${reactId}-value`;
|
|
@@ -10791,13 +10919,13 @@ var SearchableSelectInternal = ({
|
|
|
10791
10919
|
const searchInputId = `${reactId}-search`;
|
|
10792
10920
|
const effectiveSearchValue = searchValue ?? internalSearchValue;
|
|
10793
10921
|
const shouldFilterLocally = !onSearchChange && filterOption !== null;
|
|
10794
|
-
const visibleOptions =
|
|
10922
|
+
const visibleOptions = React40.useMemo(() => {
|
|
10795
10923
|
if (!shouldFilterLocally || !effectiveSearchValue) {
|
|
10796
10924
|
return options;
|
|
10797
10925
|
}
|
|
10798
10926
|
return options.filter((option) => filterOption(option, effectiveSearchValue));
|
|
10799
10927
|
}, [effectiveSearchValue, filterOption, options, shouldFilterLocally]);
|
|
10800
|
-
const selectedIndex =
|
|
10928
|
+
const selectedIndex = React40.useMemo(
|
|
10801
10929
|
() => visibleOptions.findIndex((option) => option.value === value?.value),
|
|
10802
10930
|
[value?.value, visibleOptions]
|
|
10803
10931
|
);
|
|
@@ -10808,17 +10936,18 @@ var SearchableSelectInternal = ({
|
|
|
10808
10936
|
const describedBy = error && !hideErrorMessage ? errorId : void 0;
|
|
10809
10937
|
const activeOptionId = highlightedIndex >= 0 ? getOptionId(reactId, highlightedIndex) : void 0;
|
|
10810
10938
|
useOutsideClick(containerRef, open && !isMobile ? () => closeSelect() : null);
|
|
10811
|
-
const
|
|
10939
|
+
const handleOnOpenChange = useEvent(onOpenChange);
|
|
10940
|
+
const setSelectOpen = useCallback21(
|
|
10812
10941
|
(nextOpen, options2) => {
|
|
10813
10942
|
setOpen(nextOpen);
|
|
10814
|
-
|
|
10943
|
+
handleOnOpenChange?.(nextOpen);
|
|
10815
10944
|
if (!nextOpen && options2?.restoreFocus) {
|
|
10816
10945
|
triggerRef.current?.focus();
|
|
10817
10946
|
}
|
|
10818
10947
|
},
|
|
10819
|
-
[]
|
|
10948
|
+
[handleOnOpenChange]
|
|
10820
10949
|
);
|
|
10821
|
-
|
|
10950
|
+
React40.useEffect(() => {
|
|
10822
10951
|
if (isBlocked) {
|
|
10823
10952
|
setSelectOpen(false);
|
|
10824
10953
|
return;
|
|
@@ -10831,7 +10960,7 @@ var SearchableSelectInternal = ({
|
|
|
10831
10960
|
window.cancelAnimationFrame(frameId);
|
|
10832
10961
|
};
|
|
10833
10962
|
}, [isBlocked, open, setSelectOpen]);
|
|
10834
|
-
|
|
10963
|
+
React40.useEffect(() => {
|
|
10835
10964
|
if (!open) {
|
|
10836
10965
|
setHighlightedIndex(-1);
|
|
10837
10966
|
return;
|
|
@@ -10899,7 +11028,7 @@ var SearchableSelectInternal = ({
|
|
|
10899
11028
|
}
|
|
10900
11029
|
}
|
|
10901
11030
|
}
|
|
10902
|
-
const content = /* @__PURE__ */
|
|
11031
|
+
const content = /* @__PURE__ */ jsx133(
|
|
10903
11032
|
SearchableSelectContent,
|
|
10904
11033
|
{
|
|
10905
11034
|
inputId: searchInputId,
|
|
@@ -10926,15 +11055,15 @@ var SearchableSelectInternal = ({
|
|
|
10926
11055
|
onOptionHover: setHighlightedIndex
|
|
10927
11056
|
}
|
|
10928
11057
|
);
|
|
10929
|
-
|
|
10930
|
-
return /* @__PURE__ */
|
|
11058
|
+
React40.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
11059
|
+
return /* @__PURE__ */ jsxs87(
|
|
10931
11060
|
"div",
|
|
10932
11061
|
{
|
|
10933
11062
|
ref: containerRef,
|
|
10934
11063
|
className: cn("relative w-full max-w-[var(--max-field-width)]", className),
|
|
10935
11064
|
children: [
|
|
10936
|
-
name && /* @__PURE__ */
|
|
10937
|
-
/* @__PURE__ */
|
|
11065
|
+
name && /* @__PURE__ */ jsx133("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
11066
|
+
/* @__PURE__ */ jsx133(
|
|
10938
11067
|
FieldTrigger,
|
|
10939
11068
|
{
|
|
10940
11069
|
id: `${reactId}-trigger`,
|
|
@@ -10969,7 +11098,7 @@ var SearchableSelectInternal = ({
|
|
|
10969
11098
|
},
|
|
10970
11099
|
onKeyDown: handleTriggerKeyDown,
|
|
10971
11100
|
onBlur,
|
|
10972
|
-
trailingAdornment: /* @__PURE__ */
|
|
11101
|
+
trailingAdornment: /* @__PURE__ */ jsx133(
|
|
10973
11102
|
ChevronDown3,
|
|
10974
11103
|
{
|
|
10975
11104
|
className: cn(
|
|
@@ -10980,7 +11109,7 @@ var SearchableSelectInternal = ({
|
|
|
10980
11109
|
)
|
|
10981
11110
|
}
|
|
10982
11111
|
),
|
|
10983
|
-
isMobile ? /* @__PURE__ */
|
|
11112
|
+
isMobile ? /* @__PURE__ */ jsx133(
|
|
10984
11113
|
Drawer,
|
|
10985
11114
|
{
|
|
10986
11115
|
open,
|
|
@@ -10992,13 +11121,13 @@ var SearchableSelectInternal = ({
|
|
|
10992
11121
|
}
|
|
10993
11122
|
closeSelect();
|
|
10994
11123
|
},
|
|
10995
|
-
children: /* @__PURE__ */
|
|
10996
|
-
/* @__PURE__ */
|
|
10997
|
-
/* @__PURE__ */
|
|
10998
|
-
/* @__PURE__ */
|
|
11124
|
+
children: /* @__PURE__ */ jsxs87(DrawerContent, { onClose: closeSelect, lockScroll: false, children: [
|
|
11125
|
+
/* @__PURE__ */ jsx133(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
11126
|
+
/* @__PURE__ */ jsx133(DrawerDescription, { className: "sr-only", children: label }),
|
|
11127
|
+
/* @__PURE__ */ jsx133("div", { className: "px-5 pb-5 pt-1", children: content })
|
|
10999
11128
|
] })
|
|
11000
11129
|
}
|
|
11001
|
-
) : open ? /* @__PURE__ */
|
|
11130
|
+
) : open ? /* @__PURE__ */ jsx133(
|
|
11002
11131
|
"div",
|
|
11003
11132
|
{
|
|
11004
11133
|
className: cn(
|
|
@@ -11012,7 +11141,7 @@ var SearchableSelectInternal = ({
|
|
|
11012
11141
|
}
|
|
11013
11142
|
);
|
|
11014
11143
|
};
|
|
11015
|
-
var SearchableSelect =
|
|
11144
|
+
var SearchableSelect = React40.forwardRef(
|
|
11016
11145
|
SearchableSelectInternal
|
|
11017
11146
|
);
|
|
11018
11147
|
function SearchableSelectContent({
|
|
@@ -11039,9 +11168,9 @@ function SearchableSelectContent({
|
|
|
11039
11168
|
onOptionClick,
|
|
11040
11169
|
onOptionHover
|
|
11041
11170
|
}) {
|
|
11042
|
-
const listRef =
|
|
11043
|
-
const lastLoadMoreOptionsLengthRef =
|
|
11044
|
-
const previousHighlightedIndexRef =
|
|
11171
|
+
const listRef = React40.useRef(null);
|
|
11172
|
+
const lastLoadMoreOptionsLengthRef = React40.useRef(null);
|
|
11173
|
+
const previousHighlightedIndexRef = React40.useRef(highlightedIndex);
|
|
11045
11174
|
const rowCount = options.length + (loading && options.length > 0 ? 1 : 0);
|
|
11046
11175
|
const virtualizer = useVirtualizer({
|
|
11047
11176
|
count: rowCount,
|
|
@@ -11052,7 +11181,7 @@ function SearchableSelectContent({
|
|
|
11052
11181
|
const virtualItems = virtualizer.getVirtualItems();
|
|
11053
11182
|
const emptyMessage = noOptionsMessage?.() ?? "No matches found";
|
|
11054
11183
|
const loadingText = loadingMessage?.() ?? "Loading...";
|
|
11055
|
-
|
|
11184
|
+
React40.useEffect(() => {
|
|
11056
11185
|
const lastItem = virtualItems[virtualItems.length - 1];
|
|
11057
11186
|
const shouldLoadMore = !!lastItem && hasNextPage && !loading && lastItem.index >= options.length - LOAD_MORE_THRESHOLD;
|
|
11058
11187
|
if (shouldLoadMore && lastLoadMoreOptionsLengthRef.current !== options.length) {
|
|
@@ -11060,23 +11189,23 @@ function SearchableSelectContent({
|
|
|
11060
11189
|
onLoadMore?.();
|
|
11061
11190
|
}
|
|
11062
11191
|
}, [hasNextPage, loading, onLoadMore, options.length, virtualItems]);
|
|
11063
|
-
|
|
11192
|
+
React40.useEffect(() => {
|
|
11064
11193
|
const hasHighlightedIndexChanged = previousHighlightedIndexRef.current !== highlightedIndex;
|
|
11065
11194
|
previousHighlightedIndexRef.current = highlightedIndex;
|
|
11066
11195
|
if (highlightedIndex >= 0 && hasHighlightedIndexChanged) {
|
|
11067
11196
|
virtualizer.scrollToIndex(highlightedIndex, { align: "auto" });
|
|
11068
11197
|
}
|
|
11069
11198
|
}, [highlightedIndex, virtualizer]);
|
|
11070
|
-
return /* @__PURE__ */
|
|
11071
|
-
/* @__PURE__ */
|
|
11072
|
-
/* @__PURE__ */
|
|
11199
|
+
return /* @__PURE__ */ jsxs87("div", { className: "p-2", children: [
|
|
11200
|
+
/* @__PURE__ */ jsxs87("div", { className: "relative mb-2", children: [
|
|
11201
|
+
/* @__PURE__ */ jsx133(
|
|
11073
11202
|
Search4,
|
|
11074
11203
|
{
|
|
11075
11204
|
"aria-hidden": "true",
|
|
11076
11205
|
className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 text-[#9696B9]"
|
|
11077
11206
|
}
|
|
11078
11207
|
),
|
|
11079
|
-
/* @__PURE__ */
|
|
11208
|
+
/* @__PURE__ */ jsx133(
|
|
11080
11209
|
"input",
|
|
11081
11210
|
{
|
|
11082
11211
|
id: inputId,
|
|
@@ -11095,7 +11224,7 @@ function SearchableSelectContent({
|
|
|
11095
11224
|
}
|
|
11096
11225
|
)
|
|
11097
11226
|
] }),
|
|
11098
|
-
loading && options.length === 0 ? /* @__PURE__ */
|
|
11227
|
+
loading && options.length === 0 ? /* @__PURE__ */ jsx133("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: loadingText }) : options.length === 0 ? /* @__PURE__ */ jsx133("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : /* @__PURE__ */ jsx133(
|
|
11099
11228
|
"div",
|
|
11100
11229
|
{
|
|
11101
11230
|
id: listboxId,
|
|
@@ -11104,7 +11233,7 @@ function SearchableSelectContent({
|
|
|
11104
11233
|
"aria-labelledby": labelId,
|
|
11105
11234
|
className: cn("overflow-y-auto outline-none", menuClassName),
|
|
11106
11235
|
style: { height: Math.min(height, rowCount * ROW_HEIGHT) },
|
|
11107
|
-
children: /* @__PURE__ */
|
|
11236
|
+
children: /* @__PURE__ */ jsx133(
|
|
11108
11237
|
"div",
|
|
11109
11238
|
{
|
|
11110
11239
|
className: "relative w-full",
|
|
@@ -11112,7 +11241,7 @@ function SearchableSelectContent({
|
|
|
11112
11241
|
children: virtualItems.map((virtualItem) => {
|
|
11113
11242
|
const option = options[virtualItem.index];
|
|
11114
11243
|
if (!option) {
|
|
11115
|
-
return /* @__PURE__ */
|
|
11244
|
+
return /* @__PURE__ */ jsx133(
|
|
11116
11245
|
"div",
|
|
11117
11246
|
{
|
|
11118
11247
|
className: "absolute left-0 top-0 flex w-full items-center px-4 text-base leading-6 text-[#6C6C6C]",
|
|
@@ -11127,7 +11256,7 @@ function SearchableSelectContent({
|
|
|
11127
11256
|
}
|
|
11128
11257
|
const isSelected = value?.value === option.value;
|
|
11129
11258
|
const isHighlighted = virtualItem.index === highlightedIndex;
|
|
11130
|
-
return /* @__PURE__ */
|
|
11259
|
+
return /* @__PURE__ */ jsx133(
|
|
11131
11260
|
"button",
|
|
11132
11261
|
{
|
|
11133
11262
|
id: getOptionId(idPrefix, virtualItem.index),
|
|
@@ -11149,7 +11278,7 @@ function SearchableSelectContent({
|
|
|
11149
11278
|
height: `${virtualItem.size}px`,
|
|
11150
11279
|
transform: `translateY(${virtualItem.start}px)`
|
|
11151
11280
|
},
|
|
11152
|
-
children: /* @__PURE__ */
|
|
11281
|
+
children: /* @__PURE__ */ jsx133("span", { className: "truncate text-center", children: String(option.label) })
|
|
11153
11282
|
},
|
|
11154
11283
|
`${String(option.value)}-${virtualItem.index}`
|
|
11155
11284
|
);
|
|
@@ -11213,6 +11342,7 @@ export {
|
|
|
11213
11342
|
ChannelSelector,
|
|
11214
11343
|
Checkbox,
|
|
11215
11344
|
CheckboxGroup,
|
|
11345
|
+
CircularLoader,
|
|
11216
11346
|
CommingSoonBadge,
|
|
11217
11347
|
ConfirmationDialog,
|
|
11218
11348
|
CopyIcon,
|