@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
|
@@ -104,6 +104,7 @@ const $48b99bf0df8f69a7$export$67ea30858aaf75e3 = /*#__PURE__*/ (0, $6fk2n$react
|
|
|
104
104
|
tagsRef
|
|
105
105
|
]);
|
|
106
106
|
// Remove onAction from props so it doesn't make it into useGridList.
|
|
107
|
+
// oxlint-disable-next-line react/react-compiler
|
|
107
108
|
delete props.onAction;
|
|
108
109
|
let { gridProps: gridProps, labelProps: labelProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $6fk2n$useTagGroup)({
|
|
109
110
|
...props,
|
|
@@ -173,6 +174,7 @@ const $48b99bf0df8f69a7$export$67ea30858aaf75e3 = /*#__PURE__*/ (0, $6fk2n$react
|
|
|
173
174
|
yield computeVisibleTagCount();
|
|
174
175
|
});
|
|
175
176
|
}
|
|
177
|
+
// oxlint-disable-next-line react/react-compiler
|
|
176
178
|
}, [
|
|
177
179
|
maxRows,
|
|
178
180
|
setTagState,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;AAiCD,MAAM,mCAAa;IACjB,QAAQ;QACN,QAAQ;QACR,QAAQ;IACV;IACA,OAAO;QACL,QAAQ;QACR,QAAQ;IACV;AACF;AAkCO,MAAM,0DAAW,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,SAChD,KAA+B,EAC/B,GAA2B;IAE3B,QAAQ,CAAA,GAAA,yCAAe,EAAE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Ae,CAAC,yBACf,gCAAC,CAAA,GAAA,yCAAO;QAAE,YAAY;qBACpB,gCAAC;QACC,MAAK;QACL,KAAK;QACL,IAAI;QACJ,cAAY,gBAAgB,MAAM,CAAC;QACnC,mBAAiB,GAAG,UAAU,EAAE,CAAC,CAAC,EAAE,WAAW;QAC/C,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,iDAAK,GAAG;OAC7B,SAAS,kBAAkB,kBAC1B,gCAAC,CAAA,GAAA,yCAAW;QACV,SAAA;QACA,SAAS;QACT,kBAAkB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,iDAAK,GAAG;OACpC,cACG,gBAAgB,MAAM,CAAC,sBAAsB;QAC3C,UAAU,MAAM,UAAU,CAAC,IAAI;IACjC,KACA,gBAAgB,MAAM,CAAC,qBAG9B,eAAe,0BACd,gCAAC,CAAA,GAAA,yCAAW;QACV,SAAA;QACA,SAAS,IAAM,qBAAA,+BAAA;QACf,kBAAkB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,iDAAK,GAAG;OACpC;AAUrB","sources":["packages/@adobe/react-spectrum/src/tag/TagGroup.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 {ActionButton} from '../button/ActionButton';\nimport {AriaTagGroupProps, useTagGroup} from 'react-aria/useTagGroup';\nimport {classNames} from '../utils/classNames';\nimport {\n Collection,\n DOMRef,\n Node,\n SpectrumLabelableProps,\n StyleProps,\n Validation\n} from '@react-types/shared';\nimport {Field} from '../label/Field';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport intlMessages from '../../intl/tag/*.json';\nimport {ListCollection} from 'react-stately/private/list/ListCollection';\nimport {ListKeyboardDelegate} from 'react-aria/ListKeyboardDelegate';\nimport {Provider, useProvider, useProviderProps} from '../provider/Provider';\nimport React, {JSX, ReactNode, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/tags/vars.css';\nimport {Tag} from './Tag';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useFormProps} from '../form/Form';\nimport {useId} from 'react-aria/useId';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useListState} from 'react-stately/useListState';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\nimport {useValueEffect} from 'react-aria/private/utils/useValueEffect';\n\nconst TAG_STYLES = {\n medium: {\n height: 24,\n margin: 4\n },\n large: {\n height: 30,\n margin: 5\n }\n};\n\nexport interface SpectrumTagGroupProps<T>\n extends\n Omit<\n AriaTagGroupProps<T>,\n | 'selectionMode'\n | 'disallowEmptySelection'\n | 'selectedKeys'\n | 'defaultSelectedKeys'\n | 'onSelectionChange'\n | 'selectionBehavior'\n | 'disabledKeys'\n >,\n StyleProps,\n Omit<SpectrumLabelableProps, 'isRequired' | 'necessityIndicator'>,\n Pick<Validation<any>, 'isInvalid' | 'validationState'> {\n /** The label to display on the action button. */\n actionLabel?: string;\n /** Handler that is called when the action button is pressed. */\n onAction?: () => void;\n /** Sets what the TagGroup should render when there are no tags to display. */\n renderEmptyState?: () => JSX.Element;\n /**\n * Limit the number of rows initially shown. This will render a button that allows the user to\n * expand to show all tags.\n */\n maxRows?: number;\n}\n\n/**\n * Tags allow users to categorize content. They can represent keywords or people, and are grouped to\n * describe an item or a search request.\n */\nexport const TagGroup = React.forwardRef(function TagGroup<T extends object>(\n props: SpectrumTagGroupProps<T>,\n ref: DOMRef<HTMLDivElement>\n) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n maxRows,\n children,\n actionLabel,\n onAction,\n labelPosition,\n renderEmptyState = () => stringFormatter.format('noTags')\n } = props;\n let domRef = useDOMRef(ref);\n let containerRef = useRef<HTMLDivElement>(null);\n let tagsRef = useRef<HTMLDivElement | null>(null);\n let {direction} = useLocale();\n let {scale} = useProvider();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/tag');\n let [isCollapsed, setIsCollapsed] = useState(maxRows != null);\n let state = useListState(props);\n let [tagState, setTagState] = useValueEffect({\n visibleTagCount: state.collection.size,\n showCollapseButton: false\n });\n let keyboardDelegate = useMemo(() => {\n let collection = (\n isCollapsed\n ? new ListCollection([...state.collection].slice(0, tagState.visibleTagCount))\n : new ListCollection([...state.collection])\n ) as Collection<Node<T>>;\n return new ListKeyboardDelegate({\n collection,\n ref: tagsRef,\n direction,\n orientation: 'horizontal'\n });\n }, [\n direction,\n isCollapsed,\n state.collection,\n tagState.visibleTagCount,\n tagsRef\n ]) as ListKeyboardDelegate<T>;\n // Remove onAction from props so it doesn't make it into useGridList.\n delete props.onAction;\n let {gridProps, labelProps, descriptionProps, errorMessageProps} = useTagGroup(\n {...props, keyboardDelegate},\n state,\n tagsRef\n );\n let actionsId = useId();\n let actionsRef = useRef<HTMLDivElement>(null);\n\n let updateVisibleTagCount = useCallback(() => {\n if (maxRows && maxRows > 0) {\n let computeVisibleTagCount = () => {\n // Refs can be null at runtime.\n let currContainerRef: HTMLDivElement | null = containerRef.current;\n let currTagsRef: HTMLDivElement | null = tagsRef.current;\n let currActionsRef: HTMLDivElement | null = actionsRef.current;\n if (!currContainerRef || !currTagsRef || !currActionsRef || state.collection.size === 0) {\n return {\n visibleTagCount: 0,\n showCollapseButton: false\n };\n }\n\n // Count rows and show tags until we hit the maxRows.\n let tags = [...currTagsRef.children];\n let currY = -Infinity;\n let rowCount = 0;\n let index = 0;\n let tagWidths: number[] = [];\n for (let tag of tags) {\n let {width, y} = tag.getBoundingClientRect();\n\n if (y !== currY) {\n currY = y;\n rowCount++;\n }\n\n if (maxRows && rowCount > maxRows) {\n break;\n }\n tagWidths.push(width);\n index++;\n }\n\n // Remove tags until there is space for the collapse button and action button (if present) on the last row.\n let buttons = [...currActionsRef.children];\n if (\n maxRows &&\n buttons.length > 0 &&\n rowCount >= maxRows &&\n currContainerRef.parentElement\n ) {\n let buttonsWidth = buttons.reduce(\n (acc, curr) => (acc += curr.getBoundingClientRect().width),\n 0\n );\n buttonsWidth += TAG_STYLES[scale].margin * 2 * buttons.length;\n let end = direction === 'ltr' ? 'right' : 'left';\n let containerEnd = currContainerRef.parentElement.getBoundingClientRect()[end];\n let lastTagEnd = tags[index - 1]?.getBoundingClientRect()[end];\n lastTagEnd += TAG_STYLES[scale].margin;\n let availableWidth = containerEnd - lastTagEnd;\n\n while (availableWidth < buttonsWidth && index > 0) {\n availableWidth += tagWidths.pop()!;\n index--;\n }\n }\n\n return {\n visibleTagCount: Math.max(index, 1),\n showCollapseButton: index < state.collection.size\n };\n };\n\n setTagState(function* () {\n // Update to show all items.\n yield {visibleTagCount: state.collection.size, showCollapseButton: true};\n\n // Measure, and update to show the items until maxRows is reached.\n yield computeVisibleTagCount();\n });\n }\n }, [maxRows, setTagState, direction, scale, state.collection.size]);\n\n useResizeObserver({ref: containerRef, onResize: updateVisibleTagCount});\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updateVisibleTagCount, [children]);\n\n useEffect(() => {\n // Recalculate visible tags when fonts are loaded.\n document.fonts?.ready.then(() => updateVisibleTagCount());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let visibleTags = useMemo(\n () =>\n [...state.collection].slice(\n 0,\n isCollapsed ? tagState.visibleTagCount : state.collection.size\n ),\n [isCollapsed, state.collection, tagState.visibleTagCount]\n );\n\n let handlePressCollapse = () => {\n // Prevents button from losing focus if focusedKey got collapsed.\n state.selectionManager.setFocusedKey(null);\n setIsCollapsed(prevCollapsed => !prevCollapsed);\n };\n\n let showActions = tagState.showCollapseButton || (actionLabel && onAction);\n let isEmpty = state.collection.size === 0;\n\n let containerStyle = useMemo(() => {\n if (maxRows == null || !isCollapsed || isEmpty) {\n return undefined;\n }\n let maxHeight = (TAG_STYLES[scale].height + TAG_STYLES[scale].margin * 2) * maxRows;\n return {maxHeight, overflow: 'hidden'};\n }, [isCollapsed, maxRows, isEmpty, scale]);\n\n return (\n <FocusScope>\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n showErrorIcon\n ref={domRef}\n elementType=\"span\"\n wrapperClassName={classNames(styles, 'spectrum-Tags-fieldWrapper', {\n 'spectrum-Tags-fieldWrapper--positionSide': labelPosition === 'side'\n })}>\n <div\n ref={containerRef}\n style={containerStyle}\n className={classNames(styles, 'spectrum-Tags-container', {\n 'spectrum-Tags-container--empty': isEmpty\n })}>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <div ref={tagsRef} {...gridProps} className={classNames(styles, 'spectrum-Tags')}>\n {visibleTags.map(item => (\n <Tag {...item.props} key={item.key} item={item} state={state}>\n {item.rendered}\n </Tag>\n ))}\n {isEmpty && (\n <div className={classNames(styles, 'spectrum-Tags-empty-state')}>\n {renderEmptyState()}\n </div>\n )}\n </div>\n </FocusRing>\n {showActions && !isEmpty && (\n <Provider isDisabled={false}>\n <div\n role=\"group\"\n ref={actionsRef}\n id={actionsId}\n aria-label={stringFormatter.format('actions')}\n aria-labelledby={`${gridProps.id} ${actionsId}`}\n className={classNames(styles, 'spectrum-Tags-actions')}>\n {tagState.showCollapseButton && (\n <ActionButton\n isQuiet\n onPress={handlePressCollapse}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {isCollapsed\n ? stringFormatter.format('showAllButtonLabel', {\n tagCount: state.collection.size\n })\n : stringFormatter.format('hideButtonLabel')}\n </ActionButton>\n )}\n {actionLabel && onAction && (\n <ActionButton\n isQuiet\n onPress={() => onAction?.()}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {actionLabel}\n </ActionButton>\n )}\n </div>\n </Provider>\n )}\n </div>\n </Field>\n </FocusScope>\n );\n}) as <T>(props: SpectrumTagGroupProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactNode;\n"],"names":[],"version":3,"file":"TagGroup.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;AAiCD,MAAM,mCAAa;IACjB,QAAQ;QACN,QAAQ;QACR,QAAQ;IACV;IACA,OAAO;QACL,QAAQ;QACR,QAAQ;IACV;AACF;AAkCO,MAAM,0DAAW,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,SAChD,KAA+B,EAC/B,GAA2B;IAE3B,QAAQ,CAAA,GAAA,yCAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,yCAAW,EAAE;IACrB,IAAI,WACF,OAAO,YACP,QAAQ,eACR,WAAW,YACX,QAAQ,iBACR,aAAa,oBACb,mBAAmB,IAAM,gBAAgB,MAAM,CAAC,WACjD,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,yCAAQ,EAAE;IACvB,IAAI,eAAe,CAAA,GAAA,aAAK,EAAkB;IAC1C,IAAI,UAAU,CAAA,GAAA,aAAK,EAAyB;IAC5C,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,yCAAU;IACxB,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,8CAAW,GAAG;IAChE,IAAI,CAAC,aAAa,eAAe,GAAG,CAAA,GAAA,eAAO,EAAE,WAAW;IACxD,IAAI,QAAQ,CAAA,GAAA,mBAAW,EAAE;IACzB,IAAI,CAAC,UAAU,YAAY,GAAG,C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AAkB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,iDAAK,GAAG;OACpC;AAUrB","sources":["packages/@adobe/react-spectrum/src/tag/TagGroup.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 {ActionButton} from '../button/ActionButton';\nimport {AriaTagGroupProps, useTagGroup} from 'react-aria/useTagGroup';\nimport {classNames} from '../utils/classNames';\nimport {\n Collection,\n DOMRef,\n Node,\n SpectrumLabelableProps,\n StyleProps,\n Validation\n} from '@react-types/shared';\nimport {Field} from '../label/Field';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport intlMessages from '../../intl/tag/*.json';\nimport {ListCollection} from 'react-stately/private/list/ListCollection';\nimport {ListKeyboardDelegate} from 'react-aria/ListKeyboardDelegate';\nimport {Provider, useProvider, useProviderProps} from '../provider/Provider';\nimport React, {JSX, ReactNode, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/tags/vars.css';\nimport {Tag} from './Tag';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useFormProps} from '../form/Form';\nimport {useId} from 'react-aria/useId';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useListState} from 'react-stately/useListState';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\nimport {useValueEffect} from 'react-aria/private/utils/useValueEffect';\n\nconst TAG_STYLES = {\n medium: {\n height: 24,\n margin: 4\n },\n large: {\n height: 30,\n margin: 5\n }\n};\n\nexport interface SpectrumTagGroupProps<T>\n extends\n Omit<\n AriaTagGroupProps<T>,\n | 'selectionMode'\n | 'disallowEmptySelection'\n | 'selectedKeys'\n | 'defaultSelectedKeys'\n | 'onSelectionChange'\n | 'selectionBehavior'\n | 'disabledKeys'\n >,\n StyleProps,\n Omit<SpectrumLabelableProps, 'isRequired' | 'necessityIndicator'>,\n Pick<Validation<any>, 'isInvalid' | 'validationState'> {\n /** The label to display on the action button. */\n actionLabel?: string;\n /** Handler that is called when the action button is pressed. */\n onAction?: () => void;\n /** Sets what the TagGroup should render when there are no tags to display. */\n renderEmptyState?: () => JSX.Element;\n /**\n * Limit the number of rows initially shown. This will render a button that allows the user to\n * expand to show all tags.\n */\n maxRows?: number;\n}\n\n/**\n * Tags allow users to categorize content. They can represent keywords or people, and are grouped to\n * describe an item or a search request.\n */\nexport const TagGroup = React.forwardRef(function TagGroup<T extends object>(\n props: SpectrumTagGroupProps<T>,\n ref: DOMRef<HTMLDivElement>\n) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n maxRows,\n children,\n actionLabel,\n onAction,\n labelPosition,\n renderEmptyState = () => stringFormatter.format('noTags')\n } = props;\n let domRef = useDOMRef(ref);\n let containerRef = useRef<HTMLDivElement>(null);\n let tagsRef = useRef<HTMLDivElement | null>(null);\n let {direction} = useLocale();\n let {scale} = useProvider();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/tag');\n let [isCollapsed, setIsCollapsed] = useState(maxRows != null);\n let state = useListState(props);\n let [tagState, setTagState] = useValueEffect({\n visibleTagCount: state.collection.size,\n showCollapseButton: false\n });\n let keyboardDelegate = useMemo(() => {\n let collection = (\n isCollapsed\n ? new ListCollection([...state.collection].slice(0, tagState.visibleTagCount))\n : new ListCollection([...state.collection])\n ) as Collection<Node<T>>;\n return new ListKeyboardDelegate({\n collection,\n ref: tagsRef,\n direction,\n orientation: 'horizontal'\n });\n }, [\n direction,\n isCollapsed,\n state.collection,\n tagState.visibleTagCount,\n tagsRef\n ]) as ListKeyboardDelegate<T>;\n // Remove onAction from props so it doesn't make it into useGridList.\n // oxlint-disable-next-line react/react-compiler\n delete props.onAction;\n let {gridProps, labelProps, descriptionProps, errorMessageProps} = useTagGroup(\n {...props, keyboardDelegate},\n state,\n tagsRef\n );\n let actionsId = useId();\n let actionsRef = useRef<HTMLDivElement>(null);\n\n let updateVisibleTagCount = useCallback(() => {\n if (maxRows && maxRows > 0) {\n let computeVisibleTagCount = () => {\n // Refs can be null at runtime.\n let currContainerRef: HTMLDivElement | null = containerRef.current;\n let currTagsRef: HTMLDivElement | null = tagsRef.current;\n let currActionsRef: HTMLDivElement | null = actionsRef.current;\n if (!currContainerRef || !currTagsRef || !currActionsRef || state.collection.size === 0) {\n return {\n visibleTagCount: 0,\n showCollapseButton: false\n };\n }\n\n // Count rows and show tags until we hit the maxRows.\n let tags = [...currTagsRef.children];\n let currY = -Infinity;\n let rowCount = 0;\n let index = 0;\n let tagWidths: number[] = [];\n for (let tag of tags) {\n let {width, y} = tag.getBoundingClientRect();\n\n if (y !== currY) {\n currY = y;\n rowCount++;\n }\n\n if (maxRows && rowCount > maxRows) {\n break;\n }\n tagWidths.push(width);\n index++;\n }\n\n // Remove tags until there is space for the collapse button and action button (if present) on the last row.\n let buttons = [...currActionsRef.children];\n if (\n maxRows &&\n buttons.length > 0 &&\n rowCount >= maxRows &&\n currContainerRef.parentElement\n ) {\n let buttonsWidth = buttons.reduce(\n (acc, curr) => (acc += curr.getBoundingClientRect().width),\n 0\n );\n buttonsWidth += TAG_STYLES[scale].margin * 2 * buttons.length;\n let end = direction === 'ltr' ? 'right' : 'left';\n let containerEnd = currContainerRef.parentElement.getBoundingClientRect()[end];\n let lastTagEnd = tags[index - 1]?.getBoundingClientRect()[end];\n lastTagEnd += TAG_STYLES[scale].margin;\n let availableWidth = containerEnd - lastTagEnd;\n\n while (availableWidth < buttonsWidth && index > 0) {\n availableWidth += tagWidths.pop()!;\n index--;\n }\n }\n\n return {\n visibleTagCount: Math.max(index, 1),\n showCollapseButton: index < state.collection.size\n };\n };\n\n setTagState(function* () {\n // Update to show all items.\n yield {visibleTagCount: state.collection.size, showCollapseButton: true};\n\n // Measure, and update to show the items until maxRows is reached.\n yield computeVisibleTagCount();\n });\n }\n // oxlint-disable-next-line react/react-compiler\n }, [maxRows, setTagState, direction, scale, state.collection.size]);\n\n useResizeObserver({ref: containerRef, onResize: updateVisibleTagCount});\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updateVisibleTagCount, [children]);\n\n useEffect(() => {\n // Recalculate visible tags when fonts are loaded.\n document.fonts?.ready.then(() => updateVisibleTagCount());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let visibleTags = useMemo(\n () =>\n [...state.collection].slice(\n 0,\n isCollapsed ? tagState.visibleTagCount : state.collection.size\n ),\n [isCollapsed, state.collection, tagState.visibleTagCount]\n );\n\n let handlePressCollapse = () => {\n // Prevents button from losing focus if focusedKey got collapsed.\n state.selectionManager.setFocusedKey(null);\n setIsCollapsed(prevCollapsed => !prevCollapsed);\n };\n\n let showActions = tagState.showCollapseButton || (actionLabel && onAction);\n let isEmpty = state.collection.size === 0;\n\n let containerStyle = useMemo(() => {\n if (maxRows == null || !isCollapsed || isEmpty) {\n return undefined;\n }\n let maxHeight = (TAG_STYLES[scale].height + TAG_STYLES[scale].margin * 2) * maxRows;\n return {maxHeight, overflow: 'hidden'};\n }, [isCollapsed, maxRows, isEmpty, scale]);\n\n return (\n <FocusScope>\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n showErrorIcon\n ref={domRef}\n elementType=\"span\"\n wrapperClassName={classNames(styles, 'spectrum-Tags-fieldWrapper', {\n 'spectrum-Tags-fieldWrapper--positionSide': labelPosition === 'side'\n })}>\n <div\n ref={containerRef}\n style={containerStyle}\n className={classNames(styles, 'spectrum-Tags-container', {\n 'spectrum-Tags-container--empty': isEmpty\n })}>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <div ref={tagsRef} {...gridProps} className={classNames(styles, 'spectrum-Tags')}>\n {visibleTags.map(item => (\n <Tag {...item.props} key={item.key} item={item} state={state}>\n {item.rendered}\n </Tag>\n ))}\n {isEmpty && (\n <div className={classNames(styles, 'spectrum-Tags-empty-state')}>\n {renderEmptyState()}\n </div>\n )}\n </div>\n </FocusRing>\n {showActions && !isEmpty && (\n <Provider isDisabled={false}>\n <div\n role=\"group\"\n ref={actionsRef}\n id={actionsId}\n aria-label={stringFormatter.format('actions')}\n aria-labelledby={`${gridProps.id} ${actionsId}`}\n className={classNames(styles, 'spectrum-Tags-actions')}>\n {tagState.showCollapseButton && (\n <ActionButton\n isQuiet\n onPress={handlePressCollapse}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {isCollapsed\n ? stringFormatter.format('showAllButtonLabel', {\n tagCount: state.collection.size\n })\n : stringFormatter.format('hideButtonLabel')}\n </ActionButton>\n )}\n {actionLabel && onAction && (\n <ActionButton\n isQuiet\n onPress={() => onAction?.()}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {actionLabel}\n </ActionButton>\n )}\n </div>\n </Provider>\n )}\n </div>\n </Field>\n </FocusScope>\n );\n}) as <T>(props: SpectrumTagGroupProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactNode;\n"],"names":[],"version":3,"file":"TagGroup.js.map"}
|
|
@@ -104,6 +104,7 @@ const $8811b88ab1333b3f$export$67ea30858aaf75e3 = /*#__PURE__*/ (0, $c2J0Y$react
|
|
|
104
104
|
tagsRef
|
|
105
105
|
]);
|
|
106
106
|
// Remove onAction from props so it doesn't make it into useGridList.
|
|
107
|
+
// oxlint-disable-next-line react/react-compiler
|
|
107
108
|
delete props.onAction;
|
|
108
109
|
let { gridProps: gridProps, labelProps: labelProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $c2J0Y$useTagGroup)({
|
|
109
110
|
...props,
|
|
@@ -172,6 +173,7 @@ const $8811b88ab1333b3f$export$67ea30858aaf75e3 = /*#__PURE__*/ (0, $c2J0Y$react
|
|
|
172
173
|
yield computeVisibleTagCount();
|
|
173
174
|
});
|
|
174
175
|
}
|
|
176
|
+
// oxlint-disable-next-line react/react-compiler
|
|
175
177
|
}, [
|
|
176
178
|
maxRows,
|
|
177
179
|
setTagState,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;AAiCD,MAAM,mCAAa;IACjB,QAAQ;QACN,QAAQ;QACR,QAAQ;IACV;IACA,OAAO;QACL,QAAQ;QACR,QAAQ;IACV;AACF;AAkCO,MAAM,0DAAW,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,SAChD,KAA+B,EAC/B,GAA2B;IAE3B,QAAQ,CAAA,GAAA,yCAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,yCAAW,EAAE;IACrB,IAAI,WACF,OAAO,YACP,QAAQ,eACR,WAAW,YACX,QAAQ,iBACR,aAAa,oBACb,mBAAmB,IAAM,gBAAgB,MAAM,CAAC,WACjD,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,yCAAQ,EAAE;IACvB,IAAI,eAAe,CAAA,GAAA,aAAK,EAAkB;IAC1C,IAAI,UAAU,CAAA,GAAA,aAAK,EAAyB;IAC5C,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,yCAAU;IACxB,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,+CAAW,GAAG;IAChE,IAAI,CAAC,aAAa,eAAe,GAAG,CAAA,GAAA,eAAO,EAAE,WAAW;IACxD,IAAI,QAAQ,CAAA,GAA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","sources":["packages/@adobe/react-spectrum/src/tag/TagGroup.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 {ActionButton} from '../button/ActionButton';\nimport {AriaTagGroupProps, useTagGroup} from 'react-aria/useTagGroup';\nimport {classNames} from '../utils/classNames';\nimport {\n Collection,\n DOMRef,\n Node,\n SpectrumLabelableProps,\n StyleProps,\n Validation\n} from '@react-types/shared';\nimport {Field} from '../label/Field';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport intlMessages from '../../intl/tag/*.json';\nimport {ListCollection} from 'react-stately/private/list/ListCollection';\nimport {ListKeyboardDelegate} from 'react-aria/ListKeyboardDelegate';\nimport {Provider, useProvider, useProviderProps} from '../provider/Provider';\nimport React, {JSX, ReactNode, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/tags/vars.css';\nimport {Tag} from './Tag';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useFormProps} from '../form/Form';\nimport {useId} from 'react-aria/useId';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useListState} from 'react-stately/useListState';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\nimport {useValueEffect} from 'react-aria/private/utils/useValueEffect';\n\nconst TAG_STYLES = {\n medium: {\n height: 24,\n margin: 4\n },\n large: {\n height: 30,\n margin: 5\n }\n};\n\nexport interface SpectrumTagGroupProps<T>\n extends\n Omit<\n AriaTagGroupProps<T>,\n | 'selectionMode'\n | 'disallowEmptySelection'\n | 'selectedKeys'\n | 'defaultSelectedKeys'\n | 'onSelectionChange'\n | 'selectionBehavior'\n | 'disabledKeys'\n >,\n StyleProps,\n Omit<SpectrumLabelableProps, 'isRequired' | 'necessityIndicator'>,\n Pick<Validation<any>, 'isInvalid' | 'validationState'> {\n /** The label to display on the action button. */\n actionLabel?: string;\n /** Handler that is called when the action button is pressed. */\n onAction?: () => void;\n /** Sets what the TagGroup should render when there are no tags to display. */\n renderEmptyState?: () => JSX.Element;\n /**\n * Limit the number of rows initially shown. This will render a button that allows the user to\n * expand to show all tags.\n */\n maxRows?: number;\n}\n\n/**\n * Tags allow users to categorize content. They can represent keywords or people, and are grouped to\n * describe an item or a search request.\n */\nexport const TagGroup = React.forwardRef(function TagGroup<T extends object>(\n props: SpectrumTagGroupProps<T>,\n ref: DOMRef<HTMLDivElement>\n) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n maxRows,\n children,\n actionLabel,\n onAction,\n labelPosition,\n renderEmptyState = () => stringFormatter.format('noTags')\n } = props;\n let domRef = useDOMRef(ref);\n let containerRef = useRef<HTMLDivElement>(null);\n let tagsRef = useRef<HTMLDivElement | null>(null);\n let {direction} = useLocale();\n let {scale} = useProvider();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/tag');\n let [isCollapsed, setIsCollapsed] = useState(maxRows != null);\n let state = useListState(props);\n let [tagState, setTagState] = useValueEffect({\n visibleTagCount: state.collection.size,\n showCollapseButton: false\n });\n let keyboardDelegate = useMemo(() => {\n let collection = (\n isCollapsed\n ? new ListCollection([...state.collection].slice(0, tagState.visibleTagCount))\n : new ListCollection([...state.collection])\n ) as Collection<Node<T>>;\n return new ListKeyboardDelegate({\n collection,\n ref: tagsRef,\n direction,\n orientation: 'horizontal'\n });\n }, [\n direction,\n isCollapsed,\n state.collection,\n tagState.visibleTagCount,\n tagsRef\n ]) as ListKeyboardDelegate<T>;\n // Remove onAction from props so it doesn't make it into useGridList.\n delete props.onAction;\n let {gridProps, labelProps, descriptionProps, errorMessageProps} = useTagGroup(\n {...props, keyboardDelegate},\n state,\n tagsRef\n );\n let actionsId = useId();\n let actionsRef = useRef<HTMLDivElement>(null);\n\n let updateVisibleTagCount = useCallback(() => {\n if (maxRows && maxRows > 0) {\n let computeVisibleTagCount = () => {\n // Refs can be null at runtime.\n let currContainerRef: HTMLDivElement | null = containerRef.current;\n let currTagsRef: HTMLDivElement | null = tagsRef.current;\n let currActionsRef: HTMLDivElement | null = actionsRef.current;\n if (!currContainerRef || !currTagsRef || !currActionsRef || state.collection.size === 0) {\n return {\n visibleTagCount: 0,\n showCollapseButton: false\n };\n }\n\n // Count rows and show tags until we hit the maxRows.\n let tags = [...currTagsRef.children];\n let currY = -Infinity;\n let rowCount = 0;\n let index = 0;\n let tagWidths: number[] = [];\n for (let tag of tags) {\n let {width, y} = tag.getBoundingClientRect();\n\n if (y !== currY) {\n currY = y;\n rowCount++;\n }\n\n if (maxRows && rowCount > maxRows) {\n break;\n }\n tagWidths.push(width);\n index++;\n }\n\n // Remove tags until there is space for the collapse button and action button (if present) on the last row.\n let buttons = [...currActionsRef.children];\n if (\n maxRows &&\n buttons.length > 0 &&\n rowCount >= maxRows &&\n currContainerRef.parentElement\n ) {\n let buttonsWidth = buttons.reduce(\n (acc, curr) => (acc += curr.getBoundingClientRect().width),\n 0\n );\n buttonsWidth += TAG_STYLES[scale].margin * 2 * buttons.length;\n let end = direction === 'ltr' ? 'right' : 'left';\n let containerEnd = currContainerRef.parentElement.getBoundingClientRect()[end];\n let lastTagEnd = tags[index - 1]?.getBoundingClientRect()[end];\n lastTagEnd += TAG_STYLES[scale].margin;\n let availableWidth = containerEnd - lastTagEnd;\n\n while (availableWidth < buttonsWidth && index > 0) {\n availableWidth += tagWidths.pop()!;\n index--;\n }\n }\n\n return {\n visibleTagCount: Math.max(index, 1),\n showCollapseButton: index < state.collection.size\n };\n };\n\n setTagState(function* () {\n // Update to show all items.\n yield {visibleTagCount: state.collection.size, showCollapseButton: true};\n\n // Measure, and update to show the items until maxRows is reached.\n yield computeVisibleTagCount();\n });\n }\n }, [maxRows, setTagState, direction, scale, state.collection.size]);\n\n useResizeObserver({ref: containerRef, onResize: updateVisibleTagCount});\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updateVisibleTagCount, [children]);\n\n useEffect(() => {\n // Recalculate visible tags when fonts are loaded.\n document.fonts?.ready.then(() => updateVisibleTagCount());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let visibleTags = useMemo(\n () =>\n [...state.collection].slice(\n 0,\n isCollapsed ? tagState.visibleTagCount : state.collection.size\n ),\n [isCollapsed, state.collection, tagState.visibleTagCount]\n );\n\n let handlePressCollapse = () => {\n // Prevents button from losing focus if focusedKey got collapsed.\n state.selectionManager.setFocusedKey(null);\n setIsCollapsed(prevCollapsed => !prevCollapsed);\n };\n\n let showActions = tagState.showCollapseButton || (actionLabel && onAction);\n let isEmpty = state.collection.size === 0;\n\n let containerStyle = useMemo(() => {\n if (maxRows == null || !isCollapsed || isEmpty) {\n return undefined;\n }\n let maxHeight = (TAG_STYLES[scale].height + TAG_STYLES[scale].margin * 2) * maxRows;\n return {maxHeight, overflow: 'hidden'};\n }, [isCollapsed, maxRows, isEmpty, scale]);\n\n return (\n <FocusScope>\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n showErrorIcon\n ref={domRef}\n elementType=\"span\"\n wrapperClassName={classNames(styles, 'spectrum-Tags-fieldWrapper', {\n 'spectrum-Tags-fieldWrapper--positionSide': labelPosition === 'side'\n })}>\n <div\n ref={containerRef}\n style={containerStyle}\n className={classNames(styles, 'spectrum-Tags-container', {\n 'spectrum-Tags-container--empty': isEmpty\n })}>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <div ref={tagsRef} {...gridProps} className={classNames(styles, 'spectrum-Tags')}>\n {visibleTags.map(item => (\n <Tag {...item.props} key={item.key} item={item} state={state}>\n {item.rendered}\n </Tag>\n ))}\n {isEmpty && (\n <div className={classNames(styles, 'spectrum-Tags-empty-state')}>\n {renderEmptyState()}\n </div>\n )}\n </div>\n </FocusRing>\n {showActions && !isEmpty && (\n <Provider isDisabled={false}>\n <div\n role=\"group\"\n ref={actionsRef}\n id={actionsId}\n aria-label={stringFormatter.format('actions')}\n aria-labelledby={`${gridProps.id} ${actionsId}`}\n className={classNames(styles, 'spectrum-Tags-actions')}>\n {tagState.showCollapseButton && (\n <ActionButton\n isQuiet\n onPress={handlePressCollapse}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {isCollapsed\n ? stringFormatter.format('showAllButtonLabel', {\n tagCount: state.collection.size\n })\n : stringFormatter.format('hideButtonLabel')}\n </ActionButton>\n )}\n {actionLabel && onAction && (\n <ActionButton\n isQuiet\n onPress={() => onAction?.()}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {actionLabel}\n </ActionButton>\n )}\n </div>\n </Provider>\n )}\n </div>\n </Field>\n </FocusScope>\n );\n}) as <T>(props: SpectrumTagGroupProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactNode;\n"],"names":[],"version":3,"file":"TagGroup.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;AAiCD,MAAM,mCAAa;IACjB,QAAQ;QACN,QAAQ;QACR,QAAQ;IACV;IACA,OAAO;QACL,QAAQ;QACR,QAAQ;IACV;AACF;AAkCO,MAAM,0DAAW,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,SAChD,KAA+B,EAC/B,GAA2B;IAE3B,QAAQ,CAAA,GAAA,yCAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,yCAAW,EAAE;IACrB,IAAI,WACF,OAAO,Y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gBAAgB,MAAM,CAAC;QACnC,mBAAiB,GAAG,UAAU,EAAE,CAAC,CAAC,EAAE,WAAW;QAC/C,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,iDAAK,GAAG;OAC7B,SAAS,kBAAkB,kBAC1B,gCAAC,CAAA,GAAA,yCAAW;QACV,SAAA;QACA,SAAS;QACT,kBAAkB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,iDAAK,GAAG;OACpC,cACG,gBAAgB,MAAM,CAAC,sBAAsB;QAC3C,UAAU,MAAM,UAAU,CAAC,IAAI;IACjC,KACA,gBAAgB,MAAM,CAAC,qBAG9B,eAAe,0BACd,gCAAC,CAAA,GAAA,yCAAW;QACV,SAAA;QACA,SAAS,IAAM;QACf,kBAAkB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,iDAAK,GAAG;OACpC;AAUrB","sources":["packages/@adobe/react-spectrum/src/tag/TagGroup.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 {ActionButton} from '../button/ActionButton';\nimport {AriaTagGroupProps, useTagGroup} from 'react-aria/useTagGroup';\nimport {classNames} from '../utils/classNames';\nimport {\n Collection,\n DOMRef,\n Node,\n SpectrumLabelableProps,\n StyleProps,\n Validation\n} from '@react-types/shared';\nimport {Field} from '../label/Field';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport intlMessages from '../../intl/tag/*.json';\nimport {ListCollection} from 'react-stately/private/list/ListCollection';\nimport {ListKeyboardDelegate} from 'react-aria/ListKeyboardDelegate';\nimport {Provider, useProvider, useProviderProps} from '../provider/Provider';\nimport React, {JSX, ReactNode, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/tags/vars.css';\nimport {Tag} from './Tag';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useFormProps} from '../form/Form';\nimport {useId} from 'react-aria/useId';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useListState} from 'react-stately/useListState';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\nimport {useValueEffect} from 'react-aria/private/utils/useValueEffect';\n\nconst TAG_STYLES = {\n medium: {\n height: 24,\n margin: 4\n },\n large: {\n height: 30,\n margin: 5\n }\n};\n\nexport interface SpectrumTagGroupProps<T>\n extends\n Omit<\n AriaTagGroupProps<T>,\n | 'selectionMode'\n | 'disallowEmptySelection'\n | 'selectedKeys'\n | 'defaultSelectedKeys'\n | 'onSelectionChange'\n | 'selectionBehavior'\n | 'disabledKeys'\n >,\n StyleProps,\n Omit<SpectrumLabelableProps, 'isRequired' | 'necessityIndicator'>,\n Pick<Validation<any>, 'isInvalid' | 'validationState'> {\n /** The label to display on the action button. */\n actionLabel?: string;\n /** Handler that is called when the action button is pressed. */\n onAction?: () => void;\n /** Sets what the TagGroup should render when there are no tags to display. */\n renderEmptyState?: () => JSX.Element;\n /**\n * Limit the number of rows initially shown. This will render a button that allows the user to\n * expand to show all tags.\n */\n maxRows?: number;\n}\n\n/**\n * Tags allow users to categorize content. They can represent keywords or people, and are grouped to\n * describe an item or a search request.\n */\nexport const TagGroup = React.forwardRef(function TagGroup<T extends object>(\n props: SpectrumTagGroupProps<T>,\n ref: DOMRef<HTMLDivElement>\n) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n maxRows,\n children,\n actionLabel,\n onAction,\n labelPosition,\n renderEmptyState = () => stringFormatter.format('noTags')\n } = props;\n let domRef = useDOMRef(ref);\n let containerRef = useRef<HTMLDivElement>(null);\n let tagsRef = useRef<HTMLDivElement | null>(null);\n let {direction} = useLocale();\n let {scale} = useProvider();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/tag');\n let [isCollapsed, setIsCollapsed] = useState(maxRows != null);\n let state = useListState(props);\n let [tagState, setTagState] = useValueEffect({\n visibleTagCount: state.collection.size,\n showCollapseButton: false\n });\n let keyboardDelegate = useMemo(() => {\n let collection = (\n isCollapsed\n ? new ListCollection([...state.collection].slice(0, tagState.visibleTagCount))\n : new ListCollection([...state.collection])\n ) as Collection<Node<T>>;\n return new ListKeyboardDelegate({\n collection,\n ref: tagsRef,\n direction,\n orientation: 'horizontal'\n });\n }, [\n direction,\n isCollapsed,\n state.collection,\n tagState.visibleTagCount,\n tagsRef\n ]) as ListKeyboardDelegate<T>;\n // Remove onAction from props so it doesn't make it into useGridList.\n // oxlint-disable-next-line react/react-compiler\n delete props.onAction;\n let {gridProps, labelProps, descriptionProps, errorMessageProps} = useTagGroup(\n {...props, keyboardDelegate},\n state,\n tagsRef\n );\n let actionsId = useId();\n let actionsRef = useRef<HTMLDivElement>(null);\n\n let updateVisibleTagCount = useCallback(() => {\n if (maxRows && maxRows > 0) {\n let computeVisibleTagCount = () => {\n // Refs can be null at runtime.\n let currContainerRef: HTMLDivElement | null = containerRef.current;\n let currTagsRef: HTMLDivElement | null = tagsRef.current;\n let currActionsRef: HTMLDivElement | null = actionsRef.current;\n if (!currContainerRef || !currTagsRef || !currActionsRef || state.collection.size === 0) {\n return {\n visibleTagCount: 0,\n showCollapseButton: false\n };\n }\n\n // Count rows and show tags until we hit the maxRows.\n let tags = [...currTagsRef.children];\n let currY = -Infinity;\n let rowCount = 0;\n let index = 0;\n let tagWidths: number[] = [];\n for (let tag of tags) {\n let {width, y} = tag.getBoundingClientRect();\n\n if (y !== currY) {\n currY = y;\n rowCount++;\n }\n\n if (maxRows && rowCount > maxRows) {\n break;\n }\n tagWidths.push(width);\n index++;\n }\n\n // Remove tags until there is space for the collapse button and action button (if present) on the last row.\n let buttons = [...currActionsRef.children];\n if (\n maxRows &&\n buttons.length > 0 &&\n rowCount >= maxRows &&\n currContainerRef.parentElement\n ) {\n let buttonsWidth = buttons.reduce(\n (acc, curr) => (acc += curr.getBoundingClientRect().width),\n 0\n );\n buttonsWidth += TAG_STYLES[scale].margin * 2 * buttons.length;\n let end = direction === 'ltr' ? 'right' : 'left';\n let containerEnd = currContainerRef.parentElement.getBoundingClientRect()[end];\n let lastTagEnd = tags[index - 1]?.getBoundingClientRect()[end];\n lastTagEnd += TAG_STYLES[scale].margin;\n let availableWidth = containerEnd - lastTagEnd;\n\n while (availableWidth < buttonsWidth && index > 0) {\n availableWidth += tagWidths.pop()!;\n index--;\n }\n }\n\n return {\n visibleTagCount: Math.max(index, 1),\n showCollapseButton: index < state.collection.size\n };\n };\n\n setTagState(function* () {\n // Update to show all items.\n yield {visibleTagCount: state.collection.size, showCollapseButton: true};\n\n // Measure, and update to show the items until maxRows is reached.\n yield computeVisibleTagCount();\n });\n }\n // oxlint-disable-next-line react/react-compiler\n }, [maxRows, setTagState, direction, scale, state.collection.size]);\n\n useResizeObserver({ref: containerRef, onResize: updateVisibleTagCount});\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updateVisibleTagCount, [children]);\n\n useEffect(() => {\n // Recalculate visible tags when fonts are loaded.\n document.fonts?.ready.then(() => updateVisibleTagCount());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let visibleTags = useMemo(\n () =>\n [...state.collection].slice(\n 0,\n isCollapsed ? tagState.visibleTagCount : state.collection.size\n ),\n [isCollapsed, state.collection, tagState.visibleTagCount]\n );\n\n let handlePressCollapse = () => {\n // Prevents button from losing focus if focusedKey got collapsed.\n state.selectionManager.setFocusedKey(null);\n setIsCollapsed(prevCollapsed => !prevCollapsed);\n };\n\n let showActions = tagState.showCollapseButton || (actionLabel && onAction);\n let isEmpty = state.collection.size === 0;\n\n let containerStyle = useMemo(() => {\n if (maxRows == null || !isCollapsed || isEmpty) {\n return undefined;\n }\n let maxHeight = (TAG_STYLES[scale].height + TAG_STYLES[scale].margin * 2) * maxRows;\n return {maxHeight, overflow: 'hidden'};\n }, [isCollapsed, maxRows, isEmpty, scale]);\n\n return (\n <FocusScope>\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n showErrorIcon\n ref={domRef}\n elementType=\"span\"\n wrapperClassName={classNames(styles, 'spectrum-Tags-fieldWrapper', {\n 'spectrum-Tags-fieldWrapper--positionSide': labelPosition === 'side'\n })}>\n <div\n ref={containerRef}\n style={containerStyle}\n className={classNames(styles, 'spectrum-Tags-container', {\n 'spectrum-Tags-container--empty': isEmpty\n })}>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <div ref={tagsRef} {...gridProps} className={classNames(styles, 'spectrum-Tags')}>\n {visibleTags.map(item => (\n <Tag {...item.props} key={item.key} item={item} state={state}>\n {item.rendered}\n </Tag>\n ))}\n {isEmpty && (\n <div className={classNames(styles, 'spectrum-Tags-empty-state')}>\n {renderEmptyState()}\n </div>\n )}\n </div>\n </FocusRing>\n {showActions && !isEmpty && (\n <Provider isDisabled={false}>\n <div\n role=\"group\"\n ref={actionsRef}\n id={actionsId}\n aria-label={stringFormatter.format('actions')}\n aria-labelledby={`${gridProps.id} ${actionsId}`}\n className={classNames(styles, 'spectrum-Tags-actions')}>\n {tagState.showCollapseButton && (\n <ActionButton\n isQuiet\n onPress={handlePressCollapse}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {isCollapsed\n ? stringFormatter.format('showAllButtonLabel', {\n tagCount: state.collection.size\n })\n : stringFormatter.format('hideButtonLabel')}\n </ActionButton>\n )}\n {actionLabel && onAction && (\n <ActionButton\n isQuiet\n onPress={() => onAction?.()}\n UNSAFE_className={classNames(styles, 'spectrum-Tags-actionButton')}>\n {actionLabel}\n </ActionButton>\n )}\n </div>\n </Provider>\n )}\n </div>\n </Field>\n </FocusScope>\n );\n}) as <T>(props: SpectrumTagGroupProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactNode;\n"],"names":[],"version":3,"file":"TagGroup.mjs.map"}
|
|
@@ -36,12 +36,14 @@ $parcel$export(module.exports, "TextArea", function () { return $0620308f3abbcb1
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
const $0620308f3abbcb1c$export$f5c9f3c2c4054eec = /*#__PURE__*/ (0, ($parcel$interopDefault($bdIb0$react))).forwardRef(function TextArea(props, ref) {
|
|
39
|
+
// oxlint-disable-next-line react/react-compiler
|
|
39
40
|
props = (0, $544fc82701fc93e9$exports.useProviderProps)(props);
|
|
40
41
|
props = (0, $1af2ca8553741739$exports.useFormProps)(props);
|
|
41
42
|
let { isDisabled: isDisabled = false, isQuiet: isQuiet = false, isReadOnly: isReadOnly = false, isRequired: isRequired = false, onChange: onChange, ...otherProps } = props;
|
|
42
43
|
// not in stately because this is so we know when to re-measure, which is a spectrum design
|
|
43
44
|
let [inputValue, setInputValue] = (0, $bdIb0$reactstatelyuseControlledState.useControlledState)(props.value, props.defaultValue ?? '', ()=>{});
|
|
44
45
|
let inputRef = (0, $bdIb0$react.useRef)(null);
|
|
46
|
+
// oxlint-disable-next-line react/react-compiler
|
|
45
47
|
let onHeightChange = (0, $bdIb0$react.useCallback)(()=>{
|
|
46
48
|
// Quiet textareas always grow based on their text content.
|
|
47
49
|
// Standard textareas also grow by default, unless an explicit height is set.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAwCM,MAAM,0DAAW,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,SAChD,KAA4B,EAC5B,GAA2C;IAE3C,QAAQ,CAAA,GAAA,0CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,sCAAW,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CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CACV;YAEF,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,IAAI,SAAS,CAAA,GAAA,yCAAW,EACtB;QACE,GAAG,KAAK;QACR,UAAU,CAAA,GAAA,2BAAI,EAAE,UAAU;QAC1B,kBAAkB;IACpB,GACA;IAGF,qBACE,0DAAC,CAAA,GAAA,uCAAY;QACV,GAAI,UAAU;QACf,KAAK;QACL,UAAU;QACT,GAAG,MAAM;QACV,WAAA;QACA,YAAY;QACZ,SAAS;QACT,YAAY;QACZ,YAAY;;AAGlB","sources":["packages/@adobe/react-spectrum/src/textfield/TextArea.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 {AriaTextFieldProps, useTextField} from 'react-aria/useTextField';\n\nimport {chain} from 'react-aria/chain';\nimport React, {ReactElement, Ref, useCallback, useEffect, useRef} from 'react';\nimport {\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} from '@react-types/shared';\nimport {TextFieldBase} from './TextFieldBase';\nimport {TextFieldRef} from './TextField';\nimport {useControlledState} from 'react-stately/useControlledState';\nimport {useFormProps} from '../form/Form';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useProviderProps} from '../provider/Provider';\n\nexport interface SpectrumTextAreaProps\n extends\n SpectrumTextInputBase,\n Omit<\n AriaTextFieldProps<HTMLTextAreaElement>,\n 'isInvalid' | 'validationState' | 'type' | 'pattern'\n >,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps {\n /** An icon to display at the start of the input. */\n icon?: ReactElement | null;\n /** Whether the input should be displayed with a quiet style. */\n isQuiet?: boolean;\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nexport const TextArea = React.forwardRef(function TextArea(\n props: SpectrumTextAreaProps,\n ref: Ref<TextFieldRef<HTMLTextAreaElement>>\n) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isDisabled = false,\n isQuiet = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n ...otherProps\n } = props;\n\n // not in stately because this is so we know when to re-measure, which is a spectrum design\n let [inputValue, setInputValue] = useControlledState(\n props.value,\n props.defaultValue ?? '',\n () => {}\n );\n let inputRef = useRef<HTMLTextAreaElement>(null);\n\n let onHeightChange = useCallback(() => {\n // Quiet textareas always grow based on their text content.\n // Standard textareas also grow by default, unless an explicit height is set.\n if ((isQuiet || !props.height) && inputRef.current) {\n let input = inputRef.current;\n let prevAlignment = input.style.alignSelf;\n let prevOverflow = input.style.overflow;\n // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n // The measure/applied height is also incorrect/reset if we turn on and off\n // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n let isFirefox = 'MozAppearance' in input.style;\n if (!isFirefox) {\n input.style.overflow = 'hidden';\n }\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n // offsetHeight - clientHeight accounts for the border/padding.\n input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n input.style.overflow = prevOverflow;\n input.style.alignSelf = prevAlignment;\n }\n }, [isQuiet, inputRef, props.height]);\n\n useLayoutEffect(() => {\n if (inputRef.current) {\n onHeightChange();\n }\n }, [onHeightChange, inputValue, inputRef]);\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextArea.html#help-text'\n );\n hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n let result = useTextField(\n {\n ...props,\n onChange: chain(onChange, setInputValue),\n inputElementType: 'textarea'\n },\n inputRef\n );\n\n return (\n <TextFieldBase\n {...(otherProps as any)}\n ref={ref}\n inputRef={inputRef}\n {...result}\n multiLine\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n />\n );\n});\n"],"names":[],"version":3,"file":"TextArea.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAwCM,MAAM,0DAAW,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,SAChD,KAA4B,EAC5B,GAA2C;IAE3C,gDAAgD;IAChD,QAAQ,CAAA,GAAA,0CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,sCAAW,EAAE;IACrB,IAAI,cACF,aAAa,gBACb,UAAU,mBACV,aAAa,mBACb,aAAa,iBACb,QAAQ,EACR,GAAG,YACJ,GAAG;IAEJ,2FAA2F;IAC3F,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,wDAAiB,EACjD,MAAM,KAAK,EACX,MAAM,YAAY,IAAI,IACtB,KAAO;IAET,IAAI,WAAW,CAAA,GAAA,mBAAK,EAAuB;IAE3C,gDAAgD;IAChD,IAAI,iBAAiB,CAAA,GAAA,wBAAU,EAAE;QAC/B,2DAA2D;QAC3D,6EAA6E;QAC7E,IAAI,AAAC,CAAA,WAAW,CAAC,MAAM,MAAM,AAAD,KAAM,SAAS,OAAO,EAAE;YAClD,IAAI,QAAQ,SAAS,OAAO;YAC5B,IAAI,gBAAgB,MAAM,KAAK,CAAC,SAAS;YACzC,IAAI,eAAe,MA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* 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 {AriaTextFieldProps, useTextField} from 'react-aria/useTextField';\n\nimport {chain} from 'react-aria/chain';\nimport React, {ReactElement, Ref, useCallback, useEffect, useRef} from 'react';\nimport {\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} from '@react-types/shared';\nimport {TextFieldBase} from './TextFieldBase';\nimport {TextFieldRef} from './TextField';\nimport {useControlledState} from 'react-stately/useControlledState';\nimport {useFormProps} from '../form/Form';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useProviderProps} from '../provider/Provider';\n\nexport interface SpectrumTextAreaProps\n extends\n SpectrumTextInputBase,\n Omit<\n AriaTextFieldProps<HTMLTextAreaElement>,\n 'isInvalid' | 'validationState' | 'type' | 'pattern'\n >,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps {\n /** An icon to display at the start of the input. */\n icon?: ReactElement | null;\n /** Whether the input should be displayed with a quiet style. */\n isQuiet?: boolean;\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nexport const TextArea = React.forwardRef(function TextArea(\n props: SpectrumTextAreaProps,\n ref: Ref<TextFieldRef<HTMLTextAreaElement>>\n) {\n // oxlint-disable-next-line react/react-compiler\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isDisabled = false,\n isQuiet = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n ...otherProps\n } = props;\n\n // not in stately because this is so we know when to re-measure, which is a spectrum design\n let [inputValue, setInputValue] = useControlledState(\n props.value,\n props.defaultValue ?? '',\n () => {}\n );\n let inputRef = useRef<HTMLTextAreaElement>(null);\n\n // oxlint-disable-next-line react/react-compiler\n let onHeightChange = useCallback(() => {\n // Quiet textareas always grow based on their text content.\n // Standard textareas also grow by default, unless an explicit height is set.\n if ((isQuiet || !props.height) && inputRef.current) {\n let input = inputRef.current;\n let prevAlignment = input.style.alignSelf;\n let prevOverflow = input.style.overflow;\n // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n // The measure/applied height is also incorrect/reset if we turn on and off\n // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n let isFirefox = 'MozAppearance' in input.style;\n if (!isFirefox) {\n input.style.overflow = 'hidden';\n }\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n // offsetHeight - clientHeight accounts for the border/padding.\n input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n input.style.overflow = prevOverflow;\n input.style.alignSelf = prevAlignment;\n }\n }, [isQuiet, inputRef, props.height]);\n\n useLayoutEffect(() => {\n if (inputRef.current) {\n onHeightChange();\n }\n }, [onHeightChange, inputValue, inputRef]);\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextArea.html#help-text'\n );\n hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n let result = useTextField(\n {\n ...props,\n onChange: chain(onChange, setInputValue),\n inputElementType: 'textarea'\n },\n inputRef\n );\n\n return (\n <TextFieldBase\n {...(otherProps as any)}\n ref={ref}\n inputRef={inputRef}\n {...result}\n multiLine\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n />\n );\n});\n"],"names":[],"version":3,"file":"TextArea.cjs.map"}
|
|
@@ -26,6 +26,7 @@ import {useLayoutEffect as $jbNGj$useLayoutEffect} from "react-aria/private/util
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
const $fee5ca43c2eb72c2$export$f5c9f3c2c4054eec = /*#__PURE__*/ (0, $jbNGj$react).forwardRef(function TextArea(props, ref) {
|
|
29
|
+
// oxlint-disable-next-line react/react-compiler
|
|
29
30
|
props = (0, $089943c7a219141c$export$521c373ccc32c300)(props);
|
|
30
31
|
props = (0, $d23ca6800ac02cf1$export$a6b5be5c6b451665)(props);
|
|
31
32
|
let { isDisabled: isDisabled = false, isQuiet: isQuiet = false, isReadOnly: isReadOnly = false, isRequired: isRequired = false, onChange: onChange, ...otherProps } = props;
|
|
@@ -33,6 +34,7 @@ const $fee5ca43c2eb72c2$export$f5c9f3c2c4054eec = /*#__PURE__*/ (0, $jbNGj$react
|
|
|
33
34
|
// not in stately because this is so we know when to re-measure, which is a spectrum design
|
|
34
35
|
let [inputValue, setInputValue] = (0, $jbNGj$useControlledState)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : '', ()=>{});
|
|
35
36
|
let inputRef = (0, $jbNGj$useRef)(null);
|
|
37
|
+
// oxlint-disable-next-line react/react-compiler
|
|
36
38
|
let onHeightChange = (0, $jbNGj$useCallback)(()=>{
|
|
37
39
|
// Quiet textareas always grow based on their text content.
|
|
38
40
|
// Standard textareas also grow by default, unless an explicit height is set.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAwCM,MAAM,0DAAW,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,SAChD,KAA4B,EAC5B,GAA2C;IAE3C,QAAQ,CAAA,GAAA,yCAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,yCAAW,EAAE;IACrB,IAAI,cACF,aAAa,gBACb,UAAU,mBACV,aAAa,mBACb,aAAa,iBACb,QAAQ,EACR,GAAG,YACJ,GAAG;QAKF;IAHF,2FAA2F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AEF,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,IAAI,SAAS,CAAA,GAAA,mBAAW,EACtB;QACE,GAAG,KAAK;QACR,UAAU,CAAA,GAAA,YAAI,EAAE,UAAU;QAC1B,kBAAkB;IACpB,GACA;IAGF,qBACE,gCAAC,CAAA,GAAA,yCAAY;QACV,GAAI,UAAU;QACf,KAAK;QACL,UAAU;QACT,GAAG,MAAM;QACV,WAAA;QACA,YAAY;QACZ,SAAS;QACT,YAAY;QACZ,YAAY;;AAGlB","sources":["packages/@adobe/react-spectrum/src/textfield/TextArea.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 {AriaTextFieldProps, useTextField} from 'react-aria/useTextField';\n\nimport {chain} from 'react-aria/chain';\nimport React, {ReactElement, Ref, useCallback, useEffect, useRef} from 'react';\nimport {\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} from '@react-types/shared';\nimport {TextFieldBase} from './TextFieldBase';\nimport {TextFieldRef} from './TextField';\nimport {useControlledState} from 'react-stately/useControlledState';\nimport {useFormProps} from '../form/Form';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useProviderProps} from '../provider/Provider';\n\nexport interface SpectrumTextAreaProps\n extends\n SpectrumTextInputBase,\n Omit<\n AriaTextFieldProps<HTMLTextAreaElement>,\n 'isInvalid' | 'validationState' | 'type' | 'pattern'\n >,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps {\n /** An icon to display at the start of the input. */\n icon?: ReactElement | null;\n /** Whether the input should be displayed with a quiet style. */\n isQuiet?: boolean;\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nexport const TextArea = React.forwardRef(function TextArea(\n props: SpectrumTextAreaProps,\n ref: Ref<TextFieldRef<HTMLTextAreaElement>>\n) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isDisabled = false,\n isQuiet = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n ...otherProps\n } = props;\n\n // not in stately because this is so we know when to re-measure, which is a spectrum design\n let [inputValue, setInputValue] = useControlledState(\n props.value,\n props.defaultValue ?? '',\n () => {}\n );\n let inputRef = useRef<HTMLTextAreaElement>(null);\n\n let onHeightChange = useCallback(() => {\n // Quiet textareas always grow based on their text content.\n // Standard textareas also grow by default, unless an explicit height is set.\n if ((isQuiet || !props.height) && inputRef.current) {\n let input = inputRef.current;\n let prevAlignment = input.style.alignSelf;\n let prevOverflow = input.style.overflow;\n // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n // The measure/applied height is also incorrect/reset if we turn on and off\n // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n let isFirefox = 'MozAppearance' in input.style;\n if (!isFirefox) {\n input.style.overflow = 'hidden';\n }\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n // offsetHeight - clientHeight accounts for the border/padding.\n input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n input.style.overflow = prevOverflow;\n input.style.alignSelf = prevAlignment;\n }\n }, [isQuiet, inputRef, props.height]);\n\n useLayoutEffect(() => {\n if (inputRef.current) {\n onHeightChange();\n }\n }, [onHeightChange, inputValue, inputRef]);\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextArea.html#help-text'\n );\n hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n let result = useTextField(\n {\n ...props,\n onChange: chain(onChange, setInputValue),\n inputElementType: 'textarea'\n },\n inputRef\n );\n\n return (\n <TextFieldBase\n {...(otherProps as any)}\n ref={ref}\n inputRef={inputRef}\n {...result}\n multiLine\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n />\n );\n});\n"],"names":[],"version":3,"file":"TextArea.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAwCM,MAAM,0DAAW,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,SAChD,KAA4B,EAC5B,GAA2C;IAE3C,gDAAgD;IAChD,QAAQ,CAAA,GAAA,yCAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,yCAAW,EAAE;IACrB,IAAI,cACF,aAAa,gBACb,UAAU,mBACV,aAAa,mBACb,aAAa,iBACb,QAAQ,EACR,GAAG,YACJ,GAAG;QAKF;IAHF,2FAA2F;IAC3F,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,yBAAiB,EACjD,MAAM,KAAK,EACX,CAAA,sBAAA,MAAM,YAAY,cAAlB,iCAAA,sBAAsB,IACtB,KAAO;IAET,IAAI,WAAW,CAAA,GAAA,aAAK,EAAuB;IAE3C,gDAAgD;IAChD,IAAI,iBAAiB,CAAA,GAAA,kBAAU,EAAE;QAC/B,2DAA2D;QAC3D,6EAA6E;QAC7E,IAAI,AAAC,CAAA,WAAW,CAAC,MAAM,MAAM,AAAD,KAAM,SAAS,OAAO,EAAE;YAClD,IAAI,QAAQ,SAAS,OAAO;YAC5B,IAAI,gBAAgB,MAAM,KAAK,CAAC,SAAS;YACzC,IAAI,eAAe,MAAM,KAAK,CAAC,QAAQ;YACvC,6FAA6F;YAC7F,2EAA2E;YAC3E,mFAAmF;YACnF,IAAI,YAAY,mBAAmB,MAAM,KAAK;YAC9C,IAAI,CAAC,WACH,MAAM,KAAK,CAAC,QAAQ,GAAG;YAEzB,MAAM,KAAK,CAAC,SAAS,GAAG;YACxB,MAAM,KAAK,CAAC,MAAM,GAAG;YACrB,+DAA+D;YAC/D,MAAM,KAAK,CAAC,MAAM,GAAG,GAAG,MAAM,YAAY,GAAI,CAAA,MAAM,YAAY,GAAG,MAAM,YAAY,AAAD,EAAG,EAAE,CAAC;YAC1F,MAAM,KAAK,CAAC,QAAQ,GAAG;YACvB,MAAM,KAAK,CAAC,SAAS,GAAG;QAC1B;IACF,GAAG;QAAC;QAAS;QAAU,MAAM,MAAM;KAAC;IAEpC,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,SAAS,OAAO,EAClB;IAEJ,GAAG;QAAC;QAAgB;QAAY;KAAS;IAEzC,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CACV;YAEF,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,IAAI,SAAS,CAAA,GAAA,mBAAW,EACtB;QACE,GAAG,KAAK;QACR,UAAU,CAAA,GAAA,YAAI,EAAE,UAAU;QAC1B,kBAAkB;IACpB,GACA;IAGF,qBACE,gCAAC,CAAA,GAAA,yCAAY;QACV,GAAI,UAAU;QACf,KAAK;QACL,UAAU;QACT,GAAG,MAAM;QACV,WAAA;QACA,YAAY;QACZ,SAAS;QACT,YAAY;QACZ,YAAY;;AAGlB","sources":["packages/@adobe/react-spectrum/src/textfield/TextArea.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 {AriaTextFieldProps, useTextField} from 'react-aria/useTextField';\n\nimport {chain} from 'react-aria/chain';\nimport React, {ReactElement, Ref, useCallback, useEffect, useRef} from 'react';\nimport {\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} from '@react-types/shared';\nimport {TextFieldBase} from './TextFieldBase';\nimport {TextFieldRef} from './TextField';\nimport {useControlledState} from 'react-stately/useControlledState';\nimport {useFormProps} from '../form/Form';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useProviderProps} from '../provider/Provider';\n\nexport interface SpectrumTextAreaProps\n extends\n SpectrumTextInputBase,\n Omit<\n AriaTextFieldProps<HTMLTextAreaElement>,\n 'isInvalid' | 'validationState' | 'type' | 'pattern'\n >,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps {\n /** An icon to display at the start of the input. */\n icon?: ReactElement | null;\n /** Whether the input should be displayed with a quiet style. */\n isQuiet?: boolean;\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nexport const TextArea = React.forwardRef(function TextArea(\n props: SpectrumTextAreaProps,\n ref: Ref<TextFieldRef<HTMLTextAreaElement>>\n) {\n // oxlint-disable-next-line react/react-compiler\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isDisabled = false,\n isQuiet = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n ...otherProps\n } = props;\n\n // not in stately because this is so we know when to re-measure, which is a spectrum design\n let [inputValue, setInputValue] = useControlledState(\n props.value,\n props.defaultValue ?? '',\n () => {}\n );\n let inputRef = useRef<HTMLTextAreaElement>(null);\n\n // oxlint-disable-next-line react/react-compiler\n let onHeightChange = useCallback(() => {\n // Quiet textareas always grow based on their text content.\n // Standard textareas also grow by default, unless an explicit height is set.\n if ((isQuiet || !props.height) && inputRef.current) {\n let input = inputRef.current;\n let prevAlignment = input.style.alignSelf;\n let prevOverflow = input.style.overflow;\n // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n // The measure/applied height is also incorrect/reset if we turn on and off\n // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n let isFirefox = 'MozAppearance' in input.style;\n if (!isFirefox) {\n input.style.overflow = 'hidden';\n }\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n // offsetHeight - clientHeight accounts for the border/padding.\n input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n input.style.overflow = prevOverflow;\n input.style.alignSelf = prevAlignment;\n }\n }, [isQuiet, inputRef, props.height]);\n\n useLayoutEffect(() => {\n if (inputRef.current) {\n onHeightChange();\n }\n }, [onHeightChange, inputValue, inputRef]);\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextArea.html#help-text'\n );\n hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n let result = useTextField(\n {\n ...props,\n onChange: chain(onChange, setInputValue),\n inputElementType: 'textarea'\n },\n inputRef\n );\n\n return (\n <TextFieldBase\n {...(otherProps as any)}\n ref={ref}\n inputRef={inputRef}\n {...result}\n multiLine\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n />\n );\n});\n"],"names":[],"version":3,"file":"TextArea.js.map"}
|
|
@@ -26,12 +26,14 @@ import {useLayoutEffect as $65ICI$useLayoutEffect} from "react-aria/private/util
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
const $14a1c0edab339433$export$f5c9f3c2c4054eec = /*#__PURE__*/ (0, $65ICI$react).forwardRef(function TextArea(props, ref) {
|
|
29
|
+
// oxlint-disable-next-line react/react-compiler
|
|
29
30
|
props = (0, $71dfb0e0358a12de$export$521c373ccc32c300)(props);
|
|
30
31
|
props = (0, $c29c48d4ef19ffc4$export$a6b5be5c6b451665)(props);
|
|
31
32
|
let { isDisabled: isDisabled = false, isQuiet: isQuiet = false, isReadOnly: isReadOnly = false, isRequired: isRequired = false, onChange: onChange, ...otherProps } = props;
|
|
32
33
|
// not in stately because this is so we know when to re-measure, which is a spectrum design
|
|
33
34
|
let [inputValue, setInputValue] = (0, $65ICI$useControlledState)(props.value, props.defaultValue ?? '', ()=>{});
|
|
34
35
|
let inputRef = (0, $65ICI$useRef)(null);
|
|
36
|
+
// oxlint-disable-next-line react/react-compiler
|
|
35
37
|
let onHeightChange = (0, $65ICI$useCallback)(()=>{
|
|
36
38
|
// Quiet textareas always grow based on their text content.
|
|
37
39
|
// Standard textareas also grow by default, unless an explicit height is set.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAwCM,MAAM,0DAAW,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,SAChD,KAA4B,EAC5B,GAA2C;IAE3C,QAAQ,CAAA,GAAA,yCAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,yCAAW,EAAE;IACrB,IAAI,cACF,aAAa,gBACb,UAAU,mBACV,aAAa,mBACb,aAAa,iBACb,QAAQ,EACR,GAAG,YACJ,GAAG;IAEJ,2FAA2F;IAC3F,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,yBAAiB,EACjD,MAAM,KAAK,EACX,MAAM,YAAY,IAAI,IACtB,KAAO;IAET,IAAI,WAAW,CAAA,GAAA,aAAK,EAAuB;IAE3C,IAAI,iBAAiB,CAAA,GAAA,kBAAU,EAAE;QAC/B,2DAA2D;QAC3D,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AAK;QACL,UAAU;QACT,GAAG,MAAM;QACV,WAAA;QACA,YAAY;QACZ,SAAS;QACT,YAAY;QACZ,YAAY;;AAGlB","sources":["packages/@adobe/react-spectrum/src/textfield/TextArea.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 {AriaTextFieldProps, useTextField} from 'react-aria/useTextField';\n\nimport {chain} from 'react-aria/chain';\nimport React, {ReactElement, Ref, useCallback, useEffect, useRef} from 'react';\nimport {\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} from '@react-types/shared';\nimport {TextFieldBase} from './TextFieldBase';\nimport {TextFieldRef} from './TextField';\nimport {useControlledState} from 'react-stately/useControlledState';\nimport {useFormProps} from '../form/Form';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useProviderProps} from '../provider/Provider';\n\nexport interface SpectrumTextAreaProps\n extends\n SpectrumTextInputBase,\n Omit<\n AriaTextFieldProps<HTMLTextAreaElement>,\n 'isInvalid' | 'validationState' | 'type' | 'pattern'\n >,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps {\n /** An icon to display at the start of the input. */\n icon?: ReactElement | null;\n /** Whether the input should be displayed with a quiet style. */\n isQuiet?: boolean;\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nexport const TextArea = React.forwardRef(function TextArea(\n props: SpectrumTextAreaProps,\n ref: Ref<TextFieldRef<HTMLTextAreaElement>>\n) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isDisabled = false,\n isQuiet = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n ...otherProps\n } = props;\n\n // not in stately because this is so we know when to re-measure, which is a spectrum design\n let [inputValue, setInputValue] = useControlledState(\n props.value,\n props.defaultValue ?? '',\n () => {}\n );\n let inputRef = useRef<HTMLTextAreaElement>(null);\n\n let onHeightChange = useCallback(() => {\n // Quiet textareas always grow based on their text content.\n // Standard textareas also grow by default, unless an explicit height is set.\n if ((isQuiet || !props.height) && inputRef.current) {\n let input = inputRef.current;\n let prevAlignment = input.style.alignSelf;\n let prevOverflow = input.style.overflow;\n // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n // The measure/applied height is also incorrect/reset if we turn on and off\n // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n let isFirefox = 'MozAppearance' in input.style;\n if (!isFirefox) {\n input.style.overflow = 'hidden';\n }\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n // offsetHeight - clientHeight accounts for the border/padding.\n input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n input.style.overflow = prevOverflow;\n input.style.alignSelf = prevAlignment;\n }\n }, [isQuiet, inputRef, props.height]);\n\n useLayoutEffect(() => {\n if (inputRef.current) {\n onHeightChange();\n }\n }, [onHeightChange, inputValue, inputRef]);\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextArea.html#help-text'\n );\n hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n let result = useTextField(\n {\n ...props,\n onChange: chain(onChange, setInputValue),\n inputElementType: 'textarea'\n },\n inputRef\n );\n\n return (\n <TextFieldBase\n {...(otherProps as any)}\n ref={ref}\n inputRef={inputRef}\n {...result}\n multiLine\n isDisabled={isDisabled}\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G,EAAE,CAAC;YAC1F,MAAM,KAAK,CAAC,QAAQ,GAAG;YACvB,MAAM,KAAK,CAAC,SAAS,GAAG;QAC1B;IACF,GAAG;QAAC;QAAS;QAAU,MAAM,MAAM;KAAC;IAEpC,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,SAAS,OAAO,EAClB;IAEJ,GAAG;QAAC;QAAgB;QAAY;KAAS;IAEzC,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CACV;YAEF,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,IAAI,SAAS,CAAA,GAAA,mBAAW,EACtB;QACE,GAAG,KAAK;QACR,UAAU,CAAA,GAAA,YAAI,EAAE,UAAU;QAC1B,kBAAkB;IACpB,GACA;IAGF,qBACE,gCAAC,CAAA,GAAA,yCAAY;QACV,GAAI,UAAU;QACf,KAAK;QACL,UAAU;QACT,GAAG,MAAM;QACV,WAAA;QACA,YAAY;QACZ,SAAS;QACT,YAAY;QACZ,YAAY;;AAGlB","sources":["packages/@adobe/react-spectrum/src/textfield/TextArea.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 {AriaTextFieldProps, useTextField} from 'react-aria/useTextField';\n\nimport {chain} from 'react-aria/chain';\nimport React, {ReactElement, Ref, useCallback, useEffect, useRef} from 'react';\nimport {\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} from '@react-types/shared';\nimport {TextFieldBase} from './TextFieldBase';\nimport {TextFieldRef} from './TextField';\nimport {useControlledState} from 'react-stately/useControlledState';\nimport {useFormProps} from '../form/Form';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useProviderProps} from '../provider/Provider';\n\nexport interface SpectrumTextAreaProps\n extends\n SpectrumTextInputBase,\n Omit<\n AriaTextFieldProps<HTMLTextAreaElement>,\n 'isInvalid' | 'validationState' | 'type' | 'pattern'\n >,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps {\n /** An icon to display at the start of the input. */\n icon?: ReactElement | null;\n /** Whether the input should be displayed with a quiet style. */\n isQuiet?: boolean;\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nexport const TextArea = React.forwardRef(function TextArea(\n props: SpectrumTextAreaProps,\n ref: Ref<TextFieldRef<HTMLTextAreaElement>>\n) {\n // oxlint-disable-next-line react/react-compiler\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isDisabled = false,\n isQuiet = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n ...otherProps\n } = props;\n\n // not in stately because this is so we know when to re-measure, which is a spectrum design\n let [inputValue, setInputValue] = useControlledState(\n props.value,\n props.defaultValue ?? '',\n () => {}\n );\n let inputRef = useRef<HTMLTextAreaElement>(null);\n\n // oxlint-disable-next-line react/react-compiler\n let onHeightChange = useCallback(() => {\n // Quiet textareas always grow based on their text content.\n // Standard textareas also grow by default, unless an explicit height is set.\n if ((isQuiet || !props.height) && inputRef.current) {\n let input = inputRef.current;\n let prevAlignment = input.style.alignSelf;\n let prevOverflow = input.style.overflow;\n // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n // The measure/applied height is also incorrect/reset if we turn on and off\n // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n let isFirefox = 'MozAppearance' in input.style;\n if (!isFirefox) {\n input.style.overflow = 'hidden';\n }\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n // offsetHeight - clientHeight accounts for the border/padding.\n input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n input.style.overflow = prevOverflow;\n input.style.alignSelf = prevAlignment;\n }\n }, [isQuiet, inputRef, props.height]);\n\n useLayoutEffect(() => {\n if (inputRef.current) {\n onHeightChange();\n }\n }, [onHeightChange, inputValue, inputRef]);\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextArea.html#help-text'\n );\n hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n let result = useTextField(\n {\n ...props,\n onChange: chain(onChange, setInputValue),\n inputElementType: 'textarea'\n },\n inputRef\n );\n\n return (\n <TextFieldBase\n {...(otherProps as any)}\n ref={ref}\n inputRef={inputRef}\n {...result}\n multiLine\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n />\n );\n});\n"],"names":[],"version":3,"file":"TextArea.mjs.map"}
|
|
@@ -30,6 +30,7 @@ $parcel$export(module.exports, "TextField", function () { return $1d771798824a7f
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
const $1d771798824a7f90$export$2c73285ae9390cec = /*#__PURE__*/ (0, $iyxHv$react.forwardRef)(function TextField(props, ref) {
|
|
33
|
+
// oxlint-disable-next-line react/react-compiler
|
|
33
34
|
props = (0, $544fc82701fc93e9$exports.useProviderProps)(props);
|
|
34
35
|
props = (0, $1af2ca8553741739$exports.useFormProps)(props);
|
|
35
36
|
let inputRef = (0, $iyxHv$react.useRef)(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAwCM,MAAM,0DAAY,CAAA,GAAA,uBAAS,EAAE,SAAS,UAC3C,KAA6B,EAC7B,GAAsB;IAEtB,QAAQ,CAAA,GAAA,0CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,sCAAW,EAAE;IAErB,IAAI,WAAW,CAAA,GAAA,mBAAK,EAAoB;IACxC,IAAI,SAAS,CAAA,GAAA,yCAAW,EAAE,OAAO;IAEjC,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IACvB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CACV;YAEF,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,qBAAO,0DAAC,CAAA,GAAA,uCAAY;QAAG,GAAG,KAAK;QAAG,GAAG,MAAM;QAAE,KAAK;QAAK,UAAU;;AACnE","sources":["packages/@adobe/react-spectrum/src/textfield/TextField.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 {AriaTextFieldProps, useTextField} from 'react-aria/useTextField';\nimport {\n FocusableRefValue,\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} from '@react-types/shared';\nimport React, {forwardRef, ReactElement, Ref, useEffect, useRef} from 'react';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useFormProps} from '../form/Form';\nimport {useProviderProps} from '../provider/Provider';\n\nexport interface SpectrumTextFieldProps\n extends\n SpectrumTextInputBase,\n Omit<AriaTextFieldProps, 'isInvalid' | 'validationState'>,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps {\n /** An icon to display at the start of the input. */\n icon?: ReactElement | null;\n /** Whether the input should be displayed with a quiet style. */\n isQuiet?: boolean;\n}\n\nexport interface TextFieldRef<\n T extends HTMLInputElement | HTMLTextAreaElement = HTMLInputElement\n> extends FocusableRefValue<T, HTMLDivElement> {\n select(): void;\n getInputElement(): T | null;\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nexport const TextField = forwardRef(function TextField(\n props: SpectrumTextFieldProps,\n ref: Ref<TextFieldRef>\n) {\n props = useProviderProps(props);\n props = useFormProps(props);\n\n let inputRef = useRef<HTMLInputElement>(null);\n let result = useTextField(props, inputRef);\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextField.html#help-text'\n );\n hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n return <TextFieldBase {...props} {...result} ref={ref} inputRef={inputRef} />;\n});\n"],"names":[],"version":3,"file":"TextField.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAwCM,MAAM,0DAAY,CAAA,GAAA,uBAAS,EAAE,SAAS,UAC3C,KAA6B,EAC7B,GAAsB;IAEtB,gDAAgD;IAChD,QAAQ,CAAA,GAAA,0CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,sCAAW,EAAE;IAErB,IAAI,WAAW,CAAA,GAAA,mBAAK,EAAoB;IACxC,IAAI,SAAS,CAAA,GAAA,yCAAW,EAAE,OAAO;IAEjC,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IACvB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CACV;YAEF,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,qBAAO,0DAAC,CAAA,GAAA,uCAAY;QAAG,GAAG,KAAK;QAAG,GAAG,MAAM;QAAE,KAAK;QAAK,UAAU;;AACnE","sources":["packages/@adobe/react-spectrum/src/textfield/TextField.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 {AriaTextFieldProps, useTextField} from 'react-aria/useTextField';\nimport {\n FocusableRefValue,\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} from '@react-types/shared';\nimport React, {forwardRef, ReactElement, Ref, useEffect, useRef} from 'react';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useFormProps} from '../form/Form';\nimport {useProviderProps} from '../provider/Provider';\n\nexport interface SpectrumTextFieldProps\n extends\n SpectrumTextInputBase,\n Omit<AriaTextFieldProps, 'isInvalid' | 'validationState'>,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps {\n /** An icon to display at the start of the input. */\n icon?: ReactElement | null;\n /** Whether the input should be displayed with a quiet style. */\n isQuiet?: boolean;\n}\n\nexport interface TextFieldRef<\n T extends HTMLInputElement | HTMLTextAreaElement = HTMLInputElement\n> extends FocusableRefValue<T, HTMLDivElement> {\n select(): void;\n getInputElement(): T | null;\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nexport const TextField = forwardRef(function TextField(\n props: SpectrumTextFieldProps,\n ref: Ref<TextFieldRef>\n) {\n // oxlint-disable-next-line react/react-compiler\n props = useProviderProps(props);\n props = useFormProps(props);\n\n let inputRef = useRef<HTMLInputElement>(null);\n let result = useTextField(props, inputRef);\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextField.html#help-text'\n );\n hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n return <TextFieldBase {...props} {...result} ref={ref} inputRef={inputRef} />;\n});\n"],"names":[],"version":3,"file":"TextField.cjs.map"}
|
|
@@ -20,6 +20,7 @@ import $83uWs$react, {forwardRef as $83uWs$forwardRef, useRef as $83uWs$useRef,
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
const $79f51739ebc77ec5$export$2c73285ae9390cec = /*#__PURE__*/ (0, $83uWs$forwardRef)(function TextField(props, ref) {
|
|
23
|
+
// oxlint-disable-next-line react/react-compiler
|
|
23
24
|
props = (0, $089943c7a219141c$export$521c373ccc32c300)(props);
|
|
24
25
|
props = (0, $d23ca6800ac02cf1$export$a6b5be5c6b451665)(props);
|
|
25
26
|
let inputRef = (0, $83uWs$useRef)(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAwCM,MAAM,0DAAY,CAAA,GAAA,iBAAS,EAAE,SAAS,UAC3C,KAA6B,EAC7B,GAAsB;IAEtB,QAAQ,CAAA,GAAA,yCAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,yCAAW,EAAE;IAErB,IAAI,WAAW,CAAA,GAAA,aAAK,EAAoB;IACxC,IAAI,SAAS,CAAA,GAAA,mBAAW,EAAE,OAAO;IAEjC,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CACV;YAEF,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,qBAAO,gCAAC,CAAA,GAAA,yCAAY;QAAG,GAAG,KAAK;QAAG,GAAG,MAAM;QAAE,KAAK;QAAK,UAAU;;AACnE","sources":["packages/@adobe/react-spectrum/src/textfield/TextField.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 {AriaTextFieldProps, useTextField} from 'react-aria/useTextField';\nimport {\n FocusableRefValue,\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} from '@react-types/shared';\nimport React, {forwardRef, ReactElement, Ref, useEffect, useRef} from 'react';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useFormProps} from '../form/Form';\nimport {useProviderProps} from '../provider/Provider';\n\nexport interface SpectrumTextFieldProps\n extends\n SpectrumTextInputBase,\n Omit<AriaTextFieldProps, 'isInvalid' | 'validationState'>,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps {\n /** An icon to display at the start of the input. */\n icon?: ReactElement | null;\n /** Whether the input should be displayed with a quiet style. */\n isQuiet?: boolean;\n}\n\nexport interface TextFieldRef<\n T extends HTMLInputElement | HTMLTextAreaElement = HTMLInputElement\n> extends FocusableRefValue<T, HTMLDivElement> {\n select(): void;\n getInputElement(): T | null;\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nexport const TextField = forwardRef(function TextField(\n props: SpectrumTextFieldProps,\n ref: Ref<TextFieldRef>\n) {\n props = useProviderProps(props);\n props = useFormProps(props);\n\n let inputRef = useRef<HTMLInputElement>(null);\n let result = useTextField(props, inputRef);\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextField.html#help-text'\n );\n hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n return <TextFieldBase {...props} {...result} ref={ref} inputRef={inputRef} />;\n});\n"],"names":[],"version":3,"file":"TextField.js.map"}
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAwCM,MAAM,0DAAY,CAAA,GAAA,iBAAS,EAAE,SAAS,UAC3C,KAA6B,EAC7B,GAAsB;IAEtB,gDAAgD;IAChD,QAAQ,CAAA,GAAA,yCAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,yCAAW,EAAE;IAErB,IAAI,WAAW,CAAA,GAAA,aAAK,EAAoB;IACxC,IAAI,SAAS,CAAA,GAAA,mBAAW,EAAE,OAAO;IAEjC,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CACV;YAEF,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,qBAAO,gCAAC,CAAA,GAAA,yCAAY;QAAG,GAAG,KAAK;QAAG,GAAG,MAAM;QAAE,KAAK;QAAK,UAAU;;AACnE","sources":["packages/@adobe/react-spectrum/src/textfield/TextField.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 {AriaTextFieldProps, useTextField} from 'react-aria/useTextField';\nimport {\n FocusableRefValue,\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} from '@react-types/shared';\nimport React, {forwardRef, ReactElement, Ref, useEffect, useRef} from 'react';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useFormProps} from '../form/Form';\nimport {useProviderProps} from '../provider/Provider';\n\nexport interface SpectrumTextFieldProps\n extends\n SpectrumTextInputBase,\n Omit<AriaTextFieldProps, 'isInvalid' | 'validationState'>,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps {\n /** An icon to display at the start of the input. */\n icon?: ReactElement | null;\n /** Whether the input should be displayed with a quiet style. */\n isQuiet?: boolean;\n}\n\nexport interface TextFieldRef<\n T extends HTMLInputElement | HTMLTextAreaElement = HTMLInputElement\n> extends FocusableRefValue<T, HTMLDivElement> {\n select(): void;\n getInputElement(): T | null;\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nexport const TextField = forwardRef(function TextField(\n props: SpectrumTextFieldProps,\n ref: Ref<TextFieldRef>\n) {\n // oxlint-disable-next-line react/react-compiler\n props = useProviderProps(props);\n props = useFormProps(props);\n\n let inputRef = useRef<HTMLInputElement>(null);\n let result = useTextField(props, inputRef);\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextField.html#help-text'\n );\n hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n return <TextFieldBase {...props} {...result} ref={ref} inputRef={inputRef} />;\n});\n"],"names":[],"version":3,"file":"TextField.js.map"}
|
|
@@ -20,6 +20,7 @@ import $ifeZ5$react, {forwardRef as $ifeZ5$forwardRef, useRef as $ifeZ5$useRef,
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
const $a38b6369fa4dfb49$export$2c73285ae9390cec = /*#__PURE__*/ (0, $ifeZ5$forwardRef)(function TextField(props, ref) {
|
|
23
|
+
// oxlint-disable-next-line react/react-compiler
|
|
23
24
|
props = (0, $71dfb0e0358a12de$export$521c373ccc32c300)(props);
|
|
24
25
|
props = (0, $c29c48d4ef19ffc4$export$a6b5be5c6b451665)(props);
|
|
25
26
|
let inputRef = (0, $ifeZ5$useRef)(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAwCM,MAAM,0DAAY,CAAA,GAAA,iBAAS,EAAE,SAAS,UAC3C,KAA6B,EAC7B,GAAsB;IAEtB,QAAQ,CAAA,GAAA,yCAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,yCAAW,EAAE;IAErB,IAAI,WAAW,CAAA,GAAA,aAAK,EAAoB;IACxC,IAAI,SAAS,CAAA,GAAA,mBAAW,EAAE,OAAO;IAEjC,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CACV;YAEF,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,qBAAO,gCAAC,CAAA,GAAA,yCAAY;QAAG,GAAG,KAAK;QAAG,GAAG,MAAM;QAAE,KAAK;QAAK,UAAU;;AACnE","sources":["packages/@adobe/react-spectrum/src/textfield/TextField.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 {AriaTextFieldProps, useTextField} from 'react-aria/useTextField';\nimport {\n FocusableRefValue,\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} from '@react-types/shared';\nimport React, {forwardRef, ReactElement, Ref, useEffect, useRef} from 'react';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useFormProps} from '../form/Form';\nimport {useProviderProps} from '../provider/Provider';\n\nexport interface SpectrumTextFieldProps\n extends\n SpectrumTextInputBase,\n Omit<AriaTextFieldProps, 'isInvalid' | 'validationState'>,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps {\n /** An icon to display at the start of the input. */\n icon?: ReactElement | null;\n /** Whether the input should be displayed with a quiet style. */\n isQuiet?: boolean;\n}\n\nexport interface TextFieldRef<\n T extends HTMLInputElement | HTMLTextAreaElement = HTMLInputElement\n> extends FocusableRefValue<T, HTMLDivElement> {\n select(): void;\n getInputElement(): T | null;\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nexport const TextField = forwardRef(function TextField(\n props: SpectrumTextFieldProps,\n ref: Ref<TextFieldRef>\n) {\n props = useProviderProps(props);\n props = useFormProps(props);\n\n let inputRef = useRef<HTMLInputElement>(null);\n let result = useTextField(props, inputRef);\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextField.html#help-text'\n );\n hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n return <TextFieldBase {...props} {...result} ref={ref} inputRef={inputRef} />;\n});\n"],"names":[],"version":3,"file":"TextField.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAwCM,MAAM,0DAAY,CAAA,GAAA,iBAAS,EAAE,SAAS,UAC3C,KAA6B,EAC7B,GAAsB;IAEtB,gDAAgD;IAChD,QAAQ,CAAA,GAAA,yCAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,yCAAW,EAAE;IAErB,IAAI,WAAW,CAAA,GAAA,aAAK,EAAoB;IACxC,IAAI,SAAS,CAAA,GAAA,mBAAW,EAAE,OAAO;IAEjC,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CACV;YAEF,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,qBAAO,gCAAC,CAAA,GAAA,yCAAY;QAAG,GAAG,KAAK;QAAG,GAAG,MAAM;QAAE,KAAK;QAAK,UAAU;;AACnE","sources":["packages/@adobe/react-spectrum/src/textfield/TextField.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 {AriaTextFieldProps, useTextField} from 'react-aria/useTextField';\nimport {\n FocusableRefValue,\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} from '@react-types/shared';\nimport React, {forwardRef, ReactElement, Ref, useEffect, useRef} from 'react';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useFormProps} from '../form/Form';\nimport {useProviderProps} from '../provider/Provider';\n\nexport interface SpectrumTextFieldProps\n extends\n SpectrumTextInputBase,\n Omit<AriaTextFieldProps, 'isInvalid' | 'validationState'>,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps {\n /** An icon to display at the start of the input. */\n icon?: ReactElement | null;\n /** Whether the input should be displayed with a quiet style. */\n isQuiet?: boolean;\n}\n\nexport interface TextFieldRef<\n T extends HTMLInputElement | HTMLTextAreaElement = HTMLInputElement\n> extends FocusableRefValue<T, HTMLDivElement> {\n select(): void;\n getInputElement(): T | null;\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nexport const TextField = forwardRef(function TextField(\n props: SpectrumTextFieldProps,\n ref: Ref<TextFieldRef>\n) {\n // oxlint-disable-next-line react/react-compiler\n props = useProviderProps(props);\n props = useFormProps(props);\n\n let inputRef = useRef<HTMLInputElement>(null);\n let result = useTextField(props, inputRef);\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextField.html#help-text'\n );\n hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n return <TextFieldBase {...props} {...result} ref={ref} inputRef={inputRef} />;\n});\n"],"names":[],"version":3,"file":"TextField.mjs.map"}
|
|
@@ -85,7 +85,8 @@ const $827dbb466e199966$export$d22444a338b6e3c2 = /*#__PURE__*/ (0, $jxKwg$react
|
|
|
85
85
|
});
|
|
86
86
|
// Add validation icon IDREF to aria-describedby when validationState is valid
|
|
87
87
|
let inputPropsAriaDescribedBy = inputProps['aria-describedby'];
|
|
88
|
-
if (!isInvalid && validationState === 'valid' && !isLoading && !isDisabled && (!inputPropsAriaDescribedBy || !inputPropsAriaDescribedBy.includes(validId)))
|
|
88
|
+
if (!isInvalid && validationState === 'valid' && !isLoading && !isDisabled && (!inputPropsAriaDescribedBy || !inputPropsAriaDescribedBy.includes(validId))) // oxlint-disable-next-line react/react-compiler
|
|
89
|
+
inputProps['aria-describedby'] = [
|
|
89
90
|
inputPropsAriaDescribedBy,
|
|
90
91
|
validId
|
|
91
92
|
].join(' ').trim();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AAgDM,MAAM,0DAAgB,CAAA,GAAA,uBAAS,EAAE,SAAS,cAC/C,KAAyB,EACzB,GAA8D;IAE9D,IAAI,mBACF,kBAAkB,MAAM,SAAS,GAAG,YAAY,YAChD,IAAI,WACJ,UAAU,mBACV,UAAU,aACV,SAAS,aACT,SAAS,kBACT,cAAc,mBACd,eAAe,cACf,UAAU,cACV,UAAU,oBACV,gBAAgB,qBAChB,iBAAiB,EACjB,UAAU,YAAY,aACtB,SAAS,oBACT,gBAAgB,2BAChB,uBAAuB,oBACvB,gBAAgB,EACjB,GAAG;IACJ,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,iCAAO,EAAE;oBAAC;IAAU;IAClD,IAAI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AAQ,CAAC,IAAI,CAAC,KAAK,IAAI;IAGtF,IAAI,cAAC,UAAU,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,yCAAW,EAAE;QAC9C,aAAa;mBACb;IACF;IAEA,IAAI,0BACF,0DAAC;QACC,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,sBAAsB;YAClD,+BAA+B;YAC/B,6BAA6B,oBAAoB,WAAW,CAAC;YAC7D,gCAAgC;YAChC,6BAA6B;YAC7B,iCAAiC;YACjC,cAAc,CAAC,oBAAoB;QACrC;qBACA,0DAAC;QACE,GAAG,CAAA,GAAA,qCAAS,EAAE,YAAY,YAAY,WAAW;QAClD,KAAK;QACL,MAAM,YAAY,IAAI;QACtB,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,4BACA;YACE,gCAAgC;YAChC,cAAc;QAChB,GACA;QAGH,MACA,mBAAmB,CAAC,aAAa,CAAC,aAAa,aAAa,MAC5D,aAAa,kBACb;IAIL,qBACE,0DAAC,CAAA,GAAA,+BAAI;QACF,GAAG,KAAK;QACT,YAAY;QACZ,kBAAkB;QAClB,mBAAmB;QACnB,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,8BAA8B;YACjE,qCAAqC;QACvC;QACA,eAAe;QACf,KAAK;OACJ;AAGP","sources":["packages/@adobe/react-spectrum/src/textfield/TextFieldBase.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 AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames} from '../utils/classNames';\nimport {createFocusableRef} from '../utils/useDOMRef';\nimport {Field} from '../label/Field';\nimport intlMessages from '../../intl/textfield/*.json';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {PressEvents, RefObject, ValidationResult} from '@react-types/shared';\nimport React, {\n cloneElement,\n forwardRef,\n HTMLAttributes,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n ReactElement,\n Ref,\n TextareaHTMLAttributes,\n useImperativeHandle,\n useRef\n} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from './TextField';\nimport styles from '@adobe/spectrum-css-temp/components/textfield/vars.css';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useId} from 'react-aria/useId';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\n\ninterface TextFieldBaseProps\n extends\n Omit<SpectrumTextFieldProps, 'onChange' | 'validate'>,\n PressEvents,\n Partial<ValidationResult> {\n wrapperChildren?: ReactElement | ReactElement[];\n inputClassName?: string;\n validationIconClassName?: string;\n multiLine?: boolean;\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>;\n inputProps: InputHTMLAttributes<HTMLInputElement> | TextareaHTMLAttributes<HTMLTextAreaElement>;\n descriptionProps?: HTMLAttributes<HTMLElement>;\n errorMessageProps?: HTMLAttributes<HTMLElement>;\n inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement | null>;\n loadingIndicator?: ReactElement;\n isLoading?: boolean;\n disableFocusRing?: boolean;\n}\n\nexport const TextFieldBase = forwardRef(function TextFieldBase(\n props: TextFieldBaseProps,\n ref: Ref<TextFieldRef<HTMLInputElement | HTMLTextAreaElement>>\n) {\n let {\n validationState = props.isInvalid ? 'invalid' : null,\n icon,\n isQuiet = false,\n isDisabled,\n multiLine,\n autoFocus,\n inputClassName,\n wrapperChildren,\n labelProps,\n inputProps,\n descriptionProps,\n errorMessageProps,\n inputRef: userInputRef,\n isLoading,\n loadingIndicator,\n validationIconClassName,\n disableFocusRing\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let domRef = useRef<HTMLDivElement>(null);\n let defaultInputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n let inputRef = userInputRef || defaultInputRef;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n let ElementType: React.ElementType = multiLine ? 'textarea' : 'input';\n let isInvalid = validationState === 'invalid' && !isDisabled;\n\n if (icon) {\n let UNSAFE_className = classNames(\n styles,\n icon.props && (icon.props as any).UNSAFE_className,\n 'spectrum-Textfield-icon'\n );\n\n icon = cloneElement(icon, {\n UNSAFE_className,\n size: 'S'\n } as any);\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/textfield');\n let validId = useId();\n let validationIcon = isInvalid ? (\n <AlertMedium />\n ) : (\n <CheckmarkMedium id={validId} aria-hidden aria-label={stringFormatter.format('valid')} />\n );\n let validation = cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n styles,\n 'spectrum-Textfield-validationIcon',\n validationIconClassName\n )\n });\n\n // Add validation icon IDREF to aria-describedby when validationState is valid\n let inputPropsAriaDescribedBy = inputProps['aria-describedby'];\n if (\n !isInvalid &&\n validationState === 'valid' &&\n !isLoading &&\n !isDisabled &&\n (!inputPropsAriaDescribedBy || !inputPropsAriaDescribedBy.includes(validId))\n ) {\n inputProps['aria-describedby'] = [inputPropsAriaDescribedBy, validId].join(' ').trim();\n }\n\n let {focusProps, isFocusVisible} = useFocusRing({\n isTextInput: true,\n autoFocus\n });\n\n let textField = (\n <div\n className={classNames(styles, 'spectrum-Textfield', {\n 'spectrum-Textfield--invalid': isInvalid,\n 'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,\n 'spectrum-Textfield--loadable': loadingIndicator,\n 'spectrum-Textfield--quiet': isQuiet,\n 'spectrum-Textfield--multiline': multiLine,\n 'focus-ring': !disableFocusRing && isFocusVisible\n })}>\n <ElementType\n {...mergeProps(inputProps, hoverProps, focusProps)}\n ref={inputRef as any}\n rows={multiLine ? 1 : undefined}\n className={classNames(\n styles,\n 'spectrum-Textfield-input',\n {\n 'spectrum-Textfield-inputIcon': icon,\n 'is-hovered': isHovered\n },\n inputClassName\n )}\n />\n {icon}\n {validationState && !isLoading && !isDisabled ? validation : null}\n {isLoading && loadingIndicator}\n {wrapperChildren}\n </div>\n );\n\n return (\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n wrapperClassName={classNames(styles, 'spectrum-Textfield-wrapper', {\n 'spectrum-Textfield-wrapper--quiet': isQuiet\n })}\n showErrorIcon={false}\n ref={domRef}>\n {textField}\n </Field>\n );\n});\n"],"names":[],"version":3,"file":"TextFieldBase.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AAgDM,MAAM,0DAAgB,CAAA,GAAA,uBAAS,EAAE,SAAS,cAC/C,KAAyB,EACzB,GAA8D;IAE9D,IAAI,mBACF,kBAAkB,MAAM,SAAS,GAAG,YAAY,YAChD,IAAI,WACJ,UAAU,mBACV,UAAU,aACV,SAAS,aACT,SAAS,kBACT,cAAc,mBACd,eAAe,cACf,UAAU,cACV,UAAU,oBACV,gBAAgB,qBAChB,iBAAiB,EACjB,UAAU,YAAY,aACtB,SAAS,oBACT,gBAAgB,2BAChB,uBAAuB,oBACvB,gBAAgB,EACjB,GAAG;IACJ,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,iCAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,SAAS,CAAA,GAAA,mBAAK,EAAkB;IACpC,IAAI,kBAAkB,CAAA,GAAA,mBAA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AAU,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,yCAAW,EAAE;QAC9C,aAAa;mBACb;IACF;IAEA,IAAI,0BACF,0DAAC;QACC,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,sBAAsB;YAClD,+BAA+B;YAC/B,6BAA6B,oBAAoB,WAAW,CAAC;YAC7D,gCAAgC;YAChC,6BAA6B;YAC7B,iCAAiC;YACjC,cAAc,CAAC,oBAAoB;QACrC;qBACA,0DAAC;QACE,GAAG,CAAA,GAAA,qCAAS,EAAE,YAAY,YAAY,WAAW;QAClD,KAAK;QACL,MAAM,YAAY,IAAI;QACtB,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,4BACA;YACE,gCAAgC;YAChC,cAAc;QAChB,GACA;QAGH,MACA,mBAAmB,CAAC,aAAa,CAAC,aAAa,aAAa,MAC5D,aAAa,kBACb;IAIL,qBACE,0DAAC,CAAA,GAAA,+BAAI;QACF,GAAG,KAAK;QACT,YAAY;QACZ,kBAAkB;QAClB,mBAAmB;QACnB,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,8BAA8B;YACjE,qCAAqC;QACvC;QACA,eAAe;QACf,KAAK;OACJ;AAGP","sources":["packages/@adobe/react-spectrum/src/textfield/TextFieldBase.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 AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames} from '../utils/classNames';\nimport {createFocusableRef} from '../utils/useDOMRef';\nimport {Field} from '../label/Field';\nimport intlMessages from '../../intl/textfield/*.json';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {PressEvents, RefObject, ValidationResult} from '@react-types/shared';\nimport React, {\n cloneElement,\n forwardRef,\n HTMLAttributes,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n ReactElement,\n Ref,\n TextareaHTMLAttributes,\n useImperativeHandle,\n useRef\n} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from './TextField';\nimport styles from '@adobe/spectrum-css-temp/components/textfield/vars.css';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useId} from 'react-aria/useId';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\n\ninterface TextFieldBaseProps\n extends\n Omit<SpectrumTextFieldProps, 'onChange' | 'validate'>,\n PressEvents,\n Partial<ValidationResult> {\n wrapperChildren?: ReactElement | ReactElement[];\n inputClassName?: string;\n validationIconClassName?: string;\n multiLine?: boolean;\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>;\n inputProps: InputHTMLAttributes<HTMLInputElement> | TextareaHTMLAttributes<HTMLTextAreaElement>;\n descriptionProps?: HTMLAttributes<HTMLElement>;\n errorMessageProps?: HTMLAttributes<HTMLElement>;\n inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement | null>;\n loadingIndicator?: ReactElement;\n isLoading?: boolean;\n disableFocusRing?: boolean;\n}\n\nexport const TextFieldBase = forwardRef(function TextFieldBase(\n props: TextFieldBaseProps,\n ref: Ref<TextFieldRef<HTMLInputElement | HTMLTextAreaElement>>\n) {\n let {\n validationState = props.isInvalid ? 'invalid' : null,\n icon,\n isQuiet = false,\n isDisabled,\n multiLine,\n autoFocus,\n inputClassName,\n wrapperChildren,\n labelProps,\n inputProps,\n descriptionProps,\n errorMessageProps,\n inputRef: userInputRef,\n isLoading,\n loadingIndicator,\n validationIconClassName,\n disableFocusRing\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let domRef = useRef<HTMLDivElement>(null);\n let defaultInputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n let inputRef = userInputRef || defaultInputRef;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n let ElementType: React.ElementType = multiLine ? 'textarea' : 'input';\n let isInvalid = validationState === 'invalid' && !isDisabled;\n\n if (icon) {\n let UNSAFE_className = classNames(\n styles,\n icon.props && (icon.props as any).UNSAFE_className,\n 'spectrum-Textfield-icon'\n );\n\n icon = cloneElement(icon, {\n UNSAFE_className,\n size: 'S'\n } as any);\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/textfield');\n let validId = useId();\n let validationIcon = isInvalid ? (\n <AlertMedium />\n ) : (\n <CheckmarkMedium id={validId} aria-hidden aria-label={stringFormatter.format('valid')} />\n );\n let validation = cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n styles,\n 'spectrum-Textfield-validationIcon',\n validationIconClassName\n )\n });\n\n // Add validation icon IDREF to aria-describedby when validationState is valid\n let inputPropsAriaDescribedBy = inputProps['aria-describedby'];\n if (\n !isInvalid &&\n validationState === 'valid' &&\n !isLoading &&\n !isDisabled &&\n (!inputPropsAriaDescribedBy || !inputPropsAriaDescribedBy.includes(validId))\n ) {\n // oxlint-disable-next-line react/react-compiler\n inputProps['aria-describedby'] = [inputPropsAriaDescribedBy, validId].join(' ').trim();\n }\n\n let {focusProps, isFocusVisible} = useFocusRing({\n isTextInput: true,\n autoFocus\n });\n\n let textField = (\n <div\n className={classNames(styles, 'spectrum-Textfield', {\n 'spectrum-Textfield--invalid': isInvalid,\n 'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,\n 'spectrum-Textfield--loadable': loadingIndicator,\n 'spectrum-Textfield--quiet': isQuiet,\n 'spectrum-Textfield--multiline': multiLine,\n 'focus-ring': !disableFocusRing && isFocusVisible\n })}>\n <ElementType\n {...mergeProps(inputProps, hoverProps, focusProps)}\n ref={inputRef as any}\n rows={multiLine ? 1 : undefined}\n className={classNames(\n styles,\n 'spectrum-Textfield-input',\n {\n 'spectrum-Textfield-inputIcon': icon,\n 'is-hovered': isHovered\n },\n inputClassName\n )}\n />\n {icon}\n {validationState && !isLoading && !isDisabled ? validation : null}\n {isLoading && loadingIndicator}\n {wrapperChildren}\n </div>\n );\n\n return (\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n wrapperClassName={classNames(styles, 'spectrum-Textfield-wrapper', {\n 'spectrum-Textfield-wrapper--quiet': isQuiet\n })}\n showErrorIcon={false}\n ref={domRef}>\n {textField}\n </Field>\n );\n});\n"],"names":[],"version":3,"file":"TextFieldBase.cjs.map"}
|
|
@@ -79,7 +79,8 @@ const $1f88830e88ee8f61$export$d22444a338b6e3c2 = /*#__PURE__*/ (0, $id7wL$forwa
|
|
|
79
79
|
});
|
|
80
80
|
// Add validation icon IDREF to aria-describedby when validationState is valid
|
|
81
81
|
let inputPropsAriaDescribedBy = inputProps['aria-describedby'];
|
|
82
|
-
if (!isInvalid && validationState === 'valid' && !isLoading && !isDisabled && (!inputPropsAriaDescribedBy || !inputPropsAriaDescribedBy.includes(validId)))
|
|
82
|
+
if (!isInvalid && validationState === 'valid' && !isLoading && !isDisabled && (!inputPropsAriaDescribedBy || !inputPropsAriaDescribedBy.includes(validId))) // oxlint-disable-next-line react/react-compiler
|
|
83
|
+
inputProps['aria-describedby'] = [
|
|
83
84
|
inputPropsAriaDescribedBy,
|
|
84
85
|
validId
|
|
85
86
|
].join(' ').trim();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AAgDM,MAAM,0DAA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ACjE,qCAAqC;QACvC;QACA,eAAe;QACf,KAAK;OACJ;AAGP","sources":["packages/@adobe/react-spectrum/src/textfield/TextFieldBase.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 AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames} from '../utils/classNames';\nimport {createFocusableRef} from '../utils/useDOMRef';\nimport {Field} from '../label/Field';\nimport intlMessages from '../../intl/textfield/*.json';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {PressEvents, RefObject, ValidationResult} from '@react-types/shared';\nimport React, {\n cloneElement,\n forwardRef,\n HTMLAttributes,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n ReactElement,\n Ref,\n TextareaHTMLAttributes,\n useImperativeHandle,\n useRef\n} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from './TextField';\nimport styles from '@adobe/spectrum-css-temp/components/textfield/vars.css';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useId} from 'react-aria/useId';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\n\ninterface TextFieldBaseProps\n extends\n Omit<SpectrumTextFieldProps, 'onChange' | 'validate'>,\n PressEvents,\n Partial<ValidationResult> {\n wrapperChildren?: ReactElement | ReactElement[];\n inputClassName?: string;\n validationIconClassName?: string;\n multiLine?: boolean;\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>;\n inputProps: InputHTMLAttributes<HTMLInputElement> | TextareaHTMLAttributes<HTMLTextAreaElement>;\n descriptionProps?: HTMLAttributes<HTMLElement>;\n errorMessageProps?: HTMLAttributes<HTMLElement>;\n inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement | null>;\n loadingIndicator?: ReactElement;\n isLoading?: boolean;\n disableFocusRing?: boolean;\n}\n\nexport const TextFieldBase = forwardRef(function TextFieldBase(\n props: TextFieldBaseProps,\n ref: Ref<TextFieldRef<HTMLInputElement | HTMLTextAreaElement>>\n) {\n let {\n validationState = props.isInvalid ? 'invalid' : null,\n icon,\n isQuiet = false,\n isDisabled,\n multiLine,\n autoFocus,\n inputClassName,\n wrapperChildren,\n labelProps,\n inputProps,\n descriptionProps,\n errorMessageProps,\n inputRef: userInputRef,\n isLoading,\n loadingIndicator,\n validationIconClassName,\n disableFocusRing\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let domRef = useRef<HTMLDivElement>(null);\n let defaultInputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n let inputRef = userInputRef || defaultInputRef;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n let ElementType: React.ElementType = multiLine ? 'textarea' : 'input';\n let isInvalid = validationState === 'invalid' && !isDisabled;\n\n if (icon) {\n let UNSAFE_className = classNames(\n styles,\n icon.props && (icon.props as any).UNSAFE_className,\n 'spectrum-Textfield-icon'\n );\n\n icon = cloneElement(icon, {\n UNSAFE_className,\n size: 'S'\n } as any);\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/textfield');\n let validId = useId();\n let validationIcon = isInvalid ? (\n <AlertMedium />\n ) : (\n <CheckmarkMedium id={validId} aria-hidden aria-label={stringFormatter.format('valid')} />\n );\n let validation = cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n styles,\n 'spectrum-Textfield-validationIcon',\n validationIconClassName\n )\n });\n\n // Add validation icon IDREF to aria-describedby when validationState is valid\n let inputPropsAriaDescribedBy = inputProps['aria-describedby'];\n if (\n !isInvalid &&\n validationState === 'valid' &&\n !isLoading &&\n !isDisabled &&\n (!inputPropsAriaDescribedBy || !inputPropsAriaDescribedBy.includes(validId))\n ) {\n inputProps['aria-describedby'] = [inputPropsAriaDescribedBy, validId].join(' ').trim();\n }\n\n let {focusProps, isFocusVisible} = useFocusRing({\n isTextInput: true,\n autoFocus\n });\n\n let textField = (\n <div\n className={classNames(styles, 'spectrum-Textfield', {\n 'spectrum-Textfield--invalid': isInvalid,\n 'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,\n 'spectrum-Textfield--loadable': loadingIndicator,\n 'spectrum-Textfield--quiet': isQuiet,\n 'spectrum-Textfield--multiline': multiLine,\n 'focus-ring': !disableFocusRing && isFocusVisible\n })}>\n <ElementType\n {...mergeProps(inputProps, hoverProps, focusProps)}\n ref={inputRef as any}\n rows={multiLine ? 1 : undefined}\n className={classNames(\n styles,\n 'spectrum-Textfield-input',\n {\n 'spectrum-Textfield-inputIcon': icon,\n 'is-hovered': isHovered\n },\n inputClassName\n )}\n />\n {icon}\n {validationState && !isLoading && !isDisabled ? validation : null}\n {isLoading && loadingIndicator}\n {wrapperChildren}\n </div>\n );\n\n return (\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n wrapperClassName={classNames(styles, 'spectrum-Textfield-wrapper', {\n 'spectrum-Textfield-wrapper--quiet': isQuiet\n })}\n showErrorIcon={false}\n ref={domRef}>\n {textField}\n </Field>\n );\n});\n"],"names":[],"version":3,"file":"TextFieldBase.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AAgDM,MAAM,0DAAgB,CAAA,GAAA,iBAAS,EAAE,SAAS,cAC/C,KAAyB,EACzB,GAA8D;IAE9D,IAAI,mBACF,kBA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ectrum/src/textfield/TextFieldBase.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 AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames} from '../utils/classNames';\nimport {createFocusableRef} from '../utils/useDOMRef';\nimport {Field} from '../label/Field';\nimport intlMessages from '../../intl/textfield/*.json';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {PressEvents, RefObject, ValidationResult} from '@react-types/shared';\nimport React, {\n cloneElement,\n forwardRef,\n HTMLAttributes,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n ReactElement,\n Ref,\n TextareaHTMLAttributes,\n useImperativeHandle,\n useRef\n} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from './TextField';\nimport styles from '@adobe/spectrum-css-temp/components/textfield/vars.css';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useId} from 'react-aria/useId';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\n\ninterface TextFieldBaseProps\n extends\n Omit<SpectrumTextFieldProps, 'onChange' | 'validate'>,\n PressEvents,\n Partial<ValidationResult> {\n wrapperChildren?: ReactElement | ReactElement[];\n inputClassName?: string;\n validationIconClassName?: string;\n multiLine?: boolean;\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>;\n inputProps: InputHTMLAttributes<HTMLInputElement> | TextareaHTMLAttributes<HTMLTextAreaElement>;\n descriptionProps?: HTMLAttributes<HTMLElement>;\n errorMessageProps?: HTMLAttributes<HTMLElement>;\n inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement | null>;\n loadingIndicator?: ReactElement;\n isLoading?: boolean;\n disableFocusRing?: boolean;\n}\n\nexport const TextFieldBase = forwardRef(function TextFieldBase(\n props: TextFieldBaseProps,\n ref: Ref<TextFieldRef<HTMLInputElement | HTMLTextAreaElement>>\n) {\n let {\n validationState = props.isInvalid ? 'invalid' : null,\n icon,\n isQuiet = false,\n isDisabled,\n multiLine,\n autoFocus,\n inputClassName,\n wrapperChildren,\n labelProps,\n inputProps,\n descriptionProps,\n errorMessageProps,\n inputRef: userInputRef,\n isLoading,\n loadingIndicator,\n validationIconClassName,\n disableFocusRing\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let domRef = useRef<HTMLDivElement>(null);\n let defaultInputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n let inputRef = userInputRef || defaultInputRef;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n let ElementType: React.ElementType = multiLine ? 'textarea' : 'input';\n let isInvalid = validationState === 'invalid' && !isDisabled;\n\n if (icon) {\n let UNSAFE_className = classNames(\n styles,\n icon.props && (icon.props as any).UNSAFE_className,\n 'spectrum-Textfield-icon'\n );\n\n icon = cloneElement(icon, {\n UNSAFE_className,\n size: 'S'\n } as any);\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/textfield');\n let validId = useId();\n let validationIcon = isInvalid ? (\n <AlertMedium />\n ) : (\n <CheckmarkMedium id={validId} aria-hidden aria-label={stringFormatter.format('valid')} />\n );\n let validation = cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n styles,\n 'spectrum-Textfield-validationIcon',\n validationIconClassName\n )\n });\n\n // Add validation icon IDREF to aria-describedby when validationState is valid\n let inputPropsAriaDescribedBy = inputProps['aria-describedby'];\n if (\n !isInvalid &&\n validationState === 'valid' &&\n !isLoading &&\n !isDisabled &&\n (!inputPropsAriaDescribedBy || !inputPropsAriaDescribedBy.includes(validId))\n ) {\n // oxlint-disable-next-line react/react-compiler\n inputProps['aria-describedby'] = [inputPropsAriaDescribedBy, validId].join(' ').trim();\n }\n\n let {focusProps, isFocusVisible} = useFocusRing({\n isTextInput: true,\n autoFocus\n });\n\n let textField = (\n <div\n className={classNames(styles, 'spectrum-Textfield', {\n 'spectrum-Textfield--invalid': isInvalid,\n 'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,\n 'spectrum-Textfield--loadable': loadingIndicator,\n 'spectrum-Textfield--quiet': isQuiet,\n 'spectrum-Textfield--multiline': multiLine,\n 'focus-ring': !disableFocusRing && isFocusVisible\n })}>\n <ElementType\n {...mergeProps(inputProps, hoverProps, focusProps)}\n ref={inputRef as any}\n rows={multiLine ? 1 : undefined}\n className={classNames(\n styles,\n 'spectrum-Textfield-input',\n {\n 'spectrum-Textfield-inputIcon': icon,\n 'is-hovered': isHovered\n },\n inputClassName\n )}\n />\n {icon}\n {validationState && !isLoading && !isDisabled ? validation : null}\n {isLoading && loadingIndicator}\n {wrapperChildren}\n </div>\n );\n\n return (\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n wrapperClassName={classNames(styles, 'spectrum-Textfield-wrapper', {\n 'spectrum-Textfield-wrapper--quiet': isQuiet\n })}\n showErrorIcon={false}\n ref={domRef}>\n {textField}\n </Field>\n );\n});\n"],"names":[],"version":3,"file":"TextFieldBase.js.map"}
|