@chekinapp/ui 0.0.6 → 0.0.8

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
@@ -9203,6 +9203,7 @@ var DatePicker = React30.forwardRef(
9203
9203
  value,
9204
9204
  defaultValue,
9205
9205
  onChange,
9206
+ onBlur,
9206
9207
  placeholder = "Select a date",
9207
9208
  disabled,
9208
9209
  error,
@@ -9309,7 +9310,7 @@ var DatePicker = React30.forwardRef(
9309
9310
  setIsOpen(false);
9310
9311
  }
9311
9312
  }, [isBlocked]);
9312
- return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: cn("relative w-full max-w-[425px]", className), children: [
9313
+ return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: cn("relative w-full max-w-[var(--max-field-width)]", className), children: [
9313
9314
  name && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
9314
9315
  "input",
9315
9316
  {
@@ -9344,6 +9345,7 @@ var DatePicker = React30.forwardRef(
9344
9345
  "aria-expanded": isOpen,
9345
9346
  onClick: handleTriggerClick,
9346
9347
  onKeyDown: handleTriggerKeyDown,
9348
+ onBlur,
9347
9349
  trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_lucide_react42.Calendar, { className: "h-5 w-5 text-[#1F1F1B]", strokeWidth: 2 })
9348
9350
  }
9349
9351
  ),
@@ -9573,7 +9575,7 @@ var AirbnbInput = React31.forwardRef(
9573
9575
  setIsFocused(false);
9574
9576
  onBlur?.(event);
9575
9577
  };
9576
- return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", { className: cn("w-full", wrapperClassName), children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
9578
+ return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", { className: cn("w-full max-w-[var(--max-field-width)]", wrapperClassName), children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
9577
9579
  FieldTrigger,
9578
9580
  {
9579
9581
  as: "div",
@@ -10015,7 +10017,8 @@ var SelectTrigger2 = React32.forwardRef(
10015
10017
  listboxId,
10016
10018
  describedBy,
10017
10019
  onClick,
10018
- onKeyDown
10020
+ onKeyDown,
10021
+ onBlur
10019
10022
  }, ref) => {
10020
10023
  return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
10021
10024
  FieldTrigger,
@@ -10045,6 +10048,7 @@ var SelectTrigger2 = React32.forwardRef(
10045
10048
  disabled,
10046
10049
  onClick,
10047
10050
  onKeyDown,
10051
+ onBlur,
10048
10052
  trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
10049
10053
  import_lucide_react43.ChevronDown,
10050
10054
  {
@@ -10461,9 +10465,10 @@ function useOutsideClick(elementRef, onOutsideClick, nested) {
10461
10465
  // src/airbnb/select/Select.tsx
10462
10466
  var import_jsx_runtime131 = require("react/jsx-runtime");
10463
10467
  var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
10464
- options,
10468
+ options = [],
10465
10469
  value,
10466
10470
  onChange,
10471
+ onBlur,
10467
10472
  variant = "default",
10468
10473
  label,
10469
10474
  topLabel,
@@ -10631,109 +10636,118 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
10631
10636
  handleMobileOpenChange(false);
10632
10637
  }
10633
10638
  };
10634
- return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
10635
- name && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
10636
- renderTrigger ? renderTrigger({
10637
- id: triggerId,
10638
- open: isOpen,
10639
- variant,
10640
- label,
10641
- topLabel,
10642
- helperText,
10643
- value,
10644
- valueLabel,
10645
- disabled: isBlocked,
10646
- loading,
10647
- optional,
10648
- tooltip,
10649
- error,
10650
- invalid,
10651
- listboxId,
10652
- describedBy,
10653
- triggerRef: combinedRef,
10654
- onClick: handleTriggerClick,
10655
- onKeyDown: handleRootTriggerKeyDown
10656
- }) : /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
10657
- SelectTrigger2,
10658
- {
10659
- id: triggerId,
10660
- ref: combinedRef,
10661
- open: isOpen,
10662
- variant,
10663
- label,
10664
- topLabel,
10665
- helperText,
10666
- valueLabel,
10667
- disabled,
10668
- loading,
10669
- optional,
10670
- tooltip,
10671
- error: triggerError,
10672
- hideErrorMessage,
10673
- labelId,
10674
- valueId,
10675
- helperTextId,
10676
- errorId: error ? errorId : void 0,
10677
- listboxId,
10678
- describedBy,
10679
- onClick: handleTriggerClick,
10680
- onKeyDown: handleRootTriggerKeyDown
10681
- }
10682
- ),
10683
- isMobile ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
10684
- SelectMobileContent,
10685
- {
10686
- open: isOpen,
10687
- onOpenChange: handleMobileOpenChange,
10688
- onClose: () => handleMobileOpenChange(false),
10689
- listboxId,
10690
- labelId,
10691
- label,
10692
- mobileTitle,
10693
- doneLabel,
10694
- errorId: describedErrorId,
10695
- options,
10696
- disabled: isBlocked,
10697
- menuClassName,
10698
- scrollTop: mobileScrollTop,
10699
- activeIndex: activeMobileIndex,
10700
- listRef: mobileListRef,
10701
- onScroll: handleScroll,
10702
- onOptionClick: handleOptionClick,
10703
- onKeyDown: handleMobileWheelKeyDown,
10704
- onDone: handleMobileDone,
10705
- getOptionId: getOptionId2,
10706
- noOptionsMessage
10707
- }
10708
- ) : /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
10709
- SelectDesktopContent,
10710
- {
10711
- isOpen,
10712
- listboxId,
10713
- labelId,
10714
- errorId: describedErrorId,
10715
- options,
10716
- value,
10717
- highlightedIndex,
10718
- onOptionClick: (option) => {
10719
- handleDesktopSelect(option);
10720
- setIsOpen(false);
10721
- focusTrigger();
10722
- },
10723
- onOptionHover: setHighlightedIndex,
10724
- onKeyDown: (event) => {
10725
- handleMenuKeyDown(event, () => setIsOpen(false));
10726
- },
10727
- disabled: isBlocked,
10728
- menuClassName,
10729
- dropdownClassName,
10730
- listRef: desktopListRef,
10731
- setOptionRef,
10732
- getOptionId: getOptionId2,
10733
- noOptionsMessage
10734
- }
10735
- )
10736
- ] });
10639
+ return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
10640
+ "div",
10641
+ {
10642
+ ref: containerRef,
10643
+ className: cn("relative w-full max-w-[var(--max-field-width)]", className),
10644
+ children: [
10645
+ name && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
10646
+ renderTrigger ? renderTrigger({
10647
+ id: triggerId,
10648
+ open: isOpen,
10649
+ variant,
10650
+ label,
10651
+ topLabel,
10652
+ helperText,
10653
+ value,
10654
+ valueLabel,
10655
+ disabled: isBlocked,
10656
+ loading,
10657
+ optional,
10658
+ tooltip,
10659
+ error,
10660
+ invalid,
10661
+ listboxId,
10662
+ describedBy,
10663
+ triggerRef: combinedRef,
10664
+ onClick: handleTriggerClick,
10665
+ onKeyDown: handleRootTriggerKeyDown,
10666
+ onBlur
10667
+ }) : /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
10668
+ SelectTrigger2,
10669
+ {
10670
+ id: triggerId,
10671
+ ref: combinedRef,
10672
+ open: isOpen,
10673
+ variant,
10674
+ label,
10675
+ topLabel,
10676
+ helperText,
10677
+ valueLabel,
10678
+ disabled,
10679
+ loading,
10680
+ optional,
10681
+ tooltip,
10682
+ error: triggerError,
10683
+ hideErrorMessage,
10684
+ labelId,
10685
+ valueId,
10686
+ helperTextId,
10687
+ errorId: error ? errorId : void 0,
10688
+ listboxId,
10689
+ describedBy,
10690
+ onClick: handleTriggerClick,
10691
+ onKeyDown: handleRootTriggerKeyDown,
10692
+ onBlur
10693
+ }
10694
+ ),
10695
+ isMobile ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
10696
+ SelectMobileContent,
10697
+ {
10698
+ open: isOpen,
10699
+ onOpenChange: handleMobileOpenChange,
10700
+ onClose: () => handleMobileOpenChange(false),
10701
+ listboxId,
10702
+ labelId,
10703
+ label,
10704
+ mobileTitle,
10705
+ doneLabel,
10706
+ errorId: describedErrorId,
10707
+ options,
10708
+ disabled: isBlocked,
10709
+ menuClassName,
10710
+ scrollTop: mobileScrollTop,
10711
+ activeIndex: activeMobileIndex,
10712
+ listRef: mobileListRef,
10713
+ onScroll: handleScroll,
10714
+ onOptionClick: handleOptionClick,
10715
+ onKeyDown: handleMobileWheelKeyDown,
10716
+ onDone: handleMobileDone,
10717
+ getOptionId: getOptionId2,
10718
+ noOptionsMessage
10719
+ }
10720
+ ) : /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
10721
+ SelectDesktopContent,
10722
+ {
10723
+ isOpen,
10724
+ listboxId,
10725
+ labelId,
10726
+ errorId: describedErrorId,
10727
+ options,
10728
+ value,
10729
+ highlightedIndex,
10730
+ onOptionClick: (option) => {
10731
+ handleDesktopSelect(option);
10732
+ setIsOpen(false);
10733
+ focusTrigger();
10734
+ },
10735
+ onOptionHover: setHighlightedIndex,
10736
+ onKeyDown: (event) => {
10737
+ handleMenuKeyDown(event, () => setIsOpen(false));
10738
+ },
10739
+ disabled: isBlocked,
10740
+ menuClassName,
10741
+ dropdownClassName,
10742
+ listRef: desktopListRef,
10743
+ setOptionRef,
10744
+ getOptionId: getOptionId2,
10745
+ noOptionsMessage
10746
+ }
10747
+ )
10748
+ ]
10749
+ }
10750
+ );
10737
10751
  });
