@moontra/moonui-pro 2.20.2 → 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/package.json +8 -3
- package/plugin/index.d.ts +86 -0
- package/plugin/index.js +308 -0
- package/scripts/postinstall.js +176 -23
- package/src/components/advanced-chart/index.tsx +0 -1246
- package/src/components/advanced-forms/index.tsx +0 -585
- package/src/components/animated-button/index.tsx +0 -385
- package/src/components/calendar/event-dialog.tsx +0 -377
- package/src/components/calendar/index.tsx +0 -1220
- 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 -480
- 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 -225
- package/src/components/dashboard/widgets/activity-feed.tsx +0 -349
- package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
- package/src/components/dashboard/widgets/comparison-widget.tsx +0 -177
- package/src/components/dashboard/widgets/index.ts +0 -5
- package/src/components/dashboard/widgets/metric-card.tsx +0 -363
- package/src/components/dashboard/widgets/progress-widget.tsx +0 -113
- 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/index.tsx +0 -845
- package/src/components/draggable-list/index.tsx +0 -100
- package/src/components/error-boundary/index.tsx +0 -232
- 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 -335
- package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
- package/src/components/form-wizard/form-wizard-progress.tsx +0 -329
- 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 -77
- 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 -517
- 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 -515
- package/src/components/health-check/index.tsx +0 -439
- package/src/components/hover-card-3d/index.tsx +0 -529
- package/src/components/index.ts +0 -130
- 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 -1689
- 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 -31
- package/src/components/magnetic-button/index.tsx +0 -216
- package/src/components/memory-efficient-data/index.tsx +0 -1018
- package/src/components/moonui-quiz-form/index.tsx +0 -817
- package/src/components/navbar/index.tsx +0 -781
- package/src/components/optimized-image/index.tsx +0 -425
- package/src/components/performance-debugger/index.tsx +0 -613
- package/src/components/performance-monitor/index.tsx +0 -808
- package/src/components/phone-number-input/index.tsx +0 -343
- package/src/components/phone-number-input/phone-number-input-simple.tsx +0 -167
- 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.tsx +0 -2322
- package/src/components/rich-text-editor/slash-commands-extension.ts +0 -230
- 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 -884
- 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 -1183
- package/src/components/ui/accordion.tsx +0 -581
- 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 -155
- package/src/components/ui/badge.tsx +0 -230
- package/src/components/ui/breadcrumb.tsx +0 -216
- package/src/components/ui/button.tsx +0 -228
- package/src/components/ui/calendar.tsx +0 -387
- package/src/components/ui/card.tsx +0 -216
- package/src/components/ui/checkbox.tsx +0 -259
- package/src/components/ui/collapsible.tsx +0 -631
- package/src/components/ui/color-picker.tsx +0 -97
- package/src/components/ui/command.tsx +0 -948
- package/src/components/ui/dialog.tsx +0 -752
- package/src/components/ui/dropdown-menu.tsx +0 -706
- 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 -222
- package/src/components/ui/input.tsx +0 -224
- 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 -611
- package/src/components/ui/navigation-menu.tsx +0 -130
- package/src/components/ui/pagination.tsx +0 -125
- 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 -378
- 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 -331
- package/src/components/ui/tabs-pro.tsx +0 -542
- package/src/components/ui/tabs.tsx +0 -54
- 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 -22
- 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 -681
- package/src/styles/tailwind.css +0 -7
- package/src/styles/tokens.css +0 -455
- 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,387 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
5
|
-
import { cn } from "../../lib/utils";
|
|
6
|
-
import { buttonVariants } from "./button";
|
|
7
|
-
import {
|
|
8
|
-
format,
|
|
9
|
-
startOfMonth,
|
|
10
|
-
endOfMonth,
|
|
11
|
-
eachDayOfInterval,
|
|
12
|
-
getDay,
|
|
13
|
-
isSameMonth,
|
|
14
|
-
isSameDay,
|
|
15
|
-
isToday,
|
|
16
|
-
addMonths,
|
|
17
|
-
subMonths,
|
|
18
|
-
startOfWeek,
|
|
19
|
-
endOfWeek
|
|
20
|
-
} from "date-fns";
|
|
21
|
-
|
|
22
|
-
export interface CalendarProps {
|
|
23
|
-
mode?: "single" | "range" | "multiple";
|
|
24
|
-
selected?: Date | Date[] | { from?: Date; to?: Date } | undefined;
|
|
25
|
-
onSelect?: (date: Date | Date[] | { from?: Date; to?: Date } | undefined) => void;
|
|
26
|
-
disabled?: (date: Date) => boolean;
|
|
27
|
-
showOutsideDays?: boolean;
|
|
28
|
-
className?: string;
|
|
29
|
-
classNames?: Record<string, string>;
|
|
30
|
-
numberOfMonths?: number;
|
|
31
|
-
defaultMonth?: Date;
|
|
32
|
-
initialFocus?: boolean;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function Calendar({
|
|
36
|
-
mode = "single",
|
|
37
|
-
selected,
|
|
38
|
-
onSelect,
|
|
39
|
-
disabled,
|
|
40
|
-
showOutsideDays = false,
|
|
41
|
-
className,
|
|
42
|
-
classNames,
|
|
43
|
-
numberOfMonths = 1,
|
|
44
|
-
defaultMonth,
|
|
45
|
-
...props
|
|
46
|
-
}: CalendarProps) {
|
|
47
|
-
const getInitialMonth = () => {
|
|
48
|
-
if (defaultMonth) return defaultMonth;
|
|
49
|
-
if (mode === "range" && selected) {
|
|
50
|
-
const range = selected as { from?: Date; to?: Date };
|
|
51
|
-
if (range.from && range.from instanceof Date) return range.from;
|
|
52
|
-
}
|
|
53
|
-
if (selected && selected instanceof Date) return selected;
|
|
54
|
-
return new Date();
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const [currentMonth, setCurrentMonth] = React.useState(getInitialMonth());
|
|
58
|
-
|
|
59
|
-
const weekDays = [
|
|
60
|
-
{ short: "S", full: "Sunday" },
|
|
61
|
-
{ short: "M", full: "Monday" },
|
|
62
|
-
{ short: "T", full: "Tuesday" },
|
|
63
|
-
{ short: "W", full: "Wednesday" },
|
|
64
|
-
{ short: "T", full: "Thursday" },
|
|
65
|
-
{ short: "F", full: "Friday" },
|
|
66
|
-
{ short: "S", full: "Saturday" }
|
|
67
|
-
];
|
|
68
|
-
|
|
69
|
-
const handlePreviousMonth = () => {
|
|
70
|
-
setCurrentMonth(subMonths(currentMonth, 1));
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const handleNextMonth = () => {
|
|
74
|
-
setCurrentMonth(addMonths(currentMonth, 1));
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const handleDateClick = (date: Date) => {
|
|
78
|
-
if (disabled?.(date)) return;
|
|
79
|
-
|
|
80
|
-
if (mode === "single") {
|
|
81
|
-
onSelect?.(date);
|
|
82
|
-
} else if (mode === "range") {
|
|
83
|
-
const currentSelection = selected as { from?: Date; to?: Date } | undefined;
|
|
84
|
-
if (!currentSelection?.from || (currentSelection.from && currentSelection.to)) {
|
|
85
|
-
onSelect?.({ from: date, to: undefined });
|
|
86
|
-
} else {
|
|
87
|
-
if (date < currentSelection.from) {
|
|
88
|
-
onSelect?.({ from: date, to: currentSelection.from });
|
|
89
|
-
} else {
|
|
90
|
-
onSelect?.({ from: currentSelection.from, to: date });
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const isDateSelected = (date: Date) => {
|
|
97
|
-
if (!selected) return false;
|
|
98
|
-
|
|
99
|
-
if (mode === "single") {
|
|
100
|
-
return isSameDay(date, selected as Date);
|
|
101
|
-
} else if (mode === "range") {
|
|
102
|
-
const range = selected as { from?: Date; to?: Date };
|
|
103
|
-
if (range.from && range.to) {
|
|
104
|
-
return date >= range.from && date <= range.to;
|
|
105
|
-
}
|
|
106
|
-
return range.from ? isSameDay(date, range.from) : false;
|
|
107
|
-
}
|
|
108
|
-
return false;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const isRangeStart = (date: Date) => {
|
|
112
|
-
if (mode !== "range" || !selected) return false;
|
|
113
|
-
const range = selected as { from?: Date; to?: Date };
|
|
114
|
-
return range.from ? isSameDay(date, range.from) : false;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const isRangeEnd = (date: Date) => {
|
|
118
|
-
if (mode !== "range" || !selected) return false;
|
|
119
|
-
const range = selected as { from?: Date; to?: Date };
|
|
120
|
-
return range.to ? isSameDay(date, range.to) : false;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const isRangeMiddle = (date: Date) => {
|
|
124
|
-
if (mode !== "range" || !selected) return false;
|
|
125
|
-
const range = selected as { from?: Date; to?: Date };
|
|
126
|
-
if (!range.from || !range.to) return false;
|
|
127
|
-
return date > range.from && date < range.to;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const getDaysInMonth = () => {
|
|
131
|
-
const start = startOfMonth(currentMonth);
|
|
132
|
-
const end = endOfMonth(currentMonth);
|
|
133
|
-
const days = eachDayOfInterval({ start, end });
|
|
134
|
-
|
|
135
|
-
// Get days from previous month to fill the first week
|
|
136
|
-
const firstDayOfWeek = getDay(start);
|
|
137
|
-
const previousMonthDays = [];
|
|
138
|
-
if (firstDayOfWeek > 0 && showOutsideDays) {
|
|
139
|
-
const previousMonthStart = startOfWeek(start);
|
|
140
|
-
const previousMonthEnd = new Date(start);
|
|
141
|
-
previousMonthEnd.setDate(previousMonthEnd.getDate() - 1);
|
|
142
|
-
previousMonthDays.push(...eachDayOfInterval({
|
|
143
|
-
start: previousMonthStart,
|
|
144
|
-
end: previousMonthEnd
|
|
145
|
-
}));
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Get days from next month to fill the last week
|
|
149
|
-
const lastDayOfWeek = getDay(end);
|
|
150
|
-
const nextMonthDays = [];
|
|
151
|
-
if (lastDayOfWeek < 6 && showOutsideDays) {
|
|
152
|
-
const nextMonthStart = new Date(end);
|
|
153
|
-
nextMonthStart.setDate(nextMonthStart.getDate() + 1);
|
|
154
|
-
const nextMonthEnd = endOfWeek(end);
|
|
155
|
-
nextMonthDays.push(...eachDayOfInterval({
|
|
156
|
-
start: nextMonthStart,
|
|
157
|
-
end: nextMonthEnd
|
|
158
|
-
}));
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// Add empty cells for the first week if not showing outside days
|
|
162
|
-
const emptyCells = [];
|
|
163
|
-
if (!showOutsideDays && firstDayOfWeek > 0) {
|
|
164
|
-
for (let i = 0; i < firstDayOfWeek; i++) {
|
|
165
|
-
emptyCells.push(null);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return [...previousMonthDays, ...emptyCells, ...days, ...nextMonthDays];
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const renderCalendar = (monthOffset: number = 0) => {
|
|
173
|
-
const displayMonth = addMonths(currentMonth, monthOffset);
|
|
174
|
-
const start = startOfMonth(displayMonth);
|
|
175
|
-
const end = endOfMonth(displayMonth);
|
|
176
|
-
const days = eachDayOfInterval({ start, end });
|
|
177
|
-
|
|
178
|
-
// Get days from previous month to fill the first week
|
|
179
|
-
const firstDayOfWeek = getDay(start);
|
|
180
|
-
const previousMonthDays = [];
|
|
181
|
-
if (firstDayOfWeek > 0 && showOutsideDays) {
|
|
182
|
-
const previousMonthStart = startOfWeek(start);
|
|
183
|
-
const previousMonthEnd = new Date(start);
|
|
184
|
-
previousMonthEnd.setDate(previousMonthEnd.getDate() - 1);
|
|
185
|
-
previousMonthDays.push(...eachDayOfInterval({
|
|
186
|
-
start: previousMonthStart,
|
|
187
|
-
end: previousMonthEnd
|
|
188
|
-
}));
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// Get days from next month to fill the last week
|
|
192
|
-
const lastDayOfWeek = getDay(end);
|
|
193
|
-
const nextMonthDays = [];
|
|
194
|
-
if (lastDayOfWeek < 6 && showOutsideDays) {
|
|
195
|
-
const nextMonthStart = new Date(end);
|
|
196
|
-
nextMonthStart.setDate(nextMonthStart.getDate() + 1);
|
|
197
|
-
const nextMonthEnd = endOfWeek(end);
|
|
198
|
-
nextMonthDays.push(...eachDayOfInterval({
|
|
199
|
-
start: nextMonthStart,
|
|
200
|
-
end: nextMonthEnd
|
|
201
|
-
}));
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Add empty cells for the first week if not showing outside days
|
|
205
|
-
const emptyCells = [];
|
|
206
|
-
if (!showOutsideDays && firstDayOfWeek > 0) {
|
|
207
|
-
for (let i = 0; i < firstDayOfWeek; i++) {
|
|
208
|
-
emptyCells.push(null);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const allDays = [...previousMonthDays, ...emptyCells, ...days, ...nextMonthDays];
|
|
213
|
-
|
|
214
|
-
return (
|
|
215
|
-
<div className="moonui-calendar-month flex-1 min-w-0">
|
|
216
|
-
{/* Month header for multi-month display */}
|
|
217
|
-
{numberOfMonths > 1 && (
|
|
218
|
-
<div className="flex items-center justify-center pb-2">
|
|
219
|
-
<h3 className="text-xs sm:text-sm font-medium">
|
|
220
|
-
{displayMonth instanceof Date && !isNaN(displayMonth.getTime())
|
|
221
|
-
? format(displayMonth, "MMMM yyyy")
|
|
222
|
-
: ""}
|
|
223
|
-
</h3>
|
|
224
|
-
</div>
|
|
225
|
-
)}
|
|
226
|
-
|
|
227
|
-
{/* Week days header for each month */}
|
|
228
|
-
<div className="grid grid-cols-7 gap-0 mb-1">
|
|
229
|
-
{weekDays.map((day, index) => (
|
|
230
|
-
<div
|
|
231
|
-
key={`weekday-${monthOffset}-${index}`}
|
|
232
|
-
className="text-muted-foreground text-[0.65rem] sm:text-[0.75rem] font-normal h-6 sm:h-7 w-full flex items-center justify-center"
|
|
233
|
-
title={day.full}
|
|
234
|
-
>
|
|
235
|
-
{day.short}
|
|
236
|
-
</div>
|
|
237
|
-
))}
|
|
238
|
-
</div>
|
|
239
|
-
|
|
240
|
-
{/* Days grid */}
|
|
241
|
-
<div className="grid grid-cols-7 gap-0">
|
|
242
|
-
{allDays.map((date, index) => {
|
|
243
|
-
if (!date) {
|
|
244
|
-
return <div key={`empty-${monthOffset}-${index}`} className="h-8 sm:h-9 w-full" />;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
const isOutsideMonth = !isSameMonth(date, displayMonth);
|
|
248
|
-
const isDisabled = disabled?.(date) || false;
|
|
249
|
-
const isSelected = isDateSelected(date);
|
|
250
|
-
const isTodayDate = isToday(date);
|
|
251
|
-
const rangeStart = isRangeStart(date);
|
|
252
|
-
const rangeEnd = isRangeEnd(date);
|
|
253
|
-
const rangeMiddle = isRangeMiddle(date);
|
|
254
|
-
|
|
255
|
-
return (
|
|
256
|
-
<button
|
|
257
|
-
key={date.toISOString()}
|
|
258
|
-
onClick={() => handleDateClick(date)}
|
|
259
|
-
disabled={isDisabled}
|
|
260
|
-
className={cn(
|
|
261
|
-
"h-8 sm:h-9 w-full p-0 font-normal",
|
|
262
|
-
"inline-flex items-center justify-center rounded-md",
|
|
263
|
-
"hover:bg-muted transition-colors text-xs sm:text-sm",
|
|
264
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
265
|
-
isOutsideMonth && "text-muted-foreground/50",
|
|
266
|
-
isDisabled && "text-muted-foreground/30 cursor-not-allowed hover:bg-transparent",
|
|
267
|
-
isSelected && !rangeMiddle && "bg-primary text-primary-foreground font-medium hover:bg-primary hover:text-primary-foreground",
|
|
268
|
-
isTodayDate && !isSelected && "bg-accent text-accent-foreground",
|
|
269
|
-
rangeMiddle && "bg-accent rounded-none",
|
|
270
|
-
rangeStart && "rounded-r-none",
|
|
271
|
-
rangeEnd && "rounded-l-none"
|
|
272
|
-
)}
|
|
273
|
-
type="button"
|
|
274
|
-
>
|
|
275
|
-
{date instanceof Date && !isNaN(date.getTime())
|
|
276
|
-
? format(date, "d")
|
|
277
|
-
: ""}
|
|
278
|
-
</button>
|
|
279
|
-
);
|
|
280
|
-
})}
|
|
281
|
-
</div>
|
|
282
|
-
</div>
|
|
283
|
-
);
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
return (
|
|
287
|
-
<div className={cn("moonui-calendar p-2 sm:p-3", className)}>
|
|
288
|
-
{/* Header - only show for single month */}
|
|
289
|
-
{numberOfMonths === 1 && (
|
|
290
|
-
<div className="flex items-center justify-between px-1 pb-3">
|
|
291
|
-
<button
|
|
292
|
-
onClick={handlePreviousMonth}
|
|
293
|
-
className={cn(
|
|
294
|
-
buttonVariants({ variant: "outline" }),
|
|
295
|
-
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
|
296
|
-
)}
|
|
297
|
-
type="button"
|
|
298
|
-
>
|
|
299
|
-
<ChevronLeft className="h-4 w-4" />
|
|
300
|
-
</button>
|
|
301
|
-
|
|
302
|
-
<h2 className="text-sm font-medium">
|
|
303
|
-
{currentMonth instanceof Date && !isNaN(currentMonth.getTime())
|
|
304
|
-
? format(currentMonth, "MMMM yyyy")
|
|
305
|
-
: ""
|
|
306
|
-
}
|
|
307
|
-
</h2>
|
|
308
|
-
|
|
309
|
-
<button
|
|
310
|
-
onClick={handleNextMonth}
|
|
311
|
-
className={cn(
|
|
312
|
-
buttonVariants({ variant: "outline" }),
|
|
313
|
-
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
|
314
|
-
)}
|
|
315
|
-
type="button"
|
|
316
|
-
>
|
|
317
|
-
<ChevronRight className="h-4 w-4" />
|
|
318
|
-
</button>
|
|
319
|
-
</div>
|
|
320
|
-
)}
|
|
321
|
-
|
|
322
|
-
{/* Navigation for multiple months */}
|
|
323
|
-
{numberOfMonths > 1 && (
|
|
324
|
-
<div className="flex items-center justify-between px-1 pb-3">
|
|
325
|
-
<button
|
|
326
|
-
onClick={handlePreviousMonth}
|
|
327
|
-
className={cn(
|
|
328
|
-
buttonVariants({ variant: "outline" }),
|
|
329
|
-
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
|
330
|
-
)}
|
|
331
|
-
type="button"
|
|
332
|
-
>
|
|
333
|
-
<ChevronLeft className="h-4 w-4" />
|
|
334
|
-
</button>
|
|
335
|
-
|
|
336
|
-
<h2 className="text-xs sm:text-sm font-medium text-center">
|
|
337
|
-
{currentMonth instanceof Date && !isNaN(currentMonth.getTime())
|
|
338
|
-
? `${format(currentMonth, "MMM yyyy")} - ${format(addMonths(currentMonth, numberOfMonths - 1), "MMM yyyy")}`
|
|
339
|
-
: ""
|
|
340
|
-
}
|
|
341
|
-
</h2>
|
|
342
|
-
|
|
343
|
-
<button
|
|
344
|
-
onClick={handleNextMonth}
|
|
345
|
-
className={cn(
|
|
346
|
-
buttonVariants({ variant: "outline" }),
|
|
347
|
-
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
|
348
|
-
)}
|
|
349
|
-
type="button"
|
|
350
|
-
>
|
|
351
|
-
<ChevronRight className="h-4 w-4" />
|
|
352
|
-
</button>
|
|
353
|
-
</div>
|
|
354
|
-
)}
|
|
355
|
-
|
|
356
|
-
{/* Week days header for single month */}
|
|
357
|
-
{numberOfMonths === 1 && (
|
|
358
|
-
<div className="grid grid-cols-7 gap-0 mb-1">
|
|
359
|
-
{weekDays.map((day, index) => (
|
|
360
|
-
<div
|
|
361
|
-
key={`weekday-${index}`}
|
|
362
|
-
className="text-muted-foreground text-[0.65rem] sm:text-[0.75rem] font-normal h-6 sm:h-7 w-full flex items-center justify-center"
|
|
363
|
-
title={day.full}
|
|
364
|
-
>
|
|
365
|
-
{day.short}
|
|
366
|
-
</div>
|
|
367
|
-
))}
|
|
368
|
-
</div>
|
|
369
|
-
)}
|
|
370
|
-
|
|
371
|
-
{/* Calendar(s) */}
|
|
372
|
-
<div className={cn(
|
|
373
|
-
numberOfMonths > 1 && "flex flex-col sm:flex-row gap-2 sm:gap-4"
|
|
374
|
-
)}>
|
|
375
|
-
{Array.from({ length: numberOfMonths }).map((_, i) => (
|
|
376
|
-
<div key={i} className="flex-1">
|
|
377
|
-
{renderCalendar(i)}
|
|
378
|
-
</div>
|
|
379
|
-
))}
|
|
380
|
-
</div>
|
|
381
|
-
</div>
|
|
382
|
-
);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
Calendar.displayName = "Calendar";
|
|
386
|
-
|
|
387
|
-
export { Calendar };
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
|
-
import { motion } from "framer-motion";
|
|
6
|
-
import { cn } from "../../lib/utils";
|
|
7
|
-
import { microInteractionVariants, hoverAnimations, tapAnimations } from "../../lib/micro-interactions";
|
|
8
|
-
|
|
9
|
-
const moonUICardVariantsPro = cva(
|
|
10
|
-
"rounded-lg border bg-card text-card-foreground shadow-sm transition-all duration-200",
|
|
11
|
-
{
|
|
12
|
-
variants: {
|
|
13
|
-
variant: {
|
|
14
|
-
default: "border-border dark:border-border",
|
|
15
|
-
outline: "border border-border shadow-none bg-transparent dark:border-border",
|
|
16
|
-
filled: "border-none bg-secondary dark:bg-secondary shadow-inner",
|
|
17
|
-
elevated: "border-none shadow-lg dark:shadow-xl dark:shadow-black/20",
|
|
18
|
-
gradient: "border-none bg-gradient-to-br from-primary/5 to-primary/10 dark:from-primary/10 dark:to-primary/20",
|
|
19
|
-
glass: "border border-white/20 bg-white/10 backdrop-blur-md dark:border-white/10 dark:bg-black/10",
|
|
20
|
-
neon: "border-2 border-primary/50 shadow-[0_0_15px_rgba(var(--primary),0.5)] dark:shadow-[0_0_20px_rgba(var(--primary),0.7)]",
|
|
21
|
-
glow: "border border-border shadow-[0_0_30px_rgba(var(--primary),0.15)] dark:shadow-[0_0_40px_rgba(var(--primary),0.25)]",
|
|
22
|
-
},
|
|
23
|
-
size: {
|
|
24
|
-
default: "p-6",
|
|
25
|
-
sm: "p-4",
|
|
26
|
-
lg: "p-8",
|
|
27
|
-
xl: "p-10",
|
|
28
|
-
},
|
|
29
|
-
radius: {
|
|
30
|
-
default: "rounded-lg",
|
|
31
|
-
sm: "rounded-md",
|
|
32
|
-
lg: "rounded-xl",
|
|
33
|
-
full: "rounded-3xl",
|
|
34
|
-
none: "rounded-none",
|
|
35
|
-
},
|
|
36
|
-
interactive: {
|
|
37
|
-
true: "cursor-pointer hover:shadow-lg hover:border-primary/20 dark:hover:border-primary/30 hover:-translate-y-0.5 active:translate-y-0 active:shadow-sm",
|
|
38
|
-
false: "",
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
defaultVariants: {
|
|
42
|
-
variant: "default",
|
|
43
|
-
size: "default",
|
|
44
|
-
radius: "default",
|
|
45
|
-
},
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
export interface MoonUICardProProps
|
|
50
|
-
extends React.HTMLAttributes<HTMLDivElement>,
|
|
51
|
-
VariantProps<typeof moonUICardVariantsPro> {
|
|
52
|
-
asChild?: boolean;
|
|
53
|
-
microInteraction?: "lift" | "glow" | "scale" | "none";
|
|
54
|
-
enableGlassmorphism?: boolean;
|
|
55
|
-
enableParallax?: boolean;
|
|
56
|
-
enableTilt?: boolean;
|
|
57
|
-
tiltMaxAngle?: number;
|
|
58
|
-
parallaxOffset?: number;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const MoonUICardPro = React.forwardRef<HTMLDivElement, MoonUICardProProps>(
|
|
62
|
-
({
|
|
63
|
-
className,
|
|
64
|
-
variant,
|
|
65
|
-
size,
|
|
66
|
-
radius,
|
|
67
|
-
interactive,
|
|
68
|
-
microInteraction = "lift",
|
|
69
|
-
enableGlassmorphism,
|
|
70
|
-
enableParallax = false,
|
|
71
|
-
enableTilt = false,
|
|
72
|
-
tiltMaxAngle = 15,
|
|
73
|
-
parallaxOffset = 20,
|
|
74
|
-
children,
|
|
75
|
-
asChild,
|
|
76
|
-
...props
|
|
77
|
-
}, ref) => {
|
|
78
|
-
const [mousePos, setMousePos] = React.useState({ x: 0, y: 0 });
|
|
79
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
80
|
-
|
|
81
|
-
const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
82
|
-
if (!enableTilt && !enableParallax) return;
|
|
83
|
-
|
|
84
|
-
const rect = e.currentTarget.getBoundingClientRect();
|
|
85
|
-
const centerX = rect.left + rect.width / 2;
|
|
86
|
-
const centerY = rect.top + rect.height / 2;
|
|
87
|
-
|
|
88
|
-
const x = (e.clientX - centerX) / (rect.width / 2);
|
|
89
|
-
const y = (e.clientY - centerY) / (rect.height / 2);
|
|
90
|
-
|
|
91
|
-
setMousePos({ x, y });
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const handleMouseEnter = () => setIsHovered(true);
|
|
95
|
-
const handleMouseLeave = () => {
|
|
96
|
-
setIsHovered(false);
|
|
97
|
-
setMousePos({ x: 0, y: 0 });
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
// Apply glassmorphism variant if enabled
|
|
101
|
-
const finalVariant = enableGlassmorphism ? "glass" : variant;
|
|
102
|
-
|
|
103
|
-
// Calculate tilt transforms
|
|
104
|
-
const rotateX = enableTilt ? mousePos.y * -tiltMaxAngle : 0;
|
|
105
|
-
const rotateY = enableTilt ? mousePos.x * tiltMaxAngle : 0;
|
|
106
|
-
|
|
107
|
-
// Base interaction props
|
|
108
|
-
const interactionProps = interactive && microInteraction !== "none" ? {
|
|
109
|
-
whileHover: microInteraction === "scale" ? hoverAnimations.scale :
|
|
110
|
-
microInteraction === "glow" ? hoverAnimations.glow :
|
|
111
|
-
hoverAnimations.lift,
|
|
112
|
-
whileTap: tapAnimations.scale,
|
|
113
|
-
} : {};
|
|
114
|
-
|
|
115
|
-
const { onDrag, onDragStart, onDragEnd, ...divProps } = props as any;
|
|
116
|
-
|
|
117
|
-
return (
|
|
118
|
-
<motion.div
|
|
119
|
-
ref={ref}
|
|
120
|
-
className={cn(moonUICardVariantsPro({ variant: finalVariant, size, radius, interactive, className }))}
|
|
121
|
-
onMouseMove={handleMouseMove}
|
|
122
|
-
onMouseEnter={handleMouseEnter}
|
|
123
|
-
onMouseLeave={handleMouseLeave}
|
|
124
|
-
style={{
|
|
125
|
-
transformStyle: enableTilt || enableParallax ? "preserve-3d" : undefined,
|
|
126
|
-
perspective: enableTilt || enableParallax ? "1000px" : undefined,
|
|
127
|
-
}}
|
|
128
|
-
animate={{
|
|
129
|
-
rotateX,
|
|
130
|
-
rotateY,
|
|
131
|
-
}}
|
|
132
|
-
transition={{ type: "spring", damping: 20, stiffness: 300 }}
|
|
133
|
-
{...interactionProps}
|
|
134
|
-
{...divProps}
|
|
135
|
-
>
|
|
136
|
-
{/* Parallax content wrapper */}
|
|
137
|
-
{enableParallax ? (
|
|
138
|
-
<motion.div
|
|
139
|
-
style={{ transform: "translateZ(50px)" }}
|
|
140
|
-
animate={{
|
|
141
|
-
x: isHovered ? mousePos.x * parallaxOffset : 0,
|
|
142
|
-
y: isHovered ? mousePos.y * parallaxOffset : 0,
|
|
143
|
-
}}
|
|
144
|
-
transition={{ type: "spring", damping: 20, stiffness: 300 }}
|
|
145
|
-
>
|
|
146
|
-
{children}
|
|
147
|
-
</motion.div>
|
|
148
|
-
) : (
|
|
149
|
-
children
|
|
150
|
-
)}
|
|
151
|
-
</motion.div>
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
);
|
|
155
|
-
MoonUICardPro.displayName = "MoonUICardPro";
|
|
156
|
-
|
|
157
|
-
const MoonUICardHeaderPro = React.forwardRef<
|
|
158
|
-
HTMLDivElement,
|
|
159
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
160
|
-
>(({ className, ...props }, ref) => (
|
|
161
|
-
<div
|
|
162
|
-
ref={ref}
|
|
163
|
-
className={cn("flex flex-col space-y-1.5", className)}
|
|
164
|
-
{...props}
|
|
165
|
-
/>
|
|
166
|
-
));
|
|
167
|
-
MoonUICardHeaderPro.displayName = "MoonUICardHeaderPro";
|
|
168
|
-
|
|
169
|
-
const MoonUICardTitlePro = React.forwardRef<
|
|
170
|
-
HTMLHeadingElement,
|
|
171
|
-
React.HTMLAttributes<HTMLHeadingElement>
|
|
172
|
-
>(({ className, ...props }, ref) => (
|
|
173
|
-
<h3
|
|
174
|
-
ref={ref}
|
|
175
|
-
className={cn("text-lg font-semibold leading-none tracking-tight", className)}
|
|
176
|
-
{...props}
|
|
177
|
-
/>
|
|
178
|
-
));
|
|
179
|
-
MoonUICardTitlePro.displayName = "MoonUICardTitlePro";
|
|
180
|
-
|
|
181
|
-
const MoonUICardDescriptionPro = React.forwardRef<
|
|
182
|
-
HTMLParagraphElement,
|
|
183
|
-
React.HTMLAttributes<HTMLParagraphElement>
|
|
184
|
-
>(({ className, ...props }, ref) => (
|
|
185
|
-
<p
|
|
186
|
-
ref={ref}
|
|
187
|
-
className={cn("text-sm text-muted-foreground", className)}
|
|
188
|
-
{...props}
|
|
189
|
-
/>
|
|
190
|
-
));
|
|
191
|
-
MoonUICardDescriptionPro.displayName = "MoonUICardDescriptionPro";
|
|
192
|
-
|
|
193
|
-
const MoonUICardContentPro = React.forwardRef<
|
|
194
|
-
HTMLDivElement,
|
|
195
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
196
|
-
>(({ className, ...props }, ref) => (
|
|
197
|
-
<div ref={ref} className={cn("pt-0", className)} {...props} />
|
|
198
|
-
));
|
|
199
|
-
MoonUICardContentPro.displayName = "MoonUICardContentPro";
|
|
200
|
-
|
|
201
|
-
const MoonUICardFooterPro = React.forwardRef<
|
|
202
|
-
HTMLDivElement,
|
|
203
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
204
|
-
>(({ className, ...props }, ref) => (
|
|
205
|
-
<div
|
|
206
|
-
ref={ref}
|
|
207
|
-
className={cn("flex items-center pt-4", className)}
|
|
208
|
-
{...props}
|
|
209
|
-
/>
|
|
210
|
-
));
|
|
211
|
-
MoonUICardFooterPro.displayName = "MoonUICardFooterPro";
|
|
212
|
-
|
|
213
|
-
export { MoonUICardPro, MoonUICardHeaderPro, MoonUICardFooterPro, MoonUICardTitlePro, MoonUICardDescriptionPro, MoonUICardContentPro };
|
|
214
|
-
|
|
215
|
-
// Backward compatibility exports
|
|
216
|
-
export { MoonUICardPro as Card, MoonUICardHeaderPro as CardHeader, MoonUICardFooterPro as CardFooter, MoonUICardTitlePro as CardTitle, MoonUICardDescriptionPro as CardDescription, MoonUICardContentPro as CardContent };
|