react-aria-components 1.17.0 → 1.18.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 +19 -2
- package/dist/private/GridList.cjs.map +1 -1
- package/dist/private/GridList.js +20 -3
- package/dist/private/GridList.js.map +1 -1
- package/dist/private/GridList.mjs +20 -3
- 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 +44 -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
package/dist/private/Switch.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {dom as $b7b7a92703138c9b$export$df3a06d6289f983e, removeDataAttributes as $b7b7a92703138c9b$export$ef03459518577ad4, useContextProps as $b7b7a92703138c9b$export$29f1550f4b0d4415, useRenderProps as $b7b7a92703138c9b$export$4d86445c2cf5e3} from "./utils.js";
|
|
1
|
+
import {dom as $b7b7a92703138c9b$export$df3a06d6289f983e, Provider as $b7b7a92703138c9b$export$2881499e37b75b9a, removeDataAttributes as $b7b7a92703138c9b$export$ef03459518577ad4, useContextProps as $b7b7a92703138c9b$export$29f1550f4b0d4415, useRenderProps as $b7b7a92703138c9b$export$4d86445c2cf5e3, useSlottedContext as $b7b7a92703138c9b$export$fabf2dc03a41866e} from "./utils.js";
|
|
2
|
+
import {FieldErrorContext as $6567560e1d9cc847$export$ff05c3ac10437e03} from "./FieldError.js";
|
|
3
|
+
import {FormContext as $c7332d4a2d191cd2$export$c24727297075ec6a} from "./Form.js";
|
|
4
|
+
import {TextContext as $20d769b1e2b13352$export$9afb8bc826b033ea} from "./Text.js";
|
|
2
5
|
import {useSwitch as $aLaER$useSwitch} from "react-aria/useSwitch";
|
|
3
6
|
import {filterDOMProps as $aLaER$filterDOMProps} from "react-aria/filterDOMProps";
|
|
4
7
|
import {mergeProps as $aLaER$mergeProps} from "react-aria/mergeProps";
|
|
5
8
|
import {mergeRefs as $aLaER$mergeRefs} from "react-aria/mergeRefs";
|
|
6
|
-
import $aLaER$react, {createContext as $aLaER$createContext, forwardRef as $aLaER$forwardRef} from "react";
|
|
9
|
+
import $aLaER$react, {createContext as $aLaER$createContext, forwardRef as $aLaER$forwardRef, useContext as $aLaER$useContext} from "react";
|
|
7
10
|
import {useToggleState as $aLaER$useToggleState} from "react-stately/useToggleState";
|
|
8
11
|
import {useFocusRing as $aLaER$useFocusRing} from "react-aria/useFocusRing";
|
|
9
12
|
import {useHover as $aLaER$useHover} from "react-aria/useHover";
|
|
@@ -31,26 +34,131 @@ import {VisuallyHidden as $aLaER$VisuallyHidden} from "react-aria/VisuallyHidden
|
|
|
31
34
|
|
|
32
35
|
|
|
33
36
|
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
34
40
|
const $7a050e53d1672c98$export$8699e3b644d5a28a = /*#__PURE__*/ (0, $aLaER$createContext)(null);
|
|
41
|
+
const $7a050e53d1672c98$export$3e1405298f0cafda = /*#__PURE__*/ (0, $aLaER$createContext)(null);
|
|
42
|
+
const $7a050e53d1672c98$export$5cc1518e1ec171c = /*#__PURE__*/ (0, $aLaER$createContext)(null);
|
|
35
43
|
const $7a050e53d1672c98$export$b5d5cf8927ab7262 = /*#__PURE__*/ (0, $aLaER$forwardRef)(function Switch(props, ref) {
|
|
36
44
|
let { inputRef: userProvidedInputRef = null, ...otherProps } = props;
|
|
37
45
|
[props, ref] = (0, $b7b7a92703138c9b$export$29f1550f4b0d4415)(otherProps, ref, $7a050e53d1672c98$export$8699e3b644d5a28a);
|
|
38
46
|
let inputRef = (0, $aLaER$useObjectRef)((0, $aLaER$mergeRefs)(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null));
|
|
39
47
|
let state = (0, $aLaER$useToggleState)(props);
|
|
40
|
-
let
|
|
48
|
+
let aria = (0, $aLaER$useSwitch)({
|
|
41
49
|
...(0, $b7b7a92703138c9b$export$ef03459518577ad4)(props),
|
|
42
50
|
// ReactNode type doesn't allow function children.
|
|
43
51
|
children: typeof props.children === 'function' ? true : props.children
|
|
44
52
|
}, state, inputRef);
|
|
53
|
+
return /*#__PURE__*/ (0, $aLaER$react).createElement((0, $b7b7a92703138c9b$export$2881499e37b75b9a), {
|
|
54
|
+
values: [
|
|
55
|
+
[
|
|
56
|
+
$7a050e53d1672c98$export$5cc1518e1ec171c,
|
|
57
|
+
state
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
$7a050e53d1672c98$var$InternalSwitchContext,
|
|
61
|
+
{
|
|
62
|
+
...aria,
|
|
63
|
+
inputRef: inputRef,
|
|
64
|
+
defaultClassName: 'react-aria-Switch'
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
]
|
|
68
|
+
}, /*#__PURE__*/ (0, $aLaER$react).createElement($7a050e53d1672c98$export$72111f742dee7cb8, {
|
|
69
|
+
...props,
|
|
70
|
+
ref: ref
|
|
71
|
+
}));
|
|
72
|
+
});
|
|
73
|
+
const $7a050e53d1672c98$var$InternalSwitchContext = /*#__PURE__*/ (0, $aLaER$createContext)(null);
|
|
74
|
+
const $7a050e53d1672c98$export$208c2e617baf9fc3 = /*#__PURE__*/ (0, $aLaER$forwardRef)(function Switch(props, ref) {
|
|
75
|
+
let { inputRef: userProvidedInputRef = null, ...otherProps } = props;
|
|
76
|
+
[props, ref] = (0, $b7b7a92703138c9b$export$29f1550f4b0d4415)(otherProps, ref, $7a050e53d1672c98$export$3e1405298f0cafda);
|
|
77
|
+
let { validationBehavior: formValidationBehavior } = (0, $b7b7a92703138c9b$export$fabf2dc03a41866e)((0, $c7332d4a2d191cd2$export$c24727297075ec6a)) || {};
|
|
78
|
+
var _props_validationBehavior, _ref;
|
|
79
|
+
let validationBehavior = (_ref = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : formValidationBehavior) !== null && _ref !== void 0 ? _ref : 'native';
|
|
80
|
+
let inputRef = (0, $aLaER$useObjectRef)((0, $aLaER$mergeRefs)(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null));
|
|
81
|
+
let state = (0, $aLaER$useToggleState)(props);
|
|
82
|
+
let aria = (0, $aLaER$useSwitch)({
|
|
83
|
+
...(0, $b7b7a92703138c9b$export$ef03459518577ad4)(props),
|
|
84
|
+
// ReactNode type doesn't allow function children.
|
|
85
|
+
children: typeof props.children === 'function' ? true : props.children,
|
|
86
|
+
validationBehavior: validationBehavior
|
|
87
|
+
}, state, inputRef);
|
|
88
|
+
let { descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, isSelected: isSelected, isDisabled: isDisabled, isReadOnly: isReadOnly, isInvalid: isInvalid, validationDetails: validationDetails, validationErrors: validationErrors } = aria;
|
|
89
|
+
let renderProps = (0, $b7b7a92703138c9b$export$4d86445c2cf5e3)({
|
|
90
|
+
...props,
|
|
91
|
+
defaultClassName: 'react-aria-SwitchField',
|
|
92
|
+
values: {
|
|
93
|
+
isSelected: isSelected,
|
|
94
|
+
isDisabled: isDisabled,
|
|
95
|
+
isReadOnly: isReadOnly,
|
|
96
|
+
isInvalid: isInvalid,
|
|
97
|
+
isRequired: props.isRequired || false,
|
|
98
|
+
state: state
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
let DOMProps = (0, $aLaER$filterDOMProps)(props, {
|
|
102
|
+
global: true
|
|
103
|
+
});
|
|
104
|
+
delete DOMProps.id;
|
|
105
|
+
delete DOMProps.onClick;
|
|
106
|
+
return /*#__PURE__*/ (0, $aLaER$react).createElement((0, $b7b7a92703138c9b$export$df3a06d6289f983e).div, {
|
|
107
|
+
...(0, $aLaER$mergeProps)(DOMProps, renderProps),
|
|
108
|
+
ref: ref,
|
|
109
|
+
slot: props.slot || undefined,
|
|
110
|
+
"data-selected": isSelected || undefined,
|
|
111
|
+
"data-disabled": isDisabled || undefined,
|
|
112
|
+
"data-readonly": isReadOnly || undefined,
|
|
113
|
+
"data-invalid": isInvalid || undefined,
|
|
114
|
+
"data-required": props.isRequired || undefined
|
|
115
|
+
}, /*#__PURE__*/ (0, $aLaER$react).createElement((0, $b7b7a92703138c9b$export$2881499e37b75b9a), {
|
|
116
|
+
values: [
|
|
117
|
+
[
|
|
118
|
+
$7a050e53d1672c98$export$5cc1518e1ec171c,
|
|
119
|
+
state
|
|
120
|
+
],
|
|
121
|
+
[
|
|
122
|
+
$7a050e53d1672c98$var$InternalSwitchContext,
|
|
123
|
+
{
|
|
124
|
+
...aria,
|
|
125
|
+
inputRef: inputRef,
|
|
126
|
+
defaultClassName: 'react-aria-SwitchButton',
|
|
127
|
+
isRequired: props.isRequired
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
[
|
|
131
|
+
(0, $20d769b1e2b13352$export$9afb8bc826b033ea),
|
|
132
|
+
{
|
|
133
|
+
slots: {
|
|
134
|
+
description: descriptionProps,
|
|
135
|
+
errorMessage: errorMessageProps
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
[
|
|
140
|
+
(0, $6567560e1d9cc847$export$ff05c3ac10437e03),
|
|
141
|
+
{
|
|
142
|
+
isInvalid: isInvalid,
|
|
143
|
+
validationDetails: validationDetails,
|
|
144
|
+
validationErrors: validationErrors
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
]
|
|
148
|
+
}, renderProps.children));
|
|
149
|
+
});
|
|
150
|
+
const $7a050e53d1672c98$export$72111f742dee7cb8 = /*#__PURE__*/ (0, $aLaER$forwardRef)(function SwitchButton(props, ref) {
|
|
151
|
+
let { labelProps: labelProps, inputProps: inputProps, isSelected: isSelected, isDisabled: isDisabled, isReadOnly: isReadOnly, isPressed: isPressed, isInvalid: isInvalid, inputRef: inputRef, defaultClassName: defaultClassName, isRequired: isRequired } = (0, $aLaER$useContext)($7a050e53d1672c98$var$InternalSwitchContext);
|
|
45
152
|
let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $aLaER$useFocusRing)();
|
|
46
|
-
let isInteractionDisabled =
|
|
153
|
+
let isInteractionDisabled = isDisabled || isReadOnly;
|
|
154
|
+
let state = (0, $aLaER$useContext)($7a050e53d1672c98$export$5cc1518e1ec171c);
|
|
47
155
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $aLaER$useHover)({
|
|
48
156
|
...props,
|
|
49
157
|
isDisabled: isInteractionDisabled
|
|
50
158
|
});
|
|
51
159
|
let renderProps = (0, $b7b7a92703138c9b$export$4d86445c2cf5e3)({
|
|
52
160
|
...props,
|
|
53
|
-
defaultClassName:
|
|
161
|
+
defaultClassName: defaultClassName,
|
|
54
162
|
values: {
|
|
55
163
|
isSelected: isSelected,
|
|
56
164
|
isPressed: isPressed,
|
|
@@ -59,6 +167,8 @@ const $7a050e53d1672c98$export$b5d5cf8927ab7262 = /*#__PURE__*/ (0, $aLaER$forwa
|
|
|
59
167
|
isFocusVisible: isFocusVisible,
|
|
60
168
|
isDisabled: isDisabled,
|
|
61
169
|
isReadOnly: isReadOnly,
|
|
170
|
+
isInvalid: isInvalid,
|
|
171
|
+
isRequired: isRequired || false,
|
|
62
172
|
state: state
|
|
63
173
|
}
|
|
64
174
|
});
|
|
@@ -77,7 +187,9 @@ const $7a050e53d1672c98$export$b5d5cf8927ab7262 = /*#__PURE__*/ (0, $aLaER$forwa
|
|
|
77
187
|
"data-focused": isFocused || undefined,
|
|
78
188
|
"data-focus-visible": isFocusVisible || undefined,
|
|
79
189
|
"data-disabled": isDisabled || undefined,
|
|
80
|
-
"data-readonly": isReadOnly || undefined
|
|
190
|
+
"data-readonly": isReadOnly || undefined,
|
|
191
|
+
"data-invalid": isInvalid || undefined,
|
|
192
|
+
"data-required": isRequired || undefined
|
|
81
193
|
}, /*#__PURE__*/ (0, $aLaER$react).createElement((0, $aLaER$VisuallyHidden), {
|
|
82
194
|
elementType: "span"
|
|
83
195
|
}, /*#__PURE__*/ (0, $aLaER$react).createElement("input", {
|
|
@@ -87,5 +199,5 @@ const $7a050e53d1672c98$export$b5d5cf8927ab7262 = /*#__PURE__*/ (0, $aLaER$forwa
|
|
|
87
199
|
});
|
|
88
200
|
|
|
89
201
|
|
|
90
|
-
export {$7a050e53d1672c98$export$8699e3b644d5a28a as SwitchContext, $7a050e53d1672c98$export$b5d5cf8927ab7262 as Switch};
|
|
202
|
+
export {$7a050e53d1672c98$export$8699e3b644d5a28a as SwitchContext, $7a050e53d1672c98$export$3e1405298f0cafda as SwitchFieldContext, $7a050e53d1672c98$export$5cc1518e1ec171c as ToggleStateContext, $7a050e53d1672c98$export$b5d5cf8927ab7262 as Switch, $7a050e53d1672c98$export$72111f742dee7cb8 as SwitchButton, $7a050e53d1672c98$export$208c2e617baf9fc3 as SwitchField};
|
|
91
203
|
//# sourceMappingURL=Switch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AAgFM,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAA+C;AAKjF,MAAM,4CAAuB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,OAAO,KAAkB,EAAE,GAAmC;IACxI,IAAI,EACF,UAAU,uBAAuB,IAAI,EACrC,GAAG,YACJ,GAAG;IACJ,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,YAAY,KAAK;IAChD,IAAI,WAAW,CAAA,GAAA,mBAAW,EAAE,CAAA,GAAA,gBAAQ,EAAE,sBAAsB,MAAM,QAAQ,KAAK,YAAY,MAAM,QAAQ,GAAG;IAC5G,IAAI,QAAQ,CAAA,GAAA,qBAAa,EAAE;IAC3B,IAAI,cAAC,UAAU,cAAE,UAAU,cAAE,UAAU,cAAE,UAAU,cAAE,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAAE;QACtF,GAAG,CAAA,GAAA,yCAAmB,EAAE,MAAM;QAC9B,kDAAkD;QAClD,UAAU,OAAO,MAAM,QAAQ,KAAK,aAAa,OAAO,MAAM,QAAQ;IACxE,GAAG,OAAO;IACV,IAAI,aAAC,SAAS,kBAAE,cAAc,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,mBAAW;IACzD,IAAI,wBAAwB,MAAM,UAAU,IAAI,MAAM,UAAU;IAEhE,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QACrC,GAAG,KAAK;QACR,YAAY;IACd;IAEA,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;wBACN;uBACA;uBACA;uBACA;4BACA;wBACA;wBACA;mBACA;QACF;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAClD,OAAO,SAAS,EAAE;IAClB,OAAO,SAAS,OAAO;IAEvB,qBACE,gCAAC,CAAA,GAAA,yCAAE,EAAE,KAAK;QACP,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,YAAY,YAAY,YAAY;QAC7D,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,cAAc;QAC7B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,iBAAe,cAAc;QAC7B,iBAAe,cAAc;qBAC7B,gCAAC,CAAA,GAAA,qBAAa;QAAE,aAAY;qBAC1B,gCAAC;QAAO,GAAG,CAAA,GAAA,iBAAS,EAAE,YAAY,WAAW;QAAE,KAAK;SAErD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Switch.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 */\n\nimport {AriaSwitchProps, useSwitch} from 'react-aria/useSwitch';\n\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n removeDataAttributes,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {HoverEvents} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\nimport {ToggleState, useToggleState} from 'react-stately/useToggleState';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {VisuallyHidden} from 'react-aria/VisuallyHidden';\n\nexport interface SwitchProps extends Omit<AriaSwitchProps, 'children'>, HoverEvents, RenderProps<SwitchRenderProps, 'label'>, SlotProps, Omit<GlobalDOMAttributes<HTMLLabelElement>, 'onClick'> {\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-Switch'\n */\n className?: ClassNameOrFunction<SwitchRenderProps>,\n /**\n * A ref for the HTML input element.\n */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\nexport interface SwitchRenderProps {\n /**\n * Whether the switch is selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the switch is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the switch is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the switch is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the switch is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the switch is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the switch is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * State of the switch.\n */\n state: ToggleState\n}\n\nexport const SwitchContext = createContext<ContextValue<SwitchProps, HTMLLabelElement>>(null);\n\n/**\n * A switch allows a user to turn a setting on or off.\n */\nexport const Switch = /*#__PURE__*/ (forwardRef as forwardRefType)(function Switch(props: SwitchProps, ref: ForwardedRef<HTMLLabelElement>) {\n let {\n inputRef: userProvidedInputRef = null,\n ...otherProps\n } = props;\n [props, ref] = useContextProps(otherProps, ref, SwitchContext);\n let inputRef = useObjectRef(mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null));\n let state = useToggleState(props);\n let {labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed} = useSwitch({\n ...removeDataAttributes(props),\n // ReactNode type doesn't allow function children.\n children: typeof props.children === 'function' ? true : props.children\n }, state, inputRef);\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let isInteractionDisabled = props.isDisabled || props.isReadOnly;\n\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: isInteractionDisabled\n });\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Switch',\n values: {\n isSelected,\n isPressed,\n isHovered,\n isFocused,\n isFocusVisible,\n isDisabled,\n isReadOnly,\n state\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n delete DOMProps.onClick;\n\n return (\n <dom.label\n {...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-selected={isSelected || undefined}\n data-pressed={isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}>\n <VisuallyHidden elementType=\"span\">\n <input {...mergeProps(inputProps, focusProps)} ref={inputRef} />\n </VisuallyHidden>\n {renderProps.children}\n </dom.label>\n );\n});\n"],"names":[],"version":3,"file":"Switch.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAwMM,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAA+C;AACjF,MAAM,0DACX,CAAA,GAAA,oBAAY,EAAkD;AACzD,MAAM,yDAAqB,CAAA,GAAA,oBAAY,EAAsB;AAO7D,MAAM,4CAAuB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,OAC1E,KAAkB,EAClB,GAAmC;IAEnC,IAAI,EAAC,UAAU,uBAAuB,IAAI,EAAE,GAAG,YAAW,GAAG;IAC7D,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,YAAY,KAAK;IAChD,IAAI,WAAW,CAAA,GAAA,mBAAW,EACxB,CAAA,GAAA,gBAAQ,EAAE,sBAAsB,MAAM,QAAQ,KAAK,YAAY,MAAM,QAAQ,GAAG;IAElF,IAAI,QAAQ,CAAA,GAAA,qBAAa,EAAE;IAC3B,IAAI,OAAO,CAAA,GAAA,gBAAQ,EACjB;QACE,GAAG,CAAA,GAAA,yCAAmB,EAAE,MAAM;QAC9B,kDAAkD;QAClD,UAAU,OAAO,MAAM,QAAQ,KAAK,aAAa,OAAO,MAAM,QAAQ;IACxE,GACA,OACA;IAGF,qBACE,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC;gBAAoB;aAAM;YAC3B;gBACE;gBACA;oBACE,GAAG,IAAI;8BACP;oBACA,kBAAkB;gBACpB;aACD;SACF;qBACD,gCAAC;QAAc,GAAG,KAAK;QAAE,KAAK;;AAGpC;AAQA,MAAM,4DAAwB,CAAA,GAAA,oBAAY,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ACA;uBACA;4BACA;wBACA;wBACA;uBACA;YACA,YAAY,cAAc;mBAC1B;QACF;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAClD,OAAO,SAAS,EAAE;IAClB,OAAO,SAAS,OAAO;IAEvB,qBACE,gCAAC,CAAA,GAAA,yCAAE,EAAE,KAAK;QACP,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,YAAY,YAAY,YAAY;QAC7D,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,cAAc;QAC7B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,iBAAe,cAAc;QAC7B,iBAAe,cAAc;QAC7B,gBAAc,aAAa;QAC3B,iBAAe,cAAc;qBAC7B,gCAAC,CAAA,GAAA,qBAAa;QAAE,aAAY;qBAC1B,gCAAC;QAAO,GAAG,CAAA,GAAA,iBAAS,EAAE,YAAY,WAAW;QAAE,KAAK;SAErD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Switch.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 */\n\nimport {AriaSwitchProps, SwitchAria, useSwitch} from 'react-aria/useSwitch';\n\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RACValidation,\n removeDataAttributes,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlottedContext\n} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {HoverEvents} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {createContext, ForwardedRef, forwardRef, useContext} from 'react';\nimport {TextContext} from './Text';\nimport {ToggleState, useToggleState} from 'react-stately/useToggleState';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {VisuallyHidden} from 'react-aria/VisuallyHidden';\n\nexport interface SwitchProps\n extends\n Omit<\n AriaSwitchProps,\n | 'children'\n | 'validationState'\n | 'validationBehavior'\n | 'isRequired'\n | 'isInvalid'\n | 'validate'\n >,\n HoverEvents,\n RenderProps<SwitchRenderProps, 'label'>,\n SlotProps,\n Omit<GlobalDOMAttributes<HTMLLabelElement>, 'onClick'> {\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-Switch'\n */\n className?: ClassNameOrFunction<SwitchRenderProps>;\n /**\n * A ref for the HTML input element.\n */\n inputRef?: RefObject<HTMLInputElement | null>;\n}\n\nexport interface SwitchFieldProps\n extends\n Omit<AriaSwitchProps, 'children' | 'validationState' | 'validationBehavior'>,\n RACValidation,\n RenderProps<SwitchFieldRenderProps>,\n SlotProps,\n Omit<GlobalDOMAttributes<HTMLDivElement>, 'onClick'> {\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-SwitchField'\n */\n className?: ClassNameOrFunction<SwitchFieldRenderProps>;\n /**\n * A ref for the HTML input element.\n */\n inputRef?: RefObject<HTMLInputElement | null>;\n}\n\nexport interface SwitchButtonProps\n extends\n HoverEvents,\n RenderProps<SwitchButtonRenderProps, 'label'>,\n SlotProps,\n GlobalDOMAttributes<HTMLLabelElement> {\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-SwitchButton'\n */\n className?: ClassNameOrFunction<SwitchButtonRenderProps>;\n}\n\nexport interface SwitchRenderProps {\n /**\n * Whether the switch is selected.\n *\n * @selector [data-selected]\n */\n isSelected: boolean;\n /**\n * Whether the switch is currently hovered with a mouse.\n *\n * @selector [data-hovered]\n */\n isHovered: boolean;\n /**\n * Whether the switch is currently in a pressed state.\n *\n * @selector [data-pressed]\n */\n isPressed: boolean;\n /**\n * Whether the switch is focused, either via a mouse or keyboard.\n *\n * @selector [data-focused]\n */\n isFocused: boolean;\n /**\n * Whether the switch is keyboard focused.\n *\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean;\n /**\n * Whether the switch is disabled.\n *\n * @selector [data-disabled]\n */\n isDisabled: boolean;\n /**\n * Whether the switch is read only.\n *\n * @selector [data-readonly]\n */\n isReadOnly: boolean;\n /**\n * State of the switch.\n */\n state: ToggleState;\n}\n\nexport interface SwitchFieldRenderProps {\n /**\n * Whether the switch is selected.\n *\n * @selector [data-selected]\n */\n isSelected: boolean;\n /**\n * Whether the switch is disabled.\n *\n * @selector [data-disabled]\n */\n isDisabled: boolean;\n /**\n * Whether the switch is read only.\n *\n * @selector [data-readonly]\n */\n isReadOnly: boolean;\n /**\n * Whether the switch invalid.\n *\n * @selector [data-invalid]\n */\n isInvalid: boolean;\n /**\n * Whether the switch is required.\n *\n * @selector [data-required]\n */\n isRequired: boolean;\n /**\n * State of the switch.\n */\n state: ToggleState;\n}\n\nexport interface SwitchButtonRenderProps extends SwitchRenderProps {\n /**\n * Whether the switch invalid.\n *\n * @selector [data-invalid]\n */\n isInvalid: boolean;\n /**\n * Whether the switch is required.\n *\n * @selector [data-required]\n */\n isRequired: boolean;\n /**\n * State of the switch.\n */\n state: ToggleState;\n}\n\nexport const SwitchContext = createContext<ContextValue<SwitchProps, HTMLLabelElement>>(null);\nexport const SwitchFieldContext =\n createContext<ContextValue<SwitchFieldProps, HTMLDivElement>>(null);\nexport const ToggleStateContext = createContext<ToggleState | null>(null);\n\n/**\n * A switch allows a user to turn a setting on or off.\n *\n * @deprecated Use SwitchField + SwitchButton instead.\n */\nexport const Switch = /*#__PURE__*/ (forwardRef as forwardRefType)(function Switch(\n props: SwitchProps,\n ref: ForwardedRef<HTMLLabelElement>\n) {\n let {inputRef: userProvidedInputRef = null, ...otherProps} = props;\n [props, ref] = useContextProps(otherProps, ref, SwitchContext);\n let inputRef = useObjectRef(\n mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null)\n );\n let state = useToggleState(props);\n let aria = useSwitch(\n {\n ...removeDataAttributes(props),\n // ReactNode type doesn't allow function children.\n children: typeof props.children === 'function' ? true : props.children\n },\n state,\n inputRef\n );\n\n return (\n <Provider\n values={[\n [ToggleStateContext, state],\n [\n InternalSwitchContext,\n {\n ...aria,\n inputRef,\n defaultClassName: 'react-aria-Switch'\n }\n ]\n ]}>\n <SwitchButton {...props} ref={ref} />\n </Provider>\n );\n});\n\ninterface InternalSwitchContextValue extends SwitchAria {\n inputRef: RefObject<HTMLInputElement | null>;\n defaultClassName: string;\n isRequired?: boolean;\n}\n\nconst InternalSwitchContext = createContext<InternalSwitchContextValue | null>(null);\n\n/**\n * A switch allows a user to turn a setting on or off, with support for validation and help text.\n */\nexport const SwitchField = /*#__PURE__*/ (forwardRef as forwardRefType)(function Switch(\n props: SwitchFieldProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n let {inputRef: userProvidedInputRef = null, ...otherProps} = props;\n [props, ref] = useContextProps(otherProps, ref, SwitchFieldContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let inputRef = useObjectRef(\n mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null)\n );\n let state = useToggleState(props);\n let aria = useSwitch(\n {\n ...removeDataAttributes(props),\n // ReactNode type doesn't allow function children.\n children: typeof props.children === 'function' ? true : props.children,\n validationBehavior\n },\n state,\n inputRef\n );\n let {\n descriptionProps,\n errorMessageProps,\n isSelected,\n isDisabled,\n isReadOnly,\n isInvalid,\n validationDetails,\n validationErrors\n } = aria;\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-SwitchField',\n values: {\n isSelected,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired: props.isRequired || false,\n state\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n delete DOMProps.onClick;\n\n return (\n <dom.div\n {...mergeProps(DOMProps, renderProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-selected={isSelected || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}\n data-invalid={isInvalid || undefined}\n data-required={props.isRequired || undefined}>\n <Provider\n values={[\n [ToggleStateContext, state],\n [\n InternalSwitchContext,\n {\n ...aria,\n inputRef,\n defaultClassName: 'react-aria-SwitchButton',\n isRequired: props.isRequired\n }\n ],\n [\n TextContext,\n {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }\n ],\n [FieldErrorContext, {isInvalid, validationDetails, validationErrors}]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.div>\n );\n});\n\n/**\n * A switch button is the clickable area of a switch, including the indicator and label.\n */\nexport const SwitchButton = /*#__PURE__*/ (forwardRef as forwardRefType)(function SwitchButton(\n props: SwitchButtonProps,\n ref: ForwardedRef<HTMLLabelElement>\n) {\n let {\n labelProps,\n inputProps,\n isSelected,\n isDisabled,\n isReadOnly,\n isPressed,\n isInvalid,\n inputRef,\n defaultClassName,\n isRequired\n } = useContext(InternalSwitchContext)!;\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let isInteractionDisabled = isDisabled || isReadOnly;\n let state = useContext(ToggleStateContext)!;\n\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: isInteractionDisabled\n });\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName,\n values: {\n isSelected,\n isPressed,\n isHovered,\n isFocused,\n isFocusVisible,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired: isRequired || false,\n state\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n delete DOMProps.onClick;\n\n return (\n <dom.label\n {...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-selected={isSelected || undefined}\n data-pressed={isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}\n data-invalid={isInvalid || undefined}\n data-required={isRequired || undefined}>\n <VisuallyHidden elementType=\"span\">\n <input {...mergeProps(inputProps, focusProps)} ref={inputRef} />\n </VisuallyHidden>\n {renderProps.children}\n </dom.label>\n );\n});\n"],"names":[],"version":3,"file":"Switch.js.map"}
|
package/dist/private/Switch.mjs
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {dom as $7230ffa83bc0c2cf$export$df3a06d6289f983e, removeDataAttributes as $7230ffa83bc0c2cf$export$ef03459518577ad4, useContextProps as $7230ffa83bc0c2cf$export$29f1550f4b0d4415, useRenderProps as $7230ffa83bc0c2cf$export$4d86445c2cf5e3} from "./utils.mjs";
|
|
1
|
+
import {dom as $7230ffa83bc0c2cf$export$df3a06d6289f983e, Provider as $7230ffa83bc0c2cf$export$2881499e37b75b9a, removeDataAttributes as $7230ffa83bc0c2cf$export$ef03459518577ad4, useContextProps as $7230ffa83bc0c2cf$export$29f1550f4b0d4415, useRenderProps as $7230ffa83bc0c2cf$export$4d86445c2cf5e3, useSlottedContext as $7230ffa83bc0c2cf$export$fabf2dc03a41866e} from "./utils.mjs";
|
|
2
|
+
import {FieldErrorContext as $1f3c3b1a70cec653$export$ff05c3ac10437e03} from "./FieldError.mjs";
|
|
3
|
+
import {FormContext as $cdaed739b1139372$export$c24727297075ec6a} from "./Form.mjs";
|
|
4
|
+
import {TextContext as $efe09c6d1c304b50$export$9afb8bc826b033ea} from "./Text.mjs";
|
|
2
5
|
import {useSwitch as $kf3DM$useSwitch} from "react-aria/useSwitch";
|
|
3
6
|
import {filterDOMProps as $kf3DM$filterDOMProps} from "react-aria/filterDOMProps";
|
|
4
7
|
import {mergeProps as $kf3DM$mergeProps} from "react-aria/mergeProps";
|
|
5
8
|
import {mergeRefs as $kf3DM$mergeRefs} from "react-aria/mergeRefs";
|
|
6
|
-
import $kf3DM$react, {createContext as $kf3DM$createContext, forwardRef as $kf3DM$forwardRef} from "react";
|
|
9
|
+
import $kf3DM$react, {createContext as $kf3DM$createContext, forwardRef as $kf3DM$forwardRef, useContext as $kf3DM$useContext} from "react";
|
|
7
10
|
import {useToggleState as $kf3DM$useToggleState} from "react-stately/useToggleState";
|
|
8
11
|
import {useFocusRing as $kf3DM$useFocusRing} from "react-aria/useFocusRing";
|
|
9
12
|
import {useHover as $kf3DM$useHover} from "react-aria/useHover";
|
|
@@ -31,26 +34,130 @@ import {VisuallyHidden as $kf3DM$VisuallyHidden} from "react-aria/VisuallyHidden
|
|
|
31
34
|
|
|
32
35
|
|
|
33
36
|
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
34
40
|
const $24585aa46d6ffdff$export$8699e3b644d5a28a = /*#__PURE__*/ (0, $kf3DM$createContext)(null);
|
|
41
|
+
const $24585aa46d6ffdff$export$3e1405298f0cafda = /*#__PURE__*/ (0, $kf3DM$createContext)(null);
|
|
42
|
+
const $24585aa46d6ffdff$export$5cc1518e1ec171c = /*#__PURE__*/ (0, $kf3DM$createContext)(null);
|
|
35
43
|
const $24585aa46d6ffdff$export$b5d5cf8927ab7262 = /*#__PURE__*/ (0, $kf3DM$forwardRef)(function Switch(props, ref) {
|
|
36
44
|
let { inputRef: userProvidedInputRef = null, ...otherProps } = props;
|
|
37
45
|
[props, ref] = (0, $7230ffa83bc0c2cf$export$29f1550f4b0d4415)(otherProps, ref, $24585aa46d6ffdff$export$8699e3b644d5a28a);
|
|
38
46
|
let inputRef = (0, $kf3DM$useObjectRef)((0, $kf3DM$mergeRefs)(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null));
|
|
39
47
|
let state = (0, $kf3DM$useToggleState)(props);
|
|
40
|
-
let
|
|
48
|
+
let aria = (0, $kf3DM$useSwitch)({
|
|
41
49
|
...(0, $7230ffa83bc0c2cf$export$ef03459518577ad4)(props),
|
|
42
50
|
// ReactNode type doesn't allow function children.
|
|
43
51
|
children: typeof props.children === 'function' ? true : props.children
|
|
44
52
|
}, state, inputRef);
|
|
53
|
+
return /*#__PURE__*/ (0, $kf3DM$react).createElement((0, $7230ffa83bc0c2cf$export$2881499e37b75b9a), {
|
|
54
|
+
values: [
|
|
55
|
+
[
|
|
56
|
+
$24585aa46d6ffdff$export$5cc1518e1ec171c,
|
|
57
|
+
state
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
$24585aa46d6ffdff$var$InternalSwitchContext,
|
|
61
|
+
{
|
|
62
|
+
...aria,
|
|
63
|
+
inputRef: inputRef,
|
|
64
|
+
defaultClassName: 'react-aria-Switch'
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
]
|
|
68
|
+
}, /*#__PURE__*/ (0, $kf3DM$react).createElement($24585aa46d6ffdff$export$72111f742dee7cb8, {
|
|
69
|
+
...props,
|
|
70
|
+
ref: ref
|
|
71
|
+
}));
|
|
72
|
+
});
|
|
73
|
+
const $24585aa46d6ffdff$var$InternalSwitchContext = /*#__PURE__*/ (0, $kf3DM$createContext)(null);
|
|
74
|
+
const $24585aa46d6ffdff$export$208c2e617baf9fc3 = /*#__PURE__*/ (0, $kf3DM$forwardRef)(function Switch(props, ref) {
|
|
75
|
+
let { inputRef: userProvidedInputRef = null, ...otherProps } = props;
|
|
76
|
+
[props, ref] = (0, $7230ffa83bc0c2cf$export$29f1550f4b0d4415)(otherProps, ref, $24585aa46d6ffdff$export$3e1405298f0cafda);
|
|
77
|
+
let { validationBehavior: formValidationBehavior } = (0, $7230ffa83bc0c2cf$export$fabf2dc03a41866e)((0, $cdaed739b1139372$export$c24727297075ec6a)) || {};
|
|
78
|
+
let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';
|
|
79
|
+
let inputRef = (0, $kf3DM$useObjectRef)((0, $kf3DM$mergeRefs)(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null));
|
|
80
|
+
let state = (0, $kf3DM$useToggleState)(props);
|
|
81
|
+
let aria = (0, $kf3DM$useSwitch)({
|
|
82
|
+
...(0, $7230ffa83bc0c2cf$export$ef03459518577ad4)(props),
|
|
83
|
+
// ReactNode type doesn't allow function children.
|
|
84
|
+
children: typeof props.children === 'function' ? true : props.children,
|
|
85
|
+
validationBehavior: validationBehavior
|
|
86
|
+
}, state, inputRef);
|
|
87
|
+
let { descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, isSelected: isSelected, isDisabled: isDisabled, isReadOnly: isReadOnly, isInvalid: isInvalid, validationDetails: validationDetails, validationErrors: validationErrors } = aria;
|
|
88
|
+
let renderProps = (0, $7230ffa83bc0c2cf$export$4d86445c2cf5e3)({
|
|
89
|
+
...props,
|
|
90
|
+
defaultClassName: 'react-aria-SwitchField',
|
|
91
|
+
values: {
|
|
92
|
+
isSelected: isSelected,
|
|
93
|
+
isDisabled: isDisabled,
|
|
94
|
+
isReadOnly: isReadOnly,
|
|
95
|
+
isInvalid: isInvalid,
|
|
96
|
+
isRequired: props.isRequired || false,
|
|
97
|
+
state: state
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
let DOMProps = (0, $kf3DM$filterDOMProps)(props, {
|
|
101
|
+
global: true
|
|
102
|
+
});
|
|
103
|
+
delete DOMProps.id;
|
|
104
|
+
delete DOMProps.onClick;
|
|
105
|
+
return /*#__PURE__*/ (0, $kf3DM$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).div, {
|
|
106
|
+
...(0, $kf3DM$mergeProps)(DOMProps, renderProps),
|
|
107
|
+
ref: ref,
|
|
108
|
+
slot: props.slot || undefined,
|
|
109
|
+
"data-selected": isSelected || undefined,
|
|
110
|
+
"data-disabled": isDisabled || undefined,
|
|
111
|
+
"data-readonly": isReadOnly || undefined,
|
|
112
|
+
"data-invalid": isInvalid || undefined,
|
|
113
|
+
"data-required": props.isRequired || undefined
|
|
114
|
+
}, /*#__PURE__*/ (0, $kf3DM$react).createElement((0, $7230ffa83bc0c2cf$export$2881499e37b75b9a), {
|
|
115
|
+
values: [
|
|
116
|
+
[
|
|
117
|
+
$24585aa46d6ffdff$export$5cc1518e1ec171c,
|
|
118
|
+
state
|
|
119
|
+
],
|
|
120
|
+
[
|
|
121
|
+
$24585aa46d6ffdff$var$InternalSwitchContext,
|
|
122
|
+
{
|
|
123
|
+
...aria,
|
|
124
|
+
inputRef: inputRef,
|
|
125
|
+
defaultClassName: 'react-aria-SwitchButton',
|
|
126
|
+
isRequired: props.isRequired
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
[
|
|
130
|
+
(0, $efe09c6d1c304b50$export$9afb8bc826b033ea),
|
|
131
|
+
{
|
|
132
|
+
slots: {
|
|
133
|
+
description: descriptionProps,
|
|
134
|
+
errorMessage: errorMessageProps
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
[
|
|
139
|
+
(0, $1f3c3b1a70cec653$export$ff05c3ac10437e03),
|
|
140
|
+
{
|
|
141
|
+
isInvalid: isInvalid,
|
|
142
|
+
validationDetails: validationDetails,
|
|
143
|
+
validationErrors: validationErrors
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
]
|
|
147
|
+
}, renderProps.children));
|
|
148
|
+
});
|
|
149
|
+
const $24585aa46d6ffdff$export$72111f742dee7cb8 = /*#__PURE__*/ (0, $kf3DM$forwardRef)(function SwitchButton(props, ref) {
|
|
150
|
+
let { labelProps: labelProps, inputProps: inputProps, isSelected: isSelected, isDisabled: isDisabled, isReadOnly: isReadOnly, isPressed: isPressed, isInvalid: isInvalid, inputRef: inputRef, defaultClassName: defaultClassName, isRequired: isRequired } = (0, $kf3DM$useContext)($24585aa46d6ffdff$var$InternalSwitchContext);
|
|
45
151
|
let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $kf3DM$useFocusRing)();
|
|
46
|
-
let isInteractionDisabled =
|
|
152
|
+
let isInteractionDisabled = isDisabled || isReadOnly;
|
|
153
|
+
let state = (0, $kf3DM$useContext)($24585aa46d6ffdff$export$5cc1518e1ec171c);
|
|
47
154
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $kf3DM$useHover)({
|
|
48
155
|
...props,
|
|
49
156
|
isDisabled: isInteractionDisabled
|
|
50
157
|
});
|
|
51
158
|
let renderProps = (0, $7230ffa83bc0c2cf$export$4d86445c2cf5e3)({
|
|
52
159
|
...props,
|
|
53
|
-
defaultClassName:
|
|
160
|
+
defaultClassName: defaultClassName,
|
|
54
161
|
values: {
|
|
55
162
|
isSelected: isSelected,
|
|
56
163
|
isPressed: isPressed,
|
|
@@ -59,6 +166,8 @@ const $24585aa46d6ffdff$export$b5d5cf8927ab7262 = /*#__PURE__*/ (0, $kf3DM$forwa
|
|
|
59
166
|
isFocusVisible: isFocusVisible,
|
|
60
167
|
isDisabled: isDisabled,
|
|
61
168
|
isReadOnly: isReadOnly,
|
|
169
|
+
isInvalid: isInvalid,
|
|
170
|
+
isRequired: isRequired || false,
|
|
62
171
|
state: state
|
|
63
172
|
}
|
|
64
173
|
});
|
|
@@ -77,7 +186,9 @@ const $24585aa46d6ffdff$export$b5d5cf8927ab7262 = /*#__PURE__*/ (0, $kf3DM$forwa
|
|
|
77
186
|
"data-focused": isFocused || undefined,
|
|
78
187
|
"data-focus-visible": isFocusVisible || undefined,
|
|
79
188
|
"data-disabled": isDisabled || undefined,
|
|
80
|
-
"data-readonly": isReadOnly || undefined
|
|
189
|
+
"data-readonly": isReadOnly || undefined,
|
|
190
|
+
"data-invalid": isInvalid || undefined,
|
|
191
|
+
"data-required": isRequired || undefined
|
|
81
192
|
}, /*#__PURE__*/ (0, $kf3DM$react).createElement((0, $kf3DM$VisuallyHidden), {
|
|
82
193
|
elementType: "span"
|
|
83
194
|
}, /*#__PURE__*/ (0, $kf3DM$react).createElement("input", {
|
|
@@ -87,5 +198,5 @@ const $24585aa46d6ffdff$export$b5d5cf8927ab7262 = /*#__PURE__*/ (0, $kf3DM$forwa
|
|
|
87
198
|
});
|
|
88
199
|
|
|
89
200
|
|
|
90
|
-
export {$24585aa46d6ffdff$export$8699e3b644d5a28a as SwitchContext, $24585aa46d6ffdff$export$b5d5cf8927ab7262 as Switch};
|
|
201
|
+
export {$24585aa46d6ffdff$export$8699e3b644d5a28a as SwitchContext, $24585aa46d6ffdff$export$3e1405298f0cafda as SwitchFieldContext, $24585aa46d6ffdff$export$5cc1518e1ec171c as ToggleStateContext, $24585aa46d6ffdff$export$b5d5cf8927ab7262 as Switch, $24585aa46d6ffdff$export$72111f742dee7cb8 as SwitchButton, $24585aa46d6ffdff$export$208c2e617baf9fc3 as SwitchField};
|
|
91
202
|
//# sourceMappingURL=Switch.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AAgFM,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAA+C;AAKjF,MAAM,4CAAuB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,OAAO,KAAkB,EAAE,GAAmC;IACxI,IAAI,EACF,UAAU,uBAAuB,IAAI,EACrC,GAAG,YACJ,GAAG;IACJ,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,YAAY,KAAK;IAChD,IAAI,WAAW,CAAA,GAAA,mBAAW,EAAE,CAAA,GAAA,gBAAQ,EAAE,sBAAs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AAA,GAAA,iBAAS,EAAE,YAAY,WAAW;QAAE,KAAK;SAErD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Switch.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 */\n\nimport {AriaSwitchProps, useSwitch} from 'react-aria/useSwitch';\n\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n removeDataAttributes,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {HoverEvents} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\nimport {ToggleState, useToggleState} from 'react-stately/useToggleState';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {VisuallyHidden} from 'react-aria/VisuallyHidden';\n\nexport interface SwitchProps extends Omit<AriaSwitchProps, 'children'>, HoverEvents, RenderProps<SwitchRenderProps, 'label'>, SlotProps, Omit<GlobalDOMAttributes<HTMLLabelElement>, 'onClick'> {\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-Switch'\n */\n className?: ClassNameOrFunction<SwitchRenderProps>,\n /**\n * A ref for the HTML input element.\n */\n inputRef?: RefObject<HTMLInputElement | null>\n}\n\nexport interface SwitchRenderProps {\n /**\n * Whether the switch is selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the switch is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the switch is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the switch is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the switch is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the switch is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the switch is read only.\n * @selector [data-readonly]\n */\n isReadOnly: boolean,\n /**\n * State of the switch.\n */\n state: ToggleState\n}\n\nexport const SwitchContext = createContext<ContextValue<SwitchProps, HTMLLabelElement>>(null);\n\n/**\n * A switch allows a user to turn a setting on or off.\n */\nexport const Switch = /*#__PURE__*/ (forwardRef as forwardRefType)(function Switch(props: SwitchProps, ref: ForwardedRef<HTMLLabelElement>) {\n let {\n inputRef: userProvidedInputRef = null,\n ...otherProps\n } = props;\n [props, ref] = useContextProps(otherProps, ref, SwitchContext);\n let inputRef = useObjectRef(mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null));\n let state = useToggleState(props);\n let {labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed} = useSwitch({\n ...removeDataAttributes(props),\n // ReactNode type doesn't allow function children.\n children: typeof props.children === 'function' ? true : props.children\n }, state, inputRef);\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let isInteractionDisabled = props.isDisabled || props.isReadOnly;\n\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: isInteractionDisabled\n });\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Switch',\n values: {\n isSelected,\n isPressed,\n isHovered,\n isFocused,\n isFocusVisible,\n isDisabled,\n isReadOnly,\n state\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n delete DOMProps.onClick;\n\n return (\n <dom.label\n {...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-selected={isSelected || undefined}\n data-pressed={isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}>\n <VisuallyHidden elementType=\"span\">\n <input {...mergeProps(inputProps, focusProps)} ref={inputRef} />\n </VisuallyHidden>\n {renderProps.children}\n </dom.label>\n );\n});\n"],"names":[],"version":3,"file":"Switch.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAwMM,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAA+C;AACjF,MAAM,0DACX,CAAA,GAAA,oBAAY,EAAkD;AACzD,MAAM,yDAAqB,CAAA,GAAA,oBAAY,EAAsB;AAO7D,MAAM,4CAAuB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,OAC1E,KAAkB,EAClB,GAAmC;IAEnC,IAAI,EAAC,UAAU,uBAAuB,IAAI,EAAE,GAAG,YAAW,GAAG;IAC7D,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,YAAY,KAAK;IAChD,IAAI,WAAW,CAAA,GAAA,mBAAW,EACxB,CAAA,GAAA,gBAAQ,EAAE,sBAAsB,MAAM,QAAQ,KAAK,YAAY,MAAM,QAAQ,GAAG;IAElF,IAAI,QAAQ,CAAA,GAAA,qBAAa,EAAE;IAC3B,IAAI,OAAO,CAAA,GAAA,gBAAQ,EACjB;QACE,GAAG,CAAA,GAAA,yCAAmB,EAAE,MAAM;QAC9B,kDAAkD;QAClD,UAAU,OAAO,MAAM,QAAQ,KAAK,aAAa,OAAO,MAAM,QAAQ;IACxE,GACA,OACA;IAGF,qBACE,gCAAC,CAAA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GAAA,eAAO,EAAE;QACrC,GAAG,KAAK;QACR,YAAY;IACd;IAEA,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;0BACR;QACA,QAAQ;wBACN;uBACA;uBACA;uBACA;4BACA;wBACA;wBACA;uBACA;YACA,YAAY,cAAc;mBAC1B;QACF;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAClD,OAAO,SAAS,EAAE;IAClB,OAAO,SAAS,OAAO;IAEvB,qBACE,gCAAC,CAAA,GAAA,yCAAE,EAAE,KAAK;QACP,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,YAAY,YAAY,YAAY;QAC7D,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,cAAc;QAC7B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,iBAAe,cAAc;QAC7B,iBAAe,cAAc;QAC7B,gBAAc,aAAa;QAC3B,iBAAe,cAAc;qBAC7B,gCAAC,CAAA,GAAA,qBAAa;QAAE,aAAY;qBAC1B,gCAAC;QAAO,GAAG,CAAA,GAAA,iBAAS,EAAE,YAAY,WAAW;QAAE,KAAK;SAErD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Switch.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 */\n\nimport {AriaSwitchProps, SwitchAria, useSwitch} from 'react-aria/useSwitch';\n\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RACValidation,\n removeDataAttributes,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlottedContext\n} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {HoverEvents} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {createContext, ForwardedRef, forwardRef, useContext} from 'react';\nimport {TextContext} from './Text';\nimport {ToggleState, useToggleState} from 'react-stately/useToggleState';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {VisuallyHidden} from 'react-aria/VisuallyHidden';\n\nexport interface SwitchProps\n extends\n Omit<\n AriaSwitchProps,\n | 'children'\n | 'validationState'\n | 'validationBehavior'\n | 'isRequired'\n | 'isInvalid'\n | 'validate'\n >,\n HoverEvents,\n RenderProps<SwitchRenderProps, 'label'>,\n SlotProps,\n Omit<GlobalDOMAttributes<HTMLLabelElement>, 'onClick'> {\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-Switch'\n */\n className?: ClassNameOrFunction<SwitchRenderProps>;\n /**\n * A ref for the HTML input element.\n */\n inputRef?: RefObject<HTMLInputElement | null>;\n}\n\nexport interface SwitchFieldProps\n extends\n Omit<AriaSwitchProps, 'children' | 'validationState' | 'validationBehavior'>,\n RACValidation,\n RenderProps<SwitchFieldRenderProps>,\n SlotProps,\n Omit<GlobalDOMAttributes<HTMLDivElement>, 'onClick'> {\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-SwitchField'\n */\n className?: ClassNameOrFunction<SwitchFieldRenderProps>;\n /**\n * A ref for the HTML input element.\n */\n inputRef?: RefObject<HTMLInputElement | null>;\n}\n\nexport interface SwitchButtonProps\n extends\n HoverEvents,\n RenderProps<SwitchButtonRenderProps, 'label'>,\n SlotProps,\n GlobalDOMAttributes<HTMLLabelElement> {\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-SwitchButton'\n */\n className?: ClassNameOrFunction<SwitchButtonRenderProps>;\n}\n\nexport interface SwitchRenderProps {\n /**\n * Whether the switch is selected.\n *\n * @selector [data-selected]\n */\n isSelected: boolean;\n /**\n * Whether the switch is currently hovered with a mouse.\n *\n * @selector [data-hovered]\n */\n isHovered: boolean;\n /**\n * Whether the switch is currently in a pressed state.\n *\n * @selector [data-pressed]\n */\n isPressed: boolean;\n /**\n * Whether the switch is focused, either via a mouse or keyboard.\n *\n * @selector [data-focused]\n */\n isFocused: boolean;\n /**\n * Whether the switch is keyboard focused.\n *\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean;\n /**\n * Whether the switch is disabled.\n *\n * @selector [data-disabled]\n */\n isDisabled: boolean;\n /**\n * Whether the switch is read only.\n *\n * @selector [data-readonly]\n */\n isReadOnly: boolean;\n /**\n * State of the switch.\n */\n state: ToggleState;\n}\n\nexport interface SwitchFieldRenderProps {\n /**\n * Whether the switch is selected.\n *\n * @selector [data-selected]\n */\n isSelected: boolean;\n /**\n * Whether the switch is disabled.\n *\n * @selector [data-disabled]\n */\n isDisabled: boolean;\n /**\n * Whether the switch is read only.\n *\n * @selector [data-readonly]\n */\n isReadOnly: boolean;\n /**\n * Whether the switch invalid.\n *\n * @selector [data-invalid]\n */\n isInvalid: boolean;\n /**\n * Whether the switch is required.\n *\n * @selector [data-required]\n */\n isRequired: boolean;\n /**\n * State of the switch.\n */\n state: ToggleState;\n}\n\nexport interface SwitchButtonRenderProps extends SwitchRenderProps {\n /**\n * Whether the switch invalid.\n *\n * @selector [data-invalid]\n */\n isInvalid: boolean;\n /**\n * Whether the switch is required.\n *\n * @selector [data-required]\n */\n isRequired: boolean;\n /**\n * State of the switch.\n */\n state: ToggleState;\n}\n\nexport const SwitchContext = createContext<ContextValue<SwitchProps, HTMLLabelElement>>(null);\nexport const SwitchFieldContext =\n createContext<ContextValue<SwitchFieldProps, HTMLDivElement>>(null);\nexport const ToggleStateContext = createContext<ToggleState | null>(null);\n\n/**\n * A switch allows a user to turn a setting on or off.\n *\n * @deprecated Use SwitchField + SwitchButton instead.\n */\nexport const Switch = /*#__PURE__*/ (forwardRef as forwardRefType)(function Switch(\n props: SwitchProps,\n ref: ForwardedRef<HTMLLabelElement>\n) {\n let {inputRef: userProvidedInputRef = null, ...otherProps} = props;\n [props, ref] = useContextProps(otherProps, ref, SwitchContext);\n let inputRef = useObjectRef(\n mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null)\n );\n let state = useToggleState(props);\n let aria = useSwitch(\n {\n ...removeDataAttributes(props),\n // ReactNode type doesn't allow function children.\n children: typeof props.children === 'function' ? true : props.children\n },\n state,\n inputRef\n );\n\n return (\n <Provider\n values={[\n [ToggleStateContext, state],\n [\n InternalSwitchContext,\n {\n ...aria,\n inputRef,\n defaultClassName: 'react-aria-Switch'\n }\n ]\n ]}>\n <SwitchButton {...props} ref={ref} />\n </Provider>\n );\n});\n\ninterface InternalSwitchContextValue extends SwitchAria {\n inputRef: RefObject<HTMLInputElement | null>;\n defaultClassName: string;\n isRequired?: boolean;\n}\n\nconst InternalSwitchContext = createContext<InternalSwitchContextValue | null>(null);\n\n/**\n * A switch allows a user to turn a setting on or off, with support for validation and help text.\n */\nexport const SwitchField = /*#__PURE__*/ (forwardRef as forwardRefType)(function Switch(\n props: SwitchFieldProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n let {inputRef: userProvidedInputRef = null, ...otherProps} = props;\n [props, ref] = useContextProps(otherProps, ref, SwitchFieldContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let inputRef = useObjectRef(\n mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null)\n );\n let state = useToggleState(props);\n let aria = useSwitch(\n {\n ...removeDataAttributes(props),\n // ReactNode type doesn't allow function children.\n children: typeof props.children === 'function' ? true : props.children,\n validationBehavior\n },\n state,\n inputRef\n );\n let {\n descriptionProps,\n errorMessageProps,\n isSelected,\n isDisabled,\n isReadOnly,\n isInvalid,\n validationDetails,\n validationErrors\n } = aria;\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-SwitchField',\n values: {\n isSelected,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired: props.isRequired || false,\n state\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n delete DOMProps.onClick;\n\n return (\n <dom.div\n {...mergeProps(DOMProps, renderProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-selected={isSelected || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}\n data-invalid={isInvalid || undefined}\n data-required={props.isRequired || undefined}>\n <Provider\n values={[\n [ToggleStateContext, state],\n [\n InternalSwitchContext,\n {\n ...aria,\n inputRef,\n defaultClassName: 'react-aria-SwitchButton',\n isRequired: props.isRequired\n }\n ],\n [\n TextContext,\n {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }\n ],\n [FieldErrorContext, {isInvalid, validationDetails, validationErrors}]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.div>\n );\n});\n\n/**\n * A switch button is the clickable area of a switch, including the indicator and label.\n */\nexport const SwitchButton = /*#__PURE__*/ (forwardRef as forwardRefType)(function SwitchButton(\n props: SwitchButtonProps,\n ref: ForwardedRef<HTMLLabelElement>\n) {\n let {\n labelProps,\n inputProps,\n isSelected,\n isDisabled,\n isReadOnly,\n isPressed,\n isInvalid,\n inputRef,\n defaultClassName,\n isRequired\n } = useContext(InternalSwitchContext)!;\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let isInteractionDisabled = isDisabled || isReadOnly;\n let state = useContext(ToggleStateContext)!;\n\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: isInteractionDisabled\n });\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName,\n values: {\n isSelected,\n isPressed,\n isHovered,\n isFocused,\n isFocusVisible,\n isDisabled,\n isReadOnly,\n isInvalid,\n isRequired: isRequired || false,\n state\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n delete DOMProps.onClick;\n\n return (\n <dom.label\n {...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}\n ref={ref}\n slot={props.slot || undefined}\n data-selected={isSelected || undefined}\n data-pressed={isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}\n data-invalid={isInvalid || undefined}\n data-required={isRequired || undefined}>\n <VisuallyHidden elementType=\"span\">\n <input {...mergeProps(inputProps, focusProps)} ref={inputRef} />\n </VisuallyHidden>\n {renderProps.children}\n </dom.label>\n );\n});\n"],"names":[],"version":3,"file":"Switch.mjs.map"}
|