@moontra/moonui 2.2.0 → 2.2.2

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.
Files changed (44) hide show
  1. package/dist/index.d.mts +91 -14
  2. package/dist/index.d.ts +91 -14
  3. package/dist/index.js +1714 -369
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +1546 -371
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +2 -2
  8. package/src/components/ui/alert.tsx +123 -93
  9. package/src/components/ui/avatar.tsx +2 -0
  10. package/src/components/ui/badge.tsx +19 -17
  11. package/src/components/ui/breadcrumb.tsx +2 -0
  12. package/src/components/ui/button.stories.tsx +4 -2
  13. package/src/components/ui/button.tsx +39 -33
  14. package/src/components/ui/calendar.tsx +1 -1
  15. package/src/components/ui/card-input.tsx +231 -0
  16. package/src/components/ui/card.stories.tsx +2 -0
  17. package/src/components/ui/card.tsx +2 -0
  18. package/src/components/ui/data-table.stories.tsx +4 -2
  19. package/src/components/ui/data-table.tsx +7 -7
  20. package/src/components/ui/date-picker.stories.tsx +2 -0
  21. package/src/components/ui/date-picker.tsx +18 -9
  22. package/src/components/ui/draggable-list.tsx +2 -0
  23. package/src/components/ui/index.ts +357 -44
  24. package/src/components/ui/input.stories.tsx +2 -0
  25. package/src/components/ui/input.tsx +2 -0
  26. package/src/components/ui/locked-component.tsx +222 -0
  27. package/src/components/ui/pagination.tsx +2 -0
  28. package/src/components/ui/phone-input.tsx +172 -0
  29. package/src/components/ui/popover-pro.tsx +424 -0
  30. package/src/components/ui/rich-text-editor/index.tsx +2 -1
  31. package/src/components/ui/scroll-area.tsx +48 -0
  32. package/src/components/ui/select.tsx +5 -1
  33. package/src/components/ui/separator.tsx +2 -2
  34. package/src/components/ui/swipeable-card.tsx +2 -0
  35. package/src/components/ui/table.tsx +2 -0
  36. package/src/components/ui/tabs.tsx +2 -0
  37. package/src/components/ui/tags-input.tsx +130 -0
  38. package/src/components/ui/textarea.tsx +2 -0
  39. package/src/components/ui/toast.tsx +2 -0
  40. package/src/index.tsx +4 -46
  41. package/src/lib/performance-profiler.ts +79 -0
  42. package/src/styles/index.css +315 -2
  43. package/src/use-performance-optimizer.ts +26 -26
  44. package/src/use-scroll-animation.ts +5 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Premium React component library with modern design and customization",
5
5
  "author": "MoonUI",
6
6
  "license": "MIT",
@@ -45,7 +45,7 @@
45
45
  ],
