@codapet/design-system 0.6.9 → 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 +2 -1
- package/dist/index.mjs +24 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
@@ -3712,23 +3712,25 @@ import * as React32 from "react";
|
|
|
3712
3712
|
import { OTPInput, OTPInputContext } from "input-otp";
|
|
3713
3713
|
import { MinusIcon } from "lucide-react";
|
|
3714
3714
|
import { jsx as jsx34, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3715
|
+
var InputOTPErrorContext = React32.createContext(false);
|
|
3715
3716
|
function InputOTP({
|
|
3716
3717
|
className,
|
|
3717
3718
|
containerClassName,
|
|
3719
|
+
error,
|
|
3718
3720
|
...props
|
|
3719
3721
|
}) {
|
|
3720
|
-
return /* @__PURE__ */ jsx34(
|
|
3722
|
+
return /* @__PURE__ */ jsx34(InputOTPErrorContext.Provider, { value: error ?? false, children: /* @__PURE__ */ jsx34(
|
|
3721
3723
|
OTPInput,
|
|
3722
3724
|
{
|
|
3723
3725
|
"data-slot": "input-otp",
|
|
3724
3726
|
containerClassName: cn(
|
|
3725
|
-
"flex items-center gap-2 has-disabled:opacity-
|
|
3727
|
+
"flex items-center gap-2 has-disabled:opacity-40",
|
|
3726
3728
|
containerClassName
|
|
3727
3729
|
),
|
|
3728
3730
|
className: cn("disabled:cursor-not-allowed", className),
|
|
3729
3731
|
...props
|
|
3730
3732
|
}
|
|
3731
|
-
);
|
|
3733
|
+
) });
|
|
3732
3734
|
}
|
|
3733
3735
|
function InputOTPGroup({ className, ...props }) {
|
|
3734
3736
|
return /* @__PURE__ */ jsx34(
|
|
@@ -3747,19 +3749,36 @@ function InputOTPSlot({
|
|
|
3747
3749
|
}) {
|
|
3748
3750
|
const inputOTPContext = React32.useContext(OTPInputContext);
|
|
3749
3751
|
const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
|
|
3752
|
+
const isHovering = inputOTPContext?.isHovering ?? false;
|
|
3753
|
+
const error = React32.useContext(InputOTPErrorContext);
|
|
3750
3754
|
return /* @__PURE__ */ jsxs18(
|
|
3751
3755
|
"div",
|
|
3752
3756
|
{
|
|
3753
3757
|
"data-slot": "input-otp-slot",
|
|
3754
3758
|
"data-active": isActive,
|
|
3755
3759
|
className: cn(
|
|
3756
|
-
|
|
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",
|
|
3757
3776
|
className
|
|
3758
3777
|
),
|
|
3759
3778
|
...props,
|
|
3760
3779
|
children: [
|
|
3761
3780
|
char,
|
|
3762
|
-
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-
|
|
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" }) })
|
|
3763
3782
|
]
|
|
3764
3783
|
}
|
|
3765
3784
|
);
|