@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,181 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ChevronLeftIcon
|
|
4
|
+
} from "./chunk-HUKPVIZ5.mjs";
|
|
5
|
+
import {
|
|
6
|
+
ChevronRightIcon
|
|
7
|
+
} from "./chunk-MUYVZHWM.mjs";
|
|
8
|
+
import {
|
|
9
|
+
CalendarHeader
|
|
10
|
+
} from "./chunk-IDU5RSFL.mjs";
|
|
11
|
+
import {
|
|
12
|
+
CalendarMonth
|
|
13
|
+
} from "./chunk-CPBF6DM2.mjs";
|
|
14
|
+
import {
|
|
15
|
+
CalendarPicker
|
|
16
|
+
} from "./chunk-IFK7FCNU.mjs";
|
|
17
|
+
import {
|
|
18
|
+
useCalendarContext
|
|
19
|
+
} from "./chunk-MCZLP73P.mjs";
|
|
20
|
+
import {
|
|
21
|
+
transition
|
|
22
|
+
} from "./chunk-5CY7DCRB.mjs";
|
|
23
|
+
|
|
24
|
+
// src/calendar-base.tsx
|
|
25
|
+
import { forwardRef, Fragment, useState } from "react";
|
|
26
|
+
import { VisuallyHidden } from "@react-aria/visually-hidden";
|
|
27
|
+
import { Button } from "@sytechui/button";
|
|
28
|
+
import { chain, mergeProps } from "@sytechui/shared-utils";
|
|
29
|
+
import { AnimatePresence, LazyMotion, MotionConfig } from "framer-motion";
|
|
30
|
+
import { useLocale } from "@react-aria/i18n";
|
|
31
|
+
import { ResizablePanel } from "@sytechui/framer-utils";
|
|
32
|
+
import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
|
|
33
|
+
import { createElement } from "react";
|
|
34
|
+
var domAnimation = () => import("@sytechui/dom-animation").then((res) => res.default);
|
|
35
|
+
var PopLayoutWrapper = forwardRef(
|
|
36
|
+
(props, ref) => {
|
|
37
|
+
return /* @__PURE__ */ jsx("div", { ref, ...props });
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
PopLayoutWrapper.displayName = "HeroUI - PopLayoutWrapper";
|
|
41
|
+
function CalendarBase(props) {
|
|
42
|
+
const {
|
|
43
|
+
Component = "div",
|
|
44
|
+
showHelper,
|
|
45
|
+
topContent,
|
|
46
|
+
bottomContent,
|
|
47
|
+
calendarProps,
|
|
48
|
+
nextButtonProps,
|
|
49
|
+
prevButtonProps,
|
|
50
|
+
buttonPickerProps,
|
|
51
|
+
errorMessageProps,
|
|
52
|
+
calendarRef: ref,
|
|
53
|
+
errorMessage,
|
|
54
|
+
firstDayOfWeek,
|
|
55
|
+
...otherProps
|
|
56
|
+
} = props;
|
|
57
|
+
const { state, slots, visibleMonths, showMonthAndYearPickers, disableAnimation, classNames } = useCalendarContext();
|
|
58
|
+
const [direction, setDirection] = useState(0);
|
|
59
|
+
const { direction: localeDirection } = useLocale();
|
|
60
|
+
const currentMonth = state.visibleRange.start;
|
|
61
|
+
const headers = [];
|
|
62
|
+
const calendars = [];
|
|
63
|
+
const isRTL = localeDirection === "rtl";
|
|
64
|
+
for (let i = 0; i < visibleMonths; i++) {
|
|
65
|
+
let d = currentMonth.add({ months: i });
|
|
66
|
+
headers.push(
|
|
67
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
68
|
+
i === 0 && /* @__PURE__ */ jsx(
|
|
69
|
+
Button,
|
|
70
|
+
{
|
|
71
|
+
...isRTL ? nextButtonProps : prevButtonProps,
|
|
72
|
+
onPress: chain(
|
|
73
|
+
isRTL ? nextButtonProps.onPress : prevButtonProps.onPress,
|
|
74
|
+
() => setDirection(-1)
|
|
75
|
+
),
|
|
76
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
/* @__PURE__ */ jsx(
|
|
80
|
+
CalendarHeader,
|
|
81
|
+
{
|
|
82
|
+
buttonPickerProps,
|
|
83
|
+
currentMonth,
|
|
84
|
+
date: d,
|
|
85
|
+
direction
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
i === visibleMonths - 1 && /* @__PURE__ */ jsx(
|
|
89
|
+
Button,
|
|
90
|
+
{
|
|
91
|
+
...isRTL ? prevButtonProps : nextButtonProps,
|
|
92
|
+
onPress: chain(
|
|
93
|
+
isRTL ? prevButtonProps.onPress : nextButtonProps.onPress,
|
|
94
|
+
() => setDirection(1)
|
|
95
|
+
),
|
|
96
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] }, `calendar-header-${i}`)
|
|
100
|
+
);
|
|
101
|
+
const calendarMonthContent = /* @__PURE__ */ createElement(
|
|
102
|
+
CalendarMonth,
|
|
103
|
+
{
|
|
104
|
+
...props,
|
|
105
|
+
key: `calendar-month-${i}`,
|
|
106
|
+
currentMonth: currentMonth.month,
|
|
107
|
+
direction,
|
|
108
|
+
firstDayOfWeek,
|
|
109
|
+
startDate: d
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
calendars.push(
|
|
113
|
+
showMonthAndYearPickers ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
114
|
+
calendarMonthContent,
|
|
115
|
+
/* @__PURE__ */ jsx(CalendarPicker, { currentMonth, date: d })
|
|
116
|
+
] }, `calendar-month-with-pickers-${i}`) : calendarMonthContent
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
const calendarContent = /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
120
|
+
/* @__PURE__ */ jsx(
|
|
121
|
+
"div",
|
|
122
|
+
{
|
|
123
|
+
className: slots == null ? void 0 : slots.headerWrapper({ class: classNames == null ? void 0 : classNames.headerWrapper }),
|
|
124
|
+
"data-slot": "header-wrapper",
|
|
125
|
+
children: headers
|
|
126
|
+
},
|
|
127
|
+
"header-wrapper"
|
|
128
|
+
),
|
|
129
|
+
/* @__PURE__ */ jsx(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
className: slots == null ? void 0 : slots.gridWrapper({ class: classNames == null ? void 0 : classNames.gridWrapper }),
|
|
133
|
+
"data-slot": "grid-wrapper",
|
|
134
|
+
children: calendars
|
|
135
|
+
},
|
|
136
|
+
"grid-wrapper"
|
|
137
|
+
)
|
|
138
|
+
] });
|
|
139
|
+
return /* @__PURE__ */ jsxs(Component, { ...mergeProps(calendarProps, otherProps), ref, children: [
|
|
140
|
+
topContent,
|
|
141
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("h2", { children: calendarProps["aria-label"] }) }),
|
|
142
|
+
disableAnimation ? /* @__PURE__ */ jsx("div", { className: slots == null ? void 0 : slots.content({ class: classNames == null ? void 0 : classNames.content }), "data-slot": "content", children: calendarContent }) : /* @__PURE__ */ jsx(
|
|
143
|
+
ResizablePanel,
|
|
144
|
+
{
|
|
145
|
+
className: slots == null ? void 0 : slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
146
|
+
"data-slot": "content",
|
|
147
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, { custom: direction, initial: false, mode: "popLayout", children: /* @__PURE__ */ jsx(PopLayoutWrapper, { children: /* @__PURE__ */ jsx(MotionConfig, { transition, children: /* @__PURE__ */ jsx(LazyMotion, { features: domAnimation, children: calendarContent }) }) }) })
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(
|
|
151
|
+
"button",
|
|
152
|
+
{
|
|
153
|
+
"aria-label": nextButtonProps["aria-label"],
|
|
154
|
+
disabled: nextButtonProps.isDisabled,
|
|
155
|
+
tabIndex: -1,
|
|
156
|
+
onClick: () => state.focusNextPage()
|
|
157
|
+
}
|
|
158
|
+
) }),
|
|
159
|
+
state.isValueInvalid && showHelper && /* @__PURE__ */ jsx(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
className: slots == null ? void 0 : slots.helperWrapper({ class: classNames == null ? void 0 : classNames.helperWrapper }),
|
|
163
|
+
"data-slot": "helper-wrapper",
|
|
164
|
+
children: /* @__PURE__ */ jsx(
|
|
165
|
+
"span",
|
|
166
|
+
{
|
|
167
|
+
...errorMessageProps,
|
|
168
|
+
className: slots == null ? void 0 : slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage }),
|
|
169
|
+
"data-slot": "error-message",
|
|
170
|
+
children: errorMessage || "Selected date unavailable."
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
bottomContent
|
|
176
|
+
] });
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export {
|
|
180
|
+
CalendarBase
|
|
181
|
+
};
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { default as Calendar, CalendarProps } from './calendar.mjs';
|
|
2
|
+
export { default as RangeCalendar, RangeCalendarProps } from './range-calendar.mjs';
|
|
3
|
+
export { CalendarDate } from '@internationalized/date';
|
|
4
|
+
export { DateValue } from '@react-types/calendar';
|
|
5
|
+
export { RangeValue } from '@react-types/shared';
|
|
6
|
+
export { useCalendar } from './use-calendar.mjs';
|
|
7
|
+
export { useRangeCalendar } from './use-range-calendar.mjs';
|
|
8
|
+
export { CalendarProvider, useCalendarContext } from './calendar-context.mjs';
|
|
9
|
+
import 'react';
|
|
10
|
+
import '@sytechui/theme';
|
|
11
|
+
import 'tailwind-variants';
|
|
12
|
+
import '@sytechui/system';
|
|
13
|
+
import '@react-stately/calendar';
|
|
14
|
+
import './use-calendar-base.mjs';
|
|
15
|
+
import '@sytechui/system/src/types';
|
|
16
|
+
import '@react-aria/calendar';
|
|
17
|
+
import '@react-types/button';
|
|
18
|
+
import '@sytechui/button';
|
|
19
|
+
import '@sytechui/react-utils';
|
|
20
|
+
import './calendar-base.mjs';
|
|
21
|
+
import 'react/jsx-runtime';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { default as Calendar, CalendarProps } from './calendar.js';
|
|
2
|
+
export { default as RangeCalendar, RangeCalendarProps } from './range-calendar.js';
|
|
3
|
+
export { CalendarDate } from '@internationalized/date';
|
|
4
|
+
export { DateValue } from '@react-types/calendar';
|
|
5
|
+
export { RangeValue } from '@react-types/shared';
|
|
6
|
+
export { useCalendar } from './use-calendar.js';
|
|
7
|
+
export { useRangeCalendar } from './use-range-calendar.js';
|
|
8
|
+
export { CalendarProvider, useCalendarContext } from './calendar-context.js';
|
|
9
|
+
import 'react';
|
|
10
|
+
import '@sytechui/theme';
|
|
11
|
+
import 'tailwind-variants';
|
|
12
|
+
import '@sytechui/system';
|
|
13
|
+
import '@react-stately/calendar';
|
|
14
|
+
import './use-calendar-base.js';
|
|
15
|
+
import '@sytechui/system/src/types';
|
|
16
|
+
import '@react-aria/calendar';
|
|
17
|
+
import '@react-types/button';
|
|
18
|
+
import '@sytechui/button';
|
|
19
|
+
import '@sytechui/react-utils';
|
|
20
|
+
import './calendar-base.js';
|
|
21
|
+
import 'react/jsx-runtime';
|