10738
10752
 
10739
10753
  // src/airbnb/phone-field/PhoneField.tsx
@@ -10745,6 +10759,7 @@ var PhoneField = React37.forwardRef(
10745
10759
  topLabel,
10746
10760
  value,
10747
10761
  onChange,
10762
+ onBlur,
10748
10763
  options,
10749
10764
  placeholder = "Phone number",
10750
10765
  disabled,
@@ -10765,7 +10780,7 @@ var PhoneField = React37.forwardRef(
10765
10780
  const codeOptions = React37.useMemo(
10766
10781
  () => options.map((option) => ({
10767
10782
  value: option.value,
10768
- label: option.label,
10783
+ label: `${option.label} (${option.value})`,
10769
10784
  disabled: option.disabled
10770
10785
  })),
10771
10786
  [options]
@@ -10778,7 +10793,7 @@ var PhoneField = React37.forwardRef(
10778
10793
  const hasInvalidState = Boolean(error) || Boolean(invalid);
10779
10794
  const isBlocked = Boolean(disabled) || Boolean(loading);
10780
10795
  const isCodeBlocked = isBlocked || Boolean(codeReadOnly);
10781
- return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: cn("w-full max-w-[425px]", className), children: [
10796
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: cn("w-full max-w-[var(--max-field-width)]", className), children: [
10782
10797
  name && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("input", { type: "hidden", name, value: combinedValue, disabled }),
10783
10798
  codeName && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
10784
10799
  "input",
@@ -10900,7 +10915,8 @@ var PhoneField = React37.forwardRef(
10900
10915
  onChange: (event) => onChange({
10901
10916
  code: value?.code ?? "",
10902
10917
  number: event.target.value
10903
- })
10918
+ }),
10919
+ onBlur
10904
10920
  }
10905
10921
  )
10906
10922
  ] }),
