@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,867 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ContextualPopup", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _ContextualPopup.ContextualPopup;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports["default"] = exports.ContextualPopupDecorator = void 0;
|
|
13
|
+
var _ApiDecorator = _interopRequireDefault(require("@enact/core/internal/ApiDecorator"));
|
|
14
|
+
var _dispatcher = require("@enact/core/dispatcher");
|
|
15
|
+
var _handle = require("@enact/core/handle");
|
|
16
|
+
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
17
|
+
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
18
|
+
var _WithRef = require("@enact/core/internal/WithRef");
|
|
19
|
+
var _util = require("@enact/core/util");
|
|
20
|
+
var _I18nDecorator = require("@enact/i18n/I18nDecorator");
|
|
21
|
+
var _spotlight = _interopRequireWildcard(require("@enact/spotlight"));
|
|
22
|
+
var _SpotlightContainerDecorator = _interopRequireDefault(require("@enact/spotlight/SpotlightContainerDecorator"));
|
|
23
|
+
var _FloatingLayer = _interopRequireDefault(require("@enact/ui/FloatingLayer"));
|
|
24
|
+
var _resolution = _interopRequireDefault(require("@enact/ui/resolution"));
|
|
25
|
+
var _compose = _interopRequireDefault(require("ramda/src/compose"));
|
|
26
|
+
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
27
|
+
var _react = require("react");
|
|
28
|
+
var _ContextualPopup = require("./ContextualPopup");
|
|
29
|
+
var _HolePunchScrim = _interopRequireDefault(require("./HolePunchScrim"));
|
|
30
|
+
var _ContextualPopupDecoratorModule = _interopRequireDefault(require("./ContextualPopupDecorator.module.css"));
|
|
31
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
32
|
+
var _excluded = ["data-webos-voice-exclusive", "popupComponent", "popupClassName", "noAutoDismiss", "open", "offset", "popupProps", "skin", "spotlightRestrict"];
|
|
33
|
+
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); }
|
|
34
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
35
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
36
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
37
|
+
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; }
|
|
38
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
39
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
40
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
41
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
42
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
43
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
44
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
45
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
46
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
47
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
48
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
49
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
50
|
+
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); }
|
|
51
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
52
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
53
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
54
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
55
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
56
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
57
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } /* global MutationObserver ResizeObserver */ /**
|
|
58
|
+
* A higher-order component to add a Limestone styled popup to a component.
|
|
59
|
+
*
|
|
60
|
+
* @module limestone/ContextualPopupDecorator
|
|
61
|
+
* @exports ContextualPopup
|
|
62
|
+
* @exports ContextualPopupDecorator
|
|
63
|
+
*/
|
|
64
|
+
var PositionToDirection = {
|
|
65
|
+
above: 'up',
|
|
66
|
+
below: 'down',
|
|
67
|
+
left: 'left',
|
|
68
|
+
right: 'right'
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Default config for {@link limestone/ContextualPopupDecorator.ContextualPopupDecorator}
|
|
73
|
+
*
|
|
74
|
+
* @type {Object}
|
|
75
|
+
* @hocconfig
|
|
76
|
+
* @memberof limestone/ContextualPopupDecorator.ContextualPopupDecorator
|
|
77
|
+
*/
|
|
78
|
+
var defaultConfig = {
|
|
79
|
+
/**
|
|
80
|
+
* `ContextualPopup` without the arrow.
|
|
81
|
+
*
|
|
82
|
+
* @type {Boolean}
|
|
83
|
+
* @default false
|
|
84
|
+
* @memberof limestone/ContextualPopupDecorator.ContextualPopupDecorator.defaultConfig
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
noArrow: false,
|
|
88
|
+
/**
|
|
89
|
+
* Disables passing the `skin` prop to the wrapped component.
|
|
90
|
+
*
|
|
91
|
+
* @see {@link limestone/Skinnable.Skinnable.skin}
|
|
92
|
+
* @type {Boolean}
|
|
93
|
+
* @default false
|
|
94
|
+
* @memberof limestone/ContextualPopupDecorator.ContextualPopupDecorator.defaultConfig
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
noSkin: false,
|
|
98
|
+
/**
|
|
99
|
+
* The prop in which to pass the value of `open` state of ContextualPopupDecorator to the
|
|
100
|
+
* wrapped component.
|
|
101
|
+
*
|
|
102
|
+
* @type {String}
|
|
103
|
+
* @default 'selected'
|
|
104
|
+
* @memberof limestone/ContextualPopupDecorator.ContextualPopupDecorator.defaultConfig
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
openProp: 'selected'
|
|
108
|
+
};
|
|
109
|
+
var ContextualPopupContainer = (0, _SpotlightContainerDecorator["default"])({
|
|
110
|
+
enterTo: 'default-element',
|
|
111
|
+
preserveId: true
|
|
112
|
+
}, _ContextualPopup.ContextualPopup);
|
|
113
|
+
var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
114
|
+
var _Class;
|
|
115
|
+
var noArrow = config.noArrow,
|
|
116
|
+
noSkin = config.noSkin,
|
|
117
|
+
openProp = config.openProp;
|
|
118
|
+
var WrappedWithRef = (0, _WithRef.WithRef)(Wrapped);
|
|
119
|
+
return _Class = /*#__PURE__*/function (_Component) {
|
|
120
|
+
function _Class(props) {
|
|
121
|
+
var _this;
|
|
122
|
+
_classCallCheck(this, _Class);
|
|
123
|
+
_this = _callSuper(this, _Class, [props]);
|
|
124
|
+
_this.generateId = function () {
|
|
125
|
+
return Math.random().toString(36).substring(2, 10);
|
|
126
|
+
};
|
|
127
|
+
_this.getContainerAdjustedPosition = function () {
|
|
128
|
+
var position = _this.adjustedDirection;
|
|
129
|
+
var arr = _this.adjustedDirection.split(' ');
|
|
130
|
+
var direction = null;
|
|
131
|
+
var anchor = null;
|
|
132
|
+
if (arr.length === 2) {
|
|
133
|
+
var _arr = _slicedToArray(arr, 2);
|
|
134
|
+
direction = _arr[0];
|
|
135
|
+
anchor = _arr[1];
|
|
136
|
+
} else {
|
|
137
|
+
direction = position;
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
anchor: anchor,
|
|
141
|
+
direction: direction
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Position the popup in relation to the activator.
|
|
146
|
+
*
|
|
147
|
+
* Position is based on the dimensions of the popup and its activator. If the popup does not
|
|
148
|
+
* fit in the specified direction, it will automatically flip to the opposite direction.
|
|
149
|
+
*
|
|
150
|
+
* @method
|
|
151
|
+
* @memberof limestone/ContextualPopupDecorator.ContextualPopupDecorator.prototype
|
|
152
|
+
* @public
|
|
153
|
+
* @returns {undefined}
|
|
154
|
+
*/
|
|
155
|
+
_this.positionContextualPopup = function () {
|
|
156
|
+
var _this$clientSiblingRe;
|
|
157
|
+
if (_this.containerNode && (_this$clientSiblingRe = _this.clientSiblingRef) !== null && _this$clientSiblingRe !== void 0 && _this$clientSiblingRe.current) {
|
|
158
|
+
var containerNode = _this.containerNode.getBoundingClientRect();
|
|
159
|
+
var _this$clientSiblingRe2 = _this.clientSiblingRef.current.getBoundingClientRect(),
|
|
160
|
+
top = _this$clientSiblingRe2.top,
|
|
161
|
+
left = _this$clientSiblingRe2.left,
|
|
162
|
+
bottom = _this$clientSiblingRe2.bottom,
|
|
163
|
+
right = _this$clientSiblingRe2.right,
|
|
164
|
+
width = _this$clientSiblingRe2.width,
|
|
165
|
+
height = _this$clientSiblingRe2.height;
|
|
166
|
+
var clientNode = {
|
|
167
|
+
top: top,
|
|
168
|
+
left: left,
|
|
169
|
+
bottom: bottom,
|
|
170
|
+
right: right,
|
|
171
|
+
width: width,
|
|
172
|
+
height: height
|
|
173
|
+
};
|
|
174
|
+
clientNode.left = _this.props.rtl ? window.innerWidth - right : left;
|
|
175
|
+
clientNode.right = _this.props.rtl ? window.innerWidth - left : right;
|
|
176
|
+
_this.calcOverflow(containerNode, clientNode);
|
|
177
|
+
_this.adjustDirection();
|
|
178
|
+
var arrowPosition = _this.getArrowPosition(containerNode, clientNode),
|
|
179
|
+
containerPosition = _this.getContainerPosition(containerNode, clientNode);
|
|
180
|
+
if (_this.state.direction !== _this.adjustedDirection || _this.state.arrowPosition.left !== arrowPosition.left || _this.state.arrowPosition.top !== arrowPosition.top || _this.state.containerPosition.left !== containerPosition.left || _this.state.containerPosition.right !== containerPosition.right || _this.state.containerPosition.top !== containerPosition.top) {
|
|
181
|
+
_this.setState({
|
|
182
|
+
direction: _this.adjustedDirection,
|
|
183
|
+
arrowPosition: arrowPosition,
|
|
184
|
+
containerPosition: containerPosition
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
_this.getContainerNode = function (node) {
|
|
190
|
+
_this.containerNode = node;
|
|
191
|
+
if (_this.resizeObserver) {
|
|
192
|
+
if (node) {
|
|
193
|
+
var _node$parentElement;
|
|
194
|
+
// It is not easy to trigger changed position of activator,
|
|
195
|
+
// so we chose to observe the `div` element's size that has the real size below the root of floatLayer.
|
|
196
|
+
// This implementation is dependent on the current structure of FloatingLayer,
|
|
197
|
+
// so if the structure have changed, below code needs to be changed accordingly.
|
|
198
|
+
_this.resizeObserver.observe(node === null || node === void 0 || (_node$parentElement = node.parentElement) === null || _node$parentElement === void 0 ? void 0 : _node$parentElement.parentElement);
|
|
199
|
+
} else {
|
|
200
|
+
_this.resizeObserver.disconnect();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (_this.mutationObserver) {
|
|
204
|
+
if (node) {
|
|
205
|
+
_this.mutationObserver.observe(document.body, {
|
|
206
|
+
attributes: false,
|
|
207
|
+
childList: true,
|
|
208
|
+
subtree: true
|
|
209
|
+
});
|
|
210
|
+
} else {
|
|
211
|
+
_this.mutationObserver.disconnect();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
_this.handle = _handle.handle.bind(_this);
|
|
216
|
+
_this.handleKeyUp = _this.handle((0, _handle.forProp)('open', true), (0, _handle.forKey)('enter'), function () {
|
|
217
|
+
return _spotlight["default"].getCurrent() === _this.state.activator;
|
|
218
|
+
}, _handle.stop, (0, _handle.forwardCustom)('onClose'));
|
|
219
|
+
_this.handleOpen = function (ev) {
|
|
220
|
+
(0, _handle.forward)('onOpen', ev, _this.props);
|
|
221
|
+
_this.positionContextualPopup();
|
|
222
|
+
var current = _spotlight["default"].getCurrent();
|
|
223
|
+
_this.updateLeaveFor(current);
|
|
224
|
+
_this.setState({
|
|
225
|
+
activator: current
|
|
226
|
+
}, function () {
|
|
227
|
+
return _this.spotPopupContent();
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
_this.handleClose = function () {
|
|
231
|
+
_this.updateLeaveFor(null);
|
|
232
|
+
_this.setState({
|
|
233
|
+
activator: null
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
_this.handleDismiss = function () {
|
|
237
|
+
(0, _handle.forwardCustom)('onClose')(null, _this.props);
|
|
238
|
+
};
|
|
239
|
+
// handle key event from outside (i.e. the activator) to the popup container
|
|
240
|
+
_this.handleKeyDown = function (ev) {
|
|
241
|
+
var _this$state = _this.state,
|
|
242
|
+
activator = _this$state.activator,
|
|
243
|
+
containerId = _this$state.containerId;
|
|
244
|
+
var spotlightRestrict = _this.props.spotlightRestrict;
|
|
245
|
+
var current = _spotlight["default"].getCurrent();
|
|
246
|
+
var direction = (0, _spotlight.getDirection)(ev.keyCode);
|
|
247
|
+
if (!direction) return;
|
|
248
|
+
var hasSpottables = _spotlight["default"].getSpottableDescendants(containerId).length > 0;
|
|
249
|
+
var spotlessSpotlightModal = spotlightRestrict === 'self-only' && !hasSpottables;
|
|
250
|
+
var shouldSpotPopup = current === activator && direction === PositionToDirection[_this.adjustedDirection.split(' ')[0]] && hasSpottables;
|
|
251
|
+
if (shouldSpotPopup || spotlessSpotlightModal) {
|
|
252
|
+
_this.handleDirectionalKey(ev);
|
|
253
|
+
|
|
254
|
+
// we guard against attempting a focus change by verifying the case where a
|
|
255
|
+
// spotlightModal popup contains no spottable components
|
|
256
|
+
if (!spotlessSpotlightModal && shouldSpotPopup) {
|
|
257
|
+
_this.spotPopupContent();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
// handle key event from contextual popup and closes the popup
|
|
262
|
+
_this.handleContainerKeyDown = function (ev) {
|
|
263
|
+
// Note: Container will be only rendered if `open`ed, therefore no need to check for `open`
|
|
264
|
+
var direction = (0, _spotlight.getDirection)(ev.keyCode);
|
|
265
|
+
if (!direction) return;
|
|
266
|
+
_this.handleDirectionalKey(ev);
|
|
267
|
+
|
|
268
|
+
// if focus moves outside the popup's container, issue the `onClose` event
|
|
269
|
+
if (_spotlight["default"].move(direction) && !_this.containerNode.contains(_spotlight["default"].getCurrent())) {
|
|
270
|
+
(0, _handle.forwardCustom)('onClose')(null, _this.props);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
_this.spotActivator = function (activator) {
|
|
274
|
+
if (!_spotlight["default"].getPointerMode() && activator && activator === _spotlight["default"].getCurrent()) {
|
|
275
|
+
activator.blur();
|
|
276
|
+
}
|
|
277
|
+
if (!_spotlight["default"].focus(activator)) {
|
|
278
|
+
_spotlight["default"].focus();
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
_this.spotPopupContent = function () {
|
|
282
|
+
var spotlightRestrict = _this.props.spotlightRestrict;
|
|
283
|
+
var containerId = _this.state.containerId;
|
|
284
|
+
var spottableDescendants = _spotlight["default"].getSpottableDescendants(containerId);
|
|
285
|
+
if (spotlightRestrict === 'self-only' && spottableDescendants.length && _spotlight["default"].getCurrent()) {
|
|
286
|
+
_spotlight["default"].getCurrent().blur();
|
|
287
|
+
}
|
|
288
|
+
if (!_spotlight["default"].focus(containerId)) {
|
|
289
|
+
_spotlight["default"].setActiveContainer(containerId);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
_this.state = {
|
|
293
|
+
arrowPosition: {
|
|
294
|
+
top: 0,
|
|
295
|
+
left: 0
|
|
296
|
+
},
|
|
297
|
+
containerPosition: {
|
|
298
|
+
top: 0,
|
|
299
|
+
left: 0,
|
|
300
|
+
right: 0
|
|
301
|
+
},
|
|
302
|
+
containerId: _spotlight["default"].add(_this.props.popupSpotlightId),
|
|
303
|
+
activator: null
|
|
304
|
+
};
|
|
305
|
+
_this.resizeObserver = null;
|
|
306
|
+
_this.overflow = {};
|
|
307
|
+
_this.adjustedDirection = _this.props.direction;
|
|
308
|
+
_this.id = _this.generateId();
|
|
309
|
+
_this.clientSiblingRef = /*#__PURE__*/(0, _react.createRef)(null);
|
|
310
|
+
_this.findClientSiblingRef = /*#__PURE__*/(0, _react.createRef)(null);
|
|
311
|
+
_this.MARGIN = _resolution["default"].scale(noArrow ? 0 : 12);
|
|
312
|
+
_this.ARROW_WIDTH = noArrow ? 0 : _resolution["default"].scale(60); // svg arrow width. used for arrow positioning
|
|
313
|
+
_this.ARROW_OFFSET = noArrow ? 0 : _resolution["default"].scale(36); // actual distance of the svg arrow displayed to offset overlaps with the container. Offset is when `noArrow` is false.
|
|
314
|
+
_this.KEEPOUT = _resolution["default"].scale(24); // keep out distance on the edge of the screen
|
|
315
|
+
|
|
316
|
+
if (props.setApiProvider) {
|
|
317
|
+
props.setApiProvider(_this);
|
|
318
|
+
}
|
|
319
|
+
return _this;
|
|
320
|
+
}
|
|
321
|
+
_inherits(_Class, _Component);
|
|
322
|
+
return _createClass(_Class, [{
|
|
323
|
+
key: "componentDidMount",
|
|
324
|
+
value: function componentDidMount() {
|
|
325
|
+
var _this2 = this;
|
|
326
|
+
if (this.props.open) {
|
|
327
|
+
(0, _dispatcher.on)('keydown', this.handleKeyDown);
|
|
328
|
+
(0, _dispatcher.on)('keyup', this.handleKeyUp);
|
|
329
|
+
}
|
|
330
|
+
if (typeof ResizeObserver === 'function') {
|
|
331
|
+
this.resizeObserver = new ResizeObserver(function () {
|
|
332
|
+
_this2.positionContextualPopup();
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
if (typeof MutationObserver === 'function') {
|
|
336
|
+
this.mutationObserver = new MutationObserver(function () {
|
|
337
|
+
_this2.positionContextualPopup();
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}, {
|
|
342
|
+
key: "getSnapshotBeforeUpdate",
|
|
343
|
+
value: function getSnapshotBeforeUpdate(prevProps, prevState) {
|
|
344
|
+
var snapshot = {
|
|
345
|
+
containerWidth: this.getContainerNodeWidth(),
|
|
346
|
+
clientSiblingWidth: this.getClientSiblingNodeWidth()
|
|
347
|
+
};
|
|
348
|
+
if (prevProps.open && !this.props.open) {
|
|
349
|
+
var current = _spotlight["default"].getCurrent();
|
|
350
|
+
snapshot.shouldSpotActivator =
|
|
351
|
+
// isn't set
|
|
352
|
+
!current ||
|
|
353
|
+
// is on the activator, and we want to re-spot it so a11y read out can occur
|
|
354
|
+
current === prevState.activator ||
|
|
355
|
+
// is within the popup
|
|
356
|
+
this.containerNode.contains(current);
|
|
357
|
+
}
|
|
358
|
+
return snapshot;
|
|
359
|
+
}
|
|
360
|
+
}, {
|
|
361
|
+
key: "componentDidUpdate",
|
|
362
|
+
value: function componentDidUpdate(prevProps, prevState, snapshot) {
|
|
363
|
+
if (snapshot.clientSiblingWidth !== this.getClientSiblingNodeWidth()) {
|
|
364
|
+
this.clientSiblingRef.current = this.findClientSiblingRef.current();
|
|
365
|
+
}
|
|
366
|
+
if (prevProps.direction !== this.props.direction || snapshot.containerWidth !== this.getContainerNodeWidth() || prevProps.open && this.props.open) {
|
|
367
|
+
this.adjustedDirection = this.props.direction;
|
|
368
|
+
// NOTE: `setState` is called and will cause re-render
|
|
369
|
+
this.positionContextualPopup();
|
|
370
|
+
}
|
|
371
|
+
if (this.props.open && !prevProps.open) {
|
|
372
|
+
(0, _dispatcher.on)('keydown', this.handleKeyDown);
|
|
373
|
+
(0, _dispatcher.on)('keyup', this.handleKeyUp);
|
|
374
|
+
} else if (!this.props.open && prevProps.open) {
|
|
375
|
+
(0, _dispatcher.off)('keydown', this.handleKeyDown);
|
|
376
|
+
(0, _dispatcher.off)('keyup', this.handleKeyUp);
|
|
377
|
+
if (snapshot && snapshot.shouldSpotActivator) {
|
|
378
|
+
this.spotActivator(prevState.activator);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}, {
|
|
383
|
+
key: "componentWillUnmount",
|
|
384
|
+
value: function componentWillUnmount() {
|
|
385
|
+
if (this.props.open) {
|
|
386
|
+
(0, _dispatcher.off)('keydown', this.handleKeyDown);
|
|
387
|
+
(0, _dispatcher.off)('keyup', this.handleKeyUp);
|
|
388
|
+
}
|
|
389
|
+
_spotlight["default"].remove(this.state.containerId);
|
|
390
|
+
if (this.resizeObserver) {
|
|
391
|
+
this.resizeObserver.disconnect();
|
|
392
|
+
this.resizeObserver = null;
|
|
393
|
+
}
|
|
394
|
+
if (this.mutationObserver) {
|
|
395
|
+
this.mutationObserver.disconnect();
|
|
396
|
+
this.mutationObserver = null;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}, {
|
|
400
|
+
key: "getContainerNodeWidth",
|
|
401
|
+
value: function getContainerNodeWidth() {
|
|
402
|
+
return this.containerNode && this.containerNode.getBoundingClientRect().width || 0;
|
|
403
|
+
}
|
|
404
|
+
}, {
|
|
405
|
+
key: "getClientSiblingNodeWidth",
|
|
406
|
+
value: function getClientSiblingNodeWidth() {
|
|
407
|
+
return this.clientSiblingRef.current && this.clientSiblingRef.current.getBoundingClientRect().width || 0;
|
|
408
|
+
}
|
|
409
|
+
}, {
|
|
410
|
+
key: "updateLeaveFor",
|
|
411
|
+
value: function updateLeaveFor(activator) {
|
|
412
|
+
_spotlight["default"].set(this.state.containerId, {
|
|
413
|
+
leaveFor: {
|
|
414
|
+
up: activator,
|
|
415
|
+
down: activator,
|
|
416
|
+
left: activator,
|
|
417
|
+
right: activator
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}, {
|
|
422
|
+
key: "getContainerPosition",
|
|
423
|
+
value: function getContainerPosition(containerNode, clientNode) {
|
|
424
|
+
var position = this.centerContainerPosition(containerNode, clientNode);
|
|
425
|
+
var _this$getContainerAdj = this.getContainerAdjustedPosition(),
|
|
426
|
+
direction = _this$getContainerAdj.direction;
|
|
427
|
+
switch (direction) {
|
|
428
|
+
case 'above':
|
|
429
|
+
position.top = clientNode.top - this.ARROW_OFFSET - containerNode.height - this.MARGIN;
|
|
430
|
+
break;
|
|
431
|
+
case 'below':
|
|
432
|
+
position.top = clientNode.bottom + this.ARROW_OFFSET + this.MARGIN;
|
|
433
|
+
break;
|
|
434
|
+
case 'right':
|
|
435
|
+
position.left = this.props.rtl ? clientNode.left - containerNode.width - this.ARROW_OFFSET - this.MARGIN : clientNode.right + this.ARROW_OFFSET + this.MARGIN;
|
|
436
|
+
break;
|
|
437
|
+
case 'left':
|
|
438
|
+
position.left = this.props.rtl ? clientNode.right + this.ARROW_OFFSET + this.MARGIN : clientNode.left - containerNode.width - this.ARROW_OFFSET - this.MARGIN;
|
|
439
|
+
break;
|
|
440
|
+
}
|
|
441
|
+
return this.adjustRTL(position);
|
|
442
|
+
}
|
|
443
|
+
}, {
|
|
444
|
+
key: "centerContainerPosition",
|
|
445
|
+
value: function centerContainerPosition(containerNode, clientNode) {
|
|
446
|
+
var pos = {};
|
|
447
|
+
var _this$getContainerAdj2 = this.getContainerAdjustedPosition(),
|
|
448
|
+
anchor = _this$getContainerAdj2.anchor,
|
|
449
|
+
direction = _this$getContainerAdj2.direction;
|
|
450
|
+
if (direction === 'above' || direction === 'below') {
|
|
451
|
+
if (this.overflow.isOverLeft) {
|
|
452
|
+
// anchor to the left of the screen
|
|
453
|
+
pos.left = this.KEEPOUT;
|
|
454
|
+
} else if (this.overflow.isOverRight) {
|
|
455
|
+
// anchor to the right of the screen
|
|
456
|
+
pos.left = window.innerWidth - containerNode.width - this.KEEPOUT;
|
|
457
|
+
} else if (anchor) {
|
|
458
|
+
if (anchor === 'center') {
|
|
459
|
+
// center horizontally
|
|
460
|
+
pos.left = clientNode.left + (clientNode.width - containerNode.width) / 2;
|
|
461
|
+
} else if (anchor === 'left') {
|
|
462
|
+
// anchor to the left side of the activator
|
|
463
|
+
pos.left = clientNode.left;
|
|
464
|
+
} else {
|
|
465
|
+
// anchor to the right side of the activator
|
|
466
|
+
pos.left = clientNode.right - containerNode.width;
|
|
467
|
+
}
|
|
468
|
+
} else {
|
|
469
|
+
// anchor to the left side of the activator, matching its width
|
|
470
|
+
pos.left = clientNode.left;
|
|
471
|
+
pos.width = clientNode.width;
|
|
472
|
+
}
|
|
473
|
+
} else if (direction === 'left' || direction === 'right') {
|
|
474
|
+
if (this.overflow.isOverTop) {
|
|
475
|
+
// anchor to the top of the screen
|
|
476
|
+
pos.top = this.KEEPOUT;
|
|
477
|
+
} else if (this.overflow.isOverBottom) {
|
|
478
|
+
// anchor to the bottom of the screen
|
|
479
|
+
pos.top = window.innerHeight - containerNode.height - this.KEEPOUT;
|
|
480
|
+
} else if (anchor === 'middle') {
|
|
481
|
+
// center vertically
|
|
482
|
+
pos.top = clientNode.top - (containerNode.height - clientNode.height) / 2;
|
|
483
|
+
} else if (anchor === 'top') {
|
|
484
|
+
// anchor to the top of the activator
|
|
485
|
+
pos.top = clientNode.top;
|
|
486
|
+
} else {
|
|
487
|
+
// anchor to the bottom of the activator
|
|
488
|
+
pos.top = clientNode.bottom - containerNode.height;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return pos;
|
|
492
|
+
}
|
|
493
|
+
}, {
|
|
494
|
+
key: "getArrowPosition",
|
|
495
|
+
value: function getArrowPosition(containerNode, clientNode) {
|
|
496
|
+
var position = {};
|
|
497
|
+
var _this$getContainerAdj3 = this.getContainerAdjustedPosition(),
|
|
498
|
+
anchor = _this$getContainerAdj3.anchor,
|
|
499
|
+
direction = _this$getContainerAdj3.direction;
|
|
500
|
+
if (direction === 'above' || direction === 'below') {
|
|
501
|
+
if (this.overflow.isOverRight && !this.overflow.isOverLeft) {
|
|
502
|
+
position.left = window.innerWidth - (containerNode.width + this.ARROW_WIDTH) / 2 - this.KEEPOUT;
|
|
503
|
+
} else if (!this.overflow.isOverRight && this.overflow.isOverLeft) {
|
|
504
|
+
position.left = (containerNode.width - this.ARROW_WIDTH) / 2 + this.KEEPOUT;
|
|
505
|
+
} else if (anchor === 'left') {
|
|
506
|
+
position.left = clientNode.left + (containerNode.width - this.ARROW_WIDTH) / 2;
|
|
507
|
+
} else if (anchor === 'right') {
|
|
508
|
+
position.left = clientNode.right - containerNode.width + (containerNode.width - this.ARROW_WIDTH) / 2;
|
|
509
|
+
} else {
|
|
510
|
+
position.left = clientNode.left + (clientNode.width - this.ARROW_WIDTH) / 2;
|
|
511
|
+
}
|
|
512
|
+
} else if (this.overflow.isOverBottom && !this.overflow.isOverTop) {
|
|
513
|
+
position.top = window.innerHeight - (containerNode.height + this.ARROW_WIDTH) / 2 - this.KEEPOUT;
|
|
514
|
+
} else if (!this.overflow.isOverBottom && this.overflow.isOverTop) {
|
|
515
|
+
position.top = (containerNode.height - this.ARROW_WIDTH) / 2 + this.KEEPOUT;
|
|
516
|
+
} else if (anchor === 'top') {
|
|
517
|
+
position.top = clientNode.top + (containerNode.height - this.ARROW_WIDTH) / 2;
|
|
518
|
+
} else if (anchor === 'bottom') {
|
|
519
|
+
position.top = clientNode.bottom - containerNode.height + (containerNode.height - this.ARROW_WIDTH) / 2;
|
|
520
|
+
} else {
|
|
521
|
+
position.top = clientNode.top + (clientNode.height - this.ARROW_WIDTH) / 2;
|
|
522
|
+
}
|
|
523
|
+
switch (direction) {
|
|
524
|
+
case 'above':
|
|
525
|
+
position.top = clientNode.top - this.ARROW_WIDTH - this.MARGIN;
|
|
526
|
+
break;
|
|
527
|
+
case 'below':
|
|
528
|
+
position.top = clientNode.bottom + this.MARGIN;
|
|
529
|
+
break;
|
|
530
|
+
case 'left':
|
|
531
|
+
position.left = this.props.rtl ? clientNode.left + clientNode.width + this.MARGIN : clientNode.left - this.ARROW_WIDTH - this.MARGIN;
|
|
532
|
+
break;
|
|
533
|
+
case 'right':
|
|
534
|
+
position.left = this.props.rtl ? clientNode.left - this.ARROW_WIDTH - this.MARGIN : clientNode.left + clientNode.width + this.MARGIN;
|
|
535
|
+
break;
|
|
536
|
+
default:
|
|
537
|
+
return {};
|
|
538
|
+
}
|
|
539
|
+
return this.adjustRTL(position);
|
|
540
|
+
}
|
|
541
|
+
}, {
|
|
542
|
+
key: "calcOverflow",
|
|
543
|
+
value: function calcOverflow(container, client) {
|
|
544
|
+
var containerHeight, containerWidth;
|
|
545
|
+
var _this$getContainerAdj4 = this.getContainerAdjustedPosition(),
|
|
546
|
+
anchor = _this$getContainerAdj4.anchor,
|
|
547
|
+
direction = _this$getContainerAdj4.direction;
|
|
548
|
+
if (direction === 'above' || direction === 'below') {
|
|
549
|
+
containerHeight = container.height;
|
|
550
|
+
containerWidth = (container.width - client.width) / 2;
|
|
551
|
+
} else {
|
|
552
|
+
containerHeight = (container.height - client.height) / 2;
|
|
553
|
+
containerWidth = container.width;
|
|
554
|
+
}
|
|
555
|
+
this.overflow = {
|
|
556
|
+
isOverTop: anchor === 'top' && (direction === 'left' || direction === 'right') ? !(client.top > this.KEEPOUT) : client.top - containerHeight - this.ARROW_OFFSET - this.MARGIN - this.KEEPOUT < 0,
|
|
557
|
+
isOverBottom: anchor === 'bottom' && (direction === 'left' || direction === 'right') ? client.bottom + this.KEEPOUT > window.innerHeight : client.bottom + containerHeight + this.ARROW_OFFSET + this.MARGIN + this.KEEPOUT > window.innerHeight,
|
|
558
|
+
isOverLeft: anchor === 'left' && (direction === 'above' || direction === 'below') ? !(client.left > this.KEEPOUT) : client.left - containerWidth - this.ARROW_OFFSET - this.MARGIN - this.KEEPOUT < 0,
|
|
559
|
+
isOverRight: anchor === 'right' && (direction === 'above' || direction === 'below') ? client.right + this.KEEPOUT > window.innerWidth : client.right + containerWidth + this.ARROW_OFFSET + this.MARGIN + this.KEEPOUT > window.innerWidth
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
}, {
|
|
563
|
+
key: "adjustDirection",
|
|
564
|
+
value: function adjustDirection() {
|
|
565
|
+
var _this$getContainerAdj5 = this.getContainerAdjustedPosition(),
|
|
566
|
+
anchor = _this$getContainerAdj5.anchor,
|
|
567
|
+
direction = _this$getContainerAdj5.direction;
|
|
568
|
+
if (this.overflow.isOverTop && !this.overflow.isOverBottom && direction === 'above') {
|
|
569
|
+
this.adjustedDirection = anchor ? "below ".concat(anchor) : 'below';
|
|
570
|
+
} else if (this.overflow.isOverBottom && !this.overflow.isOverTop && direction === 'below') {
|
|
571
|
+
this.adjustedDirection = anchor ? "above ".concat(anchor) : 'above';
|
|
572
|
+
} else if (this.overflow.isOverLeft && !this.overflow.isOverRight && direction === 'left' && !this.props.rtl) {
|
|
573
|
+
this.adjustedDirection = anchor ? "right ".concat(anchor) : 'right';
|
|
574
|
+
} else if (this.overflow.isOverRight && !this.overflow.isOverLeft && direction === 'right' && !this.props.rtl) {
|
|
575
|
+
this.adjustedDirection = anchor ? "left ".concat(anchor) : 'left';
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}, {
|
|
579
|
+
key: "adjustRTL",
|
|
580
|
+
value: function adjustRTL(position) {
|
|
581
|
+
var pos = position;
|
|
582
|
+
if (this.props.rtl) {
|
|
583
|
+
var tmpLeft = pos.left;
|
|
584
|
+
pos.left = pos.right;
|
|
585
|
+
pos.right = tmpLeft;
|
|
586
|
+
}
|
|
587
|
+
return pos;
|
|
588
|
+
}
|
|
589
|
+
}, {
|
|
590
|
+
key: "handleDirectionalKey",
|
|
591
|
+
value: function handleDirectionalKey(ev) {
|
|
592
|
+
// prevent default page scrolling
|
|
593
|
+
ev.preventDefault();
|
|
594
|
+
// stop propagation to prevent default spotlight behavior
|
|
595
|
+
ev.stopPropagation();
|
|
596
|
+
// set the pointer mode to false on keydown
|
|
597
|
+
_spotlight["default"].setPointerMode(false);
|
|
598
|
+
}
|
|
599
|
+
}, {
|
|
600
|
+
key: "render",
|
|
601
|
+
value: function render() {
|
|
602
|
+
var _this$clientSiblingRe3;
|
|
603
|
+
var _this$props = this.props,
|
|
604
|
+
voiceExclusive = _this$props['data-webos-voice-exclusive'],
|
|
605
|
+
PopupComponent = _this$props.popupComponent,
|
|
606
|
+
popupClassName = _this$props.popupClassName,
|
|
607
|
+
noAutoDismiss = _this$props.noAutoDismiss,
|
|
608
|
+
open = _this$props.open,
|
|
609
|
+
offset = _this$props.offset,
|
|
610
|
+
popupProps = _this$props.popupProps,
|
|
611
|
+
skin = _this$props.skin,
|
|
612
|
+
spotlightRestrict = _this$props.spotlightRestrict,
|
|
613
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
614
|
+
var idFloatLayer = "".concat(this.id, "_floatLayer");
|
|
615
|
+
var scrimType = rest.scrimType;
|
|
616
|
+
delete rest.scrimType;
|
|
617
|
+
|
|
618
|
+
// 'holepunch' scrimType is specific to this component, not supported by floating layer
|
|
619
|
+
// so it must be swapped-out for one that FloatingLayer does support.
|
|
620
|
+
var holepunchScrim = scrimType === 'holepunch';
|
|
621
|
+
if (spotlightRestrict === 'self-only' && scrimType === 'none' || holepunchScrim) {
|
|
622
|
+
scrimType = 'transparent';
|
|
623
|
+
}
|
|
624
|
+
var popupPropsRef = Object.assign({}, popupProps);
|
|
625
|
+
var ariaProps = (0, _util.extractAriaProps)(popupPropsRef);
|
|
626
|
+
if (!noSkin) {
|
|
627
|
+
rest.skin = skin;
|
|
628
|
+
}
|
|
629
|
+
var holeBounds;
|
|
630
|
+
if ((_this$clientSiblingRe3 = this.clientSiblingRef) !== null && _this$clientSiblingRe3 !== void 0 && _this$clientSiblingRe3.current && holepunchScrim) {
|
|
631
|
+
holeBounds = this.clientSiblingRef.current.getBoundingClientRect();
|
|
632
|
+
}
|
|
633
|
+
delete rest.direction;
|
|
634
|
+
delete rest.onClose;
|
|
635
|
+
delete rest.onOpen;
|
|
636
|
+
delete rest.popupSpotlightId;
|
|
637
|
+
delete rest.rtl;
|
|
638
|
+
delete rest.setApiProvider;
|
|
639
|
+
if (openProp) rest[openProp] = open;
|
|
640
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
641
|
+
"aria-owns": idFloatLayer,
|
|
642
|
+
className: _ContextualPopupDecoratorModule["default"].contextualPopupDecorator,
|
|
643
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FloatingLayer["default"], {
|
|
644
|
+
id: idFloatLayer,
|
|
645
|
+
noAutoDismiss: noAutoDismiss,
|
|
646
|
+
onClose: this.handleClose,
|
|
647
|
+
onDismiss: this.handleDismiss,
|
|
648
|
+
onOpen: this.handleOpen,
|
|
649
|
+
open: open,
|
|
650
|
+
scrimType: scrimType,
|
|
651
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
652
|
+
children: [holepunchScrim ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_HolePunchScrim["default"], {
|
|
653
|
+
holeBounds: holeBounds
|
|
654
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(ContextualPopupContainer, _objectSpread(_objectSpread({}, ariaProps), {}, {
|
|
655
|
+
className: popupClassName,
|
|
656
|
+
onKeyDown: this.handleContainerKeyDown,
|
|
657
|
+
direction: this.state.direction,
|
|
658
|
+
arrowPosition: this.state.arrowPosition,
|
|
659
|
+
containerPosition: this.state.containerPosition,
|
|
660
|
+
containerRef: this.getContainerNode,
|
|
661
|
+
"data-webos-voice-exclusive": voiceExclusive,
|
|
662
|
+
offset: noArrow ? offset : 'none',
|
|
663
|
+
showArrow: !noArrow,
|
|
664
|
+
skin: skin,
|
|
665
|
+
spotlightId: this.state.containerId,
|
|
666
|
+
spotlightRestrict: spotlightRestrict,
|
|
667
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PopupComponent, _objectSpread({}, popupPropsRef))
|
|
668
|
+
}))]
|
|
669
|
+
})
|
|
670
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedWithRef, _objectSpread(_objectSpread({}, rest), {}, {
|
|
671
|
+
outermostRef: this.clientSiblingRef,
|
|
672
|
+
findOutermostRef: this.findClientSiblingRef,
|
|
673
|
+
referrerName: "ContextualPopup"
|
|
674
|
+
}))]
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
}]);
|
|
678
|
+
}(_react.Component), _Class.displayName = 'ContextualPopupDecorator', _Class.propTypes = /** @lends limestone/ContextualPopupDecorator.ContextualPopupDecorator.prototype */{
|
|
679
|
+
/**
|
|
680
|
+
* The component rendered within the
|
|
681
|
+
* {@link limestone/ContextualPopupDecorator.ContextualPopup|ContextualPopup}.
|
|
682
|
+
*
|
|
683
|
+
* @type {Component}
|
|
684
|
+
* @required
|
|
685
|
+
* @public
|
|
686
|
+
*/
|
|
687
|
+
popupComponent: _propTypes["default"].component.isRequired,
|
|
688
|
+
/**
|
|
689
|
+
* Limits the range of voice control to the popup.
|
|
690
|
+
*
|
|
691
|
+
* @memberof limestone/ContextualPopupDecorator.ContextualPopupDecorator.prototype
|
|
692
|
+
* @type {Boolean}
|
|
693
|
+
* @default true
|
|
694
|
+
* @public
|
|
695
|
+
*/
|
|
696
|
+
'data-webos-voice-exclusive': _propTypes2["default"].bool,
|
|
697
|
+
/**
|
|
698
|
+
* Direction of popup with respect to the wrapped component.
|
|
699
|
+
*
|
|
700
|
+
* @type {('above'|'above center'|'above left'|'above right'|'below'|'below center'|'below left'|'below right'|'left middle'|'left top'|'left bottom'|'right middle'|'right top'|'right bottom')}
|
|
701
|
+
* @default 'below center'
|
|
702
|
+
* @public
|
|
703
|
+
*/
|
|
704
|
+
direction: _propTypes2["default"].oneOf(['above', 'above center', 'above left', 'above right', 'below', 'below center', 'below left', 'below right', 'left middle', 'left top', 'left bottom', 'right middle', 'right top', 'right bottom']),
|
|
705
|
+
/**
|
|
706
|
+
* Disables closing the popup when the user presses the cancel/back (e.g. `ESC`) key or taps outside the
|
|
707
|
+
* popup.
|
|
708
|
+
*
|
|
709
|
+
* @type {Boolean}
|
|
710
|
+
* @default false
|
|
711
|
+
* @public
|
|
712
|
+
*/
|
|
713
|
+
noAutoDismiss: _propTypes2["default"].bool,
|
|
714
|
+
/**
|
|
715
|
+
* Offset from the activator to apply to the position of the popup.
|
|
716
|
+
*
|
|
717
|
+
* Only applies when `noArrow` is `true`.
|
|
718
|
+
*
|
|
719
|
+
* @type {('none'|'overlap'|'small'|'large')}
|
|
720
|
+
* @default 'small'
|
|
721
|
+
* @public
|
|
722
|
+
*/
|
|
723
|
+
offset: _propTypes2["default"].oneOf(['none', 'overlap', 'small', 'large']),
|
|
724
|
+
/**
|
|
725
|
+
* Called when the user has attempted to close the popup.
|
|
726
|
+
*
|
|
727
|
+
* This may occur either when the close button is clicked or when spotlight focus
|
|
728
|
+
* moves outside the boundary of the popup. Setting `spotlightRestrict` to `'self-only'`
|
|
729
|
+
* will prevent Spotlight focus from leaving the popup.
|
|
730
|
+
*
|
|
731
|
+
* @type {Function}
|
|
732
|
+
* @public
|
|
733
|
+
*/
|
|
734
|
+
onClose: _propTypes2["default"].func,
|
|
735
|
+
/**
|
|
736
|
+
* Called when the popup is opened.
|
|
737
|
+
*
|
|
738
|
+
* @type {Function}
|
|
739
|
+
* @public
|
|
740
|
+
*/
|
|
741
|
+
onOpen: _propTypes2["default"].func,
|
|
742
|
+
/**
|
|
743
|
+
* Displays the contextual popup.
|
|
744
|
+
*
|
|
745
|
+
* @type {Boolean}
|
|
746
|
+
* @default false
|
|
747
|
+
* @public
|
|
748
|
+
*/
|
|
749
|
+
open: _propTypes2["default"].bool,
|
|
750
|
+
/**
|
|
751
|
+
* CSS class name to pass to the
|
|
752
|
+
* {@link limestone/ContextualPopupDecorator.ContextualPopup|ContextualPopup}.
|
|
753
|
+
*
|
|
754
|
+
* This is commonly used to set width and height of the popup.
|
|
755
|
+
*
|
|
756
|
+
* @type {String}
|
|
757
|
+
* @public
|
|
758
|
+
*/
|
|
759
|
+
popupClassName: _propTypes2["default"].string,
|
|
760
|
+
/**
|
|
761
|
+
* An object containing properties to be passed to popup component.
|
|
762
|
+
*
|
|
763
|
+
* @type {Object}
|
|
764
|
+
* @public
|
|
765
|
+
*/
|
|
766
|
+
popupProps: _propTypes2["default"].object,
|
|
767
|
+
/**
|
|
768
|
+
* The container ID to use with Spotlight.
|
|
769
|
+
*
|
|
770
|
+
* The spotlight container for the popup isn't created until it is open. To configure
|
|
771
|
+
* the container using `Spotlight.set()`, handle the `onOpen` event which is fired after
|
|
772
|
+
* the popup has been created and opened.
|
|
773
|
+
*
|
|
774
|
+
* @type {String}
|
|
775
|
+
* @public
|
|
776
|
+
*/
|
|
777
|
+
popupSpotlightId: _propTypes2["default"].string,
|
|
778
|
+
/**
|
|
779
|
+
* Indicates the content's text direction is right-to-left.
|
|
780
|
+
*
|
|
781
|
+
* @type {Boolean}
|
|
782
|
+
* @private
|
|
783
|
+
*/
|
|
784
|
+
rtl: _propTypes2["default"].bool,
|
|
785
|
+
/**
|
|
786
|
+
* Set the type of scrim to use
|
|
787
|
+
*
|
|
788
|
+
* @type {('holepunch'|'translucent'|'transparent'|'none')}
|
|
789
|
+
* @default 'none'
|
|
790
|
+
* @private
|
|
791
|
+
*/
|
|
792
|
+
scrimType: _propTypes2["default"].oneOf(['holepunch', 'translucent', 'transparent', 'none']),
|
|
793
|
+
/**
|
|
794
|
+
* Registers the ContextualPopupDecorator component with an
|
|
795
|
+
* {@link core/internal/ApiDecorator.ApiDecorator|ApiDecorator}.
|
|
796
|
+
*
|
|
797
|
+
* @type {Function}
|
|
798
|
+
* @private
|
|
799
|
+
*/
|
|
800
|
+
setApiProvider: _propTypes2["default"].func,
|
|
801
|
+
/**
|
|
802
|
+
* The current skin for this component.
|
|
803
|
+
*
|
|
804
|
+
* When `noSkin` is set on the config object, `skin` will only be applied to the
|
|
805
|
+
* {@link limestone/ContextualPopupDecorator.ContextualPopup|ContextualPopup} and not
|
|
806
|
+
* to the popup's activator component.
|
|
807
|
+
*
|
|
808
|
+
* @see {@link limestone/Skinnable.Skinnable.skin}
|
|
809
|
+
* @type {String}
|
|
810
|
+
* @public
|
|
811
|
+
*/
|
|
812
|
+
skin: _propTypes2["default"].string,
|
|
813
|
+
/**
|
|
814
|
+
* Restricts or prioritizes spotlight navigation.
|
|
815
|
+
*
|
|
816
|
+
* Allowed values are:
|
|
817
|
+
* * `'none'` - Spotlight can move freely within and beyond the popup
|
|
818
|
+
* * `'self-first'` - Spotlight should prefer components within the popup over
|
|
819
|
+
* components beyond the popup, or
|
|
820
|
+
* * `'self-only'` - Spotlight can only be set within the popup
|
|
821
|
+
*
|
|
822
|
+
* @type {('none'|'self-first'|'self-only')}
|
|
823
|
+
* @default 'self-first'
|
|
824
|
+
* @public
|
|
825
|
+
*/
|
|
826
|
+
spotlightRestrict: _propTypes2["default"].oneOf(['none', 'self-first', 'self-only'])
|
|
827
|
+
}, _Class.defaultProps = {
|
|
828
|
+
'data-webos-voice-exclusive': true,
|
|
829
|
+
direction: 'below center',
|
|
830
|
+
noAutoDismiss: false,
|
|
831
|
+
offset: 'small',
|
|
832
|
+
open: false,
|
|
833
|
+
scrimType: 'none',
|
|
834
|
+
spotlightRestrict: 'self-first'
|
|
835
|
+
}, _Class;
|
|
836
|
+
});
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Adds support for positioning a
|
|
840
|
+
* {@link limestone/ContextualPopupDecorator.ContextualPopup|ContextualPopup} relative to the
|
|
841
|
+
* wrapped component.
|
|
842
|
+
*
|
|
843
|
+
* `ContextualPopupDecorator` may be used to show additional settings or actions rendered within a
|
|
844
|
+
* small floating popup.
|
|
845
|
+
*
|
|
846
|
+
* Usage:
|
|
847
|
+
* ```
|
|
848
|
+
* const ButtonWithPopup = ContextualPopupDecorator(Button);
|
|
849
|
+
* <ButtonWithPopup
|
|
850
|
+
* direction="above center"
|
|
851
|
+
* open={this.state.open}
|
|
852
|
+
* popupComponent={CustomPopupComponent}
|
|
853
|
+
* >
|
|
854
|
+
* Open Popup
|
|
855
|
+
* </ButtonWithPopup>
|
|
856
|
+
* ```
|
|
857
|
+
*
|
|
858
|
+
* @hoc
|
|
859
|
+
* @memberof limestone/ContextualPopupDecorator
|
|
860
|
+
* @public
|
|
861
|
+
*/
|
|
862
|
+
var ContextualPopupDecorator = exports.ContextualPopupDecorator = (0, _compose["default"])((0, _ApiDecorator["default"])({
|
|
863
|
+
api: ['positionContextualPopup']
|
|
864
|
+
}), (0, _I18nDecorator.I18nContextDecorator)({
|
|
865
|
+
rtlProp: 'rtl'
|
|
866
|
+
}), Decorator);
|
|
867
|
+
var _default = exports["default"] = ContextualPopupDecorator;
|