@moontra/moonui-pro 2.20.1 → 2.20.3
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 +691 -261
- package/dist/index.mjs +7418 -4934
- package/package.json +11 -5
- package/plugin/index.d.ts +86 -0
- package/plugin/index.js +308 -0
- package/scripts/postbuild.js +27 -0
- package/scripts/postinstall.js +176 -23
- package/src/__tests__/use-intersection-observer.test.tsx +0 -216
- package/src/__tests__/use-local-storage.test.tsx +0 -174
- package/src/__tests__/use-pro-access.test.tsx +0 -183
- package/src/components/advanced-chart/advanced-chart.test.tsx +0 -281
- package/src/components/advanced-chart/index.tsx +0 -1242
- package/src/components/advanced-forms/index.tsx +0 -426
- package/src/components/animated-button/index.tsx +0 -385
- package/src/components/calendar/event-dialog.tsx +0 -372
- package/src/components/calendar/index.tsx +0 -1073
- package/src/components/calendar-pro/index.tsx +0 -1697
- package/src/components/color-picker/index.tsx +0 -432
- package/src/components/credit-card-input/index.tsx +0 -406
- package/src/components/dashboard/dashboard-grid.tsx +0 -462
- package/src/components/dashboard/demo.tsx +0 -425
- package/src/components/dashboard/index.tsx +0 -1046
- package/src/components/dashboard/time-range-picker.tsx +0 -336
- package/src/components/dashboard/types.ts +0 -222
- package/src/components/dashboard/widgets/activity-feed.tsx +0 -344
- package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
- package/src/components/dashboard/widgets/metric-card.tsx +0 -343
- package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
- package/src/components/data-table/data-table-column-toggle.tsx +0 -169
- package/src/components/data-table/data-table-export.ts +0 -156
- package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
- package/src/components/data-table/data-table.test.tsx +0 -187
- package/src/components/data-table/index.tsx +0 -845
- package/src/components/draggable-list/index.tsx +0 -100
- package/src/components/enhanced/badge.tsx +0 -191
- package/src/components/enhanced/button.tsx +0 -362
- package/src/components/enhanced/card.tsx +0 -266
- package/src/components/enhanced/dialog.tsx +0 -246
- package/src/components/enhanced/index.ts +0 -4
- package/src/components/error-boundary/index.tsx +0 -109
- package/src/components/file-upload/file-upload.test.tsx +0 -243
- package/src/components/file-upload/index.tsx +0 -1660
- package/src/components/floating-action-button/index.tsx +0 -206
- package/src/components/form-wizard/form-wizard-context.tsx +0 -307
- package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
- package/src/components/form-wizard/form-wizard-progress.tsx +0 -298
- package/src/components/form-wizard/form-wizard-step.tsx +0 -111
- package/src/components/form-wizard/index.tsx +0 -102
- package/src/components/form-wizard/types.ts +0 -76
- package/src/components/gesture-drawer/index.tsx +0 -551
- package/src/components/github-stars/github-api.ts +0 -426
- package/src/components/github-stars/hooks.ts +0 -516
- package/src/components/github-stars/index.tsx +0 -375
- package/src/components/github-stars/types.ts +0 -148
- package/src/components/github-stars/variants.tsx +0 -513
- package/src/components/health-check/index.tsx +0 -439
- package/src/components/hover-card-3d/index.tsx +0 -530
- package/src/components/index.ts +0 -128
- package/src/components/internal/index.ts +0 -78
- package/src/components/kanban/add-card-modal.tsx +0 -502
- package/src/components/kanban/card-detail-modal.tsx +0 -761
- package/src/components/kanban/index.ts +0 -13
- package/src/components/kanban/kanban.tsx +0 -1684
- package/src/components/kanban/types.ts +0 -168
- package/src/components/lazy-component/index.tsx +0 -823
- package/src/components/license-error/index.tsx +0 -29
- package/src/components/magnetic-button/index.tsx +0 -167
- package/src/components/memory-efficient-data/index.tsx +0 -1016
- package/src/components/moonui-quiz-form/index.tsx +0 -817
- package/src/components/optimized-image/index.tsx +0 -425
- package/src/components/performance-debugger/index.tsx +0 -589
- package/src/components/performance-monitor/index.tsx +0 -794
- package/src/components/phone-number-input/index.tsx +0 -338
- package/src/components/pinch-zoom/index.tsx +0 -566
- package/src/components/quiz-form/index.tsx +0 -479
- package/src/components/rich-text-editor/index-old-backup.tsx +0 -437
- package/src/components/rich-text-editor/index.tsx +0 -2324
- package/src/components/rich-text-editor/slash-commands-extension.ts +0 -220
- package/src/components/rich-text-editor/slash-commands.css +0 -35
- package/src/components/rich-text-editor/table-styles.css +0 -65
- package/src/components/sidebar/index.tsx +0 -865
- package/src/components/spotlight-card/index.tsx +0 -191
- package/src/components/swipeable-card/index.tsx +0 -100
- package/src/components/timeline/index.tsx +0 -1148
- package/src/components/ui/accordion.tsx +0 -73
- package/src/components/ui/alert-dialog.tsx +0 -141
- package/src/components/ui/alert.tsx +0 -141
- package/src/components/ui/aspect-ratio.tsx +0 -245
- package/src/components/ui/avatar.tsx +0 -153
- package/src/components/ui/badge.tsx +0 -228
- package/src/components/ui/breadcrumb.tsx +0 -214
- package/src/components/ui/button.tsx +0 -222
- package/src/components/ui/calendar.tsx +0 -387
- package/src/components/ui/card.tsx +0 -214
- package/src/components/ui/checkbox.tsx +0 -259
- package/src/components/ui/collapsible.tsx +0 -135
- package/src/components/ui/color-picker.tsx +0 -97
- package/src/components/ui/command.tsx +0 -225
- package/src/components/ui/dialog.tsx +0 -334
- package/src/components/ui/dropdown-menu.tsx +0 -218
- package/src/components/ui/gesture-drawer.tsx +0 -11
- package/src/components/ui/hover-card.tsx +0 -29
- package/src/components/ui/index.ts +0 -190
- package/src/components/ui/input.tsx +0 -222
- package/src/components/ui/label.tsx +0 -29
- package/src/components/ui/lightbox.tsx +0 -606
- package/src/components/ui/magnetic-button.tsx +0 -129
- package/src/components/ui/media-gallery.tsx +0 -612
- package/src/components/ui/pagination.tsx +0 -123
- package/src/components/ui/popover.tsx +0 -185
- package/src/components/ui/progress.tsx +0 -30
- package/src/components/ui/radio-group.tsx +0 -257
- package/src/components/ui/scroll-area.tsx +0 -47
- package/src/components/ui/select.tsx +0 -374
- package/src/components/ui/separator.tsx +0 -145
- package/src/components/ui/sheet.tsx +0 -139
- package/src/components/ui/skeleton.tsx +0 -20
- package/src/components/ui/slider.tsx +0 -354
- package/src/components/ui/spotlight-card.tsx +0 -119
- package/src/components/ui/switch.tsx +0 -86
- package/src/components/ui/table.tsx +0 -329
- package/src/components/ui/tabs.tsx +0 -198
- package/src/components/ui/textarea.tsx +0 -28
- package/src/components/ui/toast.tsx +0 -317
- package/src/components/ui/toggle.tsx +0 -119
- package/src/components/ui/tooltip.tsx +0 -151
- package/src/components/virtual-list/index.tsx +0 -668
- package/src/hooks/use-chart.ts +0 -205
- package/src/hooks/use-data-table.ts +0 -182
- package/src/hooks/use-docs-pro-access.ts +0 -13
- package/src/hooks/use-license-check.ts +0 -65
- package/src/hooks/use-subscription.ts +0 -19
- package/src/hooks/use-toast.ts +0 -15
- package/src/index.ts +0 -14
- package/src/lib/ai-providers.ts +0 -377
- package/src/lib/component-metadata.ts +0 -18
- package/src/lib/micro-interactions.ts +0 -255
- package/src/lib/paddle.ts +0 -17
- package/src/lib/utils.ts +0 -6
- package/src/patterns/login-form/index.tsx +0 -276
- package/src/patterns/login-form/types.ts +0 -67
- package/src/setupTests.ts +0 -41
- package/src/styles/advanced-chart.css +0 -239
- package/src/styles/calendar.css +0 -35
- package/src/styles/design-system.css +0 -363
- package/src/styles/index.css +0 -85
- package/src/styles/tailwind.css +0 -7
- package/src/styles/tokens.css +0 -455
- package/src/types/moonui.d.ts +0 -22
- package/src/types/next-auth.d.ts +0 -21
- package/src/use-intersection-observer.tsx +0 -154
- package/src/use-local-storage.tsx +0 -71
- package/src/use-paddle.ts +0 -138
- package/src/use-performance-optimizer.ts +0 -389
- package/src/use-pro-access.ts +0 -141
- package/src/use-scroll-animation.ts +0 -219
- package/src/use-subscription.ts +0 -37
- package/src/use-toast.ts +0 -32
- package/src/utils/chart-helpers.ts +0 -357
- package/src/utils/cn.ts +0 -6
- package/src/utils/data-processing.ts +0 -151
- package/src/utils/license-validator.tsx +0 -183
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
5
|
-
|
|
6
|
-
import { cn } from "../../lib/utils"
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Slider Component
|
|
10
|
-
*
|
|
11
|
-
* Accessible, customizable slider component fully integrated with the theme system.
|
|
12
|
-
* Used for value ranges like volume, brightness, price ranges.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const moonUISliderVariantsPro = cva(
|
|
16
|
-
"relative flex w-full touch-none select-none items-center",
|
|
17
|
-
{
|
|
18
|
-
variants: {
|
|
19
|
-
size: {
|
|
20
|
-
sm: "h-5",
|
|
21
|
-
default: "h-6",
|
|
22
|
-
md: "h-8",
|
|
23
|
-
lg: "h-10",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
defaultVariants: {
|
|
27
|
-
size: "default",
|
|
28
|
-
},
|
|
29
|
-
}
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
const sliderTrackVariants = cva(
|
|
33
|
-
"relative h-1.5 w-full grow overflow-hidden rounded-full",
|
|
34
|
-
{
|
|
35
|
-
variants: {
|
|
36
|
-
variant: {
|
|
37
|
-
default: "bg-muted",
|
|
38
|
-
primary: "bg-primary/20",
|
|
39
|
-
secondary: "bg-secondary/20",
|
|
40
|
-
accent: "bg-accent/20",
|
|
41
|
-
success: "bg-success/20",
|
|
42
|
-
warning: "bg-warning/20",
|
|
43
|
-
error: "bg-error/20",
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
defaultVariants: {
|
|
47
|
-
variant: "default",
|
|
48
|
-
},
|
|
49
|
-
}
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
const sliderRangeVariants = cva(
|
|
53
|
-
"absolute h-full",
|
|
54
|
-
{
|
|
55
|
-
variants: {
|
|
56
|
-
variant: {
|
|
57
|
-
default: "bg-foreground",
|
|
58
|
-
primary: "bg-primary",
|
|
59
|
-
secondary: "bg-secondary",
|
|
60
|
-
accent: "bg-accent",
|
|
61
|
-
success: "bg-success",
|
|
62
|
-
warning: "bg-warning",
|
|
63
|
-
error: "bg-error",
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
defaultVariants: {
|
|
67
|
-
variant: "primary",
|
|
68
|
-
},
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
const sliderThumbVariants = cva(
|
|
73
|
-
"block rounded-full border-2 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",
|
|
74
|
-
{
|
|
75
|
-
variants: {
|
|
76
|
-
variant: {
|
|
77
|
-
default: "border-foreground bg-background",
|
|
78
|
-
primary: "border-primary bg-background",
|
|
79
|
-
secondary: "border-secondary bg-background",
|
|
80
|
-
accent: "border-accent bg-background",
|
|
81
|
-
success: "border-success bg-background",
|
|
82
|
-
warning: "border-warning bg-background",
|
|
83
|
-
error: "border-error bg-background",
|
|
84
|
-
},
|
|
85
|
-
size: {
|
|
86
|
-
sm: "h-3 w-3",
|
|
87
|
-
default: "h-4 w-4",
|
|
88
|
-
md: "h-5 w-5",
|
|
89
|
-
lg: "h-6 w-6",
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
defaultVariants: {
|
|
93
|
-
variant: "primary",
|
|
94
|
-
size: "default",
|
|
95
|
-
},
|
|
96
|
-
}
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
// Custom type definition for component properties
|
|
100
|
-
type SliderBaseProps = {
|
|
101
|
-
/**
|
|
102
|
-
* Track variant
|
|
103
|
-
*/
|
|
104
|
-
trackVariant?: VariantProps<typeof sliderTrackVariants>["variant"];
|
|
105
|
-
/**
|
|
106
|
-
* Range variant
|
|
107
|
-
*/
|
|
108
|
-
rangeVariant?: VariantProps<typeof sliderRangeVariants>["variant"];
|
|
109
|
-
/**
|
|
110
|
-
* Thumb variant
|
|
111
|
-
*/
|
|
112
|
-
thumbVariant?: VariantProps<typeof sliderThumbVariants>["variant"];
|
|
113
|
-
/**
|
|
114
|
-
* Thumb size
|
|
115
|
-
*/
|
|
116
|
-
thumbSize?: VariantProps<typeof sliderThumbVariants>["size"];
|
|
117
|
-
/**
|
|
118
|
-
* Show value label
|
|
119
|
-
*/
|
|
120
|
-
showValueLabel?: boolean;
|
|
121
|
-
/**
|
|
122
|
-
* Value label format function
|
|
123
|
-
*/
|
|
124
|
-
valueLabelFormat?: (value: number) => string;
|
|
125
|
-
/**
|
|
126
|
-
* Value label class name
|
|
127
|
-
*/
|
|
128
|
-
valueLabelClassName?: string;
|
|
129
|
-
/**
|
|
130
|
-
* Slider value
|
|
131
|
-
*/
|
|
132
|
-
value?: number[];
|
|
133
|
-
/**
|
|
134
|
-
* Default value
|
|
135
|
-
*/
|
|
136
|
-
defaultValue?: number[];
|
|
137
|
-
/**
|
|
138
|
-
* Function called when value changes
|
|
139
|
-
*/
|
|
140
|
-
onValueChange?: (value: number[]) => void;
|
|
141
|
-
/**
|
|
142
|
-
* Minimum value
|
|
143
|
-
*/
|
|
144
|
-
min?: number;
|
|
145
|
-
/**
|
|
146
|
-
* Maximum value
|
|
147
|
-
*/
|
|
148
|
-
max?: number;
|
|
149
|
-
/**
|
|
150
|
-
* Step value
|
|
151
|
-
*/
|
|
152
|
-
step?: number;
|
|
153
|
-
/**
|
|
154
|
-
* Slider size
|
|
155
|
-
*/
|
|
156
|
-
size?: VariantProps<typeof moonUISliderVariantsPro>["size"];
|
|
157
|
-
/**
|
|
158
|
-
* Disabled state
|
|
159
|
-
*/
|
|
160
|
-
disabled?: boolean;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Merge HTML properties without defaultValue conflicts
|
|
164
|
-
type SliderProps = SliderBaseProps & Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue'>
|
|
165
|
-
|
|
166
|
-
const MoonUISliderPro = React.forwardRef<
|
|
167
|
-
HTMLDivElement,
|
|
168
|
-
SliderProps
|
|
169
|
-
>(({
|
|
170
|
-
className,
|
|
171
|
-
size,
|
|
172
|
-
trackVariant,
|
|
173
|
-
rangeVariant,
|
|
174
|
-
thumbVariant,
|
|
175
|
-
thumbSize,
|
|
176
|
-
showValueLabel = false,
|
|
177
|
-
valueLabelFormat,
|
|
178
|
-
valueLabelClassName,
|
|
179
|
-
value,
|
|
180
|
-
defaultValue = [0],
|
|
181
|
-
onValueChange,
|
|
182
|
-
disabled,
|
|
183
|
-
...props
|
|
184
|
-
}, ref) => {
|
|
185
|
-
// Value management
|
|
186
|
-
const [sliderValue, setSliderValue] = React.useState<number[]>(
|
|
187
|
-
value as number[] || defaultValue as number[] || [0]
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
React.useEffect(() => {
|
|
191
|
-
if (value !== undefined) {
|
|
192
|
-
setSliderValue(value as number[]);
|
|
193
|
-
}
|
|
194
|
-
}, [value]);
|
|
195
|
-
|
|
196
|
-
// Format value label with proper precision handling
|
|
197
|
-
const formatValue = (val: number) => {
|
|
198
|
-
if (valueLabelFormat) {
|
|
199
|
-
return valueLabelFormat(val);
|
|
200
|
-
}
|
|
201
|
-
// Round to avoid floating point precision issues
|
|
202
|
-
const roundedValue = Math.round(val * 100) / 100;
|
|
203
|
-
return `${roundedValue}`;
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
// Calculate percentage for thumb position
|
|
207
|
-
const calculateThumbPercent = (value: number, min: number, max: number) => {
|
|
208
|
-
return ((value - min) / (max - min)) * 100;
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
// Handle mouse/touch events
|
|
212
|
-
const trackRef = React.useRef<HTMLDivElement>(null);
|
|
213
|
-
|
|
214
|
-
const min = props.min || 0;
|
|
215
|
-
const max = props.max || 100;
|
|
216
|
-
const step = props.step || 1;
|
|
217
|
-
|
|
218
|
-
// Handle value change with proper precision
|
|
219
|
-
const handleValueChange = (newValues: number[]) => {
|
|
220
|
-
// Round values to avoid floating point precision issues
|
|
221
|
-
const roundedValues = newValues.map(val => {
|
|
222
|
-
if (step < 1) {
|
|
223
|
-
// For decimal steps, round to appropriate decimal places
|
|
224
|
-
const decimals = step.toString().split('.')[1]?.length || 0;
|
|
225
|
-
return Math.round(val * Math.pow(10, decimals)) / Math.pow(10, decimals);
|
|
226
|
-
}
|
|
227
|
-
return Math.round(val);
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
setSliderValue(roundedValues);
|
|
231
|
-
if (onValueChange) {
|
|
232
|
-
onValueChange(roundedValues);
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
// Handle track click
|
|
237
|
-
const handleTrackClick = (event: React.MouseEvent<HTMLDivElement>) => {
|
|
238
|
-
if (disabled) return;
|
|
239
|
-
|
|
240
|
-
const track = trackRef.current;
|
|
241
|
-
if (!track) return;
|
|
242
|
-
|
|
243
|
-
const rect = track.getBoundingClientRect();
|
|
244
|
-
const percent = (event.clientX - rect.left) / rect.width;
|
|
245
|
-
const rawValue = min + percent * (max - min);
|
|
246
|
-
const steppedValue = Math.round(rawValue / step) * step;
|
|
247
|
-
const boundedValue = Math.max(min, Math.min(max, steppedValue));
|
|
248
|
-
|
|
249
|
-
const newValues = [...sliderValue];
|
|
250
|
-
// Just update the first thumb for simplicity
|
|
251
|
-
newValues[0] = boundedValue;
|
|
252
|
-
handleValueChange(newValues);
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
const handleThumbMouseDown = (index: number) => (event: React.MouseEvent) => {
|
|
256
|
-
if (disabled) return;
|
|
257
|
-
event.preventDefault();
|
|
258
|
-
|
|
259
|
-
const handleMouseMove = (moveEvent: MouseEvent) => {
|
|
260
|
-
const track = trackRef.current;
|
|
261
|
-
if (!track) return;
|
|
262
|
-
|
|
263
|
-
const rect = track.getBoundingClientRect();
|
|
264
|
-
const percent = (moveEvent.clientX - rect.left) / rect.width;
|
|
265
|
-
const rawValue = min + percent * (max - min);
|
|
266
|
-
const steppedValue = Math.round(rawValue / step) * step;
|
|
267
|
-
const boundedValue = Math.max(min, Math.min(max, steppedValue));
|
|
268
|
-
|
|
269
|
-
const newValues = [...sliderValue];
|
|
270
|
-
newValues[index] = boundedValue;
|
|
271
|
-
handleValueChange(newValues);
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
const handleMouseUp = () => {
|
|
275
|
-
document.removeEventListener('mousemove', handleMouseMove);
|
|
276
|
-
document.removeEventListener('mouseup', handleMouseUp);
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
document.addEventListener('mousemove', handleMouseMove);
|
|
280
|
-
document.addEventListener('mouseup', handleMouseUp);
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
return (
|
|
284
|
-
<div className="w-full" ref={ref} {...props}>
|
|
285
|
-
{showValueLabel && (
|
|
286
|
-
<div className={cn(
|
|
287
|
-
"flex justify-end mb-1 text-sm text-muted-foreground",
|
|
288
|
-
valueLabelClassName
|
|
289
|
-
)}>
|
|
290
|
-
{sliderValue.length === 1 ? (
|
|
291
|
-
<span>{formatValue(sliderValue[0])}</span>
|
|
292
|
-
) : (
|
|
293
|
-
<span>{formatValue(sliderValue[0])} - {formatValue(sliderValue[sliderValue.length - 1])}</span>
|
|
294
|
-
)}
|
|
295
|
-
</div>
|
|
296
|
-
)}
|
|
297
|
-
|
|
298
|
-
<div
|
|
299
|
-
className={cn(moonUISliderVariantsPro({ size }), className)}
|
|
300
|
-
data-disabled={disabled ? true : undefined}
|
|
301
|
-
>
|
|
302
|
-
{/* Track */}
|
|
303
|
-
<div
|
|
304
|
-
ref={trackRef}
|
|
305
|
-
className={cn(sliderTrackVariants({ variant: trackVariant || thumbVariant || "default" }))}
|
|
306
|
-
onClick={handleTrackClick}
|
|
307
|
-
>
|
|
308
|
-
{/* Range */}
|
|
309
|
-
<div
|
|
310
|
-
className={cn(sliderRangeVariants({ variant: rangeVariant || thumbVariant || "primary" }))}
|
|
311
|
-
style={{
|
|
312
|
-
left: '0%',
|
|
313
|
-
width: `${calculateThumbPercent(sliderValue[0], min, max)}%`,
|
|
314
|
-
}}
|
|
315
|
-
/>
|
|
316
|
-
</div>
|
|
317
|
-
|
|
318
|
-
{/* Thumbs */}
|
|
319
|
-
{sliderValue.map((value, i) => (
|
|
320
|
-
<div
|
|
321
|
-
key={i}
|
|
322
|
-
className={cn(sliderThumbVariants({
|
|
323
|
-
variant: thumbVariant || "primary",
|
|
324
|
-
size: thumbSize
|
|
325
|
-
}))}
|
|
326
|
-
style={{
|
|
327
|
-
left: `${calculateThumbPercent(value, min, max)}%`,
|
|
328
|
-
transform: 'translateX(-50%)',
|
|
329
|
-
position: 'absolute',
|
|
330
|
-
top: '50%',
|
|
331
|
-
marginTop: thumbSize === "sm" ? '-6px' : thumbSize === "lg" ? '-12px' : '-8px',
|
|
332
|
-
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
333
|
-
}}
|
|
334
|
-
onMouseDown={handleThumbMouseDown(i)}
|
|
335
|
-
aria-label={`Thumb ${i + 1}`}
|
|
336
|
-
tabIndex={disabled ? -1 : 0}
|
|
337
|
-
role="slider"
|
|
338
|
-
aria-valuemin={min}
|
|
339
|
-
aria-valuemax={max}
|
|
340
|
-
aria-valuenow={value}
|
|
341
|
-
aria-disabled={disabled}
|
|
342
|
-
/>
|
|
343
|
-
))}
|
|
344
|
-
</div>
|
|
345
|
-
</div>
|
|
346
|
-
)
|
|
347
|
-
})
|
|
348
|
-
|
|
349
|
-
MoonUISliderPro.displayName = "MoonUISliderPro"
|
|
350
|
-
|
|
351
|
-
export { MoonUISliderPro };
|
|
352
|
-
|
|
353
|
-
// Backward compatibility exports
|
|
354
|
-
export { MoonUISliderPro as Slider }
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { motion, useMotionValue, useSpring } from "framer-motion";
|
|
5
|
-
import { cn } from "../../lib/utils";
|
|
6
|
-
|
|
7
|
-
export interface SpotlightCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
spotlightColor?: string;
|
|
10
|
-
spotlightSize?: number;
|
|
11
|
-
spotlightIntensity?: number;
|
|
12
|
-
borderRadius?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const SpotlightCard = React.forwardRef<HTMLDivElement, SpotlightCardProps>(
|
|
16
|
-
(
|
|
17
|
-
{
|
|
18
|
-
children,
|
|
19
|
-
className,
|
|
20
|
-
spotlightColor = "rgba(255, 255, 255, 0.15)",
|
|
21
|
-
spotlightSize = 400,
|
|
22
|
-
spotlightIntensity = 0.5,
|
|
23
|
-
borderRadius = "0.5rem",
|
|
24
|
-
style,
|
|
25
|
-
...props
|
|
26
|
-
},
|
|
27
|
-
ref
|
|
28
|
-
) => {
|
|
29
|
-
const cardRef = React.useRef<HTMLDivElement>(null);
|
|
30
|
-
const mouseX = useMotionValue(0);
|
|
31
|
-
const mouseY = useMotionValue(0);
|
|
32
|
-
|
|
33
|
-
const springConfig = { damping: 20, stiffness: 300 };
|
|
34
|
-
const spotlightX = useSpring(mouseX, springConfig);
|
|
35
|
-
const spotlightY = useSpring(mouseY, springConfig);
|
|
36
|
-
|
|
37
|
-
const handleMouseMove = React.useCallback(
|
|
38
|
-
(e: React.MouseEvent<HTMLDivElement>) => {
|
|
39
|
-
if (!cardRef.current) return;
|
|
40
|
-
|
|
41
|
-
const rect = cardRef.current.getBoundingClientRect();
|
|
42
|
-
const x = e.clientX - rect.left;
|
|
43
|
-
const y = e.clientY - rect.top;
|
|
44
|
-
|
|
45
|
-
mouseX.set(x);
|
|
46
|
-
mouseY.set(y);
|
|
47
|
-
},
|
|
48
|
-
[mouseX, mouseY]
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const handleMouseLeave = React.useCallback(() => {
|
|
52
|
-
// Optionally fade out the spotlight on mouse leave
|
|
53
|
-
// For now, we'll keep it at the last position
|
|
54
|
-
}, []);
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<motion.div
|
|
58
|
-
ref={(el) => {
|
|
59
|
-
cardRef.current = el;
|
|
60
|
-
if (ref) {
|
|
61
|
-
if (typeof ref === "function") ref(el);
|
|
62
|
-
else ref.current = el;
|
|
63
|
-
}
|
|
64
|
-
}}
|
|
65
|
-
className={cn(
|
|
66
|
-
"relative overflow-hidden bg-card text-card-foreground",
|
|
67
|
-
className
|
|
68
|
-
)}
|
|
69
|
-
style={{
|
|
70
|
-
borderRadius,
|
|
71
|
-
...style,
|
|
72
|
-
}}
|
|
73
|
-
onMouseMove={handleMouseMove}
|
|
74
|
-
onMouseLeave={handleMouseLeave}
|
|
75
|
-
whileHover={{ scale: 1.02 }}
|
|
76
|
-
transition={{ type: "spring", stiffness: 400, damping: 25 }}
|
|
77
|
-
{...props}
|
|
78
|
-
>
|
|
79
|
-
{/* Spotlight overlay */}
|
|
80
|
-
<motion.div
|
|
81
|
-
className="pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 hover:opacity-100"
|
|
82
|
-
style={{
|
|
83
|
-
background: `radial-gradient(${spotlightSize}px circle at var(--x) var(--y), ${spotlightColor}, transparent ${spotlightIntensity * 100}%)`,
|
|
84
|
-
"--x": spotlightX,
|
|
85
|
-
"--y": spotlightY,
|
|
86
|
-
} as React.CSSProperties}
|
|
87
|
-
/>
|
|
88
|
-
|
|
89
|
-
{/* Border glow effect */}
|
|
90
|
-
<motion.div
|
|
91
|
-
className="pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 hover:opacity-100"
|
|
92
|
-
style={{
|
|
93
|
-
background: `radial-gradient(${spotlightSize * 1.5}px circle at var(--x) var(--y), ${spotlightColor}, transparent 40%)`,
|
|
94
|
-
"--x": spotlightX,
|
|
95
|
-
"--y": spotlightY,
|
|
96
|
-
filter: "blur(40px)",
|
|
97
|
-
} as React.CSSProperties}
|
|
98
|
-
/>
|
|
99
|
-
|
|
100
|
-
{/* Card border */}
|
|
101
|
-
<div
|
|
102
|
-
className="absolute inset-0 rounded-[inherit] border border-border/50"
|
|
103
|
-
style={{
|
|
104
|
-
background: `radial-gradient(${spotlightSize * 2}px circle at var(--x) var(--y), rgba(255,255,255,0.1), transparent 40%)`,
|
|
105
|
-
"--x": spotlightX,
|
|
106
|
-
"--y": spotlightY,
|
|
107
|
-
} as React.CSSProperties}
|
|
108
|
-
/>
|
|
109
|
-
|
|
110
|
-
{/* Content */}
|
|
111
|
-
<div className="relative z-10">{children}</div>
|
|
112
|
-
</motion.div>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
SpotlightCard.displayName = "SpotlightCard";
|
|
118
|
-
|
|
119
|
-
export { SpotlightCard };
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as SwitchPrimitives from "@radix-ui/react-switch"
|
|
5
|
-
|
|
6
|
-
import { cn } from "../../lib/utils"
|
|
7
|
-
|
|
8
|
-
type SwitchSize = "sm" | "md" | "lg";
|
|
9
|
-
type SwitchVariant = "primary" | "success" | "warning" | "danger" | "secondary";
|
|
10
|
-
|
|
11
|
-
export interface MoonUISwitchProProps extends React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> {
|
|
12
|
-
/** Switch boyutu */
|
|
13
|
-
size?: SwitchSize;
|
|
14
|
-
/** Switch renk varyantı */
|
|
15
|
-
variant?: SwitchVariant;
|
|
16
|
-
/** Yükleniyor durumunu gösterir */
|
|
17
|
-
loading?: boolean;
|
|
18
|
-
/** Sol tarafta gösterilecek ikon */
|
|
19
|
-
leftIcon?: React.ReactNode;
|
|
20
|
-
/** Sağ tarafta gösterilecek ikon */
|
|
21
|
-
rightIcon?: React.ReactNode;
|
|
22
|
-
/** Switch açıklaması */
|
|
23
|
-
description?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const MoonUISwitchPro = React.forwardRef<
|
|
27
|
-
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
28
|
-
MoonUISwitchProProps
|
|
29
|
-
>(({ className, size = "md", variant = "primary", loading, leftIcon, rightIcon, description, ...props }, ref) => (
|
|
30
|
-
<div className="inline-flex items-center gap-2">
|
|
31
|
-
{leftIcon && <span className="text-muted-foreground">{leftIcon}</span>}
|
|
32
|
-
<SwitchPrimitives.Root
|
|
33
|
-
className={cn(
|
|
34
|
-
"peer relative inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors 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 dark:data-[state=unchecked]:bg-gray-700/70 dark:focus-visible:ring-primary/40 dark:focus-visible:ring-offset-gray-950",
|
|
35
|
-
|
|
36
|
-
// Boyutlar
|
|
37
|
-
size === "sm" && "h-4 w-8",
|
|
38
|
-
size === "md" && "h-6 w-11",
|
|
39
|
-
size === "lg" && "h-7 w-14",
|
|
40
|
-
|
|
41
|
-
// Varyantlar (checked durumunda)
|
|
42
|
-
variant === "primary" && "data-[state=checked]:bg-primary",
|
|
43
|
-
variant === "success" && "data-[state=checked]:bg-success",
|
|
44
|
-
variant === "warning" && "data-[state=checked]:bg-warning",
|
|
45
|
-
variant === "danger" && "data-[state=checked]:bg-error",
|
|
46
|
-
variant === "secondary" && "data-[state=checked]:bg-accent",
|
|
47
|
-
|
|
48
|
-
// Unchecked durumu
|
|
49
|
-
"data-[state=unchecked]:bg-input",
|
|
50
|
-
|
|
51
|
-
// Loading durumu
|
|
52
|
-
loading && "opacity-80 cursor-wait",
|
|
53
|
-
|
|
54
|
-
className
|
|
55
|
-
)}
|
|
56
|
-
disabled={loading || props.disabled}
|
|
57
|
-
{...props}
|
|
58
|
-
ref={ref}
|
|
59
|
-
>
|
|
60
|
-
{loading ? (
|
|
61
|
-
<div className="absolute inset-0 flex items-center justify-center">
|
|
62
|
-
<div className="h-3 w-3 animate-spin rounded-full border-2 border-gray-300 border-t-primary"></div>
|
|
63
|
-
</div>
|
|
64
|
-
) : null}
|
|
65
|
-
|
|
66
|
-
<SwitchPrimitives.Thumb
|
|
67
|
-
className={cn(
|
|
68
|
-
"pointer-events-none block rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
69
|
-
// Boyuta göre thumb boyutları
|
|
70
|
-
size === "sm" && "h-3 w-3 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0",
|
|
71
|
-
size === "md" && "h-5 w-5 data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",
|
|
72
|
-
size === "lg" && "h-6 w-6 data-[state=checked]:translate-x-7 data-[state=unchecked]:translate-x-0",
|
|
73
|
-
)}
|
|
74
|
-
/>
|
|
75
|
-
</SwitchPrimitives.Root>
|
|
76
|
-
{rightIcon && <span className="text-muted-foreground">{rightIcon}</span>}
|
|
77
|
-
{description && <span className="text-sm text-muted-foreground">{description}</span>}
|
|
78
|
-
</div>
|
|
79
|
-
))
|
|
80
|
-
MoonUISwitchPro.displayName = SwitchPrimitives.Root.displayName
|
|
81
|
-
|
|
82
|
-
export { MoonUISwitchPro };
|
|
83
|
-
|
|
84
|
-
// Backward compatibility exports
|
|
85
|
-
export { MoonUISwitchPro as Switch }
|
|
86
|
-
export type { SwitchSize, SwitchVariant }
|