@enact/limestone 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/PULL_REQUEST_TEMPLATE.md +28 -0
- package/.github/workflows/update-copyright-years.yml +25 -0
- package/.travis.yml +40 -0
- package/ActionGuide/ActionGuide.d.ts +73 -0
- package/ActionGuide/ActionGuide.js +164 -0
- package/ActionGuide/ActionGuide.module.css +73 -0
- package/ActionGuide/package.json +3 -0
- package/ActionGuide/tests/ActionGuide-specs.js +51 -0
- package/Alert/Alert.d.ts +155 -0
- package/Alert/Alert.js +313 -0
- package/Alert/Alert.module.css +190 -0
- package/Alert/AlertImage.js +102 -0
- package/Alert/AlertImage.module.css +15 -0
- package/Alert/package.json +3 -0
- package/Alert/tests/Alert-specs.js +204 -0
- package/BodyText/BodyText.d.ts +74 -0
- package/BodyText/BodyText.js +170 -0
- package/BodyText/BodyText.module.css +95 -0
- package/BodyText/package.json +3 -0
- package/BodyText/tests/BodyText-specs.js +55 -0
- package/Button/Button.d.ts +131 -0
- package/Button/Button.js +351 -0
- package/Button/Button.module.css +2518 -0
- package/Button/package.json +3 -0
- package/Button/tests/Button-specs.js +252 -0
- package/CHANGELOG.md +170 -0
- package/Card/Card.d.ts +138 -0
- package/Card/Card.js +396 -0
- package/Card/Card.module.css +1296 -0
- package/Card/package.json +3 -0
- package/Card/tests/Card-specs.js +65 -0
- package/Checkbox/Checkbox.d.ts +99 -0
- package/Checkbox/Checkbox.js +222 -0
- package/Checkbox/Checkbox.module.css +1395 -0
- package/Checkbox/package.json +3 -0
- package/Checkbox/tests/Checkbox-specs.js +79 -0
- package/CheckboxItem/CheckboxItem.d.ts +99 -0
- package/CheckboxItem/CheckboxItem.js +210 -0
- package/CheckboxItem/CheckboxItem.module.css +50 -0
- package/CheckboxItem/package.json +3 -0
- package/CheckboxItem/tests/CheckboxItem-specs.js +52 -0
- package/Chips/Chip.js +252 -0
- package/Chips/Chip.module.css +30 -0
- package/Chips/Chips.js +215 -0
- package/Chips/Chips.module.css +8 -0
- package/Chips/index.js +86 -0
- package/Chips/tests/Chip-specs.js +186 -0
- package/Chips/tests/Chips-specs.js +312 -0
- package/ColorPicker/ColorPicker.js +416 -0
- package/ColorPicker/ColorPicker.module.css +78 -0
- package/ColorPicker/package.json +3 -0
- package/ColorPicker/tests/ColorPicker-specs.js +225 -0
- package/ColorPicker/utils.js +135 -0
- package/ContextualMenuDecorator/ContextualMenuDecorator.d.ts +106 -0
- package/ContextualMenuDecorator/ContextualMenuDecorator.js +264 -0
- package/ContextualMenuDecorator/ContextualMenuDecorator.module.css +42 -0
- package/ContextualMenuDecorator/package.json +3 -0
- package/ContextualMenuDecorator/tests/ContextualMenuDecorator-specs.js +136 -0
- package/ContextualPopupDecorator/ContextualPopup.js +200 -0
- package/ContextualPopupDecorator/ContextualPopup.module.css +270 -0
- package/ContextualPopupDecorator/ContextualPopupDecorator.d.ts +182 -0
- package/ContextualPopupDecorator/ContextualPopupDecorator.js +867 -0
- package/ContextualPopupDecorator/ContextualPopupDecorator.module.css +3 -0
- package/ContextualPopupDecorator/HolePunchScrim.js +69 -0
- package/ContextualPopupDecorator/HolePunchScrim.module.css +38 -0
- package/ContextualPopupDecorator/package.json +3 -0
- package/ContextualPopupDecorator/tests/ContextualPopupDecorator-specs.js +621 -0
- package/DatePicker/DatePicker.d.ts +173 -0
- package/DatePicker/DatePicker.js +175 -0
- package/DatePicker/DatePicker.module.css +5 -0
- package/DatePicker/DatePickerBase.js +348 -0
- package/DatePicker/package.json +3 -0
- package/DatePicker/tests/DatePicker-specs.js +247 -0
- package/DayPicker/DayPicker.d.ts +92 -0
- package/DayPicker/DayPicker.js +188 -0
- package/DayPicker/DayPicker.module.css +35 -0
- package/DayPicker/DaySelectorDecorator.js +301 -0
- package/DayPicker/package.json +3 -0
- package/DayPicker/tests/DayPicker-specs.js +138 -0
- package/Dropdown/Dropdown.d.ts +135 -0
- package/Dropdown/Dropdown.js +460 -0
- package/Dropdown/Dropdown.module.css +160 -0
- package/Dropdown/DropdownList.js +360 -0
- package/Dropdown/package.json +3 -0
- package/Dropdown/tests/Dropdown-specs.js +267 -0
- package/FixedPopupPanels/FixedPopupPanels.d.ts +72 -0
- package/FixedPopupPanels/FixedPopupPanels.js +170 -0
- package/FixedPopupPanels/FixedPopupPanels.module.css +146 -0
- package/FixedPopupPanels/package.json +3 -0
- package/FixedPopupPanels/tests/FixedPopupPanels-specs.js +142 -0
- package/FlexiblePopupPanels/FlexiblePopupPanels.js +177 -0
- package/FlexiblePopupPanels/FlexiblePopupPanels.module.css +291 -0
- package/FlexiblePopupPanels/Header.js +110 -0
- package/FlexiblePopupPanels/Panel.js +256 -0
- package/FlexiblePopupPanels/index.d.ts +145 -0
- package/FlexiblePopupPanels/index.js +68 -0
- package/FlexiblePopupPanels/package.json +3 -0
- package/FlexiblePopupPanels/tests/FlexiblePopupPanels-specs.js +305 -0
- package/FlexiblePopupPanels/useNavButtonFocus.js +65 -0
- package/FormCheckboxItem/FormCheckboxItem.d.ts +87 -0
- package/FormCheckboxItem/FormCheckboxItem.js +200 -0
- package/FormCheckboxItem/FormCheckboxItem.module.css +374 -0
- package/FormCheckboxItem/package.json +3 -0
- package/FormCheckboxItem/tests/FormCheckboxItem-specs.js +164 -0
- package/Heading/Heading.d.ts +104 -0
- package/Heading/Heading.js +203 -0
- package/Heading/Heading.module.css +217 -0
- package/Heading/package.json +3 -0
- package/Heading/tests/Heading-specs.js +57 -0
- package/Icon/Icon.d.ts +377 -0
- package/Icon/Icon.js +503 -0
- package/Icon/Icon.module.css +121 -0
- package/Icon/IconList.js +611 -0
- package/Icon/package.json +3 -0
- package/Icon/tests/Icon-specs.js +131 -0
- package/IconItem/IconItem.d.ts +137 -0
- package/IconItem/IconItem.js +360 -0
- package/IconItem/IconItem.module.css +414 -0
- package/IconItem/package.json +3 -0
- package/IconItem/tests/IconItem-specs.js +106 -0
- package/Image/Image.d.ts +60 -0
- package/Image/Image.js +165 -0
- package/Image/Image.module.css +5 -0
- package/Image/package.json +3 -0
- package/Image/tests/Image-specs.js +62 -0
- package/ImageItem/ImageItem.d.ts +134 -0
- package/ImageItem/ImageItem.js +377 -0
- package/ImageItem/ImageItem.module.css +1079 -0
- package/ImageItem/package.json +3 -0
- package/ImageItem/tests/ImageItem-specs.js +223 -0
- package/Input/Input.js +715 -0
- package/Input/Input.module.css +699 -0
- package/Input/InputField.js +487 -0
- package/Input/InputField.module.css +763 -0
- package/Input/InputFieldDecoratorIcon.js +66 -0
- package/Input/InputFieldSpotlightDecorator.js +380 -0
- package/Input/Keypad.js +111 -0
- package/Input/NumberField.js +311 -0
- package/Input/index.d.ts +423 -0
- package/Input/index.js +87 -0
- package/Input/package.json +3 -0
- package/Input/pointer.js +103 -0
- package/Input/tests/Input-specs.js +537 -0
- package/Input/tests/InputField-specs.js +292 -0
- package/Input/tests/InputPopup-specs.js +56 -0
- package/Input/util.js +130 -0
- package/Item/Item.d.ts +108 -0
- package/Item/Item.js +360 -0
- package/Item/Item.module.css +665 -0
- package/Item/package.json +3 -0
- package/Item/tests/Item-specs.js +108 -0
- package/KeyGuide/KeyGuide.d.ts +103 -0
- package/KeyGuide/KeyGuide.js +254 -0
- package/KeyGuide/KeyGuide.module.css +431 -0
- package/KeyGuide/package.json +3 -0
- package/KeyGuide/tests/KeyGuide-specs.js +168 -0
- package/LICENSE +201 -0
- package/Marquee/Marquee.d.ts +42 -0
- package/Marquee/Marquee.js +45 -0
- package/Marquee/package.json +3 -0
- package/MediaOverlay/MediaOverlay.d.ts +134 -0
- package/MediaOverlay/MediaOverlay.js +304 -0
- package/MediaOverlay/MediaOverlay.module.css +292 -0
- package/MediaOverlay/package.json +3 -0
- package/MediaOverlay/tests/MediaOverlay-specs.js +127 -0
- package/MediaPlayer/MediaControls.js +934 -0
- package/MediaPlayer/MediaControls.module.css +86 -0
- package/MediaPlayer/MediaKnob.js +61 -0
- package/MediaPlayer/MediaSlider.js +131 -0
- package/MediaPlayer/MediaSlider.module.css +319 -0
- package/MediaPlayer/MediaSliderDecorator.js +245 -0
- package/MediaPlayer/Times.js +152 -0
- package/MediaPlayer/Times.module.css +34 -0
- package/MediaPlayer/index.d.ts +223 -0
- package/MediaPlayer/index.js +34 -0
- package/MediaPlayer/package.json +3 -0
- package/MediaPlayer/tests/MediaSlider-specs.js +126 -0
- package/MediaPlayer/tests/util-specs.js +114 -0
- package/MediaPlayer/util.js +83 -0
- package/PageViews/Page.js +77 -0
- package/PageViews/Page.module.css +3 -0
- package/PageViews/PageViews.js +440 -0
- package/PageViews/PageViews.module.css +175 -0
- package/PageViews/PageViewsRouter.js +150 -0
- package/PageViews/index.js +45 -0
- package/PageViews/tests/PageViews-specs.js +192 -0
- package/Panels/Header.js +599 -0
- package/Panels/Header.module.css +243 -0
- package/Panels/Panel.js +347 -0
- package/Panels/Panel.module.css +33 -0
- package/Panels/Panels.js +258 -0
- package/Panels/Panels.module.css +12 -0
- package/Panels/index.d.ts +376 -0
- package/Panels/index.js +66 -0
- package/Panels/package.json +3 -0
- package/Panels/tests/Header-specs.js +146 -0
- package/Panels/tests/Panels-specs.js +257 -0
- package/Picker/Picker.d.ts +193 -0
- package/Picker/Picker.js +389 -0
- package/Picker/Picker.module.css +46 -0
- package/Picker/package.json +3 -0
- package/Picker/tests/Picker-specs.js +91 -0
- package/Popup/Popup.d.ts +169 -0
- package/Popup/Popup.js +690 -0
- package/Popup/Popup.module.css +180 -0
- package/Popup/package.json +3 -0
- package/Popup/tests/Popup-specs.js +475 -0
- package/PopupTabLayout/PopupTabLayout.d.ts +196 -0
- package/PopupTabLayout/PopupTabLayout.js +605 -0
- package/PopupTabLayout/PopupTabLayout.module.css +226 -0
- package/PopupTabLayout/package.json +3 -0
- package/PopupTabLayout/tests/PopupTabLayout-specs.js +285 -0
- package/ProgressBar/ProgressBar.d.ts +171 -0
- package/ProgressBar/ProgressBar.js +223 -0
- package/ProgressBar/ProgressBar.module.css +264 -0
- package/ProgressBar/ProgressBarTooltip.js +359 -0
- package/ProgressBar/ProgressBarTooltip.module.css +86 -0
- package/ProgressBar/package.json +3 -0
- package/ProgressBar/tests/ProgressBar-specs.js +400 -0
- package/ProgressButton/ProgressButton.d.ts +57 -0
- package/ProgressButton/ProgressButton.js +143 -0
- package/ProgressButton/ProgressButton.module.css +147 -0
- package/ProgressButton/package.json +3 -0
- package/ProgressButton/tests/ProgressButton-specs.js +71 -0
- package/QuickGuidePanels/Panel.js +90 -0
- package/QuickGuidePanels/QuickGuidePanels.js +463 -0
- package/QuickGuidePanels/QuickGuidePanels.module.css +26 -0
- package/QuickGuidePanels/index.js +52 -0
- package/QuickGuidePanels/tests/QuickGuidePanels-specs.js +250 -0
- package/README.md +59 -0
- package/RadioItem/RadioItem.d.ts +59 -0
- package/RadioItem/RadioItem.js +146 -0
- package/RadioItem/RadioItem.module.css +233 -0
- package/RadioItem/package.json +3 -0
- package/RadioItem/tests/RadioItem-specs.js +62 -0
- package/RangePicker/RangePicker.d.ts +174 -0
- package/RangePicker/RangePicker.js +372 -0
- package/RangePicker/RangePicker.module.css +55 -0
- package/RangePicker/package.json +3 -0
- package/RangePicker/tests/RangePicker-specs.js +122 -0
- package/Region/Region.d.ts +33 -0
- package/Region/Region.js +91 -0
- package/Region/package.json +3 -0
- package/Region/tests/Region-specs.js +28 -0
- package/Scroller/ContentContainerDecorator.js +24 -0
- package/Scroller/EditableWrapper.js +1036 -0
- package/Scroller/EditableWrapper.module.css +22 -0
- package/Scroller/Scroller.d.ts +270 -0
- package/Scroller/Scroller.js +470 -0
- package/Scroller/Scroller.module.css +41 -0
- package/Scroller/package.json +3 -0
- package/Scroller/tests/ContentContainerDecorator-specs.js +20 -0
- package/Scroller/tests/EditableWrapper-specs.js +133 -0
- package/Scroller/tests/Scroller-specs.js +159 -0
- package/Scroller/useEvent.js +39 -0
- package/Scroller/useThemeScroller.js +410 -0
- package/Skinnable/Skinnable.d.ts +27 -0
- package/Skinnable/Skinnable.js +65 -0
- package/Skinnable/package.json +3 -0
- package/Slider/Slider.d.ts +218 -0
- package/Slider/Slider.js +441 -0
- package/Slider/Slider.module.css +880 -0
- package/Slider/SliderBehaviorDecorator.js +184 -0
- package/Slider/package.json +3 -0
- package/Slider/tests/Slider-specs.js +573 -0
- package/Slider/utils.js +114 -0
- package/Spinner/Spinner.d.ts +64 -0
- package/Spinner/Spinner.js +254 -0
- package/Spinner/Spinner.module.css +368 -0
- package/Spinner/package.json +3 -0
- package/Spinner/tests/Spinner-specs.js +70 -0
- package/Sprite/Sprite.d.ts +100 -0
- package/Sprite/Sprite.js +345 -0
- package/Sprite/Sprite.module.css +32 -0
- package/Sprite/package.json +3 -0
- package/Sprite/tests/Sprite-specs.js +59 -0
- package/Steps/Steps.d.ts +119 -0
- package/Steps/Steps.js +303 -0
- package/Steps/Steps.module.css +130 -0
- package/Steps/package.json +3 -0
- package/Steps/tests/Steps-specs.js +175 -0
- package/Switch/Switch.d.ts +54 -0
- package/Switch/Switch.js +143 -0
- package/Switch/Switch.module.css +714 -0
- package/Switch/package.json +3 -0
- package/Switch/tests/Switch-specs.js +54 -0
- package/SwitchItem/SwitchItem.d.ts +56 -0
- package/SwitchItem/SwitchItem.js +144 -0
- package/SwitchItem/SwitchItem.module.css +31 -0
- package/SwitchItem/package.json +3 -0
- package/SwitchItem/tests/SwitchItem-specs.js +49 -0
- package/TabLayout/RefocusDecorator.js +142 -0
- package/TabLayout/Tab.js +84 -0
- package/TabLayout/TabGroup.js +377 -0
- package/TabLayout/TabGroup.module.css +280 -0
- package/TabLayout/TabLayout.d.ts +161 -0
- package/TabLayout/TabLayout.js +661 -0
- package/TabLayout/TabLayout.module.css +101 -0
- package/TabLayout/package.json +3 -0
- package/TabLayout/tests/TabGroup-specs.js +214 -0
- package/TabLayout/tests/TabLayout-specs.js +740 -0
- package/ThemeDecorator/AccessibilityDecorator.js +151 -0
- package/ThemeDecorator/I18nFontDecorator.js +33 -0
- package/ThemeDecorator/ThemeDecorator.d.ts +143 -0
- package/ThemeDecorator/ThemeDecorator.js +307 -0
- package/ThemeDecorator/ThemeDecorator.module.css +1250 -0
- package/ThemeDecorator/fontGenerator.js +76 -0
- package/ThemeDecorator/package.json +3 -0
- package/ThemeDecorator/screenTypes.json +10 -0
- package/ThemeDecorator/tests/ThemeDecorator-specs.js +151 -0
- package/TimePicker/TimePicker.d.ts +147 -0
- package/TimePicker/TimePicker.js +255 -0
- package/TimePicker/TimePicker.module.css +61 -0
- package/TimePicker/TimePickerBase.js +396 -0
- package/TimePicker/package.json +3 -0
- package/TimePicker/tests/TimePicker-specs.js +248 -0
- package/TooltipDecorator/Tooltip.js +252 -0
- package/TooltipDecorator/Tooltip.module.css +496 -0
- package/TooltipDecorator/TooltipDecorator.d.ts +229 -0
- package/TooltipDecorator/TooltipDecorator.js +260 -0
- package/TooltipDecorator/TooltipLabel.js +117 -0
- package/TooltipDecorator/package.json +3 -0
- package/TooltipDecorator/tests/TooltipDecorator-specs.js +224 -0
- package/TooltipDecorator/tests/useTooltip-specs.js +266 -0
- package/TooltipDecorator/useTooltip.js +278 -0
- package/TooltipDecorator/util.js +273 -0
- package/VideoPlayer/Feedback.js +110 -0
- package/VideoPlayer/Feedback.module.css +55 -0
- package/VideoPlayer/FeedbackContent.js +99 -0
- package/VideoPlayer/FeedbackIcon.js +67 -0
- package/VideoPlayer/FeedbackIcons.js +76 -0
- package/VideoPlayer/FeedbackTooltip.js +242 -0
- package/VideoPlayer/FeedbackTooltip.module.css +160 -0
- package/VideoPlayer/MediaTitle.js +143 -0
- package/VideoPlayer/MediaTitle.module.css +95 -0
- package/VideoPlayer/Overlay.js +51 -0
- package/VideoPlayer/Video.js +345 -0
- package/VideoPlayer/VideoPlayer.d.ts +582 -0
- package/VideoPlayer/VideoPlayer.js +2116 -0
- package/VideoPlayer/VideoPlayer.module.css +164 -0
- package/VideoPlayer/package.json +3 -0
- package/VideoPlayer/tests/Video-specs.js +235 -0
- package/VideoPlayer/tests/VideoPlayer-specs.js +180 -0
- package/VirtualList/VirtualList.d.ts +411 -0
- package/VirtualList/VirtualList.js +931 -0
- package/VirtualList/VirtualList.module.css +52 -0
- package/VirtualList/package.json +3 -0
- package/VirtualList/tests/VirtualGridList-specs.js +289 -0
- package/VirtualList/tests/VirtualGridList-translate-specs.js +711 -0
- package/VirtualList/tests/VirtualList-specs.js +288 -0
- package/VirtualList/tests/VirtualList-translate-specs.js +704 -0
- package/VirtualList/tests/useEvent-specs.js +172 -0
- package/VirtualList/tests/useEvent-translate-specs.js +309 -0
- package/VirtualList/useEvent.js +324 -0
- package/VirtualList/usePreventScroll.js +31 -0
- package/VirtualList/useSpotlight.js +157 -0
- package/VirtualList/useThemeVirtualList.js +471 -0
- package/VirtualList/useThemeVirtualList.module.css +34 -0
- package/WizardPanels/Panel.js +99 -0
- package/WizardPanels/WizardPanels.js +501 -0
- package/WizardPanels/WizardPanels.module.css +15 -0
- package/WizardPanels/index.d.ts +182 -0
- package/WizardPanels/index.js +50 -0
- package/WizardPanels/package.json +3 -0
- package/WizardPanels/tests/WizardPanels-specs.js +713 -0
- package/codecov.yml +13 -0
- package/fonts/Limestone_Icons.ttf +0 -0
- package/fonts/Miso/LICENSE.txt +75 -0
- package/fonts/Miso/Miso-Bold.ttf +0 -0
- package/fonts/Miso/Miso-Light.ttf +0 -0
- package/fonts/Miso/Miso-Regular.ttf +0 -0
- package/fonts/MuseoSans/LICENSE.txt +75 -0
- package/fonts/MuseoSans/MuseoSans-Black.ttf +0 -0
- package/fonts/MuseoSans/MuseoSans-BlackItalic.ttf +0 -0
- package/fonts/MuseoSans/MuseoSans-Bold.ttf +0 -0
- package/fonts/MuseoSans/MuseoSans-BoldItalic.ttf +0 -0
- package/fonts/MuseoSans/MuseoSans-Light.ttf +0 -0
- package/fonts/MuseoSans/MuseoSans-Medium.ttf +0 -0
- package/fonts/MuseoSans/MuseoSans-MediumItalic.ttf +0 -0
- package/fonts/MuseoSans/MuseoSans-Thin.ttf +0 -0
- package/index.js +2 -0
- package/internal/$L/$L.d.ts +21 -0
- package/internal/$L/$L.js +97 -0
- package/internal/$L/package.json +3 -0
- package/internal/AsyncRenderChildren/AsyncRenderChildren.js +74 -0
- package/internal/AsyncRenderChildren/package.json +3 -0
- package/internal/AsyncRenderChildren/tests/AsyncRenderChildren-specs.js +49 -0
- package/internal/DateComponentPicker/DateComponentPicker.js +165 -0
- package/internal/DateComponentPicker/DateComponentPicker.module.css +53 -0
- package/internal/DateComponentPicker/DateComponentRangePicker.js +132 -0
- package/internal/DateComponentPicker/index.js +31 -0
- package/internal/DateComponentPicker/package.json +3 -0
- package/internal/DateTime/DateTime.js +83 -0
- package/internal/DateTime/DateTime.module.css +51 -0
- package/internal/DateTime/DateTimeDecorator.js +268 -0
- package/internal/DateTime/index.js +37 -0
- package/internal/DateTime/package.json +3 -0
- package/internal/DateTime/tests/DateTimeDecorator-specs.js +33 -0
- package/internal/DebounceDecorator/DebounceDecorator.js +125 -0
- package/internal/DebounceDecorator/package.json +3 -0
- package/internal/DebounceDecorator/tests/DebounceDecorator-specs.js +151 -0
- package/internal/Panels/Arrangers.js +248 -0
- package/internal/Panels/CancelDecorator.js +43 -0
- package/internal/Panels/FloatingLayerIdProvider.js +27 -0
- package/internal/Panels/NavigationButton.js +64 -0
- package/internal/Panels/NavigationButton.module.css +69 -0
- package/internal/Panels/PanelsRouter.js +223 -0
- package/internal/Panels/PopupDecorator.js +287 -0
- package/internal/Panels/TransitionDecorator.js +99 -0
- package/internal/Panels/Viewport.js +313 -0
- package/internal/Panels/Viewport.module.css +25 -0
- package/internal/Panels/captureKeys.js +48 -0
- package/internal/Panels/index.js +101 -0
- package/internal/Panels/package.json +3 -0
- package/internal/Panels/useAutoFocus.js +95 -0
- package/internal/Panels/useFocusOnTransition.js +45 -0
- package/internal/Panels/useToggleRole.js +30 -0
- package/internal/Panels/util.js +64 -0
- package/internal/Picker/Picker.js +942 -0
- package/internal/Picker/Picker.module.css +1145 -0
- package/internal/Picker/PickerButton.js +97 -0
- package/internal/Picker/PickerItem.js +38 -0
- package/internal/Picker/SpottablePicker.js +63 -0
- package/internal/Picker/package.json +3 -0
- package/internal/Picker/tests/Picker-specs.js +968 -0
- package/internal/SharedStateDecorator/SharedStateDecorator.js +167 -0
- package/internal/SharedStateDecorator/package.json +3 -0
- package/internal/SharedStateDecorator/tests/SharedStateDecorator-specs.js +277 -0
- package/internal/WindowEventable/WindowEventable.js +114 -0
- package/internal/WindowEventable/package.json +3 -0
- package/internal/util/package.json +3 -0
- package/internal/util/util.js +79 -0
- package/internal/validators/package.json +4 -0
- package/internal/validators/tests/validators-specs.js +80 -0
- package/internal/validators/validators.js +136 -0
- package/package.json +69 -0
- package/resources/ilibmanifest.json +3 -0
- package/styles/color-mixins.less +230 -0
- package/styles/colors-game-green.less +25 -0
- package/styles/colors-game-orange.less +25 -0
- package/styles/colors-game.less +56 -0
- package/styles/colors-highcontrast.less +21 -0
- package/styles/colors.less +435 -0
- package/styles/mixins.less +337 -0
- package/styles/skin.less +54 -0
- package/styles/variables-base.less +32 -0
- package/styles/variables-game.less +25 -0
- package/styles/variables.less +1182 -0
- package/useScroll/HoverToScroll.js +265 -0
- package/useScroll/HoverToScroll.module.css +38 -0
- package/useScroll/OverscrollEffect.module.css +14 -0
- package/useScroll/Scrollbar.js +171 -0
- package/useScroll/Scrollbar.module.css +19 -0
- package/useScroll/ScrollbarPlaceholder.js +64 -0
- package/useScroll/ScrollbarTrack.js +209 -0
- package/useScroll/ScrollbarTrack.module.css +136 -0
- package/useScroll/package.json +3 -0
- package/useScroll/useEvent.js +693 -0
- package/useScroll/useOverscrollEffect.js +105 -0
- package/useScroll/useScroll.js +523 -0
- package/useScroll/useScroll.module.css +49 -0
- package/useScroll/useSpotlight.js +32 -0
- package/useScroll/useThemeScrollContentHandle.js +32 -0
|
@@ -0,0 +1,1036 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.EditableWrapper = exports.EditableShape = void 0;
|
|
7
|
+
var _handle = require("@enact/core/handle");
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
9
|
+
var _keymap = require("@enact/core/keymap");
|
|
10
|
+
var _usePublicClassNames = require("@enact/core/usePublicClassNames");
|
|
11
|
+
var _spotlight = _interopRequireWildcard(require("@enact/spotlight"));
|
|
12
|
+
var _container = require("@enact/spotlight/src/container");
|
|
13
|
+
var _target = require("@enact/spotlight/src/target");
|
|
14
|
+
var _Accelerator = _interopRequireDefault(require("@enact/spotlight/Accelerator"));
|
|
15
|
+
var _pointer = require("@enact/spotlight/src/pointer");
|
|
16
|
+
var _AnnounceDecorator = require("@enact/ui/AnnounceDecorator");
|
|
17
|
+
var _Touchable = _interopRequireDefault(require("@enact/ui/Touchable"));
|
|
18
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
+
var _IString = _interopRequireDefault(require("ilib/lib/IString"));
|
|
20
|
+
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
21
|
+
var _react = require("react");
|
|
22
|
+
var _$L = _interopRequireDefault(require("../internal/$L"));
|
|
23
|
+
var _EditableWrapperModule = _interopRequireDefault(require("./EditableWrapper.module.css"));
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
26
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
27
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
28
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
29
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
30
|
+
var completeAnnounceDelay = 300; // An arbitrary delay at a level that is not ignored by the new focus element
|
|
31
|
+
var TouchableDiv = (0, _Touchable["default"])('div');
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The shape for editable of {@link limestone/Scroller|Scroller}.
|
|
35
|
+
*
|
|
36
|
+
* @typedef {Object} EditableShape
|
|
37
|
+
* @memberof limestone/Scroller
|
|
38
|
+
* @property {Function} onComplete The callback function called when editing is finished.
|
|
39
|
+
* It has an event object contains `orders` array which app can use for repopulate items.
|
|
40
|
+
* @property {Function|Object} [blurItemFuncRef] Obtains a reference to `blurItem` function.
|
|
41
|
+
* If you would like to remove `focused` CSS class to an item, you can get the reference to `blurItem` function via `useRef`.
|
|
42
|
+
* `blurItem` function needs to be called with an item node when an item is blurred.
|
|
43
|
+
* @property {Boolean} [centered] Centers the contents of the scroller.
|
|
44
|
+
* @property {Object} [css] Customizes the component by mapping the supplied collection of CSS class names to the
|
|
45
|
+
* corresponding internal elements and states of this component.
|
|
46
|
+
* The following classes are supported:
|
|
47
|
+
*
|
|
48
|
+
* * `wrapper` - The content wrapper component class
|
|
49
|
+
* * `selected` - The selected item class
|
|
50
|
+
* * `focused` - The focused item class
|
|
51
|
+
* @property {Function|Object} [focusItemFuncRef] Obtains a reference to `focusItem` function.
|
|
52
|
+
* If you would like to use `focused` CSS class to an item, you can get the reference to `focusItem` function via `useRef`.
|
|
53
|
+
* `focusItem` function needs to be called with an item node when an item is focused.
|
|
54
|
+
* @property {Function|Object} [hideItemFuncRef] Obtains a reference to `hideItem` function.
|
|
55
|
+
* If you would like to hide an item, you can get the reference to `hideItem` function via `useRef`.
|
|
56
|
+
* @property {Function|Object} [removeItemFuncRef] Obtains a reference to `removeItem` function.
|
|
57
|
+
* If you would like to remove an item, you can get the reference to `removeItem` function via `useRef`.
|
|
58
|
+
* @property {string} [selectItemBy] Decides how to start editing items.
|
|
59
|
+
* It can be either `'press'` or `'longPress'`. If unset, it defaults to `'longPress'`.
|
|
60
|
+
* @property {Function|Object} [showItemFuncRef] Obtains a reference to `showItem` function.
|
|
61
|
+
* If you would like to show an item, you can get the reference to `showItem` function via `useRef`.
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
var EditableShape = exports.EditableShape = _propTypes2["default"].shape({
|
|
65
|
+
onComplete: _propTypes2["default"].func.isRequired,
|
|
66
|
+
blurItemFuncRef: _propTypes["default"].ref,
|
|
67
|
+
centered: _propTypes2["default"].bool,
|
|
68
|
+
css: _propTypes2["default"].object,
|
|
69
|
+
focusItemFuncRef: _propTypes["default"].ref,
|
|
70
|
+
hideItemFuncRef: _propTypes["default"].ref,
|
|
71
|
+
removeItemFuncRef: _propTypes["default"].ref,
|
|
72
|
+
selectItemBy: _propTypes2["default"].string,
|
|
73
|
+
showItemFuncRef: _propTypes["default"].ref
|
|
74
|
+
});
|
|
75
|
+
var SpotlightAccelerator = new _Accelerator["default"]([5, 4]);
|
|
76
|
+
var holdDuration = 500;
|
|
77
|
+
var holdConfig = {
|
|
78
|
+
events: [{
|
|
79
|
+
name: 'hold',
|
|
80
|
+
time: holdDuration
|
|
81
|
+
}]
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* A Limestone-styled EditableWrapper.
|
|
86
|
+
*
|
|
87
|
+
* @class EditableWrapper
|
|
88
|
+
* @memberof limestone/Scroller
|
|
89
|
+
* @ui
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
var EditableWrapper = exports.EditableWrapper = function EditableWrapper(props) {
|
|
93
|
+
var _editable$hideIndex;
|
|
94
|
+
var children = props.children,
|
|
95
|
+
editable = props.editable,
|
|
96
|
+
scrollContainerHandle = props.scrollContainerHandle,
|
|
97
|
+
scrollContainerRef = props.scrollContainerRef,
|
|
98
|
+
scrollContentRef = props.scrollContentRef;
|
|
99
|
+
var centered = (editable === null || editable === void 0 ? void 0 : editable.centered) != null ? editable.centered : true;
|
|
100
|
+
var selectItemBy = (editable === null || editable === void 0 ? void 0 : editable.selectItemBy) || 'longPress';
|
|
101
|
+
var customCss = (editable === null || editable === void 0 ? void 0 : editable.css) || {};
|
|
102
|
+
var removeItemFuncRef = editable === null || editable === void 0 ? void 0 : editable.removeItemFuncRef;
|
|
103
|
+
var hideItemFuncRef = editable === null || editable === void 0 ? void 0 : editable.hideItemFuncRef;
|
|
104
|
+
var showItemFuncRef = editable === null || editable === void 0 ? void 0 : editable.showItemFuncRef;
|
|
105
|
+
var focusItemFuncRef = editable === null || editable === void 0 ? void 0 : editable.focusItemFuncRef;
|
|
106
|
+
var blurItemFuncRef = editable === null || editable === void 0 ? void 0 : editable.blurItemFuncRef;
|
|
107
|
+
var mergedCss = (0, _usePublicClassNames.usePublicClassNames)({
|
|
108
|
+
componentCss: _EditableWrapperModule["default"],
|
|
109
|
+
customCss: customCss,
|
|
110
|
+
publicClassNames: true
|
|
111
|
+
});
|
|
112
|
+
var dataSize = children === null || children === void 0 ? void 0 : children.length;
|
|
113
|
+
|
|
114
|
+
// Mutable value
|
|
115
|
+
var wrapperRef = (0, _react.useRef)();
|
|
116
|
+
var mutableRef = (0, _react.useRef)({
|
|
117
|
+
// Constants
|
|
118
|
+
itemWidth: null,
|
|
119
|
+
centeredOffset: 0,
|
|
120
|
+
spotlightId: null,
|
|
121
|
+
// DOM elements
|
|
122
|
+
focusedItem: null,
|
|
123
|
+
selectedItem: null,
|
|
124
|
+
selectedItemLabel: '',
|
|
125
|
+
rearrangedItems: [],
|
|
126
|
+
// Indices
|
|
127
|
+
fromIndex: null,
|
|
128
|
+
prevToIndex: null,
|
|
129
|
+
hideIndex: null,
|
|
130
|
+
// Position for restoring focus after removing item
|
|
131
|
+
nextSpotlightRect: null,
|
|
132
|
+
// Move direction from the starting position to the current position
|
|
133
|
+
moveDirection: null,
|
|
134
|
+
// Last mouse position
|
|
135
|
+
lastMouseClientX: null,
|
|
136
|
+
// Last InputType
|
|
137
|
+
lastInputType: null,
|
|
138
|
+
// Timer for holding key input
|
|
139
|
+
keyHoldTimerId: null,
|
|
140
|
+
// Flag for prevent event propagation
|
|
141
|
+
needToPreventEvent: null,
|
|
142
|
+
lastInputDirection: null,
|
|
143
|
+
isDraggingItem: false,
|
|
144
|
+
isDragging: false,
|
|
145
|
+
// initialSelected
|
|
146
|
+
initialSelected: editable === null || editable === void 0 ? void 0 : editable.initialSelected
|
|
147
|
+
});
|
|
148
|
+
var announceRef = (0, _react.useRef)({});
|
|
149
|
+
mutableRef.current.hideIndex = (_editable$hideIndex = editable === null || editable === void 0 ? void 0 : editable.hideIndex) !== null && _editable$hideIndex !== void 0 ? _editable$hideIndex : dataSize;
|
|
150
|
+
|
|
151
|
+
// Functions
|
|
152
|
+
|
|
153
|
+
// Reset values
|
|
154
|
+
var reset = (0, _react.useCallback)(function () {
|
|
155
|
+
var _mutableRef$current = mutableRef.current,
|
|
156
|
+
focusedItem = _mutableRef$current.focusedItem,
|
|
157
|
+
selectedItem = _mutableRef$current.selectedItem,
|
|
158
|
+
spotlightId = _mutableRef$current.spotlightId;
|
|
159
|
+
focusedItem === null || focusedItem === void 0 || focusedItem.classList.remove(customCss.focused);
|
|
160
|
+
selectedItem === null || selectedItem === void 0 || selectedItem.classList.remove(_EditableWrapperModule["default"].selected, customCss.selected, _EditableWrapperModule["default"].rearranged);
|
|
161
|
+
mutableRef.current.focusedItem = null;
|
|
162
|
+
mutableRef.current.selectedItem = null;
|
|
163
|
+
mutableRef.current.selectedItemLabel = '';
|
|
164
|
+
mutableRef.current.moveDirection = null;
|
|
165
|
+
mutableRef.current.prevToIndex = null;
|
|
166
|
+
mutableRef.current.initialSelected = null;
|
|
167
|
+
wrapperRef.current.style.setProperty('--selected-item-offset', '0px');
|
|
168
|
+
_spotlight["default"].set(spotlightId, {
|
|
169
|
+
restrict: 'self-first'
|
|
170
|
+
});
|
|
171
|
+
}, [customCss.focused, customCss.selected]);
|
|
172
|
+
|
|
173
|
+
// Finalize the order
|
|
174
|
+
var finalizeOrders = (0, _react.useCallback)(function () {
|
|
175
|
+
var _mutableRef$current2 = mutableRef.current,
|
|
176
|
+
fromIndex = _mutableRef$current2.fromIndex,
|
|
177
|
+
moveDirection = _mutableRef$current2.moveDirection,
|
|
178
|
+
prevToIndex = _mutableRef$current2.prevToIndex,
|
|
179
|
+
rearrangedItems = _mutableRef$current2.rearrangedItems,
|
|
180
|
+
selectedItem = _mutableRef$current2.selectedItem;
|
|
181
|
+
var orders = Array.from({
|
|
182
|
+
length: dataSize
|
|
183
|
+
}, function (_, i) {
|
|
184
|
+
return i + 1;
|
|
185
|
+
});
|
|
186
|
+
if (rearrangedItems.length > 0) {
|
|
187
|
+
var selectedOrder = selectedItem.style.order;
|
|
188
|
+
var changedOrder = [];
|
|
189
|
+
rearrangedItems.forEach(function (item) {
|
|
190
|
+
var order = Number(item.style.order);
|
|
191
|
+
selectedOrder = order;
|
|
192
|
+
item.style.order = order - moveDirection;
|
|
193
|
+
item.classList.remove(_EditableWrapperModule["default"].rearrangedTransform, _EditableWrapperModule["default"].rearranged);
|
|
194
|
+
if (moveDirection > 0) {
|
|
195
|
+
changedOrder.push(order);
|
|
196
|
+
} else {
|
|
197
|
+
changedOrder.unshift(order);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
if (moveDirection > 0) {
|
|
201
|
+
changedOrder.push(Number(selectedItem.style.order));
|
|
202
|
+
} else {
|
|
203
|
+
changedOrder.unshift(Number(selectedItem.style.order));
|
|
204
|
+
}
|
|
205
|
+
mutableRef.current.rearrangedItems = [];
|
|
206
|
+
selectedItem.style.order = selectedOrder;
|
|
207
|
+
|
|
208
|
+
// Create reordered array
|
|
209
|
+
orders.splice.apply(orders, [Math.min(fromIndex, prevToIndex), changedOrder.length].concat(changedOrder));
|
|
210
|
+
}
|
|
211
|
+
return orders;
|
|
212
|
+
}, [dataSize]);
|
|
213
|
+
var updateArrowIcon = (0, _react.useCallback)(function (index) {
|
|
214
|
+
var _mutableRef$current$s, _mutableRef$current$s2;
|
|
215
|
+
(_mutableRef$current$s = mutableRef.current.selectedItem) === null || _mutableRef$current$s === void 0 || _mutableRef$current$s.classList.toggle(customCss.noBefore, index === 0);
|
|
216
|
+
(_mutableRef$current$s2 = mutableRef.current.selectedItem) === null || _mutableRef$current$s2 === void 0 || _mutableRef$current$s2.classList.toggle(customCss.noAfter, index === mutableRef.current.hideIndex - 1);
|
|
217
|
+
}, [customCss.noBefore, customCss.noAfter]);
|
|
218
|
+
var startEditing = (0, _react.useCallback)(function (item) {
|
|
219
|
+
var _item$dataset;
|
|
220
|
+
if (item !== null && item !== void 0 && (_item$dataset = item.dataset) !== null && _item$dataset !== void 0 && _item$dataset.index && (!item.hasAttribute('disabled') || item.hasAttribute('data-is-hiding'))) {
|
|
221
|
+
var _mutableRef$current$f;
|
|
222
|
+
item.classList.add(_EditableWrapperModule["default"].selected, customCss.selected);
|
|
223
|
+
mutableRef.current.selectedItem = item;
|
|
224
|
+
(_mutableRef$current$f = mutableRef.current.focusedItem) === null || _mutableRef$current$f === void 0 || _mutableRef$current$f.classList.remove(customCss.focused);
|
|
225
|
+
mutableRef.current.focusedItem = null;
|
|
226
|
+
mutableRef.current.selectedItemLabel = (item.ariaLabel || item.textContent) + ' ';
|
|
227
|
+
mutableRef.current.fromIndex = Number(item.style.order) - 1;
|
|
228
|
+
mutableRef.current.prevToIndex = mutableRef.current.fromIndex;
|
|
229
|
+
updateArrowIcon(mutableRef.current.fromIndex);
|
|
230
|
+
setTimeout(function () {
|
|
231
|
+
if (item !== null && item !== void 0 && item.children[1]) {
|
|
232
|
+
item.children[1].ariaLabel = '';
|
|
233
|
+
}
|
|
234
|
+
if (!mutableRef.current.initialSelected) {
|
|
235
|
+
announceRef.current.announce(mutableRef.current.selectedItemLabel + (0, _$L["default"])('Press the left/right button to move or press the up button to select other options.'));
|
|
236
|
+
}
|
|
237
|
+
}, completeAnnounceDelay);
|
|
238
|
+
}
|
|
239
|
+
}, [customCss.focused, customCss.selected, updateArrowIcon]);
|
|
240
|
+
var finalizeEditing = (0, _react.useCallback)(function (orders) {
|
|
241
|
+
if (mutableRef.current.initialSelected) {
|
|
242
|
+
mutableRef.current.selectedItem.children[1].ariaLabel = "".concat(mutableRef.current.selectedItem.ariaLabel, " ").concat((0, _$L["default"])('Press the OK button to move or press the up button to select other options.'));
|
|
243
|
+
}
|
|
244
|
+
(0, _handle.forwardCustom)('onComplete', function () {
|
|
245
|
+
return {
|
|
246
|
+
orders: orders,
|
|
247
|
+
hideIndex: mutableRef.current.hideIndex
|
|
248
|
+
};
|
|
249
|
+
})(null, editable);
|
|
250
|
+
reset();
|
|
251
|
+
}, [editable, reset]);
|
|
252
|
+
var findItemNode = (0, _react.useCallback)(function (node) {
|
|
253
|
+
for (var current = node; current !== scrollContentRef.current && current !== document; current = current.parentNode) {
|
|
254
|
+
if (current.dataset.index) {
|
|
255
|
+
return current;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return null;
|
|
259
|
+
}, [scrollContentRef]);
|
|
260
|
+
var focusItem = (0, _react.useCallback)(function (target) {
|
|
261
|
+
var itemNode = findItemNode(target);
|
|
262
|
+
if (itemNode && !mutableRef.current.selectedItem) {
|
|
263
|
+
var _mutableRef$current$f2, _mutableRef$current$f3;
|
|
264
|
+
(_mutableRef$current$f2 = mutableRef.current.focusedItem) === null || _mutableRef$current$f2 === void 0 || _mutableRef$current$f2.classList.remove(customCss.focused);
|
|
265
|
+
mutableRef.current.focusedItem = itemNode;
|
|
266
|
+
(_mutableRef$current$f3 = mutableRef.current.focusedItem) === null || _mutableRef$current$f3 === void 0 || _mutableRef$current$f3.classList.add(customCss.focused);
|
|
267
|
+
mutableRef.current.prevToIndex = Number(itemNode.style.order) - 1;
|
|
268
|
+
}
|
|
269
|
+
}, [customCss.focused, findItemNode]);
|
|
270
|
+
var blurItem = (0, _react.useCallback)(function (target) {
|
|
271
|
+
var itemNode = findItemNode(target);
|
|
272
|
+
if (itemNode && !mutableRef.current.selectedItem) {
|
|
273
|
+
var _mutableRef$current$f4;
|
|
274
|
+
(_mutableRef$current$f4 = mutableRef.current.focusedItem) === null || _mutableRef$current$f4 === void 0 || _mutableRef$current$f4.classList.remove(customCss.focused);
|
|
275
|
+
mutableRef.current.focusedItem = null;
|
|
276
|
+
mutableRef.current.prevToIndex = null;
|
|
277
|
+
}
|
|
278
|
+
}, [customCss.focused, findItemNode]);
|
|
279
|
+
var handleClickCapture = (0, _react.useCallback)(function (ev) {
|
|
280
|
+
var _ev$target, _ev$target2;
|
|
281
|
+
var isButtonBg = ev.target.getAttribute('role') === 'button';
|
|
282
|
+
var isButtonClient = ((_ev$target = ev.target) === null || _ev$target === void 0 ? void 0 : _ev$target.parentNode.getAttribute('role')) === 'button';
|
|
283
|
+
var isButtonIcon = ((_ev$target2 = ev.target) === null || _ev$target2 === void 0 || (_ev$target2 = _ev$target2.parentNode) === null || _ev$target2 === void 0 ? void 0 : _ev$target2.parentNode.getAttribute('role')) === 'button';
|
|
284
|
+
if (isButtonBg || isButtonClient || isButtonIcon) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
// Consume the event to prevent Item behavior
|
|
288
|
+
if (mutableRef.current.selectedItem || mutableRef.current.needToPreventEvent) {
|
|
289
|
+
ev.preventDefault();
|
|
290
|
+
ev.stopPropagation();
|
|
291
|
+
mutableRef.current.needToPreventEvent = false;
|
|
292
|
+
}
|
|
293
|
+
}, []);
|
|
294
|
+
var handleMouseDown = (0, _react.useCallback)(function (ev) {
|
|
295
|
+
var _ev$target3, _ev$target4;
|
|
296
|
+
var isButtonBg = ev.target.getAttribute('role') === 'button';
|
|
297
|
+
var isButtonClient = ((_ev$target3 = ev.target) === null || _ev$target3 === void 0 ? void 0 : _ev$target3.parentNode.getAttribute('role')) === 'button';
|
|
298
|
+
var isButtonIcon = ((_ev$target4 = ev.target) === null || _ev$target4 === void 0 || (_ev$target4 = _ev$target4.parentNode) === null || _ev$target4 === void 0 ? void 0 : _ev$target4.parentNode.getAttribute('role')) === 'button';
|
|
299
|
+
if (isButtonBg || isButtonClient || isButtonIcon) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (mutableRef.current.selectedItem) {
|
|
303
|
+
// Finalize orders and forward `onComplete` event
|
|
304
|
+
var orders = finalizeOrders();
|
|
305
|
+
finalizeEditing(orders);
|
|
306
|
+
if (selectItemBy === 'press') {
|
|
307
|
+
focusItem(ev.target);
|
|
308
|
+
}
|
|
309
|
+
mutableRef.current.needToPreventEvent = true;
|
|
310
|
+
} else {
|
|
311
|
+
var targetItemNode = findItemNode(ev.target);
|
|
312
|
+
if (selectItemBy === 'press') {
|
|
313
|
+
if (targetItemNode && targetItemNode.dataset.index) {
|
|
314
|
+
// Start editing by adding selected transition to selected item
|
|
315
|
+
mutableRef.current.targetItemNode = targetItemNode;
|
|
316
|
+
startEditing(targetItemNode);
|
|
317
|
+
}
|
|
318
|
+
mutableRef.current.needToPreventEvent = true;
|
|
319
|
+
} else {
|
|
320
|
+
mutableRef.current.targetItemNode = targetItemNode;
|
|
321
|
+
mutableRef.current.needToPreventEvent = false;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}, [finalizeEditing, finalizeOrders, findItemNode, focusItem, selectItemBy, startEditing]);
|
|
325
|
+
var handleHoldStart = (0, _react.useCallback)(function () {
|
|
326
|
+
var targetItemNode = mutableRef.current.targetItemNode;
|
|
327
|
+
if (targetItemNode && targetItemNode.dataset.index && selectItemBy === 'longPress') {
|
|
328
|
+
// Start editing by adding selected transition to selected item
|
|
329
|
+
startEditing(targetItemNode);
|
|
330
|
+
}
|
|
331
|
+
}, [selectItemBy, startEditing]);
|
|
332
|
+
var readOutCurrentPosition = (0, _react.useCallback)(function (neighborItem) {
|
|
333
|
+
var _mutableRef$current3 = mutableRef.current,
|
|
334
|
+
lastInputDirection = _mutableRef$current3.lastInputDirection,
|
|
335
|
+
lastInputType = _mutableRef$current3.lastInputType,
|
|
336
|
+
selectedItemLabel = _mutableRef$current3.selectedItemLabel;
|
|
337
|
+
if (lastInputType === 'key') {
|
|
338
|
+
if (lastInputDirection === 'left') {
|
|
339
|
+
announceRef.current.announce(new _IString["default"]((0, _$L["default"])('{selectedItem} moved to the left of {neighborItem}')).format({
|
|
340
|
+
selectedItem: selectedItemLabel,
|
|
341
|
+
neighborItem: neighborItem
|
|
342
|
+
}), true);
|
|
343
|
+
} else {
|
|
344
|
+
announceRef.current.announce(new _IString["default"]((0, _$L["default"])('{selectedItem} moved to the right of {neighborItem}')).format({
|
|
345
|
+
selectedItem: selectedItemLabel,
|
|
346
|
+
neighborItem: neighborItem
|
|
347
|
+
}), true);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}, []);
|
|
351
|
+
|
|
352
|
+
// Add rearranged items
|
|
353
|
+
var addRearrangedItems = (0, _react.useCallback)(function (_ref) {
|
|
354
|
+
var currentMoveDirection = _ref.currentMoveDirection,
|
|
355
|
+
toIndex = _ref.toIndex;
|
|
356
|
+
// Set the currentMoveDirection to css variable
|
|
357
|
+
var rtl = scrollContainerHandle.current.rtl;
|
|
358
|
+
wrapperRef.current.style.setProperty('--move-direction', currentMoveDirection * (rtl ? -1 : 1));
|
|
359
|
+
var _mutableRef$current4 = mutableRef.current,
|
|
360
|
+
fromIndex = _mutableRef$current4.fromIndex,
|
|
361
|
+
rearrangedItems = _mutableRef$current4.rearrangedItems,
|
|
362
|
+
selectedItem = _mutableRef$current4.selectedItem;
|
|
363
|
+
var getNextElement = function getNextElement(item) {
|
|
364
|
+
return currentMoveDirection > 0 ? item.nextElementSibling : item.previousElementSibling;
|
|
365
|
+
};
|
|
366
|
+
var sibling = getNextElement(selectedItem);
|
|
367
|
+
var lastRearrangedItem;
|
|
368
|
+
var start = currentMoveDirection > 0 ? toIndex : fromIndex;
|
|
369
|
+
var end = currentMoveDirection > 0 ? fromIndex : toIndex;
|
|
370
|
+
while (start > end && sibling) {
|
|
371
|
+
var _sibling;
|
|
372
|
+
(_sibling = sibling) === null || _sibling === void 0 || _sibling.classList.add(_EditableWrapperModule["default"].rearranged, _EditableWrapperModule["default"].rearrangedTransform);
|
|
373
|
+
if (!rearrangedItems.includes(sibling)) {
|
|
374
|
+
rearrangedItems.push(sibling);
|
|
375
|
+
}
|
|
376
|
+
lastRearrangedItem = sibling;
|
|
377
|
+
sibling = getNextElement(sibling);
|
|
378
|
+
start--;
|
|
379
|
+
}
|
|
380
|
+
if (lastRearrangedItem) {
|
|
381
|
+
readOutCurrentPosition(lastRearrangedItem.ariaLabel || lastRearrangedItem.textContent);
|
|
382
|
+
}
|
|
383
|
+
mutableRef.current.moveDirection = currentMoveDirection;
|
|
384
|
+
}, [readOutCurrentPosition, scrollContainerHandle]);
|
|
385
|
+
var removeRearrangedItems = (0, _react.useCallback)(function (numToRemove) {
|
|
386
|
+
var rearrangedItems = mutableRef.current.rearrangedItems;
|
|
387
|
+
var toItem = null;
|
|
388
|
+
if (rearrangedItems.length > 0) {
|
|
389
|
+
for (var i = 0; i < numToRemove; i++) {
|
|
390
|
+
var _toItem;
|
|
391
|
+
toItem = rearrangedItems.pop();
|
|
392
|
+
(_toItem = toItem) === null || _toItem === void 0 || _toItem.classList.remove(_EditableWrapperModule["default"].rearrangedTransform);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
if (toItem) {
|
|
396
|
+
readOutCurrentPosition(toItem.ariaLabel || toItem.textContent);
|
|
397
|
+
}
|
|
398
|
+
}, [readOutCurrentPosition]);
|
|
399
|
+
|
|
400
|
+
// Move items
|
|
401
|
+
var moveItems = (0, _react.useCallback)(function (toIndex) {
|
|
402
|
+
var selectedItem = mutableRef.current.selectedItem;
|
|
403
|
+
var rtl = scrollContainerHandle.current.rtl;
|
|
404
|
+
if (selectedItem && !selectedItem.hasAttribute('data-is-hiding')) {
|
|
405
|
+
// Bail out when index is out of scope
|
|
406
|
+
if (toIndex < mutableRef.current.hideIndex && toIndex >= 0) {
|
|
407
|
+
var _mutableRef$current5 = mutableRef.current,
|
|
408
|
+
fromIndex = _mutableRef$current5.fromIndex,
|
|
409
|
+
itemWidth = _mutableRef$current5.itemWidth,
|
|
410
|
+
moveDirection = _mutableRef$current5.moveDirection,
|
|
411
|
+
prevToIndex = _mutableRef$current5.prevToIndex,
|
|
412
|
+
rearrangedItems = _mutableRef$current5.rearrangedItems;
|
|
413
|
+
|
|
414
|
+
// Set the selected item's offset to css variable
|
|
415
|
+
var offset = (toIndex - fromIndex) * itemWidth;
|
|
416
|
+
wrapperRef.current.style.setProperty('--selected-item-offset', offset * (rtl ? -1 : 1) + 'px');
|
|
417
|
+
|
|
418
|
+
// If the current toIndex is new,
|
|
419
|
+
if (toIndex !== prevToIndex) {
|
|
420
|
+
// Determine the direction of move from the latest from index
|
|
421
|
+
var currentMoveDirection = Math.sign(toIndex - prevToIndex);
|
|
422
|
+
// If the direction is changed and there are rearranged items, we remove them first.
|
|
423
|
+
if (moveDirection && currentMoveDirection !== moveDirection && rearrangedItems.length > 0) {
|
|
424
|
+
var numToRemove = currentMoveDirection > 0 ? toIndex - prevToIndex : prevToIndex - toIndex;
|
|
425
|
+
var needToAddItems = numToRemove > rearrangedItems.length;
|
|
426
|
+
removeRearrangedItems(numToRemove);
|
|
427
|
+
|
|
428
|
+
// When there's jump, meaning, numToRemove is bigger than 0, we need to add an item
|
|
429
|
+
if (needToAddItems) {
|
|
430
|
+
addRearrangedItems({
|
|
431
|
+
currentMoveDirection: currentMoveDirection,
|
|
432
|
+
toIndex: toIndex
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
} else {
|
|
436
|
+
addRearrangedItems({
|
|
437
|
+
currentMoveDirection: currentMoveDirection,
|
|
438
|
+
toIndex: toIndex
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
mutableRef.current.prevToIndex = toIndex;
|
|
442
|
+
}
|
|
443
|
+
updateArrowIcon(toIndex);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}, [addRearrangedItems, removeRearrangedItems, scrollContainerHandle, updateArrowIcon]);
|
|
447
|
+
var moveItemsByKeyDown = (0, _react.useCallback)(function (ev) {
|
|
448
|
+
var keyCode = ev.keyCode;
|
|
449
|
+
var container = scrollContentRef.current;
|
|
450
|
+
var _mutableRef$current6 = mutableRef.current,
|
|
451
|
+
itemWidth = _mutableRef$current6.itemWidth,
|
|
452
|
+
prevToIndex = _mutableRef$current6.prevToIndex;
|
|
453
|
+
var rtl = scrollContainerHandle.current.rtl;
|
|
454
|
+
var toIndex = !rtl ^ !(0, _keymap.is)('left', keyCode) ? prevToIndex - 1 : prevToIndex + 1;
|
|
455
|
+
var scrollLeft = container.scrollLeft * (rtl ? -1 : 1);
|
|
456
|
+
var itemLeft = toIndex * itemWidth - scrollLeft;
|
|
457
|
+
var left;
|
|
458
|
+
if (itemLeft > container.offsetLeft + container.clientWidth - itemWidth) {
|
|
459
|
+
left = itemLeft - (container.clientWidth - itemWidth) + scrollLeft;
|
|
460
|
+
} else if (itemLeft < 0) {
|
|
461
|
+
left = scrollLeft + itemLeft;
|
|
462
|
+
}
|
|
463
|
+
if (left != null) {
|
|
464
|
+
/* avoid null or undefined */
|
|
465
|
+
scrollContainerHandle.current.start({
|
|
466
|
+
targetX: left,
|
|
467
|
+
targetY: 0
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
mutableRef.current.lastInputDirection = (0, _keymap.is)('left', keyCode) ? 'left' : 'right';
|
|
471
|
+
moveItems(toIndex);
|
|
472
|
+
if (toIndex <= 0) {
|
|
473
|
+
announceRef.current.announce((0, _keymap.is)('left', keyCode) && !rtl && (0, _$L["default"])('LEFTMOST') || (0, _keymap.is)('right', keyCode) && rtl && (0, _$L["default"])('RIGHTMOST'));
|
|
474
|
+
} else if (toIndex >= dataSize - 1) {
|
|
475
|
+
announceRef.current.announce((0, _keymap.is)('right', keyCode) && !rtl && (0, _$L["default"])('RIGHTMOST') || (0, _keymap.is)('left', keyCode) && rtl && (0, _$L["default"])('LEFTMOST'));
|
|
476
|
+
}
|
|
477
|
+
}, [dataSize, moveItems, scrollContainerHandle, scrollContentRef]);
|
|
478
|
+
|
|
479
|
+
// Remove an item
|
|
480
|
+
var removeItem = (0, _react.useCallback)(function () {
|
|
481
|
+
var _mutableRef$current7 = mutableRef.current,
|
|
482
|
+
focusedItem = _mutableRef$current7.focusedItem,
|
|
483
|
+
prevToIndex = _mutableRef$current7.prevToIndex,
|
|
484
|
+
selectedItem = _mutableRef$current7.selectedItem;
|
|
485
|
+
var targetItem = selectedItem || focusedItem;
|
|
486
|
+
if (targetItem) {
|
|
487
|
+
// rearrangedItems need for the case when removing item while moving selected item
|
|
488
|
+
var rearrangedItems = mutableRef.current.rearrangedItems;
|
|
489
|
+
var targetItemRect = targetItem && targetItem.getBoundingClientRect();
|
|
490
|
+
mutableRef.current.nextSpotlightRect = {
|
|
491
|
+
x: targetItemRect.right,
|
|
492
|
+
y: targetItemRect.top
|
|
493
|
+
};
|
|
494
|
+
mutableRef.current.hideIndex -= 1;
|
|
495
|
+
var orders = finalizeOrders();
|
|
496
|
+
orders.splice(prevToIndex, 1);
|
|
497
|
+
rearrangedItems.forEach(function (item) {
|
|
498
|
+
item.style.order -= 1;
|
|
499
|
+
});
|
|
500
|
+
finalizeEditing(orders);
|
|
501
|
+
}
|
|
502
|
+
}, [finalizeEditing, finalizeOrders]);
|
|
503
|
+
var hideItem = (0, _react.useCallback)(function () {
|
|
504
|
+
var _mutableRef$current8 = mutableRef.current,
|
|
505
|
+
focusedItem = _mutableRef$current8.focusedItem,
|
|
506
|
+
selectedItem = _mutableRef$current8.selectedItem;
|
|
507
|
+
var targetItem = selectedItem || focusedItem;
|
|
508
|
+
if (targetItem) {
|
|
509
|
+
// rearrangedItems need for the case when hiding item while moving selected item
|
|
510
|
+
var rearrangedItems = mutableRef.current.rearrangedItems;
|
|
511
|
+
var targetItemOrder = Number(targetItem.style.order);
|
|
512
|
+
var targetItemRect = targetItem && targetItem.getBoundingClientRect();
|
|
513
|
+
mutableRef.current.nextSpotlightRect = {
|
|
514
|
+
x: targetItemRect.right,
|
|
515
|
+
y: targetItemRect.top
|
|
516
|
+
};
|
|
517
|
+
mutableRef.current.hideIndex -= 1;
|
|
518
|
+
var orders = finalizeOrders();
|
|
519
|
+
orders.splice(orders.indexOf(targetItemOrder), 1);
|
|
520
|
+
orders.push(targetItemOrder);
|
|
521
|
+
rearrangedItems.forEach(function (item) {
|
|
522
|
+
item.style.order -= 1;
|
|
523
|
+
});
|
|
524
|
+
targetItem.style.order = orders.length;
|
|
525
|
+
targetItem.setAttribute('data-is-hiding', true);
|
|
526
|
+
finalizeEditing(orders);
|
|
527
|
+
}
|
|
528
|
+
}, [finalizeEditing, finalizeOrders]);
|
|
529
|
+
var showItem = (0, _react.useCallback)(function () {
|
|
530
|
+
var _mutableRef$current9 = mutableRef.current,
|
|
531
|
+
focusedItem = _mutableRef$current9.focusedItem,
|
|
532
|
+
selectedItem = _mutableRef$current9.selectedItem;
|
|
533
|
+
var targetItem = selectedItem || focusedItem;
|
|
534
|
+
if (targetItem) {
|
|
535
|
+
var targetItemOrder = Number(targetItem.style.order);
|
|
536
|
+
var targetItemRect = targetItem && targetItem.getBoundingClientRect();
|
|
537
|
+
mutableRef.current.nextSpotlightRect = {
|
|
538
|
+
x: targetItemRect.right,
|
|
539
|
+
y: targetItemRect.top
|
|
540
|
+
};
|
|
541
|
+
var orders = Array.from({
|
|
542
|
+
length: dataSize
|
|
543
|
+
}, function (_, i) {
|
|
544
|
+
return i + 1;
|
|
545
|
+
});
|
|
546
|
+
orders.splice(targetItemOrder - 1, 1);
|
|
547
|
+
orders.splice(mutableRef.current.hideIndex, 0, targetItemOrder);
|
|
548
|
+
mutableRef.current.hideIndex += 1;
|
|
549
|
+
targetItem.removeAttribute('data-is-hiding');
|
|
550
|
+
finalizeEditing(orders);
|
|
551
|
+
}
|
|
552
|
+
}, [dataSize, finalizeEditing]);
|
|
553
|
+
var getNextIndexFromPosition = (0, _react.useCallback)(function (x, tolerance) {
|
|
554
|
+
var _mutableRef$current0 = mutableRef.current,
|
|
555
|
+
centeredOffset = _mutableRef$current0.centeredOffset,
|
|
556
|
+
itemWidth = _mutableRef$current0.itemWidth,
|
|
557
|
+
prevToIndex = _mutableRef$current0.prevToIndex;
|
|
558
|
+
var rtl = scrollContainerHandle.current.rtl;
|
|
559
|
+
var bodyWidth = document.body.getBoundingClientRect().width;
|
|
560
|
+
|
|
561
|
+
// Determine toIndex with mouse client x position
|
|
562
|
+
// Coordinate calculation in RTL locales is not supported in chrome below 85
|
|
563
|
+
var scrollContentOffset = scrollContentRef.current.scrollLeft * (rtl ? -1 : 1) - centeredOffset;
|
|
564
|
+
var clientXFromContent = (rtl ? bodyWidth - x : x) + scrollContentOffset;
|
|
565
|
+
var direction = itemWidth * (prevToIndex + 0.5) < clientXFromContent ? 1 : -1; // 1: To next index , -1: To prev index
|
|
566
|
+
var moveTolerance = itemWidth * tolerance * direction;
|
|
567
|
+
return Math.floor((clientXFromContent - moveTolerance) / itemWidth);
|
|
568
|
+
}, [scrollContainerHandle, scrollContentRef]);
|
|
569
|
+
var handlePointerDown = (0, _react.useCallback)(function (ev) {
|
|
570
|
+
var selectedItem = mutableRef.current.selectedItem;
|
|
571
|
+
if (selectedItem) {
|
|
572
|
+
if (ev.target.hasPointerCapture(ev.pointerId)) {
|
|
573
|
+
ev.target.releasePointerCapture(ev.pointerId);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}, []);
|
|
577
|
+
var handleMouseMove = (0, _react.useCallback)(function (ev) {
|
|
578
|
+
var clientX = ev.clientX;
|
|
579
|
+
mutableRef.current.lastMouseClientX = clientX;
|
|
580
|
+
mutableRef.current.lastInputType = 'mouse';
|
|
581
|
+
if (mutableRef.current.selectedItem && Number(mutableRef.current.selectedItem.style.order) - 1 < mutableRef.current.hideIndex) {
|
|
582
|
+
var toIndex = getNextIndexFromPosition(clientX, 0.33);
|
|
583
|
+
moveItems(toIndex);
|
|
584
|
+
}
|
|
585
|
+
}, [getNextIndexFromPosition, moveItems]);
|
|
586
|
+
var handleMouseLeave = (0, _react.useCallback)(function () {
|
|
587
|
+
var _mutableRef$current1 = mutableRef.current,
|
|
588
|
+
focusedItem = _mutableRef$current1.focusedItem,
|
|
589
|
+
itemWidth = _mutableRef$current1.itemWidth,
|
|
590
|
+
lastInputType = _mutableRef$current1.lastInputType,
|
|
591
|
+
lastMouseClientX = _mutableRef$current1.lastMouseClientX,
|
|
592
|
+
selectedItem = _mutableRef$current1.selectedItem;
|
|
593
|
+
var rtl = scrollContainerHandle.current.rtl;
|
|
594
|
+
var scrollContentNode = scrollContentRef.current;
|
|
595
|
+
var scrollContentCenter = scrollContentNode.getBoundingClientRect().width / 2;
|
|
596
|
+
if (selectedItem || focusedItem) {
|
|
597
|
+
var orders = finalizeOrders();
|
|
598
|
+
finalizeEditing(orders);
|
|
599
|
+
if (lastInputType === 'scroll') {
|
|
600
|
+
var offset = itemWidth * (!rtl ^ !(lastMouseClientX > scrollContentCenter) ? 1 : -1);
|
|
601
|
+
scrollContainerHandle.current.start({
|
|
602
|
+
targetX: scrollContentNode.scrollLeft + offset,
|
|
603
|
+
targetY: 0
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}, [finalizeEditing, finalizeOrders, scrollContainerHandle, scrollContentRef]);
|
|
608
|
+
var completeEditingByKeyDown = (0, _react.useCallback)(function () {
|
|
609
|
+
var _mutableRef$current10 = mutableRef.current,
|
|
610
|
+
selectedItem = _mutableRef$current10.selectedItem,
|
|
611
|
+
selectedItemLabel = _mutableRef$current10.selectedItemLabel;
|
|
612
|
+
var focusTarget = selectedItem.children[1];
|
|
613
|
+
var orders = finalizeOrders();
|
|
614
|
+
finalizeEditing(orders);
|
|
615
|
+
if (selectItemBy === 'press') {
|
|
616
|
+
if ((0, _pointer.getPointerMode)()) {
|
|
617
|
+
_spotlight["default"].setPointerMode(false);
|
|
618
|
+
_spotlight["default"].focus(focusTarget);
|
|
619
|
+
}
|
|
620
|
+
focusItem(focusTarget);
|
|
621
|
+
}
|
|
622
|
+
setTimeout(function () {
|
|
623
|
+
announceRef.current.announce(selectedItemLabel + (0, _$L["default"])('Movement completed'), true);
|
|
624
|
+
setTimeout(function () {
|
|
625
|
+
selectedItem.children[1].ariaLabel = "".concat(selectedItem.ariaLabel, " ").concat((0, _$L["default"])('Press the OK button to move or press the up button to select other options.'));
|
|
626
|
+
}, completeAnnounceDelay);
|
|
627
|
+
}, completeAnnounceDelay);
|
|
628
|
+
}, [finalizeEditing, finalizeOrders, focusItem, selectItemBy]);
|
|
629
|
+
var handleMoveItemsByKeyDown = (0, _react.useCallback)(function (ev, repeat) {
|
|
630
|
+
var selectedItem = mutableRef.current.selectedItem;
|
|
631
|
+
if (Number(selectedItem.style.order) - 1 < mutableRef.current.hideIndex) {
|
|
632
|
+
if (repeat) {
|
|
633
|
+
SpotlightAccelerator.processKey(ev, moveItemsByKeyDown);
|
|
634
|
+
} else {
|
|
635
|
+
SpotlightAccelerator.reset();
|
|
636
|
+
moveItemsByKeyDown(ev);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
ev.preventDefault();
|
|
640
|
+
ev.stopPropagation();
|
|
641
|
+
}, [moveItemsByKeyDown]);
|
|
642
|
+
var handleFocusLeaveScrollContainer = (0, _react.useCallback)(function (ev, nextTarget) {
|
|
643
|
+
if (nextTarget && !(0, _container.getContainersForNode)(nextTarget).includes(mutableRef.current.spotlightId)) {
|
|
644
|
+
(0, _pointer.setPointerMode)(false);
|
|
645
|
+
_spotlight["default"].focus(nextTarget);
|
|
646
|
+
var orders = finalizeOrders();
|
|
647
|
+
finalizeEditing(orders);
|
|
648
|
+
ev.preventDefault();
|
|
649
|
+
ev.stopPropagation();
|
|
650
|
+
}
|
|
651
|
+
}, [finalizeEditing, finalizeOrders]);
|
|
652
|
+
var handleKeyDownCapture = (0, _react.useCallback)(function (ev) {
|
|
653
|
+
var keyCode = ev.keyCode,
|
|
654
|
+
repeat = ev.repeat,
|
|
655
|
+
target = ev.target;
|
|
656
|
+
var _mutableRef$current11 = mutableRef.current,
|
|
657
|
+
focusedItem = _mutableRef$current11.focusedItem,
|
|
658
|
+
selectedItem = _mutableRef$current11.selectedItem;
|
|
659
|
+
var targetItemNode = findItemNode(target);
|
|
660
|
+
if ((0, _keymap.is)('enter', keyCode) && target.getAttribute('role') !== 'button') {
|
|
661
|
+
if (!repeat) {
|
|
662
|
+
if (selectedItem) {
|
|
663
|
+
completeEditingByKeyDown();
|
|
664
|
+
mutableRef.current.needToPreventEvent = true;
|
|
665
|
+
} else if (selectItemBy === 'press') {
|
|
666
|
+
startEditing(targetItemNode);
|
|
667
|
+
mutableRef.current.needToPreventEvent = true;
|
|
668
|
+
}
|
|
669
|
+
} else if (repeat && targetItemNode && !mutableRef.current.timer && selectItemBy === 'longPress') {
|
|
670
|
+
mutableRef.current.timer = setTimeout(function () {
|
|
671
|
+
startEditing(targetItemNode);
|
|
672
|
+
}, holdDuration - 300);
|
|
673
|
+
}
|
|
674
|
+
} else if ((0, _keymap.is)('down', keyCode) && target.getAttribute('role') !== 'button' && !repeat && selectedItem) {
|
|
675
|
+
completeEditingByKeyDown();
|
|
676
|
+
mutableRef.current.needToPreventEvent = true;
|
|
677
|
+
} else if ((0, _keymap.is)('left', keyCode) || (0, _keymap.is)('right', keyCode)) {
|
|
678
|
+
var nextTarget = (0, _target.getTargetByDirectionFromElement)((0, _spotlight.getDirection)(keyCode), target);
|
|
679
|
+
if (selectedItem) {
|
|
680
|
+
// If keyDown event target is item(=not button), move item.
|
|
681
|
+
if (target.getAttribute('role') !== 'button') {
|
|
682
|
+
handleMoveItemsByKeyDown(ev, repeat);
|
|
683
|
+
// If keyDown event target is button and next spot target is item, move item and then spot selected item.
|
|
684
|
+
} else if ((nextTarget === null || nextTarget === void 0 ? void 0 : nextTarget.getAttribute('role')) !== 'button') {
|
|
685
|
+
handleMoveItemsByKeyDown(ev, repeat);
|
|
686
|
+
(0, _pointer.setPointerMode)(false);
|
|
687
|
+
_spotlight["default"].focus(selectedItem.children[1]);
|
|
688
|
+
// If keyDown event target is button and next spot target is button, check whether focus leaves the scroll container.
|
|
689
|
+
} else {
|
|
690
|
+
// Check if focus leaves scroll container.
|
|
691
|
+
handleFocusLeaveScrollContainer(ev, nextTarget);
|
|
692
|
+
}
|
|
693
|
+
} else if (nextTarget && !(0, _container.getContainersForNode)(nextTarget).includes(mutableRef.current.spotlightId) && !repeat) {
|
|
694
|
+
// Check if focus leaves scroll container.
|
|
695
|
+
handleFocusLeaveScrollContainer(ev, nextTarget);
|
|
696
|
+
}
|
|
697
|
+
} else if ((0, _keymap.is)('up', keyCode) || (0, _keymap.is)('down', keyCode)) {
|
|
698
|
+
if (selectedItem || focusedItem) {
|
|
699
|
+
var _nextTarget = (0, _target.getTargetByDirectionFromElement)((0, _spotlight.getDirection)(keyCode), target);
|
|
700
|
+
|
|
701
|
+
// Check if focus leaves scroll container.
|
|
702
|
+
handleFocusLeaveScrollContainer(ev, _nextTarget);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}, [findItemNode, handleFocusLeaveScrollContainer, handleMoveItemsByKeyDown, selectItemBy, startEditing, completeEditingByKeyDown]);
|
|
706
|
+
var handleKeyUpCapture = (0, _react.useCallback)(function (ev) {
|
|
707
|
+
var keyCode = ev.keyCode,
|
|
708
|
+
target = ev.target;
|
|
709
|
+
var selectedItem = mutableRef.current.selectedItem;
|
|
710
|
+
if ((0, _keymap.is)('cancel', keyCode)) {
|
|
711
|
+
if (selectedItem) {
|
|
712
|
+
completeEditingByKeyDown();
|
|
713
|
+
ev.stopPropagation(); // To prevent onCancel by CancelDecorator
|
|
714
|
+
}
|
|
715
|
+
} else if (target.getAttribute('role') === 'button') {
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
clearTimeout(mutableRef.current.timer);
|
|
719
|
+
mutableRef.current.timer = null;
|
|
720
|
+
if (mutableRef.current.needToPreventEvent || mutableRef.current.selectedItem) {
|
|
721
|
+
ev.preventDefault();
|
|
722
|
+
mutableRef.current.needToPreventEvent = false;
|
|
723
|
+
}
|
|
724
|
+
}, [completeEditingByKeyDown]);
|
|
725
|
+
var handleGlobalKeyDownCapture = (0, _react.useCallback)(function (ev) {
|
|
726
|
+
var _mutableRef$current12 = mutableRef.current,
|
|
727
|
+
focusedItem = _mutableRef$current12.focusedItem,
|
|
728
|
+
selectedItem = _mutableRef$current12.selectedItem;
|
|
729
|
+
mutableRef.current.lastInputType = 'key';
|
|
730
|
+
|
|
731
|
+
// If the pointer mode is `true` and the focused component is not contained in scrollContainerRef,
|
|
732
|
+
// only `handleGlobalKeyDownCapture` is called instead of `handleKeyDownCapture`
|
|
733
|
+
// Below is mainly for handling key pressed while pointer mode is `true`.
|
|
734
|
+
if ((0, _pointer.getPointerMode)() && !scrollContainerRef.current.contains(_spotlight["default"].getCurrent()) && (selectedItem || focusedItem)) {
|
|
735
|
+
var keyCode = ev.keyCode;
|
|
736
|
+
var position = (0, _pointer.getLastPointerPosition)();
|
|
737
|
+
var direction = (0, _spotlight.getDirection)(keyCode);
|
|
738
|
+
if (direction) {
|
|
739
|
+
var nextTarget = (0, _target.getTargetByDirectionFromPosition)(direction, position, mutableRef.current.spotlightId);
|
|
740
|
+
if (!scrollContainerRef.current.contains(nextTarget)) {
|
|
741
|
+
// If the nextTarget is not contained in scrollContainerRef, complete editing
|
|
742
|
+
var orders = finalizeOrders();
|
|
743
|
+
finalizeEditing(orders);
|
|
744
|
+
} else if (((0, _keymap.is)('left', keyCode) || (0, _keymap.is)('right', keyCode)) && selectedItem) {
|
|
745
|
+
// When an item is selected and press the `left` or `right` key, move the selectedItem in that direction
|
|
746
|
+
moveItemsByKeyDown(ev);
|
|
747
|
+
ev.preventDefault();
|
|
748
|
+
ev.stopPropagation();
|
|
749
|
+
} else if ((0, _keymap.is)('down', keyCode) && selectedItem) {
|
|
750
|
+
// When an item is selected and press the `down` key, complete editing and focus the selectedItem
|
|
751
|
+
completeEditingByKeyDown();
|
|
752
|
+
} else if ((0, _keymap.is)('up', keyCode) && nextTarget.getAttribute('role') !== 'button') {
|
|
753
|
+
// When the nextTarget is the item and press the `up` key, focus the nextTarget to move focus successfully to the button above the item
|
|
754
|
+
(0, _pointer.setPointerMode)(false);
|
|
755
|
+
_spotlight["default"].focus(nextTarget);
|
|
756
|
+
}
|
|
757
|
+
} else if ((0, _keymap.is)('enter', keyCode)) {
|
|
758
|
+
if (selectedItem) {
|
|
759
|
+
// When an item is selected and press the `enter` key, complete editing and focus the selectedItem
|
|
760
|
+
completeEditingByKeyDown();
|
|
761
|
+
} else {
|
|
762
|
+
// When an item is focused and press the `enter` key, start editing
|
|
763
|
+
startEditing(focusedItem);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
}, [completeEditingByKeyDown, finalizeEditing, finalizeOrders, moveItemsByKeyDown, scrollContainerRef, startEditing]);
|
|
768
|
+
var handleTouchMove = (0, _react.useCallback)(function (ev) {
|
|
769
|
+
var _ev$target5;
|
|
770
|
+
mutableRef.current.lastInputType = 'touch';
|
|
771
|
+
if (mutableRef.current.selectedItem) {
|
|
772
|
+
// Prevent scrolling by dragging when item is selected
|
|
773
|
+
ev.preventDefault();
|
|
774
|
+
}
|
|
775
|
+
if (mutableRef.current.isDraggingItem && ((_ev$target5 = ev.target) === null || _ev$target5 === void 0 || (_ev$target5 = _ev$target5.parentNode) === null || _ev$target5 === void 0 ? void 0 : _ev$target5.parentNode.getAttribute('role')) !== 'button') {
|
|
776
|
+
var clientX = ev.targetTouches[0].clientX;
|
|
777
|
+
mutableRef.current.lastMouseClientX = clientX;
|
|
778
|
+
scrollContainerRef.current.style.setProperty('--scroller-hover-to-scroll-by-touch', 'auto');
|
|
779
|
+
var toIndex = getNextIndexFromPosition(clientX, 0.33);
|
|
780
|
+
if (toIndex !== mutableRef.current.prevToIndex) {
|
|
781
|
+
moveItems(toIndex);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}, [getNextIndexFromPosition, moveItems, scrollContainerRef]);
|
|
785
|
+
var handleTouchEnd = (0, _react.useCallback)(function (ev) {
|
|
786
|
+
var _ev$target6;
|
|
787
|
+
var _mutableRef$current13 = mutableRef.current,
|
|
788
|
+
itemWidth = _mutableRef$current13.itemWidth,
|
|
789
|
+
lastInputType = _mutableRef$current13.lastInputType,
|
|
790
|
+
lastMouseClientX = _mutableRef$current13.lastMouseClientX,
|
|
791
|
+
selectedItem = _mutableRef$current13.selectedItem;
|
|
792
|
+
var rtl = scrollContainerHandle.current.rtl;
|
|
793
|
+
var scrollContentNode = scrollContentRef.current;
|
|
794
|
+
var scrollContentCenter = scrollContentNode.getBoundingClientRect().width / 2;
|
|
795
|
+
var clientX = ev.changedTouches[0].clientX;
|
|
796
|
+
var targetItemIndex = getNextIndexFromPosition(clientX, 0);
|
|
797
|
+
if (((_ev$target6 = ev.target) === null || _ev$target6 === void 0 || (_ev$target6 = _ev$target6.parentNode) === null || _ev$target6 === void 0 ? void 0 : _ev$target6.parentNode.getAttribute('role')) === 'button' && Number(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.style.order) - 1 === targetItemIndex) {
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
if (selectedItem) {
|
|
801
|
+
// Cancel mouse event to deselect a selected item when it is tapped
|
|
802
|
+
ev.preventDefault();
|
|
803
|
+
|
|
804
|
+
// Finalize orders and forward `onComplete` event
|
|
805
|
+
var orders = finalizeOrders();
|
|
806
|
+
finalizeEditing(orders);
|
|
807
|
+
if (lastInputType === 'scroll' && mutableRef.current.isDragging) {
|
|
808
|
+
var offset = itemWidth * (!rtl ^ !(lastMouseClientX > scrollContentCenter) ? 1 : -1);
|
|
809
|
+
scrollContainerHandle.current.start({
|
|
810
|
+
targetX: scrollContentNode.scrollLeft + offset,
|
|
811
|
+
targetY: 0
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
} else if (!mutableRef.current.isDragging) {
|
|
815
|
+
// Cancel mouse event to select an item when it is tapped
|
|
816
|
+
ev.preventDefault();
|
|
817
|
+
var targetItemNode = findItemNode(ev.target);
|
|
818
|
+
if (selectItemBy === 'press') {
|
|
819
|
+
if (targetItemNode && targetItemNode.dataset.index) {
|
|
820
|
+
mutableRef.current.targetItemNode = targetItemNode;
|
|
821
|
+
startEditing(targetItemNode);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
mutableRef.current.isDraggingItem = false;
|
|
826
|
+
mutableRef.current.isDragging = false;
|
|
827
|
+
scrollContainerRef.current.style.setProperty('--scroller-hover-to-scroll-by-touch', 'none');
|
|
828
|
+
}, [getNextIndexFromPosition, finalizeEditing, finalizeOrders, findItemNode, scrollContainerHandle, scrollContainerRef, scrollContentRef, selectItemBy, startEditing]);
|
|
829
|
+
var handleDragStart = (0, _react.useCallback)(function (ev) {
|
|
830
|
+
var selectedItem = mutableRef.current.selectedItem;
|
|
831
|
+
// Index of dragged item
|
|
832
|
+
var dragTargetItemIndex = getNextIndexFromPosition(ev.x, 0);
|
|
833
|
+
mutableRef.current.isDragging = true;
|
|
834
|
+
if (selectedItem && Number(selectedItem.style.order) - 1 === dragTargetItemIndex) {
|
|
835
|
+
mutableRef.current.isDraggingItem = true;
|
|
836
|
+
}
|
|
837
|
+
}, [getNextIndexFromPosition]);
|
|
838
|
+
(0, _react.useLayoutEffect)(function () {
|
|
839
|
+
var available = typeof document === 'object';
|
|
840
|
+
if (available) {
|
|
841
|
+
document.addEventListener('keydown', handleGlobalKeyDownCapture, {
|
|
842
|
+
capture: true
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
return function () {
|
|
846
|
+
if (available) {
|
|
847
|
+
document.removeEventListener('keydown', handleGlobalKeyDownCapture, {
|
|
848
|
+
capture: true
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
}, [handleGlobalKeyDownCapture]);
|
|
853
|
+
(0, _react.useEffect)(function () {
|
|
854
|
+
if (mutableRef.current.nextSpotlightRect !== null) {
|
|
855
|
+
_spotlight["default"].focusNextFromPoint('down', mutableRef.current.nextSpotlightRect);
|
|
856
|
+
mutableRef.current.nextSpotlightRect = null;
|
|
857
|
+
}
|
|
858
|
+
});
|
|
859
|
+
(0, _react.useEffect)(function () {
|
|
860
|
+
var _wrapperRef$current;
|
|
861
|
+
// Calculate the item width once
|
|
862
|
+
var rtl = scrollContainerHandle.current.rtl;
|
|
863
|
+
var container = scrollContentRef.current;
|
|
864
|
+
var item = (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.children[0];
|
|
865
|
+
if (item && typeof window !== 'undefined') {
|
|
866
|
+
var _wrapperRef$current2;
|
|
867
|
+
var bodyWidth = document.body.getBoundingClientRect().width;
|
|
868
|
+
var neighbor = item.nextElementSibling || item.previousElementSibling;
|
|
869
|
+
mutableRef.current.itemWidth = Math.abs(item.offsetLeft - (neighbor === null || neighbor === void 0 ? void 0 : neighbor.offsetLeft));
|
|
870
|
+
mutableRef.current.centeredOffset = rtl ? bodyWidth - (item.getBoundingClientRect().right + container.scrollLeft) : item.getBoundingClientRect().left + container.scrollLeft;
|
|
871
|
+
(_wrapperRef$current2 = wrapperRef.current) === null || _wrapperRef$current2 === void 0 || _wrapperRef$current2.style.setProperty('--item-width', mutableRef.current.itemWidth + 'px');
|
|
872
|
+
}
|
|
873
|
+
}, [centered, dataSize, scrollContainerHandle, scrollContentRef]);
|
|
874
|
+
(0, _react.useEffect)(function () {
|
|
875
|
+
mutableRef.current.spotlightId = scrollContainerRef.current && scrollContainerRef.current.dataset.spotlightId;
|
|
876
|
+
}, [scrollContainerRef]);
|
|
877
|
+
(0, _react.useEffect)(function () {
|
|
878
|
+
var scrollContainer = scrollContainerRef.current;
|
|
879
|
+
if (scrollContainer) {
|
|
880
|
+
scrollContainer.addEventListener('mouseleave', handleMouseLeave);
|
|
881
|
+
scrollContainer.addEventListener('touchmove', handleTouchMove);
|
|
882
|
+
}
|
|
883
|
+
return function () {
|
|
884
|
+
if (scrollContainer) {
|
|
885
|
+
scrollContainer.removeEventListener('mouseleave', handleMouseLeave);
|
|
886
|
+
scrollContainer.removeEventListener('touchmove', handleTouchMove);
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
}, [handleMouseLeave, handleTouchMove, scrollContainerRef]);
|
|
890
|
+
(0, _react.useLayoutEffect)(function () {
|
|
891
|
+
if (removeItemFuncRef) {
|
|
892
|
+
removeItemFuncRef.current = removeItem;
|
|
893
|
+
}
|
|
894
|
+
}, [removeItem, removeItemFuncRef]);
|
|
895
|
+
(0, _react.useLayoutEffect)(function () {
|
|
896
|
+
if (hideItemFuncRef) {
|
|
897
|
+
hideItemFuncRef.current = hideItem;
|
|
898
|
+
}
|
|
899
|
+
}, [hideItem, hideItemFuncRef]);
|
|
900
|
+
(0, _react.useLayoutEffect)(function () {
|
|
901
|
+
if (showItemFuncRef) {
|
|
902
|
+
showItemFuncRef.current = showItem;
|
|
903
|
+
}
|
|
904
|
+
}, [showItem, showItemFuncRef]);
|
|
905
|
+
(0, _react.useLayoutEffect)(function () {
|
|
906
|
+
if (focusItemFuncRef) {
|
|
907
|
+
focusItemFuncRef.current = focusItem;
|
|
908
|
+
}
|
|
909
|
+
}, [focusItem, focusItemFuncRef]);
|
|
910
|
+
(0, _react.useLayoutEffect)(function () {
|
|
911
|
+
if (blurItemFuncRef) {
|
|
912
|
+
blurItemFuncRef.current = blurItem;
|
|
913
|
+
}
|
|
914
|
+
}, [blurItem, blurItemFuncRef]);
|
|
915
|
+
(0, _react.useEffect)(function () {
|
|
916
|
+
// addEventListener to moveItems while scrolled
|
|
917
|
+
var scrollContentNode = scrollContentRef.current;
|
|
918
|
+
var handleMoveItemsByScroll = function handleMoveItemsByScroll() {
|
|
919
|
+
var bodyWidth = document.body.getBoundingClientRect().width;
|
|
920
|
+
var _mutableRef$current14 = mutableRef.current,
|
|
921
|
+
lastMouseClientX = _mutableRef$current14.lastMouseClientX,
|
|
922
|
+
selectedItem = _mutableRef$current14.selectedItem;
|
|
923
|
+
var _scrollContainerHandl = scrollContainerHandle.current,
|
|
924
|
+
isHoveringToScroll = _scrollContainerHandl.isHoveringToScroll,
|
|
925
|
+
rtl = _scrollContainerHandl.rtl;
|
|
926
|
+
if (selectedItem && mutableRef.current.lastInputType !== 'key' && Number(selectedItem.style.order) - 1 < mutableRef.current.hideIndex) {
|
|
927
|
+
mutableRef.current.lastInputType = 'scroll';
|
|
928
|
+
if (isHoveringToScroll) {
|
|
929
|
+
var toIndex = getNextIndexFromPosition(lastMouseClientX, 0);
|
|
930
|
+
moveItems(!rtl ^ !(lastMouseClientX > bodyWidth / 2) ? toIndex + 1 : toIndex - 1);
|
|
931
|
+
} else {
|
|
932
|
+
moveItems(getNextIndexFromPosition(lastMouseClientX, 0.33));
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
setTimeout(function () {
|
|
937
|
+
scrollContentNode.addEventListener('scroll', handleMoveItemsByScroll);
|
|
938
|
+
}, 400); // Wait for finishing scroll animation when initial selected item is given.
|
|
939
|
+
|
|
940
|
+
return function () {
|
|
941
|
+
scrollContentNode.removeEventListener('scroll', handleMoveItemsByScroll);
|
|
942
|
+
};
|
|
943
|
+
}, [getNextIndexFromPosition, moveItems, scrollContainerHandle, scrollContentRef]);
|
|
944
|
+
(0, _react.useEffect)(function () {
|
|
945
|
+
if (mutableRef.current.initialSelected) {
|
|
946
|
+
var _scrollContainerHandl2;
|
|
947
|
+
(_scrollContainerHandl2 = scrollContainerHandle.current) === null || _scrollContainerHandl2 === void 0 || _scrollContainerHandl2.scrollTo({
|
|
948
|
+
animate: false,
|
|
949
|
+
position: {
|
|
950
|
+
x: mutableRef.current.initialSelected.scrollLeft
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
}, [scrollContainerHandle]);
|
|
955
|
+
(0, _react.useLayoutEffect)(function () {
|
|
956
|
+
var _initialSelected, _initialSelected2;
|
|
957
|
+
var iconItemList = Array.from(wrapperRef.current.children);
|
|
958
|
+
var initialSelected = mutableRef.current.initialSelected;
|
|
959
|
+
if (initialSelected && !(((_initialSelected = initialSelected) === null || _initialSelected === void 0 ? void 0 : _initialSelected.itemIndex) > 0)) {
|
|
960
|
+
// filter nullish values
|
|
961
|
+
initialSelected = mutableRef.current.initialSelected = null;
|
|
962
|
+
}
|
|
963
|
+
if ((_initialSelected2 = initialSelected) !== null && _initialSelected2 !== void 0 && _initialSelected2.itemIndex) {
|
|
964
|
+
var _initialSelected3;
|
|
965
|
+
var initialSelectedItem = wrapperRef.current.children[((_initialSelected3 = initialSelected) === null || _initialSelected3 === void 0 ? void 0 : _initialSelected3.itemIndex) - 1];
|
|
966
|
+
if (initialSelectedItem !== null && initialSelectedItem !== void 0 && initialSelectedItem.dataset.index) {
|
|
967
|
+
mutableRef.current.focusedItem = initialSelectedItem;
|
|
968
|
+
mutableRef.current.lastMouseClientX = (0, _pointer.getLastPointerPosition)().x;
|
|
969
|
+
startEditing(initialSelectedItem);
|
|
970
|
+
(0, _pointer.setPointerMode)(false);
|
|
971
|
+
_spotlight["default"].focus(initialSelectedItem.children[1]);
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
iconItemList.forEach(function (iconItemWrapper, index) {
|
|
975
|
+
if (iconItemWrapper !== null && iconItemWrapper !== void 0 && iconItemWrapper.children[1]) {
|
|
976
|
+
if (initialSelected && initialSelected.itemIndex - 1 === index) {
|
|
977
|
+
iconItemWrapper.children[1].ariaLabel += " ".concat((0, _$L["default"])('Press the left/right button to move or press the up button to select other options.'));
|
|
978
|
+
} else {
|
|
979
|
+
iconItemWrapper.children[1].ariaLabel += " ".concat((0, _$L["default"])('Press the OK button to move or press the up button to select other options.'));
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
984
|
+
|
|
985
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(TouchableDiv, {
|
|
986
|
+
holdConfig: holdConfig,
|
|
987
|
+
className: (0, _classnames["default"])(mergedCss.wrapper, _defineProperty({}, mergedCss.centered, centered)),
|
|
988
|
+
onClickCapture: handleClickCapture,
|
|
989
|
+
onHoldStart: handleHoldStart,
|
|
990
|
+
onKeyDownCapture: handleKeyDownCapture,
|
|
991
|
+
onKeyUpCapture: handleKeyUpCapture,
|
|
992
|
+
onMouseDown: handleMouseDown,
|
|
993
|
+
onMouseMove: handleMouseMove,
|
|
994
|
+
onPointerDown: handlePointerDown,
|
|
995
|
+
onDragStart: handleDragStart,
|
|
996
|
+
onTouchEnd: handleTouchEnd,
|
|
997
|
+
ref: wrapperRef,
|
|
998
|
+
children: [children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_AnnounceDecorator.Announce, {
|
|
999
|
+
ref: announceRef
|
|
1000
|
+
}, "editable-wrapper-announce")]
|
|
1001
|
+
});
|
|
1002
|
+
};
|
|
1003
|
+
EditableWrapper.displayName = 'EditableWrapper';
|
|
1004
|
+
EditableWrapper.propTypes = /** @lends limestone/Scroller.EditableWrapper.prototype */{
|
|
1005
|
+
/**
|
|
1006
|
+
* Enables editing items in the scroller.
|
|
1007
|
+
* You can specify props for editable scroller as an object.
|
|
1008
|
+
* See the details in {@link limestone/Scroller.EditableShape|EditableShape}
|
|
1009
|
+
*
|
|
1010
|
+
* @type {limestone/Scroller.EditableShape}
|
|
1011
|
+
* @public
|
|
1012
|
+
*/
|
|
1013
|
+
editable: EditableShape,
|
|
1014
|
+
/**
|
|
1015
|
+
* Obtains a reference to the scroll container handle.
|
|
1016
|
+
*
|
|
1017
|
+
* @type {Function|Object}
|
|
1018
|
+
* @public
|
|
1019
|
+
*/
|
|
1020
|
+
scrollContainerHandle: _propTypes["default"].ref,
|
|
1021
|
+
/**
|
|
1022
|
+
* Obtains a reference to the scroll container node.
|
|
1023
|
+
*
|
|
1024
|
+
* @type {Function|Object}
|
|
1025
|
+
* @public
|
|
1026
|
+
*/
|
|
1027
|
+
scrollContainerRef: _propTypes["default"].ref,
|
|
1028
|
+
/**
|
|
1029
|
+
* Obtains a reference to the scroll content node.
|
|
1030
|
+
*
|
|
1031
|
+
* @type {Function|Object}
|
|
1032
|
+
* @public
|
|
1033
|
+
*/
|
|
1034
|
+
scrollContentRef: _propTypes["default"].ref
|
|
1035
|
+
};
|
|
1036
|
+
var _default = exports["default"] = EditableWrapper;
|