@kenshinx/ui 1.1.0 → 1.2.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.ts +22 -1
- package/dist/index.js +123 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
|
8
8
|
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
9
9
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
10
10
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
11
|
+
import { ToasterProps } from 'sonner';
|
|
12
|
+
export { toast } from 'sonner';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Utility function to merge Tailwind CSS classes with clsx
|
|
@@ -71,4 +73,23 @@ declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.
|
|
|
71
73
|
declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
72
74
|
declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
73
75
|
|
|
74
|
-
|
|
76
|
+
declare const Toaster: ({ theme: themeProp, ...props }: ToasterProps) => react_jsx_runtime.JSX.Element;
|
|
77
|
+
|
|
78
|
+
declare const alertVariants: (props?: ({
|
|
79
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
80
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
81
|
+
declare const Alert: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
82
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
83
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
84
|
+
declare const AlertTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
85
|
+
declare const AlertDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
86
|
+
|
|
87
|
+
declare const badgeVariants: (props?: ({
|
|
88
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
89
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
90
|
+
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
91
|
+
asChild?: boolean;
|
|
92
|
+
}
|
|
93
|
+
declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLDivElement>>;
|
|
94
|
+
|
|
95
|
+
export { Alert, AlertDescription, AlertTitle, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Input, type InputProps, Label, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Switch, Textarea, type TextareaProps, Toaster, alertVariants, badgeVariants, buttonVariants, cn };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { twMerge } from 'tailwind-merge';
|
|
3
3
|
import * as React9 from 'react';
|
|
4
|
+
import { useState, useEffect } from 'react';
|
|
4
5
|
import { Slot } from '@radix-ui/react-slot';
|
|
5
6
|
import { cva } from 'class-variance-authority';
|
|
6
7
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -10,6 +11,8 @@ import { X, Check, ChevronDown, ChevronUp } from 'lucide-react';
|
|
|
10
11
|
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
11
12
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
12
13
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
14
|
+
import { Toaster as Toaster$1 } from 'sonner';
|
|
15
|
+
export { toast } from 'sonner';
|
|
13
16
|
|
|
14
17
|
// src/lib/utils.ts
|
|
15
18
|
function cn(...inputs) {
|
|
@@ -385,5 +388,124 @@ var SelectSeparator = React9.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
385
388
|
}
|
|
386
389
|
));
|
|
387
390
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
391
|
+
var Toaster = ({ theme: themeProp, ...props }) => {
|
|
392
|
+
const [theme, setTheme] = useState("system");
|
|
393
|
+
useEffect(() => {
|
|
394
|
+
if (!themeProp && typeof document !== "undefined") {
|
|
395
|
+
const isDark = document.documentElement.classList.contains("dark");
|
|
396
|
+
setTheme(isDark ? "dark" : "light");
|
|
397
|
+
const observer = new MutationObserver((mutations) => {
|
|
398
|
+
mutations.forEach((mutation) => {
|
|
399
|
+
if (mutation.attributeName === "class") {
|
|
400
|
+
const isDark2 = document.documentElement.classList.contains("dark");
|
|
401
|
+
setTheme(isDark2 ? "dark" : "light");
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
observer.observe(document.documentElement, {
|
|
406
|
+
attributes: true,
|
|
407
|
+
attributeFilter: ["class"]
|
|
408
|
+
});
|
|
409
|
+
return () => observer.disconnect();
|
|
410
|
+
}
|
|
411
|
+
}, [themeProp]);
|
|
412
|
+
return /* @__PURE__ */ jsx(
|
|
413
|
+
Toaster$1,
|
|
414
|
+
{
|
|
415
|
+
theme: themeProp || theme,
|
|
416
|
+
className: "toaster group",
|
|
417
|
+
toastOptions: {
|
|
418
|
+
classNames: {
|
|
419
|
+
toast: "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
|
|
420
|
+
description: "group-[.toast]:text-muted-foreground",
|
|
421
|
+
actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
|
|
422
|
+
cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
|
|
423
|
+
success: "group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border",
|
|
424
|
+
error: "group-[.toaster]:bg-destructive group-[.toaster]:text-destructive-foreground group-[.toaster]:border-destructive",
|
|
425
|
+
warning: "group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border",
|
|
426
|
+
info: "group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border"
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
style: {
|
|
430
|
+
"--normal-bg": "hsl(var(--popover))",
|
|
431
|
+
"--normal-text": "hsl(var(--popover-foreground))",
|
|
432
|
+
"--normal-border": "hsl(var(--border))"
|
|
433
|
+
},
|
|
434
|
+
...props
|
|
435
|
+
}
|
|
436
|
+
);
|
|
437
|
+
};
|
|
438
|
+
var alertVariants = cva(
|
|
439
|
+
"relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
|
|
440
|
+
{
|
|
441
|
+
variants: {
|
|
442
|
+
variant: {
|
|
443
|
+
default: "bg-background text-foreground",
|
|
444
|
+
destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
defaultVariants: {
|
|
448
|
+
variant: "default"
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
);
|
|
452
|
+
var Alert = React9.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
453
|
+
"div",
|
|
454
|
+
{
|
|
455
|
+
ref,
|
|
456
|
+
role: "alert",
|
|
457
|
+
className: cn(alertVariants({ variant }), className),
|
|
458
|
+
...props
|
|
459
|
+
}
|
|
460
|
+
));
|
|
461
|
+
Alert.displayName = "Alert";
|
|
462
|
+
var AlertTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
463
|
+
"h5",
|
|
464
|
+
{
|
|
465
|
+
ref,
|
|
466
|
+
className: cn("mb-1 font-medium leading-none tracking-tight", className),
|
|
467
|
+
...props
|
|
468
|
+
}
|
|
469
|
+
));
|
|
470
|
+
AlertTitle.displayName = "AlertTitle";
|
|
471
|
+
var AlertDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
472
|
+
"div",
|
|
473
|
+
{
|
|
474
|
+
ref,
|
|
475
|
+
className: cn("text-sm [&_p]:leading-relaxed", className),
|
|
476
|
+
...props
|
|
477
|
+
}
|
|
478
|
+
));
|
|
479
|
+
AlertDescription.displayName = "AlertDescription";
|
|
480
|
+
var badgeVariants = cva(
|
|
481
|
+
"inline-flex cursor-default items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
482
|
+
{
|
|
483
|
+
variants: {
|
|
484
|
+
variant: {
|
|
485
|
+
default: "border-transparent bg-primary text-primary-foreground",
|
|
486
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground",
|
|
487
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground",
|
|
488
|
+
outline: "text-foreground"
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
defaultVariants: {
|
|
492
|
+
variant: "default"
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
);
|
|
496
|
+
var Badge = React9.forwardRef(
|
|
497
|
+
({ className, variant, asChild = false, ...props }, ref) => {
|
|
498
|
+
const Comp = asChild ? Slot : "div";
|
|
499
|
+
return /* @__PURE__ */ jsx(
|
|
500
|
+
Comp,
|
|
501
|
+
{
|
|
502
|
+
ref,
|
|
503
|
+
className: cn(badgeVariants({ variant }), className),
|
|
504
|
+
...props
|
|
505
|
+
}
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
);
|
|
509
|
+
Badge.displayName = "Badge";
|
|
388
510
|
|
|
389
|
-
export { Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Input, Label, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Switch, Textarea, buttonVariants, cn };
|
|
511
|
+
export { Alert, AlertDescription, AlertTitle, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Input, Label, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Switch, Textarea, Toaster, alertVariants, badgeVariants, buttonVariants, cn };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenshinx/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Personal React UI component library based on shadcn/ui patterns",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -41,8 +41,9 @@
|
|
|
41
41
|
"@radix-ui/react-switch": "^1.1.2",
|
|
42
42
|
"class-variance-authority": "^0.7.1",
|
|
43
43
|
"clsx": "^2.1.1",
|
|
44
|
-
"tailwind-merge": "^2.6.0",
|
|
45
44
|
"lucide-react": "^0.469.0",
|
|
45
|
+
"sonner": "^2.0.7",
|
|
46
|
+
"tailwind-merge": "^2.6.0",
|
|
46
47
|
"tailwindcss-animate": "^1.0.7"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|