@pycolors/ui 1.3.0 → 1.5.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/components/ui/badge.d.ts +5 -5
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +22 -21
- package/dist/components/ui/checkbox.d.ts +9 -4
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +23 -12
- package/dist/components/ui/toast.d.ts +4 -4
- package/dist/components/ui/toast.d.ts.map +1 -1
- package/dist/components/ui/toast.js +19 -17
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { type VariantProps } from
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
variant?: "default" | "destructive" | "outline" | "secondary" | "muted" | "success" | "warning" | null | undefined;
|
|
4
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "muted" | "success" | "warning" | "info" | null | undefined;
|
|
5
5
|
size?: "sm" | "lg" | "md" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof badgeVariants> {
|
|
@@ -11,8 +11,8 @@ export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement>, Varia
|
|
|
11
11
|
*/
|
|
12
12
|
asChild?: boolean;
|
|
13
13
|
}
|
|
14
|
-
export type BadgeVariant = NonNullable<BadgeProps[
|
|
15
|
-
export type BadgeSize = NonNullable<BadgeProps[
|
|
14
|
+
export type BadgeVariant = NonNullable<BadgeProps["variant"]>;
|
|
15
|
+
export type BadgeSize = NonNullable<BadgeProps["size"]>;
|
|
16
16
|
declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
|
|
17
17
|
export { Badge, badgeVariants };
|
|
18
18
|
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/components/ui/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,aAAa;;;
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/components/ui/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,aAAa;;;8EA4BlB,CAAC;AAIF,MAAM,WAAW,UACf,SACE,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,EACrC,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AAC9D,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;AAExD,QAAA,MAAM,KAAK,oFAaV,CAAC;AAIF,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as React from
|
|
3
|
-
import { Slot } from
|
|
4
|
-
import { cva } from
|
|
5
|
-
import { cn } from
|
|
6
|
-
const badgeVariants = cva(
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
const badgeVariants = cva("inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-xs font-medium " +
|
|
7
|
+
"transition-colors ring-offset-background focus-visible:outline-none focus-visible:ring-2 " +
|
|
8
|
+
"focus-visible:ring-ring focus-visible:ring-offset-2", {
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
|
-
default:
|
|
12
|
-
secondary:
|
|
13
|
-
muted:
|
|
14
|
-
outline:
|
|
15
|
-
success:
|
|
16
|
-
warning:
|
|
17
|
-
destructive:
|
|
11
|
+
default: "border-transparent bg-primary text-primary-foreground",
|
|
12
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground",
|
|
13
|
+
muted: "border-transparent bg-muted text-muted-foreground",
|
|
14
|
+
outline: "border-border bg-background text-foreground",
|
|
15
|
+
success: "border-transparent bg-success text-success-foreground",
|
|
16
|
+
warning: "border-transparent bg-warning text-warning-foreground",
|
|
17
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground",
|
|
18
|
+
info: "border-transparent bg-card text-card-foreground",
|
|
18
19
|
},
|
|
19
20
|
size: {
|
|
20
|
-
sm:
|
|
21
|
-
md:
|
|
22
|
-
lg:
|
|
21
|
+
sm: "h-5 text-[11px]",
|
|
22
|
+
md: "h-6",
|
|
23
|
+
lg: "h-7 text-sm",
|
|
23
24
|
},
|
|
24
25
|
},
|
|
25
26
|
defaultVariants: {
|
|
26
|
-
variant:
|
|
27
|
-
size:
|
|
27
|
+
variant: "default",
|
|
28
|
+
size: "md",
|
|
28
29
|
},
|
|
29
30
|
});
|
|
30
31
|
const Badge = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
31
|
-
const Comp = asChild ? Slot :
|
|
32
|
+
const Comp = asChild ? Slot : "span";
|
|
32
33
|
return (_jsx(Comp, { ref: ref, "data-slot": "badge", className: cn(badgeVariants({ variant, size }), className), ...props }));
|
|
33
34
|
});
|
|
34
|
-
Badge.displayName =
|
|
35
|
+
Badge.displayName = "Badge";
|
|
35
36
|
export { Badge, badgeVariants };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as CheckboxPrimitive from
|
|
3
|
-
export
|
|
4
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
3
|
+
export interface CheckboxProps extends React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> {
|
|
4
|
+
/**
|
|
5
|
+
* Error message rendered below the Checkbox field.
|
|
6
|
+
*/
|
|
7
|
+
error?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
10
|
export type CheckboxFieldProps = React.HTMLAttributes<HTMLDivElement>;
|
|
6
11
|
declare function CheckboxField({ className, ...props }: Readonly<CheckboxFieldProps>): import("react/jsx-runtime").JSX.Element;
|
|
7
12
|
export type CheckboxContentProps = React.HTMLAttributes<HTMLDivElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/ui/checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAS9D,MAAM,
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/ui/checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAS9D,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,wBAAwB,CACnE,OAAO,iBAAiB,CAAC,IAAI,CAC9B;IACC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,QAAQ,yFA0Eb,CAAC;AAOF,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAEtE,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,QAAQ,CAAC,kBAAkB,CAAC,2CAW3E;AAED,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAExE,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,QAAQ,CAAC,oBAAoB,CAAC,2CAQhC;AAED,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAE7E,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,QAAQ,CAAC,kBAAkB,CAAC,2CAa3E;AAED,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAE5E,iBAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,QAAQ,CAAC,wBAAwB,CAAC,2CAYpC;AAMD,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,aAAa,EACb,mBAAmB,GACpB,CAAC"}
|
|
@@ -1,22 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as React from
|
|
4
|
-
import * as CheckboxPrimitive from
|
|
5
|
-
import { Check, Minus } from
|
|
6
|
-
import { cn } from
|
|
7
|
-
const Checkbox = React.forwardRef(({ className, checked,
|
|
8
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
5
|
+
import { Check, Minus } from "lucide-react";
|
|
6
|
+
import { cn } from "../../lib/utils.js";
|
|
7
|
+
const Checkbox = React.forwardRef(({ className, checked, error, id, "aria-describedby": consumerDescribedBy, "aria-invalid": consumerAriaInvalid, "aria-errormessage": consumerErrorMessage, ...props }, ref) => {
|
|
8
|
+
const generatedId = React.useId();
|
|
9
|
+
const checkboxId = error ? (id ?? generatedId) : id;
|
|
10
|
+
const errorId = error ? `${checkboxId}-error` : undefined;
|
|
11
|
+
const describedBy = [...(errorId ? [errorId] : []), consumerDescribedBy]
|
|
12
|
+
.filter(Boolean)
|
|
13
|
+
.join(" ") || undefined;
|
|
14
|
+
const checkbox = (_jsx(CheckboxPrimitive.Root, { ref: ref, "data-slot": "checkbox", id: checkboxId, checked: checked, className: cn("peer mt-0.5 size-4 shrink-0 rounded-sm border border-input bg-background shadow-xs transition-colors", "hover:border-foreground/30", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", "disabled:cursor-not-allowed disabled:opacity-50", "data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground", "data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground", "aria-invalid:border-destructive aria-invalid:ring-destructive/20", className), ...props, "aria-invalid": error ? true : consumerAriaInvalid, "aria-describedby": error ? describedBy : consumerDescribedBy, "aria-errormessage": error ? errorId : consumerErrorMessage, children: _jsx(CheckboxPrimitive.Indicator, { "data-slot": "checkbox-indicator", className: "flex items-center justify-center text-current", children: checked === "indeterminate" ? (_jsx(Minus, { className: "size-3", "aria-hidden": "true" })) : (_jsx(Check, { className: "size-3", "aria-hidden": "true" })) }) }));
|
|
15
|
+
if (!error)
|
|
16
|
+
return checkbox;
|
|
17
|
+
return (_jsxs(_Fragment, { children: [checkbox, _jsx("p", { id: errorId, role: "alert", className: "col-start-2 row-start-2 mt-1 text-xs text-destructive", children: error })] }));
|
|
18
|
+
});
|
|
19
|
+
Checkbox.displayName = "Checkbox";
|
|
9
20
|
function CheckboxField({ className, ...props }) {
|
|
10
|
-
return (_jsx("div", { "data-slot": "checkbox-field", className: cn(
|
|
21
|
+
return (_jsx("div", { "data-slot": "checkbox-field", className: cn("grid grid-cols-[auto_minmax(0,1fr)] items-start gap-x-3", className), ...props }));
|
|
11
22
|
}
|
|
12
23
|
function CheckboxContent({ className, ...props }) {
|
|
13
|
-
return (_jsx("div", { "data-slot": "checkbox-content", className: cn(
|
|
24
|
+
return (_jsx("div", { "data-slot": "checkbox-content", className: cn("col-start-2 row-start-1 grid min-w-0 gap-1", className), ...props }));
|
|
14
25
|
}
|
|
15
26
|
function CheckboxLabel({ className, ...props }) {
|
|
16
|
-
return (_jsx("label", { "data-slot": "checkbox-label", className: cn(
|
|
27
|
+
return (_jsx("label", { "data-slot": "checkbox-label", className: cn("block cursor-pointer text-sm font-medium leading-5 text-foreground", "peer-disabled:cursor-not-allowed peer-disabled:opacity-50", "[&_p]:m-0 [&_p]:text-sm [&_p]:font-medium [&_p]:leading-5 [&_p]:text-foreground", className), ...props }));
|
|
17
28
|
}
|
|
18
29
|
function CheckboxDescription({ className, ...props }) {
|
|
19
|
-
return (_jsx("div", { "data-slot": "checkbox-description", className: cn(
|
|
30
|
+
return (_jsx("div", { "data-slot": "checkbox-description", className: cn("text-sm leading-5 text-muted-foreground", "[&_p]:m-0 [&_p]:text-sm [&_p]:leading-5 [&_p]:text-muted-foreground", className), ...props }));
|
|
20
31
|
}
|
|
21
32
|
/* -----------------------------------------------------------------------------
|
|
22
33
|
* Exports
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as ToastPrimitive from
|
|
3
|
-
import { type VariantProps } from
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ToastPrimitive from "@radix-ui/react-toast";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
4
|
declare const toastVariants: (props?: ({
|
|
5
|
-
variant?: "default" | "destructive" | "success" | "warning" | null | undefined;
|
|
5
|
+
variant?: "default" | "destructive" | "success" | "warning" | "info" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export declare const ToastProvider: React.FC<ToastPrimitive.ToastProviderProps>;
|
|
8
8
|
export declare const ToastViewport: React.ForwardRefExoticComponent<ToastPrimitive.ToastViewportProps & React.RefAttributes<HTMLOListElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../src/components/ui/toast.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,aAAa;;
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../src/components/ui/toast.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,aAAa;;8EAiBlB,CAAC;AAEF,eAAO,MAAM,aAAa,6CAA0B,CAAC;AACrD,eAAO,MAAM,aAAa,4GAA0B,CAAC;AAErD,MAAM,WAAW,UACf,SACE,KAAK,CAAC,wBAAwB,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,EAC1D,YAAY,CAAC,OAAO,aAAa,CAAC;CAAG;AAiBzC,eAAO,MAAM,KAAK,kFAchB,CAAC;AAGH,eAAO,MAAM,UAAU,uGAAuB,CAAC;AAC/C,eAAO,MAAM,gBAAgB,6GAA6B,CAAC;AAC3D,eAAO,MAAM,UAAU,0GAAuB,CAAC"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as React from
|
|
4
|
-
import * as ToastPrimitive from
|
|
5
|
-
import { cva } from
|
|
6
|
-
import { cn } from
|
|
7
|
-
const toastVariants = cva(
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as ToastPrimitive from "@radix-ui/react-toast";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { cn } from "../../lib/utils.js";
|
|
7
|
+
const toastVariants = cva("pointer-events-auto relative flex w-full items-center justify-between gap-4 rounded-md border px-4 py-3 text-sm shadow-lg", {
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
10
|
-
default:
|
|
11
|
-
success:
|
|
12
|
-
warning:
|
|
13
|
-
destructive:
|
|
10
|
+
default: "bg-background text-foreground border-border",
|
|
11
|
+
success: "bg-background text-foreground border-success/40 text-success",
|
|
12
|
+
warning: "bg-background text-foreground border-warning/40 text-warning",
|
|
13
|
+
destructive: "bg-background text-foreground border-destructive/40 text-destructive",
|
|
14
|
+
info: "bg-background text-foreground border-border",
|
|
14
15
|
},
|
|
15
16
|
},
|
|
16
17
|
defaultVariants: {
|
|
17
|
-
variant:
|
|
18
|
+
variant: "default",
|
|
18
19
|
},
|
|
19
20
|
});
|
|
20
21
|
export const ToastProvider = ToastPrimitive.Provider;
|
|
@@ -24,16 +25,17 @@ export const ToastViewport = ToastPrimitive.Viewport;
|
|
|
24
25
|
// should interrupt; routine confirmations should announce politely. An
|
|
25
26
|
// explicit `type` prop from the consumer always wins over this default.
|
|
26
27
|
const toastTypeByVariant = {
|
|
27
|
-
default:
|
|
28
|
-
success:
|
|
29
|
-
warning:
|
|
30
|
-
destructive:
|
|
28
|
+
default: "background",
|
|
29
|
+
success: "background",
|
|
30
|
+
warning: "foreground",
|
|
31
|
+
destructive: "foreground",
|
|
32
|
+
info: "background",
|
|
31
33
|
};
|
|
32
34
|
export const Toast = React.forwardRef(({ className, variant, type, ...props }, ref) => {
|
|
33
|
-
const resolvedVariant = variant ??
|
|
35
|
+
const resolvedVariant = variant ?? "default";
|
|
34
36
|
return (_jsx(ToastPrimitive.Root, { ref: ref, type: type ?? toastTypeByVariant[resolvedVariant], className: cn(toastVariants({ variant }), className), ...props }));
|
|
35
37
|
});
|
|
36
|
-
Toast.displayName =
|
|
38
|
+
Toast.displayName = "Toast";
|
|
37
39
|
export const ToastTitle = ToastPrimitive.Title;
|
|
38
40
|
export const ToastDescription = ToastPrimitive.Description;
|
|
39
41
|
export const ToastClose = ToastPrimitive.Close;
|