@@ -10968,6 +10984,7 @@ var SearchableSelectInternal = ({
10968
10984
  options,
10969
10985
  value,
10970
10986
  onChange,
10987
+ onBlur,
10971
10988
  onOpenChange,
10972
10989
  searchValue,
10973
10990
  onSearchChange,
@@ -11144,82 +11161,90 @@ var SearchableSelectInternal = ({
11144
11161
  }
11145
11162
  );
11146
11163
  React39.useImperativeHandle(ref, () => triggerRef.current, []);
11147
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
11148
- name && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
11149
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
11150
- FieldTrigger,
11151
- {
11152
- id: `${reactId}-trigger`,
11153
- ref: triggerRef,
11154
- variant,
11155
- "aria-haspopup": "listbox",
11156
- "aria-expanded": open,
11157
- "aria-controls": listboxId,
11158
- label,
11159
- topLabel,
11160
- labelId,
11161
- valueId,
11162
- helperTextId,
11163
- errorId: error ? errorId : void 0,
11164
- labelText: topLabel ? helperText : void 0,
11165
- valueText: valueLabel,
11166
- placeholder: helperText,
11167
- describedBy,
11168
- error: triggerError,
11169
- loading,
11170
- optional,
11171
- tooltip,
11172
- forceLabelText: Boolean(optional) || Boolean(tooltip),
11173
- hideErrorMessage,
11174
- disabled,
11175
- onClick: () => {
11176
- if (open) {
11177
- closeSelect();
11178
- return;
11179
- }
11180
- openSelect();
11181
- },
11182
- onKeyDown: handleTriggerKeyDown,
11183
- trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
11184
- import_lucide_react46.ChevronDown,
11164
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
11165
+ "div",
11166
+ {
11167
+ ref: containerRef,
11168
+ className: cn("relative w-full max-w-[var(--max-field-width)]", className),
11169
+ children: [
11170
+ name && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
11171
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
11172
+ FieldTrigger,
11185
11173
  {
11186
- className: cn(
11187
- "h-6 w-6 text-[#1F1F1B] transition-transform",
11188
- open && "rotate-180"
11174
+ id: `${reactId}-trigger`,
11175
+ ref: triggerRef,
11176
+ variant,
11177
+ "aria-haspopup": "listbox",
11178
+ "aria-expanded": open,
11179
+ "aria-controls": listboxId,
11180
+ label,
11181
+ topLabel,
11182
+ labelId,
11183
+ valueId,
11184
+ helperTextId,
11185
+ errorId: error ? errorId : void 0,
11186
+ labelText: topLabel ? helperText : void 0,
11187
+ valueText: valueLabel,
11188
+ placeholder: helperText,
11189
+ describedBy,
11190
+ error: triggerError,
11191
+ loading,
11192
+ optional,
11193
+ tooltip,
11194
+ forceLabelText: Boolean(optional) || Boolean(tooltip),
11195
+ hideErrorMessage,
11196
+ disabled,
11197
+ onClick: () => {
11198
+ if (open) {
11199
+ closeSelect();
11200
+ return;
11201
+ }
11202
+ openSelect();
11203
+ },
11204
+ onKeyDown: handleTriggerKeyDown,
11205
+ onBlur,
11206
+ trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
11207
+ import_lucide_react46.ChevronDown,
11208
+ {
11209
+ className: cn(
11210
+ "h-6 w-6 text-[#1F1F1B] transition-transform",
11211
+ open && "rotate-180"
11212
+ )
11213
+ }
11189
11214
  )
11190
11215
  }
11191
- )
11192
- }
11193
- ),
11194
- isMobile ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
11195
- Drawer,
11196
- {
11197
- open,
11198
- onOpenChange: (nextOpen) => {
11199
- if (isBlocked && nextOpen) return;
11200
- if (nextOpen) {
11201
- setSelectOpen(true);
11202
- return;
11203
- }
11204
- closeSelect();
11205
- },
11206
- children: /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(DrawerContent, { onClose: closeSelect, lockScroll: false, children: [
11207
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
11208
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(DrawerDescription, { className: "sr-only", children: label }),
11209
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "px-5 pb-5 pt-1", children: content })
11210
- ] })
11211
- }
11212
- ) : open ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
11213
- "div",
11214
- {
11215
- className: cn(
11216
- "absolute left-0 right-0 top-[calc(100%+8px)] z-20 overflow-hidden rounded-[20px] border border-[#DEDAD2] bg-white shadow-[0_14px_30px_rgba(18,18,18,0.08)]",
11217
- dropdownClassName
11218
11216
  ),
11219
- children: content
11220
- }
11221
- ) : null
11222
- ] });
11217
+ isMobile ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
11218
+ Drawer,
11219
+ {
11220
+ open,
11221
+ onOpenChange: (nextOpen) => {
11222
+ if (isBlocked && nextOpen) return;
11223
+ if (nextOpen) {
11224
+ setSelectOpen(true);
11225
+ return;
11226
+ }
11227
+ closeSelect();
11228
+ },
11229
+ children: /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(DrawerContent, { onClose: closeSelect, lockScroll: false, children: [
11230
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
11231
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(DrawerDescription, { className: "sr-only", children: label }),
11232
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "px-5 pb-5 pt-1", children: content })
11233
+ ] })
11234
+ }
11235
+ ) : open ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
11236
+ "div",
11237
+ {
11238
+ className: cn(
11239
+ "absolute left-0 right-0 top-[calc(100%+8px)] z-20 overflow-hidden rounded-[20px] border border-[#DEDAD2] bg-white shadow-[0_14px_30px_rgba(18,18,18,0.08)]",
11240
+ dropdownClassName
11241
+ ),
11242
+ children: content
11243
+ }
11244
+ ) : null
11245
+ ]
11246
+ }
11247
+ );
11223
11248
  };
11224
11249
  var SearchableSelect = React39.forwardRef(
11225
11250
  SearchableSelectInternal