@chekinapp/ui 0.0.3 → 0.0.4
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 +343 -329
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +347 -333
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5303,37 +5303,42 @@ var SelectLabel = React19.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5303
5303
|
}
|
|
5304
5304
|
));
|
|
5305
5305
|
SelectLabel.displayName = "SelectLabel";
|
|
5306
|
-
var Select = (
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
}
|
|
5306
|
+
var Select = React19.forwardRef(
|
|
5307
|
+
({
|
|
5308
|
+
placeholder,
|
|
5309
|
+
label,
|
|
5310
|
+
supportingText,
|
|
5311
|
+
errorText,
|
|
5312
|
+
containerClassName,
|
|
5313
|
+
triggerClassName,
|
|
5314
|
+
children,
|
|
5315
|
+
...props
|
|
5316
|
+
}, ref) => {
|
|
5317
|
+
const reactId = React19.useId();
|
|
5318
|
+
const triggerId = props.name ?? reactId;
|
|
5319
|
+
const internalRef = React19.useRef(null);
|
|
5320
|
+
const combinedRef = useCombinedRef(ref, internalRef);
|
|
5321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: cn("flex flex-col gap-chekin-1 w-[300px]", containerClassName), children: [
|
|
5322
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
5323
|
+
"label",
|
|
5324
|
+
{
|
|
5325
|
+
htmlFor: triggerId,
|
|
5326
|
+
className: "text-chekin-navy font-sans font-medium text-[14px] leading-5",
|
|
5327
|
+
children: label
|
|
5328
|
+
}
|
|
5329
|
+
),
|
|
5330
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(SelectRoot, { ...props, children: [
|
|
5331
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectTrigger, { ref: combinedRef, id: triggerId, className: triggerClassName, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(RadixSelect.Value, { placeholder }) }),
|
|
5332
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectContent, { children })
|
|
5333
|
+
] }),
|
|
5334
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex justify-between min-h-[15px]", children: [
|
|
5335
|
+
supportingText && !errorText && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "text-chekin-gray-2 font-sans italic text-[12px] leading-[15px]", children: supportingText }),
|
|
5336
|
+
errorText && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "ml-auto text-chekin-red font-sans font-medium text-[12px] leading-4 text-right", children: errorText })
|
|
5337
|
+
] })
|
|
5338
|
+
] });
|
|
5339
|
+
}
|
|
5340
|
+
);
|
|
5341
|
+
Select.displayName = "Select";
|
|
5337
5342
|
|
|
5338
5343
|
// src/pagination/Pagination.tsx
|
|
5339
5344
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
@@ -9108,154 +9113,158 @@ FieldTrigger.displayName = "FieldTrigger";
|
|
|
9108
9113
|
// src/datepicker/DatePicker.tsx
|
|
9109
9114
|
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
9110
9115
|
var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
onChange,
|
|
9118
|
-
placeholder = "Select a date",
|
|
9119
|
-
disabled,
|
|
9120
|
-
error,
|
|
9121
|
-
className,
|
|
9122
|
-
name,
|
|
9123
|
-
minDate,
|
|
9124
|
-
maxDate,
|
|
9125
|
-
locale = "en-US",
|
|
9126
|
-
mobileTitle,
|
|
9127
|
-
doneLabel = "Done",
|
|
9128
|
-
formatValue = formatDateValue
|
|
9129
|
-
}) {
|
|
9130
|
-
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
9131
|
-
const [isOpen, setIsOpen] = React30.useState(false);
|
|
9132
|
-
const triggerId = React30.useId();
|
|
9133
|
-
const pickerId = React30.useId();
|
|
9134
|
-
const labelId = React30.useId();
|
|
9135
|
-
const valueId = React30.useId();
|
|
9136
|
-
const helperTextId = React30.useId();
|
|
9137
|
-
const errorId = React30.useId();
|
|
9138
|
-
const triggerRef = React30.useRef(null);
|
|
9139
|
-
const monthLabels = React30.useMemo(() => getMonthLabels(locale), [locale]);
|
|
9140
|
-
const resolvedMinDate = React30.useMemo(() => minDate ?? DEFAULT_MIN_DATE, [minDate]);
|
|
9141
|
-
const resolvedMaxDate = React30.useMemo(() => maxDate ?? /* @__PURE__ */ new Date(), [maxDate]);
|
|
9142
|
-
const resolvedValue = React30.useMemo(
|
|
9143
|
-
() => value ? clampDate(value, resolvedMinDate, resolvedMaxDate) : null,
|
|
9144
|
-
[resolvedMaxDate, resolvedMinDate, value]
|
|
9145
|
-
);
|
|
9146
|
-
const hasValue = Boolean(resolvedValue);
|
|
9147
|
-
const {
|
|
9148
|
-
dayIndex,
|
|
9149
|
-
dayListRef,
|
|
9150
|
-
dayScrollTop,
|
|
9151
|
-
days,
|
|
9152
|
-
draftDate,
|
|
9153
|
-
handleColumnKeyDown,
|
|
9154
|
-
handleColumnScroll,
|
|
9155
|
-
handleOptionSelect,
|
|
9156
|
-
monthIndex,
|
|
9157
|
-
monthListRef,
|
|
9158
|
-
months,
|
|
9159
|
-
monthScrollTop,
|
|
9160
|
-
yearIndex,
|
|
9161
|
-
yearListRef,
|
|
9162
|
-
yearScrollTop,
|
|
9163
|
-
years
|
|
9164
|
-
} = useDatePickerWheel({
|
|
9165
|
-
isOpen,
|
|
9166
|
-
value: resolvedValue,
|
|
9116
|
+
var DatePicker = React30.forwardRef(
|
|
9117
|
+
({
|
|
9118
|
+
variant = "default",
|
|
9119
|
+
label,
|
|
9120
|
+
topLabel,
|
|
9121
|
+
value,
|
|
9167
9122
|
defaultValue,
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
},
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
(
|
|
9123
|
+
onChange,
|
|
9124
|
+
placeholder = "Select a date",
|
|
9125
|
+
disabled,
|
|
9126
|
+
error,
|
|
9127
|
+
className,
|
|
9128
|
+
name,
|
|
9129
|
+
minDate,
|
|
9130
|
+
maxDate,
|
|
9131
|
+
locale = "en-US",
|
|
9132
|
+
mobileTitle,
|
|
9133
|
+
doneLabel = "Done",
|
|
9134
|
+
formatValue = formatDateValue
|
|
9135
|
+
}, ref) => {
|
|
9136
|
+
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
9137
|
+
const [isOpen, setIsOpen] = React30.useState(false);
|
|
9138
|
+
const triggerId = React30.useId();
|
|
9139
|
+
const pickerId = React30.useId();
|
|
9140
|
+
const labelId = React30.useId();
|
|
9141
|
+
const valueId = React30.useId();
|
|
9142
|
+
const helperTextId = React30.useId();
|
|
9143
|
+
const errorId = React30.useId();
|
|
9144
|
+
const internalRef = React30.useRef(null);
|
|
9145
|
+
const combinedRef = useCombinedRef(ref, internalRef);
|
|
9146
|
+
const monthLabels = React30.useMemo(() => getMonthLabels(locale), [locale]);
|
|
9147
|
+
const resolvedMinDate = React30.useMemo(() => minDate ?? DEFAULT_MIN_DATE, [minDate]);
|
|
9148
|
+
const resolvedMaxDate = React30.useMemo(() => maxDate ?? /* @__PURE__ */ new Date(), [maxDate]);
|
|
9149
|
+
const resolvedValue = React30.useMemo(
|
|
9150
|
+
() => value ? clampDate(value, resolvedMinDate, resolvedMaxDate) : null,
|
|
9151
|
+
[resolvedMaxDate, resolvedMinDate, value]
|
|
9152
|
+
);
|
|
9153
|
+
const hasValue = Boolean(resolvedValue);
|
|
9154
|
+
const {
|
|
9155
|
+
dayIndex,
|
|
9156
|
+
dayListRef,
|
|
9157
|
+
dayScrollTop,
|
|
9158
|
+
days,
|
|
9159
|
+
draftDate,
|
|
9160
|
+
handleColumnKeyDown,
|
|
9161
|
+
handleColumnScroll,
|
|
9162
|
+
handleOptionSelect,
|
|
9163
|
+
monthIndex,
|
|
9164
|
+
monthListRef,
|
|
9165
|
+
months,
|
|
9166
|
+
monthScrollTop,
|
|
9167
|
+
yearIndex,
|
|
9168
|
+
yearListRef,
|
|
9169
|
+
yearScrollTop,
|
|
9170
|
+
years
|
|
9171
|
+
} = useDatePickerWheel({
|
|
9172
|
+
isOpen,
|
|
9173
|
+
value: resolvedValue,
|
|
9174
|
+
defaultValue,
|
|
9175
|
+
minDate: resolvedMinDate,
|
|
9176
|
+
maxDate: resolvedMaxDate
|
|
9177
|
+
});
|
|
9178
|
+
const handleOpenChange = React30.useCallback((nextOpen) => {
|
|
9179
|
+
setIsOpen(nextOpen);
|
|
9180
|
+
if (!nextOpen) {
|
|
9181
|
+
internalRef.current?.focus();
|
|
9182
|
+
}
|
|
9183
|
+
}, []);
|
|
9184
|
+
const handleDone = React30.useCallback(() => {
|
|
9185
|
+
onChange(clampDate(draftDate, resolvedMinDate, resolvedMaxDate));
|
|
9186
|
+
handleOpenChange(false);
|
|
9187
|
+
}, [draftDate, handleOpenChange, onChange, resolvedMaxDate, resolvedMinDate]);
|
|
9188
|
+
const handleTriggerClick = React30.useCallback(() => {
|
|
9187
9189
|
if (disabled) return;
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
9207
|
-
|
|
9208
|
-
|
|
9209
|
-
|
|
9210
|
-
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
|
|
9214
|
-
|
|
9215
|
-
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
|
|
9240
|
-
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9190
|
+
setIsOpen(true);
|
|
9191
|
+
}, [disabled]);
|
|
9192
|
+
const handleTriggerKeyDown = React30.useCallback(
|
|
9193
|
+
(event) => {
|
|
9194
|
+
if (disabled) return;
|
|
9195
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
9196
|
+
event.preventDefault();
|
|
9197
|
+
setIsOpen(true);
|
|
9198
|
+
}
|
|
9199
|
+
},
|
|
9200
|
+
[disabled]
|
|
9201
|
+
);
|
|
9202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: cn("relative w-full max-w-[425px]", className), children: [
|
|
9203
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9204
|
+
"input",
|
|
9205
|
+
{
|
|
9206
|
+
type: "hidden",
|
|
9207
|
+
name,
|
|
9208
|
+
value: resolvedValue ? formatDateInputValue(resolvedValue) : ""
|
|
9209
|
+
}
|
|
9210
|
+
),
|
|
9211
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9212
|
+
FieldTrigger,
|
|
9213
|
+
{
|
|
9214
|
+
id: triggerId,
|
|
9215
|
+
ref: combinedRef,
|
|
9216
|
+
variant,
|
|
9217
|
+
label,
|
|
9218
|
+
topLabel,
|
|
9219
|
+
labelId,
|
|
9220
|
+
valueId: hasValue ? valueId : void 0,
|
|
9221
|
+
helperTextId: !hasValue ? helperTextId : void 0,
|
|
9222
|
+
errorId: error ? errorId : void 0,
|
|
9223
|
+
describedBy: error ? errorId : void 0,
|
|
9224
|
+
labelText: topLabel ? placeholder : void 0,
|
|
9225
|
+
valueText: resolvedValue ? formatValue(resolvedValue) : void 0,
|
|
9226
|
+
placeholder,
|
|
9227
|
+
disabled,
|
|
9228
|
+
error,
|
|
9229
|
+
"aria-haspopup": "dialog",
|
|
9230
|
+
"aria-expanded": isOpen,
|
|
9231
|
+
onClick: handleTriggerClick,
|
|
9232
|
+
onKeyDown: handleTriggerKeyDown,
|
|
9233
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_lucide_react41.Calendar, { className: "h-5 w-5 text-[#1F1F1B]", strokeWidth: 2 })
|
|
9234
|
+
}
|
|
9235
|
+
),
|
|
9236
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
9237
|
+
DatePickerContent,
|
|
9238
|
+
{
|
|
9239
|
+
baseId: pickerId,
|
|
9240
|
+
open: isOpen,
|
|
9241
|
+
isMobile,
|
|
9242
|
+
label,
|
|
9243
|
+
title: mobileTitle ?? label,
|
|
9244
|
+
doneLabel,
|
|
9245
|
+
monthLabels: months.map((month) => monthLabels[month] ?? ""),
|
|
9246
|
+
days,
|
|
9247
|
+
years,
|
|
9248
|
+
monthIndex,
|
|
9249
|
+
dayIndex,
|
|
9250
|
+
yearIndex,
|
|
9251
|
+
monthScrollTop,
|
|
9252
|
+
dayScrollTop,
|
|
9253
|
+
yearScrollTop,
|
|
9254
|
+
monthListRef,
|
|
9255
|
+
dayListRef,
|
|
9256
|
+
yearListRef,
|
|
9257
|
+
onOpenChange: handleOpenChange,
|
|
9258
|
+
onDone: handleDone,
|
|
9259
|
+
onColumnScroll: handleColumnScroll,
|
|
9260
|
+
onColumnKeyDown: handleColumnKeyDown,
|
|
9261
|
+
onOptionSelect: handleOptionSelect
|
|
9262
|
+
}
|
|
9263
|
+
)
|
|
9264
|
+
] });
|
|
9265
|
+
}
|
|
9266
|
+
);
|
|
9267
|
+
DatePicker.displayName = "DatePicker";
|
|
9259
9268
|
|
|
9260
9269
|
// src/responsive-sheet/ResponsiveSheet.tsx
|
|
9261
9270
|
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
@@ -10316,7 +10325,7 @@ function useOutsideClick(elementRef, onOutsideClick, nested) {
|
|
|
10316
10325
|
|
|
10317
10326
|
// src/airbnb/select/Select.tsx
|
|
10318
10327
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
10319
|
-
|
|
10328
|
+
var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
|
|
10320
10329
|
options,
|
|
10321
10330
|
value,
|
|
10322
10331
|
onChange,
|
|
@@ -10336,7 +10345,7 @@ function AirbnbSelect({
|
|
|
10336
10345
|
mobileTitle,
|
|
10337
10346
|
name,
|
|
10338
10347
|
noOptionsMessage
|
|
10339
|
-
}) {
|
|
10348
|
+
}, ref) {
|
|
10340
10349
|
const { isMatch: isMobile } = useScreenResize(DEVICE.mobileXL);
|
|
10341
10350
|
const [isOpen, setIsOpen] = React36.useState(false);
|
|
10342
10351
|
const containerRef = React36.useRef(null);
|
|
@@ -10374,7 +10383,7 @@ function AirbnbSelect({
|
|
|
10374
10383
|
listRef: desktopListRef,
|
|
10375
10384
|
setHighlightedIndex,
|
|
10376
10385
|
setOptionRef,
|
|
10377
|
-
triggerRef,
|
|
10386
|
+
triggerRef: desktopTriggerRef,
|
|
10378
10387
|
focusTrigger,
|
|
10379
10388
|
handleSelect: handleDesktopSelect,
|
|
10380
10389
|
handleMenuKeyDown,
|
|
@@ -10387,6 +10396,7 @@ function AirbnbSelect({
|
|
|
10387
10396
|
disabled,
|
|
10388
10397
|
onChange
|
|
10389
10398
|
});
|
|
10399
|
+
const combinedRef = useCombinedRef(ref, desktopTriggerRef);
|
|
10390
10400
|
const activeMobileIndex = getOptionIndex(options, pendingValue);
|
|
10391
10401
|
const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
|
|
10392
10402
|
useOutsideClick(containerRef, isOpen && !isMobile ? () => setIsOpen(false) : null);
|
|
@@ -10473,7 +10483,7 @@ function AirbnbSelect({
|
|
|
10473
10483
|
handleMobileOpenChange(false);
|
|
10474
10484
|
}
|
|
10475
10485
|
};
|
|
10476
|
-
return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { ref: containerRef, className: cn("relative w-full max-w-[
|
|
10486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
|
|
10477
10487
|
name && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
10478
10488
|
renderTrigger ? renderTrigger({
|
|
10479
10489
|
id: triggerId,
|
|
@@ -10488,14 +10498,14 @@ function AirbnbSelect({
|
|
|
10488
10498
|
error,
|
|
10489
10499
|
listboxId,
|
|
10490
10500
|
describedBy,
|
|
10491
|
-
triggerRef,
|
|
10501
|
+
triggerRef: combinedRef,
|
|
10492
10502
|
onClick: handleTriggerClick,
|
|
10493
10503
|
onKeyDown: handleRootTriggerKeyDown
|
|
10494
10504
|
}) : /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
10495
10505
|
SelectTrigger2,
|
|
10496
10506
|
{
|
|
10497
10507
|
id: triggerId,
|
|
10498
|
-
ref:
|
|
10508
|
+
ref: combinedRef,
|
|
10499
10509
|
open: isOpen,
|
|
10500
10510
|
variant,
|
|
10501
10511
|
label,
|
|
@@ -10569,160 +10579,164 @@ function AirbnbSelect({
|
|
|
10569
10579
|
}
|
|
10570
10580
|
)
|
|
10571
10581
|
] });
|
|
10572
|
-
}
|
|
10582
|
+
});
|
|
10573
10583
|
|
|
10574
10584
|
// src/airbnb/phone-field/PhoneField.tsx
|
|
10575
10585
|
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
10576
|
-
|
|
10577
|
-
|
|
10578
|
-
|
|
10579
|
-
|
|
10580
|
-
|
|
10581
|
-
|
|
10582
|
-
|
|
10583
|
-
|
|
10584
|
-
|
|
10585
|
-
|
|
10586
|
-
|
|
10587
|
-
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
|
|
10593
|
-
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
type: "hidden",
|
|
10613
|
-
name: codeName,
|
|
10614
|
-
value: value?.code ?? "",
|
|
10615
|
-
disabled
|
|
10616
|
-
}
|
|
10617
|
-
),
|
|
10618
|
-
numberName && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10619
|
-
"input",
|
|
10620
|
-
{
|
|
10621
|
-
type: "hidden",
|
|
10622
|
-
name: numberName,
|
|
10623
|
-
value: value?.number ?? "",
|
|
10624
|
-
disabled
|
|
10625
|
-
}
|
|
10626
|
-
),
|
|
10627
|
-
topLabel && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10628
|
-
"label",
|
|
10629
|
-
{
|
|
10630
|
-
htmlFor: inputId,
|
|
10631
|
-
className: "mb-3 block text-[16px] font-medium leading-5 text-[#1F1F1B]",
|
|
10632
|
-
children: topLabel
|
|
10633
|
-
}
|
|
10634
|
-
),
|
|
10635
|
-
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "flex items-stretch", children: [
|
|
10636
|
-
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10637
|
-
AirbnbSelect,
|
|
10586
|
+
var PhoneField = React37.forwardRef(
|
|
10587
|
+
({
|
|
10588
|
+
variant = "default",
|
|
10589
|
+
label,
|
|
10590
|
+
topLabel,
|
|
10591
|
+
value,
|
|
10592
|
+
onChange,
|
|
10593
|
+
options,
|
|
10594
|
+
placeholder = "Phone number",
|
|
10595
|
+
disabled,
|
|
10596
|
+
error,
|
|
10597
|
+
className,
|
|
10598
|
+
name,
|
|
10599
|
+
codeName,
|
|
10600
|
+
numberName,
|
|
10601
|
+
mobileTitle,
|
|
10602
|
+
codePlaceholder = "+00"
|
|
10603
|
+
}, ref) => {
|
|
10604
|
+
const inputId = React37.useId();
|
|
10605
|
+
const codeOptions = React37.useMemo(
|
|
10606
|
+
() => options.map((option) => ({
|
|
10607
|
+
value: option.value,
|
|
10608
|
+
label: option.label,
|
|
10609
|
+
disabled: option.disabled
|
|
10610
|
+
})),
|
|
10611
|
+
[options]
|
|
10612
|
+
);
|
|
10613
|
+
const selectedCodeOption = React37.useMemo(
|
|
10614
|
+
() => codeOptions.find((option) => option.value === value?.code) ?? null,
|
|
10615
|
+
[codeOptions, value?.code]
|
|
10616
|
+
);
|
|
10617
|
+
const combinedValue = value?.code || value?.number ? `${value?.code ?? ""}${value?.number ?? ""}` : "";
|
|
10618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: cn("w-full max-w-[425px]", className), children: [
|
|
10619
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
10620
|
+
codeName && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10621
|
+
"input",
|
|
10638
10622
|
{
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
value:
|
|
10642
|
-
|
|
10643
|
-
code: String(option.value),
|
|
10644
|
-
number: value?.number ?? ""
|
|
10645
|
-
}),
|
|
10646
|
-
label: `${label} country code`,
|
|
10647
|
-
placeholder: codePlaceholder,
|
|
10648
|
-
disabled,
|
|
10649
|
-
className: "max-w-none shrink-0 basis-[96px]",
|
|
10650
|
-
mobileTitle: mobileTitle ?? "Select country code",
|
|
10651
|
-
dropdownClassName: "right-auto w-[280px]",
|
|
10652
|
-
getValueLabel: (option) => String(option.value),
|
|
10653
|
-
renderTrigger: ({
|
|
10654
|
-
id,
|
|
10655
|
-
open,
|
|
10656
|
-
variant: selectVariant,
|
|
10657
|
-
disabled: triggerDisabled,
|
|
10658
|
-
listboxId,
|
|
10659
|
-
triggerRef,
|
|
10660
|
-
onClick,
|
|
10661
|
-
onKeyDown,
|
|
10662
|
-
valueLabel
|
|
10663
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
|
|
10664
|
-
"button",
|
|
10665
|
-
{
|
|
10666
|
-
id,
|
|
10667
|
-
ref: triggerRef,
|
|
10668
|
-
type: "button",
|
|
10669
|
-
"aria-label": `${label} country code`,
|
|
10670
|
-
"aria-haspopup": "listbox",
|
|
10671
|
-
"aria-expanded": open,
|
|
10672
|
-
"aria-controls": listboxId,
|
|
10673
|
-
disabled: triggerDisabled,
|
|
10674
|
-
onClick,
|
|
10675
|
-
onKeyDown,
|
|
10676
|
-
className: cn(
|
|
10677
|
-
"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",
|
|
10678
|
-
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]",
|
|
10679
|
-
error ? "border-[var(--status-danger)] bg-[#F2F2F2] text-[var(--status-danger)]" : selectVariant === "airbnb" ? "border-[#8C8C8C] bg-[#F4F4F2] text-[#1F1F1B]" : "border-[#A8A8A4] bg-white text-[#1F1F1B]",
|
|
10680
|
-
triggerDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
10681
|
-
),
|
|
10682
|
-
children: [
|
|
10683
|
-
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { children: valueLabel ?? codePlaceholder }),
|
|
10684
|
-
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10685
|
-
import_lucide_react43.ChevronDown,
|
|
10686
|
-
{
|
|
10687
|
-
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
10688
|
-
strokeWidth: 2
|
|
10689
|
-
}
|
|
10690
|
-
)
|
|
10691
|
-
]
|
|
10692
|
-
}
|
|
10693
|
-
)
|
|
10623
|
+
type: "hidden",
|
|
10624
|
+
name: codeName,
|
|
10625
|
+
value: value?.code ?? "",
|
|
10626
|
+
disabled
|
|
10694
10627
|
}
|
|
10695
10628
|
),
|
|
10696
|
-
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10697
|
-
|
|
10629
|
+
numberName && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10630
|
+
"input",
|
|
10698
10631
|
{
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
type: "tel",
|
|
10702
|
-
inputMode: "tel",
|
|
10703
|
-
label,
|
|
10704
|
-
helperText: placeholder,
|
|
10632
|
+
type: "hidden",
|
|
10633
|
+
name: numberName,
|
|
10705
10634
|
value: value?.number ?? "",
|
|
10706
|
-
|
|
10707
|
-
disabled,
|
|
10708
|
-
error,
|
|
10709
|
-
renderErrorMessage: false,
|
|
10710
|
-
wrapperClassName: "min-w-0 flex-1",
|
|
10711
|
-
fieldClassName: cn(
|
|
10712
|
-
variant === "airbnb" ? "min-h-[60px] rounded-l-none rounded-r-[16px] border-l-0" : "rounded-l-none rounded-r-[10px] border-l-0"
|
|
10713
|
-
),
|
|
10714
|
-
contentClassName: cn(variant === "airbnb" ? "h-[40px] py-2" : "h-[48px]"),
|
|
10715
|
-
inputClassName: "text-[16px] leading-7",
|
|
10716
|
-
onChange: (event) => onChange({
|
|
10717
|
-
code: value?.code ?? "",
|
|
10718
|
-
number: event.target.value
|
|
10719
|
-
})
|
|
10635
|
+
disabled
|
|
10720
10636
|
}
|
|
10721
|
-
)
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10637
|
+
),
|
|
10638
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10639
|
+
"label",
|
|
10640
|
+
{
|
|
10641
|
+
htmlFor: inputId,
|
|
10642
|
+
className: "mb-3 block text-[16px] font-medium leading-5 text-[#1F1F1B]",
|
|
10643
|
+
children: topLabel
|
|
10644
|
+
}
|
|
10645
|
+
),
|
|
10646
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "flex items-stretch", children: [
|
|
10647
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10648
|
+
AirbnbSelect,
|
|
10649
|
+
{
|
|
10650
|
+
ref,
|
|
10651
|
+
variant,
|
|
10652
|
+
options: codeOptions,
|
|
10653
|
+
value: selectedCodeOption,
|
|
10654
|
+
onChange: (option) => onChange({
|
|
10655
|
+
code: String(option.value),
|
|
10656
|
+
number: value?.number ?? ""
|
|
10657
|
+
}),
|
|
10658
|
+
label: `${label} country code`,
|
|
10659
|
+
placeholder: codePlaceholder,
|
|
10660
|
+
disabled,
|
|
10661
|
+
className: "max-w-none shrink-0 basis-[96px]",
|
|
10662
|
+
mobileTitle: mobileTitle ?? "Select country code",
|
|
10663
|
+
dropdownClassName: "right-auto w-[280px]",
|
|
10664
|
+
getValueLabel: (option) => String(option.value),
|
|
10665
|
+
renderTrigger: ({
|
|
10666
|
+
id,
|
|
10667
|
+
open,
|
|
10668
|
+
variant: selectVariant,
|
|
10669
|
+
disabled: triggerDisabled,
|
|
10670
|
+
listboxId,
|
|
10671
|
+
triggerRef,
|
|
10672
|
+
onClick,
|
|
10673
|
+
onKeyDown,
|
|
10674
|
+
valueLabel
|
|
10675
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
|
|
10676
|
+
"button",
|
|
10677
|
+
{
|
|
10678
|
+
id,
|
|
10679
|
+
ref: triggerRef,
|
|
10680
|
+
type: "button",
|
|
10681
|
+
"aria-label": `${label} country code`,
|
|
10682
|
+
"aria-haspopup": "listbox",
|
|
10683
|
+
"aria-expanded": open,
|
|
10684
|
+
"aria-controls": listboxId,
|
|
10685
|
+
disabled: triggerDisabled,
|
|
10686
|
+
onClick,
|
|
10687
|
+
onKeyDown,
|
|
10688
|
+
className: cn(
|
|
10689
|
+
"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
|
+
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
|
+
error ? "border-[var(--status-danger)] bg-[#F2F2F2] text-[var(--status-danger)]" : selectVariant === "airbnb" ? "border-[#8C8C8C] bg-[#F4F4F2] text-[#1F1F1B]" : "border-[#A8A8A4] bg-white text-[#1F1F1B]",
|
|
10692
|
+
triggerDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
10693
|
+
),
|
|
10694
|
+
children: [
|
|
10695
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { children: valueLabel ?? codePlaceholder }),
|
|
10696
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10697
|
+
import_lucide_react43.ChevronDown,
|
|
10698
|
+
{
|
|
10699
|
+
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
10700
|
+
strokeWidth: 2
|
|
10701
|
+
}
|
|
10702
|
+
)
|
|
10703
|
+
]
|
|
10704
|
+
}
|
|
10705
|
+
)
|
|
10706
|
+
}
|
|
10707
|
+
),
|
|
10708
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
10709
|
+
AirbnbInput,
|
|
10710
|
+
{
|
|
10711
|
+
id: inputId,
|
|
10712
|
+
variant,
|
|
10713
|
+
type: "tel",
|
|
10714
|
+
inputMode: "tel",
|
|
10715
|
+
label,
|
|
10716
|
+
helperText: placeholder,
|
|
10717
|
+
value: value?.number ?? "",
|
|
10718
|
+
placeholder,
|
|
10719
|
+
disabled,
|
|
10720
|
+
error,
|
|
10721
|
+
renderErrorMessage: false,
|
|
10722
|
+
wrapperClassName: "min-w-0 flex-1",
|
|
10723
|
+
fieldClassName: cn(
|
|
10724
|
+
variant === "airbnb" ? "min-h-[60px] rounded-l-none rounded-r-[16px] border-l-0" : "rounded-l-none rounded-r-[10px] border-l-0"
|
|
10725
|
+
),
|
|
10726
|
+
contentClassName: cn(variant === "airbnb" ? "h-[40px] py-2" : "h-[48px]"),
|
|
10727
|
+
inputClassName: "text-[16px] leading-7",
|
|
10728
|
+
onChange: (event) => onChange({
|
|
10729
|
+
code: value?.code ?? "",
|
|
10730
|
+
number: event.target.value
|
|
10731
|
+
})
|
|
10732
|
+
}
|
|
10733
|
+
)
|
|
10734
|
+
] }),
|
|
10735
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(FieldErrorMessage, { message: error })
|
|
10736
|
+
] });
|
|
10737
|
+
}
|
|
10738
|
+
);
|
|
10739
|
+
PhoneField.displayName = "PhoneField";
|
|
10726
10740
|
|
|
10727
10741
|
// src/airbnb/search-input/SearchInput.tsx
|
|
10728
10742
|
var React38 = __toESM(require("react"), 1);
|
|
@@ -10949,7 +10963,7 @@ var SearchableSelectInternal = ({
|
|
|
10949
10963
|
}
|
|
10950
10964
|
);
|
|
10951
10965
|
React39.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
10952
|
-
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { ref: containerRef, className: cn("relative w-full max-w-[
|
|
10966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
|
|
10953
10967
|
name && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
10954
10968
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
10955
10969
|
FieldTrigger,
|