@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.
Files changed (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +24 -0
  3. package/dist/calendar-base.d.mts +23 -0
  4. package/dist/calendar-base.d.ts +23 -0
  5. package/dist/calendar-base.js +604 -0
  6. package/dist/calendar-base.mjs +17 -0
  7. package/dist/calendar-cell.d.mts +18 -0
  8. package/dist/calendar-cell.d.ts +18 -0
  9. package/dist/calendar-cell.js +97 -0
  10. package/dist/calendar-cell.mjs +7 -0
  11. package/dist/calendar-context.d.mts +19 -0
  12. package/dist/calendar-context.d.ts +19 -0
  13. package/dist/calendar-context.js +38 -0
  14. package/dist/calendar-context.mjs +9 -0
  15. package/dist/calendar-header.d.mts +14 -0
  16. package/dist/calendar-header.d.ts +14 -0
  17. package/dist/calendar-header.js +156 -0
  18. package/dist/calendar-header.mjs +10 -0
  19. package/dist/calendar-month.d.mts +13 -0
  20. package/dist/calendar-month.d.ts +13 -0
  21. package/dist/calendar-month.js +226 -0
  22. package/dist/calendar-month.mjs +10 -0
  23. package/dist/calendar-picker.d.mts +12 -0
  24. package/dist/calendar-picker.d.ts +12 -0
  25. package/dist/calendar-picker.js +83 -0
  26. package/dist/calendar-picker.mjs +9 -0
  27. package/dist/calendar-transitions.d.mts +10 -0
  28. package/dist/calendar-transitions.d.ts +10 -0
  29. package/dist/calendar-transitions.js +48 -0
  30. package/dist/calendar-transitions.mjs +9 -0
  31. package/dist/calendar.d.mts +24 -0
  32. package/dist/calendar.d.ts +24 -0
  33. package/dist/calendar.js +876 -0
  34. package/dist/calendar.mjs +20 -0
  35. package/dist/chevron-down.d.mts +6 -0
  36. package/dist/chevron-down.d.ts +6 -0
  37. package/dist/chevron-down.js +54 -0
  38. package/dist/chevron-down.mjs +7 -0
  39. package/dist/chevron-left.d.mts +6 -0
  40. package/dist/chevron-left.d.ts +6 -0
  41. package/dist/chevron-left.js +54 -0
  42. package/dist/chevron-left.mjs +7 -0
  43. package/dist/chevron-right.d.mts +6 -0
  44. package/dist/chevron-right.d.ts +6 -0
  45. package/dist/chevron-right.js +54 -0
  46. package/dist/chevron-right.mjs +7 -0
  47. package/dist/chunk-5CY7DCRB.mjs +24 -0
  48. package/dist/chunk-AJXW2JXW.mjs +23 -0
  49. package/dist/chunk-BEC3B3UO.mjs +23 -0
  50. package/dist/chunk-CPBF6DM2.mjs +120 -0
  51. package/dist/chunk-DN6I5LXB.mjs +125 -0
  52. package/dist/chunk-H34OUI62.mjs +157 -0
  53. package/dist/chunk-HUKPVIZ5.mjs +31 -0
  54. package/dist/chunk-IDU5RSFL.mjs +93 -0
  55. package/dist/chunk-IFK7FCNU.mjs +42 -0
  56. package/dist/chunk-JJRY4BYN.mjs +31 -0
  57. package/dist/chunk-JQFIYCMS.mjs +19 -0
  58. package/dist/chunk-MCZLP73P.mjs +14 -0
  59. package/dist/chunk-MDGP3JHC.mjs +74 -0
  60. package/dist/chunk-MUYVZHWM.mjs +31 -0
  61. package/dist/chunk-OEB7VI2R.mjs +125 -0
  62. package/dist/chunk-ZJZG3P2K.mjs +181 -0
  63. package/dist/index.d.mts +21 -0
  64. package/dist/index.d.ts +21 -0
  65. package/dist/index.js +1020 -0
  66. package/dist/index.mjs +36 -0
  67. package/dist/range-calendar.d.mts +24 -0
  68. package/dist/range-calendar.d.ts +24 -0
  69. package/dist/range-calendar.js +876 -0
  70. package/dist/range-calendar.mjs +20 -0
  71. package/dist/use-calendar-base.d.mts +1224 -0
  72. package/dist/use-calendar-base.d.ts +1224 -0
  73. package/dist/use-calendar-base.js +174 -0
  74. package/dist/use-calendar-base.mjs +7 -0
  75. package/dist/use-calendar-picker.d.mts +482 -0
  76. package/dist/use-calendar-picker.d.ts +482 -0
  77. package/dist/use-calendar-picker.js +49 -0
  78. package/dist/use-calendar-picker.mjs +8 -0
  79. package/dist/use-calendar.d.mts +494 -0
  80. package/dist/use-calendar.d.ts +494 -0
  81. package/dist/use-calendar.js +293 -0
  82. package/dist/use-calendar.mjs +8 -0
  83. package/dist/use-range-calendar.d.mts +498 -0
  84. package/dist/use-range-calendar.d.ts +498 -0
  85. package/dist/use-range-calendar.js +293 -0
  86. package/dist/use-range-calendar.mjs +8 -0
  87. package/dist/utils.d.mts +7 -0
  88. package/dist/utils.d.ts +7 -0
  89. package/dist/utils.js +59 -0
  90. package/dist/utils.mjs +33 -0
  91. package/package.json +74 -0
@@ -0,0 +1,157 @@
1
+ "use client";
2
+
3
+ // src/use-calendar-base.ts
4
+ import { createCalendar, CalendarDate, DateFormatter } from "@internationalized/date";
5
+ import { mapPropsVariants, useProviderContext } from "@sytechui/system";
6
+ import { useCallback, useMemo } from "react";
7
+ import { calendar } from "@sytechui/theme";
8
+ import { useControlledState } from "@react-stately/utils";
9
+ import { useDOMRef } from "@sytechui/react-utils";
10
+ import { useLocale } from "@react-aria/i18n";
11
+ import {
12
+ clamp,
13
+ dataAttr,
14
+ objectToDeps,
15
+ getGregorianYearOffset,
16
+ mergeProps
17
+ } from "@sytechui/shared-utils";
18
+ function useCalendarBase(originalProps) {
19
+ var _a, _b, _c, _d, _e, _f, _g;
20
+ const [props, variantProps] = mapPropsVariants(originalProps, calendar.variantKeys);
21
+ const globalContext = useProviderContext();
22
+ const { locale, direction } = useLocale();
23
+ const isRTL = direction === "rtl";
24
+ const calendarProp = createCalendar(
25
+ new DateFormatter(locale).resolvedOptions().calendar
26
+ );
27
+ const gregorianYearOffset = getGregorianYearOffset(calendarProp.identifier);
28
+ const {
29
+ ref,
30
+ as,
31
+ children,
32
+ className,
33
+ topContent,
34
+ bottomContent,
35
+ showHelper = true,
36
+ firstDayOfWeek,
37
+ calendarWidth = 256,
38
+ visibleMonths: visibleMonthsProp = 1,
39
+ weekdayStyle = "narrow",
40
+ navButtonProps = {},
41
+ isHeaderExpanded: isHeaderExpandedProp,
42
+ isHeaderDefaultExpanded,
43
+ onHeaderExpandedChange = () => {
44
+ },
45
+ createCalendar: createCalendarProp = (_a = globalContext == null ? void 0 : globalContext.createCalendar) != null ? _a : null,
46
+ minValue = (_c = (_b = globalContext == null ? void 0 : globalContext.defaultDates) == null ? void 0 : _b.minDate) != null ? _c : new CalendarDate(calendarProp, 1900 + gregorianYearOffset, 1, 1),
47
+ maxValue = (_e = (_d = globalContext == null ? void 0 : globalContext.defaultDates) == null ? void 0 : _d.maxDate) != null ? _e : new CalendarDate(calendarProp, 2099 + gregorianYearOffset, 12, 31),
48
+ prevButtonProps: prevButtonPropsProp,
49
+ nextButtonProps: nextButtonPropsProp,
50
+ errorMessage,
51
+ classNames,
52
+ ...otherProps
53
+ } = props;
54
+ const Component = as || "div";
55
+ const visibleMonths = clamp(visibleMonthsProp, 1, 3);
56
+ const showMonthAndYearPickers = originalProps.showMonthAndYearPickers && visibleMonths === 1;
57
+ const domRef = useDOMRef(ref);
58
+ const handleHeaderExpandedChange = useCallback(
59
+ (isExpanded) => {
60
+ onHeaderExpandedChange(isExpanded || false);
61
+ },
62
+ [onHeaderExpandedChange]
63
+ );
64
+ const [isHeaderExpanded, setIsHeaderExpanded] = useControlledState(
65
+ isHeaderExpandedProp,
66
+ isHeaderDefaultExpanded != null ? isHeaderDefaultExpanded : false,
67
+ handleHeaderExpandedChange
68
+ );
69
+ const visibleDuration = useMemo(() => ({ months: visibleMonths }), [visibleMonths]);
70
+ const hasMultipleMonths = visibleMonths > 1;
71
+ const shouldFilterDOMProps = typeof Component === "string";
72
+ const slots = useMemo(
73
+ () => calendar({
74
+ ...variantProps,
75
+ showMonthAndYearPickers,
76
+ isRange: !!originalProps.isRange,
77
+ isHeaderWrapperExpanded: isHeaderExpanded,
78
+ className,
79
+ isRTL
80
+ }),
81
+ [objectToDeps(variantProps), showMonthAndYearPickers, isHeaderExpanded, className]
82
+ );
83
+ const disableAnimation = (_g = (_f = originalProps.disableAnimation) != null ? _f : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _g : false;
84
+ const commonButtonProps = {
85
+ size: "sm",
86
+ variant: "light",
87
+ radius: "full",
88
+ isIconOnly: true,
89
+ disableAnimation,
90
+ ...navButtonProps
91
+ };
92
+ const baseProps = {
93
+ "data-slot": "base",
94
+ "data-has-multiple-months": dataAttr(hasMultipleMonths),
95
+ style: {
96
+ // @ts-ignore
97
+ "--visible-months": typeof visibleMonths === "number" ? `${visibleMonths}` : visibleMonths,
98
+ "--calendar-width": typeof calendarWidth === "number" ? `${calendarWidth}px` : calendarWidth
99
+ }
100
+ };
101
+ const getPrevButtonProps = (props2 = {}) => {
102
+ return {
103
+ "data-slot": "prev-button",
104
+ tabIndex: isHeaderExpanded ? -1 : 0,
105
+ className: slots.prevButton({ class: classNames == null ? void 0 : classNames.prevButton }),
106
+ ...mergeProps(commonButtonProps, prevButtonPropsProp, props2)
107
+ };
108
+ };
109
+ const getNextButtonProps = (props2 = {}) => {
110
+ return {
111
+ "data-slot": "next-button",
112
+ tabIndex: isHeaderExpanded ? -1 : 0,
113
+ className: slots.nextButton({ class: classNames == null ? void 0 : classNames.nextButton }),
114
+ ...mergeProps(commonButtonProps, nextButtonPropsProp, props2)
115
+ };
116
+ };
117
+ const getErrorMessageProps = (props2 = {}) => {
118
+ return {
119
+ "data-slot": "error-message",
120
+ className: slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage }),
121
+ ...props2
122
+ };
123
+ };
124
+ return {
125
+ Component,
126
+ children,
127
+ domRef,
128
+ slots,
129
+ locale,
130
+ minValue,
131
+ maxValue,
132
+ baseProps,
133
+ showHelper,
134
+ firstDayOfWeek,
135
+ weekdayStyle,
136
+ visibleMonths,
137
+ visibleDuration,
138
+ shouldFilterDOMProps,
139
+ isHeaderExpanded,
140
+ showMonthAndYearPickers,
141
+ disableAnimation,
142
+ createCalendar: createCalendarProp,
143
+ getPrevButtonProps,
144
+ getNextButtonProps,
145
+ getErrorMessageProps,
146
+ setIsHeaderExpanded,
147
+ topContent,
148
+ bottomContent,
149
+ errorMessage,
150
+ classNames,
151
+ otherProps
152
+ };
153
+ }
154
+
155
+ export {
156
+ useCalendarBase
157
+ };
@@ -0,0 +1,31 @@
1
+ "use client";
2
+
3
+ // src/chevron-left.tsx
4
+ import { jsx } from "react/jsx-runtime";
5
+ var ChevronLeftIcon = (props) => /* @__PURE__ */ jsx(
6
+ "svg",
7
+ {
8
+ "aria-hidden": "true",
9
+ fill: "none",
10
+ focusable: "false",
11
+ height: "1em",
12
+ role: "presentation",
13
+ viewBox: "0 0 16 16",
14
+ width: "1em",
15
+ ...props,
16
+ children: /* @__PURE__ */ jsx(
17
+ "path",
18
+ {
19
+ d: "M10 3.33334L6 8.00001L10 12.6667",
20
+ stroke: "currentColor",
21
+ strokeLinecap: "round",
22
+ strokeLinejoin: "round",
23
+ strokeWidth: "1.5"
24
+ }
25
+ )
26
+ }
27
+ );
28
+
29
+ export {
30
+ ChevronLeftIcon
31
+ };
@@ -0,0 +1,93 @@
1
+ "use client";
2
+ import {
3
+ ChevronDownIcon
4
+ } from "./chunk-JJRY4BYN.mjs";
5
+ import {
6
+ useCalendarContext
7
+ } from "./chunk-MCZLP73P.mjs";
8
+ import {
9
+ slideVariants
10
+ } from "./chunk-5CY7DCRB.mjs";
11
+
12
+ // src/calendar-header.tsx
13
+ import { useDateFormatter } from "@react-aria/i18n";
14
+ import { m } from "framer-motion";
15
+ import { Button } from "@sytechui/button";
16
+ import { useCallback } from "react";
17
+ import { Fragment, jsx } from "react/jsx-runtime";
18
+ function CalendarHeader(props) {
19
+ const { direction, date, currentMonth, buttonPickerProps } = props;
20
+ const {
21
+ state,
22
+ slots,
23
+ headerRef,
24
+ showMonthAndYearPickers,
25
+ isHeaderExpanded,
26
+ setIsHeaderExpanded,
27
+ disableAnimation,
28
+ classNames
29
+ } = useCalendarContext();
30
+ const monthAndYearDateFormatter = useDateFormatter({
31
+ month: "long",
32
+ era: currentMonth.calendar.identifier === "gregory" && currentMonth.era === "BC" ? "short" : void 0,
33
+ calendar: currentMonth.calendar.identifier,
34
+ timeZone: state.timeZone,
35
+ year: "numeric"
36
+ });
37
+ const monthDateContent = monthAndYearDateFormatter.format(date.toDate(state.timeZone));
38
+ const headerTitle = /* @__PURE__ */ jsx(Fragment, { children: disableAnimation ? /* @__PURE__ */ jsx(
39
+ "span",
40
+ {
41
+ "aria-hidden": true,
42
+ className: slots == null ? void 0 : slots.title({ class: classNames == null ? void 0 : classNames.title }),
43
+ "data-slot": "title",
44
+ children: monthDateContent
45
+ },
46
+ currentMonth.month
47
+ ) : /* @__PURE__ */ jsx(
48
+ m.span,
49
+ {
50
+ animate: "center",
51
+ "aria-hidden": true,
52
+ className: slots == null ? void 0 : slots.title({ class: classNames == null ? void 0 : classNames.title }),
53
+ custom: direction,
54
+ "data-slot": "title",
55
+ exit: "exit",
56
+ initial: "enter",
57
+ variants: isHeaderExpanded ? {} : slideVariants,
58
+ children: monthDateContent
59
+ },
60
+ currentMonth.month
61
+ ) });
62
+ const headerProps = {
63
+ ref: headerRef,
64
+ className: slots == null ? void 0 : slots.header({ class: classNames == null ? void 0 : classNames.header }),
65
+ "data-slot": "header"
66
+ };
67
+ const handleKeyDown = useCallback(
68
+ (e) => {
69
+ if (e.key === "Escape") {
70
+ e.preventDefault();
71
+ e.stopPropagation();
72
+ setIsHeaderExpanded == null ? void 0 : setIsHeaderExpanded(false);
73
+ }
74
+ },
75
+ [setIsHeaderExpanded]
76
+ );
77
+ return showMonthAndYearPickers ? /* @__PURE__ */ jsx(
78
+ Button,
79
+ {
80
+ ...headerProps,
81
+ "aria-label": "switch to year and month view",
82
+ disableAnimation,
83
+ endContent: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "chevron-icon" }),
84
+ onKeyDown: handleKeyDown,
85
+ ...buttonPickerProps,
86
+ children: headerTitle
87
+ }
88
+ ) : /* @__PURE__ */ jsx("header", { ...headerProps, children: headerTitle });
89
+ }
90
+
91
+ export {
92
+ CalendarHeader
93
+ };
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import {
3
+ useCalendarPicker
4
+ } from "./chunk-JQFIYCMS.mjs";
5
+
6
+ // src/calendar-picker.tsx
7
+ import { TimePicker } from "@sytechui/time-picker";
8
+ import { jsx } from "react/jsx-runtime";
9
+ function CalendarPicker(props) {
10
+ const { state, slots, classNames, isHeaderExpanded } = useCalendarPicker(props);
11
+ return /* @__PURE__ */ jsx(
12
+ "div",
13
+ {
14
+ className: slots == null ? void 0 : slots.pickerWrapper({
15
+ class: classNames == null ? void 0 : classNames.pickerWrapper
16
+ }),
17
+ "data-slot": "picker-wrapper",
18
+ inert: !isHeaderExpanded ? true : void 0,
19
+ children: /* @__PURE__ */ jsx(
20
+ TimePicker,
21
+ {
22
+ isMonth: true,
23
+ isYear: true,
24
+ isDay: false,
25
+ value: state.focusedDate,
26
+ onChange: (date) => {
27
+ state.setFocusedDate(
28
+ state.focusedDate.set({
29
+ year: date.year,
30
+ month: date.month
31
+ })
32
+ );
33
+ }
34
+ }
35
+ )
36
+ }
37
+ );
38
+ }
39
+
40
+ export {
41
+ CalendarPicker
42
+ };
@@ -0,0 +1,31 @@
1
+ "use client";
2
+
3
+ // src/chevron-down.tsx
4
+ import { jsx } from "react/jsx-runtime";
5
+ var ChevronDownIcon = (props) => /* @__PURE__ */ jsx(
6
+ "svg",
7
+ {
8
+ "aria-hidden": "true",
9
+ fill: "none",
10
+ focusable: "false",
11
+ height: "1em",
12
+ role: "presentation",
13
+ viewBox: "0 0 24 24",
14
+ width: "1em",
15
+ ...props,
16
+ children: /* @__PURE__ */ jsx(
17
+ "path",
18
+ {
19
+ d: "M19 9L12 15L5 9",
20
+ stroke: "currentColor",
21
+ strokeLinecap: "round",
22
+ strokeLinejoin: "round",
23
+ strokeWidth: "1.5"
24
+ }
25
+ )
26
+ }
27
+ );
28
+
29
+ export {
30
+ ChevronDownIcon
31
+ };
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import {
3
+ useCalendarContext
4
+ } from "./chunk-MCZLP73P.mjs";
5
+
6
+ // src/use-calendar-picker.ts
7
+ function useCalendarPicker(_props) {
8
+ const { slots, state, isHeaderExpanded, classNames } = useCalendarContext();
9
+ return {
10
+ state,
11
+ slots,
12
+ classNames,
13
+ isHeaderExpanded
14
+ };
15
+ }
16
+
17
+ export {
18
+ useCalendarPicker
19
+ };
@@ -0,0 +1,14 @@
1
+ "use client";
2
+
3
+ // src/calendar-context.ts
4
+ import { createContext } from "@sytechui/react-utils";
5
+ var [CalendarProvider, useCalendarContext] = createContext({
6
+ name: "CalendarContext",
7
+ strict: true,
8
+ errorMessage: "useContext: `context` is undefined. Seems you forgot to wrap component within the CalendarProvider"
9
+ });
10
+
11
+ export {
12
+ CalendarProvider,
13
+ useCalendarContext
14
+ };
@@ -0,0 +1,74 @@
1
+ "use client";
2
+
3
+ // src/calendar-cell.tsx
4
+ import { getDayOfWeek, isSameDay, isSameMonth, isToday } from "@internationalized/date";
5
+ import { useCalendarCell } from "@react-aria/calendar";
6
+ import { useLocale } from "@react-aria/i18n";
7
+ import { useFocusRing } from "@react-aria/focus";
8
+ import { useHover } from "@react-aria/interactions";
9
+ import { useRef } from "react";
10
+ import { dataAttr, mergeProps } from "@sytechui/shared-utils";
11
+ import { jsx } from "react/jsx-runtime";
12
+ function CalendarCell(originalProps) {
13
+ const { state, slots, isPickerVisible, currentMonth, classNames, firstDayOfWeek, ...props } = originalProps;
14
+ const ref = useRef(null);
15
+ const {
16
+ cellProps,
17
+ buttonProps,
18
+ isPressed,
19
+ isSelected,
20
+ isDisabled,
21
+ isFocused,
22
+ isInvalid,
23
+ formattedDate
24
+ } = useCalendarCell(
25
+ {
26
+ ...props,
27
+ isDisabled: !isSameMonth(props.date, currentMonth) || isPickerVisible
28
+ },
29
+ state,
30
+ ref
31
+ );
32
+ const isUnavailable = state.isCellUnavailable(props.date);
33
+ const isLastSelectedBeforeDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.add({ days: 1 }));
34
+ const isFirstSelectedAfterDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.subtract({ days: 1 }));
35
+ const highlightedRange = "highlightedRange" in state && state.highlightedRange;
36
+ const isSelectionStart = isSelected && highlightedRange ? isSameDay(props.date, highlightedRange.start) : false;
37
+ const isSelectionEnd = isSelected && highlightedRange ? isSameDay(props.date, highlightedRange.end) : false;
38
+ const { locale } = useLocale();
39
+ const dayOfWeek = getDayOfWeek(props.date, locale, firstDayOfWeek);
40
+ const isRangeStart = isSelected && (isFirstSelectedAfterDisabled || dayOfWeek === 0 || props.date.day === 1);
41
+ const isRangeEnd = isSelected && (isLastSelectedBeforeDisabled || dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));
42
+ const { focusProps, isFocusVisible } = useFocusRing();
43
+ const { hoverProps, isHovered } = useHover({
44
+ isDisabled: isDisabled || isUnavailable || state.isReadOnly
45
+ });
46
+ return /* @__PURE__ */ jsx("td", { className: slots == null ? void 0 : slots.cell({ class: classNames == null ? void 0 : classNames.cell }), "data-slot": "cell", ...cellProps, children: /* @__PURE__ */ jsx(
47
+ "span",
48
+ {
49
+ ...mergeProps(buttonProps, hoverProps, focusProps),
50
+ ref,
51
+ className: slots == null ? void 0 : slots.cellButton({ class: classNames == null ? void 0 : classNames.cellButton }),
52
+ "data-disabled": dataAttr(isDisabled && !isInvalid),
53
+ "data-focus-visible": dataAttr(isFocused && isFocusVisible),
54
+ "data-hover": dataAttr(isHovered),
55
+ "data-invalid": dataAttr(isInvalid),
56
+ "data-outside-month": dataAttr(!isSameMonth(props.date, currentMonth)),
57
+ "data-pressed": dataAttr(isPressed && !state.isReadOnly),
58
+ "data-range-end": dataAttr(isRangeEnd),
59
+ "data-range-selection": dataAttr(isSelected && "highlightedRange" in state),
60
+ "data-range-start": dataAttr(isRangeStart),
61
+ "data-readonly": dataAttr(state.isReadOnly),
62
+ "data-selected": dataAttr(isSelected),
63
+ "data-selection-end": dataAttr(isSelectionEnd),
64
+ "data-selection-start": dataAttr(isSelectionStart),
65
+ "data-today": dataAttr(isToday(props.date, state.timeZone)),
66
+ "data-unavailable": dataAttr(isUnavailable),
67
+ children: /* @__PURE__ */ jsx("span", { children: formattedDate })
68
+ }
69
+ ) });
70
+ }
71
+
72
+ export {
73
+ CalendarCell
74
+ };
@@ -0,0 +1,31 @@
1
+ "use client";
2
+
3
+ // src/chevron-right.tsx
4
+ import { jsx } from "react/jsx-runtime";
5
+ var ChevronRightIcon = (props) => /* @__PURE__ */ jsx(
6
+ "svg",
7
+ {
8
+ "aria-hidden": "true",
9
+ fill: "none",
10
+ focusable: "false",
11
+ height: "1em",
12
+ role: "presentation",
13
+ viewBox: "0 0 16 16",
14
+ width: "1em",
15
+ ...props,
16
+ children: /* @__PURE__ */ jsx(
17
+ "path",
18
+ {
19
+ d: "M6 3.33334L10 8.00001L6 12.6667",
20
+ stroke: "currentColor",
21
+ strokeLinecap: "round",
22
+ strokeLinejoin: "round",
23
+ strokeWidth: "1.5"
24
+ }
25
+ )
26
+ }
27
+ );
28
+
29
+ export {
30
+ ChevronRightIcon
31
+ };
@@ -0,0 +1,125 @@
1
+ "use client";
2
+ import {
3
+ useCalendarBase
4
+ } from "./chunk-H34OUI62.mjs";
5
+
6
+ // src/use-calendar.ts
7
+ import { useMemo, useRef } from "react";
8
+ import { filterDOMProps } from "@sytechui/react-utils";
9
+ import { useCalendar as useAriaCalendar } from "@react-aria/calendar";
10
+ import { useCalendarState } from "@react-stately/calendar";
11
+ import { createCalendar } from "@internationalized/date";
12
+ import { chain, mergeProps } from "@sytechui/shared-utils";
13
+ import { cn } from "@sytechui/theme";
14
+ function useCalendar({
15
+ buttonPickerProps: buttonPickerPropsProp,
16
+ className,
17
+ ...originalProps
18
+ }) {
19
+ const {
20
+ Component,
21
+ slots,
22
+ children,
23
+ domRef,
24
+ locale,
25
+ minValue,
26
+ maxValue,
27
+ showHelper,
28
+ firstDayOfWeek,
29
+ weekdayStyle,
30
+ visibleDuration,
31
+ baseProps,
32
+ disableAnimation,
33
+ shouldFilterDOMProps,
34
+ isHeaderExpanded,
35
+ visibleMonths,
36
+ createCalendar: createCalendarProp,
37
+ showMonthAndYearPickers,
38
+ getPrevButtonProps,
39
+ getNextButtonProps,
40
+ getErrorMessageProps,
41
+ setIsHeaderExpanded,
42
+ topContent,
43
+ bottomContent,
44
+ errorMessage,
45
+ classNames,
46
+ otherProps
47
+ } = useCalendarBase(originalProps);
48
+ const headerRef = useRef(null);
49
+ const state = useCalendarState({
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 } = useAriaCalendar(originalProps, state);
58
+ const baseStyles = cn(classNames == null ? void 0 : classNames.base, className);
59
+ const buttonPickerProps = {
60
+ ...mergeProps(buttonPickerPropsProp, { isDisabled: originalProps.isDisabled }),
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
+ classNames,
95
+ showMonthAndYearPickers,
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
+ useCalendar
125
+ };