@umituz/web-design-system 1.7.3 → 1.8.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/web-design-system",
3
- "version": "1.7.3",
3
+ "version": "1.8.1",
4
4
  "private": false,
5
5
  "description": "Web Design System - Atomic Design components (Atoms, Molecules, Organisms, Templates) for React applications",
6
6
  "main": "./src/index.ts",
@@ -53,6 +53,7 @@
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@radix-ui/react-accordion": ">=1.0.0",
56
+ "@radix-ui/react-alert-dialog": ">=1.0.0",
56
57
  "@radix-ui/react-collapsible": ">=1.0.0",
57
58
  "@radix-ui/react-dialog": ">=1.0.0",
58
59
  "@radix-ui/react-hover-card": ">=1.0.0",
@@ -63,11 +64,13 @@
63
64
  "clsx": ">=2.0.0",
64
65
  "lucide-react": ">=0.400.0",
65
66
  "react": ">=18.0.0",
67
+ "react-day-picker": ">=9.0.0",
66
68
  "react-dom": ">=18.0.0",
67
69
  "tailwind-merge": ">=2.0.0"
68
70
  },
69
71
  "devDependencies": {
70
72
  "@radix-ui/react-accordion": "^1.2.12",
73
+ "@radix-ui/react-alert-dialog": "^1.1.8",
71
74
  "@radix-ui/react-collapsible": "^1.1.12",
72
75
  "@radix-ui/react-dialog": "^1.1.15",
73
76
  "@radix-ui/react-hover-card": "^1.1.8",
@@ -80,6 +83,7 @@
80
83
  "clsx": "^2.1.1",
81
84
  "lucide-react": "^0.577.0",
82
85
  "react": "^18.0.0",
86
+ "react-day-picker": "^9.14.0",
83
87
  "react-dom": "^18.0.0",
84
88
  "tailwind-merge": "^3.5.0",
85
89
  "typescript": "~5.9.2"
@@ -0,0 +1,33 @@
1
+ /**
2
+ * AspectRatio Component
3
+ * @description Aspect ratio container component
4
+ * @example
5
+ * import { AspectRatio } from '@umituz/web-design-system/atoms';
6
+ *
7
+ * <AspectRatio ratio={16 / 9}>
8
+ * <img src="..." alt="..." className="object-cover w-full h-full" />
9
+ * </AspectRatio>
10
+ */
11
+
12
+ import * as React from "react";
13
+
14
+ import { cn } from "../../infrastructure/utils/cn";
15
+
16
+ interface AspectRatioProps extends React.HTMLAttributes<HTMLDivElement> {
17
+ ratio?: number;
18
+ }
19
+
20
+ const AspectRatio = React.forwardRef<HTMLDivElement, AspectRatioProps>(
21
+ ({ className, ratio = 16 / 9, ...props }, ref) => (
22
+ <div
23
+ ref={ref}
24
+ style={{ paddingBottom: `${100 / ratio}%` }}
25
+ className={cn("relative w-full", className)}
26
+ {...props}
27
+ />
28
+ )
29
+ );
30
+ AspectRatio.displayName = "AspectRatio";
31
+
32
+ export { AspectRatio };
33
+ export type { AspectRatioProps };
@@ -47,3 +47,6 @@ export { Progress } from './Progress';
47
47
  export type { ProgressProps } from './Progress';
48
48
 
49
49
  export { Label } from './Label';
50
+
51
+ export { AspectRatio } from './AspectRatio';
52
+ export type { AspectRatioProps } from './AspectRatio';
@@ -0,0 +1,162 @@
1
+ /**
2
+ * AlertDialog Component
3
+ * @description Alert dialog component for critical confirmations using @radix-ui/react-alert-dialog
4
+ * @example
5
+ * import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction } from '@umituz/web-design-system/organisms';
6
+ *
7
+ * <AlertDialog>
8
+ * <AlertDialogTrigger asChild>
9
+ * <Button>Open Alert Dialog</Button>
10
+ * </AlertDialogTrigger>
11
+ * <AlertDialogContent>
12
+ * <AlertDialogHeader>
13
+ * <AlertDialogTitle>Are you sure?</AlertDialogTitle>
14
+ * <AlertDialogDescription>This action cannot be undone.</AlertDialogDescription>
15
+ * </AlertDialogHeader>
16
+ * <AlertDialogFooter>
17
+ * <AlertDialogCancel>Cancel</AlertDialogCancel>
18
+ * <AlertDialogAction>Continue</AlertDialogAction>
19
+ * </AlertDialogFooter>
20
+ * </AlertDialogContent>
21
+ * </AlertDialog>
22
+ */
23
+
24
+ import * as React from "react";
25
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
26
+
27
+ import { cn } from "../../infrastructure/utils/cn";
28
+ import { buttonVariants } from "../../atoms/Button";
29
+
30
+ const AlertDialog = AlertDialogPrimitive.Root;
31
+
32
+ const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
33
+
34
+ const AlertDialogPortal = AlertDialogPrimitive.Portal;
35
+
36
+ const AlertDialogOverlay = React.forwardRef<
37
+ React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
38
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
39
+ >(({ className, ...props }, ref) => (
40
+ <AlertDialogPrimitive.Overlay
41
+ className={cn(
42
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
43
+ className
44
+ )}
45
+ {...props}
46
+ ref={ref}
47
+ />
48
+ ));
49
+ AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
50
+
51
+ const AlertDialogContent = React.forwardRef<
52
+ React.ElementRef<typeof AlertDialogPrimitive.Content>,
53
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
54
+ >(({ className, ...props }, ref) => (
55
+ <AlertDialogPortal>
56
+ <AlertDialogOverlay />
57
+ <AlertDialogPrimitive.Content
58
+ ref={ref}
59
+ className={cn(
60
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
61
+ className
62
+ )}
63
+ {...props}
64
+ />
65
+ </AlertDialogPortal>
66
+ ));
67
+ AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
68
+
69
+ const AlertDialogHeader = ({
70
+ className,
71
+ ...props
72
+ }: React.HTMLAttributes<HTMLDivElement>) => (
73
+ <div
74
+ className={cn(
75
+ "flex flex-col space-y-2 text-center sm:text-left",
76
+ className
77
+ )}
78
+ {...props}
79
+ />
80
+ );
81
+ AlertDialogHeader.displayName = "AlertDialogHeader";
82
+
83
+ const AlertDialogFooter = ({
84
+ className,
85
+ ...props
86
+ }: React.HTMLAttributes<HTMLDivElement>) => (
87
+ <div
88
+ className={cn(
89
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
90
+ className
91
+ )}
92
+ {...props}
93
+ />
94
+ );
95
+ AlertDialogFooter.displayName = "AlertDialogFooter";
96
+
97
+ const AlertDialogTitle = React.forwardRef<
98
+ React.ElementRef<typeof AlertDialogPrimitive.Title>,
99
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
100
+ >(({ className, ...props }, ref) => (
101
+ <AlertDialogPrimitive.Title
102
+ ref={ref}
103
+ className={cn("text-lg font-semibold", className)}
104
+ {...props}
105
+ />
106
+ ));
107
+ AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
108
+
109
+ const AlertDialogDescription = React.forwardRef<
110
+ React.ElementRef<typeof AlertDialogPrimitive.Description>,
111
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
112
+ >(({ className, ...props }, ref) => (
113
+ <AlertDialogPrimitive.Description
114
+ ref={ref}
115
+ className={cn("text-sm text-muted-foreground", className)}
116
+ {...props}
117
+ />
118
+ ));
119
+ AlertDialogDescription.displayName =
120
+ AlertDialogPrimitive.Description.displayName;
121
+
122
+ const AlertDialogAction = React.forwardRef<
123
+ React.ElementRef<typeof AlertDialogPrimitive.Action>,
124
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
125
+ >(({ className, ...props }, ref) => (
126
+ <AlertDialogPrimitive.Action
127
+ ref={ref}
128
+ className={cn(buttonVariants(), className)}
129
+ {...props}
130
+ />
131
+ ));
132
+ AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
133
+
134
+ const AlertDialogCancel = React.forwardRef<
135
+ React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
136
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
137
+ >(({ className, ...props }, ref) => (
138
+ <AlertDialogPrimitive.Cancel
139
+ ref={ref}
140
+ className={cn(
141
+ buttonVariants({ variant: "outline" }),
142
+ "mt-2 sm:mt-0",
143
+ className
144
+ )}
145
+ {...props}
146
+ />
147
+ ));
148
+ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
149
+
150
+ export {
151
+ AlertDialog,
152
+ AlertDialogPortal,
153
+ AlertDialogOverlay,
154
+ AlertDialogTrigger,
155
+ AlertDialogContent,
156
+ AlertDialogHeader,
157
+ AlertDialogFooter,
158
+ AlertDialogTitle,
159
+ AlertDialogDescription,
160
+ AlertDialogAction,
161
+ AlertDialogCancel,
162
+ };
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Calendar Component
3
+ * @description Date picker component using react-day-picker
4
+ * @example
5
+ * import { Calendar } from '@umituz/web-design-system/organisms';
6
+ *
7
+ * <Calendar
8
+ * mode="single"
9
+ * selected={date}
10
+ * onSelect={setDate}
11
+ * className="rounded-md border"
12
+ * />
13
+ */
14
+
15
+ import * as React from "react";
16
+ import { ChevronLeft, ChevronRight } from "lucide-react";
17
+ import { DayPicker } from "react-day-picker";
18
+
19
+ import { cn } from "../../infrastructure/utils/cn";
20
+
21
+ export type CalendarProps = React.ComponentProps<typeof DayPicker>;
22
+
23
+ function Calendar({
24
+ className,
25
+ classNames,
26
+ showOutsideDays = true,
27
+ ...props
28
+ }: CalendarProps) {
29
+ return (
30
+ <DayPicker
31
+ showOutsideDays={showOutsideDays}
32
+ className={cn("p-3", className)}
33
+ classNames={{
34
+ months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
35
+ month: "space-y-4",
36
+ caption: "flex justify-center pt-1 relative items-center",
37
+ caption_label: "text-sm font-medium",
38
+ nav: "space-x-1 flex items-center",
39
+ nav_button: cn(
40
+ "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
41
+ ),
42
+ nav_button_previous: "absolute left-1",
43
+ nav_button_next: "absolute right-1",
44
+ table: "w-full border-collapse space-y-1",
45
+ head_row: "flex",
46
+ head_cell:
47
+ "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
48
+ row: "flex w-full mt-2",
49
+ cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
50
+ day: cn(
51
+ "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-9 w-9 p-0 font-normal aria-selected:opacity-100"
52
+ ),
53
+ day_range_end: "day-range-end",
54
+ day_selected:
55
+ "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
56
+ day_today: "bg-accent text-accent-foreground",
57
+ day_outside:
58
+ "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
59
+ day_disabled: "text-muted-foreground opacity-50",
60
+ day_range_middle:
61
+ "aria-selected:bg-accent aria-selected:text-accent-foreground",
62
+ day_hidden: "invisible",
63
+ ...classNames,
64
+ }}
65
+ components={{
66
+ IconLeft: ({ ..._props }) => <ChevronLeft className="h-4 w-4" />,
67
+ IconRight: ({ ..._props }) => <ChevronRight className="h-4 w-4" />,
68
+ }}
69
+ {...props}
70
+ />
71
+ );
72
+ }
73
+ Calendar.displayName = "Calendar";
74
+
75
+ export { Calendar };
@@ -5,7 +5,7 @@
5
5
 
6
6
  import * as React from 'react';
7
7
  import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
8
- import { cn } from '../../infrastructure/utils';
8
+ import { cn } from '../../infrastructure/utils/cn';
9
9
 
10
10
  const HoverCard = HoverCardPrimitive.Root;
11
11
 
@@ -49,6 +49,8 @@ export {
49
49
  export { Breadcrumbs } from './Breadcrumb';
50
50
  export type { BreadcrumbsProps, BreadcrumbItem } from './Breadcrumb';
51
51
 
52
+ export { HoverCard, HoverCardTrigger, HoverCardContent } from './HoverCard';
53
+
52
54
  export { Popover, PopoverTrigger, PopoverContent } from './Popover';
53
55
 
54
56
  export { Collapsible, CollapsibleTrigger, CollapsibleContent } from './Collapsible';
@@ -92,3 +94,20 @@ export type { FormModalProps } from './FormModal';
92
94
 
93
95
  export { ConfirmDialog } from './ConfirmDialog';
94
96
  export type { ConfirmDialogProps } from './ConfirmDialog';
97
+
98
+ export { Calendar } from './Calendar';
99
+ export type { CalendarProps } from './Calendar';
100
+
101
+ export {
102
+ AlertDialog,
103
+ AlertDialogPortal,
104
+ AlertDialogOverlay,
105
+ AlertDialogTrigger,
106
+ AlertDialogContent,
107
+ AlertDialogHeader,
108
+ AlertDialogFooter,
109
+ AlertDialogTitle,
110
+ AlertDialogDescription,
111
+ AlertDialogAction,
112
+ AlertDialogCancel,
113
+ } from './AlertDialog';