@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.cjs CHANGED
@@ -14203,7 +14203,8 @@ function SelectInternal(props, ref) {
14203
14203
  menuHeader,
14204
14204
  onMenuScrollToBottom,
14205
14205
  leftIcon,
14206
- formatGroupLabel
14206
+ formatGroupLabel,
14207
+ onReset
14207
14208
  } = props;
14208
14209
  const isSearchInDropdown = searchPosition === "dropdown";
14209
14210
  const isMulti = props.isMulti === true;
@@ -14270,7 +14271,10 @@ function SelectInternal(props, ref) {
14270
14271
  const resolvedLabel = label ?? placeholder;
14271
14272
  const hasInvalidState = state.hasInvalidState || Boolean(invalid);
14272
14273
  const hiddenValue = isMulti ? selectedOptions.map((item) => String(item.value)).join(",") : selectedOptions[0] ? String(selectedOptions[0].value) : "";
14273
- const handleClear = (event) => state.clearSelection(event);
14274
+ const handleClear = (event) => {
14275
+ state.clearSelection(event);
14276
+ onReset?.();
14277
+ };
14274
14278
  const { Control, MenuList, CreateOption } = components;
14275
14279
  return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
14276
14280
  SelectFieldShell,
@@ -14502,7 +14506,14 @@ function VirtualMenuList(props) {
14502
14506
  if (lastLoadMoreOptionsLengthRef.current === options.length) return;
14503
14507
  lastLoadMoreOptionsLengthRef.current = options.length;
14504
14508
  loadMoreItems();
14505
- }, [virtualItems, options.length]);
14509
+ }, [
14510
+ virtualItems,
14511
+ options.length,
14512
+ canLoadMore,
14513
+ isLoadingMore,
14514
+ loadMoreItems,
14515
+ loadMoreThreshold
14516
+ ]);
14506
14517
  React51.useEffect(() => {
14507
14518
  const changed = previousHighlightedIndexRef.current !== highlightedIndex;
14508
14519
  previousHighlightedIndexRef.current = highlightedIndex;
@@ -14678,7 +14689,7 @@ function InfiniteScrollSelectInternal(props, ref) {
14678
14689
  if (synthetic) list = [synthetic, ...list];
14679
14690
  }
14680
14691
  return list;
14681
- }, [rawOptions, inputValue, filterOption, getFullSearchOption, rest.getValueLabel, props]);
14692
+ }, [rawOptions, inputValue, filterOption, getFullSearchOption, props, rest]);
14682
14693
  const contextValue = React52.useMemo(
14683
14694
  () => ({
14684
14695
  canLoadMore,
@@ -14742,13 +14753,7 @@ function hasPaginationProps(props) {
14742
14753
  return props.canLoadMore !== void 0 || props.isLoadingMore !== void 0 || props.loadMoreItems !== void 0 || props.onSearchChange !== void 0 || props.getFullSearchOption !== void 0;
14743
14754
  }
14744
14755
  function SearchingSelectInternal(props, ref) {
14745
- const {
14746
- trigger,
14747
- components: userComponents,
14748
- searchPlaceholder,
14749
- searchable = true,
14750
- ...rest
14751
- } = props;
14756
+ const { trigger, components: userComponents, searchable = true, ...rest } = props;
14752
14757
  const Control = React53.useMemo(() => {
14753
14758
  if (trigger) return makeTriggerSlot(trigger);
14754
14759
  return StaticControl;
@@ -15215,7 +15220,7 @@ function SelectCheckboxesInternal(props, ref) {
15215
15220
  paginationAndRest
15216
15221
  );
15217
15222
  const [inputValue, setInputValue] = React59.useState("");
15218
- const selected = value ?? [];
15223
+ const selected = React59.useMemo(() => value ?? [], [value]);
15219
15224
  const flatRawOptions = React59.useMemo(
15220
15225
  () => flattenGroupedOptions(rawOptions),
15221
15226
  [rawOptions]
@@ -16285,7 +16290,7 @@ var Datepicker = React63.forwardRef(
16285
16290
  React63.useImperativeHandle(
16286
16291
  ref,
16287
16292
  () => dayInputRef.current ?? mobileTriggerRef.current,
16288
- [isMobile3]
16293
+ []
16289
16294
  );
16290
16295
  React63.useEffect(() => {
16291
16296
  if (!isControlled) return;
@@ -18024,7 +18029,6 @@ var import_jsx_runtime184 = require("react/jsx-runtime");
18024
18029
  var AirbnbFieldTrigger = React72.forwardRef(
18025
18030
  ({
18026
18031
  as = "button",
18027
- variant = "airbnb",
18028
18032
  id,
18029
18033
  label,
18030
18034
  topLabel,
@@ -18077,7 +18081,6 @@ var AirbnbFieldTrigger = React72.forwardRef(
18077
18081
  )
18078
18082
  ] }) : visibleLabelText;
18079
18083
  const animatedLabel = forceLabelText ? resolvedLabelText ?? placeholder : isRaised ? resolvedLabelText : label ?? placeholder;
18080
- const isAirbnbVariant = variant === "airbnb";
18081
18084
  const hasInvalidState = Boolean(error);
18082
18085
  const errorMessage = typeof error === "string" ? error : void 0;
18083
18086
  const isBlocked = Boolean(disabled) || Boolean(loading);
@@ -18092,11 +18095,11 @@ var AirbnbFieldTrigger = React72.forwardRef(
18092
18095
  )
18093
18096
  ] }) : void 0;
18094
18097
  const sharedClasses = cn(
18095
- "relative flex w-full items-center border bg-white text-left transition-colors focus-visible:outline-none",
18096
- 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)]",
18097
- isAirbnbVariant ? isRaised ? "min-h-[60px]" : "h-[60px]" : "min-h-[48px]",
18098
- hasInvalidState ? isAirbnbVariant ? "border-[var(--error-message-color)] bg-[#FFF5F3]" : "border-[var(--error-message-color)] bg-white" : isAirbnbVariant ? "border-[#8c8c8c]" : "border-[#A8A8A4] bg-white",
18099
- disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : isAirbnbVariant ? "cursor-pointer" : "cursor-text",
18098
+ "relative flex w-full items-center border bg-transparent text-left transition-colors focus-visible:outline-none",
18099
+ "rounded-[12px] border-[#8c8c8c] pl-4 pr-4 focus-visible:ring-2 focus-visible:ring-[#222222] focus-visible:ring-offset-2",
18100
+ isRaised ? "min-h-[60px]" : "h-[60px]",
18101
+ hasInvalidState ? "border-[var(--error-message-color)] bg-[#FFF5F3]" : "border-[#8c8c8c]",
18102
+ disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : "cursor-pointer",
18100
18103
  className
18101
18104
  );
18102
18105
  const sharedContent = /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(import_jsx_runtime184.Fragment, { children: [
@@ -18105,7 +18108,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
18105
18108
  {
18106
18109
  className: cn(
18107
18110
  "relative min-w-0 flex-1 pr-2",
18108
- isAirbnbVariant ? isRaised ? "h-[42px]" : "h-[28px]" : "h-[48px]",
18111
+ isRaised ? "h-[42px]" : "h-[28px]",
18109
18112
  contentClassName
18110
18113
  ),
18111
18114
  children: [
@@ -18116,8 +18119,8 @@ var AirbnbFieldTrigger = React72.forwardRef(
18116
18119
  className: cn(
18117
18120
  "absolute left-0 origin-left transition-all duration-200 ease-out",
18118
18121
  hasLabelMeta ? "max-w-full" : "pointer-events-none truncate",
18119
- 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",
18120
- hasInvalidState ? "text-[var(--error-message-color)]" : isAirbnbVariant ? "text-[#6c6c6c]" : "text-[#7A8399]"
18122
+ isRaised ? "top-[-1px] translate-y-0 text-xs leading-5" : "top-1/2 -translate-y-1/2 text-[16px] leading-7",
18123
+ hasInvalidState ? "text-[var(--error-message-color)]" : "text-[#6c6c6c]"
18121
18124
  ),
18122
18125
  children: animatedLabel
18123
18126
  }
@@ -18128,7 +18131,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
18128
18131
  id: valueId,
18129
18132
  className: cn(
18130
18133
  "absolute left-0 block truncate transition-all duration-200 ease-out",
18131
- isAirbnbVariant ? "bottom-0 translate-y-0 text-[16px] leading-6 opacity-100" : "bottom-[11px] text-[16px] leading-6",
18134
+ "bottom-0 translate-y-0 text-[16px] leading-6 opacity-100",
18132
18135
  hasInvalidState ? "text-[var(--error-message-color)]" : "text-[#222222]"
18133
18136
  ),
18134
18137
  children: valueText
@@ -18141,10 +18144,7 @@ var AirbnbFieldTrigger = React72.forwardRef(
18141
18144
  "span",
18142
18145
  {
18143
18146
  "aria-hidden": "true",
18144
- className: cn(
18145
- "pointer-events-none absolute top-1/2 -translate-y-1/2",
18146
- isAirbnbVariant ? "right-5" : "right-4"
18147
- ),
18147
+ className: "pointer-events-none absolute right-5 top-1/2 -translate-y-1/2",
18148
18148
  children: resolvedTrailingAdornment
18149
18149
  }
18150
18150
  )
@@ -18196,7 +18196,6 @@ var import_jsx_runtime185 = require("react/jsx-runtime");
18196
18196
  var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
18197
18197
  var AirbnbDatePicker = React73.forwardRef(
18198
18198
  ({
18199
- variant = "default",
18200
18199
  label,
18201
18200
  topLabel,
18202
18201
  value,
@@ -18323,7 +18322,6 @@ var AirbnbDatePicker = React73.forwardRef(
18323
18322
  {
18324
18323
  id: triggerId,
18325
18324
  ref: combinedRef,
18326
- variant,
18327
18325
  label,
18328
18326
  topLabel,
18329
18327
  labelId,
@@ -18389,7 +18387,6 @@ var import_jsx_runtime186 = require("react/jsx-runtime");
18389
18387
  var getInputValue = (value) => value != null ? String(value) : "";
18390
18388
  var AirbnbInput = React74.forwardRef(
18391
18389
  ({
18392
- variant = "default",
18393
18390
  label,
18394
18391
  topLabel,
18395
18392
  helperText,
@@ -18485,7 +18482,6 @@ var AirbnbInput = React74.forwardRef(
18485
18482
  AirbnbFieldTrigger,
18486
18483
  {
18487
18484
  as: "div",
18488
- variant,
18489
18485
  id: fieldId,
18490
18486
  label: accessibleLabel ?? "",
18491
18487
  topLabel,
@@ -18501,14 +18497,11 @@ var AirbnbInput = React74.forwardRef(
18501
18497
  tooltip,
18502
18498
  describedBy: error && renderErrorMessage ? errorId : void 0,
18503
18499
  className: cn(
18504
- variant === "airbnb" ? "px-4 focus-within:ring-2 focus-within:ring-[#1F1F1B] focus-within:ring-offset-2" : "px-3.5 focus-within:border-[#315EFB]",
18500
+ "px-4 focus-within:ring-2 focus-within:ring-[#1F1F1B] focus-within:ring-offset-2",
18505
18501
  disabled ? "cursor-not-allowed" : "cursor-text",
18506
18502
  fieldClassName
18507
18503
  ),
18508
- contentClassName: cn(
18509
- variant === "airbnb" ? "h-[42px]" : "h-[48px]",
18510
- contentClassName
18511
- ),
18504
+ contentClassName: cn("h-[42px]", contentClassName),
18512
18505
  trailingAdornment: shouldShowPasswordReveal ? void 0 : trailingAdornment,
18513
18506
  forceFloatingLabel: shouldShowLabel,
18514
18507
  forceLabelText: hasLabelMeta,
@@ -18535,7 +18528,7 @@ var AirbnbInput = React74.forwardRef(
18535
18528
  "aria-labelledby": accessibleLabel && !hasLabelMeta ? labelId : void 0,
18536
18529
  className: cn(
18537
18530
  "absolute left-0 h-6 w-full border-0 bg-transparent p-0 text-[16px] leading-6 text-[#1F1F1B] outline-none placeholder:text-[#7A8399]",
18538
- variant === "airbnb" ? "bottom-0" : "bottom-[12px]",
18531
+ "bottom-0",
18539
18532
  hasInvalidState ? "text-[var(--status-danger)] placeholder:text-[var(--status-danger)]" : "",
18540
18533
  disabled ? "cursor-not-allowed" : loading ? "cursor-progress" : "",
18541
18534
  shouldShowPasswordReveal ? "pr-8" : "",
@@ -18550,10 +18543,7 @@ var AirbnbInput = React74.forwardRef(
18550
18543
  type: "button",
18551
18544
  onClick: togglePasswordReveal,
18552
18545
  disabled: isBlocked,
18553
- className: cn(
18554
- "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",
18555
- variant === "airbnb" ? "bottom-0" : "bottom-[12px]"
18556
- ),
18546
+ 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",
18557
18547
  "aria-label": isPasswordRevealed ? t("hide_password") : t("show_password"),
18558
18548
  children: /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
18559
18549
  import_lucide_react54.Eye,
@@ -18929,7 +18919,6 @@ var AirbnbSelectTrigger = React75.forwardRef(
18929
18919
  ({
18930
18920
  id,
18931
18921
  open,
18932
- variant,
18933
18922
  label,
18934
18923
  topLabel,
18935
18924
  helperText,
@@ -18955,7 +18944,6 @@ var AirbnbSelectTrigger = React75.forwardRef(
18955
18944
  {
18956
18945
  id,
18957
18946
  ref,
18958
- variant,
18959
18947
  "aria-haspopup": "listbox",
18960
18948
  "aria-expanded": open,
18961
18949
  "aria-controls": listboxId,
@@ -19347,7 +19335,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19347
19335
  value,
19348
19336
  onChange,
19349
19337
  onBlur,
19350
- variant = "default",
19351
19338
  label,
19352
19339
  topLabel,
19353
19340
  placeholder,
@@ -19366,11 +19353,13 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19366
19353
  doneLabel = "Done",
19367
19354
  mobileTitle,
19368
19355
  name,
19369
- noOptionsMessage
19356
+ noOptionsMessage,
19357
+ filterOption
19370
19358
  }, ref) {
19371
19359
  const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
19372
19360
  const [isOpen, setIsOpen] = React79.useState(false);
19373
19361
  const containerRef = React79.useRef(null);
19362
+ const filteredOptions = filterOption ? options.filter(filterOption) : options;
19374
19363
  const hasValue = Boolean(value);
19375
19364
  const helperText = placeholder ?? label;
19376
19365
  const shouldDescribeHelperText = !hasValue && helperText !== label;
@@ -19401,7 +19390,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19401
19390
  } = useMobileSelectWheel({
19402
19391
  isMobile: isMobile3,
19403
19392
  isOpen,
19404
- options,
19393
+ options: filteredOptions,
19405
19394
  value,
19406
19395
  disabled: isBlocked
19407
19396
  });
@@ -19418,13 +19407,13 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19418
19407
  } = useDesktopSelect({
19419
19408
  isMobile: isMobile3,
19420
19409
  isOpen,
19421
- options,
19410
+ options: filteredOptions,
19422
19411
  value,
19423
19412
  disabled: isBlocked,
19424
19413
  onChange
19425
19414
  });
19426
19415
  const combinedRef = useCombinedRef(ref, desktopTriggerRef);
19427
- const activeMobileIndex = getOptionIndex2(options, pendingValue);
19416
+ const activeMobileIndex = getOptionIndex2(filteredOptions, pendingValue);
19428
19417
  const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
19429
19418
  useOutsideClick({
19430
19419
  elementRef: containerRef,
@@ -19441,12 +19430,12 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19441
19430
  if (value?.value === void 0 || value.value === null || value.label !== "") {
19442
19431
  return;
19443
19432
  }
19444
- const validOption = options.find((option) => option.value === value.value);
19433
+ const validOption = filteredOptions.find((option) => option.value === value.value);
19445
19434
  if (validOption) {
19446
19435
  onChange(validOption);
19447
19436
  }
19448
19437
  },
19449
- [onChange, options, value]
19438
+ [onChange, filteredOptions, value]
19450
19439
  );
19451
19440
  const handleMobileOpenChange = React79.useCallback(
19452
19441
  (nextOpen) => {
@@ -19531,7 +19520,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19531
19520
  renderTrigger ? renderTrigger({
19532
19521
  id: triggerId,
19533
19522
  open: isOpen,
19534
- variant,
19535
19523
  label,
19536
19524
  topLabel,
19537
19525
  helperText,
@@ -19555,7 +19543,6 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19555
19543
  id: triggerId,
19556
19544
  ref: combinedRef,
19557
19545
  open: isOpen,
19558
- variant,
19559
19546
  label,
19560
19547
  topLabel,
19561
19548
  helperText,
@@ -19589,7 +19576,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19589
19576
  mobileTitle,
19590
19577
  doneLabel,
19591
19578
  errorId: describedErrorId,
19592
- options,
19579
+ options: filteredOptions,
19593
19580
  disabled: isBlocked,
19594
19581
  menuClassName,
19595
19582
  scrollTop: mobileScrollTop,
@@ -19609,7 +19596,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
19609
19596
  listboxId,
19610
19597
  labelId,
19611
19598
  errorId: describedErrorId,
19612
- options,
19599
+ options: filteredOptions,
19613
19600
  value,
19614
19601
  highlightedIndex,
19615
19602
  onOptionClick: (option) => {
@@ -19644,7 +19631,6 @@ function formatPhoneCodeOptionLabel2(option) {
19644
19631
  }
19645
19632
  var AirbnbPhoneField = React80.forwardRef(
19646
19633
  ({
19647
- variant = "default",
19648
19634
  label,
19649
19635
  topLabel,
19650
19636
  value,
@@ -19716,7 +19702,6 @@ var AirbnbPhoneField = React80.forwardRef(
19716
19702
  AirbnbSelect,
19717
19703
  {
19718
19704
  ref,
19719
- variant,
19720
19705
  options: codeOptions,
19721
19706
  value: selectedCodeOption,
19722
19707
  onChange: (option) => onChange({
@@ -19735,7 +19720,6 @@ var AirbnbPhoneField = React80.forwardRef(
19735
19720
  renderTrigger: ({
19736
19721
  id,
19737
19722
  open,
19738
- variant: selectVariant,
19739
19723
  disabled: triggerDisabled,
19740
19724
  loading: triggerLoading,
19741
19725
  listboxId,
@@ -19759,9 +19743,8 @@ var AirbnbPhoneField = React80.forwardRef(
19759
19743
  onClick,
19760
19744
  onKeyDown,
19761
19745
  className: cn(
19762
- "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",
19763
- 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]",
19764
- 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]",
19746
+ "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",
19747
+ hasInvalidState ? "border-[var(--status-danger)] bg-[#F2F2F2] text-[var(--status-danger)]" : "border-[#8C8C8C] bg-[#F4F4F2] text-[#1F1F1B]",
19765
19748
  triggerDisabled ? "cursor-not-allowed opacity-50" : triggerLoading ? "cursor-progress" : "cursor-pointer"
19766
19749
  ),
19767
19750
  children: [
@@ -19782,7 +19765,6 @@ var AirbnbPhoneField = React80.forwardRef(
19782
19765
  AirbnbInput,
19783
19766
  {
19784
19767
  id: inputId,
19785
- variant,
19786
19768
  type: "tel",
19787
19769
  inputMode: "tel",
19788
19770
  label,
@@ -19797,10 +19779,8 @@ var AirbnbPhoneField = React80.forwardRef(
19797
19779
  tooltip,
19798
19780
  renderErrorMessage: false,
19799
19781
  wrapperClassName: "min-w-0 flex-1",
19800
- fieldClassName: cn(
19801
- variant === "airbnb" ? "min-h-[60px] rounded-l-none rounded-r-[16px] border-l-0" : "rounded-l-none rounded-r-[10px] border-l-0"
19802
- ),
19803
- contentClassName: cn(variant === "airbnb" ? "h-[40px] py-2" : "h-[48px]"),
19782
+ fieldClassName: "min-h-[60px] rounded-l-none rounded-r-[16px] border-l-0",
19783
+ contentClassName: "h-[40px] py-2",
19804
19784
  inputClassName: "text-[16px] leading-7",
19805
19785
  onChange: (event) => onChange({
19806
19786
  code: value?.code ?? "",
@@ -19841,7 +19821,6 @@ var AirbnbSearchableSelectInternal = ({
19841
19821
  loading,
19842
19822
  hasNextPage,
19843
19823
  onLoadMore,
19844
- variant = "default",
19845
19824
  label,
19846
19825
  topLabel,
19847
19826
  placeholder,
@@ -20025,7 +20004,6 @@ var AirbnbSearchableSelectInternal = ({
20025
20004
  {
20026
20005
  id: `${reactId}-trigger`,
20027
20006
  ref: triggerRef,
20028
- variant,
20029
20007
  "aria-haspopup": "listbox",
20030
20008
  "aria-expanded": open,
20031
20009
  "aria-controls": listboxId,
@@ -20308,59 +20286,83 @@ var React83 = __toESM(require("react"), 1);
20308
20286
  var SwitchPrimitives2 = __toESM(require("@radix-ui/react-switch"), 1);
20309
20287
  var import_lucide_react59 = require("lucide-react");
20310
20288
  var import_jsx_runtime196 = require("react/jsx-runtime");
20311
- var AirbnbSwitch = React83.forwardRef(({ className, value, onChange, disabled, loading, readOnly, id, label, error, wrapperClassName, ...props }, ref) => {
20312
- const generatedId = React83.useId();
20313
- const fieldId = id || generatedId;
20314
- const switchElement = /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
20315
- SwitchPrimitives2.Root,
20316
- {
20317
- ref,
20318
- className: cn(
20319
- "group inline-flex h-[24px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border border-solid border-transparent p-[2px] transition-colors duration-200",
20320
- "focus-visible:outline-none focus-visible:shadow-[var(--chekin-shadow-focus)]",
20321
- "disabled:cursor-not-allowed disabled:opacity-50 aria-busy:cursor-wait aria-busy:opacity-50",
20322
- "aria-readonly:cursor-default aria-readonly:opacity-100",
20323
- "data-[state=checked]:bg-[#222222] data-[state=unchecked]:bg-[#E7E7E4]",
20324
- className
20325
- ),
20326
- id: fieldId,
20327
- disabled,
20328
- checked: value,
20329
- value: String(value),
20330
- onCheckedChange: !disabled && !readOnly ? onChange : void 0,
20331
- "aria-busy": loading,
20332
- "aria-readonly": readOnly,
20333
- ...props,
20334
- children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
20335
- SwitchPrimitives2.Thumb,
20336
- {
20337
- className: cn(
20338
- "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",
20339
- "data-[state=checked]:translate-x-[12px] data-[state=unchecked]:translate-x-0"
20340
- ),
20341
- children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
20342
- import_lucide_react59.Check,
20343
- {
20344
- "aria-hidden": "true",
20345
- className: "h-3 w-3 text-[#222222] opacity-0 transition-opacity duration-150 group-data-[state=checked]:opacity-100",
20346
- strokeWidth: 3
20347
- }
20348
- )
20349
- }
20350
- )
20289
+ var AirbnbSwitch = React83.forwardRef(
20290
+ ({
20291
+ className,
20292
+ value,
20293
+ onChange,
20294
+ disabled,
20295
+ loading,
20296
+ readOnly,
20297
+ id,
20298
+ label,
20299
+ error,
20300
+ wrapperClassName,
20301
+ ...props
20302
+ }, ref) => {
20303
+ const generatedId = React83.useId();
20304
+ const fieldId = id || generatedId;
20305
+ const switchElement = /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
20306
+ SwitchPrimitives2.Root,
20307
+ {
20308
+ ref,
20309
+ className: cn(
20310
+ "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",
20311
+ "focus-visible:outline-none focus-visible:shadow-[var(--chekin-shadow-focus)]",
20312
+ "disabled:cursor-not-allowed disabled:opacity-50 aria-busy:cursor-wait aria-busy:opacity-50",
20313
+ "aria-readonly:cursor-default aria-readonly:opacity-100",
20314
+ "data-[state=checked]:bg-[#222222] data-[state=unchecked]:bg-[#E7E7E4]",
20315
+ className
20316
+ ),
20317
+ id: fieldId,
20318
+ disabled,
20319
+ checked: value,
20320
+ value: String(value),
20321
+ onCheckedChange: !disabled && !readOnly ? onChange : void 0,
20322
+ "aria-busy": loading,
20323
+ "aria-readonly": readOnly,
20324
+ ...props,
20325
+ children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
20326
+ SwitchPrimitives2.Thumb,
20327
+ {
20328
+ className: cn(
20329
+ "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",
20330
+ "data-[state=checked]:translate-x-[12px] data-[state=unchecked]:translate-x-0"
20331
+ ),
20332
+ children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
20333
+ import_lucide_react59.Check,
20334
+ {
20335
+ "aria-hidden": "true",
20336
+ className: "h-3 w-3 text-[#222222] opacity-0 transition-opacity duration-150 group-data-[state=checked]:opacity-100",
20337
+ strokeWidth: 3
20338
+ }
20339
+ )
20340
+ }
20341
+ )
20342
+ }
20343
+ );
20344
+ if (!label && !error) {
20345
+ return switchElement;
20351
20346
  }
20352
- );
20353
- if (!label && !error) {
20354
- return switchElement;
20347
+ return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)(import_jsx_runtime196.Fragment, { children: [
20348
+ /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: cn("flex items-center gap-x-3 gap-y-1.5", wrapperClassName), children: [
20349
+ switchElement,
20350
+ label && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
20351
+ Label,
20352
+ {
20353
+ htmlFor: fieldId,
20354
+ className: cn(
20355
+ "text-base font-medium",
20356
+ readOnly ? "cursor-default" : "cursor-pointer"
20357
+ ),
20358
+ children: label
20359
+ }
20360
+ )
20361
+ ] }),
20362
+ error && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(ErrorMessage, { disabled, children: error })
20363
+ ] });
20355
20364
  }
20356
- return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)(import_jsx_runtime196.Fragment, { children: [
20357
- /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: cn("flex items-center gap-x-3 gap-y-1.5", wrapperClassName), children: [
20358
- switchElement,
20359
- label && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(Label, { htmlFor: fieldId, className: "cursor-pointer text-base font-medium", children: label })
20360
- ] }),
20361
- error && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(ErrorMessage, { disabled, children: error })
20362
- ] });
20363
- });
20365
+ );
20364
20366
  AirbnbSwitch.displayName = "AirbnbSwitch";
20365
20367
  // Annotate the CommonJS export names for ESM import in node:
20366
20368
  0 && (module.exports = {