@chekinapp/ui 0.0.7 → 0.0.10

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
@@ -924,10 +924,12 @@ var import_react_i18next3 = require("react-i18next");
924
924
  var import_class_variance_authority3 = require("class-variance-authority");
925
925
  var buttonVariants = (0, import_class_variance_authority3.cva)(
926
926
  [
927
- "relative inline-flex items-center justify-center gap-2 whitespace-nowrap font-sans font-semibold",
928
- "transition-colors duration-150 ease-out outline-none",
929
- "focus-visible:shadow-chekin-focus disabled:pointer-events-none disabled:opacity-50",
930
- "[&_svg]:pointer-events-none [&_svg]:shrink-0",
927
+ "relative inline-flex items-center justify-center gap-2 whitespace-nowrap",
928
+ "[font-family:var(--button-font-family)] [font-weight:var(--button-font-weight)]",
929
+ "transition-all duration-150 ease-out outline-none",
930
+ "focus-visible:shadow-[var(--button-focus-shadow)]",
931
+ "disabled:pointer-events-none disabled:opacity-50",
932
+ "[&_svg]:pointer-events-none [&_svg]:size-[var(--button-icon-size)] [&_svg]:shrink-0",
931
933
  'before:absolute before:inset-0 before:rounded-[inherit] before:content-[""]',
932
934
  "before:bg-transparent before:transition-colors before:duration-150",
933
935
  "[&>*]:relative [&>*]:z-[1]"
@@ -936,47 +938,62 @@ var buttonVariants = (0, import_class_variance_authority3.cva)(
936
938
  variants: {
937
939
  variant: {
938
940
  default: [
939
- "bg-chekin-blue text-white",
940
- "hover:before:bg-white/10 active:before:bg-black/10",
941
- "focus-visible:ring-1 focus-visible:ring-chekin-navy focus-visible:ring-inset"
941
+ "bg-[var(--button-primary-bg)] text-[color:var(--button-primary-text)]",
942
+ "hover:before:bg-[var(--button-primary-hover-overlay)] active:before:bg-[var(--button-primary-active-overlay)]",
943
+ "disabled:hover:before:bg-transparent"
942
944
  ],
943
945
  primary: [
944
- "bg-chekin-blue text-white",
945
- "hover:before:bg-white/10 active:before:bg-black/10",
946
- "focus-visible:ring-1 focus-visible:ring-chekin-navy focus-visible:ring-inset"
946
+ "bg-[var(--button-primary-bg)] text-[color:var(--button-primary-text)]",
947
+ "hover:before:bg-[var(--button-primary-hover-overlay)] active:before:bg-[var(--button-primary-active-overlay)]",
948
+ "disabled:hover:before:bg-transparent"
947
949
  ],
948
950
  destructive: [
949
- "border border-chekin-red bg-white text-chekin-red shadow-chekin-subtle-outline",
950
- "hover:bg-chekin-surface-input-empty"
951
+ "border border-[var(--button-destructive-border)] bg-[var(--button-destructive-bg)] text-[color:var(--button-destructive-text)]",
952
+ "shadow-[var(--button-shadow)]",
953
+ "hover:bg-[var(--button-destructive-hover-bg)]",
954
+ "disabled:hover:bg-[var(--button-destructive-bg)]"
951
955
  ],
952
956
  secondary: [
953
- "bg-white/30 text-chekin-navy shadow-chekin-subtle-outline",
954
- "hover:before:bg-black/5 active:before:bg-black/10"
957
+ "border border-[var(--button-secondary-border)] bg-[var(--button-secondary-bg)] text-[color:var(--button-secondary-text)]",
958
+ "shadow-[var(--button-shadow)]",
959
+ "hover:before:bg-[var(--button-secondary-hover-overlay)] active:before:bg-[var(--button-secondary-active-overlay)]",
960
+ "disabled:hover:before:bg-transparent"
955
961
  ],
956
962
  ghost: [
957
- "bg-transparent text-chekin-navy",
958
- "hover:bg-chekin-surface-input-empty active:bg-chekin-gray-3"
963
+ "bg-[var(--button-ghost-bg)] text-[color:var(--button-ghost-text)]",
964
+ "hover:bg-[var(--button-ghost-hover-bg)] active:bg-[var(--button-ghost-active-bg)]",
965
+ "disabled:hover:bg-[var(--button-ghost-bg)]"
959
966
  ],
960
967
  link: [
961
- "h-auto rounded-none bg-transparent px-0 py-0 text-chekin-blue underline-offset-4",
962
- "hover:underline active:opacity-80 before:hidden"
968
+ "h-auto rounded-none bg-[var(--button-link-bg)] px-0 py-0 text-[color:var(--button-link-text)]",
969
+ "underline-offset-4",
970
+ "hover:underline active:opacity-80 before:hidden",
971
+ "disabled:hover:no-underline"
963
972
  ],
964
973
  tertiary: [
965
- "border border-white bg-transparent text-white shadow-chekin-subtle-outline",
966
- "hover:before:bg-white/10 active:before:bg-black/10"
974
+ "border border-[var(--button-tertiary-border)] bg-[var(--button-tertiary-bg)] text-[color:var(--button-tertiary-text)]",
975
+ "shadow-[var(--button-shadow)]",
976
+ "hover:before:bg-[var(--button-tertiary-hover-overlay)] active:before:bg-[var(--button-tertiary-active-overlay)]",
977
+ "disabled:hover:before:bg-transparent"
978
+ ],
979
+ outline: [
980
+ "border border-[var(--button-outline-border)] bg-[var(--button-outline-bg)] text-[color:var(--button-outline-text)]",
981
+ "hover:bg-[var(--button-outline-hover-bg)]",
982
+ "disabled:hover:bg-[var(--button-outline-bg)]"
967
983
  ]
968
984
  },
969
985
  size: {
970
- default: "h-10 px-4 py-2 text-[14px]",
971
- m: "h-12 min-w-[160px] rounded-xl px-4 text-[14px]",
972
- s: "h-8 px-[12px] text-[13px]",
973
- sm: "h-9 rounded-md px-3 text-[14px]",
974
- lg: "h-11 rounded-md px-8 text-[15px]",
975
- xs: "h-6 px-[10px] text-[12px]",
976
- icon: "h-8 w-8 p-0"
986
+ default: "h-[var(--button-height-default)] min-w-[var(--button-min-width-default)] px-4 py-2 text-[length:var(--button-font-size)]",
987
+ m: "h-[var(--button-height-m)] min-w-[var(--button-min-width-m)] px-4 text-[length:var(--button-font-size)]",
988
+ md: "h-[var(--button-height-m)] min-w-[var(--button-min-width-m)] px-4 text-[length:var(--button-font-size)]",
989
+ s: "h-[var(--button-height-s)] px-[12px] text-[13px]",
990
+ sm: "h-[var(--button-height-sm)] px-3 text-[length:var(--button-font-size)]",
991
+ lg: "h-[var(--button-height-lg)] px-8 text-[15px]",
992
+ xs: "h-[var(--button-height-xs)] px-[10px] text-[12px]",
993
+ icon: "h-[var(--button-height-icon)] w-[var(--button-height-icon)] p-0"
977
994
  },
978
995
  shape: {
979
- rounded: "rounded-chekin-input",
996
+ rounded: "rounded-[var(--button-radius)]",
980
997
  pill: "rounded-full"
981
998
  },
982
999
  readOnly: {
@@ -1030,15 +1047,28 @@ var Button = React4.forwardRef(
1030
1047
  ...props
1031
1048
  }, ref) => {
1032
1049
  const { t } = (0, import_react_i18next3.useTranslation)();
1033
- const Comp = asChild ? import_react_slot2.Slot : "button";
1034
1050
  const showLoadingLabel = size !== "icon";
1051
+ const isDisabled = readOnly || disabled || loading;
1052
+ const classNames = cn(buttonVariants({ variant, size, shape, readOnly }), className);
1053
+ if (asChild) {
1054
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1055
+ import_react_slot2.Slot,
1056
+ {
1057
+ ref,
1058
+ "aria-disabled": isDisabled || void 0,
1059
+ className: classNames,
1060
+ ...props,
1061
+ children
1062
+ }
1063
+ );
1064
+ }
1035
1065
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1036
- Comp,
1066
+ "button",
1037
1067
  {
1038
1068
  ref,
1039
- type: Comp === "button" ? type ?? "button" : void 0,
1040
- disabled: readOnly || disabled || loading,
1041
- className: cn(buttonVariants({ variant, size, shape, readOnly }), className),
1069
+ type: type ?? "button",
1070
+ disabled: isDisabled,
1071
+ className: classNames,
1042
1072
  ...props,
1043
1073
  children: loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
1044
1074
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Spinner, {}),
@@ -9203,6 +9233,7 @@ var DatePicker = React30.forwardRef(
9203
9233
  value,
9204
9234
  defaultValue,
9205
9235
  onChange,
9236
+ onBlur,
9206
9237
  placeholder = "Select a date",
9207
9238
  disabled,
9208
9239
  error,
@@ -9344,6 +9375,7 @@ var DatePicker = React30.forwardRef(
9344
9375
  "aria-expanded": isOpen,
9345
9376
  onClick: handleTriggerClick,
9346
9377
  onKeyDown: handleTriggerKeyDown,
9378
+ onBlur,
9347
9379
  trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_lucide_react42.Calendar, { className: "h-5 w-5 text-[#1F1F1B]", strokeWidth: 2 })
9348
9380
  }
9349
9381
  ),
@@ -9399,7 +9431,7 @@ function ResponsiveSheet({
9399
9431
  closeOnOverlayClick = true,
9400
9432
  closeOnEscape = true
9401
9433
  }) {
9402
- const { isMatch: isMobile } = useScreenResize(DEVICE.laptop);
9434
+ const { isMatch: isMobile } = useScreenResize(DEVICE.tablet);
9403
9435
  const isMobileMode = isMobile && isMobileModalModeAvailable();
9404
9436
  const handleOpenChange = (nextOpen) => {
9405
9437
  if (!nextOpen) {
@@ -10015,7 +10047,8 @@ var SelectTrigger2 = React32.forwardRef(
10015
10047
  listboxId,
10016
10048
  describedBy,
10017
10049
  onClick,
10018
- onKeyDown
10050
+ onKeyDown,
10051
+ onBlur
10019
10052
  }, ref) => {
10020
10053
  return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
10021
10054
  FieldTrigger,
@@ -10045,6 +10078,7 @@ var SelectTrigger2 = React32.forwardRef(
10045
10078
  disabled,
10046
10079
  onClick,
10047
10080
  onKeyDown,
10081
+ onBlur,
10048
10082
  trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
10049
10083
  import_lucide_react43.ChevronDown,
10050
10084
  {
@@ -10461,9 +10495,10 @@ function useOutsideClick(elementRef, onOutsideClick, nested) {
10461
10495
  // src/airbnb/select/Select.tsx
10462
10496
  var import_jsx_runtime131 = require("react/jsx-runtime");
10463
10497
  var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
10464
- options,
10498
+ options = [],
10465
10499
  value,
10466
10500
  onChange,
10501
+ onBlur,
10467
10502
  variant = "default",
10468
10503
  label,
10469
10504
  topLabel,
@@ -10657,7 +10692,8 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
10657
10692
  describedBy,
10658
10693
  triggerRef: combinedRef,
10659
10694
  onClick: handleTriggerClick,
10660
- onKeyDown: handleRootTriggerKeyDown
10695
+ onKeyDown: handleRootTriggerKeyDown,
10696
+ onBlur
10661
10697
  }) : /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
10662
10698
  SelectTrigger2,
10663
10699
  {
@@ -10682,7 +10718,8 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
10682
10718
  listboxId,
10683
10719
  describedBy,
10684
10720
  onClick: handleTriggerClick,
10685
- onKeyDown: handleRootTriggerKeyDown
10721
+ onKeyDown: handleRootTriggerKeyDown,
10722
+ onBlur
10686
10723
  }
10687
10724
  ),
10688
10725
  isMobile ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
@@ -10752,6 +10789,7 @@ var PhoneField = React37.forwardRef(
10752
10789
  topLabel,
10753
10790
  value,
10754
10791
  onChange,
10792
+ onBlur,
10755
10793
  options,
10756
10794
  placeholder = "Phone number",
10757
10795
  disabled,
@@ -10772,7 +10810,7 @@ var PhoneField = React37.forwardRef(
10772
10810
  const codeOptions = React37.useMemo(
10773
10811
  () => options.map((option) => ({
10774
10812
  value: option.value,
10775
- label: option.label,
10813
+ label: `${option.label} (${option.value})`,
10776
10814
  disabled: option.disabled
10777
10815
  })),
10778
10816
  [options]
@@ -10907,7 +10945,8 @@ var PhoneField = React37.forwardRef(
10907
10945
  onChange: (event) => onChange({
10908
10946
  code: value?.code ?? "",
10909
10947
  number: event.target.value
10910
- })
10948
+ }),
10949
+ onBlur
10911
10950
  }
10912
10951
  )
10913
10952
  ] }),
@@ -10975,6 +11014,7 @@ var SearchableSelectInternal = ({
10975
11014
  options,
10976
11015
  value,
10977
11016
  onChange,
11017
+ onBlur,
10978
11018
  onOpenChange,
10979
11019
  searchValue,
10980
11020
  onSearchChange,
@@ -11192,6 +11232,7 @@ var SearchableSelectInternal = ({
11192
11232
  openSelect();
11193
11233
  },
11194
11234
  onKeyDown: handleTriggerKeyDown,
11235
+ onBlur,
11195
11236
  trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
11196
11237
  import_lucide_react46.ChevronDown,
11197
11238
  {