@chekinapp/ui 0.0.4 → 0.0.5
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 +294 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -9
- package/dist/index.d.ts +52 -9
- package/dist/index.js +300 -115
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3593,27 +3593,31 @@ function HelpTooltip({
|
|
|
3593
3593
|
className,
|
|
3594
3594
|
contentClassName,
|
|
3595
3595
|
size = 16,
|
|
3596
|
-
label = "More info"
|
|
3596
|
+
label = "More info",
|
|
3597
|
+
triggerAs = "button"
|
|
3597
3598
|
}) {
|
|
3599
|
+
const triggerClassName = cn(
|
|
3600
|
+
"relative flex shrink-0 cursor-help items-center justify-center rounded-full",
|
|
3601
|
+
"text-chekin-gray-2 outline-none transition-colors hover:text-chekin-blue",
|
|
3602
|
+
triggerAs === "button" && "focus-visible:shadow-chekin-focus",
|
|
3603
|
+
className
|
|
3604
|
+
);
|
|
3605
|
+
const triggerStyle = { width: size, height: size };
|
|
3606
|
+
const triggerContent = /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
3607
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lucide_react16.CircleQuestionMark, { "aria-hidden": "true", style: { width: size, height: size } }),
|
|
3608
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "absolute -left-0.5 -top-0.5 h-5 w-5" })
|
|
3609
|
+
] });
|
|
3598
3610
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(TooltipRoot, { children: [
|
|
3599
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipTrigger, { asChild: true, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime57.
|
|
3611
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipTrigger, { asChild: true, onClick, children: triggerAs === "button" ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
3600
3612
|
"button",
|
|
3601
3613
|
{
|
|
3602
3614
|
type: "button",
|
|
3603
3615
|
"aria-label": label,
|
|
3604
|
-
className:
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
"focus-visible:shadow-chekin-focus",
|
|
3608
|
-
className
|
|
3609
|
-
),
|
|
3610
|
-
style: { width: size, height: size },
|
|
3611
|
-
children: [
|
|
3612
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lucide_react16.CircleQuestionMark, { "aria-hidden": "true", style: { width: size, height: size } }),
|
|
3613
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "absolute -left-0.5 -top-0.5 h-5 w-5" })
|
|
3614
|
-
]
|
|
3616
|
+
className: triggerClassName,
|
|
3617
|
+
style: triggerStyle,
|
|
3618
|
+
children: triggerContent
|
|
3615
3619
|
}
|
|
3616
|
-
) }),
|
|
3620
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { "aria-label": label, className: triggerClassName, style: triggerStyle, children: triggerContent }) }),
|
|
3617
3621
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
3618
3622
|
TooltipContent,
|
|
3619
3623
|
{
|
|
@@ -5848,38 +5852,70 @@ var import_lucide_react30 = require("lucide-react");
|
|
|
5848
5852
|
var import_react_i18next18 = require("react-i18next");
|
|
5849
5853
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
5850
5854
|
function SearchInput({
|
|
5855
|
+
disabled,
|
|
5856
|
+
invalid,
|
|
5857
|
+
label,
|
|
5858
|
+
loading,
|
|
5851
5859
|
onReset,
|
|
5860
|
+
optional,
|
|
5852
5861
|
placeholder,
|
|
5862
|
+
tooltip,
|
|
5853
5863
|
wrapperClassName,
|
|
5854
5864
|
className,
|
|
5855
5865
|
...props
|
|
5856
5866
|
}) {
|
|
5857
5867
|
const { t } = (0, import_react_i18next18.useTranslation)();
|
|
5858
5868
|
const placeholderText = placeholder || `${t("search_property")}...`;
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5869
|
+
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
5870
|
+
const optionalLabel = optional ? typeof optional === "string" ? optional : t("optional") : void 0;
|
|
5871
|
+
const hasLabelMeta = Boolean(optionalLabel) || Boolean(tooltip);
|
|
5872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: cn("input-wrapper", wrapperClassName), children: [
|
|
5873
|
+
(label || hasLabelMeta) && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "mb-2 inline-flex max-w-full items-center gap-1.5 text-sm font-medium text-chekin-navy", children: [
|
|
5874
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "min-w-0 truncate", children: label }),
|
|
5875
|
+
optionalLabel && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "shrink-0 text-xs font-normal text-chekin-gray-2", children: optionalLabel }),
|
|
5876
|
+
tooltip && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(HelpTooltip, { content: tooltip, side: "top", size: 16 })
|
|
5877
|
+
] }),
|
|
5878
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "relative", children: [
|
|
5879
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react30.Search, { className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 text-chekin-gray-2" }),
|
|
5880
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
5881
|
+
Input,
|
|
5882
|
+
{
|
|
5883
|
+
...props,
|
|
5884
|
+
type: "text",
|
|
5885
|
+
disabled: isBlocked,
|
|
5886
|
+
placeholder: placeholderText,
|
|
5887
|
+
"aria-busy": loading,
|
|
5888
|
+
"aria-invalid": invalid,
|
|
5889
|
+
className: cn(
|
|
5890
|
+
"w-full py-3 pl-12 pr-10 text-base text-chekin-navy focus:border-chekin-gray-3",
|
|
5891
|
+
(loading || onReset) && "pr-20",
|
|
5892
|
+
invalid && "border-[var(--status-danger)] text-[var(--status-danger)] placeholder:text-[var(--status-danger)]",
|
|
5893
|
+
loading && "cursor-progress",
|
|
5894
|
+
className
|
|
5895
|
+
)
|
|
5896
|
+
}
|
|
5897
|
+
),
|
|
5898
|
+
(loading || onReset) && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "absolute right-2 top-1/2 flex -translate-y-1/2 items-center gap-1", children: [
|
|
5899
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
5900
|
+
import_lucide_react30.Loader2,
|
|
5901
|
+
{
|
|
5902
|
+
"aria-hidden": "true",
|
|
5903
|
+
className: "h-5 w-5 animate-spin text-chekin-gray-2"
|
|
5904
|
+
}
|
|
5905
|
+
),
|
|
5906
|
+
onReset && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
5907
|
+
Button,
|
|
5908
|
+
{
|
|
5909
|
+
variant: "ghost",
|
|
5910
|
+
onClick: onReset,
|
|
5911
|
+
disabled: isBlocked,
|
|
5912
|
+
className: "h-7 w-7 p-0 text-chekin-gray-2",
|
|
5913
|
+
"aria-label": t("reset_search"),
|
|
5914
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react30.X, { className: "h-5 w-5" })
|
|
5915
|
+
}
|
|
5870
5916
|
)
|
|
5871
|
-
}
|
|
5872
|
-
)
|
|
5873
|
-
onReset && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
5874
|
-
Button,
|
|
5875
|
-
{
|
|
5876
|
-
variant: "ghost",
|
|
5877
|
-
onClick: onReset,
|
|
5878
|
-
className: "absolute right-2 top-1/2 h-7 w-7 -translate-y-1/2 p-0 text-chekin-gray-2",
|
|
5879
|
-
"aria-label": t("reset_search"),
|
|
5880
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react30.X, { className: "h-5 w-5" })
|
|
5881
|
-
}
|
|
5882
|
-
)
|
|
5917
|
+
] })
|
|
5918
|
+
] })
|
|
5883
5919
|
] });
|
|
5884
5920
|
}
|
|
5885
5921
|
|
|
@@ -8094,7 +8130,7 @@ function WideButton({ className, disabled, ...props }) {
|
|
|
8094
8130
|
|
|
8095
8131
|
// src/datepicker/DatePicker.tsx
|
|
8096
8132
|
var React30 = __toESM(require("react"), 1);
|
|
8097
|
-
var
|
|
8133
|
+
var import_lucide_react42 = require("lucide-react");
|
|
8098
8134
|
|
|
8099
8135
|
// src/drawer/Drawer.tsx
|
|
8100
8136
|
var React27 = __toESM(require("react"), 1);
|
|
@@ -8277,6 +8313,13 @@ function stripTime(date) {
|
|
|
8277
8313
|
function isValidDate(value) {
|
|
8278
8314
|
return value instanceof Date && !Number.isNaN(value.getTime());
|
|
8279
8315
|
}
|
|
8316
|
+
function normalizeDateValue(value) {
|
|
8317
|
+
if (value === "" || value === null || value === void 0) {
|
|
8318
|
+
return null;
|
|
8319
|
+
}
|
|
8320
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
8321
|
+
return isValidDate(date) ? date : null;
|
|
8322
|
+
}
|
|
8280
8323
|
function clampDate(date, minDate, maxDate) {
|
|
8281
8324
|
const normalizedDate = stripTime(date);
|
|
8282
8325
|
const normalizedMinDate = isValidDate(minDate) ? stripTime(minDate) : null;
|
|
@@ -8941,6 +8984,8 @@ var DEVICE = {
|
|
|
8941
8984
|
|
|
8942
8985
|
// src/field-trigger/FieldTrigger.tsx
|
|
8943
8986
|
var React29 = __toESM(require("react"), 1);
|
|
8987
|
+
var import_lucide_react41 = require("lucide-react");
|
|
8988
|
+
var import_react_i18next22 = require("react-i18next");
|
|
8944
8989
|
|
|
8945
8990
|
// src/field-error-message/FieldErrorMessage.tsx
|
|
8946
8991
|
var import_lucide_react40 = require("lucide-react");
|
|
@@ -8998,27 +9043,60 @@ var FieldTrigger = React29.forwardRef(
|
|
|
8998
9043
|
placeholder,
|
|
8999
9044
|
disabled,
|
|
9000
9045
|
error,
|
|
9046
|
+
loading,
|
|
9047
|
+
optional,
|
|
9048
|
+
tooltip,
|
|
9001
9049
|
describedBy,
|
|
9002
9050
|
className,
|
|
9003
9051
|
contentClassName,
|
|
9004
9052
|
trailingAdornment,
|
|
9005
9053
|
forceFloatingLabel = false,
|
|
9054
|
+
forceLabelText = false,
|
|
9006
9055
|
hideErrorMessage = false,
|
|
9007
9056
|
children,
|
|
9008
9057
|
onClick,
|
|
9009
9058
|
onKeyDown,
|
|
9010
9059
|
...props
|
|
9011
9060
|
}, ref) => {
|
|
9061
|
+
const { t } = (0, import_react_i18next22.useTranslation)();
|
|
9012
9062
|
const hasValue = Boolean(valueText);
|
|
9013
9063
|
const isRaised = hasValue || forceFloatingLabel;
|
|
9014
|
-
const
|
|
9064
|
+
const optionalLabel = optional ? typeof optional === "string" ? optional : t("optional") : void 0;
|
|
9065
|
+
const visibleLabelText = labelText ?? label;
|
|
9066
|
+
const hasLabelMeta = Boolean(optionalLabel) || Boolean(tooltip);
|
|
9067
|
+
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("span", { className: "inline-flex max-w-full items-center gap-1.5 align-middle", children: [
|
|
9068
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { className: "min-w-0 truncate", children: visibleLabelText }),
|
|
9069
|
+
optionalLabel && /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("span", { className: "shrink-0 text-[12px] relative top-[1px] font-normal leading-4 text-current opacity-70", children: [
|
|
9070
|
+
"(",
|
|
9071
|
+
optionalLabel,
|
|
9072
|
+
")"
|
|
9073
|
+
] }),
|
|
9074
|
+
tooltip && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9075
|
+
HelpTooltip,
|
|
9076
|
+
{
|
|
9077
|
+
content: tooltip,
|
|
9078
|
+
side: "top",
|
|
9079
|
+
size: 16,
|
|
9080
|
+
triggerAs: as === "button" ? "span" : "button",
|
|
9081
|
+
className: "pointer-events-auto text-current opacity-70 hover:text-current hover:opacity-100"
|
|
9082
|
+
}
|
|
9083
|
+
)
|
|
9084
|
+
] }) : visibleLabelText;
|
|
9085
|
+
const animatedLabel = forceLabelText ? resolvedLabelText ?? placeholder : isRaised ? resolvedLabelText : label ?? placeholder;
|
|
9015
9086
|
const isAirbnbVariant = variant === "airbnb";
|
|
9087
|
+
const hasInvalidState = Boolean(error);
|
|
9088
|
+
const errorMessage = typeof error === "string" ? error : void 0;
|
|
9089
|
+
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
9090
|
+
const resolvedTrailingAdornment = loading || trailingAdornment ? /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
9091
|
+
trailingAdornment,
|
|
9092
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_lucide_react41.Loader2, { "aria-hidden": "true", className: "h-5 w-5 animate-spin text-[#7A8399]" })
|
|
9093
|
+
] }) : void 0;
|
|
9016
9094
|
const sharedClasses = cn(
|
|
9017
9095
|
"relative flex border w-full items-center bg-[var(--form-background-color,#fff)] text-left transition-colors focus-visible:outline-none",
|
|
9018
9096
|
isAirbnbVariant ? "rounded-[var(--form-input-border-radius,12px)] border-[var(--form-border-color,#8c8c8c)] pl-4 pr-4 focus-visible:ring-2 focus-visible:ring-[var(--form-title-color,#222222)] focus-visible:ring-offset-2" : "rounded-[10px] px-3.5 focus-visible:border-[#315EFB]",
|
|
9019
9097
|
isAirbnbVariant ? isRaised ? "min-h-[60px]" : "h-[60px]" : "min-h-[48px]",
|
|
9020
|
-
|
|
9021
|
-
disabled ? "cursor-not-allowed opacity-50" : isAirbnbVariant ? "cursor-pointer" : "cursor-text",
|
|
9098
|
+
hasInvalidState ? isAirbnbVariant ? "border-[var(--status-danger)] bg-[var(--form-error-background,#FFF5F3)]" : "border-[var(--status-danger)] bg-white" : isAirbnbVariant ? "border-[var(--form-border-color,#8c8c8c)]" : "border-[#A8A8A4] bg-white",
|
|
9099
|
+
disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : isAirbnbVariant ? "cursor-pointer" : "cursor-text",
|
|
9022
9100
|
className
|
|
9023
9101
|
);
|
|
9024
9102
|
const sharedContent = /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_jsx_runtime122.Fragment, { children: [
|
|
@@ -9036,9 +9114,10 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9036
9114
|
{
|
|
9037
9115
|
id: labelId,
|
|
9038
9116
|
className: cn(
|
|
9039
|
-
"
|
|
9117
|
+
"absolute left-0 origin-left truncate transition-all duration-200 ease-out",
|
|
9118
|
+
hasLabelMeta ? "" : "pointer-events-none",
|
|
9040
9119
|
isAirbnbVariant ? isRaised ? "top-0 translate-y-0 text-xs leading-5" : "top-1/2 -translate-y-1/2 text-[16px] leading-7" : isRaised ? "-top-2 translate-y-0 bg-[var(--form-background-color,#fff)] px-1 text-[12px] font-medium leading-4" : "top-1/2 -translate-y-1/2 text-[16px] leading-6",
|
|
9041
|
-
|
|
9120
|
+
hasInvalidState ? "text-[var(--status-danger)]" : isAirbnbVariant ? "text-[var(--form-placeholder-color,#6c6c6c)]" : "text-[#7A8399]"
|
|
9042
9121
|
),
|
|
9043
9122
|
children: animatedLabel
|
|
9044
9123
|
}
|
|
@@ -9050,7 +9129,7 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9050
9129
|
className: cn(
|
|
9051
9130
|
"absolute left-0 block truncate transition-all duration-200 ease-out",
|
|
9052
9131
|
isAirbnbVariant ? "bottom-0 translate-y-0 text-[16px] leading-6 opacity-100" : "bottom-[11px] text-[16px] leading-6",
|
|
9053
|
-
|
|
9132
|
+
hasInvalidState ? "text-[var(--status-danger)]" : "text-[var(--form-field-text-color,#222222)]"
|
|
9054
9133
|
),
|
|
9055
9134
|
children: valueText
|
|
9056
9135
|
}
|
|
@@ -9058,7 +9137,7 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9058
9137
|
]
|
|
9059
9138
|
}
|
|
9060
9139
|
),
|
|
9061
|
-
|
|
9140
|
+
resolvedTrailingAdornment && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
9062
9141
|
"span",
|
|
9063
9142
|
{
|
|
9064
9143
|
"aria-hidden": "true",
|
|
@@ -9066,7 +9145,7 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9066
9145
|
"pointer-events-none absolute top-1/2 -translate-y-1/2",
|
|
9067
9146
|
isAirbnbVariant ? "right-5" : "right-4"
|
|
9068
9147
|
),
|
|
9069
|
-
children:
|
|
9148
|
+
children: resolvedTrailingAdornment
|
|
9070
9149
|
}
|
|
9071
9150
|
)
|
|
9072
9151
|
] });
|
|
@@ -9080,10 +9159,11 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9080
9159
|
type: "button",
|
|
9081
9160
|
"aria-labelledby": hasValue && valueId ? `${labelId} ${valueId}` : labelId,
|
|
9082
9161
|
"aria-describedby": describedBy,
|
|
9083
|
-
"aria-invalid":
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9162
|
+
"aria-invalid": hasInvalidState,
|
|
9163
|
+
"aria-busy": loading,
|
|
9164
|
+
disabled: isBlocked,
|
|
9165
|
+
onClick: isBlocked ? void 0 : onClick,
|
|
9166
|
+
onKeyDown: isBlocked ? void 0 : onKeyDown,
|
|
9087
9167
|
className: sharedClasses,
|
|
9088
9168
|
...props,
|
|
9089
9169
|
children: sharedContent
|
|
@@ -9095,16 +9175,17 @@ var FieldTrigger = React29.forwardRef(
|
|
|
9095
9175
|
ref,
|
|
9096
9176
|
"aria-labelledby": hasValue && valueId ? `${labelId} ${valueId}` : labelId,
|
|
9097
9177
|
"aria-describedby": describedBy,
|
|
9098
|
-
"aria-invalid":
|
|
9099
|
-
"aria-
|
|
9100
|
-
|
|
9101
|
-
|
|
9178
|
+
"aria-invalid": hasInvalidState,
|
|
9179
|
+
"aria-busy": loading,
|
|
9180
|
+
"aria-disabled": isBlocked,
|
|
9181
|
+
onClick: isBlocked ? void 0 : onClick,
|
|
9182
|
+
onKeyDown: isBlocked ? void 0 : onKeyDown,
|
|
9102
9183
|
className: sharedClasses,
|
|
9103
9184
|
...props,
|
|
9104
9185
|
children: sharedContent
|
|
9105
9186
|
}
|
|
9106
9187
|
),
|
|
9107
|
-
|
|
9188
|
+
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(FieldErrorMessage, { id: errorId, message: errorMessage })
|
|
9108
9189
|
] });
|
|
9109
9190
|
}
|
|
9110
9191
|
);
|
|
@@ -9124,6 +9205,10 @@ var DatePicker = React30.forwardRef(
|
|
|
9124
9205
|
placeholder = "Select a date",
|
|
9125
9206
|
disabled,
|
|
9126
9207
|
error,
|
|
9208
|
+
invalid,
|
|
9209
|
+
loading,
|
|
9210
|
+
optional,
|
|
9211
|
+
tooltip,
|
|
9127
9212
|
className,
|
|
9128
9213
|
name,
|
|
9129
9214
|
minDate,
|
|
@@ -9146,11 +9231,18 @@ var DatePicker = React30.forwardRef(
|
|
|
9146
9231
|
const monthLabels = React30.useMemo(() => getMonthLabels(locale), [locale]);
|
|
9147
9232
|
const resolvedMinDate = React30.useMemo(() => minDate ?? DEFAULT_MIN_DATE, [minDate]);
|
|
9148
9233
|
const resolvedMaxDate = React30.useMemo(() => maxDate ?? /* @__PURE__ */ new Date(), [maxDate]);
|
|
9234
|
+
const normalizedValue = React30.useMemo(() => normalizeDateValue(value), [value]);
|
|
9235
|
+
const normalizedDefaultValue = React30.useMemo(
|
|
9236
|
+
() => normalizeDateValue(defaultValue),
|
|
9237
|
+
[defaultValue]
|
|
9238
|
+
);
|
|
9149
9239
|
const resolvedValue = React30.useMemo(
|
|
9150
|
-
() =>
|
|
9151
|
-
[resolvedMaxDate, resolvedMinDate
|
|
9240
|
+
() => normalizedValue ? clampDate(normalizedValue, resolvedMinDate, resolvedMaxDate) : null,
|
|
9241
|
+
[normalizedValue, resolvedMaxDate, resolvedMinDate]
|
|
9152
9242
|
);
|
|
9153
9243
|
const hasValue = Boolean(resolvedValue);
|
|
9244
|
+
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
9245
|
+
const triggerError = error ?? invalid;
|
|
9154
9246
|
const {
|
|
9155
9247
|
dayIndex,
|
|
9156
9248
|
dayListRef,
|
|
@@ -9171,34 +9263,51 @@ var DatePicker = React30.forwardRef(
|
|
|
9171
9263
|
} = useDatePickerWheel({
|
|
9172
9264
|
isOpen,
|
|
9173
9265
|
value: resolvedValue,
|
|
9174
|
-
defaultValue,
|
|
9266
|
+
defaultValue: normalizedDefaultValue,
|
|
9175
9267
|
minDate: resolvedMinDate,
|
|
9176
9268
|
maxDate: resolvedMaxDate
|
|
9177
9269
|
});
|
|
9178
|
-
const handleOpenChange = React30.useCallback(
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9270
|
+
const handleOpenChange = React30.useCallback(
|
|
9271
|
+
(nextOpen) => {
|
|
9272
|
+
if (isBlocked && nextOpen) return;
|
|
9273
|
+
setIsOpen(nextOpen);
|
|
9274
|
+
if (!nextOpen) {
|
|
9275
|
+
internalRef.current?.focus();
|
|
9276
|
+
}
|
|
9277
|
+
},
|
|
9278
|
+
[isBlocked]
|
|
9279
|
+
);
|
|
9184
9280
|
const handleDone = React30.useCallback(() => {
|
|
9281
|
+
if (isBlocked) return;
|
|
9185
9282
|
onChange(clampDate(draftDate, resolvedMinDate, resolvedMaxDate));
|
|
9186
9283
|
handleOpenChange(false);
|
|
9187
|
-
}, [
|
|
9284
|
+
}, [
|
|
9285
|
+
draftDate,
|
|
9286
|
+
handleOpenChange,
|
|
9287
|
+
isBlocked,
|
|
9288
|
+
onChange,
|
|
9289
|
+
resolvedMaxDate,
|
|
9290
|
+
resolvedMinDate
|
|
9291
|
+
]);
|
|
9188
9292
|
const handleTriggerClick = React30.useCallback(() => {
|
|
9189
|
-
if (
|
|
9293
|
+
if (isBlocked) return;
|
|
9190
9294
|
setIsOpen(true);
|
|
9191
|
-
}, [
|
|
9295
|
+
}, [isBlocked]);
|
|
9192
9296
|
const handleTriggerKeyDown = React30.useCallback(
|
|
9193
9297
|
(event) => {
|
|
9194
|
-
if (
|
|
9298
|
+
if (isBlocked) return;
|
|
9195
9299
|
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
9196
9300
|
event.preventDefault();
|
|
9197
9301
|
setIsOpen(true);
|
|
9198
9302
|
}
|
|
9199
9303
|
},
|
|
9200
|
-
[
|
|
9304
|
+
[isBlocked]
|
|
9201
9305
|
);
|
|
9306
|
+
React30.useEffect(() => {
|
|
9307
|
+
if (isBlocked) {
|
|
9308
|
+
setIsOpen(false);
|
|
9309
|
+
}
|
|
9310
|
+
}, [isBlocked]);
|
|
9202
9311
|
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: cn("relative w-full max-w-[425px]", className), children: [
|
|
9203
9312
|
name && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9204
9313
|
"input",
|
|
@@ -9225,12 +9334,16 @@ var DatePicker = React30.forwardRef(
|
|
|
9225
9334
|
valueText: resolvedValue ? formatValue(resolvedValue) : void 0,
|
|
9226
9335
|
placeholder,
|
|
9227
9336
|
disabled,
|
|
9228
|
-
error,
|
|
9337
|
+
error: triggerError,
|
|
9338
|
+
loading,
|
|
9339
|
+
optional,
|
|
9340
|
+
tooltip,
|
|
9341
|
+
forceLabelText: Boolean(optional) || Boolean(tooltip),
|
|
9229
9342
|
"aria-haspopup": "dialog",
|
|
9230
9343
|
"aria-expanded": isOpen,
|
|
9231
9344
|
onClick: handleTriggerClick,
|
|
9232
9345
|
onKeyDown: handleTriggerKeyDown,
|
|
9233
|
-
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9346
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_lucide_react42.Calendar, { className: "h-5 w-5 text-[#1F1F1B]", strokeWidth: 2 })
|
|
9234
9347
|
}
|
|
9235
9348
|
),
|
|
9236
9349
|
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
@@ -9385,6 +9498,10 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9385
9498
|
topLabel,
|
|
9386
9499
|
helperText,
|
|
9387
9500
|
error,
|
|
9501
|
+
invalid,
|
|
9502
|
+
loading,
|
|
9503
|
+
optional,
|
|
9504
|
+
tooltip,
|
|
9388
9505
|
wrapperClassName,
|
|
9389
9506
|
fieldClassName,
|
|
9390
9507
|
contentClassName,
|
|
@@ -9409,7 +9526,7 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9409
9526
|
const fieldId = `${inputId}-field`;
|
|
9410
9527
|
const labelId = `${inputId}-label`;
|
|
9411
9528
|
const errorId = `${inputId}-error`;
|
|
9412
|
-
const accessibleLabel =
|
|
9529
|
+
const accessibleLabel = placeholder ?? label;
|
|
9413
9530
|
const [isFocused, setIsFocused] = React31.useState(false);
|
|
9414
9531
|
const [currentValue, setCurrentValue] = React31.useState(
|
|
9415
9532
|
() => value != null ? getInputValue(value) : getInputValue(defaultValue)
|
|
@@ -9417,6 +9534,10 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9417
9534
|
const resolvedValue = value != null ? getInputValue(value) : currentValue;
|
|
9418
9535
|
const hasValue = resolvedValue.length > 0;
|
|
9419
9536
|
const shouldShowLabel = hasValue || isFocused;
|
|
9537
|
+
const hasInvalidState = Boolean(error) || Boolean(invalid);
|
|
9538
|
+
const triggerError = error ?? invalid;
|
|
9539
|
+
const hasLabelMeta = Boolean(optional) || Boolean(tooltip);
|
|
9540
|
+
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
9420
9541
|
React31.useLayoutEffect(() => {
|
|
9421
9542
|
const nextValue = value != null ? getInputValue(value) : getInputValue(inputRef.current?.value);
|
|
9422
9543
|
setCurrentValue((prevValue) => prevValue === nextValue ? prevValue : nextValue);
|
|
@@ -9465,7 +9586,10 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9465
9586
|
labelText: helperText ?? label,
|
|
9466
9587
|
placeholder: placeholder ?? label,
|
|
9467
9588
|
disabled,
|
|
9468
|
-
error,
|
|
9589
|
+
error: triggerError,
|
|
9590
|
+
loading,
|
|
9591
|
+
optional,
|
|
9592
|
+
tooltip,
|
|
9469
9593
|
describedBy: error && renderErrorMessage ? errorId : void 0,
|
|
9470
9594
|
className: cn(
|
|
9471
9595
|
variant === "airbnb" ? "px-4 focus-within:ring-2 focus-within:ring-[#1F1F1B] focus-within:ring-offset-2" : "px-3.5 focus-within:border-[#315EFB]",
|
|
@@ -9478,6 +9602,7 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9478
9602
|
),
|
|
9479
9603
|
trailingAdornment,
|
|
9480
9604
|
forceFloatingLabel: shouldShowLabel,
|
|
9605
|
+
forceLabelText: hasLabelMeta,
|
|
9481
9606
|
hideErrorMessage: !renderErrorMessage,
|
|
9482
9607
|
children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
9483
9608
|
"input",
|
|
@@ -9486,21 +9611,23 @@ var AirbnbInput = React31.forwardRef(
|
|
|
9486
9611
|
id: inputId,
|
|
9487
9612
|
ref: setRefs,
|
|
9488
9613
|
type,
|
|
9489
|
-
disabled,
|
|
9614
|
+
disabled: isBlocked,
|
|
9490
9615
|
value,
|
|
9491
9616
|
defaultValue,
|
|
9492
9617
|
onChange: handleChange,
|
|
9493
9618
|
onFocus: handleFocus,
|
|
9494
9619
|
onBlur: handleBlur,
|
|
9495
9620
|
placeholder: "",
|
|
9496
|
-
"aria-invalid":
|
|
9621
|
+
"aria-invalid": hasInvalidState,
|
|
9622
|
+
"aria-busy": loading,
|
|
9497
9623
|
"aria-describedby": error && renderErrorMessage ? errorId : void 0,
|
|
9498
|
-
"aria-
|
|
9624
|
+
"aria-label": accessibleLabel && hasLabelMeta ? accessibleLabel : void 0,
|
|
9625
|
+
"aria-labelledby": accessibleLabel && !hasLabelMeta ? labelId : void 0,
|
|
9499
9626
|
className: cn(
|
|
9500
9627
|
"absolute left-0 h-6 w-full border-0 bg-transparent p-0 text-[16px] leading-6 text-[#1F1F1B] outline-none placeholder:text-[#7A8399]",
|
|
9501
9628
|
variant === "airbnb" ? "bottom-0" : "bottom-[12px]",
|
|
9502
|
-
|
|
9503
|
-
disabled ? "cursor-not-allowed" : "",
|
|
9629
|
+
hasInvalidState ? "text-[var(--status-danger)] placeholder:text-[var(--status-danger)]" : "",
|
|
9630
|
+
disabled ? "cursor-not-allowed" : loading ? "cursor-progress" : "",
|
|
9504
9631
|
inputClassName,
|
|
9505
9632
|
className
|
|
9506
9633
|
)
|
|
@@ -9514,7 +9641,7 @@ AirbnbInput.displayName = "Input";
|
|
|
9514
9641
|
|
|
9515
9642
|
// src/airbnb/phone-field/PhoneField.tsx
|
|
9516
9643
|
var React37 = __toESM(require("react"), 1);
|
|
9517
|
-
var
|
|
9644
|
+
var import_lucide_react44 = require("lucide-react");
|
|
9518
9645
|
|
|
9519
9646
|
// src/airbnb/select/Select.tsx
|
|
9520
9647
|
var React36 = __toESM(require("react"), 1);
|
|
@@ -9863,7 +9990,7 @@ function SelectMobileContent({
|
|
|
9863
9990
|
|
|
9864
9991
|
// src/airbnb/select/SelectTrigger.tsx
|
|
9865
9992
|
var React32 = __toESM(require("react"), 1);
|
|
9866
|
-
var
|
|
9993
|
+
var import_lucide_react43 = require("lucide-react");
|
|
9867
9994
|
var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
9868
9995
|
var SelectTrigger2 = React32.forwardRef(
|
|
9869
9996
|
({
|
|
@@ -9875,6 +10002,9 @@ var SelectTrigger2 = React32.forwardRef(
|
|
|
9875
10002
|
helperText,
|
|
9876
10003
|
valueLabel,
|
|
9877
10004
|
disabled,
|
|
10005
|
+
loading,
|
|
10006
|
+
optional,
|
|
10007
|
+
tooltip,
|
|
9878
10008
|
error,
|
|
9879
10009
|
hideErrorMessage,
|
|
9880
10010
|
labelId,
|
|
@@ -9906,12 +10036,16 @@ var SelectTrigger2 = React32.forwardRef(
|
|
|
9906
10036
|
placeholder: helperText,
|
|
9907
10037
|
describedBy,
|
|
9908
10038
|
error,
|
|
10039
|
+
loading,
|
|
10040
|
+
optional,
|
|
10041
|
+
tooltip,
|
|
10042
|
+
forceLabelText: Boolean(optional) || Boolean(tooltip),
|
|
9909
10043
|
hideErrorMessage,
|
|
9910
10044
|
disabled,
|
|
9911
10045
|
onClick,
|
|
9912
10046
|
onKeyDown,
|
|
9913
10047
|
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
9914
|
-
|
|
10048
|
+
import_lucide_react43.ChevronDown,
|
|
9915
10049
|
{
|
|
9916
10050
|
className: open ? "h-6 w-6 rotate-180 text-[#1F1F1B] transition-transform" : "h-6 w-6 text-[#1F1F1B] transition-transform"
|
|
9917
10051
|
}
|
|
@@ -10336,7 +10470,11 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10336
10470
|
getValueLabel,
|
|
10337
10471
|
renderTrigger,
|
|
10338
10472
|
disabled,
|
|
10473
|
+
loading,
|
|
10474
|
+
optional,
|
|
10475
|
+
tooltip,
|
|
10339
10476
|
error,
|
|
10477
|
+
invalid,
|
|
10340
10478
|
hideErrorMessage,
|
|
10341
10479
|
className,
|
|
10342
10480
|
menuClassName,
|
|
@@ -10351,6 +10489,8 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10351
10489
|
const containerRef = React36.useRef(null);
|
|
10352
10490
|
const hasValue = Boolean(value);
|
|
10353
10491
|
const helperText = placeholder ?? label;
|
|
10492
|
+
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
10493
|
+
const triggerError = error ?? invalid;
|
|
10354
10494
|
const {
|
|
10355
10495
|
triggerId,
|
|
10356
10496
|
labelId,
|
|
@@ -10376,7 +10516,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10376
10516
|
isOpen,
|
|
10377
10517
|
options,
|
|
10378
10518
|
value,
|
|
10379
|
-
disabled
|
|
10519
|
+
disabled: isBlocked
|
|
10380
10520
|
});
|
|
10381
10521
|
const {
|
|
10382
10522
|
highlightedIndex,
|
|
@@ -10393,13 +10533,18 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10393
10533
|
isOpen,
|
|
10394
10534
|
options,
|
|
10395
10535
|
value,
|
|
10396
|
-
disabled,
|
|
10536
|
+
disabled: isBlocked,
|
|
10397
10537
|
onChange
|
|
10398
10538
|
});
|
|
10399
10539
|
const combinedRef = useCombinedRef(ref, desktopTriggerRef);
|
|
10400
10540
|
const activeMobileIndex = getOptionIndex(options, pendingValue);
|
|
10401
10541
|
const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
|
|
10402
10542
|
useOutsideClick(containerRef, isOpen && !isMobile ? () => setIsOpen(false) : null);
|
|
10543
|
+
React36.useEffect(() => {
|
|
10544
|
+
if (isBlocked) {
|
|
10545
|
+
setIsOpen(false);
|
|
10546
|
+
}
|
|
10547
|
+
}, [isBlocked]);
|
|
10403
10548
|
React36.useEffect(
|
|
10404
10549
|
function setCorrectOptionIfThereIsOnlyValue() {
|
|
10405
10550
|
if (value?.value === void 0 || value.value === null || value.label !== "") {
|
|
@@ -10414,24 +10559,26 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10414
10559
|
);
|
|
10415
10560
|
const handleMobileOpenChange = React36.useCallback(
|
|
10416
10561
|
(nextOpen) => {
|
|
10562
|
+
if (isBlocked && nextOpen) return;
|
|
10417
10563
|
setIsOpen(nextOpen);
|
|
10418
10564
|
syncPendingValue(value ?? null);
|
|
10419
10565
|
if (!nextOpen) {
|
|
10420
10566
|
focusTrigger();
|
|
10421
10567
|
}
|
|
10422
10568
|
},
|
|
10423
|
-
[focusTrigger, syncPendingValue, value]
|
|
10569
|
+
[focusTrigger, isBlocked, syncPendingValue, value]
|
|
10424
10570
|
);
|
|
10425
10571
|
const handleMobileDone = React36.useCallback(() => {
|
|
10572
|
+
if (isBlocked) return;
|
|
10426
10573
|
const finalOption = pendingValue;
|
|
10427
10574
|
if (finalOption && finalOption.value !== value?.value) {
|
|
10428
10575
|
onChange(finalOption);
|
|
10429
10576
|
}
|
|
10430
10577
|
setIsOpen(false);
|
|
10431
10578
|
focusTrigger();
|
|
10432
|
-
}, [focusTrigger, onChange, pendingValue, value]);
|
|
10579
|
+
}, [focusTrigger, isBlocked, onChange, pendingValue, value]);
|
|
10433
10580
|
const handleTriggerClick = React36.useCallback(() => {
|
|
10434
|
-
if (
|
|
10581
|
+
if (isBlocked) return;
|
|
10435
10582
|
setIsOpen((prev) => {
|
|
10436
10583
|
const nextOpen = !prev;
|
|
10437
10584
|
if (isMobile) {
|
|
@@ -10439,10 +10586,10 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10439
10586
|
}
|
|
10440
10587
|
return nextOpen;
|
|
10441
10588
|
});
|
|
10442
|
-
}, [
|
|
10589
|
+
}, [isBlocked, isMobile, syncPendingValue, value]);
|
|
10443
10590
|
const handleRootTriggerKeyDown = (event) => {
|
|
10444
10591
|
if (isMobile) {
|
|
10445
|
-
if (
|
|
10592
|
+
if (isBlocked) return;
|
|
10446
10593
|
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
10447
10594
|
event.preventDefault();
|
|
10448
10595
|
syncPendingValue(value ?? null);
|
|
@@ -10494,8 +10641,12 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10494
10641
|
helperText,
|
|
10495
10642
|
value,
|
|
10496
10643
|
valueLabel,
|
|
10497
|
-
disabled,
|
|
10644
|
+
disabled: isBlocked,
|
|
10645
|
+
loading,
|
|
10646
|
+
optional,
|
|
10647
|
+
tooltip,
|
|
10498
10648
|
error,
|
|
10649
|
+
invalid,
|
|
10499
10650
|
listboxId,
|
|
10500
10651
|
describedBy,
|
|
10501
10652
|
triggerRef: combinedRef,
|
|
@@ -10513,7 +10664,10 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10513
10664
|
helperText,
|
|
10514
10665
|
valueLabel,
|
|
10515
10666
|
disabled,
|
|
10516
|
-
|
|
10667
|
+
loading,
|
|
10668
|
+
optional,
|
|
10669
|
+
tooltip,
|
|
10670
|
+
error: triggerError,
|
|
10517
10671
|
hideErrorMessage,
|
|
10518
10672
|
labelId,
|
|
10519
10673
|
valueId,
|
|
@@ -10538,7 +10692,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10538
10692
|
doneLabel,
|
|
10539
10693
|
errorId: describedErrorId,
|
|
10540
10694
|
options,
|
|
10541
|
-
disabled,
|
|
10695
|
+
disabled: isBlocked,
|
|
10542
10696
|
menuClassName,
|
|
10543
10697
|
scrollTop: mobileScrollTop,
|
|
10544
10698
|
activeIndex: activeMobileIndex,
|
|
@@ -10569,7 +10723,7 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
|
10569
10723
|
onKeyDown: (event) => {
|
|
10570
10724
|
handleMenuKeyDown(event, () => setIsOpen(false));
|
|
10571
10725
|
},
|
|
10572
|
-
disabled,
|
|
10726
|
+
disabled: isBlocked,
|
|
10573
10727
|
menuClassName,
|
|
10574
10728
|
dropdownClassName,
|
|
10575
10729
|
listRef: desktopListRef,
|
|
@@ -10593,7 +10747,12 @@ var PhoneField = React37.forwardRef(
|
|
|
10593
10747
|
options,
|
|
10594
10748
|
placeholder = "Phone number",
|
|
10595
10749
|
disabled,
|
|
10750
|
+
codeReadOnly,
|
|
10596
10751
|
error,
|
|
10752
|
+
invalid,
|
|
10753
|
+
loading,
|
|
10754
|
+
optional,
|
|
10755
|
+
tooltip,
|
|
10597
10756
|
className,
|
|
10598
10757
|
name,
|
|
10599
10758
|
codeName,
|
|
@@ -10615,6 +10774,9 @@ var PhoneField = React37.forwardRef(
|
|
|
10615
10774
|
[codeOptions, value?.code]
|
|
10616
10775
|
);
|
|
10617
10776
|
const combinedValue = value?.code || value?.number ? `${value?.code ?? ""}${value?.number ?? ""}` : "";
|
|
10777
|
+
const hasInvalidState = Boolean(error) || Boolean(invalid);
|
|
10778
|
+
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
10779
|
+
const isCodeBlocked = isBlocked || Boolean(codeReadOnly);
|
|
10618
10780
|
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: cn("w-full max-w-[425px]", className), children: [
|
|
10619
10781
|
name && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
10620
10782
|
codeName && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
@@ -10657,7 +10819,9 @@ var PhoneField = React37.forwardRef(
|
|
|
10657
10819
|
}),
|
|
10658
10820
|
label: `${label} country code`,
|
|
10659
10821
|
placeholder: codePlaceholder,
|
|
10660
|
-
disabled,
|
|
10822
|
+
disabled: isCodeBlocked,
|
|
10823
|
+
loading,
|
|
10824
|
+
invalid,
|
|
10661
10825
|
className: "max-w-none shrink-0 basis-[96px]",
|
|
10662
10826
|
mobileTitle: mobileTitle ?? "Select country code",
|
|
10663
10827
|
dropdownClassName: "right-auto w-[280px]",
|
|
@@ -10667,6 +10831,7 @@ var PhoneField = React37.forwardRef(
|
|
|
10667
10831
|
open,
|
|
10668
10832
|
variant: selectVariant,
|
|
10669
10833
|
disabled: triggerDisabled,
|
|
10834
|
+
loading: triggerLoading,
|
|
10670
10835
|
listboxId,
|
|
10671
10836
|
triggerRef,
|
|
10672
10837
|
onClick,
|
|
@@ -10682,19 +10847,21 @@ var PhoneField = React37.forwardRef(
|
|
|
10682
10847
|
"aria-haspopup": "listbox",
|
|
10683
10848
|
"aria-expanded": open,
|
|
10684
10849
|
"aria-controls": listboxId,
|
|
10850
|
+
"aria-busy": triggerLoading,
|
|
10851
|
+
"aria-invalid": hasInvalidState,
|
|
10685
10852
|
disabled: triggerDisabled,
|
|
10686
10853
|
onClick,
|
|
10687
10854
|
onKeyDown,
|
|
10688
10855
|
className: cn(
|
|
10689
10856
|
"flex w-full items-center justify-center gap-2 border border-r-0 text-[16px] font-medium leading-6 transition-colors focus-visible:outline-none",
|
|
10690
10857
|
selectVariant === "airbnb" ? "h-full min-h-[60px] rounded-l-[16px] rounded-r-none px-4 focus-visible:ring-2 focus-visible:ring-[#1F1F1B] focus-visible:ring-offset-2" : "min-h-[48px] rounded-l-[10px] rounded-r-none px-3.5 focus-visible:border-[#315EFB]",
|
|
10691
|
-
|
|
10692
|
-
triggerDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
10858
|
+
hasInvalidState ? "border-[var(--status-danger)] bg-[#F2F2F2] text-[var(--status-danger)]" : selectVariant === "airbnb" ? "border-[#8C8C8C] bg-[#F4F4F2] text-[#1F1F1B]" : "border-[#A8A8A4] bg-white text-[#1F1F1B]",
|
|
10859
|
+
triggerDisabled ? "cursor-not-allowed opacity-50" : triggerLoading ? "cursor-progress" : "cursor-pointer"
|
|
10693
10860
|
),
|
|
10694
10861
|
children: [
|
|
10695
10862
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { children: valueLabel ?? codePlaceholder }),
|
|
10696
10863
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10697
|
-
|
|
10864
|
+
import_lucide_react44.ChevronDown,
|
|
10698
10865
|
{
|
|
10699
10866
|
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
10700
10867
|
strokeWidth: 2
|
|
@@ -10718,6 +10885,10 @@ var PhoneField = React37.forwardRef(
|
|
|
10718
10885
|
placeholder,
|
|
10719
10886
|
disabled,
|
|
10720
10887
|
error,
|
|
10888
|
+
invalid,
|
|
10889
|
+
loading,
|
|
10890
|
+
optional,
|
|
10891
|
+
tooltip,
|
|
10721
10892
|
renderErrorMessage: false,
|
|
10722
10893
|
wrapperClassName: "min-w-0 flex-1",
|
|
10723
10894
|
fieldClassName: cn(
|
|
@@ -10740,14 +10911,14 @@ PhoneField.displayName = "PhoneField";
|
|
|
10740
10911
|
|
|
10741
10912
|
// src/airbnb/search-input/SearchInput.tsx
|
|
10742
10913
|
var React38 = __toESM(require("react"), 1);
|
|
10743
|
-
var
|
|
10744
|
-
var
|
|
10914
|
+
var import_react_i18next23 = require("react-i18next");
|
|
10915
|
+
var import_lucide_react45 = require("lucide-react");
|
|
10745
10916
|
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
10746
10917
|
var AirbnbSearchInput = React38.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
|
|
10747
|
-
const { t } = (0,
|
|
10918
|
+
const { t } = (0, import_react_i18next23.useTranslation)();
|
|
10748
10919
|
const placeholderText = placeholder || t("search_property") + "...";
|
|
10749
10920
|
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
|
|
10750
|
-
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10921
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_lucide_react45.Search, { className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]" }),
|
|
10751
10922
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10752
10923
|
"input",
|
|
10753
10924
|
{
|
|
@@ -10773,7 +10944,7 @@ var AirbnbSearchInput = React38.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
10773
10944
|
variant: "ghost",
|
|
10774
10945
|
onClick: onReset,
|
|
10775
10946
|
className: "absolute right-0 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]",
|
|
10776
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
10947
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_lucide_react45.X, { className: "h-5 w-5" })
|
|
10777
10948
|
}
|
|
10778
10949
|
)
|
|
10779
10950
|
] });
|
|
@@ -10782,7 +10953,7 @@ AirbnbSearchInput.displayName = "SearchInput";
|
|
|
10782
10953
|
|
|
10783
10954
|
// src/searchable-select/SearchableSelect.tsx
|
|
10784
10955
|
var React39 = __toESM(require("react"), 1);
|
|
10785
|
-
var
|
|
10956
|
+
var import_lucide_react46 = require("lucide-react");
|
|
10786
10957
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
10787
10958
|
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
10788
10959
|
var ROW_HEIGHT = 48;
|
|
@@ -10812,6 +10983,9 @@ var SearchableSelectInternal = ({
|
|
|
10812
10983
|
getValueLabel,
|
|
10813
10984
|
disabled,
|
|
10814
10985
|
error,
|
|
10986
|
+
invalid,
|
|
10987
|
+
optional,
|
|
10988
|
+
tooltip,
|
|
10815
10989
|
hideErrorMessage,
|
|
10816
10990
|
name,
|
|
10817
10991
|
className,
|
|
@@ -10848,10 +11022,16 @@ var SearchableSelectInternal = ({
|
|
|
10848
11022
|
);
|
|
10849
11023
|
const helperText = placeholder ?? label;
|
|
10850
11024
|
const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
|
|
11025
|
+
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
11026
|
+
const triggerError = error ?? invalid;
|
|
10851
11027
|
const describedBy = error && !hideErrorMessage ? errorId : void 0;
|
|
10852
11028
|
const activeOptionId = highlightedIndex >= 0 ? getOptionId(reactId, highlightedIndex) : void 0;
|
|
10853
11029
|
useOutsideClick(containerRef, open && !isMobile ? () => closeSelect() : null);
|
|
10854
11030
|
React39.useEffect(() => {
|
|
11031
|
+
if (isBlocked) {
|
|
11032
|
+
setSelectOpen(false);
|
|
11033
|
+
return;
|
|
11034
|
+
}
|
|
10855
11035
|
if (!open) return;
|
|
10856
11036
|
const frameId = window.requestAnimationFrame(() => {
|
|
10857
11037
|
inputRef.current?.focus();
|
|
@@ -10859,7 +11039,7 @@ var SearchableSelectInternal = ({
|
|
|
10859
11039
|
return () => {
|
|
10860
11040
|
window.cancelAnimationFrame(frameId);
|
|
10861
11041
|
};
|
|
10862
|
-
}, [open]);
|
|
11042
|
+
}, [isBlocked, open]);
|
|
10863
11043
|
React39.useEffect(() => {
|
|
10864
11044
|
if (!open) {
|
|
10865
11045
|
setHighlightedIndex(-1);
|
|
@@ -10880,7 +11060,7 @@ var SearchableSelectInternal = ({
|
|
|
10880
11060
|
}
|
|
10881
11061
|
}
|
|
10882
11062
|
function openSelect() {
|
|
10883
|
-
if (
|
|
11063
|
+
if (isBlocked) return;
|
|
10884
11064
|
setSelectOpen(true);
|
|
10885
11065
|
}
|
|
10886
11066
|
function closeSelect() {
|
|
@@ -10893,7 +11073,7 @@ var SearchableSelectInternal = ({
|
|
|
10893
11073
|
onSearchChange?.(nextValue);
|
|
10894
11074
|
}
|
|
10895
11075
|
function handleSelect(option) {
|
|
10896
|
-
if (
|
|
11076
|
+
if (isBlocked || option.isDisabled) return;
|
|
10897
11077
|
onChange(option);
|
|
10898
11078
|
setSelectOpen(false, { restoreFocus: true });
|
|
10899
11079
|
}
|
|
@@ -10905,7 +11085,7 @@ var SearchableSelectInternal = ({
|
|
|
10905
11085
|
}
|
|
10906
11086
|
}
|
|
10907
11087
|
function handleTriggerKeyDown(event) {
|
|
10908
|
-
if (
|
|
11088
|
+
if (isBlocked) return;
|
|
10909
11089
|
if (event.key === "Enter" || event.key === " " || event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
10910
11090
|
event.preventDefault();
|
|
10911
11091
|
openSelect();
|
|
@@ -10984,7 +11164,11 @@ var SearchableSelectInternal = ({
|
|
|
10984
11164
|
valueText: valueLabel,
|
|
10985
11165
|
placeholder: helperText,
|
|
10986
11166
|
describedBy,
|
|
10987
|
-
error,
|
|
11167
|
+
error: triggerError,
|
|
11168
|
+
loading,
|
|
11169
|
+
optional,
|
|
11170
|
+
tooltip,
|
|
11171
|
+
forceLabelText: Boolean(optional) || Boolean(tooltip),
|
|
10988
11172
|
hideErrorMessage,
|
|
10989
11173
|
disabled,
|
|
10990
11174
|
onClick: () => {
|
|
@@ -10996,7 +11180,7 @@ var SearchableSelectInternal = ({
|
|
|
10996
11180
|
},
|
|
10997
11181
|
onKeyDown: handleTriggerKeyDown,
|
|
10998
11182
|
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
10999
|
-
|
|
11183
|
+
import_lucide_react46.ChevronDown,
|
|
11000
11184
|
{
|
|
11001
11185
|
className: cn(
|
|
11002
11186
|
"h-6 w-6 text-[#1F1F1B] transition-transform",
|
|
@@ -11011,6 +11195,7 @@ var SearchableSelectInternal = ({
|
|
|
11011
11195
|
{
|
|
11012
11196
|
open,
|
|
11013
11197
|
onOpenChange: (nextOpen) => {
|
|
11198
|
+
if (isBlocked && nextOpen) return;
|
|
11014
11199
|
if (nextOpen) {
|
|
11015
11200
|
setSelectOpen(true);
|
|
11016
11201
|
return;
|
|
@@ -11093,7 +11278,7 @@ function SearchableSelectContent({
|
|
|
11093
11278
|
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "p-2", children: [
|
|
11094
11279
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "relative mb-2", children: [
|
|
11095
11280
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
11096
|
-
|
|
11281
|
+
import_lucide_react46.Search,
|
|
11097
11282
|
{
|
|
11098
11283
|
"aria-hidden": "true",
|
|
11099
11284
|
className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 text-[#9696B9]"
|