@sytechui/calendar 2.2.32
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/LICENSE +21 -0
- package/README.md +24 -0
- package/dist/calendar-base.d.mts +23 -0
- package/dist/calendar-base.d.ts +23 -0
- package/dist/calendar-base.js +604 -0
- package/dist/calendar-base.mjs +17 -0
- package/dist/calendar-cell.d.mts +18 -0
- package/dist/calendar-cell.d.ts +18 -0
- package/dist/calendar-cell.js +97 -0
- package/dist/calendar-cell.mjs +7 -0
- package/dist/calendar-context.d.mts +19 -0
- package/dist/calendar-context.d.ts +19 -0
- package/dist/calendar-context.js +38 -0
- package/dist/calendar-context.mjs +9 -0
- package/dist/calendar-header.d.mts +14 -0
- package/dist/calendar-header.d.ts +14 -0
- package/dist/calendar-header.js +156 -0
- package/dist/calendar-header.mjs +10 -0
- package/dist/calendar-month.d.mts +13 -0
- package/dist/calendar-month.d.ts +13 -0
- package/dist/calendar-month.js +226 -0
- package/dist/calendar-month.mjs +10 -0
- package/dist/calendar-picker.d.mts +12 -0
- package/dist/calendar-picker.d.ts +12 -0
- package/dist/calendar-picker.js +83 -0
- package/dist/calendar-picker.mjs +9 -0
- package/dist/calendar-transitions.d.mts +10 -0
- package/dist/calendar-transitions.d.ts +10 -0
- package/dist/calendar-transitions.js +48 -0
- package/dist/calendar-transitions.mjs +9 -0
- package/dist/calendar.d.mts +24 -0
- package/dist/calendar.d.ts +24 -0
- package/dist/calendar.js +876 -0
- package/dist/calendar.mjs +20 -0
- package/dist/chevron-down.d.mts +6 -0
- package/dist/chevron-down.d.ts +6 -0
- package/dist/chevron-down.js +54 -0
- package/dist/chevron-down.mjs +7 -0
- package/dist/chevron-left.d.mts +6 -0
- package/dist/chevron-left.d.ts +6 -0
- package/dist/chevron-left.js +54 -0
- package/dist/chevron-left.mjs +7 -0
- package/dist/chevron-right.d.mts +6 -0
- package/dist/chevron-right.d.ts +6 -0
- package/dist/chevron-right.js +54 -0
- package/dist/chevron-right.mjs +7 -0
- package/dist/chunk-5CY7DCRB.mjs +24 -0
- package/dist/chunk-AJXW2JXW.mjs +23 -0
- package/dist/chunk-BEC3B3UO.mjs +23 -0
- package/dist/chunk-CPBF6DM2.mjs +120 -0
- package/dist/chunk-DN6I5LXB.mjs +125 -0
- package/dist/chunk-H34OUI62.mjs +157 -0
- package/dist/chunk-HUKPVIZ5.mjs +31 -0
- package/dist/chunk-IDU5RSFL.mjs +93 -0
- package/dist/chunk-IFK7FCNU.mjs +42 -0
- package/dist/chunk-JJRY4BYN.mjs +31 -0
- package/dist/chunk-JQFIYCMS.mjs +19 -0
- package/dist/chunk-MCZLP73P.mjs +14 -0
- package/dist/chunk-MDGP3JHC.mjs +74 -0
- package/dist/chunk-MUYVZHWM.mjs +31 -0
- package/dist/chunk-OEB7VI2R.mjs +125 -0
- package/dist/chunk-ZJZG3P2K.mjs +181 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +1020 -0
- package/dist/index.mjs +36 -0
- package/dist/range-calendar.d.mts +24 -0
- package/dist/range-calendar.d.ts +24 -0
- package/dist/range-calendar.js +876 -0
- package/dist/range-calendar.mjs +20 -0
- package/dist/use-calendar-base.d.mts +1224 -0
- package/dist/use-calendar-base.d.ts +1224 -0
- package/dist/use-calendar-base.js +174 -0
- package/dist/use-calendar-base.mjs +7 -0
- package/dist/use-calendar-picker.d.mts +482 -0
- package/dist/use-calendar-picker.d.ts +482 -0
- package/dist/use-calendar-picker.js +49 -0
- package/dist/use-calendar-picker.mjs +8 -0
- package/dist/use-calendar.d.mts +494 -0
- package/dist/use-calendar.d.ts +494 -0
- package/dist/use-calendar.js +293 -0
- package/dist/use-calendar.mjs +8 -0
- package/dist/use-range-calendar.d.mts +498 -0
- package/dist/use-range-calendar.d.ts +498 -0
- package/dist/use-range-calendar.js +293 -0
- package/dist/use-range-calendar.mjs +8 -0
- package/dist/utils.d.mts +7 -0
- package/dist/utils.d.ts +7 -0
- package/dist/utils.js +59 -0
- package/dist/utils.mjs +33 -0
- package/package.json +74 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
calendar_default
|
|
4
|
+
} from "./chunk-BEC3B3UO.mjs";
|
|
5
|
+
import "./chunk-OEB7VI2R.mjs";
|
|
6
|
+
import "./chunk-H34OUI62.mjs";
|
|
7
|
+
import "./chunk-ZJZG3P2K.mjs";
|
|
8
|
+
import "./chunk-HUKPVIZ5.mjs";
|
|
9
|
+
import "./chunk-MUYVZHWM.mjs";
|
|
10
|
+
import "./chunk-IDU5RSFL.mjs";
|
|
11
|
+
import "./chunk-JJRY4BYN.mjs";
|
|
12
|
+
import "./chunk-CPBF6DM2.mjs";
|
|
13
|
+
import "./chunk-MDGP3JHC.mjs";
|
|
14
|
+
import "./chunk-IFK7FCNU.mjs";
|
|
15
|
+
import "./chunk-JQFIYCMS.mjs";
|
|
16
|
+
import "./chunk-MCZLP73P.mjs";
|
|
17
|
+
import "./chunk-5CY7DCRB.mjs";
|
|
18
|
+
export {
|
|
19
|
+
calendar_default as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/chevron-down.tsx
|
|
22
|
+
var chevron_down_exports = {};
|
|
23
|
+
__export(chevron_down_exports, {
|
|
24
|
+
ChevronDownIcon: () => ChevronDownIcon
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(chevron_down_exports);
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var ChevronDownIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
29
|
+
"svg",
|
|
30
|
+
{
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
fill: "none",
|
|
33
|
+
focusable: "false",
|
|
34
|
+
height: "1em",
|
|
35
|
+
role: "presentation",
|
|
36
|
+
viewBox: "0 0 24 24",
|
|
37
|
+
width: "1em",
|
|
38
|
+
...props,
|
|
39
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
40
|
+
"path",
|
|
41
|
+
{
|
|
42
|
+
d: "M19 9L12 15L5 9",
|
|
43
|
+
stroke: "currentColor",
|
|
44
|
+
strokeLinecap: "round",
|
|
45
|
+
strokeLinejoin: "round",
|
|
46
|
+
strokeWidth: "1.5"
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
ChevronDownIcon
|
|
54
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/chevron-left.tsx
|
|
22
|
+
var chevron_left_exports = {};
|
|
23
|
+
__export(chevron_left_exports, {
|
|
24
|
+
ChevronLeftIcon: () => ChevronLeftIcon
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(chevron_left_exports);
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var ChevronLeftIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
29
|
+
"svg",
|
|
30
|
+
{
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
fill: "none",
|
|
33
|
+
focusable: "false",
|
|
34
|
+
height: "1em",
|
|
35
|
+
role: "presentation",
|
|
36
|
+
viewBox: "0 0 16 16",
|
|
37
|
+
width: "1em",
|
|
38
|
+
...props,
|
|
39
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
40
|
+
"path",
|
|
41
|
+
{
|
|
42
|
+
d: "M10 3.33334L6 8.00001L10 12.6667",
|
|
43
|
+
stroke: "currentColor",
|
|
44
|
+
strokeLinecap: "round",
|
|
45
|
+
strokeLinejoin: "round",
|
|
46
|
+
strokeWidth: "1.5"
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
ChevronLeftIcon
|
|
54
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/chevron-right.tsx
|
|
22
|
+
var chevron_right_exports = {};
|
|
23
|
+
__export(chevron_right_exports, {
|
|
24
|
+
ChevronRightIcon: () => ChevronRightIcon
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(chevron_right_exports);
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var ChevronRightIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
29
|
+
"svg",
|
|
30
|
+
{
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
fill: "none",
|
|
33
|
+
focusable: "false",
|
|
34
|
+
height: "1em",
|
|
35
|
+
role: "presentation",
|
|
36
|
+
viewBox: "0 0 16 16",
|
|
37
|
+
width: "1em",
|
|
38
|
+
...props,
|
|
39
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
40
|
+
"path",
|
|
41
|
+
{
|
|
42
|
+
d: "M6 3.33334L10 8.00001L6 12.6667",
|
|
43
|
+
stroke: "currentColor",
|
|
44
|
+
strokeLinecap: "round",
|
|
45
|
+
strokeLinejoin: "round",
|
|
46
|
+
strokeWidth: "1.5"
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
ChevronRightIcon
|
|
54
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/calendar-transitions.ts
|
|
4
|
+
var transition = {
|
|
5
|
+
type: "spring",
|
|
6
|
+
bounce: 0,
|
|
7
|
+
duration: 0.3
|
|
8
|
+
};
|
|
9
|
+
var slideVariants = {
|
|
10
|
+
enter: (direction) => ({
|
|
11
|
+
x: `${direction * 100}%`
|
|
12
|
+
}),
|
|
13
|
+
center: {
|
|
14
|
+
x: "0%"
|
|
15
|
+
},
|
|
16
|
+
exit: (direction) => ({
|
|
17
|
+
x: `${direction * -100}%`
|
|
18
|
+
})
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
transition,
|
|
23
|
+
slideVariants
|
|
24
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useRangeCalendar
|
|
4
|
+
} from "./chunk-DN6I5LXB.mjs";
|
|
5
|
+
import {
|
|
6
|
+
CalendarBase
|
|
7
|
+
} from "./chunk-ZJZG3P2K.mjs";
|
|
8
|
+
import {
|
|
9
|
+
CalendarProvider
|
|
10
|
+
} from "./chunk-MCZLP73P.mjs";
|
|
11
|
+
|
|
12
|
+
// src/range-calendar.tsx
|
|
13
|
+
import { forwardRef } from "@sytechui/system";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
var RangeCalendar = forwardRef(function RangeCalendar2(props, ref) {
|
|
16
|
+
const { context, getBaseCalendarProps } = useRangeCalendar({ ...props, ref });
|
|
17
|
+
return /* @__PURE__ */ jsx(CalendarProvider, { value: context, children: /* @__PURE__ */ jsx(CalendarBase, { ...getBaseCalendarProps() }) });
|
|
18
|
+
});
|
|
19
|
+
var range_calendar_default = RangeCalendar;
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
range_calendar_default
|
|
23
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useCalendar
|
|
4
|
+
} from "./chunk-OEB7VI2R.mjs";
|
|
5
|
+
import {
|
|
6
|
+
CalendarBase
|
|
7
|
+
} from "./chunk-ZJZG3P2K.mjs";
|
|
8
|
+
import {
|
|
9
|
+
CalendarProvider
|
|
10
|
+
} from "./chunk-MCZLP73P.mjs";
|
|
11
|
+
|
|
12
|
+
// src/calendar.tsx
|
|
13
|
+
import { forwardRef } from "@sytechui/system";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
var Calendar = forwardRef(function Calendar2(props, ref) {
|
|
16
|
+
const { context, getBaseCalendarProps } = useCalendar({ ...props, ref });
|
|
17
|
+
return /* @__PURE__ */ jsx(CalendarProvider, { value: context, children: /* @__PURE__ */ jsx(CalendarBase, { ...getBaseCalendarProps() }) });
|
|
18
|
+
});
|
|
19
|
+
var calendar_default = Calendar;
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
calendar_default
|
|
23
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
CalendarCell
|
|
4
|
+
} from "./chunk-MDGP3JHC.mjs";
|
|
5
|
+
import {
|
|
6
|
+
useCalendarContext
|
|
7
|
+
} from "./chunk-MCZLP73P.mjs";
|
|
8
|
+
import {
|
|
9
|
+
slideVariants
|
|
10
|
+
} from "./chunk-5CY7DCRB.mjs";
|
|
11
|
+
|
|
12
|
+
// src/calendar-month.tsx
|
|
13
|
+
import { endOfMonth, getWeeksInMonth } from "@internationalized/date";
|
|
14
|
+
import { useLocale } from "@react-aria/i18n";
|
|
15
|
+
import { useCalendarGrid } from "@react-aria/calendar";
|
|
16
|
+
import { m } from "framer-motion";
|
|
17
|
+
import { dataAttr } from "@sytechui/shared-utils";
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
function CalendarMonth(props) {
|
|
20
|
+
const { startDate, direction, currentMonth, firstDayOfWeek } = props;
|
|
21
|
+
const { locale } = useLocale();
|
|
22
|
+
const weeksInMonth = getWeeksInMonth(startDate, locale, firstDayOfWeek);
|
|
23
|
+
const { state, slots, weekdayStyle, isHeaderExpanded, disableAnimation, classNames } = useCalendarContext();
|
|
24
|
+
const { gridProps, headerProps, weekDays } = useCalendarGrid(
|
|
25
|
+
{
|
|
26
|
+
...props,
|
|
27
|
+
weekdayStyle,
|
|
28
|
+
endDate: endOfMonth(startDate),
|
|
29
|
+
firstDayOfWeek
|
|
30
|
+
},
|
|
31
|
+
state
|
|
32
|
+
);
|
|
33
|
+
const bodyContent = [...new Array(weeksInMonth).keys()].map((weekIndex) => /* @__PURE__ */ jsx(
|
|
34
|
+
"tr",
|
|
35
|
+
{
|
|
36
|
+
className: slots == null ? void 0 : slots.gridBodyRow({ class: classNames == null ? void 0 : classNames.gridBodyRow }),
|
|
37
|
+
"data-slot": "grid-body-row",
|
|
38
|
+
inert: isHeaderExpanded ? true : void 0,
|
|
39
|
+
children: state.getDatesInWeek(weekIndex, startDate).map(
|
|
40
|
+
(date, i) => date ? /* @__PURE__ */ jsx(
|
|
41
|
+
CalendarCell,
|
|
42
|
+
{
|
|
43
|
+
classNames,
|
|
44
|
+
currentMonth: startDate,
|
|
45
|
+
date,
|
|
46
|
+
firstDayOfWeek,
|
|
47
|
+
isPickerVisible: isHeaderExpanded,
|
|
48
|
+
slots,
|
|
49
|
+
state
|
|
50
|
+
},
|
|
51
|
+
i
|
|
52
|
+
) : /* @__PURE__ */ jsx("td", {}, i)
|
|
53
|
+
)
|
|
54
|
+
},
|
|
55
|
+
weekIndex
|
|
56
|
+
));
|
|
57
|
+
return /* @__PURE__ */ jsxs(
|
|
58
|
+
"table",
|
|
59
|
+
{
|
|
60
|
+
...gridProps,
|
|
61
|
+
"aria-hidden": dataAttr(isHeaderExpanded),
|
|
62
|
+
className: slots == null ? void 0 : slots.grid({ class: classNames == null ? void 0 : classNames.grid }),
|
|
63
|
+
"data-slot": "grid",
|
|
64
|
+
tabIndex: -1,
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ jsx(
|
|
67
|
+
"thead",
|
|
68
|
+
{
|
|
69
|
+
...headerProps,
|
|
70
|
+
className: slots == null ? void 0 : slots.gridHeader({ class: classNames == null ? void 0 : classNames.gridHeader }),
|
|
71
|
+
"data-slot": "grid-header",
|
|
72
|
+
children: /* @__PURE__ */ jsx(
|
|
73
|
+
"tr",
|
|
74
|
+
{
|
|
75
|
+
className: slots == null ? void 0 : slots.gridHeaderRow({ class: classNames == null ? void 0 : classNames.gridHeaderRow }),
|
|
76
|
+
"data-slot": "grid-header-row",
|
|
77
|
+
children: weekDays.map((day, index) => /* @__PURE__ */ jsx(
|
|
78
|
+
"th",
|
|
79
|
+
{
|
|
80
|
+
className: slots == null ? void 0 : slots.gridHeaderCell({ class: classNames == null ? void 0 : classNames.gridHeaderCell }),
|
|
81
|
+
"data-slot": "grid-header-cell",
|
|
82
|
+
children: /* @__PURE__ */ jsx("span", { children: day })
|
|
83
|
+
},
|
|
84
|
+
index
|
|
85
|
+
))
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
disableAnimation ? /* @__PURE__ */ jsx(
|
|
91
|
+
"tbody",
|
|
92
|
+
{
|
|
93
|
+
className: slots == null ? void 0 : slots.gridBody({ class: classNames == null ? void 0 : classNames.gridBody }),
|
|
94
|
+
"data-slot": "grid-body",
|
|
95
|
+
tabIndex: isHeaderExpanded ? -1 : 0,
|
|
96
|
+
children: bodyContent
|
|
97
|
+
},
|
|
98
|
+
currentMonth
|
|
99
|
+
) : /* @__PURE__ */ jsx(
|
|
100
|
+
m.tbody,
|
|
101
|
+
{
|
|
102
|
+
animate: "center",
|
|
103
|
+
className: slots == null ? void 0 : slots.gridBody({ class: classNames == null ? void 0 : classNames.gridBody }),
|
|
104
|
+
custom: direction,
|
|
105
|
+
"data-slot": "grid-body",
|
|
106
|
+
exit: "exit",
|
|
107
|
+
initial: "enter",
|
|
108
|
+
variants: slideVariants,
|
|
109
|
+
children: bodyContent
|
|
110
|
+
},
|
|
111
|
+
currentMonth
|
|
112
|
+
)
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export {
|
|
119
|
+
CalendarMonth
|
|
120
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useCalendarBase
|
|
4
|
+
} from "./chunk-H34OUI62.mjs";
|
|
5
|
+
|
|
6
|
+
// src/use-range-calendar.ts
|
|
7
|
+
import { useMemo, useRef } from "react";
|
|
8
|
+
import { filterDOMProps } from "@sytechui/react-utils";
|
|
9
|
+
import { useRangeCalendar as useAriaRangeCalendar } from "@react-aria/calendar";
|
|
10
|
+
import { useRangeCalendarState } from "@react-stately/calendar";
|
|
11
|
+
import { createCalendar } from "@internationalized/date";
|
|
12
|
+
import { chain } from "@sytechui/shared-utils";
|
|
13
|
+
import { cn } from "@sytechui/theme";
|
|
14
|
+
function useRangeCalendar({
|
|
15
|
+
buttonPickerProps: buttonPickerPropsProp,
|
|
16
|
+
className,
|
|
17
|
+
...originalProps
|
|
18
|
+
}) {
|
|
19
|
+
const {
|
|
20
|
+
Component,
|
|
21
|
+
slots,
|
|
22
|
+
children,
|
|
23
|
+
domRef,
|
|
24
|
+
locale,
|
|
25
|
+
showHelper,
|
|
26
|
+
firstDayOfWeek,
|
|
27
|
+
minValue,
|
|
28
|
+
maxValue,
|
|
29
|
+
weekdayStyle,
|
|
30
|
+
visibleDuration,
|
|
31
|
+
shouldFilterDOMProps,
|
|
32
|
+
isHeaderExpanded,
|
|
33
|
+
visibleMonths,
|
|
34
|
+
disableAnimation,
|
|
35
|
+
createCalendar: createCalendarProp,
|
|
36
|
+
showMonthAndYearPickers,
|
|
37
|
+
baseProps,
|
|
38
|
+
getPrevButtonProps,
|
|
39
|
+
getNextButtonProps,
|
|
40
|
+
getErrorMessageProps,
|
|
41
|
+
setIsHeaderExpanded,
|
|
42
|
+
topContent,
|
|
43
|
+
bottomContent,
|
|
44
|
+
errorMessage,
|
|
45
|
+
classNames,
|
|
46
|
+
otherProps
|
|
47
|
+
} = useCalendarBase({ ...originalProps, isRange: true });
|
|
48
|
+
const headerRef = useRef(null);
|
|
49
|
+
const state = useRangeCalendarState({
|
|
50
|
+
...originalProps,
|
|
51
|
+
locale,
|
|
52
|
+
minValue,
|
|
53
|
+
maxValue,
|
|
54
|
+
visibleDuration,
|
|
55
|
+
createCalendar: !createCalendarProp || typeof createCalendarProp !== "function" ? createCalendar : createCalendarProp
|
|
56
|
+
});
|
|
57
|
+
const { title, calendarProps, prevButtonProps, nextButtonProps, errorMessageProps } = useAriaRangeCalendar(originalProps, state, domRef);
|
|
58
|
+
const baseStyles = cn(classNames == null ? void 0 : classNames.base, className);
|
|
59
|
+
const buttonPickerProps = {
|
|
60
|
+
...buttonPickerPropsProp,
|
|
61
|
+
onPress: chain(buttonPickerPropsProp == null ? void 0 : buttonPickerPropsProp.onPress, () => setIsHeaderExpanded(!isHeaderExpanded))
|
|
62
|
+
};
|
|
63
|
+
const getBaseCalendarProps = (props = {}) => {
|
|
64
|
+
return {
|
|
65
|
+
...baseProps,
|
|
66
|
+
Component,
|
|
67
|
+
showHelper,
|
|
68
|
+
firstDayOfWeek,
|
|
69
|
+
topContent,
|
|
70
|
+
bottomContent,
|
|
71
|
+
buttonPickerProps,
|
|
72
|
+
calendarRef: domRef,
|
|
73
|
+
calendarProps,
|
|
74
|
+
prevButtonProps: getPrevButtonProps(prevButtonProps),
|
|
75
|
+
nextButtonProps: getNextButtonProps(nextButtonProps),
|
|
76
|
+
errorMessageProps: getErrorMessageProps(errorMessageProps),
|
|
77
|
+
className: slots.base({ class: baseStyles }),
|
|
78
|
+
errorMessage,
|
|
79
|
+
...filterDOMProps(otherProps, {
|
|
80
|
+
enabled: shouldFilterDOMProps
|
|
81
|
+
}),
|
|
82
|
+
...props
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
const context = useMemo(
|
|
86
|
+
() => ({
|
|
87
|
+
state,
|
|
88
|
+
slots,
|
|
89
|
+
headerRef,
|
|
90
|
+
weekdayStyle,
|
|
91
|
+
isHeaderExpanded,
|
|
92
|
+
setIsHeaderExpanded,
|
|
93
|
+
visibleMonths,
|
|
94
|
+
showMonthAndYearPickers,
|
|
95
|
+
classNames,
|
|
96
|
+
disableAnimation
|
|
97
|
+
}),
|
|
98
|
+
[
|
|
99
|
+
state,
|
|
100
|
+
slots,
|
|
101
|
+
classNames,
|
|
102
|
+
weekdayStyle,
|
|
103
|
+
isHeaderExpanded,
|
|
104
|
+
setIsHeaderExpanded,
|
|
105
|
+
visibleMonths,
|
|
106
|
+
disableAnimation,
|
|
107
|
+
showMonthAndYearPickers
|
|
108
|
+
]
|
|
109
|
+
);
|
|
110
|
+
return {
|
|
111
|
+
Component,
|
|
112
|
+
children,
|
|
113
|
+
domRef,
|
|
114
|
+
context,
|
|
115
|
+
state,
|
|
116
|
+
slots,
|
|
117
|
+
title,
|
|
118
|
+
classNames,
|
|
119
|
+
getBaseCalendarProps
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export {
|
|
124
|
+
useRangeCalendar
|
|
125
|
+
};
|