@depup/react-aria-components 1.16.0-depup.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/LICENSE +201 -0
- package/README.md +31 -0
- package/changes.json +10 -0
- package/dist/Autocomplete.main.js +78 -0
- package/dist/Autocomplete.main.js.map +1 -0
- package/dist/Autocomplete.mjs +67 -0
- package/dist/Autocomplete.module.js +67 -0
- package/dist/Autocomplete.module.js.map +1 -0
- package/dist/Breadcrumbs.main.js +103 -0
- package/dist/Breadcrumbs.main.js.map +1 -0
- package/dist/Breadcrumbs.mjs +92 -0
- package/dist/Breadcrumbs.module.js +92 -0
- package/dist/Breadcrumbs.module.js.map +1 -0
- package/dist/Button.main.js +123 -0
- package/dist/Button.main.js.map +1 -0
- package/dist/Button.mjs +113 -0
- package/dist/Button.module.js +113 -0
- package/dist/Button.module.js.map +1 -0
- package/dist/Calendar.main.js +364 -0
- package/dist/Calendar.main.js.map +1 -0
- package/dist/Calendar.mjs +345 -0
- package/dist/Calendar.module.js +345 -0
- package/dist/Calendar.module.js.map +1 -0
- package/dist/Checkbox.main.js +188 -0
- package/dist/Checkbox.main.js.map +1 -0
- package/dist/Checkbox.mjs +176 -0
- package/dist/Checkbox.module.js +176 -0
- package/dist/Checkbox.module.js.map +1 -0
- package/dist/Collection.main.js +105 -0
- package/dist/Collection.main.js.map +1 -0
- package/dist/Collection.mjs +91 -0
- package/dist/Collection.module.js +91 -0
- package/dist/Collection.module.js.map +1 -0
- package/dist/ColorArea.main.js +80 -0
- package/dist/ColorArea.main.js.map +1 -0
- package/dist/ColorArea.mjs +70 -0
- package/dist/ColorArea.module.js +70 -0
- package/dist/ColorArea.module.js.map +1 -0
- package/dist/ColorField.main.js +168 -0
- package/dist/ColorField.main.js.map +1 -0
- package/dist/ColorField.mjs +158 -0
- package/dist/ColorField.module.js +158 -0
- package/dist/ColorField.module.js.map +1 -0
- package/dist/ColorPicker.main.js +102 -0
- package/dist/ColorPicker.main.js.map +1 -0
- package/dist/ColorPicker.mjs +91 -0
- package/dist/ColorPicker.module.js +91 -0
- package/dist/ColorPicker.module.js.map +1 -0
- package/dist/ColorSlider.main.js +112 -0
- package/dist/ColorSlider.main.js.map +1 -0
- package/dist/ColorSlider.mjs +102 -0
- package/dist/ColorSlider.module.js +102 -0
- package/dist/ColorSlider.module.js.map +1 -0
- package/dist/ColorSwatch.main.js +44 -0
- package/dist/ColorSwatch.main.js.map +1 -0
- package/dist/ColorSwatch.mjs +34 -0
- package/dist/ColorSwatch.module.js +34 -0
- package/dist/ColorSwatch.module.js.map +1 -0
- package/dist/ColorSwatchPicker.main.js +102 -0
- package/dist/ColorSwatchPicker.main.js.map +1 -0
- package/dist/ColorSwatchPicker.mjs +95 -0
- package/dist/ColorSwatchPicker.module.js +95 -0
- package/dist/ColorSwatchPicker.module.js.map +1 -0
- package/dist/ColorThumb.main.js +67 -0
- package/dist/ColorThumb.main.js.map +1 -0
- package/dist/ColorThumb.mjs +57 -0
- package/dist/ColorThumb.module.js +57 -0
- package/dist/ColorThumb.module.js.map +1 -0
- package/dist/ColorWheel.main.js +102 -0
- package/dist/ColorWheel.main.js.map +1 -0
- package/dist/ColorWheel.mjs +90 -0
- package/dist/ColorWheel.module.js +90 -0
- package/dist/ColorWheel.module.js.map +1 -0
- package/dist/ComboBox.main.js +322 -0
- package/dist/ComboBox.main.js.map +1 -0
- package/dist/ComboBox.mjs +309 -0
- package/dist/ComboBox.module.js +309 -0
- package/dist/ComboBox.module.js.map +1 -0
- package/dist/DateField.main.js +361 -0
- package/dist/DateField.main.js.map +1 -0
- package/dist/DateField.mjs +345 -0
- package/dist/DateField.module.js +345 -0
- package/dist/DateField.module.js.map +1 -0
- package/dist/DatePicker.main.js +342 -0
- package/dist/DatePicker.main.js.map +1 -0
- package/dist/DatePicker.mjs +328 -0
- package/dist/DatePicker.module.js +328 -0
- package/dist/DatePicker.module.js.map +1 -0
- package/dist/Dialog.main.js +167 -0
- package/dist/Dialog.main.js.map +1 -0
- package/dist/Dialog.mjs +155 -0
- package/dist/Dialog.module.js +155 -0
- package/dist/Dialog.module.js.map +1 -0
- package/dist/Disclosure.main.js +171 -0
- package/dist/Disclosure.main.js.map +1 -0
- package/dist/Disclosure.mjs +157 -0
- package/dist/Disclosure.module.js +157 -0
- package/dist/Disclosure.module.js.map +1 -0
- package/dist/DragAndDrop.main.js +103 -0
- package/dist/DragAndDrop.main.js.map +1 -0
- package/dist/DragAndDrop.mjs +90 -0
- package/dist/DragAndDrop.module.js +90 -0
- package/dist/DragAndDrop.module.js.map +1 -0
- package/dist/DropZone.main.js +127 -0
- package/dist/DropZone.main.js.map +1 -0
- package/dist/DropZone.mjs +121 -0
- package/dist/DropZone.module.js +121 -0
- package/dist/DropZone.module.js.map +1 -0
- package/dist/FieldError.main.js +61 -0
- package/dist/FieldError.main.js.map +1 -0
- package/dist/FieldError.mjs +51 -0
- package/dist/FieldError.module.js +51 -0
- package/dist/FieldError.module.js.map +1 -0
- package/dist/FileTrigger.main.js +60 -0
- package/dist/FileTrigger.main.js.map +1 -0
- package/dist/FileTrigger.mjs +51 -0
- package/dist/FileTrigger.module.js +51 -0
- package/dist/FileTrigger.module.js.map +1 -0
- package/dist/Form.main.js +49 -0
- package/dist/Form.main.js.map +1 -0
- package/dist/Form.mjs +39 -0
- package/dist/Form.module.js +39 -0
- package/dist/Form.module.js.map +1 -0
- package/dist/GridList.main.js +589 -0
- package/dist/GridList.main.js.map +1 -0
- package/dist/GridList.mjs +573 -0
- package/dist/GridList.module.js +573 -0
- package/dist/GridList.module.js.map +1 -0
- package/dist/Group.main.js +72 -0
- package/dist/Group.main.js.map +1 -0
- package/dist/Group.mjs +62 -0
- package/dist/Group.module.js +62 -0
- package/dist/Group.module.js.map +1 -0
- package/dist/Header.main.js +40 -0
- package/dist/Header.main.js.map +1 -0
- package/dist/Header.mjs +30 -0
- package/dist/Header.module.js +30 -0
- package/dist/Header.module.js.map +1 -0
- package/dist/Heading.main.js +40 -0
- package/dist/Heading.main.js.map +1 -0
- package/dist/Heading.mjs +31 -0
- package/dist/Heading.module.js +31 -0
- package/dist/Heading.module.js.map +1 -0
- package/dist/HiddenDateInput.main.js +126 -0
- package/dist/HiddenDateInput.main.js.map +1 -0
- package/dist/HiddenDateInput.mjs +117 -0
- package/dist/HiddenDateInput.module.js +117 -0
- package/dist/HiddenDateInput.module.js.map +1 -0
- package/dist/Input.main.js +72 -0
- package/dist/Input.main.js.map +1 -0
- package/dist/Input.mjs +62 -0
- package/dist/Input.module.js +62 -0
- package/dist/Input.module.js.map +1 -0
- package/dist/Keyboard.main.js +38 -0
- package/dist/Keyboard.main.js.map +1 -0
- package/dist/Keyboard.mjs +28 -0
- package/dist/Keyboard.module.js +28 -0
- package/dist/Keyboard.module.js.map +1 -0
- package/dist/Label.main.js +43 -0
- package/dist/Label.main.js.map +1 -0
- package/dist/Label.mjs +33 -0
- package/dist/Label.module.js +33 -0
- package/dist/Label.module.js.map +1 -0
- package/dist/Link.main.js +72 -0
- package/dist/Link.main.js.map +1 -0
- package/dist/Link.mjs +62 -0
- package/dist/Link.module.js +62 -0
- package/dist/Link.module.js.map +1 -0
- package/dist/ListBox.main.js +477 -0
- package/dist/ListBox.main.js.map +1 -0
- package/dist/ListBox.mjs +463 -0
- package/dist/ListBox.module.js +463 -0
- package/dist/ListBox.module.js.map +1 -0
- package/dist/Menu.main.js +459 -0
- package/dist/Menu.main.js.map +1 -0
- package/dist/Menu.mjs +443 -0
- package/dist/Menu.module.js +443 -0
- package/dist/Menu.module.js.map +1 -0
- package/dist/Meter.main.js +72 -0
- package/dist/Meter.main.js.map +1 -0
- package/dist/Meter.mjs +62 -0
- package/dist/Meter.module.js +62 -0
- package/dist/Meter.module.js.map +1 -0
- package/dist/Modal.main.js +191 -0
- package/dist/Modal.main.js.map +1 -0
- package/dist/Modal.mjs +180 -0
- package/dist/Modal.module.js +180 -0
- package/dist/Modal.module.js.map +1 -0
- package/dist/NumberField.main.js +147 -0
- package/dist/NumberField.main.js.map +1 -0
- package/dist/NumberField.mjs +136 -0
- package/dist/NumberField.module.js +136 -0
- package/dist/NumberField.module.js.map +1 -0
- package/dist/OverlayArrow.main.js +64 -0
- package/dist/OverlayArrow.main.js.map +1 -0
- package/dist/OverlayArrow.mjs +54 -0
- package/dist/OverlayArrow.module.js +54 -0
- package/dist/OverlayArrow.module.js.map +1 -0
- package/dist/Popover.main.js +196 -0
- package/dist/Popover.main.js.map +1 -0
- package/dist/Popover.mjs +186 -0
- package/dist/Popover.module.js +186 -0
- package/dist/Popover.module.js.map +1 -0
- package/dist/ProgressBar.main.js +73 -0
- package/dist/ProgressBar.main.js.map +1 -0
- package/dist/ProgressBar.mjs +63 -0
- package/dist/ProgressBar.module.js +63 -0
- package/dist/ProgressBar.module.js.map +1 -0
- package/dist/RSPContexts.main.js +37 -0
- package/dist/RSPContexts.main.js.map +1 -0
- package/dist/RSPContexts.mjs +25 -0
- package/dist/RSPContexts.module.js +25 -0
- package/dist/RSPContexts.module.js.map +1 -0
- package/dist/RadioGroup.main.js +184 -0
- package/dist/RadioGroup.main.js.map +1 -0
- package/dist/RadioGroup.mjs +171 -0
- package/dist/RadioGroup.module.js +171 -0
- package/dist/RadioGroup.module.js.map +1 -0
- package/dist/SearchField.main.js +140 -0
- package/dist/SearchField.main.js.map +1 -0
- package/dist/SearchField.mjs +130 -0
- package/dist/SearchField.module.js +130 -0
- package/dist/SearchField.module.js.map +1 -0
- package/dist/Select.main.js +324 -0
- package/dist/Select.main.js.map +1 -0
- package/dist/Select.mjs +315 -0
- package/dist/Select.module.js +315 -0
- package/dist/Select.module.js.map +1 -0
- package/dist/SelectionIndicator.main.js +45 -0
- package/dist/SelectionIndicator.main.js.map +1 -0
- package/dist/SelectionIndicator.mjs +35 -0
- package/dist/SelectionIndicator.module.js +35 -0
- package/dist/SelectionIndicator.module.js.map +1 -0
- package/dist/Separator.main.js +71 -0
- package/dist/Separator.main.js.map +1 -0
- package/dist/Separator.mjs +61 -0
- package/dist/Separator.module.js +61 -0
- package/dist/Separator.module.js.map +1 -0
- package/dist/SharedElementTransition.main.js +140 -0
- package/dist/SharedElementTransition.main.js.map +1 -0
- package/dist/SharedElementTransition.mjs +130 -0
- package/dist/SharedElementTransition.module.js +130 -0
- package/dist/SharedElementTransition.module.js.map +1 -0
- package/dist/Slider.main.js +220 -0
- package/dist/Slider.main.js.map +1 -0
- package/dist/Slider.mjs +204 -0
- package/dist/Slider.module.js +204 -0
- package/dist/Slider.module.js.map +1 -0
- package/dist/Switch.main.js +89 -0
- package/dist/Switch.main.js.map +1 -0
- package/dist/Switch.mjs +79 -0
- package/dist/Switch.module.js +79 -0
- package/dist/Switch.module.js.map +1 -0
- package/dist/Table.main.js +1171 -0
- package/dist/Table.main.js.map +1 -0
- package/dist/Table.mjs +1154 -0
- package/dist/Table.module.js +1154 -0
- package/dist/Table.module.js.map +1 -0
- package/dist/TableLayout.main.js +38 -0
- package/dist/TableLayout.main.js.map +1 -0
- package/dist/TableLayout.mjs +33 -0
- package/dist/TableLayout.module.js +33 -0
- package/dist/TableLayout.module.js.map +1 -0
- package/dist/Tabs.main.js +330 -0
- package/dist/Tabs.main.js.map +1 -0
- package/dist/Tabs.mjs +315 -0
- package/dist/Tabs.module.js +315 -0
- package/dist/Tabs.module.js.map +1 -0
- package/dist/TagGroup.main.js +255 -0
- package/dist/TagGroup.main.js.map +1 -0
- package/dist/TagGroup.mjs +242 -0
- package/dist/TagGroup.module.js +242 -0
- package/dist/TagGroup.module.js.map +1 -0
- package/dist/Text.main.js +41 -0
- package/dist/Text.main.js.map +1 -0
- package/dist/Text.mjs +31 -0
- package/dist/Text.module.js +31 -0
- package/dist/Text.module.js.map +1 -0
- package/dist/TextArea.main.js +57 -0
- package/dist/TextArea.main.js.map +1 -0
- package/dist/TextArea.mjs +47 -0
- package/dist/TextArea.module.js +47 -0
- package/dist/TextArea.module.js.map +1 -0
- package/dist/TextField.main.js +145 -0
- package/dist/TextField.main.js.map +1 -0
- package/dist/TextField.mjs +135 -0
- package/dist/TextField.module.js +135 -0
- package/dist/TextField.module.js.map +1 -0
- package/dist/Toast.main.js +183 -0
- package/dist/Toast.main.js.map +1 -0
- package/dist/Toast.mjs +170 -0
- package/dist/Toast.module.js +170 -0
- package/dist/Toast.module.js.map +1 -0
- package/dist/ToggleButton.main.js +96 -0
- package/dist/ToggleButton.main.js.map +1 -0
- package/dist/ToggleButton.mjs +86 -0
- package/dist/ToggleButton.module.js +86 -0
- package/dist/ToggleButton.module.js.map +1 -0
- package/dist/ToggleButtonGroup.main.js +66 -0
- package/dist/ToggleButtonGroup.main.js.map +1 -0
- package/dist/ToggleButtonGroup.mjs +55 -0
- package/dist/ToggleButtonGroup.module.js +55 -0
- package/dist/ToggleButtonGroup.module.js.map +1 -0
- package/dist/Toolbar.main.js +55 -0
- package/dist/Toolbar.main.js.map +1 -0
- package/dist/Toolbar.mjs +45 -0
- package/dist/Toolbar.module.js +45 -0
- package/dist/Toolbar.module.js.map +1 -0
- package/dist/Tooltip.main.js +132 -0
- package/dist/Tooltip.main.js.map +1 -0
- package/dist/Tooltip.mjs +120 -0
- package/dist/Tooltip.module.js +120 -0
- package/dist/Tooltip.module.js.map +1 -0
- package/dist/Tree.main.js +834 -0
- package/dist/Tree.main.js.map +1 -0
- package/dist/Tree.mjs +818 -0
- package/dist/Tree.module.js +818 -0
- package/dist/Tree.module.js.map +1 -0
- package/dist/TreeDropTargetDelegate.main.js +216 -0
- package/dist/TreeDropTargetDelegate.main.js.map +1 -0
- package/dist/TreeDropTargetDelegate.mjs +211 -0
- package/dist/TreeDropTargetDelegate.module.js +211 -0
- package/dist/TreeDropTargetDelegate.module.js.map +1 -0
- package/dist/Virtualizer.main.js +135 -0
- package/dist/Virtualizer.main.js.map +1 -0
- package/dist/Virtualizer.mjs +126 -0
- package/dist/Virtualizer.module.js +126 -0
- package/dist/Virtualizer.module.js.map +1 -0
- package/dist/ar-AE.main.js +9 -0
- package/dist/ar-AE.main.js.map +1 -0
- package/dist/ar-AE.mjs +11 -0
- package/dist/ar-AE.module.js +11 -0
- package/dist/ar-AE.module.js.map +1 -0
- package/dist/bg-BG.main.js +9 -0
- package/dist/bg-BG.main.js.map +1 -0
- package/dist/bg-BG.mjs +11 -0
- package/dist/bg-BG.module.js +11 -0
- package/dist/bg-BG.module.js.map +1 -0
- package/dist/cs-CZ.main.js +9 -0
- package/dist/cs-CZ.main.js.map +1 -0
- package/dist/cs-CZ.mjs +11 -0
- package/dist/cs-CZ.module.js +11 -0
- package/dist/cs-CZ.module.js.map +1 -0
- package/dist/da-DK.main.js +9 -0
- package/dist/da-DK.main.js.map +1 -0
- package/dist/da-DK.mjs +11 -0
- package/dist/da-DK.module.js +11 -0
- package/dist/da-DK.module.js.map +1 -0
- package/dist/de-DE.main.js +9 -0
- package/dist/de-DE.main.js.map +1 -0
- package/dist/de-DE.mjs +11 -0
- package/dist/de-DE.module.js +11 -0
- package/dist/de-DE.module.js.map +1 -0
- package/dist/el-GR.main.js +9 -0
- package/dist/el-GR.main.js.map +1 -0
- package/dist/el-GR.mjs +11 -0
- package/dist/el-GR.module.js +11 -0
- package/dist/el-GR.module.js.map +1 -0
- package/dist/en-US.main.js +9 -0
- package/dist/en-US.main.js.map +1 -0
- package/dist/en-US.mjs +11 -0
- package/dist/en-US.module.js +11 -0
- package/dist/en-US.module.js.map +1 -0
- package/dist/es-ES.main.js +9 -0
- package/dist/es-ES.main.js.map +1 -0
- package/dist/es-ES.mjs +11 -0
- package/dist/es-ES.module.js +11 -0
- package/dist/es-ES.module.js.map +1 -0
- package/dist/et-EE.main.js +9 -0
- package/dist/et-EE.main.js.map +1 -0
- package/dist/et-EE.mjs +11 -0
- package/dist/et-EE.module.js +11 -0
- package/dist/et-EE.module.js.map +1 -0
- package/dist/fi-FI.main.js +9 -0
- package/dist/fi-FI.main.js.map +1 -0
- package/dist/fi-FI.mjs +11 -0
- package/dist/fi-FI.module.js +11 -0
- package/dist/fi-FI.module.js.map +1 -0
- package/dist/fr-FR.main.js +9 -0
- package/dist/fr-FR.main.js.map +1 -0
- package/dist/fr-FR.mjs +11 -0
- package/dist/fr-FR.module.js +11 -0
- package/dist/fr-FR.module.js.map +1 -0
- package/dist/he-IL.main.js +9 -0
- package/dist/he-IL.main.js.map +1 -0
- package/dist/he-IL.mjs +11 -0
- package/dist/he-IL.module.js +11 -0
- package/dist/he-IL.module.js.map +1 -0
- package/dist/hr-HR.main.js +9 -0
- package/dist/hr-HR.main.js.map +1 -0
- package/dist/hr-HR.mjs +11 -0
- package/dist/hr-HR.module.js +11 -0
- package/dist/hr-HR.module.js.map +1 -0
- package/dist/hu-HU.main.js +9 -0
- package/dist/hu-HU.main.js.map +1 -0
- package/dist/hu-HU.mjs +11 -0
- package/dist/hu-HU.module.js +11 -0
- package/dist/hu-HU.module.js.map +1 -0
- package/dist/import.mjs +161 -0
- package/dist/intlStrings.main.js +108 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +110 -0
- package/dist/intlStrings.module.js +110 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/it-IT.main.js +9 -0
- package/dist/it-IT.main.js.map +1 -0
- package/dist/it-IT.mjs +11 -0
- package/dist/it-IT.module.js +11 -0
- package/dist/it-IT.module.js.map +1 -0
- package/dist/ja-JP.main.js +9 -0
- package/dist/ja-JP.main.js.map +1 -0
- package/dist/ja-JP.mjs +11 -0
- package/dist/ja-JP.module.js +11 -0
- package/dist/ja-JP.module.js.map +1 -0
- package/dist/ko-KR.main.js +9 -0
- package/dist/ko-KR.main.js.map +1 -0
- package/dist/ko-KR.mjs +11 -0
- package/dist/ko-KR.module.js +11 -0
- package/dist/ko-KR.module.js.map +1 -0
- package/dist/lt-LT.main.js +9 -0
- package/dist/lt-LT.main.js.map +1 -0
- package/dist/lt-LT.mjs +11 -0
- package/dist/lt-LT.module.js +11 -0
- package/dist/lt-LT.module.js.map +1 -0
- package/dist/lv-LV.main.js +9 -0
- package/dist/lv-LV.main.js.map +1 -0
- package/dist/lv-LV.mjs +11 -0
- package/dist/lv-LV.module.js +11 -0
- package/dist/lv-LV.module.js.map +1 -0
- package/dist/main.js +430 -0
- package/dist/main.js.map +1 -0
- package/dist/module.js +161 -0
- package/dist/module.js.map +1 -0
- package/dist/nb-NO.main.js +9 -0
- package/dist/nb-NO.main.js.map +1 -0
- package/dist/nb-NO.mjs +11 -0
- package/dist/nb-NO.module.js +11 -0
- package/dist/nb-NO.module.js.map +1 -0
- package/dist/nl-NL.main.js +9 -0
- package/dist/nl-NL.main.js.map +1 -0
- package/dist/nl-NL.mjs +11 -0
- package/dist/nl-NL.module.js +11 -0
- package/dist/nl-NL.module.js.map +1 -0
- package/dist/pl-PL.main.js +9 -0
- package/dist/pl-PL.main.js.map +1 -0
- package/dist/pl-PL.mjs +11 -0
- package/dist/pl-PL.module.js +11 -0
- package/dist/pl-PL.module.js.map +1 -0
- package/dist/pt-BR.main.js +9 -0
- package/dist/pt-BR.main.js.map +1 -0
- package/dist/pt-BR.mjs +11 -0
- package/dist/pt-BR.module.js +11 -0
- package/dist/pt-BR.module.js.map +1 -0
- package/dist/pt-PT.main.js +9 -0
- package/dist/pt-PT.main.js.map +1 -0
- package/dist/pt-PT.mjs +11 -0
- package/dist/pt-PT.module.js +11 -0
- package/dist/pt-PT.module.js.map +1 -0
- package/dist/ro-RO.main.js +9 -0
- package/dist/ro-RO.main.js.map +1 -0
- package/dist/ro-RO.mjs +11 -0
- package/dist/ro-RO.module.js +11 -0
- package/dist/ro-RO.module.js.map +1 -0
- package/dist/ru-RU.main.js +9 -0
- package/dist/ru-RU.main.js.map +1 -0
- package/dist/ru-RU.mjs +11 -0
- package/dist/ru-RU.module.js +11 -0
- package/dist/ru-RU.module.js.map +1 -0
- package/dist/sk-SK.main.js +9 -0
- package/dist/sk-SK.main.js.map +1 -0
- package/dist/sk-SK.mjs +11 -0
- package/dist/sk-SK.module.js +11 -0
- package/dist/sk-SK.module.js.map +1 -0
- package/dist/sl-SI.main.js +9 -0
- package/dist/sl-SI.main.js.map +1 -0
- package/dist/sl-SI.mjs +11 -0
- package/dist/sl-SI.module.js +11 -0
- package/dist/sl-SI.module.js.map +1 -0
- package/dist/sr-SP.main.js +9 -0
- package/dist/sr-SP.main.js.map +1 -0
- package/dist/sr-SP.mjs +11 -0
- package/dist/sr-SP.module.js +11 -0
- package/dist/sr-SP.module.js.map +1 -0
- package/dist/sv-SE.main.js +9 -0
- package/dist/sv-SE.main.js.map +1 -0
- package/dist/sv-SE.mjs +11 -0
- package/dist/sv-SE.module.js +11 -0
- package/dist/sv-SE.module.js.map +1 -0
- package/dist/tr-TR.main.js +9 -0
- package/dist/tr-TR.main.js.map +1 -0
- package/dist/tr-TR.mjs +11 -0
- package/dist/tr-TR.module.js +11 -0
- package/dist/tr-TR.module.js.map +1 -0
- package/dist/types.d.ts +3764 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/uk-UA.main.js +9 -0
- package/dist/uk-UA.main.js.map +1 -0
- package/dist/uk-UA.mjs +11 -0
- package/dist/uk-UA.module.js +11 -0
- package/dist/uk-UA.module.js.map +1 -0
- package/dist/useDragAndDrop.main.js +74 -0
- package/dist/useDragAndDrop.main.js.map +1 -0
- package/dist/useDragAndDrop.mjs +69 -0
- package/dist/useDragAndDrop.module.js +69 -0
- package/dist/useDragAndDrop.module.js.map +1 -0
- package/dist/utils.main.js +205 -0
- package/dist/utils.main.js.map +1 -0
- package/dist/utils.mjs +188 -0
- package/dist/utils.module.js +188 -0
- package/dist/utils.module.js.map +1 -0
- package/dist/zh-CN.main.js +9 -0
- package/dist/zh-CN.main.js.map +1 -0
- package/dist/zh-CN.mjs +11 -0
- package/dist/zh-CN.module.js +11 -0
- package/dist/zh-CN.module.js.map +1 -0
- package/dist/zh-TW.main.js +9 -0
- package/dist/zh-TW.main.js.map +1 -0
- package/dist/zh-TW.mjs +11 -0
- package/dist/zh-TW.module.js +11 -0
- package/dist/zh-TW.module.js.map +1 -0
- package/i18n/ar-AE.js +1 -0
- package/i18n/ar-AE.mjs +1 -0
- package/i18n/bg-BG.js +1 -0
- package/i18n/bg-BG.mjs +1 -0
- package/i18n/cs-CZ.js +1 -0
- package/i18n/cs-CZ.mjs +1 -0
- package/i18n/da-DK.js +1 -0
- package/i18n/da-DK.mjs +1 -0
- package/i18n/de-DE.js +1 -0
- package/i18n/de-DE.mjs +1 -0
- package/i18n/el-GR.js +1 -0
- package/i18n/el-GR.mjs +1 -0
- package/i18n/en-US.js +1 -0
- package/i18n/en-US.mjs +1 -0
- package/i18n/es-ES.js +1 -0
- package/i18n/es-ES.mjs +1 -0
- package/i18n/et-EE.js +1 -0
- package/i18n/et-EE.mjs +1 -0
- package/i18n/fi-FI.js +1 -0
- package/i18n/fi-FI.mjs +1 -0
- package/i18n/fr-FR.js +1 -0
- package/i18n/fr-FR.mjs +1 -0
- package/i18n/he-IL.js +1 -0
- package/i18n/he-IL.mjs +1 -0
- package/i18n/hr-HR.js +1 -0
- package/i18n/hr-HR.mjs +1 -0
- package/i18n/hu-HU.js +1 -0
- package/i18n/hu-HU.mjs +1 -0
- package/i18n/index.d.ts +13 -0
- package/i18n/index.js +118 -0
- package/i18n/index.mjs +115 -0
- package/i18n/it-IT.js +1 -0
- package/i18n/it-IT.mjs +1 -0
- package/i18n/ja-JP.js +1 -0
- package/i18n/ja-JP.mjs +1 -0
- package/i18n/ko-KR.js +1 -0
- package/i18n/ko-KR.mjs +1 -0
- package/i18n/lang.d.ts +7 -0
- package/i18n/lt-LT.js +1 -0
- package/i18n/lt-LT.mjs +1 -0
- package/i18n/lv-LV.js +1 -0
- package/i18n/lv-LV.mjs +1 -0
- package/i18n/nb-NO.js +1 -0
- package/i18n/nb-NO.mjs +1 -0
- package/i18n/nl-NL.js +1 -0
- package/i18n/nl-NL.mjs +1 -0
- package/i18n/pl-PL.js +1 -0
- package/i18n/pl-PL.mjs +1 -0
- package/i18n/pt-BR.js +1 -0
- package/i18n/pt-BR.mjs +1 -0
- package/i18n/pt-PT.js +1 -0
- package/i18n/pt-PT.mjs +1 -0
- package/i18n/ro-RO.js +1 -0
- package/i18n/ro-RO.mjs +1 -0
- package/i18n/ru-RU.js +1 -0
- package/i18n/ru-RU.mjs +1 -0
- package/i18n/sk-SK.js +1 -0
- package/i18n/sk-SK.mjs +1 -0
- package/i18n/sl-SI.js +1 -0
- package/i18n/sl-SI.mjs +1 -0
- package/i18n/sr-SP.js +1 -0
- package/i18n/sr-SP.mjs +1 -0
- package/i18n/sv-SE.js +1 -0
- package/i18n/sv-SE.mjs +1 -0
- package/i18n/tr-TR.js +1 -0
- package/i18n/tr-TR.mjs +1 -0
- package/i18n/uk-UA.js +1 -0
- package/i18n/uk-UA.mjs +1 -0
- package/i18n/zh-CN.js +1 -0
- package/i18n/zh-CN.mjs +1 -0
- package/i18n/zh-TW.js +1 -0
- package/i18n/zh-TW.mjs +1 -0
- package/package.json +105 -0
- package/src/Autocomplete.tsx +64 -0
- package/src/Breadcrumbs.tsx +137 -0
- package/src/Button.tsx +185 -0
- package/src/Calendar.tsx +620 -0
- package/src/Checkbox.tsx +282 -0
- package/src/Collection.tsx +225 -0
- package/src/ColorArea.tsx +89 -0
- package/src/ColorField.tsx +243 -0
- package/src/ColorPicker.tsx +63 -0
- package/src/ColorSlider.tsx +110 -0
- package/src/ColorSwatch.tsx +54 -0
- package/src/ColorSwatchPicker.tsx +125 -0
- package/src/ColorThumb.tsx +108 -0
- package/src/ColorWheel.tsx +122 -0
- package/src/ComboBox.tsx +325 -0
- package/src/DateField.tsx +425 -0
- package/src/DatePicker.tsx +334 -0
- package/src/Dialog.tsx +159 -0
- package/src/Disclosure.tsx +259 -0
- package/src/DragAndDrop.tsx +115 -0
- package/src/DropZone.tsx +145 -0
- package/src/FieldError.tsx +57 -0
- package/src/FileTrigger.tsx +79 -0
- package/src/Form.tsx +52 -0
- package/src/GridList.tsx +678 -0
- package/src/Group.tsx +114 -0
- package/src/Header.tsx +28 -0
- package/src/Heading.tsx +31 -0
- package/src/HiddenDateInput.tsx +152 -0
- package/src/Input.tsx +113 -0
- package/src/Keyboard.tsx +23 -0
- package/src/Label.tsx +29 -0
- package/src/Link.tsx +115 -0
- package/src/ListBox.tsx +577 -0
- package/src/Menu.tsx +496 -0
- package/src/Meter.tsx +93 -0
- package/src/Modal.tsx +262 -0
- package/src/NumberField.tsx +152 -0
- package/src/OverlayArrow.tsx +91 -0
- package/src/Popover.tsx +267 -0
- package/src/ProgressBar.tsx +101 -0
- package/src/RSPContexts.ts +52 -0
- package/src/RadioGroup.tsx +273 -0
- package/src/SearchField.tsx +152 -0
- package/src/Select.tsx +356 -0
- package/src/SelectionIndicator.tsx +46 -0
- package/src/Separator.tsx +76 -0
- package/src/SharedElementTransition.tsx +186 -0
- package/src/Slider.tsx +310 -0
- package/src/Switch.tsx +146 -0
- package/src/Table.tsx +1597 -0
- package/src/TableLayout.ts +28 -0
- package/src/Tabs.tsx +495 -0
- package/src/TagGroup.tsx +310 -0
- package/src/Text.tsx +28 -0
- package/src/TextArea.tsx +65 -0
- package/src/TextField.tsx +148 -0
- package/src/Toast.tsx +248 -0
- package/src/ToggleButton.tsx +103 -0
- package/src/ToggleButtonGroup.tsx +90 -0
- package/src/Toolbar.tsx +69 -0
- package/src/Tooltip.tsx +187 -0
- package/src/Tree.tsx +1066 -0
- package/src/TreeDropTargetDelegate.ts +308 -0
- package/src/Virtualizer.tsx +174 -0
- package/src/index.ts +160 -0
- package/src/useDragAndDrop.tsx +150 -0
- package/src/utils.tsx +351 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
DropIndicatorProps as AriaDropIndicatorProps,
|
|
15
|
+
DraggableCollectionOptions,
|
|
16
|
+
DraggableItemProps,
|
|
17
|
+
DraggableItemResult,
|
|
18
|
+
DragItem,
|
|
19
|
+
DragPreview,
|
|
20
|
+
DropIndicatorAria,
|
|
21
|
+
DroppableCollectionOptions,
|
|
22
|
+
DroppableCollectionResult,
|
|
23
|
+
DroppableItemOptions,
|
|
24
|
+
DroppableItemResult,
|
|
25
|
+
DropTarget,
|
|
26
|
+
DropTargetDelegate,
|
|
27
|
+
ListDropTargetDelegate,
|
|
28
|
+
useDraggableCollection,
|
|
29
|
+
useDraggableItem,
|
|
30
|
+
useDropIndicator,
|
|
31
|
+
useDroppableCollection,
|
|
32
|
+
useDroppableItem
|
|
33
|
+
} from 'react-aria';
|
|
34
|
+
import {DraggableCollectionProps, DroppableCollectionProps, Key, RefObject} from '@react-types/shared';
|
|
35
|
+
import {
|
|
36
|
+
DraggableCollectionState,
|
|
37
|
+
DraggableCollectionStateOptions,
|
|
38
|
+
DroppableCollectionState,
|
|
39
|
+
DroppableCollectionStateOptions,
|
|
40
|
+
useDraggableCollectionState,
|
|
41
|
+
useDroppableCollectionState
|
|
42
|
+
} from 'react-stately';
|
|
43
|
+
import {isVirtualDragging} from '@react-aria/dnd';
|
|
44
|
+
import {JSX, useMemo} from 'react';
|
|
45
|
+
|
|
46
|
+
interface DraggableCollectionStateOpts<T = object> extends Omit<DraggableCollectionStateOptions<T>, 'getItems'> {}
|
|
47
|
+
|
|
48
|
+
interface DragHooks<T = object> {
|
|
49
|
+
useDraggableCollectionState?: (props: DraggableCollectionStateOpts<T>) => DraggableCollectionState,
|
|
50
|
+
useDraggableCollection?: (props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement | null>) => void,
|
|
51
|
+
useDraggableItem?: (props: DraggableItemProps, state: DraggableCollectionState) => DraggableItemResult,
|
|
52
|
+
DragPreview?: typeof DragPreview,
|
|
53
|
+
renderDragPreview?: (items: DragItem[]) => JSX.Element | {element: JSX.Element, x: number, y: number},
|
|
54
|
+
isVirtualDragging?: () => boolean
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface DropHooks {
|
|
58
|
+
useDroppableCollectionState?: (props: DroppableCollectionStateOptions) => DroppableCollectionState,
|
|
59
|
+
useDroppableCollection?: (props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DroppableCollectionResult,
|
|
60
|
+
useDroppableItem?: (options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DroppableItemResult,
|
|
61
|
+
useDropIndicator?: (props: AriaDropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DropIndicatorAria,
|
|
62
|
+
renderDropIndicator?: (target: DropTarget) => JSX.Element,
|
|
63
|
+
dropTargetDelegate?: DropTargetDelegate,
|
|
64
|
+
ListDropTargetDelegate: typeof ListDropTargetDelegate
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type DragAndDropHooks<T = object> = DragHooks<T> & DropHooks
|
|
68
|
+
|
|
69
|
+
export interface DragAndDrop<T = object> {
|
|
70
|
+
/** Drag and drop hooks for the collection element. */
|
|
71
|
+
dragAndDropHooks: DragAndDropHooks<T>
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface DragAndDropOptions<T = object> extends Omit<DraggableCollectionProps, 'preview' | 'getItems'>, DroppableCollectionProps {
|
|
75
|
+
/**
|
|
76
|
+
* A function that returns the items being dragged. If not specified, we assume that the collection is not draggable.
|
|
77
|
+
* @default () => []
|
|
78
|
+
*/
|
|
79
|
+
getItems?: (keys: Set<Key>, items: T[]) => DragItem[],
|
|
80
|
+
/**
|
|
81
|
+
* A function that renders a drag preview, which is shown under the user's cursor while dragging.
|
|
82
|
+
* By default, a copy of the dragged element is rendered.
|
|
83
|
+
*/
|
|
84
|
+
renderDragPreview?: (items: DragItem[]) => JSX.Element | {element: JSX.Element, x: number, y: number},
|
|
85
|
+
/**
|
|
86
|
+
* A function that renders a drop indicator element between two items in a collection.
|
|
87
|
+
* This should render a `<DropIndicator>` element. If this function is not provided, a
|
|
88
|
+
* default DropIndicator is provided.
|
|
89
|
+
*/
|
|
90
|
+
renderDropIndicator?: (target: DropTarget) => JSX.Element,
|
|
91
|
+
/** A custom delegate object that provides drop targets for pointer coordinates within the collection. */
|
|
92
|
+
dropTargetDelegate?: DropTargetDelegate,
|
|
93
|
+
/** Whether the drag and drop events should be disabled. */
|
|
94
|
+
isDisabled?: boolean
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Provides the hooks required to enable drag and drop behavior for a drag and drop compatible collection component.
|
|
99
|
+
*/
|
|
100
|
+
export function useDragAndDrop<T = object>(options: DragAndDropOptions<T>): DragAndDrop<T> {
|
|
101
|
+
let dragAndDropHooks = useMemo(() => {
|
|
102
|
+
let {
|
|
103
|
+
onDrop,
|
|
104
|
+
onInsert,
|
|
105
|
+
onItemDrop,
|
|
106
|
+
onReorder,
|
|
107
|
+
onMove,
|
|
108
|
+
onRootDrop,
|
|
109
|
+
getItems,
|
|
110
|
+
renderDragPreview,
|
|
111
|
+
renderDropIndicator,
|
|
112
|
+
dropTargetDelegate
|
|
113
|
+
} = options;
|
|
114
|
+
|
|
115
|
+
let isDraggable = !!getItems;
|
|
116
|
+
let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onMove || onRootDrop);
|
|
117
|
+
|
|
118
|
+
let hooks = {} as DragAndDropHooks;
|
|
119
|
+
if (isDraggable) {
|
|
120
|
+
hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(props: DraggableCollectionStateOpts) {
|
|
121
|
+
return useDraggableCollectionState({...props, ...options} as DraggableCollectionStateOptions);
|
|
122
|
+
};
|
|
123
|
+
hooks.useDraggableCollection = useDraggableCollection;
|
|
124
|
+
hooks.useDraggableItem = useDraggableItem;
|
|
125
|
+
hooks.DragPreview = DragPreview;
|
|
126
|
+
hooks.renderDragPreview = renderDragPreview;
|
|
127
|
+
hooks.isVirtualDragging = isVirtualDragging;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (isDroppable) {
|
|
131
|
+
hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props: DroppableCollectionStateOptions) {
|
|
132
|
+
return useDroppableCollectionState({...props, ...options});
|
|
133
|
+
};
|
|
134
|
+
hooks.useDroppableItem = useDroppableItem;
|
|
135
|
+
hooks.useDroppableCollection = function useDroppableCollectionOverride(props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) {
|
|
136
|
+
return useDroppableCollection({...props, ...options}, state, ref);
|
|
137
|
+
};
|
|
138
|
+
hooks.useDropIndicator = useDropIndicator;
|
|
139
|
+
hooks.renderDropIndicator = renderDropIndicator;
|
|
140
|
+
hooks.dropTargetDelegate = dropTargetDelegate;
|
|
141
|
+
hooks.ListDropTargetDelegate = ListDropTargetDelegate;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return hooks;
|
|
145
|
+
}, [options]);
|
|
146
|
+
|
|
147
|
+
return {
|
|
148
|
+
dragAndDropHooks
|
|
149
|
+
};
|
|
150
|
+
}
|
package/src/utils.tsx
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {AriaLabelingProps, RefObject, DOMProps as SharedDOMProps} from '@react-types/shared';
|
|
14
|
+
import {mergeProps, mergeRefs, useLayoutEffect, useObjectRef} from '@react-aria/utils';
|
|
15
|
+
import React, {AllHTMLAttributes, AnchorHTMLAttributes, Context, CSSProperties, DetailedHTMLProps, ForwardedRef, forwardRef, JSX, ReactElement, ReactNode, RefCallback, useCallback, useContext, useMemo, useRef, useState} from 'react';
|
|
16
|
+
|
|
17
|
+
export const DEFAULT_SLOT = Symbol('default');
|
|
18
|
+
|
|
19
|
+
interface SlottedValue<T> {
|
|
20
|
+
slots?: Record<string | symbol, T>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;
|
|
24
|
+
export type ContextValue<T, E> = SlottedContextValue<WithRef<T, E>>;
|
|
25
|
+
|
|
26
|
+
type ProviderValue<T> = [Context<T>, T];
|
|
27
|
+
type ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L> =
|
|
28
|
+
| [ProviderValue<A>]
|
|
29
|
+
| [ProviderValue<A>, ProviderValue<B>]
|
|
30
|
+
| [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>]
|
|
31
|
+
| [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>]
|
|
32
|
+
| [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>]
|
|
33
|
+
| [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>, ProviderValue<F>]
|
|
34
|
+
| [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>, ProviderValue<F>, ProviderValue<G>]
|
|
35
|
+
| [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>, ProviderValue<F>, ProviderValue<G>, ProviderValue<H>]
|
|
36
|
+
| [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>, ProviderValue<F>, ProviderValue<G>, ProviderValue<H>, ProviderValue<I>]
|
|
37
|
+
| [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>, ProviderValue<F>, ProviderValue<G>, ProviderValue<H>, ProviderValue<I>, ProviderValue<J>]
|
|
38
|
+
| [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>, ProviderValue<F>, ProviderValue<G>, ProviderValue<H>, ProviderValue<I>, ProviderValue<J>, ProviderValue<K>]
|
|
39
|
+
| [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>, ProviderValue<F>, ProviderValue<G>, ProviderValue<H>, ProviderValue<I>, ProviderValue<J>, ProviderValue<K>, ProviderValue<L>];
|
|
40
|
+
|
|
41
|
+
interface ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L> {
|
|
42
|
+
values: ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L>,
|
|
43
|
+
children: ReactNode
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function Provider<A, B, C, D, E, F, G, H, I, J, K, L>({values, children}: ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L>): JSX.Element {
|
|
47
|
+
for (let [Context, value] of values) {
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
children = <Context.Provider value={value}>{children}</Context.Provider>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return children as JSX.Element;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface StyleProps {
|
|
56
|
+
/** The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. */
|
|
57
|
+
className?: string,
|
|
58
|
+
/** The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the element. */
|
|
59
|
+
style?: CSSProperties
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface DOMProps extends StyleProps, SharedDOMProps {
|
|
63
|
+
/** The children of the component. */
|
|
64
|
+
children?: ReactNode
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type ClassNameOrFunction<T> = string | ((values: T & {defaultClassName: string | undefined}) => string);
|
|
68
|
+
type StyleOrFunction<T> = CSSProperties | ((values: T & {defaultStyle: CSSProperties}) => CSSProperties | undefined);
|
|
69
|
+
|
|
70
|
+
export interface StyleRenderProps<T, E extends keyof React.JSX.IntrinsicElements = 'div'> extends DOMRenderProps<E, T> {
|
|
71
|
+
/** 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. */
|
|
72
|
+
className?: ClassNameOrFunction<T>,
|
|
73
|
+
/** The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the element. A function may be provided to compute the style based on component state. */
|
|
74
|
+
style?: StyleOrFunction<T>
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type ChildrenOrFunction<T> = ReactNode | ((values: T & {defaultChildren: ReactNode | undefined}) => ReactNode);
|
|
78
|
+
|
|
79
|
+
export interface RenderProps<T, E extends keyof React.JSX.IntrinsicElements = 'div'> extends StyleRenderProps<T, E> {
|
|
80
|
+
/** The children of the component. A function may be provided to alter the children based on component state. */
|
|
81
|
+
children?: ChildrenOrFunction<T>
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface RenderPropsHookOptions<T, E extends keyof React.JSX.IntrinsicElements> extends RenderProps<T, E>, SharedDOMProps, AriaLabelingProps {
|
|
85
|
+
values: T,
|
|
86
|
+
defaultChildren?: ReactNode,
|
|
87
|
+
defaultClassName?: string,
|
|
88
|
+
defaultStyle?: CSSProperties
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface RenderPropsHookRetVal<T, E extends keyof React.JSX.IntrinsicElements> {
|
|
92
|
+
className?: string,
|
|
93
|
+
style?: CSSProperties,
|
|
94
|
+
children?: ReactNode,
|
|
95
|
+
'data-rac': string,
|
|
96
|
+
render?: DOMRenderFunction<E, T>
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function useRenderProps<T, E extends keyof React.JSX.IntrinsicElements>(props: RenderPropsHookOptions<T, E>): RenderPropsHookRetVal<T, E> {
|
|
100
|
+
let {
|
|
101
|
+
className,
|
|
102
|
+
style,
|
|
103
|
+
children,
|
|
104
|
+
defaultClassName = undefined,
|
|
105
|
+
defaultChildren = undefined,
|
|
106
|
+
defaultStyle,
|
|
107
|
+
values,
|
|
108
|
+
render
|
|
109
|
+
} = props;
|
|
110
|
+
|
|
111
|
+
return useMemo(() => {
|
|
112
|
+
let computedClassName: string | undefined;
|
|
113
|
+
let computedStyle: React.CSSProperties | undefined;
|
|
114
|
+
let computedChildren: React.ReactNode | undefined;
|
|
115
|
+
|
|
116
|
+
if (typeof className === 'function') {
|
|
117
|
+
computedClassName = className({...values, defaultClassName});
|
|
118
|
+
} else {
|
|
119
|
+
computedClassName = className;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (typeof style === 'function') {
|
|
123
|
+
computedStyle = style({...values, defaultStyle: defaultStyle || {}});
|
|
124
|
+
} else {
|
|
125
|
+
computedStyle = style;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (typeof children === 'function') {
|
|
129
|
+
computedChildren = children({...values, defaultChildren});
|
|
130
|
+
} else if (children == null) {
|
|
131
|
+
computedChildren = defaultChildren;
|
|
132
|
+
} else {
|
|
133
|
+
computedChildren = children;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
className: computedClassName ?? defaultClassName,
|
|
138
|
+
style: (computedStyle || defaultStyle) ? {...defaultStyle, ...computedStyle} : undefined,
|
|
139
|
+
children: computedChildren ?? defaultChildren,
|
|
140
|
+
'data-rac': '',
|
|
141
|
+
render: render ? (props => render(props, values)) : undefined
|
|
142
|
+
};
|
|
143
|
+
}, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values, render]);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* A helper function that accepts a user-provided render prop value (either a static value or a function),
|
|
148
|
+
* and combines it with another value to create a final result.
|
|
149
|
+
*/
|
|
150
|
+
export function composeRenderProps<T, U, V extends T>(
|
|
151
|
+
// https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage
|
|
152
|
+
value: T extends any ? (T | ((renderProps: U) => V)) : never,
|
|
153
|
+
wrap: (prevValue: T, renderProps: U) => V
|
|
154
|
+
): (renderProps: U) => V {
|
|
155
|
+
return (renderProps) => wrap(typeof value === 'function' ? value(renderProps) : value, renderProps);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export type WithRef<T, E> = T & {ref?: ForwardedRef<E>};
|
|
159
|
+
export interface SlotProps {
|
|
160
|
+
/**
|
|
161
|
+
* A slot name for the component. Slots allow the component to receive props from a parent component.
|
|
162
|
+
* An explicit `null` value indicates that the local props completely override all props received from a parent.
|
|
163
|
+
*/
|
|
164
|
+
slot?: string | null
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function useSlottedContext<T>(context: Context<SlottedContextValue<T>>, slot?: string | null): T | null | undefined {
|
|
168
|
+
let ctx = useContext(context);
|
|
169
|
+
if (slot === null) {
|
|
170
|
+
// An explicit `null` slot means don't use context.
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
if (ctx && typeof ctx === 'object' && 'slots' in ctx && ctx.slots) {
|
|
174
|
+
let slotKey = slot || DEFAULT_SLOT;
|
|
175
|
+
if (!ctx.slots[slotKey]) {
|
|
176
|
+
let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map(p => `"${p}"`));
|
|
177
|
+
let errorMessage = slot ? `Invalid slot "${slot}".` : 'A slot prop is required.';
|
|
178
|
+
|
|
179
|
+
throw new Error(`${errorMessage} Valid slot names are ${availableSlots}.`);
|
|
180
|
+
}
|
|
181
|
+
return ctx.slots[slotKey];
|
|
182
|
+
}
|
|
183
|
+
// @ts-ignore
|
|
184
|
+
return ctx;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function useContextProps<T, U extends SlotProps, E extends Element>(props: T & SlotProps, ref: ForwardedRef<E> | undefined, context: Context<ContextValue<U, E>>): [T, RefObject<E | null>] {
|
|
188
|
+
let ctx = useSlottedContext(context, props.slot) || {};
|
|
189
|
+
let {ref: contextRef, ...contextProps} = ctx as any;
|
|
190
|
+
let mergedRef = useObjectRef(useMemo(() => mergeRefs(ref, contextRef), [ref, contextRef]));
|
|
191
|
+
let mergedProps = mergeProps(contextProps, props) as unknown as T;
|
|
192
|
+
|
|
193
|
+
// mergeProps does not merge `style`. Adding this there might be a breaking change.
|
|
194
|
+
if (
|
|
195
|
+
'style' in contextProps &&
|
|
196
|
+
contextProps.style &&
|
|
197
|
+
'style' in props &&
|
|
198
|
+
props.style
|
|
199
|
+
) {
|
|
200
|
+
if (typeof contextProps.style === 'function' || typeof props.style === 'function') {
|
|
201
|
+
// @ts-ignore
|
|
202
|
+
mergedProps.style = (renderProps) => {
|
|
203
|
+
let contextStyle = typeof contextProps.style === 'function' ? contextProps.style(renderProps) : contextProps.style;
|
|
204
|
+
let defaultStyle = {...renderProps.defaultStyle, ...contextStyle};
|
|
205
|
+
let style = typeof props.style === 'function'
|
|
206
|
+
? props.style({...renderProps, defaultStyle})
|
|
207
|
+
: props.style;
|
|
208
|
+
return {...defaultStyle, ...style};
|
|
209
|
+
};
|
|
210
|
+
} else {
|
|
211
|
+
// @ts-ignore
|
|
212
|
+
mergedProps.style = {...contextProps.style, ...props.style};
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return [mergedProps, mergedRef];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export function useSlot(initialState: boolean | (() => boolean) = true): [RefCallback<Element>, boolean] {
|
|
220
|
+
// Initial state is typically based on the parent having an aria-label or aria-labelledby.
|
|
221
|
+
// If it does, this value should be false so that we don't update the state and cause a rerender when we go through the layoutEffect
|
|
222
|
+
let [hasSlot, setHasSlot] = useState(initialState);
|
|
223
|
+
let hasRun = useRef(false);
|
|
224
|
+
|
|
225
|
+
// A callback ref which will run when the slotted element mounts.
|
|
226
|
+
// This should happen before the useLayoutEffect below.
|
|
227
|
+
let ref = useCallback(el => {
|
|
228
|
+
hasRun.current = true;
|
|
229
|
+
setHasSlot(!!el);
|
|
230
|
+
}, []);
|
|
231
|
+
|
|
232
|
+
// If the callback hasn't been called, then reset to false.
|
|
233
|
+
useLayoutEffect(() => {
|
|
234
|
+
if (!hasRun.current) {
|
|
235
|
+
setHasSlot(false);
|
|
236
|
+
}
|
|
237
|
+
}, []);
|
|
238
|
+
|
|
239
|
+
return [ref, hasSlot];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Filters out `data-*` attributes to keep them from being passed down and duplicated.
|
|
244
|
+
* @param props
|
|
245
|
+
*/
|
|
246
|
+
export function removeDataAttributes<T>(props: T): T {
|
|
247
|
+
const prefix = /^(data-.*)$/;
|
|
248
|
+
let filteredProps = {} as T;
|
|
249
|
+
|
|
250
|
+
for (const prop in props) {
|
|
251
|
+
if (!prefix.test(prop)) {
|
|
252
|
+
filteredProps[prop] = props[prop];
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return filteredProps;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Override base type to change the default.
|
|
260
|
+
export interface RACValidation {
|
|
261
|
+
/**
|
|
262
|
+
* Whether to use native HTML form validation to prevent form submission
|
|
263
|
+
* when the value is missing or invalid, or mark the field as required
|
|
264
|
+
* or invalid via ARIA.
|
|
265
|
+
* @default 'native'
|
|
266
|
+
*/
|
|
267
|
+
validationBehavior?: 'native' | 'aria'
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export type DOMRenderFunction<E extends keyof React.JSX.IntrinsicElements, T> = (props: React.JSX.IntrinsicElements[E], renderProps: T) => ReactElement;
|
|
271
|
+
export interface DOMRenderProps<E extends keyof React.JSX.IntrinsicElements, T> {
|
|
272
|
+
/**
|
|
273
|
+
* Overrides the default DOM element with a custom render function.
|
|
274
|
+
* This allows rendering existing components with built-in styles and behaviors
|
|
275
|
+
* such as router links, animation libraries, and pre-styled components.
|
|
276
|
+
*
|
|
277
|
+
* Requirements:
|
|
278
|
+
*
|
|
279
|
+
* * You must render the expected element type (e.g. if `<button>` is expected, you cannot render an `<a>`).
|
|
280
|
+
* * Only a single root DOM element can be rendered (no fragments).
|
|
281
|
+
* * You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
|
|
282
|
+
*/
|
|
283
|
+
render?: DOMRenderFunction<E, T>
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Makes `href` required in AnchorHTMLAttributes
|
|
287
|
+
type LinkWithRequiredHref = Required<Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>> & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;
|
|
288
|
+
|
|
289
|
+
// Same as DOMRenderProps but specific for the case where the element could be a 'a' or 'div' element.
|
|
290
|
+
export interface PossibleLinkDOMRenderProps<Fallback extends keyof React.JSX.IntrinsicElements, T> {
|
|
291
|
+
/**
|
|
292
|
+
* Overrides the default DOM element with a custom render function.
|
|
293
|
+
* This allows rendering existing components with built-in styles and behaviors
|
|
294
|
+
* such as router links, animation libraries, and pre-styled components.
|
|
295
|
+
*
|
|
296
|
+
* Note: You can check if `'href' in props` in order to tell whether to render an `<a>` element.
|
|
297
|
+
*
|
|
298
|
+
* Requirements:
|
|
299
|
+
*
|
|
300
|
+
* * You must render the expected element type (e.g. if `<a>` is expected, you cannot render a `<button>`).
|
|
301
|
+
* * Only a single root DOM element can be rendered (no fragments).
|
|
302
|
+
* * You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
|
|
303
|
+
*/
|
|
304
|
+
render?: (props: DetailedHTMLProps<LinkWithRequiredHref, HTMLAnchorElement> | React.JSX.IntrinsicElements[Fallback], renderProps: T) => ReactElement
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function DOMElement(ElementType: string, props: DOMRenderProps<any, any> & AllHTMLAttributes<HTMLElement>, forwardedRef: ForwardedRef<HTMLElement>) {
|
|
308
|
+
let {render, ...otherProps} = props;
|
|
309
|
+
let elementRef = useRef<HTMLElement | null>(null);
|
|
310
|
+
let ref = useMemo(() => mergeRefs(forwardedRef, elementRef), [forwardedRef, elementRef]);
|
|
311
|
+
|
|
312
|
+
useLayoutEffect(() => {
|
|
313
|
+
if (process.env.NODE_ENV !== 'production' && render) {
|
|
314
|
+
if (!elementRef.current) {
|
|
315
|
+
console.warn('Ref was not connected to DOM element returned by custom `render` function. Did you forget to pass through or merge the `ref`?');
|
|
316
|
+
} else if (elementRef.current.localName !== ElementType) {
|
|
317
|
+
console.warn(`Unexpected DOM element returned by custom \`render\` function. Expected <${ElementType}>, got <${elementRef.current.localName}>. This may break the component behavior and accessibility.`);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}, [ElementType, render]);
|
|
321
|
+
|
|
322
|
+
let domProps: any = {...otherProps, ref};
|
|
323
|
+
if (render) {
|
|
324
|
+
return render(domProps, undefined);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return <ElementType {...domProps} />;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
type DOMComponents = {
|
|
331
|
+
[E in keyof React.JSX.IntrinsicElements]: (props: DOMRenderProps<E, any> & React.JSX.IntrinsicElements[E]) => ReactElement
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
const domComponentCache = {};
|
|
335
|
+
|
|
336
|
+
// Dynamically generates and caches components for each DOM element (e.g. `dom.button`).
|
|
337
|
+
export const dom = new Proxy({}, {
|
|
338
|
+
get(target, elementType) {
|
|
339
|
+
if (typeof elementType !== 'string') {
|
|
340
|
+
return undefined;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
let res = domComponentCache[elementType];
|
|
344
|
+
if (!res) {
|
|
345
|
+
res = forwardRef(DOMElement.bind(null, elementType));
|
|
346
|
+
domComponentCache[elementType] = res;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return res;
|
|
350
|
+
}
|
|
351
|
+
}) as DOMComponents;
|