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