analytica-frontend-lib 1.0.42 → 1.0.44
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/Calendar/index.d.mts +60 -0
- package/dist/Calendar/index.d.ts +60 -0
- package/dist/Calendar/index.js +526 -0
- package/dist/Calendar/index.js.map +1 -0
- package/dist/Calendar/index.mjs +501 -0
- package/dist/Calendar/index.mjs.map +1 -0
- package/dist/Input/index.js +5 -2
- package/dist/Input/index.js.map +1 -1
- package/dist/Input/index.mjs +5 -2
- package/dist/Input/index.mjs.map +1 -1
- package/dist/ProgressBar/index.d.mts +36 -1
- package/dist/ProgressBar/index.d.ts +36 -1
- package/dist/ProgressBar/index.js +371 -75
- package/dist/ProgressBar/index.js.map +1 -1
- package/dist/ProgressBar/index.mjs +372 -76
- package/dist/ProgressBar/index.mjs.map +1 -1
- package/dist/index.css +141 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +952 -154
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +933 -136
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +141 -0
- package/dist/styles.css.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Activity status types for calendar days
|
|
5
|
+
*/
|
|
6
|
+
type ActivityStatus = 'near-deadline' | 'overdue' | 'in-deadline';
|
|
7
|
+
/**
|
|
8
|
+
* Activity data for a specific day
|
|
9
|
+
*/
|
|
10
|
+
interface CalendarActivity {
|
|
11
|
+
id: string;
|
|
12
|
+
status: ActivityStatus;
|
|
13
|
+
title?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Calendar day data
|
|
17
|
+
*/
|
|
18
|
+
interface CalendarDay {
|
|
19
|
+
date: Date;
|
|
20
|
+
isCurrentMonth: boolean;
|
|
21
|
+
isToday: boolean;
|
|
22
|
+
isSelected: boolean;
|
|
23
|
+
activities?: CalendarActivity[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Calendar variant types
|
|
27
|
+
*/
|
|
28
|
+
type CalendarVariant = 'navigation' | 'selection';
|
|
29
|
+
/**
|
|
30
|
+
* Calendar component props
|
|
31
|
+
*/
|
|
32
|
+
interface CalendarProps {
|
|
33
|
+
/** Calendar variant - navigation (compact) or selection (full) */
|
|
34
|
+
variant?: CalendarVariant;
|
|
35
|
+
/** Currently selected date */
|
|
36
|
+
selectedDate?: Date;
|
|
37
|
+
/** Function called when a date is selected */
|
|
38
|
+
onDateSelect?: (date: Date) => void;
|
|
39
|
+
/** Function called when month changes */
|
|
40
|
+
onMonthChange?: (date: Date) => void;
|
|
41
|
+
/** Activities data for calendar days */
|
|
42
|
+
activities?: Record<string, CalendarActivity[]>;
|
|
43
|
+
/** Show activities indicators */
|
|
44
|
+
showActivities?: boolean;
|
|
45
|
+
/** Additional CSS classes */
|
|
46
|
+
className?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Day names abbreviations
|
|
50
|
+
*/
|
|
51
|
+
declare const WEEK_DAYS: string[];
|
|
52
|
+
/**
|
|
53
|
+
* Calendar component for Analytica Ensino platforms
|
|
54
|
+
*
|
|
55
|
+
* A comprehensive calendar component with activity indicators,
|
|
56
|
+
* date selection, and navigation capabilities.
|
|
57
|
+
*/
|
|
58
|
+
declare const Calendar: ({ variant, selectedDate, onDateSelect, onMonthChange, activities, showActivities, className, }: CalendarProps) => react_jsx_runtime.JSX.Element;
|
|
59
|
+
|
|
60
|
+
export { type ActivityStatus, type CalendarActivity, type CalendarDay, type CalendarProps, type CalendarVariant, WEEK_DAYS, Calendar as default };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Activity status types for calendar days
|
|
5
|
+
*/
|
|
6
|
+
type ActivityStatus = 'near-deadline' | 'overdue' | 'in-deadline';
|
|
7
|
+
/**
|
|
8
|
+
* Activity data for a specific day
|
|
9
|
+
*/
|
|
10
|
+
interface CalendarActivity {
|
|
11
|
+
id: string;
|
|
12
|
+
status: ActivityStatus;
|
|
13
|
+
title?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Calendar day data
|
|
17
|
+
*/
|
|
18
|
+
interface CalendarDay {
|
|
19
|
+
date: Date;
|
|
20
|
+
isCurrentMonth: boolean;
|
|
21
|
+
isToday: boolean;
|
|
22
|
+
isSelected: boolean;
|
|
23
|
+
activities?: CalendarActivity[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Calendar variant types
|
|
27
|
+
*/
|
|
28
|
+
type CalendarVariant = 'navigation' | 'selection';
|
|
29
|
+
/**
|
|
30
|
+
* Calendar component props
|
|
31
|
+
*/
|
|
32
|
+
interface CalendarProps {
|
|
33
|
+
/** Calendar variant - navigation (compact) or selection (full) */
|
|
34
|
+
variant?: CalendarVariant;
|
|
35
|
+
/** Currently selected date */
|
|
36
|
+
selectedDate?: Date;
|
|
37
|
+
/** Function called when a date is selected */
|
|
38
|
+
onDateSelect?: (date: Date) => void;
|
|
39
|
+
/** Function called when month changes */
|
|
40
|
+
onMonthChange?: (date: Date) => void;
|
|
41
|
+
/** Activities data for calendar days */
|
|
42
|
+
activities?: Record<string, CalendarActivity[]>;
|
|
43
|
+
/** Show activities indicators */
|
|
44
|
+
showActivities?: boolean;
|
|
45
|
+
/** Additional CSS classes */
|
|
46
|
+
className?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Day names abbreviations
|
|
50
|
+
*/
|
|
51
|
+
declare const WEEK_DAYS: string[];
|
|
52
|
+
/**
|
|
53
|
+
* Calendar component for Analytica Ensino platforms
|
|
54
|
+
*
|
|
55
|
+
* A comprehensive calendar component with activity indicators,
|
|
56
|
+
* date selection, and navigation capabilities.
|
|
57
|
+
*/
|
|
58
|
+
declare const Calendar: ({ variant, selectedDate, onDateSelect, onMonthChange, activities, showActivities, className, }: CalendarProps) => react_jsx_runtime.JSX.Element;
|
|
59
|
+
|
|
60
|
+
export { type ActivityStatus, type CalendarActivity, type CalendarDay, type CalendarProps, type CalendarVariant, WEEK_DAYS, Calendar as default };
|
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/Calendar/Calendar.tsx
|
|
21
|
+
var Calendar_exports = {};
|
|
22
|
+
__export(Calendar_exports, {
|
|
23
|
+
WEEK_DAYS: () => WEEK_DAYS,
|
|
24
|
+
default: () => Calendar_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(Calendar_exports);
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var WEEK_DAYS = ["SEG", "TER", "QUA", "QUI", "SEX", "S\xC1B", "DOM"];
|
|
30
|
+
var WEEK_DAYS_SHORT = ["S", "T", "Q", "Q", "S", "S", "D"];
|
|
31
|
+
var MONTH_NAMES = [
|
|
32
|
+
"Janeiro",
|
|
33
|
+
"Fevereiro",
|
|
34
|
+
"Mar\xE7o",
|
|
35
|
+
"Abril",
|
|
36
|
+
"Maio",
|
|
37
|
+
"Junho",
|
|
38
|
+
"Julho",
|
|
39
|
+
"Agosto",
|
|
40
|
+
"Setembro",
|
|
41
|
+
"Outubro",
|
|
42
|
+
"Novembro",
|
|
43
|
+
"Dezembro"
|
|
44
|
+
];
|
|
45
|
+
var MonthYearPicker = ({
|
|
46
|
+
monthPickerRef,
|
|
47
|
+
availableYears,
|
|
48
|
+
currentDate,
|
|
49
|
+
onYearChange,
|
|
50
|
+
onMonthChange
|
|
51
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
ref: monthPickerRef,
|
|
55
|
+
className: "absolute top-full left-0 z-50 mt-1 bg-white rounded-lg shadow-lg border border-border-200 p-4 min-w-[280px]",
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mb-4", children: [
|
|
58
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-sm font-medium text-text-700 mb-2", children: "Selecionar Ano" }),
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-4 gap-1 max-h-32 overflow-y-auto", children: availableYears.map((year) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
"button",
|
|
61
|
+
{
|
|
62
|
+
onClick: () => onYearChange(year),
|
|
63
|
+
className: `
|
|
64
|
+
px-2 py-1 text-xs rounded text-center hover:bg-background-100 transition-colors
|
|
65
|
+
${year === currentDate.getFullYear() ? "bg-primary-800 text-text font-medium hover:text-text-950" : "text-text-700"}
|
|
66
|
+
`,
|
|
67
|
+
children: year
|
|
68
|
+
},
|
|
69
|
+
year
|
|
70
|
+
)) })
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-sm font-medium text-text-700 mb-2", children: "Selecionar M\xEAs" }),
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-3 gap-1", children: MONTH_NAMES.map((month, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
|
+
"button",
|
|
76
|
+
{
|
|
77
|
+
onClick: () => onMonthChange(index, currentDate.getFullYear()),
|
|
78
|
+
className: `
|
|
79
|
+
px-2 py-2 text-xs rounded text-center hover:bg-background-100 transition-colors
|
|
80
|
+
${index === currentDate.getMonth() ? "bg-primary-800 text-text font-medium hover:text-text-950" : "text-text-700"}
|
|
81
|
+
`,
|
|
82
|
+
children: month.substring(0, 3)
|
|
83
|
+
},
|
|
84
|
+
month
|
|
85
|
+
)) })
|
|
86
|
+
] })
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
var getDayStyles = (day, variant, showActivities) => {
|
|
91
|
+
let dayStyle = "";
|
|
92
|
+
let textStyle = "";
|
|
93
|
+
if (variant === "selection" && day.isSelected) {
|
|
94
|
+
dayStyle = "bg-primary-800";
|
|
95
|
+
textStyle = "text-white";
|
|
96
|
+
} else if (day.isToday) {
|
|
97
|
+
textStyle = "text-[#1c61b2]";
|
|
98
|
+
} else if (variant === "navigation" && showActivities && day.activities?.length) {
|
|
99
|
+
const primaryActivity = day.activities[0];
|
|
100
|
+
if (primaryActivity.status === "near-deadline") {
|
|
101
|
+
dayStyle = "bg-warning-background border-2 border-warning-400";
|
|
102
|
+
textStyle = "text-text-950";
|
|
103
|
+
} else if (primaryActivity.status === "in-deadline") {
|
|
104
|
+
dayStyle = "bg-success-background border-2 border-success-300";
|
|
105
|
+
textStyle = "text-text-950";
|
|
106
|
+
} else if (primaryActivity.status === "overdue") {
|
|
107
|
+
dayStyle = "bg-error-background border-2 border-error-300";
|
|
108
|
+
textStyle = "text-text-950";
|
|
109
|
+
} else {
|
|
110
|
+
dayStyle = "border-2 border-blue-500";
|
|
111
|
+
textStyle = "text-blue-500";
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
textStyle = "text-text-950 hover:bg-background-100";
|
|
115
|
+
}
|
|
116
|
+
return { dayStyle, textStyle };
|
|
117
|
+
};
|
|
118
|
+
var Calendar = ({
|
|
119
|
+
variant = "selection",
|
|
120
|
+
selectedDate,
|
|
121
|
+
onDateSelect,
|
|
122
|
+
onMonthChange,
|
|
123
|
+
activities = {},
|
|
124
|
+
showActivities = true,
|
|
125
|
+
className = ""
|
|
126
|
+
}) => {
|
|
127
|
+
const [currentDate, setCurrentDate] = (0, import_react.useState)(selectedDate || /* @__PURE__ */ new Date());
|
|
128
|
+
const [isMonthPickerOpen, setIsMonthPickerOpen] = (0, import_react.useState)(false);
|
|
129
|
+
const monthPickerRef = (0, import_react.useRef)(null);
|
|
130
|
+
const monthPickerContainerRef = (0, import_react.useRef)(null);
|
|
131
|
+
(0, import_react.useEffect)(() => {
|
|
132
|
+
const handleClickOutside = (event) => {
|
|
133
|
+
if (monthPickerContainerRef.current && !monthPickerContainerRef.current.contains(event.target)) {
|
|
134
|
+
setIsMonthPickerOpen(false);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
if (isMonthPickerOpen) {
|
|
138
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
139
|
+
}
|
|
140
|
+
return () => {
|
|
141
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
142
|
+
};
|
|
143
|
+
}, [isMonthPickerOpen]);
|
|
144
|
+
const today = /* @__PURE__ */ new Date();
|
|
145
|
+
const availableYears = (0, import_react.useMemo)(() => {
|
|
146
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
147
|
+
const years = [];
|
|
148
|
+
for (let year = currentYear - 10; year <= currentYear + 10; year++) {
|
|
149
|
+
years.push(year);
|
|
150
|
+
}
|
|
151
|
+
return years;
|
|
152
|
+
}, []);
|
|
153
|
+
const calendarData = (0, import_react.useMemo)(() => {
|
|
154
|
+
const year = currentDate.getFullYear();
|
|
155
|
+
const month = currentDate.getMonth();
|
|
156
|
+
const firstDay = new Date(year, month, 1);
|
|
157
|
+
const startDate = new Date(firstDay);
|
|
158
|
+
const firstDayOfWeek = (firstDay.getDay() + 6) % 7;
|
|
159
|
+
startDate.setDate(startDate.getDate() - firstDayOfWeek);
|
|
160
|
+
const days = [];
|
|
161
|
+
const currentCalendarDate = new Date(startDate);
|
|
162
|
+
for (let i = 0; i < 42; i++) {
|
|
163
|
+
const dateKey = currentCalendarDate.toISOString().split("T")[0];
|
|
164
|
+
const dayActivities = activities[dateKey] || [];
|
|
165
|
+
days.push({
|
|
166
|
+
date: new Date(currentCalendarDate),
|
|
167
|
+
isCurrentMonth: currentCalendarDate.getMonth() === month,
|
|
168
|
+
isToday: currentCalendarDate.getFullYear() === today.getFullYear() && currentCalendarDate.getMonth() === today.getMonth() && currentCalendarDate.getDate() === today.getDate(),
|
|
169
|
+
isSelected: selectedDate ? currentCalendarDate.getFullYear() === selectedDate.getFullYear() && currentCalendarDate.getMonth() === selectedDate.getMonth() && currentCalendarDate.getDate() === selectedDate.getDate() : false,
|
|
170
|
+
activities: dayActivities
|
|
171
|
+
});
|
|
172
|
+
currentCalendarDate.setDate(currentCalendarDate.getDate() + 1);
|
|
173
|
+
}
|
|
174
|
+
return days;
|
|
175
|
+
}, [currentDate, selectedDate, activities]);
|
|
176
|
+
const goToPreviousMonth = () => {
|
|
177
|
+
const newDate = new Date(currentDate);
|
|
178
|
+
newDate.setMonth(newDate.getMonth() - 1);
|
|
179
|
+
setCurrentDate(newDate);
|
|
180
|
+
onMonthChange?.(newDate);
|
|
181
|
+
};
|
|
182
|
+
const goToNextMonth = () => {
|
|
183
|
+
const newDate = new Date(currentDate);
|
|
184
|
+
newDate.setMonth(newDate.getMonth() + 1);
|
|
185
|
+
setCurrentDate(newDate);
|
|
186
|
+
onMonthChange?.(newDate);
|
|
187
|
+
};
|
|
188
|
+
const goToMonth = (month, year) => {
|
|
189
|
+
const newDate = new Date(year, month, 1);
|
|
190
|
+
setCurrentDate(newDate);
|
|
191
|
+
setIsMonthPickerOpen(false);
|
|
192
|
+
onMonthChange?.(newDate);
|
|
193
|
+
};
|
|
194
|
+
const handleYearChange = (year) => {
|
|
195
|
+
const newDate = new Date(year, currentDate.getMonth(), 1);
|
|
196
|
+
setCurrentDate(newDate);
|
|
197
|
+
};
|
|
198
|
+
const toggleMonthPicker = (event) => {
|
|
199
|
+
event.stopPropagation();
|
|
200
|
+
setIsMonthPickerOpen(!isMonthPickerOpen);
|
|
201
|
+
};
|
|
202
|
+
const handleDateSelect = (day) => {
|
|
203
|
+
onDateSelect?.(day.date);
|
|
204
|
+
};
|
|
205
|
+
if (variant === "navigation") {
|
|
206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `bg-background rounded-xl p-3 ${className}`, children: [
|
|
207
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between mb-4 px-6", children: [
|
|
208
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative", ref: monthPickerContainerRef, children: [
|
|
209
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
210
|
+
"button",
|
|
211
|
+
{
|
|
212
|
+
onClick: toggleMonthPicker,
|
|
213
|
+
className: "flex items-center gap-1 hover:bg-background-100 rounded px-2 py-1 transition-colors",
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "text-sm font-medium text-text-600", children: [
|
|
216
|
+
MONTH_NAMES[currentDate.getMonth()],
|
|
217
|
+
" ",
|
|
218
|
+
currentDate.getFullYear()
|
|
219
|
+
] }),
|
|
220
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
221
|
+
"svg",
|
|
222
|
+
{
|
|
223
|
+
className: `w-4 h-4 text-primary-950 transition-transform ${isMonthPickerOpen ? "rotate-180" : ""}`,
|
|
224
|
+
fill: "none",
|
|
225
|
+
stroke: "currentColor",
|
|
226
|
+
viewBox: "0 0 24 24",
|
|
227
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
228
|
+
"path",
|
|
229
|
+
{
|
|
230
|
+
strokeLinecap: "round",
|
|
231
|
+
strokeLinejoin: "round",
|
|
232
|
+
strokeWidth: 2,
|
|
233
|
+
d: "M19 9l-7 7-7-7"
|
|
234
|
+
}
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
isMonthPickerOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
242
|
+
MonthYearPicker,
|
|
243
|
+
{
|
|
244
|
+
monthPickerRef,
|
|
245
|
+
availableYears,
|
|
246
|
+
currentDate,
|
|
247
|
+
onYearChange: handleYearChange,
|
|
248
|
+
onMonthChange: goToMonth
|
|
249
|
+
}
|
|
250
|
+
)
|
|
251
|
+
] }),
|
|
252
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-10", children: [
|
|
253
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
254
|
+
"button",
|
|
255
|
+
{
|
|
256
|
+
onClick: goToPreviousMonth,
|
|
257
|
+
className: "p-1 rounded hover:bg-background-100 transition-colors",
|
|
258
|
+
"aria-label": "M\xEAs anterior",
|
|
259
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
260
|
+
"svg",
|
|
261
|
+
{
|
|
262
|
+
className: "w-6 h-6 text-primary-950",
|
|
263
|
+
fill: "none",
|
|
264
|
+
stroke: "currentColor",
|
|
265
|
+
viewBox: "0 0 24 24",
|
|
266
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
267
|
+
"path",
|
|
268
|
+
{
|
|
269
|
+
strokeLinecap: "round",
|
|
270
|
+
strokeLinejoin: "round",
|
|
271
|
+
strokeWidth: 2,
|
|
272
|
+
d: "M15 19l-7-7 7-7"
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
280
|
+
"button",
|
|
281
|
+
{
|
|
282
|
+
onClick: goToNextMonth,
|
|
283
|
+
className: "p-1 rounded hover:bg-background-100 transition-colors",
|
|
284
|
+
"aria-label": "Pr\xF3ximo m\xEAs",
|
|
285
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
286
|
+
"svg",
|
|
287
|
+
{
|
|
288
|
+
className: "w-6 h-6 text-primary-950",
|
|
289
|
+
fill: "none",
|
|
290
|
+
stroke: "currentColor",
|
|
291
|
+
viewBox: "0 0 24 24",
|
|
292
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
293
|
+
"path",
|
|
294
|
+
{
|
|
295
|
+
strokeLinecap: "round",
|
|
296
|
+
strokeLinejoin: "round",
|
|
297
|
+
strokeWidth: 2,
|
|
298
|
+
d: "M9 5l7 7-7 7"
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
}
|
|
302
|
+
)
|
|
303
|
+
}
|
|
304
|
+
)
|
|
305
|
+
] })
|
|
306
|
+
] }),
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-7 gap-1 mb-2", children: WEEK_DAYS_SHORT.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
308
|
+
"div",
|
|
309
|
+
{
|
|
310
|
+
className: "h-9 flex items-center justify-center text-xs font-normal text-text-600",
|
|
311
|
+
children: day
|
|
312
|
+
},
|
|
313
|
+
`${day}-${index}`
|
|
314
|
+
)) }),
|
|
315
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-7 gap-1", children: calendarData.map((day) => {
|
|
316
|
+
if (!day.isCurrentMonth) {
|
|
317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
318
|
+
"div",
|
|
319
|
+
{
|
|
320
|
+
className: "flex items-center justify-center",
|
|
321
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "w-9 h-9" })
|
|
322
|
+
},
|
|
323
|
+
day.date.getTime()
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
const { dayStyle, textStyle } = getDayStyles(
|
|
327
|
+
day,
|
|
328
|
+
variant,
|
|
329
|
+
showActivities
|
|
330
|
+
);
|
|
331
|
+
let spanClass = "";
|
|
332
|
+
if (day.isSelected && day.isToday) {
|
|
333
|
+
spanClass = "h-6 w-6 rounded-full bg-[#1c61b2] text-text";
|
|
334
|
+
} else if (day.isSelected) {
|
|
335
|
+
spanClass = "h-6 w-6 rounded-full bg-primary-950 text-text";
|
|
336
|
+
}
|
|
337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
338
|
+
"div",
|
|
339
|
+
{
|
|
340
|
+
className: "flex items-center justify-center",
|
|
341
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
342
|
+
"button",
|
|
343
|
+
{
|
|
344
|
+
className: `
|
|
345
|
+
w-9 h-9
|
|
346
|
+
flex items-center justify-center
|
|
347
|
+
text-md font-normal
|
|
348
|
+
cursor-pointer
|
|
349
|
+
rounded-full
|
|
350
|
+
${dayStyle}
|
|
351
|
+
${textStyle}
|
|
352
|
+
`,
|
|
353
|
+
onClick: () => handleDateSelect(day),
|
|
354
|
+
"aria-label": `${day.date.getDate()} de ${MONTH_NAMES[day.date.getMonth()]}`,
|
|
355
|
+
"aria-current": day.isToday ? "date" : void 0,
|
|
356
|
+
tabIndex: 0,
|
|
357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: spanClass, children: day.date.getDate() })
|
|
358
|
+
}
|
|
359
|
+
)
|
|
360
|
+
},
|
|
361
|
+
day.date.getTime()
|
|
362
|
+
);
|
|
363
|
+
}) })
|
|
364
|
+
] });
|
|
365
|
+
}
|
|
366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `bg-background rounded-xl p-4 ${className}`, children: [
|
|
367
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between mb-3.5", children: [
|
|
368
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative", ref: monthPickerContainerRef, children: [
|
|
369
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
370
|
+
"button",
|
|
371
|
+
{
|
|
372
|
+
onClick: toggleMonthPicker,
|
|
373
|
+
className: "flex items-center gap-2 hover:bg-background-100 rounded px-2 py-1 transition-colors",
|
|
374
|
+
children: [
|
|
375
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h2", { className: "text-lg font-semibold text-text-950", children: [
|
|
376
|
+
MONTH_NAMES[currentDate.getMonth()],
|
|
377
|
+
" ",
|
|
378
|
+
currentDate.getFullYear()
|
|
379
|
+
] }),
|
|
380
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
381
|
+
"svg",
|
|
382
|
+
{
|
|
383
|
+
className: `w-4 h-4 text-text-400 transition-transform ${isMonthPickerOpen ? "rotate-180" : ""}`,
|
|
384
|
+
fill: "none",
|
|
385
|
+
stroke: "currentColor",
|
|
386
|
+
viewBox: "0 0 24 24",
|
|
387
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
388
|
+
"path",
|
|
389
|
+
{
|
|
390
|
+
strokeLinecap: "round",
|
|
391
|
+
strokeLinejoin: "round",
|
|
392
|
+
strokeWidth: 2,
|
|
393
|
+
d: "M19 9l-7 7-7-7"
|
|
394
|
+
}
|
|
395
|
+
)
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
),
|
|
401
|
+
isMonthPickerOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
402
|
+
MonthYearPicker,
|
|
403
|
+
{
|
|
404
|
+
monthPickerRef,
|
|
405
|
+
availableYears,
|
|
406
|
+
currentDate,
|
|
407
|
+
onYearChange: handleYearChange,
|
|
408
|
+
onMonthChange: goToMonth
|
|
409
|
+
}
|
|
410
|
+
)
|
|
411
|
+
] }),
|
|
412
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
413
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
414
|
+
"button",
|
|
415
|
+
{
|
|
416
|
+
onClick: goToPreviousMonth,
|
|
417
|
+
className: "p-1 rounded-md hover:bg-background-100 transition-colors",
|
|
418
|
+
"aria-label": "M\xEAs anterior",
|
|
419
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
420
|
+
"svg",
|
|
421
|
+
{
|
|
422
|
+
className: "w-6 h-6 text-primary-950",
|
|
423
|
+
fill: "none",
|
|
424
|
+
stroke: "currentColor",
|
|
425
|
+
viewBox: "0 0 24 24",
|
|
426
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
427
|
+
"path",
|
|
428
|
+
{
|
|
429
|
+
strokeLinecap: "round",
|
|
430
|
+
strokeLinejoin: "round",
|
|
431
|
+
strokeWidth: 2,
|
|
432
|
+
d: "M15 19l-7-7 7-7"
|
|
433
|
+
}
|
|
434
|
+
)
|
|
435
|
+
}
|
|
436
|
+
)
|
|
437
|
+
}
|
|
438
|
+
),
|
|
439
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
440
|
+
"button",
|
|
441
|
+
{
|
|
442
|
+
onClick: goToNextMonth,
|
|
443
|
+
className: "p-1 rounded-md hover:bg-background-100 transition-colors",
|
|
444
|
+
"aria-label": "Pr\xF3ximo m\xEAs",
|
|
445
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
446
|
+
"svg",
|
|
447
|
+
{
|
|
448
|
+
className: "w-6 h-6 text-primary-950",
|
|
449
|
+
fill: "none",
|
|
450
|
+
stroke: "currentColor",
|
|
451
|
+
viewBox: "0 0 24 24",
|
|
452
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
453
|
+
"path",
|
|
454
|
+
{
|
|
455
|
+
strokeLinecap: "round",
|
|
456
|
+
strokeLinejoin: "round",
|
|
457
|
+
strokeWidth: 2,
|
|
458
|
+
d: "M9 5l7 7-7 7"
|
|
459
|
+
}
|
|
460
|
+
)
|
|
461
|
+
}
|
|
462
|
+
)
|
|
463
|
+
}
|
|
464
|
+
)
|
|
465
|
+
] })
|
|
466
|
+
] }),
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-7 gap-1 mb-2", children: WEEK_DAYS.map((day) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
468
|
+
"div",
|
|
469
|
+
{
|
|
470
|
+
className: "h-4 flex items-center justify-center text-xs font-semibold text-text-500",
|
|
471
|
+
children: day
|
|
472
|
+
},
|
|
473
|
+
day
|
|
474
|
+
)) }),
|
|
475
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-7 gap-1", children: calendarData.map((day) => {
|
|
476
|
+
if (!day.isCurrentMonth) {
|
|
477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
478
|
+
"div",
|
|
479
|
+
{
|
|
480
|
+
className: "flex items-center justify-center",
|
|
481
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "w-10 h-10" })
|
|
482
|
+
},
|
|
483
|
+
day.date.getTime()
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
const { dayStyle, textStyle } = getDayStyles(
|
|
487
|
+
day,
|
|
488
|
+
variant,
|
|
489
|
+
showActivities
|
|
490
|
+
);
|
|
491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
492
|
+
"div",
|
|
493
|
+
{
|
|
494
|
+
className: "flex items-center justify-center",
|
|
495
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
496
|
+
"button",
|
|
497
|
+
{
|
|
498
|
+
className: `
|
|
499
|
+
w-10 h-10
|
|
500
|
+
flex items-center justify-center
|
|
501
|
+
text-xl font-normal
|
|
502
|
+
cursor-pointer
|
|
503
|
+
rounded-full
|
|
504
|
+
focus:outline-none focus:ring-2 focus:ring-primary-600 focus:ring-offset-1
|
|
505
|
+
${dayStyle}
|
|
506
|
+
${textStyle}
|
|
507
|
+
`,
|
|
508
|
+
onClick: () => handleDateSelect(day),
|
|
509
|
+
"aria-label": `${day.date.getDate()} de ${MONTH_NAMES[day.date.getMonth()]}`,
|
|
510
|
+
"aria-current": day.isToday ? "date" : void 0,
|
|
511
|
+
tabIndex: 0,
|
|
512
|
+
children: day.date.getDate()
|
|
513
|
+
}
|
|
514
|
+
)
|
|
515
|
+
},
|
|
516
|
+
day.date.getTime()
|
|
517
|
+
);
|
|
518
|
+
}) })
|
|
519
|
+
] });
|
|
520
|
+
};
|
|
521
|
+
var Calendar_default = Calendar;
|
|
522
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
523
|
+
0 && (module.exports = {
|
|
524
|
+
WEEK_DAYS
|
|
525
|
+
});
|
|
526
|
+
//# sourceMappingURL=index.js.map
|