@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.js
CHANGED
|
@@ -4747,7 +4747,7 @@ function Header2({ children, className, ...props }) {
|
|
|
4747
4747
|
"h2",
|
|
4748
4748
|
{
|
|
4749
4749
|
className: cn(
|
|
4750
|
-
"m-0 flex items-center gap-2 self-stretch p-0 text-2xl font-semibold leading-normal text-[var(--
|
|
4750
|
+
"m-0 flex items-center gap-2 self-stretch p-0 text-2xl font-semibold leading-normal text-[var(--form-box-title-color)]",
|
|
4751
4751
|
className
|
|
4752
4752
|
),
|
|
4753
4753
|
...props,
|
|
@@ -4763,7 +4763,7 @@ function Root11({ children, nested, className, ...props }) {
|
|
|
4763
4763
|
"div",
|
|
4764
4764
|
{
|
|
4765
4765
|
className: cn(
|
|
4766
|
-
"flex max-w-[1400px] flex-col items-start gap-6 self-stretch rounded-[
|
|
4766
|
+
"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]",
|
|
4767
4767
|
nested && "border-0 p-0",
|
|
4768
4768
|
className
|
|
4769
4769
|
),
|
|
@@ -4780,7 +4780,7 @@ function SubHeader({ children, className, ...props }) {
|
|
|
4780
4780
|
"h4",
|
|
4781
4781
|
{
|
|
4782
4782
|
className: cn(
|
|
4783
|
-
"m-0 flex items-center gap-2 self-stretch border-b border-[var(--
|
|
4783
|
+
"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)]",
|
|
4784
4784
|
className
|
|
4785
4785
|
),
|
|
4786
4786
|
...props,
|
|
@@ -12511,6 +12511,23 @@ import * as React45 from "react";
|
|
|
12511
12511
|
import { useTranslation as useTranslation28 } from "react-i18next";
|
|
12512
12512
|
|
|
12513
12513
|
// src/dashboard/_select-internals/utils.ts
|
|
12514
|
+
function isOptionGroup(item) {
|
|
12515
|
+
return Boolean(
|
|
12516
|
+
item && Array.isArray(item.options)
|
|
12517
|
+
);
|
|
12518
|
+
}
|
|
12519
|
+
function flattenGroupedOptions(items) {
|
|
12520
|
+
if (!items) return [];
|
|
12521
|
+
const result = [];
|
|
12522
|
+
for (const item of items) {
|
|
12523
|
+
if (isOptionGroup(item)) {
|
|
12524
|
+
for (const option of item.options) result.push(option);
|
|
12525
|
+
} else {
|
|
12526
|
+
result.push(item);
|
|
12527
|
+
}
|
|
12528
|
+
}
|
|
12529
|
+
return result;
|
|
12530
|
+
}
|
|
12514
12531
|
function isOptionEnabled(option, isOptionDisabled) {
|
|
12515
12532
|
if (!option) return false;
|
|
12516
12533
|
if (option.isDisabled) return false;
|
|
@@ -12608,6 +12625,51 @@ function DefaultOption(props) {
|
|
|
12608
12625
|
|
|
12609
12626
|
// src/dashboard/_select-internals/SelectMenu.tsx
|
|
12610
12627
|
import { jsx as jsx146, jsxs as jsxs93 } from "react/jsx-runtime";
|
|
12628
|
+
function buildMenuEntries(groupedOptions, options, formatGroupLabel) {
|
|
12629
|
+
if (!groupedOptions || !groupedOptions.some((item) => isOptionGroup(item))) {
|
|
12630
|
+
return options.map((option, index) => ({
|
|
12631
|
+
kind: "option",
|
|
12632
|
+
key: `${String(option.value)}-${index}`,
|
|
12633
|
+
option,
|
|
12634
|
+
flatIndex: index
|
|
12635
|
+
}));
|
|
12636
|
+
}
|
|
12637
|
+
const indexByOption = /* @__PURE__ */ new Map();
|
|
12638
|
+
options.forEach((option, index) => indexByOption.set(option, index));
|
|
12639
|
+
const entries = [];
|
|
12640
|
+
let groupCount = 0;
|
|
12641
|
+
for (const item of groupedOptions) {
|
|
12642
|
+
if (isOptionGroup(item)) {
|
|
12643
|
+
const visible = item.options.filter((option) => indexByOption.has(option));
|
|
12644
|
+
if (visible.length === 0) continue;
|
|
12645
|
+
const label = formatGroupLabel ? formatGroupLabel(item) : item.label;
|
|
12646
|
+
entries.push({
|
|
12647
|
+
kind: "group-label",
|
|
12648
|
+
key: `__group-${groupCount}`,
|
|
12649
|
+
label
|
|
12650
|
+
});
|
|
12651
|
+
groupCount += 1;
|
|
12652
|
+
for (const option of visible) {
|
|
12653
|
+
const flatIndex = indexByOption.get(option);
|
|
12654
|
+
entries.push({
|
|
12655
|
+
kind: "option",
|
|
12656
|
+
key: `${String(option.value)}-${flatIndex}`,
|
|
12657
|
+
option,
|
|
12658
|
+
flatIndex
|
|
12659
|
+
});
|
|
12660
|
+
}
|
|
12661
|
+
} else if (indexByOption.has(item)) {
|
|
12662
|
+
const flatIndex = indexByOption.get(item);
|
|
12663
|
+
entries.push({
|
|
12664
|
+
kind: "option",
|
|
12665
|
+
key: `${String(item.value)}-${flatIndex}`,
|
|
12666
|
+
option: item,
|
|
12667
|
+
flatIndex
|
|
12668
|
+
});
|
|
12669
|
+
}
|
|
12670
|
+
}
|
|
12671
|
+
return entries;
|
|
12672
|
+
}
|
|
12611
12673
|
function SelectMenu({
|
|
12612
12674
|
id,
|
|
12613
12675
|
options,
|
|
@@ -12633,7 +12695,9 @@ function SelectMenu({
|
|
|
12633
12695
|
inputValue = "",
|
|
12634
12696
|
formatOptionLabel,
|
|
12635
12697
|
isOptionSelected: isOptionSelected2,
|
|
12636
|
-
onMenuScrollToBottom
|
|
12698
|
+
onMenuScrollToBottom,
|
|
12699
|
+
groupedOptions,
|
|
12700
|
+
formatGroupLabel
|
|
12637
12701
|
}) {
|
|
12638
12702
|
const { t } = useTranslation28();
|
|
12639
12703
|
const emptyMessage = noOptionsMessage?.() ?? t("no_options");
|
|
@@ -12644,6 +12708,10 @@ function SelectMenu({
|
|
|
12644
12708
|
() => selectedValues ?? (selectedValue ? [selectedValue] : []),
|
|
12645
12709
|
[selectedValues, selectedValue]
|
|
12646
12710
|
);
|
|
12711
|
+
const entries = React45.useMemo(
|
|
12712
|
+
() => buildMenuEntries(groupedOptions, options, formatGroupLabel),
|
|
12713
|
+
[groupedOptions, options, formatGroupLabel]
|
|
12714
|
+
);
|
|
12647
12715
|
const wasAtBottomRef = React45.useRef(false);
|
|
12648
12716
|
const handleScroll = React45.useCallback(
|
|
12649
12717
|
(event) => {
|
|
@@ -12677,31 +12745,43 @@ function SelectMenu({
|
|
|
12677
12745
|
),
|
|
12678
12746
|
children: [
|
|
12679
12747
|
!hasOptions && (emptyContent ?? /* @__PURE__ */ jsx146("div", { className: "px-3 py-3 text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: emptyMessage })),
|
|
12680
|
-
|
|
12748
|
+
entries.map((entry) => {
|
|
12749
|
+
if (entry.kind === "group-label") {
|
|
12750
|
+
return /* @__PURE__ */ jsx146(
|
|
12751
|
+
"div",
|
|
12752
|
+
{
|
|
12753
|
+
role: "presentation",
|
|
12754
|
+
className: "px-3 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-[var(--chekin-color-gray-1)]",
|
|
12755
|
+
children: entry.label
|
|
12756
|
+
},
|
|
12757
|
+
entry.key
|
|
12758
|
+
);
|
|
12759
|
+
}
|
|
12760
|
+
const { option, flatIndex } = entry;
|
|
12681
12761
|
const isSelected = isOptionSelected2 ? isOptionSelected2(option, selectedList) : isOptionSelected(option, selectedValue, selectedValues);
|
|
12682
|
-
const isHighlighted =
|
|
12762
|
+
const isHighlighted = flatIndex === highlightedIndex;
|
|
12683
12763
|
const optionDisabled = Boolean(
|
|
12684
12764
|
disabled || option.isDisabled || isOptionDisabled?.(option)
|
|
12685
12765
|
);
|
|
12686
12766
|
return /* @__PURE__ */ jsx146(
|
|
12687
12767
|
Option,
|
|
12688
12768
|
{
|
|
12689
|
-
id: getOptionId2(
|
|
12769
|
+
id: getOptionId2(flatIndex),
|
|
12690
12770
|
option,
|
|
12691
|
-
index,
|
|
12771
|
+
index: flatIndex,
|
|
12692
12772
|
isSelected,
|
|
12693
12773
|
isHighlighted,
|
|
12694
12774
|
isDisabled: optionDisabled,
|
|
12695
|
-
isLast:
|
|
12775
|
+
isLast: flatIndex === lastIndex,
|
|
12696
12776
|
isMulti: Boolean(isMulti),
|
|
12697
12777
|
onClick: onOptionClick,
|
|
12698
12778
|
onHover: onOptionHover ?? (() => void 0),
|
|
12699
|
-
innerRef: (node) => selectedOptionRef?.(
|
|
12779
|
+
innerRef: (node) => selectedOptionRef?.(flatIndex, node),
|
|
12700
12780
|
inputValue,
|
|
12701
12781
|
selectedOptions: selectedList,
|
|
12702
12782
|
formatOptionLabel
|
|
12703
12783
|
},
|
|
12704
|
-
|
|
12784
|
+
entry.key
|
|
12705
12785
|
);
|
|
12706
12786
|
}),
|
|
12707
12787
|
footer
|
|
@@ -12830,6 +12910,7 @@ function SelectTrigger({
|
|
|
12830
12910
|
invalid,
|
|
12831
12911
|
placeholder,
|
|
12832
12912
|
valueLabel,
|
|
12913
|
+
leftIcon,
|
|
12833
12914
|
onClick,
|
|
12834
12915
|
onKeyDown,
|
|
12835
12916
|
onBlur
|
|
@@ -12853,12 +12934,14 @@ function SelectTrigger({
|
|
|
12853
12934
|
onKeyDown,
|
|
12854
12935
|
onBlur,
|
|
12855
12936
|
className: cn(
|
|
12856
|
-
"relative m-0 box-border flex h-12 w-full cursor-pointer items-center justify-between gap-2 rounded-[6px] border-0
|
|
12937
|
+
"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",
|
|
12938
|
+
leftIcon ? "pl-10" : "pl-4",
|
|
12857
12939
|
isEmpty ? "bg-[var(--empty-field-background)] text-[var(--chekin-color-gray-1)]" : "bg-transparent text-[var(--chekin-color-brand-navy)]",
|
|
12858
12940
|
disabled && !loading && "cursor-not-allowed opacity-50",
|
|
12859
12941
|
loading && "!cursor-progress"
|
|
12860
12942
|
),
|
|
12861
12943
|
children: [
|
|
12944
|
+
leftIcon && /* @__PURE__ */ jsx149("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__ */ jsx149("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
12862
12945
|
/* @__PURE__ */ jsx149("span", { id: valueId, className: "block min-w-0 flex-1 truncate text-left", children: valueLabel ?? (isOpen ? placeholder : null) }),
|
|
12863
12946
|
/* @__PURE__ */ jsx149("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ jsx149(
|
|
12864
12947
|
ChevronDown2,
|
|
@@ -12908,6 +12991,7 @@ function ComboboxTrigger({
|
|
|
12908
12991
|
onClear,
|
|
12909
12992
|
clearLabel,
|
|
12910
12993
|
leadingContent,
|
|
12994
|
+
leftIcon,
|
|
12911
12995
|
containerClassName,
|
|
12912
12996
|
inputClassName,
|
|
12913
12997
|
hideIndicator,
|
|
@@ -12938,11 +13022,13 @@ function ComboboxTrigger({
|
|
|
12938
13022
|
containerClassName
|
|
12939
13023
|
),
|
|
12940
13024
|
children: [
|
|
13025
|
+
leftIcon && /* @__PURE__ */ jsx150("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__ */ jsx150("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
12941
13026
|
/* @__PURE__ */ jsxs97(
|
|
12942
13027
|
"div",
|
|
12943
13028
|
{
|
|
12944
13029
|
className: cn(
|
|
12945
|
-
"flex min-w-0 flex-1 items-center gap-2 py-[10px]
|
|
13030
|
+
"flex min-w-0 flex-1 items-center gap-2 py-[10px]",
|
|
13031
|
+
leftIcon ? "pl-10" : "pl-4",
|
|
12946
13032
|
isMulti && "flex-wrap"
|
|
12947
13033
|
),
|
|
12948
13034
|
children: [
|
|
@@ -13504,6 +13590,7 @@ function DefaultControl(props) {
|
|
|
13504
13590
|
clearLabel,
|
|
13505
13591
|
hideIndicator,
|
|
13506
13592
|
autoFocus,
|
|
13593
|
+
leftIcon,
|
|
13507
13594
|
components
|
|
13508
13595
|
} = props;
|
|
13509
13596
|
const Chip = components.MultiValueChip ?? DefaultMultiValueChip;
|
|
@@ -13541,6 +13628,7 @@ function DefaultControl(props) {
|
|
|
13541
13628
|
clearLabel,
|
|
13542
13629
|
hideIndicator,
|
|
13543
13630
|
autoFocus,
|
|
13631
|
+
leftIcon,
|
|
13544
13632
|
leadingContent: isMulti ? selectedOptions.map((option) => /* @__PURE__ */ jsx152(
|
|
13545
13633
|
Chip,
|
|
13546
13634
|
{
|
|
@@ -13571,7 +13659,8 @@ function StaticControl(props) {
|
|
|
13571
13659
|
disabled,
|
|
13572
13660
|
valueLabel,
|
|
13573
13661
|
placeholder,
|
|
13574
|
-
onContainerClick
|
|
13662
|
+
onContainerClick,
|
|
13663
|
+
leftIcon
|
|
13575
13664
|
} = props;
|
|
13576
13665
|
return /* @__PURE__ */ jsx153(
|
|
13577
13666
|
SelectTrigger,
|
|
@@ -13589,6 +13678,7 @@ function StaticControl(props) {
|
|
|
13589
13678
|
invalid,
|
|
13590
13679
|
placeholder,
|
|
13591
13680
|
valueLabel,
|
|
13681
|
+
leftIcon,
|
|
13592
13682
|
onClick: onContainerClick,
|
|
13593
13683
|
onKeyDown: () => void 0
|
|
13594
13684
|
}
|
|
@@ -13621,7 +13711,9 @@ function DefaultMenuList(props) {
|
|
|
13621
13711
|
inputValue,
|
|
13622
13712
|
formatOptionLabel,
|
|
13623
13713
|
isOptionSelected: isOptionSelected2,
|
|
13624
|
-
onMenuScrollToBottom
|
|
13714
|
+
onMenuScrollToBottom,
|
|
13715
|
+
groupedOptions,
|
|
13716
|
+
formatGroupLabel
|
|
13625
13717
|
} = props;
|
|
13626
13718
|
return /* @__PURE__ */ jsx154(
|
|
13627
13719
|
SelectMenu,
|
|
@@ -13649,7 +13741,9 @@ function DefaultMenuList(props) {
|
|
|
13649
13741
|
inputValue,
|
|
13650
13742
|
formatOptionLabel,
|
|
13651
13743
|
isOptionSelected: isOptionSelected2,
|
|
13652
|
-
onMenuScrollToBottom
|
|
13744
|
+
onMenuScrollToBottom,
|
|
13745
|
+
groupedOptions,
|
|
13746
|
+
formatGroupLabel
|
|
13653
13747
|
}
|
|
13654
13748
|
);
|
|
13655
13749
|
}
|
|
@@ -13740,7 +13834,9 @@ function SelectInternal(props, ref) {
|
|
|
13740
13834
|
onInputChange,
|
|
13741
13835
|
searchPosition = "trigger",
|
|
13742
13836
|
menuHeader,
|
|
13743
|
-
onMenuScrollToBottom
|
|
13837
|
+
onMenuScrollToBottom,
|
|
13838
|
+
leftIcon,
|
|
13839
|
+
formatGroupLabel
|
|
13744
13840
|
} = props;
|
|
13745
13841
|
const isSearchInDropdown = searchPosition === "dropdown";
|
|
13746
13842
|
const isMulti = props.isMulti === true;
|
|
@@ -13761,9 +13857,10 @@ function SelectInternal(props, ref) {
|
|
|
13761
13857
|
},
|
|
13762
13858
|
[isMulti, props.onChange]
|
|
13763
13859
|
);
|
|
13860
|
+
const flatOptions = React49.useMemo(() => flattenGroupedOptions(options), [options]);
|
|
13764
13861
|
const state = useSelectState({
|
|
13765
13862
|
isMulti,
|
|
13766
|
-
options,
|
|
13863
|
+
options: flatOptions,
|
|
13767
13864
|
selectedOptions,
|
|
13768
13865
|
onSelectionChange,
|
|
13769
13866
|
filterOption,
|
|
@@ -13862,6 +13959,7 @@ function SelectInternal(props, ref) {
|
|
|
13862
13959
|
clearLabel: isMulti ? t("clear_all") : t("clear"),
|
|
13863
13960
|
hideIndicator,
|
|
13864
13961
|
autoFocus,
|
|
13962
|
+
leftIcon,
|
|
13865
13963
|
components
|
|
13866
13964
|
}
|
|
13867
13965
|
),
|
|
@@ -13880,7 +13978,8 @@ function SelectInternal(props, ref) {
|
|
|
13880
13978
|
legend: resolvedLabel,
|
|
13881
13979
|
label: resolvedLabel,
|
|
13882
13980
|
tooltip,
|
|
13883
|
-
onClick: state.handleContainerClick
|
|
13981
|
+
onClick: state.handleContainerClick,
|
|
13982
|
+
labelClassName: leftIcon ? "pl-[28px]" : void 0
|
|
13884
13983
|
}
|
|
13885
13984
|
),
|
|
13886
13985
|
/* @__PURE__ */ jsxs99(
|
|
@@ -13932,7 +14031,9 @@ function SelectInternal(props, ref) {
|
|
|
13932
14031
|
inputValue: state.inputValue,
|
|
13933
14032
|
formatOptionLabel,
|
|
13934
14033
|
isOptionSelected: isOptionSelected2,
|
|
13935
|
-
onMenuScrollToBottom
|
|
14034
|
+
onMenuScrollToBottom,
|
|
14035
|
+
groupedOptions: options,
|
|
14036
|
+
formatGroupLabel
|
|
13936
14037
|
}
|
|
13937
14038
|
),
|
|
13938
14039
|
state.canCreateNewOption && /* @__PURE__ */ jsx156(
|
|
@@ -14635,7 +14736,8 @@ function createCountTrigger(opts) {
|
|
|
14635
14736
|
disabled,
|
|
14636
14737
|
placeholder,
|
|
14637
14738
|
selectedOptions,
|
|
14638
|
-
onContainerClick
|
|
14739
|
+
onContainerClick,
|
|
14740
|
+
leftIcon
|
|
14639
14741
|
} = props;
|
|
14640
14742
|
const count = selectedOptions.length;
|
|
14641
14743
|
const total = totalCount ?? count;
|
|
@@ -14657,12 +14759,14 @@ function createCountTrigger(opts) {
|
|
|
14657
14759
|
disabled: isBlocked,
|
|
14658
14760
|
onClick: onContainerClick,
|
|
14659
14761
|
className: cn(
|
|
14660
|
-
"relative m-0 box-border flex h-12 w-full cursor-pointer items-center justify-between gap-2 rounded-[6px] border-0
|
|
14762
|
+
"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",
|
|
14763
|
+
leftIcon ? "pl-10" : "pl-4",
|
|
14661
14764
|
isEmpty ? "bg-[var(--empty-field-background)] text-[var(--chekin-color-gray-1)]" : "bg-transparent text-[var(--chekin-color-brand-navy)]",
|
|
14662
14765
|
disabled && !loading && "cursor-not-allowed opacity-50",
|
|
14663
14766
|
loading && "!cursor-progress"
|
|
14664
14767
|
),
|
|
14665
14768
|
children: [
|
|
14769
|
+
leftIcon && /* @__PURE__ */ jsx166("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__ */ jsx166("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
14666
14770
|
/* @__PURE__ */ jsx166("span", { id: valueId, className: "block min-w-0 flex-1 truncate text-left", children: display }),
|
|
14667
14771
|
/* @__PURE__ */ jsx166("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ jsx166(
|
|
14668
14772
|
ChevronDown3,
|
|
@@ -14752,19 +14856,33 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
14752
14856
|
);
|
|
14753
14857
|
const [inputValue, setInputValue] = React59.useState("");
|
|
14754
14858
|
const selected = value ?? [];
|
|
14755
|
-
const
|
|
14859
|
+
const flatRawOptions = React59.useMemo(
|
|
14860
|
+
() => flattenGroupedOptions(rawOptions),
|
|
14861
|
+
[rawOptions]
|
|
14862
|
+
);
|
|
14863
|
+
const filteredGrouped = React59.useMemo(() => {
|
|
14756
14864
|
const trimmed = inputValue.trim();
|
|
14757
14865
|
if (!trimmed) return rawOptions;
|
|
14758
|
-
return rawOptions.
|
|
14866
|
+
return rawOptions.map((item) => {
|
|
14867
|
+
if (isOptionGroup(item)) {
|
|
14868
|
+
const opts = item.options.filter((o) => filterOption(o, trimmed));
|
|
14869
|
+
return opts.length > 0 ? { ...item, options: opts } : null;
|
|
14870
|
+
}
|
|
14871
|
+
return filterOption(item, trimmed) ? item : null;
|
|
14872
|
+
}).filter((item) => item !== null);
|
|
14759
14873
|
}, [rawOptions, inputValue, filterOption]);
|
|
14760
|
-
const
|
|
14874
|
+
const filteredFlat = React59.useMemo(
|
|
14875
|
+
() => flattenGroupedOptions(filteredGrouped),
|
|
14876
|
+
[filteredGrouped]
|
|
14877
|
+
);
|
|
14878
|
+
const visibleSelectedCount = filteredFlat.reduce((acc, option) => {
|
|
14761
14879
|
return acc + (selected.some((s) => s.value === option.value) ? 1 : 0);
|
|
14762
14880
|
}, 0);
|
|
14763
|
-
const allVisibleSelected =
|
|
14764
|
-
const someVisibleSelected = visibleSelectedCount > 0 && visibleSelectedCount <
|
|
14881
|
+
const allVisibleSelected = filteredFlat.length > 0 && visibleSelectedCount === filteredFlat.length;
|
|
14882
|
+
const someVisibleSelected = visibleSelectedCount > 0 && visibleSelectedCount < filteredFlat.length;
|
|
14765
14883
|
const handleToggleAll = React59.useCallback(() => {
|
|
14766
14884
|
if (allVisibleSelected) {
|
|
14767
|
-
const visibleValues = new Set(
|
|
14885
|
+
const visibleValues = new Set(filteredFlat.map((option) => option.value));
|
|
14768
14886
|
onChange(
|
|
14769
14887
|
selected.filter((s) => !visibleValues.has(s.value)),
|
|
14770
14888
|
{ action: "deselect" }
|
|
@@ -14772,18 +14890,18 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
14772
14890
|
return;
|
|
14773
14891
|
}
|
|
14774
14892
|
const merged = [...selected];
|
|
14775
|
-
for (const option of
|
|
14893
|
+
for (const option of filteredFlat) {
|
|
14776
14894
|
if (!merged.some((s) => s.value === option.value)) merged.push(option);
|
|
14777
14895
|
}
|
|
14778
14896
|
onChange(merged, { action: "select" });
|
|
14779
|
-
}, [allVisibleSelected,
|
|
14897
|
+
}, [allVisibleSelected, filteredFlat, onChange, selected]);
|
|
14780
14898
|
const Control = React59.useMemo(() => {
|
|
14781
14899
|
if (trigger) return makeTriggerSlot2(trigger);
|
|
14782
14900
|
return createCountTrigger({
|
|
14783
14901
|
valueText,
|
|
14784
|
-
totalCount:
|
|
14902
|
+
totalCount: flatRawOptions.length
|
|
14785
14903
|
});
|
|
14786
|
-
}, [trigger, valueText,
|
|
14904
|
+
}, [trigger, valueText, flatRawOptions.length]);
|
|
14787
14905
|
const components = React59.useMemo(
|
|
14788
14906
|
() => ({
|
|
14789
14907
|
...userComponents,
|
|
@@ -14808,11 +14926,10 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
14808
14926
|
},
|
|
14809
14927
|
[onSearchChange]
|
|
14810
14928
|
);
|
|
14811
|
-
const
|
|
14929
|
+
const baseSharedProps = {
|
|
14812
14930
|
...paginationAndRest,
|
|
14813
14931
|
value,
|
|
14814
14932
|
onChange,
|
|
14815
|
-
options: filteredOptions,
|
|
14816
14933
|
filterOption: passthroughFilter2,
|
|
14817
14934
|
components,
|
|
14818
14935
|
closeMenuOnSelect,
|
|
@@ -14826,7 +14943,10 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
14826
14943
|
InfiniteScrollSelect,
|
|
14827
14944
|
{
|
|
14828
14945
|
ref,
|
|
14829
|
-
...
|
|
14946
|
+
...{
|
|
14947
|
+
...baseSharedProps,
|
|
14948
|
+
options: filteredFlat
|
|
14949
|
+
}
|
|
14830
14950
|
}
|
|
14831
14951
|
);
|
|
14832
14952
|
}
|
|
@@ -14834,7 +14954,10 @@ function SelectCheckboxesInternal(props, ref) {
|
|
|
14834
14954
|
Select,
|
|
14835
14955
|
{
|
|
14836
14956
|
ref,
|
|
14837
|
-
...
|
|
14957
|
+
...{
|
|
14958
|
+
...baseSharedProps,
|
|
14959
|
+
options: filteredGrouped
|
|
14960
|
+
}
|
|
14838
14961
|
}
|
|
14839
14962
|
);
|
|
14840
14963
|
}
|
|
@@ -15757,7 +15880,7 @@ var Datepicker = React63.forwardRef(
|
|
|
15757
15880
|
hideErrorMessage,
|
|
15758
15881
|
helperText,
|
|
15759
15882
|
width,
|
|
15760
|
-
locale
|
|
15883
|
+
locale,
|
|
15761
15884
|
minDate,
|
|
15762
15885
|
maxDate,
|
|
15763
15886
|
formatValue
|
|
@@ -15776,10 +15899,11 @@ var Datepicker = React63.forwardRef(
|
|
|
15776
15899
|
const yearId = `${baseId}-year`;
|
|
15777
15900
|
const labelId = `${baseId}-label`;
|
|
15778
15901
|
const errorId = `${baseId}-error`;
|
|
15779
|
-
const { t } = useTranslation39();
|
|
15902
|
+
const { t, i18n } = useTranslation39();
|
|
15903
|
+
const resolvedLocale = locale ?? i18n.resolvedLanguage ?? i18n.language ?? "en-US";
|
|
15780
15904
|
const resolvedMonthLabels = React63.useMemo(
|
|
15781
|
-
() => monthLabels ?? getMonthLabels2(
|
|
15782
|
-
[
|
|
15905
|
+
() => monthLabels ?? getMonthLabels2(resolvedLocale),
|
|
15906
|
+
[resolvedLocale, monthLabels]
|
|
15783
15907
|
);
|
|
15784
15908
|
const resolvedMonthPlaceholder = monthPlaceholder ?? t("month");
|
|
15785
15909
|
const resolvedDoneLabel = doneLabel ?? t("done");
|
|
@@ -17581,7 +17705,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
17581
17705
|
const hasLabelMeta = Boolean(optionalLabel) || Boolean(tooltip);
|
|
17582
17706
|
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */ jsxs116("span", { className: "inline-flex max-w-full items-center gap-1.5 align-middle", children: [
|
|
17583
17707
|
/* @__PURE__ */ jsx182("span", { className: "min-w-0 truncate", children: visibleLabelText }),
|
|
17584
|
-
optionalLabel && /* @__PURE__ */ jsxs116("span", { className: "
|
|
17708
|
+
optionalLabel && /* @__PURE__ */ jsxs116("span", { className: "text-current opacity-70 lowercase", children: [
|
|
17585
17709
|
"(",
|
|
17586
17710
|
optionalLabel,
|
|
17587
17711
|
")"
|
|
@@ -17635,8 +17759,8 @@ var AirbnbFieldTrigger = React72.forwardRef(
|
|
|
17635
17759
|
{
|
|
17636
17760
|
id: labelId,
|
|
17637
17761
|
className: cn(
|
|
17638
|
-
"absolute left-0 origin-left
|
|
17639
|
-
hasLabelMeta ? "" : "pointer-events-none",
|
|
17762
|
+
"absolute left-0 origin-left transition-all duration-200 ease-out",
|
|
17763
|
+
hasLabelMeta ? "max-w-full" : "pointer-events-none truncate",
|
|
17640
17764
|
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",
|
|
17641
17765
|
hasInvalidState ? "text-[var(--error-message-color)]" : isAirbnbVariant ? "text-[#6c6c6c]" : "text-[#7A8399]"
|
|
17642
17766
|
),
|
|
@@ -17904,7 +18028,9 @@ AirbnbDatePicker.displayName = "AirbnbDatePicker";
|
|
|
17904
18028
|
|
|
17905
18029
|
// src/airbnb-fields/input/Input.tsx
|
|
17906
18030
|
import * as React74 from "react";
|
|
17907
|
-
import {
|
|
18031
|
+
import { Eye as Eye2 } from "lucide-react";
|
|
18032
|
+
import { useTranslation as useTranslation44 } from "react-i18next";
|
|
18033
|
+
import { jsx as jsx184, jsxs as jsxs118 } from "react/jsx-runtime";
|
|
17908
18034
|
var getInputValue = (value) => value != null ? String(value) : "";
|
|
17909
18035
|
var AirbnbInput = React74.forwardRef(
|
|
17910
18036
|
({
|
|
@@ -17935,6 +18061,7 @@ var AirbnbInput = React74.forwardRef(
|
|
|
17935
18061
|
placeholder,
|
|
17936
18062
|
...props
|
|
17937
18063
|
}, ref) => {
|
|
18064
|
+
const { t } = useTranslation44();
|
|
17938
18065
|
const generatedId = React74.useId();
|
|
17939
18066
|
const inputRef = React74.useRef(null);
|
|
17940
18067
|
const inputId = id ?? generatedId;
|
|
@@ -17943,11 +18070,15 @@ var AirbnbInput = React74.forwardRef(
|
|
|
17943
18070
|
const errorId = `${inputId}-error`;
|
|
17944
18071
|
const accessibleLabel = placeholder ?? label;
|
|
17945
18072
|
const [isFocused, setIsFocused] = React74.useState(false);
|
|
18073
|
+
const [isPasswordRevealed, setIsPasswordRevealed] = React74.useState(false);
|
|
17946
18074
|
const [currentValue, setCurrentValue] = React74.useState(
|
|
17947
18075
|
() => value != null ? getInputValue(value) : getInputValue(defaultValue)
|
|
17948
18076
|
);
|
|
17949
18077
|
const resolvedValue = value != null ? getInputValue(value) : currentValue;
|
|
17950
18078
|
const hasValue = resolvedValue.length > 0;
|
|
18079
|
+
const isPasswordInput = type === "password";
|
|
18080
|
+
const inputType = isPasswordInput && isPasswordRevealed ? "text" : type;
|
|
18081
|
+
const shouldShowPasswordReveal = isPasswordInput && hasValue && !loading;
|
|
17951
18082
|
const shouldShowLabel = hasValue || isFocused;
|
|
17952
18083
|
const hasInvalidState = Boolean(error) || Boolean(invalid);
|
|
17953
18084
|
const triggerError = error ?? invalid;
|
|
@@ -17957,6 +18088,11 @@ var AirbnbInput = React74.forwardRef(
|
|
|
17957
18088
|
const nextValue = value != null ? getInputValue(value) : getInputValue(inputRef.current?.value);
|
|
17958
18089
|
setCurrentValue((prevValue) => prevValue === nextValue ? prevValue : nextValue);
|
|
17959
18090
|
}, [value]);
|
|
18091
|
+
React74.useEffect(() => {
|
|
18092
|
+
if (!isPasswordInput) {
|
|
18093
|
+
setIsPasswordRevealed(false);
|
|
18094
|
+
}
|
|
18095
|
+
}, [isPasswordInput]);
|
|
17960
18096
|
const setRefs = React74.useCallback(
|
|
17961
18097
|
(node) => {
|
|
17962
18098
|
inputRef.current = node;
|
|
@@ -17987,7 +18123,10 @@ var AirbnbInput = React74.forwardRef(
|
|
|
17987
18123
|
setIsFocused(false);
|
|
17988
18124
|
onBlur?.(event);
|
|
17989
18125
|
};
|
|
17990
|
-
|
|
18126
|
+
const togglePasswordReveal = () => {
|
|
18127
|
+
setIsPasswordRevealed((isRevealed) => !isRevealed);
|
|
18128
|
+
};
|
|
18129
|
+
return /* @__PURE__ */ jsx184("div", { className: cn("w-full max-w-[var(--max-field-width)]", wrapperClassName), children: /* @__PURE__ */ jsxs118(
|
|
17991
18130
|
AirbnbFieldTrigger,
|
|
17992
18131
|
{
|
|
17993
18132
|
as: "div",
|
|
@@ -18015,39 +18154,63 @@ var AirbnbInput = React74.forwardRef(
|
|
|
18015
18154
|
variant === "airbnb" ? "h-[42px]" : "h-[48px]",
|
|
18016
18155
|
contentClassName
|
|
18017
18156
|
),
|
|
18018
|
-
trailingAdornment,
|
|
18157
|
+
trailingAdornment: shouldShowPasswordReveal ? void 0 : trailingAdornment,
|
|
18019
18158
|
forceFloatingLabel: shouldShowLabel,
|
|
18020
18159
|
forceLabelText: hasLabelMeta,
|
|
18021
18160
|
hideErrorMessage: !renderErrorMessage,
|
|
18022
|
-
children:
|
|
18023
|
-
|
|
18024
|
-
|
|
18025
|
-
|
|
18026
|
-
|
|
18027
|
-
|
|
18028
|
-
|
|
18029
|
-
|
|
18030
|
-
|
|
18031
|
-
|
|
18032
|
-
|
|
18033
|
-
|
|
18034
|
-
|
|
18035
|
-
|
|
18036
|
-
|
|
18037
|
-
|
|
18038
|
-
|
|
18039
|
-
|
|
18040
|
-
|
|
18041
|
-
|
|
18042
|
-
|
|
18043
|
-
|
|
18044
|
-
|
|
18045
|
-
|
|
18046
|
-
|
|
18047
|
-
|
|
18048
|
-
|
|
18049
|
-
|
|
18050
|
-
|
|
18161
|
+
children: [
|
|
18162
|
+
/* @__PURE__ */ jsx184(
|
|
18163
|
+
"input",
|
|
18164
|
+
{
|
|
18165
|
+
...props,
|
|
18166
|
+
id: inputId,
|
|
18167
|
+
ref: setRefs,
|
|
18168
|
+
type: inputType,
|
|
18169
|
+
disabled: isBlocked,
|
|
18170
|
+
value,
|
|
18171
|
+
defaultValue,
|
|
18172
|
+
onChange: handleChange,
|
|
18173
|
+
onFocus: handleFocus,
|
|
18174
|
+
onBlur: handleBlur,
|
|
18175
|
+
placeholder: "",
|
|
18176
|
+
"aria-invalid": hasInvalidState,
|
|
18177
|
+
"aria-busy": loading,
|
|
18178
|
+
"aria-describedby": error && renderErrorMessage ? errorId : void 0,
|
|
18179
|
+
"aria-label": accessibleLabel && hasLabelMeta ? accessibleLabel : void 0,
|
|
18180
|
+
"aria-labelledby": accessibleLabel && !hasLabelMeta ? labelId : void 0,
|
|
18181
|
+
className: cn(
|
|
18182
|
+
"absolute left-0 h-6 w-full border-0 bg-transparent p-0 text-[16px] leading-6 text-[#1F1F1B] outline-none placeholder:text-[#7A8399]",
|
|
18183
|
+
variant === "airbnb" ? "bottom-0" : "bottom-[12px]",
|
|
18184
|
+
hasInvalidState ? "text-[var(--status-danger)] placeholder:text-[var(--status-danger)]" : "",
|
|
18185
|
+
disabled ? "cursor-not-allowed" : loading ? "cursor-progress" : "",
|
|
18186
|
+
shouldShowPasswordReveal ? "pr-8" : "",
|
|
18187
|
+
inputClassName,
|
|
18188
|
+
className
|
|
18189
|
+
)
|
|
18190
|
+
}
|
|
18191
|
+
),
|
|
18192
|
+
shouldShowPasswordReveal && /* @__PURE__ */ jsx184(
|
|
18193
|
+
"button",
|
|
18194
|
+
{
|
|
18195
|
+
type: "button",
|
|
18196
|
+
onClick: togglePasswordReveal,
|
|
18197
|
+
disabled: isBlocked,
|
|
18198
|
+
className: cn(
|
|
18199
|
+
"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",
|
|
18200
|
+
variant === "airbnb" ? "bottom-0" : "bottom-[12px]"
|
|
18201
|
+
),
|
|
18202
|
+
"aria-label": isPasswordRevealed ? t("hide_password") : t("show_password"),
|
|
18203
|
+
children: /* @__PURE__ */ jsx184(
|
|
18204
|
+
Eye2,
|
|
18205
|
+
{
|
|
18206
|
+
size: 18,
|
|
18207
|
+
"aria-hidden": "true",
|
|
18208
|
+
className: cn(isPasswordRevealed ? "text-[#fc98dd]" : "")
|
|
18209
|
+
}
|
|
18210
|
+
)
|
|
18211
|
+
}
|
|
18212
|
+
)
|
|
18213
|
+
]
|
|
18051
18214
|
}
|
|
18052
18215
|
) });
|
|
18053
18216
|
}
|
|
@@ -18062,7 +18225,7 @@ import { ChevronDown as ChevronDown6 } from "lucide-react";
|
|
|
18062
18225
|
import * as React79 from "react";
|
|
18063
18226
|
|
|
18064
18227
|
// src/airbnb-fields/select/SelectDesktopMenu.tsx
|
|
18065
|
-
import { jsx as jsx185, jsxs as
|
|
18228
|
+
import { jsx as jsx185, jsxs as jsxs119 } from "react/jsx-runtime";
|
|
18066
18229
|
function AirbnbSelectDesktopMenu({
|
|
18067
18230
|
id,
|
|
18068
18231
|
options,
|
|
@@ -18081,7 +18244,7 @@ function AirbnbSelectDesktopMenu({
|
|
|
18081
18244
|
noOptionsMessage
|
|
18082
18245
|
}) {
|
|
18083
18246
|
const emptyMessage = noOptionsMessage?.();
|
|
18084
|
-
return /* @__PURE__ */
|
|
18247
|
+
return /* @__PURE__ */ jsxs119(
|
|
18085
18248
|
"div",
|
|
18086
18249
|
{
|
|
18087
18250
|
id,
|
|
@@ -18257,7 +18420,7 @@ function getMobileOptionStyles(index, scrollTop) {
|
|
|
18257
18420
|
}
|
|
18258
18421
|
|
|
18259
18422
|
// src/airbnb-fields/select/SelectMobileWheel.tsx
|
|
18260
|
-
import { jsx as jsx187, jsxs as
|
|
18423
|
+
import { jsx as jsx187, jsxs as jsxs120 } from "react/jsx-runtime";
|
|
18261
18424
|
function AirbnbSelectMobileWheel({
|
|
18262
18425
|
id,
|
|
18263
18426
|
options,
|
|
@@ -18276,7 +18439,7 @@ function AirbnbSelectMobileWheel({
|
|
|
18276
18439
|
}) {
|
|
18277
18440
|
const spacerHeight2 = getWheelSpacerHeight();
|
|
18278
18441
|
const emptyMessage = noOptionsMessage?.();
|
|
18279
|
-
return /* @__PURE__ */
|
|
18442
|
+
return /* @__PURE__ */ jsxs120(
|
|
18280
18443
|
"div",
|
|
18281
18444
|
{
|
|
18282
18445
|
id,
|
|
@@ -18301,7 +18464,7 @@ function AirbnbSelectMobileWheel({
|
|
|
18301
18464
|
)
|
|
18302
18465
|
}
|
|
18303
18466
|
),
|
|
18304
|
-
/* @__PURE__ */
|
|
18467
|
+
/* @__PURE__ */ jsxs120(
|
|
18305
18468
|
"div",
|
|
18306
18469
|
{
|
|
18307
18470
|
ref: listRef,
|
|
@@ -18351,7 +18514,7 @@ function AirbnbSelectMobileWheel({
|
|
|
18351
18514
|
}
|
|
18352
18515
|
|
|
18353
18516
|
// src/airbnb-fields/select/SelectMobileContent.tsx
|
|
18354
|
-
import { jsx as jsx188, jsxs as
|
|
18517
|
+
import { jsx as jsx188, jsxs as jsxs121 } from "react/jsx-runtime";
|
|
18355
18518
|
function AirbnbSelectMobileContent({
|
|
18356
18519
|
open,
|
|
18357
18520
|
onOpenChange,
|
|
@@ -18375,10 +18538,10 @@ function AirbnbSelectMobileContent({
|
|
|
18375
18538
|
getOptionId: getOptionId2,
|
|
18376
18539
|
noOptionsMessage
|
|
18377
18540
|
}) {
|
|
18378
|
-
return /* @__PURE__ */ jsx188(Drawer, { open, onOpenChange, children: /* @__PURE__ */
|
|
18541
|
+
return /* @__PURE__ */ jsx188(Drawer, { open, onOpenChange, children: /* @__PURE__ */ jsxs121(DrawerContent, { onClose, lockScroll: false, children: [
|
|
18379
18542
|
/* @__PURE__ */ jsx188(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
18380
18543
|
/* @__PURE__ */ jsx188(DrawerDescription, { className: "sr-only", children: label }),
|
|
18381
|
-
/* @__PURE__ */
|
|
18544
|
+
/* @__PURE__ */ jsxs121("div", { className: "px-6 pb-4 pt-1", children: [
|
|
18382
18545
|
/* @__PURE__ */ jsx188(
|
|
18383
18546
|
AirbnbSelectMobileWheel,
|
|
18384
18547
|
{
|
|
@@ -18823,7 +18986,7 @@ function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
|
18823
18986
|
}
|
|
18824
18987
|
|
|
18825
18988
|
// src/airbnb-fields/select/Select.tsx
|
|
18826
|
-
import { jsx as jsx190, jsxs as
|
|
18989
|
+
import { jsx as jsx190, jsxs as jsxs122 } from "react/jsx-runtime";
|
|
18827
18990
|
var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
18828
18991
|
options = [],
|
|
18829
18992
|
value,
|
|
@@ -19003,7 +19166,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19003
19166
|
handleMobileOpenChange(false);
|
|
19004
19167
|
}
|
|
19005
19168
|
};
|
|
19006
|
-
return /* @__PURE__ */
|
|
19169
|
+
return /* @__PURE__ */ jsxs122(
|
|
19007
19170
|
"div",
|
|
19008
19171
|
{
|
|
19009
19172
|
ref: containerRef,
|
|
@@ -19118,7 +19281,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
19118
19281
|
});
|
|
19119
19282
|
|
|
19120
19283
|
// src/airbnb-fields/phone-field/PhoneField.tsx
|
|
19121
|
-
import { jsx as jsx191, jsxs as
|
|
19284
|
+
import { jsx as jsx191, jsxs as jsxs123 } from "react/jsx-runtime";
|
|
19122
19285
|
function formatPhoneCodeOptionLabel2(option) {
|
|
19123
19286
|
const label = String(option.label);
|
|
19124
19287
|
const value = String(option.value);
|
|
@@ -19165,7 +19328,7 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
19165
19328
|
const hasInvalidState = Boolean(error) || Boolean(invalid);
|
|
19166
19329
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
19167
19330
|
const isCodeBlocked = isBlocked || Boolean(codeReadOnly);
|
|
19168
|
-
return /* @__PURE__ */
|
|
19331
|
+
return /* @__PURE__ */ jsxs123("div", { className: cn("w-full max-w-[var(--max-field-width)]", className), children: [
|
|
19169
19332
|
name && /* @__PURE__ */ jsx191("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
19170
19333
|
codeName && /* @__PURE__ */ jsx191(
|
|
19171
19334
|
"input",
|
|
@@ -19193,7 +19356,7 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
19193
19356
|
children: topLabel
|
|
19194
19357
|
}
|
|
19195
19358
|
),
|
|
19196
|
-
/* @__PURE__ */
|
|
19359
|
+
/* @__PURE__ */ jsxs123("div", { className: "flex items-stretch", children: [
|
|
19197
19360
|
/* @__PURE__ */ jsx191(
|
|
19198
19361
|
AirbnbSelect,
|
|
19199
19362
|
{
|
|
@@ -19225,7 +19388,7 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
19225
19388
|
onClick,
|
|
19226
19389
|
onKeyDown,
|
|
19227
19390
|
valueLabel
|
|
19228
|
-
}) => /* @__PURE__ */
|
|
19391
|
+
}) => /* @__PURE__ */ jsxs123(
|
|
19229
19392
|
"button",
|
|
19230
19393
|
{
|
|
19231
19394
|
id,
|
|
@@ -19303,7 +19466,7 @@ import * as React81 from "react";
|
|
|
19303
19466
|
import { ChevronDown as ChevronDown7, Search as Search4 } from "lucide-react";
|
|
19304
19467
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
19305
19468
|
import { useCallback as useCallback57 } from "react";
|
|
19306
|
-
import { jsx as jsx192, jsxs as
|
|
19469
|
+
import { jsx as jsx192, jsxs as jsxs124 } from "react/jsx-runtime";
|
|
19307
19470
|
var ROW_HEIGHT = 48;
|
|
19308
19471
|
var DESKTOP_LIST_HEIGHT = 280;
|
|
19309
19472
|
var MOBILE_LIST_HEIGHT = 420;
|
|
@@ -19500,7 +19663,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
19500
19663
|
}
|
|
19501
19664
|
);
|
|
19502
19665
|
React81.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
19503
|
-
return /* @__PURE__ */
|
|
19666
|
+
return /* @__PURE__ */ jsxs124("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
|
|
19504
19667
|
name && /* @__PURE__ */ jsx192("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
19505
19668
|
/* @__PURE__ */ jsx192(
|
|
19506
19669
|
AirbnbFieldTrigger,
|
|
@@ -19560,7 +19723,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
19560
19723
|
}
|
|
19561
19724
|
closeSelect();
|
|
19562
19725
|
},
|
|
19563
|
-
children: /* @__PURE__ */
|
|
19726
|
+
children: /* @__PURE__ */ jsxs124(DrawerContent, { onClose: closeSelect, lockScroll: false, children: [
|
|
19564
19727
|
/* @__PURE__ */ jsx192(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
19565
19728
|
/* @__PURE__ */ jsx192(DrawerDescription, { className: "sr-only", children: label }),
|
|
19566
19729
|
/* @__PURE__ */ jsx192("div", { className: "px-5 pb-5 pt-1", children: content })
|
|
@@ -19633,8 +19796,8 @@ function AirbnbSearchableSelectContent({
|
|
|
19633
19796
|
virtualizer.scrollToIndex(highlightedIndex, { align: "auto" });
|
|
19634
19797
|
}
|
|
19635
19798
|
}, [highlightedIndex, virtualizer]);
|
|
19636
|
-
return /* @__PURE__ */
|
|
19637
|
-
/* @__PURE__ */
|
|
19799
|
+
return /* @__PURE__ */ jsxs124("div", { className: "p-2", children: [
|
|
19800
|
+
/* @__PURE__ */ jsxs124("div", { className: "relative mb-2", children: [
|
|
19638
19801
|
/* @__PURE__ */ jsx192(
|
|
19639
19802
|
Search4,
|
|
19640
19803
|
{
|
|
@@ -19745,13 +19908,13 @@ function getNextEnabledIndex(options, startIndex, step) {
|
|
|
19745
19908
|
|
|
19746
19909
|
// src/airbnb-fields/search-input/SearchInput.tsx
|
|
19747
19910
|
import * as React82 from "react";
|
|
19748
|
-
import { useTranslation as
|
|
19911
|
+
import { useTranslation as useTranslation45 } from "react-i18next";
|
|
19749
19912
|
import { Search as Search5, X as X11 } from "lucide-react";
|
|
19750
|
-
import { jsx as jsx193, jsxs as
|
|
19913
|
+
import { jsx as jsx193, jsxs as jsxs125 } from "react/jsx-runtime";
|
|
19751
19914
|
var AirbnbSearchInput = React82.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
|
|
19752
|
-
const { t } =
|
|
19915
|
+
const { t } = useTranslation45();
|
|
19753
19916
|
const placeholderText = placeholder || t("search_property") + "...";
|
|
19754
|
-
return /* @__PURE__ */
|
|
19917
|
+
return /* @__PURE__ */ jsxs125("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
|
|
19755
19918
|
/* @__PURE__ */ jsx193(Search5, { className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]" }),
|
|
19756
19919
|
/* @__PURE__ */ jsx193(
|
|
19757
19920
|
"input",
|
|
@@ -19784,6 +19947,51 @@ var AirbnbSearchInput = React82.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
19784
19947
|
] });
|
|
19785
19948
|
});
|
|
19786
19949
|
AirbnbSearchInput.displayName = "AirbnbSearchInput";
|
|
19950
|
+
|
|
19951
|
+
// src/airbnb-fields/switch/Switch.tsx
|
|
19952
|
+
import * as React83 from "react";
|
|
19953
|
+
import * as SwitchPrimitives2 from "@radix-ui/react-switch";
|
|
19954
|
+
import { Check as Check7 } from "lucide-react";
|
|
19955
|
+
import { jsx as jsx194 } from "react/jsx-runtime";
|
|
19956
|
+
var AirbnbSwitch = React83.forwardRef(({ className, value, onChange, disabled, loading, readOnly, ...props }, ref) => /* @__PURE__ */ jsx194(
|
|
19957
|
+
SwitchPrimitives2.Root,
|
|
19958
|
+
{
|
|
19959
|
+
ref,
|
|
19960
|
+
className: cn(
|
|
19961
|
+
"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",
|
|
19962
|
+
"focus-visible:outline-none focus-visible:shadow-[var(--chekin-shadow-focus)]",
|
|
19963
|
+
"disabled:cursor-not-allowed disabled:opacity-50 aria-busy:cursor-wait aria-busy:opacity-50",
|
|
19964
|
+
"aria-readonly:cursor-default aria-readonly:opacity-100",
|
|
19965
|
+
"data-[state=checked]:bg-[#222222] data-[state=unchecked]:bg-[#E7E7E4]",
|
|
19966
|
+
className
|
|
19967
|
+
),
|
|
19968
|
+
disabled,
|
|
19969
|
+
checked: value,
|
|
19970
|
+
value: String(value),
|
|
19971
|
+
onCheckedChange: !disabled && !readOnly ? onChange : void 0,
|
|
19972
|
+
"aria-busy": loading,
|
|
19973
|
+
"aria-readonly": readOnly,
|
|
19974
|
+
...props,
|
|
19975
|
+
children: /* @__PURE__ */ jsx194(
|
|
19976
|
+
SwitchPrimitives2.Thumb,
|
|
19977
|
+
{
|
|
19978
|
+
className: cn(
|
|
19979
|
+
"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",
|
|
19980
|
+
"data-[state=checked]:translate-x-[12px] data-[state=unchecked]:translate-x-0"
|
|
19981
|
+
),
|
|
19982
|
+
children: /* @__PURE__ */ jsx194(
|
|
19983
|
+
Check7,
|
|
19984
|
+
{
|
|
19985
|
+
"aria-hidden": "true",
|
|
19986
|
+
className: "h-3 w-3 text-[#222222] opacity-0 transition-opacity duration-150 group-data-[state=checked]:opacity-100",
|
|
19987
|
+
strokeWidth: 3
|
|
19988
|
+
}
|
|
19989
|
+
)
|
|
19990
|
+
}
|
|
19991
|
+
)
|
|
19992
|
+
}
|
|
19993
|
+
));
|
|
19994
|
+
AirbnbSwitch.displayName = "AirbnbSwitch";
|
|
19787
19995
|
export {
|
|
19788
19996
|
ALERT_BOX_VARIANTS,
|
|
19789
19997
|
Accordion,
|
|
@@ -19797,6 +20005,7 @@ export {
|
|
|
19797
20005
|
AirbnbSearchInput,
|
|
19798
20006
|
AirbnbSearchableSelect,
|
|
19799
20007
|
AirbnbSelect,
|
|
20008
|
+
AirbnbSwitch,
|
|
19800
20009
|
Alert,
|
|
19801
20010
|
AlertBox,
|
|
19802
20011
|
AlertDescription,
|