react-attendance-calendar 2.3.3 → 2.3.5
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/README.md +167 -38
- package/dist/AttendanceCalendar.d.ts +1 -1
- package/dist/AttendanceCalendar.d.ts.map +1 -1
- package/dist/index.js +60 -60
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
# React Attendance Calendar
|
|
2
2
|
|
|
3
|
-
A modern, customizable attendance calendar component for React with TypeScript support.
|
|
3
|
+
A modern, responsive, and highly customizable attendance calendar component for React with full TypeScript support. Perfect for tracking employee attendance, student presence, or any date-based status system.
|
|
4
4
|
|
|
5
5
|
## ✨ Features
|
|
6
6
|
|
|
7
|
-
- 📅 Responsive design
|
|
8
|
-
- 🎨 Fully customizable with Tailwind CSS classes
|
|
9
|
-
- 🖱️ Interactive
|
|
10
|
-
- 📱 Mobile-friendly
|
|
11
|
-
- 🔧 TypeScript support
|
|
12
|
-
- 🎭 Beautiful
|
|
7
|
+
- 📅 **Responsive design** - Automatically switches between 7-14 columns based on container width
|
|
8
|
+
- 🎨 **Fully customizable** - Complete control with Tailwind CSS classes
|
|
9
|
+
- 🖱️ **Interactive** - Date click callbacks with hover effects
|
|
10
|
+
- 📱 **Mobile-friendly** - Responsive grid layout with touch-friendly interactions
|
|
11
|
+
- 🔧 **TypeScript support** - Full type safety and IntelliSense
|
|
12
|
+
- 🎭 **Beautiful defaults** - Modern design with emerald/amber color scheme
|
|
13
|
+
- 📊 **Multi-month support** - Provide attendance data for multiple months at once
|
|
14
|
+
- 🔄 **Flexible data format** - Support both single month and array of months
|
|
15
|
+
- ⚡ **Auto-initialization** - Defaults to current month if no view provided
|
|
16
|
+
- 🎯 **Smart navigation** - Seamless month/year transitions
|
|
13
17
|
|
|
14
18
|
## 📦 Installation
|
|
15
19
|
|
|
@@ -46,7 +50,20 @@ function App() {
|
|
|
46
50
|
}
|
|
47
51
|
```
|
|
48
52
|
|
|
49
|
-
###
|
|
53
|
+
### Minimal Example (Auto-initialize to current month)
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { AttendanceCalendar } from "react-attendance-calendar";
|
|
57
|
+
import "react-attendance-calendar/styles.css";
|
|
58
|
+
|
|
59
|
+
function App() {
|
|
60
|
+
const [view, setView] = useState();
|
|
61
|
+
|
|
62
|
+
return <AttendanceCalendar onChangeView={setView} />;
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### With Single Month Attendance Data
|
|
50
67
|
|
|
51
68
|
```tsx
|
|
52
69
|
import { AttendanceCalendar } from "react-attendance-calendar";
|
|
@@ -67,6 +84,42 @@ const attendanceData = {
|
|
|
67
84
|
/>;
|
|
68
85
|
```
|
|
69
86
|
|
|
87
|
+
### With Multiple Months Attendance Data
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
import { AttendanceCalendar } from "react-attendance-calendar";
|
|
91
|
+
import "react-attendance-calendar/styles.css";
|
|
92
|
+
|
|
93
|
+
// Provide data for multiple months at once
|
|
94
|
+
const attendanceData = [
|
|
95
|
+
// January 2024
|
|
96
|
+
{
|
|
97
|
+
year: 2024,
|
|
98
|
+
monthIndex: 0,
|
|
99
|
+
presentDays: new Set([
|
|
100
|
+
1, 2, 3, 5, 8, 9, 10, 12, 15, 16, 17, 19, 22, 23, 24, 26, 29, 30, 31,
|
|
101
|
+
]),
|
|
102
|
+
absentDays: new Set([4, 11, 18, 25]),
|
|
103
|
+
},
|
|
104
|
+
// February 2025
|
|
105
|
+
{
|
|
106
|
+
year: 2025,
|
|
107
|
+
monthIndex: 1,
|
|
108
|
+
presentDays: new Set([
|
|
109
|
+
1, 2, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 26, 27, 28,
|
|
110
|
+
]),
|
|
111
|
+
absentDays: new Set([3, 10, 17, 24]),
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
<AttendanceCalendar
|
|
116
|
+
view={view}
|
|
117
|
+
onChangeView={setView}
|
|
118
|
+
attendanceData={attendanceData}
|
|
119
|
+
onDateClick={(day, month, year) => console.log(day, month, year)}
|
|
120
|
+
/>;
|
|
121
|
+
```
|
|
122
|
+
|
|
70
123
|
### Custom Styling
|
|
71
124
|
|
|
72
125
|
```tsx
|
|
@@ -96,15 +149,27 @@ function App() {
|
|
|
96
149
|
monthIndex: 0, // January
|
|
97
150
|
});
|
|
98
151
|
|
|
99
|
-
// Sample attendance data
|
|
100
|
-
const attendanceData: AttendanceData =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
152
|
+
// Sample attendance data for multiple months
|
|
153
|
+
const attendanceData: AttendanceData = [
|
|
154
|
+
// January 2024
|
|
155
|
+
{
|
|
156
|
+
year: 2024,
|
|
157
|
+
monthIndex: 0,
|
|
158
|
+
presentDays: new Set([
|
|
159
|
+
1, 2, 3, 5, 8, 9, 10, 12, 15, 16, 17, 19, 22, 23, 24, 26, 29, 30, 31,
|
|
160
|
+
]),
|
|
161
|
+
absentDays: new Set([4, 11, 18, 25]),
|
|
162
|
+
},
|
|
163
|
+
// February 2025
|
|
164
|
+
{
|
|
165
|
+
year: 2025,
|
|
166
|
+
monthIndex: 1,
|
|
167
|
+
presentDays: new Set([
|
|
168
|
+
1, 2, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 26, 27, 28,
|
|
169
|
+
]),
|
|
170
|
+
absentDays: new Set([3, 10, 17, 24]),
|
|
171
|
+
},
|
|
172
|
+
];
|
|
108
173
|
|
|
109
174
|
const handleDateClick = (day: number, month: number, year: number) => {
|
|
110
175
|
console.log(`Clicked on ${day}/${month + 1}/${year}`);
|
|
@@ -137,22 +202,22 @@ export default App;
|
|
|
137
202
|
|
|
138
203
|
## 📚 Props
|
|
139
204
|
|
|
140
|
-
| Prop | Type | Required | Description
|
|
141
|
-
| --------------------------- | ---------------------------- | -------- |
|
|
142
|
-
| `view` | `MonthView` |
|
|
143
|
-
| `onChangeView` | `(view: MonthView) => void` | ✅ | Month navigation callback
|
|
144
|
-
| `attendanceData` | `AttendanceData` | ❌ | Present/absent days data
|
|
145
|
-
| `onDateClick` | `(day, month, year) => void` | ❌ | Date click callback
|
|
146
|
-
| `showNavigation` | `boolean` | ❌ | Show nav arrows (default: `true`)
|
|
147
|
-
| `showWeekdayHeaders` | `boolean` | ❌ | Show weekday headers (default: `true`)
|
|
148
|
-
| `className` | `string` | ❌ | Additional classes for root element
|
|
149
|
-
| `cellClassName` | `string` | ❌ | Custom classes for all cells
|
|
150
|
-
| `presentCellClassName` | `string` | ❌ | Custom classes for present days
|
|
151
|
-
| `absentCellClassName` | `string` | ❌ | Custom classes for absent days
|
|
152
|
-
| `navigationButtonClassName` | `string` | ❌ | Custom classes for nav buttons
|
|
153
|
-
| `monthTitleClassName` | `string` | ❌ | Custom classes for month title
|
|
154
|
-
| `weekdayHeaderClassName` | `string` | ❌ | Custom classes for weekday headers
|
|
155
|
-
| `containerClassName` | `string` | ❌ | Custom classes for main container
|
|
205
|
+
| Prop | Type | Required | Description |
|
|
206
|
+
| --------------------------- | ---------------------------- | -------- | -------------------------------------------------- |
|
|
207
|
+
| `view` | `MonthView` | ❌ | Current month and year (defaults to current month) |
|
|
208
|
+
| `onChangeView` | `(view: MonthView) => void` | ✅ | Month navigation callback |
|
|
209
|
+
| `attendanceData` | `AttendanceData` | ❌ | Present/absent days data (single month or array) |
|
|
210
|
+
| `onDateClick` | `(day, month, year) => void` | ❌ | Date click callback |
|
|
211
|
+
| `showNavigation` | `boolean` | ❌ | Show nav arrows (default: `true`) |
|
|
212
|
+
| `showWeekdayHeaders` | `boolean` | ❌ | Show weekday headers (default: `true`) |
|
|
213
|
+
| `className` | `string` | ❌ | Additional classes for root element |
|
|
214
|
+
| `cellClassName` | `string` | ❌ | Custom classes for all cells |
|
|
215
|
+
| `presentCellClassName` | `string` | ❌ | Custom classes for present days |
|
|
216
|
+
| `absentCellClassName` | `string` | ❌ | Custom classes for absent days |
|
|
217
|
+
| `navigationButtonClassName` | `string` | ❌ | Custom classes for nav buttons |
|
|
218
|
+
| `monthTitleClassName` | `string` | ❌ | Custom classes for month title |
|
|
219
|
+
| `weekdayHeaderClassName` | `string` | ❌ | Custom classes for weekday headers |
|
|
220
|
+
| `containerClassName` | `string` | ❌ | Custom classes for main container |
|
|
156
221
|
|
|
157
222
|
### TypeScript
|
|
158
223
|
|
|
@@ -162,22 +227,86 @@ type MonthView = {
|
|
|
162
227
|
monthIndex: number; // 0-11 (0 = January)
|
|
163
228
|
};
|
|
164
229
|
|
|
165
|
-
type
|
|
230
|
+
type MonthAttendanceData = {
|
|
166
231
|
year: number;
|
|
167
232
|
monthIndex: number;
|
|
168
233
|
presentDays: Set<number>; // Day numbers 1-31
|
|
169
234
|
absentDays: Set<number>; // Day numbers 1-31
|
|
170
235
|
};
|
|
236
|
+
|
|
237
|
+
// Support both single month and multiple months
|
|
238
|
+
type AttendanceData = MonthAttendanceData | MonthAttendanceData[];
|
|
171
239
|
```
|
|
172
240
|
|
|
173
241
|
## 🎨 Styling
|
|
174
242
|
|
|
175
|
-
The component uses Tailwind CSS classes
|
|
243
|
+
The component uses Tailwind CSS classes with a modern design system:
|
|
244
|
+
|
|
245
|
+
### Default Theme
|
|
246
|
+
|
|
247
|
+
- **Present days**: Emerald green (`emerald-500`) with white text
|
|
248
|
+
- **Absent days**: Amber orange (`amber-500`) with white text
|
|
249
|
+
- **Regular days**: Slate gray (`slate-700`) with light border
|
|
250
|
+
- **Navigation**: Rounded buttons with hover effects
|
|
251
|
+
- **Typography**: Clean, readable fonts with proper hierarchy
|
|
252
|
+
|
|
253
|
+
### Responsive Behavior
|
|
254
|
+
|
|
255
|
+
- **Desktop**: 7 columns with larger cells (`size-12 sm:size-14`)
|
|
256
|
+
- **Wide screens**: 14 columns with smaller cells (`size-8 sm:size-12`)
|
|
257
|
+
- **Mobile**: Optimized touch targets and spacing
|
|
258
|
+
|
|
259
|
+
### Customization
|
|
260
|
+
|
|
261
|
+
Override any styling using the `className` props. All Tailwind classes are supported:
|
|
262
|
+
|
|
263
|
+
- Colors, spacing, borders, shadows
|
|
264
|
+
- Hover effects, transitions, animations
|
|
265
|
+
- Responsive breakpoints and utilities
|
|
266
|
+
|
|
267
|
+
## 🔄 Multi-Month Data Format
|
|
268
|
+
|
|
269
|
+
The `attendanceData` prop supports two formats:
|
|
270
|
+
|
|
271
|
+
### Single Month (Legacy Format)
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
const attendanceData: AttendanceData = {
|
|
275
|
+
year: 2024,
|
|
276
|
+
monthIndex: 0,
|
|
277
|
+
presentDays: new Set([1, 2, 3, 5, 8]),
|
|
278
|
+
absentDays: new Set([4, 6, 7]),
|
|
279
|
+
};
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Multiple Months (New Format)
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
const attendanceData: AttendanceData = [
|
|
286
|
+
{
|
|
287
|
+
year: 2024,
|
|
288
|
+
monthIndex: 0, // January
|
|
289
|
+
presentDays: new Set([1, 2, 3, 5, 8]),
|
|
290
|
+
absentDays: new Set([4, 6, 7]),
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
year: 2024,
|
|
294
|
+
monthIndex: 1, // February
|
|
295
|
+
presentDays: new Set([1, 2, 5, 6, 7]),
|
|
296
|
+
absentDays: new Set([3, 4, 8]),
|
|
297
|
+
},
|
|
298
|
+
// ... add more months as needed
|
|
299
|
+
];
|
|
300
|
+
```
|
|
176
301
|
|
|
177
|
-
|
|
178
|
-
- Absent days: Orange (`amber-500`)
|
|
302
|
+
**Benefits of Multi-Month Format:**
|
|
179
303
|
|
|
180
|
-
|
|
304
|
+
- ✅ **Batch loading** - Load attendance data for multiple months at once
|
|
305
|
+
- ✅ **Better performance** - No need to fetch data when navigating between months
|
|
306
|
+
- ✅ **Seamless navigation** - Smooth transitions between months with data
|
|
307
|
+
- ✅ **Backward compatible** - Works with existing single month format
|
|
308
|
+
- ✅ **Memory efficient** - Store data in memory for instant access
|
|
309
|
+
- ✅ **Offline ready** - Pre-load data for offline calendar browsing
|
|
181
310
|
|
|
182
311
|
## 📝 License
|
|
183
312
|
|
|
@@ -12,7 +12,7 @@ export type MonthAttendanceData = {
|
|
|
12
12
|
};
|
|
13
13
|
export type AttendanceData = MonthAttendanceData | MonthAttendanceData[];
|
|
14
14
|
export type CalendarProps = {
|
|
15
|
-
view
|
|
15
|
+
view?: MonthView;
|
|
16
16
|
onChangeView: (next: MonthView) => void;
|
|
17
17
|
attendanceData?: AttendanceData;
|
|
18
18
|
onDateClick?: (day: number, month: number, year: number) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttendanceCalendar.d.ts","sourceRoot":"","sources":["../src/AttendanceCalendar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAI7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG,mBAAmB,EAAE,CAAC;AAEzE,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"AttendanceCalendar.d.ts","sourceRoot":"","sources":["../src/AttendanceCalendar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAI7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG,mBAAmB,EAAE,CAAC;AAEzE,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,YAAY,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACxC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAuCF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,IAA4E,EAC5E,YAAY,EACZ,cAAc,EACd,WAAW,EACX,cAAqB,EACrB,kBAAyB,EACzB,SAAc,EAEd,aAAkB,EAClB,oBAAyB,EACzB,mBAAwB,EACxB,yBAA8B,EAC9B,sBAA2B,EAC3B,mBAAwB,EACxB,kBAAuB,GACxB,EAAE,aAAa,2CAgOf"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Le, { useRef as
|
|
1
|
+
import Le, { useRef as Fe, useState as $e, useEffect as We, useMemo as fe } from "react";
|
|
2
2
|
var ce = { exports: {} }, se = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
@@ -47,7 +47,7 @@ function Ye() {
|
|
|
47
47
|
function e(r) {
|
|
48
48
|
if (r == null) return null;
|
|
49
49
|
if (typeof r == "function")
|
|
50
|
-
return r.$$typeof ===
|
|
50
|
+
return r.$$typeof === M ? null : r.displayName || r.name || null;
|
|
51
51
|
if (typeof r == "string") return r;
|
|
52
52
|
switch (r) {
|
|
53
53
|
case j:
|
|
@@ -69,11 +69,11 @@ function Ye() {
|
|
|
69
69
|
), r.$$typeof) {
|
|
70
70
|
case v:
|
|
71
71
|
return "Portal";
|
|
72
|
-
case
|
|
72
|
+
case F:
|
|
73
73
|
return r.displayName || "Context";
|
|
74
74
|
case Y:
|
|
75
75
|
return (r._context.displayName || "Context") + ".Consumer";
|
|
76
|
-
case
|
|
76
|
+
case $:
|
|
77
77
|
var f = r.render;
|
|
78
78
|
return r = r.displayName, r || (r = f.displayName || f.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
|
|
79
79
|
case u:
|
|
@@ -237,16 +237,16 @@ React keys must be passed directly to JSX without using spread:
|
|
|
237
237
|
function L(r) {
|
|
238
238
|
return typeof r == "object" && r !== null && r.$$typeof === E;
|
|
239
239
|
}
|
|
240
|
-
var
|
|
240
|
+
var z = Le, E = Symbol.for("react.transitional.element"), v = Symbol.for("react.portal"), j = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), q = Symbol.for("react.profiler"), Y = Symbol.for("react.consumer"), F = Symbol.for("react.context"), $ = Symbol.for("react.forward_ref"), W = Symbol.for("react.suspense"), G = Symbol.for("react.suspense_list"), u = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), y = Symbol.for("react.activity"), M = Symbol.for("react.client.reference"), N = z.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, I = Array.isArray, S = console.createTask ? console.createTask : function() {
|
|
241
241
|
return null;
|
|
242
242
|
};
|
|
243
|
-
|
|
243
|
+
z = {
|
|
244
244
|
react_stack_bottom_frame: function(r) {
|
|
245
245
|
return r();
|
|
246
246
|
}
|
|
247
247
|
};
|
|
248
|
-
var R, D = {}, d =
|
|
249
|
-
|
|
248
|
+
var R, D = {}, d = z.react_stack_bottom_frame.bind(
|
|
249
|
+
z,
|
|
250
250
|
c
|
|
251
251
|
)(), oe = S(t(c)), ne = {};
|
|
252
252
|
ae.Fragment = j, ae.jsx = function(r, f, b) {
|
|
@@ -410,12 +410,12 @@ const ye = "-", Be = (e) => {
|
|
|
410
410
|
}
|
|
411
411
|
v === "[" ? l++ : v === "]" ? l-- : v === "(" ? h++ : v === ")" && h--;
|
|
412
412
|
}
|
|
413
|
-
const w = c.length === 0 ? i : i.substring(m), T = Ke(w), L = T !== w,
|
|
413
|
+
const w = c.length === 0 ? i : i.substring(m), T = Ke(w), L = T !== w, z = k && k > m ? k - m : void 0;
|
|
414
414
|
return {
|
|
415
415
|
modifiers: c,
|
|
416
416
|
hasImportantModifier: L,
|
|
417
417
|
baseClassName: T,
|
|
418
|
-
maybePostfixModifierPosition:
|
|
418
|
+
maybePostfixModifierPosition: z
|
|
419
419
|
};
|
|
420
420
|
};
|
|
421
421
|
if (n) {
|
|
@@ -464,7 +464,7 @@ const ye = "-", Be = (e) => {
|
|
|
464
464
|
const w = h[k], {
|
|
465
465
|
isExternal: T,
|
|
466
466
|
modifiers: L,
|
|
467
|
-
hasImportantModifier:
|
|
467
|
+
hasImportantModifier: z,
|
|
468
468
|
baseClassName: E,
|
|
469
469
|
maybePostfixModifierPosition: v
|
|
470
470
|
} = o(w);
|
|
@@ -484,13 +484,13 @@ const ye = "-", Be = (e) => {
|
|
|
484
484
|
}
|
|
485
485
|
j = !1;
|
|
486
486
|
}
|
|
487
|
-
const q = c(L).join(":"), Y =
|
|
488
|
-
if (l.includes(
|
|
487
|
+
const q = c(L).join(":"), Y = z ? q + he : q, F = Y + O;
|
|
488
|
+
if (l.includes(F))
|
|
489
489
|
continue;
|
|
490
|
-
l.push(
|
|
491
|
-
const
|
|
492
|
-
for (let W = 0; W <
|
|
493
|
-
const G =
|
|
490
|
+
l.push(F);
|
|
491
|
+
const $ = i(O, j);
|
|
492
|
+
for (let W = 0; W < $.length; ++W) {
|
|
493
|
+
const G = $[W];
|
|
494
494
|
l.push(Y + G);
|
|
495
495
|
}
|
|
496
496
|
m = w + (m.length > 0 ? " " + m : m);
|
|
@@ -531,19 +531,19 @@ function sr(e, ...n) {
|
|
|
531
531
|
const A = (e) => {
|
|
532
532
|
const n = (o) => o[e] || [];
|
|
533
533
|
return n.isThemeGetter = !0, n;
|
|
534
|
-
},
|
|
534
|
+
}, Me = /^\[(?:(\w[\w-]*):)?(.+)\]$/i, Pe = /^\((?:(\w[\w-]*):)?(.+)\)$/i, ar = /^\d+\/\d+$/, ir = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, lr = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, cr = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/, dr = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, ur = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, ee = (e) => ar.test(e), p = (e) => !!e && !Number.isNaN(Number(e)), H = (e) => !!e && Number.isInteger(Number(e)), pe = (e) => e.endsWith("%") && p(e.slice(0, -1)), B = (e) => ir.test(e), mr = () => !0, fr = (e) => (
|
|
535
535
|
// `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
|
|
536
536
|
// For example, `hsl(0 0% 0%)` would be classified as a length without this check.
|
|
537
537
|
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
538
538
|
lr.test(e) && !cr.test(e)
|
|
539
|
-
),
|
|
540
|
-
const t =
|
|
539
|
+
), ze = () => !1, pr = (e) => dr.test(e), br = (e) => ur.test(e), gr = (e) => !s(e) && !a(e), hr = (e) => re(e, Ie, ze), s = (e) => Me.test(e), Z = (e) => re(e, Oe, fr), be = (e) => re(e, vr, p), Ae = (e) => re(e, je, ze), xr = (e) => re(e, Ne, br), de = (e) => re(e, Ge, pr), a = (e) => Pe.test(e), ie = (e) => te(e, Oe), yr = (e) => te(e, Rr), Ce = (e) => te(e, je), kr = (e) => te(e, Ie), wr = (e) => te(e, Ne), ue = (e) => te(e, Ge, !0), re = (e, n, o) => {
|
|
540
|
+
const t = Me.exec(e);
|
|
541
541
|
return t ? t[1] ? n(t[1]) : o(t[2]) : !1;
|
|
542
542
|
}, te = (e, n, o = !1) => {
|
|
543
|
-
const t =
|
|
543
|
+
const t = Pe.exec(e);
|
|
544
544
|
return t ? t[1] ? n(t[1]) : o : !1;
|
|
545
545
|
}, je = (e) => e === "position" || e === "percentage", Ne = (e) => e === "image" || e === "url", Ie = (e) => e === "length" || e === "size" || e === "bg-size", Oe = (e) => e === "length", vr = (e) => e === "number", Rr = (e) => e === "family-name", Ge = (e) => e === "shadow", Er = () => {
|
|
546
|
-
const e = A("color"), n = A("font"), o = A("text"), t = A("font-weight"), i = A("tracking"), c = A("leading"), l = A("breakpoint"), h = A("container"), m = A("spacing"), k = A("radius"), w = A("shadow"), T = A("inset-shadow"), L = A("text-shadow"),
|
|
546
|
+
const e = A("color"), n = A("font"), o = A("text"), t = A("font-weight"), i = A("tracking"), c = A("leading"), l = A("breakpoint"), h = A("container"), m = A("spacing"), k = A("radius"), w = A("shadow"), T = A("inset-shadow"), L = A("text-shadow"), z = A("drop-shadow"), E = A("blur"), v = A("perspective"), j = A("aspect"), O = A("ease"), q = A("animate"), Y = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], F = () => [
|
|
547
547
|
"center",
|
|
548
548
|
"top",
|
|
549
549
|
"bottom",
|
|
@@ -561,9 +561,9 @@ const A = (e) => {
|
|
|
561
561
|
"bottom-left",
|
|
562
562
|
// Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
|
|
563
563
|
"left-bottom"
|
|
564
|
-
],
|
|
564
|
+
], $ = () => [...F(), a, s], W = () => ["auto", "hidden", "clip", "visible", "scroll"], G = () => ["auto", "contain", "none"], u = () => [a, s, m], _ = () => [ee, "full", "auto", ...u()], y = () => [H, "none", "subgrid", a, s], M = () => ["auto", {
|
|
565
565
|
span: ["full", H, a, s]
|
|
566
|
-
}, H, a, s], N = () => [H, "auto", a, s], J = () => ["auto", "min", "max", "fr", a, s], I = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], S = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"], R = () => ["auto", ...u()], D = () => [ee, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...u()], d = () => [e, a, s], oe = () => [
|
|
566
|
+
}, H, a, s], N = () => [H, "auto", a, s], J = () => ["auto", "min", "max", "fr", a, s], I = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], S = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"], R = () => ["auto", ...u()], D = () => [ee, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...u()], d = () => [e, a, s], oe = () => [...F(), Ce, Ae, {
|
|
567
567
|
position: [a, s]
|
|
568
568
|
}], ne = () => ["no-repeat", {
|
|
569
569
|
repeat: ["", "x", "y", "space", "round"]
|
|
@@ -708,7 +708,7 @@ const A = (e) => {
|
|
|
708
708
|
* @see https://tailwindcss.com/docs/object-position
|
|
709
709
|
*/
|
|
710
710
|
"object-position": [{
|
|
711
|
-
object:
|
|
711
|
+
object: $()
|
|
712
712
|
}],
|
|
713
713
|
/**
|
|
714
714
|
* Overflow
|
|
@@ -896,7 +896,7 @@ const A = (e) => {
|
|
|
896
896
|
* @see https://tailwindcss.com/docs/grid-column
|
|
897
897
|
*/
|
|
898
898
|
"col-start-end": [{
|
|
899
|
-
col:
|
|
899
|
+
col: M()
|
|
900
900
|
}],
|
|
901
901
|
/**
|
|
902
902
|
* Grid Column Start
|
|
@@ -924,7 +924,7 @@ const A = (e) => {
|
|
|
924
924
|
* @see https://tailwindcss.com/docs/grid-row
|
|
925
925
|
*/
|
|
926
926
|
"row-start-end": [{
|
|
927
|
-
row:
|
|
927
|
+
row: M()
|
|
928
928
|
}],
|
|
929
929
|
/**
|
|
930
930
|
* Grid Row Start
|
|
@@ -2177,7 +2177,7 @@ const A = (e) => {
|
|
|
2177
2177
|
}]
|
|
2178
2178
|
}],
|
|
2179
2179
|
"mask-image-radial-pos": [{
|
|
2180
|
-
"mask-radial-at":
|
|
2180
|
+
"mask-radial-at": F()
|
|
2181
2181
|
}],
|
|
2182
2182
|
"mask-image-conic-pos": [{
|
|
2183
2183
|
"mask-conic": [p]
|
|
@@ -2289,7 +2289,7 @@ const A = (e) => {
|
|
|
2289
2289
|
// Deprecated since Tailwind CSS v4.0.0
|
|
2290
2290
|
"",
|
|
2291
2291
|
"none",
|
|
2292
|
-
|
|
2292
|
+
z,
|
|
2293
2293
|
ue,
|
|
2294
2294
|
de
|
|
2295
2295
|
]
|
|
@@ -2524,7 +2524,7 @@ const A = (e) => {
|
|
|
2524
2524
|
* @see https://tailwindcss.com/docs/perspective-origin
|
|
2525
2525
|
*/
|
|
2526
2526
|
"perspective-origin": [{
|
|
2527
|
-
"perspective-origin":
|
|
2527
|
+
"perspective-origin": $()
|
|
2528
2528
|
}],
|
|
2529
2529
|
/**
|
|
2530
2530
|
* Rotate
|
|
@@ -2620,7 +2620,7 @@ const A = (e) => {
|
|
|
2620
2620
|
* @see https://tailwindcss.com/docs/transform-origin
|
|
2621
2621
|
*/
|
|
2622
2622
|
"transform-origin": [{
|
|
2623
|
-
origin:
|
|
2623
|
+
origin: $()
|
|
2624
2624
|
}],
|
|
2625
2625
|
/**
|
|
2626
2626
|
* Transform Style
|
|
@@ -3013,7 +3013,7 @@ const A = (e) => {
|
|
|
3013
3013
|
orderSensitiveModifiers: ["*", "**", "after", "backdrop", "before", "details-content", "file", "first-letter", "first-line", "marker", "placeholder", "selection"]
|
|
3014
3014
|
};
|
|
3015
3015
|
}, Ar = /* @__PURE__ */ sr(Er);
|
|
3016
|
-
function
|
|
3016
|
+
function P(...e) {
|
|
3017
3017
|
return Ar(Ue(e));
|
|
3018
3018
|
}
|
|
3019
3019
|
const Cr = [
|
|
@@ -3040,7 +3040,7 @@ function _r({ year: e, monthIndex: n }, o) {
|
|
|
3040
3040
|
return h;
|
|
3041
3041
|
}
|
|
3042
3042
|
function Tr({
|
|
3043
|
-
view: e,
|
|
3043
|
+
view: e = { year: (/* @__PURE__ */ new Date()).getFullYear(), monthIndex: (/* @__PURE__ */ new Date()).getMonth() },
|
|
3044
3044
|
onChangeView: n,
|
|
3045
3045
|
attendanceData: o,
|
|
3046
3046
|
onDateClick: t,
|
|
@@ -3054,26 +3054,26 @@ function Tr({
|
|
|
3054
3054
|
navigationButtonClassName: w = "",
|
|
3055
3055
|
weekdayHeaderClassName: T = "",
|
|
3056
3056
|
monthTitleClassName: L = "",
|
|
3057
|
-
containerClassName:
|
|
3057
|
+
containerClassName: z = ""
|
|
3058
3058
|
}) {
|
|
3059
|
-
const E =
|
|
3059
|
+
const E = Fe(null), [v, j] = $e(7);
|
|
3060
3060
|
We(() => {
|
|
3061
3061
|
if (!E.current) return;
|
|
3062
|
-
const y = E.current,
|
|
3062
|
+
const y = E.current, M = new ResizeObserver((N) => {
|
|
3063
3063
|
const R = (N[0]?.contentRect.width ?? y.clientWidth) >= 8 * 64 + 156;
|
|
3064
3064
|
j(R ? 14 : 7);
|
|
3065
3065
|
});
|
|
3066
|
-
return
|
|
3066
|
+
return M.observe(y), () => M.disconnect();
|
|
3067
3067
|
}, []);
|
|
3068
|
-
const O = fe(() => _r(e, v), [e, v]), q = fe(() => Array.from({ length: v }).map((y,
|
|
3068
|
+
const O = fe(() => _r(e, v), [e, v]), q = fe(() => Array.from({ length: v }).map((y, M) => Cr[M % 7]), [v]), Y = fe(
|
|
3069
3069
|
() => new Date(e.year, e.monthIndex).toLocaleString("en-US", {
|
|
3070
3070
|
month: "long"
|
|
3071
3071
|
}),
|
|
3072
3072
|
[e]
|
|
3073
|
-
),
|
|
3073
|
+
), F = () => {
|
|
3074
3074
|
const y = e.monthIndex - 1;
|
|
3075
3075
|
y < 0 ? n({ year: e.year - 1, monthIndex: 11 }) : n({ ...e, monthIndex: y });
|
|
3076
|
-
},
|
|
3076
|
+
}, $ = () => {
|
|
3077
3077
|
const y = e.monthIndex + 1;
|
|
3078
3078
|
y > 11 ? n({ year: e.year + 1, monthIndex: 0 }) : n({ ...e, monthIndex: y });
|
|
3079
3079
|
}, G = (() => {
|
|
@@ -3084,14 +3084,14 @@ function Tr({
|
|
|
3084
3084
|
})(), u = G !== void 0, _ = (y) => {
|
|
3085
3085
|
t && u && t(y, e.monthIndex, e.year);
|
|
3086
3086
|
};
|
|
3087
|
-
return /* @__PURE__ */ C.jsxs("div", { className:
|
|
3087
|
+
return /* @__PURE__ */ C.jsxs("div", { className: P("w-full", l, z), children: [
|
|
3088
3088
|
i && /* @__PURE__ */ C.jsxs("div", { className: "flex items-center justify-between mb-8", children: [
|
|
3089
3089
|
/* @__PURE__ */ C.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
3090
3090
|
/* @__PURE__ */ C.jsx(
|
|
3091
3091
|
"button",
|
|
3092
3092
|
{
|
|
3093
|
-
onClick:
|
|
3094
|
-
className:
|
|
3093
|
+
onClick: F,
|
|
3094
|
+
className: P(
|
|
3095
3095
|
"size-10 rounded-xl border-2 border-slate-200 text-slate-700 grid place-items-center",
|
|
3096
3096
|
"transition-colors duration-200 hover:bg-slate-50",
|
|
3097
3097
|
w
|
|
@@ -3114,8 +3114,8 @@ function Tr({
|
|
|
3114
3114
|
/* @__PURE__ */ C.jsx(
|
|
3115
3115
|
"button",
|
|
3116
3116
|
{
|
|
3117
|
-
onClick:
|
|
3118
|
-
className:
|
|
3117
|
+
onClick: $,
|
|
3118
|
+
className: P(
|
|
3119
3119
|
"size-10 rounded-xl border-2 border-slate-200 text-slate-700 grid place-items-center",
|
|
3120
3120
|
"transition-colors duration-200 hover:bg-slate-50",
|
|
3121
3121
|
w
|
|
@@ -3139,7 +3139,7 @@ function Tr({
|
|
|
3139
3139
|
/* @__PURE__ */ C.jsxs(
|
|
3140
3140
|
"h2",
|
|
3141
3141
|
{
|
|
3142
|
-
className:
|
|
3142
|
+
className: P(
|
|
3143
3143
|
"text-2xl font-bold text-slate-900",
|
|
3144
3144
|
L
|
|
3145
3145
|
),
|
|
@@ -3156,19 +3156,19 @@ function Tr({
|
|
|
3156
3156
|
c && /* @__PURE__ */ C.jsx(
|
|
3157
3157
|
"div",
|
|
3158
3158
|
{
|
|
3159
|
-
className:
|
|
3159
|
+
className: P("grid gap-4 text-center mb-6"),
|
|
3160
3160
|
style: { gridTemplateColumns: `repeat(${v}, minmax(0, 1fr))` },
|
|
3161
|
-
children: q.map((y,
|
|
3161
|
+
children: q.map((y, M) => /* @__PURE__ */ C.jsx(
|
|
3162
3162
|
"div",
|
|
3163
3163
|
{
|
|
3164
|
-
className:
|
|
3164
|
+
className: P(
|
|
3165
3165
|
"text-sm font-semibold uppercase tracking-wide py-2",
|
|
3166
3166
|
"text-slate-500 bg-transparent rounded-xl",
|
|
3167
3167
|
T
|
|
3168
3168
|
),
|
|
3169
3169
|
children: y
|
|
3170
3170
|
},
|
|
3171
|
-
|
|
3171
|
+
M
|
|
3172
3172
|
))
|
|
3173
3173
|
}
|
|
3174
3174
|
),
|
|
@@ -3176,31 +3176,31 @@ function Tr({
|
|
|
3176
3176
|
"div",
|
|
3177
3177
|
{
|
|
3178
3178
|
ref: E,
|
|
3179
|
-
className:
|
|
3179
|
+
className: P("grid gap-4"),
|
|
3180
3180
|
style: { gridTemplateColumns: `repeat(${v}, minmax(0, 1fr))` },
|
|
3181
|
-
children: O.map((y,
|
|
3182
|
-
const N = u && y.inCurrentMonth && G?.presentDays.has(y.day), J = u && y.inCurrentMonth && G?.absentDays.has(y.day), I =
|
|
3181
|
+
children: O.map((y, M) => {
|
|
3182
|
+
const N = u && y.inCurrentMonth && G?.presentDays.has(y.day), J = u && y.inCurrentMonth && G?.absentDays.has(y.day), I = P(
|
|
3183
3183
|
"rounded-2xl grid place-items-center font-semibold cursor-pointer",
|
|
3184
3184
|
"transition-all duration-200",
|
|
3185
3185
|
v >= 14 ? "size-8 sm:size-12 text-sm" : "size-12 sm:size-14 text-base",
|
|
3186
3186
|
h
|
|
3187
3187
|
), S = t && y.inCurrentMonth && u;
|
|
3188
3188
|
let R = I;
|
|
3189
|
-
return y.inCurrentMonth ? N ? R =
|
|
3189
|
+
return y.inCurrentMonth ? N ? R = P(
|
|
3190
3190
|
I,
|
|
3191
3191
|
"bg-emerald-500 text-white border-2 border-emerald-500",
|
|
3192
3192
|
m
|
|
3193
|
-
) : J ? R =
|
|
3193
|
+
) : J ? R = P(
|
|
3194
3194
|
I,
|
|
3195
3195
|
"bg-amber-500 text-white border-2 border-amber-500",
|
|
3196
3196
|
k
|
|
3197
|
-
) : R =
|
|
3197
|
+
) : R = P(
|
|
3198
3198
|
I,
|
|
3199
3199
|
"text-slate-700 border-2 border-slate-200"
|
|
3200
|
-
) : R =
|
|
3200
|
+
) : R = P(
|
|
3201
3201
|
I,
|
|
3202
3202
|
"text-slate-400 border-2 border-slate-200"
|
|
3203
|
-
), /* @__PURE__ */ C.jsx("div", { className:
|
|
3203
|
+
), /* @__PURE__ */ C.jsx("div", { className: P("flex items-center justify-center"), children: /* @__PURE__ */ C.jsx(
|
|
3204
3204
|
"div",
|
|
3205
3205
|
{
|
|
3206
3206
|
className: R,
|
|
@@ -3208,7 +3208,7 @@ function Tr({
|
|
|
3208
3208
|
title: S ? `Click to interact with ${y.day}` : void 0,
|
|
3209
3209
|
children: y.day
|
|
3210
3210
|
}
|
|
3211
|
-
) },
|
|
3211
|
+
) }, M);
|
|
3212
3212
|
})
|
|
3213
3213
|
}
|
|
3214
3214
|
)
|
|
@@ -3216,6 +3216,6 @@ function Tr({
|
|
|
3216
3216
|
}
|
|
3217
3217
|
export {
|
|
3218
3218
|
Tr as AttendanceCalendar,
|
|
3219
|
-
|
|
3219
|
+
P as cn
|
|
3220
3220
|
};
|
|
3221
3221
|
//# sourceMappingURL=index.js.map
|