@proyecto-viviana/solidaria-components 0.3.2 → 0.4.0
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.js +184 -0
- package/dist/ActionBar.js.map +1 -0
- package/dist/ActionBar.jsx +128 -0
- package/dist/ActionBar.jsx.map +1 -0
- package/dist/ActionGroup.js +179 -0
- package/dist/ActionGroup.js.map +1 -0
- package/dist/ActionGroup.jsx +129 -0
- package/dist/ActionGroup.jsx.map +1 -0
- package/dist/Alert.js +111 -0
- package/dist/Alert.js.map +1 -0
- package/dist/Alert.jsx +82 -0
- package/dist/Alert.jsx.map +1 -0
- package/dist/Autocomplete.js +130 -0
- package/dist/Autocomplete.js.map +1 -0
- package/dist/Autocomplete.jsx +116 -0
- package/dist/Autocomplete.jsx.map +1 -0
- package/dist/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs.js +334 -0
- package/dist/Breadcrumbs.js.map +1 -0
- package/dist/Breadcrumbs.jsx +266 -0
- package/dist/Breadcrumbs.jsx.map +1 -0
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +348 -0
- package/dist/Button.js.map +1 -0
- package/dist/Button.jsx +314 -0
- package/dist/Button.jsx.map +1 -0
- package/dist/Calendar.d.ts +4 -4
- package/dist/Calendar.d.ts.map +1 -1
- package/dist/Calendar.js +538 -0
- package/dist/Calendar.js.map +1 -0
- package/dist/Calendar.jsx +333 -0
- package/dist/Calendar.jsx.map +1 -0
- package/dist/CalendarPicker.d.ts +33 -0
- package/dist/CalendarPicker.d.ts.map +1 -0
- package/dist/CalendarPicker.js +44 -0
- package/dist/CalendarPicker.js.map +1 -0
- package/dist/CalendarPicker.jsx +44 -0
- package/dist/CalendarPicker.jsx.map +1 -0
- package/dist/Checkbox.d.ts +83 -4
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +923 -0
- package/dist/Checkbox.js.map +1 -0
- package/dist/Checkbox.jsx +707 -0
- package/dist/Checkbox.jsx.map +1 -0
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +202 -0
- package/dist/Collection.js.map +1 -0
- package/dist/Collection.jsx +152 -0
- package/dist/Collection.jsx.map +1 -0
- package/dist/Color.d.ts.map +1 -1
- package/dist/Color.js +1720 -0
- package/dist/Color.js.map +1 -0
- package/dist/Color.jsx +1344 -0
- package/dist/Color.jsx.map +1 -0
- package/dist/ColorEditor.js +208 -0
- package/dist/ColorEditor.js.map +1 -0
- package/dist/ColorEditor.jsx +120 -0
- package/dist/ColorEditor.jsx.map +1 -0
- package/dist/ComboBox.d.ts +4 -4
- package/dist/ComboBox.d.ts.map +1 -1
- package/dist/ComboBox.js +992 -0
- package/dist/ComboBox.js.map +1 -0
- package/dist/ComboBox.jsx +714 -0
- package/dist/ComboBox.jsx.map +1 -0
- package/dist/ContextualHelpTrigger.js +146 -0
- package/dist/ContextualHelpTrigger.js.map +1 -0
- package/dist/ContextualHelpTrigger.jsx +109 -0
- package/dist/ContextualHelpTrigger.jsx.map +1 -0
- package/dist/DateField.d.ts +3 -3
- package/dist/DateField.d.ts.map +1 -1
- package/dist/DateField.js +4 -0
- package/dist/DateField.jsx +4 -0
- package/dist/DateField2.js +499 -0
- package/dist/DateField2.js.map +1 -0
- package/dist/DateField2.jsx +317 -0
- package/dist/DateField2.jsx.map +1 -0
- package/dist/DatePicker.d.ts +4 -4
- package/dist/DatePicker.d.ts.map +1 -1
- package/dist/DatePicker.js +991 -0
- package/dist/DatePicker.js.map +1 -0
- package/dist/DatePicker.jsx +682 -0
- package/dist/DatePicker.jsx.map +1 -0
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +337 -0
- package/dist/Dialog.js.map +1 -0
- package/dist/Dialog.jsx +192 -0
- package/dist/Dialog.jsx.map +1 -0
- package/dist/Disclosure.d.ts.map +1 -1
- package/dist/Disclosure.js +328 -0
- package/dist/Disclosure.js.map +1 -0
- package/dist/Disclosure.jsx +230 -0
- package/dist/Disclosure.jsx.map +1 -0
- package/dist/DragAndDrop.d.ts.map +1 -1
- package/dist/DragAndDrop.js +176 -0
- package/dist/DragAndDrop.js.map +1 -0
- package/dist/DragAndDrop.jsx +160 -0
- package/dist/DragAndDrop.jsx.map +1 -0
- package/dist/DropZone.d.ts.map +1 -1
- package/dist/DropZone.js +189 -0
- package/dist/DropZone.js.map +1 -0
- package/dist/DropZone.jsx +144 -0
- package/dist/DropZone.jsx.map +1 -0
- package/dist/FieldError.js +66 -0
- package/dist/FieldError.js.map +1 -0
- package/dist/FieldError.jsx +47 -0
- package/dist/FieldError.jsx.map +1 -0
- package/dist/FileTrigger.js +79 -0
- package/dist/FileTrigger.js.map +1 -0
- package/dist/FileTrigger.jsx +49 -0
- package/dist/FileTrigger.jsx.map +1 -0
- package/dist/Focusable.js +70 -0
- package/dist/Focusable.js.map +1 -0
- package/dist/Focusable.jsx +69 -0
- package/dist/Focusable.jsx.map +1 -0
- package/dist/Form.js +99 -0
- package/dist/Form.js.map +1 -0
- package/dist/Form.jsx +73 -0
- package/dist/Form.jsx.map +1 -0
- package/dist/GridList.d.ts +34 -2
- package/dist/GridList.d.ts.map +1 -1
- package/dist/GridList.js +723 -0
- package/dist/GridList.js.map +1 -0
- package/dist/GridList.jsx +552 -0
- package/dist/GridList.jsx.map +1 -0
- package/dist/HiddenTimeInput.js +104 -0
- package/dist/HiddenTimeInput.js.map +1 -0
- package/dist/HiddenTimeInput.jsx +69 -0
- package/dist/HiddenTimeInput.jsx.map +1 -0
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +127 -0
- package/dist/Icon.js.map +1 -0
- package/dist/Icon.jsx +72 -0
- package/dist/Icon.jsx.map +1 -0
- package/dist/Keyboard.js +30 -0
- package/dist/Keyboard.js.map +1 -0
- package/dist/Keyboard.jsx +24 -0
- package/dist/Keyboard.jsx.map +1 -0
- package/dist/Landmark.js +134 -0
- package/dist/Landmark.js.map +1 -0
- package/dist/Landmark.jsx +118 -0
- package/dist/Landmark.jsx.map +1 -0
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +219 -0
- package/dist/Link.js.map +1 -0
- package/dist/Link.jsx +189 -0
- package/dist/Link.jsx.map +1 -0
- package/dist/ListBox.d.ts.map +1 -1
- package/dist/ListBox.js +670 -0
- package/dist/ListBox.js.map +1 -0
- package/dist/ListBox.jsx +508 -0
- package/dist/ListBox.jsx.map +1 -0
- package/dist/Menu.d.ts +27 -9
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +1254 -0
- package/dist/Menu.js.map +1 -0
- package/dist/Menu.jsx +1042 -0
- package/dist/Menu.jsx.map +1 -0
- package/dist/Meter.d.ts.map +1 -1
- package/dist/Meter.js +123 -0
- package/dist/Meter.js.map +1 -0
- package/dist/Meter.jsx +107 -0
- package/dist/Meter.jsx.map +1 -0
- package/dist/Modal.d.ts.map +1 -1
- package/dist/Modal.js +380 -0
- package/dist/Modal.js.map +1 -0
- package/dist/Modal.jsx +314 -0
- package/dist/Modal.jsx.map +1 -0
- package/dist/NumberField.d.ts +3 -3
- package/dist/NumberField.d.ts.map +1 -1
- package/dist/NumberField.js +573 -0
- package/dist/NumberField.js.map +1 -0
- package/dist/NumberField.jsx +443 -0
- package/dist/NumberField.jsx.map +1 -0
- package/dist/Popover.d.ts +10 -2
- package/dist/Popover.d.ts.map +1 -1
- package/dist/Popover.js +464 -0
- package/dist/Popover.js.map +1 -0
- package/dist/Popover.jsx +333 -0
- package/dist/Popover.jsx.map +1 -0
- package/dist/Pressable.js +69 -0
- package/dist/Pressable.js.map +1 -0
- package/dist/Pressable.jsx +68 -0
- package/dist/Pressable.jsx.map +1 -0
- package/dist/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar.js +130 -0
- package/dist/ProgressBar.js.map +1 -0
- package/dist/ProgressBar.jsx +114 -0
- package/dist/ProgressBar.jsx.map +1 -0
- package/dist/RadioGroup.d.ts +82 -4
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +931 -0
- package/dist/RadioGroup.js.map +1 -0
- package/dist/RadioGroup.jsx +681 -0
- package/dist/RadioGroup.jsx.map +1 -0
- package/dist/RangeCalendar.d.ts.map +1 -1
- package/dist/RangeCalendar.js +410 -0
- package/dist/RangeCalendar.js.map +1 -0
- package/dist/RangeCalendar.jsx +253 -0
- package/dist/RangeCalendar.jsx.map +1 -0
- package/dist/RouterProvider.js +118 -0
- package/dist/RouterProvider.js.map +1 -0
- package/dist/RouterProvider.jsx +112 -0
- package/dist/RouterProvider.jsx.map +1 -0
- package/dist/SearchField.d.ts +2 -2
- package/dist/SearchField.d.ts.map +1 -1
- package/dist/SearchField.js +643 -0
- package/dist/SearchField.js.map +1 -0
- package/dist/SearchField.jsx +526 -0
- package/dist/SearchField.jsx.map +1 -0
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +1031 -0
- package/dist/Select.js.map +1 -0
- package/dist/Select.jsx +744 -0
- package/dist/Select.jsx.map +1 -0
- package/dist/SelectionIndicator.d.ts.map +1 -1
- package/dist/SelectionIndicator.js +86 -0
- package/dist/SelectionIndicator.js.map +1 -0
- package/dist/SelectionIndicator.jsx +50 -0
- package/dist/SelectionIndicator.jsx.map +1 -0
- package/dist/Separator.js +97 -0
- package/dist/Separator.js.map +1 -0
- package/dist/Separator.jsx +85 -0
- package/dist/Separator.jsx.map +1 -0
- package/dist/SharedElementTransition.d.ts.map +1 -1
- package/dist/SharedElementTransition.js +165 -0
- package/dist/SharedElementTransition.js.map +1 -0
- package/dist/SharedElementTransition.jsx +138 -0
- package/dist/SharedElementTransition.jsx.map +1 -0
- package/dist/Slider.d.ts +33 -1
- package/dist/Slider.d.ts.map +1 -1
- package/dist/Slider.js +515 -0
- package/dist/Slider.js.map +1 -0
- package/dist/Slider.jsx +403 -0
- package/dist/Slider.jsx.map +1 -0
- package/dist/StepList.js +198 -0
- package/dist/StepList.js.map +1 -0
- package/dist/StepList.jsx +141 -0
- package/dist/StepList.jsx.map +1 -0
- package/dist/Switch.d.ts +65 -2
- package/dist/Switch.d.ts.map +1 -1
- package/dist/Switch.js +534 -0
- package/dist/Switch.js.map +1 -0
- package/dist/Switch.jsx +393 -0
- package/dist/Switch.jsx.map +1 -0
- package/dist/Table.d.ts +48 -0
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +1759 -0
- package/dist/Table.js.map +1 -0
- package/dist/Table.jsx +1348 -0
- package/dist/Table.jsx.map +1 -0
- package/dist/Tabs.d.ts +0 -4
- package/dist/Tabs.d.ts.map +1 -1
- package/dist/Tabs.js +595 -0
- package/dist/Tabs.js.map +1 -0
- package/dist/Tabs.jsx +367 -0
- package/dist/Tabs.jsx.map +1 -0
- package/dist/TagGroup.d.ts.map +1 -1
- package/dist/TagGroup.js +378 -0
- package/dist/TagGroup.js.map +1 -0
- package/dist/TagGroup.jsx +270 -0
- package/dist/TagGroup.jsx.map +1 -0
- package/dist/Text.d.ts +18 -6
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +42 -0
- package/dist/Text.js.map +1 -0
- package/dist/Text.jsx +35 -0
- package/dist/Text.jsx.map +1 -0
- package/dist/TextField.d.ts +6 -6
- package/dist/TextField.d.ts.map +1 -1
- package/dist/TextField.js +436 -0
- package/dist/TextField.js.map +1 -0
- package/dist/TextField.jsx +403 -0
- package/dist/TextField.jsx.map +1 -0
- package/dist/TimeField.d.ts +3 -3
- package/dist/TimeField.d.ts.map +1 -1
- package/dist/TimeField.js +372 -0
- package/dist/TimeField.js.map +1 -0
- package/dist/TimeField.jsx +224 -0
- package/dist/TimeField.jsx.map +1 -0
- package/dist/Toast.d.ts +14 -0
- package/dist/Toast.d.ts.map +1 -1
- package/dist/Toast.js +551 -0
- package/dist/Toast.js.map +1 -0
- package/dist/Toast.jsx +361 -0
- package/dist/Toast.jsx.map +1 -0
- package/dist/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton.js +123 -0
- package/dist/ToggleButton.js.map +1 -0
- package/dist/ToggleButton.jsx +88 -0
- package/dist/ToggleButton.jsx.map +1 -0
- package/dist/ToggleButtonGroup.d.ts.map +1 -1
- package/dist/ToggleButtonGroup.js +114 -0
- package/dist/ToggleButtonGroup.js.map +1 -0
- package/dist/ToggleButtonGroup.jsx +85 -0
- package/dist/ToggleButtonGroup.jsx.map +1 -0
- package/dist/Toolbar.js +112 -0
- package/dist/Toolbar.js.map +1 -0
- package/dist/Toolbar.jsx +92 -0
- package/dist/Toolbar.jsx.map +1 -0
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip.js +539 -0
- package/dist/Tooltip.js.map +1 -0
- package/dist/Tooltip.jsx +465 -0
- package/dist/Tooltip.jsx.map +1 -0
- package/dist/Tree.d.ts +14 -2
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Tree.js +1424 -0
- package/dist/Tree.js.map +1 -0
- package/dist/Tree.jsx +1172 -0
- package/dist/Tree.jsx.map +1 -0
- package/dist/Virtualizer.d.ts +16 -2
- package/dist/Virtualizer.d.ts.map +1 -1
- package/dist/Virtualizer.js +2 -0
- package/dist/Virtualizer.jsx +2 -0
- package/dist/Virtualizer2.js +751 -0
- package/dist/Virtualizer2.js.map +1 -0
- package/dist/Virtualizer2.jsx +730 -0
- package/dist/Virtualizer2.jsx.map +1 -0
- package/dist/VirtualizerLayouts.d.ts +18 -0
- package/dist/VirtualizerLayouts.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +42 -0
- package/dist/VisuallyHidden.js.map +1 -0
- package/dist/VisuallyHidden.jsx +35 -0
- package/dist/VisuallyHidden.jsx.map +1 -0
- package/dist/contexts.js +33 -0
- package/dist/contexts.js.map +1 -0
- package/dist/contexts.jsx +33 -0
- package/dist/contexts.jsx.map +1 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +70 -23932
- package/dist/index.jsx +70 -18337
- package/dist/useDragAndDrop.js +2 -0
- package/dist/useDragAndDrop.jsx +2 -0
- package/dist/useDragAndDrop2.js +395 -0
- package/dist/useDragAndDrop2.js.map +1 -0
- package/dist/useDragAndDrop2.jsx +395 -0
- package/dist/useDragAndDrop2.jsx.map +1 -0
- package/dist/utils.d.ts +83 -11
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +285 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.jsx +277 -0
- package/dist/utils.jsx.map +1 -0
- package/dist/virtualizer/Layout.js +144 -0
- package/dist/virtualizer/Layout.js.map +1 -0
- package/dist/virtualizer/Layout.jsx +144 -0
- package/dist/virtualizer/Layout.jsx.map +1 -0
- package/package.json +401 -4
- package/src/Breadcrumbs.tsx +3 -1
- package/src/Button.tsx +22 -2
- package/src/Calendar.tsx +27 -10
- package/src/CalendarPicker.tsx +73 -0
- package/src/Checkbox.tsx +539 -3
- package/src/Collection.tsx +9 -3
- package/src/Color.tsx +42 -14
- package/src/ComboBox.tsx +50 -6
- package/src/DateField.tsx +20 -2
- package/src/DatePicker.tsx +57 -5
- package/src/Dialog.tsx +13 -5
- package/src/Disclosure.tsx +3 -1
- package/src/DragAndDrop.tsx +3 -1
- package/src/DropZone.tsx +3 -1
- package/src/GridList.tsx +125 -24
- package/src/Icon.tsx +3 -1
- package/src/Link.tsx +3 -1
- package/src/ListBox.tsx +31 -4
- package/src/Menu.tsx +252 -128
- package/src/Meter.tsx +3 -1
- package/src/Modal.tsx +100 -52
- package/src/NumberField.tsx +51 -8
- package/src/Popover.tsx +40 -10
- package/src/ProgressBar.tsx +3 -1
- package/src/RadioGroup.tsx +468 -4
- package/src/RangeCalendar.tsx +3 -1
- package/src/SearchField.tsx +27 -3
- package/src/Select.tsx +22 -7
- package/src/SelectionIndicator.tsx +3 -1
- package/src/SharedElementTransition.tsx +3 -1
- package/src/Slider.tsx +159 -13
- package/src/Switch.tsx +395 -2
- package/src/Table.tsx +409 -95
- package/src/Tabs.tsx +16 -45
- package/src/TagGroup.tsx +3 -1
- package/src/Text.tsx +31 -10
- package/src/TextField.tsx +43 -5
- package/src/TimeField.tsx +20 -2
- package/src/Toast.tsx +79 -14
- package/src/ToggleButton.tsx +3 -1
- package/src/ToggleButtonGroup.tsx +3 -1
- package/src/Tooltip.tsx +3 -1
- package/src/Tree.tsx +77 -9
- package/src/Virtualizer.tsx +180 -31
- package/src/VirtualizerLayouts.ts +45 -10
- package/src/index.ts +50 -0
- package/src/utils.tsx +243 -27
- package/dist/index.js.map +0 -1
- package/dist/index.jsx.map +0 -1
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { dataAttr, useIsHydrated, useRenderProps } from "./utils.jsx";
|
|
2
|
+
import { VisuallyHidden } from "./VisuallyHidden.jsx";
|
|
3
|
+
import { For, Index, Show, createContext, createMemo, createSignal, splitProps, useContext } from "solid-js";
|
|
4
|
+
import { createCalendar, createCalendarCell, createCalendarGrid, createHover } from "@proyecto-viviana/solidaria";
|
|
5
|
+
import { createCalendarState, endOfMonth, isSameMonth } from "@proyecto-viviana/solid-stately";
|
|
6
|
+
//#region src/Calendar.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Calendar component for solidaria-components
|
|
9
|
+
*
|
|
10
|
+
* Pre-wired headless calendar component that combines aria hooks.
|
|
11
|
+
* Port of react-aria-components/src/Calendar.tsx
|
|
12
|
+
*/
|
|
13
|
+
function assignRef(ref, el) {
|
|
14
|
+
if (!ref) return;
|
|
15
|
+
if (typeof ref === "function") ref(el);
|
|
16
|
+
else ref.current = el;
|
|
17
|
+
}
|
|
18
|
+
const CalendarContext = createContext(null);
|
|
19
|
+
const CalendarGridMonthContext = createContext(null);
|
|
20
|
+
const CalendarGridCellPositionContext = createContext(null);
|
|
21
|
+
function useCalendarContext() {
|
|
22
|
+
const context = useContext(CalendarContext);
|
|
23
|
+
if (!context) throw new Error("Calendar components must be used within a Calendar");
|
|
24
|
+
return context;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A calendar displays a grid of days in a month and allows users to select a single date.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <Calendar aria-label="Event date">
|
|
32
|
+
* <header>
|
|
33
|
+
* <CalendarButton slot="previous">◀</CalendarButton>
|
|
34
|
+
* <CalendarHeading />
|
|
35
|
+
* <CalendarButton slot="next">▶</CalendarButton>
|
|
36
|
+
* </header>
|
|
37
|
+
* <CalendarGrid>
|
|
38
|
+
* {(date) => <CalendarCell date={date} />}
|
|
39
|
+
* </CalendarGrid>
|
|
40
|
+
* </Calendar>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
function Calendar(props) {
|
|
44
|
+
const inheritedState = useContext(CalendarContext);
|
|
45
|
+
const isHydrated = useIsHydrated();
|
|
46
|
+
return <Show when={isHydrated()} fallback={<div class="solidaria-Calendar solidaria-Calendar--placeholder" aria-hidden="true" />}>
|
|
47
|
+
<Show when={inheritedState} fallback={<CalendarInner {...props} />}>
|
|
48
|
+
<CalendarWithState state={inheritedState} {...props} />
|
|
49
|
+
</Show>
|
|
50
|
+
</Show>;
|
|
51
|
+
}
|
|
52
|
+
function CalendarWithState(props) {
|
|
53
|
+
const [local, stateProps, rest] = splitProps(props, [
|
|
54
|
+
"children",
|
|
55
|
+
"class",
|
|
56
|
+
"style",
|
|
57
|
+
"slot",
|
|
58
|
+
"state",
|
|
59
|
+
"ref"
|
|
60
|
+
], [
|
|
61
|
+
"value",
|
|
62
|
+
"defaultValue",
|
|
63
|
+
"onChange",
|
|
64
|
+
"selectionMode",
|
|
65
|
+
"minValue",
|
|
66
|
+
"maxValue",
|
|
67
|
+
"isDisabled",
|
|
68
|
+
"isReadOnly",
|
|
69
|
+
"autoFocus",
|
|
70
|
+
"focusedValue",
|
|
71
|
+
"defaultFocusedValue",
|
|
72
|
+
"onFocusChange",
|
|
73
|
+
"locale",
|
|
74
|
+
"createCalendar",
|
|
75
|
+
"isDateUnavailable",
|
|
76
|
+
"visibleMonths",
|
|
77
|
+
"pageBehavior",
|
|
78
|
+
"selectionAlignment",
|
|
79
|
+
"isDateDisabled",
|
|
80
|
+
"validationState",
|
|
81
|
+
"errorMessage",
|
|
82
|
+
"firstDayOfWeek"
|
|
83
|
+
]);
|
|
84
|
+
const state = () => props.state;
|
|
85
|
+
const calendarAria = createCalendar(() => ({
|
|
86
|
+
...rest,
|
|
87
|
+
errorMessage: stateProps.errorMessage
|
|
88
|
+
}), state());
|
|
89
|
+
const renderValues = createMemo(() => ({
|
|
90
|
+
isDisabled: state().isDisabled(),
|
|
91
|
+
isReadOnly: state().isReadOnly(),
|
|
92
|
+
isInvalid: state().isValueInvalid()
|
|
93
|
+
}));
|
|
94
|
+
const renderProps = useRenderProps({
|
|
95
|
+
class: local.class,
|
|
96
|
+
style: local.style,
|
|
97
|
+
defaultClassName: "solidaria-Calendar"
|
|
98
|
+
}, renderValues);
|
|
99
|
+
return <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())}>
|
|
100
|
+
<VisuallyHidden>
|
|
101
|
+
<h2>{String(calendarAria.calendarProps["aria-label"] ?? "")}</h2>
|
|
102
|
+
</VisuallyHidden>
|
|
103
|
+
{props.children}
|
|
104
|
+
</div>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Internal Calendar component that renders after client mount.
|
|
108
|
+
*/
|
|
109
|
+
function CalendarInner(props) {
|
|
110
|
+
const [local, stateProps, rest] = splitProps(props, [
|
|
111
|
+
"children",
|
|
112
|
+
"class",
|
|
113
|
+
"style",
|
|
114
|
+
"slot",
|
|
115
|
+
"ref"
|
|
116
|
+
], [
|
|
117
|
+
"value",
|
|
118
|
+
"defaultValue",
|
|
119
|
+
"onChange",
|
|
120
|
+
"selectionMode",
|
|
121
|
+
"minValue",
|
|
122
|
+
"maxValue",
|
|
123
|
+
"isDisabled",
|
|
124
|
+
"isReadOnly",
|
|
125
|
+
"autoFocus",
|
|
126
|
+
"focusedValue",
|
|
127
|
+
"defaultFocusedValue",
|
|
128
|
+
"onFocusChange",
|
|
129
|
+
"locale",
|
|
130
|
+
"createCalendar",
|
|
131
|
+
"isDateUnavailable",
|
|
132
|
+
"visibleMonths",
|
|
133
|
+
"pageBehavior",
|
|
134
|
+
"selectionAlignment",
|
|
135
|
+
"isDateDisabled",
|
|
136
|
+
"validationState",
|
|
137
|
+
"errorMessage",
|
|
138
|
+
"firstDayOfWeek"
|
|
139
|
+
]);
|
|
140
|
+
const state = createCalendarState(stateProps);
|
|
141
|
+
const calendarAria = createCalendar(() => ({
|
|
142
|
+
...rest,
|
|
143
|
+
errorMessage: stateProps.errorMessage
|
|
144
|
+
}), state);
|
|
145
|
+
const renderValues = createMemo(() => ({
|
|
146
|
+
isDisabled: state.isDisabled(),
|
|
147
|
+
isReadOnly: state.isReadOnly(),
|
|
148
|
+
isInvalid: state.isValueInvalid()
|
|
149
|
+
}));
|
|
150
|
+
const renderProps = useRenderProps({
|
|
151
|
+
class: local.class,
|
|
152
|
+
style: local.style,
|
|
153
|
+
defaultClassName: "solidaria-Calendar"
|
|
154
|
+
}, renderValues);
|
|
155
|
+
return <CalendarContext.Provider value={state}>
|
|
156
|
+
<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())}>
|
|
157
|
+
<VisuallyHidden>
|
|
158
|
+
<h2>{String(calendarAria.calendarProps["aria-label"] ?? "")}</h2>
|
|
159
|
+
</VisuallyHidden>
|
|
160
|
+
{props.children}
|
|
161
|
+
</div>
|
|
162
|
+
</CalendarContext.Provider>;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Displays the current month and year in the calendar.
|
|
166
|
+
*/
|
|
167
|
+
function CalendarHeading(props) {
|
|
168
|
+
const state = useCalendarContext();
|
|
169
|
+
const renderValues = createMemo(() => ({ title: state.title() }));
|
|
170
|
+
const renderProps = useRenderProps({
|
|
171
|
+
get children() {
|
|
172
|
+
return props.children;
|
|
173
|
+
},
|
|
174
|
+
class: props.class,
|
|
175
|
+
style: props.style,
|
|
176
|
+
defaultClassName: "solidaria-CalendarHeading"
|
|
177
|
+
}, renderValues);
|
|
178
|
+
return <h2 class={renderProps.class()} style={renderProps.style()} aria-live="polite">
|
|
179
|
+
{typeof props.children === "function" ? renderProps.renderChildren() : state.title()}
|
|
180
|
+
</h2>;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* A button for navigating the calendar.
|
|
184
|
+
*/
|
|
185
|
+
function CalendarButton(props) {
|
|
186
|
+
const state = useCalendarContext();
|
|
187
|
+
const calendarAria = createCalendar({}, state);
|
|
188
|
+
const buttonProps = createMemo(() => {
|
|
189
|
+
if (props.slot === "previous") return calendarAria.prevButtonProps;
|
|
190
|
+
return calendarAria.nextButtonProps;
|
|
191
|
+
});
|
|
192
|
+
return <button {...buttonProps()} class={props.class ?? "solidaria-CalendarButton"} style={props.style} disabled={props.isDisabled || state.isDisabled()}>
|
|
193
|
+
{props.children}
|
|
194
|
+
</button>;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Displays a grid of calendar cells.
|
|
198
|
+
*/
|
|
199
|
+
function CalendarGrid(props) {
|
|
200
|
+
const state = useCalendarContext();
|
|
201
|
+
const [gridRef, setGridRef] = createSignal(null);
|
|
202
|
+
const startDate = createMemo(() => {
|
|
203
|
+
const offsetMonths = props.offset?.months ?? 0;
|
|
204
|
+
const baseStart = state.visibleRange().start;
|
|
205
|
+
return offsetMonths ? baseStart.add({ months: offsetMonths }) : baseStart;
|
|
206
|
+
});
|
|
207
|
+
const gridAria = createCalendarGrid({
|
|
208
|
+
startDate: startDate(),
|
|
209
|
+
endDate: endOfMonth(startDate()),
|
|
210
|
+
weekdayStyle: props.weekdayStyle
|
|
211
|
+
}, state, gridRef);
|
|
212
|
+
const renderValues = createMemo(() => ({ isDisabled: state.isDisabled() }));
|
|
213
|
+
const renderProps = useRenderProps({
|
|
214
|
+
class: props.class,
|
|
215
|
+
style: props.style,
|
|
216
|
+
defaultClassName: "solidaria-CalendarGrid"
|
|
217
|
+
}, renderValues);
|
|
218
|
+
const allDates = createMemo(() => {
|
|
219
|
+
const monthStart = startDate();
|
|
220
|
+
const numWeeks = state.getWeeksInMonth(monthStart);
|
|
221
|
+
const weekDates = [];
|
|
222
|
+
for (let weekIndex = 0; weekIndex < numWeeks; weekIndex++) weekDates.push(state.getDatesInWeek(weekIndex, monthStart));
|
|
223
|
+
return weekDates;
|
|
224
|
+
});
|
|
225
|
+
return <CalendarGridMonthContext.Provider value={startDate}>
|
|
226
|
+
<table ref={setGridRef} {...gridAria.gridProps} class={renderProps.class()} style={renderProps.style()}>
|
|
227
|
+
<thead {...gridAria.headerProps}>
|
|
228
|
+
<tr>
|
|
229
|
+
<For each={gridAria.weekDays}>
|
|
230
|
+
{(day) => <th scope="col" class={props.headerCellClass ?? "solidaria-CalendarHeaderCell"}>
|
|
231
|
+
{day}
|
|
232
|
+
</th>}
|
|
233
|
+
</For>
|
|
234
|
+
</tr>
|
|
235
|
+
</thead>
|
|
236
|
+
<tbody>
|
|
237
|
+
<Index each={allDates()}>
|
|
238
|
+
{(weekDates, weekIndex) => <tr>
|
|
239
|
+
<Index each={weekDates()}>
|
|
240
|
+
{(date, dayIndex) => <Show when={date()} fallback={<td />}>
|
|
241
|
+
<CalendarGridCellPositionContext.Provider value={() => ({
|
|
242
|
+
weekIndex,
|
|
243
|
+
dayIndex,
|
|
244
|
+
lastWeekIndex: allDates().length - 1
|
|
245
|
+
})}>
|
|
246
|
+
{props.children?.(date())}
|
|
247
|
+
</CalendarGridCellPositionContext.Provider>
|
|
248
|
+
</Show>}
|
|
249
|
+
</Index>
|
|
250
|
+
</tr>}
|
|
251
|
+
</Index>
|
|
252
|
+
</tbody>
|
|
253
|
+
</table>
|
|
254
|
+
</CalendarGridMonthContext.Provider>;
|
|
255
|
+
}
|
|
256
|
+
function CalendarGridHeader(props) {
|
|
257
|
+
return <thead class={props.class ?? "solidaria-CalendarGridHeader"} style={props.style}>
|
|
258
|
+
{props.children}
|
|
259
|
+
</thead>;
|
|
260
|
+
}
|
|
261
|
+
function CalendarGridBody(props) {
|
|
262
|
+
return <tbody class={props.class ?? "solidaria-CalendarGridBody"} style={props.style}>
|
|
263
|
+
{props.children}
|
|
264
|
+
</tbody>;
|
|
265
|
+
}
|
|
266
|
+
function CalendarHeaderCell(props) {
|
|
267
|
+
return <th scope="col" class={props.class ?? "solidaria-CalendarHeaderCell"} style={props.style}>
|
|
268
|
+
{props.children}
|
|
269
|
+
</th>;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* A cell in the calendar grid representing a single day.
|
|
273
|
+
*/
|
|
274
|
+
function CalendarCell(props) {
|
|
275
|
+
const state = useCalendarContext();
|
|
276
|
+
const currentMonthStart = useContext(CalendarGridMonthContext);
|
|
277
|
+
const cellPosition = useContext(CalendarGridCellPositionContext);
|
|
278
|
+
const [cellRef, setCellRef] = createSignal(null);
|
|
279
|
+
const isOutsideMonth = createMemo(() => currentMonthStart != null && !isSameMonth(currentMonthStart(), props.date));
|
|
280
|
+
const position = createMemo(() => cellPosition?.() ?? {
|
|
281
|
+
weekIndex: 0,
|
|
282
|
+
dayIndex: 0,
|
|
283
|
+
lastWeekIndex: 0
|
|
284
|
+
});
|
|
285
|
+
const cellAria = createCalendarCell(() => ({
|
|
286
|
+
date: props.date,
|
|
287
|
+
isOutsideMonth: isOutsideMonth()
|
|
288
|
+
}), state, cellRef);
|
|
289
|
+
const { hoverProps, isHovered } = createHover(() => ({ isDisabled: cellAria.isDisabled || cellAria.isUnavailable }));
|
|
290
|
+
const renderValues = createMemo(() => ({
|
|
291
|
+
isSelected: cellAria.isSelected,
|
|
292
|
+
isFocused: cellAria.isFocused,
|
|
293
|
+
isFocusVisible: cellAria.isFocusVisible,
|
|
294
|
+
isDisabled: cellAria.isDisabled,
|
|
295
|
+
isUnavailable: cellAria.isUnavailable,
|
|
296
|
+
isInvalid: cellAria.isInvalid,
|
|
297
|
+
isOutsideMonth: cellAria.isOutsideMonth,
|
|
298
|
+
isToday: cellAria.isToday,
|
|
299
|
+
isPressed: cellAria.isPressed,
|
|
300
|
+
isHovered: isHovered(),
|
|
301
|
+
isFirstChild: position().dayIndex === 0,
|
|
302
|
+
isLastChild: position().dayIndex === 6,
|
|
303
|
+
isFirstWeek: position().weekIndex === 0,
|
|
304
|
+
isLastWeek: position().weekIndex === position().lastWeekIndex,
|
|
305
|
+
formattedDate: cellAria.formattedDate
|
|
306
|
+
}));
|
|
307
|
+
const renderProps = useRenderProps({
|
|
308
|
+
get children() {
|
|
309
|
+
return props.children;
|
|
310
|
+
},
|
|
311
|
+
class: props.class,
|
|
312
|
+
style: props.style,
|
|
313
|
+
defaultClassName: "solidaria-CalendarCell"
|
|
314
|
+
}, renderValues);
|
|
315
|
+
const cellRenderProps = useRenderProps({
|
|
316
|
+
class: props.cellClass,
|
|
317
|
+
style: props.cellStyle,
|
|
318
|
+
defaultClassName: "solidaria-CalendarCellWrapper"
|
|
319
|
+
}, renderValues);
|
|
320
|
+
const getChildren = () => {
|
|
321
|
+
if (typeof props.children === "function") return renderProps.renderChildren();
|
|
322
|
+
return cellAria.formattedDate;
|
|
323
|
+
};
|
|
324
|
+
return <td {...cellAria.cellProps} class={cellRenderProps.class()} style={cellRenderProps.style()}>
|
|
325
|
+
<div ref={setCellRef} {...cellAria.buttonProps} {...hoverProps} class={renderProps.class()} style={renderProps.style()} data-selected={dataAttr(cellAria.isSelected)} data-focused={dataAttr(cellAria.isFocused)} data-focus-visible={dataAttr(cellAria.isFocusVisible)} data-disabled={dataAttr(cellAria.isDisabled)} data-unavailable={dataAttr(cellAria.isUnavailable)} data-invalid={dataAttr(cellAria.isInvalid)} data-outside-month={dataAttr(cellAria.isOutsideMonth)} data-today={dataAttr(cellAria.isToday)} data-pressed={dataAttr(cellAria.isPressed)} data-hovered={dataAttr(isHovered())}>
|
|
326
|
+
{getChildren()}
|
|
327
|
+
</div>
|
|
328
|
+
</td>;
|
|
329
|
+
}
|
|
330
|
+
//#endregion
|
|
331
|
+
export { Calendar, CalendarButton, CalendarCell, CalendarContext, CalendarGrid, CalendarGridBody, CalendarGridHeader, CalendarHeaderCell, CalendarHeading, useCalendarContext };
|
|
332
|
+
|
|
333
|
+
//# sourceMappingURL=Calendar.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Calendar.jsx","names":[],"sources":["../src/Calendar.tsx"],"sourcesContent":["/**\n * Calendar component for solidaria-components\n *\n * Pre-wired headless calendar component that combines aria hooks.\n * Port of react-aria-components/src/Calendar.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\";\n\nimport {\n createCalendar,\n createCalendarGrid,\n createCalendarCell,\n createHover,\n type AriaCalendarProps,\n type AriaCalendarGridProps,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createCalendarState,\n type CalendarState,\n type CalendarStateProps,\n type CalendarSelectionMode,\n type CalendarDate,\n type DateValue,\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 CalendarRenderProps {\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}\n\nexport interface CalendarProps<\n T extends DateValue = DateValue,\n M extends CalendarSelectionMode = \"single\",\n>\n extends\n Omit<AriaCalendarProps, \"id\" | \"isDisabled\" | \"isReadOnly\">,\n Omit<CalendarStateProps<T, M>, \"locale\">,\n SlotProps {\n /** The children of the component. */\n children?: JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<CalendarRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<CalendarRenderProps>;\n /** The locale to use for formatting. */\n locale?: string;\n /** Ref for the calendar root element. */\n ref?: RefLike<HTMLDivElement>;\n}\n\nexport interface CalendarGridRenderProps {\n /** Whether the grid is disabled. */\n isDisabled: boolean;\n}\n\nexport interface CalendarGridProps\n extends Omit<AriaCalendarGridProps, \"startDate\" | \"endDate\">, SlotProps {\n /** The children of the component (render function receiving weeks). */\n children?: (date: CalendarDate) => JSX.Element;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<CalendarGridRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<CalendarGridRenderProps>;\n /** Class name for weekday header cells. */\n headerCellClass?: string;\n /** Number of weeks to offset from the start. */\n offset?: { months?: number };\n}\n\nexport interface CalendarCellRenderProps {\n /** Whether the cell is selected. */\n isSelected: boolean;\n /** Whether the cell is focused. */\n isFocused: boolean;\n /** Whether the cell should display a keyboard focus ring. */\n isFocusVisible: 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 CalendarCellProps 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<CalendarCellRenderProps>;\n /** The CSS className for the element. */\n class?: ClassNameOrFunction<CalendarCellRenderProps>;\n /** The inline style for the element. */\n style?: StyleOrFunction<CalendarCellRenderProps>;\n /** Class name for the table cell wrapper. */\n cellClass?: ClassNameOrFunction<CalendarCellRenderProps>;\n /** Inline style for the table cell wrapper. */\n cellStyle?: StyleOrFunction<CalendarCellRenderProps>;\n}\n\nexport interface CalendarHeaderCellProps extends SlotProps {\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}\n\nexport interface CalendarGridHeaderProps extends SlotProps {\n children?: JSX.Element;\n class?: string;\n style?: JSX.CSSProperties;\n}\n\nexport interface CalendarGridBodyProps extends SlotProps {\n children?: JSX.Element;\n class?: string;\n style?: JSX.CSSProperties;\n}\n\nexport const CalendarContext = createContext<CalendarState<DateValue> | null>(null);\nconst CalendarGridMonthContext = createContext<Accessor<CalendarDate> | null>(null);\nconst CalendarGridCellPositionContext = createContext<Accessor<{\n weekIndex: number;\n dayIndex: number;\n lastWeekIndex: number;\n}> | null>(null);\n\nexport function useCalendarContext(): CalendarState<DateValue> {\n const context = useContext(CalendarContext);\n if (!context) {\n throw new Error(\"Calendar components must be used within a Calendar\");\n }\n return context;\n}\n\n/**\n * A calendar displays a grid of days in a month and allows users to select a single date.\n *\n * @example\n * ```tsx\n * <Calendar aria-label=\"Event date\">\n * <header>\n * <CalendarButton slot=\"previous\">◀</CalendarButton>\n * <CalendarHeading />\n * <CalendarButton slot=\"next\">▶</CalendarButton>\n * </header>\n * <CalendarGrid>\n * {(date) => <CalendarCell date={date} />}\n * </CalendarGrid>\n * </Calendar>\n * ```\n */\nexport function Calendar<\n T extends DateValue = CalendarDate,\n M extends CalendarSelectionMode = \"single\",\n>(props: CalendarProps<T, M>): JSX.Element {\n const inheritedState = useContext(CalendarContext);\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 class=\"solidaria-Calendar solidaria-Calendar--placeholder\" aria-hidden=\"true\" />\n }\n >\n <Show when={inheritedState} fallback={<CalendarInner {...props} />}>\n <CalendarWithState state={inheritedState as CalendarState<DateValue>} {...props} />\n </Show>\n </Show>\n );\n}\n\nfunction CalendarWithState<\n T extends DateValue = CalendarDate,\n M extends CalendarSelectionMode = \"single\",\n>(props: CalendarProps<T, M> & { state: CalendarState<DateValue> }): JSX.Element {\n const [local, stateProps, rest] = splitProps(\n props,\n [\"children\", \"class\", \"style\", \"slot\", \"state\", \"ref\"],\n [\n \"value\",\n \"defaultValue\",\n \"onChange\",\n \"selectionMode\",\n \"minValue\",\n \"maxValue\",\n \"isDisabled\",\n \"isReadOnly\",\n \"autoFocus\",\n \"focusedValue\",\n \"defaultFocusedValue\",\n \"onFocusChange\",\n \"locale\",\n \"createCalendar\",\n \"isDateUnavailable\",\n \"visibleMonths\",\n \"pageBehavior\",\n \"selectionAlignment\",\n \"isDateDisabled\",\n \"validationState\",\n \"errorMessage\",\n \"firstDayOfWeek\",\n ],\n );\n\n const state = () => props.state;\n const calendarAria = createCalendar(\n () => ({\n ...rest,\n errorMessage: stateProps.errorMessage,\n }),\n state(),\n );\n\n const renderValues = createMemo<CalendarRenderProps>(() => ({\n isDisabled: state().isDisabled(),\n isReadOnly: state().isReadOnly(),\n isInvalid: state().isValueInvalid(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Calendar\",\n },\n renderValues,\n );\n\n return (\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 >\n <VisuallyHidden>\n <h2>{String(calendarAria.calendarProps[\"aria-label\"] ?? \"\")}</h2>\n </VisuallyHidden>\n {props.children}\n </div>\n );\n}\n\n/**\n * Internal Calendar component that renders after client mount.\n */\nfunction CalendarInner<\n T extends DateValue = CalendarDate,\n M extends CalendarSelectionMode = \"single\",\n>(props: CalendarProps<T, M>): JSX.Element {\n const [local, stateProps, rest] = splitProps(\n props,\n [\"children\", \"class\", \"style\", \"slot\", \"ref\"],\n [\n \"value\",\n \"defaultValue\",\n \"onChange\",\n \"selectionMode\",\n \"minValue\",\n \"maxValue\",\n \"isDisabled\",\n \"isReadOnly\",\n \"autoFocus\",\n \"focusedValue\",\n \"defaultFocusedValue\",\n \"onFocusChange\",\n \"locale\",\n \"createCalendar\",\n \"isDateUnavailable\",\n \"visibleMonths\",\n \"pageBehavior\",\n \"selectionAlignment\",\n \"isDateDisabled\",\n \"validationState\",\n \"errorMessage\",\n \"firstDayOfWeek\",\n ],\n );\n\n // Create calendar state\n const state = createCalendarState<T, M>(stateProps);\n\n // Create calendar ARIA props\n const calendarAria = createCalendar(\n () => ({\n ...rest,\n errorMessage: stateProps.errorMessage,\n }),\n state as unknown as CalendarState<DateValue>,\n );\n\n const renderValues = createMemo<CalendarRenderProps>(() => ({\n isDisabled: state.isDisabled(),\n isReadOnly: state.isReadOnly(),\n isInvalid: state.isValueInvalid(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-Calendar\",\n },\n renderValues,\n );\n\n return (\n <CalendarContext.Provider value={state as unknown as CalendarState<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 >\n <VisuallyHidden>\n <h2>{String(calendarAria.calendarProps[\"aria-label\"] ?? \"\")}</h2>\n </VisuallyHidden>\n {props.children}\n </div>\n </CalendarContext.Provider>\n );\n}\n\nexport interface CalendarHeadingProps extends SlotProps {\n /** The children of the component. */\n children?: RenderChildren<{ title: string }>;\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 calendar.\n */\nexport function CalendarHeading(props: CalendarHeadingProps): JSX.Element {\n const state = useCalendarContext();\n const renderValues = createMemo(() => ({\n title: state.title(),\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-CalendarHeading\",\n },\n renderValues,\n );\n\n return (\n <h2 class={renderProps.class()} style={renderProps.style()} aria-live=\"polite\">\n {typeof props.children === \"function\" ? renderProps.renderChildren() : state.title()}\n </h2>\n );\n}\n\nexport interface CalendarButtonProps 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 calendar.\n */\nexport function CalendarButton(props: CalendarButtonProps): JSX.Element {\n const state = useCalendarContext();\n const calendarAria = createCalendar({}, state);\n\n const buttonProps = createMemo(() => {\n if (props.slot === \"previous\") {\n return calendarAria.prevButtonProps;\n }\n return calendarAria.nextButtonProps;\n });\n\n return (\n <button\n {...buttonProps()}\n class={props.class ?? \"solidaria-CalendarButton\"}\n style={props.style}\n disabled={props.isDisabled || state.isDisabled()}\n >\n {props.children}\n </button>\n );\n}\n\n/**\n * Displays a grid of calendar cells.\n */\nexport function CalendarGrid(props: CalendarGridProps): JSX.Element {\n const state = useCalendarContext();\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,\n gridRef,\n );\n\n const renderValues = createMemo<CalendarGridRenderProps>(() => ({\n isDisabled: state.isDisabled(),\n }));\n\n const renderProps = useRenderProps(\n {\n class: props.class,\n style: props.style,\n defaultClassName: \"solidaria-CalendarGrid\",\n },\n renderValues,\n );\n\n // Memoize ALL dates for the grid at once to avoid reactive loops.\n // This breaks the cycle where accessing visibleRange() inside For loop\n // would cause infinite re-renders.\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 <CalendarGridMonthContext.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 scope=\"col\" class={props.headerCellClass ?? \"solidaria-CalendarHeaderCell\"}>\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 <CalendarGridCellPositionContext.Provider\n value={() => ({\n weekIndex,\n dayIndex,\n lastWeekIndex: allDates().length - 1,\n })}\n >\n {props.children?.(date()!)}\n </CalendarGridCellPositionContext.Provider>\n </Show>\n )}\n </Index>\n </tr>\n )}\n </Index>\n </tbody>\n </table>\n </CalendarGridMonthContext.Provider>\n );\n}\n\nexport function CalendarGridHeader(props: CalendarGridHeaderProps): JSX.Element {\n return (\n <thead class={props.class ?? \"solidaria-CalendarGridHeader\"} style={props.style}>\n {props.children}\n </thead>\n );\n}\n\nexport function CalendarGridBody(props: CalendarGridBodyProps): JSX.Element {\n return (\n <tbody class={props.class ?? \"solidaria-CalendarGridBody\"} style={props.style}>\n {props.children}\n </tbody>\n );\n}\n\nexport function CalendarHeaderCell(props: CalendarHeaderCellProps): JSX.Element {\n return (\n <th scope=\"col\" class={props.class ?? \"solidaria-CalendarHeaderCell\"} style={props.style}>\n {props.children}\n </th>\n );\n}\n\n/**\n * A cell in the calendar grid representing a single day.\n */\nexport function CalendarCell(props: CalendarCellProps): JSX.Element {\n const state = useCalendarContext();\n const currentMonthStart = useContext(CalendarGridMonthContext);\n const cellPosition = useContext(CalendarGridCellPositionContext);\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 = createCalendarCell(\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<CalendarCellRenderProps>(() => ({\n isSelected: cellAria.isSelected,\n isFocused: cellAria.isFocused,\n isFocusVisible: cellAria.isFocusVisible,\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-CalendarCell\",\n },\n renderValues,\n );\n const cellRenderProps = useRenderProps(\n {\n class: props.cellClass,\n style: props.cellStyle,\n defaultClassName: \"solidaria-CalendarCellWrapper\",\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-focused={dataAttr(cellAria.isFocused)}\n data-focus-visible={dataAttr(cellAria.isFocusVisible)}\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 { CalendarState, CalendarDate, DateValue };\n"],"mappings":";;;;;;;;;;;;AAmDA,SAAS,UAAa,KAAiB,IAAa;CAClD,IAAI,CAAC,KACH;CAGF,IAAI,OAAO,QAAQ,YACjB,IAAI,EAAE;MAEN,IAAI,UAAU;AAElB;AAuHA,MAAa,kBAAkB,cAA+C,IAAI;AAClF,MAAM,2BAA2B,cAA6C,IAAI;AAClF,MAAM,kCAAkC,cAI7B,IAAI;AAEf,SAAgB,qBAA+C;CAC7D,MAAM,UAAU,WAAW,eAAe;CAC1C,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,oDAAoD;CAEtE,OAAO;AACT;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,SAGd,OAAyC;CACzC,MAAM,iBAAiB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a,YAC5B,OAAO,YAAY,eAAe;EAEpC,OAAO,SAAS;CAClB;CAEA,OACE,CAAC,OAAO,SAAS,WAAW,OAAO,gBAAgB,MAAM,GAAG,OAAO,gBAAgB,MAAM,GAAG;MAC1F,CAAC,IACC,KAAK,gBACD,SAAS,iBACT,YACJ,OAAO,YAAY,MAAM,GACzB,OAAO,YAAY,MAAM,GACzB,eAAe,SAAS,SAAS,UAAU,GAC3C,cAAc,SAAS,SAAS,SAAS,GACzC,oBAAoB,SAAS,SAAS,cAAc,GACpD,eAAe,SAAS,SAAS,UAAU,GAC3C,kBAAkB,SAAS,SAAS,aAAa,GACjD,cAAc,SAAS,SAAS,SAAS,GACzC,oBAAoB,SAAS,SAAS,cAAc,GACpD,YAAY,SAAS,SAAS,OAAO,GACrC,cAAc,SAAS,SAAS,SAAS,GACzC,cAAc,SAAS,UAAU,CAAC,GACnC;SACE,YAAY,EAAE;MACjB,EAAE,IAAI;IACR,EAAE;AAEN"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CalendarMonthPicker / CalendarYearPicker components for solidaria-components
|
|
3
|
+
*
|
|
4
|
+
* Headless month/year "jump-to" pickers shared by Calendar and RangeCalendar.
|
|
5
|
+
* Each reads whichever calendar state context is present and renders through a
|
|
6
|
+
* child function, mirroring the single context-agnostic components upstream.
|
|
7
|
+
* Port of react-aria-components/src/Calendar.tsx (CalendarMonthPicker /
|
|
8
|
+
* CalendarYearPicker).
|
|
9
|
+
*/
|
|
10
|
+
import { type JSX } from "solid-js";
|
|
11
|
+
import { type CalendarMonthPickerProps as AriaCalendarMonthPickerProps, type CalendarMonthPickerAria, type CalendarYearPickerProps as AriaCalendarYearPickerProps, type CalendarYearPickerAria } from "@proyecto-viviana/solidaria";
|
|
12
|
+
export type { CalendarMonthPickerAria, CalendarMonthPickerItem, CalendarYearPickerAria, CalendarYearPickerItem, CalendarYearPickerFormatOptions, } from "@proyecto-viviana/solidaria";
|
|
13
|
+
export interface CalendarMonthPickerProps extends AriaCalendarMonthPickerProps {
|
|
14
|
+
/** A function that renders the month picker from its accessible props. */
|
|
15
|
+
children: (renderProps: CalendarMonthPickerAria) => JSX.Element;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A CalendarMonthPicker renders the list of months in the focused year so the
|
|
19
|
+
* user can jump the calendar's focus to a different month. It works within both
|
|
20
|
+
* a Calendar and a RangeCalendar.
|
|
21
|
+
*/
|
|
22
|
+
export declare function CalendarMonthPicker(props: CalendarMonthPickerProps): JSX.Element;
|
|
23
|
+
export interface CalendarYearPickerProps extends AriaCalendarYearPickerProps {
|
|
24
|
+
/** A function that renders the year picker from its accessible props. */
|
|
25
|
+
children: (renderProps: CalendarYearPickerAria) => JSX.Element;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A CalendarYearPicker renders a sliding window of years so the user can jump
|
|
29
|
+
* the calendar's focus to a different year. It works within both a Calendar and
|
|
30
|
+
* a RangeCalendar.
|
|
31
|
+
*/
|
|
32
|
+
export declare function CalendarYearPicker(props: CalendarYearPickerProps): JSX.Element;
|
|
33
|
+
//# sourceMappingURL=CalendarPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalendarPicker.d.ts","sourceRoot":"","sources":["../src/CalendarPicker.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,GAAG,EAAc,MAAM,UAAU,CAAC;AAEhD,OAAO,EAGL,KAAK,wBAAwB,IAAI,4BAA4B,EAC7D,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,KAAK,sBAAsB,EAC5B,MAAM,6BAA6B,CAAC;AAKrC,YAAY,EACV,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,6BAA6B,CAAC;AAErC,MAAM,WAAW,wBAAyB,SAAQ,4BAA4B;IAC5E,0EAA0E;IAC1E,QAAQ,EAAE,CAAC,WAAW,EAAE,uBAAuB,KAAK,GAAG,CAAC,OAAO,CAAC;CACjE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,GAAG,CAAC,OAAO,CAShF;AAED,MAAM,WAAW,uBAAwB,SAAQ,2BAA2B;IAC1E,yEAAyE;IACzE,QAAQ,EAAE,CAAC,WAAW,EAAE,sBAAsB,KAAK,GAAG,CAAC,OAAO,CAAC;CAChE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CAS9E"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CalendarContext } from "./Calendar.js";
|
|
2
|
+
import { RangeCalendarContext } from "./RangeCalendar.js";
|
|
3
|
+
import { useContext } from "solid-js";
|
|
4
|
+
import { createCalendarMonthPicker, createCalendarYearPicker } from "@proyecto-viviana/solidaria";
|
|
5
|
+
//#region src/CalendarPicker.tsx
|
|
6
|
+
/**
|
|
7
|
+
* CalendarMonthPicker / CalendarYearPicker components for solidaria-components
|
|
8
|
+
*
|
|
9
|
+
* Headless month/year "jump-to" pickers shared by Calendar and RangeCalendar.
|
|
10
|
+
* Each reads whichever calendar state context is present and renders through a
|
|
11
|
+
* child function, mirroring the single context-agnostic components upstream.
|
|
12
|
+
* Port of react-aria-components/src/Calendar.tsx (CalendarMonthPicker /
|
|
13
|
+
* CalendarYearPicker).
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* A CalendarMonthPicker renders the list of months in the focused year so the
|
|
17
|
+
* user can jump the calendar's focus to a different month. It works within both
|
|
18
|
+
* a Calendar and a RangeCalendar.
|
|
19
|
+
*/
|
|
20
|
+
function CalendarMonthPicker(props) {
|
|
21
|
+
const calendarState = useContext(CalendarContext);
|
|
22
|
+
const rangeCalendarState = useContext(RangeCalendarContext);
|
|
23
|
+
const state = calendarState ?? rangeCalendarState;
|
|
24
|
+
if (!state) throw new Error("CalendarMonthPicker must be used within a Calendar or RangeCalendar");
|
|
25
|
+
const aria = createCalendarMonthPicker(props, state);
|
|
26
|
+
return props.children(aria);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A CalendarYearPicker renders a sliding window of years so the user can jump
|
|
30
|
+
* the calendar's focus to a different year. It works within both a Calendar and
|
|
31
|
+
* a RangeCalendar.
|
|
32
|
+
*/
|
|
33
|
+
function CalendarYearPicker(props) {
|
|
34
|
+
const calendarState = useContext(CalendarContext);
|
|
35
|
+
const rangeCalendarState = useContext(RangeCalendarContext);
|
|
36
|
+
const state = calendarState ?? rangeCalendarState;
|
|
37
|
+
if (!state) throw new Error("CalendarYearPicker must be used within a Calendar or RangeCalendar");
|
|
38
|
+
const aria = createCalendarYearPicker(props, state);
|
|
39
|
+
return props.children(aria);
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { CalendarMonthPicker, CalendarYearPicker };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=CalendarPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalendarPicker.js","names":["JSX","useContext","createCalendarMonthPicker","createCalendarYearPicker","CalendarMonthPickerProps","AriaCalendarMonthPickerProps","CalendarMonthPickerAria","CalendarYearPickerProps","AriaCalendarYearPickerProps","CalendarYearPickerAria","CalendarContext","RangeCalendarContext","CalendarMonthPickerItem","CalendarYearPickerItem","CalendarYearPickerFormatOptions","children","renderProps","Element","CalendarMonthPicker","props","calendarState","rangeCalendarState","state","Error","aria","CalendarYearPicker"],"sources":["../src/CalendarPicker.tsx"],"sourcesContent":["/**\n * CalendarMonthPicker / CalendarYearPicker components for solidaria-components\n *\n * Headless month/year \"jump-to\" pickers shared by Calendar and RangeCalendar.\n * Each reads whichever calendar state context is present and renders through a\n * child function, mirroring the single context-agnostic components upstream.\n * Port of react-aria-components/src/Calendar.tsx (CalendarMonthPicker /\n * CalendarYearPicker).\n */\n\nimport { type JSX, useContext } from \"solid-js\";\n\nimport {\n createCalendarMonthPicker,\n createCalendarYearPicker,\n type CalendarMonthPickerProps as AriaCalendarMonthPickerProps,\n type CalendarMonthPickerAria,\n type CalendarYearPickerProps as AriaCalendarYearPickerProps,\n type CalendarYearPickerAria,\n} from \"@proyecto-viviana/solidaria\";\n\nimport { CalendarContext } from \"./Calendar\";\nimport { RangeCalendarContext } from \"./RangeCalendar\";\n\nexport type {\n CalendarMonthPickerAria,\n CalendarMonthPickerItem,\n CalendarYearPickerAria,\n CalendarYearPickerItem,\n CalendarYearPickerFormatOptions,\n} from \"@proyecto-viviana/solidaria\";\n\nexport interface CalendarMonthPickerProps extends AriaCalendarMonthPickerProps {\n /** A function that renders the month picker from its accessible props. */\n children: (renderProps: CalendarMonthPickerAria) => JSX.Element;\n}\n\n/**\n * A CalendarMonthPicker renders the list of months in the focused year so the\n * user can jump the calendar's focus to a different month. It works within both\n * a Calendar and a RangeCalendar.\n */\nexport function CalendarMonthPicker(props: CalendarMonthPickerProps): JSX.Element {\n const calendarState = useContext(CalendarContext);\n const rangeCalendarState = useContext(RangeCalendarContext);\n const state = calendarState ?? rangeCalendarState;\n if (!state) {\n throw new Error(\"CalendarMonthPicker must be used within a Calendar or RangeCalendar\");\n }\n const aria = createCalendarMonthPicker(props, state);\n return props.children(aria);\n}\n\nexport interface CalendarYearPickerProps extends AriaCalendarYearPickerProps {\n /** A function that renders the year picker from its accessible props. */\n children: (renderProps: CalendarYearPickerAria) => JSX.Element;\n}\n\n/**\n * A CalendarYearPicker renders a sliding window of years so the user can jump\n * the calendar's focus to a different year. It works within both a Calendar and\n * a RangeCalendar.\n */\nexport function CalendarYearPicker(props: CalendarYearPickerProps): JSX.Element {\n const calendarState = useContext(CalendarContext);\n const rangeCalendarState = useContext(RangeCalendarContext);\n const state = calendarState ?? rangeCalendarState;\n if (!state) {\n throw new Error(\"CalendarYearPicker must be used within a Calendar or RangeCalendar\");\n }\n const aria = createCalendarYearPicker(props, state);\n return props.children(aria);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0CA,SAAgBkB,oBAAoBC,OAA8C;CAChF,MAAMC,gBAAgBnB,WAAWS,eAAe;CAChD,MAAMW,qBAAqBpB,WAAWU,oBAAoB;CAC1D,MAAMW,QAAQF,iBAAiBC;CAC/B,IAAI,CAACC,OACH,MAAM,IAAIC,MAAM,qEAAqE;CAEvF,MAAMC,OAAOtB,0BAA0BiB,OAAOG,KAAK;CACnD,OAAOH,MAAMJ,SAASS,IAAI;AAC5B;;;;;;AAYA,SAAgBC,mBAAmBN,OAA6C;CAC9E,MAAMC,gBAAgBnB,WAAWS,eAAe;CAChD,MAAMW,qBAAqBpB,WAAWU,oBAAoB;CAC1D,MAAMW,QAAQF,iBAAiBC;CAC/B,IAAI,CAACC,OACH,MAAM,IAAIC,MAAM,oEAAoE;CAEtF,MAAMC,OAAOrB,yBAAyBgB,OAAOG,KAAK;CAClD,OAAOH,MAAMJ,SAASS,IAAI;AAC5B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CalendarContext } from "./Calendar.jsx";
|
|
2
|
+
import { RangeCalendarContext } from "./RangeCalendar.jsx";
|
|
3
|
+
import { useContext } from "solid-js";
|
|
4
|
+
import { createCalendarMonthPicker, createCalendarYearPicker } from "@proyecto-viviana/solidaria";
|
|
5
|
+
//#region src/CalendarPicker.tsx
|
|
6
|
+
/**
|
|
7
|
+
* CalendarMonthPicker / CalendarYearPicker components for solidaria-components
|
|
8
|
+
*
|
|
9
|
+
* Headless month/year "jump-to" pickers shared by Calendar and RangeCalendar.
|
|
10
|
+
* Each reads whichever calendar state context is present and renders through a
|
|
11
|
+
* child function, mirroring the single context-agnostic components upstream.
|
|
12
|
+
* Port of react-aria-components/src/Calendar.tsx (CalendarMonthPicker /
|
|
13
|
+
* CalendarYearPicker).
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* A CalendarMonthPicker renders the list of months in the focused year so the
|
|
17
|
+
* user can jump the calendar's focus to a different month. It works within both
|
|
18
|
+
* a Calendar and a RangeCalendar.
|
|
19
|
+
*/
|
|
20
|
+
function CalendarMonthPicker(props) {
|
|
21
|
+
const calendarState = useContext(CalendarContext);
|
|
22
|
+
const rangeCalendarState = useContext(RangeCalendarContext);
|
|
23
|
+
const state = calendarState ?? rangeCalendarState;
|
|
24
|
+
if (!state) throw new Error("CalendarMonthPicker must be used within a Calendar or RangeCalendar");
|
|
25
|
+
const aria = createCalendarMonthPicker(props, state);
|
|
26
|
+
return props.children(aria);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A CalendarYearPicker renders a sliding window of years so the user can jump
|
|
30
|
+
* the calendar's focus to a different year. It works within both a Calendar and
|
|
31
|
+
* a RangeCalendar.
|
|
32
|
+
*/
|
|
33
|
+
function CalendarYearPicker(props) {
|
|
34
|
+
const calendarState = useContext(CalendarContext);
|
|
35
|
+
const rangeCalendarState = useContext(RangeCalendarContext);
|
|
36
|
+
const state = calendarState ?? rangeCalendarState;
|
|
37
|
+
if (!state) throw new Error("CalendarYearPicker must be used within a Calendar or RangeCalendar");
|
|
38
|
+
const aria = createCalendarYearPicker(props, state);
|
|
39
|
+
return props.children(aria);
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { CalendarMonthPicker, CalendarYearPicker };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=CalendarPicker.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalendarPicker.jsx","names":[],"sources":["../src/CalendarPicker.tsx"],"sourcesContent":["/**\n * CalendarMonthPicker / CalendarYearPicker components for solidaria-components\n *\n * Headless month/year \"jump-to\" pickers shared by Calendar and RangeCalendar.\n * Each reads whichever calendar state context is present and renders through a\n * child function, mirroring the single context-agnostic components upstream.\n * Port of react-aria-components/src/Calendar.tsx (CalendarMonthPicker /\n * CalendarYearPicker).\n */\n\nimport { type JSX, useContext } from \"solid-js\";\n\nimport {\n createCalendarMonthPicker,\n createCalendarYearPicker,\n type CalendarMonthPickerProps as AriaCalendarMonthPickerProps,\n type CalendarMonthPickerAria,\n type CalendarYearPickerProps as AriaCalendarYearPickerProps,\n type CalendarYearPickerAria,\n} from \"@proyecto-viviana/solidaria\";\n\nimport { CalendarContext } from \"./Calendar\";\nimport { RangeCalendarContext } from \"./RangeCalendar\";\n\nexport type {\n CalendarMonthPickerAria,\n CalendarMonthPickerItem,\n CalendarYearPickerAria,\n CalendarYearPickerItem,\n CalendarYearPickerFormatOptions,\n} from \"@proyecto-viviana/solidaria\";\n\nexport interface CalendarMonthPickerProps extends AriaCalendarMonthPickerProps {\n /** A function that renders the month picker from its accessible props. */\n children: (renderProps: CalendarMonthPickerAria) => JSX.Element;\n}\n\n/**\n * A CalendarMonthPicker renders the list of months in the focused year so the\n * user can jump the calendar's focus to a different month. It works within both\n * a Calendar and a RangeCalendar.\n */\nexport function CalendarMonthPicker(props: CalendarMonthPickerProps): JSX.Element {\n const calendarState = useContext(CalendarContext);\n const rangeCalendarState = useContext(RangeCalendarContext);\n const state = calendarState ?? rangeCalendarState;\n if (!state) {\n throw new Error(\"CalendarMonthPicker must be used within a Calendar or RangeCalendar\");\n }\n const aria = createCalendarMonthPicker(props, state);\n return props.children(aria);\n}\n\nexport interface CalendarYearPickerProps extends AriaCalendarYearPickerProps {\n /** A function that renders the year picker from its accessible props. */\n children: (renderProps: CalendarYearPickerAria) => JSX.Element;\n}\n\n/**\n * A CalendarYearPicker renders a sliding window of years so the user can jump\n * the calendar's focus to a different year. It works within both a Calendar and\n * a RangeCalendar.\n */\nexport function CalendarYearPicker(props: CalendarYearPickerProps): JSX.Element {\n const calendarState = useContext(CalendarContext);\n const rangeCalendarState = useContext(RangeCalendarContext);\n const state = calendarState ?? rangeCalendarState;\n if (!state) {\n throw new Error(\"CalendarYearPicker must be used within a Calendar or RangeCalendar\");\n }\n const aria = createCalendarYearPicker(props, state);\n return props.children(aria);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,oBAAoB,OAA8C;CAChF,MAAM,gBAAgB,WAAW,eAAe;CAChD,MAAM,qBAAqB,WAAW,oBAAoB;CAC1D,MAAM,QAAQ,iBAAiB;CAC/B,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,qEAAqE;CAEvF,MAAM,OAAO,0BAA0B,OAAO,KAAK;CACnD,OAAO,MAAM,SAAS,IAAI;AAC5B;;;;;;AAYA,SAAgB,mBAAmB,OAA6C;CAC9E,MAAM,gBAAgB,WAAW,eAAe;CAChD,MAAM,qBAAqB,WAAW,oBAAoB;CAC1D,MAAM,QAAQ,iBAAiB;CAC/B,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,oEAAoE;CAEtF,MAAM,OAAO,yBAAyB,OAAO,KAAK;CAClD,OAAO,MAAM,SAAS,IAAI;AAC5B"}
|