@chekinapp/ui 0.0.114 → 0.0.116
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 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -5
- package/dist/index.d.ts +29 -5
- package/dist/index.js +307 -98
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -42,6 +42,7 @@ __export(index_exports, {
|
|
|
42
42
|
AirbnbSearchInput: () => AirbnbSearchInput,
|
|
43
43
|
AirbnbSearchableSelect: () => AirbnbSearchableSelect,
|
|
44
44
|
AirbnbSelect: () => AirbnbSelect,
|
|
45
|
+
AirbnbSwitch: () => AirbnbSwitch,
|
|
45
46
|
Alert: () => Alert,
|
|
46
47
|
AlertBox: () => AlertBox,
|
|
47
48
|
AlertDescription: () => AlertDescription,
|
|
@@ -5147,7 +5148,7 @@ function Header2({ children, className, ...props }) {
|
|
|
5147
5148
|
"h2",
|
|
5148
5149
|
{
|
|
5149
5150
|
className: cn(
|
|
5150
|
-
"m-0 flex items-center gap-2 self-stretch p-0 text-2xl font-semibold leading-normal text-[var(--
|
|
5151
|
+
"m-0 flex items-center gap-2 self-stretch p-0 text-2xl font-semibold leading-normal text-[var(--form-box-title-color)]",
|
|
5151
5152
|
className
|
|
5152
5153
|
),
|
|
5153
5154
|
...props,
|
|
@@ -5163,7 +5164,7 @@ function Root11({ children, nested, className, ...props }) {
|
|
|
5163
5164
|
"div",
|
|
5164
5165
|
{
|
|
5165
5166
|
className: cn(
|
|
5166
|
-
"flex max-w-[1400px] flex-col items-start gap-6 self-stretch rounded-[
|
|
5167
|
+
"flex max-w-[1400px] flex-col items-start gap-6 self-stretch rounded-[var(--form-box-radius)] border border-[var(--form-box-border)] p-6 [container-type:inline-size]",
|
|
5167
5168
|
nested && "border-0 p-0",
|
|
5168
5169
|
className
|
|
5169
5170
|
),
|
|
@@ -5180,7 +5181,7 @@ function SubHeader({ children, className, ...props }) {
|
|
|
5180
5181
|
"h4",
|
|
5181
5182
|
{
|
|
5182
5183
|
className: cn(
|
|
5183
|
-
"m-0 flex items-center gap-2 self-stretch border-b border-[var(--
|
|
5184
|
+
"m-0 flex items-center gap-2 self-stretch border-b border-[var(--form-box-subtitle-border)] px-0 py-2 text-base font-semibold leading-normal text-[var(--form-box-subtitle-color)]",
|
|
5184
5185
|
className
|
|
5185
5186
|
),
|
|
5186
5187
|
...props,
|
|
@@ -12871,6 +12872,23 @@ var React45 = __toESM(require("react"), 1);
|
|
|
12871
12872
|
var import_react_i18next28 = require("react-i18next");
|
|
12872
12873
|
|
|
12873
12874
|
// src/dashboard/_select-internals/utils.ts
|
|
12875
|
+
function isOptionGroup(item) {
|
|
12876
|
+
return Boolean(
|
|
12877
|
+
item && Array.isArray(item.options)
|
|
12878
|
+
);
|
|
12879
|
+
}
|
|
12880
|
+
function flattenGroupedOptions(items) {
|
|
12881
|
+
if (!items) return [];
|
|
12882
|
+
const result = [];
|
|
12883
|
+
for (const item of items) {
|
|
12884
|
+
if (isOptionGroup(item)) {
|
|
12885
|
+
for (const option of item.options) result.push(option);
|
|
12886
|
+
} else {
|
|
12887
|
+
result.push(item);
|
|
12888
|
+
}
|
|
12889
|
+
}
|
|
12890
|
+
return result;
|
|
12891
|
+
}
|
|
12874
12892
|
function isOptionEnabled(option, isOptionDisabled) {
|
|
12875
12893
|
if (!option) return false;
|
|
12876
12894
|
if (option.isDisabled) return false;
|
|
@@ -12968,6 +12986,51 @@ function DefaultOption(props) {
|
|
|
12968
12986
|
|
|
12969
12987
|
// src/dashboard/_select-internals/SelectMenu.tsx
|
|
12970
12988
|
var import_jsx_runtime148 = require("react/jsx-runtime");
|
|
12989
|
+
function buildMenuEntries(groupedOptions, options, formatGroupLabel) {
|
|
12990
|
+
if (!groupedOptions || !groupedOptions.some((item) => isOptionGroup(item))) {
|
|
12991
|
+
return options.map((option, index) => ({
|
|
12992
|
+
kind: "option",
|
|
12993
|
+
key: `${String(option.value)}-${index}`,
|
|
12994
|
+
option,
|
|
12995
|
+
flatIndex: index
|
|
12996
|
+
}));
|
|
12997
|
+
}
|
|
12998
|
+
const indexByOption = /* @__PURE__ */ new Map();
|
|
12999
|
+
options.forEach((option, index) => indexByOption.set(option, index));
|
|
13000
|
+
const entries = [];
|
|
13001
|
+
let groupCount = 0;
|
|
13002
|
+
for (const item of groupedOptions) {
|
|
13003
|
+
if (isOptionGroup(item)) {
|
|
13004
|
+
const visible = item.options.filter((option) => indexByOption.has(option));
|
|
13005
|
+
if (visible.length === 0) continue;
|
|
13006
|
+
const label = formatGroupLabel ? formatGroupLabel(item) : item.label;
|
|
13007
|
+
entries.push({
|
|
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",
|
|
13017
|
+
key: `${String(option.value)}-${flatIndex}`,
|
|
13018
|
+
option,
|
|
13019
|
+
flatIndex
|
|
13020
|
+
});
|
|
13021
|
+
}
|
|
13022
|
+
} else if (indexByOption.has(item)) {
|
|
13023
|
+
const flatIndex = indexByOption.get(item);
|
|
13024
|
+
entries.push({
|
|
13025
|
+
kind: "option",
|
|
13026
|
+
key: `${String(item.value)}-${flatIndex}`,
|
|
13027
|
+
option: item,
|
|
13028
|
+
flatIndex
|
|
13029
|
+
});
|
|
13030
|
+
}
|
|
13031
|
+
}
|
|
13032
|
+
return entries;
|
|
13033
|
+
}
|
|
12971
13034
|
function SelectMenu({
|
|
12972
13035
|
id,
|
|
12973
13036
|
options,
|
|
@@ -12993,7 +13056,9 @@ function SelectMenu({
|
|
|
12993
13056
|
inputValue = "",
|
|
12994
13057
|
formatOptionLabel,
|
|
12995
13058
|
isOptionSelected: isOptionSelected2,
|
|
12996
|
-
onMenuScrollToBottom
|
|
13059
|
+
onMenuScrollToBottom,
|
|
13060
|
+
groupedOptions,
|
|
13061
|
+
formatGroupLabel
|
|
12997
13062
|
}) {
|
|
12998
13063
|
const { t } = (0, import_react_i18next28.useTranslation)();
|
|
12999
13064
|
const emptyMessage = noOptionsMessage?.() ?? t("no_options");
|
|
@@ -13004,6 +13069,10 @@ function SelectMenu({
|
|
|
13004
13069
|
() => selectedValues ?? (selectedValue ? [selectedValue] : []),
|
|
13005
13070
|
[selectedValues, selectedValue]
|
|
13006
13071
|
);
|
|
13072
|
+
const entries = React45.useMemo(
|
|
13073
|
+
() => buildMenuEntries(groupedOptions, options, formatGroupLabel),
|
|
13074
|
+
[groupedOptions, options, formatGroupLabel]
|
|
13075
|
+
);
|
|
13007
13076
|
const wasAtBottomRef = React45.useRef(false);
|
|
13008
13077
|
const handleScroll = React45.useCallback(
|
|
13009
13078
|
(event) => {
|
|
@@ -13037,31 +13106,43 @@ function SelectMenu({
|
|
|
13037
13106
|
),
|
|
13038
13107
|
children: [
|
|
13039
13108
|
!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 })),
|
|
13040
|
-
|
|
13109
|
+
entries.map((entry) => {
|
|
13110
|
+
if (entry.kind === "group-label") {
|
|
13111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
|
|
13112
|
+
"div",
|
|
13113
|
+
{
|
|
13114
|
+
role: "presentation",
|
|
13115
|
+
className: "px-3 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-[var(--chekin-color-gray-1)]",
|
|
13116
|
+
children: entry.label
|
|
13117
|
+
},
|
|
13118
|
+
entry.key
|
|
13119
|
+
);
|
|
13120
|
+
}
|
|
13121
|
+
const { option, flatIndex } = entry;
|
|
13041
13122
|
const isSelected = isOptionSelected2 ? isOptionSelected2(option, selectedList) : isOptionSelected(option, selectedValue, selectedValues);
|
|
13042
|
-
const isHighlighted =
|
|
13123
|
+
const isHighlighted = flatIndex === highlightedIndex;
|
|
13043
13124
|
const optionDisabled = Boolean(
|
|
13044
13125
|
disabled || option.isDisabled || isOptionDisabled?.(option)
|
|
13045
13126
|
);
|
|
13046
13127
|
return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
|
|
13047
13128
|
Option,
|
|
13048
13129
|
{
|
|
13049
|
-
id: getOptionId2(
|
|
13130
|
+
id: getOptionId2(flatIndex),
|
|
13050
13131
|
option,
|
|
13051
|
-
index,
|
|
13132
|
+
index: flatIndex,
|
|
13052
13133
|
isSelected,
|
|
13053
13134
|
isHighlighted,
|
|
13054
13135
|
isDisabled: optionDisabled,
|
|
13055
|
-
isLast:
|
|
13136
|
+
isLast: flatIndex === lastIndex,
|
|
13056
13137
|
isMulti: Boolean(isMulti),
|
|
13057
13138
|
onClick: onOptionClick,
|
|
13058
13139
|
onHover: onOptionHover ?? (() => void 0),
|
|
13059
|
-
innerRef: (node) => selectedOptionRef?.(
|
|
13140
|
+
innerRef: (node) => selectedOptionRef?.(flatIndex, node),
|
|
13060
13141
|
inputValue,
|
|
13061
13142
|
selectedOptions: selectedList,
|
|
13062
13143
|
formatOptionLabel
|
|
13063
13144
|
},
|
|
13064
|
-
|
|
13145
|
+
entry.key
|
|
13065
13146
|
);
|
|
13066
13147
|
}),
|
|
13067
13148
|
footer
|
|
@@ -13190,6 +13271,7 @@ function SelectTrigger({
|
|
|
13190
13271
|
invalid,
|
|
13191
13272
|
placeholder,
|
|
13192
13273
|
valueLabel,
|
|
13274
|
+
leftIcon,
|
|
13193
13275
|
onClick,
|
|
13194
13276
|
onKeyDown,
|
|
13195
13277
|
onBlur
|
|
@@ -13213,12 +13295,14 @@ function SelectTrigger({
|
|
|
13213
13295
|
onKeyDown,
|
|
13214
13296
|
onBlur,
|
|
13215
13297
|
className: cn(
|
|
13216
|
-
"relative m-0 box-border flex h-12 w-full cursor-pointer items-center justify-between gap-2 rounded-[6px] border-0
|
|
13298
|
+
"relative m-0 box-border flex h-12 w-full cursor-pointer items-center justify-between gap-2 rounded-[6px] border-0 pr-4 text-left text-[16px] font-medium leading-5 outline-none transition-colors duration-200",
|
|
13299
|
+
leftIcon ? "pl-10" : "pl-4",
|
|
13217
13300
|
isEmpty ? "bg-[var(--empty-field-background)] text-[var(--chekin-color-gray-1)]" : "bg-transparent text-[var(--chekin-color-brand-navy)]",
|
|
13218
13301
|
disabled && !loading && "cursor-not-allowed opacity-50",
|
|
13219
13302
|
loading && "!cursor-progress"
|
|
13220
13303
|
),
|
|
13221
13304
|
children: [
|
|
13305
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "pointer-events-none absolute left-0 top-0 flex h-full max-w-10 items-center justify-center text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
13222
13306
|
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { id: valueId, className: "block min-w-0 flex-1 truncate text-left", children: valueLabel ?? (isOpen ? placeholder : null) }),
|
|
13223
13307
|
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
|
|
13224
13308
|
import_lucide_react45.ChevronDown,
|
|
@@ -13268,6 +13352,7 @@ function ComboboxTrigger({
|
|
|
13268
13352
|
onClear,
|
|
13269
13353
|
clearLabel,
|
|
13270
13354
|
leadingContent,
|
|
13355
|
+
leftIcon,
|
|
13271
13356
|
containerClassName,
|
|
13272
13357
|
inputClassName,
|
|
13273
13358
|
hideIndicator,
|
|
@@ -13298,11 +13383,13 @@ function ComboboxTrigger({
|
|
|
13298
13383
|
containerClassName
|
|
13299
13384
|
),
|
|
13300
13385
|
children: [
|
|
13386
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "pointer-events-none absolute left-0 top-0 flex h-full max-w-10 items-center justify-center text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
13301
13387
|
/* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
|
|
13302
13388
|
"div",
|
|
13303
13389
|
{
|
|
13304
13390
|
className: cn(
|
|
13305
|
-
"flex min-w-0 flex-1 items-center gap-2 py-[10px]
|
|
13391
|
+
"flex min-w-0 flex-1 items-center gap-2 py-[10px]",
|
|
13392
|
+
leftIcon ? "pl-10" : "pl-4",
|
|
13306
13393
|
isMulti && "flex-wrap"
|
|
13307
13394
|
),
|
|
13308
13395
|
children: [
|
|
@@ -13864,6 +13951,7 @@ function DefaultControl(props) {
|
|
|
13864
13951
|
clearLabel,
|
|
13865
13952
|
hideIndicator,
|
|
13866
13953
|
autoFocus,
|
|
13954
|
+
leftIcon,
|
|
13867
13955
|
components
|
|
13868
13956
|
} = props;
|
|
13869
13957
|
const Chip = components.MultiValueChip ?? DefaultMultiValueChip;
|
|
@@ -13901,6 +13989,7 @@ function DefaultControl(props) {
|
|
|
13901
13989
|
clearLabel,
|
|
13902
13990
|
hideIndicator,
|
|
13903
13991
|
autoFocus,
|
|
13992
|
+
leftIcon,
|
|
13904
13993
|
leadingContent: isMulti ? selectedOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
13905
13994
|
Chip,
|
|
13906
13995
|
{
|
|
@@ -13931,7 +14020,8 @@ function StaticControl(props) {
|
|
|
13931
14020
|
disabled,
|
|
13932
14021
|
valueLabel,
|
|
13933
14022
|
placeholder,
|
|
13934
|
-
onContainerClick
|
|
14023
|
+
onContainerClick,
|
|
14024
|
+
leftIcon
|
|
13935
14025
|
} = props;
|
|
13936
14026
|
return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
13937
14027
|
SelectTrigger,
|
|
@@ -13949,6 +14039,7 @@ function StaticControl(props) {
|
|
|
13949
14039
|
invalid,
|
|
13950
14040
|
placeholder,
|
|
13951
14041
|
valueLabel,
|
|
14042
|
+
leftIcon,
|
|
13952
14043
|
onClick: onContainerClick,
|
|
13953
14044
|
onKeyDown: () => void 0
|
|
13954
14045
|
}
|
|
@@ -13981,7 +14072,9 @@ function DefaultMenuList(props) {
|
|
|
13981
14072
|
inputValue,
|
|
13982
14073
|
formatOptionLabel,
|
|
13983
14074
|
isOptionSelected: isOptionSelected2,
|
|
13984
|
-
onMenuScrollToBottom
|
|
14075
|
+
onMenuScrollToBottom,
|
|
14076
|
+
groupedOptions,
|
|
14077
|
+
formatGroupLabel
|
|
13985
14078
|
} = props;
|
|
13986
14079
|
return /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
|
|
13987
14080
|
SelectMenu,
|
|
@@ -14009,7 +14102,9 @@ function DefaultMenuList(props) {
|
|
|
14009
14102
|
inputValue,
|
|
14010
14103
|
formatOptionLabel,
|
|
14011
14104
|
isOptionSelected: isOptionSelected2,
|
|
14012
|
-
onMenuScrollToBottom
|
|
14105
|
+
onMenuScrollToBottom,
|
|
14106
|
+
groupedOptions,
|
|
14107
|
+
formatGroupLabel
|
|
14013
14108
|
}
|
|
14014
14109
|
);
|
|
14015
14110
|
}
|
|
@@ -14100,7 +14195,9 @@ function SelectInternal(props, ref) {
|
|
|
14100
14195
|
onInputChange,
|
|
14101
14196
|
searchPosition = "trigger",
|
|
14102
14197
|
menuHeader,
|
|
14103
|
-
onMenuScrollToBottom
|
|
14198
|
+
onMenuScrollToBottom,
|
|
14199
|
+
leftIcon,
|
|
14200
|
+
formatGroupLabel
|
|
14104
14201
|
} = props;
|
|
14105
14202
|
const isSearchInDropdown = searchPosition === "dropdown";
|
|
14106
14203
|
const isMulti = props.isMulti === true;
|
|
@@ -14121,9 +14218,10 @@ function SelectInternal(props, ref) {
|
|
|
14121
14218
|
},
|
|
14122
14219
|
[isMulti, props.onChange]
|
|
14123
14220
|
);
|
|
14221
|
+
const flatOptions = React49.useMemo(() => flattenGroupedOptions(options), [options]);
|
|
14124
14222
|
const state = useSelectState({
|
|
14125
14223
|
isMulti,
|
|
14126
|
-
options,
|
|
14224
|
+
options: flatOptions,
|
|
14127
14225
|
selectedOptions,
|
|
14128
14226
|
onSelectionChange,
|
|
14129
14227
|
filterOption,
|
|
@@ -14222,6 +14320,7 @@ function SelectInternal(props, ref) {
|
|
|
14222
14320
|
clearLabel: isMulti ? t("clear_all") : t("clear"),
|
|
14223
14321
|
hideIndicator,
|
|
14224
14322
|
autoFocus,
|
|
14323
|
+
leftIcon,
|
|
14225
14324
|
components
|
|
14226
14325
|
}
|
|
14227
14326
|
),
|
|
@@ -14240,7 +14339,8 @@ function SelectInternal(props, ref) {
|
|
|
14240
14339
|
legend: resolvedLabel,
|
|
14241
14340
|
label: resolvedLabel,
|
|
14242
14341
|
tooltip,
|
|
14243
|
-
onClick: state.handleContainerClick
|
|
14342
|
+
onClick: state.handleContainerClick,
|
|
14343
|
+
labelClassName: leftIcon ? "pl-[28px]" : void 0
|
|
14244
14344
|
}
|
|
14245
14345
|
),
|
|
14246
14346
|
/* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
|
|
@@ -14292,7 +14392,9 @@ function SelectInternal(props, ref) {
|
|
|
14292
14392
|
inputValue: state.inputValue,
|
|
14293
14393
|
formatOptionLabel,
|
|
14294
14394
|
isOptionSelected: isOptionSelected2,
|
|
14295
|
-
onMenuScrollToBottom
|
|
14395
|
+
onMenuScrollToBottom,
|
|
14396
|
+
groupedOptions: options,
|
|
14397
|
+
formatGroupLabel
|
|
14296
14398
|
}
|
|
14297
14399
|
),
|
|
14298
14400
|
state.canCreateNewOption && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
@@ -14995,7 +15097,8 @@ function createCountTrigger(opts) {
|
|
|
14995
15097
|
disabled,
|
|
14996
15098
|
placeholder,
|
|
14997
15099
|
selectedOptions,
|
|
14998
|
-
onContainerClick
|
|
15100
|
+
onContainerClick,
|
|
15101
|
+
leftIcon
|
|
14999
15102
|
} = props;
|
|
15000
15103
|
const count = selectedOptions.length;
|
|
15001
15104
|
const total = totalCount ?? count;
|
|
@@ -15017,12 +15120,14 @@ function createCountTrigger(opts) {
|
|
|
15017
15120
|
disabled: isBlocked,
|
|
15018
15121
|
onClick: onContainerClick,
|
|
15019
15122
|
className: cn(
|
|
15020
|
-
"relative m-0 box-border flex h-12 w-full cursor-pointer items-center justify-between gap-2 rounded-[6px] border-0
|
|
15123
|
+
"relative m-0 box-border flex h-12 w-full cursor-pointer items-center justify-between gap-2 rounded-[6px] border-0 pr-4 text-left text-[16px] font-medium leading-5 outline-none transition-colors duration-200",
|
|
15124
|
+
leftIcon ? "pl-10" : "pl-4",
|
|
15021
15125
|
isEmpty ? "bg-[var(--empty-field-background)] text-[var(--chekin-color-gray-1)]" : "bg-transparent text-[var(--chekin-color-brand-navy)]",
|
|
15022
15126
|
disabled && !loading && "cursor-not-allowed opacity-50",
|
|
15023
15127
|
loading && "!cursor-progress"
|
|
15024
15128
|
),
|
|
15025
15129
|
children: [
|
|
15130
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "pointer-events-none absolute left-0 top-0 flex h-full max-w-10 items-center justify-center text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
15026
15131
|
/* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { id: valueId, className: "block min-w-0 flex-1 truncate text-left", children: display }),
|
|
15027
15132
|
/* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
|
|
15028
15133
|
import_lucide_react48.ChevronDown,
|
|
@@ -15112,19 +15217,33 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15112
15217
|
);
|
|
15113
15218
|
const [inputValue, setInputValue] = React59.useState("");
|
|
15114
15219
|
const selected = value ?? [];
|
|
15115
|
-
const
|
|
15220
|
+
const flatRawOptions = React59.useMemo(
|
|
15221
|
+
() => flattenGroupedOptions(rawOptions),
|
|
15222
|
+
[rawOptions]
|
|
15223
|
+
);
|
|
15224
|
+
const filteredGrouped = React59.useMemo(() => {
|
|
15116
15225
|
const trimmed = inputValue.trim();
|
|
15117
15226
|
if (!trimmed) return rawOptions;
|
|
15118
|
-
return rawOptions.
|
|
15227
|
+
return rawOptions.map((item) => {
|
|
15228
|
+
if (isOptionGroup(item)) {
|
|
15229
|
+
const opts = item.options.filter((o) => filterOption(o, trimmed));
|
|
15230
|
+
return opts.length > 0 ? { ...item, options: opts } : null;
|
|
15231
|
+
}
|
|
15232
|
+
return filterOption(item, trimmed) ? item : null;
|
|
15233
|
+
}).filter((item) => item !== null);
|
|
15119
15234
|
}, [rawOptions, inputValue, filterOption]);
|
|
15120
|
-
const
|
|
15235
|
+
const filteredFlat = React59.useMemo(
|
|
15236
|
+
() => flattenGroupedOptions(filteredGrouped),
|
|
15237
|
+
[filteredGrouped]
|
|
15238
|
+
);
|
|
15239
|
+
const visibleSelectedCount = filteredFlat.reduce((acc, option) => {
|
|
15121
15240
|
return acc + (selected.some((s) => s.value === option.value) ? 1 : 0);
|
|
15122
15241
|
}, 0);
|
|
15123
|
-
const allVisibleSelected =
|
|
15124
|
-
const someVisibleSelected = visibleSelectedCount > 0 && visibleSelectedCount <
|
|
15242
|
+
const allVisibleSelected = filteredFlat.length > 0 && visibleSelectedCount === filteredFlat.length;
|
|
15243
|
+
const someVisibleSelected = visibleSelectedCount > 0 && visibleSelectedCount < filteredFlat.length;
|
|
15125
15244
|
const handleToggleAll = React59.useCallback(() => {
|
|
15126
15245
|
if (allVisibleSelected) {
|
|
15127
|
-
const visibleValues = new Set(
|
|
15246
|
+
const visibleValues = new Set(filteredFlat.map((option) => option.value));
|
|
15128
15247
|
onChange(
|
|
15129
15248
|
selected.filter((s) => !visibleValues.has(s.value)),
|
|
15130
15249
|
{ action: "deselect" }
|
|
@@ -15132,18 +15251,18 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15132
15251
|
return;
|
|
15133
15252
|
}
|
|
15134
15253
|
const merged = [...selected];
|
|
15135
|
-
for (const option of
|
|
15254
|
+
for (const option of filteredFlat) {
|
|
15136
15255
|
if (!merged.some((s) => s.value === option.value)) merged.push(option);
|
|
15137
15256
|
}
|
|
15138
15257
|
onChange(merged, { action: "select" });
|
|
15139
|
-
}, [allVisibleSelected,
|
|
15258
|
+
}, [allVisibleSelected, filteredFlat, onChange, selected]);
|
|
15140
15259
|
const Control = React59.useMemo(() => {
|
|
15141
15260
|
if (trigger) return makeTriggerSlot2(trigger);
|
|
15142
15261
|
return createCountTrigger({
|
|
15143
15262
|
valueText,
|
|
15144
|
-
totalCount:
|
|
15263
|
+
totalCount: flatRawOptions.length
|
|
15145
15264
|
});
|
|
15146
|
-
}, [trigger, valueText,
|
|
15265
|
+
}, [trigger, valueText, flatRawOptions.length]);
|
|
15147
15266
|
const components = React59.useMemo(
|
|
15148
15267
|
() => ({
|
|
15149
15268
|
...userComponents,
|
|
@@ -15168,11 +15287,10 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15168
15287
|
},
|
|
15169
15288
|
[onSearchChange]
|
|
15170
15289
|
);
|
|
15171
|
-
const
|
|
15290
|
+
const baseSharedProps = {
|
|
15172
15291
|
...paginationAndRest,
|
|
15173
15292
|
value,
|
|
15174
15293
|
onChange,
|
|
15175
|
-
options: filteredOptions,
|
|
15176
15294
|
filterOption: passthroughFilter2,
|
|
15177
15295
|
components,
|
|
15178
15296
|
closeMenuOnSelect,
|
|
@@ -15186,7 +15304,10 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15186
15304
|
InfiniteScrollSelect,
|
|
15187
15305
|
{
|
|
15188
15306
|
ref,
|
|
15189
|
-
...
|
|
15307
|
+
...{
|
|
15308
|
+
...baseSharedProps,
|
|
15309
|
+
options: filteredFlat
|
|
15310
|
+
}
|
|
15190
15311
|
}
|
|
15191
15312
|
);
|
|
15192
15313
|
}
|
|
@@ -15194,7 +15315,10 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
15194
15315
|
Select,
|
|
15195
15316
|
{
|
|
15196
15317
|
ref,
|
|
15197
|
-
...
|
|
15318
|
+
...{
|
|
15319
|
+
...baseSharedProps,
|
|
15320
|
+
options: filteredGrouped
|
|
15321
|
+
}
|
|
15198
15322
|
}
|
|
15199
15323
|
);
|
|
15200
15324
|
}
|
|
@@ -16117,7 +16241,7 @@ var Datepicker = React63.forwardRef(
|
|
|
16117
16241
|
hideErrorMessage,
|
|
16118
16242
|
helperText,
|
|
16119
16243
|
width,
|
|
16120
|
-
locale
|
|
16244
|
+
locale,
|
|
16121
16245
|
minDate,
|
|
16122
16246
|
maxDate,
|
|
16123
16247
|
formatValue
|
|
@@ -16136,10 +16260,11 @@ var Datepicker = React63.forwardRef(
|
|
|
16136
16260
|
const yearId = `${baseId}-year`;
|
|
16137
16261
|
const labelId = `${baseId}-label`;
|
|
16138
16262
|
const errorId = `${baseId}-error`;
|
|
16139
|
-
const { t } = (0, import_react_i18next39.useTranslation)();
|
|
16263
|
+
const { t, i18n } = (0, import_react_i18next39.useTranslation)();
|
|
16264
|
+
const resolvedLocale = locale ?? i18n.resolvedLanguage ?? i18n.language ?? "en-US";
|
|
16140
16265
|
const resolvedMonthLabels = React63.useMemo(
|
|
16141
|
-
() => monthLabels ?? getMonthLabels2(
|
|
16142
|
-
[
|
|
16266
|
+
() => monthLabels ?? getMonthLabels2(resolvedLocale),
|
|
16267
|
+
[resolvedLocale, monthLabels]
|
|
16143
16268
|
);
|
|
16144
16269
|
const resolvedMonthPlaceholder = monthPlaceholder ?? t("month");
|
|
16145
16270
|
const resolvedDoneLabel = doneLabel ?? t("done");
|
|
@@ -17938,7 +18063,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
17938
18063
|
const hasLabelMeta = Boolean(optionalLabel) || Boolean(tooltip);
|
|
17939
18064
|
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("span", { className: "inline-flex max-w-full items-center gap-1.5 align-middle", children: [
|
|
17940
18065
|
/* @__PURE__ */ (0, import_jsx_runtime184.jsx)("span", { className: "min-w-0 truncate", children: visibleLabelText }),
|
|
17941
|
-
optionalLabel && /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("span", { className: "
|
|
18066
|
+
optionalLabel && /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("span", { className: "text-current opacity-70 lowercase", children: [
|
|
17942
18067
|
"(",
|
|
17943
18068
|
optionalLabel,
|
|
17944
18069
|
")"
|
|
@@ -17992,8 +18117,8 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
17992
18117
|
{
|
|
17993
18118
|
id: labelId,
|
|
17994
18119
|
className: cn(
|
|
17995
|
-
"absolute left-0 origin-left
|
|
17996
|
-
hasLabelMeta ? "" : "pointer-events-none",
|
|
18120
|
+
"absolute left-0 origin-left transition-all duration-200 ease-out",
|
|
18121
|
+
hasLabelMeta ? "max-w-full" : "pointer-events-none truncate",
|
|
17997
18122
|
isAirbnbVariant ? isRaised ? "top-[-1px] 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-white px-1 text-[12px] font-medium leading-4" : "top-1/2 -translate-y-1/2 text-[16px] leading-6",
|
|
17998
18123
|
hasInvalidState ? "text-[var(--error-message-color)]" : isAirbnbVariant ? "text-[#6c6c6c]" : "text-[#7A8399]"
|
|
17999
18124
|
),
|
|
@@ -18261,6 +18386,8 @@ AirbnbDatePicker.displayName = "AirbnbDatePicker";
|
|
|
18261
18386
|
|
|
18262
18387
|
// src/airbnb-fields/input/Input.tsx
|
|
18263
18388
|
var React74 = __toESM(require("react"), 1);
|
|
18389
|
+
var import_lucide_react54 = require("lucide-react");
|
|
18390
|
+
var import_react_i18next44 = require("react-i18next");
|
|
18264
18391
|
var import_jsx_runtime186 = require("react/jsx-runtime");
|
|
18265
18392
|
var getInputValue = (value) => value != null ? String(value) : "";
|
|
18266
18393
|
var AirbnbInput = React74.forwardRef(
|
|
@@ -18292,6 +18419,7 @@ var AirbnbInput = React74.forwardRef(
|
|
|
18292
18419
|
placeholder,
|
|
18293
18420
|
...props
|
|
18294
18421
|
}, ref) => {
|
|
18422
|
+
const { t } = (0, import_react_i18next44.useTranslation)();
|
|
18295
18423
|
const generatedId = React74.useId();
|
|
18296
18424
|
const inputRef = React74.useRef(null);
|
|
18297
18425
|
const inputId = id ?? generatedId;
|
|
@@ -18300,11 +18428,15 @@ var AirbnbInput = React74.forwardRef(
|
|
|
18300
18428
|
const errorId = `${inputId}-error`;
|
|
18301
18429
|
const accessibleLabel = placeholder ?? label;
|
|
18302
18430
|
const [isFocused, setIsFocused] = React74.useState(false);
|
|
18431
|
+
const [isPasswordRevealed, setIsPasswordRevealed] = React74.useState(false);
|
|
18303
18432
|
const [currentValue, setCurrentValue] = React74.useState(
|
|
18304
18433
|
() => value != null ? getInputValue(value) : getInputValue(defaultValue)
|
|
18305
18434
|
);
|
|
18306
18435
|
const resolvedValue = value != null ? getInputValue(value) : currentValue;
|
|
18307
18436
|
const hasValue = resolvedValue.length > 0;
|
|
18437
|
+
const isPasswordInput = type === "password";
|
|
18438
|
+
const inputType = isPasswordInput && isPasswordRevealed ? "text" : type;
|
|
18439
|
+
const shouldShowPasswordReveal = isPasswordInput && hasValue && !loading;
|
|
18308
18440
|
const shouldShowLabel = hasValue || isFocused;
|
|
18309
18441
|
const hasInvalidState = Boolean(error) || Boolean(invalid);
|
|
18310
18442
|
const triggerError = error ?? invalid;
|
|
@@ -18314,6 +18446,11 @@ var AirbnbInput = React74.forwardRef(
|
|
|
18314
18446
|
const nextValue = value != null ? getInputValue(value) : getInputValue(inputRef.current?.value);
|
|
18315
18447
|
setCurrentValue((prevValue) => prevValue === nextValue ? prevValue : nextValue);
|
|
18316
18448
|
}, [value]);
|
|
18449
|
+
React74.useEffect(() => {
|
|
18450
|
+
if (!isPasswordInput) {
|
|
18451
|
+
setIsPasswordRevealed(false);
|
|
18452
|
+
}
|
|
18453
|
+
}, [isPasswordInput]);
|
|
18317
18454
|
const setRefs = React74.useCallback(
|
|
18318
18455
|
(node) => {
|
|
18319
18456
|
inputRef.current = node;
|
|
@@ -18344,7 +18481,10 @@ var AirbnbInput = React74.forwardRef(
|
|
|
18344
18481
|
setIsFocused(false);
|
|
18345
18482
|
onBlur?.(event);
|
|
18346
18483
|
};
|
|
18347
|
-
|
|
18484
|
+
const togglePasswordReveal = () => {
|
|
18485
|
+
setIsPasswordRevealed((isRevealed) => !isRevealed);
|
|
18486
|
+
};
|
|
18487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)("div", { className: cn("w-full max-w-[var(--max-field-width)]", wrapperClassName), children: /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)(
|
|
18348
18488
|
AirbnbFieldTrigger,
|
|
18349
18489
|
{
|
|
18350
18490
|
as: "div",
|
|
@@ -18372,39 +18512,63 @@ var AirbnbInput = React74.forwardRef(
|
|
|
18372
18512
|
variant === "airbnb" ? "h-[42px]" : "h-[48px]",
|
|
18373
18513
|
contentClassName
|
|
18374
18514
|
),
|
|
18375
|
-
trailingAdornment,
|
|
18515
|
+
trailingAdornment: shouldShowPasswordReveal ? void 0 : trailingAdornment,
|
|
18376
18516
|
forceFloatingLabel: shouldShowLabel,
|
|
18377
18517
|
forceLabelText: hasLabelMeta,
|
|
18378
18518
|
hideErrorMessage: !renderErrorMessage,
|
|
18379
|
-
children:
|
|
18380
|
-
|
|
18381
|
-
|
|
18382
|
-
|
|
18383
|
-
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
|
|
18387
|
-
|
|
18388
|
-
|
|
18389
|
-
|
|
18390
|
-
|
|
18391
|
-
|
|
18392
|
-
|
|
18393
|
-
|
|
18394
|
-
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
|
|
18403
|
-
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
|
|
18519
|
+
children: [
|
|
18520
|
+
/* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
|
|
18521
|
+
"input",
|
|
18522
|
+
{
|
|
18523
|
+
...props,
|
|
18524
|
+
id: inputId,
|
|
18525
|
+
ref: setRefs,
|
|
18526
|
+
type: inputType,
|
|
18527
|
+
disabled: isBlocked,
|
|
18528
|
+
value,
|
|
18529
|
+
defaultValue,
|
|
18530
|
+
onChange: handleChange,
|
|
18531
|
+
onFocus: handleFocus,
|
|
18532
|
+
onBlur: handleBlur,
|
|
18533
|
+
placeholder: "",
|
|
18534
|
+
"aria-invalid": hasInvalidState,
|
|
18535
|
+
"aria-busy": loading,
|
|
18536
|
+
"aria-describedby": error && renderErrorMessage ? errorId : void 0,
|
|
18537
|
+
"aria-label": accessibleLabel && hasLabelMeta ? accessibleLabel : void 0,
|
|
18538
|
+
"aria-labelledby": accessibleLabel && !hasLabelMeta ? labelId : void 0,
|
|
18539
|
+
className: cn(
|
|
18540
|
+
"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
|
+
variant === "airbnb" ? "bottom-0" : "bottom-[12px]",
|
|
18542
|
+
hasInvalidState ? "text-[var(--status-danger)] placeholder:text-[var(--status-danger)]" : "",
|
|
18543
|
+
disabled ? "cursor-not-allowed" : loading ? "cursor-progress" : "",
|
|
18544
|
+
shouldShowPasswordReveal ? "pr-8" : "",
|
|
18545
|
+
inputClassName,
|
|
18546
|
+
className
|
|
18547
|
+
)
|
|
18548
|
+
}
|
|
18549
|
+
),
|
|
18550
|
+
shouldShowPasswordReveal && /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
|
|
18551
|
+
"button",
|
|
18552
|
+
{
|
|
18553
|
+
type: "button",
|
|
18554
|
+
onClick: togglePasswordReveal,
|
|
18555
|
+
disabled: isBlocked,
|
|
18556
|
+
className: cn(
|
|
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
|
+
),
|
|
18560
|
+
"aria-label": isPasswordRevealed ? t("hide_password") : t("show_password"),
|
|
18561
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
|
|
18562
|
+
import_lucide_react54.Eye,
|
|
18563
|
+
{
|
|
18564
|
+
size: 18,
|
|
18565
|
+
"aria-hidden": "true",
|
|
18566
|
+
className: cn(isPasswordRevealed ? "text-[#fc98dd]" : "")
|
|
18567
|
+
}
|
|
18568
|
+
)
|
|
18569
|
+
}
|
|
18570
|
+
)
|
|
18571
|
+
]
|
|
18408
18572
|
}
|
|
18409
18573
|
) });
|
|
18410
18574
|
}
|
|
@@ -18413,7 +18577,7 @@ AirbnbInput.displayName = "AirbnbInput";
|
|
|
18413
18577
|
|
|
18414
18578
|
// src/airbnb-fields/phone-field/PhoneField.tsx
|
|
18415
18579
|
var React80 = __toESM(require("react"), 1);
|
|
18416
|
-
var
|
|
18580
|
+
var import_lucide_react56 = require("lucide-react");
|
|
18417
18581
|
|
|
18418
18582
|
// src/airbnb-fields/select/Select.tsx
|
|
18419
18583
|
var React79 = __toESM(require("react"), 1);
|
|
@@ -18762,7 +18926,7 @@ function AirbnbSelectMobileContent({
|
|
|
18762
18926
|
|
|
18763
18927
|
// src/airbnb-fields/select/SelectTrigger.tsx
|
|
18764
18928
|
var React75 = __toESM(require("react"), 1);
|
|
18765
|
-
var
|
|
18929
|
+
var import_lucide_react55 = require("lucide-react");
|
|
18766
18930
|
var import_jsx_runtime191 = require("react/jsx-runtime");
|
|
18767
18931
|
var AirbnbSelectTrigger = React75.forwardRef(
|
|
18768
18932
|
({
|
|
@@ -18819,7 +18983,7 @@ var AirbnbSelectTrigger = React75.forwardRef(
|
|
|
18819
18983
|
onKeyDown,
|
|
18820
18984
|
onBlur,
|
|
18821
18985
|
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
|
|
18822
|
-
|
|
18986
|
+
import_lucide_react55.ChevronDown,
|
|
18823
18987
|
{
|
|
18824
18988
|
className: open ? "h-6 w-6 rotate-180 text-[#1F1F1B] transition-transform" : "h-6 w-6 text-[#1F1F1B] transition-transform"
|
|
18825
18989
|
}
|
|
@@ -19606,7 +19770,7 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
19606
19770
|
children: [
|
|
19607
19771
|
/* @__PURE__ */ (0, import_jsx_runtime193.jsx)("span", { children: valueLabel ?? codePlaceholder }),
|
|
19608
19772
|
/* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
|
|
19609
|
-
|
|
19773
|
+
import_lucide_react56.ChevronDown,
|
|
19610
19774
|
{
|
|
19611
19775
|
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
19612
19776
|
strokeWidth: 2
|
|
@@ -19657,7 +19821,7 @@ AirbnbPhoneField.displayName = "AirbnbPhoneField";
|
|
|
19657
19821
|
|
|
19658
19822
|
// src/airbnb-fields/searchable-select/SearchableSelect.tsx
|
|
19659
19823
|
var React81 = __toESM(require("react"), 1);
|
|
19660
|
-
var
|
|
19824
|
+
var import_lucide_react57 = require("lucide-react");
|
|
19661
19825
|
var import_react_virtual3 = require("@tanstack/react-virtual");
|
|
19662
19826
|
var import_react90 = require("react");
|
|
19663
19827
|
var import_jsx_runtime194 = require("react/jsx-runtime");
|
|
@@ -19895,7 +20059,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
19895
20059
|
onKeyDown: handleTriggerKeyDown,
|
|
19896
20060
|
onBlur,
|
|
19897
20061
|
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
|
|
19898
|
-
|
|
20062
|
+
import_lucide_react57.ChevronDown,
|
|
19899
20063
|
{
|
|
19900
20064
|
className: cn(
|
|
19901
20065
|
"h-6 w-6 text-[#1F1F1B] transition-transform",
|
|
@@ -19993,7 +20157,7 @@ function AirbnbSearchableSelectContent({
|
|
|
19993
20157
|
return /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { className: "p-2", children: [
|
|
19994
20158
|
/* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { className: "relative mb-2", children: [
|
|
19995
20159
|
/* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
|
|
19996
|
-
|
|
20160
|
+
import_lucide_react57.Search,
|
|
19997
20161
|
{
|
|
19998
20162
|
"aria-hidden": "true",
|
|
19999
20163
|
className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 text-[#9696B9]"
|
|
@@ -20102,14 +20266,14 @@ function getNextEnabledIndex(options, startIndex, step) {
|
|
|
20102
20266
|
|
|
20103
20267
|
// src/airbnb-fields/search-input/SearchInput.tsx
|
|
20104
20268
|
var React82 = __toESM(require("react"), 1);
|
|
20105
|
-
var
|
|
20106
|
-
var
|
|
20269
|
+
var import_react_i18next45 = require("react-i18next");
|
|
20270
|
+
var import_lucide_react58 = require("lucide-react");
|
|
20107
20271
|
var import_jsx_runtime195 = require("react/jsx-runtime");
|
|
20108
20272
|
var AirbnbSearchInput = React82.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
|
|
20109
|
-
const { t } = (0,
|
|
20273
|
+
const { t } = (0, import_react_i18next45.useTranslation)();
|
|
20110
20274
|
const placeholderText = placeholder || t("search_property") + "...";
|
|
20111
20275
|
return /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
|
|
20112
|
-
/* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
|
|
20276
|
+
/* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_lucide_react58.Search, { className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]" }),
|
|
20113
20277
|
/* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
|
|
20114
20278
|
"input",
|
|
20115
20279
|
{
|
|
@@ -20135,12 +20299,57 @@ var AirbnbSearchInput = React82.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
20135
20299
|
variant: "ghost",
|
|
20136
20300
|
onClick: onReset,
|
|
20137
20301
|
className: "absolute right-0 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]",
|
|
20138
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
|
|
20302
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_lucide_react58.X, { className: "h-5 w-5" })
|
|
20139
20303
|
}
|
|
20140
20304
|
)
|
|
20141
20305
|
] });
|
|
20142
20306
|
});
|
|
20143
20307
|
AirbnbSearchInput.displayName = "AirbnbSearchInput";
|
|
20308
|
+
|
|
20309
|
+
// src/airbnb-fields/switch/Switch.tsx
|
|
20310
|
+
var React83 = __toESM(require("react"), 1);
|
|
20311
|
+
var SwitchPrimitives2 = __toESM(require("@radix-ui/react-switch"), 1);
|
|
20312
|
+
var import_lucide_react59 = require("lucide-react");
|
|
20313
|
+
var import_jsx_runtime196 = require("react/jsx-runtime");
|
|
20314
|
+
var AirbnbSwitch = React83.forwardRef(({ className, value, onChange, disabled, loading, readOnly, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20315
|
+
SwitchPrimitives2.Root,
|
|
20316
|
+
{
|
|
20317
|
+
ref,
|
|
20318
|
+
className: cn(
|
|
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
|
+
),
|
|
20326
|
+
disabled,
|
|
20327
|
+
checked: value,
|
|
20328
|
+
value: String(value),
|
|
20329
|
+
onCheckedChange: !disabled && !readOnly ? onChange : void 0,
|
|
20330
|
+
"aria-busy": loading,
|
|
20331
|
+
"aria-readonly": readOnly,
|
|
20332
|
+
...props,
|
|
20333
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20334
|
+
SwitchPrimitives2.Thumb,
|
|
20335
|
+
{
|
|
20336
|
+
className: cn(
|
|
20337
|
+
"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",
|
|
20338
|
+
"data-[state=checked]:translate-x-[12px] data-[state=unchecked]:translate-x-0"
|
|
20339
|
+
),
|
|
20340
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
20341
|
+
import_lucide_react59.Check,
|
|
20342
|
+
{
|
|
20343
|
+
"aria-hidden": "true",
|
|
20344
|
+
className: "h-3 w-3 text-[#222222] opacity-0 transition-opacity duration-150 group-data-[state=checked]:opacity-100",
|
|
20345
|
+
strokeWidth: 3
|
|
20346
|
+
}
|
|
20347
|
+
)
|
|
20348
|
+
}
|
|
20349
|
+
)
|
|
20350
|
+
}
|
|
20351
|
+
));
|
|
20352
|
+
AirbnbSwitch.displayName = "AirbnbSwitch";
|
|
20144
20353
|
// Annotate the CommonJS export names for ESM import in node:
|
|
20145
20354
|
0 && (module.exports = {
|
|
20146
20355
|
ALERT_BOX_VARIANTS,
|
|
@@ -20155,6 +20364,7 @@ AirbnbSearchInput.displayName = "AirbnbSearchInput";
|
|
|
20155
20364
|
AirbnbSearchInput,
|
|
20156
20365
|
AirbnbSearchableSelect,
|
|
20157
20366
|
AirbnbSelect,
|
|
20367
|
+
AirbnbSwitch,
|
|
20158
20368
|
Alert,
|
|
20159
20369
|
AlertBox,
|
|
20160
20370
|
AlertDescription,
|