@codapet/design-system 0.6.8 → 0.7.0

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.mts CHANGED
@@ -463,8 +463,9 @@ declare function HoverCard({ ...props }: React$1.ComponentProps<typeof HoverCard
463
463
  declare function HoverCardTrigger({ ...props }: React$1.ComponentProps<typeof HoverCardPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
464
464
  declare function HoverCardContent({ className, align, sideOffset, ...props }: React$1.ComponentProps<typeof HoverCardPrimitive.Content>): react_jsx_runtime.JSX.Element;
465
465
 
466
- declare function InputOTP({ className, containerClassName, ...props }: React$1.ComponentProps<typeof OTPInput> & {
466
+ declare function InputOTP({ className, containerClassName, error, ...props }: React$1.ComponentProps<typeof OTPInput> & {
467
467
  containerClassName?: string;
468
+ error?: boolean;
468
469
  }): react_jsx_runtime.JSX.Element;
469
470
  declare function InputOTPGroup({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
470
471
  declare function InputOTPSlot({ index, className, ...props }: React$1.ComponentProps<"div"> & {
package/dist/index.mjs CHANGED
@@ -404,25 +404,24 @@ import { jsx as jsx7 } from "react/jsx-runtime";
404
404
  var textareaBaseStyles = [
405
405
  // Base styles aligned with Input
406
406
  "placeholder:text-gray-subtle selection:bg-primary selection:text-primary-foreground",
407
- "flex w-full min-w-0 rounded-md border bg-transparent text-base shadow-xs transition-all duration-400",
407
+ "flex w-full min-w-0 rounded-lg border bg-transparent text-base font-medium transition-all duration-400",
408
408
  "outline-none font-sans",
409
409
  // Disabled
410
- "disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
411
- // Responsive text size
412
- "md:text-sm",
410
+ "disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-40",
413
411
  // Default state
414
- "border-border-default bg-background",
412
+ "border-gray-stroke-default bg-background",
415
413
  // Hover/Focus/Active states
416
- "hover:border-brand-normal",
417
- "focus:border-focus-ring",
418
- "active:border-brand-normal",
414
+ "hover:border-focus-ring",
415
+ "focus:border-2 focus:border-focus-ring",
416
+ "active:border-focus-ring",
419
417
  // Textarea specific
420
418
  "field-sizing-content min-h-16 resize-y px-3 py-2"
421
419
  ].join(" ");
422
420
  var errorStyles = [
423
- "border-destructive bg-red-subtle",
424
- "focus:border-destructive focus:ring-destructive/20",
425
- "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"
421
+ "border-error-stroke-default bg-white",
422
+ "hover:border-error-stroke-default",
423
+ "focus:border-2 focus:border-error-stroke-default",
424
+ "active:border-error-stroke-default"
426
425
  ].join(" ");
427
426
  var Textarea = React6.forwardRef(
428
427
  ({ className, error, ...props }, ref) => {
@@ -3713,23 +3712,25 @@ import * as React32 from "react";
3713
3712
  import { OTPInput, OTPInputContext } from "input-otp";
3714
3713
  import { MinusIcon } from "lucide-react";
3715
3714
  import { jsx as jsx34, jsxs as jsxs18 } from "react/jsx-runtime";
3715
+ var InputOTPErrorContext = React32.createContext(false);
3716
3716
  function InputOTP({
3717
3717
  className,
3718
3718
  containerClassName,
3719
+ error,
3719
3720
  ...props
3720
3721
  }) {
3721
- return /* @__PURE__ */ jsx34(
3722
+ return /* @__PURE__ */ jsx34(InputOTPErrorContext.Provider, { value: error ?? false, children: /* @__PURE__ */ jsx34(
3722
3723
  OTPInput,
3723
3724
  {
3724
3725
  "data-slot": "input-otp",
3725
3726
  containerClassName: cn(
3726
- "flex items-center gap-2 has-disabled:opacity-50",
3727
+ "flex items-center gap-2 has-disabled:opacity-40",
3727
3728
  containerClassName
3728
3729
  ),
3729
3730
  className: cn("disabled:cursor-not-allowed", className),
3730
3731
  ...props
3731
3732
  }
3732
- );
3733
+ ) });
3733
3734
  }
3734
3735
  function InputOTPGroup({ className, ...props }) {
3735
3736
  return /* @__PURE__ */ jsx34(
@@ -3748,19 +3749,36 @@ function InputOTPSlot({
3748
3749
  }) {
3749
3750
  const inputOTPContext = React32.useContext(OTPInputContext);
3750
3751
  const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
3752
+ const isHovering = inputOTPContext?.isHovering ?? false;
3753
+ const error = React32.useContext(InputOTPErrorContext);
3751
3754
  return /* @__PURE__ */ jsxs18(
3752
3755
  "div",
3753
3756
  {
3754
3757
  "data-slot": "input-otp-slot",
3755
3758
  "data-active": isActive,
3756
3759
  className: cn(
3757
- "data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",
3760
+ // Base layout & typography
3761
+ "relative flex size-10 items-center justify-center",
3762
+ "border-y border-r first:border-l text-sm font-medium leading-5",
3763
+ "transition-all outline-none",
3764
+ "first:rounded-l-[4px] last:rounded-r-[4px]",
3765
+ "text-foreground",
3766
+ // Default state (no error)
3767
+ !error && "border-gray-stroke-default bg-background",
3768
+ // Hover: all slots turn blue (non-error, non-active)
3769
+ !error && isHovering && !isActive && "border-focus-ring",
3770
+ // Active slot (non-error): 2px blue border
3771
+ !error && isActive && "z-10 border-2 border-focus-ring",
3772
+ // Error (non-active)
3773
+ error && !isActive && "border-error-stroke-default bg-error-surface-subtle",
3774
+ // Error + active
3775
+ error && isActive && "z-10 border-2 border-error-stroke-default bg-error-surface-subtle",
3758
3776
  className
3759
3777
  ),
3760
3778
  ...props,
3761
3779
  children: [
3762
3780
  char,
3763
- hasFakeCaret && /* @__PURE__ */ jsx34("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx34("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" }) })
3781
+ hasFakeCaret && /* @__PURE__ */ jsx34("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx34("div", { className: "animate-caret-blink bg-focus-ring h-4 w-px duration-1000" }) })
3764
3782
  ]
3765
3783
  }
3766
3784
  );