@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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React$1 from 'react';
2
- import { ReactNode, ElementType, InputHTMLAttributes, ComponentProps, PropsWithChildren, MouseEvent, SVGProps, FC, ImgHTMLAttributes, ComponentType, AnchorHTMLAttributes, ForwardedRef, ButtonHTMLAttributes, HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes, ComponentPropsWithoutRef, ReactElement, TextareaHTMLAttributes } from 'react';
2
+ import { ReactNode, ElementType, InputHTMLAttributes, ComponentProps, PropsWithChildren, MouseEvent, SVGProps, FC, ImgHTMLAttributes, ComponentType, AnchorHTMLAttributes, ForwardedRef, ButtonHTMLAttributes, HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes, ComponentPropsWithoutRef, ReactElement, TextareaHTMLAttributes, FocusEventHandler } from 'react';
3
3
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
@@ -163,8 +163,8 @@ type BreadcrumbsProps = {
163
163
  declare function Breadcrumbs({ className, children }: BreadcrumbsProps): react_jsx_runtime.JSX.Element;
164
164
 
165
165
  declare const buttonVariants: (props?: ({
166
- variant?: "link" | "default" | "secondary" | "destructive" | "primary" | "ghost" | "tertiary" | null | undefined;
167
- size?: "s" | "default" | "sm" | "lg" | "icon" | "m" | "xs" | null | undefined;
166
+ variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "primary" | "ghost" | "tertiary" | null | undefined;
167
+ size?: "s" | "default" | "sm" | "md" | "lg" | "icon" | "m" | "xs" | null | undefined;
168
168
  shape?: "rounded" | "pill" | null | undefined;
169
169
  readOnly?: boolean | null | undefined;
170
170
  } & class_variance_authority_types.ClassProp) | undefined) => string;
@@ -2224,6 +2224,7 @@ type DatePickerProps = {
2224
2224
  value?: DatePickerValue;
2225
2225
  defaultValue?: DatePickerValue;
2226
2226
  onChange: (value: Date | null) => void;
2227
+ onBlur?: React$1.FocusEventHandler<HTMLButtonElement>;
2227
2228
  placeholder?: string;
2228
2229
  disabled?: boolean;
2229
2230
  error?: string;
@@ -2400,6 +2401,7 @@ type PhoneFieldProps = {
2400
2401
  topLabel?: string;
2401
2402
  value?: PhoneFieldValue | null;
2402
2403
  onChange: (value: PhoneFieldValue) => void;
2404
+ onBlur?: React$1.FocusEventHandler<HTMLInputElement>;
2403
2405
  options: PhoneFieldOption[];
2404
2406
  placeholder?: string;
2405
2407
  disabled?: boolean;
@@ -2439,11 +2441,13 @@ type SelectRenderTriggerProps<T = undefined, V extends SelectValue = string, L e
2439
2441
  triggerRef: React$1.Ref<HTMLButtonElement>;
2440
2442
  onClick: () => void;
2441
2443
  onKeyDown: React$1.KeyboardEventHandler<HTMLButtonElement>;
2444
+ onBlur?: React$1.FocusEventHandler<HTMLButtonElement>;
2442
2445
  };
2443
2446
  type AirbnbSelectProps<T = undefined, V extends SelectValue = string, L extends string | number | React$1.ReactNode = string> = {
2444
- options: SelectOption<T, V, L>[];
2447
+ options?: SelectOption<T, V, L>[];
2445
2448
  value?: SelectOption<T, V, L> | null;
2446
2449
  onChange: (option: SelectOption<T, V, L>) => void;
2450
+ onBlur?: React$1.FocusEventHandler<HTMLButtonElement>;
2447
2451
  variant?: 'default' | 'airbnb';
2448
2452
  label: string;
2449
2453
  topLabel?: string;
@@ -2481,6 +2485,7 @@ type SearchableSelectProps<T = undefined, V extends SearchableSelectValue = stri
2481
2485
  options: SelectOption<T, V, L>[];
2482
2486
  value?: SelectOption<T, V, L> | null;
2483
2487
  onChange: (option: SelectOption<T, V, L>) => void;
2488
+ onBlur?: FocusEventHandler<HTMLButtonElement>;
2484
2489
  onOpenChange?: (open: boolean) => void;
2485
2490
  searchValue?: string;
2486
2491
  onSearchChange?: (value: string) => void;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React$1 from 'react';
2
- import { ReactNode, ElementType, InputHTMLAttributes, ComponentProps, PropsWithChildren, MouseEvent, SVGProps, FC, ImgHTMLAttributes, ComponentType, AnchorHTMLAttributes, ForwardedRef, ButtonHTMLAttributes, HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes, ComponentPropsWithoutRef, ReactElement, TextareaHTMLAttributes } from 'react';
2
+ import { ReactNode, ElementType, InputHTMLAttributes, ComponentProps, PropsWithChildren, MouseEvent, SVGProps, FC, ImgHTMLAttributes, ComponentType, AnchorHTMLAttributes, ForwardedRef, ButtonHTMLAttributes, HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes, ComponentPropsWithoutRef, ReactElement, TextareaHTMLAttributes, FocusEventHandler } from 'react';
3
3
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
@@ -163,8 +163,8 @@ type BreadcrumbsProps = {
163
163
  declare function Breadcrumbs({ className, children }: BreadcrumbsProps): react_jsx_runtime.JSX.Element;
164
164
 
165
165
  declare const buttonVariants: (props?: ({
166
- variant?: "link" | "default" | "secondary" | "destructive" | "primary" | "ghost" | "tertiary" | null | undefined;
167
- size?: "s" | "default" | "sm" | "lg" | "icon" | "m" | "xs" | null | undefined;
166
+ variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "primary" | "ghost" | "tertiary" | null | undefined;
167
+ size?: "s" | "default" | "sm" | "md" | "lg" | "icon" | "m" | "xs" | null | undefined;
168
168
  shape?: "rounded" | "pill" | null | undefined;
169
169
  readOnly?: boolean | null | undefined;
170
170
  } & class_variance_authority_types.ClassProp) | undefined) => string;
@@ -2224,6 +2224,7 @@ type DatePickerProps = {
2224
2224
  value?: DatePickerValue;
2225
2225
  defaultValue?: DatePickerValue;
2226
2226
  onChange: (value: Date | null) => void;
2227
+ onBlur?: React$1.FocusEventHandler<HTMLButtonElement>;
2227
2228
  placeholder?: string;
2228
2229
  disabled?: boolean;
2229
2230
  error?: string;
@@ -2400,6 +2401,7 @@ type PhoneFieldProps = {
2400
2401
  topLabel?: string;
2401
2402
  value?: PhoneFieldValue | null;
2402
2403
  onChange: (value: PhoneFieldValue) => void;
2404
+ onBlur?: React$1.FocusEventHandler<HTMLInputElement>;
2403
2405
  options: PhoneFieldOption[];
2404
2406
  placeholder?: string;
2405
2407
  disabled?: boolean;
@@ -2439,11 +2441,13 @@ type SelectRenderTriggerProps<T = undefined, V extends SelectValue = string, L e
2439
2441
  triggerRef: React$1.Ref<HTMLButtonElement>;
2440
2442
  onClick: () => void;
2441
2443
  onKeyDown: React$1.KeyboardEventHandler<HTMLButtonElement>;
2444
+ onBlur?: React$1.FocusEventHandler<HTMLButtonElement>;
2442
2445
  };
2443
2446
  type AirbnbSelectProps<T = undefined, V extends SelectValue = string, L extends string | number | React$1.ReactNode = string> = {
2444
- options: SelectOption<T, V, L>[];
2447
+ options?: SelectOption<T, V, L>[];
2445
2448
  value?: SelectOption<T, V, L> | null;
2446
2449
  onChange: (option: SelectOption<T, V, L>) => void;
2450
+ onBlur?: React$1.FocusEventHandler<HTMLButtonElement>;
2447
2451
  variant?: 'default' | 'airbnb';
2448
2452
  label: string;
2449
2453
  topLabel?: string;
@@ -2481,6 +2485,7 @@ type SearchableSelectProps<T = undefined, V extends SearchableSelectValue = stri
2481
2485
  options: SelectOption<T, V, L>[];
2482
2486
  value?: SelectOption<T, V, L> | null;
2483
2487
  onChange: (option: SelectOption<T, V, L>) => void;
2488
+ onBlur?: FocusEventHandler<HTMLButtonElement>;
2484
2489
  onOpenChange?: (open: boolean) => void;
2485
2490
  searchValue?: string;
2486
2491
  onSearchChange?: (value: string) => void;
package/dist/index.js CHANGED
@@ -627,10 +627,12 @@ import { useTranslation as useTranslation3 } from "react-i18next";
627
627
  import { cva as cva3 } from "class-variance-authority";
628
628
  var buttonVariants = cva3(
629
629
  [
630
- "relative inline-flex items-center justify-center gap-2 whitespace-nowrap font-sans font-semibold",
631
- "transition-colors duration-150 ease-out outline-none",
632
- "focus-visible:shadow-chekin-focus disabled:pointer-events-none disabled:opacity-50",
633
- "[&_svg]:pointer-events-none [&_svg]:shrink-0",
630
+ "relative inline-flex items-center justify-center gap-2 whitespace-nowrap",
631
+ "[font-family:var(--button-font-family)] [font-weight:var(--button-font-weight)]",
632
+ "transition-all duration-150 ease-out outline-none",
633
+ "focus-visible:shadow-[var(--button-focus-shadow)]",
634
+ "disabled:pointer-events-none disabled:opacity-50",
635
+ "[&_svg]:pointer-events-none [&_svg]:size-[var(--button-icon-size)] [&_svg]:shrink-0",
634
636
  'before:absolute before:inset-0 before:rounded-[inherit] before:content-[""]',
635
637
  "before:bg-transparent before:transition-colors before:duration-150",
636
638
  "[&>*]:relative [&>*]:z-[1]"
@@ -639,47 +641,62 @@ var buttonVariants = cva3(
639
641
  variants: {
640
642
  variant: {
641
643
  default: [
642
- "bg-chekin-blue text-white",
643
- "hover:before:bg-white/10 active:before:bg-black/10",
644
- "focus-visible:ring-1 focus-visible:ring-chekin-navy focus-visible:ring-inset"
644
+ "bg-[var(--button-primary-bg)] text-[color:var(--button-primary-text)]",
645
+ "hover:before:bg-[var(--button-primary-hover-overlay)] active:before:bg-[var(--button-primary-active-overlay)]",
646
+ "disabled:hover:before:bg-transparent"
645
647
  ],
646
648
  primary: [
647
- "bg-chekin-blue text-white",
648
- "hover:before:bg-white/10 active:before:bg-black/10",
649
- "focus-visible:ring-1 focus-visible:ring-chekin-navy focus-visible:ring-inset"
649
+ "bg-[var(--button-primary-bg)] text-[color:var(--button-primary-text)]",
650
+ "hover:before:bg-[var(--button-primary-hover-overlay)] active:before:bg-[var(--button-primary-active-overlay)]",
651
+ "disabled:hover:before:bg-transparent"
650
652
  ],
651
653
  destructive: [
652
- "border border-chekin-red bg-white text-chekin-red shadow-chekin-subtle-outline",
653
- "hover:bg-chekin-surface-input-empty"
654
+ "border border-[var(--button-destructive-border)] bg-[var(--button-destructive-bg)] text-[color:var(--button-destructive-text)]",
655
+ "shadow-[var(--button-shadow)]",
656
+ "hover:bg-[var(--button-destructive-hover-bg)]",
657
+ "disabled:hover:bg-[var(--button-destructive-bg)]"
654
658
  ],
655
659
  secondary: [
656
- "bg-white/30 text-chekin-navy shadow-chekin-subtle-outline",
657
- "hover:before:bg-black/5 active:before:bg-black/10"
660
+ "border border-[var(--button-secondary-border)] bg-[var(--button-secondary-bg)] text-[color:var(--button-secondary-text)]",
661
+ "shadow-[var(--button-shadow)]",
662
+ "hover:before:bg-[var(--button-secondary-hover-overlay)] active:before:bg-[var(--button-secondary-active-overlay)]",
663
+ "disabled:hover:before:bg-transparent"
658
664
  ],
659
665
  ghost: [
660
- "bg-transparent text-chekin-navy",
661
- "hover:bg-chekin-surface-input-empty active:bg-chekin-gray-3"
666
+ "bg-[var(--button-ghost-bg)] text-[color:var(--button-ghost-text)]",
667
+ "hover:bg-[var(--button-ghost-hover-bg)] active:bg-[var(--button-ghost-active-bg)]",
668
+ "disabled:hover:bg-[var(--button-ghost-bg)]"
662
669
  ],
663
670
  link: [
664
- "h-auto rounded-none bg-transparent px-0 py-0 text-chekin-blue underline-offset-4",
665
- "hover:underline active:opacity-80 before:hidden"
671
+ "h-auto rounded-none bg-[var(--button-link-bg)] px-0 py-0 text-[color:var(--button-link-text)]",
672
+ "underline-offset-4",
673
+ "hover:underline active:opacity-80 before:hidden",
674
+ "disabled:hover:no-underline"
666
675
  ],
667
676
  tertiary: [
668
- "border border-white bg-transparent text-white shadow-chekin-subtle-outline",
669
- "hover:before:bg-white/10 active:before:bg-black/10"
677
+ "border border-[var(--button-tertiary-border)] bg-[var(--button-tertiary-bg)] text-[color:var(--button-tertiary-text)]",
678
+ "shadow-[var(--button-shadow)]",
679
+ "hover:before:bg-[var(--button-tertiary-hover-overlay)] active:before:bg-[var(--button-tertiary-active-overlay)]",
680
+ "disabled:hover:before:bg-transparent"
681
+ ],
682
+ outline: [
683
+ "border border-[var(--button-outline-border)] bg-[var(--button-outline-bg)] text-[color:var(--button-outline-text)]",
684
+ "hover:bg-[var(--button-outline-hover-bg)]",
685
+ "disabled:hover:bg-[var(--button-outline-bg)]"
670
686
  ]
671
687
  },
672
688
  size: {
673
- default: "h-10 px-4 py-2 text-[14px]",
674
- m: "h-12 min-w-[160px] rounded-xl px-4 text-[14px]",
675
- s: "h-8 px-[12px] text-[13px]",
676
- sm: "h-9 rounded-md px-3 text-[14px]",
677
- lg: "h-11 rounded-md px-8 text-[15px]",
678
- xs: "h-6 px-[10px] text-[12px]",
679
- icon: "h-8 w-8 p-0"
689
+ default: "h-[var(--button-height-default)] min-w-[var(--button-min-width-default)] px-4 py-2 text-[length:var(--button-font-size)]",
690
+ m: "h-[var(--button-height-m)] min-w-[var(--button-min-width-m)] px-4 text-[length:var(--button-font-size)]",
691
+ md: "h-[var(--button-height-m)] min-w-[var(--button-min-width-m)] px-4 text-[length:var(--button-font-size)]",
692
+ s: "h-[var(--button-height-s)] px-[12px] text-[13px]",
693
+ sm: "h-[var(--button-height-sm)] px-3 text-[length:var(--button-font-size)]",
694
+ lg: "h-[var(--button-height-lg)] px-8 text-[15px]",
695
+ xs: "h-[var(--button-height-xs)] px-[10px] text-[12px]",
696
+ icon: "h-[var(--button-height-icon)] w-[var(--button-height-icon)] p-0"
680
697
  },
681
698
  shape: {
682
- rounded: "rounded-chekin-input",
699
+ rounded: "rounded-[var(--button-radius)]",
683
700
  pill: "rounded-full"
684
701
  },
685
702
  readOnly: {
@@ -733,15 +750,28 @@ var Button = React4.forwardRef(
733
750
  ...props
734
751
  }, ref) => {
735
752
  const { t } = useTranslation3();
736
- const Comp = asChild ? Slot2 : "button";
737
753
  const showLoadingLabel = size !== "icon";
754
+ const isDisabled = readOnly || disabled || loading;
755
+ const classNames = cn(buttonVariants({ variant, size, shape, readOnly }), className);
756
+ if (asChild) {
757
+ return /* @__PURE__ */ jsx10(
758
+ Slot2,
759
+ {
760
+ ref,
761
+ "aria-disabled": isDisabled || void 0,
762
+ className: classNames,
763
+ ...props,
764
+ children
765
+ }
766
+ );
767
+ }
738
768
  return /* @__PURE__ */ jsx10(
739
- Comp,
769
+ "button",
740
770
  {
741
771
  ref,
742
- type: Comp === "button" ? type ?? "button" : void 0,
743
- disabled: readOnly || disabled || loading,
744
- className: cn(buttonVariants({ variant, size, shape, readOnly }), className),
772
+ type: type ?? "button",
773
+ disabled: isDisabled,
774
+ className: classNames,
745
775
  ...props,
746
776
  children: loading ? /* @__PURE__ */ jsxs9("span", { className: "inline-flex items-center gap-1.5", children: [
747
777
  /* @__PURE__ */ jsx10(Spinner, {}),
@@ -8937,6 +8967,7 @@ var DatePicker = React30.forwardRef(
8937
8967
  value,
8938
8968
  defaultValue,
8939
8969
  onChange,
8970
+ onBlur,
8940
8971
  placeholder = "Select a date",
8941
8972
  disabled,
8942
8973
  error,
@@ -9078,6 +9109,7 @@ var DatePicker = React30.forwardRef(
9078
9109
  "aria-expanded": isOpen,
9079
9110
  onClick: handleTriggerClick,
9080
9111
  onKeyDown: handleTriggerKeyDown,
9112
+ onBlur,
9081
9113
  trailingAdornment: /* @__PURE__ */ jsx121(Calendar2, { className: "h-5 w-5 text-[#1F1F1B]", strokeWidth: 2 })
9082
9114
  }
9083
9115
  ),
@@ -9133,7 +9165,7 @@ function ResponsiveSheet({
9133
9165
  closeOnOverlayClick = true,
9134
9166
  closeOnEscape = true
9135
9167
  }) {
9136
- const { isMatch: isMobile } = useScreenResize(DEVICE.laptop);
9168
+ const { isMatch: isMobile } = useScreenResize(DEVICE.tablet);
9137
9169
  const isMobileMode = isMobile && isMobileModalModeAvailable();
9138
9170
  const handleOpenChange = (nextOpen) => {
9139
9171
  if (!nextOpen) {
@@ -9749,7 +9781,8 @@ var SelectTrigger2 = React32.forwardRef(
9749
9781
  listboxId,
9750
9782
  describedBy,
9751
9783
  onClick,
9752
- onKeyDown
9784
+ onKeyDown,
9785
+ onBlur
9753
9786
  }, ref) => {
9754
9787
  return /* @__PURE__ */ jsx128(
9755
9788
  FieldTrigger,
@@ -9779,6 +9812,7 @@ var SelectTrigger2 = React32.forwardRef(
9779
9812
  disabled,
9780
9813
  onClick,
9781
9814
  onKeyDown,
9815
+ onBlur,
9782
9816
  trailingAdornment: /* @__PURE__ */ jsx128(
9783
9817
  ChevronDown,
9784
9818
  {
@@ -10195,9 +10229,10 @@ function useOutsideClick(elementRef, onOutsideClick, nested) {
10195
10229
  // src/airbnb/select/Select.tsx
10196
10230
  import { jsx as jsx129, jsxs as jsxs83 } from "react/jsx-runtime";
10197
10231
  var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
10198
- options,
10232
+ options = [],
10199
10233
  value,
10200
10234
  onChange,
10235
+ onBlur,
10201
10236
  variant = "default",
10202
10237
  label,
10203
10238
  topLabel,
@@ -10391,7 +10426,8 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
10391
10426
  describedBy,
10392
10427
  triggerRef: combinedRef,
10393
10428
  onClick: handleTriggerClick,
10394
- onKeyDown: handleRootTriggerKeyDown
10429
+ onKeyDown: handleRootTriggerKeyDown,
10430
+ onBlur
10395
10431
  }) : /* @__PURE__ */ jsx129(
10396
10432
  SelectTrigger2,
10397
10433
  {
@@ -10416,7 +10452,8 @@ var AirbnbSelect = React36.forwardRef(function AirbnbSelect2({
10416
10452
  listboxId,
10417
10453
  describedBy,
10418
10454
  onClick: handleTriggerClick,
10419
- onKeyDown: handleRootTriggerKeyDown
10455
+ onKeyDown: handleRootTriggerKeyDown,
10456
+ onBlur
10420
10457
  }
10421
10458
  ),
10422
10459
  isMobile ? /* @__PURE__ */ jsx129(
@@ -10486,6 +10523,7 @@ var PhoneField = React37.forwardRef(
10486
10523
  topLabel,
10487
10524
  value,
10488
10525
  onChange,
10526
+ onBlur,
10489
10527
  options,
10490
10528
  placeholder = "Phone number",
10491
10529
  disabled,
@@ -10506,7 +10544,7 @@ var PhoneField = React37.forwardRef(
10506
10544
  const codeOptions = React37.useMemo(
10507
10545
  () => options.map((option) => ({
10508
10546
  value: option.value,
10509
- label: option.label,
10547
+ label: `${option.label} (${option.value})`,
10510
10548
  disabled: option.disabled
10511
10549
  })),
10512
10550
  [options]
@@ -10641,7 +10679,8 @@ var PhoneField = React37.forwardRef(
10641
10679
  onChange: (event) => onChange({
10642
10680
  code: value?.code ?? "",
10643
10681
  number: event.target.value
10644
- })
10682
+ }),
10683
+ onBlur
10645
10684
  }
10646
10685
  )
10647
10686
  ] }),
@@ -10709,6 +10748,7 @@ var SearchableSelectInternal = ({
10709
10748
  options,
10710
10749
  value,
10711
10750
  onChange,
10751
+ onBlur,
10712
10752
  onOpenChange,
10713
10753
  searchValue,
10714
10754
  onSearchChange,
@@ -10926,6 +10966,7 @@ var SearchableSelectInternal = ({
10926
10966
  openSelect();
10927
10967
  },
10928
10968
  onKeyDown: handleTriggerKeyDown,
10969
+ onBlur,
10929
10970
  trailingAdornment: /* @__PURE__ */ jsx132(
10930
10971
  ChevronDown3,
10931
10972
  {