@chekinapp/ui 0.0.116 → 0.0.118
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 +170 -154
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -15
- package/dist/index.d.ts +5 -15
- package/dist/index.js +171 -155
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -12873,9 +12873,9 @@ var import_react_i18next28 = require("react-i18next");
|
|
|
12873
12873
|
|
|
12874
12874
|
// src/dashboard/_select-internals/utils.ts
|
|
12875
12875
|
function isOptionGroup(item) {
|
|
12876
|
-
return
|
|
12877
|
-
|
|
12878
|
-
);
|
|
12876
|
+
if (!item || typeof item !== "object") return false;
|
|
12877
|
+
if ("value" in item) return false;
|
|
12878
|
+
return Array.isArray(item.options);
|
|
12879
12879
|
}
|
|
12880
12880
|
function flattenGroupedOptions(items) {
|
|
12881
12881
|
if (!items) return [];
|
|
@@ -12986,7 +12986,7 @@ function DefaultOption(props) {
|
|
|
12986
12986
|
|
|
12987
12987
|
// src/dashboard/_select-internals/SelectMenu.tsx
|
|
12988
12988
|
var import_jsx_runtime148 = require("react/jsx-runtime");
|
|
12989
|
-
function buildMenuEntries(groupedOptions, options, formatGroupLabel) {
|
|
12989
|
+
function buildMenuEntries(groupedOptions, options, formatGroupLabel, listboxId) {
|
|
12990
12990
|
if (!groupedOptions || !groupedOptions.some((item) => isOptionGroup(item))) {
|
|
12991
12991
|
return options.map((option, index) => ({
|
|
12992
12992
|
kind: "option",
|
|
@@ -12995,38 +12995,39 @@ function buildMenuEntries(groupedOptions, options, formatGroupLabel) {
|
|
|
12995
12995
|
flatIndex: index
|
|
12996
12996
|
}));
|
|
12997
12997
|
}
|
|
12998
|
-
const
|
|
12999
|
-
options.forEach((option, index) => indexByOption.set(option, index));
|
|
12998
|
+
const visibleValues = new Set(options.map((option) => option.value));
|
|
13000
12999
|
const entries = [];
|
|
13000
|
+
let flatIndex = 0;
|
|
13001
13001
|
let groupCount = 0;
|
|
13002
13002
|
for (const item of groupedOptions) {
|
|
13003
13003
|
if (isOptionGroup(item)) {
|
|
13004
|
-
const visible =
|
|
13005
|
-
|
|
13006
|
-
|
|
13007
|
-
|
|
13008
|
-
kind: "group-label",
|
|
13009
|
-
key: `__group-${groupCount}`,
|
|
13010
|
-
label
|
|
13011
|
-
});
|
|
13012
|
-
groupCount += 1;
|
|
13013
|
-
for (const option of visible) {
|
|
13014
|
-
const flatIndex = indexByOption.get(option);
|
|
13015
|
-
entries.push({
|
|
13016
|
-
kind: "option",
|
|
13004
|
+
const visible = [];
|
|
13005
|
+
for (const option of item.options) {
|
|
13006
|
+
if (!visibleValues.has(option.value)) continue;
|
|
13007
|
+
visible.push({
|
|
13017
13008
|
key: `${String(option.value)}-${flatIndex}`,
|
|
13018
13009
|
option,
|
|
13019
13010
|
flatIndex
|
|
13020
13011
|
});
|
|
13012
|
+
flatIndex += 1;
|
|
13021
13013
|
}
|
|
13022
|
-
|
|
13023
|
-
|
|
13014
|
+
if (visible.length === 0) continue;
|
|
13015
|
+
entries.push({
|
|
13016
|
+
kind: "group",
|
|
13017
|
+
key: `__group-${groupCount}`,
|
|
13018
|
+
labelId: `${listboxId}-group-${groupCount}`,
|
|
13019
|
+
label: formatGroupLabel ? formatGroupLabel(item) : item.label,
|
|
13020
|
+
options: visible
|
|
13021
|
+
});
|
|
13022
|
+
groupCount += 1;
|
|
13023
|
+
} else if (visibleValues.has(item.value)) {
|
|
13024
13024
|
entries.push({
|
|
13025
13025
|
kind: "option",
|
|
13026
13026
|
key: `${String(item.value)}-${flatIndex}`,
|
|
13027
13027
|
option: item,
|
|
13028
13028
|
flatIndex
|
|
13029
13029
|
});
|
|
13030
|
+
flatIndex += 1;
|
|
13030
13031
|
}
|
|
13031
13032
|
}
|
|
13032
13033
|
return entries;
|
|
@@ -13070,9 +13071,37 @@ function SelectMenu({
|
|
|
13070
13071
|
[selectedValues, selectedValue]
|
|
13071
13072
|
);
|
|
13072
13073
|
const entries = React45.useMemo(
|
|
13073
|
-
() => buildMenuEntries(groupedOptions, options, formatGroupLabel),
|
|
13074
|
-
[groupedOptions, options, formatGroupLabel]
|
|
13074
|
+
() => buildMenuEntries(groupedOptions, options, formatGroupLabel, id),
|
|
13075
|
+
[groupedOptions, options, formatGroupLabel, id]
|
|
13075
13076
|
);
|
|
13077
|
+
const renderOption = (entry) => {
|
|
13078
|
+
const { option, flatIndex, key } = entry;
|
|
13079
|
+
const isSelected = isOptionSelected2 ? isOptionSelected2(option, selectedList) : isOptionSelected(option, selectedValue, selectedValues);
|
|
13080
|
+
const isHighlighted = flatIndex === highlightedIndex;
|
|
13081
|
+
const optionDisabled = Boolean(
|
|
13082
|
+
disabled || option.isDisabled || isOptionDisabled?.(option)
|
|
13083
|
+
);
|
|
13084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
|
|
13085
|
+
Option,
|
|
13086
|
+
{
|
|
13087
|
+
id: getOptionId2(flatIndex),
|
|
13088
|
+
option,
|
|
13089
|
+
index: flatIndex,
|
|
13090
|
+
isSelected,
|
|
13091
|
+
isHighlighted,
|
|
13092
|
+
isDisabled: optionDisabled,
|
|
13093
|
+
isLast: flatIndex === lastIndex,
|
|
13094
|
+
isMulti: Boolean(isMulti),
|
|
13095
|
+
onClick: onOptionClick,
|
|
13096
|
+
onHover: onOptionHover ?? (() => void 0),
|
|
13097
|
+
innerRef: (node) => selectedOptionRef?.(flatIndex, node),
|
|
13098
|
+
inputValue,
|
|
13099
|
+
selectedOptions: selectedList,
|
|
13100
|
+
formatOptionLabel
|
|
13101
|
+
},
|
|
13102
|
+
key
|
|
13103
|
+
);
|
|
13104
|
+
};
|
|
13076
13105
|
const wasAtBottomRef = React45.useRef(false);
|
|
13077
13106
|
const handleScroll = React45.useCallback(
|
|
13078
13107
|
(event) => {
|
|
@@ -13107,43 +13136,20 @@ function SelectMenu({
|
|
|
13107
13136
|
children: [
|
|
13108
13137
|
!hasOptions && (emptyContent ?? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "px-3 py-3 text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: emptyMessage })),
|
|
13109
13138
|
entries.map((entry) => {
|
|
13110
|
-
if (entry.kind === "group
|
|
13111
|
-
return /* @__PURE__ */ (0, import_jsx_runtime148.
|
|
13112
|
-
|
|
13113
|
-
|
|
13114
|
-
|
|
13115
|
-
|
|
13116
|
-
|
|
13117
|
-
|
|
13118
|
-
|
|
13119
|
-
|
|
13139
|
+
if (entry.kind === "group") {
|
|
13140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { role: "group", "aria-labelledby": entry.labelId, children: [
|
|
13141
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
|
|
13142
|
+
"div",
|
|
13143
|
+
{
|
|
13144
|
+
id: entry.labelId,
|
|
13145
|
+
className: "px-3 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-[var(--chekin-color-gray-1)]",
|
|
13146
|
+
children: entry.label
|
|
13147
|
+
}
|
|
13148
|
+
),
|
|
13149
|
+
entry.options.map(renderOption)
|
|
13150
|
+
] }, entry.key);
|
|
13120
13151
|
}
|
|
13121
|
-
|
|
13122
|
-
const isSelected = isOptionSelected2 ? isOptionSelected2(option, selectedList) : isOptionSelected(option, selectedValue, selectedValues);
|
|
13123
|
-
const isHighlighted = flatIndex === highlightedIndex;
|
|
13124
|
-
const optionDisabled = Boolean(
|
|
13125
|
-
disabled || option.isDisabled || isOptionDisabled?.(option)
|
|
13126
|
-
);
|
|
13127
|
-
return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
|
|
13128
|
-
Option,
|
|
13129
|
-
{
|
|
13130
|
-
id: getOptionId2(flatIndex),
|
|
13131
|
-
option,
|
|
13132
|
-
index: flatIndex,
|
|
13133
|
-
isSelected,
|
|
13134
|
-
isHighlighted,
|
|
13135
|
-
isDisabled: optionDisabled,
|
|
13136
|
-
isLast: flatIndex === lastIndex,
|
|
13137
|
-
isMulti: Boolean(isMulti),
|
|
13138
|
-
onClick: onOptionClick,
|
|
13139
|
-
onHover: onOptionHover ?? (() => void 0),
|
|
13140
|
-
innerRef: (node) => selectedOptionRef?.(flatIndex, node),
|
|
13141
|
-
inputValue,
|
|
13142
|
-
selectedOptions: selectedList,
|
|
13143
|
-
formatOptionLabel
|
|
13144
|
-
},
|
|
13145
|
-
entry.key
|
|
13146
|
-
);
|
|
13152
|
+
return renderOption(entry);
|
|
13147
13153
|
}),
|
|
13148
13154
|
footer
|
|
13149
13155
|
]
|
|
@@ -14672,7 +14678,14 @@ function InfiniteScrollSelectInternal(props, ref) {
|
|
|
14672
14678
|
if (synthetic) list = [synthetic, ...list];
|
|
14673
14679
|
}
|
|
14674
14680
|
return list;
|
|
14675
|
-
}, [
|
|
14681
|
+
}, [
|
|
14682
|
+
rawOptions,
|
|
14683
|
+
inputValue,
|
|
14684
|
+
filterOption,
|
|
14685
|
+
getFullSearchOption,
|
|
14686
|
+
rest.getValueLabel,
|
|
14687
|
+
props
|
|
14688
|
+
]);
|
|
14676
14689
|
const contextValue = React52.useMemo(
|
|
14677
14690
|
() => ({
|
|
14678
14691
|
canLoadMore,
|
|
@@ -15148,13 +15161,7 @@ function createCountTrigger(opts) {
|
|
|
15148
15161
|
|
|
15149
15162
|
// src/dashboard/select-checkboxes/SelectAllRow.tsx
|
|
15150
15163
|
var import_jsx_runtime169 = require("react/jsx-runtime");
|
|
15151
|
-
function SelectAllRow({
|
|
15152
|
-
label,
|
|
15153
|
-
checked,
|
|
15154
|
-
indeterminate,
|
|
15155
|
-
disabled,
|
|
15156
|
-
onToggle
|
|
15157
|
-
}) {
|
|
15164
|
+
function SelectAllRow({ label, checked, disabled, onToggle }) {
|
|
15158
15165
|
return /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)(
|
|
15159
15166
|
"button",
|
|
15160
15167
|
{
|
|
@@ -15169,7 +15176,7 @@ function SelectAllRow({
|
|
|
15169
15176
|
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
|
|
15170
15177
|
BaseCheckbox,
|
|
15171
15178
|
{
|
|
15172
|
-
checked
|
|
15179
|
+
checked,
|
|
15173
15180
|
disabled,
|
|
15174
15181
|
size: "s",
|
|
15175
15182
|
tabIndex: -1,
|
|
@@ -15205,7 +15212,6 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15205
15212
|
allowSelectAll = false,
|
|
15206
15213
|
selectAllLabel,
|
|
15207
15214
|
searchable = true,
|
|
15208
|
-
searchPlaceholder,
|
|
15209
15215
|
filterOption = defaultFilterOption,
|
|
15210
15216
|
closeMenuOnSelect = false,
|
|
15211
15217
|
onSearchChange,
|
|
@@ -15240,7 +15246,6 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15240
15246
|
return acc + (selected.some((s) => s.value === option.value) ? 1 : 0);
|
|
15241
15247
|
}, 0);
|
|
15242
15248
|
const allVisibleSelected = filteredFlat.length > 0 && visibleSelectedCount === filteredFlat.length;
|
|
15243
|
-
const someVisibleSelected = visibleSelectedCount > 0 && visibleSelectedCount < filteredFlat.length;
|
|
15244
15249
|
const handleToggleAll = React59.useCallback(() => {
|
|
15245
15250
|
if (allVisibleSelected) {
|
|
15246
15251
|
const visibleValues = new Set(filteredFlat.map((option) => option.value));
|
|
@@ -15276,7 +15281,6 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15276
15281
|
{
|
|
15277
15282
|
label: selectAllLabel ?? t("select_all", { defaultValue: "Select All" }),
|
|
15278
15283
|
checked: allVisibleSelected,
|
|
15279
|
-
indeterminate: someVisibleSelected,
|
|
15280
15284
|
onToggle: handleToggleAll
|
|
15281
15285
|
}
|
|
15282
15286
|
) : void 0;
|
|
@@ -18027,7 +18031,6 @@ var import_jsx_runtime184 = require("react/jsx-runtime");
|
|
|
18027
18031
|
var AirbnbFieldTrigger = React72.forwardRef(
|
|
18028
18032
|
({
|
|
18029
18033
|
as = "button",
|
|
18030
|
-
variant = "airbnb",
|
|
18031
18034
|
id,
|
|
18032
18035
|
label,
|
|
18033
18036
|
topLabel,
|
|
@@ -18080,7 +18083,6 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
18080
18083
|
)
|
|
18081
18084
|
] }) : visibleLabelText;
|
|
18082
18085
|
const animatedLabel = forceLabelText ? resolvedLabelText ?? placeholder : isRaised ? resolvedLabelText : label ?? placeholder;
|
|
18083
|
-
const isAirbnbVariant = variant === "airbnb";
|
|
18084
18086
|
const hasInvalidState = Boolean(error);
|
|
18085
18087
|
const errorMessage = typeof error === "string" ? error : void 0;
|
|
18086
18088
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
@@ -18095,11 +18097,11 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
18095
18097
|
)
|
|
18096
18098
|
] }) : void 0;
|
|
18097
18099
|
const sharedClasses = cn(
|
|
18098
|
-
"relative flex w-full items-center border bg-
|
|
18099
|
-
|
|
18100
|
-
|
|
18101
|
-
hasInvalidState ?
|
|
18102
|
-
disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" :
|
|
18100
|
+
"relative flex w-full items-center border bg-transparent text-left transition-colors focus-visible:outline-none",
|
|
18101
|
+
"rounded-[12px] border-[#8c8c8c] pl-4 pr-4 focus-visible:ring-2 focus-visible:ring-[#222222] focus-visible:ring-offset-2",
|
|
18102
|
+
isRaised ? "min-h-[60px]" : "h-[60px]",
|
|
18103
|
+
hasInvalidState ? "border-[var(--error-message-color)] bg-[#FFF5F3]" : "border-[#8c8c8c]",
|
|
18104
|
+
disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : "cursor-pointer",
|
|
18103
18105
|
className
|
|
18104
18106
|
);
|
|
18105
18107
|
const sharedContent = /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(import_jsx_runtime184.Fragment, { children: [
|
|
@@ -18108,7 +18110,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
18108
18110
|
{
|
|
18109
18111
|
className: cn(
|
|
18110
18112
|
"relative min-w-0 flex-1 pr-2",
|
|
18111
|
-
|
|
18113
|
+
isRaised ? "h-[42px]" : "h-[28px]",
|
|
18112
18114
|
contentClassName
|
|
18113
18115
|
),
|
|
18114
18116
|
children: [
|
|
@@ -18119,8 +18121,8 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
18119
18121
|
className: cn(
|
|
18120
18122
|
"absolute left-0 origin-left transition-all duration-200 ease-out",
|
|
18121
18123
|
hasLabelMeta ? "max-w-full" : "pointer-events-none truncate",
|
|
18122
|
-
|
|
18123
|
-
hasInvalidState ? "text-[var(--error-message-color)]" :
|
|
18124
|
+
isRaised ? "top-[-1px] translate-y-0 text-xs leading-5" : "top-1/2 -translate-y-1/2 text-[16px] leading-7",
|
|
18125
|
+
hasInvalidState ? "text-[var(--error-message-color)]" : "text-[#6c6c6c]"
|
|
18124
18126
|
),
|
|
18125
18127
|
children: animatedLabel
|
|
18126
18128
|
}
|
|
@@ -18131,7 +18133,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
18131
18133
|
id: valueId,
|
|
18132
18134
|
className: cn(
|
|
18133
18135
|
"absolute left-0 block truncate transition-all duration-200 ease-out",
|
|
18134
|
-
|
|
18136
|
+
"bottom-0 translate-y-0 text-[16px] leading-6 opacity-100",
|
|
18135
18137
|
hasInvalidState ? "text-[var(--error-message-color)]" : "text-[#222222]"
|
|
18136
18138
|
),
|
|
18137
18139
|
children: valueText
|
|
@@ -18144,10 +18146,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
18144
18146
|
"span",
|
|
18145
18147
|
{
|
|
18146
18148
|
"aria-hidden": "true",
|
|
18147
|
-
className:
|
|
18148
|
-
"pointer-events-none absolute top-1/2 -translate-y-1/2",
|
|
18149
|
-
isAirbnbVariant ? "right-5" : "right-4"
|
|
18150
|
-
),
|
|
18149
|
+
className: "pointer-events-none absolute right-5 top-1/2 -translate-y-1/2",
|
|
18151
18150
|
children: resolvedTrailingAdornment
|
|
18152
18151
|
}
|
|
18153
18152
|
)
|
|
@@ -18199,7 +18198,6 @@ var import_jsx_runtime185 = require("react/jsx-runtime");
|
|
|
18199
18198
|
var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
|
|
18200
18199
|
var AirbnbDatePicker = React73.forwardRef(
|
|
18201
18200
|
({
|
|
18202
|
-
variant = "default",
|
|
18203
18201
|
label,
|
|
18204
18202
|
topLabel,
|
|
18205
18203
|
value,
|
|
@@ -18326,7 +18324,6 @@ var AirbnbDatePicker = React73.forwardRef(
|
|
|
18326
18324
|
{
|
|
18327
18325
|
id: triggerId,
|
|
18328
18326
|
ref: combinedRef,
|
|
18329
|
-
variant,
|
|
18330
18327
|
label,
|
|
18331
18328
|
topLabel,
|
|
18332
18329
|
labelId,
|
|
@@ -18392,7 +18389,6 @@ var import_jsx_runtime186 = require("react/jsx-runtime");
|
|
|
18392
18389
|
var getInputValue = (value) => value != null ? String(value) : "";
|
|
18393
18390
|
var AirbnbInput = React74.forwardRef(
|
|
18394
18391
|
({
|
|
18395
|
-
variant = "default",
|
|
18396
18392
|
label,
|
|
18397
18393
|
topLabel,
|
|
18398
18394
|
helperText,
|
|
@@ -18488,7 +18484,6 @@ var AirbnbInput = React74.forwardRef(
|
|
|
18488
18484
|
AirbnbFieldTrigger,
|
|
18489
18485
|
{
|
|
18490
18486
|
as: "div",
|
|
18491
|
-
variant,
|
|
18492
18487
|
id: fieldId,
|
|
18493
18488
|
label: accessibleLabel ?? "",
|
|
18494
18489
|
topLabel,
|
|
@@ -18504,14 +18499,11 @@ var AirbnbInput = React74.forwardRef(
|
|
|
18504
18499
|
tooltip,
|
|
18505
18500
|
describedBy: error && renderErrorMessage ? errorId : void 0,
|
|
18506
18501
|
className: cn(
|
|
18507
|
-
|
|
18502
|
+
"px-4 focus-within:ring-2 focus-within:ring-[#1F1F1B] focus-within:ring-offset-2",
|
|
18508
18503
|
disabled ? "cursor-not-allowed" : "cursor-text",
|
|
18509
18504
|
fieldClassName
|
|
18510
18505
|
),
|
|
18511
|
-
contentClassName: cn(
|
|
18512
|
-
variant === "airbnb" ? "h-[42px]" : "h-[48px]",
|
|
18513
|
-
contentClassName
|
|
18514
|
-
),
|
|
18506
|
+
contentClassName: cn("h-[42px]", contentClassName),
|
|
18515
18507
|
trailingAdornment: shouldShowPasswordReveal ? void 0 : trailingAdornment,
|
|
18516
18508
|
forceFloatingLabel: shouldShowLabel,
|
|
18517
18509
|
forceLabelText: hasLabelMeta,
|
|
@@ -18538,7 +18530,7 @@ var AirbnbInput = React74.forwardRef(
|
|
|
18538
18530
|
"aria-labelledby": accessibleLabel && !hasLabelMeta ? labelId : void 0,
|
|
18539
18531
|
className: cn(
|
|
18540
18532
|
"absolute left-0 h-6 w-full border-0 bg-transparent p-0 text-[16px] leading-6 text-[#1F1F1B] outline-none placeholder:text-[#7A8399]",
|
|
18541
|
-
|
|
18533
|
+
"bottom-0",
|
|
18542
18534
|
hasInvalidState ? "text-[var(--status-danger)] placeholder:text-[var(--status-danger)]" : "",
|
|
18543
18535
|
disabled ? "cursor-not-allowed" : loading ? "cursor-progress" : "",
|
|
18544
18536
|
shouldShowPasswordReveal ? "pr-8" : "",
|
|
@@ -18553,10 +18545,7 @@ var AirbnbInput = React74.forwardRef(
|
|
|
18553
18545
|
type: "button",
|
|
18554
18546
|
onClick: togglePasswordReveal,
|
|
18555
18547
|
disabled: isBlocked,
|
|
18556
|
-
className:
|
|
18557
|
-
"absolute right-0 flex h-6 w-6 items-center justify-center border-0 bg-transparent p-0 text-[#7A8399] hover:text-[#1F1F1B] hover:opacity-85 disabled:cursor-not-allowed disabled:opacity-50",
|
|
18558
|
-
variant === "airbnb" ? "bottom-0" : "bottom-[12px]"
|
|
18559
|
-
),
|
|
18548
|
+
className: "absolute bottom-0 right-0 flex h-6 w-6 items-center justify-center border-0 bg-transparent p-0 text-[#7A8399] hover:text-[#1F1F1B] hover:opacity-85 disabled:cursor-not-allowed disabled:opacity-50",
|
|
18560
18549
|
"aria-label": isPasswordRevealed ? t("hide_password") : t("show_password"),
|
|
18561
18550
|
children: /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
|
|
18562
18551
|
import_lucide_react54.Eye,
|
|
@@ -18932,7 +18921,6 @@ var AirbnbSelectTrigger = React75.forwardRef(
|
|
|
18932
18921
|
({
|
|
18933
18922
|
id,
|
|
18934
18923
|
open,
|
|
18935
|
-
variant,
|
|
18936
18924
|
label,
|
|
18937
18925
|
topLabel,
|
|
18938
18926
|
helperText,
|
|
@@ -18958,7 +18946,6 @@ var AirbnbSelectTrigger = React75.forwardRef(
|
|
|
18958
18946
|
{
|
|
18959
18947
|
id,
|
|
18960
18948
|
ref,
|
|
18961
|
-
variant,
|
|
18962
18949
|
"aria-haspopup": "listbox",
|
|
18963
18950
|
"aria-expanded": open,
|
|
18964
18951
|
"aria-controls": listboxId,
|
|
@@ -19350,7 +19337,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19350
19337
|
value,
|
|
19351
19338
|
onChange,
|
|
19352
19339
|
onBlur,
|
|
19353
|
-
variant = "default",
|
|
19354
19340
|
label,
|
|
19355
19341
|
topLabel,
|
|
19356
19342
|
placeholder,
|
|
@@ -19369,11 +19355,13 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19369
19355
|
doneLabel = "Done",
|
|
19370
19356
|
mobileTitle,
|
|
19371
19357
|
name,
|
|
19372
|
-
noOptionsMessage
|
|
19358
|
+
noOptionsMessage,
|
|
19359
|
+
filterOption
|
|
19373
19360
|
}, ref) {
|
|
19374
19361
|
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
19375
19362
|
const [isOpen, setIsOpen] = React79.useState(false);
|
|
19376
19363
|
const containerRef = React79.useRef(null);
|
|
19364
|
+
const filteredOptions = filterOption ? options.filter(filterOption) : options;
|
|
19377
19365
|
const hasValue = Boolean(value);
|
|
19378
19366
|
const helperText = placeholder ?? label;
|
|
19379
19367
|
const shouldDescribeHelperText = !hasValue && helperText !== label;
|
|
@@ -19404,7 +19392,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19404
19392
|
} = useMobileSelectWheel({
|
|
19405
19393
|
isMobile: isMobile3,
|
|
19406
19394
|
isOpen,
|
|
19407
|
-
options,
|
|
19395
|
+
options: filteredOptions,
|
|
19408
19396
|
value,
|
|
19409
19397
|
disabled: isBlocked
|
|
19410
19398
|
});
|
|
@@ -19421,13 +19409,13 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19421
19409
|
} = useDesktopSelect({
|
|
19422
19410
|
isMobile: isMobile3,
|
|
19423
19411
|
isOpen,
|
|
19424
|
-
options,
|
|
19412
|
+
options: filteredOptions,
|
|
19425
19413
|
value,
|
|
19426
19414
|
disabled: isBlocked,
|
|
19427
19415
|
onChange
|
|
19428
19416
|
});
|
|
19429
19417
|
const combinedRef = useCombinedRef(ref, desktopTriggerRef);
|
|
19430
|
-
const activeMobileIndex = getOptionIndex2(
|
|
19418
|
+
const activeMobileIndex = getOptionIndex2(filteredOptions, pendingValue);
|
|
19431
19419
|
const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
|
|
19432
19420
|
useOutsideClick({
|
|
19433
19421
|
elementRef: containerRef,
|
|
@@ -19444,12 +19432,12 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19444
19432
|
if (value?.value === void 0 || value.value === null || value.label !== "") {
|
|
19445
19433
|
return;
|
|
19446
19434
|
}
|
|
19447
|
-
const validOption =
|
|
19435
|
+
const validOption = filteredOptions.find((option) => option.value === value.value);
|
|
19448
19436
|
if (validOption) {
|
|
19449
19437
|
onChange(validOption);
|
|
19450
19438
|
}
|
|
19451
19439
|
},
|
|
19452
|
-
[onChange,
|
|
19440
|
+
[onChange, filteredOptions, value]
|
|
19453
19441
|
);
|
|
19454
19442
|
const handleMobileOpenChange = React79.useCallback(
|
|
19455
19443
|
(nextOpen) => {
|
|
@@ -19534,7 +19522,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19534
19522
|
renderTrigger ? renderTrigger({
|
|
19535
19523
|
id: triggerId,
|
|
19536
19524
|
open: isOpen,
|
|
19537
|
-
variant,
|
|
19538
19525
|
label,
|
|
19539
19526
|
topLabel,
|
|
19540
19527
|
helperText,
|
|
@@ -19558,7 +19545,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19558
19545
|
id: triggerId,
|
|
19559
19546
|
ref: combinedRef,
|
|
19560
19547
|
open: isOpen,
|
|
19561
|
-
variant,
|
|
19562
19548
|
label,
|
|
19563
19549
|
topLabel,
|
|
19564
19550
|
helperText,
|
|
@@ -19592,7 +19578,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19592
19578
|
mobileTitle,
|
|
19593
19579
|
doneLabel,
|
|
19594
19580
|
errorId: describedErrorId,
|
|
19595
|
-
options,
|
|
19581
|
+
options: filteredOptions,
|
|
19596
19582
|
disabled: isBlocked,
|
|
19597
19583
|
menuClassName,
|
|
19598
19584
|
scrollTop: mobileScrollTop,
|
|
@@ -19612,7 +19598,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19612
19598
|
listboxId,
|
|
19613
19599
|
labelId,
|
|
19614
19600
|
errorId: describedErrorId,
|
|
19615
|
-
options,
|
|
19601
|
+
options: filteredOptions,
|
|
19616
19602
|
value,
|
|
19617
19603
|
highlightedIndex,
|
|
19618
19604
|
onOptionClick: (option) => {
|
|
@@ -19647,7 +19633,6 @@ function formatPhoneCodeOptionLabel2(option) {
|
|
|
19647
19633
|
}
|
|
19648
19634
|
var AirbnbPhoneField = React80.forwardRef(
|
|
19649
19635
|
({
|
|
19650
|
-
variant = "default",
|
|
19651
19636
|
label,
|
|
19652
19637
|
topLabel,
|
|
19653
19638
|
value,
|
|
@@ -19719,7 +19704,6 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
19719
19704
|
AirbnbSelect,
|
|
19720
19705
|
{
|
|
19721
19706
|
ref,
|
|
19722
|
-
variant,
|
|
19723
19707
|
options: codeOptions,
|
|
19724
19708
|
value: selectedCodeOption,
|
|
19725
19709
|
onChange: (option) => onChange({
|
|
@@ -19738,7 +19722,6 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
19738
19722
|
renderTrigger: ({
|
|
19739
19723
|
id,
|
|
19740
19724
|
open,
|
|
19741
|
-
variant: selectVariant,
|
|
19742
19725
|
disabled: triggerDisabled,
|
|
19743
19726
|
loading: triggerLoading,
|
|
19744
19727
|
listboxId,
|
|
@@ -19762,9 +19745,8 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
19762
19745
|
onClick,
|
|
19763
19746
|
onKeyDown,
|
|
19764
19747
|
className: cn(
|
|
19765
|
-
"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",
|
|
19766
|
-
|
|
19767
|
-
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]",
|
|
19748
|
+
"flex h-full min-h-[60px] w-full items-center justify-center gap-2 rounded-l-[16px] rounded-r-none border border-r-0 px-4 text-[16px] font-medium leading-6 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#1F1F1B] focus-visible:ring-offset-2",
|
|
19749
|
+
hasInvalidState ? "border-[var(--status-danger)] bg-[#F2F2F2] text-[var(--status-danger)]" : "border-[#8C8C8C] bg-[#F4F4F2] text-[#1F1F1B]",
|
|
19768
19750
|
triggerDisabled ? "cursor-not-allowed opacity-50" : triggerLoading ? "cursor-progress" : "cursor-pointer"
|
|
19769
19751
|
),
|
|
19770
19752
|
children: [
|
|
@@ -19785,7 +19767,6 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
19785
19767
|
AirbnbInput,
|
|
19786
19768
|
{
|
|
19787
19769
|
id: inputId,
|
|
19788
|
-
variant,
|
|
19789
19770
|
type: "tel",
|
|
19790
19771
|
inputMode: "tel",
|
|
19791
19772
|
label,
|
|
@@ -19800,10 +19781,8 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
19800
19781
|
tooltip,
|
|
19801
19782
|
renderErrorMessage: false,
|
|
19802
19783
|
wrapperClassName: "min-w-0 flex-1",
|
|
19803
|
-
fieldClassName:
|
|
19804
|
-
|
|
19805
|
-
),
|
|
19806
|
-
contentClassName: cn(variant === "airbnb" ? "h-[40px] py-2" : "h-[48px]"),
|
|
19784
|
+
fieldClassName: "min-h-[60px] rounded-l-none rounded-r-[16px] border-l-0",
|
|
19785
|
+
contentClassName: "h-[40px] py-2",
|
|
19807
19786
|
inputClassName: "text-[16px] leading-7",
|
|
19808
19787
|
onChange: (event) => onChange({
|
|
19809
19788
|
code: value?.code ?? "",
|
|
@@ -19844,7 +19823,6 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
19844
19823
|
loading,
|
|
19845
19824
|
hasNextPage,
|
|
19846
19825
|
onLoadMore,
|
|
19847
|
-
variant = "default",
|
|
19848
19826
|
label,
|
|
19849
19827
|
topLabel,
|
|
19850
19828
|
placeholder,
|
|
@@ -20028,7 +20006,6 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
20028
20006
|
{
|
|
20029
20007
|
id: `${reactId}-trigger`,
|
|
20030
20008
|
ref: triggerRef,
|
|
20031
|
-
variant,
|
|
20032
20009
|
"aria-haspopup": "listbox",
|
|
20033
20010
|
"aria-expanded": open,
|
|
20034
20011
|
"aria-controls": listboxId,
|
|
@@ -20311,44 +20288,83 @@ var React83 = __toESM(require("react"), 1);
|
|
|
20311
20288
|
var SwitchPrimitives2 = __toESM(require("@radix-ui/react-switch"), 1);
|
|
20312
20289
|
var import_lucide_react59 = require("lucide-react");
|
|
20313
20290
|
var import_jsx_runtime196 = require("react/jsx-runtime");
|
|
20314
|
-
var AirbnbSwitch = React83.forwardRef(
|
|
20315
|
-
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
"group inline-flex h-[24px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border border-solid border-transparent p-[2px] transition-colors duration-200",
|
|
20320
|
-
"focus-visible:outline-none focus-visible:shadow-[var(--chekin-shadow-focus)]",
|
|
20321
|
-
"disabled:cursor-not-allowed disabled:opacity-50 aria-busy:cursor-wait aria-busy:opacity-50",
|
|
20322
|
-
"aria-readonly:cursor-default aria-readonly:opacity-100",
|
|
20323
|
-
"data-[state=checked]:bg-[#222222] data-[state=unchecked]:bg-[#E7E7E4]",
|
|
20324
|
-
className
|
|
20325
|
-
),
|
|
20291
|
+
var AirbnbSwitch = React83.forwardRef(
|
|
20292
|
+
({
|
|
20293
|
+
className,
|
|
20294
|
+
value,
|
|
20295
|
+
onChange,
|
|
20326
20296
|
disabled,
|
|
20327
|
-
|
|
20328
|
-
|
|
20329
|
-
|
|
20330
|
-
|
|
20331
|
-
|
|
20332
|
-
|
|
20333
|
-
|
|
20334
|
-
|
|
20297
|
+
loading,
|
|
20298
|
+
readOnly,
|
|
20299
|
+
id,
|
|
20300
|
+
label,
|
|
20301
|
+
error,
|
|
20302
|
+
wrapperClassName,
|
|
20303
|
+
...props
|
|
20304
|
+
}, ref) => {
|
|
20305
|
+
const generatedId = React83.useId();
|
|
20306
|
+
const fieldId = id || generatedId;
|
|
20307
|
+
const switchElement = /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20308
|
+
SwitchPrimitives2.Root,
|
|
20335
20309
|
{
|
|
20310
|
+
ref,
|
|
20336
20311
|
className: cn(
|
|
20337
|
-
"flex h-[
|
|
20338
|
-
"
|
|
20312
|
+
"group inline-flex h-[24px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border border-solid border-transparent p-[2px] transition-colors duration-200",
|
|
20313
|
+
"focus-visible:outline-none focus-visible:shadow-[var(--chekin-shadow-focus)]",
|
|
20314
|
+
"disabled:cursor-not-allowed disabled:opacity-50 aria-busy:cursor-wait aria-busy:opacity-50",
|
|
20315
|
+
"aria-readonly:cursor-default aria-readonly:opacity-100",
|
|
20316
|
+
"data-[state=checked]:bg-[#222222] data-[state=unchecked]:bg-[#E7E7E4]",
|
|
20317
|
+
className
|
|
20339
20318
|
),
|
|
20319
|
+
id: fieldId,
|
|
20320
|
+
disabled,
|
|
20321
|
+
checked: value,
|
|
20322
|
+
value: String(value),
|
|
20323
|
+
onCheckedChange: !disabled && !readOnly ? onChange : void 0,
|
|
20324
|
+
"aria-busy": loading,
|
|
20325
|
+
"aria-readonly": readOnly,
|
|
20326
|
+
...props,
|
|
20340
20327
|
children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20341
|
-
|
|
20328
|
+
SwitchPrimitives2.Thumb,
|
|
20342
20329
|
{
|
|
20343
|
-
|
|
20344
|
-
|
|
20345
|
-
|
|
20330
|
+
className: cn(
|
|
20331
|
+
"flex h-[20px] w-[20px] items-center justify-center rounded-full bg-white shadow-[0_1px_3px_rgba(0,0,0,0.22)] transition-transform duration-200",
|
|
20332
|
+
"data-[state=checked]:translate-x-[12px] data-[state=unchecked]:translate-x-0"
|
|
20333
|
+
),
|
|
20334
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20335
|
+
import_lucide_react59.Check,
|
|
20336
|
+
{
|
|
20337
|
+
"aria-hidden": "true",
|
|
20338
|
+
className: "h-3 w-3 text-[#222222] opacity-0 transition-opacity duration-150 group-data-[state=checked]:opacity-100",
|
|
20339
|
+
strokeWidth: 3
|
|
20340
|
+
}
|
|
20341
|
+
)
|
|
20346
20342
|
}
|
|
20347
20343
|
)
|
|
20348
20344
|
}
|
|
20349
|
-
)
|
|
20345
|
+
);
|
|
20346
|
+
if (!label && !error) {
|
|
20347
|
+
return switchElement;
|
|
20348
|
+
}
|
|
20349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)(import_jsx_runtime196.Fragment, { children: [
|
|
20350
|
+
/* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: cn("flex items-center gap-x-3 gap-y-1.5", wrapperClassName), children: [
|
|
20351
|
+
switchElement,
|
|
20352
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20353
|
+
Label,
|
|
20354
|
+
{
|
|
20355
|
+
htmlFor: fieldId,
|
|
20356
|
+
className: cn(
|
|
20357
|
+
"text-base font-medium",
|
|
20358
|
+
readOnly ? "cursor-default" : "cursor-pointer"
|
|
20359
|
+
),
|
|
20360
|
+
children: label
|
|
20361
|
+
}
|
|
20362
|
+
)
|
|
20363
|
+
] }),
|
|
20364
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(ErrorMessage, { disabled, children: error })
|
|
20365
|
+
] });
|
|
20350
20366
|
}
|
|
20351
|
-
)
|
|
20367
|
+
);
|
|
20352
20368
|
AirbnbSwitch.displayName = "AirbnbSwitch";
|
|
20353
20369
|
// Annotate the CommonJS export names for ESM import in node:
|
|
20354
20370
|
0 && (module.exports = {
|