react-aria-components 1.17.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/Autocomplete.cjs.map +1 -1
- package/dist/exports/Autocomplete.js.map +1 -1
- package/dist/exports/Autocomplete.mjs.map +1 -1
- package/dist/exports/Calendar.cjs +3 -0
- package/dist/exports/Calendar.cjs.map +1 -1
- package/dist/exports/Calendar.js +2 -2
- package/dist/exports/Calendar.js.map +1 -1
- package/dist/exports/Calendar.mjs +2 -2
- package/dist/exports/Calendar.mjs.map +1 -1
- package/dist/exports/Checkbox.cjs +8 -0
- package/dist/exports/Checkbox.cjs.map +1 -1
- package/dist/exports/Checkbox.js +6 -2
- package/dist/exports/Checkbox.js.map +1 -1
- package/dist/exports/Checkbox.mjs +6 -2
- package/dist/exports/Checkbox.mjs.map +1 -1
- package/dist/exports/CheckboxGroup.cjs.map +1 -1
- package/dist/exports/CheckboxGroup.js.map +1 -1
- package/dist/exports/CheckboxGroup.mjs.map +1 -1
- package/dist/exports/CollectionBuilder.cjs.map +1 -1
- package/dist/exports/CollectionBuilder.js.map +1 -1
- package/dist/exports/CollectionBuilder.mjs.map +1 -1
- package/dist/exports/ColorArea.cjs.map +1 -1
- package/dist/exports/ColorArea.js.map +1 -1
- package/dist/exports/ColorArea.mjs.map +1 -1
- package/dist/exports/ColorField.cjs.map +1 -1
- package/dist/exports/ColorField.js.map +1 -1
- package/dist/exports/ColorField.mjs.map +1 -1
- package/dist/exports/ColorPicker.cjs.map +1 -1
- package/dist/exports/ColorPicker.js.map +1 -1
- package/dist/exports/ColorPicker.mjs.map +1 -1
- package/dist/exports/ColorSlider.cjs.map +1 -1
- package/dist/exports/ColorSlider.js.map +1 -1
- package/dist/exports/ColorSlider.mjs.map +1 -1
- package/dist/exports/ColorSwatch.cjs.map +1 -1
- package/dist/exports/ColorSwatch.js.map +1 -1
- package/dist/exports/ColorSwatch.mjs.map +1 -1
- package/dist/exports/ColorSwatchPicker.cjs.map +1 -1
- package/dist/exports/ColorSwatchPicker.js.map +1 -1
- package/dist/exports/ColorSwatchPicker.mjs.map +1 -1
- package/dist/exports/ColorThumb.cjs.map +1 -1
- package/dist/exports/ColorThumb.js.map +1 -1
- package/dist/exports/ColorThumb.mjs.map +1 -1
- package/dist/exports/ColorWheel.cjs.map +1 -1
- package/dist/exports/ColorWheel.js.map +1 -1
- package/dist/exports/ColorWheel.mjs.map +1 -1
- package/dist/exports/ComboBox.cjs.map +1 -1
- package/dist/exports/ComboBox.js.map +1 -1
- package/dist/exports/ComboBox.mjs.map +1 -1
- package/dist/exports/DateField.cjs.map +1 -1
- package/dist/exports/DateField.js.map +1 -1
- package/dist/exports/DateField.mjs.map +1 -1
- package/dist/exports/DatePicker.cjs.map +1 -1
- package/dist/exports/DatePicker.js.map +1 -1
- package/dist/exports/DatePicker.mjs.map +1 -1
- package/dist/exports/DateRangePicker.cjs.map +1 -1
- package/dist/exports/DateRangePicker.js.map +1 -1
- package/dist/exports/DateRangePicker.mjs.map +1 -1
- package/dist/exports/Disclosure.cjs.map +1 -1
- package/dist/exports/Disclosure.js.map +1 -1
- package/dist/exports/Disclosure.mjs.map +1 -1
- package/dist/exports/DisclosureGroup.cjs.map +1 -1
- package/dist/exports/DisclosureGroup.js.map +1 -1
- package/dist/exports/DisclosureGroup.mjs.map +1 -1
- package/dist/exports/GridList.cjs.map +1 -1
- package/dist/exports/GridList.js.map +1 -1
- package/dist/exports/GridList.mjs.map +1 -1
- package/dist/exports/ListBox.cjs.map +1 -1
- package/dist/exports/ListBox.js.map +1 -1
- package/dist/exports/ListBox.mjs.map +1 -1
- package/dist/exports/Menu.cjs.map +1 -1
- package/dist/exports/Menu.js.map +1 -1
- package/dist/exports/Menu.mjs.map +1 -1
- package/dist/exports/RadioGroup.cjs +3 -0
- package/dist/exports/RadioGroup.cjs.map +1 -1
- package/dist/exports/RadioGroup.js +2 -2
- package/dist/exports/RadioGroup.js.map +1 -1
- package/dist/exports/RadioGroup.mjs +2 -2
- package/dist/exports/RadioGroup.mjs.map +1 -1
- package/dist/exports/RangeCalendar.cjs +3 -0
- package/dist/exports/RangeCalendar.cjs.map +1 -1
- package/dist/exports/RangeCalendar.js +2 -2
- package/dist/exports/RangeCalendar.js.map +1 -1
- package/dist/exports/RangeCalendar.mjs +2 -2
- package/dist/exports/RangeCalendar.mjs.map +1 -1
- package/dist/exports/Select.cjs.map +1 -1
- package/dist/exports/Select.js.map +1 -1
- package/dist/exports/Select.mjs.map +1 -1
- package/dist/exports/SharedElementTransition.cjs.map +1 -1
- package/dist/exports/SharedElementTransition.js.map +1 -1
- package/dist/exports/SharedElementTransition.mjs.map +1 -1
- package/dist/exports/Slider.cjs +2 -0
- package/dist/exports/Slider.cjs.map +1 -1
- package/dist/exports/Slider.js +2 -2
- package/dist/exports/Slider.js.map +1 -1
- package/dist/exports/Slider.mjs +2 -2
- package/dist/exports/Slider.mjs.map +1 -1
- package/dist/exports/Switch.cjs +8 -0
- package/dist/exports/Switch.cjs.map +1 -1
- package/dist/exports/Switch.js +6 -2
- package/dist/exports/Switch.js.map +1 -1
- package/dist/exports/Switch.mjs +6 -2
- package/dist/exports/Switch.mjs.map +1 -1
- package/dist/exports/Table.cjs +1 -0
- package/dist/exports/Table.cjs.map +1 -1
- package/dist/exports/Table.js +2 -2
- package/dist/exports/Table.js.map +1 -1
- package/dist/exports/Table.mjs +2 -2
- package/dist/exports/Table.mjs.map +1 -1
- package/dist/exports/Tabs.cjs.map +1 -1
- package/dist/exports/Tabs.js.map +1 -1
- package/dist/exports/Tabs.mjs.map +1 -1
- package/dist/exports/TagGroup.cjs.map +1 -1
- package/dist/exports/TagGroup.js.map +1 -1
- package/dist/exports/TagGroup.mjs.map +1 -1
- package/dist/exports/TimeField.cjs.map +1 -1
- package/dist/exports/TimeField.js.map +1 -1
- package/dist/exports/TimeField.mjs.map +1 -1
- package/dist/exports/Toast.cjs.map +1 -1
- package/dist/exports/Toast.js.map +1 -1
- package/dist/exports/Toast.mjs.map +1 -1
- package/dist/exports/ToggleButtonGroup.cjs.map +1 -1
- package/dist/exports/ToggleButtonGroup.js.map +1 -1
- package/dist/exports/ToggleButtonGroup.mjs.map +1 -1
- package/dist/exports/Tree.cjs.map +1 -1
- package/dist/exports/Tree.js.map +1 -1
- package/dist/exports/Tree.mjs.map +1 -1
- package/dist/exports/Virtualizer.cjs.map +1 -1
- package/dist/exports/Virtualizer.js.map +1 -1
- package/dist/exports/Virtualizer.mjs.map +1 -1
- package/dist/exports/index.cjs +19 -1
- package/dist/exports/index.cjs.map +1 -1
- package/dist/exports/index.js +11 -8
- package/dist/exports/index.js.map +1 -1
- package/dist/exports/index.mjs +11 -8
- package/dist/exports/index.mjs.map +1 -1
- package/dist/exports/useAsyncList.cjs.map +1 -1
- package/dist/exports/useAsyncList.js.map +1 -1
- package/dist/exports/useAsyncList.mjs.map +1 -1
- package/dist/exports/useDragAndDrop.cjs.map +1 -1
- package/dist/exports/useDragAndDrop.js.map +1 -1
- package/dist/exports/useDragAndDrop.mjs.map +1 -1
- package/dist/exports/useDrop.cjs.map +1 -1
- package/dist/exports/useDrop.js.map +1 -1
- package/dist/exports/useDrop.mjs.map +1 -1
- package/dist/private/Autocomplete.cjs.map +1 -1
- package/dist/private/Autocomplete.js.map +1 -1
- package/dist/private/Autocomplete.mjs.map +1 -1
- package/dist/private/Breadcrumbs.cjs.map +1 -1
- package/dist/private/Breadcrumbs.js.map +1 -1
- package/dist/private/Breadcrumbs.mjs.map +1 -1
- package/dist/private/Button.cjs.map +1 -1
- package/dist/private/Button.js.map +1 -1
- package/dist/private/Button.mjs.map +1 -1
- package/dist/private/Calendar.cjs +34 -2
- package/dist/private/Calendar.cjs.map +1 -1
- package/dist/private/Calendar.js +34 -5
- package/dist/private/Calendar.js.map +1 -1
- package/dist/private/Calendar.mjs +34 -5
- package/dist/private/Calendar.mjs.map +1 -1
- package/dist/private/Checkbox.cjs +104 -17
- package/dist/private/Checkbox.cjs.map +1 -1
- package/dist/private/Checkbox.js +102 -18
- package/dist/private/Checkbox.js.map +1 -1
- package/dist/private/Checkbox.mjs +102 -18
- package/dist/private/Checkbox.mjs.map +1 -1
- package/dist/private/Collection.cjs.map +1 -1
- package/dist/private/Collection.js.map +1 -1
- package/dist/private/Collection.mjs.map +1 -1
- package/dist/private/ColorArea.cjs.map +1 -1
- package/dist/private/ColorArea.js.map +1 -1
- package/dist/private/ColorArea.mjs.map +1 -1
- package/dist/private/ColorField.cjs.map +1 -1
- package/dist/private/ColorField.js.map +1 -1
- package/dist/private/ColorField.mjs.map +1 -1
- package/dist/private/ColorPicker.cjs.map +1 -1
- package/dist/private/ColorPicker.js.map +1 -1
- package/dist/private/ColorPicker.mjs.map +1 -1
- package/dist/private/ColorSlider.cjs.map +1 -1
- package/dist/private/ColorSlider.js.map +1 -1
- package/dist/private/ColorSlider.mjs.map +1 -1
- package/dist/private/ColorSwatch.cjs.map +1 -1
- package/dist/private/ColorSwatch.js.map +1 -1
- package/dist/private/ColorSwatch.mjs.map +1 -1
- package/dist/private/ColorSwatchPicker.cjs.map +1 -1
- package/dist/private/ColorSwatchPicker.js.map +1 -1
- package/dist/private/ColorSwatchPicker.mjs.map +1 -1
- package/dist/private/ColorThumb.cjs.map +1 -1
- package/dist/private/ColorThumb.js.map +1 -1
- package/dist/private/ColorThumb.mjs.map +1 -1
- package/dist/private/ColorWheel.cjs.map +1 -1
- package/dist/private/ColorWheel.js.map +1 -1
- package/dist/private/ColorWheel.mjs.map +1 -1
- package/dist/private/ComboBox.cjs +15 -3
- package/dist/private/ComboBox.cjs.map +1 -1
- package/dist/private/ComboBox.js +16 -4
- package/dist/private/ComboBox.js.map +1 -1
- package/dist/private/ComboBox.mjs +16 -4
- package/dist/private/ComboBox.mjs.map +1 -1
- package/dist/private/DateField.cjs.map +1 -1
- package/dist/private/DateField.js.map +1 -1
- package/dist/private/DateField.mjs.map +1 -1
- package/dist/private/DatePicker.cjs +0 -26
- package/dist/private/DatePicker.cjs.map +1 -1
- package/dist/private/DatePicker.js +1 -27
- package/dist/private/DatePicker.js.map +1 -1
- package/dist/private/DatePicker.mjs +1 -27
- package/dist/private/DatePicker.mjs.map +1 -1
- package/dist/private/Dialog.cjs +1 -17
- package/dist/private/Dialog.cjs.map +1 -1
- package/dist/private/Dialog.js +2 -18
- package/dist/private/Dialog.js.map +1 -1
- package/dist/private/Dialog.mjs +2 -18
- package/dist/private/Dialog.mjs.map +1 -1
- package/dist/private/Disclosure.cjs.map +1 -1
- package/dist/private/Disclosure.js.map +1 -1
- package/dist/private/Disclosure.mjs.map +1 -1
- package/dist/private/DragAndDrop.cjs +3 -3
- package/dist/private/DragAndDrop.cjs.map +1 -1
- package/dist/private/DragAndDrop.js +3 -3
- package/dist/private/DragAndDrop.js.map +1 -1
- package/dist/private/DragAndDrop.mjs +3 -3
- package/dist/private/DragAndDrop.mjs.map +1 -1
- package/dist/private/DropZone.cjs.map +1 -1
- package/dist/private/DropZone.js.map +1 -1
- package/dist/private/DropZone.mjs.map +1 -1
- package/dist/private/FieldError.cjs.map +1 -1
- package/dist/private/FieldError.js.map +1 -1
- package/dist/private/FieldError.mjs.map +1 -1
- package/dist/private/FileTrigger.cjs.map +1 -1
- package/dist/private/FileTrigger.js.map +1 -1
- package/dist/private/FileTrigger.mjs.map +1 -1
- package/dist/private/Form.cjs.map +1 -1
- package/dist/private/Form.js.map +1 -1
- package/dist/private/Form.mjs.map +1 -1
- package/dist/private/GridLayout.cjs +37 -0
- package/dist/private/GridLayout.cjs.map +1 -0
- package/dist/private/GridLayout.js +32 -0
- package/dist/private/GridLayout.js.map +1 -0
- package/dist/private/GridLayout.mjs +32 -0
- package/dist/private/GridLayout.mjs.map +1 -0
- package/dist/private/GridList.cjs +23 -5
- package/dist/private/GridList.cjs.map +1 -1
- package/dist/private/GridList.js +24 -6
- package/dist/private/GridList.js.map +1 -1
- package/dist/private/GridList.mjs +24 -6
- package/dist/private/GridList.mjs.map +1 -1
- package/dist/private/Group.cjs.map +1 -1
- package/dist/private/Group.js.map +1 -1
- package/dist/private/Group.mjs.map +1 -1
- package/dist/private/Header.cjs.map +1 -1
- package/dist/private/Header.js.map +1 -1
- package/dist/private/Header.mjs.map +1 -1
- package/dist/private/Heading.cjs.map +1 -1
- package/dist/private/Heading.js.map +1 -1
- package/dist/private/Heading.mjs.map +1 -1
- package/dist/private/HiddenDateInput.cjs +3 -3
- package/dist/private/HiddenDateInput.cjs.map +1 -1
- package/dist/private/HiddenDateInput.js +3 -3
- package/dist/private/HiddenDateInput.js.map +1 -1
- package/dist/private/HiddenDateInput.mjs +3 -3
- package/dist/private/HiddenDateInput.mjs.map +1 -1
- package/dist/private/Input.cjs.map +1 -1
- package/dist/private/Input.js.map +1 -1
- package/dist/private/Input.mjs.map +1 -1
- package/dist/private/Keyboard.cjs.map +1 -1
- package/dist/private/Keyboard.js.map +1 -1
- package/dist/private/Keyboard.mjs.map +1 -1
- package/dist/private/Label.cjs.map +1 -1
- package/dist/private/Label.js.map +1 -1
- package/dist/private/Label.mjs.map +1 -1
- package/dist/private/Link.cjs.map +1 -1
- package/dist/private/Link.js.map +1 -1
- package/dist/private/Link.mjs.map +1 -1
- package/dist/private/ListBox.cjs +6 -5
- package/dist/private/ListBox.cjs.map +1 -1
- package/dist/private/ListBox.js +6 -5
- package/dist/private/ListBox.js.map +1 -1
- package/dist/private/ListBox.mjs +6 -5
- package/dist/private/ListBox.mjs.map +1 -1
- package/dist/private/Menu.cjs +5 -15
- package/dist/private/Menu.cjs.map +1 -1
- package/dist/private/Menu.js +6 -16
- package/dist/private/Menu.js.map +1 -1
- package/dist/private/Menu.mjs +6 -16
- package/dist/private/Menu.mjs.map +1 -1
- package/dist/private/Meter.cjs.map +1 -1
- package/dist/private/Meter.js.map +1 -1
- package/dist/private/Meter.mjs.map +1 -1
- package/dist/private/Modal.cjs.map +1 -1
- package/dist/private/Modal.js.map +1 -1
- package/dist/private/Modal.mjs.map +1 -1
- package/dist/private/NumberField.cjs.map +1 -1
- package/dist/private/NumberField.js.map +1 -1
- package/dist/private/NumberField.mjs.map +1 -1
- package/dist/private/OverlayArrow.cjs.map +1 -1
- package/dist/private/OverlayArrow.js.map +1 -1
- package/dist/private/OverlayArrow.mjs.map +1 -1
- package/dist/private/Popover.cjs +17 -1
- package/dist/private/Popover.cjs.map +1 -1
- package/dist/private/Popover.js +19 -2
- package/dist/private/Popover.js.map +1 -1
- package/dist/private/Popover.mjs +18 -2
- package/dist/private/Popover.mjs.map +1 -1
- package/dist/private/ProgressBar.cjs.map +1 -1
- package/dist/private/ProgressBar.js.map +1 -1
- package/dist/private/ProgressBar.mjs.map +1 -1
- package/dist/private/RadioGroup.cjs +87 -7
- package/dist/private/RadioGroup.cjs.map +1 -1
- package/dist/private/RadioGroup.js +86 -9
- package/dist/private/RadioGroup.js.map +1 -1
- package/dist/private/RadioGroup.mjs +86 -9
- package/dist/private/RadioGroup.mjs.map +1 -1
- package/dist/private/SearchField.cjs.map +1 -1
- package/dist/private/SearchField.js.map +1 -1
- package/dist/private/SearchField.mjs.map +1 -1
- package/dist/private/Select.cjs +1 -17
- package/dist/private/Select.cjs.map +1 -1
- package/dist/private/Select.js +2 -18
- package/dist/private/Select.js.map +1 -1
- package/dist/private/Select.mjs +2 -18
- package/dist/private/Select.mjs.map +1 -1
- package/dist/private/SelectionIndicator.cjs.map +1 -1
- package/dist/private/SelectionIndicator.js.map +1 -1
- package/dist/private/SelectionIndicator.mjs.map +1 -1
- package/dist/private/Separator.cjs.map +1 -1
- package/dist/private/Separator.js.map +1 -1
- package/dist/private/Separator.mjs.map +1 -1
- package/dist/private/SharedElementTransition.cjs.map +1 -1
- package/dist/private/SharedElementTransition.js.map +1 -1
- package/dist/private/SharedElementTransition.mjs.map +1 -1
- package/dist/private/Slider.cjs +51 -1
- package/dist/private/Slider.cjs.map +1 -1
- package/dist/private/Slider.js +50 -2
- package/dist/private/Slider.js.map +1 -1
- package/dist/private/Slider.mjs +50 -2
- package/dist/private/Slider.mjs.map +1 -1
- package/dist/private/Switch.cjs +118 -4
- package/dist/private/Switch.cjs.map +1 -1
- package/dist/private/Switch.js +119 -7
- package/dist/private/Switch.js.map +1 -1
- package/dist/private/Switch.mjs +118 -7
- package/dist/private/Switch.mjs.map +1 -1
- package/dist/private/Table.cjs +115 -24
- package/dist/private/Table.cjs.map +1 -1
- package/dist/private/Table.js +116 -26
- package/dist/private/Table.js.map +1 -1
- package/dist/private/Table.mjs +116 -26
- package/dist/private/Table.mjs.map +1 -1
- package/dist/private/TableLayout.cjs.map +1 -1
- package/dist/private/TableLayout.js.map +1 -1
- package/dist/private/TableLayout.mjs.map +1 -1
- package/dist/private/Tabs.cjs +4 -3
- package/dist/private/Tabs.cjs.map +1 -1
- package/dist/private/Tabs.js +4 -3
- package/dist/private/Tabs.js.map +1 -1
- package/dist/private/Tabs.mjs +4 -3
- package/dist/private/Tabs.mjs.map +1 -1
- package/dist/private/TagGroup.cjs.map +1 -1
- package/dist/private/TagGroup.js.map +1 -1
- package/dist/private/TagGroup.mjs.map +1 -1
- package/dist/private/Text.cjs.map +1 -1
- package/dist/private/Text.js.map +1 -1
- package/dist/private/Text.mjs.map +1 -1
- package/dist/private/TextArea.cjs.map +1 -1
- package/dist/private/TextArea.js.map +1 -1
- package/dist/private/TextArea.mjs.map +1 -1
- package/dist/private/TextField.cjs.map +1 -1
- package/dist/private/TextField.js.map +1 -1
- package/dist/private/TextField.mjs.map +1 -1
- package/dist/private/Toast.cjs +2 -1
- package/dist/private/Toast.cjs.map +1 -1
- package/dist/private/Toast.js +2 -1
- package/dist/private/Toast.js.map +1 -1
- package/dist/private/Toast.mjs +2 -1
- package/dist/private/Toast.mjs.map +1 -1
- package/dist/private/ToggleButton.cjs.map +1 -1
- package/dist/private/ToggleButton.js.map +1 -1
- package/dist/private/ToggleButton.mjs.map +1 -1
- package/dist/private/ToggleButtonGroup.cjs.map +1 -1
- package/dist/private/ToggleButtonGroup.js.map +1 -1
- package/dist/private/ToggleButtonGroup.mjs.map +1 -1
- package/dist/private/Toolbar.cjs.map +1 -1
- package/dist/private/Toolbar.js.map +1 -1
- package/dist/private/Toolbar.mjs.map +1 -1
- package/dist/private/Tooltip.cjs.map +1 -1
- package/dist/private/Tooltip.js.map +1 -1
- package/dist/private/Tooltip.mjs.map +1 -1
- package/dist/private/Tree.cjs +18 -6
- package/dist/private/Tree.cjs.map +1 -1
- package/dist/private/Tree.js +19 -7
- package/dist/private/Tree.js.map +1 -1
- package/dist/private/Tree.mjs +19 -7
- package/dist/private/Tree.mjs.map +1 -1
- package/dist/private/TreeDropTargetDelegate.cjs +9 -4
- package/dist/private/TreeDropTargetDelegate.cjs.map +1 -1
- package/dist/private/TreeDropTargetDelegate.js +10 -4
- package/dist/private/TreeDropTargetDelegate.js.map +1 -1
- package/dist/private/TreeDropTargetDelegate.mjs +9 -4
- package/dist/private/TreeDropTargetDelegate.mjs.map +1 -1
- package/dist/private/Virtualizer.cjs.map +1 -1
- package/dist/private/Virtualizer.js.map +1 -1
- package/dist/private/Virtualizer.mjs.map +1 -1
- package/dist/private/useDragAndDrop.cjs.map +1 -1
- package/dist/private/useDragAndDrop.js.map +1 -1
- package/dist/private/useDragAndDrop.mjs.map +1 -1
- package/dist/private/utils.cjs.map +1 -1
- package/dist/private/utils.js.map +1 -1
- package/dist/private/utils.mjs.map +1 -1
- package/dist/types/exports/Calendar.d.ts +4 -3
- package/dist/types/exports/Checkbox.d.ts +7 -2
- package/dist/types/exports/RadioGroup.d.ts +2 -2
- package/dist/types/exports/RangeCalendar.d.ts +3 -2
- package/dist/types/exports/Slider.d.ts +2 -2
- package/dist/types/exports/Switch.d.ts +7 -2
- package/dist/types/exports/Table.d.ts +2 -2
- package/dist/types/exports/index.d.ts +15 -13
- package/dist/types/exports/useDragAndDrop.d.ts +1 -1
- package/dist/types/src/Autocomplete.d.ts +1 -1
- package/dist/types/src/Breadcrumbs.d.ts +13 -4
- package/dist/types/src/Button.d.ts +9 -1
- package/dist/types/src/Calendar.d.ts +93 -33
- package/dist/types/src/Checkbox.d.ts +93 -2
- package/dist/types/src/Collection.d.ts +17 -4
- package/dist/types/src/ColorArea.d.ts +6 -2
- package/dist/types/src/ColorField.d.ts +8 -1
- package/dist/types/src/ColorPicker.d.ts +4 -1
- package/dist/types/src/ColorSlider.d.ts +5 -1
- package/dist/types/src/ColorSwatch.d.ts +3 -1
- package/dist/types/src/ColorSwatchPicker.d.ts +7 -2
- package/dist/types/src/ColorThumb.d.ts +10 -2
- package/dist/types/src/ColorWheel.d.ts +7 -2
- package/dist/types/src/ComboBox.d.ts +24 -11
- package/dist/types/src/DateField.d.ts +29 -4
- package/dist/types/src/DatePicker.d.ts +15 -3
- package/dist/types/src/Dialog.d.ts +3 -1
- package/dist/types/src/Disclosure.d.ts +21 -5
- package/dist/types/src/DragAndDrop.d.ts +6 -2
- package/dist/types/src/DropZone.d.ts +8 -1
- package/dist/types/src/FieldError.d.ts +4 -1
- package/dist/types/src/FileTrigger.d.ts +2 -1
- package/dist/types/src/Form.d.ts +4 -1
- package/dist/types/src/GridLayout.d.ts +5 -0
- package/dist/types/src/GridList.d.ts +51 -13
- package/dist/types/src/Group.d.ts +9 -1
- package/dist/types/src/Heading.d.ts +12 -0
- package/dist/types/src/HiddenDateInput.d.ts +2 -1
- package/dist/types/src/Input.d.ts +8 -1
- package/dist/types/src/Link.d.ts +9 -1
- package/dist/types/src/ListBox.d.ts +35 -12
- package/dist/types/src/Menu.d.ts +22 -10
- package/dist/types/src/Meter.d.ts +4 -1
- package/dist/types/src/Modal.d.ts +9 -3
- package/dist/types/src/NumberField.d.ts +9 -2
- package/dist/types/src/OverlayArrow.d.ts +4 -1
- package/dist/types/src/Popover.d.ts +12 -3
- package/dist/types/src/ProgressBar.d.ts +5 -1
- package/dist/types/src/RadioGroup.d.ts +88 -2
- package/dist/types/src/SearchField.d.ts +8 -1
- package/dist/types/src/Select.d.ts +19 -6
- package/dist/types/src/SelectionIndicator.d.ts +7 -2
- package/dist/types/src/Separator.d.ts +5 -2
- package/dist/types/src/SharedElementTransition.d.ts +2 -0
- package/dist/types/src/Slider.d.ts +48 -4
- package/dist/types/src/Switch.d.ts +100 -3
- package/dist/types/src/Table.d.ts +138 -31
- package/dist/types/src/Tabs.d.ts +37 -12
- package/dist/types/src/TagGroup.d.ts +18 -7
- package/dist/types/src/TextArea.d.ts +3 -1
- package/dist/types/src/TextField.d.ts +7 -1
- package/dist/types/src/Toast.d.ts +13 -3
- package/dist/types/src/ToggleButton.d.ts +10 -3
- package/dist/types/src/ToggleButtonGroup.d.ts +7 -2
- package/dist/types/src/Toolbar.d.ts +6 -3
- package/dist/types/src/Tooltip.d.ts +13 -4
- package/dist/types/src/Tree.d.ts +52 -16
- package/dist/types/src/useDragAndDrop.d.ts +10 -4
- package/dist/types/src/utils.d.ts +109 -17
- package/package.json +9 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;AAoGM,MAAM,0DAAoB,CAAA,GAAA,oBAAY,EAAsD;AAC5F,MAAM,yDAAyB,CAAA,GAAA,oBAAY,EAA2D;AACtG,MAAM,0DAAyB,CAAA,GAAA,oBAAY,EAA0B;AACrE,MAAM,0DAA8B,CAAA,GAAA,oBAAY,EAA+B;AAEtF,wCAAwC;AACxC,MAAM,uCAAiB;IAAC,CAAA,GAAA,yCAAW;IAAG,CAAA,GAAA,yCAAY;IAAG,CAAA,GAAA,yCAAW;IAAG,CAAA,GAAA,yCAAU;CAAE;AAKxE,MAAM,4CAA2B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,WAAgC,KAAyB,EAAE,GAAiC;IAC1K,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,EAAC,oBAAoB,sBAAsB,EAAC,GAAG,CAAA,GAAA,yCAAgB,EAAE,CAAA,GAAA,yCAAU,MAAM,CAAC;QAC7D,2BAAA;IAAzB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AAe;gBAAG;oBACjB,OAAO;wBACL,OAAO;wBACP,KAAK;oBACP;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBACZ,OAAO;wBACL,aAAa;wBACb,cAAc;oBAChB;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAgB;gBAAG;aAAW;SAChC;qBACD,gCAAC,CAAA,GAAA,yCAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,aAAa,WAAW;QACjD,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,qBAAmB,aAAa;QAChC,gBAAc,MAAM,SAAS,IAAI;QACjC,sBAAoB,kBAAkB;QACtC,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,aAAW,MAAM,MAAM,IAAI;;AAGnC","sources":["packages/react-aria-components/src/DatePicker.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 {AriaDatePickerProps, useDatePicker} from 'react-aria/useDatePicker';\nimport {AriaDateRangePickerProps, useDateRangePicker} from 'react-aria/useDateRangePicker';\nimport {ButtonContext} from './Button';\nimport {CalendarContext, RangeCalendarContext} from './Calendar';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RACValidation,\n removeDataAttributes,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlot,\n useSlottedContext\n} from './utils';\nimport {DateFieldContext} from './DateField';\nimport {DatePickerState, DatePickerStateOptions, DateValue, useDatePickerState} from 'react-stately/useDatePickerState';\nimport {DateRangePickerState, DateRangePickerStateOptions, useDateRangePickerState} from 'react-stately/useDateRangePickerState';\nimport {DialogContext, OverlayTriggerStateContext} from './Dialog';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {HiddenDateInput} from './HiddenDateInput';\nimport {LabelContext} from './Label';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, useCallback, useRef, useState} from 'react';\nimport {TextContext} from './Text';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\n\nexport interface DatePickerRenderProps {\n /**\n * Whether an element within the date picker is focused, either via a mouse or keyboard.\n * @selector [data-focus-within]\n */\n isFocusWithin: boolean,\n /**\n * Whether an element within the date picker is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the date picker is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the date picker is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the date picker is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the date picker is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * Whether the date picker's popover is currently open.\n * @selector [data-open]\n */\n isOpen: boolean,\n /**\n * State of the date picker.\n */\n state: DatePickerState\n}\nexport interface DateRangePickerRenderProps extends Omit<DatePickerRenderProps, 'state'> {\n /**\n * State of the date range picker.\n */\n state: DateRangePickerState\n}\n\nexport interface DatePickerProps<T extends DateValue> extends Omit<AriaDatePickerProps<T>, 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, Pick<DatePickerStateOptions<T>, 'shouldCloseOnSelect'>, RACValidation, RenderProps<DatePickerRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-DatePicker'\n */\n className?: ClassNameOrFunction<DatePickerRenderProps>\n}\nexport interface DateRangePickerProps<T extends DateValue> extends Omit<AriaDateRangePickerProps<T>, 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, Pick<DateRangePickerStateOptions<T>, 'shouldCloseOnSelect'>, RACValidation, RenderProps<DateRangePickerRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-DateRangePicker'\n */\n className?: ClassNameOrFunction<DateRangePickerRenderProps>\n}\n\nexport const DatePickerContext = createContext<ContextValue<DatePickerProps<any>, HTMLDivElement>>(null);\nexport const DateRangePickerContext = createContext<ContextValue<DateRangePickerProps<any>, HTMLDivElement>>(null);\nexport const DatePickerStateContext = createContext<DatePickerState | null>(null);\nexport const DateRangePickerStateContext = createContext<DateRangePickerState | null>(null);\n\n// Contexts to clear inside the popover.\nconst CLEAR_CONTEXTS = [GroupContext, ButtonContext, LabelContext, TextContext];\n\n/**\n * A date picker combines a DateField and a Calendar popover to allow users to enter or select a date and time value.\n */\nexport const DatePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DatePicker<T extends DateValue>(props: DatePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, DatePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDatePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n groupProps,\n labelProps,\n fieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDatePicker({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, groupRef);\n\n // Allows calendar width to match input group\n let [groupWidth, setGroupWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (groupRef.current) {\n setGroupWidth(groupRef.current.offsetWidth + 'px');\n }\n }, []);\n\n useResizeObserver({\n ref: groupRef,\n onResize: onResize\n });\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-DatePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DatePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [DateFieldContext, fieldProps],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [CalendarContext, calendarProps],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'DatePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n style: {'--trigger-width': groupWidth} as React.CSSProperties,\n clearContexts: CLEAR_CONTEXTS\n }],\n [DialogContext, dialogProps],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-open={state.isOpen || undefined} />\n <HiddenDateInput\n autoComplete={props.autoComplete}\n name={props.name}\n isDisabled={props.isDisabled}\n state={state} />\n </Provider>\n );\n});\n\n/**\n * A date range picker combines two DateFields and a RangeCalendar popover to allow\n * users to enter or select a date and time range.\n */\nexport const DateRangePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DateRangePicker<T extends DateValue>(props: DateRangePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, DateRangePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDateRangePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n groupProps,\n labelProps,\n startFieldProps,\n endFieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDateRangePicker({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, groupRef);\n\n // Allows calendar width to match input group\n let [groupWidth, setGroupWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (groupRef.current) {\n setGroupWidth(groupRef.current.offsetWidth + 'px');\n }\n }, []);\n\n useResizeObserver({\n ref: groupRef,\n onResize: onResize\n });\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-DateRangePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DateRangePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [RangeCalendarContext, calendarProps],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'DateRangePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n style: {'--trigger-width': groupWidth} as React.CSSProperties,\n clearContexts: CLEAR_CONTEXTS\n }],\n [DialogContext, dialogProps],\n [DateFieldContext, {\n slots: {\n start: startFieldProps,\n end: endFieldProps\n }\n }],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-open={state.isOpen || undefined} />\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"DatePicker.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;AA2IM,MAAM,0DACX,CAAA,GAAA,oBAAY,EAAsD;AAC7D,MAAM,yDACX,CAAA,GAAA,oBAAY,EAA2D;AAClE,MAAM,0DAAyB,CAAA,GAAA,oBAAY,EAA0B;AACrE,MAAM,0DAA8B,CAAA,GAAA,oBAAY,EAA+B;AAEtF,wCAAwC;AACxC,MAAM,uCAAiB;IAAC,CAAA,GAAA,yCAAW;IAAG,CAAA,GAAA,yCAAY;IAAG,CAAA,GAAA,yCAAW;IAAG,CAAA,GAAA,yCAAU;CAAE;AAMxE,MAAM,4CAA2B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,WAE9E,KAAyB,EAA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e,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,aAAW,MAAM,MAAM,IAAI;;AAInC","sources":["packages/react-aria-components/src/DatePicker.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 {AriaDatePickerProps, useDatePicker} from 'react-aria/useDatePicker';\nimport {AriaDateRangePickerProps, useDateRangePicker} from 'react-aria/useDateRangePicker';\nimport {ButtonContext} from './Button';\nimport {CalendarContext, RangeCalendarContext} from './Calendar';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RACValidation,\n removeDataAttributes,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlot,\n useSlottedContext\n} from './utils';\nimport {DateFieldContext} from './DateField';\nimport {\n DatePickerState,\n DatePickerStateOptions,\n DateValue,\n useDatePickerState\n} from 'react-stately/useDatePickerState';\nimport {\n DateRangePickerState,\n DateRangePickerStateOptions,\n useDateRangePickerState\n} from 'react-stately/useDateRangePickerState';\nimport {DialogContext, OverlayTriggerStateContext} from './Dialog';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {HiddenDateInput} from './HiddenDateInput';\nimport {LabelContext} from './Label';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\nimport {TextContext} from './Text';\nimport {useFocusRing} from 'react-aria/useFocusRing';\n\nexport interface DatePickerRenderProps {\n /**\n * Whether an element within the date picker is focused, either via a mouse or keyboard.\n *\n * @selector [data-focus-within]\n */\n isFocusWithin: boolean;\n /**\n * Whether an element within the date picker is keyboard focused.\n *\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean;\n /**\n * Whether the date picker is disabled.\n *\n * @selector [data-disabled]\n */\n isDisabled: boolean;\n /**\n * Whether the date picker is read only.\n *\n * @selector [data-readonly]\n */\n isReadOnly: boolean;\n /**\n * Whether the date picker is invalid.\n *\n * @selector [data-invalid]\n */\n isInvalid: boolean;\n /**\n * Whether the date picker is required.\n *\n * @selector [data-required]\n */\n isRequired: boolean;\n /**\n * Whether the date picker's popover is currently open.\n *\n * @selector [data-open]\n */\n isOpen: boolean;\n /**\n * State of the date picker.\n */\n state: DatePickerState;\n}\nexport interface DateRangePickerRenderProps extends Omit<DatePickerRenderProps, 'state'> {\n /**\n * State of the date range picker.\n */\n state: DateRangePickerState;\n}\n\nexport interface DatePickerProps<T extends DateValue>\n extends\n Omit<\n AriaDatePickerProps<T>,\n 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'\n >,\n Pick<DatePickerStateOptions<T>, 'shouldCloseOnSelect'>,\n RACValidation,\n RenderProps<DatePickerRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-DatePicker'\n */\n className?: ClassNameOrFunction<DatePickerRenderProps>;\n}\nexport interface DateRangePickerProps<T extends DateValue>\n extends\n Omit<\n AriaDateRangePickerProps<T>,\n 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'\n >,\n Pick<DateRangePickerStateOptions<T>, 'shouldCloseOnSelect'>,\n RACValidation,\n RenderProps<DateRangePickerRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-DateRangePicker'\n */\n className?: ClassNameOrFunction<DateRangePickerRenderProps>;\n}\n\nexport const DatePickerContext =\n createContext<ContextValue<DatePickerProps<any>, HTMLDivElement>>(null);\nexport const DateRangePickerContext =\n createContext<ContextValue<DateRangePickerProps<any>, HTMLDivElement>>(null);\nexport const DatePickerStateContext = createContext<DatePickerState | null>(null);\nexport const DateRangePickerStateContext = createContext<DateRangePickerState | null>(null);\n\n// Contexts to clear inside the popover.\nconst CLEAR_CONTEXTS = [GroupContext, ButtonContext, LabelContext, TextContext];\n\n/**\n * A date picker combines a DateField and a Calendar popover to allow users to enter or select a\n * date and time value.\n */\nexport const DatePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DatePicker<\n T extends DateValue\n>(props: DatePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, DatePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDatePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']);\n let {\n groupProps,\n labelProps,\n fieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDatePicker(\n {\n ...removeDataAttributes(props),\n label,\n validationBehavior\n },\n state,\n groupRef\n );\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-DatePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DatePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [DateFieldContext, fieldProps],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [CalendarContext, calendarProps as any],\n [OverlayTriggerStateContext, state],\n [\n PopoverContext,\n {\n trigger: 'DatePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n clearContexts: CLEAR_CONTEXTS\n }\n ],\n [DialogContext, dialogProps],\n [\n TextContext,\n {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }\n ],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-open={state.isOpen || undefined}\n />\n <HiddenDateInput\n autoComplete={props.autoComplete}\n name={props.name}\n isDisabled={props.isDisabled}\n state={state}\n />\n </Provider>\n );\n});\n\n/**\n * A date range picker combines two DateFields and a RangeCalendar popover to allow\n * users to enter or select a date and time range.\n */\nexport const DateRangePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(\n function DateRangePicker<T extends DateValue>(\n props: DateRangePickerProps<T>,\n ref: ForwardedRef<HTMLDivElement>\n ) {\n [props, ref] = useContextProps(props, ref, DateRangePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDateRangePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']);\n let {\n groupProps,\n labelProps,\n startFieldProps,\n endFieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDateRangePicker(\n {\n ...removeDataAttributes(props),\n label,\n validationBehavior\n },\n state,\n groupRef\n );\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-DateRangePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DateRangePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [RangeCalendarContext, calendarProps],\n [OverlayTriggerStateContext, state],\n [\n PopoverContext,\n {\n trigger: 'DateRangePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n clearContexts: CLEAR_CONTEXTS\n }\n ],\n [DialogContext, dialogProps],\n [\n DateFieldContext,\n {\n slots: {\n start: startFieldProps,\n end: endFieldProps\n }\n }\n ],\n [\n TextContext,\n {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }\n ],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-open={state.isOpen || undefined}\n />\n </Provider>\n );\n }\n);\n"],"names":[],"version":3,"file":"DatePicker.js.map"}
|
|
@@ -16,9 +16,8 @@ import {useDatePickerState as $a7Jp3$useDatePickerState} from "react-stately/use
|
|
|
16
16
|
import {useDateRangePickerState as $a7Jp3$useDateRangePickerState} from "react-stately/useDateRangePickerState";
|
|
17
17
|
import {filterDOMProps as $a7Jp3$filterDOMProps} from "react-aria/filterDOMProps";
|
|
18
18
|
import {mergeProps as $a7Jp3$mergeProps} from "react-aria/mergeProps";
|
|
19
|
-
import $a7Jp3$react, {createContext as $a7Jp3$createContext, forwardRef as $a7Jp3$forwardRef, useRef as $a7Jp3$useRef
|
|
19
|
+
import $a7Jp3$react, {createContext as $a7Jp3$createContext, forwardRef as $a7Jp3$forwardRef, useRef as $a7Jp3$useRef} from "react";
|
|
20
20
|
import {useFocusRing as $a7Jp3$useFocusRing} from "react-aria/useFocusRing";
|
|
21
|
-
import {useResizeObserver as $a7Jp3$useResizeObserver} from "react-aria/private/utils/useResizeObserver";
|
|
22
21
|
|
|
23
22
|
/*
|
|
24
23
|
* Copyright 2022 Adobe. All rights reserved.
|
|
@@ -50,7 +49,6 @@ import {useResizeObserver as $a7Jp3$useResizeObserver} from "react-aria/private/
|
|
|
50
49
|
|
|
51
50
|
|
|
52
51
|
|
|
53
|
-
|
|
54
52
|
const $e539d00f123fdfd8$export$cf316c7f3b44c11e = /*#__PURE__*/ (0, $a7Jp3$createContext)(null);
|
|
55
53
|
const $e539d00f123fdfd8$export$8282edba42ee28a = /*#__PURE__*/ (0, $a7Jp3$createContext)(null);
|
|
56
54
|
const $e539d00f123fdfd8$export$50a10c048fdcdee9 = /*#__PURE__*/ (0, $a7Jp3$createContext)(null);
|
|
@@ -77,15 +75,6 @@ const $e539d00f123fdfd8$export$5109c6dd95d8fb00 = /*#__PURE__*/ (0, $a7Jp3$forwa
|
|
|
77
75
|
label: label,
|
|
78
76
|
validationBehavior: validationBehavior
|
|
79
77
|
}, state, groupRef);
|
|
80
|
-
// Allows calendar width to match input group
|
|
81
|
-
let [groupWidth, setGroupWidth] = (0, $a7Jp3$useState)(null);
|
|
82
|
-
let onResize = (0, $a7Jp3$useCallback)(()=>{
|
|
83
|
-
if (groupRef.current) setGroupWidth(groupRef.current.offsetWidth + 'px');
|
|
84
|
-
}, []);
|
|
85
|
-
(0, $a7Jp3$useResizeObserver)({
|
|
86
|
-
ref: groupRef,
|
|
87
|
-
onResize: onResize
|
|
88
|
-
});
|
|
89
78
|
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $a7Jp3$useFocusRing)({
|
|
90
79
|
within: true
|
|
91
80
|
});
|
|
@@ -154,9 +143,6 @@ const $e539d00f123fdfd8$export$5109c6dd95d8fb00 = /*#__PURE__*/ (0, $a7Jp3$forwa
|
|
|
154
143
|
trigger: 'DatePicker',
|
|
155
144
|
triggerRef: groupRef,
|
|
156
145
|
placement: 'bottom start',
|
|
157
|
-
style: {
|
|
158
|
-
'--trigger-width': groupWidth
|
|
159
|
-
},
|
|
160
146
|
clearContexts: $e539d00f123fdfd8$var$CLEAR_CONTEXTS
|
|
161
147
|
}
|
|
162
148
|
],
|
|
@@ -211,15 +197,6 @@ const $e539d00f123fdfd8$export$17334619f3ac2224 = /*#__PURE__*/ (0, $a7Jp3$forwa
|
|
|
211
197
|
label: label,
|
|
212
198
|
validationBehavior: validationBehavior
|
|
213
199
|
}, state, groupRef);
|
|
214
|
-
// Allows calendar width to match input group
|
|
215
|
-
let [groupWidth, setGroupWidth] = (0, $a7Jp3$useState)(null);
|
|
216
|
-
let onResize = (0, $a7Jp3$useCallback)(()=>{
|
|
217
|
-
if (groupRef.current) setGroupWidth(groupRef.current.offsetWidth + 'px');
|
|
218
|
-
}, []);
|
|
219
|
-
(0, $a7Jp3$useResizeObserver)({
|
|
220
|
-
ref: groupRef,
|
|
221
|
-
onResize: onResize
|
|
222
|
-
});
|
|
223
200
|
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $a7Jp3$useFocusRing)({
|
|
224
201
|
within: true
|
|
225
202
|
});
|
|
@@ -284,9 +261,6 @@ const $e539d00f123fdfd8$export$17334619f3ac2224 = /*#__PURE__*/ (0, $a7Jp3$forwa
|
|
|
284
261
|
trigger: 'DateRangePicker',
|
|
285
262
|
triggerRef: groupRef,
|
|
286
263
|
placement: 'bottom start',
|
|
287
|
-
style: {
|
|
288
|
-
'--trigger-width': groupWidth
|
|
289
|
-
},
|
|
290
264
|
clearContexts: $e539d00f123fdfd8$var$CLEAR_CONTEXTS
|
|
291
265
|
}
|
|
292
266
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;AAoGM,MAAM,0DAAoB,CAAA,GAAA,oBAAY,EAAsD;AAC5F,MAAM,yDAAyB,CAAA,GAAA,oBAAY,EAA2D;AACtG,MAAM,0DAAyB,CAAA,GAAA,oBAAY,EAA0B;AACrE,MAAM,0DAA8B,CAAA,GAAA,oBAAY,EAA+B;AAEtF,wCAAwC;AACxC,MAAM,uCAAiB;IAAC,CAAA,GAAA,yCAAW;IAAG,CAAA,GAAA,yCAAY;IAAG,CAAA,GAAA,yCAAW;IAAG,CAAA,GAAA,yCAAU;CAAE;AAKxE,MAAM,4CAA2B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,WAAgC,KAAyB,EAAE,GAAiC;IAC1K,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,EAAC,oBAAoB,sBAAsB,EAAC,GAAG,CAAA,GAAA,yCAAgB,EAAE,CAAA,GAAA,yCAAU,MAAM,CAAC;IACtF,IAAI,qBAAqB,MAAM,kBAAkB,IAAI,0BAA0B;IAC/E,IAAI,QAAQ,CAAA,GAAA,yBAAiB,EAAE;QAC7B,GAAG,KAAK;4BACR;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,aAAK,EAAkB;IACtC,I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aAAa,WAAW;QACjD,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,qBAAmB,aAAa;QAChC,gBAAc,MAAM,SAAS,IAAI;QACjC,sBAAoB,kBAAkB;QACtC,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,aAAW,MAAM,MAAM,IAAI;;AAGnC","sources":["packages/react-aria-components/src/DatePicker.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 {AriaDatePickerProps, useDatePicker} from 'react-aria/useDatePicker';\nimport {AriaDateRangePickerProps, useDateRangePicker} from 'react-aria/useDateRangePicker';\nimport {ButtonContext} from './Button';\nimport {CalendarContext, RangeCalendarContext} from './Calendar';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RACValidation,\n removeDataAttributes,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlot,\n useSlottedContext\n} from './utils';\nimport {DateFieldContext} from './DateField';\nimport {DatePickerState, DatePickerStateOptions, DateValue, useDatePickerState} from 'react-stately/useDatePickerState';\nimport {DateRangePickerState, DateRangePickerStateOptions, useDateRangePickerState} from 'react-stately/useDateRangePickerState';\nimport {DialogContext, OverlayTriggerStateContext} from './Dialog';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {HiddenDateInput} from './HiddenDateInput';\nimport {LabelContext} from './Label';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, useCallback, useRef, useState} from 'react';\nimport {TextContext} from './Text';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\n\nexport interface DatePickerRenderProps {\n /**\n * Whether an element within the date picker is focused, either via a mouse or keyboard.\n * @selector [data-focus-within]\n */\n isFocusWithin: boolean,\n /**\n * Whether an element within the date picker is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the date picker is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the date picker is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * Whether the date picker is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the date picker is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * Whether the date picker's popover is currently open.\n * @selector [data-open]\n */\n isOpen: boolean,\n /**\n * State of the date picker.\n */\n state: DatePickerState\n}\nexport interface DateRangePickerRenderProps extends Omit<DatePickerRenderProps, 'state'> {\n /**\n * State of the date range picker.\n */\n state: DateRangePickerState\n}\n\nexport interface DatePickerProps<T extends DateValue> extends Omit<AriaDatePickerProps<T>, 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, Pick<DatePickerStateOptions<T>, 'shouldCloseOnSelect'>, RACValidation, RenderProps<DatePickerRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-DatePicker'\n */\n className?: ClassNameOrFunction<DatePickerRenderProps>\n}\nexport interface DateRangePickerProps<T extends DateValue> extends Omit<AriaDateRangePickerProps<T>, 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, Pick<DateRangePickerStateOptions<T>, 'shouldCloseOnSelect'>, RACValidation, RenderProps<DateRangePickerRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n * @default 'react-aria-DateRangePicker'\n */\n className?: ClassNameOrFunction<DateRangePickerRenderProps>\n}\n\nexport const DatePickerContext = createContext<ContextValue<DatePickerProps<any>, HTMLDivElement>>(null);\nexport const DateRangePickerContext = createContext<ContextValue<DateRangePickerProps<any>, HTMLDivElement>>(null);\nexport const DatePickerStateContext = createContext<DatePickerState | null>(null);\nexport const DateRangePickerStateContext = createContext<DateRangePickerState | null>(null);\n\n// Contexts to clear inside the popover.\nconst CLEAR_CONTEXTS = [GroupContext, ButtonContext, LabelContext, TextContext];\n\n/**\n * A date picker combines a DateField and a Calendar popover to allow users to enter or select a date and time value.\n */\nexport const DatePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DatePicker<T extends DateValue>(props: DatePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, DatePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDatePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n groupProps,\n labelProps,\n fieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDatePicker({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, groupRef);\n\n // Allows calendar width to match input group\n let [groupWidth, setGroupWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (groupRef.current) {\n setGroupWidth(groupRef.current.offsetWidth + 'px');\n }\n }, []);\n\n useResizeObserver({\n ref: groupRef,\n onResize: onResize\n });\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-DatePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DatePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [DateFieldContext, fieldProps],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [CalendarContext, calendarProps],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'DatePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n style: {'--trigger-width': groupWidth} as React.CSSProperties,\n clearContexts: CLEAR_CONTEXTS\n }],\n [DialogContext, dialogProps],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-open={state.isOpen || undefined} />\n <HiddenDateInput\n autoComplete={props.autoComplete}\n name={props.name}\n isDisabled={props.isDisabled}\n state={state} />\n </Provider>\n );\n});\n\n/**\n * A date range picker combines two DateFields and a RangeCalendar popover to allow\n * users to enter or select a date and time range.\n */\nexport const DateRangePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DateRangePicker<T extends DateValue>(props: DateRangePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, DateRangePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDateRangePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n groupProps,\n labelProps,\n startFieldProps,\n endFieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDateRangePicker({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, groupRef);\n\n // Allows calendar width to match input group\n let [groupWidth, setGroupWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (groupRef.current) {\n setGroupWidth(groupRef.current.offsetWidth + 'px');\n }\n }, []);\n\n useResizeObserver({\n ref: groupRef,\n onResize: onResize\n });\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-DateRangePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DateRangePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [RangeCalendarContext, calendarProps],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'DateRangePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n style: {'--trigger-width': groupWidth} as React.CSSProperties,\n clearContexts: CLEAR_CONTEXTS\n }],\n [DialogContext, dialogProps],\n [DateFieldContext, {\n slots: {\n start: startFieldProps,\n end: endFieldProps\n }\n }],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-open={state.isOpen || undefined} />\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"DatePicker.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;AA2IM,MAAM,0DACX,CAAA,GAAA,oBAAY,EAAsD;AAC7D,MAAM,yDACX,CAAA,GAAA,oBAAY,EAA2D;AAClE,MAAM,0DAAyB,CAAA,GAAA,oBAAY,EAA0B;AACrE,MAAM,0DAA8B,CAAA,GAAA,oBAAY,EAA+B;AAEtF,wCAAwC;AACxC,MAAM,uCAAiB;IAAC,CAAA,GAAA,yCAAW;IAAG,CAAA,GAAA,yCAAY;IAAG,CAAA,GAAA,yCAAW;IAAG,CAAA,GAAA,yCAAU;CAAE;AAMxE,MAAM,4CAA2B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,WAE9E,KAAyB,EAAE,GAAiC;IAC5D,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,EAAC,oBAAoB,sBAAsB,EAAC,GAAG,CAAA,GAAA,yCAAgB,EAAE,CAAA,GAAA,yCAAU,MAAM,CAAC;IACtF,IAAI,qBAAqB,MAAM,kBAAkB,IAAI,0BAA0B;IAC/E,IAAI,QAAQ,CAAA,GAAA,yBAAiB,EAAE;QAC7B,GAAG,KAAK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;gBAAC,CAAA,GAAA,yCAAW;gBAAG;oBAAC,GAAG,UAAU;oBAAE,KAAK;oBAAU,aAAa;gBAAM;aAAE;YACnE;gBAAC,CAAA,GAAA,yCAAmB;gBAAG;aAAc;YACrC;gBAAC,CAAA,GAAA,wCAAyB;gBAAG;aAAM;YACnC;gBACE,CAAA,GAAA,yCAAa;gBACb;oBACE,SAAS;oBACT,YAAY;oBACZ,WAAW;oBACX,eAAe;gBACjB;aACD;YACD;gBAAC,CAAA,GAAA,yCAAY;gBAAG;aAAY;YAC5B;gBACE,CAAA,GAAA,yCAAe;gBACf;oBACE,OAAO;wBACL,OAAO;wBACP,KAAK;oBACP;gBACF;aACD;YACD;gBACE,CAAA,GAAA,yCAAU;gBACV;oBACE,OAAO;wBACL,aAAa;wBACb,cAAc;oBAChB;gBACF;aACD;YACD;gBAAC,CAAA,GAAA,yCAAgB;gBAAG;aAAW;SAChC;qBACD,gCAAC,CAAA,GAAA,yCAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,aAAa,WAAW;QACjD,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,qBAAmB,aAAa;QAChC,gBAAc,MAAM,SAAS,IAAI;QACjC,sBAAoB,kBAAkB;QACtC,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,aAAW,MAAM,MAAM,IAAI;;AAInC","sources":["packages/react-aria-components/src/DatePicker.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 {AriaDatePickerProps, useDatePicker} from 'react-aria/useDatePicker';\nimport {AriaDateRangePickerProps, useDateRangePicker} from 'react-aria/useDateRangePicker';\nimport {ButtonContext} from './Button';\nimport {CalendarContext, RangeCalendarContext} from './Calendar';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RACValidation,\n removeDataAttributes,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlot,\n useSlottedContext\n} from './utils';\nimport {DateFieldContext} from './DateField';\nimport {\n DatePickerState,\n DatePickerStateOptions,\n DateValue,\n useDatePickerState\n} from 'react-stately/useDatePickerState';\nimport {\n DateRangePickerState,\n DateRangePickerStateOptions,\n useDateRangePickerState\n} from 'react-stately/useDateRangePickerState';\nimport {DialogContext, OverlayTriggerStateContext} from './Dialog';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {HiddenDateInput} from './HiddenDateInput';\nimport {LabelContext} from './Label';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\nimport {TextContext} from './Text';\nimport {useFocusRing} from 'react-aria/useFocusRing';\n\nexport interface DatePickerRenderProps {\n /**\n * Whether an element within the date picker is focused, either via a mouse or keyboard.\n *\n * @selector [data-focus-within]\n */\n isFocusWithin: boolean;\n /**\n * Whether an element within the date picker is keyboard focused.\n *\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean;\n /**\n * Whether the date picker is disabled.\n *\n * @selector [data-disabled]\n */\n isDisabled: boolean;\n /**\n * Whether the date picker is read only.\n *\n * @selector [data-readonly]\n */\n isReadOnly: boolean;\n /**\n * Whether the date picker is invalid.\n *\n * @selector [data-invalid]\n */\n isInvalid: boolean;\n /**\n * Whether the date picker is required.\n *\n * @selector [data-required]\n */\n isRequired: boolean;\n /**\n * Whether the date picker's popover is currently open.\n *\n * @selector [data-open]\n */\n isOpen: boolean;\n /**\n * State of the date picker.\n */\n state: DatePickerState;\n}\nexport interface DateRangePickerRenderProps extends Omit<DatePickerRenderProps, 'state'> {\n /**\n * State of the date range picker.\n */\n state: DateRangePickerState;\n}\n\nexport interface DatePickerProps<T extends DateValue>\n extends\n Omit<\n AriaDatePickerProps<T>,\n 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'\n >,\n Pick<DatePickerStateOptions<T>, 'shouldCloseOnSelect'>,\n RACValidation,\n RenderProps<DatePickerRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-DatePicker'\n */\n className?: ClassNameOrFunction<DatePickerRenderProps>;\n}\nexport interface DateRangePickerProps<T extends DateValue>\n extends\n Omit<\n AriaDateRangePickerProps<T>,\n 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'\n >,\n Pick<DateRangePickerStateOptions<T>, 'shouldCloseOnSelect'>,\n RACValidation,\n RenderProps<DateRangePickerRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-DateRangePicker'\n */\n className?: ClassNameOrFunction<DateRangePickerRenderProps>;\n}\n\nexport const DatePickerContext =\n createContext<ContextValue<DatePickerProps<any>, HTMLDivElement>>(null);\nexport const DateRangePickerContext =\n createContext<ContextValue<DateRangePickerProps<any>, HTMLDivElement>>(null);\nexport const DatePickerStateContext = createContext<DatePickerState | null>(null);\nexport const DateRangePickerStateContext = createContext<DateRangePickerState | null>(null);\n\n// Contexts to clear inside the popover.\nconst CLEAR_CONTEXTS = [GroupContext, ButtonContext, LabelContext, TextContext];\n\n/**\n * A date picker combines a DateField and a Calendar popover to allow users to enter or select a\n * date and time value.\n */\nexport const DatePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DatePicker<\n T extends DateValue\n>(props: DatePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, DatePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDatePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']);\n let {\n groupProps,\n labelProps,\n fieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDatePicker(\n {\n ...removeDataAttributes(props),\n label,\n validationBehavior\n },\n state,\n groupRef\n );\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-DatePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DatePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [DateFieldContext, fieldProps],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [CalendarContext, calendarProps as any],\n [OverlayTriggerStateContext, state],\n [\n PopoverContext,\n {\n trigger: 'DatePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n clearContexts: CLEAR_CONTEXTS\n }\n ],\n [DialogContext, dialogProps],\n [\n TextContext,\n {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }\n ],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-open={state.isOpen || undefined}\n />\n <HiddenDateInput\n autoComplete={props.autoComplete}\n name={props.name}\n isDisabled={props.isDisabled}\n state={state}\n />\n </Provider>\n );\n});\n\n/**\n * A date range picker combines two DateFields and a RangeCalendar popover to allow\n * users to enter or select a date and time range.\n */\nexport const DateRangePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(\n function DateRangePicker<T extends DateValue>(\n props: DateRangePickerProps<T>,\n ref: ForwardedRef<HTMLDivElement>\n ) {\n [props, ref] = useContextProps(props, ref, DateRangePickerContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useDateRangePickerState({\n ...props,\n validationBehavior\n });\n\n let groupRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']);\n let {\n groupProps,\n labelProps,\n startFieldProps,\n endFieldProps,\n buttonProps,\n dialogProps,\n calendarProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useDateRangePicker(\n {\n ...removeDataAttributes(props),\n label,\n validationBehavior\n },\n state,\n groupRef\n );\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isFocusWithin: isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: state.isInvalid,\n isOpen: state.isOpen,\n isReadOnly: props.isReadOnly || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-DateRangePicker'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [DateRangePickerStateContext, state],\n [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [RangeCalendarContext, calendarProps],\n [OverlayTriggerStateContext, state],\n [\n PopoverContext,\n {\n trigger: 'DateRangePicker',\n triggerRef: groupRef,\n placement: 'bottom start',\n clearContexts: CLEAR_CONTEXTS\n }\n ],\n [DialogContext, dialogProps],\n [\n DateFieldContext,\n {\n slots: {\n start: startFieldProps,\n end: endFieldProps\n }\n }\n ],\n [\n TextContext,\n {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }\n ],\n [FieldErrorContext, validation]\n ]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-focus-within={isFocused || undefined}\n data-invalid={state.isInvalid || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={props.isDisabled || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n data-open={state.isOpen || undefined}\n />\n </Provider>\n );\n }\n);\n"],"names":[],"version":3,"file":"DatePicker.mjs.map"}
|
package/dist/private/Dialog.cjs
CHANGED
|
@@ -11,7 +11,6 @@ var $kcsOx$react = require("react");
|
|
|
11
11
|
var $kcsOx$reactariauseId = require("react-aria/useId");
|
|
12
12
|
var $kcsOx$reactstatelyuseMenuTriggerState = require("react-stately/useMenuTriggerState");
|
|
13
13
|
var $kcsOx$reactariauseOverlayTrigger = require("react-aria/useOverlayTrigger");
|
|
14
|
-
var $kcsOx$reactariaprivateutilsuseResizeObserver = require("react-aria/private/utils/useResizeObserver");
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
function $parcel$interopDefault(a) {
|
|
@@ -49,7 +48,6 @@ $parcel$export(module.exports, "Dialog", function () { return $88595bf043e542ec$
|
|
|
49
48
|
|
|
50
49
|
|
|
51
50
|
|
|
52
|
-
|
|
53
51
|
const $88595bf043e542ec$export$8b93a07348a7730c = /*#__PURE__*/ (0, $kcsOx$react.createContext)(null);
|
|
54
52
|
const $88595bf043e542ec$export$d2f961adcb0afbe = /*#__PURE__*/ (0, $kcsOx$react.createContext)(null);
|
|
55
53
|
function $88595bf043e542ec$export$2e1e1122cf0cba88(props) {
|
|
@@ -60,17 +58,6 @@ function $88595bf043e542ec$export$2e1e1122cf0cba88(props) {
|
|
|
60
58
|
let { triggerProps: triggerProps, overlayProps: overlayProps } = (0, $kcsOx$reactariauseOverlayTrigger.useOverlayTrigger)({
|
|
61
59
|
type: 'dialog'
|
|
62
60
|
}, state, buttonRef);
|
|
63
|
-
// Allows popover width to match trigger element
|
|
64
|
-
let [buttonWidth, setButtonWidth] = (0, $kcsOx$react.useState)(null);
|
|
65
|
-
let onResize = (0, $kcsOx$react.useCallback)(()=>{
|
|
66
|
-
if (buttonRef.current) setButtonWidth(buttonRef.current.offsetWidth + 'px');
|
|
67
|
-
}, [
|
|
68
|
-
buttonRef
|
|
69
|
-
]);
|
|
70
|
-
(0, $kcsOx$reactariaprivateutilsuseResizeObserver.useResizeObserver)({
|
|
71
|
-
ref: buttonRef,
|
|
72
|
-
onResize: onResize
|
|
73
|
-
});
|
|
74
61
|
// Label dialog by the trigger as a fallback if there is no title slot.
|
|
75
62
|
// This is done in RAC instead of hooks because otherwise we cannot distinguish
|
|
76
63
|
// between context and props. Normally aria-labelledby overrides the title
|
|
@@ -96,10 +83,7 @@ function $88595bf043e542ec$export$2e1e1122cf0cba88(props) {
|
|
|
96
83
|
{
|
|
97
84
|
trigger: 'DialogTrigger',
|
|
98
85
|
triggerRef: buttonRef,
|
|
99
|
-
'aria-labelledby': overlayProps['aria-labelledby']
|
|
100
|
-
style: {
|
|
101
|
-
'--trigger-width': buttonWidth
|
|
102
|
-
}
|
|
86
|
+
'aria-labelledby': overlayProps['aria-labelledby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EAAE,CAAC;wBACjB,OAAO;4BACL,SAAS,IAAM,OAAO;wBACxB;oBACF;gBACF;aACD;SACF;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Dialog.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 {AriaDialogProps, useDialog} from 'react-aria/useDialog';\n\nimport {ButtonContext} from './Button';\nimport {\n ContextValue,\n DEFAULT_SLOT,\n dom,\n DOMRenderProps,\n Provider,\n SlotProps,\n StyleProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {HeadingContext} from './Heading';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {OverlayTriggerProps, OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {PopoverContext} from './Popover';\nimport {PressResponder} from 'react-aria/private/interactions/PressResponder';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactNode,\n useContext,\n useRef\n} from 'react';\nimport {RootMenuTriggerStateContext} from './Menu';\nimport {useId} from 'react-aria/useId';\nimport {useMenuTriggerState} from 'react-stately/useMenuTriggerState';\nimport {useOverlayTrigger} from 'react-aria/useOverlayTrigger';\n\nexport interface DialogTriggerProps extends OverlayTriggerProps {\n children: ReactNode;\n}\n\nexport interface DialogRenderProps {\n close: () => void;\n}\n\nexport interface DialogProps\n extends\n AriaDialogProps,\n StyleProps,\n SlotProps,\n DOMRenderProps<'section', undefined>,\n GlobalDOMAttributes<HTMLElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n *\n * @default 'react-aria-Dialog'\n */\n className?: string;\n /** Children of the dialog. A function may be provided to access a function to close the dialog. */\n children?: ReactNode | ((opts: DialogRenderProps) => ReactNode);\n}\n\nexport const DialogContext = createContext<ContextValue<DialogProps, HTMLElement>>(null);\nexport const OverlayTriggerStateContext = createContext<OverlayTriggerState | null>(null);\n\n/**\n * A DialogTrigger opens a dialog when a trigger element is pressed.\n */\nexport function DialogTrigger(props: DialogTriggerProps): JSX.Element {\n // Use useMenuTriggerState instead of useOverlayTriggerState in case a menu is embedded in the dialog.\n // This is needed to handle submenus.\n let state = useMenuTriggerState(props);\n\n let buttonRef = useRef<HTMLButtonElement>(null);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'dialog'}, state, buttonRef);\n\n // Label dialog by the trigger as a fallback if there is no title slot.\n // This is done in RAC instead of hooks because otherwise we cannot distinguish\n // between context and props. Normally aria-labelledby overrides the title\n // but when sent by context we want the title to win.\n triggerProps.id = useId();\n overlayProps['aria-labelledby'] = triggerProps.id;\n\n return (\n <Provider\n values={[\n [OverlayTriggerStateContext, state],\n [RootMenuTriggerStateContext, state],\n [DialogContext, overlayProps],\n [\n PopoverContext,\n {\n trigger: 'DialogTrigger',\n triggerRef: buttonRef,\n 'aria-labelledby': overlayProps['aria-labelledby']\n }\n ]\n ]}>\n <PressResponder {...triggerProps} ref={buttonRef} isPressed={state.isOpen}>\n {props.children}\n </PressResponder>\n </Provider>\n );\n}\n\n/**\n * A dialog is an overlay shown above other content in an application.\n */\nexport const Dialog = /*#__PURE__*/ (forwardRef as forwardRefType)(function Dialog(\n props: DialogProps,\n ref: ForwardedRef<HTMLElement>\n) {\n let originalAriaLabelledby = props['aria-labelledby'];\n [props, ref] = useContextProps(props, ref, DialogContext);\n let {dialogProps, titleProps} = useDialog(\n {\n ...props,\n // Only pass aria-labelledby from props, not context.\n // Context is used as a fallback below.\n 'aria-labelledby': originalAriaLabelledby\n },\n ref\n );\n let state = useContext(OverlayTriggerStateContext);\n\n if (!dialogProps['aria-label'] && !dialogProps['aria-labelledby']) {\n // If aria-labelledby exists on props, we know it came from context.\n // Use that as a fallback in case there is no title slot.\n if (props['aria-labelledby']) {\n dialogProps['aria-labelledby'] = props['aria-labelledby'];\n } else if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'If a Dialog does not contain a <Heading slot=\"title\">, it must have an aria-label or aria-labelledby attribute for accessibility.'\n );\n }\n }\n\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Dialog',\n className: props.className,\n style: props.style,\n children: props.children,\n values: {\n close: state?.close || (() => {})\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <dom.section\n {...mergeProps(DOMProps, renderProps, dialogProps)}\n render={props.render}\n ref={ref}\n slot={props.slot || undefined}>\n <Provider\n values={[\n [\n HeadingContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n title: {...titleProps, level: 2}\n }\n }\n ],\n [\n ButtonContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n close: {\n onPress: () => state?.close()\n }\n }\n }\n ]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.section>\n );\n});\n"],"names":[],"version":3,"file":"Dialog.cjs.map"}
|
package/dist/private/Dialog.js
CHANGED
|
@@ -7,11 +7,10 @@ import {useDialog as $bX1PO$useDialog} from "react-aria/useDialog";
|
|
|
7
7
|
import {filterDOMProps as $bX1PO$filterDOMProps} from "react-aria/filterDOMProps";
|
|
8
8
|
import {mergeProps as $bX1PO$mergeProps} from "react-aria/mergeProps";
|
|
9
9
|
import {PressResponder as $bX1PO$PressResponder} from "react-aria/private/interactions/PressResponder";
|
|
10
|
-
import $bX1PO$react, {createContext as $bX1PO$createContext, useRef as $bX1PO$useRef,
|
|
10
|
+
import $bX1PO$react, {createContext as $bX1PO$createContext, useRef as $bX1PO$useRef, forwardRef as $bX1PO$forwardRef, useContext as $bX1PO$useContext} from "react";
|
|
11
11
|
import {useId as $bX1PO$useId} from "react-aria/useId";
|
|
12
12
|
import {useMenuTriggerState as $bX1PO$useMenuTriggerState} from "react-stately/useMenuTriggerState";
|
|
13
13
|
import {useOverlayTrigger as $bX1PO$useOverlayTrigger} from "react-aria/useOverlayTrigger";
|
|
14
|
-
import {useResizeObserver as $bX1PO$useResizeObserver} from "react-aria/private/utils/useResizeObserver";
|
|
15
14
|
|
|
16
15
|
/*
|
|
17
16
|
* Copyright 2022 Adobe. All rights reserved.
|
|
@@ -36,7 +35,6 @@ import {useResizeObserver as $bX1PO$useResizeObserver} from "react-aria/private/
|
|
|
36
35
|
|
|
37
36
|
|
|
38
37
|
|
|
39
|
-
|
|
40
38
|
const $acf8e70c2f419f18$export$8b93a07348a7730c = /*#__PURE__*/ (0, $bX1PO$createContext)(null);
|
|
41
39
|
const $acf8e70c2f419f18$export$d2f961adcb0afbe = /*#__PURE__*/ (0, $bX1PO$createContext)(null);
|
|
42
40
|
function $acf8e70c2f419f18$export$2e1e1122cf0cba88(props) {
|
|
@@ -47,17 +45,6 @@ function $acf8e70c2f419f18$export$2e1e1122cf0cba88(props) {
|
|
|
47
45
|
let { triggerProps: triggerProps, overlayProps: overlayProps } = (0, $bX1PO$useOverlayTrigger)({
|
|
48
46
|
type: 'dialog'
|
|
49
47
|
}, state, buttonRef);
|
|
50
|
-
// Allows popover width to match trigger element
|
|
51
|
-
let [buttonWidth, setButtonWidth] = (0, $bX1PO$useState)(null);
|
|
52
|
-
let onResize = (0, $bX1PO$useCallback)(()=>{
|
|
53
|
-
if (buttonRef.current) setButtonWidth(buttonRef.current.offsetWidth + 'px');
|
|
54
|
-
}, [
|
|
55
|
-
buttonRef
|
|
56
|
-
]);
|
|
57
|
-
(0, $bX1PO$useResizeObserver)({
|
|
58
|
-
ref: buttonRef,
|
|
59
|
-
onResize: onResize
|
|
60
|
-
});
|
|
61
48
|
// Label dialog by the trigger as a fallback if there is no title slot.
|
|
62
49
|
// This is done in RAC instead of hooks because otherwise we cannot distinguish
|
|
63
50
|
// between context and props. Normally aria-labelledby overrides the title
|
|
@@ -83,10 +70,7 @@ function $acf8e70c2f419f18$export$2e1e1122cf0cba88(props) {
|
|
|
83
70
|
{
|
|
84
71
|
trigger: 'DialogTrigger',
|
|
85
72
|
triggerRef: buttonRef,
|
|
86
|
-
'aria-labelledby': overlayProps['aria-labelledby']
|
|
87
|
-
style: {
|
|
88
|
-
'--trigger-width': buttonWidth
|
|
89
|
-
}
|
|
73
|
+
'aria-labelledby': overlayProps['aria-labelledby']
|
|
90
74
|
}
|
|
91
75
|
]
|
|
92
76
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AA8DM,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAA0C;AAC5E,MAAM,yDAA6B,CAAA,GAAA,oBAAY,EAA8B;AAK7E,SAAS,0CAAc,KAAyB;IACrD,sGAAsG;IACtG,qCAAqC;IACrC,IAAI,QAAQ,CAAA,GAAA,0BAAkB,EAAE;IAEhC,IAAI,YAAY,CAAA,GAAA,aAAK,EAAqB;IAC1C,IAAI,gBAAC,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;QAAC,MAAM;IAAQ,GAAG,OAAO;IAE9E,uEAAuE;IACvE,+EAA+E;IAC/E,0EAA0E;IAC1E,qDAAqD;IACrD,aAAa,EAAE,GAAG,CAAA,GAAA,YAAI;IACtB,YAAY,CAAC,kBAAkB,GAAG,aAAa,EAAE;IAEjD,qBACE,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC;gBAA4B;aAAM;YACnC;gBAAC,CAAA,GAAA,yCAA0B;gBAAG;aAAM;YACpC;gBAAC;gBAAe;aAAa;YAC7B;gBACE,CAAA,GAAA,yCAAa;gBACb;oBACE,SAAS;oBACT,YAAY;oBACZ,mBAAmB,YAA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M;QACpB,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;qBACpB,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBACE,CAAA,GAAA,yCAAa;gBACb;oBACE,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE,CAAC;wBACjB,OAAO;4BAAC,GAAG,UAAU;4BAAE,OAAO;wBAAC;oBACjC;gBACF;aACD;YACD;gBACE,CAAA,GAAA,yCAAY;gBACZ;oBACE,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE,CAAC;wBACjB,OAAO;4BACL,SAAS,IAAM,kBAAA,4BAAA,MAAO,KAAK;wBAC7B;oBACF;gBACF;aACD;SACF;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Dialog.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 {AriaDialogProps, useDialog} from 'react-aria/useDialog';\n\nimport {ButtonContext} from './Button';\nimport {\n ContextValue,\n DEFAULT_SLOT,\n dom,\n DOMRenderProps,\n Provider,\n SlotProps,\n StyleProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {HeadingContext} from './Heading';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {OverlayTriggerProps, OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {PopoverContext} from './Popover';\nimport {PressResponder} from 'react-aria/private/interactions/PressResponder';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactNode,\n useContext,\n useRef\n} from 'react';\nimport {RootMenuTriggerStateContext} from './Menu';\nimport {useId} from 'react-aria/useId';\nimport {useMenuTriggerState} from 'react-stately/useMenuTriggerState';\nimport {useOverlayTrigger} from 'react-aria/useOverlayTrigger';\n\nexport interface DialogTriggerProps extends OverlayTriggerProps {\n children: ReactNode;\n}\n\nexport interface DialogRenderProps {\n close: () => void;\n}\n\nexport interface DialogProps\n extends\n AriaDialogProps,\n StyleProps,\n SlotProps,\n DOMRenderProps<'section', undefined>,\n GlobalDOMAttributes<HTMLElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n *\n * @default 'react-aria-Dialog'\n */\n className?: string;\n /** Children of the dialog. A function may be provided to access a function to close the dialog. */\n children?: ReactNode | ((opts: DialogRenderProps) => ReactNode);\n}\n\nexport const DialogContext = createContext<ContextValue<DialogProps, HTMLElement>>(null);\nexport const OverlayTriggerStateContext = createContext<OverlayTriggerState | null>(null);\n\n/**\n * A DialogTrigger opens a dialog when a trigger element is pressed.\n */\nexport function DialogTrigger(props: DialogTriggerProps): JSX.Element {\n // Use useMenuTriggerState instead of useOverlayTriggerState in case a menu is embedded in the dialog.\n // This is needed to handle submenus.\n let state = useMenuTriggerState(props);\n\n let buttonRef = useRef<HTMLButtonElement>(null);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'dialog'}, state, buttonRef);\n\n // Label dialog by the trigger as a fallback if there is no title slot.\n // This is done in RAC instead of hooks because otherwise we cannot distinguish\n // between context and props. Normally aria-labelledby overrides the title\n // but when sent by context we want the title to win.\n triggerProps.id = useId();\n overlayProps['aria-labelledby'] = triggerProps.id;\n\n return (\n <Provider\n values={[\n [OverlayTriggerStateContext, state],\n [RootMenuTriggerStateContext, state],\n [DialogContext, overlayProps],\n [\n PopoverContext,\n {\n trigger: 'DialogTrigger',\n triggerRef: buttonRef,\n 'aria-labelledby': overlayProps['aria-labelledby']\n }\n ]\n ]}>\n <PressResponder {...triggerProps} ref={buttonRef} isPressed={state.isOpen}>\n {props.children}\n </PressResponder>\n </Provider>\n );\n}\n\n/**\n * A dialog is an overlay shown above other content in an application.\n */\nexport const Dialog = /*#__PURE__*/ (forwardRef as forwardRefType)(function Dialog(\n props: DialogProps,\n ref: ForwardedRef<HTMLElement>\n) {\n let originalAriaLabelledby = props['aria-labelledby'];\n [props, ref] = useContextProps(props, ref, DialogContext);\n let {dialogProps, titleProps} = useDialog(\n {\n ...props,\n // Only pass aria-labelledby from props, not context.\n // Context is used as a fallback below.\n 'aria-labelledby': originalAriaLabelledby\n },\n ref\n );\n let state = useContext(OverlayTriggerStateContext);\n\n if (!dialogProps['aria-label'] && !dialogProps['aria-labelledby']) {\n // If aria-labelledby exists on props, we know it came from context.\n // Use that as a fallback in case there is no title slot.\n if (props['aria-labelledby']) {\n dialogProps['aria-labelledby'] = props['aria-labelledby'];\n } else if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'If a Dialog does not contain a <Heading slot=\"title\">, it must have an aria-label or aria-labelledby attribute for accessibility.'\n );\n }\n }\n\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Dialog',\n className: props.className,\n style: props.style,\n children: props.children,\n values: {\n close: state?.close || (() => {})\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <dom.section\n {...mergeProps(DOMProps, renderProps, dialogProps)}\n render={props.render}\n ref={ref}\n slot={props.slot || undefined}>\n <Provider\n values={[\n [\n HeadingContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n title: {...titleProps, level: 2}\n }\n }\n ],\n [\n ButtonContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n close: {\n onPress: () => state?.close()\n }\n }\n }\n ]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.section>\n );\n});\n"],"names":[],"version":3,"file":"Dialog.js.map"}
|
package/dist/private/Dialog.mjs
CHANGED
|
@@ -7,11 +7,10 @@ import {useDialog as $gV8PY$useDialog} from "react-aria/useDialog";
|
|
|
7
7
|
import {filterDOMProps as $gV8PY$filterDOMProps} from "react-aria/filterDOMProps";
|
|
8
8
|
import {mergeProps as $gV8PY$mergeProps} from "react-aria/mergeProps";
|
|
9
9
|
import {PressResponder as $gV8PY$PressResponder} from "react-aria/private/interactions/PressResponder";
|
|
10
|
-
import $gV8PY$react, {createContext as $gV8PY$createContext, useRef as $gV8PY$useRef,
|
|
10
|
+
import $gV8PY$react, {createContext as $gV8PY$createContext, useRef as $gV8PY$useRef, forwardRef as $gV8PY$forwardRef, useContext as $gV8PY$useContext} from "react";
|
|
11
11
|
import {useId as $gV8PY$useId} from "react-aria/useId";
|
|
12
12
|
import {useMenuTriggerState as $gV8PY$useMenuTriggerState} from "react-stately/useMenuTriggerState";
|
|
13
13
|
import {useOverlayTrigger as $gV8PY$useOverlayTrigger} from "react-aria/useOverlayTrigger";
|
|
14
|
-
import {useResizeObserver as $gV8PY$useResizeObserver} from "react-aria/private/utils/useResizeObserver";
|
|
15
14
|
|
|
16
15
|
/*
|
|
17
16
|
* Copyright 2022 Adobe. All rights reserved.
|
|
@@ -36,7 +35,6 @@ import {useResizeObserver as $gV8PY$useResizeObserver} from "react-aria/private/
|
|
|
36
35
|
|
|
37
36
|
|
|
38
37
|
|
|
39
|
-
|
|
40
38
|
const $f2ff30fde7b014be$export$8b93a07348a7730c = /*#__PURE__*/ (0, $gV8PY$createContext)(null);
|
|
41
39
|
const $f2ff30fde7b014be$export$d2f961adcb0afbe = /*#__PURE__*/ (0, $gV8PY$createContext)(null);
|
|
42
40
|
function $f2ff30fde7b014be$export$2e1e1122cf0cba88(props) {
|
|
@@ -47,17 +45,6 @@ function $f2ff30fde7b014be$export$2e1e1122cf0cba88(props) {
|
|
|
47
45
|
let { triggerProps: triggerProps, overlayProps: overlayProps } = (0, $gV8PY$useOverlayTrigger)({
|
|
48
46
|
type: 'dialog'
|
|
49
47
|
}, state, buttonRef);
|
|
50
|
-
// Allows popover width to match trigger element
|
|
51
|
-
let [buttonWidth, setButtonWidth] = (0, $gV8PY$useState)(null);
|
|
52
|
-
let onResize = (0, $gV8PY$useCallback)(()=>{
|
|
53
|
-
if (buttonRef.current) setButtonWidth(buttonRef.current.offsetWidth + 'px');
|
|
54
|
-
}, [
|
|
55
|
-
buttonRef
|
|
56
|
-
]);
|
|
57
|
-
(0, $gV8PY$useResizeObserver)({
|
|
58
|
-
ref: buttonRef,
|
|
59
|
-
onResize: onResize
|
|
60
|
-
});
|
|
61
48
|
// Label dialog by the trigger as a fallback if there is no title slot.
|
|
62
49
|
// This is done in RAC instead of hooks because otherwise we cannot distinguish
|
|
63
50
|
// between context and props. Normally aria-labelledby overrides the title
|
|
@@ -83,10 +70,7 @@ function $f2ff30fde7b014be$export$2e1e1122cf0cba88(props) {
|
|
|
83
70
|
{
|
|
84
71
|
trigger: 'DialogTrigger',
|
|
85
72
|
triggerRef: buttonRef,
|
|
86
|
-
'aria-labelledby': overlayProps['aria-labelledby']
|
|
87
|
-
style: {
|
|
88
|
-
'--trigger-width': buttonWidth
|
|
89
|
-
}
|
|
73
|
+
'aria-labelledby': overlayProps['aria-labelledby']
|
|
90
74
|
}
|
|
91
75
|
]
|
|
92
76
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AA8DM,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAA0C;AAC5E,MAAM,yDAA6B,CAAA,GAAA,oBAAY,EAA8B;AAK7E,SAAS,0CAAc,KAAyB;IACrD,sGAAsG;IACtG,qCAAqC;IACrC,IAAI,QAAQ,CAAA,GAAA,0BAAkB,EAAE;IAEhC,IAAI,YAAY,CAAA,GAAA,aAAK,EAAqB;IAC1C,IAAI,gBAAC,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;QAAC,MAAM;IAAQ,GAAG,OAAO;IAE9E,uEAAuE;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kB;QAClB,WAAW,MAAM,SAAS;QAC1B,OAAO,MAAM,KAAK;QAClB,UAAU,MAAM,QAAQ;QACxB,QAAQ;YACN,OAAO,OAAO,SAAU,CAAA,KAAO,CAAA;QACjC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAElD,qBACE,gCAAC,CAAA,GAAA,yCAAE,EAAE,OAAO;QACT,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,aAAa,YAAY;QAClD,QAAQ,MAAM,MAAM;QACpB,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;qBACpB,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBACE,CAAA,GAAA,yCAAa;gBACb;oBACE,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE,CAAC;wBACjB,OAAO;4BAAC,GAAG,UAAU;4BAAE,OAAO;wBAAC;oBACjC;gBACF;aACD;YACD;gBACE,CAAA,GAAA,yCAAY;gBACZ;oBACE,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE,CAAC;wBACjB,OAAO;4BACL,SAAS,IAAM,OAAO;wBACxB;oBACF;gBACF;aACD;SACF;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Dialog.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 {AriaDialogProps, useDialog} from 'react-aria/useDialog';\n\nimport {ButtonContext} from './Button';\nimport {\n ContextValue,\n DEFAULT_SLOT,\n dom,\n DOMRenderProps,\n Provider,\n SlotProps,\n StyleProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {HeadingContext} from './Heading';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {OverlayTriggerProps, OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {PopoverContext} from './Popover';\nimport {PressResponder} from 'react-aria/private/interactions/PressResponder';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactNode,\n useContext,\n useRef\n} from 'react';\nimport {RootMenuTriggerStateContext} from './Menu';\nimport {useId} from 'react-aria/useId';\nimport {useMenuTriggerState} from 'react-stately/useMenuTriggerState';\nimport {useOverlayTrigger} from 'react-aria/useOverlayTrigger';\n\nexport interface DialogTriggerProps extends OverlayTriggerProps {\n children: ReactNode;\n}\n\nexport interface DialogRenderProps {\n close: () => void;\n}\n\nexport interface DialogProps\n extends\n AriaDialogProps,\n StyleProps,\n SlotProps,\n DOMRenderProps<'section', undefined>,\n GlobalDOMAttributes<HTMLElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n *\n * @default 'react-aria-Dialog'\n */\n className?: string;\n /** Children of the dialog. A function may be provided to access a function to close the dialog. */\n children?: ReactNode | ((opts: DialogRenderProps) => ReactNode);\n}\n\nexport const DialogContext = createContext<ContextValue<DialogProps, HTMLElement>>(null);\nexport const OverlayTriggerStateContext = createContext<OverlayTriggerState | null>(null);\n\n/**\n * A DialogTrigger opens a dialog when a trigger element is pressed.\n */\nexport function DialogTrigger(props: DialogTriggerProps): JSX.Element {\n // Use useMenuTriggerState instead of useOverlayTriggerState in case a menu is embedded in the dialog.\n // This is needed to handle submenus.\n let state = useMenuTriggerState(props);\n\n let buttonRef = useRef<HTMLButtonElement>(null);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'dialog'}, state, buttonRef);\n\n // Label dialog by the trigger as a fallback if there is no title slot.\n // This is done in RAC instead of hooks because otherwise we cannot distinguish\n // between context and props. Normally aria-labelledby overrides the title\n // but when sent by context we want the title to win.\n triggerProps.id = useId();\n overlayProps['aria-labelledby'] = triggerProps.id;\n\n return (\n <Provider\n values={[\n [OverlayTriggerStateContext, state],\n [RootMenuTriggerStateContext, state],\n [DialogContext, overlayProps],\n [\n PopoverContext,\n {\n trigger: 'DialogTrigger',\n triggerRef: buttonRef,\n 'aria-labelledby': overlayProps['aria-labelledby']\n }\n ]\n ]}>\n <PressResponder {...triggerProps} ref={buttonRef} isPressed={state.isOpen}>\n {props.children}\n </PressResponder>\n </Provider>\n );\n}\n\n/**\n * A dialog is an overlay shown above other content in an application.\n */\nexport const Dialog = /*#__PURE__*/ (forwardRef as forwardRefType)(function Dialog(\n props: DialogProps,\n ref: ForwardedRef<HTMLElement>\n) {\n let originalAriaLabelledby = props['aria-labelledby'];\n [props, ref] = useContextProps(props, ref, DialogContext);\n let {dialogProps, titleProps} = useDialog(\n {\n ...props,\n // Only pass aria-labelledby from props, not context.\n // Context is used as a fallback below.\n 'aria-labelledby': originalAriaLabelledby\n },\n ref\n );\n let state = useContext(OverlayTriggerStateContext);\n\n if (!dialogProps['aria-label'] && !dialogProps['aria-labelledby']) {\n // If aria-labelledby exists on props, we know it came from context.\n // Use that as a fallback in case there is no title slot.\n if (props['aria-labelledby']) {\n dialogProps['aria-labelledby'] = props['aria-labelledby'];\n } else if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'If a Dialog does not contain a <Heading slot=\"title\">, it must have an aria-label or aria-labelledby attribute for accessibility.'\n );\n }\n }\n\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Dialog',\n className: props.className,\n style: props.style,\n children: props.children,\n values: {\n close: state?.close || (() => {})\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <dom.section\n {...mergeProps(DOMProps, renderProps, dialogProps)}\n render={props.render}\n ref={ref}\n slot={props.slot || undefined}>\n <Provider\n values={[\n [\n HeadingContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n title: {...titleProps, level: 2}\n }\n }\n ],\n [\n ButtonContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n close: {\n onPress: () => state?.close()\n }\n }\n }\n ]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.section>\n );\n});\n"],"names":[],"version":3,"file":"Dialog.mjs.map"}
|