@proyecto-viviana/solidaria-components 0.4.0 → 0.4.1
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/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar.js +2 -11
- package/dist/ActionBar.js.map +1 -1
- package/dist/ActionBar.jsx +2 -11
- package/dist/ActionBar.jsx.map +1 -1
- package/dist/ActionGroup.d.ts.map +1 -1
- package/dist/ActionGroup.js +1 -1
- package/dist/ActionGroup.js.map +1 -1
- package/dist/ActionGroup.jsx +1 -1
- package/dist/ActionGroup.jsx.map +1 -1
- package/dist/Autocomplete.d.ts +2 -2
- package/dist/Autocomplete.d.ts.map +1 -1
- package/dist/Autocomplete.js +7 -7
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Autocomplete.jsx +7 -7
- package/dist/Autocomplete.jsx.map +1 -1
- package/dist/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs.js +15 -16
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/Breadcrumbs.jsx +19 -24
- package/dist/Breadcrumbs.jsx.map +1 -1
- package/dist/Calendar.d.ts.map +1 -1
- package/dist/Calendar.js +100 -65
- package/dist/Calendar.js.map +1 -1
- package/dist/Calendar.jsx +10 -1
- package/dist/Calendar.jsx.map +1 -1
- package/dist/Color.d.ts.map +1 -1
- package/dist/Color.js +15 -18
- package/dist/Color.js.map +1 -1
- package/dist/Color.jsx +15 -19
- package/dist/Color.jsx.map +1 -1
- package/dist/ComboBox.d.ts +4 -0
- package/dist/ComboBox.d.ts.map +1 -1
- package/dist/ComboBox.js +21 -13
- package/dist/ComboBox.js.map +1 -1
- package/dist/ComboBox.jsx +23 -13
- package/dist/ComboBox.jsx.map +1 -1
- package/dist/DateField.d.ts +11 -2
- package/dist/DateField.d.ts.map +1 -1
- package/dist/DateField2.js +237 -234
- package/dist/DateField2.js.map +1 -1
- package/dist/DateField2.jsx +134 -97
- package/dist/DateField2.jsx.map +1 -1
- package/dist/DatePicker.d.ts +42 -3
- package/dist/DatePicker.d.ts.map +1 -1
- package/dist/DatePicker.js +6 -990
- package/dist/DatePicker.jsx +6 -681
- package/dist/DatePicker2.js +1171 -0
- package/dist/DatePicker2.js.map +1 -0
- package/dist/DatePicker2.jsx +820 -0
- package/dist/DatePicker2.jsx.map +1 -0
- package/dist/DateRangePickerContext.d.ts +2 -0
- package/dist/DateRangePickerContext.d.ts.map +1 -1
- package/dist/Disclosure.d.ts.map +1 -1
- package/dist/Disclosure.js +3 -0
- package/dist/Disclosure.js.map +1 -1
- package/dist/Disclosure.jsx +1 -1
- package/dist/Disclosure.jsx.map +1 -1
- package/dist/GridList.d.ts.map +1 -1
- package/dist/GridList.js +2 -2
- package/dist/GridList.js.map +1 -1
- package/dist/GridList.jsx +2 -2
- package/dist/GridList.jsx.map +1 -1
- package/dist/ListBox.d.ts +2 -2
- package/dist/ListBox.d.ts.map +1 -1
- package/dist/ListBox.js +327 -166
- package/dist/ListBox.js.map +1 -1
- package/dist/ListBox.jsx +161 -25
- package/dist/ListBox.jsx.map +1 -1
- package/dist/Modal.d.ts.map +1 -1
- package/dist/Modal.js +7 -5
- package/dist/Modal.js.map +1 -1
- package/dist/Modal.jsx +5 -5
- package/dist/Modal.jsx.map +1 -1
- package/dist/Popover.d.ts.map +1 -1
- package/dist/Popover.js +16 -9
- package/dist/Popover.js.map +1 -1
- package/dist/Popover.jsx +25 -4
- package/dist/Popover.jsx.map +1 -1
- package/dist/RangeCalendar.d.ts.map +1 -1
- package/dist/RangeCalendar.js +182 -46
- package/dist/RangeCalendar.js.map +1 -1
- package/dist/RangeCalendar.jsx +72 -2
- package/dist/RangeCalendar.jsx.map +1 -1
- package/dist/SearchField.d.ts.map +1 -1
- package/dist/SearchField.js +26 -2
- package/dist/SearchField.js.map +1 -1
- package/dist/SearchField.jsx +26 -2
- package/dist/SearchField.jsx.map +1 -1
- package/dist/Select.d.ts +7 -0
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +62 -49
- package/dist/Select.js.map +1 -1
- package/dist/Select.jsx +33 -18
- package/dist/Select.jsx.map +1 -1
- package/dist/SharedElementTransition.d.ts.map +1 -1
- package/dist/SharedElementTransition.js +35 -33
- package/dist/SharedElementTransition.js.map +1 -1
- package/dist/SharedElementTransition.jsx +35 -33
- package/dist/SharedElementTransition.jsx.map +1 -1
- package/dist/StepList.d.ts.map +1 -1
- package/dist/StepList.js +2 -9
- package/dist/StepList.js.map +1 -1
- package/dist/StepList.jsx +1 -6
- package/dist/StepList.jsx.map +1 -1
- package/dist/Table.d.ts +2 -0
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +10 -3
- package/dist/Table.js.map +1 -1
- package/dist/Table.jsx +10 -3
- package/dist/Table.jsx.map +1 -1
- package/dist/Tabs.d.ts.map +1 -1
- package/dist/Tabs.js +3 -0
- package/dist/Tabs.js.map +1 -1
- package/dist/Tabs.jsx +1 -1
- package/dist/Tabs.jsx.map +1 -1
- package/dist/TagGroup.d.ts +3 -1
- package/dist/TagGroup.d.ts.map +1 -1
- package/dist/TagGroup.js +12 -8
- package/dist/TagGroup.js.map +1 -1
- package/dist/TagGroup.jsx +11 -8
- package/dist/TagGroup.jsx.map +1 -1
- package/dist/TextField.js +4 -1
- package/dist/TextField.js.map +1 -1
- package/dist/TextField.jsx +4 -1
- package/dist/TextField.jsx.map +1 -1
- package/dist/TimeField.d.ts +14 -50
- package/dist/TimeField.d.ts.map +1 -1
- package/dist/TimeField.js +111 -205
- package/dist/TimeField.js.map +1 -1
- package/dist/TimeField.jsx +76 -82
- package/dist/TimeField.jsx.map +1 -1
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Tree.js +3 -3
- package/dist/Tree.js.map +1 -1
- package/dist/Tree.jsx +3 -3
- package/dist/Tree.jsx.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -6
- package/dist/index.jsx +5 -6
- package/dist/useDragAndDrop.d.ts +0 -8
- package/dist/useDragAndDrop.d.ts.map +1 -1
- package/dist/useDragAndDrop2.js +6 -2
- package/dist/useDragAndDrop2.js.map +1 -1
- package/dist/useDragAndDrop2.jsx +6 -2
- package/dist/useDragAndDrop2.jsx.map +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -2
- package/dist/utils.js.map +1 -1
- package/dist/utils.jsx +2 -2
- package/dist/utils.jsx.map +1 -1
- package/package.json +3 -9
- package/src/ActionBar.tsx +10 -12
- package/src/ActionGroup.tsx +5 -3
- package/src/Autocomplete.tsx +14 -9
- package/src/Breadcrumbs.tsx +55 -38
- package/src/Calendar.tsx +30 -1
- package/src/Color.tsx +42 -27
- package/src/ComboBox.tsx +49 -17
- package/src/DateField.tsx +285 -52
- package/src/DatePicker.tsx +345 -57
- package/src/DateRangePickerContext.tsx +2 -0
- package/src/Disclosure.tsx +4 -0
- package/src/GridList.tsx +8 -2
- package/src/ListBox.tsx +323 -21
- package/src/Modal.tsx +21 -5
- package/src/Popover.tsx +28 -7
- package/src/RangeCalendar.tsx +120 -1
- package/src/SearchField.tsx +53 -1
- package/src/Select.tsx +101 -20
- package/src/SharedElementTransition.tsx +92 -36
- package/src/StepList.tsx +0 -7
- package/src/Table.tsx +19 -4
- package/src/Tabs.tsx +1 -0
- package/src/TagGroup.tsx +26 -6
- package/src/TextField.tsx +1 -1
- package/src/TimeField.tsx +113 -196
- package/src/Tree.tsx +14 -4
- package/src/index.ts +1 -8
- package/src/useDragAndDrop.ts +8 -10
- package/src/utils.tsx +3 -3
- package/dist/DatePicker.js.map +0 -1
- package/dist/DatePicker.jsx.map +0 -1
- package/dist/HiddenTimeInput.d.ts +0 -25
- package/dist/HiddenTimeInput.d.ts.map +0 -1
- package/dist/HiddenTimeInput.js +0 -104
- package/dist/HiddenTimeInput.js.map +0 -1
- package/dist/HiddenTimeInput.jsx +0 -69
- package/dist/HiddenTimeInput.jsx.map +0 -1
- package/src/HiddenTimeInput.tsx +0 -133
package/dist/RangeCalendar.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { dataAttr, useIsHydrated, useRenderProps } from "./utils.js";
|
|
2
2
|
import { VisuallyHidden } from "./VisuallyHidden.js";
|
|
3
|
-
import { className, createComponent, effect, getNextElement, getNextMarker, insert, mergeProps, runHydrationEvents, spread, style, template, use } from "solid-js/web";
|
|
3
|
+
import { className, createComponent, delegateEvents, effect, getNextElement, getNextMarker, insert, mergeProps, runHydrationEvents, setAttribute, setProperty, spread, style, template, use } from "solid-js/web";
|
|
4
4
|
import { For, Index, Show, createContext, createMemo, createSignal, splitProps, useContext } from "solid-js";
|
|
5
5
|
import { createCalendarGrid, createHover, createRangeCalendar, createRangeCalendarCell } from "@proyecto-viviana/solidaria";
|
|
6
6
|
import { createRangeCalendarState, endOfMonth, isSameMonth } from "@proyecto-viviana/solid-stately";
|
|
@@ -11,7 +11,7 @@ import { createRangeCalendarState, endOfMonth, isSameMonth } from "@proyecto-viv
|
|
|
11
11
|
* Pre-wired headless range calendar component that combines aria hooks.
|
|
12
12
|
* Port of react-aria-components/src/RangeCalendar.tsx
|
|
13
13
|
*/
|
|
14
|
-
var _tmpl$ = /*#__PURE__*/ template(`<div class="solidaria-RangeCalendar solidaria-RangeCalendar--placeholder"aria-hidden=true>`), _tmpl$2 = /*#__PURE__*/ template(`<h2>`), _tmpl$3 = /*#__PURE__*/ template(`<
|
|
14
|
+
var _tmpl$ = /*#__PURE__*/ template(`<div class="solidaria-RangeCalendar solidaria-RangeCalendar--placeholder"aria-hidden=true>`), _tmpl$2 = /*#__PURE__*/ template(`<h2>`), _tmpl$3 = /*#__PURE__*/ template(`<button tabindex=-1>`), _tmpl$4 = /*#__PURE__*/ template(`<div><!$><!/><!$><!/><!$><!/>`), _tmpl$5 = /*#__PURE__*/ template(`<h2 aria-live=polite>`), _tmpl$6 = /*#__PURE__*/ template(`<button>`), _tmpl$7 = /*#__PURE__*/ template(`<table><thead><tr></tr></thead><tbody>`), _tmpl$8 = /*#__PURE__*/ template(`<th scope=col>`), _tmpl$9 = /*#__PURE__*/ template(`<tr>`), _tmpl$0 = /*#__PURE__*/ template(`<td>`), _tmpl$1 = /*#__PURE__*/ template(`<td><div>`);
|
|
15
15
|
function assignRef(ref, el) {
|
|
16
16
|
if (!ref) return;
|
|
17
17
|
if (typeof ref === "function") ref(el);
|
|
@@ -44,6 +44,7 @@ function useRangeCalendarContext() {
|
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
46
|
function RangeCalendar(props) {
|
|
47
|
+
const inheritedState = useContext(RangeCalendarContext);
|
|
47
48
|
const isHydrated = useIsHydrated();
|
|
48
49
|
return createComponent(Show, {
|
|
49
50
|
get when() {
|
|
@@ -53,7 +54,123 @@ function RangeCalendar(props) {
|
|
|
53
54
|
return getNextElement(_tmpl$);
|
|
54
55
|
},
|
|
55
56
|
get children() {
|
|
56
|
-
return createComponent(
|
|
57
|
+
return createComponent(Show, {
|
|
58
|
+
when: inheritedState,
|
|
59
|
+
get fallback() {
|
|
60
|
+
return createComponent(RangeCalendarInner, props);
|
|
61
|
+
},
|
|
62
|
+
get children() {
|
|
63
|
+
return createComponent(RangeCalendarWithState, mergeProps({ state: inheritedState }, props));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* RangeCalendar variant that renders against an externally-owned state (from
|
|
71
|
+
* `RangeCalendarContext`) rather than creating its own. Mirrors the single
|
|
72
|
+
* `CalendarWithState`.
|
|
73
|
+
*/
|
|
74
|
+
function RangeCalendarWithState(props) {
|
|
75
|
+
const [local, , rest] = splitProps(props, [
|
|
76
|
+
"children",
|
|
77
|
+
"class",
|
|
78
|
+
"style",
|
|
79
|
+
"slot",
|
|
80
|
+
"state",
|
|
81
|
+
"ref"
|
|
82
|
+
], [
|
|
83
|
+
"value",
|
|
84
|
+
"defaultValue",
|
|
85
|
+
"onChange",
|
|
86
|
+
"minValue",
|
|
87
|
+
"maxValue",
|
|
88
|
+
"isDisabled",
|
|
89
|
+
"isReadOnly",
|
|
90
|
+
"focusedValue",
|
|
91
|
+
"defaultFocusedValue",
|
|
92
|
+
"onFocusChange",
|
|
93
|
+
"locale",
|
|
94
|
+
"createCalendar",
|
|
95
|
+
"isDateUnavailable",
|
|
96
|
+
"visibleMonths",
|
|
97
|
+
"pageBehavior",
|
|
98
|
+
"selectionAlignment",
|
|
99
|
+
"isDateDisabled",
|
|
100
|
+
"validationState",
|
|
101
|
+
"allowsNonContiguousRanges",
|
|
102
|
+
"firstDayOfWeek"
|
|
103
|
+
]);
|
|
104
|
+
const state = () => props.state;
|
|
105
|
+
const calendarAria = createRangeCalendar(rest, state());
|
|
106
|
+
const renderValues = createMemo(() => ({
|
|
107
|
+
isDisabled: state().isDisabled(),
|
|
108
|
+
isReadOnly: state().isReadOnly(),
|
|
109
|
+
isInvalid: state().isValueInvalid(),
|
|
110
|
+
isDragging: state().isDragging()
|
|
111
|
+
}));
|
|
112
|
+
const renderProps = useRenderProps({
|
|
113
|
+
class: local.class,
|
|
114
|
+
style: local.style,
|
|
115
|
+
defaultClassName: "solidaria-RangeCalendar"
|
|
116
|
+
}, renderValues);
|
|
117
|
+
return createComponent(RangeCalendarStateContext.Provider, {
|
|
118
|
+
get value() {
|
|
119
|
+
return state();
|
|
120
|
+
},
|
|
121
|
+
get children() {
|
|
122
|
+
return createComponent(RangeCalendarContext.Provider, {
|
|
123
|
+
get value() {
|
|
124
|
+
return state();
|
|
125
|
+
},
|
|
126
|
+
get children() {
|
|
127
|
+
var _el$2 = getNextElement(_tmpl$4), _el$5 = _el$2.firstChild, [_el$6, _co$] = getNextMarker(_el$5.nextSibling), _el$7 = _el$6.nextSibling, [_el$8, _co$2] = getNextMarker(_el$7.nextSibling), _el$9 = _el$8.nextSibling, [_el$0, _co$3] = getNextMarker(_el$9.nextSibling);
|
|
128
|
+
use((el) => assignRef(local.ref, el), _el$2);
|
|
129
|
+
spread(_el$2, mergeProps(() => calendarAria.calendarProps, {
|
|
130
|
+
get ["class"]() {
|
|
131
|
+
return renderProps.class();
|
|
132
|
+
},
|
|
133
|
+
get style() {
|
|
134
|
+
return renderProps.style();
|
|
135
|
+
},
|
|
136
|
+
get ["data-disabled"]() {
|
|
137
|
+
return dataAttr(state().isDisabled());
|
|
138
|
+
},
|
|
139
|
+
get ["data-readonly"]() {
|
|
140
|
+
return dataAttr(state().isReadOnly());
|
|
141
|
+
},
|
|
142
|
+
get ["data-invalid"]() {
|
|
143
|
+
return dataAttr(state().isValueInvalid());
|
|
144
|
+
},
|
|
145
|
+
get ["data-dragging"]() {
|
|
146
|
+
return dataAttr(state().isDragging());
|
|
147
|
+
}
|
|
148
|
+
}), false, true);
|
|
149
|
+
insert(_el$2, createComponent(VisuallyHidden, { get children() {
|
|
150
|
+
var _el$3 = getNextElement(_tmpl$2);
|
|
151
|
+
insert(_el$3, () => String(calendarAria.calendarProps["aria-label"] ?? ""));
|
|
152
|
+
return _el$3;
|
|
153
|
+
} }), _el$6, _co$);
|
|
154
|
+
insert(_el$2, () => props.children, _el$8, _co$2);
|
|
155
|
+
insert(_el$2, createComponent(VisuallyHidden, { get children() {
|
|
156
|
+
var _el$4 = getNextElement(_tmpl$3);
|
|
157
|
+
_el$4.$$click = () => state().focusNextPage();
|
|
158
|
+
effect((_p$) => {
|
|
159
|
+
var _v$ = String(calendarAria.nextButtonProps["aria-label"] ?? ""), _v$2 = Boolean(calendarAria.nextButtonProps.disabled);
|
|
160
|
+
_v$ !== _p$.e && setAttribute(_el$4, "aria-label", _p$.e = _v$);
|
|
161
|
+
_v$2 !== _p$.t && setProperty(_el$4, "disabled", _p$.t = _v$2);
|
|
162
|
+
return _p$;
|
|
163
|
+
}, {
|
|
164
|
+
e: void 0,
|
|
165
|
+
t: void 0
|
|
166
|
+
});
|
|
167
|
+
runHydrationEvents();
|
|
168
|
+
return _el$4;
|
|
169
|
+
} }), _el$0, _co$3);
|
|
170
|
+
runHydrationEvents();
|
|
171
|
+
return _el$2;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
57
174
|
}
|
|
58
175
|
});
|
|
59
176
|
}
|
|
@@ -108,9 +225,9 @@ function RangeCalendarInner(props) {
|
|
|
108
225
|
return createComponent(RangeCalendarContext.Provider, {
|
|
109
226
|
value: state,
|
|
110
227
|
get children() {
|
|
111
|
-
var _el$
|
|
112
|
-
use((el) => assignRef(local.ref, el), _el$
|
|
113
|
-
spread(_el$
|
|
228
|
+
var _el$1 = getNextElement(_tmpl$4), _el$12 = _el$1.firstChild, [_el$13, _co$4] = getNextMarker(_el$12.nextSibling), _el$14 = _el$13.nextSibling, [_el$15, _co$5] = getNextMarker(_el$14.nextSibling), _el$16 = _el$15.nextSibling, [_el$17, _co$6] = getNextMarker(_el$16.nextSibling);
|
|
229
|
+
use((el) => assignRef(local.ref, el), _el$1);
|
|
230
|
+
spread(_el$1, mergeProps(() => calendarAria.calendarProps, {
|
|
114
231
|
get ["class"]() {
|
|
115
232
|
return renderProps.class();
|
|
116
233
|
},
|
|
@@ -130,14 +247,29 @@ function RangeCalendarInner(props) {
|
|
|
130
247
|
return dataAttr(state.isDragging());
|
|
131
248
|
}
|
|
132
249
|
}), false, true);
|
|
133
|
-
insert(_el$
|
|
134
|
-
var _el$
|
|
135
|
-
insert(_el$
|
|
136
|
-
return _el$
|
|
137
|
-
} }), _el$
|
|
138
|
-
insert(_el$
|
|
250
|
+
insert(_el$1, createComponent(VisuallyHidden, { get children() {
|
|
251
|
+
var _el$10 = getNextElement(_tmpl$2);
|
|
252
|
+
insert(_el$10, () => String(calendarAria.calendarProps["aria-label"] ?? ""));
|
|
253
|
+
return _el$10;
|
|
254
|
+
} }), _el$13, _co$4);
|
|
255
|
+
insert(_el$1, () => props.children, _el$15, _co$5);
|
|
256
|
+
insert(_el$1, createComponent(VisuallyHidden, { get children() {
|
|
257
|
+
var _el$11 = getNextElement(_tmpl$3);
|
|
258
|
+
_el$11.$$click = () => state.focusNextPage();
|
|
259
|
+
effect((_p$) => {
|
|
260
|
+
var _v$3 = String(calendarAria.nextButtonProps["aria-label"] ?? ""), _v$4 = Boolean(calendarAria.nextButtonProps.disabled);
|
|
261
|
+
_v$3 !== _p$.e && setAttribute(_el$11, "aria-label", _p$.e = _v$3);
|
|
262
|
+
_v$4 !== _p$.t && setProperty(_el$11, "disabled", _p$.t = _v$4);
|
|
263
|
+
return _p$;
|
|
264
|
+
}, {
|
|
265
|
+
e: void 0,
|
|
266
|
+
t: void 0
|
|
267
|
+
});
|
|
268
|
+
runHydrationEvents();
|
|
269
|
+
return _el$11;
|
|
270
|
+
} }), _el$17, _co$6);
|
|
139
271
|
runHydrationEvents();
|
|
140
|
-
return _el$
|
|
272
|
+
return _el$1;
|
|
141
273
|
}
|
|
142
274
|
});
|
|
143
275
|
}
|
|
@@ -149,18 +281,18 @@ function RangeCalendarInner(props) {
|
|
|
149
281
|
function RangeCalendarHeading(props) {
|
|
150
282
|
const state = useRangeCalendarContext();
|
|
151
283
|
return (() => {
|
|
152
|
-
var _el$
|
|
153
|
-
insert(_el$
|
|
284
|
+
var _el$18 = getNextElement(_tmpl$5);
|
|
285
|
+
insert(_el$18, () => state.title());
|
|
154
286
|
effect((_p$) => {
|
|
155
|
-
var _v$ = props.class ?? "solidaria-RangeCalendarHeading", _v$
|
|
156
|
-
_v$ !== _p$.e && className(_el$
|
|
157
|
-
_p$.t = style(_el$
|
|
287
|
+
var _v$5 = props.class ?? "solidaria-RangeCalendarHeading", _v$6 = props.style;
|
|
288
|
+
_v$5 !== _p$.e && className(_el$18, _p$.e = _v$5);
|
|
289
|
+
_p$.t = style(_el$18, _v$6, _p$.t);
|
|
158
290
|
return _p$;
|
|
159
291
|
}, {
|
|
160
292
|
e: void 0,
|
|
161
293
|
t: void 0
|
|
162
294
|
});
|
|
163
|
-
return _el$
|
|
295
|
+
return _el$18;
|
|
164
296
|
})();
|
|
165
297
|
}
|
|
166
298
|
/**
|
|
@@ -175,8 +307,8 @@ function RangeCalendarButton(props) {
|
|
|
175
307
|
});
|
|
176
308
|
const isDisabled = createMemo(() => props.isDisabled || Boolean(buttonProps().disabled) || state.isDisabled());
|
|
177
309
|
return (() => {
|
|
178
|
-
var _el$
|
|
179
|
-
spread(_el$
|
|
310
|
+
var _el$19 = getNextElement(_tmpl$6);
|
|
311
|
+
spread(_el$19, mergeProps(buttonProps, {
|
|
180
312
|
get ["class"]() {
|
|
181
313
|
return props.class ?? "solidaria-RangeCalendarButton";
|
|
182
314
|
},
|
|
@@ -185,11 +317,14 @@ function RangeCalendarButton(props) {
|
|
|
185
317
|
},
|
|
186
318
|
get disabled() {
|
|
187
319
|
return isDisabled();
|
|
320
|
+
},
|
|
321
|
+
get tabindex() {
|
|
322
|
+
return isDisabled() ? void 0 : 0;
|
|
188
323
|
}
|
|
189
324
|
}), false, true);
|
|
190
|
-
insert(_el$
|
|
325
|
+
insert(_el$19, () => props.children);
|
|
191
326
|
runHydrationEvents();
|
|
192
|
-
return _el$
|
|
327
|
+
return _el$19;
|
|
193
328
|
})();
|
|
194
329
|
}
|
|
195
330
|
/**
|
|
@@ -224,9 +359,9 @@ function RangeCalendarGrid(props) {
|
|
|
224
359
|
return createComponent(RangeCalendarGridMonthContext.Provider, {
|
|
225
360
|
value: startDate,
|
|
226
361
|
get children() {
|
|
227
|
-
var _el$
|
|
228
|
-
use(setGridRef, _el$
|
|
229
|
-
spread(_el$
|
|
362
|
+
var _el$20 = getNextElement(_tmpl$7), _el$21 = _el$20.firstChild, _el$22 = _el$21.firstChild, _el$23 = _el$21.nextSibling;
|
|
363
|
+
use(setGridRef, _el$20);
|
|
364
|
+
spread(_el$20, mergeProps(() => gridAria.gridProps, {
|
|
230
365
|
get ["class"]() {
|
|
231
366
|
return renderProps.class();
|
|
232
367
|
},
|
|
@@ -234,33 +369,33 @@ function RangeCalendarGrid(props) {
|
|
|
234
369
|
return renderProps.style();
|
|
235
370
|
}
|
|
236
371
|
}), false, true);
|
|
237
|
-
spread(_el$
|
|
238
|
-
insert(_el$
|
|
372
|
+
spread(_el$21, mergeProps(() => gridAria.headerProps), false, true);
|
|
373
|
+
insert(_el$22, createComponent(For, {
|
|
239
374
|
get each() {
|
|
240
375
|
return gridAria.weekDays;
|
|
241
376
|
},
|
|
242
377
|
children: (day) => (() => {
|
|
243
|
-
var _el$
|
|
244
|
-
insert(_el$
|
|
378
|
+
var _el$24 = getNextElement(_tmpl$8);
|
|
379
|
+
insert(_el$24, day);
|
|
245
380
|
effect((_p$) => {
|
|
246
|
-
var _v$
|
|
247
|
-
_v$
|
|
248
|
-
_p$.t = style(_el$
|
|
381
|
+
var _v$7 = props.headerCellClass ?? "solidaria-RangeCalendarHeaderCell", _v$8 = props.headerCellStyle;
|
|
382
|
+
_v$7 !== _p$.e && className(_el$24, _p$.e = _v$7);
|
|
383
|
+
_p$.t = style(_el$24, _v$8, _p$.t);
|
|
249
384
|
return _p$;
|
|
250
385
|
}, {
|
|
251
386
|
e: void 0,
|
|
252
387
|
t: void 0
|
|
253
388
|
});
|
|
254
|
-
return _el$
|
|
389
|
+
return _el$24;
|
|
255
390
|
})()
|
|
256
391
|
}));
|
|
257
|
-
insert(_el$
|
|
392
|
+
insert(_el$23, createComponent(Index, {
|
|
258
393
|
get each() {
|
|
259
394
|
return allDates();
|
|
260
395
|
},
|
|
261
396
|
children: (weekDates, weekIndex) => (() => {
|
|
262
|
-
var _el$
|
|
263
|
-
insert(_el$
|
|
397
|
+
var _el$25 = getNextElement(_tmpl$9);
|
|
398
|
+
insert(_el$25, createComponent(Index, {
|
|
264
399
|
get each() {
|
|
265
400
|
return weekDates();
|
|
266
401
|
},
|
|
@@ -269,7 +404,7 @@ function RangeCalendarGrid(props) {
|
|
|
269
404
|
return date();
|
|
270
405
|
},
|
|
271
406
|
get fallback() {
|
|
272
|
-
return getNextElement(_tmpl$
|
|
407
|
+
return getNextElement(_tmpl$0);
|
|
273
408
|
},
|
|
274
409
|
get children() {
|
|
275
410
|
return createComponent(RangeCalendarGridCellPositionContext.Provider, {
|
|
@@ -285,11 +420,11 @@ function RangeCalendarGrid(props) {
|
|
|
285
420
|
}
|
|
286
421
|
})
|
|
287
422
|
}));
|
|
288
|
-
return _el$
|
|
423
|
+
return _el$25;
|
|
289
424
|
})()
|
|
290
425
|
}));
|
|
291
426
|
runHydrationEvents();
|
|
292
|
-
return _el$
|
|
427
|
+
return _el$20;
|
|
293
428
|
}
|
|
294
429
|
});
|
|
295
430
|
}
|
|
@@ -348,8 +483,8 @@ function RangeCalendarCell(props) {
|
|
|
348
483
|
return cellAria.formattedDate;
|
|
349
484
|
};
|
|
350
485
|
return (() => {
|
|
351
|
-
var _el$
|
|
352
|
-
spread(_el$
|
|
486
|
+
var _el$27 = getNextElement(_tmpl$1), _el$28 = _el$27.firstChild;
|
|
487
|
+
spread(_el$27, mergeProps(() => cellAria.cellProps, {
|
|
353
488
|
get ["class"]() {
|
|
354
489
|
return cellRenderProps.class();
|
|
355
490
|
},
|
|
@@ -357,8 +492,8 @@ function RangeCalendarCell(props) {
|
|
|
357
492
|
return cellRenderProps.style();
|
|
358
493
|
}
|
|
359
494
|
}), false, true);
|
|
360
|
-
use(setCellRef, _el$
|
|
361
|
-
spread(_el$
|
|
495
|
+
use(setCellRef, _el$28);
|
|
496
|
+
spread(_el$28, mergeProps(() => cellAria.buttonProps, hoverProps, {
|
|
362
497
|
get ["class"]() {
|
|
363
498
|
return renderProps.class();
|
|
364
499
|
},
|
|
@@ -399,11 +534,12 @@ function RangeCalendarCell(props) {
|
|
|
399
534
|
return dataAttr(isHovered());
|
|
400
535
|
}
|
|
401
536
|
}), false, true);
|
|
402
|
-
insert(_el$
|
|
537
|
+
insert(_el$28, getChildren);
|
|
403
538
|
runHydrationEvents();
|
|
404
|
-
return _el$
|
|
539
|
+
return _el$27;
|
|
405
540
|
})();
|
|
406
541
|
}
|
|
542
|
+
delegateEvents(["click"]);
|
|
407
543
|
//#endregion
|
|
408
544
|
export { RangeCalendar, RangeCalendarButton, RangeCalendarCell, RangeCalendarContext, RangeCalendarGrid, RangeCalendarHeading, RangeCalendarStateContext, useRangeCalendarContext };
|
|
409
545
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeCalendar.js","names":["JSX","Accessor","createContext","createMemo","createSignal","splitProps","useContext","For","Index","Show","createRangeCalendar","createCalendarGrid","createRangeCalendarCell","createHover","AriaRangeCalendarProps","AriaCalendarGridProps","createRangeCalendarState","RangeCalendarState","RangeCalendarStateProps","CalendarDate","DateValue","RangeValue","endOfMonth","isSameMonth","RenderChildren","ClassNameOrFunction","StyleOrFunction","SlotProps","useRenderProps","dataAttr","useIsHydrated","VisuallyHidden","RefLike","el","T","current","assignRef","ref","RangeCalendarRenderProps","isDisabled","isReadOnly","isInvalid","isDragging","RangeCalendarProps","Omit","children","Element","class","style","locale","HTMLDivElement","RangeCalendarGridRenderProps","RangeCalendarGridProps","date","headerCellClass","headerCellStyle","CSSProperties","offset","months","RangeCalendarCellRenderProps","isSelected","isSelectionStart","isSelectionEnd","isFocused","isUnavailable","isOutsideMonth","isToday","isPressed","isHovered","isFirstChild","isLastChild","isFirstWeek","isLastWeek","formattedDate","RangeCalendarCellProps","cellClass","cellStyle","RangeCalendarContext","RangeCalendarStateContext","RangeCalendarGridMonthContext","RangeCalendarGridCellPositionContext","weekIndex","dayIndex","lastWeekIndex","useRangeCalendarContext","context","Error","RangeCalendar","props","isHydrated","_$createComponent","when","fallback","_$getNextElement","_tmpl$","RangeCalendarInner","local","stateProps","rest","state","calendarAria","renderValues","isValueInvalid","renderProps","defaultClassName","Provider","value","_el$2","_tmpl$3","_el$4","firstChild","_el$5","_co$","_$getNextMarker","nextSibling","_el$6","_el$7","_co$2","_$use","_$spread","_$mergeProps","calendarProps","data-disabled","data-readonly","data-invalid","data-dragging","_$insert","_el$3","_tmpl$2","String","_$runHydrationEvents","RangeCalendarHeadingProps","RangeCalendarHeading","_el$8","_tmpl$4","title","_$effect","_p$","_v$","_v$2","e","_$className","t","_$style","undefined","RangeCalendarButtonProps","slot","RangeCalendarButton","buttonProps","prevButtonProps","nextButtonProps","Boolean","disabled","_el$9","_tmpl$5","RangeCalendarGrid","gridRef","setGridRef","HTMLTableElement","startDate","offsetMonths","baseStart","visibleRange","start","add","gridAria","endDate","weekdayStyle","Parameters","allDates","monthStart","numWeeks","getWeeksInMonth","weekDates","push","getDatesInWeek","_el$0","_tmpl$6","_el$1","_el$10","_el$11","gridProps","headerProps","each","weekDays","day","_el$12","_tmpl$7","_v$3","_v$4","_el$13","_tmpl$8","_tmpl$9","length","RangeCalendarCell","currentMonthStart","cellPosition","cellRef","setCellRef","position","cellAria","hoverProps","cellRenderProps","getChildren","renderChildren","_el$15","_tmpl$0","_el$16","cellProps","data-selected","data-selection-start","data-selection-end","data-focused","data-unavailable","data-outside-month","data-today","data-pressed","data-hovered"],"sources":["../src/RangeCalendar.tsx"],"sourcesContent":["/**\n * RangeCalendar component for solidaria-components\n *\n * Pre-wired headless range calendar component that combines aria hooks.\n * Port of react-aria-components/src/RangeCalendar.tsx\n */\n\nimport {\n type JSX,\n type Accessor,\n createContext,\n createMemo,\n createSignal,\n splitProps,\n useContext,\n For,\n Index,\n Show,\n} from \"solid-js\";\nimport {\n createRangeCalendar,\n createCalendarGrid,\n createRangeCalendarCell,\n createHover,\n type AriaRangeCalendarProps,\n type AriaCalendarGridProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createRangeCalendarState,\n type RangeCalendarState,\n type RangeCalendarStateProps,\n type CalendarDate,\n type DateValue,\n type RangeValue,\n endOfMonth,\n isSameMonth,\n} from \"@proyecto-viviana/solid-stately\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n dataAttr,\n useIsHydrated,\n} from \"./utils\";\nimport { VisuallyHidden } from \"./VisuallyHidden\";\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n ref(el);\n } else {\n ref.current = el;\n }\n}\n\nexport interface RangeCalendarRenderProps {\n /** Whether the calendar is disabled. */\n isDisabled: boolean;\n /** Whether the calendar is read-only. */\n isReadOnly: boolean;\n /** Whether the current selection is invalid. */\n isInvalid: boolean;\n /** Whether the user is currently selecting a range. */\n isDragging: boolean;\n}\n\nexport interface RangeCalendarProps<T extends DateValue = DateValue>\n extends\n Omit<AriaRangeCalendarProps, \"id\" | \"isDisabled\" | \"isReadOnly\">,\n Omit<RangeCalendarStateProps<T>, \"locale\">,\n SlotProps {\n /** The children of the component. */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<RangeCalendarRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<RangeCalendarRenderProps>;\n /** The locale to use for formatting. */\n locale?: string;\n /** Ref for the range calendar root element. */\n ref?: RefLike<HTMLDivElement>;\n}\n\nexport interface RangeCalendarGridRenderProps {\n /** Whether the grid is disabled. */\n isDisabled: boolean;\n}\n\nexport interface RangeCalendarGridProps\n extends Omit<AriaCalendarGridProps, \"startDate\" | \"endDate\">, SlotProps {\n /** The children of the component (render function receiving dates). */\n children?: (date: CalendarDate) => JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<RangeCalendarGridRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<RangeCalendarGridRenderProps>;\n /** Class name for weekday header cells. */\n headerCellClass?: string;\n /** Inline style for weekday header cells. */\n headerCellStyle?: JSX.CSSProperties;\n /** Number of months to offset from the start. */\n offset?: { months?: number };\n}\n\nexport interface RangeCalendarCellRenderProps {\n /** Whether the cell is within the selected range. */\n isSelected: boolean;\n /** Whether the cell is the start of the selection. */\n isSelectionStart: boolean;\n /** Whether the cell is the end of the selection. */\n isSelectionEnd: boolean;\n /** Whether the cell is focused. */\n isFocused: boolean;\n /** Whether the cell is disabled. */\n isDisabled: boolean;\n /** Whether the cell is unavailable. */\n isUnavailable: boolean;\n /** Whether the cell is part of an invalid selection. */\n isInvalid: boolean;\n /** Whether the cell is outside the visible month. */\n isOutsideMonth: boolean;\n /** Whether the cell represents today. */\n isToday: boolean;\n /** Whether the cell is pressed. */\n isPressed: boolean;\n /** Whether the cell is hovered. */\n isHovered: boolean;\n /** Whether the cell is the first day slot in its row. */\n isFirstChild: boolean;\n /** Whether the cell is the last day slot in its row. */\n isLastChild: boolean;\n /** Whether the cell is in the first rendered week row. */\n isFirstWeek: boolean;\n /** Whether the cell is in the last rendered week row. */\n isLastWeek: boolean;\n /** The formatted date string. */\n formattedDate: string;\n}\n\nexport interface RangeCalendarCellProps extends SlotProps {\n /** The date for this cell. */\n date: CalendarDate;\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<RangeCalendarCellRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<RangeCalendarCellRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<RangeCalendarCellRenderProps>;\n /** Class name for the table cell wrapper. */\n cellClass?: ClassNameOrFunction<RangeCalendarCellRenderProps>;\n /** Inline style for the table cell wrapper. */\n cellStyle?: StyleOrFunction<RangeCalendarCellRenderProps>;\n}\n\nexport const RangeCalendarContext = createContext<RangeCalendarState<DateValue> | null>(null);\nexport const RangeCalendarStateContext = createContext<RangeCalendarState<DateValue> | null>(null);\nconst RangeCalendarGridMonthContext = createContext<Accessor<CalendarDate> | null>(null);\nconst RangeCalendarGridCellPositionContext = createContext<Accessor<{\n weekIndex: number;\n dayIndex: number;\n lastWeekIndex: number;\n}> | null>(null);\n\nexport function useRangeCalendarContext(): RangeCalendarState<DateValue> {\n const context = useContext(RangeCalendarContext);\n if (!context) {\n throw new Error(\"RangeCalendar components must be used within a RangeCalendar\");\n }\n return context;\n}\n\n/**\n * A range calendar displays a grid of days and allows users to select a contiguous range of dates.\n *\n * @example\n * ```tsx\n * <RangeCalendar aria-label=\"Date range\">\n * <header>\n * <RangeCalendarButton slot=\"previous\">◀</RangeCalendarButton>\n * <RangeCalendarHeading />\n * <RangeCalendarButton slot=\"next\">▶</RangeCalendarButton>\n * </header>\n * <RangeCalendarGrid>\n * {(date) => <RangeCalendarCell date={date} />}\n * </RangeCalendarGrid>\n * </RangeCalendar>\n * ```\n */\nexport function RangeCalendar<T extends DateValue = CalendarDate>(\n props: RangeCalendarProps<T>,\n): JSX.Element {\n // Use hydration-safe pattern for client-only rendering\n const isHydrated = useIsHydrated();\n\n return (\n <Show\n when={isHydrated()}\n fallback={\n <div\n class=\"solidaria-RangeCalendar solidaria-RangeCalendar--placeholder\"\n aria-hidden=\"true\"\n />\n }\n >\n <RangeCalendarInner {...props} />\n </Show>\n );\n}\n\n/**\n * Internal RangeCalendar component that renders after client mount.\n */\nfunction RangeCalendarInner<T extends DateValue = CalendarDate>(\n props: RangeCalendarProps<T>,\n): JSX.Element {\n const [local, stateProps, rest] = splitProps(\n props,\n [\"children\", \"class\", \"style\", \"slot\", \"ref\"],\n [\n \"value\",\n \"defaultValue\",\n \"onChange\",\n \"minValue\",\n \"maxValue\",\n \"isDisabled\",\n \"isReadOnly\",\n \"focusedValue\",\n \"defaultFocusedValue\",\n \"onFocusChange\",\n \"locale\",\n \"createCalendar\",\n \"isDateUnavailable\",\n \"visibleMonths\",\n \"pageBehavior\",\n \"selectionAlignment\",\n \"isDateDisabled\",\n \"validationState\",\n \"allowsNonContiguousRanges\",\n \"firstDayOfWeek\",\n ],\n );\n\n const state = createRangeCalendarState(stateProps);\n\n const calendarAria = createRangeCalendar(rest, state as unknown as RangeCalendarState<DateValue>);\n\n const renderValues = createMemo<RangeCalendarRenderProps>(() => ({\n isDisabled: state.isDisabled(),\n isReadOnly: state.isReadOnly(),\n isInvalid: state.isValueInvalid(),\n isDragging: state.isDragging(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-RangeCalendar\",\n },\n renderValues,\n );\n\n return (\n <RangeCalendarStateContext.Provider value={state as unknown as RangeCalendarState<DateValue>}>\n <RangeCalendarContext.Provider value={state as unknown as RangeCalendarState<DateValue>}>\n <div\n {...calendarAria.calendarProps}\n ref={(el) => assignRef(local.ref, el)}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state.isDisabled())}\n data-readonly={dataAttr(state.isReadOnly())}\n data-invalid={dataAttr(state.isValueInvalid())}\n data-dragging={dataAttr(state.isDragging())}\n >\n <VisuallyHidden>\n <h2>{String(calendarAria.calendarProps[\"aria-label\"] ?? \"\")}</h2>\n </VisuallyHidden>\n {props.children}\n </div>\n </RangeCalendarContext.Provider>\n </RangeCalendarStateContext.Provider>\n );\n}\n\nexport interface RangeCalendarHeadingProps extends SlotProps {\n /** The CSS className for the element. */\n class?: string;\n /** The inline style for the element. */\n style?: JSX.CSSProperties;\n}\n\n/**\n * Displays the current month and year in the range calendar.\n */\nexport function RangeCalendarHeading(props: RangeCalendarHeadingProps): JSX.Element {\n const state = useRangeCalendarContext();\n\n return (\n <h2\n class={props.class ?? \"solidaria-RangeCalendarHeading\"}\n style={props.style}\n aria-live=\"polite\"\n >\n {state.title()}\n </h2>\n );\n}\n\nexport interface RangeCalendarButtonProps extends SlotProps {\n /** The slot for this button (previous or next). */\n slot?: \"previous\" | \"next\";\n /** The children of the component. */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: string;\n /** The inline style for the element. */\n style?: JSX.CSSProperties;\n /** Whether the button is disabled. */\n isDisabled?: boolean;\n}\n\n/**\n * A button for navigating the range calendar.\n */\nexport function RangeCalendarButton(props: RangeCalendarButtonProps): JSX.Element {\n const state = useRangeCalendarContext();\n const calendarAria = createRangeCalendar({}, state);\n\n const buttonProps = createMemo(() => {\n if (props.slot === \"previous\") {\n return calendarAria.prevButtonProps;\n }\n return calendarAria.nextButtonProps;\n });\n const isDisabled = createMemo(\n () => props.isDisabled || Boolean(buttonProps().disabled) || state.isDisabled(),\n );\n\n return (\n <button\n {...buttonProps()}\n class={props.class ?? \"solidaria-RangeCalendarButton\"}\n style={props.style}\n disabled={isDisabled()}\n >\n {props.children}\n </button>\n );\n}\n\n/**\n * Displays a grid of range calendar cells.\n */\nexport function RangeCalendarGrid(props: RangeCalendarGridProps): JSX.Element {\n const state = useRangeCalendarContext();\n const [gridRef, setGridRef] = createSignal<HTMLTableElement | null>(null);\n const startDate = createMemo(() => {\n const offsetMonths = props.offset?.months ?? 0;\n const baseStart = state.visibleRange().start;\n return offsetMonths ? baseStart.add({ months: offsetMonths }) : baseStart;\n });\n\n const gridAria = createCalendarGrid(\n {\n startDate: startDate(),\n endDate: endOfMonth(startDate()),\n weekdayStyle: props.weekdayStyle,\n },\n state as unknown as Parameters<typeof createCalendarGrid>[1],\n gridRef,\n );\n\n const renderValues = createMemo<RangeCalendarGridRenderProps>(() => ({\n isDisabled: state.isDisabled(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: props.class,\n style: props.style,\n defaultClassName: \"solidaria-RangeCalendarGrid\",\n },\n renderValues,\n );\n\n // Memoize all dates for the grid to avoid reactive loops in render paths.\n const allDates = createMemo(() => {\n const monthStart = startDate();\n const numWeeks = state.getWeeksInMonth(monthStart);\n const weekDates: (CalendarDate | null)[][] = [];\n\n for (let weekIndex = 0; weekIndex < numWeeks; weekIndex++) {\n weekDates.push(state.getDatesInWeek(weekIndex, monthStart));\n }\n\n return weekDates;\n });\n\n return (\n <RangeCalendarGridMonthContext.Provider value={startDate}>\n <table\n ref={setGridRef}\n {...gridAria.gridProps}\n class={renderProps.class()}\n style={renderProps.style()}\n >\n <thead {...gridAria.headerProps}>\n <tr>\n <For each={gridAria.weekDays}>\n {(day) => (\n <th\n scope=\"col\"\n class={props.headerCellClass ?? \"solidaria-RangeCalendarHeaderCell\"}\n style={props.headerCellStyle}\n >\n {day}\n </th>\n )}\n </For>\n </tr>\n </thead>\n <tbody>\n <Index each={allDates()}>\n {(weekDates, weekIndex) => (\n <tr>\n <Index each={weekDates()}>\n {(date, dayIndex) => (\n <Show when={date()} fallback={<td />}>\n <RangeCalendarGridCellPositionContext.Provider\n value={() => ({\n weekIndex,\n dayIndex,\n lastWeekIndex: allDates().length - 1,\n })}\n >\n {props.children?.(date()!)}\n </RangeCalendarGridCellPositionContext.Provider>\n </Show>\n )}\n </Index>\n </tr>\n )}\n </Index>\n </tbody>\n </table>\n </RangeCalendarGridMonthContext.Provider>\n );\n}\n\n/**\n * A cell in the range calendar grid representing a single day.\n */\nexport function RangeCalendarCell(props: RangeCalendarCellProps): JSX.Element {\n const state = useRangeCalendarContext();\n const currentMonthStart = useContext(RangeCalendarGridMonthContext);\n const cellPosition = useContext(RangeCalendarGridCellPositionContext);\n const [cellRef, setCellRef] = createSignal<HTMLDivElement | null>(null);\n const isOutsideMonth = createMemo(\n () => currentMonthStart != null && !isSameMonth(currentMonthStart(), props.date),\n );\n const position = createMemo(\n () =>\n cellPosition?.() ?? {\n weekIndex: 0,\n dayIndex: 0,\n lastWeekIndex: 0,\n },\n );\n\n const cellAria = createRangeCalendarCell(\n () => ({\n date: props.date,\n isOutsideMonth: isOutsideMonth(),\n }),\n state,\n cellRef,\n );\n const { hoverProps, isHovered } = createHover(() => ({\n isDisabled: cellAria.isDisabled || cellAria.isUnavailable,\n }));\n\n const renderValues = createMemo<RangeCalendarCellRenderProps>(() => ({\n isSelected: cellAria.isSelected,\n isSelectionStart: cellAria.isSelectionStart,\n isSelectionEnd: cellAria.isSelectionEnd,\n isFocused: cellAria.isFocused,\n isDisabled: cellAria.isDisabled,\n isUnavailable: cellAria.isUnavailable,\n isInvalid: cellAria.isInvalid,\n isOutsideMonth: cellAria.isOutsideMonth,\n isToday: cellAria.isToday,\n isPressed: cellAria.isPressed,\n isHovered: isHovered(),\n isFirstChild: position().dayIndex === 0,\n isLastChild: position().dayIndex === 6,\n isFirstWeek: position().weekIndex === 0,\n isLastWeek: position().weekIndex === position().lastWeekIndex,\n formattedDate: cellAria.formattedDate,\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n class: props.class,\n style: props.style,\n defaultClassName: \"solidaria-RangeCalendarCell\",\n },\n renderValues,\n );\n const cellRenderProps = useRenderProps(\n {\n class: props.cellClass,\n style: props.cellStyle,\n defaultClassName: \"solidaria-RangeCalendarCellWrapper\",\n },\n renderValues,\n );\n\n // Determine children content - avoid Show for SSR hydration compatibility\n const getChildren = () => {\n if (typeof props.children === \"function\") {\n return renderProps.renderChildren();\n }\n return cellAria.formattedDate;\n };\n\n return (\n <td {...cellAria.cellProps} class={cellRenderProps.class()} style={cellRenderProps.style()}>\n <div\n ref={setCellRef}\n {...cellAria.buttonProps}\n {...hoverProps}\n class={renderProps.class()}\n style={renderProps.style()}\n data-selected={dataAttr(cellAria.isSelected)}\n data-selection-start={dataAttr(cellAria.isSelectionStart)}\n data-selection-end={dataAttr(cellAria.isSelectionEnd)}\n data-focused={dataAttr(cellAria.isFocused)}\n data-disabled={dataAttr(cellAria.isDisabled)}\n data-unavailable={dataAttr(cellAria.isUnavailable)}\n data-invalid={dataAttr(cellAria.isInvalid)}\n data-outside-month={dataAttr(cellAria.isOutsideMonth)}\n data-today={dataAttr(cellAria.isToday)}\n data-pressed={dataAttr(cellAria.isPressed)}\n data-hovered={dataAttr(isHovered())}\n >\n {getChildren()}\n </div>\n </td>\n );\n}\n\nexport type { RangeCalendarState, RangeValue };\n"],"mappings":";;;;;;;;;;;;;;AAkDA,SAASoC,UAAaC,KAAiBJ,IAAa;CAClD,IAAI,CAACI,KACH;CAGF,IAAI,OAAOA,QAAQ,YACjBA,IAAIJ,EAAE;MAENI,IAAIF,UAAUF;AAElB;AAqGA,MAAa4C,uBAAuB3E,cAAoD,IAAI;AAC5F,MAAa4E,4BAA4B5E,cAAoD,IAAI;AACjG,MAAM6E,gCAAgC7E,cAA6C,IAAI;AACvF,MAAM8E,uCAAuC9E,cAIlC,IAAI;AAEf,SAAgBkF,0BAAyD;CACvE,MAAMC,UAAU/E,WAAWuE,oBAAoB;CAC/C,IAAI,CAACQ,SACH,MAAM,IAAIC,MAAM,8DAA8D;CA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AzE,mBAAA;EAAA,OAAA2E;CAAA,EAAA,CAAA;AAIpB"}
|
|
1
|
+
{"version":3,"file":"RangeCalendar.js","names":["JSX","Accessor","createContext","createMemo","createSignal","splitProps","useContext","For","Index","Show","createRangeCalendar","createCalendarGrid","createRangeCalendarCell","createHover","AriaRangeCalendarProps","AriaCalendarGridProps","createRangeCalendarState","RangeCalendarState","RangeCalendarStateProps","CalendarDate","DateValue","RangeValue","endOfMonth","isSameMonth","RenderChildren","ClassNameOrFunction","StyleOrFunction","SlotProps","useRenderProps","dataAttr","useIsHydrated","VisuallyHidden","RefLike","el","T","current","assignRef","ref","RangeCalendarRenderProps","isDisabled","isReadOnly","isInvalid","isDragging","RangeCalendarProps","Omit","children","Element","class","style","locale","HTMLDivElement","RangeCalendarGridRenderProps","RangeCalendarGridProps","date","headerCellClass","headerCellStyle","CSSProperties","offset","months","RangeCalendarCellRenderProps","isSelected","isSelectionStart","isSelectionEnd","isFocused","isUnavailable","isOutsideMonth","isToday","isPressed","isHovered","isFirstChild","isLastChild","isFirstWeek","isLastWeek","formattedDate","RangeCalendarCellProps","cellClass","cellStyle","RangeCalendarContext","RangeCalendarStateContext","RangeCalendarGridMonthContext","RangeCalendarGridCellPositionContext","weekIndex","dayIndex","lastWeekIndex","useRangeCalendarContext","context","Error","RangeCalendar","props","inheritedState","isHydrated","_$createComponent","when","fallback","_$getNextElement","_tmpl$","RangeCalendarInner","RangeCalendarWithState","_$mergeProps","state","local","rest","calendarAria","renderValues","isValueInvalid","renderProps","defaultClassName","Provider","value","_el$2","_tmpl$4","_el$5","firstChild","_el$6","_co$","_$getNextMarker","nextSibling","_el$7","_el$8","_co$2","_el$9","_el$0","_co$3","_$use","_$spread","calendarProps","data-disabled","data-readonly","data-invalid","data-dragging","_$insert","_el$3","_tmpl$2","String","_el$4","_tmpl$3","$$click","focusNextPage","_$effect","_p$","_v$","nextButtonProps","_v$2","Boolean","disabled","e","_$setAttribute","t","_$setProperty","undefined","_$runHydrationEvents","stateProps","_el$1","_el$12","_el$13","_co$4","_el$14","_el$15","_co$5","_el$16","_el$17","_co$6","_el$10","_el$11","_v$3","_v$4","RangeCalendarHeadingProps","RangeCalendarHeading","_el$18","_tmpl$5","title","_v$5","_v$6","_$className","_$style","RangeCalendarButtonProps","slot","RangeCalendarButton","buttonProps","prevButtonProps","_el$19","_tmpl$6","tabindex","RangeCalendarGrid","gridRef","setGridRef","HTMLTableElement","startDate","offsetMonths","baseStart","visibleRange","start","add","gridAria","endDate","weekdayStyle","Parameters","allDates","monthStart","numWeeks","getWeeksInMonth","weekDates","push","getDatesInWeek","_el$20","_tmpl$7","_el$21","_el$22","_el$23","gridProps","headerProps","each","weekDays","day","_el$24","_tmpl$8","_v$7","_v$8","_el$25","_tmpl$9","_tmpl$0","length","RangeCalendarCell","currentMonthStart","cellPosition","cellRef","setCellRef","position","cellAria","hoverProps","cellRenderProps","getChildren","renderChildren","_el$27","_tmpl$1","_el$28","cellProps","data-selected","data-selection-start","data-selection-end","data-focused","data-unavailable","data-outside-month","data-today","data-pressed","data-hovered","_$delegateEvents"],"sources":["../src/RangeCalendar.tsx"],"sourcesContent":["/**\n * RangeCalendar component for solidaria-components\n *\n * Pre-wired headless range calendar component that combines aria hooks.\n * Port of react-aria-components/src/RangeCalendar.tsx\n */\n\nimport {\n type JSX,\n type Accessor,\n createContext,\n createMemo,\n createSignal,\n splitProps,\n useContext,\n For,\n Index,\n Show,\n} from \"solid-js\";\nimport {\n createRangeCalendar,\n createCalendarGrid,\n createRangeCalendarCell,\n createHover,\n type AriaRangeCalendarProps,\n type AriaCalendarGridProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createRangeCalendarState,\n type RangeCalendarState,\n type RangeCalendarStateProps,\n type CalendarDate,\n type DateValue,\n type RangeValue,\n endOfMonth,\n isSameMonth,\n} from \"@proyecto-viviana/solid-stately\";\nimport {\n type RenderChildren,\n type ClassNameOrFunction,\n type StyleOrFunction,\n type SlotProps,\n useRenderProps,\n dataAttr,\n useIsHydrated,\n} from \"./utils\";\nimport { VisuallyHidden } from \"./VisuallyHidden\";\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) {\n return;\n }\n\n if (typeof ref === \"function\") {\n ref(el);\n } else {\n ref.current = el;\n }\n}\n\nexport interface RangeCalendarRenderProps {\n /** Whether the calendar is disabled. */\n isDisabled: boolean;\n /** Whether the calendar is read-only. */\n isReadOnly: boolean;\n /** Whether the current selection is invalid. */\n isInvalid: boolean;\n /** Whether the user is currently selecting a range. */\n isDragging: boolean;\n}\n\nexport interface RangeCalendarProps<T extends DateValue = DateValue>\n extends\n Omit<AriaRangeCalendarProps, \"id\" | \"isDisabled\" | \"isReadOnly\">,\n Omit<RangeCalendarStateProps<T>, \"locale\">,\n SlotProps {\n /** The children of the component. */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<RangeCalendarRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<RangeCalendarRenderProps>;\n /** The locale to use for formatting. */\n locale?: string;\n /** Ref for the range calendar root element. */\n ref?: RefLike<HTMLDivElement>;\n}\n\nexport interface RangeCalendarGridRenderProps {\n /** Whether the grid is disabled. */\n isDisabled: boolean;\n}\n\nexport interface RangeCalendarGridProps\n extends Omit<AriaCalendarGridProps, \"startDate\" | \"endDate\">, SlotProps {\n /** The children of the component (render function receiving dates). */\n children?: (date: CalendarDate) => JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<RangeCalendarGridRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<RangeCalendarGridRenderProps>;\n /** Class name for weekday header cells. */\n headerCellClass?: string;\n /** Inline style for weekday header cells. */\n headerCellStyle?: JSX.CSSProperties;\n /** Number of months to offset from the start. */\n offset?: { months?: number };\n}\n\nexport interface RangeCalendarCellRenderProps {\n /** Whether the cell is within the selected range. */\n isSelected: boolean;\n /** Whether the cell is the start of the selection. */\n isSelectionStart: boolean;\n /** Whether the cell is the end of the selection. */\n isSelectionEnd: boolean;\n /** Whether the cell is focused. */\n isFocused: boolean;\n /** Whether the cell is disabled. */\n isDisabled: boolean;\n /** Whether the cell is unavailable. */\n isUnavailable: boolean;\n /** Whether the cell is part of an invalid selection. */\n isInvalid: boolean;\n /** Whether the cell is outside the visible month. */\n isOutsideMonth: boolean;\n /** Whether the cell represents today. */\n isToday: boolean;\n /** Whether the cell is pressed. */\n isPressed: boolean;\n /** Whether the cell is hovered. */\n isHovered: boolean;\n /** Whether the cell is the first day slot in its row. */\n isFirstChild: boolean;\n /** Whether the cell is the last day slot in its row. */\n isLastChild: boolean;\n /** Whether the cell is in the first rendered week row. */\n isFirstWeek: boolean;\n /** Whether the cell is in the last rendered week row. */\n isLastWeek: boolean;\n /** The formatted date string. */\n formattedDate: string;\n}\n\nexport interface RangeCalendarCellProps extends SlotProps {\n /** The date for this cell. */\n date: CalendarDate;\n /** The children of the component. A function may be provided to receive render props. */\n children?: RenderChildren<RangeCalendarCellRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<RangeCalendarCellRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<RangeCalendarCellRenderProps>;\n /** Class name for the table cell wrapper. */\n cellClass?: ClassNameOrFunction<RangeCalendarCellRenderProps>;\n /** Inline style for the table cell wrapper. */\n cellStyle?: StyleOrFunction<RangeCalendarCellRenderProps>;\n}\n\nexport const RangeCalendarContext = createContext<RangeCalendarState<DateValue> | null>(null);\nexport const RangeCalendarStateContext = createContext<RangeCalendarState<DateValue> | null>(null);\nconst RangeCalendarGridMonthContext = createContext<Accessor<CalendarDate> | null>(null);\nconst RangeCalendarGridCellPositionContext = createContext<Accessor<{\n weekIndex: number;\n dayIndex: number;\n lastWeekIndex: number;\n}> | null>(null);\n\nexport function useRangeCalendarContext(): RangeCalendarState<DateValue> {\n const context = useContext(RangeCalendarContext);\n if (!context) {\n throw new Error(\"RangeCalendar components must be used within a RangeCalendar\");\n }\n return context;\n}\n\n/**\n * A range calendar displays a grid of days and allows users to select a contiguous range of dates.\n *\n * @example\n * ```tsx\n * <RangeCalendar aria-label=\"Date range\">\n * <header>\n * <RangeCalendarButton slot=\"previous\">◀</RangeCalendarButton>\n * <RangeCalendarHeading />\n * <RangeCalendarButton slot=\"next\">▶</RangeCalendarButton>\n * </header>\n * <RangeCalendarGrid>\n * {(date) => <RangeCalendarCell date={date} />}\n * </RangeCalendarGrid>\n * </RangeCalendar>\n * ```\n */\nexport function RangeCalendar<T extends DateValue = CalendarDate>(\n props: RangeCalendarProps<T>,\n): JSX.Element {\n // When rendered inside a composite that owns the range state (e.g.\n // DateRangePicker provides `RangeCalendarContext`), reuse that shared state\n // instead of minting a fresh one — otherwise the composite's focus/anchor\n // flags (e.g. the popover-open `setFocused(true)`) drive a different state\n // instance than the one this grid renders. Mirrors the single `Calendar`.\n const inheritedState = useContext(RangeCalendarContext);\n\n // Use hydration-safe pattern for client-only rendering\n const isHydrated = useIsHydrated();\n\n return (\n <Show\n when={isHydrated()}\n fallback={\n <div\n class=\"solidaria-RangeCalendar solidaria-RangeCalendar--placeholder\"\n aria-hidden=\"true\"\n />\n }\n >\n <Show when={inheritedState} fallback={<RangeCalendarInner {...props} />}>\n <RangeCalendarWithState\n state={inheritedState as RangeCalendarState<DateValue>}\n {...props}\n />\n </Show>\n </Show>\n );\n}\n\n/**\n * RangeCalendar variant that renders against an externally-owned state (from\n * `RangeCalendarContext`) rather than creating its own. Mirrors the single\n * `CalendarWithState`.\n */\nfunction RangeCalendarWithState<T extends DateValue = CalendarDate>(\n props: RangeCalendarProps<T> & { state: RangeCalendarState<DateValue> },\n): JSX.Element {\n const [local, , rest] = splitProps(\n props,\n [\"children\", \"class\", \"style\", \"slot\", \"state\", \"ref\"],\n [\n \"value\",\n \"defaultValue\",\n \"onChange\",\n \"minValue\",\n \"maxValue\",\n \"isDisabled\",\n \"isReadOnly\",\n \"focusedValue\",\n \"defaultFocusedValue\",\n \"onFocusChange\",\n \"locale\",\n \"createCalendar\",\n \"isDateUnavailable\",\n \"visibleMonths\",\n \"pageBehavior\",\n \"selectionAlignment\",\n \"isDateDisabled\",\n \"validationState\",\n \"allowsNonContiguousRanges\",\n \"firstDayOfWeek\",\n ],\n );\n\n const state = () => props.state;\n\n const calendarAria = createRangeCalendar(rest, state());\n\n const renderValues = createMemo<RangeCalendarRenderProps>(() => ({\n isDisabled: state().isDisabled(),\n isReadOnly: state().isReadOnly(),\n isInvalid: state().isValueInvalid(),\n isDragging: state().isDragging(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-RangeCalendar\",\n },\n renderValues,\n );\n\n return (\n <RangeCalendarStateContext.Provider value={state()}>\n <RangeCalendarContext.Provider value={state()}>\n <div\n {...calendarAria.calendarProps}\n ref={(el) => assignRef(local.ref, el)}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state().isDisabled())}\n data-readonly={dataAttr(state().isReadOnly())}\n data-invalid={dataAttr(state().isValueInvalid())}\n data-dragging={dataAttr(state().isDragging())}\n >\n <VisuallyHidden>\n <h2>{String(calendarAria.calendarProps[\"aria-label\"] ?? \"\")}</h2>\n </VisuallyHidden>\n {props.children}\n {/* For touch screen readers, a visually hidden next button after the\n * month grid so it's easy to navigate after reaching the end without\n * going all the way back to the start. Mirrors react-aria-components\n * Calendar (and the headless Calendar). */}\n <VisuallyHidden>\n <button\n aria-label={String(calendarAria.nextButtonProps[\"aria-label\"] ?? \"\")}\n disabled={Boolean(calendarAria.nextButtonProps.disabled)}\n onClick={() => state().focusNextPage()}\n tabIndex={-1}\n />\n </VisuallyHidden>\n </div>\n </RangeCalendarContext.Provider>\n </RangeCalendarStateContext.Provider>\n );\n}\n\n/**\n * Internal RangeCalendar component that renders after client mount.\n */\nfunction RangeCalendarInner<T extends DateValue = CalendarDate>(\n props: RangeCalendarProps<T>,\n): JSX.Element {\n const [local, stateProps, rest] = splitProps(\n props,\n [\"children\", \"class\", \"style\", \"slot\", \"ref\"],\n [\n \"value\",\n \"defaultValue\",\n \"onChange\",\n \"minValue\",\n \"maxValue\",\n \"isDisabled\",\n \"isReadOnly\",\n \"focusedValue\",\n \"defaultFocusedValue\",\n \"onFocusChange\",\n \"locale\",\n \"createCalendar\",\n \"isDateUnavailable\",\n \"visibleMonths\",\n \"pageBehavior\",\n \"selectionAlignment\",\n \"isDateDisabled\",\n \"validationState\",\n \"allowsNonContiguousRanges\",\n \"firstDayOfWeek\",\n ],\n );\n\n const state = createRangeCalendarState(stateProps);\n\n const calendarAria = createRangeCalendar(rest, state as unknown as RangeCalendarState<DateValue>);\n\n const renderValues = createMemo<RangeCalendarRenderProps>(() => ({\n isDisabled: state.isDisabled(),\n isReadOnly: state.isReadOnly(),\n isInvalid: state.isValueInvalid(),\n isDragging: state.isDragging(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-RangeCalendar\",\n },\n renderValues,\n );\n\n return (\n <RangeCalendarStateContext.Provider value={state as unknown as RangeCalendarState<DateValue>}>\n <RangeCalendarContext.Provider value={state as unknown as RangeCalendarState<DateValue>}>\n <div\n {...calendarAria.calendarProps}\n ref={(el) => assignRef(local.ref, el)}\n class={renderProps.class()}\n style={renderProps.style()}\n data-disabled={dataAttr(state.isDisabled())}\n data-readonly={dataAttr(state.isReadOnly())}\n data-invalid={dataAttr(state.isValueInvalid())}\n data-dragging={dataAttr(state.isDragging())}\n >\n <VisuallyHidden>\n <h2>{String(calendarAria.calendarProps[\"aria-label\"] ?? \"\")}</h2>\n </VisuallyHidden>\n {props.children}\n {/* For touch screen readers, a visually hidden next button after the\n * month grid so it's easy to navigate after reaching the end without\n * going all the way back to the start. Mirrors react-aria-components\n * Calendar (and the headless Calendar). */}\n <VisuallyHidden>\n <button\n aria-label={String(calendarAria.nextButtonProps[\"aria-label\"] ?? \"\")}\n disabled={Boolean(calendarAria.nextButtonProps.disabled)}\n onClick={() => state.focusNextPage()}\n tabIndex={-1}\n />\n </VisuallyHidden>\n </div>\n </RangeCalendarContext.Provider>\n </RangeCalendarStateContext.Provider>\n );\n}\n\nexport interface RangeCalendarHeadingProps extends SlotProps {\n /** The CSS className for the element. */\n class?: string;\n /** The inline style for the element. */\n style?: JSX.CSSProperties;\n}\n\n/**\n * Displays the current month and year in the range calendar.\n */\nexport function RangeCalendarHeading(props: RangeCalendarHeadingProps): JSX.Element {\n const state = useRangeCalendarContext();\n\n return (\n <h2\n class={props.class ?? \"solidaria-RangeCalendarHeading\"}\n style={props.style}\n aria-live=\"polite\"\n >\n {state.title()}\n </h2>\n );\n}\n\nexport interface RangeCalendarButtonProps extends SlotProps {\n /** The slot for this button (previous or next). */\n slot?: \"previous\" | \"next\";\n /** The children of the component. */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: string;\n /** The inline style for the element. */\n style?: JSX.CSSProperties;\n /** Whether the button is disabled. */\n isDisabled?: boolean;\n}\n\n/**\n * A button for navigating the range calendar.\n */\nexport function RangeCalendarButton(props: RangeCalendarButtonProps): JSX.Element {\n const state = useRangeCalendarContext();\n const calendarAria = createRangeCalendar({}, state);\n\n const buttonProps = createMemo(() => {\n if (props.slot === \"previous\") {\n return calendarAria.prevButtonProps;\n }\n return calendarAria.nextButtonProps;\n });\n const isDisabled = createMemo(\n () => props.isDisabled || Boolean(buttonProps().disabled) || state.isDisabled(),\n );\n\n return (\n <button\n {...buttonProps()}\n class={props.class ?? \"solidaria-RangeCalendarButton\"}\n style={props.style}\n disabled={isDisabled()}\n // Mirror useFocusable (same as CalendarButton): always set an explicit\n // tabIndex on an enabled focusable nav button (0), and drop it entirely\n // when disabled — so the prev/next buttons appear in the roving tab order\n // exactly as the S2 oracle does.\n tabindex={isDisabled() ? undefined : 0}\n >\n {props.children}\n </button>\n );\n}\n\n/**\n * Displays a grid of range calendar cells.\n */\nexport function RangeCalendarGrid(props: RangeCalendarGridProps): JSX.Element {\n const state = useRangeCalendarContext();\n const [gridRef, setGridRef] = createSignal<HTMLTableElement | null>(null);\n const startDate = createMemo(() => {\n const offsetMonths = props.offset?.months ?? 0;\n const baseStart = state.visibleRange().start;\n return offsetMonths ? baseStart.add({ months: offsetMonths }) : baseStart;\n });\n\n const gridAria = createCalendarGrid(\n {\n startDate: startDate(),\n endDate: endOfMonth(startDate()),\n weekdayStyle: props.weekdayStyle,\n },\n state as unknown as Parameters<typeof createCalendarGrid>[1],\n gridRef,\n );\n\n const renderValues = createMemo<RangeCalendarGridRenderProps>(() => ({\n isDisabled: state.isDisabled(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: props.class,\n style: props.style,\n defaultClassName: \"solidaria-RangeCalendarGrid\",\n },\n renderValues,\n );\n\n // Memoize all dates for the grid to avoid reactive loops in render paths.\n const allDates = createMemo(() => {\n const monthStart = startDate();\n const numWeeks = state.getWeeksInMonth(monthStart);\n const weekDates: (CalendarDate | null)[][] = [];\n\n for (let weekIndex = 0; weekIndex < numWeeks; weekIndex++) {\n weekDates.push(state.getDatesInWeek(weekIndex, monthStart));\n }\n\n return weekDates;\n });\n\n return (\n <RangeCalendarGridMonthContext.Provider value={startDate}>\n <table\n ref={setGridRef}\n {...gridAria.gridProps}\n class={renderProps.class()}\n style={renderProps.style()}\n >\n <thead {...gridAria.headerProps}>\n <tr>\n <For each={gridAria.weekDays}>\n {(day) => (\n <th\n scope=\"col\"\n class={props.headerCellClass ?? \"solidaria-RangeCalendarHeaderCell\"}\n style={props.headerCellStyle}\n >\n {day}\n </th>\n )}\n </For>\n </tr>\n </thead>\n <tbody>\n <Index each={allDates()}>\n {(weekDates, weekIndex) => (\n <tr>\n <Index each={weekDates()}>\n {(date, dayIndex) => (\n <Show when={date()} fallback={<td />}>\n <RangeCalendarGridCellPositionContext.Provider\n value={() => ({\n weekIndex,\n dayIndex,\n lastWeekIndex: allDates().length - 1,\n })}\n >\n {props.children?.(date()!)}\n </RangeCalendarGridCellPositionContext.Provider>\n </Show>\n )}\n </Index>\n </tr>\n )}\n </Index>\n </tbody>\n </table>\n </RangeCalendarGridMonthContext.Provider>\n );\n}\n\n/**\n * A cell in the range calendar grid representing a single day.\n */\nexport function RangeCalendarCell(props: RangeCalendarCellProps): JSX.Element {\n const state = useRangeCalendarContext();\n const currentMonthStart = useContext(RangeCalendarGridMonthContext);\n const cellPosition = useContext(RangeCalendarGridCellPositionContext);\n const [cellRef, setCellRef] = createSignal<HTMLDivElement | null>(null);\n const isOutsideMonth = createMemo(\n () => currentMonthStart != null && !isSameMonth(currentMonthStart(), props.date),\n );\n const position = createMemo(\n () =>\n cellPosition?.() ?? {\n weekIndex: 0,\n dayIndex: 0,\n lastWeekIndex: 0,\n },\n );\n\n const cellAria = createRangeCalendarCell(\n () => ({\n date: props.date,\n isOutsideMonth: isOutsideMonth(),\n }),\n state,\n cellRef,\n );\n const { hoverProps, isHovered } = createHover(() => ({\n isDisabled: cellAria.isDisabled || cellAria.isUnavailable,\n }));\n\n const renderValues = createMemo<RangeCalendarCellRenderProps>(() => ({\n isSelected: cellAria.isSelected,\n isSelectionStart: cellAria.isSelectionStart,\n isSelectionEnd: cellAria.isSelectionEnd,\n isFocused: cellAria.isFocused,\n isDisabled: cellAria.isDisabled,\n isUnavailable: cellAria.isUnavailable,\n isInvalid: cellAria.isInvalid,\n isOutsideMonth: cellAria.isOutsideMonth,\n isToday: cellAria.isToday,\n isPressed: cellAria.isPressed,\n isHovered: isHovered(),\n isFirstChild: position().dayIndex === 0,\n isLastChild: position().dayIndex === 6,\n isFirstWeek: position().weekIndex === 0,\n isLastWeek: position().weekIndex === position().lastWeekIndex,\n formattedDate: cellAria.formattedDate,\n }));\n\n const renderProps = useRenderProps(\n {\n get children() {\n return props.children;\n },\n class: props.class,\n style: props.style,\n defaultClassName: \"solidaria-RangeCalendarCell\",\n },\n renderValues,\n );\n const cellRenderProps = useRenderProps(\n {\n class: props.cellClass,\n style: props.cellStyle,\n defaultClassName: \"solidaria-RangeCalendarCellWrapper\",\n },\n renderValues,\n );\n\n // Determine children content - avoid Show for SSR hydration compatibility\n const getChildren = () => {\n if (typeof props.children === \"function\") {\n return renderProps.renderChildren();\n }\n return cellAria.formattedDate;\n };\n\n return (\n <td {...cellAria.cellProps} class={cellRenderProps.class()} style={cellRenderProps.style()}>\n <div\n ref={setCellRef}\n {...cellAria.buttonProps}\n {...hoverProps}\n class={renderProps.class()}\n style={renderProps.style()}\n data-selected={dataAttr(cellAria.isSelected)}\n data-selection-start={dataAttr(cellAria.isSelectionStart)}\n data-selection-end={dataAttr(cellAria.isSelectionEnd)}\n data-focused={dataAttr(cellAria.isFocused)}\n data-disabled={dataAttr(cellAria.isDisabled)}\n data-unavailable={dataAttr(cellAria.isUnavailable)}\n data-invalid={dataAttr(cellAria.isInvalid)}\n data-outside-month={dataAttr(cellAria.isOutsideMonth)}\n data-today={dataAttr(cellAria.isToday)}\n data-pressed={dataAttr(cellAria.isPressed)}\n data-hovered={dataAttr(isHovered())}\n >\n {getChildren()}\n </div>\n </td>\n );\n}\n\nexport type { RangeCalendarState, RangeValue };\n"],"mappings":";;;;;;;;;;;;;;AAkDA,SAASoC,UAAaC,KAAiBJ,IAAa;CAClD,IAAI,CAACI,KACH;CAGF,IAAI,OAAOA,QAAQ,YACjBA,IAAIJ,EAAE;MAENI,IAAIF,UAAUF;AAElB;AAqGA,MAAa4C,uBAAuB3E,cAAoD,IAAI;AAC5F,MAAa4E,4BAA4B5E,cAAoD,IAAI;AACjG,MAAM6E,gCAAgC7E,cAA6C,IAAI;AACvF,MAAM8E,uCAAuC9E,cAIlC,IAAI;AAEf,SAAgBkF,0BAAyD;CACvE,MAAMC,UAAU/E,WAAWuE,oBAAoB;CAC/C,IAAI,CAACQ,SACH,MAAM,IAAIC,MAAM,8DAA8D;CAEhF,OAAOD;AACT;;;;;;;;;;;;;;;;;;AAmBA,SAAgBE,cACdC,OACa;CAMb,MAAMC,iBAAiBnF,WAAWuE,oBAAoB;CAGtD,MAAMa,aAAa5D,cAAc;CAEjC,OAAA6D,gBACGlF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AA2E,IAEjFuG,YAAUS,MAAA;EAAA/G,OAAA+G,QAAAzI,iBACXkI,SAASlD,aACTmD,YAAU;GAAA,KAAA,WAAA;IAAA,OACP5H,YAAY1D,MAAM;GAAC;GAAA,IAC1BC,QAAK;IAAA,OAAEyD,YAAYzD,MAAM;GAAC;GAAA,KAAA,mBAAA;IAAA,OACXnB,SAASuM,SAASxK,UAAU;GAAC;GAAA,KAAA,0BAAA;IAAA,OACtB/B,SAASuM,SAASvK,gBAAgB;GAAC;GAAA,KAAA,wBAAA;IAAA,OACrChC,SAASuM,SAAStK,cAAc;GAAC;GAAA,KAAA,kBAAA;IAAA,OACvCjC,SAASuM,SAASrK,SAAS;GAAC;GAAA,KAAA,mBAAA;IAAA,OAC3BlC,SAASuM,SAAS7L,UAAU;GAAC;GAAA,KAAA,sBAAA;IAAA,OAC1BV,SAASuM,SAASpK,aAAa;GAAC;GAAA,KAAA,kBAAA;IAAA,OACpCnC,SAASuM,SAAS3L,SAAS;GAAC;GAAA,KAAA,wBAAA;IAAA,OACtBZ,SAASuM,SAASnK,cAAc;GAAC;GAAA,KAAA,gBAAA;IAAA,OACzCpC,SAASuM,SAASlK,OAAO;GAAC;GAAA,KAAA,kBAAA;IAAA,OACxBrC,SAASuM,SAASjK,SAAS;GAAC;GAAA,KAAA,kBAAA;IAAA,OAC5BtC,SAASuC,UAAU,CAAC;GAAC;EAAA,CAAA,GAAA,OAAA,IAAA;EAAA8D,OAAAyG,QAElCJ,WAAW;EAAAjF,mBAAA;EAAA,OAAAmF;CAAA,EAAA,CAAA;AAIpB;AAE+Ca,eAAA,CAAA,OAAA,CAAA"}
|
package/dist/RangeCalendar.jsx
CHANGED
|
@@ -42,12 +42,78 @@ function useRangeCalendarContext() {
|
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
44
|
function RangeCalendar(props) {
|
|
45
|
+
const inheritedState = useContext(RangeCalendarContext);
|
|
45
46
|
const isHydrated = useIsHydrated();
|
|
46
47
|
return <Show when={isHydrated()} fallback={<div class="solidaria-RangeCalendar solidaria-RangeCalendar--placeholder" aria-hidden="true" />}>
|
|
47
|
-
<RangeCalendarInner {...props} />
|
|
48
|
+
<Show when={inheritedState} fallback={<RangeCalendarInner {...props} />}>
|
|
49
|
+
<RangeCalendarWithState state={inheritedState} {...props} />
|
|
50
|
+
</Show>
|
|
48
51
|
</Show>;
|
|
49
52
|
}
|
|
50
53
|
/**
|
|
54
|
+
* RangeCalendar variant that renders against an externally-owned state (from
|
|
55
|
+
* `RangeCalendarContext`) rather than creating its own. Mirrors the single
|
|
56
|
+
* `CalendarWithState`.
|
|
57
|
+
*/
|
|
58
|
+
function RangeCalendarWithState(props) {
|
|
59
|
+
const [local, , rest] = splitProps(props, [
|
|
60
|
+
"children",
|
|
61
|
+
"class",
|
|
62
|
+
"style",
|
|
63
|
+
"slot",
|
|
64
|
+
"state",
|
|
65
|
+
"ref"
|
|
66
|
+
], [
|
|
67
|
+
"value",
|
|
68
|
+
"defaultValue",
|
|
69
|
+
"onChange",
|
|
70
|
+
"minValue",
|
|
71
|
+
"maxValue",
|
|
72
|
+
"isDisabled",
|
|
73
|
+
"isReadOnly",
|
|
74
|
+
"focusedValue",
|
|
75
|
+
"defaultFocusedValue",
|
|
76
|
+
"onFocusChange",
|
|
77
|
+
"locale",
|
|
78
|
+
"createCalendar",
|
|
79
|
+
"isDateUnavailable",
|
|
80
|
+
"visibleMonths",
|
|
81
|
+
"pageBehavior",
|
|
82
|
+
"selectionAlignment",
|
|
83
|
+
"isDateDisabled",
|
|
84
|
+
"validationState",
|
|
85
|
+
"allowsNonContiguousRanges",
|
|
86
|
+
"firstDayOfWeek"
|
|
87
|
+
]);
|
|
88
|
+
const state = () => props.state;
|
|
89
|
+
const calendarAria = createRangeCalendar(rest, state());
|
|
90
|
+
const renderValues = createMemo(() => ({
|
|
91
|
+
isDisabled: state().isDisabled(),
|
|
92
|
+
isReadOnly: state().isReadOnly(),
|
|
93
|
+
isInvalid: state().isValueInvalid(),
|
|
94
|
+
isDragging: state().isDragging()
|
|
95
|
+
}));
|
|
96
|
+
const renderProps = useRenderProps({
|
|
97
|
+
class: local.class,
|
|
98
|
+
style: local.style,
|
|
99
|
+
defaultClassName: "solidaria-RangeCalendar"
|
|
100
|
+
}, renderValues);
|
|
101
|
+
return <RangeCalendarStateContext.Provider value={state()}>
|
|
102
|
+
<RangeCalendarContext.Provider value={state()}>
|
|
103
|
+
<div {...calendarAria.calendarProps} ref={(el) => assignRef(local.ref, el)} class={renderProps.class()} style={renderProps.style()} data-disabled={dataAttr(state().isDisabled())} data-readonly={dataAttr(state().isReadOnly())} data-invalid={dataAttr(state().isValueInvalid())} data-dragging={dataAttr(state().isDragging())}>
|
|
104
|
+
<VisuallyHidden>
|
|
105
|
+
<h2>{String(calendarAria.calendarProps["aria-label"] ?? "")}</h2>
|
|
106
|
+
</VisuallyHidden>
|
|
107
|
+
{props.children}
|
|
108
|
+
{}
|
|
109
|
+
<VisuallyHidden>
|
|
110
|
+
<button aria-label={String(calendarAria.nextButtonProps["aria-label"] ?? "")} disabled={Boolean(calendarAria.nextButtonProps.disabled)} onClick={() => state().focusNextPage()} tabIndex={-1} />
|
|
111
|
+
</VisuallyHidden>
|
|
112
|
+
</div>
|
|
113
|
+
</RangeCalendarContext.Provider>
|
|
114
|
+
</RangeCalendarStateContext.Provider>;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
51
117
|
* Internal RangeCalendar component that renders after client mount.
|
|
52
118
|
*/
|
|
53
119
|
function RangeCalendarInner(props) {
|
|
@@ -99,6 +165,10 @@ function RangeCalendarInner(props) {
|
|
|
99
165
|
<h2>{String(calendarAria.calendarProps["aria-label"] ?? "")}</h2>
|
|
100
166
|
</VisuallyHidden>
|
|
101
167
|
{props.children}
|
|
168
|
+
{}
|
|
169
|
+
<VisuallyHidden>
|
|
170
|
+
<button aria-label={String(calendarAria.nextButtonProps["aria-label"] ?? "")} disabled={Boolean(calendarAria.nextButtonProps.disabled)} onClick={() => state.focusNextPage()} tabIndex={-1} />
|
|
171
|
+
</VisuallyHidden>
|
|
102
172
|
</div>
|
|
103
173
|
</RangeCalendarContext.Provider>
|
|
104
174
|
</RangeCalendarStateContext.Provider>;
|
|
@@ -123,7 +193,7 @@ function RangeCalendarButton(props) {
|
|
|
123
193
|
return calendarAria.nextButtonProps;
|
|
124
194
|
});
|
|
125
195
|
const isDisabled = createMemo(() => props.isDisabled || Boolean(buttonProps().disabled) || state.isDisabled());
|
|
126
|
-
return <button {...buttonProps()} class={props.class ?? "solidaria-RangeCalendarButton"} style={props.style} disabled={isDisabled()}>
|
|
196
|
+
return <button {...buttonProps()} class={props.class ?? "solidaria-RangeCalendarButton"} style={props.style} disabled={isDisabled()} tabindex={isDisabled() ? void 0 : 0}>
|
|
127
197
|
{props.children}
|
|
128
198
|
</button>;
|
|
129
199
|
}
|