46
46
  "scripts": {
47
47
  "dev": "tsup src/index.tsx --format esm,cjs --dts --watch --sourcemap",
48
- "build": "npm run build:js && npm run build:dts",
48
+ "build": "npm run build:js && npm run build:dts && node scripts/postbuild.js",
49
49
  "build:js": "tsup src/index.tsx --format esm,cjs",
50
50
  "build:dts": "tsup src/index.tsx --format esm,cjs --dts-only",
51
51
  "lint": "eslint \"src/**/*.{ts,tsx}\" --fix",
@@ -14,116 +14,146 @@ import { cn } from "../../lib/utils";
14
14
  */
15
15
 
16
16
  const alertVariants = cva(
17
- "relative w-full flex items-center gap-3 p-4 border text-foreground [&>svg]:shrink-0",
18
- {
19
- variants: {
20
- variant: {
21
- default: "bg-background text-foreground border-border",
22
- primary: "bg-primary/10 text-primary border-primary/30",
23
- success: "bg-success/10 text-success border-success/30",
24
- warning: "bg-warning/10 text-warning border-warning/30",
25
- error: "bg-destructive/10 text-destructive border-destructive/30",
26
- info: "bg-blue-500/10 text-blue-500 border-blue-500/30",
27
- },
28
- size: {
29
- sm: "py-2 text-xs",
30
- default: "py-3 text-sm",
31
- lg: "py-4 text-base",
32
- },
33
- radius: {
34
- none: "rounded-none",
35
- sm: "rounded-sm",
36
- default: "rounded-md",
37
- lg: "rounded-lg",
38
- full: "rounded-full",
39
- },
40
- withClose: {
41
- true: "pr-10",
42
- },
43
- },
44
- defaultVariants: {
45
- variant: "default",
46
- size: "default",
47
- radius: "default",
48
- withClose: false,
49
- },
50
- }
17
+ "relative w-full flex items-center gap-3 p-4 border text-foreground [&>svg]:shrink-0",
18
+ {
19
+ variants: {
20
+ variant: {
21
+ default: "bg-background text-foreground border-border",
22
+ primary: "bg-primary/10 text-primary border-primary/30",
23
+ success: "bg-success/10 text-success border-success/30",
24
+ warning: "bg-warning/10 text-warning border-warning/30",
25
+ error: "bg-destructive/10 text-destructive border-destructive/30",
26
+ info: "bg-blue-500/10 text-blue-500 border-blue-500/30",
27
+ },
28
+ size: {
29
+ sm: "py-2 text-xs",
30
+ default: "py-3 text-sm",
31
+ lg: "py-4 text-base",
32
+ },
33
+ radius: {
34
+ none: "rounded-none",
35
+ sm: "rounded-sm",
36
+ default: "rounded-md",
37
+ lg: "rounded-lg",
38
+ full: "rounded-full",
39
+ },
40
+ withClose: {
41
+ true: "pr-10",
42
+ },
43
+ },
44
+ defaultVariants: {
45
+ variant: "default",
46
+ size: "default",
47
+ radius: "default",
48
+ withClose: false,
49
+ },
50
+ }
51
51
  );
52
52
 
53
53
  export interface AlertProps
54
- extends React.HTMLAttributes<HTMLDivElement>,
55
- VariantProps<typeof alertVariants> {
56
- /** Alert ikonunu gizler */
57
- hideIcon?: boolean;
58
- /** Kapatma butonu ekler */
59
- closable?: boolean;
60
- /** Kapatma butonu tıklandığında çalışacak fonksiyon */
61
- onClose?: () => void;
54
+ extends React.HTMLAttributes<HTMLDivElement>,
55
+ VariantProps<typeof alertVariants> {
56
+ /** Alert ikonunu gizler */
57
+ hideIcon?: boolean;
58
+ /** Kapatma butonu ekler */
59
+ closable?: boolean;
60
+ /** Kapatma butonu tıklandığında çalışacak fonksiyon */
61
+ onClose?: () => void;
62
62
  }
63
63
 
64
64
  const Alert = React.forwardRef<HTMLDivElement, AlertProps>(
65
- ({ className, variant = "default", size, radius, hideIcon = false, closable = false, onClose, children, ...props }, ref) => {
66
- // Alert türüne göre ikon belirleme
67
- const Icon = React.useMemo(() => {
68
- switch (variant) {
69
- case "success":
70
- return Check;
71
- case "warning":
72
- return AlertTriangle;
73
- case "error":
74
- return AlertCircle;
75
- case "info":
76
- return Info;
77
- default:
78
- return Info;
79
- }
80
- }, [variant]);
65
+ (
66
+ {
67
+ className,
68
+ variant = "default",
69
+ size,
70
+ radius,
71
+ hideIcon = false,
72
+ closable = false,
73
+ onClose,
74
+ children,
75
+ ...props
76
+ },
77
+ ref
78
+ ) => {
79
+ // Alert türüne göre ikon belirleme
80
+ const Icon = React.useMemo(() => {
81
+ switch (variant) {
82
+ case "success":
83
+ return Check;
84
+ case "warning":
85
+ return AlertTriangle;
86
+ case "error":
87
+ return AlertCircle;
88
+ case "info":
89
+ return Info;
90
+ default:
91
+ return Info;
92
+ }
93
+ }, [variant]);
81
94
 
82
- return (
83
- <div
84
- ref={ref}
85
- role="alert"
86
- className={cn("moonui-theme", alertVariants({ variant, size, radius, withClose: closable }), className)}
87
- {...props}
88
- >
89
- {!hideIcon && <Icon className="h-5 w-5" />}
90
- <div className="flex-1">{children}</div>
91
- {closable && onClose && (
92
- <button
93
- onClick={onClose}
94
- className="absolute right-3 top-3 inline-flex h-6 w-6 items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100"
95
- aria-label="Kapat"
96
- >
97
- <X className="h-4 w-4" />
98
- </button>
99
- )}
100
- </div>
101
- );
102
- }
95
+ return (
96
+ <div
97
+ ref={ref}
98
+ role="alert"
99
+ className={cn(
100
+ "moonui-theme",
101
+ alertVariants({
102
+ variant,
103
+ size,
104
+ radius,
105
+ withClose: closable,
106
+ }),
107
+ className
108
+ )}
109
+ {...props}
110
+ >
111
+ {!hideIcon && <Icon className="h-5 w-5" />}
112
+ <div className="flex-1">{children}</div>
113
+ {closable && onClose && (
114
+ <button
115
+ onClick={onClose}
116
+ className="absolute right-3 top-3 inline-flex h-6 w-6 items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100"
117
+ aria-label="Kapat"
118
+ >
119
+ <X className="h-4 w-4" />
120
+ </button>
121
+ )}
122
+ </div>
123
+ );
124
+ }
103
125
  );
104
126
  Alert.displayName = "Alert";
105
127
 
106
128
  const AlertTitle = React.forwardRef<
107
- HTMLParagraphElement,
108
- React.HTMLAttributes<HTMLHeadingElement>
129
+ HTMLParagraphElement,
130
+ React.HTMLAttributes<HTMLHeadingElement>
109
131
  >(({ className, ...props }, ref) => (
110
- <h5
111
- ref={ref}
112
- className={cn("moonui-theme", "font-semibold leading-tight tracking-tight mb-1", className)}
113
- {...props}
114
- />
132
+ <h5
133
+ ref={ref}
134
+ className={cn(
135
+ "moonui-theme",
136
+ "font-semibold leading-tight tracking-tight mb-1",
137
+ className
138
+ )}
139
+ {...props}
140
+ />
115
141
  ));
116
142
  AlertTitle.displayName = "AlertTitle";
117
143
 
118
144
  const AlertDescription = React.forwardRef<
119
- HTMLParagraphElement,
120
- React.HTMLAttributes<HTMLParagraphElement>
145
+ HTMLParagraphElement,
146
+ React.HTMLAttributes<HTMLParagraphElement>
121
147
  >(({ className, ...props }, ref) => (
122
- <div
123
- ref={ref}
124
- className={cn("moonui-theme", "text-sm leading-5 text-muted-foreground", className)}
125
- {...props}
126
- />
148
+ <div
149
+ ref={ref}
150
+ className={cn(
151
+ "moonui-theme",
152
+ "text-sm leading-5 text-muted-foreground",
153
+ className
154
+ )}
155
+ {...props}
156
+ />
127
157
  ));
128
158
  AlertDescription.displayName = "AlertDescription";
129
159
 
@@ -1,3 +1,5 @@
1
+ "use client"
2
+
1
3
  import * as React from "react";
2
4
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
3
5
  import { cva, type VariantProps } from "class-variance-authority";
@@ -1,3 +1,5 @@
1
+ "use client"
2
+
1
3
  import * as React from "react";
2
4
  import { cva, type VariantProps } from "class-variance-authority";
3
5
  import { cn } from "../../lib/utils";
@@ -10,7 +12,7 @@ import { cn } from "../../lib/utils";
10
12
  */
11
13
 
12
14
  const badgeVariants = cva(
13
- ["inline-flex items-center gap-1.5",
15
+ ["inline-flex items-center justify-center gap-1.5",
14
16
  "font-medium transition-colors duration-200",
15
17
  "border focus:outline-none",
16
18
  "focus-visible:ring-2 focus-visible:ring-offset-1"],
@@ -18,23 +20,23 @@ const badgeVariants = cva(
18
20
  variants: {
19
21
  variant: {
20
22
  primary: [
21
- "border-transparent bg-primary text-primary-foreground",
22
- "hover:bg-primary-hover dark:hover:bg-primary/90",
23
- "focus-visible:ring-primary/30 dark:focus-visible:ring-primary/40",
24
- "dark:bg-primary/90 dark:text-white dark:shadow-inner dark:shadow-primary/10",
23
+ "border-transparent bg-gray-900 text-white",
24
+ "hover:bg-gray-800 dark:hover:bg-gray-700",
25
+ "focus-visible:ring-gray-500/30 dark:focus-visible:ring-gray-400/40",
26
+ "dark:bg-gray-700 dark:text-gray-50 dark:shadow-inner dark:shadow-gray-950/10",
25
27
  ],
26
28
  secondary: [
27
29
  "border-transparent bg-secondary text-secondary-foreground",
28
- "hover:bg-gray-200 dark:hover:bg-gray-700/90",
30
+ "hover:bg-gray-200 dark:hover:bg-gray-600",
29
31
  "focus-visible:ring-gray-400/30 dark:focus-visible:ring-gray-500/40",
30
- "dark:bg-gray-800 dark:text-gray-100 dark:shadow-inner dark:shadow-gray-950/10",
32
+ "dark:bg-gray-700/50 dark:text-gray-50 dark:shadow-inner dark:shadow-gray-950/10",
31
33
  ],
32
34
  outline: [
33
- "border-gray-200 dark:border-gray-700",
35
+ "border-gray-200 dark:border-gray-600",
34
36
  "bg-transparent text-foreground",
35
- "hover:border-gray-300 dark:hover:border-gray-600",
37
+ "hover:border-gray-300 dark:hover:border-gray-500",
36
38
  "focus-visible:ring-gray-400/30 dark:focus-visible:ring-gray-500/40",
37
- "dark:text-gray-200 dark:bg-transparent dark:backdrop-blur-sm",
39
+ "dark:text-gray-100 dark:bg-transparent dark:backdrop-blur-sm",
38
40
  ],
39
41
  destructive: [
40
42
  "border-transparent bg-error text-white",
@@ -55,11 +57,11 @@ const badgeVariants = cva(
55
57
  "dark:bg-warning/90 dark:text-gray-900 dark:shadow-inner dark:shadow-warning/10",
56
58
  ],
57
59
  ghost: [
58
- "border-transparent bg-transparent text-foreground",
59
- "hover:bg-gray-100 dark:hover:bg-gray-800/80",
60
+ "border border-gray-200 bg-gray-50/50 text-gray-700",
61
+ "hover:bg-gray-100 dark:hover:bg-gray-800/60",
60
62
  "focus-visible:ring-gray-400/30 dark:focus-visible:ring-gray-500/40",
61
- "dark:text-gray-200 dark:backdrop-blur-sm",
62
- "transition-colors duration-200",
63
+ "dark:border-gray-700 dark:bg-gray-800/30 dark:text-gray-300",
64
+ "transition-all duration-200",
63
65
  ],
64
66
  pro: [
65
67
  "border-transparent bg-gradient-to-r from-purple-600 to-pink-600 text-white",
@@ -185,13 +187,13 @@ function Badge({
185
187
  />
186
188
  )}
187
189
  {autoLeftIcon && (
188
- <span className="inline-flex shrink-0">
190
+ <span className="inline-flex shrink-0 items-center">
189
191
  {autoLeftIcon}
190
192
  </span>
191
193
  )}
192
- <span className="truncate">{autoChildren}</span>
194
+ <span className="inline-flex items-center">{autoChildren}</span>
193
195
  {rightIcon && (
194
- <span className="inline-flex shrink-0">
196
+ <span className="inline-flex shrink-0 items-center">
195
197
  {rightIcon}
196
198
  </span>
197
199
  )}
@@ -1,3 +1,5 @@
1
+ "use client"
2
+
1
3
  import * as React from "react";
2
4
  import { ChevronRight, MoreHorizontal } from "lucide-react";
3
5
  import { cva, type VariantProps } from "class-variance-authority";
@@ -1,3 +1,5 @@
1
+ "use client"
2
+
1
3
  import type { Meta, StoryObj } from '@storybook/react';
2
4
  import { Button } from './button';
3
5
  import { Mail, Plus, Loader2 } from 'lucide-react';
@@ -135,7 +137,7 @@ export const AllVariants: Story = {
135
137
  render: () => (
136
138
  <div className="flex flex-col gap-4">
137
139
  <div className="flex flex-wrap gap-2">
138
- <Button variant="default">Default</Button>
140
+ <Button variant="primary">Default</Button>
139
141
  <Button variant="secondary">Secondary</Button>
140
142
  <Button variant="destructive">Destructive</Button>
141
143
  <Button variant="outline">Outline</Button>
@@ -144,7 +146,7 @@ export const AllVariants: Story = {
144
146
  </div>
145
147
  <div className="flex flex-wrap gap-2">
146
148
  <Button size="sm">Small</Button>
147
- <Button size="default">Default</Button>
149
+ <Button size="md">Default</Button>
148
150
  <Button size="lg">Large</Button>
149
151
  <Button size="icon">
150
152
  <Plus className="h-4 w-4" />
@@ -1,3 +1,5 @@
1
+ "use client"
2
+
1
3
  import * as React from "react";
2
4
  import { cva, type VariantProps } from "class-variance-authority";
3
5
  import { cn } from "../../lib/utils";
@@ -29,11 +31,11 @@ const buttonVariants = cva(
29
31
  "transition-all duration-200",
30
32
  ],
31
33
  secondary: [
32
- "bg-muted text-muted-foreground",
33
- "dark:bg-muted dark:text-muted-foreground",
34
- "hover:bg-muted/80 dark:hover:bg-muted/80",
35
- "active:bg-muted/70 dark:active:bg-muted/70",
36
- "border border-input dark:border-input",
34
+ "bg-gray-100 text-gray-900",
35
+ "dark:bg-gray-800 dark:text-gray-100",
36
+ "hover:bg-gray-200 dark:hover:bg-gray-700",
37
+ "active:bg-gray-300 dark:active:bg-gray-600",
38
+ "border border-gray-200 dark:border-gray-700",
37
39
  "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
38
40
  "shadow-sm hover:shadow-md",
39
41
  ],
@@ -47,10 +49,10 @@ const buttonVariants = cva(
47
49
  "transition-all duration-200",
48
50
  ],
49
51
  ghost: [
50
- "text-foreground",
51
- "dark:text-foreground",
52
- "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent dark:hover:text-accent-foreground",
53
- "active:bg-accent/80 dark:active:bg-accent/80",
52
+ "text-gray-700",
53
+ "dark:text-gray-300",
54
+ "hover:bg-gray-100 hover:text-gray-900 dark:hover:bg-gray-800 dark:hover:text-gray-100",
55
+ "active:bg-gray-200 dark:active:bg-gray-700",
54
56
  "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
55
57
  "transition-all duration-200",
56
58
  ],
@@ -80,19 +82,21 @@ const buttonVariants = cva(
80
82
  "transition-colors duration-200",
81
83
  ],
82
84
  gradient: [
83
- "bg-gradient-to-r from-blue-600 to-purple-600 text-white",
84
- "hover:from-blue-700 hover:to-purple-700",
85
- "active:from-blue-800 active:to-purple-800",
86
- "shadow-lg shadow-purple-500/25",
85
+ "bg-gradient-to-r from-purple-500 to-pink-500 text-white",
86
+ "hover:from-purple-600 hover:to-pink-600",
87
+ "active:from-purple-700 active:to-pink-700",
88
+ "shadow-xl shadow-purple-500/40",
89
+ "hover:shadow-2xl hover:shadow-purple-500/50",
87
90
  "focus-visible:ring-purple-500/50",
88
91
  "transition-all duration-300",
89
92
  ],
90
93
  glow: [
91
- "bg-primary text-primary-foreground",
92
- "shadow-lg shadow-primary/50",
93
- "hover:shadow-xl hover:shadow-primary/60",
94
- "active:shadow-md active:shadow-primary/40",
95
- "focus-visible:ring-primary/50",
94
+ "bg-blue-500 text-white",
95
+ "shadow-[0_0_30px_rgba(59,130,246,0.5)]",
96
+ "hover:shadow-[0_0_40px_rgba(59,130,246,0.7)]",
97
+ "active:shadow-[0_0_20px_rgba(59,130,246,0.4)]",
98
+ "hover:bg-blue-600",
99
+ "focus-visible:ring-blue-500/50",
96
100
  "transition-all duration-300",
97
101
  ],
98
102
  soft: [
@@ -116,29 +120,31 @@ const buttonVariants = cva(
116
120
  "transition-all duration-200",
117
121
  ],
118
122
  neon: [
119
- "bg-transparent text-primary",
120
- "border-2 border-primary",
121
- "hover:bg-primary hover:text-primary-foreground",
122
- "hover:shadow-[0_0_20px_rgba(var(--primary),0.5)]",
123
- "active:shadow-[0_0_10px_rgba(var(--primary),0.3)]",
124
- "focus-visible:ring-primary/50",
123
+ "bg-transparent text-green-400",
124
+ "border-2 border-green-400",
125
+ "hover:bg-green-400 hover:text-gray-900",
126
+ "hover:shadow-[0_0_30px_rgba(74,222,128,0.6)]",
127
+ "active:shadow-[0_0_15px_rgba(74,222,128,0.4)]",
128
+ "focus-visible:ring-green-400/50",
125
129
  "transition-all duration-300",
126
130
  ],
127
131
  },
128
132
  size: {
129
- xs: "h-7 px-2.5 text-xs rounded-md",
130
- sm: "h-8 px-3 text-sm rounded-md",
131
- md: "h-10 px-4 text-base rounded-lg",
132
- lg: "h-12 px-6 text-lg rounded-lg",
133
- xl: "h-14 px-8 text-xl rounded-xl",
134
- icon: "h-10 w-10 p-2 rounded-lg",
135
- "icon-sm": "h-8 w-8 p-1.5 rounded-md",
136
- "icon-lg": "h-12 w-12 p-3 rounded-xl",
133
+ xs: "h-7 px-2.5 text-xs",
134
+ sm: "h-8 px-3 text-sm",
135
+ md: "h-10 px-4 text-base",
136
+ lg: "h-12 px-6 text-lg",
137
+ xl: "h-14 px-8 text-xl",
138
+ icon: "h-10 w-10 p-2",
139
+ "icon-sm": "h-8 w-8 p-1.5",
140
+ "icon-lg": "h-12 w-12 p-3",
137
141
  },
138
142
  rounded: {
139
- default: "",
143
+ default: "rounded-xl",
140
144
  full: "rounded-full",
141
145
  none: "rounded-none",
146
+ sm: "rounded-lg",
147
+ lg: "rounded-2xl",
142
148
  },
143
149
  fullWidth: {
144
150
  true: "w-full",
@@ -166,7 +166,7 @@ function Calendar({
166
166
  return (
167
167
  <div className={cn("moonui-theme", "p-0", className)}>
168
168
  {/* Header */}
169
- <div className="flex items-center justify-between px-6 py-4">
169
+ <div className="flex items-center justify-between px-6 py-4 border-b border-border/50 dark:border-gray-700/50">
170
170
  <button
171
171
  onClick={handlePreviousMonth}
172
172
  className={cn(