@chekinapp/ui 0.0.117 → 0.0.119

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
@@ -13842,7 +13842,8 @@ function SelectInternal(props, ref) {
13842
13842
  menuHeader,
13843
13843
  onMenuScrollToBottom,
13844
13844
  leftIcon,
13845
- formatGroupLabel
13845
+ formatGroupLabel,
13846
+ onReset
13846
13847
  } = props;
13847
13848
  const isSearchInDropdown = searchPosition === "dropdown";
13848
13849
  const isMulti = props.isMulti === true;
@@ -13909,7 +13910,10 @@ function SelectInternal(props, ref) {
13909
13910
  const resolvedLabel = label ?? placeholder;
13910
13911
  const hasInvalidState = state.hasInvalidState || Boolean(invalid);
13911
13912
  const hiddenValue = isMulti ? selectedOptions.map((item) => String(item.value)).join(",") : selectedOptions[0] ? String(selectedOptions[0].value) : "";
13912
- const handleClear = (event) => state.clearSelection(event);
13913
+ const handleClear = (event) => {
13914
+ state.clearSelection(event);
13915
+ onReset?.();
13916
+ };
13913
13917
  const { Control, MenuList, CreateOption } = components;
13914
13918
  return /* @__PURE__ */ jsxs99(
13915
13919
  SelectFieldShell,
@@ -14141,7 +14145,14 @@ function VirtualMenuList(props) {
14141
14145
  if (lastLoadMoreOptionsLengthRef.current === options.length) return;
14142
14146
  lastLoadMoreOptionsLengthRef.current = options.length;
14143
14147
  loadMoreItems();
14144
- }, [virtualItems, options.length]);
14148
+ }, [
14149
+ virtualItems,
14150
+ options.length,
14151
+ canLoadMore,
14152
+ isLoadingMore,
14153
+ loadMoreItems,
14154
+ loadMoreThreshold
14155
+ ]);
14145
14156
  React51.useEffect(() => {
14146
14157
  const changed = previousHighlightedIndexRef.current !== highlightedIndex;
14147
14158
  previousHighlightedIndexRef.current = highlightedIndex;
@@ -14317,7 +14328,7 @@ function InfiniteScrollSelectInternal(props, ref) {
14317
14328
  if (synthetic) list = [synthetic, ...list];
14318
14329
  }
14319
14330
  return list;
14320
- }, [rawOptions, inputValue, filterOption, getFullSearchOption, rest.getValueLabel, props]);
14331
+ }, [rawOptions, inputValue, filterOption, getFullSearchOption, props, rest]);
14321
14332
  const contextValue = React52.useMemo(
14322
14333
  () => ({
14323
14334
  canLoadMore,
@@ -14381,13 +14392,7 @@ function hasPaginationProps(props) {
14381
14392
  return props.canLoadMore !== void 0 || props.isLoadingMore !== void 0 || props.loadMoreItems !== void 0 || props.onSearchChange !== void 0 || props.getFullSearchOption !== void 0;
14382
14393
  }
14383
14394
  function SearchingSelectInternal(props, ref) {
14384
- const {
14385
- trigger,
14386
- components: userComponents,
14387
- searchPlaceholder,
14388
- searchable = true,
14389
- ...rest
14390
- } = props;
14395
+ const { trigger, components: userComponents, searchable = true, ...rest } = props;
14391
14396
  const Control = React53.useMemo(() => {
14392
14397
  if (trigger) return makeTriggerSlot(trigger);
14393
14398
  return StaticControl;
@@ -14854,7 +14859,7 @@ function SelectCheckboxesInternal(props, ref) {
14854
14859
  paginationAndRest
14855
14860
  );
14856
14861
  const [inputValue, setInputValue] = React59.useState("");
14857
- const selected = value ?? [];
14862
+ const selected = React59.useMemo(() => value ?? [], [value]);
14858
14863
  const flatRawOptions = React59.useMemo(
14859
14864
  () => flattenGroupedOptions(rawOptions),
14860
14865
  [rawOptions]
@@ -15924,7 +15929,7 @@ var Datepicker = React63.forwardRef(
15924
15929
  React63.useImperativeHandle(
15925
15930
  ref,
15926
15931
  () => dayInputRef.current ?? mobileTriggerRef.current,
15927
- [isMobile3]
15932
+ []
15928
15933
  );
15929
15934
  React63.useEffect(() => {
15930
15935
  if (!isControlled) return;
@@ -17666,7 +17671,6 @@ import { Fragment as Fragment18, jsx as jsx182, jsxs as jsxs116 } from "react/js
17666
17671
  var AirbnbFieldTrigger = React72.forwardRef(
17667
17672
  ({
17668
17673
  as = "button",
17669
- variant = "airbnb",
17670
17674
  id,
17671
17675
  label,
17672
17676
  topLabel,
@@ -17719,7 +17723,6 @@ var AirbnbFieldTrigger = React72.forwardRef(
17719
17723
  )
17720
17724
  ] }) : visibleLabelText;
17721
17725
  const animatedLabel = forceLabelText ? resolvedLabelText ?? placeholder : isRaised ? resolvedLabelText : label ?? placeholder;
17722
- const isAirbnbVariant = variant === "airbnb";
17723
17726
  const hasInvalidState = Boolean(error);
17724
17727
  const errorMessage = typeof error === "string" ? error : void 0;
17725
17728
  const isBlocked = Boolean(disabled) || Boolean(loading);
@@ -17734,11 +17737,11 @@ var AirbnbFieldTrigger = React72.forwardRef(
17734
17737
  )
17735
17738
  ] }) : void 0;
17736
17739
  const sharedClasses = cn(
17737
- "relative flex w-full items-center border bg-white text-left transition-colors focus-visible:outline-none",
17738
- 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)]",
17739
- isAirbnbVariant ? isRaised ? "min-h-[60px]" : "h-[60px]" : "min-h-[48px]",
17740
- hasInvalidState ? isAirbnbVariant ? "border-[var(--error-message-color)] bg-[#FFF5F3]" : "border-[var(--error-message-color)] bg-white" : isAirbnbVariant ? "border-[#8c8c8c]" : "border-[#A8A8A4] bg-white",
17741
- disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : isAirbnbVariant ? "cursor-pointer" : "cursor-text",
17740
+ "relative flex w-full items-center border bg-transparent text-left transition-colors focus-visible:outline-none",
17741
+ "rounded-[12px] border-[#8c8c8c] pl-4 pr-4 focus-visible:ring-2 focus-visible:ring-[#222222] focus-visible:ring-offset-2",
17742
+ isRaised ? "min-h-[60px]" : "h-[60px]",
17743
+ hasInvalidState ? "border-[var(--error-message-color)] bg-[#FFF5F3]" : "border-[#8c8c8c]",
17744
+ disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : "cursor-pointer",
17742
17745
  className
17743
17746
  );
17744
17747
  const sharedContent = /* @__PURE__ */ jsxs116(Fragment18, { children: [
@@ -17747,7 +17750,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
17747
17750
  {
17748
17751
  className: cn(
17749
17752
  "relative min-w-0 flex-1 pr-2",
17750
- isAirbnbVariant ? isRaised ? "h-[42px]" : "h-[28px]" : "h-[48px]",
17753
+ isRaised ? "h-[42px]" : "h-[28px]",
17751
17754
  contentClassName
17752
17755
  ),
17753
17756
  children: [
@@ -17758,8 +17761,8 @@ var AirbnbFieldTrigger = React72.forwardRef(
17758
17761
  className: cn(
17759
17762
  "absolute left-0 origin-left transition-all duration-200 ease-out",
17760
17763
  hasLabelMeta ? "max-w-full" : "pointer-events-none truncate",
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",
17762
- hasInvalidState ? "text-[var(--error-message-color)]" : isAirbnbVariant ? "text-[#6c6c6c]" : "text-[#7A8399]"
17764
+ isRaised ? "top-[-1px] translate-y-0 text-xs leading-5" : "top-1/2 -translate-y-1/2 text-[16px] leading-7",
17765
+ hasInvalidState ? "text-[var(--error-message-color)]" : "text-[#6c6c6c]"
17763
17766
  ),
17764
17767
  children: animatedLabel
17765
17768
  }
@@ -17770,7 +17773,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
17770
17773
  id: valueId,
17771
17774
  className: cn(
17772
17775
  "absolute left-0 block truncate transition-all duration-200 ease-out",
17773
- isAirbnbVariant ? "bottom-0 translate-y-0 text-[16px] leading-6 opacity-100" : "bottom-[11px] text-[16px] leading-6",
17776
+ "bottom-0 translate-y-0 text-[16px] leading-6 opacity-100",
17774
17777
  hasInvalidState ? "text-[var(--error-message-color)]" : "text-[#222222]"
17775
17778
  ),
17776
17779
  children: valueText
@@ -17783,10 +17786,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
17783
17786
  "span",
17784
17787
  {
17785
17788
  "aria-hidden": "true",
17786
- className: cn(
17787
- "pointer-events-none absolute top-1/2 -translate-y-1/2",
17788
- isAirbnbVariant ? "right-5" : "right-4"
17789
- ),
17789
+ className: "pointer-events-none absolute right-5 top-1/2 -translate-y-1/2",
17790
17790
  children: resolvedTrailingAdornment
17791
17791
  }
17792
17792
  )
@@ -17838,7 +17838,6 @@ import { jsx as jsx183, jsxs as jsxs117 } from "react/jsx-runtime";
17838
17838
  var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
17839
17839
  var AirbnbDatePicker = React73.forwardRef(
17840
17840
  ({
17841
- variant = "default",
17842
17841
  label,
17843
17842
  topLabel,
17844
17843
  value,
@@ -17965,7 +17964,6 @@ var AirbnbDatePicker = React73.forwardRef(
17965
17964
  {
17966
17965
  id: triggerId,
17967
17966
  ref: combinedRef,
17968
- variant,
17969
17967
  label,
17970
17968
  topLabel,
17971
17969
  labelId,
@@ -18031,7 +18029,6 @@ import { jsx as jsx184, jsxs as jsxs118 } from "react/jsx-runtime";
18031
18029
  var getInputValue = (value) => value != null ? String(value) : "";
18032
18030
  var AirbnbInput = React74.forwardRef(
18033
18031
  ({
18034
- variant = "default",
18035
18032
  label,
18036
18033
  topLabel,
18037
18034
  helperText,
@@ -18127,7 +18124,6 @@ var AirbnbInput = React74.forwardRef(
18127
18124
  AirbnbFieldTrigger,
18128
18125
  {
18129
18126
  as: "div",
18130
- variant,
18131
18127
  id: fieldId,
18132
18128
  label: accessibleLabel ?? "",
18133
18129
  topLabel,
@@ -18143,14 +18139,11 @@ var AirbnbInput = React74.forwardRef(
18143
18139
  tooltip,
18144
18140
  describedBy: error && renderErrorMessage ? errorId : void 0,
18145
18141
  className: cn(
18146
- variant === "airbnb" ? "px-4 focus-within:ring-2 focus-within:ring-[#1F1F1B] focus-within:ring-offset-2" : "px-3.5 focus-within:border-[#315EFB]",
18142
+ "px-4 focus-within:ring-2 focus-within:ring-[#1F1F1B] focus-within:ring-offset-2",
18147
18143
  disabled ? "cursor-not-allowed" : "cursor-text",
18148
18144
  fieldClassName
18149
18145
  ),
18150
- contentClassName: cn(
18151
- variant === "airbnb" ? "h-[42px]" : "h-[48px]",
18152
- contentClassName
18153
- ),
18146
+ contentClassName: cn("h-[42px]", contentClassName),
18154
18147
  trailingAdornment: shouldShowPasswordReveal ? void 0 : trailingAdornment,
18155
18148
  forceFloatingLabel: shouldShowLabel,
18156
18149
  forceLabelText: hasLabelMeta,
@@ -18177,7 +18170,7 @@ var AirbnbInput = React74.forwardRef(
18177
18170
  "aria-labelledby": accessibleLabel && !hasLabelMeta ? labelId : void 0,
18178
18171
  className: cn(
18179
18172
  "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]",
18173
+ "bottom-0",
18181
18174
  hasInvalidState ? "text-[var(--status-danger)] placeholder:text-[var(--status-danger)]" : "",
18182
18175
  disabled ? "cursor-not-allowed" : loading ? "cursor-progress" : "",
18183
18176
  shouldShowPasswordReveal ? "pr-8" : "",
@@ -18192,10 +18185,7 @@ var AirbnbInput = React74.forwardRef(
18192
18185
  type: "button",
18193
18186
  onClick: togglePasswordReveal,
18194
18187
  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
- ),
18188
+ 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",
18199
18189
  "aria-label": isPasswordRevealed ? t("hide_password") : t("show_password"),
18200
18190
  children: /* @__PURE__ */ jsx184(
18201
18191
  Eye2,
@@ -18571,7 +18561,6 @@ var AirbnbSelectTrigger = React75.forwardRef(
18571
18561
  ({
18572
18562
  id,
18573
18563
  open,
18574
- variant,
18575
18564
  label,
18576
18565
  topLabel,
18577
18566
  helperText,
@@ -18597,7 +18586,6 @@ var AirbnbSelectTrigger = React75.forwardRef(
18597
18586
  {
18598
18587
  id,
18599
18588
  ref,
18600
- variant,
18601
18589
  "aria-haspopup": "listbox",
18602
18590
  "aria-expanded": open,
18603
18591
  "aria-controls": listboxId,
@@ -18989,7 +18977,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
18989
18977
  value,
18990
18978
  onChange,
18991
18979
  onBlur,
18992
- variant = "default",
18993
18980
  label,
18994
18981
  topLabel,
18995
18982
  placeholder,
@@ -19008,11 +18995,13 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19008
18995
  doneLabel = "Done",
19009
18996
  mobileTitle,
19010
18997
  name,
19011
- noOptionsMessage
18998
+ noOptionsMessage,
18999
+ filterOption
19012
19000
  }, ref) {
19013
19001
  const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
19014
19002
  const [isOpen, setIsOpen] = React79.useState(false);
19015
19003
  const containerRef = React79.useRef(null);
19004
+ const filteredOptions = filterOption ? options.filter(filterOption) : options;
19016
19005
  const hasValue = Boolean(value);
19017
19006
  const helperText = placeholder ?? label;
19018
19007
  const shouldDescribeHelperText = !hasValue && helperText !== label;
@@ -19043,7 +19032,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19043
19032
  } = useMobileSelectWheel({
19044
19033
  isMobile: isMobile3,
19045
19034
  isOpen,
19046
- options,
19035
+ options: filteredOptions,
19047
19036
  value,
19048
19037
  disabled: isBlocked
19049
19038
  });
@@ -19060,13 +19049,13 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19060
19049
  } = useDesktopSelect({
19061
19050
  isMobile: isMobile3,
19062
19051
  isOpen,
19063
- options,
19052
+ options: filteredOptions,
19064
19053
  value,
19065
19054
  disabled: isBlocked,
19066
19055
  onChange
19067
19056
  });
19068
19057
  const combinedRef = useCombinedRef(ref, desktopTriggerRef);
19069
- const activeMobileIndex = getOptionIndex2(options, pendingValue);
19058
+ const activeMobileIndex = getOptionIndex2(filteredOptions, pendingValue);
19070
19059
  const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
19071
19060
  useOutsideClick({
19072
19061
  elementRef: containerRef,
@@ -19083,12 +19072,12 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19083
19072
  if (value?.value === void 0 || value.value === null || value.label !== "") {
19084
19073
  return;
19085
19074
  }
19086
- const validOption = options.find((option) => option.value === value.value);
19075
+ const validOption = filteredOptions.find((option) => option.value === value.value);
19087
19076
  if (validOption) {
19088
19077
  onChange(validOption);
19089
19078
  }
19090
19079
  },
19091
- [onChange, options, value]
19080
+ [onChange, filteredOptions, value]
19092
19081
  );
19093
19082
  const handleMobileOpenChange = React79.useCallback(
19094
19083
  (nextOpen) => {
@@ -19173,7 +19162,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19173
19162
  renderTrigger ? renderTrigger({
19174
19163
  id: triggerId,
19175
19164
  open: isOpen,
19176
- variant,
19177
19165
  label,
19178
19166
  topLabel,
19179
19167
  helperText,
@@ -19197,7 +19185,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19197
19185
  id: triggerId,
19198
19186
  ref: combinedRef,
19199
19187
  open: isOpen,
19200
- variant,
19201
19188
  label,
19202
19189
  topLabel,
19203
19190
  helperText,
@@ -19231,7 +19218,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19231
19218
  mobileTitle,
19232
19219
  doneLabel,
19233
19220
  errorId: describedErrorId,
19234
- options,
19221
+ options: filteredOptions,
19235
19222
  disabled: isBlocked,
19236
19223
  menuClassName,
19237
19224
  scrollTop: mobileScrollTop,
@@ -19251,7 +19238,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19251
19238
  listboxId,
19252
19239
  labelId,
19253
19240
  errorId: describedErrorId,
19254
- options,
19241
+ options: filteredOptions,
19255
19242
  value,
19256
19243
  highlightedIndex,
19257
19244
  onOptionClick: (option) => {
@@ -19286,7 +19273,6 @@ function formatPhoneCodeOptionLabel2(option) {
19286
19273
  }
19287
19274
  var AirbnbPhoneField = React80.forwardRef(
19288
19275
  ({
19289
- variant = "default",
19290
19276
  label,
19291
19277
  topLabel,
19292
19278
  value,
@@ -19358,7 +19344,6 @@ var AirbnbPhoneField = React80.forwardRef(
19358
19344
  AirbnbSelect,
19359
19345
  {
19360
19346
  ref,
19361
- variant,
19362
19347
  options: codeOptions,
19363
19348
  value: selectedCodeOption,
19364
19349
  onChange: (option) => onChange({
@@ -19377,7 +19362,6 @@ var AirbnbPhoneField = React80.forwardRef(
19377
19362
  renderTrigger: ({
19378
19363
  id,
19379
19364
  open,
19380
- variant: selectVariant,
19381
19365
  disabled: triggerDisabled,
19382
19366
  loading: triggerLoading,
19383
19367
  listboxId,
@@ -19401,9 +19385,8 @@ var AirbnbPhoneField = React80.forwardRef(
19401
19385
  onClick,
19402
19386
  onKeyDown,
19403
19387
  className: cn(
19404
- "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",
19405
- 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]",
19406
- 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]",
19388
+ "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",
19389
+ hasInvalidState ? "border-[var(--status-danger)] bg-[#F2F2F2] text-[var(--status-danger)]" : "border-[#8C8C8C] bg-[#F4F4F2] text-[#1F1F1B]",
19407
19390
  triggerDisabled ? "cursor-not-allowed opacity-50" : triggerLoading ? "cursor-progress" : "cursor-pointer"
19408
19391
  ),
19409
19392
  children: [
@@ -19424,7 +19407,6 @@ var AirbnbPhoneField = React80.forwardRef(
19424
19407
  AirbnbInput,
19425
19408
  {
19426
19409
  id: inputId,
19427
- variant,
19428
19410
  type: "tel",
19429
19411
  inputMode: "tel",
19430
19412
  label,
@@ -19439,10 +19421,8 @@ var AirbnbPhoneField = React80.forwardRef(
19439
19421
  tooltip,
19440
19422
  renderErrorMessage: false,
19441
19423
  wrapperClassName: "min-w-0 flex-1",
19442
- fieldClassName: cn(
19443
- variant === "airbnb" ? "min-h-[60px] rounded-l-none rounded-r-[16px] border-l-0" : "rounded-l-none rounded-r-[10px] border-l-0"
19444
- ),
19445
- contentClassName: cn(variant === "airbnb" ? "h-[40px] py-2" : "h-[48px]"),
19424
+ fieldClassName: "min-h-[60px] rounded-l-none rounded-r-[16px] border-l-0",
19425
+ contentClassName: "h-[40px] py-2",
19446
19426
  inputClassName: "text-[16px] leading-7",
19447
19427
  onChange: (event) => onChange({
19448
19428
  code: value?.code ?? "",
@@ -19483,7 +19463,6 @@ var AirbnbSearchableSelectInternal = ({
19483
19463
  loading,
19484
19464
  hasNextPage,
19485
19465
  onLoadMore,
19486
- variant = "default",
19487
19466
  label,
19488
19467
  topLabel,
19489
19468
  placeholder,
@@ -19667,7 +19646,6 @@ var AirbnbSearchableSelectInternal = ({
19667
19646
  {
19668
19647
  id: `${reactId}-trigger`,
19669
19648
  ref: triggerRef,
19670
- variant,
19671
19649
  "aria-haspopup": "listbox",
19672
19650
  "aria-expanded": open,
19673
19651
  "aria-controls": listboxId,
@@ -19950,59 +19928,83 @@ import * as React83 from "react";
19950
19928
  import * as SwitchPrimitives2 from "@radix-ui/react-switch";
19951
19929
  import { Check as Check7 } from "lucide-react";
19952
19930
  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
- )
19931
+ var AirbnbSwitch = React83.forwardRef(
19932
+ ({
19933
+ className,
19934
+ value,
19935
+ onChange,
19936
+ disabled,
19937
+ loading,
19938
+ readOnly,
19939
+ id,
19940
+ label,
19941
+ error,
19942
+ wrapperClassName,
19943
+ ...props
19944
+ }, ref) => {
19945
+ const generatedId = React83.useId();
19946
+ const fieldId = id || generatedId;
19947
+ const switchElement = /* @__PURE__ */ jsx194(
19948
+ SwitchPrimitives2.Root,
19949
+ {
19950
+ ref,
19951
+ className: cn(
19952
+ "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",
19953
+ "focus-visible:outline-none focus-visible:shadow-[var(--chekin-shadow-focus)]",
19954
+ "disabled:cursor-not-allowed disabled:opacity-50 aria-busy:cursor-wait aria-busy:opacity-50",
19955
+ "aria-readonly:cursor-default aria-readonly:opacity-100",
19956
+ "data-[state=checked]:bg-[#222222] data-[state=unchecked]:bg-[#E7E7E4]",
19957
+ className
19958
+ ),
19959
+ id: fieldId,
19960
+ disabled,
19961
+ checked: value,
19962
+ value: String(value),
19963
+ onCheckedChange: !disabled && !readOnly ? onChange : void 0,
19964
+ "aria-busy": loading,
19965
+ "aria-readonly": readOnly,
19966
+ ...props,
19967
+ children: /* @__PURE__ */ jsx194(
19968
+ SwitchPrimitives2.Thumb,
19969
+ {
19970
+ className: cn(
19971
+ "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",
19972
+ "data-[state=checked]:translate-x-[12px] data-[state=unchecked]:translate-x-0"
19973
+ ),
19974
+ children: /* @__PURE__ */ jsx194(
19975
+ Check7,
19976
+ {
19977
+ "aria-hidden": "true",
19978
+ className: "h-3 w-3 text-[#222222] opacity-0 transition-opacity duration-150 group-data-[state=checked]:opacity-100",
19979
+ strokeWidth: 3
19980
+ }
19981
+ )
19982
+ }
19983
+ )
19984
+ }
19985
+ );
19986
+ if (!label && !error) {
19987
+ return switchElement;
19993
19988
  }
19994
- );
19995
- if (!label && !error) {
19996
- return switchElement;
19989
+ return /* @__PURE__ */ jsxs126(Fragment19, { children: [
19990
+ /* @__PURE__ */ jsxs126("div", { className: cn("flex items-center gap-x-3 gap-y-1.5", wrapperClassName), children: [
19991
+ switchElement,
19992
+ label && /* @__PURE__ */ jsx194(
19993
+ Label,
19994
+ {
19995
+ htmlFor: fieldId,
19996
+ className: cn(
19997
+ "text-base font-medium",
19998
+ readOnly ? "cursor-default" : "cursor-pointer"
19999
+ ),
20000
+ children: label
20001
+ }
20002
+ )
20003
+ ] }),
20004
+ error && /* @__PURE__ */ jsx194(ErrorMessage, { disabled, children: error })
20005
+ ] });
19997
20006
  }
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
- });
20007
+ );
20006
20008
  AirbnbSwitch.displayName = "AirbnbSwitch";
20007
20009
  export {
20008
20010
  ALERT_BOX_VARIANTS,