@adobe/react-spectrum 3.47.2 → 3.47.3
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/private/actionbar/ActionBar.cjs +2 -3
- package/dist/private/actionbar/ActionBar.cjs.map +1 -1
- package/dist/private/actionbar/ActionBar.js +2 -3
- package/dist/private/actionbar/ActionBar.js.map +1 -1
- package/dist/private/actionbar/ActionBar.mjs +2 -3
- package/dist/private/actionbar/ActionBar.mjs.map +1 -1
- package/dist/private/actiongroup/ActionGroup.cjs +5 -1
- package/dist/private/actiongroup/ActionGroup.cjs.map +1 -1
- package/dist/private/actiongroup/ActionGroup.js +5 -1
- package/dist/private/actiongroup/ActionGroup.js.map +1 -1
- package/dist/private/actiongroup/ActionGroup.mjs +5 -1
- package/dist/private/actiongroup/ActionGroup.mjs.map +1 -1
- package/dist/private/autocomplete/MobileSearchAutocomplete.cjs +6 -0
- package/dist/private/autocomplete/MobileSearchAutocomplete.cjs.map +1 -1
- package/dist/private/autocomplete/MobileSearchAutocomplete.js +6 -0
- package/dist/private/autocomplete/MobileSearchAutocomplete.js.map +1 -1
- package/dist/private/autocomplete/MobileSearchAutocomplete.mjs +6 -0
- package/dist/private/autocomplete/MobileSearchAutocomplete.mjs.map +1 -1
- package/dist/private/autocomplete/SearchAutocomplete.cjs +1 -0
- package/dist/private/autocomplete/SearchAutocomplete.cjs.map +1 -1
- package/dist/private/autocomplete/SearchAutocomplete.js +1 -0
- package/dist/private/autocomplete/SearchAutocomplete.js.map +1 -1
- package/dist/private/autocomplete/SearchAutocomplete.mjs +1 -0
- package/dist/private/autocomplete/SearchAutocomplete.mjs.map +1 -1
- package/dist/private/button/Button.cjs +2 -1
- package/dist/private/button/Button.cjs.map +1 -1
- package/dist/private/button/Button.js +3 -2
- package/dist/private/button/Button.js.map +1 -1
- package/dist/private/button/Button.mjs +3 -2
- package/dist/private/button/Button.mjs.map +1 -1
- package/dist/private/button/ClearButton.cjs +2 -1
- package/dist/private/button/ClearButton.cjs.map +1 -1
- package/dist/private/button/ClearButton.js +2 -1
- package/dist/private/button/ClearButton.js.map +1 -1
- package/dist/private/button/ClearButton.mjs +2 -1
- package/dist/private/button/ClearButton.mjs.map +1 -1
- package/dist/private/buttongroup/ButtonGroup.cjs +4 -2
- package/dist/private/buttongroup/ButtonGroup.cjs.map +1 -1
- package/dist/private/buttongroup/ButtonGroup.js +4 -2
- package/dist/private/buttongroup/ButtonGroup.js.map +1 -1
- package/dist/private/buttongroup/ButtonGroup.mjs +4 -2
- package/dist/private/buttongroup/ButtonGroup.mjs.map +1 -1
- package/dist/private/card/CardBase.cjs +1 -0
- package/dist/private/card/CardBase.cjs.map +1 -1
- package/dist/private/card/CardBase.js +1 -0
- package/dist/private/card/CardBase.js.map +1 -1
- package/dist/private/card/CardBase.mjs +1 -0
- package/dist/private/card/CardBase.mjs.map +1 -1
- package/dist/private/card/CardView.cjs +3 -0
- package/dist/private/card/CardView.cjs.map +1 -1
- package/dist/private/card/CardView.js +3 -0
- package/dist/private/card/CardView.js.map +1 -1
- package/dist/private/card/CardView.mjs +3 -0
- package/dist/private/card/CardView.mjs.map +1 -1
- package/dist/private/checkbox/Checkbox.cjs.map +1 -1
- package/dist/private/checkbox/Checkbox.js.map +1 -1
- package/dist/private/checkbox/Checkbox.mjs.map +1 -1
- package/dist/private/color/ColorField.cjs +1 -0
- package/dist/private/color/ColorField.cjs.map +1 -1
- package/dist/private/color/ColorField.js +1 -0
- package/dist/private/color/ColorField.js.map +1 -1
- package/dist/private/color/ColorField.mjs +1 -0
- package/dist/private/color/ColorField.mjs.map +1 -1
- package/dist/private/color/ColorPicker.cjs.map +1 -1
- package/dist/private/color/ColorPicker.js.map +1 -1
- package/dist/private/color/ColorPicker.mjs.map +1 -1
- package/dist/private/color/ColorSwatch.cjs +2 -1
- package/dist/private/color/ColorSwatch.cjs.map +1 -1
- package/dist/private/color/ColorSwatch.js +2 -1
- package/dist/private/color/ColorSwatch.js.map +1 -1
- package/dist/private/color/ColorSwatch.mjs +2 -1
- package/dist/private/color/ColorSwatch.mjs.map +1 -1
- package/dist/private/color/ColorSwatchPicker.cjs.map +1 -1
- package/dist/private/color/ColorSwatchPicker.js.map +1 -1
- package/dist/private/color/ColorSwatchPicker.mjs.map +1 -1
- package/dist/private/color/ColorWheel.cjs +1 -0
- package/dist/private/color/ColorWheel.cjs.map +1 -1
- package/dist/private/color/ColorWheel.js +1 -0
- package/dist/private/color/ColorWheel.js.map +1 -1
- package/dist/private/color/ColorWheel.mjs +1 -0
- package/dist/private/color/ColorWheel.mjs.map +1 -1
- package/dist/private/combobox/ComboBox.cjs +1 -0
- package/dist/private/combobox/ComboBox.cjs.map +1 -1
- package/dist/private/combobox/ComboBox.js +1 -0
- package/dist/private/combobox/ComboBox.js.map +1 -1
- package/dist/private/combobox/ComboBox.mjs +1 -0
- package/dist/private/combobox/ComboBox.mjs.map +1 -1
- package/dist/private/combobox/MobileComboBox.cjs +8 -0
- package/dist/private/combobox/MobileComboBox.cjs.map +1 -1
- package/dist/private/combobox/MobileComboBox.js +8 -0
- package/dist/private/combobox/MobileComboBox.js.map +1 -1
- package/dist/private/combobox/MobileComboBox.mjs +8 -0
- package/dist/private/combobox/MobileComboBox.mjs.map +1 -1
- package/dist/private/datepicker/DateField.cjs +2 -1
- package/dist/private/datepicker/DateField.cjs.map +1 -1
- package/dist/private/datepicker/DateField.js +2 -1
- package/dist/private/datepicker/DateField.js.map +1 -1
- package/dist/private/datepicker/DateField.mjs +2 -1
- package/dist/private/datepicker/DateField.mjs.map +1 -1
- package/dist/private/datepicker/DatePicker.cjs +2 -1
- package/dist/private/datepicker/DatePicker.cjs.map +1 -1
- package/dist/private/datepicker/DatePicker.js +2 -1
- package/dist/private/datepicker/DatePicker.js.map +1 -1
- package/dist/private/datepicker/DatePicker.mjs +2 -1
- package/dist/private/datepicker/DatePicker.mjs.map +1 -1
- package/dist/private/datepicker/DateRangePicker.cjs +2 -1
- package/dist/private/datepicker/DateRangePicker.cjs.map +1 -1
- package/dist/private/datepicker/DateRangePicker.js +2 -1
- package/dist/private/datepicker/DateRangePicker.js.map +1 -1
- package/dist/private/datepicker/DateRangePicker.mjs +2 -1
- package/dist/private/datepicker/DateRangePicker.mjs.map +1 -1
- package/dist/private/dialog/AlertDialog.cjs +3 -1
- package/dist/private/dialog/AlertDialog.cjs.map +1 -1
- package/dist/private/dialog/AlertDialog.js +3 -1
- package/dist/private/dialog/AlertDialog.js.map +1 -1
- package/dist/private/dialog/AlertDialog.mjs +3 -1
- package/dist/private/dialog/AlertDialog.mjs.map +1 -1
- package/dist/private/dialog/Dialog.cjs +10 -3
- package/dist/private/dialog/Dialog.cjs.map +1 -1
- package/dist/private/dialog/Dialog.js +10 -3
- package/dist/private/dialog/Dialog.js.map +1 -1
- package/dist/private/dialog/Dialog.mjs +10 -3
- package/dist/private/dialog/Dialog.mjs.map +1 -1
- package/dist/private/dnd/useDragAndDrop.cjs +7 -0
- package/dist/private/dnd/useDragAndDrop.cjs.map +1 -1
- package/dist/private/dnd/useDragAndDrop.js +7 -0
- package/dist/private/dnd/useDragAndDrop.js.map +1 -1
- package/dist/private/dnd/useDragAndDrop.mjs +7 -0
- package/dist/private/dnd/useDragAndDrop.mjs.map +1 -1
- package/dist/private/icon/Icon.cjs +1 -1
- package/dist/private/icon/Icon.cjs.map +1 -1
- package/dist/private/icon/Icon.js +1 -1
- package/dist/private/icon/Icon.js.map +1 -1
- package/dist/private/icon/Icon.mjs +1 -1
- package/dist/private/icon/Icon.mjs.map +1 -1
- package/dist/private/icon/UIIcon.cjs +1 -1
- package/dist/private/icon/UIIcon.cjs.map +1 -1
- package/dist/private/icon/UIIcon.js +1 -1
- package/dist/private/icon/UIIcon.js.map +1 -1
- package/dist/private/icon/UIIcon.mjs +1 -1
- package/dist/private/icon/UIIcon.mjs.map +1 -1
- package/dist/private/intl/label/zh-CN.cjs +1 -1
- package/dist/private/intl/label/zh-CN.cjs.map +1 -1
- package/dist/private/intl/label/zh-CN.js +1 -1
- package/dist/private/intl/label/zh-CN.js.map +1 -1
- package/dist/private/intl/label/zh-CN.mjs +1 -1
- package/dist/private/intl/label/zh-CN.mjs.map +1 -1
- package/dist/private/intl/menu/es-ES.cjs +1 -1
- package/dist/private/intl/menu/es-ES.cjs.map +1 -1
- package/dist/private/intl/menu/es-ES.js +1 -1
- package/dist/private/intl/menu/es-ES.js.map +1 -1
- package/dist/private/intl/menu/es-ES.mjs +1 -1
- package/dist/private/intl/menu/es-ES.mjs.map +1 -1
- package/dist/private/intl/picker/zh-CN.cjs +1 -1
- package/dist/private/intl/picker/zh-CN.cjs.map +1 -1
- package/dist/private/intl/picker/zh-CN.js +1 -1
- package/dist/private/intl/picker/zh-CN.js.map +1 -1
- package/dist/private/intl/picker/zh-CN.mjs +1 -1
- package/dist/private/intl/picker/zh-CN.mjs.map +1 -1
- package/dist/private/intl/table/es-ES.cjs +1 -1
- package/dist/private/intl/table/es-ES.cjs.map +1 -1
- package/dist/private/intl/table/es-ES.js +1 -1
- package/dist/private/intl/table/es-ES.js.map +1 -1
- package/dist/private/intl/table/es-ES.mjs +1 -1
- package/dist/private/intl/table/es-ES.mjs.map +1 -1
- package/dist/private/intl/table/zh-TW.cjs +2 -2
- package/dist/private/intl/table/zh-TW.cjs.map +1 -1
- package/dist/private/intl/table/zh-TW.js +2 -2
- package/dist/private/intl/table/zh-TW.js.map +1 -1
- package/dist/private/intl/table/zh-TW.mjs +2 -2
- package/dist/private/intl/table/zh-TW.mjs.map +1 -1
- package/dist/private/label/Field.cjs +2 -1
- package/dist/private/label/Field.cjs.map +1 -1
- package/dist/private/label/Field.js +2 -1
- package/dist/private/label/Field.js.map +1 -1
- package/dist/private/label/Field.mjs +2 -1
- package/dist/private/label/Field.mjs.map +1 -1
- package/dist/private/layout/Grid.cjs +2 -1
- package/dist/private/layout/Grid.cjs.map +1 -1
- package/dist/private/layout/Grid.js +2 -1
- package/dist/private/layout/Grid.js.map +1 -1
- package/dist/private/layout/Grid.mjs +2 -1
- package/dist/private/layout/Grid.mjs.map +1 -1
- package/dist/private/link/Link.cjs +3 -0
- package/dist/private/link/Link.cjs.map +1 -1
- package/dist/private/link/Link.js +3 -0
- package/dist/private/link/Link.js.map +1 -1
- package/dist/private/link/Link.mjs +3 -0
- package/dist/private/link/Link.mjs.map +1 -1
- package/dist/private/list/InsertionIndicator.cjs +1 -0
- package/dist/private/list/InsertionIndicator.cjs.map +1 -1
- package/dist/private/list/InsertionIndicator.js +1 -0
- package/dist/private/list/InsertionIndicator.js.map +1 -1
- package/dist/private/list/InsertionIndicator.mjs +1 -0
- package/dist/private/list/InsertionIndicator.mjs.map +1 -1
- package/dist/private/list/ListView.cjs +5 -0
- package/dist/private/list/ListView.cjs.map +1 -1
- package/dist/private/list/ListView.js +5 -0
- package/dist/private/list/ListView.js.map +1 -1
- package/dist/private/list/ListView.mjs +5 -0
- package/dist/private/list/ListView.mjs.map +1 -1
- package/dist/private/list/ListViewItem.cjs +2 -0
- package/dist/private/list/ListViewItem.cjs.map +1 -1
- package/dist/private/list/ListViewItem.js +2 -0
- package/dist/private/list/ListViewItem.js.map +1 -1
- package/dist/private/list/ListViewItem.mjs +2 -0
- package/dist/private/list/ListViewItem.mjs.map +1 -1
- package/dist/private/list/RootDropIndicator.cjs +1 -0
- package/dist/private/list/RootDropIndicator.cjs.map +1 -1
- package/dist/private/list/RootDropIndicator.js +1 -0
- package/dist/private/list/RootDropIndicator.js.map +1 -1
- package/dist/private/list/RootDropIndicator.mjs +1 -0
- package/dist/private/list/RootDropIndicator.mjs.map +1 -1
- package/dist/private/menu/ContextualHelpTrigger.cjs +7 -1
- package/dist/private/menu/ContextualHelpTrigger.cjs.map +1 -1
- package/dist/private/menu/ContextualHelpTrigger.js +7 -1
- package/dist/private/menu/ContextualHelpTrigger.js.map +1 -1
- package/dist/private/menu/ContextualHelpTrigger.mjs +7 -1
- package/dist/private/menu/ContextualHelpTrigger.mjs.map +1 -1
- package/dist/private/menu/MenuItem.cjs +2 -0
- package/dist/private/menu/MenuItem.cjs.map +1 -1
- package/dist/private/menu/MenuItem.js +2 -0
- package/dist/private/menu/MenuItem.js.map +1 -1
- package/dist/private/menu/MenuItem.mjs +2 -0
- package/dist/private/menu/MenuItem.mjs.map +1 -1
- package/dist/private/menu/MenuTrigger.cjs +1 -0
- package/dist/private/menu/MenuTrigger.cjs.map +1 -1
- package/dist/private/menu/MenuTrigger.js +1 -0
- package/dist/private/menu/MenuTrigger.js.map +1 -1
- package/dist/private/menu/MenuTrigger.mjs +1 -0
- package/dist/private/menu/MenuTrigger.mjs.map +1 -1
- package/dist/private/menu/SubmenuTrigger.cjs +6 -1
- package/dist/private/menu/SubmenuTrigger.cjs.map +1 -1
- package/dist/private/menu/SubmenuTrigger.js +6 -1
- package/dist/private/menu/SubmenuTrigger.js.map +1 -1
- package/dist/private/menu/SubmenuTrigger.mjs +6 -1
- package/dist/private/menu/SubmenuTrigger.mjs.map +1 -1
- package/dist/private/package.cjs +1 -1
- package/dist/private/package.cjs.map +1 -1
- package/dist/private/package.js +1 -1
- package/dist/private/package.js.map +1 -1
- package/dist/private/package.mjs +1 -1
- package/dist/private/package.mjs.map +1 -1
- package/dist/private/progress/ProgressBarBase.cjs +2 -1
- package/dist/private/progress/ProgressBarBase.cjs.map +1 -1
- package/dist/private/progress/ProgressBarBase.js +2 -1
- package/dist/private/progress/ProgressBarBase.js.map +1 -1
- package/dist/private/progress/ProgressBarBase.mjs +2 -1
- package/dist/private/progress/ProgressBarBase.mjs.map +1 -1
- package/dist/private/progress/ProgressCircle.cjs +2 -1
- package/dist/private/progress/ProgressCircle.cjs.map +1 -1
- package/dist/private/progress/ProgressCircle.js +2 -1
- package/dist/private/progress/ProgressCircle.js.map +1 -1
- package/dist/private/progress/ProgressCircle.mjs +2 -1
- package/dist/private/progress/ProgressCircle.mjs.map +1 -1
- package/dist/private/slider/Slider.cjs +1 -0
- package/dist/private/slider/Slider.cjs.map +1 -1
- package/dist/private/slider/Slider.js +1 -0
- package/dist/private/slider/Slider.js.map +1 -1
- package/dist/private/slider/Slider.mjs +1 -0
- package/dist/private/slider/Slider.mjs.map +1 -1
- package/dist/private/table/InsertionIndicator.cjs +1 -0
- package/dist/private/table/InsertionIndicator.cjs.map +1 -1
- package/dist/private/table/InsertionIndicator.js +1 -0
- package/dist/private/table/InsertionIndicator.js.map +1 -1
- package/dist/private/table/InsertionIndicator.mjs +1 -0
- package/dist/private/table/InsertionIndicator.mjs.map +1 -1
- package/dist/private/table/Resizer.cjs +2 -25
- package/dist/private/table/Resizer.cjs.map +1 -1
- package/dist/private/table/Resizer.js +3 -26
- package/dist/private/table/Resizer.js.map +1 -1
- package/dist/private/table/Resizer.mjs +3 -26
- package/dist/private/table/Resizer.mjs.map +1 -1
- package/dist/private/table/RootDropIndicator.cjs +1 -0
- package/dist/private/table/RootDropIndicator.cjs.map +1 -1
- package/dist/private/table/RootDropIndicator.js +1 -0
- package/dist/private/table/RootDropIndicator.js.map +1 -1
- package/dist/private/table/RootDropIndicator.mjs +1 -0
- package/dist/private/table/RootDropIndicator.mjs.map +1 -1
- package/dist/private/table/TableViewBase.cjs +8 -0
- package/dist/private/table/TableViewBase.cjs.map +1 -1
- package/dist/private/table/TableViewBase.js +8 -0
- package/dist/private/table/TableViewBase.js.map +1 -1
- package/dist/private/table/TableViewBase.mjs +8 -0
- package/dist/private/table/TableViewBase.mjs.map +1 -1
- package/dist/private/table/TreeGridTableView.cjs +1 -0
- package/dist/private/table/TreeGridTableView.cjs.map +1 -1
- package/dist/private/table/TreeGridTableView.js +1 -0
- package/dist/private/table/TreeGridTableView.js.map +1 -1
- package/dist/private/table/TreeGridTableView.mjs +1 -0
- package/dist/private/table/TreeGridTableView.mjs.map +1 -1
- package/dist/private/tabs/Tabs.cjs +4 -2
- package/dist/private/tabs/Tabs.cjs.map +1 -1
- package/dist/private/tabs/Tabs.js +4 -2
- package/dist/private/tabs/Tabs.js.map +1 -1
- package/dist/private/tabs/Tabs.mjs +4 -2
- package/dist/private/tabs/Tabs.mjs.map +1 -1
- package/dist/private/tag/TagGroup.cjs +2 -0
- package/dist/private/tag/TagGroup.cjs.map +1 -1
- package/dist/private/tag/TagGroup.js +2 -0
- package/dist/private/tag/TagGroup.js.map +1 -1
- package/dist/private/tag/TagGroup.mjs +2 -0
- package/dist/private/tag/TagGroup.mjs.map +1 -1
- package/dist/private/textfield/TextArea.cjs +2 -0
- package/dist/private/textfield/TextArea.cjs.map +1 -1
- package/dist/private/textfield/TextArea.js +2 -0
- package/dist/private/textfield/TextArea.js.map +1 -1
- package/dist/private/textfield/TextArea.mjs +2 -0
- package/dist/private/textfield/TextArea.mjs.map +1 -1
- package/dist/private/textfield/TextField.cjs +1 -0
- package/dist/private/textfield/TextField.cjs.map +1 -1
- package/dist/private/textfield/TextField.js +1 -0
- package/dist/private/textfield/TextField.js.map +1 -1
- package/dist/private/textfield/TextField.mjs +1 -0
- package/dist/private/textfield/TextField.mjs.map +1 -1
- package/dist/private/textfield/TextFieldBase.cjs +2 -1
- package/dist/private/textfield/TextFieldBase.cjs.map +1 -1
- package/dist/private/textfield/TextFieldBase.js +2 -1
- package/dist/private/textfield/TextFieldBase.js.map +1 -1
- package/dist/private/textfield/TextFieldBase.mjs +2 -1
- package/dist/private/textfield/TextFieldBase.mjs.map +1 -1
- package/dist/private/utils/Slots.cjs +1 -0
- package/dist/private/utils/Slots.cjs.map +1 -1
- package/dist/private/utils/Slots.js +1 -0
- package/dist/private/utils/Slots.js.map +1 -1
- package/dist/private/utils/Slots.mjs +1 -0
- package/dist/private/utils/Slots.mjs.map +1 -1
- package/dist/types/src/dialog/AlertDialog.d.ts +2 -2
- 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 +1 -1
- package/i18n/index.mjs +1 -1
- 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 +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;AA6CD,SAAS,0CAAoB,KAAK;IAChC,kDAAkD;IAClD,IAAI,MAAM,SAAS,EAAE;QACnB,MAAM,OAAO,GAAG;QAChB,MAAM,YAAY,GAAG;QACrB,MAAM,UAAU,GAAG;QACnB,MAAM,aAAa,GAAG;QACtB,MAAM,SAAS,GAAG;QAClB,MAAM,SAAS,GAAG;QAClB,MAAM,OAAO,GAAG;QAChB,MAAM,OAAO,GAAG;QAChB,MAAM,IAAI,GAAG;IACf;IACA,OAAO;AACT;AAOO,MAAM,0DAAS,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,OAC9C,KAA6B,EAC7B,GAA8B;IAE9B,QAAQ,CAAA,GAAA,0CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,sCAAW,EAAE,OAAO;IAC5B,QAAQ,0CAAoB;IAC5B,IAAI,EACF,aAAa,UAAU,QAAQ,YAC/B,QAAQ,WACR,OAAO,SACP,QAAQ,YAAY,YAAY,YAAY,QAAQ,SAAS,wBAC7D,WAAW,cACX,UAAU,aACV,SAAS,aACT,SAAS,EACT,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,mCAAQ,EAAE,OAAO;IAChD,I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AA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YACvC;YACA,MAAM;gBACJ,IAAI;gBACJ,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YACvC;QACF;OACC,OAAO,aAAa,yBAAW,0DAAC,CAAA,GAAA,8BAAG,SAAG,YAAmB,UACzD,2BACC,0DAAC;QACC,eAAY;QACZ,OAAO;YAAC,YAAY,oBAAoB,YAAY;QAAQ;QAC5D,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;qBAC9B,0DAAC,CAAA,GAAA,wCAAa;QACZ,cAAY;QACZ,iBAAA;QACA,MAAK;QACL,aAAa;SAIlB,2BACC,oIACE,0DAAC;QAAI,aAAW,YAAY,WAAW;OACpC,mCACC,0DAAC;QAAI,MAAK;QAAM,mBAAiB;uBAOrC,0DAAC;QAAI,IAAI;QAAW,MAAK;QAAM,cAAY;;AAOzD","sources":["packages/@adobe/react-spectrum/src/button/Button.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps, useButton} from 'react-aria/useButton';\nimport {classNames} from '../utils/classNames';\nimport {FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport intlMessages from '../../intl/button/*.json';\nimport {isAppleDevice, isFirefox} from 'react-aria/private/utils/platform';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {ElementType, ReactElement, useEffect, useState} from 'react';\nimport {SlotProvider, useSlotProps} from '../utils/Slots';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {Text} from '../text/Text';\nimport {useFocus} from 'react-aria/useFocus';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useHasChild} from '../utils/useHasChild';\nimport {useHover} from 'react-aria/useHover';\nimport {useId} from 'react-aria/useId';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProviderProps} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\n\n/** @deprecated */\ntype LegacyButtonVariant = 'cta' | 'overBackground';\nexport interface SpectrumButtonProps<T extends ElementType = 'button'>\n extends Omit<AriaButtonProps<T>, 'onClick'>, StyleProps {\n /** The [visual style](https://spectrum.adobe.com/page/button/#Options) of the button. */\n variant: 'accent' | 'primary' | 'secondary' | 'negative' | LegacyButtonVariant;\n /** The background style of the button. */\n style?: 'fill' | 'outline';\n /** The static color style to apply. Useful when the button appears over a color background. */\n staticColor?: 'white' | 'black';\n /**\n * Whether to disable events immediately and display a loading spinner after a 1 second delay.\n */\n isPending?: boolean;\n /**\n * Whether the button should be displayed with a quiet style.\n *\n * @deprecated\n */\n isQuiet?: boolean;\n}\n\nfunction disablePendingProps(props) {\n // Don't allow interaction while isPending is true\n if (props.isPending) {\n props.onPress = undefined;\n props.onPressStart = undefined;\n props.onPressEnd = undefined;\n props.onPressChange = undefined;\n props.onPressUp = undefined;\n props.onKeyDown = undefined;\n props.onKeyUp = undefined;\n props.onClick = undefined;\n props.href = undefined;\n }\n return props;\n}\n\n/**\n * Buttons allow users to perform an action or to navigate to another page.\n * They have multiple styles for various needs, and are ideal for calling attention to\n * where a user needs to do something in order to move forward in a flow.\n */\nexport const Button = React.forwardRef(function Button<T extends ElementType = 'button'>(\n props: SpectrumButtonProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\n props = useProviderProps(props);\n props = useSlotProps(props, 'button');\n props = disablePendingProps(props);\n let {\n elementType: Element = 'button',\n children,\n variant,\n style = variant === 'accent' || variant === 'cta' ? 'fill' : 'outline',\n staticColor,\n isDisabled,\n isPending,\n autoFocus,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref);\n let {buttonProps, isPressed} = useButton(props, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let [isFocused, onFocusChange] = useState(false);\n let {focusProps} = useFocus({onFocusChange, isDisabled});\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/button');\n let {styleProps} = useStyleProps(otherProps);\n let hasLabel = useHasChild(`.${styles['spectrum-Button-label']}`, domRef);\n let hasIcon = useHasChild(`.${styles['spectrum-Icon']}`, domRef);\n // an aria label will block children and their labels from being read, this is undesirable for pending state\n let hasAriaLabel = !!buttonProps['aria-label'] || !!buttonProps['aria-labelledby'];\n let [isProgressVisible, setIsProgressVisible] = useState(false);\n let backupButtonId = useId();\n let buttonId = buttonProps.id || backupButtonId;\n let iconId = useId();\n let textId = useId();\n let spinnerId = useId();\n\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n\n if (isPending) {\n // Start timer when isPending is set to true.\n timeout = setTimeout(() => {\n setIsProgressVisible(true);\n }, 1000);\n } else {\n // Exit loading state when isPending is set to false. */\n setIsProgressVisible(false);\n }\n return () => {\n // Clean up on unmount or when user removes isPending prop before entering loading state.\n clearTimeout(timeout);\n };\n }, [isPending]);\n\n if (variant === 'cta') {\n variant = 'accent';\n } else if (variant === 'overBackground') {\n variant = 'primary';\n staticColor = 'white';\n }\n\n const isPendingAriaLiveLabel =\n `${hasAriaLabel ? buttonProps['aria-label'] : ''} ${stringFormatter.format('pending')}`.trim();\n const isPendingAriaLiveLabelledby = hasAriaLabel\n ? (buttonProps['aria-labelledby']?.replace(buttonId, spinnerId) ?? spinnerId)\n : `${hasIcon ? iconId : ''} ${hasLabel ? textId : ''} ${spinnerId}`.trim();\n\n let ariaLive: 'off' | 'polite' | 'assertive' = 'polite';\n if (isAppleDevice() && (!hasAriaLabel || isFirefox())) {\n ariaLive = 'off';\n }\n\n let isPendingProps = isPending\n ? {\n onClick: e => {\n if (e.currentTarget instanceof HTMLButtonElement) {\n e.preventDefault();\n }\n }\n }\n : {\n // no-op.\n // Not sure why, but TypeScript wouldn't allow to have an empty object `{}`.\n onClick: () => {}\n };\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <Element\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps, focusProps, isPendingProps)}\n id={buttonId}\n ref={domRef}\n data-variant={variant}\n data-style={style}\n data-static-color={staticColor || undefined}\n aria-disabled={isPending ? 'true' : undefined}\n aria-label={isPending ? isPendingAriaLiveLabel : buttonProps['aria-label']}\n aria-labelledby={isPending ? isPendingAriaLiveLabelledby : buttonProps['aria-labelledby']}\n className={classNames(\n styles,\n 'spectrum-Button',\n {\n 'spectrum-Button--iconOnly': hasIcon && !hasLabel,\n 'is-disabled': isDisabled || isProgressVisible,\n 'is-active': isPressed,\n 'is-hovered': isHovered,\n 'spectrum-Button--pending': isProgressVisible\n },\n styleProps.className\n )}>\n <SlotProvider\n slots={{\n icon: {\n id: iconId,\n size: 'S',\n UNSAFE_className: classNames(styles, 'spectrum-Icon')\n },\n text: {\n id: textId,\n UNSAFE_className: classNames(styles, 'spectrum-Button-label')\n }\n }}>\n {typeof children === 'string' ? <Text>{children}</Text> : children}\n {isPending && (\n <div\n aria-hidden=\"true\"\n style={{visibility: isProgressVisible ? 'visible' : 'hidden'}}\n className={classNames(styles, 'spectrum-Button-circleLoader')}>\n <ProgressCircle\n aria-label={isPendingAriaLiveLabel}\n isIndeterminate\n size=\"S\"\n staticColor={staticColor}\n />\n </div>\n )}\n {isPending && (\n <>\n <div aria-live={isFocused ? ariaLive : 'off'}>\n {isProgressVisible && (\n <div role=\"img\" aria-labelledby={isPendingAriaLiveLabelledby} />\n )}\n </div>\n {/* Adding the element here with the same labels as the button itself causes aria-live to pick up the change in Safari.\n Safari with VO unfortunately doesn't announce changes to *all* of its labels specifically for button\n https://a11ysupport.io/tests/tech__html__button-name-change#assertion-aria-aria-label_attribute-convey_name_change-html-button_element-vo_macos-safari\n The aria-live may cause extra announcements in other browsers. */}\n <div id={spinnerId} role=\"img\" aria-label={isPendingAriaLiveLabel} />\n </>\n )}\n </SlotProvider>\n </Element>\n </FocusRing>\n );\n}) as <T extends ElementType = 'button'>(\n props: SpectrumButtonProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\n"],"names":[],"version":3,"file":"Button.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;AA6CD,SAAS,0CAAoB,KAAK;IAChC,kDAAkD;IAClD,IAAI,MAAM,SAAS,EAAE;QACnB,MAAM,OAAO,GAAG;QAChB,MAAM,YAAY,GAAG;QACrB,MAAM,UAAU,GAAG;QACnB,MAAM,aAAa,GAAG;QACtB,MAAM,SAAS,GAAG;QAClB,MAAM,SAAS,GAAG;QAClB,MAAM,OAAO,GAAG;QAChB,MAAM,OAAO,GAAG;QAChB,MAAM,IAAI,GAAG;IACf;IACA,OAAO;AACT;AAOO,MAAM,0DAAS,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,OAC9C,KAA6B,EAC7B,GAA8B;IAE9B,QAAQ,CAAA,GAAA,0CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,sCAAW,EAAE,OAAO;IAC5B,QAAQ,0CAAoB;IAC5B,IAAI,EACF,aAAa,UAAU,QAAQ,YAC/B,QAAQ,WACR,OAAO,SACP,QAAQ,YAAY,YAAY,YAAY,QAAQ,SAAS,wBAC7D,WAAW,cACX,UAAU,aACV,SAAS,aACT,SAAS,EACT,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,mCAAQ,EAAE,OAAO;IAChD,IAAI,cAAC,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BACJ,MAAM;gBACN,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YACvC;YACA,MAAM;gBACJ,IAAI;gBACJ,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YACvC;QACF;OACC,OAAO,aAAa,yBAAW,0DAAC,CAAA,GAAA,8BAAG,SAAG,YAAmB,UACzD,2BACC,0DAAC;QACC,eAAY;QACZ,OAAO;YAAC,YAAY,oBAAoB,YAAY;QAAQ;QAC5D,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;qBAC9B,0DAAC,CAAA,GAAA,wCAAa;QACZ,cAAY;QACZ,iBAAA;QACA,MAAK;QACL,aAAa;SAIlB,2BACC,oIACE,0DAAC;QAAI,aAAW,YAAY,WAAW;OACpC,mCACC,0DAAC;QAAI,MAAK;QAAM,mBAAiB;uBAOrC,0DAAC;QAAI,IAAI;QAAW,MAAK;QAAM,cAAY;;AAOzD","sources":["packages/@adobe/react-spectrum/src/button/Button.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps, useButton} from 'react-aria/useButton';\nimport {classNames} from '../utils/classNames';\nimport {FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport intlMessages from '../../intl/button/*.json';\nimport {isAppleDevice, isFirefox, isWebKit} from 'react-aria/private/utils/platform';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {ElementType, ReactElement, useEffect, useState} from 'react';\nimport {SlotProvider, useSlotProps} from '../utils/Slots';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {Text} from '../text/Text';\nimport {useFocus} from 'react-aria/useFocus';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useHasChild} from '../utils/useHasChild';\nimport {useHover} from 'react-aria/useHover';\nimport {useId} from 'react-aria/useId';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProviderProps} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\n\n/** @deprecated */\ntype LegacyButtonVariant = 'cta' | 'overBackground';\nexport interface SpectrumButtonProps<T extends ElementType = 'button'>\n extends Omit<AriaButtonProps<T>, 'onClick'>, StyleProps {\n /** The [visual style](https://spectrum.adobe.com/page/button/#Options) of the button. */\n variant: 'accent' | 'primary' | 'secondary' | 'negative' | LegacyButtonVariant;\n /** The background style of the button. */\n style?: 'fill' | 'outline';\n /** The static color style to apply. Useful when the button appears over a color background. */\n staticColor?: 'white' | 'black';\n /**\n * Whether to disable events immediately and display a loading spinner after a 1 second delay.\n */\n isPending?: boolean;\n /**\n * Whether the button should be displayed with a quiet style.\n *\n * @deprecated\n */\n isQuiet?: boolean;\n}\n\nfunction disablePendingProps(props) {\n // Don't allow interaction while isPending is true\n if (props.isPending) {\n props.onPress = undefined;\n props.onPressStart = undefined;\n props.onPressEnd = undefined;\n props.onPressChange = undefined;\n props.onPressUp = undefined;\n props.onKeyDown = undefined;\n props.onKeyUp = undefined;\n props.onClick = undefined;\n props.href = undefined;\n }\n return props;\n}\n\n/**\n * Buttons allow users to perform an action or to navigate to another page.\n * They have multiple styles for various needs, and are ideal for calling attention to\n * where a user needs to do something in order to move forward in a flow.\n */\nexport const Button = React.forwardRef(function Button<T extends ElementType = 'button'>(\n props: SpectrumButtonProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\n props = useProviderProps(props);\n props = useSlotProps(props, 'button');\n props = disablePendingProps(props);\n let {\n elementType: Element = 'button',\n children,\n variant,\n style = variant === 'accent' || variant === 'cta' ? 'fill' : 'outline',\n staticColor,\n isDisabled,\n isPending,\n autoFocus,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref);\n let {buttonProps, isPressed} = useButton(props, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let [isFocused, onFocusChange] = useState(false);\n let {focusProps} = useFocus({onFocusChange, isDisabled});\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/button');\n let {styleProps} = useStyleProps(otherProps);\n let hasLabel = useHasChild(`.${styles['spectrum-Button-label']}`, domRef);\n let hasIcon = useHasChild(`.${styles['spectrum-Icon']}`, domRef);\n // an aria label will block children and their labels from being read, this is undesirable for pending state\n let hasAriaLabel = !!buttonProps['aria-label'] || !!buttonProps['aria-labelledby'];\n let [isProgressVisible, setIsProgressVisible] = useState(false);\n let backupButtonId = useId();\n let buttonId = buttonProps.id || backupButtonId;\n let iconId = useId();\n let textId = useId();\n let spinnerId = useId();\n\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n\n if (isPending) {\n // Start timer when isPending is set to true.\n timeout = setTimeout(() => {\n setIsProgressVisible(true);\n }, 1000);\n } else {\n // Exit loading state when isPending is set to false. */\n // oxlint-disable-next-line react/react-compiler\n setIsProgressVisible(false);\n }\n return () => {\n // Clean up on unmount or when user removes isPending prop before entering loading state.\n clearTimeout(timeout);\n };\n }, [isPending]);\n\n if (variant === 'cta') {\n variant = 'accent';\n } else if (variant === 'overBackground') {\n variant = 'primary';\n staticColor = 'white';\n }\n\n const isPendingAriaLiveLabel =\n `${hasAriaLabel ? buttonProps['aria-label'] : ''} ${stringFormatter.format('pending')}`.trim();\n const isPendingAriaLiveLabelledby = hasAriaLabel\n ? (buttonProps['aria-labelledby']?.replace(buttonId, spinnerId) ?? spinnerId)\n : `${hasIcon ? iconId : ''} ${hasLabel ? textId : ''} ${spinnerId}`.trim();\n\n let ariaLive: 'off' | 'polite' | 'assertive' = 'polite';\n if (isAppleDevice() && (!hasAriaLabel || (!isWebKit() && isFirefox()))) {\n ariaLive = 'off';\n }\n\n let isPendingProps = isPending\n ? {\n onClick: e => {\n if (e.currentTarget instanceof HTMLButtonElement) {\n e.preventDefault();\n }\n }\n }\n : {\n // no-op.\n // Not sure why, but TypeScript wouldn't allow to have an empty object `{}`.\n onClick: () => {}\n };\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <Element\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps, focusProps, isPendingProps)}\n id={buttonId}\n ref={domRef}\n data-variant={variant}\n data-style={style}\n data-static-color={staticColor || undefined}\n aria-disabled={isPending ? 'true' : undefined}\n aria-label={isPending ? isPendingAriaLiveLabel : buttonProps['aria-label']}\n aria-labelledby={isPending ? isPendingAriaLiveLabelledby : buttonProps['aria-labelledby']}\n className={classNames(\n styles,\n 'spectrum-Button',\n {\n 'spectrum-Button--iconOnly': hasIcon && !hasLabel,\n 'is-disabled': isDisabled || isProgressVisible,\n 'is-active': isPressed,\n 'is-hovered': isHovered,\n 'spectrum-Button--pending': isProgressVisible\n },\n styleProps.className\n )}>\n <SlotProvider\n slots={{\n icon: {\n id: iconId,\n size: 'S',\n UNSAFE_className: classNames(styles, 'spectrum-Icon')\n },\n text: {\n id: textId,\n UNSAFE_className: classNames(styles, 'spectrum-Button-label')\n }\n }}>\n {typeof children === 'string' ? <Text>{children}</Text> : children}\n {isPending && (\n <div\n aria-hidden=\"true\"\n style={{visibility: isProgressVisible ? 'visible' : 'hidden'}}\n className={classNames(styles, 'spectrum-Button-circleLoader')}>\n <ProgressCircle\n aria-label={isPendingAriaLiveLabel}\n isIndeterminate\n size=\"S\"\n staticColor={staticColor}\n />\n </div>\n )}\n {isPending && (\n <>\n <div aria-live={isFocused ? ariaLive : 'off'}>\n {isProgressVisible && (\n <div role=\"img\" aria-labelledby={isPendingAriaLiveLabelledby} />\n )}\n </div>\n {/* Adding the element here with the same labels as the button itself causes aria-live to pick up the change in Safari.\n Safari with VO unfortunately doesn't announce changes to *all* of its labels specifically for button\n https://a11ysupport.io/tests/tech__html__button-name-change#assertion-aria-aria-label_attribute-convey_name_change-html-button_element-vo_macos-safari\n The aria-live may cause extra announcements in other browsers. */}\n <div id={spinnerId} role=\"img\" aria-label={isPendingAriaLiveLabel} />\n </>\n )}\n </SlotProvider>\n </Element>\n </FocusRing>\n );\n}) as <T extends ElementType = 'button'>(\n props: SpectrumButtonProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\n"],"names":[],"version":3,"file":"Button.cjs.map"}
|
|
@@ -11,7 +11,7 @@ import {useProviderProps as $089943c7a219141c$export$521c373ccc32c300} from "../
|
|
|
11
11
|
import {useStyleProps as $120fbea2d95e11ed$export$b8e6fb9d2dff3f41} from "../utils/styleProps.js";
|
|
12
12
|
import {useButton as $jeK3W$useButton} from "react-aria/useButton";
|
|
13
13
|
import {FocusRing as $jeK3W$FocusRing} from "react-aria/FocusRing";
|
|
14
|
-
import {isAppleDevice as $jeK3W$isAppleDevice, isFirefox as $jeK3W$isFirefox} from "react-aria/private/utils/platform";
|
|
14
|
+
import {isAppleDevice as $jeK3W$isAppleDevice, isWebKit as $jeK3W$isWebKit, isFirefox as $jeK3W$isFirefox} from "react-aria/private/utils/platform";
|
|
15
15
|
import {mergeProps as $jeK3W$mergeProps} from "react-aria/mergeProps";
|
|
16
16
|
import $jeK3W$react, {useState as $jeK3W$useState, useEffect as $jeK3W$useEffect} from "react";
|
|
17
17
|
import {useFocus as $jeK3W$useFocus} from "react-aria/useFocus";
|
|
@@ -102,6 +102,7 @@ const $88f996b7df3752a1$export$353f5b6fc5456de1 = /*#__PURE__*/ (0, $jeK3W$react
|
|
|
102
102
|
setIsProgressVisible(true);
|
|
103
103
|
}, 1000);
|
|
104
104
|
else // Exit loading state when isPending is set to false. */
|
|
105
|
+
// oxlint-disable-next-line react/react-compiler
|
|
105
106
|
setIsProgressVisible(false);
|
|
106
107
|
return ()=>{
|
|
107
108
|
// Clean up on unmount or when user removes isPending prop before entering loading state.
|
|
@@ -119,7 +120,7 @@ const $88f996b7df3752a1$export$353f5b6fc5456de1 = /*#__PURE__*/ (0, $jeK3W$react
|
|
|
119
120
|
var _buttonProps_arialabelledby_replace;
|
|
120
121
|
const isPendingAriaLiveLabelledby = hasAriaLabel ? (_buttonProps_arialabelledby_replace = (_buttonProps_arialabelledby = buttonProps['aria-labelledby']) === null || _buttonProps_arialabelledby === void 0 ? void 0 : _buttonProps_arialabelledby.replace(buttonId, spinnerId)) !== null && _buttonProps_arialabelledby_replace !== void 0 ? _buttonProps_arialabelledby_replace : spinnerId : `${hasIcon ? iconId : ''} ${hasLabel ? textId : ''} ${spinnerId}`.trim();
|
|
121
122
|
let ariaLive = 'polite';
|
|
122
|
-
if ((0, $jeK3W$isAppleDevice)() && (!hasAriaLabel || (0, $jeK3W$isFirefox)())) ariaLive = 'off';
|
|
123
|
+
if ((0, $jeK3W$isAppleDevice)() && (!hasAriaLabel || !(0, $jeK3W$isWebKit)() && (0, $jeK3W$isFirefox)())) ariaLive = 'off';
|
|
123
124
|
let isPendingProps = isPending ? {
|
|
124
125
|
onClick: (e)=>{
|
|
125
126
|
if (e.currentTarget instanceof HTMLButtonElement) e.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;AA6CD,SAAS,0CAAoB,KAAK;IAChC,kDAAkD;IAClD,IAAI,MAAM,SAAS,EAAE;QACnB,MAAM,OAAO,GAAG;QAChB,MAAM,YAAY,GAAG;QACrB,MAAM,UAAU,GAAG;QACnB,MAAM,aAAa,GAAG;QACtB,MAAM,SAAS,GAAG;QAClB,MAAM,SAAS,GAAG;QAClB,MAAM,OAAO,GAAG;QAChB,MAAM,OAAO,GAAG;QAChB,MAAM,IAAI,GAAG;IACf;IACA,OAAO;AACT;AAOO,MA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AW;qBACtE,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,YAAY,YAAY,eAAe;QACnE,IAAI;QACJ,KAAK;QACL,gBAAc;QACd,cAAY;QACZ,qBAAmB,eAAe;QAClC,iBAAe,YAAY,SAAS;QACpC,cAAY,YAAY,yBAAyB,WAAW,CAAC,aAAa;QAC1E,mBAAiB,YAAY,8BAA8B,WAAW,CAAC,kBAAkB;QACzF,WAAW,CAAA,GAAA,yCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,mBACA;YACE,6BAA6B,WAAW,CAAC;YACzC,eAAe,cAAc;YAC7B,aAAa;YACb,cAAc;YACd,4BAA4B;QAC9B,GACA,WAAW,SAAS;qBAEtB,gCAAC,CAAA,GAAA,yCAAW;QACV,OAAO;YACL,MAAM;gBACJ,IAAI;gBACJ,MAAM;gBACN,kBAAkB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YACvC;YACA,MAAM;gBACJ,IAAI;gBACJ,kBAAkB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YACvC;QACF;OACC,OAAO,aAAa,yBAAW,gCAAC,CAAA,GAAA,yCAAG,SAAG,YAAmB,UACzD,2BACC,gCAAC;QACC,eAAY;QACZ,OAAO;YAAC,YAAY,oBAAoB,YAAY;QAAQ;QAC5D,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;qBAC9B,gCAAC,CAAA,GAAA,yCAAa;QACZ,cAAY;QACZ,iBAAA;QACA,MAAK;QACL,aAAa;SAIlB,2BACC,gFACE,gCAAC;QAAI,aAAW,YAAY,WAAW;OACpC,mCACC,gCAAC;QAAI,MAAK;QAAM,mBAAiB;uBAOrC,gCAAC;QAAI,IAAI;QAAW,MAAK;QAAM,cAAY;;AAOzD","sources":["packages/@adobe/react-spectrum/src/button/Button.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps, useButton} from 'react-aria/useButton';\nimport {classNames} from '../utils/classNames';\nimport {FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport intlMessages from '../../intl/button/*.json';\nimport {isAppleDevice, isFirefox} from 'react-aria/private/utils/platform';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {ElementType, ReactElement, useEffect, useState} from 'react';\nimport {SlotProvider, useSlotProps} from '../utils/Slots';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {Text} from '../text/Text';\nimport {useFocus} from 'react-aria/useFocus';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useHasChild} from '../utils/useHasChild';\nimport {useHover} from 'react-aria/useHover';\nimport {useId} from 'react-aria/useId';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProviderProps} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\n\n/** @deprecated */\ntype LegacyButtonVariant = 'cta' | 'overBackground';\nexport interface SpectrumButtonProps<T extends ElementType = 'button'>\n extends Omit<AriaButtonProps<T>, 'onClick'>, StyleProps {\n /** The [visual style](https://spectrum.adobe.com/page/button/#Options) of the button. */\n variant: 'accent' | 'primary' | 'secondary' | 'negative' | LegacyButtonVariant;\n /** The background style of the button. */\n style?: 'fill' | 'outline';\n /** The static color style to apply. Useful when the button appears over a color background. */\n staticColor?: 'white' | 'black';\n /**\n * Whether to disable events immediately and display a loading spinner after a 1 second delay.\n */\n isPending?: boolean;\n /**\n * Whether the button should be displayed with a quiet style.\n *\n * @deprecated\n */\n isQuiet?: boolean;\n}\n\nfunction disablePendingProps(props) {\n // Don't allow interaction while isPending is true\n if (props.isPending) {\n props.onPress = undefined;\n props.onPressStart = undefined;\n props.onPressEnd = undefined;\n props.onPressChange = undefined;\n props.onPressUp = undefined;\n props.onKeyDown = undefined;\n props.onKeyUp = undefined;\n props.onClick = undefined;\n props.href = undefined;\n }\n return props;\n}\n\n/**\n * Buttons allow users to perform an action or to navigate to another page.\n * They have multiple styles for various needs, and are ideal for calling attention to\n * where a user needs to do something in order to move forward in a flow.\n */\nexport const Button = React.forwardRef(function Button<T extends ElementType = 'button'>(\n props: SpectrumButtonProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\n props = useProviderProps(props);\n props = useSlotProps(props, 'button');\n props = disablePendingProps(props);\n let {\n elementType: Element = 'button',\n children,\n variant,\n style = variant === 'accent' || variant === 'cta' ? 'fill' : 'outline',\n staticColor,\n isDisabled,\n isPending,\n autoFocus,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref);\n let {buttonProps, isPressed} = useButton(props, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let [isFocused, onFocusChange] = useState(false);\n let {focusProps} = useFocus({onFocusChange, isDisabled});\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/button');\n let {styleProps} = useStyleProps(otherProps);\n let hasLabel = useHasChild(`.${styles['spectrum-Button-label']}`, domRef);\n let hasIcon = useHasChild(`.${styles['spectrum-Icon']}`, domRef);\n // an aria label will block children and their labels from being read, this is undesirable for pending state\n let hasAriaLabel = !!buttonProps['aria-label'] || !!buttonProps['aria-labelledby'];\n let [isProgressVisible, setIsProgressVisible] = useState(false);\n let backupButtonId = useId();\n let buttonId = buttonProps.id || backupButtonId;\n let iconId = useId();\n let textId = useId();\n let spinnerId = useId();\n\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n\n if (isPending) {\n // Start timer when isPending is set to true.\n timeout = setTimeout(() => {\n setIsProgressVisible(true);\n }, 1000);\n } else {\n // Exit loading state when isPending is set to false. */\n setIsProgressVisible(false);\n }\n return () => {\n // Clean up on unmount or when user removes isPending prop before entering loading state.\n clearTimeout(timeout);\n };\n }, [isPending]);\n\n if (variant === 'cta') {\n variant = 'accent';\n } else if (variant === 'overBackground') {\n variant = 'primary';\n staticColor = 'white';\n }\n\n const isPendingAriaLiveLabel =\n `${hasAriaLabel ? buttonProps['aria-label'] : ''} ${stringFormatter.format('pending')}`.trim();\n const isPendingAriaLiveLabelledby = hasAriaLabel\n ? (buttonProps['aria-labelledby']?.replace(buttonId, spinnerId) ?? spinnerId)\n : `${hasIcon ? iconId : ''} ${hasLabel ? textId : ''} ${spinnerId}`.trim();\n\n let ariaLive: 'off' | 'polite' | 'assertive' = 'polite';\n if (isAppleDevice() && (!hasAriaLabel || isFirefox())) {\n ariaLive = 'off';\n }\n\n let isPendingProps = isPending\n ? {\n onClick: e => {\n if (e.currentTarget instanceof HTMLButtonElement) {\n e.preventDefault();\n }\n }\n }\n : {\n // no-op.\n // Not sure why, but TypeScript wouldn't allow to have an empty object `{}`.\n onClick: () => {}\n };\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <Element\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps, focusProps, isPendingProps)}\n id={buttonId}\n ref={domRef}\n data-variant={variant}\n data-style={style}\n data-static-color={staticColor || undefined}\n aria-disabled={isPending ? 'true' : undefined}\n aria-label={isPending ? isPendingAriaLiveLabel : buttonProps['aria-label']}\n aria-labelledby={isPending ? isPendingAriaLiveLabelledby : buttonProps['aria-labelledby']}\n className={classNames(\n styles,\n 'spectrum-Button',\n {\n 'spectrum-Button--iconOnly': hasIcon && !hasLabel,\n 'is-disabled': isDisabled || isProgressVisible,\n 'is-active': isPressed,\n 'is-hovered': isHovered,\n 'spectrum-Button--pending': isProgressVisible\n },\n styleProps.className\n )}>\n <SlotProvider\n slots={{\n icon: {\n id: iconId,\n size: 'S',\n UNSAFE_className: classNames(styles, 'spectrum-Icon')\n },\n text: {\n id: textId,\n UNSAFE_className: classNames(styles, 'spectrum-Button-label')\n }\n }}>\n {typeof children === 'string' ? <Text>{children}</Text> : children}\n {isPending && (\n <div\n aria-hidden=\"true\"\n style={{visibility: isProgressVisible ? 'visible' : 'hidden'}}\n className={classNames(styles, 'spectrum-Button-circleLoader')}>\n <ProgressCircle\n aria-label={isPendingAriaLiveLabel}\n isIndeterminate\n size=\"S\"\n staticColor={staticColor}\n />\n </div>\n )}\n {isPending && (\n <>\n <div aria-live={isFocused ? ariaLive : 'off'}>\n {isProgressVisible && (\n <div role=\"img\" aria-labelledby={isPendingAriaLiveLabelledby} />\n )}\n </div>\n {/* Adding the element here with the same labels as the button itself causes aria-live to pick up the change in Safari.\n Safari with VO unfortunately doesn't announce changes to *all* of its labels specifically for button\n https://a11ysupport.io/tests/tech__html__button-name-change#assertion-aria-aria-label_attribute-convey_name_change-html-button_element-vo_macos-safari\n The aria-live may cause extra announcements in other browsers. */}\n <div id={spinnerId} role=\"img\" aria-label={isPendingAriaLiveLabel} />\n </>\n )}\n </SlotProvider>\n </Element>\n </FocusRing>\n );\n}) as <T extends ElementType = 'button'>(\n props: SpectrumButtonProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\n"],"names":[],"version":3,"file":"Button.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;AA6CD,SAAS,0CAAoB,KAAK;IAChC,kDAAkD;IAClD,IAAI,MAAM,SAAS,EAAE;QACnB,MAAM,OAAO,GAAG;QAChB,MAAM,YAAY,GAAG;QACrB,MAAM,UAAU,GAAG;QACnB,MAAM,aAAa,GAAG;QACtB,MAAM,SAAS,GAAG;QAClB,MAAM,SAAS,GAAG;QAClB,MAAM,OAAO,GAAG;QAChB,MAAM,OAAO,GAAG;QAChB,MAAM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AOzD","sources":["packages/@adobe/react-spectrum/src/button/Button.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps, useButton} from 'react-aria/useButton';\nimport {classNames} from '../utils/classNames';\nimport {FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport intlMessages from '../../intl/button/*.json';\nimport {isAppleDevice, isFirefox, isWebKit} from 'react-aria/private/utils/platform';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {ElementType, ReactElement, useEffect, useState} from 'react';\nimport {SlotProvider, useSlotProps} from '../utils/Slots';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {Text} from '../text/Text';\nimport {useFocus} from 'react-aria/useFocus';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useHasChild} from '../utils/useHasChild';\nimport {useHover} from 'react-aria/useHover';\nimport {useId} from 'react-aria/useId';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProviderProps} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\n\n/** @deprecated */\ntype LegacyButtonVariant = 'cta' | 'overBackground';\nexport interface SpectrumButtonProps<T extends ElementType = 'button'>\n extends Omit<AriaButtonProps<T>, 'onClick'>, StyleProps {\n /** The [visual style](https://spectrum.adobe.com/page/button/#Options) of the button. */\n variant: 'accent' | 'primary' | 'secondary' | 'negative' | LegacyButtonVariant;\n /** The background style of the button. */\n style?: 'fill' | 'outline';\n /** The static color style to apply. Useful when the button appears over a color background. */\n staticColor?: 'white' | 'black';\n /**\n * Whether to disable events immediately and display a loading spinner after a 1 second delay.\n */\n isPending?: boolean;\n /**\n * Whether the button should be displayed with a quiet style.\n *\n * @deprecated\n */\n isQuiet?: boolean;\n}\n\nfunction disablePendingProps(props) {\n // Don't allow interaction while isPending is true\n if (props.isPending) {\n props.onPress = undefined;\n props.onPressStart = undefined;\n props.onPressEnd = undefined;\n props.onPressChange = undefined;\n props.onPressUp = undefined;\n props.onKeyDown = undefined;\n props.onKeyUp = undefined;\n props.onClick = undefined;\n props.href = undefined;\n }\n return props;\n}\n\n/**\n * Buttons allow users to perform an action or to navigate to another page.\n * They have multiple styles for various needs, and are ideal for calling attention to\n * where a user needs to do something in order to move forward in a flow.\n */\nexport const Button = React.forwardRef(function Button<T extends ElementType = 'button'>(\n props: SpectrumButtonProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\n props = useProviderProps(props);\n props = useSlotProps(props, 'button');\n props = disablePendingProps(props);\n let {\n elementType: Element = 'button',\n children,\n variant,\n style = variant === 'accent' || variant === 'cta' ? 'fill' : 'outline',\n staticColor,\n isDisabled,\n isPending,\n autoFocus,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref);\n let {buttonProps, isPressed} = useButton(props, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let [isFocused, onFocusChange] = useState(false);\n let {focusProps} = useFocus({onFocusChange, isDisabled});\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/button');\n let {styleProps} = useStyleProps(otherProps);\n let hasLabel = useHasChild(`.${styles['spectrum-Button-label']}`, domRef);\n let hasIcon = useHasChild(`.${styles['spectrum-Icon']}`, domRef);\n // an aria label will block children and their labels from being read, this is undesirable for pending state\n let hasAriaLabel = !!buttonProps['aria-label'] || !!buttonProps['aria-labelledby'];\n let [isProgressVisible, setIsProgressVisible] = useState(false);\n let backupButtonId = useId();\n let buttonId = buttonProps.id || backupButtonId;\n let iconId = useId();\n let textId = useId();\n let spinnerId = useId();\n\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n\n if (isPending) {\n // Start timer when isPending is set to true.\n timeout = setTimeout(() => {\n setIsProgressVisible(true);\n }, 1000);\n } else {\n // Exit loading state when isPending is set to false. */\n // oxlint-disable-next-line react/react-compiler\n setIsProgressVisible(false);\n }\n return () => {\n // Clean up on unmount or when user removes isPending prop before entering loading state.\n clearTimeout(timeout);\n };\n }, [isPending]);\n\n if (variant === 'cta') {\n variant = 'accent';\n } else if (variant === 'overBackground') {\n variant = 'primary';\n staticColor = 'white';\n }\n\n const isPendingAriaLiveLabel =\n `${hasAriaLabel ? buttonProps['aria-label'] : ''} ${stringFormatter.format('pending')}`.trim();\n const isPendingAriaLiveLabelledby = hasAriaLabel\n ? (buttonProps['aria-labelledby']?.replace(buttonId, spinnerId) ?? spinnerId)\n : `${hasIcon ? iconId : ''} ${hasLabel ? textId : ''} ${spinnerId}`.trim();\n\n let ariaLive: 'off' | 'polite' | 'assertive' = 'polite';\n if (isAppleDevice() && (!hasAriaLabel || (!isWebKit() && isFirefox()))) {\n ariaLive = 'off';\n }\n\n let isPendingProps = isPending\n ? {\n onClick: e => {\n if (e.currentTarget instanceof HTMLButtonElement) {\n e.preventDefault();\n }\n }\n }\n : {\n // no-op.\n // Not sure why, but TypeScript wouldn't allow to have an empty object `{}`.\n onClick: () => {}\n };\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <Element\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps, focusProps, isPendingProps)}\n id={buttonId}\n ref={domRef}\n data-variant={variant}\n data-style={style}\n data-static-color={staticColor || undefined}\n aria-disabled={isPending ? 'true' : undefined}\n aria-label={isPending ? isPendingAriaLiveLabel : buttonProps['aria-label']}\n aria-labelledby={isPending ? isPendingAriaLiveLabelledby : buttonProps['aria-labelledby']}\n className={classNames(\n styles,\n 'spectrum-Button',\n {\n 'spectrum-Button--iconOnly': hasIcon && !hasLabel,\n 'is-disabled': isDisabled || isProgressVisible,\n 'is-active': isPressed,\n 'is-hovered': isHovered,\n 'spectrum-Button--pending': isProgressVisible\n },\n styleProps.className\n )}>\n <SlotProvider\n slots={{\n icon: {\n id: iconId,\n size: 'S',\n UNSAFE_className: classNames(styles, 'spectrum-Icon')\n },\n text: {\n id: textId,\n UNSAFE_className: classNames(styles, 'spectrum-Button-label')\n }\n }}>\n {typeof children === 'string' ? <Text>{children}</Text> : children}\n {isPending && (\n <div\n aria-hidden=\"true\"\n style={{visibility: isProgressVisible ? 'visible' : 'hidden'}}\n className={classNames(styles, 'spectrum-Button-circleLoader')}>\n <ProgressCircle\n aria-label={isPendingAriaLiveLabel}\n isIndeterminate\n size=\"S\"\n staticColor={staticColor}\n />\n </div>\n )}\n {isPending && (\n <>\n <div aria-live={isFocused ? ariaLive : 'off'}>\n {isProgressVisible && (\n <div role=\"img\" aria-labelledby={isPendingAriaLiveLabelledby} />\n )}\n </div>\n {/* Adding the element here with the same labels as the button itself causes aria-live to pick up the change in Safari.\n Safari with VO unfortunately doesn't announce changes to *all* of its labels specifically for button\n https://a11ysupport.io/tests/tech__html__button-name-change#assertion-aria-aria-label_attribute-convey_name_change-html-button_element-vo_macos-safari\n The aria-live may cause extra announcements in other browsers. */}\n <div id={spinnerId} role=\"img\" aria-label={isPendingAriaLiveLabel} />\n </>\n )}\n </SlotProvider>\n </Element>\n </FocusRing>\n );\n}) as <T extends ElementType = 'button'>(\n props: SpectrumButtonProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\n"],"names":[],"version":3,"file":"Button.js.map"}
|
|
@@ -11,7 +11,7 @@ import {useProviderProps as $71dfb0e0358a12de$export$521c373ccc32c300} from "../
|
|
|
11
11
|
import {useStyleProps as $63d03c54ca5e4b88$export$b8e6fb9d2dff3f41} from "../utils/styleProps.mjs";
|
|
12
12
|
import {useButton as $9zSjX$useButton} from "react-aria/useButton";
|
|
13
13
|
import {FocusRing as $9zSjX$FocusRing} from "react-aria/FocusRing";
|
|
14
|
-
import {isAppleDevice as $9zSjX$isAppleDevice, isFirefox as $9zSjX$isFirefox} from "react-aria/private/utils/platform";
|
|
14
|
+
import {isAppleDevice as $9zSjX$isAppleDevice, isWebKit as $9zSjX$isWebKit, isFirefox as $9zSjX$isFirefox} from "react-aria/private/utils/platform";
|
|
15
15
|
import {mergeProps as $9zSjX$mergeProps} from "react-aria/mergeProps";
|
|
16
16
|
import $9zSjX$react, {useState as $9zSjX$useState, useEffect as $9zSjX$useEffect} from "react";
|
|
17
17
|
import {useFocus as $9zSjX$useFocus} from "react-aria/useFocus";
|
|
@@ -101,6 +101,7 @@ const $36a99e6d76bd9d26$export$353f5b6fc5456de1 = /*#__PURE__*/ (0, $9zSjX$react
|
|
|
101
101
|
setIsProgressVisible(true);
|
|
102
102
|
}, 1000);
|
|
103
103
|
else // Exit loading state when isPending is set to false. */
|
|
104
|
+
// oxlint-disable-next-line react/react-compiler
|
|
104
105
|
setIsProgressVisible(false);
|
|
105
106
|
return ()=>{
|
|
106
107
|
// Clean up on unmount or when user removes isPending prop before entering loading state.
|
|
@@ -117,7 +118,7 @@ const $36a99e6d76bd9d26$export$353f5b6fc5456de1 = /*#__PURE__*/ (0, $9zSjX$react
|
|
|
117
118
|
const isPendingAriaLiveLabel = `${hasAriaLabel ? buttonProps['aria-label'] : ''} ${stringFormatter.format('pending')}`.trim();
|
|
118
119
|
const isPendingAriaLiveLabelledby = hasAriaLabel ? buttonProps['aria-labelledby']?.replace(buttonId, spinnerId) ?? spinnerId : `${hasIcon ? iconId : ''} ${hasLabel ? textId : ''} ${spinnerId}`.trim();
|
|
119
120
|
let ariaLive = 'polite';
|
|
120
|
-
if ((0, $9zSjX$isAppleDevice)() && (!hasAriaLabel || (0, $9zSjX$isFirefox)())) ariaLive = 'off';
|
|
121
|
+
if ((0, $9zSjX$isAppleDevice)() && (!hasAriaLabel || !(0, $9zSjX$isWebKit)() && (0, $9zSjX$isFirefox)())) ariaLive = 'off';
|
|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mB,UACzD,2BACC,gCAAC;QACC,eAAY;QACZ,OAAO;YAAC,YAAY,oBAAoB,YAAY;QAAQ;QAC5D,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;qBAC9B,gCAAC,CAAA,GAAA,yCAAa;QACZ,cAAY;QACZ,iBAAA;QACA,MAAK;QACL,aAAa;SAIlB,2BACC,gFACE,gCAAC;QAAI,aAAW,YAAY,WAAW;OACpC,mCACC,gCAAC;QAAI,MAAK;QAAM,mBAAiB;uBAOrC,gCAAC;QAAI,IAAI;QAAW,MAAK;QAAM,cAAY;;AAOzD","sources":["packages/@adobe/react-spectrum/src/button/Button.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps, useButton} from 'react-aria/useButton';\nimport {classNames} from '../utils/classNames';\nimport {FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport intlMessages from '../../intl/button/*.json';\nimport {isAppleDevice, isFirefox} from 'react-aria/private/utils/platform';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {ElementType, ReactElement, useEffect, useState} from 'react';\nimport {SlotProvider, useSlotProps} from '../utils/Slots';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {Text} from '../text/Text';\nimport {useFocus} from 'react-aria/useFocus';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useHasChild} from '../utils/useHasChild';\nimport {useHover} from 'react-aria/useHover';\nimport {useId} from 'react-aria/useId';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProviderProps} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\n\n/** @deprecated */\ntype LegacyButtonVariant = 'cta' | 'overBackground';\nexport interface SpectrumButtonProps<T extends ElementType = 'button'>\n extends Omit<AriaButtonProps<T>, 'onClick'>, StyleProps {\n /** The [visual style](https://spectrum.adobe.com/page/button/#Options) of the button. */\n variant: 'accent' | 'primary' | 'secondary' | 'negative' | LegacyButtonVariant;\n /** The background style of the button. */\n style?: 'fill' | 'outline';\n /** The static color style to apply. Useful when the button appears over a color background. */\n staticColor?: 'white' | 'black';\n /**\n * Whether to disable events immediately and display a loading spinner after a 1 second delay.\n */\n isPending?: boolean;\n /**\n * Whether the button should be displayed with a quiet style.\n *\n * @deprecated\n */\n isQuiet?: boolean;\n}\n\nfunction disablePendingProps(props) {\n // Don't allow interaction while isPending is true\n if (props.isPending) {\n props.onPress = undefined;\n props.onPressStart = undefined;\n props.onPressEnd = undefined;\n props.onPressChange = undefined;\n props.onPressUp = undefined;\n props.onKeyDown = undefined;\n props.onKeyUp = undefined;\n props.onClick = undefined;\n props.href = undefined;\n }\n return props;\n}\n\n/**\n * Buttons allow users to perform an action or to navigate to another page.\n * They have multiple styles for various needs, and are ideal for calling attention to\n * where a user needs to do something in order to move forward in a flow.\n */\nexport const Button = React.forwardRef(function Button<T extends ElementType = 'button'>(\n props: SpectrumButtonProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\n props = useProviderProps(props);\n props = useSlotProps(props, 'button');\n props = disablePendingProps(props);\n let {\n elementType: Element = 'button',\n children,\n variant,\n style = variant === 'accent' || variant === 'cta' ? 'fill' : 'outline',\n staticColor,\n isDisabled,\n isPending,\n autoFocus,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref);\n let {buttonProps, isPressed} = useButton(props, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let [isFocused, onFocusChange] = useState(false);\n let {focusProps} = useFocus({onFocusChange, isDisabled});\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/button');\n let {styleProps} = useStyleProps(otherProps);\n let hasLabel = useHasChild(`.${styles['spectrum-Button-label']}`, domRef);\n let hasIcon = useHasChild(`.${styles['spectrum-Icon']}`, domRef);\n // an aria label will block children and their labels from being read, this is undesirable for pending state\n let hasAriaLabel = !!buttonProps['aria-label'] || !!buttonProps['aria-labelledby'];\n let [isProgressVisible, setIsProgressVisible] = useState(false);\n let backupButtonId = useId();\n let buttonId = buttonProps.id || backupButtonId;\n let iconId = useId();\n let textId = useId();\n let spinnerId = useId();\n\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n\n if (isPending) {\n // Start timer when isPending is set to true.\n timeout = setTimeout(() => {\n setIsProgressVisible(true);\n }, 1000);\n } else {\n // Exit loading state when isPending is set to false. */\n setIsProgressVisible(false);\n }\n return () => {\n // Clean up on unmount or when user removes isPending prop before entering loading state.\n clearTimeout(timeout);\n };\n }, [isPending]);\n\n if (variant === 'cta') {\n variant = 'accent';\n } else if (variant === 'overBackground') {\n variant = 'primary';\n staticColor = 'white';\n }\n\n const isPendingAriaLiveLabel =\n `${hasAriaLabel ? buttonProps['aria-label'] : ''} ${stringFormatter.format('pending')}`.trim();\n const isPendingAriaLiveLabelledby = hasAriaLabel\n ? (buttonProps['aria-labelledby']?.replace(buttonId, spinnerId) ?? spinnerId)\n : `${hasIcon ? iconId : ''} ${hasLabel ? textId : ''} ${spinnerId}`.trim();\n\n let ariaLive: 'off' | 'polite' | 'assertive' = 'polite';\n if (isAppleDevice() && (!hasAriaLabel || isFirefox())) {\n ariaLive = 'off';\n }\n\n let isPendingProps = isPending\n ? {\n onClick: e => {\n if (e.currentTarget instanceof HTMLButtonElement) {\n e.preventDefault();\n }\n }\n }\n : {\n // no-op.\n // Not sure why, but TypeScript wouldn't allow to have an empty object `{}`.\n onClick: () => {}\n };\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <Element\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps, focusProps, isPendingProps)}\n id={buttonId}\n ref={domRef}\n data-variant={variant}\n data-style={style}\n data-static-color={staticColor || undefined}\n aria-disabled={isPending ? 'true' : undefined}\n aria-label={isPending ? isPendingAriaLiveLabel : buttonProps['aria-label']}\n aria-labelledby={isPending ? isPendingAriaLiveLabelledby : buttonProps['aria-labelledby']}\n className={classNames(\n styles,\n 'spectrum-Button',\n {\n 'spectrum-Button--iconOnly': hasIcon && !hasLabel,\n 'is-disabled': isDisabled || isProgressVisible,\n 'is-active': isPressed,\n 'is-hovered': isHovered,\n 'spectrum-Button--pending': isProgressVisible\n },\n styleProps.className\n )}>\n <SlotProvider\n slots={{\n icon: {\n id: iconId,\n size: 'S',\n UNSAFE_className: classNames(styles, 'spectrum-Icon')\n },\n text: {\n id: textId,\n UNSAFE_className: classNames(styles, 'spectrum-Button-label')\n }\n }}>\n {typeof children === 'string' ? <Text>{children}</Text> : children}\n {isPending && (\n <div\n aria-hidden=\"true\"\n style={{visibility: isProgressVisible ? 'visible' : 'hidden'}}\n className={classNames(styles, 'spectrum-Button-circleLoader')}>\n <ProgressCircle\n aria-label={isPendingAriaLiveLabel}\n isIndeterminate\n size=\"S\"\n staticColor={staticColor}\n />\n </div>\n )}\n {isPending && (\n <>\n <div aria-live={isFocused ? ariaLive : 'off'}>\n {isProgressVisible && (\n <div role=\"img\" aria-labelledby={isPendingAriaLiveLabelledby} />\n )}\n </div>\n {/* Adding the element here with the same labels as the button itself causes aria-live to pick up the change in Safari.\n Safari with VO unfortunately doesn't announce changes to *all* of its labels specifically for button\n https://a11ysupport.io/tests/tech__html__button-name-change#assertion-aria-aria-label_attribute-convey_name_change-html-button_element-vo_macos-safari\n The aria-live may cause extra announcements in other browsers. */}\n <div id={spinnerId} role=\"img\" aria-label={isPendingAriaLiveLabel} />\n </>\n )}\n </SlotProvider>\n </Element>\n </FocusRing>\n );\n}) as <T extends ElementType = 'button'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CAAG,SAAG,YAAmB,UACzD,2BACC,gCAAC;QACC,eAAY;QACZ,OAAO;YAAC,YAAY,oBAAoB,YAAY;QAAQ;QAC5D,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;qBAC9B,gCAAC,CAAA,GAAA,yCAAa;QACZ,cAAY;QACZ,iBAAA;QACA,MAAK;QACL,aAAa;SAIlB,2BACC,gFACE,gCAAC;QAAI,aAAW,YAAY,WAAW;OACpC,mCACC,gCAAC;QAAI,MAAK;QAAM,mBAAiB;uBAOrC,gCAAC;QAAI,IAAI;QAAW,MAAK;QAAM,cAAY;;AAOzD","sources":["packages/@adobe/react-spectrum/src/button/Button.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps, useButton} from 'react-aria/useButton';\nimport {classNames} from '../utils/classNames';\nimport {FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport intlMessages from '../../intl/button/*.json';\nimport {isAppleDevice, isFirefox, isWebKit} from 'react-aria/private/utils/platform';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {ElementType, ReactElement, useEffect, useState} from 'react';\nimport {SlotProvider, useSlotProps} from '../utils/Slots';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {Text} from '../text/Text';\nimport {useFocus} from 'react-aria/useFocus';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useHasChild} from '../utils/useHasChild';\nimport {useHover} from 'react-aria/useHover';\nimport {useId} from 'react-aria/useId';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProviderProps} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\n\n/** @deprecated */\ntype LegacyButtonVariant = 'cta' | 'overBackground';\nexport interface SpectrumButtonProps<T extends ElementType = 'button'>\n extends Omit<AriaButtonProps<T>, 'onClick'>, StyleProps {\n /** The [visual style](https://spectrum.adobe.com/page/button/#Options) of the button. */\n variant: 'accent' | 'primary' | 'secondary' | 'negative' | LegacyButtonVariant;\n /** The background style of the button. */\n style?: 'fill' | 'outline';\n /** The static color style to apply. Useful when the button appears over a color background. */\n staticColor?: 'white' | 'black';\n /**\n * Whether to disable events immediately and display a loading spinner after a 1 second delay.\n */\n isPending?: boolean;\n /**\n * Whether the button should be displayed with a quiet style.\n *\n * @deprecated\n */\n isQuiet?: boolean;\n}\n\nfunction disablePendingProps(props) {\n // Don't allow interaction while isPending is true\n if (props.isPending) {\n props.onPress = undefined;\n props.onPressStart = undefined;\n props.onPressEnd = undefined;\n props.onPressChange = undefined;\n props.onPressUp = undefined;\n props.onKeyDown = undefined;\n props.onKeyUp = undefined;\n props.onClick = undefined;\n props.href = undefined;\n }\n return props;\n}\n\n/**\n * Buttons allow users to perform an action or to navigate to another page.\n * They have multiple styles for various needs, and are ideal for calling attention to\n * where a user needs to do something in order to move forward in a flow.\n */\nexport const Button = React.forwardRef(function Button<T extends ElementType = 'button'>(\n props: SpectrumButtonProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\n props = useProviderProps(props);\n props = useSlotProps(props, 'button');\n props = disablePendingProps(props);\n let {\n elementType: Element = 'button',\n children,\n variant,\n style = variant === 'accent' || variant === 'cta' ? 'fill' : 'outline',\n staticColor,\n isDisabled,\n isPending,\n autoFocus,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref);\n let {buttonProps, isPressed} = useButton(props, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let [isFocused, onFocusChange] = useState(false);\n let {focusProps} = useFocus({onFocusChange, isDisabled});\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/button');\n let {styleProps} = useStyleProps(otherProps);\n let hasLabel = useHasChild(`.${styles['spectrum-Button-label']}`, domRef);\n let hasIcon = useHasChild(`.${styles['spectrum-Icon']}`, domRef);\n // an aria label will block children and their labels from being read, this is undesirable for pending state\n let hasAriaLabel = !!buttonProps['aria-label'] || !!buttonProps['aria-labelledby'];\n let [isProgressVisible, setIsProgressVisible] = useState(false);\n let backupButtonId = useId();\n let buttonId = buttonProps.id || backupButtonId;\n let iconId = useId();\n let textId = useId();\n let spinnerId = useId();\n\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n\n if (isPending) {\n // Start timer when isPending is set to true.\n timeout = setTimeout(() => {\n setIsProgressVisible(true);\n }, 1000);\n } else {\n // Exit loading state when isPending is set to false. */\n // oxlint-disable-next-line react/react-compiler\n setIsProgressVisible(false);\n }\n return () => {\n // Clean up on unmount or when user removes isPending prop before entering loading state.\n clearTimeout(timeout);\n };\n }, [isPending]);\n\n if (variant === 'cta') {\n variant = 'accent';\n } else if (variant === 'overBackground') {\n variant = 'primary';\n staticColor = 'white';\n }\n\n const isPendingAriaLiveLabel =\n `${hasAriaLabel ? buttonProps['aria-label'] : ''} ${stringFormatter.format('pending')}`.trim();\n const isPendingAriaLiveLabelledby = hasAriaLabel\n ? (buttonProps['aria-labelledby']?.replace(buttonId, spinnerId) ?? spinnerId)\n : `${hasIcon ? iconId : ''} ${hasLabel ? textId : ''} ${spinnerId}`.trim();\n\n let ariaLive: 'off' | 'polite' | 'assertive' = 'polite';\n if (isAppleDevice() && (!hasAriaLabel || (!isWebKit() && isFirefox()))) {\n ariaLive = 'off';\n }\n\n let isPendingProps = isPending\n ? {\n onClick: e => {\n if (e.currentTarget instanceof HTMLButtonElement) {\n e.preventDefault();\n }\n }\n }\n : {\n // no-op.\n // Not sure why, but TypeScript wouldn't allow to have an empty object `{}`.\n onClick: () => {}\n };\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <Element\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps, focusProps, isPendingProps)}\n id={buttonId}\n ref={domRef}\n data-variant={variant}\n data-style={style}\n data-static-color={staticColor || undefined}\n aria-disabled={isPending ? 'true' : undefined}\n aria-label={isPending ? isPendingAriaLiveLabel : buttonProps['aria-label']}\n aria-labelledby={isPending ? isPendingAriaLiveLabelledby : buttonProps['aria-labelledby']}\n className={classNames(\n styles,\n 'spectrum-Button',\n {\n 'spectrum-Button--iconOnly': hasIcon && !hasLabel,\n 'is-disabled': isDisabled || isProgressVisible,\n 'is-active': isPressed,\n 'is-hovered': isHovered,\n 'spectrum-Button--pending': isProgressVisible\n },\n styleProps.className\n )}>\n <SlotProvider\n slots={{\n icon: {\n id: iconId,\n size: 'S',\n UNSAFE_className: classNames(styles, 'spectrum-Icon')\n },\n text: {\n id: textId,\n UNSAFE_className: classNames(styles, 'spectrum-Button-label')\n }\n }}>\n {typeof children === 'string' ? <Text>{children}</Text> : children}\n {isPending && (\n <div\n aria-hidden=\"true\"\n style={{visibility: isProgressVisible ? 'visible' : 'hidden'}}\n className={classNames(styles, 'spectrum-Button-circleLoader')}>\n <ProgressCircle\n aria-label={isPendingAriaLiveLabel}\n isIndeterminate\n size=\"S\"\n staticColor={staticColor}\n />\n </div>\n )}\n {isPending && (\n <>\n <div aria-live={isFocused ? ariaLive : 'off'}>\n {isProgressVisible && (\n <div role=\"img\" aria-labelledby={isPendingAriaLiveLabelledby} />\n )}\n </div>\n {/* Adding the element here with the same labels as the button itself causes aria-live to pick up the change in Safari.\n Safari with VO unfortunately doesn't announce changes to *all* of its labels specifically for button\n https://a11ysupport.io/tests/tech__html__button-name-change#assertion-aria-aria-label_attribute-convey_name_change-html-button_element-vo_macos-safari\n The aria-live may cause extra announcements in other browsers. */}\n <div id={spinnerId} role=\"img\" aria-label={isPendingAriaLiveLabel} />\n </>\n )}\n </SlotProvider>\n </Element>\n </FocusRing>\n );\n}) as <T extends ElementType = 'button'>(\n props: SpectrumButtonProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\n"],"names":[],"version":3,"file":"Button.mjs.map"}
|
|
@@ -56,7 +56,8 @@ const $0fc8553a4214494f$export$13ec83e50bf04290 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
56
56
|
// For cases like the clear button in a search field, remove the tabIndex so
|
|
57
57
|
// iOS 14 with VoiceOver doesn't focus the button and hide the keyboard when
|
|
58
58
|
// moving the cursor over the clear button.
|
|
59
|
-
if (preventFocus)
|
|
59
|
+
if (preventFocus) // oxlint-disable-next-line react/react-compiler
|
|
60
|
+
delete buttonProps.tabIndex;
|
|
60
61
|
let ElementType = elementType;
|
|
61
62
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($fYCN7$react))).createElement((0, $fYCN7$reactariaFocusRing.FocusRing), {
|
|
62
63
|
focusRingClass: (0, $69fd630bd812ba47$exports.classNames)((0, ($parcel$interopDefault($869138cbe3b599dc$exports))), 'focus-ring', focusClassName),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAwBM,MAAM,0DAAc,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,YACnD,KAAuB,EACvB,GAAoC;IAEpC,IAAI,YACF,yBAAW,0DAAC,CAAA,GAAA,0DAAS;QAAE,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,gBAAgB;wBAChE,cAAc,WACd,OAAO,aACP,SAAS,cACT,UAAU,gBACV,YAAY,eACZ,cAAc,eAAe,QAAS,iBACtC,QAAQ,OACR,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,mCAAQ,EAAE;QAAC,GAAG,KAAK;qBAAE;IAAW,GAAG;IAClE,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,iCAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IAEjC,4EAA4E;IAC5E,4EAA4E;IAC5E,2CAA2C;IAC3C,IAAI,cACF,OAAO,YAAY,QAAQ;IAG7B,IAAI,cAAc;IAClB,qBACE,0DAAC,CAAA,GAAA,mCAAQ;QACP,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,cAAc;QACjD,WAAW;qBACX,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,CAAA,GAAA,qCAAS,EAAE,aAAa,WAAW;QACvC,KAAK;QACL,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,wBACA;YACE,CAAC,CAAC,sBAAsB,EAAE,SAAS,CAAC,EAAE;YACtC,eAAe;YACf,aAAa;YACb,cAAc;YACd,+BAA+B;QACjC,GACA,WAAW,SAAS;OAErB;AAIT","sources":["packages/@adobe/react-spectrum/src/button/ClearButton.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps, useButton} from 'react-aria/useButton';\n\nimport {classNames} from '../utils/classNames';\nimport CrossSmall from '@spectrum-icons/ui/CrossSmall';\nimport {DOMProps, FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {ElementType} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useHover} from 'react-aria/useHover';\nimport {useStyleProps} from '../utils/styleProps';\n\ninterface ClearButtonProps<T extends ElementType = 'button'>\n extends AriaButtonProps<T>, DOMProps, StyleProps {\n focusClassName?: string;\n variant?: 'overBackground';\n excludeFromTabOrder?: boolean;\n preventFocus?: boolean;\n inset?: boolean;\n}\n\nexport const ClearButton = React.forwardRef(function ClearButton(\n props: ClearButtonProps,\n ref: FocusableRef<HTMLButtonElement>\n) {\n let {\n children = <CrossSmall UNSAFE_className={styles['spectrum-Icon']} />,\n focusClassName,\n variant,\n autoFocus,\n isDisabled,\n preventFocus,\n elementType = preventFocus ? 'div' : ('button' as ElementType),\n inset = false,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref);\n let {buttonProps, isPressed} = useButton({...props, elementType}, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let {styleProps} = useStyleProps(otherProps);\n\n // For cases like the clear button in a search field, remove the tabIndex so\n // iOS 14 with VoiceOver doesn't focus the button and hide the keyboard when\n // moving the cursor over the clear button.\n if (preventFocus) {\n delete buttonProps.tabIndex;\n }\n\n let ElementType = elementType;\n return (\n <FocusRing\n focusRingClass={classNames(styles, 'focus-ring', focusClassName)}\n autoFocus={autoFocus}>\n <ElementType\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps)}\n ref={domRef}\n className={classNames(\n styles,\n 'spectrum-ClearButton',\n {\n [`spectrum-ClearButton--${variant}`]: variant,\n 'is-disabled': isDisabled,\n 'is-active': isPressed,\n 'is-hovered': isHovered,\n 'spectrum-ClearButton--inset': inset\n },\n styleProps.className\n )}>\n {children}\n </ElementType>\n </FocusRing>\n );\n});\n"],"names":[],"version":3,"file":"ClearButton.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAwBM,MAAM,0DAAc,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,YACnD,KAAuB,EACvB,GAAoC;IAEpC,IAAI,YACF,yBAAW,0DAAC,CAAA,GAAA,0DAAS;QAAE,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,gBAAgB;wBAChE,cAAc,WACd,OAAO,aACP,SAAS,cACT,UAAU,gBACV,YAAY,eACZ,cAAc,eAAe,QAAS,iBACtC,QAAQ,OACR,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,mCAAQ,EAAE;QAAC,GAAG,KAAK;qBAAE;IAAW,GAAG;IAClE,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,iCAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IAEjC,4EAA4E;IAC5E,4EAA4E;IAC5E,2CAA2C;IAC3C,IAAI,cACF,gDAAgD;IAChD,OAAO,YAAY,QAAQ;IAG7B,IAAI,cAAc;IAClB,qBACE,0DAAC,CAAA,GAAA,mCAAQ;QACP,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,cAAc;QACjD,WAAW;qBACX,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,CAAA,GAAA,qCAAS,EAAE,aAAa,WAAW;QACvC,KAAK;QACL,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,wBACA;YACE,CAAC,CAAC,sBAAsB,EAAE,SAAS,CAAC,EAAE;YACtC,eAAe;YACf,aAAa;YACb,cAAc;YACd,+BAA+B;QACjC,GACA,WAAW,SAAS;OAErB;AAIT","sources":["packages/@adobe/react-spectrum/src/button/ClearButton.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps, useButton} from 'react-aria/useButton';\n\nimport {classNames} from '../utils/classNames';\nimport CrossSmall from '@spectrum-icons/ui/CrossSmall';\nimport {DOMProps, FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {ElementType} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useHover} from 'react-aria/useHover';\nimport {useStyleProps} from '../utils/styleProps';\n\ninterface ClearButtonProps<T extends ElementType = 'button'>\n extends AriaButtonProps<T>, DOMProps, StyleProps {\n focusClassName?: string;\n variant?: 'overBackground';\n excludeFromTabOrder?: boolean;\n preventFocus?: boolean;\n inset?: boolean;\n}\n\nexport const ClearButton = React.forwardRef(function ClearButton(\n props: ClearButtonProps,\n ref: FocusableRef<HTMLButtonElement>\n) {\n let {\n children = <CrossSmall UNSAFE_className={styles['spectrum-Icon']} />,\n focusClassName,\n variant,\n autoFocus,\n isDisabled,\n preventFocus,\n elementType = preventFocus ? 'div' : ('button' as ElementType),\n inset = false,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref);\n let {buttonProps, isPressed} = useButton({...props, elementType}, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let {styleProps} = useStyleProps(otherProps);\n\n // For cases like the clear button in a search field, remove the tabIndex so\n // iOS 14 with VoiceOver doesn't focus the button and hide the keyboard when\n // moving the cursor over the clear button.\n if (preventFocus) {\n // oxlint-disable-next-line react/react-compiler\n delete buttonProps.tabIndex;\n }\n\n let ElementType = elementType;\n return (\n <FocusRing\n focusRingClass={classNames(styles, 'focus-ring', focusClassName)}\n autoFocus={autoFocus}>\n <ElementType\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps)}\n ref={domRef}\n className={classNames(\n styles,\n 'spectrum-ClearButton',\n {\n [`spectrum-ClearButton--${variant}`]: variant,\n 'is-disabled': isDisabled,\n 'is-active': isPressed,\n 'is-hovered': isHovered,\n 'spectrum-ClearButton--inset': inset\n },\n styleProps.className\n )}>\n {children}\n </ElementType>\n </FocusRing>\n );\n});\n"],"names":[],"version":3,"file":"ClearButton.cjs.map"}
|
|
@@ -50,7 +50,8 @@ const $cf8b586db4c34baa$export$13ec83e50bf04290 = /*#__PURE__*/ (0, $dOW0k$react
|
|
|
50
50
|
// For cases like the clear button in a search field, remove the tabIndex so
|
|
51
51
|
// iOS 14 with VoiceOver doesn't focus the button and hide the keyboard when
|
|
52
52
|
// moving the cursor over the clear button.
|
|
53
|
-
if (preventFocus)
|
|
53
|
+
if (preventFocus) // oxlint-disable-next-line react/react-compiler
|
|
54
|
+
delete buttonProps.tabIndex;
|
|
54
55
|
let ElementType = elementType;
|
|
55
56
|
return /*#__PURE__*/ (0, $dOW0k$react).createElement((0, $dOW0k$FocusRing), {
|
|
56
57
|
focusRingClass: (0, $512ba93e663f149c$export$ce4ab0c55987d1ff)((0, ($parcel$interopDefault($dOW0k$button_vars_cssmjs))), 'focus-ring', focusClassName),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAwBM,MAAM,0DAAc,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,YACnD,KAAuB,EACvB,GAAoC;IAEpC,IAAI,YACF,yBAAW,gCAAC,CAAA,GAAA,gCAAS;QAAE,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,gBAAgB;wBAChE,cAAc,WACd,OAAO,aACP,SAAS,cACT,UAAU,gBACV,YAAY,eACZ,cAAc,eAAe,QAAS,iBACtC,QAAQ,OACR,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAAE;QAAC,GAAG,KAAK;qBAAE;IAAW,GAAG;IAClE,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAY,EAAE;IAEjC,4EAA4E;IAC5E,4EAA4E;IAC5E,2CAA2C;IAC3C,IAAI,cACF,OAAO,YAAY,QAAQ;IAG7B,IAAI,cAAc;IAClB,qBACE,gCAAC,CAAA,GAAA,gBAAQ;QACP,gBAAgB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,cAAc;QACjD,WAAW;qBACX,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,WAAW;QACvC,KAAK;QACL,WAAW,CAAA,GAAA,yCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,wBACA;YACE,CAAC,CAAC,sBAAsB,EAAE,SAAS,CAAC,EAAE;YACtC,eAAe;YACf,aAAa;YACb,cAAc;YACd,+BAA+B;QACjC,GACA,WAAW,SAAS;OAErB;AAIT","sources":["packages/@adobe/react-spectrum/src/button/ClearButton.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps, useButton} from 'react-aria/useButton';\n\nimport {classNames} from '../utils/classNames';\nimport CrossSmall from '@spectrum-icons/ui/CrossSmall';\nimport {DOMProps, FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {ElementType} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useHover} from 'react-aria/useHover';\nimport {useStyleProps} from '../utils/styleProps';\n\ninterface ClearButtonProps<T extends ElementType = 'button'>\n extends AriaButtonProps<T>, DOMProps, StyleProps {\n focusClassName?: string;\n variant?: 'overBackground';\n excludeFromTabOrder?: boolean;\n preventFocus?: boolean;\n inset?: boolean;\n}\n\nexport const ClearButton = React.forwardRef(function ClearButton(\n props: ClearButtonProps,\n ref: FocusableRef<HTMLButtonElement>\n) {\n let {\n children = <CrossSmall UNSAFE_className={styles['spectrum-Icon']} />,\n focusClassName,\n variant,\n autoFocus,\n isDisabled,\n preventFocus,\n elementType = preventFocus ? 'div' : ('button' as ElementType),\n inset = false,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref);\n let {buttonProps, isPressed} = useButton({...props, elementType}, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let {styleProps} = useStyleProps(otherProps);\n\n // For cases like the clear button in a search field, remove the tabIndex so\n // iOS 14 with VoiceOver doesn't focus the button and hide the keyboard when\n // moving the cursor over the clear button.\n if (preventFocus) {\n delete buttonProps.tabIndex;\n }\n\n let ElementType = elementType;\n return (\n <FocusRing\n focusRingClass={classNames(styles, 'focus-ring', focusClassName)}\n autoFocus={autoFocus}>\n <ElementType\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps)}\n ref={domRef}\n className={classNames(\n styles,\n 'spectrum-ClearButton',\n {\n [`spectrum-ClearButton--${variant}`]: variant,\n 'is-disabled': isDisabled,\n 'is-active': isPressed,\n 'is-hovered': isHovered,\n 'spectrum-ClearButton--inset': inset\n },\n styleProps.className\n )}>\n {children}\n </ElementType>\n </FocusRing>\n );\n});\n"],"names":[],"version":3,"file":"ClearButton.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAwBM,MAAM,0DAAc,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,YACnD,KAAuB,EACvB,GAAoC;IAEpC,IAAI,YACF,yBAAW,gCAAC,CAAA,GAAA,gCAAS;QAAE,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,gBAAgB;wBAChE,cAAc,WACd,OAAO,aACP,SAAS,cACT,UAAU,gBACV,YAAY,eACZ,cAAc,eAAe,QAAS,iBACtC,QAAQ,OACR,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAAE;QAAC,GAAG,KAAK;qBAAE;IAAW,GAAG;IAClE,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAY,EAAE;IAEjC,4EAA4E;IAC5E,4EAA4E;IAC5E,2CAA2C;IAC3C,IAAI,cACF,gDAAgD;IAChD,OAAO,YAAY,QAAQ;IAG7B,IAAI,cAAc;IAClB,qBACE,gCAAC,CAAA,GAAA,gBAAQ;QACP,gBAAgB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,cAAc;QACjD,WAAW;qBACX,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,WAAW;QACvC,KAAK;QACL,WAAW,CAAA,GAAA,yCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,wBACA;YACE,CAAC,CAAC,sBAAsB,EAAE,SAAS,CAAC,EAAE;YACtC,eAAe;YACf,aAAa;YACb,cAAc;YACd,+BAA+B;QACjC,GACA,WAAW,SAAS;OAErB;AAIT","sources":["packages/@adobe/react-spectrum/src/button/ClearButton.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps, useButton} from 'react-aria/useButton';\n\nimport {classNames} from '../utils/classNames';\nimport CrossSmall from '@spectrum-icons/ui/CrossSmall';\nimport {DOMProps, FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {ElementType} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useHover} from 'react-aria/useHover';\nimport {useStyleProps} from '../utils/styleProps';\n\ninterface ClearButtonProps<T extends ElementType = 'button'>\n extends AriaButtonProps<T>, DOMProps, StyleProps {\n focusClassName?: string;\n variant?: 'overBackground';\n excludeFromTabOrder?: boolean;\n preventFocus?: boolean;\n inset?: boolean;\n}\n\nexport const ClearButton = React.forwardRef(function ClearButton(\n props: ClearButtonProps,\n ref: FocusableRef<HTMLButtonElement>\n) {\n let {\n children = <CrossSmall UNSAFE_className={styles['spectrum-Icon']} />,\n focusClassName,\n variant,\n autoFocus,\n isDisabled,\n preventFocus,\n elementType = preventFocus ? 'div' : ('button' as ElementType),\n inset = false,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref);\n let {buttonProps, isPressed} = useButton({...props, elementType}, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let {styleProps} = useStyleProps(otherProps);\n\n // For cases like the clear button in a search field, remove the tabIndex so\n // iOS 14 with VoiceOver doesn't focus the button and hide the keyboard when\n // moving the cursor over the clear button.\n if (preventFocus) {\n // oxlint-disable-next-line react/react-compiler\n delete buttonProps.tabIndex;\n }\n\n let ElementType = elementType;\n return (\n <FocusRing\n focusRingClass={classNames(styles, 'focus-ring', focusClassName)}\n autoFocus={autoFocus}>\n <ElementType\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps)}\n ref={domRef}\n className={classNames(\n styles,\n 'spectrum-ClearButton',\n {\n [`spectrum-ClearButton--${variant}`]: variant,\n 'is-disabled': isDisabled,\n 'is-active': isPressed,\n 'is-hovered': isHovered,\n 'spectrum-ClearButton--inset': inset\n },\n styleProps.className\n )}>\n {children}\n </ElementType>\n </FocusRing>\n );\n});\n"],"names":[],"version":3,"file":"ClearButton.js.map"}
|
|
@@ -50,7 +50,8 @@ const $ab14010a528467be$export$13ec83e50bf04290 = /*#__PURE__*/ (0, $cbPEp$react
|
|
|
50
50
|
// For cases like the clear button in a search field, remove the tabIndex so
|
|
51
51
|
// iOS 14 with VoiceOver doesn't focus the button and hide the keyboard when
|
|
52
52
|
// moving the cursor over the clear button.
|
|
53
|
-
if (preventFocus)
|
|
53
|
+
if (preventFocus) // oxlint-disable-next-line react/react-compiler
|
|
54
|
+
delete buttonProps.tabIndex;
|
|
54
55
|
let ElementType = elementType;
|
|
55
56
|
return /*#__PURE__*/ (0, $cbPEp$react).createElement((0, $cbPEp$FocusRing), {
|
|
56
57
|
focusRingClass: (0, $6e6392558d48dfec$export$ce4ab0c55987d1ff)((0, ($parcel$interopDefault($cbPEp$button_vars_cssmjs))), 'focus-ring', focusClassName),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAwBM,MAAM,0DAAc,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,YACnD,KAAuB,EACvB,GAAoC;IAEpC,IAAI,YACF,yBAAW,gCAAC,CAAA,GAAA,gCAAS;QAAE,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,gBAAgB;wBAChE,cAAc,WACd,OAAO,aACP,SAAS,cACT,UAAU,gBACV,YAAY,eACZ,cAAc,eAAe,QAAS,iBACtC,QAAQ,OACR,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAAE;QAAC,GAAG,KAAK;qBAAE;IAAW,GAAG;IAClE,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAY,EAAE;IAEjC,4EAA4E;IAC5E,4EAA4E;IAC5E,2CAA2C;IAC3C,IAAI,cACF,OAAO,YAAY,QAAQ;IAG7B,IAAI,cAAc;IAClB,qBACE,gCAAC,CAAA,GAAA,gBAAQ;QACP,gBAAgB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,cAAc;QACjD,WAAW;qBACX,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,WAAW;QACvC,KAAK;QACL,WAAW,CAAA,GAAA,yCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,wBACA;YACE,CAAC,CAAC,sBAAsB,EAAE,SAAS,CAAC,EAAE;YACtC,eAAe;YACf,aAAa;YACb,cAAc;YACd,+BAA+B;QACjC,GACA,WAAW,SAAS;OAErB;AAIT","sources":["packages/@adobe/react-spectrum/src/button/ClearButton.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps, useButton} from 'react-aria/useButton';\n\nimport {classNames} from '../utils/classNames';\nimport CrossSmall from '@spectrum-icons/ui/CrossSmall';\nimport {DOMProps, FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {ElementType} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useHover} from 'react-aria/useHover';\nimport {useStyleProps} from '../utils/styleProps';\n\ninterface ClearButtonProps<T extends ElementType = 'button'>\n extends AriaButtonProps<T>, DOMProps, StyleProps {\n focusClassName?: string;\n variant?: 'overBackground';\n excludeFromTabOrder?: boolean;\n preventFocus?: boolean;\n inset?: boolean;\n}\n\nexport const ClearButton = React.forwardRef(function ClearButton(\n props: ClearButtonProps,\n ref: FocusableRef<HTMLButtonElement>\n) {\n let {\n children = <CrossSmall UNSAFE_className={styles['spectrum-Icon']} />,\n focusClassName,\n variant,\n autoFocus,\n isDisabled,\n preventFocus,\n elementType = preventFocus ? 'div' : ('button' as ElementType),\n inset = false,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref);\n let {buttonProps, isPressed} = useButton({...props, elementType}, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let {styleProps} = useStyleProps(otherProps);\n\n // For cases like the clear button in a search field, remove the tabIndex so\n // iOS 14 with VoiceOver doesn't focus the button and hide the keyboard when\n // moving the cursor over the clear button.\n if (preventFocus) {\n delete buttonProps.tabIndex;\n }\n\n let ElementType = elementType;\n return (\n <FocusRing\n focusRingClass={classNames(styles, 'focus-ring', focusClassName)}\n autoFocus={autoFocus}>\n <ElementType\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps)}\n ref={domRef}\n className={classNames(\n styles,\n 'spectrum-ClearButton',\n {\n [`spectrum-ClearButton--${variant}`]: variant,\n 'is-disabled': isDisabled,\n 'is-active': isPressed,\n 'is-hovered': isHovered,\n 'spectrum-ClearButton--inset': inset\n },\n styleProps.className\n )}>\n {children}\n </ElementType>\n </FocusRing>\n );\n});\n"],"names":[],"version":3,"file":"ClearButton.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAwBM,MAAM,0DAAc,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,YACnD,KAAuB,EACvB,GAAoC;IAEpC,IAAI,YACF,yBAAW,gCAAC,CAAA,GAAA,gCAAS;QAAE,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,gBAAgB;wBAChE,cAAc,WACd,OAAO,aACP,SAAS,cACT,UAAU,gBACV,YAAY,eACZ,cAAc,eAAe,QAAS,iBACtC,QAAQ,OACR,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAAE;QAAC,GAAG,KAAK;qBAAE;IAAW,GAAG;IAClE,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAY,EAAE;IAEjC,4EAA4E;IAC5E,4EAA4E;IAC5E,2CAA2C;IAC3C,IAAI,cACF,gDAAgD;IAChD,OAAO,YAAY,QAAQ;IAG7B,IAAI,cAAc;IAClB,qBACE,gCAAC,CAAA,GAAA,gBAAQ;QACP,gBAAgB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,cAAc;QACjD,WAAW;qBACX,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,WAAW;QACvC,KAAK;QACL,WAAW,CAAA,GAAA,yCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,wBACA;YACE,CAAC,CAAC,sBAAsB,EAAE,SAAS,CAAC,EAAE;YACtC,eAAe;YACf,aAAa;YACb,cAAc;YACd,+BAA+B;QACjC,GACA,WAAW,SAAS;OAErB;AAIT","sources":["packages/@adobe/react-spectrum/src/button/ClearButton.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps, useButton} from 'react-aria/useButton';\n\nimport {classNames} from '../utils/classNames';\nimport CrossSmall from '@spectrum-icons/ui/CrossSmall';\nimport {DOMProps, FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {ElementType} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useHover} from 'react-aria/useHover';\nimport {useStyleProps} from '../utils/styleProps';\n\ninterface ClearButtonProps<T extends ElementType = 'button'>\n extends AriaButtonProps<T>, DOMProps, StyleProps {\n focusClassName?: string;\n variant?: 'overBackground';\n excludeFromTabOrder?: boolean;\n preventFocus?: boolean;\n inset?: boolean;\n}\n\nexport const ClearButton = React.forwardRef(function ClearButton(\n props: ClearButtonProps,\n ref: FocusableRef<HTMLButtonElement>\n) {\n let {\n children = <CrossSmall UNSAFE_className={styles['spectrum-Icon']} />,\n focusClassName,\n variant,\n autoFocus,\n isDisabled,\n preventFocus,\n elementType = preventFocus ? 'div' : ('button' as ElementType),\n inset = false,\n ...otherProps\n } = props;\n let domRef = useFocusableRef(ref);\n let {buttonProps, isPressed} = useButton({...props, elementType}, domRef);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let {styleProps} = useStyleProps(otherProps);\n\n // For cases like the clear button in a search field, remove the tabIndex so\n // iOS 14 with VoiceOver doesn't focus the button and hide the keyboard when\n // moving the cursor over the clear button.\n if (preventFocus) {\n // oxlint-disable-next-line react/react-compiler\n delete buttonProps.tabIndex;\n }\n\n let ElementType = elementType;\n return (\n <FocusRing\n focusRingClass={classNames(styles, 'focus-ring', focusClassName)}\n autoFocus={autoFocus}>\n <ElementType\n {...styleProps}\n {...mergeProps(buttonProps, hoverProps)}\n ref={domRef}\n className={classNames(\n styles,\n 'spectrum-ClearButton',\n {\n [`spectrum-ClearButton--${variant}`]: variant,\n 'is-disabled': isDisabled,\n 'is-active': isPressed,\n 'is-hovered': isHovered,\n 'spectrum-ClearButton--inset': inset\n },\n styleProps.className\n )}>\n {children}\n </ElementType>\n </FocusRing>\n );\n});\n"],"names":[],"version":3,"file":"ClearButton.mjs.map"}
|
|
@@ -50,6 +50,7 @@ const $cae6b34e4dffcb70$export$69b1032f2ecdf404 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
50
50
|
let { styleProps: styleProps } = (0, $b8f90d51c4908137$exports.useStyleProps)(otherProps);
|
|
51
51
|
let domRef = (0, $65aea7b37663976b$exports.useDOMRef)(ref);
|
|
52
52
|
let [hasOverflow, setHasOverflow] = (0, $48ux6$reactariaprivateutilsuseValueEffect.useValueEffect)(false);
|
|
53
|
+
// oxlint-disable react/react-compiler, react-hooks/exhaustive-deps
|
|
53
54
|
let checkForOverflow = (0, $48ux6$react.useCallback)(()=>{
|
|
54
55
|
let computeHasOverflow = ()=>{
|
|
55
56
|
if (domRef.current && orientation === 'horizontal') {
|
|
@@ -67,7 +68,6 @@ const $cae6b34e4dffcb70$export$69b1032f2ecdf404 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
67
68
|
// Measure, and update if there is overflow.
|
|
68
69
|
yield computeHasOverflow();
|
|
69
70
|
});
|
|
70
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
71
71
|
}, [
|
|
72
72
|
domRef,
|
|
73
73
|
orientation,
|
|
@@ -75,6 +75,7 @@ const $cae6b34e4dffcb70$export$69b1032f2ecdf404 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
75
75
|
setHasOverflow,
|
|
76
76
|
children
|
|
77
77
|
]);
|
|
78
|
+
// oxlint-enable react/react-compiler, react-hooks/exhaustive-deps
|
|
78
79
|
// There are two main reasons we need to remeasure:
|
|
79
80
|
// 1. Internal changes: Check for initial overflow or when orientation/scale/children change (from checkForOverflow dep array)
|
|
80
81
|
(0, $48ux6$reactariaprivateutilsuseLayoutEffect.useLayoutEffect)(()=>{
|
|
@@ -84,12 +85,13 @@ const $cae6b34e4dffcb70$export$69b1032f2ecdf404 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
84
85
|
]);
|
|
85
86
|
// 2. External changes: buttongroup won't change size due to any parents changing size, so listen to its container for size changes to figure out if we should remeasure
|
|
86
87
|
let parent = (0, $48ux6$react.useRef)(undefined);
|
|
88
|
+
// oxlint-disable react/react-compiler, react-hooks/exhaustive-deps
|
|
87
89
|
(0, $48ux6$reactariaprivateutilsuseLayoutEffect.useLayoutEffect)(()=>{
|
|
88
90
|
if (domRef.current) parent.current = domRef.current.parentElement;
|
|
89
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
90
91
|
}, [
|
|
91
92
|
domRef.current
|
|
92
93
|
]);
|
|
94
|
+
// oxlint-enable react/react-compiler, react-hooks/exhaustive-deps
|
|
93
95
|
(0, $48ux6$reactariaprivateutilsuseResizeObserver.useResizeObserver)({
|
|
94
96
|
ref: parent,
|
|
95
97
|
onResize: checkForOverflow
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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,OAAO,CAAC,aAAa;IAEjD,GAAG;QAAC,OAAO,OAAO;KAAC;IACnB,kEAAkE;IAClE,CAAA,GAAA,+DAAgB,EAAE;QAAC,KAAK;QAAQ,UAAU;IAAgB;IAE1D,qBACE,0DAAC;QACE,GAAG,CAAA,GAAA,6CAAa,EAAE,WAAW;QAC7B,GAAG,UAAU;QACd,KAAK;QACL,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,wBACA;YACE,kCAAkC,gBAAgB,cAAc;YAChE,kCAAkC,UAAU;YAC5C,qCAAqC,UAAU;QACjD,GACA,WAAW,SAAS;qBAEtB,0DAAC,CAAA,GAAA,sCAAW;QACV,OAAO;YACL,QAAQ;gBACN,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YACvC;QACF;qBACA,0DAAC,CAAA,GAAA,kCAAO;QAAE,YAAY;OAAa;AAI3C","sources":["packages/@adobe/react-spectrum/src/buttongroup/ButtonGroup.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Alignment, DOMProps, DOMRef, Orientation, StyleProps} from '@react-types/shared';\nimport {classNames} from '../utils/classNames';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {Provider, useProvider, useProviderProps} from '../provider/Provider';\nimport React, {ReactNode, useCallback, useRef} from 'react';\nimport {SlotProvider, useSlotProps} from '../utils/Slots';\nimport styles from '@adobe/spectrum-css-temp/components/buttongroup/vars.css';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\nimport {useStyleProps} from '../utils/styleProps';\nimport {useValueEffect} from 'react-aria/private/utils/useValueEffect';\n\nexport interface SpectrumButtonGroupProps extends DOMProps, StyleProps {\n /** Whether the Buttons in the ButtonGroup are all disabled. */\n isDisabled?: boolean;\n /**\n * The axis the ButtonGroup should align with. Setting this to 'vertical' will prevent\n * any switching behaviors between 'vertical' and 'horizontal'.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /** The Buttons contained within the ButtonGroup. */\n children: ReactNode;\n /**\n * The alignment of the buttons within the ButtonGroup.\n *\n * @default 'start'\n */\n align?: Alignment | 'center';\n}\n\n/**\n * ButtonGroup handles overflow for a grouping of buttons whose actions are related to each other.\n */\nexport const ButtonGroup = React.forwardRef(function ButtonGroup(\n props: SpectrumButtonGroupProps,\n ref: DOMRef<HTMLDivElement>\n) {\n let {scale} = useProvider();\n props = useProviderProps(props);\n props = useSlotProps(props, 'buttonGroup');\n\n let {children, orientation = 'horizontal', isDisabled, align = 'start', ...otherProps} = props;\n\n let {styleProps} = useStyleProps(otherProps);\n let domRef = useDOMRef(ref);\n let [hasOverflow, setHasOverflow] = useValueEffect(false);\n\n // oxlint-disable react/react-compiler, react-hooks/exhaustive-deps\n let checkForOverflow = useCallback(() => {\n let computeHasOverflow = () => {\n if (domRef.current && orientation === 'horizontal') {\n let buttonGroupChildren = Array.from(domRef.current.children) as HTMLElement[];\n let maxX = domRef.current.offsetWidth + 1; // + 1 to account for rounding errors\n // If any buttons have negative X positions (align=\"end\") or extend beyond\n // the width of the button group (align=\"start\"), then switch to vertical.\n if (\n buttonGroupChildren.some(\n child => child.offsetLeft < 0 || child.offsetLeft + child.offsetWidth > maxX\n )\n ) {\n return true;\n }\n return false;\n }\n };\n if (orientation === 'horizontal') {\n setHasOverflow(function* () {\n // Force to horizontal for measurement.\n yield false;\n\n // Measure, and update if there is overflow.\n yield computeHasOverflow();\n });\n }\n }, [domRef, orientation, scale, setHasOverflow, children]);\n // oxlint-enable react/react-compiler, react-hooks/exhaustive-deps\n\n // There are two main reasons we need to remeasure:\n // 1. Internal changes: Check for initial overflow or when orientation/scale/children change (from checkForOverflow dep array)\n useLayoutEffect(() => {\n checkForOverflow();\n }, [checkForOverflow]);\n\n // 2. External changes: buttongroup won't change size due to any parents changing size, so listen to its container for size changes to figure out if we should remeasure\n let parent = useRef<HTMLElement>(undefined);\n // oxlint-disable react/react-compiler, react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n if (domRef.current) {\n parent.current = domRef.current.parentElement as HTMLElement;\n }\n }, [domRef.current]);\n // oxlint-enable react/react-compiler, react-hooks/exhaustive-deps\n useResizeObserver({ref: parent, onResize: checkForOverflow});\n\n return (\n <div\n {...filterDOMProps(otherProps)}\n {...styleProps}\n ref={domRef}\n className={classNames(\n styles,\n 'spectrum-ButtonGroup',\n {\n 'spectrum-ButtonGroup--vertical': orientation === 'vertical' || hasOverflow,\n 'spectrum-ButtonGroup--alignEnd': align === 'end',\n 'spectrum-ButtonGroup--alignCenter': align === 'center'\n },\n styleProps.className\n )}>\n <SlotProvider\n slots={{\n button: {\n UNSAFE_className: classNames(styles, 'spectrum-ButtonGroup-Button')\n }\n }}>\n <Provider isDisabled={isDisabled}>{children}</Provider>\n </SlotProvider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ButtonGroup.cjs.map"}
|
|
@@ -44,6 +44,7 @@ const $020e7479c60446a5$export$69b1032f2ecdf404 = /*#__PURE__*/ (0, $8aBSe$react
|
|
|
44
44
|
let { styleProps: styleProps } = (0, $120fbea2d95e11ed$export$b8e6fb9d2dff3f41)(otherProps);
|
|
45
45
|
let domRef = (0, $c234463e9ef56637$export$c2c55ef9111cafd8)(ref);
|
|
46
46
|
let [hasOverflow, setHasOverflow] = (0, $8aBSe$useValueEffect)(false);
|
|
47
|
+
// oxlint-disable react/react-compiler, react-hooks/exhaustive-deps
|
|
47
48
|
let checkForOverflow = (0, $8aBSe$useCallback)(()=>{
|
|
48
49
|
let computeHasOverflow = ()=>{
|
|
49
50
|
if (domRef.current && orientation === 'horizontal') {
|
|
@@ -61,7 +62,6 @@ const $020e7479c60446a5$export$69b1032f2ecdf404 = /*#__PURE__*/ (0, $8aBSe$react
|
|
|
61
62
|
// Measure, and update if there is overflow.
|
|
62
63
|
yield computeHasOverflow();
|
|
63
64
|
});
|
|
64
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
65
|
}, [
|
|
66
66
|
domRef,
|
|
67
67
|
orientation,
|
|
@@ -69,6 +69,7 @@ const $020e7479c60446a5$export$69b1032f2ecdf404 = /*#__PURE__*/ (0, $8aBSe$react
|
|
|
69
69
|
setHasOverflow,
|
|
70
70
|
children
|
|
71
71
|
]);
|
|
72
|
+
// oxlint-enable react/react-compiler, react-hooks/exhaustive-deps
|
|
72
73
|
// There are two main reasons we need to remeasure:
|
|
73
74
|
// 1. Internal changes: Check for initial overflow or when orientation/scale/children change (from checkForOverflow dep array)
|
|
74
75
|
(0, $8aBSe$useLayoutEffect)(()=>{
|
|
@@ -78,12 +79,13 @@ const $020e7479c60446a5$export$69b1032f2ecdf404 = /*#__PURE__*/ (0, $8aBSe$react
|
|
|
78
79
|
]);
|
|
79
80
|
// 2. External changes: buttongroup won't change size due to any parents changing size, so listen to its container for size changes to figure out if we should remeasure
|
|
80
81
|
let parent = (0, $8aBSe$useRef)(undefined);
|
|
82
|
+
// oxlint-disable react/react-compiler, react-hooks/exhaustive-deps
|
|
81
83
|
(0, $8aBSe$useLayoutEffect)(()=>{
|
|
82
84
|
if (domRef.current) parent.current = domRef.current.parentElement;
|
|
83
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
85
|
}, [
|
|
85
86
|
domRef.current
|
|
86
87
|
]);
|
|
88
|
+
// oxlint-enable react/react-compiler, react-hooks/exhaustive-deps
|
|
87
89
|
(0, $8aBSe$useResizeObserver)({
|
|
88
90
|
ref: parent,
|
|
89
91
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AO,EAChB,OAAO,OAAO,GAAG,OAAO,OAAO,CAAC,aAAa;IAEjD,GAAG;QAAC,OAAO,OAAO;KAAC;IACnB,kEAAkE;IAClE,CAAA,GAAA,wBAAgB,EAAE;QAAC,KAAK;QAAQ,UAAU;IAAgB;IAE1D,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,qBAAa,EAAE,WAAW;QAC7B,GAAG,UAAU;QACd,KAAK;QACL,WAAW,CAAA,GAAA,yCAAS,EAClB,CAAA,GAAA,wDAAK,GACL,wBACA;YACE,kCAAkC,gBAAgB,cAAc;YAChE,kCAAkC,UAAU;YAC5C,qCAAqC,UAAU;QACjD,GACA,WAAW,SAAS;qBAEtB,gCAAC,CAAA,GAAA,yCAAW;QACV,OAAO;YACL,QAAQ;gBACN,kBAAkB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,wDAAK,GAAG;YACvC;QACF;qBACA,gCAAC,CAAA,GAAA,yCAAO;QAAE,YAAY;OAAa;AAI3C","sources":["packages/@adobe/react-spectrum/src/buttongroup/ButtonGroup.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Alignment, DOMProps, DOMRef, Orientation, StyleProps} from '@react-types/shared';\nimport {classNames} from '../utils/classNames';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {Provider, useProvider, useProviderProps} from '../provider/Provider';\nimport React, {ReactNode, useCallback, useRef} from 'react';\nimport {SlotProvider, useSlotProps} from '../utils/Slots';\nimport styles from '@adobe/spectrum-css-temp/components/buttongroup/vars.css';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\nimport {useStyleProps} from '../utils/styleProps';\nimport {useValueEffect} from 'react-aria/private/utils/useValueEffect';\n\nexport interface SpectrumButtonGroupProps extends DOMProps, StyleProps {\n /** Whether the Buttons in the ButtonGroup are all disabled. */\n isDisabled?: boolean;\n /**\n * The axis the ButtonGroup should align with. Setting this to 'vertical' will prevent\n * any switching behaviors between 'vertical' and 'horizontal'.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /** The Buttons contained within the ButtonGroup. */\n children: ReactNode;\n /**\n * The alignment of the buttons within the ButtonGroup.\n *\n * @default 'start'\n */\n align?: Alignment | 'center';\n}\n\n/**\n * ButtonGroup handles overflow for a grouping of buttons whose actions are related to each other.\n */\nexport const ButtonGroup = React.forwardRef(function ButtonGroup(\n props: SpectrumButtonGroupProps,\n ref: DOMRef<HTMLDivElement>\n) {\n let {scale} = useProvider();\n props = useProviderProps(props);\n props = useSlotProps(props, 'buttonGroup');\n\n let {children, orientation = 'horizontal', isDisabled, align = 'start', ...otherProps} = props;\n\n let {styleProps} = useStyleProps(otherProps);\n let domRef = useDOMRef(ref);\n let [hasOverflow, setHasOverflow] = useValueEffect(false);\n\n // oxlint-disable react/react-compiler, react-hooks/exhaustive-deps\n let checkForOverflow = useCallback(() => {\n let computeHasOverflow = () => {\n if (domRef.current && orientation === 'horizontal') {\n let buttonGroupChildren = Array.from(domRef.current.children) as HTMLElement[];\n let maxX = domRef.current.offsetWidth + 1; // + 1 to account for rounding errors\n // If any buttons have negative X positions (align=\"end\") or extend beyond\n // the width of the button group (align=\"start\"), then switch to vertical.\n if (\n buttonGroupChildren.some(\n child => child.offsetLeft < 0 || child.offsetLeft + child.offsetWidth > maxX\n )\n ) {\n return true;\n }\n return false;\n }\n };\n if (orientation === 'horizontal') {\n setHasOverflow(function* () {\n // Force to horizontal for measurement.\n yield false;\n\n // Measure, and update if there is overflow.\n yield computeHasOverflow();\n });\n }\n }, [domRef, orientation, scale, setHasOverflow, children]);\n // oxlint-enable react/react-compiler, react-hooks/exhaustive-deps\n\n // There are two main reasons we need to remeasure:\n // 1. Internal changes: Check for initial overflow or when orientation/scale/children change (from checkForOverflow dep array)\n useLayoutEffect(() => {\n checkForOverflow();\n }, [checkForOverflow]);\n\n // 2. External changes: buttongroup won't change size due to any parents changing size, so listen to its container for size changes to figure out if we should remeasure\n let parent = useRef<HTMLElement>(undefined);\n // oxlint-disable react/react-compiler, react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n if (domRef.current) {\n parent.current = domRef.current.parentElement as HTMLElement;\n }\n }, [domRef.current]);\n // oxlint-enable react/react-compiler, react-hooks/exhaustive-deps\n useResizeObserver({ref: parent, onResize: checkForOverflow});\n\n return (\n <div\n {...filterDOMProps(otherProps)}\n {...styleProps}\n ref={domRef}\n className={classNames(\n styles,\n 'spectrum-ButtonGroup',\n {\n 'spectrum-ButtonGroup--vertical': orientation === 'vertical' || hasOverflow,\n 'spectrum-ButtonGroup--alignEnd': align === 'end',\n 'spectrum-ButtonGroup--alignCenter': align === 'center'\n },\n styleProps.className\n )}>\n <SlotProvider\n slots={{\n button: {\n UNSAFE_className: classNames(styles, 'spectrum-ButtonGroup-Button')\n }\n }}>\n <Provider isDisabled={isDisabled}>{children}</Provider>\n </SlotProvider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ButtonGroup.js.map"}
|
|
@@ -44,6 +44,7 @@ const $3a97ced4c1581335$export$69b1032f2ecdf404 = /*#__PURE__*/ (0, $bhDJM$react
|
|
|
44
44
|
let { styleProps: styleProps } = (0, $63d03c54ca5e4b88$export$b8e6fb9d2dff3f41)(otherProps);
|
|
45
45
|
let domRef = (0, $3c2c983d5210446c$export$c2c55ef9111cafd8)(ref);
|
|
46
46
|
let [hasOverflow, setHasOverflow] = (0, $bhDJM$useValueEffect)(false);
|
|
47
|
+
// oxlint-disable react/react-compiler, react-hooks/exhaustive-deps
|
|
47
48
|
let checkForOverflow = (0, $bhDJM$useCallback)(()=>{
|
|
48
49
|
let computeHasOverflow = ()=>{
|
|
49
50
|
if (domRef.current && orientation === 'horizontal') {
|
|
@@ -61,7 +62,6 @@ const $3a97ced4c1581335$export$69b1032f2ecdf404 = /*#__PURE__*/ (0, $bhDJM$react
|
|
|
61
62
|
// Measure, and update if there is overflow.
|
|
62
63
|
yield computeHasOverflow();
|
|
63
64
|
});
|
|
64
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
65
|
}, [
|
|
66
66
|
domRef,
|
|
67
67
|
orientation,
|
|
@@ -69,6 +69,7 @@ const $3a97ced4c1581335$export$69b1032f2ecdf404 = /*#__PURE__*/ (0, $bhDJM$react
|
|
|
69
69
|
setHasOverflow,
|
|
70
70
|
children
|
|
71
71
|
]);
|
|
72
|
+
// oxlint-enable react/react-compiler, react-hooks/exhaustive-deps
|
|
72
73
|
// There are two main reasons we need to remeasure:
|
|
73
74
|
// 1. Internal changes: Check for initial overflow or when orientation/scale/children change (from checkForOverflow dep array)
|
|
74
75
|
(0, $bhDJM$useLayoutEffect)(()=>{
|
|
@@ -78,12 +79,13 @@ const $3a97ced4c1581335$export$69b1032f2ecdf404 = /*#__PURE__*/ (0, $bhDJM$react
|
|
|
78
79
|
]);
|
|
79
80
|
// 2. External changes: buttongroup won't change size due to any parents changing size, so listen to its container for size changes to figure out if we should remeasure
|
|
80
81
|
let parent = (0, $bhDJM$useRef)(undefined);
|
|
82
|
+
// oxlint-disable react/react-compiler, react-hooks/exhaustive-deps
|
|
81
83
|
(0, $bhDJM$useLayoutEffect)(()=>{
|
|
82
84
|
if (domRef.current) parent.current = domRef.current.parentElement;
|
|
83
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
85
|
}, [
|
|
85
86
|
domRef.current
|
|
86
87
|
]);
|
|
88
|
+
// oxlint-enable react/react-compiler, react-hooks/exhaustive-deps
|
|
87
89
|
(0, $bhDJM$useResizeObserver)({
|
|
88
90
|
ref: parent,
|
|
89
91
|
onResize: checkForOverflow
|