@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.js CHANGED
@@ -12512,9 +12512,9 @@ import { useTranslation as useTranslation28 } from "react-i18next";
12512
12512
 
12513
12513
  // src/dashboard/_select-internals/utils.ts
12514
12514
  function isOptionGroup(item) {
12515
- return Boolean(
12516
- item && Array.isArray(item.options)
12517
- );
12515
+ if (!item || typeof item !== "object") return false;
12516
+ if ("value" in item) return false;
12517
+ return Array.isArray(item.options);
12518
12518
  }
12519
12519
  function flattenGroupedOptions(items) {
12520
12520
  if (!items) return [];
@@ -12625,7 +12625,7 @@ function DefaultOption(props) {
12625
12625
 
12626
12626
  // src/dashboard/_select-internals/SelectMenu.tsx
12627
12627
  import { jsx as jsx146, jsxs as jsxs93 } from "react/jsx-runtime";
12628
- function buildMenuEntries(groupedOptions, options, formatGroupLabel) {
12628
+ function buildMenuEntries(groupedOptions, options, formatGroupLabel, listboxId) {
12629
12629
  if (!groupedOptions || !groupedOptions.some((item) => isOptionGroup(item))) {
12630
12630
  return options.map((option, index) => ({
12631
12631
  kind: "option",
@@ -12634,38 +12634,39 @@ function buildMenuEntries(groupedOptions, options, formatGroupLabel) {
12634
12634
  flatIndex: index
12635
12635
  }));
12636
12636
  }
12637
- const indexByOption = /* @__PURE__ */ new Map();
12638
- options.forEach((option, index) => indexByOption.set(option, index));
12637
+ const visibleValues = new Set(options.map((option) => option.value));
12639
12638
  const entries = [];
12639
+ let flatIndex = 0;
12640
12640
  let groupCount = 0;
12641
12641
  for (const item of groupedOptions) {
12642
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",
12643
+ const visible = [];
12644
+ for (const option of item.options) {
12645
+ if (!visibleValues.has(option.value)) continue;
12646
+ visible.push({
12656
12647
  key: `${String(option.value)}-${flatIndex}`,
12657
12648
  option,
12658
12649
  flatIndex
12659
12650
  });
12651
+ flatIndex += 1;
12660
12652
  }
12661
- } else if (indexByOption.has(item)) {
12662
- const flatIndex = indexByOption.get(item);
12653
+ if (visible.length === 0) continue;
12654
+ entries.push({
12655
+ kind: "group",
12656
+ key: `__group-${groupCount}`,
12657
+ labelId: `${listboxId}-group-${groupCount}`,
12658
+ label: formatGroupLabel ? formatGroupLabel(item) : item.label,
12659
+ options: visible
12660
+ });
12661
+ groupCount += 1;
12662
+ } else if (visibleValues.has(item.value)) {
12663
12663
  entries.push({
12664
12664
  kind: "option",
12665
12665
  key: `${String(item.value)}-${flatIndex}`,
12666
12666
  option: item,
12667
12667
  flatIndex
12668
12668
  });
12669
+ flatIndex += 1;
12669
12670
  }
12670
12671
  }
12671
12672
  return entries;
@@ -12709,9 +12710,37 @@ function SelectMenu({
12709
12710
  [selectedValues, selectedValue]
12710
12711
  );
12711
12712
  const entries = React45.useMemo(
12712
- () => buildMenuEntries(groupedOptions, options, formatGroupLabel),
12713
- [groupedOptions, options, formatGroupLabel]
12713
+ () => buildMenuEntries(groupedOptions, options, formatGroupLabel, id),
12714
+ [groupedOptions, options, formatGroupLabel, id]
12714
12715
  );
12716
+ const renderOption = (entry) => {
12717
+ const { option, flatIndex, key } = entry;
12718
+ const isSelected = isOptionSelected2 ? isOptionSelected2(option, selectedList) : isOptionSelected(option, selectedValue, selectedValues);
12719
+ const isHighlighted = flatIndex === highlightedIndex;
12720
+ const optionDisabled = Boolean(
12721
+ disabled || option.isDisabled || isOptionDisabled?.(option)
12722
+ );
12723
+ return /* @__PURE__ */ jsx146(
12724
+ Option,
12725
+ {
12726
+ id: getOptionId2(flatIndex),
12727
+ option,
12728
+ index: flatIndex,
12729
+ isSelected,
12730
+ isHighlighted,
12731
+ isDisabled: optionDisabled,
12732
+ isLast: flatIndex === lastIndex,
12733
+ isMulti: Boolean(isMulti),
12734
+ onClick: onOptionClick,
12735
+ onHover: onOptionHover ?? (() => void 0),
12736
+ innerRef: (node) => selectedOptionRef?.(flatIndex, node),
12737
+ inputValue,
12738
+ selectedOptions: selectedList,
12739
+ formatOptionLabel
12740
+ },
12741
+ key
12742
+ );
12743
+ };
12715
12744
  const wasAtBottomRef = React45.useRef(false);
12716
12745
  const handleScroll = React45.useCallback(
12717
12746
  (event) => {
@@ -12746,43 +12775,20 @@ function SelectMenu({
12746
12775
  children: [
12747
12776
  !hasOptions && (emptyContent ?? /* @__PURE__ */ jsx146("div", { className: "px-3 py-3 text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: emptyMessage })),
12748
12777
  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
- );
12778
+ if (entry.kind === "group") {
12779
+ return /* @__PURE__ */ jsxs93("div", { role: "group", "aria-labelledby": entry.labelId, children: [
12780
+ /* @__PURE__ */ jsx146(
12781
+ "div",
12782
+ {
12783
+ id: entry.labelId,
12784
+ className: "px-3 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-[var(--chekin-color-gray-1)]",
12785
+ children: entry.label
12786
+ }
12787
+ ),
12788
+ entry.options.map(renderOption)
12789
+ ] }, entry.key);
12759
12790
  }
12760
- const { option, flatIndex } = entry;
12761
- const isSelected = isOptionSelected2 ? isOptionSelected2(option, selectedList) : isOptionSelected(option, selectedValue, selectedValues);
12762
- const isHighlighted = flatIndex === highlightedIndex;
12763
- const optionDisabled = Boolean(
12764
- disabled || option.isDisabled || isOptionDisabled?.(option)
12765
- );
12766
- return /* @__PURE__ */ jsx146(
12767
- Option,
12768
- {
12769
- id: getOptionId2(flatIndex),
12770
- option,
12771
- index: flatIndex,
12772
- isSelected,
12773
- isHighlighted,
12774
- isDisabled: optionDisabled,
12775
- isLast: flatIndex === lastIndex,
12776
- isMulti: Boolean(isMulti),
12777
- onClick: onOptionClick,
12778
- onHover: onOptionHover ?? (() => void 0),
12779
- innerRef: (node) => selectedOptionRef?.(flatIndex, node),
12780
- inputValue,
12781
- selectedOptions: selectedList,
12782
- formatOptionLabel
12783
- },
12784
- entry.key
12785
- );
12791
+ return renderOption(entry);
12786
12792
  }),
12787
12793
  footer
12788
12794
  ]
@@ -14311,7 +14317,14 @@ function InfiniteScrollSelectInternal(props, ref) {
14311
14317
  if (synthetic) list = [synthetic, ...list];
14312
14318
  }
14313
14319
  return list;
14314
- }, [rawOptions, inputValue, filterOption, getFullSearchOption, rest.getValueLabel, props]);
14320
+ }, [
14321
+ rawOptions,
14322
+ inputValue,
14323
+ filterOption,
14324
+ getFullSearchOption,
14325
+ rest.getValueLabel,
14326
+ props
14327
+ ]);
14315
14328
  const contextValue = React52.useMemo(
14316
14329
  () => ({
14317
14330
  canLoadMore,
@@ -14787,13 +14800,7 @@ function createCountTrigger(opts) {
14787
14800
 
14788
14801
  // src/dashboard/select-checkboxes/SelectAllRow.tsx
14789
14802
  import { jsx as jsx167, jsxs as jsxs104 } from "react/jsx-runtime";
14790
- function SelectAllRow({
14791
- label,
14792
- checked,
14793
- indeterminate,
14794
- disabled,
14795
- onToggle
14796
- }) {
14803
+ function SelectAllRow({ label, checked, disabled, onToggle }) {
14797
14804
  return /* @__PURE__ */ jsxs104(
14798
14805
  "button",
14799
14806
  {
@@ -14808,7 +14815,7 @@ function SelectAllRow({
14808
14815
  /* @__PURE__ */ jsx167(
14809
14816
  BaseCheckbox,
14810
14817
  {
14811
- checked: indeterminate ? "indeterminate" : checked,
14818
+ checked,
14812
14819
  disabled,
14813
14820
  size: "s",
14814
14821
  tabIndex: -1,
@@ -14844,7 +14851,6 @@ function SelectCheckboxesInternal(props, ref) {
14844
14851
  allowSelectAll = false,
14845
14852
  selectAllLabel,
14846
14853
  searchable = true,
14847
- searchPlaceholder,
14848
14854
  filterOption = defaultFilterOption,
14849
14855
  closeMenuOnSelect = false,
14850
14856
  onSearchChange,
@@ -14879,7 +14885,6 @@ function SelectCheckboxesInternal(props, ref) {
14879
14885
  return acc + (selected.some((s) => s.value === option.value) ? 1 : 0);
14880
14886
  }, 0);
14881
14887
  const allVisibleSelected = filteredFlat.length > 0 && visibleSelectedCount === filteredFlat.length;
14882
- const someVisibleSelected = visibleSelectedCount > 0 && visibleSelectedCount < filteredFlat.length;
14883
14888
  const handleToggleAll = React59.useCallback(() => {
14884
14889
  if (allVisibleSelected) {
14885
14890
  const visibleValues = new Set(filteredFlat.map((option) => option.value));
@@ -14915,7 +14920,6 @@ function SelectCheckboxesInternal(props, ref) {
14915
14920
  {
14916
14921
  label: selectAllLabel ?? t("select_all", { defaultValue: "Select All" }),
14917
14922
  checked: allVisibleSelected,
14918
- indeterminate: someVisibleSelected,
14919
14923
  onToggle: handleToggleAll
14920
14924
  }
14921
14925
  ) : void 0;
@@ -17669,7 +17673,6 @@ import { Fragment as Fragment18, jsx as jsx182, jsxs as jsxs116 } from "react/js
17669
17673
  var AirbnbFieldTrigger = React72.forwardRef(
17670
17674
  ({
17671
17675
  as = "button",
17672
- variant = "airbnb",
17673
17676
  id,
17674
17677
  label,
17675
17678
  topLabel,
@@ -17722,7 +17725,6 @@ var AirbnbFieldTrigger = React72.forwardRef(
17722
17725
  )
17723
17726
  ] }) : visibleLabelText;
17724
17727
  const animatedLabel = forceLabelText ? resolvedLabelText ?? placeholder : isRaised ? resolvedLabelText : label ?? placeholder;
17725
- const isAirbnbVariant = variant === "airbnb";
17726
17728
  const hasInvalidState = Boolean(error);
17727
17729
  const errorMessage = typeof error === "string" ? error : void 0;
17728
17730
  const isBlocked = Boolean(disabled) || Boolean(loading);
@@ -17737,11 +17739,11 @@ var AirbnbFieldTrigger = React72.forwardRef(
17737
17739
  )
17738
17740
  ] }) : void 0;
17739
17741
  const sharedClasses = cn(
17740
- "relative flex w-full items-center border bg-white text-left transition-colors focus-visible:outline-none",
17741
- isAirbnbVariant ? "rounded-[12px] border-[#8c8c8c] pl-4 pr-4 focus-visible:ring-2 focus-visible:ring-[#222222] focus-visible:ring-offset-2" : "rounded-[10px] px-3.5 focus-visible:border-[var(--chekin-color-brand-blue)]",
17742
- isAirbnbVariant ? isRaised ? "min-h-[60px]" : "h-[60px]" : "min-h-[48px]",
17743
- hasInvalidState ? isAirbnbVariant ? "border-[var(--error-message-color)] bg-[#FFF5F3]" : "border-[var(--error-message-color)] bg-white" : isAirbnbVariant ? "border-[#8c8c8c]" : "border-[#A8A8A4] bg-white",
17744
- disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : isAirbnbVariant ? "cursor-pointer" : "cursor-text",
17742
+ "relative flex w-full items-center border bg-transparent text-left transition-colors focus-visible:outline-none",
17743
+ "rounded-[12px] border-[#8c8c8c] pl-4 pr-4 focus-visible:ring-2 focus-visible:ring-[#222222] focus-visible:ring-offset-2",
17744
+ isRaised ? "min-h-[60px]" : "h-[60px]",
17745
+ hasInvalidState ? "border-[var(--error-message-color)] bg-[#FFF5F3]" : "border-[#8c8c8c]",
17746
+ disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : "cursor-pointer",
17745
17747
  className
17746
17748
  );
17747
17749
  const sharedContent = /* @__PURE__ */ jsxs116(Fragment18, { children: [
@@ -17750,7 +17752,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
17750
17752
  {
17751
17753
  className: cn(
17752
17754
  "relative min-w-0 flex-1 pr-2",
17753
- isAirbnbVariant ? isRaised ? "h-[42px]" : "h-[28px]" : "h-[48px]",
17755
+ isRaised ? "h-[42px]" : "h-[28px]",
17754
17756
  contentClassName
17755
17757
  ),
17756
17758
  children: [
@@ -17761,8 +17763,8 @@ var AirbnbFieldTrigger = React72.forwardRef(
17761
17763
  className: cn(
17762
17764
  "absolute left-0 origin-left transition-all duration-200 ease-out",
17763
17765
  hasLabelMeta ? "max-w-full" : "pointer-events-none truncate",
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",
17765
- hasInvalidState ? "text-[var(--error-message-color)]" : isAirbnbVariant ? "text-[#6c6c6c]" : "text-[#7A8399]"
17766
+ isRaised ? "top-[-1px] translate-y-0 text-xs leading-5" : "top-1/2 -translate-y-1/2 text-[16px] leading-7",
17767
+ hasInvalidState ? "text-[var(--error-message-color)]" : "text-[#6c6c6c]"
17766
17768
  ),
17767
17769
  children: animatedLabel
17768
17770
  }
@@ -17773,7 +17775,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
17773
17775
  id: valueId,
17774
17776
  className: cn(
17775
17777
  "absolute left-0 block truncate transition-all duration-200 ease-out",
17776
- isAirbnbVariant ? "bottom-0 translate-y-0 text-[16px] leading-6 opacity-100" : "bottom-[11px] text-[16px] leading-6",
17778
+ "bottom-0 translate-y-0 text-[16px] leading-6 opacity-100",
17777
17779
  hasInvalidState ? "text-[var(--error-message-color)]" : "text-[#222222]"
17778
17780
  ),
17779
17781
  children: valueText
@@ -17786,10 +17788,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
17786
17788
  "span",
17787
17789
  {
17788
17790
  "aria-hidden": "true",
17789
- className: cn(
17790
- "pointer-events-none absolute top-1/2 -translate-y-1/2",
17791
- isAirbnbVariant ? "right-5" : "right-4"
17792
- ),
17791
+ className: "pointer-events-none absolute right-5 top-1/2 -translate-y-1/2",
17793
17792
  children: resolvedTrailingAdornment
17794
17793
  }
17795
17794
  )
@@ -17841,7 +17840,6 @@ import { jsx as jsx183, jsxs as jsxs117 } from "react/jsx-runtime";
17841
17840
  var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
17842
17841
  var AirbnbDatePicker = React73.forwardRef(
17843
17842
  ({
17844
- variant = "default",
17845
17843
  label,
17846
17844
  topLabel,
17847
17845
  value,
@@ -17968,7 +17966,6 @@ var AirbnbDatePicker = React73.forwardRef(
17968
17966
  {
17969
17967
  id: triggerId,
17970
17968
  ref: combinedRef,
17971
- variant,
17972
17969
  label,
17973
17970
  topLabel,
17974
17971
  labelId,
@@ -18034,7 +18031,6 @@ import { jsx as jsx184, jsxs as jsxs118 } from "react/jsx-runtime";
18034
18031
  var getInputValue = (value) => value != null ? String(value) : "";
18035
18032
  var AirbnbInput = React74.forwardRef(
18036
18033
  ({
18037
- variant = "default",
18038
18034
  label,
18039
18035
  topLabel,
18040
18036
  helperText,
@@ -18130,7 +18126,6 @@ var AirbnbInput = React74.forwardRef(
18130
18126
  AirbnbFieldTrigger,
18131
18127
  {
18132
18128
  as: "div",
18133
- variant,
18134
18129
  id: fieldId,
18135
18130
  label: accessibleLabel ?? "",
18136
18131
  topLabel,
@@ -18146,14 +18141,11 @@ var AirbnbInput = React74.forwardRef(
18146
18141
  tooltip,
18147
18142
  describedBy: error && renderErrorMessage ? errorId : void 0,
18148
18143
  className: cn(
18149
- variant === "airbnb" ? "px-4 focus-within:ring-2 focus-within:ring-[#1F1F1B] focus-within:ring-offset-2" : "px-3.5 focus-within:border-[#315EFB]",
18144
+ "px-4 focus-within:ring-2 focus-within:ring-[#1F1F1B] focus-within:ring-offset-2",
18150
18145
  disabled ? "cursor-not-allowed" : "cursor-text",
18151
18146
  fieldClassName
18152
18147
  ),
18153
- contentClassName: cn(
18154
- variant === "airbnb" ? "h-[42px]" : "h-[48px]",
18155
- contentClassName
18156
- ),
18148
+ contentClassName: cn("h-[42px]", contentClassName),
18157
18149
  trailingAdornment: shouldShowPasswordReveal ? void 0 : trailingAdornment,
18158
18150
  forceFloatingLabel: shouldShowLabel,
18159
18151
  forceLabelText: hasLabelMeta,
@@ -18180,7 +18172,7 @@ var AirbnbInput = React74.forwardRef(
18180
18172
  "aria-labelledby": accessibleLabel && !hasLabelMeta ? labelId : void 0,
18181
18173
  className: cn(
18182
18174
  "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]",
18175
+ "bottom-0",
18184
18176
  hasInvalidState ? "text-[var(--status-danger)] placeholder:text-[var(--status-danger)]" : "",
18185
18177
  disabled ? "cursor-not-allowed" : loading ? "cursor-progress" : "",
18186
18178
  shouldShowPasswordReveal ? "pr-8" : "",
@@ -18195,10 +18187,7 @@ var AirbnbInput = React74.forwardRef(
18195
18187
  type: "button",
18196
18188
  onClick: togglePasswordReveal,
18197
18189
  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
- ),
18190
+ 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",
18202
18191
  "aria-label": isPasswordRevealed ? t("hide_password") : t("show_password"),
18203
18192
  children: /* @__PURE__ */ jsx184(
18204
18193
  Eye2,
@@ -18574,7 +18563,6 @@ var AirbnbSelectTrigger = React75.forwardRef(
18574
18563
  ({
18575
18564
  id,
18576
18565
  open,
18577
- variant,
18578
18566
  label,
18579
18567
  topLabel,
18580
18568
  helperText,
@@ -18600,7 +18588,6 @@ var AirbnbSelectTrigger = React75.forwardRef(
18600
18588
  {
18601
18589
  id,
18602
18590
  ref,
18603
- variant,
18604
18591
  "aria-haspopup": "listbox",
18605
18592
  "aria-expanded": open,
18606
18593
  "aria-controls": listboxId,
@@ -18992,7 +18979,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
18992
18979
  value,
18993
18980
  onChange,
18994
18981
  onBlur,
18995
- variant = "default",
18996
18982
  label,
18997
18983
  topLabel,
18998
18984
  placeholder,
@@ -19011,11 +18997,13 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19011
18997
  doneLabel = "Done",
19012
18998
  mobileTitle,
19013
18999
  name,
19014
- noOptionsMessage
19000
+ noOptionsMessage,
19001
+ filterOption
19015
19002
  }, ref) {
19016
19003
  const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
19017
19004
  const [isOpen, setIsOpen] = React79.useState(false);
19018
19005
  const containerRef = React79.useRef(null);
19006
+ const filteredOptions = filterOption ? options.filter(filterOption) : options;
19019
19007
  const hasValue = Boolean(value);
19020
19008
  const helperText = placeholder ?? label;
19021
19009
  const shouldDescribeHelperText = !hasValue && helperText !== label;
@@ -19046,7 +19034,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19046
19034
  } = useMobileSelectWheel({
19047
19035
  isMobile: isMobile3,
19048
19036
  isOpen,
19049
- options,
19037
+ options: filteredOptions,
19050
19038
  value,
19051
19039
  disabled: isBlocked
19052
19040
  });
@@ -19063,13 +19051,13 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19063
19051
  } = useDesktopSelect({
19064
19052
  isMobile: isMobile3,
19065
19053
  isOpen,
19066
- options,
19054
+ options: filteredOptions,
19067
19055
  value,
19068
19056
  disabled: isBlocked,
19069
19057
  onChange
19070
19058
  });
19071
19059
  const combinedRef = useCombinedRef(ref, desktopTriggerRef);
19072
- const activeMobileIndex = getOptionIndex2(options, pendingValue);
19060
+ const activeMobileIndex = getOptionIndex2(filteredOptions, pendingValue);
19073
19061
  const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
19074
19062
  useOutsideClick({
19075
19063
  elementRef: containerRef,
@@ -19086,12 +19074,12 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19086
19074
  if (value?.value === void 0 || value.value === null || value.label !== "") {
19087
19075
  return;
19088
19076
  }
19089
- const validOption = options.find((option) => option.value === value.value);
19077
+ const validOption = filteredOptions.find((option) => option.value === value.value);
19090
19078
  if (validOption) {
19091
19079
  onChange(validOption);
19092
19080
  }
19093
19081
  },
19094
- [onChange, options, value]
19082
+ [onChange, filteredOptions, value]
19095
19083
  );
19096
19084
  const handleMobileOpenChange = React79.useCallback(
19097
19085
  (nextOpen) => {
@@ -19176,7 +19164,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19176
19164
  renderTrigger ? renderTrigger({
19177
19165
  id: triggerId,
19178
19166
  open: isOpen,
19179
- variant,
19180
19167
  label,
19181
19168
  topLabel,
19182
19169
  helperText,
@@ -19200,7 +19187,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19200
19187
  id: triggerId,
19201
19188
  ref: combinedRef,
19202
19189
  open: isOpen,
19203
- variant,
19204
19190
  label,
19205
19191
  topLabel,
19206
19192
  helperText,
@@ -19234,7 +19220,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19234
19220
  mobileTitle,
19235
19221
  doneLabel,
19236
19222
  errorId: describedErrorId,
19237
- options,
19223
+ options: filteredOptions,
19238
19224
  disabled: isBlocked,
19239
19225
  menuClassName,
19240
19226
  scrollTop: mobileScrollTop,
@@ -19254,7 +19240,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19254
19240
  listboxId,
19255
19241
  labelId,
19256
19242
  errorId: describedErrorId,
19257
- options,
19243
+ options: filteredOptions,
19258
19244
  value,
19259
19245
  highlightedIndex,
19260
19246
  onOptionClick: (option) => {
@@ -19289,7 +19275,6 @@ function formatPhoneCodeOptionLabel2(option) {
19289
19275
  }
19290
19276
  var AirbnbPhoneField = React80.forwardRef(
19291
19277
  ({
19292
- variant = "default",
19293
19278
  label,
19294
19279
  topLabel,
19295
19280
  value,
@@ -19361,7 +19346,6 @@ var AirbnbPhoneField = React80.forwardRef(
19361
19346
  AirbnbSelect,
19362
19347
  {
19363
19348
  ref,
19364
- variant,
19365
19349
  options: codeOptions,
19366
19350
  value: selectedCodeOption,
19367
19351
  onChange: (option) => onChange({
@@ -19380,7 +19364,6 @@ var AirbnbPhoneField = React80.forwardRef(
19380
19364
  renderTrigger: ({
19381
19365
  id,
19382
19366
  open,
19383
- variant: selectVariant,
19384
19367
  disabled: triggerDisabled,
19385
19368
  loading: triggerLoading,
19386
19369
  listboxId,
@@ -19404,9 +19387,8 @@ var AirbnbPhoneField = React80.forwardRef(
19404
19387
  onClick,
19405
19388
  onKeyDown,
19406
19389
  className: cn(
19407
- "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",
19408
- selectVariant === "airbnb" ? "h-full min-h-[60px] rounded-l-[16px] rounded-r-none px-4 focus-visible:ring-2 focus-visible:ring-[#1F1F1B] focus-visible:ring-offset-2" : "min-h-[48px] rounded-l-[10px] rounded-r-none px-3.5 focus-visible:border-[#315EFB]",
19409
- 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]",
19390
+ "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",
19391
+ hasInvalidState ? "border-[var(--status-danger)] bg-[#F2F2F2] text-[var(--status-danger)]" : "border-[#8C8C8C] bg-[#F4F4F2] text-[#1F1F1B]",
19410
19392
  triggerDisabled ? "cursor-not-allowed opacity-50" : triggerLoading ? "cursor-progress" : "cursor-pointer"
19411
19393
  ),
19412
19394
  children: [
@@ -19427,7 +19409,6 @@ var AirbnbPhoneField = React80.forwardRef(
19427
19409
  AirbnbInput,
19428
19410
  {
19429
19411
  id: inputId,
19430
- variant,
19431
19412
  type: "tel",
19432
19413
  inputMode: "tel",
19433
19414
  label,
@@ -19442,10 +19423,8 @@ var AirbnbPhoneField = React80.forwardRef(
19442
19423
  tooltip,
19443
19424
  renderErrorMessage: false,
19444
19425
  wrapperClassName: "min-w-0 flex-1",
19445
- fieldClassName: cn(
19446
- variant === "airbnb" ? "min-h-[60px] rounded-l-none rounded-r-[16px] border-l-0" : "rounded-l-none rounded-r-[10px] border-l-0"
19447
- ),
19448
- contentClassName: cn(variant === "airbnb" ? "h-[40px] py-2" : "h-[48px]"),
19426
+ fieldClassName: "min-h-[60px] rounded-l-none rounded-r-[16px] border-l-0",
19427
+ contentClassName: "h-[40px] py-2",
19449
19428
  inputClassName: "text-[16px] leading-7",
19450
19429
  onChange: (event) => onChange({
19451
19430
  code: value?.code ?? "",
@@ -19486,7 +19465,6 @@ var AirbnbSearchableSelectInternal = ({
19486
19465
  loading,
19487
19466
  hasNextPage,
19488
19467
  onLoadMore,
19489
- variant = "default",
19490
19468
  label,
19491
19469
  topLabel,
19492
19470
  placeholder,
@@ -19670,7 +19648,6 @@ var AirbnbSearchableSelectInternal = ({
19670
19648
  {
19671
19649
  id: `${reactId}-trigger`,
19672
19650
  ref: triggerRef,
19673
- variant,
19674
19651
  "aria-haspopup": "listbox",
19675
19652
  "aria-expanded": open,
19676
19653
  "aria-controls": listboxId,
@@ -19952,45 +19929,84 @@ AirbnbSearchInput.displayName = "AirbnbSearchInput";
19952
19929
  import * as React83 from "react";
19953
19930
  import * as SwitchPrimitives2 from "@radix-ui/react-switch";
19954
19931
  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
- ),
19932
+ import { Fragment as Fragment19, jsx as jsx194, jsxs as jsxs126 } from "react/jsx-runtime";
19933
+ var AirbnbSwitch = React83.forwardRef(
19934
+ ({
19935
+ className,
19936
+ value,
19937
+ onChange,
19968
19938
  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,
19939
+ loading,
19940
+ readOnly,
19941
+ id,
19942
+ label,
19943
+ error,
19944
+ wrapperClassName,
19945
+ ...props
19946
+ }, ref) => {
19947
+ const generatedId = React83.useId();
19948
+ const fieldId = id || generatedId;
19949
+ const switchElement = /* @__PURE__ */ jsx194(
19950
+ SwitchPrimitives2.Root,
19977
19951
  {
19952
+ ref,
19978
19953
  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"
19954
+ "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",
19955
+ "focus-visible:outline-none focus-visible:shadow-[var(--chekin-shadow-focus)]",
19956
+ "disabled:cursor-not-allowed disabled:opacity-50 aria-busy:cursor-wait aria-busy:opacity-50",
19957
+ "aria-readonly:cursor-default aria-readonly:opacity-100",
19958
+ "data-[state=checked]:bg-[#222222] data-[state=unchecked]:bg-[#E7E7E4]",
19959
+ className
19981
19960
  ),
19961
+ id: fieldId,
19962
+ disabled,
19963
+ checked: value,
19964
+ value: String(value),
19965
+ onCheckedChange: !disabled && !readOnly ? onChange : void 0,
19966
+ "aria-busy": loading,
19967
+ "aria-readonly": readOnly,
19968
+ ...props,
19982
19969
  children: /* @__PURE__ */ jsx194(
19983
- Check7,
19970
+ SwitchPrimitives2.Thumb,
19984
19971
  {
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
19972
+ className: cn(
19973
+ "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",
19974
+ "data-[state=checked]:translate-x-[12px] data-[state=unchecked]:translate-x-0"
19975
+ ),
19976
+ children: /* @__PURE__ */ jsx194(
19977
+ Check7,
19978
+ {
19979
+ "aria-hidden": "true",
19980
+ className: "h-3 w-3 text-[#222222] opacity-0 transition-opacity duration-150 group-data-[state=checked]:opacity-100",
19981
+ strokeWidth: 3
19982
+ }
19983
+ )
19988
19984
  }
19989
19985
  )
19990
19986
  }
19991
- )
19987
+ );
19988
+ if (!label && !error) {
19989
+ return switchElement;
19990
+ }
19991
+ return /* @__PURE__ */ jsxs126(Fragment19, { children: [
19992
+ /* @__PURE__ */ jsxs126("div", { className: cn("flex items-center gap-x-3 gap-y-1.5", wrapperClassName), children: [
19993
+ switchElement,
19994
+ label && /* @__PURE__ */ jsx194(
19995
+ Label,
19996
+ {
19997
+ htmlFor: fieldId,
19998
+ className: cn(
19999
+ "text-base font-medium",
20000
+ readOnly ? "cursor-default" : "cursor-pointer"
20001
+ ),
20002
+ children: label
20003
+ }
20004
+ )
20005
+ ] }),
20006
+ error && /* @__PURE__ */ jsx194(ErrorMessage, { disabled, children: error })
20007
+ ] });
19992
20008
  }
19993
- ));
20009
+ );
19994
20010
  AirbnbSwitch.displayName = "AirbnbSwitch";
19995
20011
  export {
19996
20012
  ALERT_BOX_VARIANTS,