@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
|
@@ -18,6 +18,7 @@ function $9f6a882f2314049c$export$2e2bcd8739ae039(props) {
|
|
|
18
18
|
let { dropState: dropState, dragAndDropHooks: dragAndDropHooks } = (0, $kUAIr$useContext)((0, $9710157b2ac3a032$export$870039b0abfe3de0));
|
|
19
19
|
const { target: target, isPresentationOnly: isPresentationOnly } = props;
|
|
20
20
|
let ref = (0, $kUAIr$useRef)(null);
|
|
21
|
+
// oxlint-disable-next-line react/react-compiler
|
|
21
22
|
let { dropIndicatorProps: dropIndicatorProps } = dragAndDropHooks.useDropIndicator(props, dropState, ref);
|
|
22
23
|
let { visuallyHiddenProps: visuallyHiddenProps } = (0, $kUAIr$useVisuallyHidden)();
|
|
23
24
|
let isDropTarget = dropState.isDropTarget(target);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAYe,kDAA4B,KAA8B;IACvE,IAAI,aAAC,SAAS,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAc;IAC7D,MAAM,UAAC,MAAM,sBAAE,kBAAkB,EAAC,GAAG;IAErC,IAAI,MAAM,CAAA,GAAA,aAAK,EAAyB;IACxC,IAAI,sBAAC,kBAAkB,EAAC,GAAG,iBAAkB,gBAAgB,CAAE,OAAO,WAAY;IAClF,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,wBAAgB;IAE5C,IAAI,eAAe,UAAW,YAAY,CAAC;IAE3C,IAAI,CAAC,gBAAgB,kBAAkB,CAAC,cAAc,EACpD,OAAO;IAGT,qBACE,gCAAC;QAAI,MAAK;QAAM,eAAa,kBAAkB,CAAC,cAAc;qBAC5D,gCAAC;QACC,MAAK;QACL,iBAAc;QACd,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,8CAAS,GAAG,6CAA6C;YAC7E,yDAAyD;QAC3D;OACC,CAAC,oCACA,gCAAC;QAAK,GAAG,mBAAmB;QAAE,MAAK;QAAU,GAAG,kBAAkB;QAAE,KAAK;;AAKnF","sources":["packages/@adobe/react-spectrum/src/list/InsertionIndicator.tsx"],"sourcesContent":["import {classNames} from '../utils/classNames';\nimport {ItemDropTarget} from '@react-types/shared';\nimport listStyles from './styles.css';\nimport {ListViewContext} from './ListView';\nimport React, {JSX, useContext, useRef} from 'react';\nimport {useVisuallyHidden} from 'react-aria/VisuallyHidden';\n\ninterface InsertionIndicatorProps {\n target: ItemDropTarget;\n isPresentationOnly?: boolean;\n}\n\nexport default function InsertionIndicator(props: InsertionIndicatorProps): JSX.Element | null {\n let {dropState, dragAndDropHooks} = useContext(ListViewContext)!;\n const {target, isPresentationOnly} = props;\n\n let ref = useRef<HTMLDivElement | null>(null);\n let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!(props, dropState!, ref);\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n let isDropTarget = dropState!.isDropTarget(target);\n\n if (!isDropTarget && dropIndicatorProps['aria-hidden']) {\n return null;\n }\n\n return (\n <div role=\"row\" aria-hidden={dropIndicatorProps['aria-hidden']}>\n <div\n role=\"gridcell\"\n aria-selected=\"false\"\n className={classNames(listStyles, 'react-spectrum-ListViewInsertionIndicator', {\n 'react-spectrum-ListViewInsertionIndicator--dropTarget': isDropTarget\n })}>\n {!isPresentationOnly && (\n <div {...visuallyHiddenProps} role=\"button\" {...dropIndicatorProps} ref={ref} />\n )}\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"InsertionIndicator.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAYe,kDAA4B,KAA8B;IACvE,IAAI,aAAC,SAAS,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAc;IAC7D,MAAM,UAAC,MAAM,sBAAE,kBAAkB,EAAC,GAAG;IAErC,IAAI,MAAM,CAAA,GAAA,aAAK,EAAyB;IACxC,gDAAgD;IAChD,IAAI,sBAAC,kBAAkB,EAAC,GAAG,iBAAkB,gBAAgB,CAAE,OAAO,WAAY;IAClF,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,wBAAgB;IAE5C,IAAI,eAAe,UAAW,YAAY,CAAC;IAE3C,IAAI,CAAC,gBAAgB,kBAAkB,CAAC,cAAc,EACpD,OAAO;IAGT,qBACE,gCAAC;QAAI,MAAK;QAAM,eAAa,kBAAkB,CAAC,cAAc;qBAC5D,gCAAC;QACC,MAAK;QACL,iBAAc;QACd,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,8CAAS,GAAG,6CAA6C;YAC7E,yDAAyD;QAC3D;OACC,CAAC,oCACA,gCAAC;QAAK,GAAG,mBAAmB;QAAE,MAAK;QAAU,GAAG,kBAAkB;QAAE,KAAK;;AAKnF","sources":["packages/@adobe/react-spectrum/src/list/InsertionIndicator.tsx"],"sourcesContent":["import {classNames} from '../utils/classNames';\nimport {ItemDropTarget} from '@react-types/shared';\nimport listStyles from './styles.css';\nimport {ListViewContext} from './ListView';\nimport React, {JSX, useContext, useRef} from 'react';\nimport {useVisuallyHidden} from 'react-aria/VisuallyHidden';\n\ninterface InsertionIndicatorProps {\n target: ItemDropTarget;\n isPresentationOnly?: boolean;\n}\n\nexport default function InsertionIndicator(props: InsertionIndicatorProps): JSX.Element | null {\n let {dropState, dragAndDropHooks} = useContext(ListViewContext)!;\n const {target, isPresentationOnly} = props;\n\n let ref = useRef<HTMLDivElement | null>(null);\n // oxlint-disable-next-line react/react-compiler\n let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!(props, dropState!, ref);\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n let isDropTarget = dropState!.isDropTarget(target);\n\n if (!isDropTarget && dropIndicatorProps['aria-hidden']) {\n return null;\n }\n\n return (\n <div role=\"row\" aria-hidden={dropIndicatorProps['aria-hidden']}>\n <div\n role=\"gridcell\"\n aria-selected=\"false\"\n className={classNames(listStyles, 'react-spectrum-ListViewInsertionIndicator', {\n 'react-spectrum-ListViewInsertionIndicator--dropTarget': isDropTarget\n })}>\n {!isPresentationOnly && (\n <div {...visuallyHiddenProps} role=\"button\" {...dropIndicatorProps} ref={ref} />\n )}\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"InsertionIndicator.mjs.map"}
|
|
@@ -87,6 +87,7 @@ function $65a78aedcedf442b$var$useListLayout(state, density, overflowMode) {
|
|
|
87
87
|
let layout = (0, $b4U5H$react.useMemo)(()=>new (0, $d428a6aed80ea2ae$exports.ListViewLayout)({
|
|
88
88
|
estimatedRowHeight: $65a78aedcedf442b$var$ROW_HEIGHTS[density || 'regular'][scale]
|
|
89
89
|
}), // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
90
|
+
// oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps
|
|
90
91
|
[
|
|
91
92
|
scale,
|
|
92
93
|
density,
|
|
@@ -118,11 +119,13 @@ const $65a78aedcedf442b$export$84d0dd190d551cd1 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
118
119
|
let dragState = null;
|
|
119
120
|
let preview = (0, $b4U5H$react.useRef)(null);
|
|
120
121
|
if (isListDraggable && dragAndDropHooks) {
|
|
122
|
+
// oxlint-disable-next-line react/react-compiler
|
|
121
123
|
dragState = dragAndDropHooks.useDraggableCollectionState({
|
|
122
124
|
collection: collection,
|
|
123
125
|
selectionManager: selectionManager,
|
|
124
126
|
preview: preview
|
|
125
127
|
});
|
|
128
|
+
// oxlint-disable-next-line react/react-compiler
|
|
126
129
|
dragAndDropHooks.useDraggableCollection({}, dragState, domRef);
|
|
127
130
|
}
|
|
128
131
|
let layout = $65a78aedcedf442b$var$useListLayout(state, props.density || 'regular', overflowMode);
|
|
@@ -131,10 +134,12 @@ const $65a78aedcedf442b$export$84d0dd190d551cd1 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
131
134
|
let droppableCollection = null;
|
|
132
135
|
let isRootDropTarget = false;
|
|
133
136
|
if (isListDroppable && dragAndDropHooks) {
|
|
137
|
+
// oxlint-disable-next-line react/react-compiler
|
|
134
138
|
dropState = dragAndDropHooks.useDroppableCollectionState({
|
|
135
139
|
collection: collection,
|
|
136
140
|
selectionManager: selectionManager
|
|
137
141
|
});
|
|
142
|
+
// oxlint-disable-next-line react/react-compiler
|
|
138
143
|
droppableCollection = dragAndDropHooks.useDroppableCollection({
|
|
139
144
|
keyboardDelegate: new (0, $b4U5H$reactariaListKeyboardDelegate.ListKeyboardDelegate)({
|
|
140
145
|
collection: collection,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;AAoGM,MAAM,0DAAkB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAuC;AAEzF,MAAM,oCAAc;IAClB,SAAS;QACP,QAAQ;QACR,OAAO;IACT;IACA,SAAS;QACP,QAAQ;QACR,OAAO;IACT;IACA,UAAU;QACR,QAAQ;QACR,OAAO;IACT;AACF;AAEA,SAAS,oCACP,KAAmB,EACnB,OAA4C,EAC5C,YAAsD;IAEtD,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,qCAAU;IACxB,IAAI,SAAS,CAAA,GAAA,oBAAM,EACjB,IACE,IAAI,CAAA,GAAA,wCAAa,EAAK;YACpB,oBAAoB,iCAAW,CAAC,WAAW,UAAU,CAAC,MAAM;QAC9D,IACF,uDAAuD;IACvD;QAAC;QAAO;QAAS;KAAa;IAGhC,OAAO;A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c;QAAO;QAC3D,oBAAoB,MAAM,UAAU,CAAC,WAAW,CAAC,KAAK,GAAG,KAAK;;AAKxE;AAEA,SAAS;IACP,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE;IACzB,IAAI,kBAAkB,CAAA,GAAA,uEAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,qBACE,0DAAC,2DACC,0DAAC,CAAA,GAAA,wCAAa;QACZ,iBAAA;QACA,cACE,MAAM,UAAU,CAAC,IAAI,GAAG,IACpB,gBAAgB,MAAM,CAAC,iBACvB,gBAAgB,MAAM,CAAC;;AAKrC;AAEA,SAAS;IACP,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE;IACpC,IAAI,aAAa,mBAAmB,qBAAqB;IACzD,IAAI,cAAc,MAChB,OAAO;IAGT,qBAAO,0DAAC,6CAAiB;AAC3B;AAEA,SAAS,sCAAgB,YAAC,QAAQ,EAAC;IACjC,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE;IACzB,qBACE,0DAAC;QACC,MAAK;QACL,iBAAe,MAAM,UAAU,CAAC,IAAI,GAAG;QACvC,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAS,GAAG,2CAA2C;YAC3E,wDAAwD,MAAM,UAAU,CAAC,IAAI,GAAG;QAClF;qBACA,0DAAC;QAAI,MAAK;OAAY;AAG5B","sources":["packages/@adobe/react-spectrum/src/list/ListView.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {AriaGridListProps, useGridList} from 'react-aria/useGridList';\nimport {\n AsyncLoadable,\n DOMRef,\n Key,\n LoadingState,\n Node,\n SpectrumSelectionProps,\n StyleProps\n} from '@react-types/shared';\nimport {classNames} from '../utils/classNames';\nimport type {DragAndDropHooks} from '../dnd/useDragAndDrop';\nimport type {DraggableCollectionState} from 'react-stately/useDraggableCollectionState';\nimport type {DroppableCollectionResult} from 'react-aria/useDroppableCollection';\nimport type {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport InsertionIndicator from './InsertionIndicator';\nimport intlMessages from '../../intl/list/*.json';\nimport {ListKeyboardDelegate} from 'react-aria/ListKeyboardDelegate';\nimport {ListState, useListState} from 'react-stately/useListState';\nimport listStyles from './styles.css';\nimport {ListViewItem} from './ListViewItem';\nimport {ListViewLayout} from './ListViewLayout';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {\n JSX,\n ReactElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport RootDropIndicator from './RootDropIndicator';\nimport {DragPreview as SpectrumDragPreview} from './DragPreview';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProvider} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\nimport {Virtualizer} from 'react-aria/private/virtualizer/Virtualizer';\n\nexport interface SpectrumListViewProps<T>\n extends\n Omit<AriaGridListProps<T>, 'keyboardNavigationBehavior'>,\n StyleProps,\n SpectrumSelectionProps,\n Omit<AsyncLoadable, 'isLoading'> {\n /**\n * Sets the amount of vertical padding within each cell.\n *\n * @default 'regular'\n */\n density?: 'compact' | 'regular' | 'spacious';\n /** Whether the ListView should be displayed with a quiet style. */\n isQuiet?: boolean;\n /**\n * The current loading state of the ListView. Determines whether or not the progress circle should\n * be shown.\n */\n loadingState?: LoadingState;\n /**\n * Sets the text behavior for the row contents.\n *\n * @default 'truncate'\n */\n overflowMode?: 'truncate' | 'wrap';\n /** Sets what the ListView should render when there is no content to display. */\n renderEmptyState?: () => JSX.Element;\n /**\n * Handler that is called when a user performs an action on an item. The exact user event depends\n * on the collection's `selectionStyle` prop and the interaction modality.\n */\n onAction?: (key: Key) => void;\n /**\n * The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for\n * the ListView.\n */\n dragAndDropHooks?: DragAndDropHooks<NoInfer<T>>['dragAndDropHooks'];\n}\n\ninterface ListViewContextValue<T> {\n state: ListState<T>;\n dragState: DraggableCollectionState | null;\n dropState: DroppableCollectionState | null;\n dragAndDropHooks?: DragAndDropHooks<T>['dragAndDropHooks'];\n onAction?: (key: Key) => void;\n isListDraggable: boolean;\n isListDroppable: boolean;\n layout: ListViewLayout<T>;\n loadingState?: LoadingState;\n renderEmptyState?: () => JSX.Element;\n}\n\nexport const ListViewContext = React.createContext<ListViewContextValue<unknown> | null>(null);\n\nconst ROW_HEIGHTS = {\n compact: {\n medium: 32,\n large: 40\n },\n regular: {\n medium: 40,\n large: 50\n },\n spacious: {\n medium: 48,\n large: 60\n }\n};\n\nfunction useListLayout<T>(\n state: ListState<T>,\n density: SpectrumListViewProps<T>['density'],\n overflowMode: SpectrumListViewProps<T>['overflowMode']\n) {\n let {scale} = useProvider();\n let layout = useMemo(\n () =>\n new ListViewLayout<T>({\n estimatedRowHeight: ROW_HEIGHTS[density || 'regular'][scale]\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [scale, density, overflowMode]\n );\n\n return layout;\n}\n\n/**\n * A ListView displays a list of interactive items, and allows a user to navigate, select, or\n * perform an action.\n */\nexport const ListView = React.forwardRef(function ListView<T extends object>(\n props: SpectrumListViewProps<T>,\n ref: DOMRef<HTMLDivElement>\n) {\n let {\n density = 'regular',\n loadingState,\n onLoadMore,\n isQuiet,\n overflowMode = 'truncate',\n onAction,\n dragAndDropHooks,\n renderEmptyState,\n ...otherProps\n } = props;\n let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;\n let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;\n let dragHooksProvided = useRef(isListDraggable);\n let dropHooksProvided = useRef(isListDroppable);\n useEffect(() => {\n if (dragHooksProvided.current !== isListDraggable && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.'\n );\n }\n if (dropHooksProvided.current !== isListDroppable && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.'\n );\n }\n }, [isListDraggable, isListDroppable]);\n\n let domRef = useDOMRef(ref);\n let state = useListState({\n ...props,\n selectionBehavior: props.selectionStyle === 'highlight' ? 'replace' : 'toggle'\n });\n let {collection, selectionManager} = state;\n let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n\n let {styleProps} = useStyleProps(props);\n let dragState: DraggableCollectionState | null = null;\n let preview = useRef(null);\n if (isListDraggable && dragAndDropHooks) {\n dragState = dragAndDropHooks.useDraggableCollectionState!({\n collection,\n selectionManager,\n preview\n });\n dragAndDropHooks.useDraggableCollection!({}, dragState, domRef);\n }\n let layout = useListLayout(state, props.density || 'regular', overflowMode);\n\n let DragPreview = dragAndDropHooks?.DragPreview;\n let dropState: DroppableCollectionState | null = null;\n let droppableCollection: DroppableCollectionResult | null = null;\n let isRootDropTarget = false;\n if (isListDroppable && dragAndDropHooks) {\n dropState = dragAndDropHooks.useDroppableCollectionState!({\n collection,\n selectionManager\n });\n droppableCollection = dragAndDropHooks.useDroppableCollection!(\n {\n keyboardDelegate: new ListKeyboardDelegate({\n collection,\n disabledKeys: dragState?.draggingKeys.size ? undefined : selectionManager.disabledKeys,\n ref: domRef,\n layoutDelegate: layout\n }),\n dropTargetDelegate: layout\n },\n dropState,\n domRef\n );\n\n isRootDropTarget = dropState.isDropTarget({type: 'root'});\n }\n\n let {gridProps} = useGridList(\n {\n ...props,\n isVirtualized: true,\n layoutDelegate: layout,\n onAction\n },\n state,\n domRef\n );\n\n let focusedKey = selectionManager.focusedKey;\n let dropTargetKey: Key | null = null;\n if (dropState?.target?.type === 'item') {\n dropTargetKey = dropState.target.key;\n if (dropState.target.dropPosition === 'after') {\n // Normalize to the \"before\" drop position since we only render those in the DOM.\n dropTargetKey = state.collection.getKeyAfter(dropTargetKey) ?? dropTargetKey;\n }\n }\n\n let persistedKeys = useMemo(() => {\n return new Set([focusedKey, dropTargetKey].filter(k => k !== null));\n }, [focusedKey, dropTargetKey]);\n\n // wait for layout to get accurate measurements\n let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = useState(false);\n let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = useState(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n if (domRef.current) {\n // 2 is the width of the border which is not part of the box size\n setVerticalScollbarVisible(domRef.current.clientWidth + 2 < domRef.current.offsetWidth);\n setHorizontalScollbarVisible(domRef.current.clientHeight + 2 < domRef.current.offsetHeight);\n }\n });\n\n let hasAnyChildren = useMemo(\n () => [...collection].some(item => item.hasChildNodes),\n [collection]\n );\n\n return (\n <ListViewContext.Provider\n value={{\n state,\n dragState,\n dropState,\n dragAndDropHooks,\n onAction,\n isListDraggable,\n isListDroppable,\n layout,\n loadingState,\n renderEmptyState\n }}>\n <FocusScope>\n <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>\n <Virtualizer\n {...mergeProps(\n isListDroppable ? droppableCollection?.collectionProps : null,\n gridProps\n )}\n {...filterDOMProps(otherProps)}\n {...gridProps}\n {...styleProps}\n onScroll={undefined}\n isLoading={isLoading}\n onLoadMore={onLoadMore}\n ref={domRef}\n persistedKeys={persistedKeys}\n scrollDirection=\"vertical\"\n className={classNames(\n listStyles,\n 'react-spectrum-ListView',\n `react-spectrum-ListView--${density}`,\n 'react-spectrum-ListView--emphasized',\n {\n 'react-spectrum-ListView--quiet': isQuiet,\n 'react-spectrum-ListView--loadingMore': loadingState === 'loadingMore',\n 'react-spectrum-ListView--draggable': !!isListDraggable,\n 'react-spectrum-ListView--dropTarget': !!isRootDropTarget,\n 'react-spectrum-ListView--isVerticalScrollbarVisible': isVerticalScrollbarVisible,\n 'react-spectrum-ListView--isHorizontalScrollbarVisible':\n isHorizontalScrollbarVisible,\n 'react-spectrum-ListView--hasAnyChildren': hasAnyChildren,\n 'react-spectrum-ListView--wrap': overflowMode === 'wrap'\n },\n styleProps.className\n )}\n layout={layout}\n layoutOptions={useMemo(() => ({isLoading}), [isLoading])}\n collection={collection}>\n {useCallback((type, item: Node<T>) => {\n if (type === 'item') {\n return <Item item={item} />;\n } else if (type === 'loader') {\n return <LoadingView />;\n } else if (type === 'placeholder') {\n return <EmptyState />;\n }\n }, [])}\n </Virtualizer>\n </FocusRing>\n </FocusScope>\n {DragPreview && isListDraggable && dragAndDropHooks && dragState && (\n <DragPreview ref={preview}>\n {() => {\n if (dragState.draggedKey == null) {\n return null;\n }\n if (dragAndDropHooks.renderPreview) {\n return dragAndDropHooks.renderPreview(dragState.draggingKeys, dragState.draggedKey);\n }\n let item = state.collection.getItem(dragState.draggedKey);\n if (!item) {\n return null;\n }\n let itemCount = dragState.draggingKeys.size;\n let itemHeight = layout.getLayoutInfo(dragState.draggedKey)?.rect.height ?? 0;\n return (\n <SpectrumDragPreview\n item={item}\n itemCount={itemCount}\n itemHeight={itemHeight}\n density={density}\n />\n );\n }}\n </DragPreview>\n )}\n </ListViewContext.Provider>\n );\n}) as <T>(props: SpectrumListViewProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\n\nfunction Item({item}: {item: Node<unknown>}) {\n let {isListDroppable, state, onAction} = useContext(ListViewContext)!;\n return (\n <>\n {isListDroppable && state.collection.getKeyBefore(item.key) == null && (\n <RootDropIndicator key=\"root\" />\n )}\n {isListDroppable && (\n <InsertionIndicator\n key={`${item.key}-before`}\n target={{key: item.key, type: 'item', dropPosition: 'before'}}\n />\n )}\n <ListViewItem item={item} isEmphasized hasActions={!!onAction} />\n {isListDroppable && (\n <InsertionIndicator\n key={`${item.key}-after`}\n target={{key: item.key, type: 'item', dropPosition: 'after'}}\n isPresentationOnly={state.collection.getKeyAfter(item.key) != null}\n />\n )}\n </>\n );\n}\n\nfunction LoadingView() {\n let {state} = useContext(ListViewContext)!;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/list');\n return (\n <CenteredWrapper>\n <ProgressCircle\n isIndeterminate\n aria-label={\n state.collection.size > 0\n ? stringFormatter.format('loadingMore')\n : stringFormatter.format('loading')\n }\n />\n </CenteredWrapper>\n );\n}\n\nfunction EmptyState() {\n let {renderEmptyState} = useContext(ListViewContext)!;\n let emptyState = renderEmptyState ? renderEmptyState() : null;\n if (emptyState == null) {\n return null;\n }\n\n return <CenteredWrapper>{emptyState}</CenteredWrapper>;\n}\n\nfunction CenteredWrapper({children}) {\n let {state} = useContext(ListViewContext)!;\n return (\n <div\n role=\"row\"\n aria-rowindex={state.collection.size + 1}\n className={classNames(listStyles, 'react-spectrum-ListView-centeredWrapper', {\n 'react-spectrum-ListView-centeredWrapper--loadingMore': state.collection.size > 0\n })}>\n <div role=\"gridcell\">{children}</div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"ListView.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;AAoGM,MAAM,0DAAkB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAuC;AAEzF,MAAM,oCAAc;IAClB,SAAS;QACP,QAAQ;QACR,OAAO;IACT;IACA,SAAS;QACP,QAAQ;QACR,OAAO;IACT;IACA,UAAU;QACR,QAAQ;QACR,OAAO;IACT;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AAI,GAAG;QAClF;qBACA,0DAAC;QAAI,MAAK;OAAY;AAG5B","sources":["packages/@adobe/react-spectrum/src/list/ListView.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {AriaGridListProps, useGridList} from 'react-aria/useGridList';\nimport {\n AsyncLoadable,\n DOMRef,\n Key,\n LoadingState,\n Node,\n SpectrumSelectionProps,\n StyleProps\n} from '@react-types/shared';\nimport {classNames} from '../utils/classNames';\nimport type {DragAndDropHooks} from '../dnd/useDragAndDrop';\nimport type {DraggableCollectionState} from 'react-stately/useDraggableCollectionState';\nimport type {DroppableCollectionResult} from 'react-aria/useDroppableCollection';\nimport type {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport InsertionIndicator from './InsertionIndicator';\nimport intlMessages from '../../intl/list/*.json';\nimport {ListKeyboardDelegate} from 'react-aria/ListKeyboardDelegate';\nimport {ListState, useListState} from 'react-stately/useListState';\nimport listStyles from './styles.css';\nimport {ListViewItem} from './ListViewItem';\nimport {ListViewLayout} from './ListViewLayout';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {\n JSX,\n ReactElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport RootDropIndicator from './RootDropIndicator';\nimport {DragPreview as SpectrumDragPreview} from './DragPreview';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProvider} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\nimport {Virtualizer} from 'react-aria/private/virtualizer/Virtualizer';\n\nexport interface SpectrumListViewProps<T>\n extends\n Omit<AriaGridListProps<T>, 'keyboardNavigationBehavior'>,\n StyleProps,\n SpectrumSelectionProps,\n Omit<AsyncLoadable, 'isLoading'> {\n /**\n * Sets the amount of vertical padding within each cell.\n *\n * @default 'regular'\n */\n density?: 'compact' | 'regular' | 'spacious';\n /** Whether the ListView should be displayed with a quiet style. */\n isQuiet?: boolean;\n /**\n * The current loading state of the ListView. Determines whether or not the progress circle should\n * be shown.\n */\n loadingState?: LoadingState;\n /**\n * Sets the text behavior for the row contents.\n *\n * @default 'truncate'\n */\n overflowMode?: 'truncate' | 'wrap';\n /** Sets what the ListView should render when there is no content to display. */\n renderEmptyState?: () => JSX.Element;\n /**\n * Handler that is called when a user performs an action on an item. The exact user event depends\n * on the collection's `selectionStyle` prop and the interaction modality.\n */\n onAction?: (key: Key) => void;\n /**\n * The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for\n * the ListView.\n */\n dragAndDropHooks?: DragAndDropHooks<NoInfer<T>>['dragAndDropHooks'];\n}\n\ninterface ListViewContextValue<T> {\n state: ListState<T>;\n dragState: DraggableCollectionState | null;\n dropState: DroppableCollectionState | null;\n dragAndDropHooks?: DragAndDropHooks<T>['dragAndDropHooks'];\n onAction?: (key: Key) => void;\n isListDraggable: boolean;\n isListDroppable: boolean;\n layout: ListViewLayout<T>;\n loadingState?: LoadingState;\n renderEmptyState?: () => JSX.Element;\n}\n\nexport const ListViewContext = React.createContext<ListViewContextValue<unknown> | null>(null);\n\nconst ROW_HEIGHTS = {\n compact: {\n medium: 32,\n large: 40\n },\n regular: {\n medium: 40,\n large: 50\n },\n spacious: {\n medium: 48,\n large: 60\n }\n};\n\nfunction useListLayout<T>(\n state: ListState<T>,\n density: SpectrumListViewProps<T>['density'],\n overflowMode: SpectrumListViewProps<T>['overflowMode']\n) {\n let {scale} = useProvider();\n let layout = useMemo(\n () =>\n new ListViewLayout<T>({\n estimatedRowHeight: ROW_HEIGHTS[density || 'regular'][scale]\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps\n [scale, density, overflowMode]\n );\n\n return layout;\n}\n\n/**\n * A ListView displays a list of interactive items, and allows a user to navigate, select, or\n * perform an action.\n */\nexport const ListView = React.forwardRef(function ListView<T extends object>(\n props: SpectrumListViewProps<T>,\n ref: DOMRef<HTMLDivElement>\n) {\n let {\n density = 'regular',\n loadingState,\n onLoadMore,\n isQuiet,\n overflowMode = 'truncate',\n onAction,\n dragAndDropHooks,\n renderEmptyState,\n ...otherProps\n } = props;\n let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;\n let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;\n let dragHooksProvided = useRef(isListDraggable);\n let dropHooksProvided = useRef(isListDroppable);\n useEffect(() => {\n if (dragHooksProvided.current !== isListDraggable && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.'\n );\n }\n if (dropHooksProvided.current !== isListDroppable && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.'\n );\n }\n }, [isListDraggable, isListDroppable]);\n\n let domRef = useDOMRef(ref);\n let state = useListState({\n ...props,\n selectionBehavior: props.selectionStyle === 'highlight' ? 'replace' : 'toggle'\n });\n let {collection, selectionManager} = state;\n let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n\n let {styleProps} = useStyleProps(props);\n let dragState: DraggableCollectionState | null = null;\n let preview = useRef(null);\n if (isListDraggable && dragAndDropHooks) {\n // oxlint-disable-next-line react/react-compiler\n dragState = dragAndDropHooks.useDraggableCollectionState!({\n collection,\n selectionManager,\n preview\n });\n // oxlint-disable-next-line react/react-compiler\n dragAndDropHooks.useDraggableCollection!({}, dragState, domRef);\n }\n let layout = useListLayout(state, props.density || 'regular', overflowMode);\n\n let DragPreview = dragAndDropHooks?.DragPreview;\n let dropState: DroppableCollectionState | null = null;\n let droppableCollection: DroppableCollectionResult | null = null;\n let isRootDropTarget = false;\n if (isListDroppable && dragAndDropHooks) {\n // oxlint-disable-next-line react/react-compiler\n dropState = dragAndDropHooks.useDroppableCollectionState!({\n collection,\n selectionManager\n });\n // oxlint-disable-next-line react/react-compiler\n droppableCollection = dragAndDropHooks.useDroppableCollection!(\n {\n keyboardDelegate: new ListKeyboardDelegate({\n collection,\n disabledKeys: dragState?.draggingKeys.size ? undefined : selectionManager.disabledKeys,\n ref: domRef,\n layoutDelegate: layout\n }),\n dropTargetDelegate: layout\n },\n dropState,\n domRef\n );\n\n isRootDropTarget = dropState.isDropTarget({type: 'root'});\n }\n\n let {gridProps} = useGridList(\n {\n ...props,\n isVirtualized: true,\n layoutDelegate: layout,\n onAction\n },\n state,\n domRef\n );\n\n let focusedKey = selectionManager.focusedKey;\n let dropTargetKey: Key | null = null;\n if (dropState?.target?.type === 'item') {\n dropTargetKey = dropState.target.key;\n if (dropState.target.dropPosition === 'after') {\n // Normalize to the \"before\" drop position since we only render those in the DOM.\n dropTargetKey = state.collection.getKeyAfter(dropTargetKey) ?? dropTargetKey;\n }\n }\n\n let persistedKeys = useMemo(() => {\n return new Set([focusedKey, dropTargetKey].filter(k => k !== null));\n }, [focusedKey, dropTargetKey]);\n\n // wait for layout to get accurate measurements\n let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = useState(false);\n let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = useState(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n if (domRef.current) {\n // 2 is the width of the border which is not part of the box size\n setVerticalScollbarVisible(domRef.current.clientWidth + 2 < domRef.current.offsetWidth);\n setHorizontalScollbarVisible(domRef.current.clientHeight + 2 < domRef.current.offsetHeight);\n }\n });\n\n let hasAnyChildren = useMemo(\n () => [...collection].some(item => item.hasChildNodes),\n [collection]\n );\n\n return (\n <ListViewContext.Provider\n value={{\n state,\n dragState,\n dropState,\n dragAndDropHooks,\n onAction,\n isListDraggable,\n isListDroppable,\n layout,\n loadingState,\n renderEmptyState\n }}>\n <FocusScope>\n <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>\n <Virtualizer\n {...mergeProps(\n isListDroppable ? droppableCollection?.collectionProps : null,\n gridProps\n )}\n {...filterDOMProps(otherProps)}\n {...gridProps}\n {...styleProps}\n onScroll={undefined}\n isLoading={isLoading}\n onLoadMore={onLoadMore}\n ref={domRef}\n persistedKeys={persistedKeys}\n scrollDirection=\"vertical\"\n className={classNames(\n listStyles,\n 'react-spectrum-ListView',\n `react-spectrum-ListView--${density}`,\n 'react-spectrum-ListView--emphasized',\n {\n 'react-spectrum-ListView--quiet': isQuiet,\n 'react-spectrum-ListView--loadingMore': loadingState === 'loadingMore',\n 'react-spectrum-ListView--draggable': !!isListDraggable,\n 'react-spectrum-ListView--dropTarget': !!isRootDropTarget,\n 'react-spectrum-ListView--isVerticalScrollbarVisible': isVerticalScrollbarVisible,\n 'react-spectrum-ListView--isHorizontalScrollbarVisible':\n isHorizontalScrollbarVisible,\n 'react-spectrum-ListView--hasAnyChildren': hasAnyChildren,\n 'react-spectrum-ListView--wrap': overflowMode === 'wrap'\n },\n styleProps.className\n )}\n layout={layout}\n layoutOptions={useMemo(() => ({isLoading}), [isLoading])}\n collection={collection}>\n {useCallback((type, item: Node<T>) => {\n if (type === 'item') {\n return <Item item={item} />;\n } else if (type === 'loader') {\n return <LoadingView />;\n } else if (type === 'placeholder') {\n return <EmptyState />;\n }\n }, [])}\n </Virtualizer>\n </FocusRing>\n </FocusScope>\n {DragPreview && isListDraggable && dragAndDropHooks && dragState && (\n <DragPreview ref={preview}>\n {() => {\n if (dragState.draggedKey == null) {\n return null;\n }\n if (dragAndDropHooks.renderPreview) {\n return dragAndDropHooks.renderPreview(dragState.draggingKeys, dragState.draggedKey);\n }\n let item = state.collection.getItem(dragState.draggedKey);\n if (!item) {\n return null;\n }\n let itemCount = dragState.draggingKeys.size;\n let itemHeight = layout.getLayoutInfo(dragState.draggedKey)?.rect.height ?? 0;\n return (\n <SpectrumDragPreview\n item={item}\n itemCount={itemCount}\n itemHeight={itemHeight}\n density={density}\n />\n );\n }}\n </DragPreview>\n )}\n </ListViewContext.Provider>\n );\n}) as <T>(props: SpectrumListViewProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\n\nfunction Item({item}: {item: Node<unknown>}) {\n let {isListDroppable, state, onAction} = useContext(ListViewContext)!;\n return (\n <>\n {isListDroppable && state.collection.getKeyBefore(item.key) == null && (\n <RootDropIndicator key=\"root\" />\n )}\n {isListDroppable && (\n <InsertionIndicator\n key={`${item.key}-before`}\n target={{key: item.key, type: 'item', dropPosition: 'before'}}\n />\n )}\n <ListViewItem item={item} isEmphasized hasActions={!!onAction} />\n {isListDroppable && (\n <InsertionIndicator\n key={`${item.key}-after`}\n target={{key: item.key, type: 'item', dropPosition: 'after'}}\n isPresentationOnly={state.collection.getKeyAfter(item.key) != null}\n />\n )}\n </>\n );\n}\n\nfunction LoadingView() {\n let {state} = useContext(ListViewContext)!;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/list');\n return (\n <CenteredWrapper>\n <ProgressCircle\n isIndeterminate\n aria-label={\n state.collection.size > 0\n ? stringFormatter.format('loadingMore')\n : stringFormatter.format('loading')\n }\n />\n </CenteredWrapper>\n );\n}\n\nfunction EmptyState() {\n let {renderEmptyState} = useContext(ListViewContext)!;\n let emptyState = renderEmptyState ? renderEmptyState() : null;\n if (emptyState == null) {\n return null;\n }\n\n return <CenteredWrapper>{emptyState}</CenteredWrapper>;\n}\n\nfunction CenteredWrapper({children}) {\n let {state} = useContext(ListViewContext)!;\n return (\n <div\n role=\"row\"\n aria-rowindex={state.collection.size + 1}\n className={classNames(listStyles, 'react-spectrum-ListView-centeredWrapper', {\n 'react-spectrum-ListView-centeredWrapper--loadingMore': state.collection.size > 0\n })}>\n <div role=\"gridcell\">{children}</div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"ListView.cjs.map"}
|
|
@@ -80,6 +80,7 @@ function $bcd1a74211acbd51$var$useListLayout(state, density, overflowMode) {
|
|
|
80
80
|
let layout = (0, $jU4mA$useMemo)(()=>new (0, $d5bbdf752e3f3896$export$dab781655dfbb7d3)({
|
|
81
81
|
estimatedRowHeight: $bcd1a74211acbd51$var$ROW_HEIGHTS[density || 'regular'][scale]
|
|
82
82
|
}), // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
83
|
+
// oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps
|
|
83
84
|
[
|
|
84
85
|
scale,
|
|
85
86
|
density,
|
|
@@ -112,11 +113,13 @@ const $bcd1a74211acbd51$export$84d0dd190d551cd1 = /*#__PURE__*/ (0, $jU4mA$react
|
|
|
112
113
|
let dragState = null;
|
|
113
114
|
let preview = (0, $jU4mA$useRef)(null);
|
|
114
115
|
if (isListDraggable && dragAndDropHooks) {
|
|
116
|
+
// oxlint-disable-next-line react/react-compiler
|
|
115
117
|
dragState = dragAndDropHooks.useDraggableCollectionState({
|
|
116
118
|
collection: collection,
|
|
117
119
|
selectionManager: selectionManager,
|
|
118
120
|
preview: preview
|
|
119
121
|
});
|
|
122
|
+
// oxlint-disable-next-line react/react-compiler
|
|
120
123
|
dragAndDropHooks.useDraggableCollection({}, dragState, domRef);
|
|
121
124
|
}
|
|
122
125
|
let layout = $bcd1a74211acbd51$var$useListLayout(state, props.density || 'regular', overflowMode);
|
|
@@ -125,10 +128,12 @@ const $bcd1a74211acbd51$export$84d0dd190d551cd1 = /*#__PURE__*/ (0, $jU4mA$react
|
|
|
125
128
|
let droppableCollection = null;
|
|
126
129
|
let isRootDropTarget = false;
|
|
127
130
|
if (isListDroppable && dragAndDropHooks) {
|
|
131
|
+
// oxlint-disable-next-line react/react-compiler
|
|
128
132
|
dropState = dragAndDropHooks.useDroppableCollectionState({
|
|
129
133
|
collection: collection,
|
|
130
134
|
selectionManager: selectionManager
|
|
131
135
|
});
|
|
136
|
+
// oxlint-disable-next-line react/react-compiler
|
|
132
137
|
droppableCollection = dragAndDropHooks.useDroppableCollection({
|
|
133
138
|
keyboardDelegate: new (0, $jU4mA$ListKeyboardDelegate)({
|
|
134
139
|
collection: collection,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;AAoGM,MAAM,0DAAkB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAuC;AAEzF,MAAM,oCAAc;IAClB,SAAS;QACP,QAAQ;QACR,OAAO;IACT;IACA,SAAS;QACP,QAAQ;QACR,OAAO;IACT;IACA,UAAU;QACR,QAAQ;QACR,OAAO;IACT;AACF;AAEA,SAAS,oCACP,KAAmB,EACnB,OAA4C,EAC5C,YAAsD;IAEtD,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,yCAAU;IACxB,IAAI,SAAS,CAAA,GAAA,cAAM,EACjB,IACE,IAAI,CAAA,GAAA,yCAAa,EAAK;YACpB,oBAAoB,iCAAW,CAAC,WAAW,UAAU,CAAC,MAAM;QAC9D,IACF,uDAAuD;IACvD;QAAC;QAAO;QAAS;KAAa;IAGhC,OAAO;AACT;AAMO,MAAM,0DAAW,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,SAChD,KAA+B,EAC/B,GAA2B;QA0FvB;IAxFJ,IAAI,WACF,UAAU,yBACV,YAAY,cACZ,UAAU,WACV,OAAO,gBACP,eAAe,sBACf,QAAQ,oBACR,gBAAgB,oBAChB,gBAAgB,EAChB,GAAG,YACJ,GAAG;IACJ,IAAI,kBAAkB,CAA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G;YAAE,MAAM;YAAQ,cAAc;QAAO;QAC3D,oBAAoB,MAAM,UAAU,CAAC,WAAW,CAAC,KAAK,GAAG,KAAK;;AAKxE;AAEA,SAAS;IACP,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IACzB,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,8CAAW,GAAG;IAChE,qBACE,gCAAC,2DACC,gCAAC,CAAA,GAAA,yCAAa;QACZ,iBAAA;QACA,cACE,MAAM,UAAU,CAAC,IAAI,GAAG,IACpB,gBAAgB,MAAM,CAAC,iBACvB,gBAAgB,MAAM,CAAC;;AAKrC;AAEA,SAAS;IACP,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IACpC,IAAI,aAAa,mBAAmB,qBAAqB;IACzD,IAAI,cAAc,MAChB,OAAO;IAGT,qBAAO,gCAAC,6CAAiB;AAC3B;AAEA,SAAS,sCAAgB,YAAC,QAAQ,EAAC;IACjC,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IACzB,qBACE,gCAAC;QACC,MAAK;QACL,iBAAe,MAAM,UAAU,CAAC,IAAI,GAAG;QACvC,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,8CAAS,GAAG,2CAA2C;YAC3E,wDAAwD,MAAM,UAAU,CAAC,IAAI,GAAG;QAClF;qBACA,gCAAC;QAAI,MAAK;OAAY;AAG5B","sources":["packages/@adobe/react-spectrum/src/list/ListView.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {AriaGridListProps, useGridList} from 'react-aria/useGridList';\nimport {\n AsyncLoadable,\n DOMRef,\n Key,\n LoadingState,\n Node,\n SpectrumSelectionProps,\n StyleProps\n} from '@react-types/shared';\nimport {classNames} from '../utils/classNames';\nimport type {DragAndDropHooks} from '../dnd/useDragAndDrop';\nimport type {DraggableCollectionState} from 'react-stately/useDraggableCollectionState';\nimport type {DroppableCollectionResult} from 'react-aria/useDroppableCollection';\nimport type {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport InsertionIndicator from './InsertionIndicator';\nimport intlMessages from '../../intl/list/*.json';\nimport {ListKeyboardDelegate} from 'react-aria/ListKeyboardDelegate';\nimport {ListState, useListState} from 'react-stately/useListState';\nimport listStyles from './styles.css';\nimport {ListViewItem} from './ListViewItem';\nimport {ListViewLayout} from './ListViewLayout';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {\n JSX,\n ReactElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport RootDropIndicator from './RootDropIndicator';\nimport {DragPreview as SpectrumDragPreview} from './DragPreview';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProvider} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\nimport {Virtualizer} from 'react-aria/private/virtualizer/Virtualizer';\n\nexport interface SpectrumListViewProps<T>\n extends\n Omit<AriaGridListProps<T>, 'keyboardNavigationBehavior'>,\n StyleProps,\n SpectrumSelectionProps,\n Omit<AsyncLoadable, 'isLoading'> {\n /**\n * Sets the amount of vertical padding within each cell.\n *\n * @default 'regular'\n */\n density?: 'compact' | 'regular' | 'spacious';\n /** Whether the ListView should be displayed with a quiet style. */\n isQuiet?: boolean;\n /**\n * The current loading state of the ListView. Determines whether or not the progress circle should\n * be shown.\n */\n loadingState?: LoadingState;\n /**\n * Sets the text behavior for the row contents.\n *\n * @default 'truncate'\n */\n overflowMode?: 'truncate' | 'wrap';\n /** Sets what the ListView should render when there is no content to display. */\n renderEmptyState?: () => JSX.Element;\n /**\n * Handler that is called when a user performs an action on an item. The exact user event depends\n * on the collection's `selectionStyle` prop and the interaction modality.\n */\n onAction?: (key: Key) => void;\n /**\n * The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for\n * the ListView.\n */\n dragAndDropHooks?: DragAndDropHooks<NoInfer<T>>['dragAndDropHooks'];\n}\n\ninterface ListViewContextValue<T> {\n state: ListState<T>;\n dragState: DraggableCollectionState | null;\n dropState: DroppableCollectionState | null;\n dragAndDropHooks?: DragAndDropHooks<T>['dragAndDropHooks'];\n onAction?: (key: Key) => void;\n isListDraggable: boolean;\n isListDroppable: boolean;\n layout: ListViewLayout<T>;\n loadingState?: LoadingState;\n renderEmptyState?: () => JSX.Element;\n}\n\nexport const ListViewContext = React.createContext<ListViewContextValue<unknown> | null>(null);\n\nconst ROW_HEIGHTS = {\n compact: {\n medium: 32,\n large: 40\n },\n regular: {\n medium: 40,\n large: 50\n },\n spacious: {\n medium: 48,\n large: 60\n }\n};\n\nfunction useListLayout<T>(\n state: ListState<T>,\n density: SpectrumListViewProps<T>['density'],\n overflowMode: SpectrumListViewProps<T>['overflowMode']\n) {\n let {scale} = useProvider();\n let layout = useMemo(\n () =>\n new ListViewLayout<T>({\n estimatedRowHeight: ROW_HEIGHTS[density || 'regular'][scale]\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [scale, density, overflowMode]\n );\n\n return layout;\n}\n\n/**\n * A ListView displays a list of interactive items, and allows a user to navigate, select, or\n * perform an action.\n */\nexport const ListView = React.forwardRef(function ListView<T extends object>(\n props: SpectrumListViewProps<T>,\n ref: DOMRef<HTMLDivElement>\n) {\n let {\n density = 'regular',\n loadingState,\n onLoadMore,\n isQuiet,\n overflowMode = 'truncate',\n onAction,\n dragAndDropHooks,\n renderEmptyState,\n ...otherProps\n } = props;\n let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;\n let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;\n let dragHooksProvided = useRef(isListDraggable);\n let dropHooksProvided = useRef(isListDroppable);\n useEffect(() => {\n if (dragHooksProvided.current !== isListDraggable && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.'\n );\n }\n if (dropHooksProvided.current !== isListDroppable && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.'\n );\n }\n }, [isListDraggable, isListDroppable]);\n\n let domRef = useDOMRef(ref);\n let state = useListState({\n ...props,\n selectionBehavior: props.selectionStyle === 'highlight' ? 'replace' : 'toggle'\n });\n let {collection, selectionManager} = state;\n let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n\n let {styleProps} = useStyleProps(props);\n let dragState: DraggableCollectionState | null = null;\n let preview = useRef(null);\n if (isListDraggable && dragAndDropHooks) {\n dragState = dragAndDropHooks.useDraggableCollectionState!({\n collection,\n selectionManager,\n preview\n });\n dragAndDropHooks.useDraggableCollection!({}, dragState, domRef);\n }\n let layout = useListLayout(state, props.density || 'regular', overflowMode);\n\n let DragPreview = dragAndDropHooks?.DragPreview;\n let dropState: DroppableCollectionState | null = null;\n let droppableCollection: DroppableCollectionResult | null = null;\n let isRootDropTarget = false;\n if (isListDroppable && dragAndDropHooks) {\n dropState = dragAndDropHooks.useDroppableCollectionState!({\n collection,\n selectionManager\n });\n droppableCollection = dragAndDropHooks.useDroppableCollection!(\n {\n keyboardDelegate: new ListKeyboardDelegate({\n collection,\n disabledKeys: dragState?.draggingKeys.size ? undefined : selectionManager.disabledKeys,\n ref: domRef,\n layoutDelegate: layout\n }),\n dropTargetDelegate: layout\n },\n dropState,\n domRef\n );\n\n isRootDropTarget = dropState.isDropTarget({type: 'root'});\n }\n\n let {gridProps} = useGridList(\n {\n ...props,\n isVirtualized: true,\n layoutDelegate: layout,\n onAction\n },\n state,\n domRef\n );\n\n let focusedKey = selectionManager.focusedKey;\n let dropTargetKey: Key | null = null;\n if (dropState?.target?.type === 'item') {\n dropTargetKey = dropState.target.key;\n if (dropState.target.dropPosition === 'after') {\n // Normalize to the \"before\" drop position since we only render those in the DOM.\n dropTargetKey = state.collection.getKeyAfter(dropTargetKey) ?? dropTargetKey;\n }\n }\n\n let persistedKeys = useMemo(() => {\n return new Set([focusedKey, dropTargetKey].filter(k => k !== null));\n }, [focusedKey, dropTargetKey]);\n\n // wait for layout to get accurate measurements\n let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = useState(false);\n let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = useState(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n if (domRef.current) {\n // 2 is the width of the border which is not part of the box size\n setVerticalScollbarVisible(domRef.current.clientWidth + 2 < domRef.current.offsetWidth);\n setHorizontalScollbarVisible(domRef.current.clientHeight + 2 < domRef.current.offsetHeight);\n }\n });\n\n let hasAnyChildren = useMemo(\n () => [...collection].some(item => item.hasChildNodes),\n [collection]\n );\n\n return (\n <ListViewContext.Provider\n value={{\n state,\n dragState,\n dropState,\n dragAndDropHooks,\n onAction,\n isListDraggable,\n isListDroppable,\n layout,\n loadingState,\n renderEmptyState\n }}>\n <FocusScope>\n <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>\n <Virtualizer\n {...mergeProps(\n isListDroppable ? droppableCollection?.collectionProps : null,\n gridProps\n )}\n {...filterDOMProps(otherProps)}\n {...gridProps}\n {...styleProps}\n onScroll={undefined}\n isLoading={isLoading}\n onLoadMore={onLoadMore}\n ref={domRef}\n persistedKeys={persistedKeys}\n scrollDirection=\"vertical\"\n className={classNames(\n listStyles,\n 'react-spectrum-ListView',\n `react-spectrum-ListView--${density}`,\n 'react-spectrum-ListView--emphasized',\n {\n 'react-spectrum-ListView--quiet': isQuiet,\n 'react-spectrum-ListView--loadingMore': loadingState === 'loadingMore',\n 'react-spectrum-ListView--draggable': !!isListDraggable,\n 'react-spectrum-ListView--dropTarget': !!isRootDropTarget,\n 'react-spectrum-ListView--isVerticalScrollbarVisible': isVerticalScrollbarVisible,\n 'react-spectrum-ListView--isHorizontalScrollbarVisible':\n isHorizontalScrollbarVisible,\n 'react-spectrum-ListView--hasAnyChildren': hasAnyChildren,\n 'react-spectrum-ListView--wrap': overflowMode === 'wrap'\n },\n styleProps.className\n )}\n layout={layout}\n layoutOptions={useMemo(() => ({isLoading}), [isLoading])}\n collection={collection}>\n {useCallback((type, item: Node<T>) => {\n if (type === 'item') {\n return <Item item={item} />;\n } else if (type === 'loader') {\n return <LoadingView />;\n } else if (type === 'placeholder') {\n return <EmptyState />;\n }\n }, [])}\n </Virtualizer>\n </FocusRing>\n </FocusScope>\n {DragPreview && isListDraggable && dragAndDropHooks && dragState && (\n <DragPreview ref={preview}>\n {() => {\n if (dragState.draggedKey == null) {\n return null;\n }\n if (dragAndDropHooks.renderPreview) {\n return dragAndDropHooks.renderPreview(dragState.draggingKeys, dragState.draggedKey);\n }\n let item = state.collection.getItem(dragState.draggedKey);\n if (!item) {\n return null;\n }\n let itemCount = dragState.draggingKeys.size;\n let itemHeight = layout.getLayoutInfo(dragState.draggedKey)?.rect.height ?? 0;\n return (\n <SpectrumDragPreview\n item={item}\n itemCount={itemCount}\n itemHeight={itemHeight}\n density={density}\n />\n );\n }}\n </DragPreview>\n )}\n </ListViewContext.Provider>\n );\n}) as <T>(props: SpectrumListViewProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\n\nfunction Item({item}: {item: Node<unknown>}) {\n let {isListDroppable, state, onAction} = useContext(ListViewContext)!;\n return (\n <>\n {isListDroppable && state.collection.getKeyBefore(item.key) == null && (\n <RootDropIndicator key=\"root\" />\n )}\n {isListDroppable && (\n <InsertionIndicator\n key={`${item.key}-before`}\n target={{key: item.key, type: 'item', dropPosition: 'before'}}\n />\n )}\n <ListViewItem item={item} isEmphasized hasActions={!!onAction} />\n {isListDroppable && (\n <InsertionIndicator\n key={`${item.key}-after`}\n target={{key: item.key, type: 'item', dropPosition: 'after'}}\n isPresentationOnly={state.collection.getKeyAfter(item.key) != null}\n />\n )}\n </>\n );\n}\n\nfunction LoadingView() {\n let {state} = useContext(ListViewContext)!;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/list');\n return (\n <CenteredWrapper>\n <ProgressCircle\n isIndeterminate\n aria-label={\n state.collection.size > 0\n ? stringFormatter.format('loadingMore')\n : stringFormatter.format('loading')\n }\n />\n </CenteredWrapper>\n );\n}\n\nfunction EmptyState() {\n let {renderEmptyState} = useContext(ListViewContext)!;\n let emptyState = renderEmptyState ? renderEmptyState() : null;\n if (emptyState == null) {\n return null;\n }\n\n return <CenteredWrapper>{emptyState}</CenteredWrapper>;\n}\n\nfunction CenteredWrapper({children}) {\n let {state} = useContext(ListViewContext)!;\n return (\n <div\n role=\"row\"\n aria-rowindex={state.collection.size + 1}\n className={classNames(listStyles, 'react-spectrum-ListView-centeredWrapper', {\n 'react-spectrum-ListView-centeredWrapper--loadingMore': state.collection.size > 0\n })}>\n <div role=\"gridcell\">{children}</div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"ListView.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;AAoGM,MAAM,0DAAkB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAuC;AAEzF,MAAM,oCAAc;IAClB,SAAS;QACP,QAAQ;QACR,OAAO;IACT;IACA,SAAS;QACP,QAAQ;QACR,OAAO;IACT;IACA,UAAU;QACR,QAAQ;QAC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gCAAC,6CAAiB;AAC3B;AAEA,SAAS,sCAAgB,YAAC,QAAQ,EAAC;IACjC,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IACzB,qBACE,gCAAC;QACC,MAAK;QACL,iBAAe,MAAM,UAAU,CAAC,IAAI,GAAG;QACvC,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,8CAAS,GAAG,2CAA2C;YAC3E,wDAAwD,MAAM,UAAU,CAAC,IAAI,GAAG;QAClF;qBACA,gCAAC;QAAI,MAAK;OAAY;AAG5B","sources":["packages/@adobe/react-spectrum/src/list/ListView.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {AriaGridListProps, useGridList} from 'react-aria/useGridList';\nimport {\n AsyncLoadable,\n DOMRef,\n Key,\n LoadingState,\n Node,\n SpectrumSelectionProps,\n StyleProps\n} from '@react-types/shared';\nimport {classNames} from '../utils/classNames';\nimport type {DragAndDropHooks} from '../dnd/useDragAndDrop';\nimport type {DraggableCollectionState} from 'react-stately/useDraggableCollectionState';\nimport type {DroppableCollectionResult} from 'react-aria/useDroppableCollection';\nimport type {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport InsertionIndicator from './InsertionIndicator';\nimport intlMessages from '../../intl/list/*.json';\nimport {ListKeyboardDelegate} from 'react-aria/ListKeyboardDelegate';\nimport {ListState, useListState} from 'react-stately/useListState';\nimport listStyles from './styles.css';\nimport {ListViewItem} from './ListViewItem';\nimport {ListViewLayout} from './ListViewLayout';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {\n JSX,\n ReactElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport RootDropIndicator from './RootDropIndicator';\nimport {DragPreview as SpectrumDragPreview} from './DragPreview';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProvider} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\nimport {Virtualizer} from 'react-aria/private/virtualizer/Virtualizer';\n\nexport interface SpectrumListViewProps<T>\n extends\n Omit<AriaGridListProps<T>, 'keyboardNavigationBehavior'>,\n StyleProps,\n SpectrumSelectionProps,\n Omit<AsyncLoadable, 'isLoading'> {\n /**\n * Sets the amount of vertical padding within each cell.\n *\n * @default 'regular'\n */\n density?: 'compact' | 'regular' | 'spacious';\n /** Whether the ListView should be displayed with a quiet style. */\n isQuiet?: boolean;\n /**\n * The current loading state of the ListView. Determines whether or not the progress circle should\n * be shown.\n */\n loadingState?: LoadingState;\n /**\n * Sets the text behavior for the row contents.\n *\n * @default 'truncate'\n */\n overflowMode?: 'truncate' | 'wrap';\n /** Sets what the ListView should render when there is no content to display. */\n renderEmptyState?: () => JSX.Element;\n /**\n * Handler that is called when a user performs an action on an item. The exact user event depends\n * on the collection's `selectionStyle` prop and the interaction modality.\n */\n onAction?: (key: Key) => void;\n /**\n * The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for\n * the ListView.\n */\n dragAndDropHooks?: DragAndDropHooks<NoInfer<T>>['dragAndDropHooks'];\n}\n\ninterface ListViewContextValue<T> {\n state: ListState<T>;\n dragState: DraggableCollectionState | null;\n dropState: DroppableCollectionState | null;\n dragAndDropHooks?: DragAndDropHooks<T>['dragAndDropHooks'];\n onAction?: (key: Key) => void;\n isListDraggable: boolean;\n isListDroppable: boolean;\n layout: ListViewLayout<T>;\n loadingState?: LoadingState;\n renderEmptyState?: () => JSX.Element;\n}\n\nexport const ListViewContext = React.createContext<ListViewContextValue<unknown> | null>(null);\n\nconst ROW_HEIGHTS = {\n compact: {\n medium: 32,\n large: 40\n },\n regular: {\n medium: 40,\n large: 50\n },\n spacious: {\n medium: 48,\n large: 60\n }\n};\n\nfunction useListLayout<T>(\n state: ListState<T>,\n density: SpectrumListViewProps<T>['density'],\n overflowMode: SpectrumListViewProps<T>['overflowMode']\n) {\n let {scale} = useProvider();\n let layout = useMemo(\n () =>\n new ListViewLayout<T>({\n estimatedRowHeight: ROW_HEIGHTS[density || 'regular'][scale]\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps\n [scale, density, overflowMode]\n );\n\n return layout;\n}\n\n/**\n * A ListView displays a list of interactive items, and allows a user to navigate, select, or\n * perform an action.\n */\nexport const ListView = React.forwardRef(function ListView<T extends object>(\n props: SpectrumListViewProps<T>,\n ref: DOMRef<HTMLDivElement>\n) {\n let {\n density = 'regular',\n loadingState,\n onLoadMore,\n isQuiet,\n overflowMode = 'truncate',\n onAction,\n dragAndDropHooks,\n renderEmptyState,\n ...otherProps\n } = props;\n let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;\n let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;\n let dragHooksProvided = useRef(isListDraggable);\n let dropHooksProvided = useRef(isListDroppable);\n useEffect(() => {\n if (dragHooksProvided.current !== isListDraggable && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.'\n );\n }\n if (dropHooksProvided.current !== isListDroppable && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.'\n );\n }\n }, [isListDraggable, isListDroppable]);\n\n let domRef = useDOMRef(ref);\n let state = useListState({\n ...props,\n selectionBehavior: props.selectionStyle === 'highlight' ? 'replace' : 'toggle'\n });\n let {collection, selectionManager} = state;\n let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n\n let {styleProps} = useStyleProps(props);\n let dragState: DraggableCollectionState | null = null;\n let preview = useRef(null);\n if (isListDraggable && dragAndDropHooks) {\n // oxlint-disable-next-line react/react-compiler\n dragState = dragAndDropHooks.useDraggableCollectionState!({\n collection,\n selectionManager,\n preview\n });\n // oxlint-disable-next-line react/react-compiler\n dragAndDropHooks.useDraggableCollection!({}, dragState, domRef);\n }\n let layout = useListLayout(state, props.density || 'regular', overflowMode);\n\n let DragPreview = dragAndDropHooks?.DragPreview;\n let dropState: DroppableCollectionState | null = null;\n let droppableCollection: DroppableCollectionResult | null = null;\n let isRootDropTarget = false;\n if (isListDroppable && dragAndDropHooks) {\n // oxlint-disable-next-line react/react-compiler\n dropState = dragAndDropHooks.useDroppableCollectionState!({\n collection,\n selectionManager\n });\n // oxlint-disable-next-line react/react-compiler\n droppableCollection = dragAndDropHooks.useDroppableCollection!(\n {\n keyboardDelegate: new ListKeyboardDelegate({\n collection,\n disabledKeys: dragState?.draggingKeys.size ? undefined : selectionManager.disabledKeys,\n ref: domRef,\n layoutDelegate: layout\n }),\n dropTargetDelegate: layout\n },\n dropState,\n domRef\n );\n\n isRootDropTarget = dropState.isDropTarget({type: 'root'});\n }\n\n let {gridProps} = useGridList(\n {\n ...props,\n isVirtualized: true,\n layoutDelegate: layout,\n onAction\n },\n state,\n domRef\n );\n\n let focusedKey = selectionManager.focusedKey;\n let dropTargetKey: Key | null = null;\n if (dropState?.target?.type === 'item') {\n dropTargetKey = dropState.target.key;\n if (dropState.target.dropPosition === 'after') {\n // Normalize to the \"before\" drop position since we only render those in the DOM.\n dropTargetKey = state.collection.getKeyAfter(dropTargetKey) ?? dropTargetKey;\n }\n }\n\n let persistedKeys = useMemo(() => {\n return new Set([focusedKey, dropTargetKey].filter(k => k !== null));\n }, [focusedKey, dropTargetKey]);\n\n // wait for layout to get accurate measurements\n let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = useState(false);\n let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = useState(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n if (domRef.current) {\n // 2 is the width of the border which is not part of the box size\n setVerticalScollbarVisible(domRef.current.clientWidth + 2 < domRef.current.offsetWidth);\n setHorizontalScollbarVisible(domRef.current.clientHeight + 2 < domRef.current.offsetHeight);\n }\n });\n\n let hasAnyChildren = useMemo(\n () => [...collection].some(item => item.hasChildNodes),\n [collection]\n );\n\n return (\n <ListViewContext.Provider\n value={{\n state,\n dragState,\n dropState,\n dragAndDropHooks,\n onAction,\n isListDraggable,\n isListDroppable,\n layout,\n loadingState,\n renderEmptyState\n }}>\n <FocusScope>\n <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>\n <Virtualizer\n {...mergeProps(\n isListDroppable ? droppableCollection?.collectionProps : null,\n gridProps\n )}\n {...filterDOMProps(otherProps)}\n {...gridProps}\n {...styleProps}\n onScroll={undefined}\n isLoading={isLoading}\n onLoadMore={onLoadMore}\n ref={domRef}\n persistedKeys={persistedKeys}\n scrollDirection=\"vertical\"\n className={classNames(\n listStyles,\n 'react-spectrum-ListView',\n `react-spectrum-ListView--${density}`,\n 'react-spectrum-ListView--emphasized',\n {\n 'react-spectrum-ListView--quiet': isQuiet,\n 'react-spectrum-ListView--loadingMore': loadingState === 'loadingMore',\n 'react-spectrum-ListView--draggable': !!isListDraggable,\n 'react-spectrum-ListView--dropTarget': !!isRootDropTarget,\n 'react-spectrum-ListView--isVerticalScrollbarVisible': isVerticalScrollbarVisible,\n 'react-spectrum-ListView--isHorizontalScrollbarVisible':\n isHorizontalScrollbarVisible,\n 'react-spectrum-ListView--hasAnyChildren': hasAnyChildren,\n 'react-spectrum-ListView--wrap': overflowMode === 'wrap'\n },\n styleProps.className\n )}\n layout={layout}\n layoutOptions={useMemo(() => ({isLoading}), [isLoading])}\n collection={collection}>\n {useCallback((type, item: Node<T>) => {\n if (type === 'item') {\n return <Item item={item} />;\n } else if (type === 'loader') {\n return <LoadingView />;\n } else if (type === 'placeholder') {\n return <EmptyState />;\n }\n }, [])}\n </Virtualizer>\n </FocusRing>\n </FocusScope>\n {DragPreview && isListDraggable && dragAndDropHooks && dragState && (\n <DragPreview ref={preview}>\n {() => {\n if (dragState.draggedKey == null) {\n return null;\n }\n if (dragAndDropHooks.renderPreview) {\n return dragAndDropHooks.renderPreview(dragState.draggingKeys, dragState.draggedKey);\n }\n let item = state.collection.getItem(dragState.draggedKey);\n if (!item) {\n return null;\n }\n let itemCount = dragState.draggingKeys.size;\n let itemHeight = layout.getLayoutInfo(dragState.draggedKey)?.rect.height ?? 0;\n return (\n <SpectrumDragPreview\n item={item}\n itemCount={itemCount}\n itemHeight={itemHeight}\n density={density}\n />\n );\n }}\n </DragPreview>\n )}\n </ListViewContext.Provider>\n );\n}) as <T>(props: SpectrumListViewProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\n\nfunction Item({item}: {item: Node<unknown>}) {\n let {isListDroppable, state, onAction} = useContext(ListViewContext)!;\n return (\n <>\n {isListDroppable && state.collection.getKeyBefore(item.key) == null && (\n <RootDropIndicator key=\"root\" />\n )}\n {isListDroppable && (\n <InsertionIndicator\n key={`${item.key}-before`}\n target={{key: item.key, type: 'item', dropPosition: 'before'}}\n />\n )}\n <ListViewItem item={item} isEmphasized hasActions={!!onAction} />\n {isListDroppable && (\n <InsertionIndicator\n key={`${item.key}-after`}\n target={{key: item.key, type: 'item', dropPosition: 'after'}}\n isPresentationOnly={state.collection.getKeyAfter(item.key) != null}\n />\n )}\n </>\n );\n}\n\nfunction LoadingView() {\n let {state} = useContext(ListViewContext)!;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/list');\n return (\n <CenteredWrapper>\n <ProgressCircle\n isIndeterminate\n aria-label={\n state.collection.size > 0\n ? stringFormatter.format('loadingMore')\n : stringFormatter.format('loading')\n }\n />\n </CenteredWrapper>\n );\n}\n\nfunction EmptyState() {\n let {renderEmptyState} = useContext(ListViewContext)!;\n let emptyState = renderEmptyState ? renderEmptyState() : null;\n if (emptyState == null) {\n return null;\n }\n\n return <CenteredWrapper>{emptyState}</CenteredWrapper>;\n}\n\nfunction CenteredWrapper({children}) {\n let {state} = useContext(ListViewContext)!;\n return (\n <div\n role=\"row\"\n aria-rowindex={state.collection.size + 1}\n className={classNames(listStyles, 'react-spectrum-ListView-centeredWrapper', {\n 'react-spectrum-ListView-centeredWrapper--loadingMore': state.collection.size > 0\n })}>\n <div role=\"gridcell\">{children}</div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"ListView.js.map"}
|
|
@@ -80,6 +80,7 @@ function $9710157b2ac3a032$var$useListLayout(state, density, overflowMode) {
|
|
|
80
80
|
let layout = (0, $dzLUI$useMemo)(()=>new (0, $f1f5a4c1b08ae7d1$export$dab781655dfbb7d3)({
|
|
81
81
|
estimatedRowHeight: $9710157b2ac3a032$var$ROW_HEIGHTS[density || 'regular'][scale]
|
|
82
82
|
}), // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
83
|
+
// oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps
|
|
83
84
|
[
|
|
84
85
|
scale,
|
|
85
86
|
density,
|
|
@@ -111,11 +112,13 @@ const $9710157b2ac3a032$export$84d0dd190d551cd1 = /*#__PURE__*/ (0, $dzLUI$react
|
|
|
111
112
|
let dragState = null;
|
|
112
113
|
let preview = (0, $dzLUI$useRef)(null);
|
|
113
114
|
if (isListDraggable && dragAndDropHooks) {
|
|
115
|
+
// oxlint-disable-next-line react/react-compiler
|
|
114
116
|
dragState = dragAndDropHooks.useDraggableCollectionState({
|
|
115
117
|
collection: collection,
|
|
116
118
|
selectionManager: selectionManager,
|
|
117
119
|
preview: preview
|
|
118
120
|
});
|
|
121
|
+
// oxlint-disable-next-line react/react-compiler
|
|
119
122
|
dragAndDropHooks.useDraggableCollection({}, dragState, domRef);
|
|
120
123
|
}
|
|
121
124
|
let layout = $9710157b2ac3a032$var$useListLayout(state, props.density || 'regular', overflowMode);
|
|
@@ -124,10 +127,12 @@ const $9710157b2ac3a032$export$84d0dd190d551cd1 = /*#__PURE__*/ (0, $dzLUI$react
|
|
|
124
127
|
let droppableCollection = null;
|
|
125
128
|
let isRootDropTarget = false;
|
|
126
129
|
if (isListDroppable && dragAndDropHooks) {
|
|
130
|
+
// oxlint-disable-next-line react/react-compiler
|
|
127
131
|
dropState = dragAndDropHooks.useDroppableCollectionState({
|
|
128
132
|
collection: collection,
|
|
129
133
|
selectionManager: selectionManager
|
|
130
134
|
});
|
|
135
|
+
// oxlint-disable-next-line react/react-compiler
|
|
131
136
|
droppableCollection = dragAndDropHooks.useDroppableCollection({
|
|
132
137
|
keyboardDelegate: new (0, $dzLUI$ListKeyboardDelegate)({
|
|
133
138
|
collection: collection,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;AAoGM,MAAM,0DAAkB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAuC;AAEzF,MAAM,oCAAc;IAClB,SAAS;QACP,QAAQ;QACR,OAAO;IACT;IACA,SAAS;QACP,QAAQ;QACR,OAAO;IACT;IACA,UAAU;QACR,QAAQ;QACR,OAAO;IACT;AACF;AAEA,SAAS,oCACP,KAAmB,EACnB,OAA4C,EAC5C,YAAsD;IAEtD,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,yCAAU;IACxB,IAAI,SAAS,CAAA,GAAA,cAAM,EACjB,IACE,IAAI,CAAA,GAAA,yCAAa,EAAK;YACpB,oBAAoB,iCAAW,CAAC,WAAW,UAAU,CAAC,MAAM;QAC9D,IACF,uDAAuD;IACvD;QAAC;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AAE,MAAM;YAAQ,cAAc;QAAO;QAC3D,oBAAoB,MAAM,UAAU,CAAC,WAAW,CAAC,KAAK,GAAG,KAAK;;AAKxE;AAEA,SAAS;IACP,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IACzB,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,+CAAW,GAAG;IAChE,qBACE,gCAAC,2DACC,gCAAC,CAAA,GAAA,yCAAa;QACZ,iBAAA;QACA,cACE,MAAM,UAAU,CAAC,IAAI,GAAG,IACpB,gBAAgB,MAAM,CAAC,iBACvB,gBAAgB,MAAM,CAAC;;AAKrC;AAEA,SAAS;IACP,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IACpC,IAAI,aAAa,mBAAmB,qBAAqB;IACzD,IAAI,cAAc,MAChB,OAAO;IAGT,qBAAO,gCAAC,6CAAiB;AAC3B;AAEA,SAAS,sCAAgB,YAAC,QAAQ,EAAC;IACjC,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IACzB,qBACE,gCAAC;QACC,MAAK;QACL,iBAAe,MAAM,UAAU,CAAC,IAAI,GAAG;QACvC,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,8CAAS,GAAG,2CAA2C;YAC3E,wDAAwD,MAAM,UAAU,CAAC,IAAI,GAAG;QAClF;qBACA,gCAAC;QAAI,MAAK;OAAY;AAG5B","sources":["packages/@adobe/react-spectrum/src/list/ListView.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {AriaGridListProps, useGridList} from 'react-aria/useGridList';\nimport {\n AsyncLoadable,\n DOMRef,\n Key,\n LoadingState,\n Node,\n SpectrumSelectionProps,\n StyleProps\n} from '@react-types/shared';\nimport {classNames} from '../utils/classNames';\nimport type {DragAndDropHooks} from '../dnd/useDragAndDrop';\nimport type {DraggableCollectionState} from 'react-stately/useDraggableCollectionState';\nimport type {DroppableCollectionResult} from 'react-aria/useDroppableCollection';\nimport type {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport InsertionIndicator from './InsertionIndicator';\nimport intlMessages from '../../intl/list/*.json';\nimport {ListKeyboardDelegate} from 'react-aria/ListKeyboardDelegate';\nimport {ListState, useListState} from 'react-stately/useListState';\nimport listStyles from './styles.css';\nimport {ListViewItem} from './ListViewItem';\nimport {ListViewLayout} from './ListViewLayout';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {\n JSX,\n ReactElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport RootDropIndicator from './RootDropIndicator';\nimport {DragPreview as SpectrumDragPreview} from './DragPreview';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProvider} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\nimport {Virtualizer} from 'react-aria/private/virtualizer/Virtualizer';\n\nexport interface SpectrumListViewProps<T>\n extends\n Omit<AriaGridListProps<T>, 'keyboardNavigationBehavior'>,\n StyleProps,\n SpectrumSelectionProps,\n Omit<AsyncLoadable, 'isLoading'> {\n /**\n * Sets the amount of vertical padding within each cell.\n *\n * @default 'regular'\n */\n density?: 'compact' | 'regular' | 'spacious';\n /** Whether the ListView should be displayed with a quiet style. */\n isQuiet?: boolean;\n /**\n * The current loading state of the ListView. Determines whether or not the progress circle should\n * be shown.\n */\n loadingState?: LoadingState;\n /**\n * Sets the text behavior for the row contents.\n *\n * @default 'truncate'\n */\n overflowMode?: 'truncate' | 'wrap';\n /** Sets what the ListView should render when there is no content to display. */\n renderEmptyState?: () => JSX.Element;\n /**\n * Handler that is called when a user performs an action on an item. The exact user event depends\n * on the collection's `selectionStyle` prop and the interaction modality.\n */\n onAction?: (key: Key) => void;\n /**\n * The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for\n * the ListView.\n */\n dragAndDropHooks?: DragAndDropHooks<NoInfer<T>>['dragAndDropHooks'];\n}\n\ninterface ListViewContextValue<T> {\n state: ListState<T>;\n dragState: DraggableCollectionState | null;\n dropState: DroppableCollectionState | null;\n dragAndDropHooks?: DragAndDropHooks<T>['dragAndDropHooks'];\n onAction?: (key: Key) => void;\n isListDraggable: boolean;\n isListDroppable: boolean;\n layout: ListViewLayout<T>;\n loadingState?: LoadingState;\n renderEmptyState?: () => JSX.Element;\n}\n\nexport const ListViewContext = React.createContext<ListViewContextValue<unknown> | null>(null);\n\nconst ROW_HEIGHTS = {\n compact: {\n medium: 32,\n large: 40\n },\n regular: {\n medium: 40,\n large: 50\n },\n spacious: {\n medium: 48,\n large: 60\n }\n};\n\nfunction useListLayout<T>(\n state: ListState<T>,\n density: SpectrumListViewProps<T>['density'],\n overflowMode: SpectrumListViewProps<T>['overflowMode']\n) {\n let {scale} = useProvider();\n let layout = useMemo(\n () =>\n new ListViewLayout<T>({\n estimatedRowHeight: ROW_HEIGHTS[density || 'regular'][scale]\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [scale, density, overflowMode]\n );\n\n return layout;\n}\n\n/**\n * A ListView displays a list of interactive items, and allows a user to navigate, select, or\n * perform an action.\n */\nexport const ListView = React.forwardRef(function ListView<T extends object>(\n props: SpectrumListViewProps<T>,\n ref: DOMRef<HTMLDivElement>\n) {\n let {\n density = 'regular',\n loadingState,\n onLoadMore,\n isQuiet,\n overflowMode = 'truncate',\n onAction,\n dragAndDropHooks,\n renderEmptyState,\n ...otherProps\n } = props;\n let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;\n let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;\n let dragHooksProvided = useRef(isListDraggable);\n let dropHooksProvided = useRef(isListDroppable);\n useEffect(() => {\n if (dragHooksProvided.current !== isListDraggable && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.'\n );\n }\n if (dropHooksProvided.current !== isListDroppable && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.'\n );\n }\n }, [isListDraggable, isListDroppable]);\n\n let domRef = useDOMRef(ref);\n let state = useListState({\n ...props,\n selectionBehavior: props.selectionStyle === 'highlight' ? 'replace' : 'toggle'\n });\n let {collection, selectionManager} = state;\n let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n\n let {styleProps} = useStyleProps(props);\n let dragState: DraggableCollectionState | null = null;\n let preview = useRef(null);\n if (isListDraggable && dragAndDropHooks) {\n dragState = dragAndDropHooks.useDraggableCollectionState!({\n collection,\n selectionManager,\n preview\n });\n dragAndDropHooks.useDraggableCollection!({}, dragState, domRef);\n }\n let layout = useListLayout(state, props.density || 'regular', overflowMode);\n\n let DragPreview = dragAndDropHooks?.DragPreview;\n let dropState: DroppableCollectionState | null = null;\n let droppableCollection: DroppableCollectionResult | null = null;\n let isRootDropTarget = false;\n if (isListDroppable && dragAndDropHooks) {\n dropState = dragAndDropHooks.useDroppableCollectionState!({\n collection,\n selectionManager\n });\n droppableCollection = dragAndDropHooks.useDroppableCollection!(\n {\n keyboardDelegate: new ListKeyboardDelegate({\n collection,\n disabledKeys: dragState?.draggingKeys.size ? undefined : selectionManager.disabledKeys,\n ref: domRef,\n layoutDelegate: layout\n }),\n dropTargetDelegate: layout\n },\n dropState,\n domRef\n );\n\n isRootDropTarget = dropState.isDropTarget({type: 'root'});\n }\n\n let {gridProps} = useGridList(\n {\n ...props,\n isVirtualized: true,\n layoutDelegate: layout,\n onAction\n },\n state,\n domRef\n );\n\n let focusedKey = selectionManager.focusedKey;\n let dropTargetKey: Key | null = null;\n if (dropState?.target?.type === 'item') {\n dropTargetKey = dropState.target.key;\n if (dropState.target.dropPosition === 'after') {\n // Normalize to the \"before\" drop position since we only render those in the DOM.\n dropTargetKey = state.collection.getKeyAfter(dropTargetKey) ?? dropTargetKey;\n }\n }\n\n let persistedKeys = useMemo(() => {\n return new Set([focusedKey, dropTargetKey].filter(k => k !== null));\n }, [focusedKey, dropTargetKey]);\n\n // wait for layout to get accurate measurements\n let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = useState(false);\n let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = useState(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n if (domRef.current) {\n // 2 is the width of the border which is not part of the box size\n setVerticalScollbarVisible(domRef.current.clientWidth + 2 < domRef.current.offsetWidth);\n setHorizontalScollbarVisible(domRef.current.clientHeight + 2 < domRef.current.offsetHeight);\n }\n });\n\n let hasAnyChildren = useMemo(\n () => [...collection].some(item => item.hasChildNodes),\n [collection]\n );\n\n return (\n <ListViewContext.Provider\n value={{\n state,\n dragState,\n dropState,\n dragAndDropHooks,\n onAction,\n isListDraggable,\n isListDroppable,\n layout,\n loadingState,\n renderEmptyState\n }}>\n <FocusScope>\n <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>\n <Virtualizer\n {...mergeProps(\n isListDroppable ? droppableCollection?.collectionProps : null,\n gridProps\n )}\n {...filterDOMProps(otherProps)}\n {...gridProps}\n {...styleProps}\n onScroll={undefined}\n isLoading={isLoading}\n onLoadMore={onLoadMore}\n ref={domRef}\n persistedKeys={persistedKeys}\n scrollDirection=\"vertical\"\n className={classNames(\n listStyles,\n 'react-spectrum-ListView',\n `react-spectrum-ListView--${density}`,\n 'react-spectrum-ListView--emphasized',\n {\n 'react-spectrum-ListView--quiet': isQuiet,\n 'react-spectrum-ListView--loadingMore': loadingState === 'loadingMore',\n 'react-spectrum-ListView--draggable': !!isListDraggable,\n 'react-spectrum-ListView--dropTarget': !!isRootDropTarget,\n 'react-spectrum-ListView--isVerticalScrollbarVisible': isVerticalScrollbarVisible,\n 'react-spectrum-ListView--isHorizontalScrollbarVisible':\n isHorizontalScrollbarVisible,\n 'react-spectrum-ListView--hasAnyChildren': hasAnyChildren,\n 'react-spectrum-ListView--wrap': overflowMode === 'wrap'\n },\n styleProps.className\n )}\n layout={layout}\n layoutOptions={useMemo(() => ({isLoading}), [isLoading])}\n collection={collection}>\n {useCallback((type, item: Node<T>) => {\n if (type === 'item') {\n return <Item item={item} />;\n } else if (type === 'loader') {\n return <LoadingView />;\n } else if (type === 'placeholder') {\n return <EmptyState />;\n }\n }, [])}\n </Virtualizer>\n </FocusRing>\n </FocusScope>\n {DragPreview && isListDraggable && dragAndDropHooks && dragState && (\n <DragPreview ref={preview}>\n {() => {\n if (dragState.draggedKey == null) {\n return null;\n }\n if (dragAndDropHooks.renderPreview) {\n return dragAndDropHooks.renderPreview(dragState.draggingKeys, dragState.draggedKey);\n }\n let item = state.collection.getItem(dragState.draggedKey);\n if (!item) {\n return null;\n }\n let itemCount = dragState.draggingKeys.size;\n let itemHeight = layout.getLayoutInfo(dragState.draggedKey)?.rect.height ?? 0;\n return (\n <SpectrumDragPreview\n item={item}\n itemCount={itemCount}\n itemHeight={itemHeight}\n density={density}\n />\n );\n }}\n </DragPreview>\n )}\n </ListViewContext.Provider>\n );\n}) as <T>(props: SpectrumListViewProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\n\nfunction Item({item}: {item: Node<unknown>}) {\n let {isListDroppable, state, onAction} = useContext(ListViewContext)!;\n return (\n <>\n {isListDroppable && state.collection.getKeyBefore(item.key) == null && (\n <RootDropIndicator key=\"root\" />\n )}\n {isListDroppable && (\n <InsertionIndicator\n key={`${item.key}-before`}\n target={{key: item.key, type: 'item', dropPosition: 'before'}}\n />\n )}\n <ListViewItem item={item} isEmphasized hasActions={!!onAction} />\n {isListDroppable && (\n <InsertionIndicator\n key={`${item.key}-after`}\n target={{key: item.key, type: 'item', dropPosition: 'after'}}\n isPresentationOnly={state.collection.getKeyAfter(item.key) != null}\n />\n )}\n </>\n );\n}\n\nfunction LoadingView() {\n let {state} = useContext(ListViewContext)!;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/list');\n return (\n <CenteredWrapper>\n <ProgressCircle\n isIndeterminate\n aria-label={\n state.collection.size > 0\n ? stringFormatter.format('loadingMore')\n : stringFormatter.format('loading')\n }\n />\n </CenteredWrapper>\n );\n}\n\nfunction EmptyState() {\n let {renderEmptyState} = useContext(ListViewContext)!;\n let emptyState = renderEmptyState ? renderEmptyState() : null;\n if (emptyState == null) {\n return null;\n }\n\n return <CenteredWrapper>{emptyState}</CenteredWrapper>;\n}\n\nfunction CenteredWrapper({children}) {\n let {state} = useContext(ListViewContext)!;\n return (\n <div\n role=\"row\"\n aria-rowindex={state.collection.size + 1}\n className={classNames(listStyles, 'react-spectrum-ListView-centeredWrapper', {\n 'react-spectrum-ListView-centeredWrapper--loadingMore': state.collection.size > 0\n })}>\n <div role=\"gridcell\">{children}</div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"ListView.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;AAoGM,MAAM,0DAAkB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAuC;AAEzF,MAAM,oCAAc;IAClB,SAAS;QACP,QAAQ;QACR,OAAO;IACT;IACA,SAAS;QACP,QAAQ;QACR,OAAO;IACT;IACA,UAAU;QACR,QAAQ;QACR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AAI,GAAG;QAClF;qBACA,gCAAC;QAAI,MAAK;OAAY;AAG5B","sources":["packages/@adobe/react-spectrum/src/list/ListView.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {AriaGridListProps, useGridList} from 'react-aria/useGridList';\nimport {\n AsyncLoadable,\n DOMRef,\n Key,\n LoadingState,\n Node,\n SpectrumSelectionProps,\n StyleProps\n} from '@react-types/shared';\nimport {classNames} from '../utils/classNames';\nimport type {DragAndDropHooks} from '../dnd/useDragAndDrop';\nimport type {DraggableCollectionState} from 'react-stately/useDraggableCollectionState';\nimport type {DroppableCollectionResult} from 'react-aria/useDroppableCollection';\nimport type {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport InsertionIndicator from './InsertionIndicator';\nimport intlMessages from '../../intl/list/*.json';\nimport {ListKeyboardDelegate} from 'react-aria/ListKeyboardDelegate';\nimport {ListState, useListState} from 'react-stately/useListState';\nimport listStyles from './styles.css';\nimport {ListViewItem} from './ListViewItem';\nimport {ListViewLayout} from './ListViewLayout';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {\n JSX,\n ReactElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport RootDropIndicator from './RootDropIndicator';\nimport {DragPreview as SpectrumDragPreview} from './DragPreview';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProvider} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\nimport {Virtualizer} from 'react-aria/private/virtualizer/Virtualizer';\n\nexport interface SpectrumListViewProps<T>\n extends\n Omit<AriaGridListProps<T>, 'keyboardNavigationBehavior'>,\n StyleProps,\n SpectrumSelectionProps,\n Omit<AsyncLoadable, 'isLoading'> {\n /**\n * Sets the amount of vertical padding within each cell.\n *\n * @default 'regular'\n */\n density?: 'compact' | 'regular' | 'spacious';\n /** Whether the ListView should be displayed with a quiet style. */\n isQuiet?: boolean;\n /**\n * The current loading state of the ListView. Determines whether or not the progress circle should\n * be shown.\n */\n loadingState?: LoadingState;\n /**\n * Sets the text behavior for the row contents.\n *\n * @default 'truncate'\n */\n overflowMode?: 'truncate' | 'wrap';\n /** Sets what the ListView should render when there is no content to display. */\n renderEmptyState?: () => JSX.Element;\n /**\n * Handler that is called when a user performs an action on an item. The exact user event depends\n * on the collection's `selectionStyle` prop and the interaction modality.\n */\n onAction?: (key: Key) => void;\n /**\n * The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for\n * the ListView.\n */\n dragAndDropHooks?: DragAndDropHooks<NoInfer<T>>['dragAndDropHooks'];\n}\n\ninterface ListViewContextValue<T> {\n state: ListState<T>;\n dragState: DraggableCollectionState | null;\n dropState: DroppableCollectionState | null;\n dragAndDropHooks?: DragAndDropHooks<T>['dragAndDropHooks'];\n onAction?: (key: Key) => void;\n isListDraggable: boolean;\n isListDroppable: boolean;\n layout: ListViewLayout<T>;\n loadingState?: LoadingState;\n renderEmptyState?: () => JSX.Element;\n}\n\nexport const ListViewContext = React.createContext<ListViewContextValue<unknown> | null>(null);\n\nconst ROW_HEIGHTS = {\n compact: {\n medium: 32,\n large: 40\n },\n regular: {\n medium: 40,\n large: 50\n },\n spacious: {\n medium: 48,\n large: 60\n }\n};\n\nfunction useListLayout<T>(\n state: ListState<T>,\n density: SpectrumListViewProps<T>['density'],\n overflowMode: SpectrumListViewProps<T>['overflowMode']\n) {\n let {scale} = useProvider();\n let layout = useMemo(\n () =>\n new ListViewLayout<T>({\n estimatedRowHeight: ROW_HEIGHTS[density || 'regular'][scale]\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps\n [scale, density, overflowMode]\n );\n\n return layout;\n}\n\n/**\n * A ListView displays a list of interactive items, and allows a user to navigate, select, or\n * perform an action.\n */\nexport const ListView = React.forwardRef(function ListView<T extends object>(\n props: SpectrumListViewProps<T>,\n ref: DOMRef<HTMLDivElement>\n) {\n let {\n density = 'regular',\n loadingState,\n onLoadMore,\n isQuiet,\n overflowMode = 'truncate',\n onAction,\n dragAndDropHooks,\n renderEmptyState,\n ...otherProps\n } = props;\n let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;\n let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;\n let dragHooksProvided = useRef(isListDraggable);\n let dropHooksProvided = useRef(isListDroppable);\n useEffect(() => {\n if (dragHooksProvided.current !== isListDraggable && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.'\n );\n }\n if (dropHooksProvided.current !== isListDroppable && process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.'\n );\n }\n }, [isListDraggable, isListDroppable]);\n\n let domRef = useDOMRef(ref);\n let state = useListState({\n ...props,\n selectionBehavior: props.selectionStyle === 'highlight' ? 'replace' : 'toggle'\n });\n let {collection, selectionManager} = state;\n let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n\n let {styleProps} = useStyleProps(props);\n let dragState: DraggableCollectionState | null = null;\n let preview = useRef(null);\n if (isListDraggable && dragAndDropHooks) {\n // oxlint-disable-next-line react/react-compiler\n dragState = dragAndDropHooks.useDraggableCollectionState!({\n collection,\n selectionManager,\n preview\n });\n // oxlint-disable-next-line react/react-compiler\n dragAndDropHooks.useDraggableCollection!({}, dragState, domRef);\n }\n let layout = useListLayout(state, props.density || 'regular', overflowMode);\n\n let DragPreview = dragAndDropHooks?.DragPreview;\n let dropState: DroppableCollectionState | null = null;\n let droppableCollection: DroppableCollectionResult | null = null;\n let isRootDropTarget = false;\n if (isListDroppable && dragAndDropHooks) {\n // oxlint-disable-next-line react/react-compiler\n dropState = dragAndDropHooks.useDroppableCollectionState!({\n collection,\n selectionManager\n });\n // oxlint-disable-next-line react/react-compiler\n droppableCollection = dragAndDropHooks.useDroppableCollection!(\n {\n keyboardDelegate: new ListKeyboardDelegate({\n collection,\n disabledKeys: dragState?.draggingKeys.size ? undefined : selectionManager.disabledKeys,\n ref: domRef,\n layoutDelegate: layout\n }),\n dropTargetDelegate: layout\n },\n dropState,\n domRef\n );\n\n isRootDropTarget = dropState.isDropTarget({type: 'root'});\n }\n\n let {gridProps} = useGridList(\n {\n ...props,\n isVirtualized: true,\n layoutDelegate: layout,\n onAction\n },\n state,\n domRef\n );\n\n let focusedKey = selectionManager.focusedKey;\n let dropTargetKey: Key | null = null;\n if (dropState?.target?.type === 'item') {\n dropTargetKey = dropState.target.key;\n if (dropState.target.dropPosition === 'after') {\n // Normalize to the \"before\" drop position since we only render those in the DOM.\n dropTargetKey = state.collection.getKeyAfter(dropTargetKey) ?? dropTargetKey;\n }\n }\n\n let persistedKeys = useMemo(() => {\n return new Set([focusedKey, dropTargetKey].filter(k => k !== null));\n }, [focusedKey, dropTargetKey]);\n\n // wait for layout to get accurate measurements\n let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = useState(false);\n let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = useState(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n if (domRef.current) {\n // 2 is the width of the border which is not part of the box size\n setVerticalScollbarVisible(domRef.current.clientWidth + 2 < domRef.current.offsetWidth);\n setHorizontalScollbarVisible(domRef.current.clientHeight + 2 < domRef.current.offsetHeight);\n }\n });\n\n let hasAnyChildren = useMemo(\n () => [...collection].some(item => item.hasChildNodes),\n [collection]\n );\n\n return (\n <ListViewContext.Provider\n value={{\n state,\n dragState,\n dropState,\n dragAndDropHooks,\n onAction,\n isListDraggable,\n isListDroppable,\n layout,\n loadingState,\n renderEmptyState\n }}>\n <FocusScope>\n <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>\n <Virtualizer\n {...mergeProps(\n isListDroppable ? droppableCollection?.collectionProps : null,\n gridProps\n )}\n {...filterDOMProps(otherProps)}\n {...gridProps}\n {...styleProps}\n onScroll={undefined}\n isLoading={isLoading}\n onLoadMore={onLoadMore}\n ref={domRef}\n persistedKeys={persistedKeys}\n scrollDirection=\"vertical\"\n className={classNames(\n listStyles,\n 'react-spectrum-ListView',\n `react-spectrum-ListView--${density}`,\n 'react-spectrum-ListView--emphasized',\n {\n 'react-spectrum-ListView--quiet': isQuiet,\n 'react-spectrum-ListView--loadingMore': loadingState === 'loadingMore',\n 'react-spectrum-ListView--draggable': !!isListDraggable,\n 'react-spectrum-ListView--dropTarget': !!isRootDropTarget,\n 'react-spectrum-ListView--isVerticalScrollbarVisible': isVerticalScrollbarVisible,\n 'react-spectrum-ListView--isHorizontalScrollbarVisible':\n isHorizontalScrollbarVisible,\n 'react-spectrum-ListView--hasAnyChildren': hasAnyChildren,\n 'react-spectrum-ListView--wrap': overflowMode === 'wrap'\n },\n styleProps.className\n )}\n layout={layout}\n layoutOptions={useMemo(() => ({isLoading}), [isLoading])}\n collection={collection}>\n {useCallback((type, item: Node<T>) => {\n if (type === 'item') {\n return <Item item={item} />;\n } else if (type === 'loader') {\n return <LoadingView />;\n } else if (type === 'placeholder') {\n return <EmptyState />;\n }\n }, [])}\n </Virtualizer>\n </FocusRing>\n </FocusScope>\n {DragPreview && isListDraggable && dragAndDropHooks && dragState && (\n <DragPreview ref={preview}>\n {() => {\n if (dragState.draggedKey == null) {\n return null;\n }\n if (dragAndDropHooks.renderPreview) {\n return dragAndDropHooks.renderPreview(dragState.draggingKeys, dragState.draggedKey);\n }\n let item = state.collection.getItem(dragState.draggedKey);\n if (!item) {\n return null;\n }\n let itemCount = dragState.draggingKeys.size;\n let itemHeight = layout.getLayoutInfo(dragState.draggedKey)?.rect.height ?? 0;\n return (\n <SpectrumDragPreview\n item={item}\n itemCount={itemCount}\n itemHeight={itemHeight}\n density={density}\n />\n );\n }}\n </DragPreview>\n )}\n </ListViewContext.Provider>\n );\n}) as <T>(props: SpectrumListViewProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\n\nfunction Item({item}: {item: Node<unknown>}) {\n let {isListDroppable, state, onAction} = useContext(ListViewContext)!;\n return (\n <>\n {isListDroppable && state.collection.getKeyBefore(item.key) == null && (\n <RootDropIndicator key=\"root\" />\n )}\n {isListDroppable && (\n <InsertionIndicator\n key={`${item.key}-before`}\n target={{key: item.key, type: 'item', dropPosition: 'before'}}\n />\n )}\n <ListViewItem item={item} isEmphasized hasActions={!!onAction} />\n {isListDroppable && (\n <InsertionIndicator\n key={`${item.key}-after`}\n target={{key: item.key, type: 'item', dropPosition: 'after'}}\n isPresentationOnly={state.collection.getKeyAfter(item.key) != null}\n />\n )}\n </>\n );\n}\n\nfunction LoadingView() {\n let {state} = useContext(ListViewContext)!;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/list');\n return (\n <CenteredWrapper>\n <ProgressCircle\n isIndeterminate\n aria-label={\n state.collection.size > 0\n ? stringFormatter.format('loadingMore')\n : stringFormatter.format('loading')\n }\n />\n </CenteredWrapper>\n );\n}\n\nfunction EmptyState() {\n let {renderEmptyState} = useContext(ListViewContext)!;\n let emptyState = renderEmptyState ? renderEmptyState() : null;\n if (emptyState == null) {\n return null;\n }\n\n return <CenteredWrapper>{emptyState}</CenteredWrapper>;\n}\n\nfunction CenteredWrapper({children}) {\n let {state} = useContext(ListViewContext)!;\n return (\n <div\n role=\"row\"\n aria-rowindex={state.collection.size + 1}\n className={classNames(listStyles, 'react-spectrum-ListView-centeredWrapper', {\n 'react-spectrum-ListView-centeredWrapper--loadingMore': state.collection.size > 0\n })}>\n <div role=\"gridcell\">{children}</div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"ListView.mjs.map"}
|
|
@@ -90,6 +90,7 @@ function $425ebe0ef8a16c9d$export$c6bde0c04b033c0e(props) {
|
|
|
90
90
|
let hasDescription = (0, $dd6348d4a1a51ff9$exports.useHasChild)(`.${(0, ($parcel$interopDefault($9730d29fe3ac43ea$exports)))['react-spectrum-ListViewItem-description']}`, rowRef);
|
|
91
91
|
let draggableItem = null;
|
|
92
92
|
if (isListDraggable && dragAndDropHooks && dragState) {
|
|
93
|
+
// oxlint-disable-next-line react/react-compiler
|
|
93
94
|
draggableItem = dragAndDropHooks.useDraggableItem({
|
|
94
95
|
key: item.key,
|
|
95
96
|
hasDragButton: true
|
|
@@ -106,6 +107,7 @@ function $425ebe0ef8a16c9d$export$c6bde0c04b033c0e(props) {
|
|
|
106
107
|
dropPosition: 'on'
|
|
107
108
|
};
|
|
108
109
|
isDropTarget = dropState.isDropTarget(target);
|
|
110
|
+
// oxlint-disable-next-line react/react-compiler
|
|
109
111
|
dropIndicator = dragAndDropHooks.useDropIndicator({
|
|
110
112
|
target: target
|
|
111
113
|
}, dropState, dropIndicatorRef);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;AAmCM,SAAS,0CAAgB,KAA2B;IACzD,IAAI,QAAC,IAAI,gBAAE,YAAY,EAAC,GAAG;IAC3B,IAAI,SACF,KAAK,aACL,SAAS,aACT,SAAS,mBACT,eAAe,mBACf,eAAe,UACf,MAAM,oBACN,gBAAgB,gBAChB,YAAY,EACb,GAAG,CAAA,GAAA,uBAAS,EAAE,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;QAC5E;QACA,SAAS;QACT,SAAS;qBACT,0DAAC;QACC,KAAK;QACL,WAAW,CAAA,GAAA,mDAAS,CAAC,CAAC,8CAA8C;qBACpE,0DAAC,CAAA,GAAA,kCAAO;QACL,GAAG,aAAa;QACjB,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,uCAAuC;QACpE,cAAc;wBAIpB,0DAAC,CAAA,GAAA,sCAAW;QACV,OAAO;YACL,MAAM;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,sCAAsC;YAAA;YAC1E,aAAa;gBACX,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,0CAA0C;gBACvE,GAAG,gBAAgB;YACrB;YACA,cAAc;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,wCAAwC;YAAA;YACpF,OAAO;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,wCAAwC;YAAA;YAC7E,cAAc;gBACZ,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,sCAAsC;gBACnE,SAAS;YACX;YACA,aAAa;gBACX,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,sCAAsC;gBACnE,SAAS;gBACT,SAAS;YACX;YACA,YAAY;gBACV,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,yCAAyC;gBACtE,SAAS;YACX;QACF;OACC,uBACD,0DAAC,CAAA,GAAA,oCAAS,SAAG;AAMzB","sources":["packages/@adobe/react-spectrum/src/list/ListViewItem.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 */\nimport {Checkbox} from '../checkbox/Checkbox';\n\nimport ChevronLeftMedium from '@spectrum-icons/ui/ChevronLeftMedium';\nimport ChevronRightMedium from '@spectrum-icons/ui/ChevronRightMedium';\nimport {classNames} from '../utils/classNames';\nimport {ClearSlots, SlotProvider} from '../utils/Slots';\nimport {CSSTransition} from 'react-transition-group';\nimport type {DraggableItemResult} from 'react-aria/useDraggableCollection';\nimport type {DropIndicatorAria} from 'react-aria/useDroppableCollection';\nimport {DropTarget, Node} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {Grid} from '../layout/Grid';\nimport {isFocusVisible as isGlobalFocusVisible} from 'react-aria/private/interactions/useFocusVisible';\nimport ListGripper from '@spectrum-icons/ui/ListGripper';\nimport listStyles from './styles.css';\nimport {ListViewContext} from './ListView';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {Provider} from '../provider/Provider';\nimport React, {JSX, useContext, useRef} from 'react';\nimport {Text} from '../text/Text';\nimport {useButton} from 'react-aria/useButton';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useGridListItem, useGridListSelectionCheckbox} from 'react-aria/useGridList';\nimport {useHasChild} from '../utils/useHasChild';\nimport {useHover} from 'react-aria/useHover';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useVisuallyHidden} from 'react-aria/VisuallyHidden';\n\ninterface ListViewItemProps<T> {\n item: Node<T>;\n isEmphasized: boolean;\n hasActions: boolean;\n}\n\nexport function ListViewItem<T>(props: ListViewItemProps<T>): JSX.Element {\n let {item, isEmphasized} = props;\n let {\n state,\n dragState,\n dropState,\n isListDraggable,\n isListDroppable,\n layout,\n dragAndDropHooks,\n loadingState\n } = useContext(ListViewContext)!;\n let {direction} = useLocale();\n let rowRef = useRef<HTMLDivElement | null>(null);\n let checkboxWrapperRef = useRef<HTMLDivElement | null>(null);\n let {isFocusVisible: isFocusVisibleWithin, focusProps: focusWithinProps} = useFocusRing({\n within: true\n });\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n rowProps,\n gridCellProps,\n isPressed,\n descriptionProps,\n isSelected,\n isDisabled,\n allowsSelection,\n hasAction\n } = useGridListItem(\n {\n node: item,\n isVirtualized: true,\n shouldSelectOnPressUp: isListDraggable\n },\n state,\n rowRef\n );\n let {hoverProps, isHovered} = useHover({isDisabled: !allowsSelection && !hasAction});\n\n let {checkboxProps} = useGridListSelectionCheckbox({key: item.key}, state);\n let hasDescription = useHasChild(\n `.${listStyles['react-spectrum-ListViewItem-description']}`,\n rowRef\n );\n\n let draggableItem: DraggableItemResult | null = null;\n if (isListDraggable && dragAndDropHooks && dragState) {\n draggableItem = dragAndDropHooks.useDraggableItem!(\n {key: item.key, hasDragButton: true},\n dragState\n );\n if (isDisabled) {\n draggableItem = null;\n }\n }\n let isDropTarget = false;\n let dropIndicator: DropIndicatorAria | null = null;\n let dropIndicatorRef = useRef<HTMLDivElement | null>(null);\n if (isListDroppable && dragAndDropHooks && dropState) {\n let target = {type: 'item', key: item.key, dropPosition: 'on'} as DropTarget;\n isDropTarget = dropState.isDropTarget(target);\n\n dropIndicator = dragAndDropHooks.useDropIndicator!({target}, dropState, dropIndicatorRef);\n }\n\n let dragButtonRef = React.useRef<HTMLDivElement | null>(null);\n let {buttonProps} = useButton(\n {\n ...draggableItem?.dragButtonProps,\n elementType: 'div'\n },\n dragButtonRef\n );\n\n let chevron =\n direction === 'ltr' ? (\n <ChevronRightMedium\n aria-hidden=\"true\"\n UNSAFE_className={classNames(listStyles, 'react-spectrum-ListViewItem-parentIndicator', {\n 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,\n 'is-disabled': !hasAction\n })}\n />\n ) : (\n <ChevronLeftMedium\n aria-hidden=\"true\"\n UNSAFE_className={classNames(listStyles, 'react-spectrum-ListViewItem-parentIndicator', {\n 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,\n 'is-disabled': !hasAction\n })}\n />\n );\n\n let showCheckbox =\n state.selectionManager.selectionMode !== 'none' &&\n state.selectionManager.selectionBehavior === 'toggle';\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n const mergedProps = mergeProps(\n rowProps,\n draggableItem?.dragProps,\n hoverProps,\n focusWithinProps,\n focusProps\n );\n\n // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,\n // allowing for single swipe navigation between row drop indicator\n if (dragAndDropHooks?.isVirtualDragging?.()) {\n mergedProps.tabIndex = undefined;\n }\n\n let isFirstRow = item.prevKey == null;\n let isLastRow = item.nextKey == null;\n // Figure out if the ListView content is equal or greater in height to the container. If so, we'll need to round the bottom\n // border corners of the last row when selected and we can get rid of the bottom border if it isn't selected to avoid border overlap\n // with bottom border\n let isFlushWithContainerBottom = false;\n if (isLastRow && loadingState !== 'loadingMore') {\n if (layout.getContentSize()?.height >= (layout.virtualizer?.visibleRect.height ?? 0)) {\n isFlushWithContainerBottom = true;\n }\n }\n // previous item isn't selected\n // and the previous item isn't focused or, if it is focused, then if focus globally isn't visible or just focus isn't in the listview\n let roundTops =\n !(item.prevKey != null && state.selectionManager.isSelected(item.prevKey)) &&\n (state.selectionManager.focusedKey !== item.prevKey ||\n !(isGlobalFocusVisible() && state.selectionManager.isFocused));\n let roundBottoms =\n !(item.nextKey != null && state.selectionManager.isSelected(item.nextKey)) &&\n (state.selectionManager.focusedKey !== item.nextKey ||\n !(isGlobalFocusVisible() && state.selectionManager.isFocused));\n\n let content = typeof item.rendered === 'string' ? <Text>{item.rendered}</Text> : item.rendered;\n if (isDisabled) {\n content = <Provider isDisabled>{content}</Provider>;\n }\n\n return (\n <div\n {...mergedProps}\n className={classNames(listStyles, 'react-spectrum-ListView-row', {\n 'focus-ring': isFocusVisible,\n 'round-tops':\n roundTops || (isHovered && !isSelected && state.selectionManager.focusedKey !== item.key),\n 'round-bottoms':\n roundBottoms ||\n (isHovered && !isSelected && state.selectionManager.focusedKey !== item.key)\n })}\n ref={rowRef}>\n <div\n // TODO: refactor the css here now that we are focusing the row?\n className={classNames(listStyles, 'react-spectrum-ListViewItem', {\n 'is-active': isPressed,\n 'is-focused': isFocusVisibleWithin,\n 'focus-ring': isFocusVisible,\n 'is-hovered': isHovered,\n 'is-selected': isSelected,\n 'is-disabled': isDisabled,\n 'is-prev-selected':\n item.prevKey != null && state.selectionManager.isSelected(item.prevKey),\n 'is-next-selected':\n item.nextKey != null && state.selectionManager.isSelected(item.nextKey),\n 'react-spectrum-ListViewItem--highlightSelection':\n state.selectionManager.selectionBehavior === 'replace' &&\n (isSelected ||\n (item.nextKey != null && state.selectionManager.isSelected(item.nextKey))),\n 'react-spectrum-ListViewItem--dropTarget': !!isDropTarget,\n 'react-spectrum-ListViewItem--firstRow': isFirstRow,\n 'react-spectrum-ListViewItem--lastRow': isLastRow,\n 'react-spectrum-ListViewItem--isFlushBottom': isFlushWithContainerBottom,\n 'react-spectrum-ListViewItem--hasDescription': hasDescription\n })}\n {...gridCellProps}>\n <Grid UNSAFE_className={listStyles['react-spectrum-ListViewItem-grid']}>\n {isListDraggable && (\n <div className={listStyles['react-spectrum-ListViewItem-draghandle-container']}>\n {!isDisabled && (\n <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>\n <div\n {...(buttonProps as React.HTMLAttributes<HTMLElement>)}\n className={classNames(\n listStyles,\n 'react-spectrum-ListViewItem-draghandle-button'\n )}\n style={!isFocusVisibleWithin ? {...visuallyHiddenProps.style} : {}}\n ref={dragButtonRef}\n draggable=\"true\">\n <ListGripper />\n </div>\n </FocusRing>\n )}\n </div>\n )}\n {isListDroppable && !dropIndicator?.isHidden && (\n <div\n role=\"button\"\n {...visuallyHiddenProps}\n {...dropIndicator?.dropIndicatorProps}\n ref={dropIndicatorRef}\n />\n )}\n <CSSTransition\n in={showCheckbox}\n unmountOnExit\n classNames={{\n enter: listStyles['react-spectrum-ListViewItem-checkbox--enter'],\n enterActive: listStyles['react-spectrum-ListViewItem-checkbox--enterActive'],\n exit: listStyles['react-spectrum-ListViewItem-checkbox--exit'],\n exitActive: listStyles['react-spectrum-ListViewItem-checkbox--exitActive']\n }}\n timeout={160}\n nodeRef={checkboxWrapperRef}>\n <div\n ref={checkboxWrapperRef}\n className={listStyles['react-spectrum-ListViewItem-checkboxWrapper']}>\n <Checkbox\n {...checkboxProps}\n UNSAFE_className={listStyles['react-spectrum-ListViewItem-checkbox']}\n isEmphasized={isEmphasized}\n />\n </div>\n </CSSTransition>\n <SlotProvider\n slots={{\n text: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-content']},\n description: {\n UNSAFE_className: listStyles['react-spectrum-ListViewItem-description'],\n ...descriptionProps\n },\n illustration: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-thumbnail']},\n image: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-thumbnail']},\n actionButton: {\n UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'],\n isQuiet: true\n },\n actionGroup: {\n UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'],\n isQuiet: true,\n density: 'compact'\n },\n actionMenu: {\n UNSAFE_className: listStyles['react-spectrum-ListViewItem-actionmenu'],\n isQuiet: true\n }\n }}>\n {content}\n <ClearSlots>{chevron}</ClearSlots>\n </SlotProvider>\n </Grid>\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"ListViewItem.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;AAmCM,SAAS,0CAAgB,KAA2B;IACzD,IAAI,QAAC,IAAI,gBAAE,YAAY,EAAC,GAAG;IAC3B,IAAI,SACF,KAAK,aACL,SAAS,aACT,SAAS,mBACT,eAAe,mBACf,eAAe,UACf,MAAM,oBACN,gBAAgB,gBAChB,YAAY,EACb,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,yCAAc;IAC7B,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,sCAAQ;IAC1B,IAAI,SAAS,CAAA,GAA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mDAAS,CAAC,CAAC,8CAA8C;qBACpE,0DAAC,CAAA,GAAA,kCAAO;QACL,GAAG,aAAa;QACjB,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,uCAAuC;QACpE,cAAc;wBAIpB,0DAAC,CAAA,GAAA,sCAAW;QACV,OAAO;YACL,MAAM;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,sCAAsC;YAAA;YAC1E,aAAa;gBACX,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,0CAA0C;gBACvE,GAAG,gBAAgB;YACrB;YACA,cAAc;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,wCAAwC;YAAA;YACpF,OAAO;gBAAC,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,wCAAwC;YAAA;YAC7E,cAAc;gBACZ,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,sCAAsC;gBACnE,SAAS;YACX;YACA,aAAa;gBACX,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,sCAAsC;gBACnE,SAAS;gBACT,SAAS;YACX;YACA,YAAY;gBACV,kBAAkB,CAAA,GAAA,mDAAS,CAAC,CAAC,yCAAyC;gBACtE,SAAS;YACX;QACF;OACC,uBACD,0DAAC,CAAA,GAAA,oCAAS,SAAG;AAMzB","sources":["packages/@adobe/react-spectrum/src/list/ListViewItem.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 */\nimport {Checkbox} from '../checkbox/Checkbox';\n\nimport ChevronLeftMedium from '@spectrum-icons/ui/ChevronLeftMedium';\nimport ChevronRightMedium from '@spectrum-icons/ui/ChevronRightMedium';\nimport {classNames} from '../utils/classNames';\nimport {ClearSlots, SlotProvider} from '../utils/Slots';\nimport {CSSTransition} from 'react-transition-group';\nimport type {DraggableItemResult} from 'react-aria/useDraggableCollection';\nimport type {DropIndicatorAria} from 'react-aria/useDroppableCollection';\nimport {DropTarget, Node} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {Grid} from '../layout/Grid';\nimport {isFocusVisible as isGlobalFocusVisible} from 'react-aria/private/interactions/useFocusVisible';\nimport ListGripper from '@spectrum-icons/ui/ListGripper';\nimport listStyles from './styles.css';\nimport {ListViewContext} from './ListView';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {Provider} from '../provider/Provider';\nimport React, {JSX, useContext, useRef} from 'react';\nimport {Text} from '../text/Text';\nimport {useButton} from 'react-aria/useButton';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useGridListItem, useGridListSelectionCheckbox} from 'react-aria/useGridList';\nimport {useHasChild} from '../utils/useHasChild';\nimport {useHover} from 'react-aria/useHover';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useVisuallyHidden} from 'react-aria/VisuallyHidden';\n\ninterface ListViewItemProps<T> {\n item: Node<T>;\n isEmphasized: boolean;\n hasActions: boolean;\n}\n\nexport function ListViewItem<T>(props: ListViewItemProps<T>): JSX.Element {\n let {item, isEmphasized} = props;\n let {\n state,\n dragState,\n dropState,\n isListDraggable,\n isListDroppable,\n layout,\n dragAndDropHooks,\n loadingState\n } = useContext(ListViewContext)!;\n let {direction} = useLocale();\n let rowRef = useRef<HTMLDivElement | null>(null);\n let checkboxWrapperRef = useRef<HTMLDivElement | null>(null);\n let {isFocusVisible: isFocusVisibleWithin, focusProps: focusWithinProps} = useFocusRing({\n within: true\n });\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n rowProps,\n gridCellProps,\n isPressed,\n descriptionProps,\n isSelected,\n isDisabled,\n allowsSelection,\n hasAction\n } = useGridListItem(\n {\n node: item,\n isVirtualized: true,\n shouldSelectOnPressUp: isListDraggable\n },\n state,\n rowRef\n );\n let {hoverProps, isHovered} = useHover({isDisabled: !allowsSelection && !hasAction});\n\n let {checkboxProps} = useGridListSelectionCheckbox({key: item.key}, state);\n let hasDescription = useHasChild(\n `.${listStyles['react-spectrum-ListViewItem-description']}`,\n rowRef\n );\n\n let draggableItem: DraggableItemResult | null = null;\n if (isListDraggable && dragAndDropHooks && dragState) {\n // oxlint-disable-next-line react/react-compiler\n draggableItem = dragAndDropHooks.useDraggableItem!(\n {key: item.key, hasDragButton: true},\n dragState\n );\n if (isDisabled) {\n draggableItem = null;\n }\n }\n let isDropTarget = false;\n let dropIndicator: DropIndicatorAria | null = null;\n let dropIndicatorRef = useRef<HTMLDivElement | null>(null);\n if (isListDroppable && dragAndDropHooks && dropState) {\n let target = {type: 'item', key: item.key, dropPosition: 'on'} as DropTarget;\n isDropTarget = dropState.isDropTarget(target);\n\n // oxlint-disable-next-line react/react-compiler\n dropIndicator = dragAndDropHooks.useDropIndicator!({target}, dropState, dropIndicatorRef);\n }\n\n let dragButtonRef = React.useRef<HTMLDivElement | null>(null);\n let {buttonProps} = useButton(\n {\n ...draggableItem?.dragButtonProps,\n elementType: 'div'\n },\n dragButtonRef\n );\n\n let chevron =\n direction === 'ltr' ? (\n <ChevronRightMedium\n aria-hidden=\"true\"\n UNSAFE_className={classNames(listStyles, 'react-spectrum-ListViewItem-parentIndicator', {\n 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,\n 'is-disabled': !hasAction\n })}\n />\n ) : (\n <ChevronLeftMedium\n aria-hidden=\"true\"\n UNSAFE_className={classNames(listStyles, 'react-spectrum-ListViewItem-parentIndicator', {\n 'react-spectrum-ListViewItem-parentIndicator--hasChildItems': item.props.hasChildItems,\n 'is-disabled': !hasAction\n })}\n />\n );\n\n let showCheckbox =\n state.selectionManager.selectionMode !== 'none' &&\n state.selectionManager.selectionBehavior === 'toggle';\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n const mergedProps = mergeProps(\n rowProps,\n draggableItem?.dragProps,\n hoverProps,\n focusWithinProps,\n focusProps\n );\n\n // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,\n // allowing for single swipe navigation between row drop indicator\n if (dragAndDropHooks?.isVirtualDragging?.()) {\n mergedProps.tabIndex = undefined;\n }\n\n let isFirstRow = item.prevKey == null;\n let isLastRow = item.nextKey == null;\n // Figure out if the ListView content is equal or greater in height to the container. If so, we'll need to round the bottom\n // border corners of the last row when selected and we can get rid of the bottom border if it isn't selected to avoid border overlap\n // with bottom border\n let isFlushWithContainerBottom = false;\n if (isLastRow && loadingState !== 'loadingMore') {\n if (layout.getContentSize()?.height >= (layout.virtualizer?.visibleRect.height ?? 0)) {\n isFlushWithContainerBottom = true;\n }\n }\n // previous item isn't selected\n // and the previous item isn't focused or, if it is focused, then if focus globally isn't visible or just focus isn't in the listview\n let roundTops =\n !(item.prevKey != null && state.selectionManager.isSelected(item.prevKey)) &&\n (state.selectionManager.focusedKey !== item.prevKey ||\n !(isGlobalFocusVisible() && state.selectionManager.isFocused));\n let roundBottoms =\n !(item.nextKey != null && state.selectionManager.isSelected(item.nextKey)) &&\n (state.selectionManager.focusedKey !== item.nextKey ||\n !(isGlobalFocusVisible() && state.selectionManager.isFocused));\n\n let content = typeof item.rendered === 'string' ? <Text>{item.rendered}</Text> : item.rendered;\n if (isDisabled) {\n content = <Provider isDisabled>{content}</Provider>;\n }\n\n return (\n <div\n {...mergedProps}\n className={classNames(listStyles, 'react-spectrum-ListView-row', {\n 'focus-ring': isFocusVisible,\n 'round-tops':\n roundTops || (isHovered && !isSelected && state.selectionManager.focusedKey !== item.key),\n 'round-bottoms':\n roundBottoms ||\n (isHovered && !isSelected && state.selectionManager.focusedKey !== item.key)\n })}\n ref={rowRef}>\n <div\n // TODO: refactor the css here now that we are focusing the row?\n className={classNames(listStyles, 'react-spectrum-ListViewItem', {\n 'is-active': isPressed,\n 'is-focused': isFocusVisibleWithin,\n 'focus-ring': isFocusVisible,\n 'is-hovered': isHovered,\n 'is-selected': isSelected,\n 'is-disabled': isDisabled,\n 'is-prev-selected':\n item.prevKey != null && state.selectionManager.isSelected(item.prevKey),\n 'is-next-selected':\n item.nextKey != null && state.selectionManager.isSelected(item.nextKey),\n 'react-spectrum-ListViewItem--highlightSelection':\n state.selectionManager.selectionBehavior === 'replace' &&\n (isSelected ||\n (item.nextKey != null && state.selectionManager.isSelected(item.nextKey))),\n 'react-spectrum-ListViewItem--dropTarget': !!isDropTarget,\n 'react-spectrum-ListViewItem--firstRow': isFirstRow,\n 'react-spectrum-ListViewItem--lastRow': isLastRow,\n 'react-spectrum-ListViewItem--isFlushBottom': isFlushWithContainerBottom,\n 'react-spectrum-ListViewItem--hasDescription': hasDescription\n })}\n {...gridCellProps}>\n <Grid UNSAFE_className={listStyles['react-spectrum-ListViewItem-grid']}>\n {isListDraggable && (\n <div className={listStyles['react-spectrum-ListViewItem-draghandle-container']}>\n {!isDisabled && (\n <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>\n <div\n {...(buttonProps as React.HTMLAttributes<HTMLElement>)}\n className={classNames(\n listStyles,\n 'react-spectrum-ListViewItem-draghandle-button'\n )}\n style={!isFocusVisibleWithin ? {...visuallyHiddenProps.style} : {}}\n ref={dragButtonRef}\n draggable=\"true\">\n <ListGripper />\n </div>\n </FocusRing>\n )}\n </div>\n )}\n {isListDroppable && !dropIndicator?.isHidden && (\n <div\n role=\"button\"\n {...visuallyHiddenProps}\n {...dropIndicator?.dropIndicatorProps}\n ref={dropIndicatorRef}\n />\n )}\n <CSSTransition\n in={showCheckbox}\n unmountOnExit\n classNames={{\n enter: listStyles['react-spectrum-ListViewItem-checkbox--enter'],\n enterActive: listStyles['react-spectrum-ListViewItem-checkbox--enterActive'],\n exit: listStyles['react-spectrum-ListViewItem-checkbox--exit'],\n exitActive: listStyles['react-spectrum-ListViewItem-checkbox--exitActive']\n }}\n timeout={160}\n nodeRef={checkboxWrapperRef}>\n <div\n ref={checkboxWrapperRef}\n className={listStyles['react-spectrum-ListViewItem-checkboxWrapper']}>\n <Checkbox\n {...checkboxProps}\n UNSAFE_className={listStyles['react-spectrum-ListViewItem-checkbox']}\n isEmphasized={isEmphasized}\n />\n </div>\n </CSSTransition>\n <SlotProvider\n slots={{\n text: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-content']},\n description: {\n UNSAFE_className: listStyles['react-spectrum-ListViewItem-description'],\n ...descriptionProps\n },\n illustration: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-thumbnail']},\n image: {UNSAFE_className: listStyles['react-spectrum-ListViewItem-thumbnail']},\n actionButton: {\n UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'],\n isQuiet: true\n },\n actionGroup: {\n UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'],\n isQuiet: true,\n density: 'compact'\n },\n actionMenu: {\n UNSAFE_className: listStyles['react-spectrum-ListViewItem-actionmenu'],\n isQuiet: true\n }\n }}>\n {content}\n <ClearSlots>{chevron}</ClearSlots>\n </SlotProvider>\n </Grid>\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"ListViewItem.cjs.map"}
|
|
@@ -85,6 +85,7 @@ function $79675b2331570dd1$export$c6bde0c04b033c0e(props) {
|
|
|
85
85
|
let hasDescription = (0, $584638b763a93bff$export$e52e2242b6d0f1d4)(`.${(0, ($parcel$interopDefault($dPSzQ$styles_cssmjs)))['react-spectrum-ListViewItem-description']}`, rowRef);
|
|
86
86
|
let draggableItem = null;
|
|
87
87
|
if (isListDraggable && dragAndDropHooks && dragState) {
|
|
88
|
+
// oxlint-disable-next-line react/react-compiler
|
|
88
89
|
draggableItem = dragAndDropHooks.useDraggableItem({
|
|
89
90
|
key: item.key,
|
|
90
91
|
hasDragButton: true
|
|
@@ -101,6 +102,7 @@ function $79675b2331570dd1$export$c6bde0c04b033c0e(props) {
|
|
|
101
102
|
dropPosition: 'on'
|
|
102
103
|
};
|
|
103
104
|
isDropTarget = dropState.isDropTarget(target);
|
|
105
|
+
// oxlint-disable-next-line react/react-compiler
|
|
104
106
|
dropIndicator = dragAndDropHooks.useDropIndicator({
|
|
105
107
|
target: target
|
|
106
108
|
}, dropState, dropIndicatorRef);
|