react-aria-components 1.13.0 → 1.15.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/Autocomplete.main.js.map +1 -1
- package/dist/Autocomplete.module.js.map +1 -1
- package/dist/Breadcrumbs.main.js +8 -5
- package/dist/Breadcrumbs.main.js.map +1 -1
- package/dist/Breadcrumbs.mjs +8 -5
- package/dist/Breadcrumbs.module.js +8 -5
- package/dist/Breadcrumbs.module.js.map +1 -1
- package/dist/Button.main.js +1 -1
- package/dist/Button.main.js.map +1 -1
- package/dist/Button.mjs +2 -2
- package/dist/Button.module.js +2 -2
- package/dist/Button.module.js.map +1 -1
- package/dist/Calendar.main.js +13 -9
- package/dist/Calendar.main.js.map +1 -1
- package/dist/Calendar.mjs +14 -10
- package/dist/Calendar.module.js +14 -10
- package/dist/Calendar.module.js.map +1 -1
- package/dist/Checkbox.main.js +2 -2
- package/dist/Checkbox.main.js.map +1 -1
- package/dist/Checkbox.mjs +3 -3
- package/dist/Checkbox.module.js +3 -3
- package/dist/Checkbox.module.js.map +1 -1
- package/dist/Collection.main.js +1 -1
- package/dist/Collection.main.js.map +1 -1
- package/dist/Collection.mjs +1 -1
- package/dist/Collection.module.js +1 -1
- package/dist/Collection.module.js.map +1 -1
- package/dist/ColorArea.main.js +2 -2
- package/dist/ColorArea.main.js.map +1 -1
- package/dist/ColorArea.mjs +2 -2
- package/dist/ColorArea.module.js +2 -2
- package/dist/ColorArea.module.js.map +1 -1
- package/dist/ColorField.main.js +8 -4
- package/dist/ColorField.main.js.map +1 -1
- package/dist/ColorField.mjs +8 -4
- package/dist/ColorField.module.js +8 -4
- package/dist/ColorField.module.js.map +1 -1
- package/dist/ColorPicker.main.js +1 -1
- package/dist/ColorPicker.main.js.map +1 -1
- package/dist/ColorPicker.mjs +1 -1
- package/dist/ColorPicker.module.js +1 -1
- package/dist/ColorPicker.module.js.map +1 -1
- package/dist/ColorSlider.main.js +2 -2
- package/dist/ColorSlider.main.js.map +1 -1
- package/dist/ColorSlider.mjs +2 -2
- package/dist/ColorSlider.module.js +2 -2
- package/dist/ColorSlider.module.js.map +1 -1
- package/dist/ColorSwatch.main.js +1 -1
- package/dist/ColorSwatch.main.js.map +1 -1
- package/dist/ColorSwatch.mjs +2 -2
- package/dist/ColorSwatch.module.js +2 -2
- package/dist/ColorSwatch.module.js.map +1 -1
- package/dist/ColorSwatchPicker.main.js +3 -1
- package/dist/ColorSwatchPicker.main.js.map +1 -1
- package/dist/ColorSwatchPicker.mjs +3 -1
- package/dist/ColorSwatchPicker.module.js +3 -1
- package/dist/ColorSwatchPicker.module.js.map +1 -1
- package/dist/ColorThumb.main.js +1 -1
- package/dist/ColorThumb.main.js.map +1 -1
- package/dist/ColorThumb.mjs +2 -2
- package/dist/ColorThumb.module.js +2 -2
- package/dist/ColorThumb.module.js.map +1 -1
- package/dist/ColorWheel.main.js +3 -3
- package/dist/ColorWheel.main.js.map +1 -1
- package/dist/ColorWheel.mjs +3 -3
- package/dist/ColorWheel.module.js +3 -3
- package/dist/ColorWheel.module.js.map +1 -1
- package/dist/ComboBox.main.js +2 -2
- package/dist/ComboBox.main.js.map +1 -1
- package/dist/ComboBox.mjs +3 -3
- package/dist/ComboBox.module.js +3 -3
- package/dist/ComboBox.module.js.map +1 -1
- package/dist/DateField.main.js +6 -4
- package/dist/DateField.main.js.map +1 -1
- package/dist/DateField.mjs +7 -5
- package/dist/DateField.module.js +7 -5
- package/dist/DateField.module.js.map +1 -1
- package/dist/DatePicker.main.js +2 -2
- package/dist/DatePicker.main.js.map +1 -1
- package/dist/DatePicker.mjs +3 -3
- package/dist/DatePicker.module.js +3 -3
- package/dist/DatePicker.module.js.map +1 -1
- package/dist/Dialog.main.js +2 -1
- package/dist/Dialog.main.js.map +1 -1
- package/dist/Dialog.mjs +3 -2
- package/dist/Dialog.module.js +3 -2
- package/dist/Dialog.module.js.map +1 -1
- package/dist/Disclosure.main.js +5 -4
- package/dist/Disclosure.main.js.map +1 -1
- package/dist/Disclosure.mjs +6 -5
- package/dist/Disclosure.module.js +6 -5
- package/dist/Disclosure.module.js.map +1 -1
- package/dist/DragAndDrop.main.js.map +1 -1
- package/dist/DragAndDrop.module.js.map +1 -1
- package/dist/DropZone.main.js +2 -3
- package/dist/DropZone.main.js.map +1 -1
- package/dist/DropZone.mjs +4 -5
- package/dist/DropZone.module.js +4 -5
- package/dist/DropZone.module.js.map +1 -1
- package/dist/FieldError.main.js.map +1 -1
- package/dist/FieldError.module.js.map +1 -1
- package/dist/FileTrigger.main.js +1 -0
- package/dist/FileTrigger.main.js.map +1 -1
- package/dist/FileTrigger.mjs +1 -0
- package/dist/FileTrigger.module.js +1 -0
- package/dist/FileTrigger.module.js.map +1 -1
- package/dist/Form.main.js +1 -1
- package/dist/Form.main.js.map +1 -1
- package/dist/Form.mjs +2 -2
- package/dist/Form.module.js +2 -2
- package/dist/Form.module.js.map +1 -1
- package/dist/GridList.main.js +17 -14
- package/dist/GridList.main.js.map +1 -1
- package/dist/GridList.mjs +17 -14
- package/dist/GridList.module.js +17 -14
- package/dist/GridList.module.js.map +1 -1
- package/dist/Group.main.js +3 -3
- package/dist/Group.main.js.map +1 -1
- package/dist/Group.mjs +4 -4
- package/dist/Group.module.js +4 -4
- package/dist/Group.module.js.map +1 -1
- package/dist/Header.main.js +1 -1
- package/dist/Header.main.js.map +1 -1
- package/dist/Header.mjs +2 -2
- package/dist/Header.module.js +2 -2
- package/dist/Header.module.js.map +1 -1
- package/dist/Heading.main.js +2 -2
- package/dist/Heading.main.js.map +1 -1
- package/dist/Heading.mjs +2 -2
- package/dist/Heading.module.js +2 -2
- package/dist/Heading.module.js.map +1 -1
- package/dist/HiddenDateInput.main.js +10 -4
- package/dist/HiddenDateInput.main.js.map +1 -1
- package/dist/HiddenDateInput.mjs +11 -5
- package/dist/HiddenDateInput.module.js +11 -5
- package/dist/HiddenDateInput.module.js.map +1 -1
- package/dist/Input.main.js +5 -2
- package/dist/Input.main.js.map +1 -1
- package/dist/Input.mjs +6 -3
- package/dist/Input.module.js +6 -3
- package/dist/Input.module.js.map +1 -1
- package/dist/Keyboard.main.js +1 -1
- package/dist/Keyboard.main.js.map +1 -1
- package/dist/Keyboard.mjs +2 -2
- package/dist/Keyboard.module.js +2 -2
- package/dist/Keyboard.module.js.map +1 -1
- package/dist/Label.main.js +2 -1
- package/dist/Label.main.js.map +1 -1
- package/dist/Label.mjs +3 -2
- package/dist/Label.module.js +3 -2
- package/dist/Label.module.js.map +1 -1
- package/dist/Link.main.js +3 -2
- package/dist/Link.main.js.map +1 -1
- package/dist/Link.mjs +4 -3
- package/dist/Link.module.js +4 -3
- package/dist/Link.module.js.map +1 -1
- package/dist/ListBox.main.js +18 -16
- package/dist/ListBox.main.js.map +1 -1
- package/dist/ListBox.mjs +19 -17
- package/dist/ListBox.module.js +19 -17
- package/dist/ListBox.module.js.map +1 -1
- package/dist/Menu.main.js +22 -9
- package/dist/Menu.main.js.map +1 -1
- package/dist/Menu.mjs +22 -9
- package/dist/Menu.module.js +22 -9
- package/dist/Menu.module.js.map +1 -1
- package/dist/Meter.main.js +1 -1
- package/dist/Meter.main.js.map +1 -1
- package/dist/Meter.mjs +2 -2
- package/dist/Meter.module.js +2 -2
- package/dist/Meter.module.js.map +1 -1
- package/dist/Modal.main.js +2 -2
- package/dist/Modal.main.js.map +1 -1
- package/dist/Modal.mjs +3 -3
- package/dist/Modal.module.js +3 -3
- package/dist/Modal.module.js.map +1 -1
- package/dist/NumberField.main.js +1 -1
- package/dist/NumberField.main.js.map +1 -1
- package/dist/NumberField.mjs +2 -2
- package/dist/NumberField.module.js +2 -2
- package/dist/NumberField.module.js.map +1 -1
- package/dist/OverlayArrow.main.js +1 -1
- package/dist/OverlayArrow.main.js.map +1 -1
- package/dist/OverlayArrow.mjs +2 -2
- package/dist/OverlayArrow.module.js +2 -2
- package/dist/OverlayArrow.module.js.map +1 -1
- package/dist/Popover.main.js +2 -2
- package/dist/Popover.main.js.map +1 -1
- package/dist/Popover.mjs +4 -4
- package/dist/Popover.module.js +4 -4
- package/dist/Popover.module.js.map +1 -1
- package/dist/ProgressBar.main.js +1 -1
- package/dist/ProgressBar.main.js.map +1 -1
- package/dist/ProgressBar.mjs +2 -2
- package/dist/ProgressBar.module.js +2 -2
- package/dist/ProgressBar.module.js.map +1 -1
- package/dist/RadioGroup.main.js +2 -2
- package/dist/RadioGroup.main.js.map +1 -1
- package/dist/RadioGroup.mjs +3 -3
- package/dist/RadioGroup.module.js +3 -3
- package/dist/RadioGroup.module.js.map +1 -1
- package/dist/SearchField.main.js +6 -2
- package/dist/SearchField.main.js.map +1 -1
- package/dist/SearchField.mjs +7 -3
- package/dist/SearchField.module.js +7 -3
- package/dist/SearchField.module.js.map +1 -1
- package/dist/Select.main.js +2 -2
- package/dist/Select.main.js.map +1 -1
- package/dist/Select.mjs +3 -3
- package/dist/Select.module.js +3 -3
- package/dist/Select.module.js.map +1 -1
- package/dist/SelectionIndicator.main.js.map +1 -1
- package/dist/SelectionIndicator.module.js.map +1 -1
- package/dist/Separator.main.js +3 -1
- package/dist/Separator.main.js.map +1 -1
- package/dist/Separator.mjs +4 -2
- package/dist/Separator.module.js +4 -2
- package/dist/Separator.module.js.map +1 -1
- package/dist/SharedElementTransition.main.js +3 -2
- package/dist/SharedElementTransition.main.js.map +1 -1
- package/dist/SharedElementTransition.mjs +4 -3
- package/dist/SharedElementTransition.module.js +4 -3
- package/dist/SharedElementTransition.module.js.map +1 -1
- package/dist/Slider.main.js +6 -5
- package/dist/Slider.main.js.map +1 -1
- package/dist/Slider.mjs +7 -6
- package/dist/Slider.module.js +7 -6
- package/dist/Slider.module.js.map +1 -1
- package/dist/Switch.main.js +1 -1
- package/dist/Switch.main.js.map +1 -1
- package/dist/Switch.mjs +2 -2
- package/dist/Switch.module.js +2 -2
- package/dist/Switch.module.js.map +1 -1
- package/dist/Table.main.js +139 -50
- package/dist/Table.main.js.map +1 -1
- package/dist/Table.mjs +139 -50
- package/dist/Table.module.js +139 -50
- package/dist/Table.module.js.map +1 -1
- package/dist/Tabs.main.js +86 -10
- package/dist/Tabs.main.js.map +1 -1
- package/dist/Tabs.mjs +88 -13
- package/dist/Tabs.module.js +88 -13
- package/dist/Tabs.module.js.map +1 -1
- package/dist/TagGroup.main.js +7 -6
- package/dist/TagGroup.main.js.map +1 -1
- package/dist/TagGroup.mjs +7 -6
- package/dist/TagGroup.module.js +7 -6
- package/dist/TagGroup.module.js.map +1 -1
- package/dist/Text.main.js +2 -1
- package/dist/Text.main.js.map +1 -1
- package/dist/Text.mjs +3 -2
- package/dist/Text.module.js +3 -2
- package/dist/Text.module.js.map +1 -1
- package/dist/TextArea.main.js +1 -1
- package/dist/TextArea.main.js.map +1 -1
- package/dist/TextArea.mjs +2 -2
- package/dist/TextArea.module.js +2 -2
- package/dist/TextArea.module.js.map +1 -1
- package/dist/TextField.main.js +1 -1
- package/dist/TextField.main.js.map +1 -1
- package/dist/TextField.mjs +2 -2
- package/dist/TextField.module.js +2 -2
- package/dist/TextField.module.js.map +1 -1
- package/dist/Toast.main.js +6 -4
- package/dist/Toast.main.js.map +1 -1
- package/dist/Toast.mjs +7 -5
- package/dist/Toast.module.js +7 -5
- package/dist/Toast.module.js.map +1 -1
- package/dist/ToggleButton.main.js +5 -2
- package/dist/ToggleButton.main.js.map +1 -1
- package/dist/ToggleButton.mjs +6 -3
- package/dist/ToggleButton.module.js +6 -3
- package/dist/ToggleButton.module.js.map +1 -1
- package/dist/ToggleButtonGroup.main.js +2 -1
- package/dist/ToggleButtonGroup.main.js.map +1 -1
- package/dist/ToggleButtonGroup.mjs +3 -2
- package/dist/ToggleButtonGroup.module.js +3 -2
- package/dist/ToggleButtonGroup.module.js.map +1 -1
- package/dist/Toolbar.main.js +1 -1
- package/dist/Toolbar.main.js.map +1 -1
- package/dist/Toolbar.mjs +2 -2
- package/dist/Toolbar.module.js +2 -2
- package/dist/Toolbar.module.js.map +1 -1
- package/dist/Tooltip.main.js +1 -1
- package/dist/Tooltip.main.js.map +1 -1
- package/dist/Tooltip.mjs +2 -2
- package/dist/Tooltip.module.js +2 -2
- package/dist/Tooltip.module.js.map +1 -1
- package/dist/Tree.main.js +6 -6
- package/dist/Tree.main.js.map +1 -1
- package/dist/Tree.mjs +7 -7
- package/dist/Tree.module.js +7 -7
- package/dist/Tree.module.js.map +1 -1
- package/dist/import.mjs +4 -4
- package/dist/main.js +5 -0
- package/dist/main.js.map +1 -1
- package/dist/module.js +4 -4
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +679 -90
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.main.js +41 -4
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.mjs +42 -6
- package/dist/utils.module.js +42 -6
- package/dist/utils.module.js.map +1 -1
- package/i18n/ar-AE.js +1 -1
- package/i18n/ar-AE.mjs +1 -1
- package/i18n/bg-BG.js +1 -1
- package/i18n/bg-BG.mjs +1 -1
- package/i18n/cs-CZ.js +1 -1
- package/i18n/cs-CZ.mjs +1 -1
- package/i18n/da-DK.js +1 -1
- package/i18n/da-DK.mjs +1 -1
- package/i18n/de-DE.js +1 -1
- package/i18n/de-DE.mjs +1 -1
- package/i18n/el-GR.js +1 -1
- package/i18n/el-GR.mjs +1 -1
- package/i18n/en-US.js +1 -1
- package/i18n/en-US.mjs +1 -1
- package/i18n/es-ES.js +1 -1
- package/i18n/es-ES.mjs +1 -1
- package/i18n/et-EE.js +1 -1
- package/i18n/et-EE.mjs +1 -1
- package/i18n/fi-FI.js +1 -1
- package/i18n/fi-FI.mjs +1 -1
- package/i18n/fr-FR.js +1 -1
- package/i18n/fr-FR.mjs +1 -1
- package/i18n/he-IL.js +1 -1
- package/i18n/he-IL.mjs +1 -1
- package/i18n/hr-HR.js +1 -1
- package/i18n/hr-HR.mjs +1 -1
- package/i18n/hu-HU.js +1 -1
- package/i18n/hu-HU.mjs +1 -1
- package/i18n/index.js +67 -67
- package/i18n/index.mjs +67 -67
- package/i18n/it-IT.js +1 -1
- package/i18n/it-IT.mjs +1 -1
- package/i18n/ja-JP.js +1 -1
- package/i18n/ja-JP.mjs +1 -1
- package/i18n/ko-KR.js +1 -1
- package/i18n/ko-KR.mjs +1 -1
- package/i18n/lt-LT.js +1 -1
- package/i18n/lt-LT.mjs +1 -1
- package/i18n/lv-LV.js +1 -1
- package/i18n/lv-LV.mjs +1 -1
- package/i18n/nb-NO.js +1 -1
- package/i18n/nb-NO.mjs +1 -1
- package/i18n/nl-NL.js +1 -1
- package/i18n/nl-NL.mjs +1 -1
- package/i18n/pl-PL.js +1 -1
- package/i18n/pl-PL.mjs +1 -1
- package/i18n/pt-BR.js +1 -1
- package/i18n/pt-BR.mjs +1 -1
- package/i18n/pt-PT.js +1 -1
- package/i18n/pt-PT.mjs +1 -1
- package/i18n/ro-RO.js +1 -1
- package/i18n/ro-RO.mjs +1 -1
- package/i18n/ru-RU.js +1 -1
- package/i18n/ru-RU.mjs +1 -1
- package/i18n/sk-SK.js +1 -1
- package/i18n/sk-SK.mjs +1 -1
- package/i18n/sl-SI.js +1 -1
- package/i18n/sl-SI.mjs +1 -1
- package/i18n/sr-SP.js +1 -1
- package/i18n/sr-SP.mjs +1 -1
- package/i18n/sv-SE.js +1 -1
- package/i18n/sv-SE.mjs +1 -1
- package/i18n/tr-TR.js +1 -1
- package/i18n/tr-TR.mjs +1 -1
- package/i18n/uk-UA.js +1 -1
- package/i18n/uk-UA.mjs +1 -1
- package/i18n/zh-CN.js +1 -1
- package/i18n/zh-CN.mjs +1 -1
- package/i18n/zh-TW.js +1 -1
- package/i18n/zh-TW.mjs +1 -1
- package/package.json +26 -26
- package/src/Autocomplete.tsx +1 -1
- package/src/Breadcrumbs.tsx +32 -10
- package/src/Button.tsx +10 -3
- package/src/Calendar.tsx +76 -25
- package/src/Checkbox.tsx +31 -7
- package/src/Collection.tsx +1 -1
- package/src/ColorArea.tsx +18 -4
- package/src/ColorField.tsx +34 -4
- package/src/ColorPicker.tsx +5 -2
- package/src/ColorSlider.tsx +18 -3
- package/src/ColorSwatch.tsx +17 -3
- package/src/ColorSwatchPicker.tsx +20 -1
- package/src/ColorThumb.tsx +10 -4
- package/src/ColorWheel.tsx +28 -6
- package/src/ComboBox.tsx +21 -3
- package/src/DateField.tsx +45 -9
- package/src/DatePicker.tsx +30 -5
- package/src/Dialog.tsx +10 -4
- package/src/Disclosure.tsx +37 -11
- package/src/DragAndDrop.tsx +8 -2
- package/src/DropZone.tsx +21 -7
- package/src/FieldError.tsx +8 -2
- package/src/FileTrigger.tsx +1 -0
- package/src/Form.tsx +9 -4
- package/src/GridList.tsx +63 -24
- package/src/Group.tsx +33 -21
- package/src/Header.tsx +7 -5
- package/src/Heading.tsx +4 -4
- package/src/HiddenDateInput.tsx +16 -7
- package/src/Input.tsx +24 -9
- package/src/Keyboard.tsx +4 -2
- package/src/Label.tsx +4 -3
- package/src/Link.tsx +23 -7
- package/src/ListBox.tsx +66 -26
- package/src/Menu.tsx +60 -17
- package/src/Meter.tsx +19 -4
- package/src/Modal.tsx +24 -5
- package/src/NumberField.tsx +22 -3
- package/src/OverlayArrow.tsx +16 -3
- package/src/Popover.tsx +18 -5
- package/src/ProgressBar.tsx +19 -4
- package/src/RadioGroup.tsx +31 -7
- package/src/SearchField.tsx +38 -5
- package/src/Select.tsx +30 -6
- package/src/SelectionIndicator.tsx +8 -2
- package/src/Separator.tsx +17 -5
- package/src/SharedElementTransition.tsx +4 -3
- package/src/Slider.tsx +43 -9
- package/src/Switch.tsx +22 -8
- package/src/Table.tsx +217 -86
- package/src/Tabs.tsx +165 -23
- package/src/TagGroup.tsx +44 -14
- package/src/Text.tsx +4 -3
- package/src/TextArea.tsx +16 -3
- package/src/TextField.tsx +23 -4
- package/src/Toast.tsx +37 -13
- package/src/ToggleButton.tsx +18 -5
- package/src/ToggleButtonGroup.tsx +25 -5
- package/src/Toolbar.tsx +16 -3
- package/src/Tooltip.tsx +16 -3
- package/src/Tree.tsx +66 -36
- package/src/index.ts +7 -7
- package/src/utils.tsx +98 -13
package/src/ProgressBar.tsx
CHANGED
|
@@ -12,13 +12,28 @@
|
|
|
12
12
|
|
|
13
13
|
import {AriaProgressBarProps, useProgressBar} from 'react-aria';
|
|
14
14
|
import {clamp} from '@react-stately/utils';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
ClassNameOrFunction,
|
|
17
|
+
ContextValue,
|
|
18
|
+
dom,
|
|
19
|
+
RenderProps,
|
|
20
|
+
SlotProps,
|
|
21
|
+
useContextProps,
|
|
22
|
+
useRenderProps,
|
|
23
|
+
useSlot
|
|
24
|
+
} from './utils';
|
|
16
25
|
import {filterDOMProps, mergeProps} from '@react-aria/utils';
|
|
17
26
|
import {GlobalDOMAttributes} from '@react-types/shared';
|
|
18
27
|
import {LabelContext} from './Label';
|
|
19
28
|
import React, {createContext, ForwardedRef, forwardRef} from 'react';
|
|
20
29
|
|
|
21
|
-
export interface ProgressBarProps extends Omit<AriaProgressBarProps, 'label'>, RenderProps<ProgressBarRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {
|
|
30
|
+
export interface ProgressBarProps extends Omit<AriaProgressBarProps, 'label'>, RenderProps<ProgressBarRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {
|
|
31
|
+
/**
|
|
32
|
+
* 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.
|
|
33
|
+
* @default 'react-aria-ProgressBar'
|
|
34
|
+
*/
|
|
35
|
+
className?: ClassNameOrFunction<ProgressBarRenderProps>
|
|
36
|
+
}
|
|
22
37
|
|
|
23
38
|
export interface ProgressBarRenderProps {
|
|
24
39
|
/**
|
|
@@ -77,10 +92,10 @@ export const ProgressBar = forwardRef(function ProgressBar(props: ProgressBarPro
|
|
|
77
92
|
let DOMProps = filterDOMProps(props, {global: true});
|
|
78
93
|
|
|
79
94
|
return (
|
|
80
|
-
<div {...mergeProps(DOMProps, renderProps, progressBarProps)} ref={ref} slot={props.slot || undefined}>
|
|
95
|
+
<dom.div {...mergeProps(DOMProps, renderProps, progressBarProps)} ref={ref} slot={props.slot || undefined}>
|
|
81
96
|
<LabelContext.Provider value={{...labelProps, ref: labelRef, elementType: 'span'}}>
|
|
82
97
|
{renderProps.children}
|
|
83
98
|
</LabelContext.Provider>
|
|
84
|
-
</div>
|
|
99
|
+
</dom.div>
|
|
85
100
|
);
|
|
86
101
|
});
|
package/src/RadioGroup.tsx
CHANGED
|
@@ -11,7 +11,20 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {AriaRadioGroupProps, AriaRadioProps, HoverEvents, Orientation, useFocusRing, useHover, useRadio, useRadioGroup, VisuallyHidden} from 'react-aria';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
ClassNameOrFunction,
|
|
16
|
+
ContextValue,
|
|
17
|
+
dom,
|
|
18
|
+
Provider,
|
|
19
|
+
RACValidation,
|
|
20
|
+
removeDataAttributes,
|
|
21
|
+
RenderProps,
|
|
22
|
+
SlotProps,
|
|
23
|
+
useContextProps,
|
|
24
|
+
useRenderProps,
|
|
25
|
+
useSlot,
|
|
26
|
+
useSlottedContext
|
|
27
|
+
} from './utils';
|
|
15
28
|
import {FieldErrorContext} from './FieldError';
|
|
16
29
|
import {filterDOMProps, mergeProps, mergeRefs, useObjectRef} from '@react-aria/utils';
|
|
17
30
|
import {FormContext} from './Form';
|
|
@@ -23,8 +36,19 @@ import {SelectionIndicatorContext} from './SelectionIndicator';
|
|
|
23
36
|
import {SharedElementTransition} from './SharedElementTransition';
|
|
24
37
|
import {TextContext} from './Text';
|
|
25
38
|
|
|
26
|
-
export interface RadioGroupProps extends Omit<AriaRadioGroupProps, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<RadioGroupRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {
|
|
27
|
-
|
|
39
|
+
export interface RadioGroupProps extends Omit<AriaRadioGroupProps, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<RadioGroupRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {
|
|
40
|
+
/**
|
|
41
|
+
* 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.
|
|
42
|
+
* @default 'react-aria-RadioGroup'
|
|
43
|
+
*/
|
|
44
|
+
className?: ClassNameOrFunction<RadioGroupRenderProps>
|
|
45
|
+
}
|
|
46
|
+
export interface RadioProps extends Omit<AriaRadioProps, 'children'>, HoverEvents, RenderProps<RadioRenderProps, 'label'>, SlotProps, Omit<GlobalDOMAttributes<HTMLLabelElement>, 'onClick'> {
|
|
47
|
+
/**
|
|
48
|
+
* 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.
|
|
49
|
+
* @default 'react-aria-Radio'
|
|
50
|
+
*/
|
|
51
|
+
className?: ClassNameOrFunction<RadioRenderProps>,
|
|
28
52
|
/**
|
|
29
53
|
* A ref for the HTML input element.
|
|
30
54
|
*/
|
|
@@ -152,7 +176,7 @@ export const RadioGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(function
|
|
|
152
176
|
let DOMProps = filterDOMProps(props, {global: true});
|
|
153
177
|
|
|
154
178
|
return (
|
|
155
|
-
<div
|
|
179
|
+
<dom.div
|
|
156
180
|
{...mergeProps(DOMProps, renderProps, radioGroupProps)}
|
|
157
181
|
ref={ref}
|
|
158
182
|
slot={props.slot || undefined}
|
|
@@ -177,7 +201,7 @@ export const RadioGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(function
|
|
|
177
201
|
{renderProps.children}
|
|
178
202
|
</SharedElementTransition>
|
|
179
203
|
</Provider>
|
|
180
|
-
</div>
|
|
204
|
+
</dom.div>
|
|
181
205
|
);
|
|
182
206
|
});
|
|
183
207
|
|
|
@@ -226,7 +250,7 @@ export const Radio = /*#__PURE__*/ (forwardRef as forwardRefType)(function Radio
|
|
|
226
250
|
delete DOMProps.onClick;
|
|
227
251
|
|
|
228
252
|
return (
|
|
229
|
-
<label
|
|
253
|
+
<dom.label
|
|
230
254
|
{...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}
|
|
231
255
|
ref={ref}
|
|
232
256
|
data-selected={isSelected || undefined}
|
|
@@ -244,6 +268,6 @@ export const Radio = /*#__PURE__*/ (forwardRef as forwardRefType)(function Radio
|
|
|
244
268
|
<SelectionIndicatorContext.Provider value={{isSelected}}>
|
|
245
269
|
{renderProps.children}
|
|
246
270
|
</SelectionIndicatorContext.Provider>
|
|
247
|
-
</label>
|
|
271
|
+
</dom.label>
|
|
248
272
|
);
|
|
249
273
|
});
|
package/src/SearchField.tsx
CHANGED
|
@@ -12,7 +12,20 @@
|
|
|
12
12
|
|
|
13
13
|
import {AriaSearchFieldProps, useSearchField} from 'react-aria';
|
|
14
14
|
import {ButtonContext} from './Button';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
ClassNameOrFunction,
|
|
17
|
+
ContextValue,
|
|
18
|
+
dom,
|
|
19
|
+
Provider,
|
|
20
|
+
RACValidation,
|
|
21
|
+
removeDataAttributes,
|
|
22
|
+
RenderProps,
|
|
23
|
+
SlotProps,
|
|
24
|
+
useContextProps,
|
|
25
|
+
useRenderProps,
|
|
26
|
+
useSlot,
|
|
27
|
+
useSlottedContext
|
|
28
|
+
} from './utils';
|
|
16
29
|
import {createHideableComponent} from '@react-aria/collections';
|
|
17
30
|
import {FieldErrorContext} from './FieldError';
|
|
18
31
|
import {FieldInputContext} from './RSPContexts';
|
|
@@ -42,13 +55,29 @@ export interface SearchFieldRenderProps {
|
|
|
42
55
|
* @selector [data-invalid]
|
|
43
56
|
*/
|
|
44
57
|
isInvalid: boolean,
|
|
58
|
+
/**
|
|
59
|
+
* Whether the search field is read only.
|
|
60
|
+
* @selector [data-readonly]
|
|
61
|
+
*/
|
|
62
|
+
isReadOnly: boolean,
|
|
63
|
+
/**
|
|
64
|
+
* Whether the search field is required.
|
|
65
|
+
* @selector [data-required]
|
|
66
|
+
*/
|
|
67
|
+
isRequired: boolean,
|
|
45
68
|
/**
|
|
46
69
|
* State of the search field.
|
|
47
70
|
*/
|
|
48
71
|
state: SearchFieldState
|
|
49
72
|
}
|
|
50
73
|
|
|
51
|
-
export interface SearchFieldProps extends Omit<AriaSearchFieldProps, 'label' | 'placeholder' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<SearchFieldRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {
|
|
74
|
+
export interface SearchFieldProps extends Omit<AriaSearchFieldProps, 'label' | 'placeholder' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<SearchFieldRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {
|
|
75
|
+
/**
|
|
76
|
+
* 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.
|
|
77
|
+
* @default 'react-aria-SearchField'
|
|
78
|
+
*/
|
|
79
|
+
className?: ClassNameOrFunction<SearchFieldRenderProps>
|
|
80
|
+
}
|
|
52
81
|
|
|
53
82
|
export const SearchFieldContext = createContext<ContextValue<SearchFieldProps, HTMLDivElement>>(null);
|
|
54
83
|
|
|
@@ -81,6 +110,8 @@ export const SearchField = /*#__PURE__*/ createHideableComponent(function Search
|
|
|
81
110
|
isEmpty: state.value === '',
|
|
82
111
|
isDisabled: props.isDisabled || false,
|
|
83
112
|
isInvalid: validation.isInvalid || false,
|
|
113
|
+
isReadOnly: props.isReadOnly || false,
|
|
114
|
+
isRequired: props.isRequired || false,
|
|
84
115
|
state
|
|
85
116
|
},
|
|
86
117
|
defaultClassName: 'react-aria-SearchField'
|
|
@@ -90,14 +121,16 @@ export const SearchField = /*#__PURE__*/ createHideableComponent(function Search
|
|
|
90
121
|
delete DOMProps.id;
|
|
91
122
|
|
|
92
123
|
return (
|
|
93
|
-
<div
|
|
124
|
+
<dom.div
|
|
94
125
|
{...DOMProps}
|
|
95
126
|
{...renderProps}
|
|
96
127
|
ref={ref}
|
|
97
128
|
slot={props.slot || undefined}
|
|
98
129
|
data-empty={state.value === '' || undefined}
|
|
99
130
|
data-disabled={props.isDisabled || undefined}
|
|
100
|
-
data-invalid={validation.isInvalid || undefined}
|
|
131
|
+
data-invalid={validation.isInvalid || undefined}
|
|
132
|
+
data-readonly={props.isReadOnly || undefined}
|
|
133
|
+
data-required={props.isRequired || undefined}>
|
|
101
134
|
<Provider
|
|
102
135
|
values={[
|
|
103
136
|
[LabelContext, {...labelProps, ref: labelRef}],
|
|
@@ -114,6 +147,6 @@ export const SearchField = /*#__PURE__*/ createHideableComponent(function Search
|
|
|
114
147
|
]}>
|
|
115
148
|
{renderProps.children}
|
|
116
149
|
</Provider>
|
|
117
|
-
</div>
|
|
150
|
+
</dom.div>
|
|
118
151
|
);
|
|
119
152
|
});
|
package/src/Select.tsx
CHANGED
|
@@ -12,9 +12,22 @@
|
|
|
12
12
|
|
|
13
13
|
import {AriaSelectProps, HiddenSelect, useFocusRing, useListFormatter, useLocalizedStringFormatter, useSelect} from 'react-aria';
|
|
14
14
|
import {ButtonContext} from './Button';
|
|
15
|
+
import {
|
|
16
|
+
ClassNameOrFunction,
|
|
17
|
+
ContextValue,
|
|
18
|
+
dom,
|
|
19
|
+
Provider,
|
|
20
|
+
RACValidation,
|
|
21
|
+
removeDataAttributes,
|
|
22
|
+
RenderProps,
|
|
23
|
+
SlotProps,
|
|
24
|
+
useContextProps,
|
|
25
|
+
useRenderProps,
|
|
26
|
+
useSlot,
|
|
27
|
+
useSlottedContext
|
|
28
|
+
} from './utils';
|
|
15
29
|
import {Collection, Node, SelectState, useSelectState} from 'react-stately';
|
|
16
30
|
import {CollectionBuilder, createHideableComponent} from '@react-aria/collections';
|
|
17
|
-
import {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';
|
|
18
31
|
import {FieldErrorContext} from './FieldError';
|
|
19
32
|
import {filterDOMProps, mergeProps, useResizeObserver} from '@react-aria/utils';
|
|
20
33
|
import {FormContext} from './Form';
|
|
@@ -65,6 +78,11 @@ export interface SelectRenderProps {
|
|
|
65
78
|
}
|
|
66
79
|
|
|
67
80
|
export interface SelectProps<T extends object = {}, M extends SelectionMode = 'single'> extends Omit<AriaSelectProps<T, M>, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior' | 'items'>, RACValidation, RenderProps<SelectRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {
|
|
81
|
+
/**
|
|
82
|
+
* 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.
|
|
83
|
+
* @default 'react-aria-Select'
|
|
84
|
+
*/
|
|
85
|
+
className?: ClassNameOrFunction<SelectRenderProps>,
|
|
68
86
|
/**
|
|
69
87
|
* Temporary text that occupies the select when it is empty.
|
|
70
88
|
* @default 'Select an item' (localized)
|
|
@@ -205,7 +223,7 @@ function SelectInner<T extends object>({props, selectRef: ref, collection}: Sele
|
|
|
205
223
|
}],
|
|
206
224
|
[FieldErrorContext, validation]
|
|
207
225
|
]}>
|
|
208
|
-
<div
|
|
226
|
+
<dom.div
|
|
209
227
|
{...mergeProps(DOMProps, renderProps, focusProps)}
|
|
210
228
|
ref={ref}
|
|
211
229
|
slot={props.slot || undefined}
|
|
@@ -219,7 +237,7 @@ function SelectInner<T extends object>({props, selectRef: ref, collection}: Sele
|
|
|
219
237
|
<HiddenSelect
|
|
220
238
|
{...hiddenSelectProps}
|
|
221
239
|
autoComplete={props.autoComplete} />
|
|
222
|
-
</div>
|
|
240
|
+
</dom.div>
|
|
223
241
|
</Provider>
|
|
224
242
|
);
|
|
225
243
|
}
|
|
@@ -243,7 +261,13 @@ export interface SelectValueRenderProps<T> {
|
|
|
243
261
|
state: SelectState<T, 'single' | 'multiple'>
|
|
244
262
|
}
|
|
245
263
|
|
|
246
|
-
export interface SelectValueProps<T extends object> extends Omit<HTMLAttributes<HTMLElement>, keyof RenderProps<unknown>>, RenderProps<SelectValueRenderProps<T
|
|
264
|
+
export interface SelectValueProps<T extends object> extends Omit<HTMLAttributes<HTMLElement>, keyof RenderProps<unknown>>, RenderProps<SelectValueRenderProps<T>, 'span'> {
|
|
265
|
+
/**
|
|
266
|
+
* 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.
|
|
267
|
+
* @default 'react-aria-SelectValue'
|
|
268
|
+
*/
|
|
269
|
+
className?: ClassNameOrFunction<SelectValueRenderProps<T>>
|
|
270
|
+
}
|
|
247
271
|
|
|
248
272
|
export const SelectValueContext = createContext<ContextValue<SelectValueProps<any>, HTMLSpanElement>>(null);
|
|
249
273
|
|
|
@@ -322,11 +346,11 @@ export const SelectValue = /*#__PURE__*/ createHideableComponent(function Select
|
|
|
322
346
|
let DOMProps = filterDOMProps(props, {global: true});
|
|
323
347
|
|
|
324
348
|
return (
|
|
325
|
-
<span ref={ref} {...DOMProps} {...renderProps} data-placeholder={state.selectedItems.length === 0 || undefined}>
|
|
349
|
+
<dom.span ref={ref} {...DOMProps} {...renderProps} data-placeholder={state.selectedItems.length === 0 || undefined}>
|
|
326
350
|
{/* clear description and error message slots */}
|
|
327
351
|
<TextContext.Provider value={undefined}>
|
|
328
352
|
{renderProps.children}
|
|
329
353
|
</TextContext.Provider>
|
|
330
|
-
</span>
|
|
354
|
+
</dom.span>
|
|
331
355
|
);
|
|
332
356
|
});
|
|
@@ -10,11 +10,17 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {ContextValue, useContextProps} from './utils';
|
|
13
|
+
import {ClassNameOrFunction, ContextValue, useContextProps} from './utils';
|
|
14
14
|
import React, {createContext, ForwardedRef, forwardRef} from 'react';
|
|
15
|
-
import {SharedElement, SharedElementPropsBase} from './SharedElementTransition';
|
|
15
|
+
import {SharedElement, SharedElementPropsBase, SharedElementRenderProps} from './SharedElementTransition';
|
|
16
16
|
|
|
17
17
|
export interface SelectionIndicatorProps extends SharedElementPropsBase {
|
|
18
|
+
/**
|
|
19
|
+
* 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.
|
|
20
|
+
* @default 'react-aria-SelectionIndicator'
|
|
21
|
+
*/
|
|
22
|
+
className?: ClassNameOrFunction<SharedElementRenderProps>,
|
|
23
|
+
/** Whether the SelectionIndicator is visible. This is usually set automatically by the parent component. */
|
|
18
24
|
isSelected?: boolean
|
|
19
25
|
}
|
|
20
26
|
|
package/src/Separator.tsx
CHANGED
|
@@ -12,12 +12,18 @@
|
|
|
12
12
|
|
|
13
13
|
import {SeparatorProps as AriaSeparatorProps, useSeparator} from 'react-aria';
|
|
14
14
|
import {BaseCollection, CollectionNode, createLeafComponent} from '@react-aria/collections';
|
|
15
|
-
import {ContextValue, SlotProps, StyleProps, useContextProps} from './utils';
|
|
15
|
+
import {ContextValue, dom, DOMRenderProps, SlotProps, StyleProps, useContextProps} from './utils';
|
|
16
16
|
import {filterDOMProps, mergeProps} from '@react-aria/utils';
|
|
17
17
|
import {GlobalDOMAttributes} from '@react-types/shared';
|
|
18
|
-
import React, {createContext,
|
|
18
|
+
import React, {createContext, ForwardedRef} from 'react';
|
|
19
19
|
|
|
20
|
-
export interface SeparatorProps extends AriaSeparatorProps, StyleProps, SlotProps, GlobalDOMAttributes<HTMLElement> {
|
|
20
|
+
export interface SeparatorProps extends AriaSeparatorProps, StyleProps, SlotProps, DOMRenderProps<'hr' | 'div', undefined>, GlobalDOMAttributes<HTMLElement> {
|
|
21
|
+
/**
|
|
22
|
+
* The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element.
|
|
23
|
+
* @default 'react-aria-Separator'
|
|
24
|
+
*/
|
|
25
|
+
className?: string
|
|
26
|
+
}
|
|
21
27
|
|
|
22
28
|
export const SeparatorContext = createContext<ContextValue<SeparatorProps, HTMLElement>>({});
|
|
23
29
|
|
|
@@ -36,15 +42,20 @@ export class SeparatorNode extends CollectionNode<any> {
|
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
44
|
|
|
45
|
+
/**
|
|
46
|
+
* A separator is a visual divider between two groups of content, e.g. groups of menu items or sections of a page.
|
|
47
|
+
*/
|
|
39
48
|
export const Separator = /*#__PURE__*/ createLeafComponent(SeparatorNode, function Separator(props: SeparatorProps, ref: ForwardedRef<HTMLElement>) {
|
|
40
49
|
[props, ref] = useContextProps(props, ref, SeparatorContext);
|
|
41
50
|
|
|
42
51
|
let {elementType, orientation, style, className, slot, ...otherProps} = props;
|
|
43
|
-
let Element =
|
|
52
|
+
let Element = elementType || 'hr';
|
|
44
53
|
if (Element === 'hr' && orientation === 'vertical') {
|
|
45
54
|
Element = 'div';
|
|
46
55
|
}
|
|
47
56
|
|
|
57
|
+
let ElementType = dom[Element];
|
|
58
|
+
|
|
48
59
|
let {separatorProps} = useSeparator({
|
|
49
60
|
...otherProps,
|
|
50
61
|
elementType,
|
|
@@ -54,7 +65,8 @@ export const Separator = /*#__PURE__*/ createLeafComponent(SeparatorNode, functi
|
|
|
54
65
|
let DOMProps = filterDOMProps(props, {global: true});
|
|
55
66
|
|
|
56
67
|
return (
|
|
57
|
-
<
|
|
68
|
+
<ElementType
|
|
69
|
+
render={props.render}
|
|
58
70
|
{...mergeProps(DOMProps, separatorProps)}
|
|
59
71
|
style={style}
|
|
60
72
|
className={className ?? 'react-aria-Separator'}
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import {dom, RenderProps, useRenderProps} from './utils';
|
|
13
14
|
import {flushSync} from 'react-dom';
|
|
14
15
|
import React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, ReactNode, RefObject, useContext, useRef, useState} from 'react';
|
|
15
|
-
import {RenderProps, useRenderProps} from './utils';
|
|
16
16
|
import {useLayoutEffect} from '@react-aria/utils';
|
|
17
17
|
import {useObjectRef} from 'react-aria';
|
|
18
18
|
|
|
@@ -63,7 +63,7 @@ export interface SharedElementProps extends SharedElementPropsBase {
|
|
|
63
63
|
* An element that animates between its old and new position when moving between parents.
|
|
64
64
|
*/
|
|
65
65
|
export const SharedElement = forwardRef(function SharedElement(props: SharedElementProps, ref: ForwardedRef<HTMLDivElement>) {
|
|
66
|
-
let {name, isVisible = true, children, className, style, ...divProps} = props;
|
|
66
|
+
let {name, isVisible = true, children, className, style, render, ...divProps} = props;
|
|
67
67
|
let [state, setState] = useState(isVisible ? 'visible' : 'hidden');
|
|
68
68
|
let scopeRef = useContext(SharedElementContext);
|
|
69
69
|
if (!scopeRef) {
|
|
@@ -164,6 +164,7 @@ export const SharedElement = forwardRef(function SharedElement(props: SharedElem
|
|
|
164
164
|
children,
|
|
165
165
|
className,
|
|
166
166
|
style,
|
|
167
|
+
render,
|
|
167
168
|
values: {
|
|
168
169
|
isEntering: state === 'entering',
|
|
169
170
|
isExiting: state === 'exiting'
|
|
@@ -175,7 +176,7 @@ export const SharedElement = forwardRef(function SharedElement(props: SharedElem
|
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
return (
|
|
178
|
-
<div
|
|
179
|
+
<dom.div
|
|
179
180
|
{...divProps}
|
|
180
181
|
{...renderProps}
|
|
181
182
|
ref={ref}
|
package/src/Slider.tsx
CHANGED
|
@@ -11,7 +11,18 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {AriaSliderProps, AriaSliderThumbProps, HoverEvents, mergeProps, Orientation, useFocusRing, useHover, useNumberFormatter, useSlider, useSliderThumb, VisuallyHidden} from 'react-aria';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
ClassNameOrFunction,
|
|
16
|
+
ContextValue,
|
|
17
|
+
dom,
|
|
18
|
+
Provider,
|
|
19
|
+
RenderProps,
|
|
20
|
+
SlotProps,
|
|
21
|
+
useContextProps,
|
|
22
|
+
useRenderProps,
|
|
23
|
+
useSlot,
|
|
24
|
+
useSlottedContext
|
|
25
|
+
} from './utils';
|
|
15
26
|
import {filterDOMProps} from '@react-aria/utils';
|
|
16
27
|
import {forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';
|
|
17
28
|
import {LabelContext} from './Label';
|
|
@@ -19,6 +30,11 @@ import React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, OutputHT
|
|
|
19
30
|
import {SliderState, useSliderState} from 'react-stately';
|
|
20
31
|
|
|
21
32
|
export interface SliderProps<T = number | number[]> extends Omit<AriaSliderProps<T>, 'label'>, RenderProps<SliderRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {
|
|
33
|
+
/**
|
|
34
|
+
* 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.
|
|
35
|
+
* @default 'react-aria-Slider'
|
|
36
|
+
*/
|
|
37
|
+
className?: ClassNameOrFunction<SliderRenderProps>,
|
|
22
38
|
/**
|
|
23
39
|
* The display format of the value label.
|
|
24
40
|
*/
|
|
@@ -86,7 +102,7 @@ export const Slider = /*#__PURE__*/ (forwardRef as forwardRefType)(function Slid
|
|
|
86
102
|
[SliderOutputContext, outputProps],
|
|
87
103
|
[LabelContext, {...labelProps, ref: labelRef}]
|
|
88
104
|
]}>
|
|
89
|
-
<div
|
|
105
|
+
<dom.div
|
|
90
106
|
{...mergeProps(DOMProps, renderProps, groupProps)}
|
|
91
107
|
ref={ref}
|
|
92
108
|
slot={props.slot || undefined}
|
|
@@ -96,7 +112,13 @@ export const Slider = /*#__PURE__*/ (forwardRef as forwardRefType)(function Slid
|
|
|
96
112
|
);
|
|
97
113
|
});
|
|
98
114
|
|
|
99
|
-
export interface SliderOutputProps extends RenderProps<SliderRenderProps>, GlobalDOMAttributes<HTMLOutputElement> {
|
|
115
|
+
export interface SliderOutputProps extends RenderProps<SliderRenderProps, 'output'>, GlobalDOMAttributes<HTMLOutputElement> {
|
|
116
|
+
/**
|
|
117
|
+
* 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.
|
|
118
|
+
* @default 'react-aria-SliderOutput'
|
|
119
|
+
*/
|
|
120
|
+
className?: ClassNameOrFunction<SliderRenderProps>
|
|
121
|
+
}
|
|
100
122
|
interface SliderOutputContextValue extends Omit<OutputHTMLAttributes<HTMLOutputElement>, 'children' | 'className' | 'style'>, SliderOutputProps {}
|
|
101
123
|
|
|
102
124
|
/**
|
|
@@ -104,12 +126,13 @@ interface SliderOutputContextValue extends Omit<OutputHTMLAttributes<HTMLOutputE
|
|
|
104
126
|
*/
|
|
105
127
|
export const SliderOutput = /*#__PURE__*/ (forwardRef as forwardRefType)(function SliderOutput(props: SliderOutputProps, ref: ForwardedRef<HTMLOutputElement>) {
|
|
106
128
|
[props, ref] = useContextProps(props, ref, SliderOutputContext);
|
|
107
|
-
let {children, style, className, ...otherProps} = props;
|
|
129
|
+
let {children, style, className, render, ...otherProps} = props;
|
|
108
130
|
let state = useContext(SliderStateContext)!;
|
|
109
131
|
let renderProps = useRenderProps({
|
|
110
132
|
className,
|
|
111
133
|
style,
|
|
112
134
|
children,
|
|
135
|
+
render,
|
|
113
136
|
defaultChildren: state.getThumbValueLabel(0),
|
|
114
137
|
defaultClassName: 'react-aria-SliderOutput',
|
|
115
138
|
values: {
|
|
@@ -120,7 +143,7 @@ export const SliderOutput = /*#__PURE__*/ (forwardRef as forwardRefType)(functio
|
|
|
120
143
|
});
|
|
121
144
|
|
|
122
145
|
return (
|
|
123
|
-
<output
|
|
146
|
+
<dom.output
|
|
124
147
|
{...otherProps}
|
|
125
148
|
{...renderProps}
|
|
126
149
|
ref={ref}
|
|
@@ -137,7 +160,13 @@ export interface SliderTrackRenderProps extends SliderRenderProps {
|
|
|
137
160
|
isHovered: boolean
|
|
138
161
|
}
|
|
139
162
|
|
|
140
|
-
export interface SliderTrackProps extends HoverEvents, RenderProps<SliderTrackRenderProps>, GlobalDOMAttributes<HTMLDivElement> {
|
|
163
|
+
export interface SliderTrackProps extends HoverEvents, RenderProps<SliderTrackRenderProps>, GlobalDOMAttributes<HTMLDivElement> {
|
|
164
|
+
/**
|
|
165
|
+
* 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.
|
|
166
|
+
* @default 'react-aria-SliderTrack'
|
|
167
|
+
*/
|
|
168
|
+
className?: ClassNameOrFunction<SliderTrackRenderProps>
|
|
169
|
+
}
|
|
141
170
|
interface SliderTrackContextValue extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'className' | 'style'>, SliderTrackProps {}
|
|
142
171
|
|
|
143
172
|
/**
|
|
@@ -160,7 +189,7 @@ export const SliderTrack = /*#__PURE__*/ (forwardRef as forwardRefType)(function
|
|
|
160
189
|
});
|
|
161
190
|
|
|
162
191
|
return (
|
|
163
|
-
<div
|
|
192
|
+
<dom.div
|
|
164
193
|
{...mergeProps(otherProps, hoverProps)}
|
|
165
194
|
{...renderProps}
|
|
166
195
|
ref={ref}
|
|
@@ -203,6 +232,11 @@ export interface SliderThumbRenderProps {
|
|
|
203
232
|
}
|
|
204
233
|
|
|
205
234
|
export interface SliderThumbProps extends Omit<AriaSliderThumbProps, 'label' | 'validationState'>, HoverEvents, RenderProps<SliderThumbRenderProps>, GlobalDOMAttributes<HTMLDivElement> {
|
|
235
|
+
/**
|
|
236
|
+
* 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.
|
|
237
|
+
* @default 'react-aria-SliderThumb'
|
|
238
|
+
*/
|
|
239
|
+
className?: ClassNameOrFunction<SliderThumbRenderProps>,
|
|
206
240
|
/**
|
|
207
241
|
* A ref for the HTML input element.
|
|
208
242
|
*/
|
|
@@ -252,7 +286,7 @@ export const SliderThumb = /*#__PURE__*/ (forwardRef as forwardRefType)(function
|
|
|
252
286
|
delete DOMProps.id;
|
|
253
287
|
|
|
254
288
|
return (
|
|
255
|
-
<div
|
|
289
|
+
<dom.div
|
|
256
290
|
{...mergeProps(DOMProps, thumbProps, hoverProps)}
|
|
257
291
|
{...renderProps}
|
|
258
292
|
ref={ref}
|
|
@@ -271,6 +305,6 @@ export const SliderThumb = /*#__PURE__*/ (forwardRef as forwardRefType)(function
|
|
|
271
305
|
]}>
|
|
272
306
|
{renderProps.children}
|
|
273
307
|
</Provider>
|
|
274
|
-
</div>
|
|
308
|
+
</dom.div>
|
|
275
309
|
);
|
|
276
310
|
});
|
package/src/Switch.tsx
CHANGED
|
@@ -11,17 +11,31 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {AriaSwitchProps, HoverEvents, mergeProps, useFocusRing, useHover, useSwitch, VisuallyHidden} from 'react-aria';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
ClassNameOrFunction,
|
|
16
|
+
ContextValue,
|
|
17
|
+
dom,
|
|
18
|
+
removeDataAttributes,
|
|
19
|
+
RenderProps,
|
|
20
|
+
SlotProps,
|
|
21
|
+
useContextProps,
|
|
22
|
+
useRenderProps
|
|
23
|
+
} from './utils';
|
|
15
24
|
import {filterDOMProps, mergeRefs, useObjectRef} from '@react-aria/utils';
|
|
16
25
|
import {forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';
|
|
17
26
|
import React, {createContext, ForwardedRef, forwardRef} from 'react';
|
|
18
27
|
import {ToggleState, useToggleState} from 'react-stately';
|
|
19
28
|
|
|
20
|
-
export interface SwitchProps extends Omit<AriaSwitchProps, 'children'>, HoverEvents, RenderProps<SwitchRenderProps>, SlotProps, Omit<GlobalDOMAttributes<HTMLLabelElement>, 'onClick'> {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
export interface SwitchProps extends Omit<AriaSwitchProps, 'children'>, HoverEvents, RenderProps<SwitchRenderProps, 'label'>, SlotProps, Omit<GlobalDOMAttributes<HTMLLabelElement>, 'onClick'> {
|
|
30
|
+
/**
|
|
31
|
+
* 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.
|
|
32
|
+
* @default 'react-aria-Switch'
|
|
33
|
+
*/
|
|
34
|
+
className?: ClassNameOrFunction<SwitchRenderProps>,
|
|
35
|
+
/**
|
|
36
|
+
* A ref for the HTML input element.
|
|
37
|
+
*/
|
|
38
|
+
inputRef?: RefObject<HTMLInputElement | null>
|
|
25
39
|
}
|
|
26
40
|
|
|
27
41
|
export interface SwitchRenderProps {
|
|
@@ -112,7 +126,7 @@ export const Switch = /*#__PURE__*/ (forwardRef as forwardRefType)(function Swit
|
|
|
112
126
|
delete DOMProps.onClick;
|
|
113
127
|
|
|
114
128
|
return (
|
|
115
|
-
<label
|
|
129
|
+
<dom.label
|
|
116
130
|
{...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}
|
|
117
131
|
ref={ref}
|
|
118
132
|
slot={props.slot || undefined}
|
|
@@ -127,6 +141,6 @@ export const Switch = /*#__PURE__*/ (forwardRef as forwardRefType)(function Swit
|
|
|
127
141
|
<input {...mergeProps(inputProps, focusProps)} ref={inputRef} />
|
|
128
142
|
</VisuallyHidden>
|
|
129
143
|
{renderProps.children}
|
|
130
|
-
</label>
|
|
144
|
+
</dom.label>
|
|
131
145
|
);
|
|
132
146
|
});
|