react-aria-components 3.0.0-nightly-ab9fd5c68-241125 → 3.0.0-nightly-10a43de88-241127
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/Breadcrumbs.main.js +2 -5
- package/dist/Breadcrumbs.main.js.map +1 -1
- package/dist/Breadcrumbs.mjs +3 -6
- package/dist/Breadcrumbs.module.js +3 -6
- package/dist/Breadcrumbs.module.js.map +1 -1
- package/dist/Button.main.js +2 -5
- package/dist/Button.main.js.map +1 -1
- package/dist/Button.mjs +2 -5
- package/dist/Button.module.js +2 -5
- package/dist/Button.module.js.map +1 -1
- package/dist/Calendar.main.js +9 -22
- package/dist/Calendar.main.js.map +1 -1
- package/dist/Calendar.mjs +9 -22
- package/dist/Calendar.module.js +9 -22
- package/dist/Calendar.module.js.map +1 -1
- package/dist/Checkbox.main.js +5 -12
- package/dist/Checkbox.main.js.map +1 -1
- package/dist/Checkbox.mjs +6 -13
- package/dist/Checkbox.module.js +6 -13
- package/dist/Checkbox.module.js.map +1 -1
- package/dist/ColorArea.main.js +2 -5
- package/dist/ColorArea.main.js.map +1 -1
- package/dist/ColorArea.mjs +3 -6
- package/dist/ColorArea.module.js +3 -6
- package/dist/ColorArea.module.js.map +1 -1
- package/dist/ColorField.main.js +2 -5
- package/dist/ColorField.main.js.map +1 -1
- package/dist/ColorField.mjs +2 -5
- package/dist/ColorField.module.js +2 -5
- package/dist/ColorField.module.js.map +1 -1
- package/dist/ColorSlider.main.js +2 -5
- package/dist/ColorSlider.main.js.map +1 -1
- package/dist/ColorSlider.mjs +2 -5
- package/dist/ColorSlider.module.js +2 -5
- package/dist/ColorSlider.module.js.map +1 -1
- package/dist/ColorSwatch.main.js +2 -5
- package/dist/ColorSwatch.main.js.map +1 -1
- package/dist/ColorSwatch.mjs +2 -5
- package/dist/ColorSwatch.module.js +2 -5
- package/dist/ColorSwatch.module.js.map +1 -1
- package/dist/ColorSwatchPicker.main.js +4 -8
- package/dist/ColorSwatchPicker.main.js.map +1 -1
- package/dist/ColorSwatchPicker.mjs +5 -9
- package/dist/ColorSwatchPicker.module.js +5 -9
- package/dist/ColorSwatchPicker.module.js.map +1 -1
- package/dist/ColorThumb.main.js +2 -5
- package/dist/ColorThumb.main.js.map +1 -1
- package/dist/ColorThumb.mjs +3 -6
- package/dist/ColorThumb.module.js +3 -6
- package/dist/ColorThumb.module.js.map +1 -1
- package/dist/ColorWheel.main.js +5 -11
- package/dist/ColorWheel.main.js.map +1 -1
- package/dist/ColorWheel.mjs +6 -12
- package/dist/ColorWheel.module.js +6 -12
- package/dist/ColorWheel.module.js.map +1 -1
- package/dist/ComboBox.main.js +2 -5
- package/dist/ComboBox.main.js.map +1 -1
- package/dist/ComboBox.mjs +3 -6
- package/dist/ComboBox.module.js +3 -6
- package/dist/ComboBox.module.js.map +1 -1
- package/dist/DateField.main.js +8 -23
- package/dist/DateField.main.js.map +1 -1
- package/dist/DateField.mjs +9 -24
- package/dist/DateField.module.js +9 -24
- package/dist/DateField.module.js.map +1 -1
- package/dist/DatePicker.main.js +4 -11
- package/dist/DatePicker.main.js.map +1 -1
- package/dist/DatePicker.mjs +5 -12
- package/dist/DatePicker.module.js +5 -12
- package/dist/DatePicker.module.js.map +1 -1
- package/dist/Dialog.main.js +2 -5
- package/dist/Dialog.main.js.map +1 -1
- package/dist/Dialog.mjs +3 -6
- package/dist/Dialog.module.js +3 -6
- package/dist/Dialog.module.js.map +1 -1
- package/dist/Disclosure.main.js +6 -16
- package/dist/Disclosure.main.js.map +1 -1
- package/dist/Disclosure.mjs +6 -16
- package/dist/Disclosure.module.js +6 -16
- package/dist/Disclosure.module.js.map +1 -1
- package/dist/DragAndDrop.main.js +2 -5
- package/dist/DragAndDrop.main.js.map +1 -1
- package/dist/DragAndDrop.mjs +3 -6
- package/dist/DragAndDrop.module.js +3 -6
- package/dist/DragAndDrop.module.js.map +1 -1
- package/dist/DropZone.main.js +2 -5
- package/dist/DropZone.main.js.map +1 -1
- package/dist/DropZone.mjs +3 -6
- package/dist/DropZone.module.js +3 -6
- package/dist/DropZone.module.js.map +1 -1
- package/dist/FieldError.main.js +2 -5
- package/dist/FieldError.main.js.map +1 -1
- package/dist/FieldError.mjs +3 -6
- package/dist/FieldError.module.js +3 -6
- package/dist/FieldError.module.js.map +1 -1
- package/dist/FileTrigger.main.js +2 -5
- package/dist/FileTrigger.main.js.map +1 -1
- package/dist/FileTrigger.mjs +2 -5
- package/dist/FileTrigger.module.js +2 -5
- package/dist/FileTrigger.module.js.map +1 -1
- package/dist/Form.main.js +2 -6
- package/dist/Form.main.js.map +1 -1
- package/dist/Form.mjs +2 -6
- package/dist/Form.module.js +2 -6
- package/dist/Form.module.js.map +1 -1
- package/dist/GridList.main.js +2 -6
- package/dist/GridList.main.js.map +1 -1
- package/dist/GridList.mjs +3 -7
- package/dist/GridList.module.js +3 -7
- package/dist/GridList.module.js.map +1 -1
- package/dist/Group.main.js +2 -5
- package/dist/Group.main.js.map +1 -1
- package/dist/Group.mjs +2 -5
- package/dist/Group.module.js +2 -5
- package/dist/Group.module.js.map +1 -1
- package/dist/Heading.main.js +2 -3
- package/dist/Heading.main.js.map +1 -1
- package/dist/Heading.mjs +2 -3
- package/dist/Heading.module.js +2 -3
- package/dist/Heading.module.js.map +1 -1
- package/dist/Input.main.js +2 -5
- package/dist/Input.main.js.map +1 -1
- package/dist/Input.mjs +2 -5
- package/dist/Input.module.js +2 -5
- package/dist/Input.module.js.map +1 -1
- package/dist/Keyboard.main.js +2 -3
- package/dist/Keyboard.main.js.map +1 -1
- package/dist/Keyboard.mjs +2 -3
- package/dist/Keyboard.module.js +2 -3
- package/dist/Keyboard.module.js.map +1 -1
- package/dist/Label.main.js +2 -3
- package/dist/Label.main.js.map +1 -1
- package/dist/Label.mjs +2 -3
- package/dist/Label.module.js +2 -3
- package/dist/Label.module.js.map +1 -1
- package/dist/Link.main.js +2 -6
- package/dist/Link.main.js.map +1 -1
- package/dist/Link.mjs +2 -6
- package/dist/Link.module.js +2 -6
- package/dist/Link.module.js.map +1 -1
- package/dist/ListBox.main.js +5 -10
- package/dist/ListBox.main.js.map +1 -1
- package/dist/ListBox.mjs +6 -11
- package/dist/ListBox.module.js +6 -11
- package/dist/ListBox.module.js.map +1 -1
- package/dist/Menu.main.js +5 -10
- package/dist/Menu.main.js.map +1 -1
- package/dist/Menu.mjs +5 -10
- package/dist/Menu.module.js +5 -10
- package/dist/Menu.module.js.map +1 -1
- package/dist/Meter.main.js +2 -5
- package/dist/Meter.main.js.map +1 -1
- package/dist/Meter.mjs +2 -5
- package/dist/Meter.module.js +2 -5
- package/dist/Meter.module.js.map +1 -1
- package/dist/Modal.main.js +3 -6
- package/dist/Modal.main.js.map +1 -1
- package/dist/Modal.mjs +4 -7
- package/dist/Modal.module.js +4 -7
- package/dist/Modal.module.js.map +1 -1
- package/dist/NumberField.main.js +2 -5
- package/dist/NumberField.main.js.map +1 -1
- package/dist/NumberField.mjs +3 -6
- package/dist/NumberField.module.js +3 -6
- package/dist/NumberField.module.js.map +1 -1
- package/dist/OverlayArrow.main.js +2 -6
- package/dist/OverlayArrow.main.js.map +1 -1
- package/dist/OverlayArrow.mjs +2 -6
- package/dist/OverlayArrow.module.js +2 -6
- package/dist/OverlayArrow.module.js.map +1 -1
- package/dist/Popover.main.js +2 -5
- package/dist/Popover.main.js.map +1 -1
- package/dist/Popover.mjs +3 -6
- package/dist/Popover.module.js +3 -6
- package/dist/Popover.module.js.map +1 -1
- package/dist/ProgressBar.main.js +2 -6
- package/dist/ProgressBar.main.js.map +1 -1
- package/dist/ProgressBar.mjs +2 -6
- package/dist/ProgressBar.module.js +2 -6
- package/dist/ProgressBar.module.js.map +1 -1
- package/dist/RadioGroup.main.js +4 -10
- package/dist/RadioGroup.main.js.map +1 -1
- package/dist/RadioGroup.mjs +4 -10
- package/dist/RadioGroup.module.js +4 -10
- package/dist/RadioGroup.module.js.map +1 -1
- package/dist/SearchField.main.js +2 -5
- package/dist/SearchField.main.js.map +1 -1
- package/dist/SearchField.mjs +3 -6
- package/dist/SearchField.module.js +3 -6
- package/dist/SearchField.module.js.map +1 -1
- package/dist/Select.main.js +5 -12
- package/dist/Select.main.js.map +1 -1
- package/dist/Select.mjs +6 -13
- package/dist/Select.module.js +6 -13
- package/dist/Select.module.js.map +1 -1
- package/dist/Slider.main.js +8 -20
- package/dist/Slider.main.js.map +1 -1
- package/dist/Slider.mjs +9 -21
- package/dist/Slider.module.js +9 -21
- package/dist/Slider.module.js.map +1 -1
- package/dist/Switch.main.js +2 -5
- package/dist/Switch.main.js.map +1 -1
- package/dist/Switch.mjs +2 -5
- package/dist/Switch.module.js +2 -5
- package/dist/Switch.module.js.map +1 -1
- package/dist/Table.main.js +6 -12
- package/dist/Table.main.js.map +1 -1
- package/dist/Table.mjs +7 -13
- package/dist/Table.module.js +7 -13
- package/dist/Table.module.js.map +1 -1
- package/dist/Tabs.main.js +6 -16
- package/dist/Tabs.main.js.map +1 -1
- package/dist/Tabs.mjs +7 -17
- package/dist/Tabs.module.js +7 -17
- package/dist/Tabs.module.js.map +1 -1
- package/dist/TagGroup.main.js +4 -10
- package/dist/TagGroup.main.js.map +1 -1
- package/dist/TagGroup.mjs +5 -11
- package/dist/TagGroup.module.js +5 -11
- package/dist/TagGroup.module.js.map +1 -1
- package/dist/Text.main.js +2 -3
- package/dist/Text.main.js.map +1 -1
- package/dist/Text.mjs +2 -3
- package/dist/Text.module.js +2 -3
- package/dist/Text.module.js.map +1 -1
- package/dist/TextArea.main.js +2 -5
- package/dist/TextArea.main.js.map +1 -1
- package/dist/TextArea.mjs +2 -5
- package/dist/TextArea.module.js +2 -5
- package/dist/TextArea.module.js.map +1 -1
- package/dist/TextField.main.js +2 -5
- package/dist/TextField.main.js.map +1 -1
- package/dist/TextField.mjs +3 -6
- package/dist/TextField.module.js +3 -6
- package/dist/TextField.module.js.map +1 -1
- package/dist/ToggleButton.main.js +2 -5
- package/dist/ToggleButton.main.js.map +1 -1
- package/dist/ToggleButton.mjs +3 -6
- package/dist/ToggleButton.module.js +3 -6
- package/dist/ToggleButton.module.js.map +1 -1
- package/dist/ToggleButtonGroup.main.js +2 -5
- package/dist/ToggleButtonGroup.main.js.map +1 -1
- package/dist/ToggleButtonGroup.mjs +2 -5
- package/dist/ToggleButtonGroup.module.js +2 -5
- package/dist/ToggleButtonGroup.module.js.map +1 -1
- package/dist/Toolbar.main.js +2 -6
- package/dist/Toolbar.main.js.map +1 -1
- package/dist/Toolbar.mjs +2 -6
- package/dist/Toolbar.module.js +2 -6
- package/dist/Toolbar.module.js.map +1 -1
- package/dist/Tooltip.main.js +2 -5
- package/dist/Tooltip.main.js.map +1 -1
- package/dist/Tooltip.mjs +3 -6
- package/dist/Tooltip.module.js +3 -6
- package/dist/Tooltip.module.js.map +1 -1
- package/dist/Tree.main.js +2 -6
- package/dist/Tree.main.js.map +1 -1
- package/dist/Tree.mjs +3 -7
- package/dist/Tree.module.js +3 -7
- package/dist/Tree.module.js.map +1 -1
- package/dist/types.d.ts +10 -10
- package/dist/types.d.ts.map +1 -1
- package/package.json +30 -30
- package/src/Breadcrumbs.tsx +5 -8
- package/src/Button.tsx +5 -8
- package/src/Calendar.tsx +19 -31
- package/src/Checkbox.tsx +11 -17
- package/src/ColorArea.tsx +5 -8
- package/src/ColorField.tsx +5 -8
- package/src/ColorSlider.tsx +5 -8
- package/src/ColorSwatch.tsx +5 -8
- package/src/ColorSwatchPicker.tsx +7 -13
- package/src/ColorThumb.tsx +5 -8
- package/src/ColorWheel.tsx +10 -16
- package/src/ComboBox.tsx +5 -8
- package/src/DateField.tsx +21 -33
- package/src/DatePicker.tsx +9 -15
- package/src/Dialog.tsx +5 -8
- package/src/Disclosure.tsx +16 -25
- package/src/DragAndDrop.tsx +5 -8
- package/src/DropZone.tsx +5 -8
- package/src/FieldError.tsx +5 -8
- package/src/FileTrigger.tsx +5 -8
- package/src/Form.tsx +6 -9
- package/src/GridList.tsx +6 -9
- package/src/Group.tsx +5 -8
- package/src/Heading.tsx +2 -5
- package/src/Input.tsx +5 -8
- package/src/Keyboard.tsx +2 -5
- package/src/Label.tsx +2 -5
- package/src/Link.tsx +6 -9
- package/src/ListBox.tsx +8 -12
- package/src/Menu.tsx +8 -12
- package/src/Meter.tsx +5 -8
- package/src/Modal.tsx +5 -8
- package/src/NumberField.tsx +5 -8
- package/src/OverlayArrow.tsx +6 -9
- package/src/Popover.tsx +5 -8
- package/src/ProgressBar.tsx +6 -9
- package/src/RadioGroup.tsx +10 -16
- package/src/SearchField.tsx +5 -8
- package/src/Select.tsx +11 -17
- package/src/Slider.tsx +20 -32
- package/src/Switch.tsx +5 -8
- package/src/Table.tsx +10 -19
- package/src/Tabs.tsx +14 -23
- package/src/TagGroup.tsx +8 -14
- package/src/Text.tsx +2 -5
- package/src/TextArea.tsx +5 -7
- package/src/TextField.tsx +5 -8
- package/src/ToggleButton.tsx +5 -8
- package/src/ToggleButtonGroup.tsx +5 -8
- package/src/Toolbar.tsx +6 -9
- package/src/Tooltip.tsx +5 -8
- package/src/Tree.tsx +6 -9
package/dist/Calendar.mjs
CHANGED
|
@@ -31,7 +31,7 @@ const $dfd62f934fc76fed$export$3b805cea1f178355 = /*#__PURE__*/ (0, $dCiKx$creat
|
|
|
31
31
|
const $dfd62f934fc76fed$export$233dd9682e1ad64b = /*#__PURE__*/ (0, $dCiKx$createContext)({});
|
|
32
32
|
const $dfd62f934fc76fed$export$9e31dcedda1dadc7 = /*#__PURE__*/ (0, $dCiKx$createContext)(null);
|
|
33
33
|
const $dfd62f934fc76fed$export$5e0fc348c00f87a0 = /*#__PURE__*/ (0, $dCiKx$createContext)(null);
|
|
34
|
-
|
|
34
|
+
const $dfd62f934fc76fed$export$e1aef45b828286de = /*#__PURE__*/ (0, $dCiKx$forwardRef)(function Calendar(props, ref) {
|
|
35
35
|
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $dfd62f934fc76fed$export$3b805cea1f178355);
|
|
36
36
|
let { locale: locale } = (0, $dCiKx$useLocale)();
|
|
37
37
|
let state = (0, $dCiKx$useCalendarState)({
|
|
@@ -94,11 +94,8 @@ function $dfd62f934fc76fed$var$Calendar(props, ref) {
|
|
|
94
94
|
onClick: ()=>state.focusNextPage(),
|
|
95
95
|
tabIndex: -1
|
|
96
96
|
}))));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
* A calendar displays one or more date grids and allows users to select a single date.
|
|
100
|
-
*/ const $dfd62f934fc76fed$export$e1aef45b828286de = /*#__PURE__*/ (0, $dCiKx$forwardRef)($dfd62f934fc76fed$var$Calendar);
|
|
101
|
-
function $dfd62f934fc76fed$var$RangeCalendar(props, ref) {
|
|
97
|
+
});
|
|
98
|
+
const $dfd62f934fc76fed$export$a4f5c8b89d277a8d = /*#__PURE__*/ (0, $dCiKx$forwardRef)(function RangeCalendar(props, ref) {
|
|
102
99
|
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $dfd62f934fc76fed$export$233dd9682e1ad64b);
|
|
103
100
|
let { locale: locale } = (0, $dCiKx$useLocale)();
|
|
104
101
|
let state = (0, $dCiKx$useRangeCalendarState)({
|
|
@@ -161,12 +158,9 @@ function $dfd62f934fc76fed$var$RangeCalendar(props, ref) {
|
|
|
161
158
|
onClick: ()=>state.focusNextPage(),
|
|
162
159
|
tabIndex: -1
|
|
163
160
|
}))));
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* A range calendar displays one or more date grids and allows users to select a contiguous range of dates.
|
|
167
|
-
*/ const $dfd62f934fc76fed$export$a4f5c8b89d277a8d = /*#__PURE__*/ (0, $dCiKx$forwardRef)($dfd62f934fc76fed$var$RangeCalendar);
|
|
161
|
+
});
|
|
168
162
|
const $dfd62f934fc76fed$var$InternalCalendarGridContext = /*#__PURE__*/ (0, $dCiKx$createContext)(null);
|
|
169
|
-
|
|
163
|
+
const $dfd62f934fc76fed$export$5bd780d491cfc46c = /*#__PURE__*/ (0, $dCiKx$forwardRef)(function CalendarGrid(props, ref) {
|
|
170
164
|
let calendarState = (0, $dCiKx$useContext)($dfd62f934fc76fed$export$9e31dcedda1dadc7);
|
|
171
165
|
let rangeCalendarState = (0, $dCiKx$useContext)($dfd62f934fc76fed$export$5e0fc348c00f87a0);
|
|
172
166
|
let state = calendarState !== null && calendarState !== void 0 ? calendarState : rangeCalendarState;
|
|
@@ -191,11 +185,7 @@ function $dfd62f934fc76fed$var$CalendarGrid(props, ref) {
|
|
|
191
185
|
style: props.style,
|
|
192
186
|
className: (_props_className = props.className) !== null && _props_className !== void 0 ? _props_className : 'react-aria-CalendarGrid'
|
|
193
187
|
}, typeof props.children !== 'function' ? props.children : /*#__PURE__*/ (0, $dCiKx$react).createElement((0, $dCiKx$react).Fragment, null, /*#__PURE__*/ (0, $dCiKx$react).createElement($dfd62f934fc76fed$export$22e2d15eaa4d2377, null, (day)=>/*#__PURE__*/ (0, $dCiKx$react).createElement($dfd62f934fc76fed$export$ad2135cac3a11b3d, null, day)), /*#__PURE__*/ (0, $dCiKx$react).createElement($dfd62f934fc76fed$export$e11f8ba65d857bff, null, props.children))));
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* A calendar grid displays a single grid of days within a calendar or range calendar which
|
|
197
|
-
* can be keyboard navigated and selected by the user.
|
|
198
|
-
*/ const $dfd62f934fc76fed$export$5bd780d491cfc46c = /*#__PURE__*/ (0, $dCiKx$forwardRef)($dfd62f934fc76fed$var$CalendarGrid);
|
|
188
|
+
});
|
|
199
189
|
function $dfd62f934fc76fed$var$CalendarGridHeader(props, ref) {
|
|
200
190
|
let { children: children, style: style, className: className } = props;
|
|
201
191
|
let { headerProps: headerProps, weekDays: weekDays } = (0, $dCiKx$useContext)($dfd62f934fc76fed$var$InternalCalendarGridContext);
|
|
@@ -250,7 +240,7 @@ function $dfd62f934fc76fed$var$CalendarGridBody(props, ref) {
|
|
|
250
240
|
/**
|
|
251
241
|
* A calendar grid body displays a grid of calendar cells within a month.
|
|
252
242
|
*/ const $dfd62f934fc76fed$export$e11f8ba65d857bff = /*#__PURE__*/ (0, $dCiKx$forwardRef)($dfd62f934fc76fed$var$CalendarGridBody);
|
|
253
|
-
|
|
243
|
+
const $dfd62f934fc76fed$export$5d847498420df57b = /*#__PURE__*/ (0, $dCiKx$forwardRef)(function CalendarCell({ date: date, ...otherProps }, ref) {
|
|
254
244
|
let calendarState = (0, $dCiKx$useContext)($dfd62f934fc76fed$export$9e31dcedda1dadc7);
|
|
255
245
|
let rangeCalendarState = (0, $dCiKx$useContext)($dfd62f934fc76fed$export$5e0fc348c00f87a0);
|
|
256
246
|
let state = calendarState !== null && calendarState !== void 0 ? calendarState : rangeCalendarState;
|
|
@@ -310,11 +300,8 @@ function $dfd62f934fc76fed$var$CalendarCell({ date: date, ...otherProps }, ref)
|
|
|
310
300
|
...(0, $dCiKx$mergeProps)((0, $dCiKx$filterDOMProps)(otherProps), buttonProps, focusProps, hoverProps, dataAttrs, renderProps),
|
|
311
301
|
ref: buttonRef
|
|
312
302
|
}));
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* A calendar cell displays a date cell within a calendar grid which can be selected by the user.
|
|
316
|
-
*/ const $dfd62f934fc76fed$export$5d847498420df57b = /*#__PURE__*/ (0, $dCiKx$forwardRef)($dfd62f934fc76fed$var$CalendarCell);
|
|
303
|
+
});
|
|
317
304
|
|
|
318
305
|
|
|
319
|
-
export {$dfd62f934fc76fed$export$3b805cea1f178355 as CalendarContext, $dfd62f934fc76fed$export$233dd9682e1ad64b as RangeCalendarContext, $dfd62f934fc76fed$export$9e31dcedda1dadc7 as CalendarStateContext, $dfd62f934fc76fed$export$5e0fc348c00f87a0 as RangeCalendarStateContext, $dfd62f934fc76fed$export$e1aef45b828286de as Calendar, $dfd62f934fc76fed$export$a4f5c8b89d277a8d as RangeCalendar, $dfd62f934fc76fed$export$
|
|
306
|
+
export {$dfd62f934fc76fed$export$3b805cea1f178355 as CalendarContext, $dfd62f934fc76fed$export$233dd9682e1ad64b as RangeCalendarContext, $dfd62f934fc76fed$export$9e31dcedda1dadc7 as CalendarStateContext, $dfd62f934fc76fed$export$5e0fc348c00f87a0 as RangeCalendarStateContext, $dfd62f934fc76fed$export$e1aef45b828286de as Calendar, $dfd62f934fc76fed$export$a4f5c8b89d277a8d as RangeCalendar, $dfd62f934fc76fed$export$5bd780d491cfc46c as CalendarGrid, $dfd62f934fc76fed$export$22e2d15eaa4d2377 as CalendarGridHeader, $dfd62f934fc76fed$export$ad2135cac3a11b3d as CalendarHeaderCell, $dfd62f934fc76fed$export$e11f8ba65d857bff as CalendarGridBody, $dfd62f934fc76fed$export$5d847498420df57b as CalendarCell};
|
|
320
307
|
//# sourceMappingURL=Calendar.module.js.map
|
package/dist/Calendar.module.js
CHANGED
|
@@ -31,7 +31,7 @@ const $dfd62f934fc76fed$export$3b805cea1f178355 = /*#__PURE__*/ (0, $dCiKx$creat
|
|
|
31
31
|
const $dfd62f934fc76fed$export$233dd9682e1ad64b = /*#__PURE__*/ (0, $dCiKx$createContext)({});
|
|
32
32
|
const $dfd62f934fc76fed$export$9e31dcedda1dadc7 = /*#__PURE__*/ (0, $dCiKx$createContext)(null);
|
|
33
33
|
const $dfd62f934fc76fed$export$5e0fc348c00f87a0 = /*#__PURE__*/ (0, $dCiKx$createContext)(null);
|
|
34
|
-
|
|
34
|
+
const $dfd62f934fc76fed$export$e1aef45b828286de = /*#__PURE__*/ (0, $dCiKx$forwardRef)(function Calendar(props, ref) {
|
|
35
35
|
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $dfd62f934fc76fed$export$3b805cea1f178355);
|
|
36
36
|
let { locale: locale } = (0, $dCiKx$useLocale)();
|
|
37
37
|
let state = (0, $dCiKx$useCalendarState)({
|
|
@@ -94,11 +94,8 @@ function $dfd62f934fc76fed$var$Calendar(props, ref) {
|
|
|
94
94
|
onClick: ()=>state.focusNextPage(),
|
|
95
95
|
tabIndex: -1
|
|
96
96
|
}))));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
* A calendar displays one or more date grids and allows users to select a single date.
|
|
100
|
-
*/ const $dfd62f934fc76fed$export$e1aef45b828286de = /*#__PURE__*/ (0, $dCiKx$forwardRef)($dfd62f934fc76fed$var$Calendar);
|
|
101
|
-
function $dfd62f934fc76fed$var$RangeCalendar(props, ref) {
|
|
97
|
+
});
|
|
98
|
+
const $dfd62f934fc76fed$export$a4f5c8b89d277a8d = /*#__PURE__*/ (0, $dCiKx$forwardRef)(function RangeCalendar(props, ref) {
|
|
102
99
|
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $dfd62f934fc76fed$export$233dd9682e1ad64b);
|
|
103
100
|
let { locale: locale } = (0, $dCiKx$useLocale)();
|
|
104
101
|
let state = (0, $dCiKx$useRangeCalendarState)({
|
|
@@ -161,12 +158,9 @@ function $dfd62f934fc76fed$var$RangeCalendar(props, ref) {
|
|
|
161
158
|
onClick: ()=>state.focusNextPage(),
|
|
162
159
|
tabIndex: -1
|
|
163
160
|
}))));
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* A range calendar displays one or more date grids and allows users to select a contiguous range of dates.
|
|
167
|
-
*/ const $dfd62f934fc76fed$export$a4f5c8b89d277a8d = /*#__PURE__*/ (0, $dCiKx$forwardRef)($dfd62f934fc76fed$var$RangeCalendar);
|
|
161
|
+
});
|
|
168
162
|
const $dfd62f934fc76fed$var$InternalCalendarGridContext = /*#__PURE__*/ (0, $dCiKx$createContext)(null);
|
|
169
|
-
|
|
163
|
+
const $dfd62f934fc76fed$export$5bd780d491cfc46c = /*#__PURE__*/ (0, $dCiKx$forwardRef)(function CalendarGrid(props, ref) {
|
|
170
164
|
let calendarState = (0, $dCiKx$useContext)($dfd62f934fc76fed$export$9e31dcedda1dadc7);
|
|
171
165
|
let rangeCalendarState = (0, $dCiKx$useContext)($dfd62f934fc76fed$export$5e0fc348c00f87a0);
|
|
172
166
|
let state = calendarState !== null && calendarState !== void 0 ? calendarState : rangeCalendarState;
|
|
@@ -191,11 +185,7 @@ function $dfd62f934fc76fed$var$CalendarGrid(props, ref) {
|
|
|
191
185
|
style: props.style,
|
|
192
186
|
className: (_props_className = props.className) !== null && _props_className !== void 0 ? _props_className : 'react-aria-CalendarGrid'
|
|
193
187
|
}, typeof props.children !== 'function' ? props.children : /*#__PURE__*/ (0, $dCiKx$react).createElement((0, $dCiKx$react).Fragment, null, /*#__PURE__*/ (0, $dCiKx$react).createElement($dfd62f934fc76fed$export$22e2d15eaa4d2377, null, (day)=>/*#__PURE__*/ (0, $dCiKx$react).createElement($dfd62f934fc76fed$export$ad2135cac3a11b3d, null, day)), /*#__PURE__*/ (0, $dCiKx$react).createElement($dfd62f934fc76fed$export$e11f8ba65d857bff, null, props.children))));
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* A calendar grid displays a single grid of days within a calendar or range calendar which
|
|
197
|
-
* can be keyboard navigated and selected by the user.
|
|
198
|
-
*/ const $dfd62f934fc76fed$export$5bd780d491cfc46c = /*#__PURE__*/ (0, $dCiKx$forwardRef)($dfd62f934fc76fed$var$CalendarGrid);
|
|
188
|
+
});
|
|
199
189
|
function $dfd62f934fc76fed$var$CalendarGridHeader(props, ref) {
|
|
200
190
|
let { children: children, style: style, className: className } = props;
|
|
201
191
|
let { headerProps: headerProps, weekDays: weekDays } = (0, $dCiKx$useContext)($dfd62f934fc76fed$var$InternalCalendarGridContext);
|
|
@@ -250,7 +240,7 @@ function $dfd62f934fc76fed$var$CalendarGridBody(props, ref) {
|
|
|
250
240
|
/**
|
|
251
241
|
* A calendar grid body displays a grid of calendar cells within a month.
|
|
252
242
|
*/ const $dfd62f934fc76fed$export$e11f8ba65d857bff = /*#__PURE__*/ (0, $dCiKx$forwardRef)($dfd62f934fc76fed$var$CalendarGridBody);
|
|
253
|
-
|
|
243
|
+
const $dfd62f934fc76fed$export$5d847498420df57b = /*#__PURE__*/ (0, $dCiKx$forwardRef)(function CalendarCell({ date: date, ...otherProps }, ref) {
|
|
254
244
|
let calendarState = (0, $dCiKx$useContext)($dfd62f934fc76fed$export$9e31dcedda1dadc7);
|
|
255
245
|
let rangeCalendarState = (0, $dCiKx$useContext)($dfd62f934fc76fed$export$5e0fc348c00f87a0);
|
|
256
246
|
let state = calendarState !== null && calendarState !== void 0 ? calendarState : rangeCalendarState;
|
|
@@ -310,11 +300,8 @@ function $dfd62f934fc76fed$var$CalendarCell({ date: date, ...otherProps }, ref)
|
|
|
310
300
|
...(0, $dCiKx$mergeProps)((0, $dCiKx$filterDOMProps)(otherProps), buttonProps, focusProps, hoverProps, dataAttrs, renderProps),
|
|
311
301
|
ref: buttonRef
|
|
312
302
|
}));
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* A calendar cell displays a date cell within a calendar grid which can be selected by the user.
|
|
316
|
-
*/ const $dfd62f934fc76fed$export$5d847498420df57b = /*#__PURE__*/ (0, $dCiKx$forwardRef)($dfd62f934fc76fed$var$CalendarCell);
|
|
303
|
+
});
|
|
317
304
|
|
|
318
305
|
|
|
319
|
-
export {$dfd62f934fc76fed$export$3b805cea1f178355 as CalendarContext, $dfd62f934fc76fed$export$233dd9682e1ad64b as RangeCalendarContext, $dfd62f934fc76fed$export$9e31dcedda1dadc7 as CalendarStateContext, $dfd62f934fc76fed$export$5e0fc348c00f87a0 as RangeCalendarStateContext, $dfd62f934fc76fed$export$e1aef45b828286de as Calendar, $dfd62f934fc76fed$export$a4f5c8b89d277a8d as RangeCalendar, $dfd62f934fc76fed$export$
|
|
306
|
+
export {$dfd62f934fc76fed$export$3b805cea1f178355 as CalendarContext, $dfd62f934fc76fed$export$233dd9682e1ad64b as RangeCalendarContext, $dfd62f934fc76fed$export$9e31dcedda1dadc7 as CalendarStateContext, $dfd62f934fc76fed$export$5e0fc348c00f87a0 as RangeCalendarStateContext, $dfd62f934fc76fed$export$e1aef45b828286de as Calendar, $dfd62f934fc76fed$export$a4f5c8b89d277a8d as RangeCalendar, $dfd62f934fc76fed$export$5bd780d491cfc46c as CalendarGrid, $dfd62f934fc76fed$export$22e2d15eaa4d2377 as CalendarGridHeader, $dfd62f934fc76fed$export$ad2135cac3a11b3d as CalendarHeaderCell, $dfd62f934fc76fed$export$e11f8ba65d857bff as CalendarGridBody, $dfd62f934fc76fed$export$5d847498420df57b as CalendarCell};
|
|
320
307
|
//# sourceMappingURL=Calendar.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAiEM,MAAM,0DAAkB,CAAA,GAAA,oBAAY,EAAoD,CAAC;AACzF,MAAM,0DAAuB,CAAA,GAAA,oBAAY,EAAyD,CAAC;AACnG,MAAM,0DAAuB,CAAA,GAAA,oBAAY,EAAwB;AACjE,MAAM,0DAA4B,CAAA,GAAA,oBAAY,EAA6B;AAElF,SAAS,+BAA8B,KAAuB,EAAE,GAAiC;IAC/F,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,gBAAQ;IACvB,IAAI,QAAQ,CAAA,GAAA,uBAAe,EAAE;QAC3B,GAAG,KAAK;gBACR;wBACA;IACF;IAEA,IAAI,iBAAC,aAAa,mBAAE,eAAe,mBAAE,eAAe,qBAAE,iBAAiB,SAAE,KAAK,EAAC,GAAG,CAAA,GAAA,kBAAU,EAAE,OAAO;IAErG,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,QAAQ;mBACN;YACA,YAAY,MAAM,UAAU,IAAI;YAChC,WAAW,MAAM,cAAc;QACjC;QACA,kBAAkB;IACpB;IAEA,qBACE,gCAAC;QACE,GAAG,WAAW;QACd,GAAG,aAAa;QACjB,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,MAAM,cAAc,IAAI;qBACtC,gCAAC,CAAA,GAAA,yCAAO;QACN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SAAS,IAAI;IACtC;IAEA,qBACE,gCAAC;QAAI,GAAG,SAAS;QAAE,KAAK;qBACtB,gCAAC;QAAK,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,qBAAa,EAAE,aAAoB,aAAa,YAAY,YAAY,WAAW,YAAY;QAAE,KAAK;;AAGhI;AAEA;;CAEC,GACD,MAAM,4CAA8B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB","sources":["packages/react-aria-components/src/Calendar.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n AriaCalendarProps,\n AriaRangeCalendarProps,\n DateValue,\n mergeProps,\n useCalendar,\n useCalendarCell,\n useCalendarGrid,\n useFocusRing,\n useHover,\n useLocale,\n useRangeCalendar,\n VisuallyHidden\n} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CalendarDate, createCalendar, DateDuration, endOfMonth, getWeeksInMonth, isSameDay, isSameMonth} from '@internationalized/date';\nimport {CalendarState, RangeCalendarState, useCalendarState, useRangeCalendarState} from 'react-stately';\nimport {ContextValue, DOMProps, Provider, RenderProps, SlotProps, StyleProps, useContextProps, useRenderProps} from './utils';\nimport {DOMAttributes, FocusableElement, forwardRefType, HoverEvents} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {HeadingContext} from './RSPContexts';\nimport React, {createContext, ForwardedRef, forwardRef, ReactElement, useContext, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface CalendarRenderProps {\n /**\n * Whether the calendar is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * State of the calendar.\n */\n state: CalendarState,\n /**\n * Whether the calendar is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean\n}\n\nexport interface RangeCalendarRenderProps extends Omit<CalendarRenderProps, 'state'> {\n /**\n * State of the range calendar.\n */\n state: RangeCalendarState\n}\n\nexport interface CalendarProps<T extends DateValue> extends Omit<AriaCalendarProps<T>, 'errorMessage' | 'validationState'>, RenderProps<CalendarRenderProps>, SlotProps {\n /**\n * The amount of days that will be displayed at once. This affects how pagination works.\n * @default {months: 1}\n */\n visibleDuration?: DateDuration\n}\n\nexport interface RangeCalendarProps<T extends DateValue> extends Omit<AriaRangeCalendarProps<T>, 'errorMessage' | 'validationState'>, RenderProps<RangeCalendarRenderProps>, SlotProps {\n /**\n * The amount of days that will be displayed at once. This affects how pagination works.\n * @default {months: 1}\n */\n visibleDuration?: DateDuration\n}\n\nexport const CalendarContext = createContext<ContextValue<CalendarProps<any>, HTMLDivElement>>({});\nexport const RangeCalendarContext = createContext<ContextValue<RangeCalendarProps<any>, HTMLDivElement>>({});\nexport const CalendarStateContext = createContext<CalendarState | null>(null);\nexport const RangeCalendarStateContext = createContext<RangeCalendarState | null>(null);\n\nfunction Calendar<T extends DateValue>(props: CalendarProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, CalendarContext);\n let {locale} = useLocale();\n let state = useCalendarState({\n ...props,\n locale,\n createCalendar\n });\n\n let {calendarProps, prevButtonProps, nextButtonProps, errorMessageProps, title} = useCalendar(props, state);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isValueInvalid\n },\n defaultClassName: 'react-aria-Calendar'\n });\n\n return (\n <div\n {...renderProps}\n {...calendarProps}\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={state.isValueInvalid || undefined}>\n <Provider\n values={[\n [ButtonContext, {\n slots: {\n previous: prevButtonProps,\n next: nextButtonProps\n }\n }],\n [HeadingContext, {'aria-hidden': true, level: 2, children: title}],\n [CalendarStateContext, state],\n [TextContext, {\n slots: {\n errorMessage: errorMessageProps\n }\n }]\n ]}>\n {/* Add a screen reader only description of the entire visible range rather than\n * a separate heading above each month grid. This is placed first in the DOM order\n * so that it is the first thing a touch screen reader user encounters.\n * In addition, VoiceOver on iOS does not announce the aria-label of the grid\n * elements, so the aria-label of the Calendar is included here as well. */}\n <VisuallyHidden>\n <h2>{calendarProps['aria-label']}</h2>\n </VisuallyHidden>\n {renderProps.children}\n {/* For touch screen readers, add a visually hidden next button after the month grid\n * so it's easy to navigate after reaching the end without going all the way\n * back to the start of the month. */}\n <VisuallyHidden>\n <button\n aria-label={nextButtonProps['aria-label']}\n disabled={nextButtonProps.isDisabled}\n onClick={() => state.focusNextPage()}\n tabIndex={-1} />\n </VisuallyHidden>\n </Provider>\n </div>\n );\n}\n\n/**\n * A calendar displays one or more date grids and allows users to select a single date.\n */\nconst _Calendar = /*#__PURE__*/ (forwardRef as forwardRefType)(Calendar);\nexport {_Calendar as Calendar};\n\nfunction RangeCalendar<T extends DateValue>(props: RangeCalendarProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, RangeCalendarContext);\n let {locale} = useLocale();\n let state = useRangeCalendarState({\n ...props,\n locale,\n createCalendar\n });\n\n let {calendarProps, prevButtonProps, nextButtonProps, errorMessageProps, title} = useRangeCalendar(\n props,\n state,\n ref\n );\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isValueInvalid\n },\n defaultClassName: 'react-aria-RangeCalendar'\n });\n\n return (\n <div\n {...renderProps}\n {...calendarProps}\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={state.isValueInvalid || undefined}>\n <Provider\n values={[\n [ButtonContext, {\n slots: {\n previous: prevButtonProps,\n next: nextButtonProps\n }\n }],\n [HeadingContext, {'aria-hidden': true, level: 2, children: title}],\n [RangeCalendarStateContext, state],\n [TextContext, {\n slots: {\n errorMessage: errorMessageProps\n }\n }]\n ]}>\n {/* Add a screen reader only description of the entire visible range rather than\n * a separate heading above each month grid. This is placed first in the DOM order\n * so that it is the first thing a touch screen reader user encounters.\n * In addition, VoiceOver on iOS does not announce the aria-label of the grid\n * elements, so the aria-label of the Calendar is included here as well. */}\n <VisuallyHidden>\n <h2>{calendarProps['aria-label']}</h2>\n </VisuallyHidden>\n {renderProps.children}\n {/* For touch screen readers, add a visually hidden next button after the month grid\n * so it's easy to navigate after reaching the end without going all the way\n * back to the start of the month. */}\n <VisuallyHidden>\n <button\n aria-label={nextButtonProps['aria-label']}\n disabled={nextButtonProps.isDisabled}\n onClick={() => state.focusNextPage()}\n tabIndex={-1} />\n </VisuallyHidden>\n </Provider>\n </div>\n );\n}\n\n/**\n * A range calendar displays one or more date grids and allows users to select a contiguous range of dates.\n */\nconst _RangeCalendar = /*#__PURE__*/ (forwardRef as forwardRefType)(RangeCalendar);\nexport {_RangeCalendar as RangeCalendar};\n\nexport interface CalendarCellRenderProps {\n /** The date that the cell represents. */\n date: CalendarDate,\n /** The day number formatted according to the current locale. */\n formattedDate: string,\n /**\n * Whether the cell is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the cell is currently being pressed.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the cell is selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the cell is the first date in a range selection.\n * @selector [data-selection-start]\n */\n isSelectionStart: boolean,\n /**\n * Whether the cell is the last date in a range selection.\n * @selector [data-selection-end]\n */\n isSelectionEnd: boolean,\n /**\n * Whether the cell is focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the cell is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the cell is disabled, according to the calendar's `minValue`, `maxValue`, and `isDisabled` props.\n * Disabled dates are not focusable, and cannot be selected by the user. They are typically\n * displayed with a dimmed appearance.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the cell is outside the visible range of the calendar.\n * For example, dates before the first day of a month in the same week.\n * @selector [data-outside-visible-range]\n */\n isOutsideVisibleRange: boolean,\n /**\n * Whether the cell is outside the current month.\n * @selector [data-outside-month]\n */\n isOutsideMonth: boolean,\n /**\n * Whether the cell is unavailable, according to the calendar's `isDateUnavailable` prop. Unavailable dates remain\n * focusable, but cannot be selected by the user. They should be displayed with a visual affordance to indicate they\n * are unavailable, such as a different color or a strikethrough.\n *\n * Note that because they are focusable, unavailable dates must meet a 4.5:1 color contrast ratio,\n * [as defined by WCAG](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html).\n *\n * @selector [data-unavailable]\n */\n isUnavailable: boolean,\n /**\n * Whether the cell is part of an invalid selection.\n * @selector [data-invalid]\n */\n isInvalid: boolean\n}\n\nexport interface CalendarGridProps extends StyleProps {\n /**\n * Either a function to render calendar cells for each date in the month,\n * or children containing a `<CalendarGridHeader>`` and `<CalendarGridBody>`\n * when additional customization is needed.\n */\n children?: ReactElement | ReactElement[] | ((date: CalendarDate) => ReactElement),\n /**\n * An offset from the beginning of the visible date range that this\n * CalendarGrid should display. Useful when displaying more than one\n * month at a time.\n */\n offset?: DateDuration,\n /**\n * The style of weekday names to display in the calendar grid header,\n * e.g. single letter, abbreviation, or full day name.\n * @default \"narrow\"\n */\n weekdayStyle?: 'narrow' | 'short' | 'long'\n}\n\ninterface InternalCalendarGridContextValue {\n headerProps: DOMAttributes<FocusableElement>,\n weekDays: string[],\n startDate: CalendarDate\n}\n\nconst InternalCalendarGridContext = createContext<InternalCalendarGridContextValue | null>(null);\n\nfunction CalendarGrid(props: CalendarGridProps, ref: ForwardedRef<HTMLTableElement>) {\n let calendarState = useContext(CalendarStateContext);\n let rangeCalendarState = useContext(RangeCalendarStateContext);\n let state = calendarState ?? rangeCalendarState!;\n let startDate = state.visibleRange.start;\n if (props.offset) {\n startDate = startDate.add(props.offset);\n }\n\n let {gridProps, headerProps, weekDays} = useCalendarGrid({\n startDate,\n endDate: endOfMonth(startDate),\n weekdayStyle: props.weekdayStyle\n }, state);\n\n return (\n <InternalCalendarGridContext.Provider value={{headerProps, weekDays, startDate}}>\n <table\n {...filterDOMProps(props as any)}\n {...gridProps}\n ref={ref}\n style={props.style}\n className={props.className ?? 'react-aria-CalendarGrid'}>\n {typeof props.children !== 'function'\n ? props.children\n : (<>\n <CalendarGridHeaderForwardRef>\n {day => <CalendarHeaderCellForwardRef>{day}</CalendarHeaderCellForwardRef>}\n </CalendarGridHeaderForwardRef>\n <CalendarGridBodyForwardRef>\n {props.children}\n </CalendarGridBodyForwardRef>\n </>)\n }\n </table>\n </InternalCalendarGridContext.Provider>\n );\n}\n\n/**\n * A calendar grid displays a single grid of days within a calendar or range calendar which\n * can be keyboard navigated and selected by the user.\n */\nconst _CalendarGrid = /*#__PURE__*/ (forwardRef as forwardRefType)(CalendarGrid);\nexport {_CalendarGrid as CalendarGrid};\n\nexport interface CalendarGridHeaderProps extends StyleProps {\n /** A function to render a `<CalendarHeaderCell>` for a weekday name. */\n children: (day: string) => ReactElement\n}\n\nfunction CalendarGridHeader(props: CalendarGridHeaderProps, ref: ForwardedRef<HTMLTableSectionElement>) {\n let {children, style, className} = props;\n let {headerProps, weekDays} = useContext(InternalCalendarGridContext)!;\n\n return (\n <thead\n {...filterDOMProps(props as any)}\n {...headerProps}\n ref={ref}\n style={style}\n className={className || 'react-aria-CalendarGridHeader'}>\n <tr>\n {weekDays.map((day, key) => React.cloneElement(children(day), {key}))}\n </tr>\n </thead>\n );\n}\n\n/**\n * A calendar grid header displays a row of week day names at the top of a month.\n */\nconst CalendarGridHeaderForwardRef = /*#__PURE__*/ (forwardRef as forwardRefType)(CalendarGridHeader);\nexport {CalendarGridHeaderForwardRef as CalendarGridHeader};\n\nexport interface CalendarHeaderCellProps extends DOMProps {}\n\nfunction CalendarHeaderCell(props: CalendarHeaderCellProps, ref: ForwardedRef<HTMLTableCellElement>) {\n let {children, style, className} = props;\n return (\n <th\n {...filterDOMProps(props as any)}\n ref={ref}\n style={style}\n className={className || 'react-aria-CalendarHeaderCell'}>\n {children}\n </th>\n );\n}\n\n/**\n * A calendar header cell displays a week day name at the top of a column within a calendar.\n */\nconst CalendarHeaderCellForwardRef = forwardRef(CalendarHeaderCell);\nexport {CalendarHeaderCellForwardRef as CalendarHeaderCell};\n\nexport interface CalendarGridBodyProps extends StyleProps {\n /** A function to render a `<CalendarCell>` for a given date. */\n children: (date: CalendarDate) => ReactElement\n}\n\nfunction CalendarGridBody(props: CalendarGridBodyProps, ref: ForwardedRef<HTMLTableSectionElement>) {\n let {children, style, className} = props;\n let calendarState = useContext(CalendarStateContext);\n let rangeCalendarState = useContext(RangeCalendarStateContext);\n let state = calendarState ?? rangeCalendarState!;\n let {startDate} = useContext(InternalCalendarGridContext)!;\n let {locale} = useLocale();\n let weeksInMonth = getWeeksInMonth(startDate, locale);\n\n return (\n <tbody\n {...filterDOMProps(props as any)}\n ref={ref}\n style={style}\n className={className || 'react-aria-CalendarGridBody'}>\n {[...new Array(weeksInMonth).keys()].map((weekIndex) => (\n <tr key={weekIndex}>\n {state.getDatesInWeek(weekIndex, startDate).map((date, i) => (\n date\n ? React.cloneElement(children(date), {key: i})\n : <td key={i} />\n ))}\n </tr>\n ))}\n </tbody>\n );\n}\n\n/**\n * A calendar grid body displays a grid of calendar cells within a month.\n */\nconst CalendarGridBodyForwardRef = /*#__PURE__*/ (forwardRef as forwardRefType)(CalendarGridBody);\nexport {CalendarGridBodyForwardRef as CalendarGridBody};\n\nexport interface CalendarCellProps extends RenderProps<CalendarCellRenderProps>, HoverEvents {\n /** The date to render in the cell. */\n date: CalendarDate\n}\n\nfunction CalendarCell({date, ...otherProps}: CalendarCellProps, ref: ForwardedRef<HTMLTableCellElement>) {\n let calendarState = useContext(CalendarStateContext);\n let rangeCalendarState = useContext(RangeCalendarStateContext);\n let state = calendarState ?? rangeCalendarState!;\n let {startDate: currentMonth} = useContext(InternalCalendarGridContext) ?? {startDate: state.visibleRange.start};\n let buttonRef = useRef<HTMLDivElement>(null);\n let {cellProps, buttonProps, ...states} = useCalendarCell(\n {date},\n state,\n buttonRef\n );\n\n let {hoverProps, isHovered} = useHover({...otherProps, isDisabled: states.isDisabled});\n let {focusProps, isFocusVisible} = useFocusRing();\n isFocusVisible &&= states.isFocused;\n let isOutsideMonth = !isSameMonth(currentMonth, date);\n let isSelectionStart = false;\n let isSelectionEnd = false;\n if ('highlightedRange' in state && state.highlightedRange) {\n isSelectionStart = isSameDay(date, state.highlightedRange.start);\n isSelectionEnd = isSameDay(date, state.highlightedRange.end);\n }\n\n let renderProps = useRenderProps({\n ...otherProps,\n defaultChildren: states.formattedDate,\n defaultClassName: 'react-aria-CalendarCell',\n values: {\n date,\n isHovered,\n isOutsideMonth,\n isFocusVisible,\n isSelectionStart,\n isSelectionEnd,\n ...states\n }\n });\n\n let dataAttrs = {\n 'data-focused': states.isFocused || undefined,\n 'data-hovered': isHovered || undefined,\n 'data-pressed': states.isPressed || undefined,\n 'data-unavailable': states.isUnavailable || undefined,\n 'data-disabled': states.isDisabled || undefined,\n 'data-focus-visible': isFocusVisible || undefined,\n 'data-outside-visible-range': states.isOutsideVisibleRange || undefined,\n 'data-outside-month': isOutsideMonth || undefined,\n 'data-selected': states.isSelected || undefined,\n 'data-selection-start': isSelectionStart || undefined,\n 'data-selection-end': isSelectionEnd || undefined,\n 'data-invalid': states.isInvalid || undefined\n };\n\n return (\n <td {...cellProps} ref={ref}>\n <div {...mergeProps(filterDOMProps(otherProps as any), buttonProps, focusProps, hoverProps, dataAttrs, renderProps)} ref={buttonRef} />\n </td>\n );\n}\n\n/**\n * A calendar cell displays a date cell within a calendar grid which can be selected by the user.\n */\nconst _CalendarCell = /*#__PURE__*/ (forwardRef as forwardRefType)(CalendarCell);\nexport {_CalendarCell as CalendarCell};\n"],"names":[],"version":3,"file":"Calendar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ourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n AriaCalendarProps,\n AriaRangeCalendarProps,\n DateValue,\n mergeProps,\n useCalendar,\n useCalendarCell,\n useCalendarGrid,\n useFocusRing,\n useHover,\n useLocale,\n useRangeCalendar,\n VisuallyHidden\n} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CalendarDate, createCalendar, DateDuration, endOfMonth, getWeeksInMonth, isSameDay, isSameMonth} from '@internationalized/date';\nimport {CalendarState, RangeCalendarState, useCalendarState, useRangeCalendarState} from 'react-stately';\nimport {ContextValue, DOMProps, Provider, RenderProps, SlotProps, StyleProps, useContextProps, useRenderProps} from './utils';\nimport {DOMAttributes, FocusableElement, forwardRefType, HoverEvents} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {HeadingContext} from './RSPContexts';\nimport React, {createContext, ForwardedRef, forwardRef, ReactElement, useContext, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface CalendarRenderProps {\n /**\n * Whether the calendar is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * State of the calendar.\n */\n state: CalendarState,\n /**\n * Whether the calendar is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean\n}\n\nexport interface RangeCalendarRenderProps extends Omit<CalendarRenderProps, 'state'> {\n /**\n * State of the range calendar.\n */\n state: RangeCalendarState\n}\n\nexport interface CalendarProps<T extends DateValue> extends Omit<AriaCalendarProps<T>, 'errorMessage' | 'validationState'>, RenderProps<CalendarRenderProps>, SlotProps {\n /**\n * The amount of days that will be displayed at once. This affects how pagination works.\n * @default {months: 1}\n */\n visibleDuration?: DateDuration\n}\n\nexport interface RangeCalendarProps<T extends DateValue> extends Omit<AriaRangeCalendarProps<T>, 'errorMessage' | 'validationState'>, RenderProps<RangeCalendarRenderProps>, SlotProps {\n /**\n * The amount of days that will be displayed at once. This affects how pagination works.\n * @default {months: 1}\n */\n visibleDuration?: DateDuration\n}\n\nexport const CalendarContext = createContext<ContextValue<CalendarProps<any>, HTMLDivElement>>({});\nexport const RangeCalendarContext = createContext<ContextValue<RangeCalendarProps<any>, HTMLDivElement>>({});\nexport const CalendarStateContext = createContext<CalendarState | null>(null);\nexport const RangeCalendarStateContext = createContext<RangeCalendarState | null>(null);\n\n/**\n * A calendar displays one or more date grids and allows users to select a single date.\n */\nexport const Calendar = /*#__PURE__*/ (forwardRef as forwardRefType)(function Calendar<T extends DateValue>(props: CalendarProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, CalendarContext);\n let {locale} = useLocale();\n let state = useCalendarState({\n ...props,\n locale,\n createCalendar\n });\n\n let {calendarProps, prevButtonProps, nextButtonProps, errorMessageProps, title} = useCalendar(props, state);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isValueInvalid\n },\n defaultClassName: 'react-aria-Calendar'\n });\n\n return (\n <div\n {...renderProps}\n {...calendarProps}\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={state.isValueInvalid || undefined}>\n <Provider\n values={[\n [ButtonContext, {\n slots: {\n previous: prevButtonProps,\n next: nextButtonProps\n }\n }],\n [HeadingContext, {'aria-hidden': true, level: 2, children: title}],\n [CalendarStateContext, state],\n [TextContext, {\n slots: {\n errorMessage: errorMessageProps\n }\n }]\n ]}>\n {/* Add a screen reader only description of the entire visible range rather than\n * a separate heading above each month grid. This is placed first in the DOM order\n * so that it is the first thing a touch screen reader user encounters.\n * In addition, VoiceOver on iOS does not announce the aria-label of the grid\n * elements, so the aria-label of the Calendar is included here as well. */}\n <VisuallyHidden>\n <h2>{calendarProps['aria-label']}</h2>\n </VisuallyHidden>\n {renderProps.children}\n {/* For touch screen readers, add a visually hidden next button after the month grid\n * so it's easy to navigate after reaching the end without going all the way\n * back to the start of the month. */}\n <VisuallyHidden>\n <button\n aria-label={nextButtonProps['aria-label']}\n disabled={nextButtonProps.isDisabled}\n onClick={() => state.focusNextPage()}\n tabIndex={-1} />\n </VisuallyHidden>\n </Provider>\n </div>\n );\n});\n\n/**\n * A range calendar displays one or more date grids and allows users to select a contiguous range of dates.\n */\nexport const RangeCalendar = /*#__PURE__*/ (forwardRef as forwardRefType)(function RangeCalendar<T extends DateValue>(props: RangeCalendarProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, RangeCalendarContext);\n let {locale} = useLocale();\n let state = useRangeCalendarState({\n ...props,\n locale,\n createCalendar\n });\n\n let {calendarProps, prevButtonProps, nextButtonProps, errorMessageProps, title} = useRangeCalendar(\n props,\n state,\n ref\n );\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isValueInvalid\n },\n defaultClassName: 'react-aria-RangeCalendar'\n });\n\n return (\n <div\n {...renderProps}\n {...calendarProps}\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={state.isValueInvalid || undefined}>\n <Provider\n values={[\n [ButtonContext, {\n slots: {\n previous: prevButtonProps,\n next: nextButtonProps\n }\n }],\n [HeadingContext, {'aria-hidden': true, level: 2, children: title}],\n [RangeCalendarStateContext, state],\n [TextContext, {\n slots: {\n errorMessage: errorMessageProps\n }\n }]\n ]}>\n {/* Add a screen reader only description of the entire visible range rather than\n * a separate heading above each month grid. This is placed first in the DOM order\n * so that it is the first thing a touch screen reader user encounters.\n * In addition, VoiceOver on iOS does not announce the aria-label of the grid\n * elements, so the aria-label of the Calendar is included here as well. */}\n <VisuallyHidden>\n <h2>{calendarProps['aria-label']}</h2>\n </VisuallyHidden>\n {renderProps.children}\n {/* For touch screen readers, add a visually hidden next button after the month grid\n * so it's easy to navigate after reaching the end without going all the way\n * back to the start of the month. */}\n <VisuallyHidden>\n <button\n aria-label={nextButtonProps['aria-label']}\n disabled={nextButtonProps.isDisabled}\n onClick={() => state.focusNextPage()}\n tabIndex={-1} />\n </VisuallyHidden>\n </Provider>\n </div>\n );\n});\n\nexport interface CalendarCellRenderProps {\n /** The date that the cell represents. */\n date: CalendarDate,\n /** The day number formatted according to the current locale. */\n formattedDate: string,\n /**\n * Whether the cell is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the cell is currently being pressed.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the cell is selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the cell is the first date in a range selection.\n * @selector [data-selection-start]\n */\n isSelectionStart: boolean,\n /**\n * Whether the cell is the last date in a range selection.\n * @selector [data-selection-end]\n */\n isSelectionEnd: boolean,\n /**\n * Whether the cell is focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the cell is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the cell is disabled, according to the calendar's `minValue`, `maxValue`, and `isDisabled` props.\n * Disabled dates are not focusable, and cannot be selected by the user. They are typically\n * displayed with a dimmed appearance.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the cell is outside the visible range of the calendar.\n * For example, dates before the first day of a month in the same week.\n * @selector [data-outside-visible-range]\n */\n isOutsideVisibleRange: boolean,\n /**\n * Whether the cell is outside the current month.\n * @selector [data-outside-month]\n */\n isOutsideMonth: boolean,\n /**\n * Whether the cell is unavailable, according to the calendar's `isDateUnavailable` prop. Unavailable dates remain\n * focusable, but cannot be selected by the user. They should be displayed with a visual affordance to indicate they\n * are unavailable, such as a different color or a strikethrough.\n *\n * Note that because they are focusable, unavailable dates must meet a 4.5:1 color contrast ratio,\n * [as defined by WCAG](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html).\n *\n * @selector [data-unavailable]\n */\n isUnavailable: boolean,\n /**\n * Whether the cell is part of an invalid selection.\n * @selector [data-invalid]\n */\n isInvalid: boolean\n}\n\nexport interface CalendarGridProps extends StyleProps {\n /**\n * Either a function to render calendar cells for each date in the month,\n * or children containing a `<CalendarGridHeader>`` and `<CalendarGridBody>`\n * when additional customization is needed.\n */\n children?: ReactElement | ReactElement[] | ((date: CalendarDate) => ReactElement),\n /**\n * An offset from the beginning of the visible date range that this\n * CalendarGrid should display. Useful when displaying more than one\n * month at a time.\n */\n offset?: DateDuration,\n /**\n * The style of weekday names to display in the calendar grid header,\n * e.g. single letter, abbreviation, or full day name.\n * @default \"narrow\"\n */\n weekdayStyle?: 'narrow' | 'short' | 'long'\n}\n\ninterface InternalCalendarGridContextValue {\n headerProps: DOMAttributes<FocusableElement>,\n weekDays: string[],\n startDate: CalendarDate\n}\n\nconst InternalCalendarGridContext = createContext<InternalCalendarGridContextValue | null>(null);\n\n/**\n * A calendar grid displays a single grid of days within a calendar or range calendar which\n * can be keyboard navigated and selected by the user.\n */\nexport const CalendarGrid = /*#__PURE__*/ (forwardRef as forwardRefType)(function CalendarGrid(props: CalendarGridProps, ref: ForwardedRef<HTMLTableElement>) {\n let calendarState = useContext(CalendarStateContext);\n let rangeCalendarState = useContext(RangeCalendarStateContext);\n let state = calendarState ?? rangeCalendarState!;\n let startDate = state.visibleRange.start;\n if (props.offset) {\n startDate = startDate.add(props.offset);\n }\n\n let {gridProps, headerProps, weekDays} = useCalendarGrid({\n startDate,\n endDate: endOfMonth(startDate),\n weekdayStyle: props.weekdayStyle\n }, state);\n\n return (\n <InternalCalendarGridContext.Provider value={{headerProps, weekDays, startDate}}>\n <table\n {...filterDOMProps(props as any)}\n {...gridProps}\n ref={ref}\n style={props.style}\n className={props.className ?? 'react-aria-CalendarGrid'}>\n {typeof props.children !== 'function'\n ? props.children\n : (<>\n <CalendarGridHeaderForwardRef>\n {day => <CalendarHeaderCellForwardRef>{day}</CalendarHeaderCellForwardRef>}\n </CalendarGridHeaderForwardRef>\n <CalendarGridBodyForwardRef>\n {props.children}\n </CalendarGridBodyForwardRef>\n </>)\n }\n </table>\n </InternalCalendarGridContext.Provider>\n );\n});\n\nexport interface CalendarGridHeaderProps extends StyleProps {\n /** A function to render a `<CalendarHeaderCell>` for a weekday name. */\n children: (day: string) => ReactElement\n}\n\nfunction CalendarGridHeader(props: CalendarGridHeaderProps, ref: ForwardedRef<HTMLTableSectionElement>) {\n let {children, style, className} = props;\n let {headerProps, weekDays} = useContext(InternalCalendarGridContext)!;\n\n return (\n <thead\n {...filterDOMProps(props as any)}\n {...headerProps}\n ref={ref}\n style={style}\n className={className || 'react-aria-CalendarGridHeader'}>\n <tr>\n {weekDays.map((day, key) => React.cloneElement(children(day), {key}))}\n </tr>\n </thead>\n );\n}\n\n/**\n * A calendar grid header displays a row of week day names at the top of a month.\n */\nconst CalendarGridHeaderForwardRef = /*#__PURE__*/ (forwardRef as forwardRefType)(CalendarGridHeader);\nexport {CalendarGridHeaderForwardRef as CalendarGridHeader};\n\nexport interface CalendarHeaderCellProps extends DOMProps {}\n\nfunction CalendarHeaderCell(props: CalendarHeaderCellProps, ref: ForwardedRef<HTMLTableCellElement>) {\n let {children, style, className} = props;\n return (\n <th\n {...filterDOMProps(props as any)}\n ref={ref}\n style={style}\n className={className || 'react-aria-CalendarHeaderCell'}>\n {children}\n </th>\n );\n}\n\n/**\n * A calendar header cell displays a week day name at the top of a column within a calendar.\n */\nconst CalendarHeaderCellForwardRef = forwardRef(CalendarHeaderCell);\nexport {CalendarHeaderCellForwardRef as CalendarHeaderCell};\n\nexport interface CalendarGridBodyProps extends StyleProps {\n /** A function to render a `<CalendarCell>` for a given date. */\n children: (date: CalendarDate) => ReactElement\n}\n\nfunction CalendarGridBody(props: CalendarGridBodyProps, ref: ForwardedRef<HTMLTableSectionElement>) {\n let {children, style, className} = props;\n let calendarState = useContext(CalendarStateContext);\n let rangeCalendarState = useContext(RangeCalendarStateContext);\n let state = calendarState ?? rangeCalendarState!;\n let {startDate} = useContext(InternalCalendarGridContext)!;\n let {locale} = useLocale();\n let weeksInMonth = getWeeksInMonth(startDate, locale);\n\n return (\n <tbody\n {...filterDOMProps(props as any)}\n ref={ref}\n style={style}\n className={className || 'react-aria-CalendarGridBody'}>\n {[...new Array(weeksInMonth).keys()].map((weekIndex) => (\n <tr key={weekIndex}>\n {state.getDatesInWeek(weekIndex, startDate).map((date, i) => (\n date\n ? React.cloneElement(children(date), {key: i})\n : <td key={i} />\n ))}\n </tr>\n ))}\n </tbody>\n );\n}\n\n/**\n * A calendar grid body displays a grid of calendar cells within a month.\n */\nconst CalendarGridBodyForwardRef = /*#__PURE__*/ (forwardRef as forwardRefType)(CalendarGridBody);\nexport {CalendarGridBodyForwardRef as CalendarGridBody};\n\nexport interface CalendarCellProps extends RenderProps<CalendarCellRenderProps>, HoverEvents {\n /** The date to render in the cell. */\n date: CalendarDate\n}\n\n/**\n * A calendar cell displays a date cell within a calendar grid which can be selected by the user.\n */\nexport const CalendarCell = /*#__PURE__*/ (forwardRef as forwardRefType)(function CalendarCell({date, ...otherProps}: CalendarCellProps, ref: ForwardedRef<HTMLTableCellElement>) {\n let calendarState = useContext(CalendarStateContext);\n let rangeCalendarState = useContext(RangeCalendarStateContext);\n let state = calendarState ?? rangeCalendarState!;\n let {startDate: currentMonth} = useContext(InternalCalendarGridContext) ?? {startDate: state.visibleRange.start};\n let buttonRef = useRef<HTMLDivElement>(null);\n let {cellProps, buttonProps, ...states} = useCalendarCell(\n {date},\n state,\n buttonRef\n );\n\n let {hoverProps, isHovered} = useHover({...otherProps, isDisabled: states.isDisabled});\n let {focusProps, isFocusVisible} = useFocusRing();\n isFocusVisible &&= states.isFocused;\n let isOutsideMonth = !isSameMonth(currentMonth, date);\n let isSelectionStart = false;\n let isSelectionEnd = false;\n if ('highlightedRange' in state && state.highlightedRange) {\n isSelectionStart = isSameDay(date, state.highlightedRange.start);\n isSelectionEnd = isSameDay(date, state.highlightedRange.end);\n }\n\n let renderProps = useRenderProps({\n ...otherProps,\n defaultChildren: states.formattedDate,\n defaultClassName: 'react-aria-CalendarCell',\n values: {\n date,\n isHovered,\n isOutsideMonth,\n isFocusVisible,\n isSelectionStart,\n isSelectionEnd,\n ...states\n }\n });\n\n let dataAttrs = {\n 'data-focused': states.isFocused || undefined,\n 'data-hovered': isHovered || undefined,\n 'data-pressed': states.isPressed || undefined,\n 'data-unavailable': states.isUnavailable || undefined,\n 'data-disabled': states.isDisabled || undefined,\n 'data-focus-visible': isFocusVisible || undefined,\n 'data-outside-visible-range': states.isOutsideVisibleRange || undefined,\n 'data-outside-month': isOutsideMonth || undefined,\n 'data-selected': states.isSelected || undefined,\n 'data-selection-start': isSelectionStart || undefined,\n 'data-selection-end': isSelectionEnd || undefined,\n 'data-invalid': states.isInvalid || undefined\n };\n\n return (\n <td {...cellProps} ref={ref}>\n <div {...mergeProps(filterDOMProps(otherProps as any), buttonProps, focusProps, hoverProps, dataAttrs, renderProps)} ref={buttonRef} />\n </td>\n );\n});\n"],"names":[],"version":3,"file":"Calendar.module.js.map"}
|
package/dist/Checkbox.main.js
CHANGED
|
@@ -20,8 +20,8 @@ function $parcel$export(e, n, v, s) {
|
|
|
20
20
|
|
|
21
21
|
$parcel$export(module.exports, "CheckboxGroupContext", () => $e733553516d848a9$export$baf37c4be89255b8);
|
|
22
22
|
$parcel$export(module.exports, "CheckboxGroupStateContext", () => $e733553516d848a9$export$139c5b8563afc1fc);
|
|
23
|
-
$parcel$export(module.exports, "Checkbox", () => $e733553516d848a9$export$48513f6b9f8ce62d);
|
|
24
23
|
$parcel$export(module.exports, "CheckboxGroup", () => $e733553516d848a9$export$4aa08d5625cb8ead);
|
|
24
|
+
$parcel$export(module.exports, "Checkbox", () => $e733553516d848a9$export$48513f6b9f8ce62d);
|
|
25
25
|
/*
|
|
26
26
|
* Copyright 2022 Adobe. All rights reserved.
|
|
27
27
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -44,7 +44,7 @@ $parcel$export(module.exports, "CheckboxGroup", () => $e733553516d848a9$export$4
|
|
|
44
44
|
|
|
45
45
|
const $e733553516d848a9$export$baf37c4be89255b8 = /*#__PURE__*/ (0, $72alD$react.createContext)(null);
|
|
46
46
|
const $e733553516d848a9$export$139c5b8563afc1fc = /*#__PURE__*/ (0, $72alD$react.createContext)(null);
|
|
47
|
-
|
|
47
|
+
const $e733553516d848a9$export$4aa08d5625cb8ead = /*#__PURE__*/ (0, $72alD$react.forwardRef)(function CheckboxGroup(props, ref) {
|
|
48
48
|
[props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $e733553516d848a9$export$baf37c4be89255b8);
|
|
49
49
|
let { validationBehavior: formValidationBehavior } = (0, $c5ccf687772c0422$exports.useSlottedContext)((0, $35157657e549736b$exports.FormContext)) || {};
|
|
50
50
|
var _props_validationBehavior, _ref;
|
|
@@ -108,8 +108,8 @@ function $e733553516d848a9$var$CheckboxGroup(props, ref) {
|
|
|
108
108
|
]
|
|
109
109
|
]
|
|
110
110
|
}, renderProps.children));
|
|
111
|
-
}
|
|
112
|
-
|
|
111
|
+
});
|
|
112
|
+
const $e733553516d848a9$export$48513f6b9f8ce62d = /*#__PURE__*/ (0, $72alD$react.forwardRef)(function Checkbox(props, ref) {
|
|
113
113
|
let { inputRef: userProvidedInputRef = null, ...otherProps } = props;
|
|
114
114
|
[props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(otherProps, ref, (0, $525402dfec7da5bc$exports.CheckboxContext));
|
|
115
115
|
let { validationBehavior: formValidationBehavior } = (0, $c5ccf687772c0422$exports.useSlottedContext)((0, $35157657e549736b$exports.FormContext)) || {};
|
|
@@ -174,14 +174,7 @@ function $e733553516d848a9$var$Checkbox(props, ref) {
|
|
|
174
174
|
...(0, $72alD$reactaria.mergeProps)(inputProps, focusProps),
|
|
175
175
|
ref: inputRef
|
|
176
176
|
})), renderProps.children);
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* A checkbox allows a user to select multiple items from a list of individual items, or
|
|
180
|
-
* to mark one individual item as selected.
|
|
181
|
-
*/ const $e733553516d848a9$export$48513f6b9f8ce62d = /*#__PURE__*/ (0, $72alD$react.forwardRef)($e733553516d848a9$var$Checkbox);
|
|
182
|
-
/**
|
|
183
|
-
* A checkbox group allows a user to select multiple items from a list of options.
|
|
184
|
-
*/ const $e733553516d848a9$export$4aa08d5625cb8ead = /*#__PURE__*/ (0, $72alD$react.forwardRef)($e733553516d848a9$var$CheckboxGroup);
|
|
177
|
+
});
|
|
185
178
|
|
|
186
179
|
|
|
187
180
|
//# sourceMappingURL=Checkbox.main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAqGM,MAAM,0DAAuB,CAAA,GAAA,0BAAY,EAAoD;AAC7F,MAAM,0DAA4B,CAAA,GAAA,0BAAY,EAA6B;AAElF,SAAS,oCAAc,KAAyB,EAAE,GAAiC;IACjF,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,EAAC,oBAAoB,sBAAsB,EAAC,GAAG,CAAA,GAAA,2CAAgB,EAAE,CAAA,GAAA,qCAAU,MAAM,CAAC;QAC7D,2BAAA;IAAzB,IAAI,qBAAqB,CAAA,OAAA,CAAA,4BAAA,MAAM,kBAAkB,cAAxB,uCAAA,4BAA4B,oCAA5B,kBAAA,OAAsD;IAC/E,IAAI,QAAQ,CAAA,GAAA,yCAAoB,EAAE;QAChC,GAAG,KAAK;4BACR;IACF;IACA,IAAI,CAAC,UAAU,MAAM,GAAG,CAAA,GAAA,iCAAM;IAC9B,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,EAA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SAAS,EAAE;IAElB,qBACE,0DAAC;QACE,GAAG,CAAA,GAAA,2BAAS,EAAE,UAAU,YAAY,YAAY,YAAY;QAC7D,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,cAAc;QAC7B,sBAAoB,MAAM,eAAe,IAAI;QAC7C,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,iBAAe,cAAc;QAC7B,iBAAe,cAAc;QAC7B,gBAAc,aAAa;QAC3B,iBAAe,MAAM,UAAU,IAAI;qBACnC,0DAAC,CAAA,GAAA,+BAAa;QAAE,aAAY;qBAC1B,0DAAC;QAAO,GAAG,CAAA,GAAA,2BAAS,EAAE,YAAY,WAAW;QAAE,KAAK;SAErD,YAAY,QAAQ;AAG3B;AAEA;;;CAGC,GACD,MAAM,4CAA0B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB;AAE/D;;CAEC,GACD,MAAM,4CAA+B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB","sources":["packages/react-aria-components/src/Checkbox.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {AriaCheckboxGroupProps, AriaCheckboxProps, HoverEvents, mergeProps, useCheckbox, useCheckboxGroup, useCheckboxGroupItem, useFocusRing, useHover, VisuallyHidden} from 'react-aria';\nimport {CheckboxContext} from './RSPContexts';\nimport {CheckboxGroupState, useCheckboxGroupState, useToggleState} from 'react-stately';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, mergeRefs, useObjectRef} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, forwardRef, useContext} from 'react';\nimport {TextContext} from './Text';\n\nexport interface CheckboxGroupProps extends Omit<AriaCheckboxGroupProps, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<CheckboxGroupRenderProps>, SlotProps {}\nexport interface CheckboxProps extends Omit<AriaCheckboxProps, 'children' | 'validationState' | 'validationBehavior'>, HoverEvents, RACValidation, RenderProps<CheckboxRenderProps>, SlotProps {\n /**\n * A ref for the HTML input element.\n */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\nexport interface CheckboxGroupRenderProps {\n /**\n * Whether the checkbox group is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox group is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox group is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * Whether the checkbox group is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * State of the checkbox group.\n */\n state: CheckboxGroupState\n}\n\nexport interface CheckboxRenderProps {\n /**\n * Whether the checkbox is selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the checkbox is indeterminate.\n * @selector [data-indeterminate]\n */\n isIndeterminate: boolean,\n /**\n * Whether the checkbox is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the checkbox is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the checkbox is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the checkbox is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the checkbox is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the checkbox is required.\n * @selector [data-required]\n */\n isRequired: boolean\n}\n\nexport const CheckboxGroupContext = createContext<ContextValue<CheckboxGroupProps, HTMLDivElement>>(null);\nexport const CheckboxGroupStateContext = createContext<CheckboxGroupState | null>(null);\n\nfunction CheckboxGroup(props: CheckboxGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, CheckboxGroupContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useCheckboxGroupState({\n ...props,\n validationBehavior\n });\n let [labelRef, label] = useSlot();\n let {groupProps, labelProps, descriptionProps, errorMessageProps, ...validation} = useCheckboxGroup({\n ...props,\n label,\n validationBehavior\n }, state);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n isDisabled: state.isDisabled,\n isReadOnly: state.isReadOnly,\n isRequired: props.isRequired || false,\n isInvalid: state.isInvalid,\n state\n },\n defaultClassName: 'react-aria-CheckboxGroup'\n });\n\n return (\n <div\n {...groupProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-readonly={state.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-invalid={state.isInvalid || undefined}\n data-disabled={props.isDisabled || undefined}>\n <Provider\n values={[\n [CheckboxGroupStateContext, state],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n}\n\nfunction Checkbox(props: CheckboxProps, ref: ForwardedRef<HTMLLabelElement>) {\n let {\n inputRef: userProvidedInputRef = null,\n ...otherProps\n } = props;\n [props, ref] = useContextProps(otherProps, ref, CheckboxContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let groupState = useContext(CheckboxGroupStateContext);\n let inputRef = useObjectRef(mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null));\n let {labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed, isInvalid} = groupState\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ? useCheckboxGroupItem({\n ...removeDataAttributes(props),\n // Value is optional for standalone checkboxes, but required for CheckboxGroup items;\n // it's passed explicitly here to avoid typescript error (requires ignore).\n // @ts-ignore\n value: props.value,\n // ReactNode type doesn't allow function children.\n children: typeof props.children === 'function' ? true : props.children\n }, groupState, inputRef)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n : useCheckbox({\n ...removeDataAttributes(props),\n children: typeof props.children === 'function' ? true : props.children,\n validationBehavior\n // eslint-disable-next-line react-hooks/rules-of-hooks\n }, useToggleState(props), inputRef);\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let isInteractionDisabled = isDisabled || isReadOnly;\n\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: isInteractionDisabled\n });\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Checkbox',\n values: {\n isSelected,\n isIndeterminate: props.isIndeterminate || false,\n isPressed,\n isHovered,\n isFocused,\n isFocusVisible,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired: props.isRequired || false\n }\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <label\n {...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-selected={isSelected || undefined}\n data-indeterminate={props.isIndeterminate || undefined}\n data-pressed={isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}\n data-invalid={isInvalid || undefined}\n data-required={props.isRequired || undefined}>\n <VisuallyHidden elementType=\"span\">\n <input {...mergeProps(inputProps, focusProps)} ref={inputRef} />\n </VisuallyHidden>\n {renderProps.children}\n </label>\n );\n}\n\n/**\n * A checkbox allows a user to select multiple items from a list of individual items, or\n * to mark one individual item as selected.\n */\nconst _Checkbox = /*#__PURE__*/ (forwardRef as forwardRefType)(Checkbox);\n\n/**\n * A checkbox group allows a user to select multiple items from a list of options.\n */\nconst _CheckboxGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(CheckboxGroup);\n\nexport {_Checkbox as Checkbox, _CheckboxGroup as CheckboxGroup};\n"],"names":[],"version":3,"file":"Checkbox.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAqGM,MAAM,0DAAuB,CAAA,GAAA,0BAAY,EAAoD;AAC7F,MAAM,0DAA4B,CAAA,GAAA,0BAAY,EAA6B;AAK3E,MAAM,4CAA8B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,cAAc,KAAyB,EAAE,GAAiC;IAC3J,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,EAAC,oBAAoB,sBAAsB,EAAC,GAAG,CAAA,GAAA,2CAAgB,EAAE,CAAA,GAAA,qCAAU,MAAM,CAAC;QAC7D,2BAAA;IAAzB,IAAI,qBAAqB,CAAA,OAAA,CAAA,4BAAA,MAAM,kBAAkB,cAAxB,uCAAA,4BAA4B,oCAA5B,kBAAA,OAAsD;IAC/E,IAAI,QAAQ,CAAA,GAAA,yCAAoB,EAAE;QAChC,GAAG,KAAK;4BACR;IACF;IACA,IAAI,CAAC,UAAU,MAAM,GAAG,CAAA,GAAA,iCAAM;IA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A;uBACA;4BACA;wBACA;wBACA;uBACA;YACA,YAAY,MAAM,UAAU,IAAI;QAClC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE;IAC9B,OAAO,SAAS,EAAE;IAElB,qBACE,0DAAC;QACE,GAAG,CAAA,GAAA,2BAAS,EAAE,UAAU,YAAY,YAAY,YAAY;QAC7D,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,cAAc;QAC7B,sBAAoB,MAAM,eAAe,IAAI;QAC7C,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,iBAAe,cAAc;QAC7B,iBAAe,cAAc;QAC7B,gBAAc,aAAa;QAC3B,iBAAe,MAAM,UAAU,IAAI;qBACnC,0DAAC,CAAA,GAAA,+BAAa;QAAE,aAAY;qBAC1B,0DAAC;QAAO,GAAG,CAAA,GAAA,2BAAS,EAAE,YAAY,WAAW;QAAE,KAAK;SAErD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Checkbox.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {AriaCheckboxGroupProps, AriaCheckboxProps, HoverEvents, mergeProps, useCheckbox, useCheckboxGroup, useCheckboxGroupItem, useFocusRing, useHover, VisuallyHidden} from 'react-aria';\nimport {CheckboxContext} from './RSPContexts';\nimport {CheckboxGroupState, useCheckboxGroupState, useToggleState} from 'react-stately';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, mergeRefs, useObjectRef} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, forwardRef, useContext} from 'react';\nimport {TextContext} from './Text';\n\nexport interface CheckboxGroupProps extends Omit<AriaCheckboxGroupProps, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<CheckboxGroupRenderProps>, SlotProps {}\nexport interface CheckboxProps extends Omit<AriaCheckboxProps, 'children' | 'validationState' | 'validationBehavior'>, HoverEvents, RACValidation, RenderProps<CheckboxRenderProps>, SlotProps {\n /**\n * A ref for the HTML input element.\n */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\nexport interface CheckboxGroupRenderProps {\n /**\n * Whether the checkbox group is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox group is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox group is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * Whether the checkbox group is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * State of the checkbox group.\n */\n state: CheckboxGroupState\n}\n\nexport interface CheckboxRenderProps {\n /**\n * Whether the checkbox is selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the checkbox is indeterminate.\n * @selector [data-indeterminate]\n */\n isIndeterminate: boolean,\n /**\n * Whether the checkbox is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the checkbox is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the checkbox is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the checkbox is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the checkbox is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the checkbox is required.\n * @selector [data-required]\n */\n isRequired: boolean\n}\n\nexport const CheckboxGroupContext = createContext<ContextValue<CheckboxGroupProps, HTMLDivElement>>(null);\nexport const CheckboxGroupStateContext = createContext<CheckboxGroupState | null>(null);\n\n/**\n * A checkbox group allows a user to select multiple items from a list of options.\n */\nexport const CheckboxGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(function CheckboxGroup(props: CheckboxGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, CheckboxGroupContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useCheckboxGroupState({\n ...props,\n validationBehavior\n });\n let [labelRef, label] = useSlot();\n let {groupProps, labelProps, descriptionProps, errorMessageProps, ...validation} = useCheckboxGroup({\n ...props,\n label,\n validationBehavior\n }, state);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n isDisabled: state.isDisabled,\n isReadOnly: state.isReadOnly,\n isRequired: props.isRequired || false,\n isInvalid: state.isInvalid,\n state\n },\n defaultClassName: 'react-aria-CheckboxGroup'\n });\n\n return (\n <div\n {...groupProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-readonly={state.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-invalid={state.isInvalid || undefined}\n data-disabled={props.isDisabled || undefined}>\n <Provider\n values={[\n [CheckboxGroupStateContext, state],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n});\n\n/**\n * A checkbox allows a user to select multiple items from a list of individual items, or\n * to mark one individual item as selected.\n */\nexport const Checkbox = /*#__PURE__*/ (forwardRef as forwardRefType)(function Checkbox(props: CheckboxProps, ref: ForwardedRef<HTMLLabelElement>) {\n let {\n inputRef: userProvidedInputRef = null,\n ...otherProps\n } = props;\n [props, ref] = useContextProps(otherProps, ref, CheckboxContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let groupState = useContext(CheckboxGroupStateContext);\n let inputRef = useObjectRef(mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null));\n let {labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed, isInvalid} = groupState\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ? useCheckboxGroupItem({\n ...removeDataAttributes(props),\n // Value is optional for standalone checkboxes, but required for CheckboxGroup items;\n // it's passed explicitly here to avoid typescript error (requires ignore).\n // @ts-ignore\n value: props.value,\n // ReactNode type doesn't allow function children.\n children: typeof props.children === 'function' ? true : props.children\n }, groupState, inputRef)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n : useCheckbox({\n ...removeDataAttributes(props),\n children: typeof props.children === 'function' ? true : props.children,\n validationBehavior\n // eslint-disable-next-line react-hooks/rules-of-hooks\n }, useToggleState(props), inputRef);\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let isInteractionDisabled = isDisabled || isReadOnly;\n\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: isInteractionDisabled\n });\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Checkbox',\n values: {\n isSelected,\n isIndeterminate: props.isIndeterminate || false,\n isPressed,\n isHovered,\n isFocused,\n isFocusVisible,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired: props.isRequired || false\n }\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <label\n {...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-selected={isSelected || undefined}\n data-indeterminate={props.isIndeterminate || undefined}\n data-pressed={isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}\n data-invalid={isInvalid || undefined}\n data-required={props.isRequired || undefined}>\n <VisuallyHidden elementType=\"span\">\n <input {...mergeProps(inputProps, focusProps)} ref={inputRef} />\n </VisuallyHidden>\n {renderProps.children}\n </label>\n );\n});\n"],"names":[],"version":3,"file":"Checkbox.main.js.map"}
|
package/dist/Checkbox.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {TextContext as $514c0188e459b4c0$export$9afb8bc826b033ea} from "./Text.m
|
|
|
7
7
|
import {useCheckboxGroup as $kPH7g$useCheckboxGroup, useCheckboxGroupItem as $kPH7g$useCheckboxGroupItem, useCheckbox as $kPH7g$useCheckbox, useFocusRing as $kPH7g$useFocusRing, useHover as $kPH7g$useHover, mergeProps as $kPH7g$mergeProps, VisuallyHidden as $kPH7g$VisuallyHidden} from "react-aria";
|
|
8
8
|
import {useCheckboxGroupState as $kPH7g$useCheckboxGroupState, useToggleState as $kPH7g$useToggleState} from "react-stately";
|
|
9
9
|
import {useObjectRef as $kPH7g$useObjectRef, mergeRefs as $kPH7g$mergeRefs, filterDOMProps as $kPH7g$filterDOMProps} from "@react-aria/utils";
|
|
10
|
-
import $kPH7g$react, {createContext as $kPH7g$createContext,
|
|
10
|
+
import $kPH7g$react, {createContext as $kPH7g$createContext, forwardRef as $kPH7g$forwardRef, useContext as $kPH7g$useContext} from "react";
|
|
11
11
|
|
|
12
12
|
/*
|
|
13
13
|
* Copyright 2022 Adobe. All rights reserved.
|
|
@@ -31,7 +31,7 @@ import $kPH7g$react, {createContext as $kPH7g$createContext, useContext as $kPH7
|
|
|
31
31
|
|
|
32
32
|
const $bc237834342dbd75$export$baf37c4be89255b8 = /*#__PURE__*/ (0, $kPH7g$createContext)(null);
|
|
33
33
|
const $bc237834342dbd75$export$139c5b8563afc1fc = /*#__PURE__*/ (0, $kPH7g$createContext)(null);
|
|
34
|
-
|
|
34
|
+
const $bc237834342dbd75$export$4aa08d5625cb8ead = /*#__PURE__*/ (0, $kPH7g$forwardRef)(function CheckboxGroup(props, ref) {
|
|
35
35
|
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $bc237834342dbd75$export$baf37c4be89255b8);
|
|
36
36
|
let { validationBehavior: formValidationBehavior } = (0, $64fa3d84918910a7$export$fabf2dc03a41866e)((0, $d3e0e05bdfcf66bd$export$c24727297075ec6a)) || {};
|
|
37
37
|
var _props_validationBehavior, _ref;
|
|
@@ -95,8 +95,8 @@ function $bc237834342dbd75$var$CheckboxGroup(props, ref) {
|
|
|
95
95
|
]
|
|
96
96
|
]
|
|
97
97
|
}, renderProps.children));
|
|
98
|
-
}
|
|
99
|
-
|
|
98
|
+
});
|
|
99
|
+
const $bc237834342dbd75$export$48513f6b9f8ce62d = /*#__PURE__*/ (0, $kPH7g$forwardRef)(function Checkbox(props, ref) {
|
|
100
100
|
let { inputRef: userProvidedInputRef = null, ...otherProps } = props;
|
|
101
101
|
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(otherProps, ref, (0, $4e85f108e88277b8$export$b085522c77523c51));
|
|
102
102
|
let { validationBehavior: formValidationBehavior } = (0, $64fa3d84918910a7$export$fabf2dc03a41866e)((0, $d3e0e05bdfcf66bd$export$c24727297075ec6a)) || {};
|
|
@@ -161,15 +161,8 @@ function $bc237834342dbd75$var$Checkbox(props, ref) {
|
|
|
161
161
|
...(0, $kPH7g$mergeProps)(inputProps, focusProps),
|
|
162
162
|
ref: inputRef
|
|
163
163
|
})), renderProps.children);
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* A checkbox allows a user to select multiple items from a list of individual items, or
|
|
167
|
-
* to mark one individual item as selected.
|
|
168
|
-
*/ const $bc237834342dbd75$export$48513f6b9f8ce62d = /*#__PURE__*/ (0, $kPH7g$forwardRef)($bc237834342dbd75$var$Checkbox);
|
|
169
|
-
/**
|
|
170
|
-
* A checkbox group allows a user to select multiple items from a list of options.
|
|
171
|
-
*/ const $bc237834342dbd75$export$4aa08d5625cb8ead = /*#__PURE__*/ (0, $kPH7g$forwardRef)($bc237834342dbd75$var$CheckboxGroup);
|
|
164
|
+
});
|
|
172
165
|
|
|
173
166
|
|
|
174
|
-
export {$bc237834342dbd75$export$baf37c4be89255b8 as CheckboxGroupContext, $bc237834342dbd75$export$139c5b8563afc1fc as CheckboxGroupStateContext, $bc237834342dbd75$export$
|
|
167
|
+
export {$bc237834342dbd75$export$baf37c4be89255b8 as CheckboxGroupContext, $bc237834342dbd75$export$139c5b8563afc1fc as CheckboxGroupStateContext, $bc237834342dbd75$export$4aa08d5625cb8ead as CheckboxGroup, $bc237834342dbd75$export$48513f6b9f8ce62d as Checkbox};
|
|
175
168
|
//# sourceMappingURL=Checkbox.module.js.map
|
package/dist/Checkbox.module.js
CHANGED
|
@@ -7,7 +7,7 @@ import {TextContext as $514c0188e459b4c0$export$9afb8bc826b033ea} from "./Text.m
|
|
|
7
7
|
import {useCheckboxGroup as $kPH7g$useCheckboxGroup, useCheckboxGroupItem as $kPH7g$useCheckboxGroupItem, useCheckbox as $kPH7g$useCheckbox, useFocusRing as $kPH7g$useFocusRing, useHover as $kPH7g$useHover, mergeProps as $kPH7g$mergeProps, VisuallyHidden as $kPH7g$VisuallyHidden} from "react-aria";
|
|
8
8
|
import {useCheckboxGroupState as $kPH7g$useCheckboxGroupState, useToggleState as $kPH7g$useToggleState} from "react-stately";
|
|
9
9
|
import {useObjectRef as $kPH7g$useObjectRef, mergeRefs as $kPH7g$mergeRefs, filterDOMProps as $kPH7g$filterDOMProps} from "@react-aria/utils";
|
|
10
|
-
import $kPH7g$react, {createContext as $kPH7g$createContext,
|
|
10
|
+
import $kPH7g$react, {createContext as $kPH7g$createContext, forwardRef as $kPH7g$forwardRef, useContext as $kPH7g$useContext} from "react";
|
|
11
11
|
|
|
12
12
|
/*
|
|
13
13
|
* Copyright 2022 Adobe. All rights reserved.
|
|
@@ -31,7 +31,7 @@ import $kPH7g$react, {createContext as $kPH7g$createContext, useContext as $kPH7
|
|
|
31
31
|
|
|
32
32
|
const $bc237834342dbd75$export$baf37c4be89255b8 = /*#__PURE__*/ (0, $kPH7g$createContext)(null);
|
|
33
33
|
const $bc237834342dbd75$export$139c5b8563afc1fc = /*#__PURE__*/ (0, $kPH7g$createContext)(null);
|
|
34
|
-
|
|
34
|
+
const $bc237834342dbd75$export$4aa08d5625cb8ead = /*#__PURE__*/ (0, $kPH7g$forwardRef)(function CheckboxGroup(props, ref) {
|
|
35
35
|
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $bc237834342dbd75$export$baf37c4be89255b8);
|
|
36
36
|
let { validationBehavior: formValidationBehavior } = (0, $64fa3d84918910a7$export$fabf2dc03a41866e)((0, $d3e0e05bdfcf66bd$export$c24727297075ec6a)) || {};
|
|
37
37
|
var _props_validationBehavior, _ref;
|
|
@@ -95,8 +95,8 @@ function $bc237834342dbd75$var$CheckboxGroup(props, ref) {
|
|
|
95
95
|
]
|
|
96
96
|
]
|
|
97
97
|
}, renderProps.children));
|
|
98
|
-
}
|
|
99
|
-
|
|
98
|
+
});
|
|
99
|
+
const $bc237834342dbd75$export$48513f6b9f8ce62d = /*#__PURE__*/ (0, $kPH7g$forwardRef)(function Checkbox(props, ref) {
|
|
100
100
|
let { inputRef: userProvidedInputRef = null, ...otherProps } = props;
|
|
101
101
|
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(otherProps, ref, (0, $4e85f108e88277b8$export$b085522c77523c51));
|
|
102
102
|
let { validationBehavior: formValidationBehavior } = (0, $64fa3d84918910a7$export$fabf2dc03a41866e)((0, $d3e0e05bdfcf66bd$export$c24727297075ec6a)) || {};
|
|
@@ -161,15 +161,8 @@ function $bc237834342dbd75$var$Checkbox(props, ref) {
|
|
|
161
161
|
...(0, $kPH7g$mergeProps)(inputProps, focusProps),
|
|
162
162
|
ref: inputRef
|
|
163
163
|
})), renderProps.children);
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* A checkbox allows a user to select multiple items from a list of individual items, or
|
|
167
|
-
* to mark one individual item as selected.
|
|
168
|
-
*/ const $bc237834342dbd75$export$48513f6b9f8ce62d = /*#__PURE__*/ (0, $kPH7g$forwardRef)($bc237834342dbd75$var$Checkbox);
|
|
169
|
-
/**
|
|
170
|
-
* A checkbox group allows a user to select multiple items from a list of options.
|
|
171
|
-
*/ const $bc237834342dbd75$export$4aa08d5625cb8ead = /*#__PURE__*/ (0, $kPH7g$forwardRef)($bc237834342dbd75$var$CheckboxGroup);
|
|
164
|
+
});
|
|
172
165
|
|
|
173
166
|
|
|
174
|
-
export {$bc237834342dbd75$export$baf37c4be89255b8 as CheckboxGroupContext, $bc237834342dbd75$export$139c5b8563afc1fc as CheckboxGroupStateContext, $bc237834342dbd75$export$
|
|
167
|
+
export {$bc237834342dbd75$export$baf37c4be89255b8 as CheckboxGroupContext, $bc237834342dbd75$export$139c5b8563afc1fc as CheckboxGroupStateContext, $bc237834342dbd75$export$4aa08d5625cb8ead as CheckboxGroup, $bc237834342dbd75$export$48513f6b9f8ce62d as Checkbox};
|
|
175
168
|
//# sourceMappingURL=Checkbox.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAqGM,MAAM,0DAAuB,CAAA,GAAA,oBAAY,EAAoD;AAC7F,MAAM,0DAA4B,CAAA,GAAA,oBAAY,EAA6B;AAElF,SAAS,oCAAc,KAAyB,EAAE,GAAiC;IACjF,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,EAAC,oBAAoB,sB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zD,IAAI,wBAAwB,cAAc;IAE1C,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QACrC,GAAG,KAAK;QACR,YAAY;IACd;IAEA,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;wBACN;YACA,iBAAiB,MAAM,eAAe,IAAI;uBAC1C;uBACA;uBACA;4BACA;wBACA;wBACA;uBACA;YACA,YAAY,MAAM,UAAU,IAAI;QAClC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE;IAC9B,OAAO,SAAS,EAAE;IAElB,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,YAAY,YAAY,YAAY;QAC7D,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,cAAc;QAC7B,sBAAoB,MAAM,eAAe,IAAI;QAC7C,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,iBAAe,cAAc;QAC7B,iBAAe,cAAc;QAC7B,gBAAc,aAAa;QAC3B,iBAAe,MAAM,UAAU,IAAI;qBACnC,gCAAC,CAAA,GAAA,qBAAa;QAAE,aAAY;qBAC1B,gCAAC;QAAO,GAAG,CAAA,GAAA,iBAAS,EAAE,YAAY,WAAW;QAAE,KAAK;SAErD,YAAY,QAAQ;AAG3B;AAEA;;;CAGC,GACD,MAAM,4CAA0B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB;AAE/D;;CAEC,GACD,MAAM,4CAA+B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB","sources":["packages/react-aria-components/src/Checkbox.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {AriaCheckboxGroupProps, AriaCheckboxProps, HoverEvents, mergeProps, useCheckbox, useCheckboxGroup, useCheckboxGroupItem, useFocusRing, useHover, VisuallyHidden} from 'react-aria';\nimport {CheckboxContext} from './RSPContexts';\nimport {CheckboxGroupState, useCheckboxGroupState, useToggleState} from 'react-stately';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, mergeRefs, useObjectRef} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, forwardRef, useContext} from 'react';\nimport {TextContext} from './Text';\n\nexport interface CheckboxGroupProps extends Omit<AriaCheckboxGroupProps, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<CheckboxGroupRenderProps>, SlotProps {}\nexport interface CheckboxProps extends Omit<AriaCheckboxProps, 'children' | 'validationState' | 'validationBehavior'>, HoverEvents, RACValidation, RenderProps<CheckboxRenderProps>, SlotProps {\n /**\n * A ref for the HTML input element.\n */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\nexport interface CheckboxGroupRenderProps {\n /**\n * Whether the checkbox group is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox group is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox group is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * Whether the checkbox group is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * State of the checkbox group.\n */\n state: CheckboxGroupState\n}\n\nexport interface CheckboxRenderProps {\n /**\n * Whether the checkbox is selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the checkbox is indeterminate.\n * @selector [data-indeterminate]\n */\n isIndeterminate: boolean,\n /**\n * Whether the checkbox is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the checkbox is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the checkbox is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the checkbox is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the checkbox is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the checkbox is required.\n * @selector [data-required]\n */\n isRequired: boolean\n}\n\nexport const CheckboxGroupContext = createContext<ContextValue<CheckboxGroupProps, HTMLDivElement>>(null);\nexport const CheckboxGroupStateContext = createContext<CheckboxGroupState | null>(null);\n\nfunction CheckboxGroup(props: CheckboxGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, CheckboxGroupContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useCheckboxGroupState({\n ...props,\n validationBehavior\n });\n let [labelRef, label] = useSlot();\n let {groupProps, labelProps, descriptionProps, errorMessageProps, ...validation} = useCheckboxGroup({\n ...props,\n label,\n validationBehavior\n }, state);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n isDisabled: state.isDisabled,\n isReadOnly: state.isReadOnly,\n isRequired: props.isRequired || false,\n isInvalid: state.isInvalid,\n state\n },\n defaultClassName: 'react-aria-CheckboxGroup'\n });\n\n return (\n <div\n {...groupProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-readonly={state.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-invalid={state.isInvalid || undefined}\n data-disabled={props.isDisabled || undefined}>\n <Provider\n values={[\n [CheckboxGroupStateContext, state],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n}\n\nfunction Checkbox(props: CheckboxProps, ref: ForwardedRef<HTMLLabelElement>) {\n let {\n inputRef: userProvidedInputRef = null,\n ...otherProps\n } = props;\n [props, ref] = useContextProps(otherProps, ref, CheckboxContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let groupState = useContext(CheckboxGroupStateContext);\n let inputRef = useObjectRef(mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null));\n let {labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed, isInvalid} = groupState\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ? useCheckboxGroupItem({\n ...removeDataAttributes(props),\n // Value is optional for standalone checkboxes, but required for CheckboxGroup items;\n // it's passed explicitly here to avoid typescript error (requires ignore).\n // @ts-ignore\n value: props.value,\n // ReactNode type doesn't allow function children.\n children: typeof props.children === 'function' ? true : props.children\n }, groupState, inputRef)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n : useCheckbox({\n ...removeDataAttributes(props),\n children: typeof props.children === 'function' ? true : props.children,\n validationBehavior\n // eslint-disable-next-line react-hooks/rules-of-hooks\n }, useToggleState(props), inputRef);\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let isInteractionDisabled = isDisabled || isReadOnly;\n\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: isInteractionDisabled\n });\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Checkbox',\n values: {\n isSelected,\n isIndeterminate: props.isIndeterminate || false,\n isPressed,\n isHovered,\n isFocused,\n isFocusVisible,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired: props.isRequired || false\n }\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <label\n {...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-selected={isSelected || undefined}\n data-indeterminate={props.isIndeterminate || undefined}\n data-pressed={isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}\n data-invalid={isInvalid || undefined}\n data-required={props.isRequired || undefined}>\n <VisuallyHidden elementType=\"span\">\n <input {...mergeProps(inputProps, focusProps)} ref={inputRef} />\n </VisuallyHidden>\n {renderProps.children}\n </label>\n );\n}\n\n/**\n * A checkbox allows a user to select multiple items from a list of individual items, or\n * to mark one individual item as selected.\n */\nconst _Checkbox = /*#__PURE__*/ (forwardRef as forwardRefType)(Checkbox);\n\n/**\n * A checkbox group allows a user to select multiple items from a list of options.\n */\nconst _CheckboxGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(CheckboxGroup);\n\nexport {_Checkbox as Checkbox, _CheckboxGroup as CheckboxGroup};\n"],"names":[],"version":3,"file":"Checkbox.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAqGM,MAAM,0DAAuB,CAAA,GAAA,oBAAY,EAAoD;AAC7F,MAAM,0DAA4B,CAAA,GAAA,oBAAY,EAA6B;AAK3E,MAAM,4CAA8B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,cAAc,KAAyB,EAAE,GAAiC;IAC3J,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yC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,GAAA,qBAAa,EAAE,QAAQ;IAC5B,IAAI,aAAC,SAAS,kBAAE,cAAc,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,mBAAW;IACzD,IAAI,wBAAwB,cAAc;IAE1C,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QACrC,GAAG,KAAK;QACR,YAAY;IACd;IAEA,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;wBACN;YACA,iBAAiB,MAAM,eAAe,IAAI;uBAC1C;uBACA;uBACA;4BACA;wBACA;wBACA;uBACA;YACA,YAAY,MAAM,UAAU,IAAI;QAClC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE;IAC9B,OAAO,SAAS,EAAE;IAElB,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,YAAY,YAAY,YAAY;QAC7D,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,cAAc;QAC7B,sBAAoB,MAAM,eAAe,IAAI;QAC7C,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,iBAAe,cAAc;QAC7B,iBAAe,cAAc;QAC7B,gBAAc,aAAa;QAC3B,iBAAe,MAAM,UAAU,IAAI;qBACnC,gCAAC,CAAA,GAAA,qBAAa;QAAE,aAAY;qBAC1B,gCAAC;QAAO,GAAG,CAAA,GAAA,iBAAS,EAAE,YAAY,WAAW;QAAE,KAAK;SAErD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Checkbox.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {AriaCheckboxGroupProps, AriaCheckboxProps, HoverEvents, mergeProps, useCheckbox, useCheckboxGroup, useCheckboxGroupItem, useFocusRing, useHover, VisuallyHidden} from 'react-aria';\nimport {CheckboxContext} from './RSPContexts';\nimport {CheckboxGroupState, useCheckboxGroupState, useToggleState} from 'react-stately';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, mergeRefs, useObjectRef} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, forwardRef, useContext} from 'react';\nimport {TextContext} from './Text';\n\nexport interface CheckboxGroupProps extends Omit<AriaCheckboxGroupProps, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<CheckboxGroupRenderProps>, SlotProps {}\nexport interface CheckboxProps extends Omit<AriaCheckboxProps, 'children' | 'validationState' | 'validationBehavior'>, HoverEvents, RACValidation, RenderProps<CheckboxRenderProps>, SlotProps {\n /**\n * A ref for the HTML input element.\n */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\nexport interface CheckboxGroupRenderProps {\n /**\n * Whether the checkbox group is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox group is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox group is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * Whether the checkbox group is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * State of the checkbox group.\n */\n state: CheckboxGroupState\n}\n\nexport interface CheckboxRenderProps {\n /**\n * Whether the checkbox is selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the checkbox is indeterminate.\n * @selector [data-indeterminate]\n */\n isIndeterminate: boolean,\n /**\n * Whether the checkbox is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the checkbox is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the checkbox is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the checkbox is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the checkbox is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the checkbox is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the checkbox invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the checkbox is required.\n * @selector [data-required]\n */\n isRequired: boolean\n}\n\nexport const CheckboxGroupContext = createContext<ContextValue<CheckboxGroupProps, HTMLDivElement>>(null);\nexport const CheckboxGroupStateContext = createContext<CheckboxGroupState | null>(null);\n\n/**\n * A checkbox group allows a user to select multiple items from a list of options.\n */\nexport const CheckboxGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(function CheckboxGroup(props: CheckboxGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, CheckboxGroupContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useCheckboxGroupState({\n ...props,\n validationBehavior\n });\n let [labelRef, label] = useSlot();\n let {groupProps, labelProps, descriptionProps, errorMessageProps, ...validation} = useCheckboxGroup({\n ...props,\n label,\n validationBehavior\n }, state);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n isDisabled: state.isDisabled,\n isReadOnly: state.isReadOnly,\n isRequired: props.isRequired || false,\n isInvalid: state.isInvalid,\n state\n },\n defaultClassName: 'react-aria-CheckboxGroup'\n });\n\n return (\n <div\n {...groupProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-readonly={state.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-invalid={state.isInvalid || undefined}\n data-disabled={props.isDisabled || undefined}>\n <Provider\n values={[\n [CheckboxGroupStateContext, state],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n});\n\n/**\n * A checkbox allows a user to select multiple items from a list of individual items, or\n * to mark one individual item as selected.\n */\nexport const Checkbox = /*#__PURE__*/ (forwardRef as forwardRefType)(function Checkbox(props: CheckboxProps, ref: ForwardedRef<HTMLLabelElement>) {\n let {\n inputRef: userProvidedInputRef = null,\n ...otherProps\n } = props;\n [props, ref] = useContextProps(otherProps, ref, CheckboxContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let groupState = useContext(CheckboxGroupStateContext);\n let inputRef = useObjectRef(mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null));\n let {labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed, isInvalid} = groupState\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ? useCheckboxGroupItem({\n ...removeDataAttributes(props),\n // Value is optional for standalone checkboxes, but required for CheckboxGroup items;\n // it's passed explicitly here to avoid typescript error (requires ignore).\n // @ts-ignore\n value: props.value,\n // ReactNode type doesn't allow function children.\n children: typeof props.children === 'function' ? true : props.children\n }, groupState, inputRef)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n : useCheckbox({\n ...removeDataAttributes(props),\n children: typeof props.children === 'function' ? true : props.children,\n validationBehavior\n // eslint-disable-next-line react-hooks/rules-of-hooks\n }, useToggleState(props), inputRef);\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let isInteractionDisabled = isDisabled || isReadOnly;\n\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: isInteractionDisabled\n });\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Checkbox',\n values: {\n isSelected,\n isIndeterminate: props.isIndeterminate || false,\n isPressed,\n isHovered,\n isFocused,\n isFocusVisible,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired: props.isRequired || false\n }\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <label\n {...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-selected={isSelected || undefined}\n data-indeterminate={props.isIndeterminate || undefined}\n data-pressed={isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}\n data-invalid={isInvalid || undefined}\n data-required={props.isRequired || undefined}>\n <VisuallyHidden elementType=\"span\">\n <input {...mergeProps(inputProps, focusProps)} ref={inputRef} />\n </VisuallyHidden>\n {renderProps.children}\n </label>\n );\n});\n"],"names":[],"version":3,"file":"Checkbox.module.js.map"}
|
package/dist/ColorArea.main.js
CHANGED
|
@@ -25,7 +25,7 @@ $parcel$export(module.exports, "ColorArea", () => $4b8ff932b8d77df7$export$b2103
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
const $4b8ff932b8d77df7$export$6b32221de49982e = /*#__PURE__*/ (0, $hLuah$react.createContext)(null);
|
|
28
|
-
|
|
28
|
+
const $4b8ff932b8d77df7$export$b2103f68a961418e = /*#__PURE__*/ (0, $hLuah$react.forwardRef)(function ColorArea(props, ref) {
|
|
29
29
|
[props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, (0, $525402dfec7da5bc$exports.ColorAreaContext));
|
|
30
30
|
let inputXRef = (0, $hLuah$react.useRef)(null);
|
|
31
31
|
let inputYRef = (0, $hLuah$react.useRef)(null);
|
|
@@ -74,10 +74,7 @@ function $4b8ff932b8d77df7$var$ColorArea(props, ref) {
|
|
|
74
74
|
]
|
|
75
75
|
]
|
|
76
76
|
}, renderProps.children));
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* A color area allows users to adjust two channels of an RGB, HSL or HSB color value against a two-dimensional gradient background.
|
|
80
|
-
*/ const $4b8ff932b8d77df7$export$b2103f68a961418e = /*#__PURE__*/ (0, $hLuah$react.forwardRef)($4b8ff932b8d77df7$var$ColorArea);
|
|
77
|
+
});
|
|
81
78
|
|
|
82
79
|
|
|
83
80
|
//# sourceMappingURL=ColorArea.main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,MAAM,yDAAwB,CAAA,GAAA,0BAAY,EAAyB;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,MAAM,yDAAwB,CAAA,GAAA,0BAAY,EAAyB;AAKnE,MAAM,0DAAY,CAAA,GAAA,uBAAS,EAAE,SAAS,UAAU,KAAqB,EAAE,GAAiC;IAC7G,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK,CAAA,GAAA,0CAAe;IAC1D,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IACvB,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IAEvB,IAAI,QAAQ,CAAA,GAAA,0CAAgB,EAAE;IAC9B,IAAI,kBACF,cAAc,eACd,WAAW,eACX,WAAW,cACX,UAAU,EACX,GAAG,CAAA,GAAA,kCAAW,EAAE;QACf,GAAG,KAAK;mBACR;mBACA;QACA,cAAc;IAChB,GAAG;IAEH,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,cAAc,eAAe,KAAK;QAClC,QAAQ;mBACN;YACA,YAAY,MAAM,UAAU,IAAI;QAClC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE;IAC9B,OAAO,SAAS,EAAE;IAElB,qBACE,0DAAC;QACC,KAAK;QACJ,GAAG,cAAc;QACjB,GAAG,QAAQ;QACX,GAAG,WAAW;QACf,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,MAAM,UAAU,IAAI;qBACnC,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC;gBAAuB;aAAM;YAC9B;gBAAC,CAAA,GAAA,mDAAwB;gBAAG;2BAAC;gCAAO;+BAAY;iCAAW;+BAAa;iCAAW;oBAAa,YAAY,MAAM,UAAU;gBAAA;aAAE;SAC/H;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/ColorArea.tsx"],"sourcesContent":["import {AriaColorAreaProps} from '@react-types/color';\nimport {ColorAreaContext} from './RSPContexts';\nimport {ColorAreaState, useColorAreaState} from '@react-stately/color';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {InternalColorThumbContext} from './ColorThumb';\nimport {Provider, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\nimport {useColorArea} from '@react-aria/color';\n\nexport interface ColorAreaRenderProps {\n /**\n * Whether the color area is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * State of the color area.\n */\n state: ColorAreaState\n}\n\nexport interface ColorAreaProps extends AriaColorAreaProps, RenderProps<ColorAreaRenderProps>, SlotProps {}\n\nexport const ColorAreaStateContext = createContext<ColorAreaState | null>(null);\n\n/**\n * A color area allows users to adjust two channels of an RGB, HSL or HSB color value against a two-dimensional gradient background.\n */\nexport const ColorArea = forwardRef(function ColorArea(props: ColorAreaProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ColorAreaContext);\n let inputXRef = useRef(null);\n let inputYRef = useRef(null);\n\n let state = useColorAreaState(props);\n let {\n colorAreaProps,\n xInputProps,\n yInputProps,\n thumbProps\n } = useColorArea({\n ...props,\n inputXRef,\n inputYRef,\n containerRef: ref\n }, state);\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ColorArea',\n defaultStyle: colorAreaProps.style,\n values: {\n state,\n isDisabled: props.isDisabled || false\n }\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <div\n ref={ref}\n {...colorAreaProps}\n {...DOMProps}\n {...renderProps}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}>\n <Provider\n values={[\n [ColorAreaStateContext, state],\n [InternalColorThumbContext, {state, thumbProps, inputXRef, xInputProps, inputYRef, yInputProps, isDisabled: props.isDisabled}]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ColorArea.main.js.map"}
|