@chekinapp/ui 0.0.115 → 0.0.117

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
@@ -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(--chekin-color-brand-navy)]",
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-[10px] border border-[var(--chekin-color-gray-separator)] p-6 [container-type:inline-size]",
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(--chekin-color-gray-separator)] px-0 py-2 text-base font-semibold leading-normal text-[var(--chekin-color-brand-navy)]",
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
+ if (!item || typeof item !== "object") return false;
12516
+ if ("value" in item) return false;
12517
+ return Array.isArray(item.options);
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,52 @@ 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, listboxId) {
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 visibleValues = new Set(options.map((option) => option.value));
12638
+ const entries = [];
12639
+ let flatIndex = 0;
12640
+ let groupCount = 0;
12641
+ for (const item of groupedOptions) {
12642
+ if (isOptionGroup(item)) {
12643
+ const visible = [];
12644
+ for (const option of item.options) {
12645
+ if (!visibleValues.has(option.value)) continue;
12646
+ visible.push({
12647
+ key: `${String(option.value)}-${flatIndex}`,
12648
+ option,
12649
+ flatIndex
12650
+ });
12651
+ flatIndex += 1;
12652
+ }
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
+ entries.push({
12664
+ kind: "option",
12665
+ key: `${String(item.value)}-${flatIndex}`,
12666
+ option: item,
12667
+ flatIndex
12668
+ });
12669
+ flatIndex += 1;
12670
+ }
12671
+ }
12672
+ return entries;
12673
+ }
12611
12674
  function SelectMenu({
12612
12675
  id,
12613
12676
  options,
@@ -12633,7 +12696,9 @@ function SelectMenu({
12633
12696
  inputValue = "",
12634
12697
  formatOptionLabel,
12635
12698
  isOptionSelected: isOptionSelected2,
12636
- onMenuScrollToBottom
12699
+ onMenuScrollToBottom,
12700
+ groupedOptions,
12701
+ formatGroupLabel
12637
12702
  }) {
12638
12703
  const { t } = useTranslation28();
12639
12704
  const emptyMessage = noOptionsMessage?.() ?? t("no_options");
@@ -12644,6 +12709,38 @@ function SelectMenu({
12644
12709
  () => selectedValues ?? (selectedValue ? [selectedValue] : []),
12645
12710
  [selectedValues, selectedValue]
12646
12711
  );
12712
+ const entries = React45.useMemo(
12713
+ () => buildMenuEntries(groupedOptions, options, formatGroupLabel, id),
12714
+ [groupedOptions, options, formatGroupLabel, id]
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
+ };
12647
12744
  const wasAtBottomRef = React45.useRef(false);
12648
12745
  const handleScroll = React45.useCallback(
12649
12746
  (event) => {
@@ -12677,32 +12774,21 @@ function SelectMenu({
12677
12774
  ),
12678
12775
  children: [
12679
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 })),
12680
- options.map((option, index) => {
12681
- const isSelected = isOptionSelected2 ? isOptionSelected2(option, selectedList) : isOptionSelected(option, selectedValue, selectedValues);
12682
- const isHighlighted = index === highlightedIndex;
12683
- const optionDisabled = Boolean(
12684
- disabled || option.isDisabled || isOptionDisabled?.(option)
12685
- );
12686
- return /* @__PURE__ */ jsx146(
12687
- Option,
12688
- {
12689
- id: getOptionId2(index),
12690
- option,
12691
- index,
12692
- isSelected,
12693
- isHighlighted,
12694
- isDisabled: optionDisabled,
12695
- isLast: index === lastIndex,
12696
- isMulti: Boolean(isMulti),
12697
- onClick: onOptionClick,
12698
- onHover: onOptionHover ?? (() => void 0),
12699
- innerRef: (node) => selectedOptionRef?.(index, node),
12700
- inputValue,
12701
- selectedOptions: selectedList,
12702
- formatOptionLabel
12703
- },
12704
- `${String(option.value)}-${index}`
12705
- );
12777
+ entries.map((entry) => {
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);
12790
+ }
12791
+ return renderOption(entry);
12706
12792
  }),
12707
12793
  footer
12708
12794
  ]
@@ -13631,7 +13717,9 @@ function DefaultMenuList(props) {
13631
13717
  inputValue,
13632
13718
  formatOptionLabel,
13633
13719
  isOptionSelected: isOptionSelected2,
13634
- onMenuScrollToBottom
13720
+ onMenuScrollToBottom,
13721
+ groupedOptions,
13722
+ formatGroupLabel
13635
13723
  } = props;
13636
13724
  return /* @__PURE__ */ jsx154(
13637
13725
  SelectMenu,
@@ -13659,7 +13747,9 @@ function DefaultMenuList(props) {
13659
13747
  inputValue,
13660
13748
  formatOptionLabel,
13661
13749
  isOptionSelected: isOptionSelected2,
13662
- onMenuScrollToBottom
13750
+ onMenuScrollToBottom,
13751
+ groupedOptions,
13752
+ formatGroupLabel
13663
13753
  }
13664
13754
  );
13665
13755
  }
@@ -13751,7 +13841,8 @@ function SelectInternal(props, ref) {
13751
13841
  searchPosition = "trigger",
13752
13842
  menuHeader,
13753
13843
  onMenuScrollToBottom,
13754
- leftIcon
13844
+ leftIcon,
13845
+ formatGroupLabel
13755
13846
  } = props;
13756
13847
  const isSearchInDropdown = searchPosition === "dropdown";
13757
13848
  const isMulti = props.isMulti === true;
@@ -13772,9 +13863,10 @@ function SelectInternal(props, ref) {
13772
13863
  },
13773
13864
  [isMulti, props.onChange]
13774
13865
  );
13866
+ const flatOptions = React49.useMemo(() => flattenGroupedOptions(options), [options]);
13775
13867
  const state = useSelectState({
13776
13868
  isMulti,
13777
- options,
13869
+ options: flatOptions,
13778
13870
  selectedOptions,
13779
13871
  onSelectionChange,
13780
13872
  filterOption,
@@ -13945,7 +14037,9 @@ function SelectInternal(props, ref) {
13945
14037
  inputValue: state.inputValue,
13946
14038
  formatOptionLabel,
13947
14039
  isOptionSelected: isOptionSelected2,
13948
- onMenuScrollToBottom
14040
+ onMenuScrollToBottom,
14041
+ groupedOptions: options,
14042
+ formatGroupLabel
13949
14043
  }
13950
14044
  ),
13951
14045
  state.canCreateNewOption && /* @__PURE__ */ jsx156(
@@ -14699,13 +14793,7 @@ function createCountTrigger(opts) {
14699
14793
 
14700
14794
  // src/dashboard/select-checkboxes/SelectAllRow.tsx
14701
14795
  import { jsx as jsx167, jsxs as jsxs104 } from "react/jsx-runtime";
14702
- function SelectAllRow({
14703
- label,
14704
- checked,
14705
- indeterminate,
14706
- disabled,
14707
- onToggle
14708
- }) {
14796
+ function SelectAllRow({ label, checked, disabled, onToggle }) {
14709
14797
  return /* @__PURE__ */ jsxs104(
14710
14798
  "button",
14711
14799
  {
@@ -14720,7 +14808,7 @@ function SelectAllRow({
14720
14808
  /* @__PURE__ */ jsx167(
14721
14809
  BaseCheckbox,
14722
14810
  {
14723
- checked: indeterminate ? "indeterminate" : checked,
14811
+ checked,
14724
14812
  disabled,
14725
14813
  size: "s",
14726
14814
  tabIndex: -1,
@@ -14756,7 +14844,6 @@ function SelectCheckboxesInternal(props, ref) {
14756
14844
  allowSelectAll = false,
14757
14845
  selectAllLabel,
14758
14846
  searchable = true,
14759
- searchPlaceholder,
14760
14847
  filterOption = defaultFilterOption,
14761
14848
  closeMenuOnSelect = false,
14762
14849
  onSearchChange,
@@ -14768,19 +14855,32 @@ function SelectCheckboxesInternal(props, ref) {
14768
14855
  );
14769
14856
  const [inputValue, setInputValue] = React59.useState("");
14770
14857
  const selected = value ?? [];
14771
- const filteredOptions = React59.useMemo(() => {
14858
+ const flatRawOptions = React59.useMemo(
14859
+ () => flattenGroupedOptions(rawOptions),
14860
+ [rawOptions]
14861
+ );
14862
+ const filteredGrouped = React59.useMemo(() => {
14772
14863
  const trimmed = inputValue.trim();
14773
14864
  if (!trimmed) return rawOptions;
14774
- return rawOptions.filter((option) => filterOption(option, trimmed));
14865
+ return rawOptions.map((item) => {
14866
+ if (isOptionGroup(item)) {
14867
+ const opts = item.options.filter((o) => filterOption(o, trimmed));
14868
+ return opts.length > 0 ? { ...item, options: opts } : null;
14869
+ }
14870
+ return filterOption(item, trimmed) ? item : null;
14871
+ }).filter((item) => item !== null);
14775
14872
  }, [rawOptions, inputValue, filterOption]);
14776
- const visibleSelectedCount = filteredOptions.reduce((acc, option) => {
14873
+ const filteredFlat = React59.useMemo(
14874
+ () => flattenGroupedOptions(filteredGrouped),
14875
+ [filteredGrouped]
14876
+ );
14877
+ const visibleSelectedCount = filteredFlat.reduce((acc, option) => {
14777
14878
  return acc + (selected.some((s) => s.value === option.value) ? 1 : 0);
14778
14879
  }, 0);
14779
- const allVisibleSelected = filteredOptions.length > 0 && visibleSelectedCount === filteredOptions.length;
14780
- const someVisibleSelected = visibleSelectedCount > 0 && visibleSelectedCount < filteredOptions.length;
14880
+ const allVisibleSelected = filteredFlat.length > 0 && visibleSelectedCount === filteredFlat.length;
14781
14881
  const handleToggleAll = React59.useCallback(() => {
14782
14882
  if (allVisibleSelected) {
14783
- const visibleValues = new Set(filteredOptions.map((option) => option.value));
14883
+ const visibleValues = new Set(filteredFlat.map((option) => option.value));
14784
14884
  onChange(
14785
14885
  selected.filter((s) => !visibleValues.has(s.value)),
14786
14886
  { action: "deselect" }
@@ -14788,18 +14888,18 @@ function SelectCheckboxesInternal(props, ref) {
14788
14888
  return;
14789
14889
  }
14790
14890
  const merged = [...selected];
14791
- for (const option of filteredOptions) {
14891
+ for (const option of filteredFlat) {
14792
14892
  if (!merged.some((s) => s.value === option.value)) merged.push(option);
14793
14893
  }
14794
14894
  onChange(merged, { action: "select" });
14795
- }, [allVisibleSelected, filteredOptions, onChange, selected]);
14895
+ }, [allVisibleSelected, filteredFlat, onChange, selected]);
14796
14896
  const Control = React59.useMemo(() => {
14797
14897
  if (trigger) return makeTriggerSlot2(trigger);
14798
14898
  return createCountTrigger({
14799
14899
  valueText,
14800
- totalCount: rawOptions.length
14900
+ totalCount: flatRawOptions.length
14801
14901
  });
14802
- }, [trigger, valueText, rawOptions.length]);
14902
+ }, [trigger, valueText, flatRawOptions.length]);
14803
14903
  const components = React59.useMemo(
14804
14904
  () => ({
14805
14905
  ...userComponents,
@@ -14813,7 +14913,6 @@ function SelectCheckboxesInternal(props, ref) {
14813
14913
  {
14814
14914
  label: selectAllLabel ?? t("select_all", { defaultValue: "Select All" }),
14815
14915
  checked: allVisibleSelected,
14816
- indeterminate: someVisibleSelected,
14817
14916
  onToggle: handleToggleAll
14818
14917
  }
14819
14918
  ) : void 0;
@@ -14824,11 +14923,10 @@ function SelectCheckboxesInternal(props, ref) {
14824
14923
  },
14825
14924
  [onSearchChange]
14826
14925
  );
14827
- const sharedProps = {
14926
+ const baseSharedProps = {
14828
14927
  ...paginationAndRest,
14829
14928
  value,
14830
14929
  onChange,
14831
- options: filteredOptions,
14832
14930
  filterOption: passthroughFilter2,
14833
14931
  components,
14834
14932
  closeMenuOnSelect,
@@ -14842,7 +14940,10 @@ function SelectCheckboxesInternal(props, ref) {
14842
14940
  InfiniteScrollSelect,
14843
14941
  {
14844
14942
  ref,
14845
- ...sharedProps
14943
+ ...{
14944
+ ...baseSharedProps,
14945
+ options: filteredFlat
14946
+ }
14846
14947
  }
14847
14948
  );
14848
14949
  }
@@ -14850,7 +14951,10 @@ function SelectCheckboxesInternal(props, ref) {
14850
14951
  Select,
14851
14952
  {
14852
14953
  ref,
14853
- ...sharedProps
14954
+ ...{
14955
+ ...baseSharedProps,
14956
+ options: filteredGrouped
14957
+ }
14854
14958
  }
14855
14959
  );
14856
14960
  }
@@ -15773,7 +15877,7 @@ var Datepicker = React63.forwardRef(
15773
15877
  hideErrorMessage,
15774
15878
  helperText,
15775
15879
  width,
15776
- locale = "en-US",
15880
+ locale,
15777
15881
  minDate,
15778
15882
  maxDate,
15779
15883
  formatValue
@@ -15792,10 +15896,11 @@ var Datepicker = React63.forwardRef(
15792
15896
  const yearId = `${baseId}-year`;
15793
15897
  const labelId = `${baseId}-label`;
15794
15898
  const errorId = `${baseId}-error`;
15795
- const { t } = useTranslation39();
15899
+ const { t, i18n } = useTranslation39();
15900
+ const resolvedLocale = locale ?? i18n.resolvedLanguage ?? i18n.language ?? "en-US";
15796
15901
  const resolvedMonthLabels = React63.useMemo(
15797
- () => monthLabels ?? getMonthLabels2(locale),
15798
- [locale, monthLabels]
15902
+ () => monthLabels ?? getMonthLabels2(resolvedLocale),
15903
+ [resolvedLocale, monthLabels]
15799
15904
  );
15800
15905
  const resolvedMonthPlaceholder = monthPlaceholder ?? t("month");
15801
15906
  const resolvedDoneLabel = doneLabel ?? t("done");
@@ -17597,7 +17702,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
17597
17702
  const hasLabelMeta = Boolean(optionalLabel) || Boolean(tooltip);
17598
17703
  const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */ jsxs116("span", { className: "inline-flex max-w-full items-center gap-1.5 align-middle", children: [
17599
17704
  /* @__PURE__ */ jsx182("span", { className: "min-w-0 truncate", children: visibleLabelText }),
17600
- optionalLabel && /* @__PURE__ */ jsxs116("span", { className: "shrink-0 text-[12px] relative top-[1px] font-normal leading-4 text-current opacity-70", children: [
17705
+ optionalLabel && /* @__PURE__ */ jsxs116("span", { className: "text-current opacity-70 lowercase", children: [
17601
17706
  "(",
17602
17707
  optionalLabel,
17603
17708
  ")"
@@ -17651,8 +17756,8 @@ var AirbnbFieldTrigger = React72.forwardRef(
17651
17756
  {
17652
17757
  id: labelId,
17653
17758
  className: cn(
17654
- "absolute left-0 origin-left truncate transition-all duration-200 ease-out",
17655
- hasLabelMeta ? "" : "pointer-events-none",
17759
+ "absolute left-0 origin-left transition-all duration-200 ease-out",
17760
+ hasLabelMeta ? "max-w-full" : "pointer-events-none truncate",
17656
17761
  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",
17657
17762
  hasInvalidState ? "text-[var(--error-message-color)]" : isAirbnbVariant ? "text-[#6c6c6c]" : "text-[#7A8399]"
17658
17763
  ),
@@ -17920,7 +18025,9 @@ AirbnbDatePicker.displayName = "AirbnbDatePicker";
17920
18025
 
17921
18026
  // src/airbnb-fields/input/Input.tsx
17922
18027
  import * as React74 from "react";
17923
- import { jsx as jsx184 } from "react/jsx-runtime";
18028
+ import { Eye as Eye2 } from "lucide-react";
18029
+ import { useTranslation as useTranslation44 } from "react-i18next";
18030
+ import { jsx as jsx184, jsxs as jsxs118 } from "react/jsx-runtime";
17924
18031
  var getInputValue = (value) => value != null ? String(value) : "";
17925
18032
  var AirbnbInput = React74.forwardRef(
17926
18033
  ({
@@ -17951,6 +18058,7 @@ var AirbnbInput = React74.forwardRef(
17951
18058
  placeholder,
17952
18059
  ...props
17953
18060
  }, ref) => {
18061
+ const { t } = useTranslation44();
17954
18062
  const generatedId = React74.useId();
17955
18063
  const inputRef = React74.useRef(null);
17956
18064
  const inputId = id ?? generatedId;
@@ -17959,11 +18067,15 @@ var AirbnbInput = React74.forwardRef(
17959
18067
  const errorId = `${inputId}-error`;
17960
18068
  const accessibleLabel = placeholder ?? label;
17961
18069
  const [isFocused, setIsFocused] = React74.useState(false);
18070
+ const [isPasswordRevealed, setIsPasswordRevealed] = React74.useState(false);
17962
18071
  const [currentValue, setCurrentValue] = React74.useState(
17963
18072
  () => value != null ? getInputValue(value) : getInputValue(defaultValue)
17964
18073
  );
17965
18074
  const resolvedValue = value != null ? getInputValue(value) : currentValue;
17966
18075
  const hasValue = resolvedValue.length > 0;
18076
+ const isPasswordInput = type === "password";
18077
+ const inputType = isPasswordInput && isPasswordRevealed ? "text" : type;
18078
+ const shouldShowPasswordReveal = isPasswordInput && hasValue && !loading;
17967
18079
  const shouldShowLabel = hasValue || isFocused;
17968
18080
  const hasInvalidState = Boolean(error) || Boolean(invalid);
17969
18081
  const triggerError = error ?? invalid;
@@ -17973,6 +18085,11 @@ var AirbnbInput = React74.forwardRef(
17973
18085
  const nextValue = value != null ? getInputValue(value) : getInputValue(inputRef.current?.value);
17974
18086
  setCurrentValue((prevValue) => prevValue === nextValue ? prevValue : nextValue);
17975
18087
  }, [value]);
18088
+ React74.useEffect(() => {
18089
+ if (!isPasswordInput) {
18090
+ setIsPasswordRevealed(false);
18091
+ }
18092
+ }, [isPasswordInput]);
17976
18093
  const setRefs = React74.useCallback(
17977
18094
  (node) => {
17978
18095
  inputRef.current = node;
@@ -18003,7 +18120,10 @@ var AirbnbInput = React74.forwardRef(
18003
18120
  setIsFocused(false);
18004
18121
  onBlur?.(event);
18005
18122
  };
18006
- return /* @__PURE__ */ jsx184("div", { className: cn("w-full max-w-[var(--max-field-width)]", wrapperClassName), children: /* @__PURE__ */ jsx184(
18123
+ const togglePasswordReveal = () => {
18124
+ setIsPasswordRevealed((isRevealed) => !isRevealed);
18125
+ };
18126
+ return /* @__PURE__ */ jsx184("div", { className: cn("w-full max-w-[var(--max-field-width)]", wrapperClassName), children: /* @__PURE__ */ jsxs118(
18007
18127
  AirbnbFieldTrigger,
18008
18128
  {
18009
18129
  as: "div",
@@ -18031,39 +18151,63 @@ var AirbnbInput = React74.forwardRef(
18031
18151
  variant === "airbnb" ? "h-[42px]" : "h-[48px]",
18032
18152
  contentClassName
18033
18153
  ),
18034
- trailingAdornment,
18154
+ trailingAdornment: shouldShowPasswordReveal ? void 0 : trailingAdornment,
18035
18155
  forceFloatingLabel: shouldShowLabel,
18036
18156
  forceLabelText: hasLabelMeta,
18037
18157
  hideErrorMessage: !renderErrorMessage,
18038
- children: /* @__PURE__ */ jsx184(
18039
- "input",
18040
- {
18041
- ...props,
18042
- id: inputId,
18043
- ref: setRefs,
18044
- type,
18045
- disabled: isBlocked,
18046
- value,
18047
- defaultValue,
18048
- onChange: handleChange,
18049
- onFocus: handleFocus,
18050
- onBlur: handleBlur,
18051
- placeholder: "",
18052
- "aria-invalid": hasInvalidState,
18053
- "aria-busy": loading,
18054
- "aria-describedby": error && renderErrorMessage ? errorId : void 0,
18055
- "aria-label": accessibleLabel && hasLabelMeta ? accessibleLabel : void 0,
18056
- "aria-labelledby": accessibleLabel && !hasLabelMeta ? labelId : void 0,
18057
- className: cn(
18058
- "absolute left-0 h-6 w-full border-0 bg-transparent p-0 text-[16px] leading-6 text-[#1F1F1B] outline-none placeholder:text-[#7A8399]",
18059
- variant === "airbnb" ? "bottom-0" : "bottom-[12px]",
18060
- hasInvalidState ? "text-[var(--status-danger)] placeholder:text-[var(--status-danger)]" : "",
18061
- disabled ? "cursor-not-allowed" : loading ? "cursor-progress" : "",
18062
- inputClassName,
18063
- className
18064
- )
18065
- }
18066
- )
18158
+ children: [
18159
+ /* @__PURE__ */ jsx184(
18160
+ "input",
18161
+ {
18162
+ ...props,
18163
+ id: inputId,
18164
+ ref: setRefs,
18165
+ type: inputType,
18166
+ disabled: isBlocked,
18167
+ value,
18168
+ defaultValue,
18169
+ onChange: handleChange,
18170
+ onFocus: handleFocus,
18171
+ onBlur: handleBlur,
18172
+ placeholder: "",
18173
+ "aria-invalid": hasInvalidState,
18174
+ "aria-busy": loading,
18175
+ "aria-describedby": error && renderErrorMessage ? errorId : void 0,
18176
+ "aria-label": accessibleLabel && hasLabelMeta ? accessibleLabel : void 0,
18177
+ "aria-labelledby": accessibleLabel && !hasLabelMeta ? labelId : void 0,
18178
+ className: cn(
18179
+ "absolute left-0 h-6 w-full border-0 bg-transparent p-0 text-[16px] leading-6 text-[#1F1F1B] outline-none placeholder:text-[#7A8399]",
18180
+ variant === "airbnb" ? "bottom-0" : "bottom-[12px]",
18181
+ hasInvalidState ? "text-[var(--status-danger)] placeholder:text-[var(--status-danger)]" : "",
18182
+ disabled ? "cursor-not-allowed" : loading ? "cursor-progress" : "",
18183
+ shouldShowPasswordReveal ? "pr-8" : "",
18184
+ inputClassName,
18185
+ className
18186
+ )
18187
+ }
18188
+ ),
18189
+ shouldShowPasswordReveal && /* @__PURE__ */ jsx184(
18190
+ "button",
18191
+ {
18192
+ type: "button",
18193
+ onClick: togglePasswordReveal,
18194
+ disabled: isBlocked,
18195
+ className: cn(
18196
+ "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",
18197
+ variant === "airbnb" ? "bottom-0" : "bottom-[12px]"
18198
+ ),
18199
+ "aria-label": isPasswordRevealed ? t("hide_password") : t("show_password"),
18200
+ children: /* @__PURE__ */ jsx184(
18201
+ Eye2,
18202
+ {
18203
+ size: 18,
18204
+ "aria-hidden": "true",
18205
+ className: cn(isPasswordRevealed ? "text-[#fc98dd]" : "")
18206
+ }
18207
+ )
18208
+ }
18209
+ )
18210
+ ]
18067
18211
  }
18068
18212
  ) });
18069
18213
  }
@@ -18078,7 +18222,7 @@ import { ChevronDown as ChevronDown6 } from "lucide-react";
18078
18222
  import * as React79 from "react";
18079
18223
 
18080
18224
  // src/airbnb-fields/select/SelectDesktopMenu.tsx
18081
- import { jsx as jsx185, jsxs as jsxs118 } from "react/jsx-runtime";
18225
+ import { jsx as jsx185, jsxs as jsxs119 } from "react/jsx-runtime";
18082
18226
  function AirbnbSelectDesktopMenu({
18083
18227
  id,
18084
18228
  options,
@@ -18097,7 +18241,7 @@ function AirbnbSelectDesktopMenu({
18097
18241
  noOptionsMessage
18098
18242
  }) {
18099
18243
  const emptyMessage = noOptionsMessage?.();
18100
- return /* @__PURE__ */ jsxs118(
18244
+ return /* @__PURE__ */ jsxs119(
18101
18245
  "div",
18102
18246
  {
18103
18247
  id,
@@ -18273,7 +18417,7 @@ function getMobileOptionStyles(index, scrollTop) {
18273
18417
  }
18274
18418
 
18275
18419
  // src/airbnb-fields/select/SelectMobileWheel.tsx
18276
- import { jsx as jsx187, jsxs as jsxs119 } from "react/jsx-runtime";
18420
+ import { jsx as jsx187, jsxs as jsxs120 } from "react/jsx-runtime";
18277
18421
  function AirbnbSelectMobileWheel({
18278
18422
  id,
18279
18423
  options,
@@ -18292,7 +18436,7 @@ function AirbnbSelectMobileWheel({
18292
18436
  }) {
18293
18437
  const spacerHeight2 = getWheelSpacerHeight();
18294
18438
  const emptyMessage = noOptionsMessage?.();
18295
- return /* @__PURE__ */ jsxs119(
18439
+ return /* @__PURE__ */ jsxs120(
18296
18440
  "div",
18297
18441
  {
18298
18442
  id,
@@ -18317,7 +18461,7 @@ function AirbnbSelectMobileWheel({
18317
18461
  )
18318
18462
  }
18319
18463
  ),
18320
- /* @__PURE__ */ jsxs119(
18464
+ /* @__PURE__ */ jsxs120(
18321
18465
  "div",
18322
18466
  {
18323
18467
  ref: listRef,
@@ -18367,7 +18511,7 @@ function AirbnbSelectMobileWheel({
18367
18511
  }
18368
18512
 
18369
18513
  // src/airbnb-fields/select/SelectMobileContent.tsx
18370
- import { jsx as jsx188, jsxs as jsxs120 } from "react/jsx-runtime";
18514
+ import { jsx as jsx188, jsxs as jsxs121 } from "react/jsx-runtime";
18371
18515
  function AirbnbSelectMobileContent({
18372
18516
  open,
18373
18517
  onOpenChange,
@@ -18391,10 +18535,10 @@ function AirbnbSelectMobileContent({
18391
18535
  getOptionId: getOptionId2,
18392
18536
  noOptionsMessage
18393
18537
  }) {
18394
- return /* @__PURE__ */ jsx188(Drawer, { open, onOpenChange, children: /* @__PURE__ */ jsxs120(DrawerContent, { onClose, lockScroll: false, children: [
18538
+ return /* @__PURE__ */ jsx188(Drawer, { open, onOpenChange, children: /* @__PURE__ */ jsxs121(DrawerContent, { onClose, lockScroll: false, children: [
18395
18539
  /* @__PURE__ */ jsx188(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
18396
18540
  /* @__PURE__ */ jsx188(DrawerDescription, { className: "sr-only", children: label }),
18397
- /* @__PURE__ */ jsxs120("div", { className: "px-6 pb-4 pt-1", children: [
18541
+ /* @__PURE__ */ jsxs121("div", { className: "px-6 pb-4 pt-1", children: [
18398
18542
  /* @__PURE__ */ jsx188(
18399
18543
  AirbnbSelectMobileWheel,
18400
18544
  {
@@ -18839,7 +18983,7 @@ function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
18839
18983
  }
18840
18984
 
18841
18985
  // src/airbnb-fields/select/Select.tsx
18842
- import { jsx as jsx190, jsxs as jsxs121 } from "react/jsx-runtime";
18986
+ import { jsx as jsx190, jsxs as jsxs122 } from "react/jsx-runtime";
18843
18987
  var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
18844
18988
  options = [],
18845
18989
  value,
@@ -19019,7 +19163,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19019
19163
  handleMobileOpenChange(false);
19020
19164
  }
19021
19165
  };
19022
- return /* @__PURE__ */ jsxs121(
19166
+ return /* @__PURE__ */ jsxs122(
19023
19167
  "div",
19024
19168
  {
19025
19169
  ref: containerRef,
@@ -19134,7 +19278,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19134
19278
  });
19135
19279
 
19136
19280
  // src/airbnb-fields/phone-field/PhoneField.tsx
19137
- import { jsx as jsx191, jsxs as jsxs122 } from "react/jsx-runtime";
19281
+ import { jsx as jsx191, jsxs as jsxs123 } from "react/jsx-runtime";
19138
19282
  function formatPhoneCodeOptionLabel2(option) {
19139
19283
  const label = String(option.label);
19140
19284
  const value = String(option.value);
@@ -19181,7 +19325,7 @@ var AirbnbPhoneField = React80.forwardRef(
19181
19325
  const hasInvalidState = Boolean(error) || Boolean(invalid);
19182
19326
  const isBlocked = Boolean(disabled) || Boolean(loading);
19183
19327
  const isCodeBlocked = isBlocked || Boolean(codeReadOnly);
19184
- return /* @__PURE__ */ jsxs122("div", { className: cn("w-full max-w-[var(--max-field-width)]", className), children: [
19328
+ return /* @__PURE__ */ jsxs123("div", { className: cn("w-full max-w-[var(--max-field-width)]", className), children: [
19185
19329
  name && /* @__PURE__ */ jsx191("input", { type: "hidden", name, value: combinedValue, disabled }),
19186
19330
  codeName && /* @__PURE__ */ jsx191(
19187
19331
  "input",
@@ -19209,7 +19353,7 @@ var AirbnbPhoneField = React80.forwardRef(
19209
19353
  children: topLabel
19210
19354
  }
19211
19355
  ),
19212
- /* @__PURE__ */ jsxs122("div", { className: "flex items-stretch", children: [
19356
+ /* @__PURE__ */ jsxs123("div", { className: "flex items-stretch", children: [
19213
19357
  /* @__PURE__ */ jsx191(
19214
19358
  AirbnbSelect,
19215
19359
  {
@@ -19241,7 +19385,7 @@ var AirbnbPhoneField = React80.forwardRef(
19241
19385
  onClick,
19242
19386
  onKeyDown,
19243
19387
  valueLabel
19244
- }) => /* @__PURE__ */ jsxs122(
19388
+ }) => /* @__PURE__ */ jsxs123(
19245
19389
  "button",
19246
19390
  {
19247
19391
  id,
@@ -19319,7 +19463,7 @@ import * as React81 from "react";
19319
19463
  import { ChevronDown as ChevronDown7, Search as Search4 } from "lucide-react";
19320
19464
  import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
19321
19465
  import { useCallback as useCallback57 } from "react";
19322
- import { jsx as jsx192, jsxs as jsxs123 } from "react/jsx-runtime";
19466
+ import { jsx as jsx192, jsxs as jsxs124 } from "react/jsx-runtime";
19323
19467
  var ROW_HEIGHT = 48;
19324
19468
  var DESKTOP_LIST_HEIGHT = 280;
19325
19469
  var MOBILE_LIST_HEIGHT = 420;
@@ -19516,7 +19660,7 @@ var AirbnbSearchableSelectInternal = ({
19516
19660
  }
19517
19661
  );
19518
19662
  React81.useImperativeHandle(ref, () => triggerRef.current, []);
19519
- return /* @__PURE__ */ jsxs123("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
19663
+ return /* @__PURE__ */ jsxs124("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
19520
19664
  name && /* @__PURE__ */ jsx192("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
19521
19665
  /* @__PURE__ */ jsx192(
19522
19666
  AirbnbFieldTrigger,
@@ -19576,7 +19720,7 @@ var AirbnbSearchableSelectInternal = ({
19576
19720
  }
19577
19721
  closeSelect();
19578
19722
  },
19579
- children: /* @__PURE__ */ jsxs123(DrawerContent, { onClose: closeSelect, lockScroll: false, children: [
19723
+ children: /* @__PURE__ */ jsxs124(DrawerContent, { onClose: closeSelect, lockScroll: false, children: [
19580
19724
  /* @__PURE__ */ jsx192(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
19581
19725
  /* @__PURE__ */ jsx192(DrawerDescription, { className: "sr-only", children: label }),
19582
19726
  /* @__PURE__ */ jsx192("div", { className: "px-5 pb-5 pt-1", children: content })
@@ -19649,8 +19793,8 @@ function AirbnbSearchableSelectContent({
19649
19793
  virtualizer.scrollToIndex(highlightedIndex, { align: "auto" });
19650
19794
  }
19651
19795
  }, [highlightedIndex, virtualizer]);
19652
- return /* @__PURE__ */ jsxs123("div", { className: "p-2", children: [
19653
- /* @__PURE__ */ jsxs123("div", { className: "relative mb-2", children: [
19796
+ return /* @__PURE__ */ jsxs124("div", { className: "p-2", children: [
19797
+ /* @__PURE__ */ jsxs124("div", { className: "relative mb-2", children: [
19654
19798
  /* @__PURE__ */ jsx192(
19655
19799
  Search4,
19656
19800
  {
@@ -19761,13 +19905,13 @@ function getNextEnabledIndex(options, startIndex, step) {
19761
19905
 
19762
19906
  // src/airbnb-fields/search-input/SearchInput.tsx
19763
19907
  import * as React82 from "react";
19764
- import { useTranslation as useTranslation44 } from "react-i18next";
19908
+ import { useTranslation as useTranslation45 } from "react-i18next";
19765
19909
  import { Search as Search5, X as X11 } from "lucide-react";
19766
- import { jsx as jsx193, jsxs as jsxs124 } from "react/jsx-runtime";
19910
+ import { jsx as jsx193, jsxs as jsxs125 } from "react/jsx-runtime";
19767
19911
  var AirbnbSearchInput = React82.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
19768
- const { t } = useTranslation44();
19912
+ const { t } = useTranslation45();
19769
19913
  const placeholderText = placeholder || t("search_property") + "...";
19770
- return /* @__PURE__ */ jsxs124("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
19914
+ return /* @__PURE__ */ jsxs125("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
19771
19915
  /* @__PURE__ */ jsx193(Search5, { className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]" }),
19772
19916
  /* @__PURE__ */ jsx193(
19773
19917
  "input",
@@ -19800,6 +19944,66 @@ var AirbnbSearchInput = React82.forwardRef(({ onReset, placeholder, wrapperClass
19800
19944
  ] });
19801
19945
  });
19802
19946
  AirbnbSearchInput.displayName = "AirbnbSearchInput";
19947
+
19948
+ // src/airbnb-fields/switch/Switch.tsx
19949
+ import * as React83 from "react";
19950
+ import * as SwitchPrimitives2 from "@radix-ui/react-switch";
19951
+ import { Check as Check7 } from "lucide-react";
19952
+ import { Fragment as Fragment19, jsx as jsx194, jsxs as jsxs126 } from "react/jsx-runtime";
19953
+ var AirbnbSwitch = React83.forwardRef(({ className, value, onChange, disabled, loading, readOnly, id, label, error, wrapperClassName, ...props }, ref) => {
19954
+ const generatedId = React83.useId();
19955
+ const fieldId = id || generatedId;
19956
+ const switchElement = /* @__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
+ id: fieldId,
19969
+ disabled,
19970
+ checked: value,
19971
+ value: String(value),
19972
+ onCheckedChange: !disabled && !readOnly ? onChange : void 0,
19973
+ "aria-busy": loading,
19974
+ "aria-readonly": readOnly,
19975
+ ...props,
19976
+ children: /* @__PURE__ */ jsx194(
19977
+ SwitchPrimitives2.Thumb,
19978
+ {
19979
+ className: cn(
19980
+ "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",
19981
+ "data-[state=checked]:translate-x-[12px] data-[state=unchecked]:translate-x-0"
19982
+ ),
19983
+ children: /* @__PURE__ */ jsx194(
19984
+ Check7,
19985
+ {
19986
+ "aria-hidden": "true",
19987
+ className: "h-3 w-3 text-[#222222] opacity-0 transition-opacity duration-150 group-data-[state=checked]:opacity-100",
19988
+ strokeWidth: 3
19989
+ }
19990
+ )
19991
+ }
19992
+ )
19993
+ }
19994
+ );
19995
+ if (!label && !error) {
19996
+ return switchElement;
19997
+ }
19998
+ return /* @__PURE__ */ jsxs126(Fragment19, { children: [
19999
+ /* @__PURE__ */ jsxs126("div", { className: cn("flex items-center gap-x-3 gap-y-1.5", wrapperClassName), children: [
20000
+ switchElement,
20001
+ label && /* @__PURE__ */ jsx194(Label, { htmlFor: fieldId, className: "cursor-pointer text-base font-medium", children: label })
20002
+ ] }),
20003
+ error && /* @__PURE__ */ jsx194(ErrorMessage, { disabled, children: error })
20004
+ ] });
20005
+ });
20006
+ AirbnbSwitch.displayName = "AirbnbSwitch";
19803
20007
  export {
19804
20008
  ALERT_BOX_VARIANTS,
19805
20009
  Accordion,
@@ -19813,6 +20017,7 @@ export {
19813
20017
  AirbnbSearchInput,
19814
20018
  AirbnbSearchableSelect,
19815
20019
  AirbnbSelect,
20020
+ AirbnbSwitch,
19816
20021
  Alert,
19817
20022
  AlertBox,
19818
20023
  AlertDescription,