@zohodesk/components 1.0.0-temp-164 → 1.0.0-temp-166
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/README.md +34 -0
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +151 -151
- package/assets/Appearance/dark/themes/blue/blue_CTA_DarkModifyCategory.module.css +450 -450
- package/assets/Appearance/dark/themes/blue/blue_CTA_DarkTheme.module.css +30 -30
- package/assets/Appearance/dark/themes/green/green_CTA_DarkModifyCategory.module.css +450 -450
- package/assets/Appearance/dark/themes/green/green_CTA_DarkTheme.module.css +30 -30
- package/assets/Appearance/dark/themes/orange/orange_CTA_DarkModifyCategory.module.css +450 -450
- package/assets/Appearance/dark/themes/orange/orange_CTA_DarkTheme.module.css +30 -30
- package/assets/Appearance/dark/themes/red/red_CTA_DarkModifyCategory.module.css +450 -450
- package/assets/Appearance/dark/themes/red/red_CTA_DarkTheme.module.css +30 -30
- package/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkModifyCategory.module.css +450 -450
- package/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkTheme.module.css +30 -30
- package/assets/Appearance/light/mode/Component_LightMode.module.css +148 -148
- package/assets/Appearance/light/themes/blue/blue_CTA_LightModifyCategory.module.css +450 -450
- package/assets/Appearance/light/themes/blue/blue_CTA_LightTheme.module.css +30 -30
- package/assets/Appearance/light/themes/green/green_CTA_LightModifyCategory.module.css +450 -450
- package/assets/Appearance/light/themes/green/green_CTA_LightTheme.module.css +30 -30
- package/assets/Appearance/light/themes/orange/orange_CTA_LightModifyCategory.module.css +450 -450
- package/assets/Appearance/light/themes/orange/orange_CTA_LightTheme.module.css +30 -30
- package/assets/Appearance/light/themes/red/red_CTA_LightModifyCategory.module.css +450 -450
- package/assets/Appearance/light/themes/red/red_CTA_LightTheme.module.css +30 -30
- package/assets/Appearance/light/themes/yellow/yellow_CTA_LightModifyCategory.module.css +450 -450
- package/assets/Appearance/light/themes/yellow/yellow_CTA_LightTheme.module.css +30 -30
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +153 -153
- package/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkModifyCategory.module.css +450 -450
- package/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkTheme.module.css +30 -30
- package/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkModifyCategory.module.css +450 -450
- package/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkTheme.module.css +30 -30
- package/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkModifyCategory.module.css +450 -450
- package/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkTheme.module.css +30 -30
- package/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkModifyCategory.module.css +450 -450
- package/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkTheme.module.css +30 -30
- package/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkModifyCategory.module.css +450 -450
- package/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkTheme.module.css +30 -30
- package/es/Accordion/Accordion.js +8 -3
- package/es/Accordion/AccordionItem.js +5 -2
- package/es/Animation/Animation.js +3 -3
- package/es/AppContainer/AppContainer.js +27 -10
- package/es/AppContainer/AppContainer.module.css +2 -2
- package/es/AppContainer/props/defaultProps.js +2 -1
- package/es/AppContainer/props/propTypes.js +1 -0
- package/es/Avatar/Avatar.js +26 -11
- package/es/Avatar/Avatar.module.css +18 -18
- package/es/AvatarTeam/AvatarTeam.js +4 -3
- package/es/AvatarTeam/AvatarTeam.module.css +35 -35
- package/es/Button/Button.js +5 -3
- package/es/Button/css/Button.module.css +70 -70
- package/es/Buttongroup/Buttongroup.js +4 -3
- package/es/Buttongroup/Buttongroup.module.css +14 -15
- package/es/Card/Card.js +21 -10
- package/es/CheckBox/CheckBox.js +5 -3
- package/es/CheckBox/CheckBox.module.css +15 -15
- package/es/DateTime/CalendarView.js +33 -20
- package/es/DateTime/DateTime.js +113 -12
- package/es/DateTime/DateTime.module.css +39 -39
- package/es/DateTime/DateTimePopupFooter.js +4 -2
- package/es/DateTime/DateTimePopupHeader.js +8 -2
- package/es/DateTime/DateWidget.js +100 -35
- package/es/DateTime/DateWidget.module.css +5 -5
- package/es/DateTime/DaysRow.js +4 -2
- package/es/DateTime/Time.js +10 -2
- package/es/DateTime/YearView.js +28 -4
- package/es/DateTime/YearView.module.css +15 -15
- package/es/DateTime/__tests__/CalendarView.spec.js +1 -0
- package/es/DateTime/__tests__/DateTime.spec.js +1 -0
- package/es/DateTime/__tests__/DateWidget.spec.js +2 -3
- package/es/DateTime/common.js +3 -0
- package/es/DateTime/constants.js +1 -0
- package/es/DateTime/dateFormatUtils/dateFormat.js +63 -30
- package/es/DateTime/dateFormatUtils/dateFormats.js +0 -1
- package/es/DateTime/dateFormatUtils/dayChange.js +13 -4
- package/es/DateTime/dateFormatUtils/index.js +32 -2
- package/es/DateTime/dateFormatUtils/monthChange.js +8 -0
- package/es/DateTime/dateFormatUtils/timeChange.js +22 -6
- package/es/DateTime/dateFormatUtils/yearChange.js +11 -2
- package/es/DateTime/objectUtils.js +14 -20
- package/es/DateTime/props/defaultProps.js +2 -1
- package/es/DateTime/typeChecker.js +3 -0
- package/es/DateTime/validator.js +58 -6
- package/es/DropBox/DropBox.js +9 -5
- package/es/DropBox/DropBoxElement/DropBoxElement.js +18 -6
- package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +85 -79
- package/es/DropBox/DropBoxElement/css/cssJSLogic.js +6 -4
- package/es/DropBox/DropBoxElement/props/propTypes.js +1 -1
- package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +3 -0
- package/es/DropBox/__tests__/DropBox.spec.js +2 -2
- package/es/DropBox/css/DropBox.module.css +6 -6
- package/es/DropBox/props/defaultProps.js +1 -2
- package/es/DropBox/props/propTypes.js +1 -2
- package/es/DropDown/DropDown.js +10 -5
- package/es/DropDown/DropDown.module.css +2 -2
- package/es/DropDown/DropDownHeading.js +5 -5
- package/es/DropDown/DropDownHeading.module.css +6 -6
- package/es/DropDown/DropDownItem.js +8 -1
- package/es/DropDown/DropDownItem.module.css +12 -12
- package/es/DropDown/DropDownSearch.js +4 -0
- package/es/DropDown/DropDownSearch.module.css +3 -3
- package/es/DropDown/DropDownSeparator.js +1 -0
- package/es/DropDown/DropDownSeparator.module.css +2 -2
- package/es/DropDown/__tests__/DropDown.spec.js +1 -2
- package/es/Heading/Heading.js +3 -3
- package/es/Heading/Heading.module.css +2 -2
- package/es/Label/Label.js +3 -3
- package/es/Label/Label.module.css +5 -5
- package/es/Layout/Box.js +17 -3
- package/es/Layout/Container.js +16 -4
- package/es/Layout/Layout.module.css +15 -15
- package/es/Layout/index.js +1 -2
- package/es/Layout/props/defaultProps.js +2 -0
- package/es/Layout/props/propTypes.js +2 -0
- package/es/Layout/utils.js +5 -1
- package/es/ListItem/ListContainer.js +8 -3
- package/es/ListItem/ListItem.js +9 -3
- package/es/ListItem/ListItem.module.css +38 -38
- package/es/ListItem/ListItemWithAvatar.js +9 -3
- package/es/ListItem/ListItemWithCheckBox.js +7 -2
- package/es/ListItem/ListItemWithIcon.js +8 -3
- package/es/ListItem/ListItemWithRadio.js +7 -3
- package/es/Modal/Modal.js +28 -11
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +90 -13
- package/es/MultiSelect/AdvancedMultiSelect.js +33 -9
- package/es/MultiSelect/EmptyState.js +6 -0
- package/es/MultiSelect/MultiSelect.js +100 -32
- package/es/MultiSelect/MultiSelect.module.css +31 -31
- package/es/MultiSelect/MultiSelectHeader.js +3 -0
- package/es/MultiSelect/MultiSelectWithAvatar.js +13 -6
- package/es/MultiSelect/SelectedOptions.js +6 -3
- package/es/MultiSelect/SelectedOptions.module.css +5 -5
- package/es/MultiSelect/Suggestions.js +7 -3
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +4 -6
- package/es/MultiSelect/props/propTypes.js +2 -0
- package/es/PopOver/PopOver.js +18 -2
- package/es/PopOver/__tests__/PopOver.spec.js +2 -1
- package/es/Popup/Popup.js +77 -27
- package/es/Popup/__tests__/Popup.spec.js +17 -5
- package/es/Popup/viewPort.js +16 -4
- package/es/Provider/IdProvider.js +10 -5
- package/es/Provider/LibraryContext.js +6 -4
- package/es/Provider/NumberGenerator/NumberGenerator.js +21 -7
- package/es/Provider/ZindexProvider.js +9 -2
- package/es/Radio/Radio.js +4 -2
- package/es/Radio/Radio.module.css +9 -9
- package/es/Responsive/CustomResponsive.js +30 -18
- package/es/Responsive/RefWrapper.js +6 -7
- package/es/Responsive/ResizeComponent.js +35 -25
- package/es/Responsive/ResizeObserver.js +26 -6
- package/es/Responsive/Responsive.js +34 -20
- package/es/Responsive/index.js +1 -3
- package/es/Responsive/sizeObservers.js +28 -7
- package/es/Responsive/utils/index.js +7 -5
- package/es/Responsive/utils/shallowCompare.js +7 -2
- package/es/Responsive/windowResizeObserver.js +7 -0
- package/es/ResponsiveDropBox/ResponsiveDropBox.js +4 -0
- package/es/ResponsiveDropBox/ResponsiveDropBox.module.css +2 -2
- package/es/Ribbon/Ribbon.js +4 -2
- package/es/Ribbon/Ribbon.module.css +46 -48
- package/es/RippleEffect/RippleEffect.js +1 -3
- package/es/Select/GroupSelect.js +59 -14
- package/es/Select/Select.js +81 -34
- package/es/Select/Select.module.css +23 -23
- package/es/Select/SelectWithAvatar.js +19 -4
- package/es/Select/SelectWithIcon.js +48 -6
- package/es/Select/__tests__/Select.spec.js +6 -8
- package/es/Select/props/propTypes.js +1 -0
- package/es/Stencils/Stencils.js +3 -3
- package/es/Stencils/Stencils.module.css +11 -11
- package/es/Switch/Switch.js +6 -3
- package/es/Switch/Switch.module.css +23 -23
- package/es/Tab/Tab.js +4 -4
- package/es/Tab/Tab.module.css +14 -14
- package/es/Tab/TabContent.js +1 -0
- package/es/Tab/TabContentWrapper.js +2 -0
- package/es/Tab/TabWrapper.js +5 -2
- package/es/Tab/Tabs.js +56 -8
- package/es/Tab/Tabs.module.css +24 -42
- package/es/Tab/__tests__/Tab.spec.js +1 -3
- package/es/Tab/__tests__/TabWrapper.spec.js +1 -0
- package/es/Tag/Tag.js +7 -3
- package/es/Tag/Tag.module.css +25 -25
- package/es/TextBox/TextBox.js +16 -3
- package/es/TextBox/TextBox.module.css +9 -9
- package/es/TextBox/__tests__/TextBox.spec.js +1 -4
- package/es/TextBoxIcon/TextBoxIcon.js +9 -2
- package/es/TextBoxIcon/TextBoxIcon.module.css +7 -7
- package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +2 -7
- package/es/Textarea/Textarea.js +13 -3
- package/es/Textarea/Textarea.module.css +21 -21
- package/es/Textarea/__tests__/Textarea.spec.js +2 -2
- package/es/Tooltip/Tooltip.js +60 -15
- package/es/Tooltip/Tooltip.module.css +5 -5
- package/es/Tooltip/__tests__/Tooltip.spec.js +5 -0
- package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +3 -2
- package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +7 -5
- package/es/common/animation.module.css +8 -8
- package/es/common/avatarsizes.module.css +16 -16
- package/es/common/basicReset.module.css +3 -3
- package/es/common/common.module.css +24 -24
- package/es/common/customscroll.module.css +2 -2
- package/es/deprecated/AdvancedMultiSelect.module.css +18 -18
- package/es/deprecated/PortalLayer/PortalLayer.js +25 -20
- package/es/semantic/Button/Button.js +4 -2
- package/es/semantic/Button/semanticButton.module.css +1 -1
- package/es/utils/Common.js +58 -9
- package/es/utils/ContextOptimizer.js +4 -5
- package/es/utils/__tests__/debounce.spec.js +2 -2
- package/es/utils/constructFullName.js +2 -0
- package/es/utils/css/compileClassNames.js +5 -0
- package/es/utils/css/mergeStyle.js +7 -6
- package/es/utils/css/utils.js +1 -0
- package/es/utils/datetime/GMTZones.js +48 -0
- package/es/utils/datetime/common.js +31 -7
- package/es/utils/debounce.js +5 -1
- package/es/utils/dropDownUtils.js +68 -11
- package/es/utils/getInitial.js +4 -0
- package/es/utils/shallowEqual.js +6 -0
- package/lib/Accordion/Accordion.js +43 -18
- package/lib/Accordion/AccordionItem.js +41 -18
- package/lib/Accordion/__tests__/Accordion.spec.js +3 -0
- package/lib/Accordion/index.js +3 -0
- package/lib/Accordion/props/propTypes.js +3 -0
- package/lib/Animation/Animation.js +38 -18
- package/lib/Animation/__tests__/Animation.spec.js +11 -7
- package/lib/Animation/props/propTypes.js +3 -0
- package/lib/AppContainer/AppContainer.js +66 -26
- package/lib/AppContainer/AppContainer.module.css +2 -2
- package/lib/AppContainer/props/defaultProps.js +2 -1
- package/lib/AppContainer/props/propTypes.js +4 -0
- package/lib/Avatar/Avatar.js +81 -38
- package/lib/Avatar/Avatar.module.css +18 -18
- package/lib/Avatar/__tests__/Avatar.spec.js +44 -0
- package/lib/Avatar/props/propTypes.js +3 -0
- package/lib/AvatarTeam/AvatarTeam.js +53 -30
- package/lib/AvatarTeam/AvatarTeam.module.css +35 -35
- package/lib/AvatarTeam/__tests__/AvatarTeam.spec.js +13 -0
- package/lib/AvatarTeam/props/propTypes.js +3 -0
- package/lib/Button/Button.js +32 -20
- package/lib/Button/css/Button.module.css +70 -70
- package/lib/Button/css/cssJSLogic.js +18 -17
- package/lib/Button/index.js +3 -0
- package/lib/Button/props/defaultProps.js +2 -0
- package/lib/Button/props/propTypes.js +3 -0
- package/lib/Buttongroup/Buttongroup.js +33 -12
- package/lib/Buttongroup/Buttongroup.module.css +14 -15
- package/lib/Buttongroup/__test__/Buttongroup.spec.js +10 -0
- package/lib/Buttongroup/props/propTypes.js +3 -0
- package/lib/Card/Card.js +102 -46
- package/lib/Card/__tests__/Card.spec.js +10 -1
- package/lib/Card/index.js +4 -0
- package/lib/Card/props/propTypes.js +3 -0
- package/lib/CheckBox/CheckBox.js +71 -47
- package/lib/CheckBox/CheckBox.module.css +15 -15
- package/lib/CheckBox/__tests__/CheckBox.spec.js +3 -0
- package/lib/CheckBox/props/propTypes.js +3 -0
- package/lib/DateTime/CalendarView.js +83 -42
- package/lib/DateTime/DateTime.js +287 -160
- package/lib/DateTime/DateTime.module.css +39 -39
- package/lib/DateTime/DateTimePopupFooter.js +31 -8
- package/lib/DateTime/DateTimePopupHeader.js +48 -17
- package/lib/DateTime/DateWidget.js +354 -250
- package/lib/DateTime/DateWidget.module.css +5 -5
- package/lib/DateTime/DaysRow.js +27 -5
- package/lib/DateTime/Time.js +73 -32
- package/lib/DateTime/YearView.js +77 -28
- package/lib/DateTime/YearView.module.css +15 -15
- package/lib/DateTime/__tests__/CalendarView.spec.js +13 -5
- package/lib/DateTime/__tests__/DateTime.spec.js +51 -37
- package/lib/DateTime/__tests__/DateWidget.spec.js +10 -8
- package/lib/DateTime/common.js +6 -0
- package/lib/DateTime/constants.js +1 -0
- package/lib/DateTime/dateFormatUtils/dateFormat.js +184 -122
- package/lib/DateTime/dateFormatUtils/dateFormats.js +0 -1
- package/lib/DateTime/dateFormatUtils/dayChange.js +14 -7
- package/lib/DateTime/dateFormatUtils/index.js +74 -16
- package/lib/DateTime/dateFormatUtils/monthChange.js +19 -9
- package/lib/DateTime/dateFormatUtils/timeChange.js +54 -22
- package/lib/DateTime/dateFormatUtils/yearChange.js +22 -11
- package/lib/DateTime/index.js +2 -0
- package/lib/DateTime/objectUtils.js +24 -20
- package/lib/DateTime/props/defaultProps.js +2 -1
- package/lib/DateTime/props/propTypes.js +11 -1
- package/lib/DateTime/typeChecker.js +4 -0
- package/lib/DateTime/validator.js +73 -10
- package/lib/DropBox/DropBox.js +36 -12
- package/lib/DropBox/DropBoxElement/DropBoxElement.js +68 -42
- package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +85 -79
- package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +43 -34
- package/lib/DropBox/DropBoxElement/props/propTypes.js +4 -1
- package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +14 -9
- package/lib/DropBox/__tests__/DropBox.spec.js +8 -4
- package/lib/DropBox/css/DropBox.module.css +6 -6
- package/lib/DropBox/css/cssJSLogic.js +3 -1
- package/lib/DropBox/props/defaultProps.js +8 -4
- package/lib/DropBox/props/propTypes.js +10 -4
- package/lib/DropDown/DropDown.js +54 -9
- package/lib/DropDown/DropDown.module.css +2 -2
- package/lib/DropDown/DropDownHeading.js +40 -20
- package/lib/DropDown/DropDownHeading.module.css +6 -6
- package/lib/DropDown/DropDownItem.js +44 -21
- package/lib/DropDown/DropDownItem.module.css +12 -12
- package/lib/DropDown/DropDownSearch.js +40 -17
- package/lib/DropDown/DropDownSearch.module.css +3 -3
- package/lib/DropDown/DropDownSeparator.js +24 -4
- package/lib/DropDown/DropDownSeparator.module.css +2 -2
- package/lib/DropDown/__tests__/DropDown.spec.js +15 -9
- package/lib/DropDown/__tests__/DropDownItem.spec.js +9 -4
- package/lib/DropDown/__tests__/DropDownSearch.spec.js +3 -0
- package/lib/DropDown/index.js +9 -0
- package/lib/DropDown/props/propTypes.js +6 -4
- package/lib/Heading/Heading.js +39 -16
- package/lib/Heading/Heading.module.css +2 -2
- package/lib/Heading/props/propTypes.js +3 -0
- package/lib/Label/Label.js +40 -19
- package/lib/Label/Label.module.css +5 -5
- package/lib/Label/__tests__/Label.spec.js +14 -1
- package/lib/Label/props/propTypes.js +3 -0
- package/lib/Layout/Box.js +39 -15
- package/lib/Layout/Container.js +37 -14
- package/lib/Layout/Layout.module.css +15 -15
- package/lib/Layout/__tests__/Box.spec.js +65 -49
- package/lib/Layout/__tests__/Container.spec.js +67 -50
- package/lib/Layout/index.js +3 -0
- package/lib/Layout/props/defaultProps.js +2 -0
- package/lib/Layout/props/propTypes.js +5 -0
- package/lib/Layout/utils.js +15 -1
- package/lib/ListItem/ListContainer.js +48 -27
- package/lib/ListItem/ListItem.js +69 -45
- package/lib/ListItem/ListItem.module.css +38 -38
- package/lib/ListItem/ListItemWithAvatar.js +75 -48
- package/lib/ListItem/ListItemWithCheckBox.js +64 -39
- package/lib/ListItem/ListItemWithIcon.js +68 -44
- package/lib/ListItem/ListItemWithRadio.js +65 -41
- package/lib/ListItem/index.js +7 -0
- package/lib/ListItem/props/propTypes.js +6 -4
- package/lib/Modal/Modal.js +45 -10
- package/lib/Modal/props/propTypes.js +3 -0
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +295 -166
- package/lib/MultiSelect/AdvancedMultiSelect.js +203 -125
- package/lib/MultiSelect/EmptyState.js +49 -24
- package/lib/MultiSelect/MultiSelect.js +324 -206
- package/lib/MultiSelect/MultiSelect.module.css +31 -31
- package/lib/MultiSelect/MultiSelectHeader.js +30 -8
- package/lib/MultiSelect/MultiSelectWithAvatar.js +106 -63
- package/lib/MultiSelect/SelectedOptions.js +43 -17
- package/lib/MultiSelect/SelectedOptions.module.css +5 -5
- package/lib/MultiSelect/Suggestions.js +64 -32
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +86 -75
- package/lib/MultiSelect/index.js +5 -0
- package/lib/MultiSelect/props/defaultProps.js +2 -0
- package/lib/MultiSelect/props/propTypes.js +5 -0
- package/lib/PopOver/PopOver.js +95 -49
- package/lib/PopOver/__tests__/PopOver.spec.js +4 -1
- package/lib/PopOver/index.js +4 -0
- package/lib/PopOver/props/propTypes.js +3 -0
- package/lib/Popup/Popup.js +158 -84
- package/lib/Popup/__tests__/Popup.spec.js +43 -8
- package/lib/Popup/viewPort.js +28 -14
- package/lib/Provider/AvatarSize.js +4 -0
- package/lib/Provider/Config.js +2 -0
- package/lib/Provider/CssProvider.js +4 -0
- package/lib/Provider/IdProvider.js +17 -6
- package/lib/Provider/LibraryContext.js +35 -15
- package/lib/Provider/LibraryContextInit.js +4 -0
- package/lib/Provider/NumberGenerator/NumberGenerator.js +44 -15
- package/lib/Provider/ZindexProvider.js +15 -3
- package/lib/Provider/index.js +5 -0
- package/lib/Radio/Radio.js +61 -38
- package/lib/Radio/Radio.module.css +9 -9
- package/lib/Radio/__tests__/Radiospec.js +9 -5
- package/lib/Radio/props/propTypes.js +3 -0
- package/lib/Responsive/CustomResponsive.js +73 -29
- package/lib/Responsive/RefWrapper.js +17 -11
- package/lib/Responsive/ResizeComponent.js +62 -36
- package/lib/Responsive/ResizeObserver.js +24 -10
- package/lib/Responsive/Responsive.js +80 -30
- package/lib/Responsive/index.js +4 -0
- package/lib/Responsive/props/propTypes.js +3 -0
- package/lib/Responsive/sizeObservers.js +53 -17
- package/lib/Responsive/utils/index.js +11 -3
- package/lib/Responsive/utils/shallowCompare.js +11 -2
- package/lib/Responsive/windowResizeObserver.js +8 -0
- package/lib/ResponsiveDropBox/ResponsiveDropBox.js +45 -17
- package/lib/ResponsiveDropBox/ResponsiveDropBox.module.css +2 -2
- package/lib/ResponsiveDropBox/props/propTypes.js +3 -0
- package/lib/Ribbon/Ribbon.js +34 -13
- package/lib/Ribbon/Ribbon.module.css +46 -48
- package/lib/Ribbon/__tests__/Ribbon.spec.js +22 -0
- package/lib/Ribbon/props/propTypes.js +3 -0
- package/lib/RippleEffect/RippleEffect.js +18 -10
- package/lib/RippleEffect/props/propTypes.js +3 -0
- package/lib/Select/GroupSelect.js +230 -130
- package/lib/Select/Select.js +292 -210
- package/lib/Select/Select.module.css +23 -23
- package/lib/Select/SelectWithAvatar.js +104 -56
- package/lib/Select/SelectWithIcon.js +134 -77
- package/lib/Select/__tests__/Select.spec.js +133 -91
- package/lib/Select/index.js +5 -0
- package/lib/Select/props/defaultProps.js +5 -4
- package/lib/Select/props/propTypes.js +4 -0
- package/lib/Stencils/Stencils.js +29 -10
- package/lib/Stencils/Stencils.module.css +11 -11
- package/lib/Stencils/__tests__/Stencils.spec.js +12 -0
- package/lib/Stencils/props/propTypes.js +3 -0
- package/lib/Switch/Switch.js +58 -34
- package/lib/Switch/Switch.module.css +23 -23
- package/lib/Switch/props/propTypes.js +3 -0
- package/lib/Tab/Tab.js +40 -27
- package/lib/Tab/Tab.module.css +14 -14
- package/lib/Tab/TabContent.js +12 -5
- package/lib/Tab/TabContentWrapper.js +13 -6
- package/lib/Tab/TabWrapper.js +37 -19
- package/lib/Tab/Tabs.js +173 -92
- package/lib/Tab/Tabs.module.css +24 -42
- package/lib/Tab/__tests__/Tab.spec.js +67 -58
- package/lib/Tab/__tests__/TabContent.spec.js +10 -6
- package/lib/Tab/__tests__/TabContentWrapper.spec.js +28 -20
- package/lib/Tab/__tests__/TabWrapper.spec.js +12 -0
- package/lib/Tab/__tests__/Tabs.spec.js +53 -39
- package/lib/Tab/index.js +6 -0
- package/lib/Tab/props/propTypes.js +3 -0
- package/lib/Tag/Tag.js +73 -43
- package/lib/Tag/Tag.module.css +25 -25
- package/lib/Tag/__tests__/Tag.spec.js +14 -8
- package/lib/Tag/props/propTypes.js +3 -0
- package/lib/TextBox/TextBox.js +86 -59
- package/lib/TextBox/TextBox.module.css +9 -9
- package/lib/TextBox/__tests__/TextBox.spec.js +14 -4
- package/lib/TextBox/props/propTypes.js +6 -4
- package/lib/TextBoxIcon/TextBoxIcon.js +79 -52
- package/lib/TextBoxIcon/TextBoxIcon.module.css +7 -7
- package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +14 -5
- package/lib/TextBoxIcon/props/propTypes.js +3 -0
- package/lib/Textarea/Textarea.js +55 -29
- package/lib/Textarea/Textarea.module.css +21 -21
- package/lib/Textarea/__tests__/Textarea.spec.js +14 -2
- package/lib/Textarea/props/propTypes.js +3 -0
- package/lib/Tooltip/Tooltip.js +96 -32
- package/lib/Tooltip/Tooltip.module.css +5 -5
- package/lib/Tooltip/__tests__/Tooltip.spec.js +24 -3
- package/lib/Tooltip/props/propTypes.js +3 -0
- package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +40 -16
- package/lib/VelocityAnimation/VelocityAnimation/props/propTypes.js +3 -0
- package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +53 -25
- package/lib/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +3 -0
- package/lib/VelocityAnimation/index.js +3 -0
- package/lib/common/animation.module.css +8 -8
- package/lib/common/avatarsizes.module.css +16 -16
- package/lib/common/basicReset.module.css +3 -3
- package/lib/common/common.module.css +24 -24
- package/lib/common/customscroll.module.css +2 -2
- package/lib/css.js +40 -0
- package/lib/deprecated/AdvancedMultiSelect.module.css +18 -18
- package/lib/deprecated/PortalLayer/PortalLayer.js +46 -23
- package/lib/deprecated/PortalLayer/props/propTypes.js +3 -0
- package/lib/index.js +57 -0
- package/lib/semantic/Button/Button.js +43 -22
- package/lib/semantic/Button/props/propTypes.js +3 -0
- package/lib/semantic/Button/semanticButton.module.css +1 -1
- package/lib/semantic/index.js +2 -0
- package/lib/utils/Common.js +117 -19
- package/lib/utils/ContextOptimizer.js +16 -10
- package/lib/utils/__tests__/constructFullName.spec.js +1 -0
- package/lib/utils/__tests__/debounce.spec.js +3 -2
- package/lib/utils/__tests__/getInitial.spec.js +1 -0
- package/lib/utils/constructFullName.js +13 -4
- package/lib/utils/css/compileClassNames.js +6 -0
- package/lib/utils/css/mergeStyle.js +10 -7
- package/lib/utils/css/utils.js +8 -0
- package/lib/utils/datetime/GMTZones.js +55 -0
- package/lib/utils/datetime/common.js +52 -7
- package/lib/utils/debounce.js +6 -1
- package/lib/utils/dropDownUtils.js +175 -59
- package/lib/utils/dummyFunction.js +2 -0
- package/lib/utils/getHTMLFontSize.js +1 -0
- package/lib/utils/getInitial.js +6 -0
- package/lib/utils/index.js +4 -0
- package/lib/utils/scrollTo.js +2 -0
- package/lib/utils/shallowEqual.js +8 -0
- package/package.json +18 -27
package/es/Popup/Popup.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
2
3
|
/**** Libraries ****/
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
5
6
|
import hoistStatics from 'hoist-non-react-statics';
|
|
6
|
-
|
|
7
7
|
/**** Methods ****/
|
|
8
|
+
|
|
8
9
|
import { debounce, isDescendant, isTextSelected, cancelBubblingEffect } from '../utils/Common.js';
|
|
9
10
|
import viewPort from './viewPort';
|
|
10
11
|
import { absolutePositionMapping, rtlAbsolutePositionMapping, rtlFixedPositionMapping } from './PositionMapping.json';
|
|
11
12
|
import ResizeObserver from '@zohodesk/virtualizer/lib/commons/ResizeObserver.js';
|
|
12
13
|
let lastOpenedGroup = [];
|
|
13
14
|
let popups = {};
|
|
15
|
+
|
|
14
16
|
global.closeGroupPopups = function (groupName) {
|
|
15
17
|
const groupPopups = popups[groupName] || [];
|
|
16
18
|
groupPopups.forEach(popup => {
|
|
@@ -20,6 +22,7 @@ global.closeGroupPopups = function (groupName) {
|
|
|
20
22
|
});
|
|
21
23
|
});
|
|
22
24
|
};
|
|
25
|
+
|
|
23
26
|
const defaultState = {
|
|
24
27
|
position: 'bottomCenter',
|
|
25
28
|
height: '0px',
|
|
@@ -33,8 +36,8 @@ const defaultState = {
|
|
|
33
36
|
//{height: ‘’, width: ‘’,}
|
|
34
37
|
isAbsolutePositioningNeeded: true
|
|
35
38
|
};
|
|
36
|
-
|
|
37
39
|
/* eslint-disable react/no-deprecated */
|
|
40
|
+
|
|
38
41
|
/* eslint-disable react/prop-types */
|
|
39
42
|
|
|
40
43
|
const Popup = function (Component) {
|
|
@@ -47,6 +50,7 @@ const Popup = function (Component) {
|
|
|
47
50
|
scrollDebounceTime: popupScrollDebounceTime = 0,
|
|
48
51
|
closeOnScroll: closeOnScrollPopup = false
|
|
49
52
|
} = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
53
|
+
|
|
50
54
|
class Popup extends React.Component {
|
|
51
55
|
constructor(props) {
|
|
52
56
|
super(props);
|
|
@@ -87,9 +91,8 @@ const Popup = function (Component) {
|
|
|
87
91
|
this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
|
|
88
92
|
this.handleDocumentFocus = this.handleDocumentFocus.bind(this);
|
|
89
93
|
this.handleGetNeedPrevent = this.handleGetNeedPrevent.bind(this);
|
|
90
|
-
this.popupObserver = new ResizeObserver(this.handlePopupResize);
|
|
94
|
+
this.popupObserver = new ResizeObserver(this.handlePopupResize); //dropBoxSize
|
|
91
95
|
|
|
92
|
-
//dropBoxSize
|
|
93
96
|
this.size = null;
|
|
94
97
|
this.isAbsolutePopup = isAbsolutePopup;
|
|
95
98
|
this.needPopupArrow = needPopupArrow;
|
|
@@ -101,25 +104,29 @@ const Popup = function (Component) {
|
|
|
101
104
|
} = this.getScrollDebounceTime(this);
|
|
102
105
|
this.handleScroll = debounce(this.handleScroll.bind(this), scrollDebounceTime);
|
|
103
106
|
}
|
|
107
|
+
|
|
104
108
|
componentDidMount() {
|
|
105
109
|
const group = this.getGroup();
|
|
106
110
|
const groupPopups = popups[group] || [];
|
|
107
111
|
groupPopups.push(this);
|
|
108
112
|
popups[group] = groupPopups;
|
|
113
|
+
|
|
109
114
|
if (Object.keys(popups).length === 1 && groupPopups.length === 1) {
|
|
110
115
|
document.addEventListener('click', this.documentClickHandler, false);
|
|
111
|
-
document.addEventListener('keyup', this.documentKeyupHandler, false);
|
|
112
|
-
|
|
116
|
+
document.addEventListener('keyup', this.documentKeyupHandler, false); // document.addEventListener('scroll', this.handleScroll, true);
|
|
117
|
+
|
|
113
118
|
window.addEventListener('resize', this.handleResize);
|
|
114
119
|
document.addEventListener('click', this.documentClickHandler1, true);
|
|
115
120
|
document.addEventListener('mousedown', this.handleDocumentMouseDown, true);
|
|
116
121
|
document.addEventListener('focus', this.handleDocumentFocus, true);
|
|
117
122
|
}
|
|
118
123
|
}
|
|
124
|
+
|
|
119
125
|
componentWillReceiveProps(nextProps) {
|
|
120
126
|
const {
|
|
121
127
|
isPopupOpen
|
|
122
128
|
} = this.state;
|
|
129
|
+
|
|
123
130
|
if (typeof nextProps.isPopupOpen !== 'undefined' && nextProps.isPopupOpen !== isPopupOpen) {
|
|
124
131
|
this.setState({
|
|
125
132
|
isPopupOpen: nextProps.isPopupOpen,
|
|
@@ -127,6 +134,7 @@ const Popup = function (Component) {
|
|
|
127
134
|
});
|
|
128
135
|
}
|
|
129
136
|
}
|
|
137
|
+
|
|
130
138
|
componentDidUpdate(prevProps, prevState) {
|
|
131
139
|
const {
|
|
132
140
|
isPopupReady
|
|
@@ -140,6 +148,7 @@ const Popup = function (Component) {
|
|
|
140
148
|
const {
|
|
141
149
|
needResizeHandling: propResizeHandling
|
|
142
150
|
} = this.props;
|
|
151
|
+
|
|
143
152
|
if (oldStateOpen !== isPopupReady) {
|
|
144
153
|
if (isPopupReady && dropElement && (propResizeHandling !== undefined ? propResizeHandling : needResizeHandling)) {
|
|
145
154
|
this.popupObserver.replaceObservationElement(dropElement);
|
|
@@ -149,6 +158,7 @@ const Popup = function (Component) {
|
|
|
149
158
|
}
|
|
150
159
|
}
|
|
151
160
|
}
|
|
161
|
+
|
|
152
162
|
componentWillUnmount() {
|
|
153
163
|
const group = this.getGroup();
|
|
154
164
|
popups = Object.keys(popups).reduce((res, groupName) => {
|
|
@@ -158,34 +168,40 @@ const Popup = function (Component) {
|
|
|
158
168
|
newGroupPopups.length === 0 && lastOpenedGroup.indexOf(group) >= 0 && lastOpenedGroup.splice(lastOpenedGroup.indexOf(group), 1);
|
|
159
169
|
res[group] = newGroupPopups;
|
|
160
170
|
}
|
|
171
|
+
|
|
161
172
|
return res;
|
|
162
173
|
}, popups);
|
|
163
174
|
let noPopups = true;
|
|
175
|
+
|
|
164
176
|
for (const i in popups) {
|
|
165
177
|
if (popups[i].length >= 1) {
|
|
166
178
|
noPopups = false;
|
|
167
179
|
break;
|
|
168
180
|
}
|
|
169
181
|
}
|
|
182
|
+
|
|
170
183
|
if (this.popupObserver) {
|
|
171
184
|
this.popupObserver.disconnect();
|
|
172
185
|
}
|
|
186
|
+
|
|
173
187
|
if (noPopups) {
|
|
174
188
|
document.removeEventListener('click', this.documentClickHandler);
|
|
175
|
-
document.removeEventListener('keyup', this.documentKeyupHandler);
|
|
176
|
-
|
|
189
|
+
document.removeEventListener('keyup', this.documentKeyupHandler); // document.removeEventListener('scroll', this.handleScroll);
|
|
190
|
+
|
|
177
191
|
window.removeEventListener('resize', this.handleResize);
|
|
178
192
|
document.removeEventListener('click', this.documentClickHandler1, true);
|
|
179
193
|
document.removeEventListener('mousedown', this.handleDocumentMouseDown, true);
|
|
180
194
|
document.removeEventListener('focus', this.handleDocumentFocus, true);
|
|
181
195
|
}
|
|
182
196
|
}
|
|
197
|
+
|
|
183
198
|
getGroup() {
|
|
184
199
|
const {
|
|
185
200
|
popupGroup
|
|
186
201
|
} = this.props;
|
|
187
202
|
return popupGroup || group;
|
|
188
203
|
}
|
|
204
|
+
|
|
189
205
|
getNeedArrow(popup) {
|
|
190
206
|
const {
|
|
191
207
|
isArrow
|
|
@@ -195,6 +211,7 @@ const Popup = function (Component) {
|
|
|
195
211
|
} = popup;
|
|
196
212
|
return isArrow !== undefined ? isArrow : needPopupArrow;
|
|
197
213
|
}
|
|
214
|
+
|
|
198
215
|
getScrollDebounceTime(popup) {
|
|
199
216
|
const {
|
|
200
217
|
scrollDebounceTime
|
|
@@ -204,6 +221,7 @@ const Popup = function (Component) {
|
|
|
204
221
|
} = popup;
|
|
205
222
|
return scrollDebounceTime !== undefined ? scrollDebounceTime : popupScrollDebounceTime;
|
|
206
223
|
}
|
|
224
|
+
|
|
207
225
|
getCloseOnScrollPopup(popup) {
|
|
208
226
|
const {
|
|
209
227
|
closeOnScroll
|
|
@@ -213,6 +231,7 @@ const Popup = function (Component) {
|
|
|
213
231
|
} = popup;
|
|
214
232
|
return closeOnScroll !== undefined ? closeOnScroll : closeOnScrollPopup;
|
|
215
233
|
}
|
|
234
|
+
|
|
216
235
|
getIsAbsolutePopup(popup) {
|
|
217
236
|
const {
|
|
218
237
|
isAbsolutePositioningNeeded
|
|
@@ -222,6 +241,7 @@ const Popup = function (Component) {
|
|
|
222
241
|
} = popup;
|
|
223
242
|
return isAbsolutePositioningNeeded !== undefined ? isAbsolutePositioningNeeded : isAbsolutePopup;
|
|
224
243
|
}
|
|
244
|
+
|
|
225
245
|
getCustomPositionOrder(popup) {
|
|
226
246
|
const {
|
|
227
247
|
customOrder = []
|
|
@@ -231,6 +251,7 @@ const Popup = function (Component) {
|
|
|
231
251
|
} = popup;
|
|
232
252
|
return customOrder.length !== 0 ? customOrder : customPositionOrder;
|
|
233
253
|
}
|
|
254
|
+
|
|
234
255
|
togglePopup(e, defaultPosition) {
|
|
235
256
|
const group = this.getGroup();
|
|
236
257
|
this.removeClose(e);
|
|
@@ -248,6 +269,7 @@ const Popup = function (Component) {
|
|
|
248
269
|
});
|
|
249
270
|
}
|
|
250
271
|
});
|
|
272
|
+
|
|
251
273
|
if (isPopupOpen) {
|
|
252
274
|
this.setState({
|
|
253
275
|
isPopupOpen: false,
|
|
@@ -257,18 +279,21 @@ const Popup = function (Component) {
|
|
|
257
279
|
this.handlePopupPosition(defaultPosition);
|
|
258
280
|
}
|
|
259
281
|
}
|
|
282
|
+
|
|
260
283
|
openPopupOnly(e, defaultPosition) {
|
|
261
284
|
const group = this.getGroup();
|
|
262
285
|
this.removeClose(e);
|
|
263
286
|
lastOpenedGroup = lastOpenedGroup.indexOf(group) === -1 ? [group, ...lastOpenedGroup] : lastOpenedGroup;
|
|
264
287
|
this.handlePopupPosition(defaultPosition);
|
|
265
288
|
}
|
|
289
|
+
|
|
266
290
|
closePopupOnly(e) {
|
|
267
291
|
this.removeClose(e);
|
|
268
292
|
lastOpenedGroup.splice(0, 1);
|
|
269
293
|
const {
|
|
270
294
|
isPopupOpen
|
|
271
295
|
} = this.state;
|
|
296
|
+
|
|
272
297
|
if (isPopupOpen) {
|
|
273
298
|
this.setState({
|
|
274
299
|
isPopupOpen: false,
|
|
@@ -276,6 +301,7 @@ const Popup = function (Component) {
|
|
|
276
301
|
});
|
|
277
302
|
}
|
|
278
303
|
}
|
|
304
|
+
|
|
279
305
|
handleCloseLastOpenedGroup() {
|
|
280
306
|
const groupPopups = lastOpenedGroup.length ? popups[lastOpenedGroup[0]] || [] : [];
|
|
281
307
|
lastOpenedGroup.splice(0, 1);
|
|
@@ -286,67 +312,74 @@ const Popup = function (Component) {
|
|
|
286
312
|
});
|
|
287
313
|
});
|
|
288
314
|
}
|
|
315
|
+
|
|
289
316
|
handleDocumentMouseDown(e) {
|
|
290
317
|
const needPrevent = this.handleGetNeedPrevent(e);
|
|
318
|
+
|
|
291
319
|
if (needPrevent) {
|
|
292
320
|
this.removeClose(e);
|
|
293
321
|
}
|
|
294
322
|
}
|
|
323
|
+
|
|
295
324
|
handleDocumentFocus(e) {
|
|
296
325
|
const needPrevent = this.handleGetNeedPrevent(e);
|
|
326
|
+
|
|
297
327
|
if (needPrevent) {
|
|
298
328
|
this.removeClose(e);
|
|
299
329
|
}
|
|
300
330
|
}
|
|
331
|
+
|
|
301
332
|
handleGetNeedPrevent(e) {
|
|
302
333
|
let needPrevent = false;
|
|
334
|
+
|
|
303
335
|
if (lastOpenedGroup.length > 1) {
|
|
304
336
|
const {
|
|
305
337
|
target
|
|
306
338
|
} = e;
|
|
307
339
|
const groupPopups = lastOpenedGroup.length ? popups[lastOpenedGroup[0]] : [];
|
|
308
|
-
let openedPopup = null;
|
|
309
|
-
|
|
340
|
+
let openedPopup = null; // eslint-disable-next-line guard-for-in
|
|
341
|
+
|
|
310
342
|
for (const i in groupPopups) {
|
|
311
343
|
const {
|
|
312
344
|
isPopupOpen
|
|
313
345
|
} = groupPopups[i].state;
|
|
346
|
+
|
|
314
347
|
if (isPopupOpen) {
|
|
315
348
|
openedPopup = groupPopups[i];
|
|
316
349
|
break;
|
|
317
350
|
}
|
|
318
351
|
}
|
|
352
|
+
|
|
319
353
|
if (openedPopup) {
|
|
320
354
|
const {
|
|
321
355
|
dropElement,
|
|
322
356
|
placeHolderElement
|
|
323
357
|
} = openedPopup;
|
|
324
358
|
const isDropBoxChild = isDescendant(dropElement, target);
|
|
325
|
-
const isTargetChild = isDescendant(placeHolderElement, target);
|
|
326
|
-
// const massUpdateParent = document.querySelector(
|
|
327
|
-
// '[data-id=massUpdatePopup]'
|
|
328
|
-
// );
|
|
329
|
-
// const isPopupMassUpdateChild = isDescendant(
|
|
359
|
+
const isTargetChild = isDescendant(placeHolderElement, target); // const isPopupMassUpdateChild = isDescendant(
|
|
330
360
|
// massUpdateParent,
|
|
331
361
|
// dropElement
|
|
332
362
|
// );
|
|
333
363
|
|
|
334
|
-
if (!isDropBoxChild && !isTargetChild
|
|
335
|
-
// && isPopupMassUpdateChild
|
|
364
|
+
if (!isDropBoxChild && !isTargetChild // && isPopupMassUpdateChild
|
|
336
365
|
) {
|
|
337
366
|
needPrevent = true;
|
|
338
367
|
}
|
|
339
368
|
}
|
|
340
369
|
}
|
|
370
|
+
|
|
341
371
|
return needPrevent;
|
|
342
372
|
}
|
|
373
|
+
|
|
343
374
|
documentClickHandler1(e) {
|
|
344
375
|
const needPrevent = this.handleGetNeedPrevent(e);
|
|
376
|
+
|
|
345
377
|
if (needPrevent) {
|
|
346
378
|
this.removeClose(e);
|
|
347
379
|
this.handleCloseLastOpenedGroup();
|
|
348
380
|
}
|
|
349
381
|
}
|
|
382
|
+
|
|
350
383
|
documentClickHandler() {
|
|
351
384
|
try {
|
|
352
385
|
Object.keys(popups).forEach(groupName => {
|
|
@@ -359,25 +392,26 @@ const Popup = function (Component) {
|
|
|
359
392
|
});
|
|
360
393
|
});
|
|
361
394
|
lastOpenedGroup = [];
|
|
362
|
-
} catch (e) {
|
|
363
|
-
// eslint-disable-next-line no-console
|
|
395
|
+
} catch (e) {// eslint-disable-next-line no-console
|
|
364
396
|
//console.error('popup component not unmounted properly', e);
|
|
365
397
|
}
|
|
366
398
|
}
|
|
399
|
+
|
|
367
400
|
documentKeyupHandler(e) {
|
|
368
401
|
try {
|
|
369
402
|
if (e.keyCode === 27) {
|
|
370
403
|
this.handleCloseLastOpenedGroup();
|
|
371
404
|
}
|
|
372
|
-
} catch (e) {
|
|
373
|
-
// eslint-disable-next-line no-console
|
|
405
|
+
} catch (e) {// eslint-disable-next-line no-console
|
|
374
406
|
//console.log('error', e);
|
|
375
407
|
}
|
|
376
408
|
}
|
|
409
|
+
|
|
377
410
|
removeClose(e) {
|
|
378
411
|
// e && e.preventDefault && e.preventDefault();
|
|
379
412
|
cancelBubblingEffect(e);
|
|
380
413
|
}
|
|
414
|
+
|
|
381
415
|
handlePopupPosition() {
|
|
382
416
|
let defaultPosition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'bottomCenter';
|
|
383
417
|
let isResizeHandling = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -392,11 +426,13 @@ const Popup = function (Component) {
|
|
|
392
426
|
const needArrow = this.getNeedArrow(this);
|
|
393
427
|
const isAbsolute = this.getIsAbsolutePopup(this);
|
|
394
428
|
const customOrder = this.getCustomPositionOrder(this);
|
|
429
|
+
|
|
395
430
|
if (direction === 'rtl') {
|
|
396
431
|
defaultPosition = isAbsolute ? rtlAbsolutePositionMapping[defaultPosition] : rtlFixedPositionMapping[defaultPosition];
|
|
397
432
|
} else {
|
|
398
433
|
defaultPosition = isAbsolute ? absolutePositionMapping[defaultPosition] : defaultPosition;
|
|
399
434
|
}
|
|
435
|
+
|
|
400
436
|
if (!placeHolderElement && !dropElement) {
|
|
401
437
|
this.setState({
|
|
402
438
|
isPopupOpen: true,
|
|
@@ -404,6 +440,7 @@ const Popup = function (Component) {
|
|
|
404
440
|
});
|
|
405
441
|
return;
|
|
406
442
|
}
|
|
443
|
+
|
|
407
444
|
const setPosition = () => {
|
|
408
445
|
requestAnimationFrame(() => {
|
|
409
446
|
const {
|
|
@@ -427,6 +464,7 @@ const Popup = function (Component) {
|
|
|
427
464
|
targetOffset,
|
|
428
465
|
popupOffset
|
|
429
466
|
} = betterPosition || {};
|
|
467
|
+
|
|
430
468
|
if (position !== view || !isPopupReady) {
|
|
431
469
|
this.setState({
|
|
432
470
|
isPopupReady: true,
|
|
@@ -440,6 +478,7 @@ const Popup = function (Component) {
|
|
|
440
478
|
}
|
|
441
479
|
});
|
|
442
480
|
};
|
|
481
|
+
|
|
443
482
|
if (isResizeHandling) {
|
|
444
483
|
setPosition();
|
|
445
484
|
} else {
|
|
@@ -450,6 +489,7 @@ const Popup = function (Component) {
|
|
|
450
489
|
}, setPosition);
|
|
451
490
|
}
|
|
452
491
|
}
|
|
492
|
+
|
|
453
493
|
handleOpenPopupPositionChange() {
|
|
454
494
|
Object.keys(popups).forEach(groupName => {
|
|
455
495
|
const groupPopups = popups[groupName] || [];
|
|
@@ -464,6 +504,7 @@ const Popup = function (Component) {
|
|
|
464
504
|
position,
|
|
465
505
|
positionsOffset = {}
|
|
466
506
|
} = popup.state;
|
|
507
|
+
|
|
467
508
|
if (placeHolderElement && dropElement) {
|
|
468
509
|
const scrollContainer = placeHolderElement.closest('[data-scroll=true]') || document.body;
|
|
469
510
|
requestAnimationFrame(() => {
|
|
@@ -490,9 +531,7 @@ const Popup = function (Component) {
|
|
|
490
531
|
left = '',
|
|
491
532
|
top = ''
|
|
492
533
|
} = viewsOffset[view] || {};
|
|
493
|
-
const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top;
|
|
494
|
-
|
|
495
|
-
// let isInViewPort = viewPort.isInViewPort(
|
|
534
|
+
const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top; // let isInViewPort = viewPort.isInViewPort(
|
|
496
535
|
// placeHolderElement,
|
|
497
536
|
// scrollContainer
|
|
498
537
|
// );
|
|
@@ -506,9 +545,7 @@ const Popup = function (Component) {
|
|
|
506
545
|
popupOffset,
|
|
507
546
|
isAbsolutePositioningNeeded: isAbsolute
|
|
508
547
|
});
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
// if (!isInViewPort && !isAbsolute) {
|
|
548
|
+
} // if (!isInViewPort && !isAbsolute) {
|
|
512
549
|
// popup.setState({ isPopupOpen: false, isPopupReady: false });
|
|
513
550
|
// } else if (view && changeState) {
|
|
514
551
|
// popup.setState({
|
|
@@ -520,6 +557,7 @@ const Popup = function (Component) {
|
|
|
520
557
|
// isAbsolutePositioningNeeded: isAbsolute
|
|
521
558
|
// });
|
|
522
559
|
// }
|
|
560
|
+
|
|
523
561
|
});
|
|
524
562
|
}
|
|
525
563
|
}
|
|
@@ -530,6 +568,7 @@ const Popup = function (Component) {
|
|
|
530
568
|
handleResize() {
|
|
531
569
|
this.handleOpenPopupPositionChange();
|
|
532
570
|
}
|
|
571
|
+
|
|
533
572
|
handleScroll(e) {
|
|
534
573
|
// this.handleOpenPopupPositionChange();
|
|
535
574
|
const {
|
|
@@ -538,14 +577,17 @@ const Popup = function (Component) {
|
|
|
538
577
|
const {
|
|
539
578
|
isPopupReady
|
|
540
579
|
} = this.state;
|
|
580
|
+
|
|
541
581
|
if (isPopupReady) {
|
|
542
582
|
console.log('onscrollPopupREady');
|
|
543
583
|
}
|
|
584
|
+
|
|
544
585
|
if (isPopupReady && closeOnScroll) {
|
|
545
586
|
console.log(this, 'handle Scroll');
|
|
546
587
|
this.togglePopup(e);
|
|
547
588
|
}
|
|
548
589
|
}
|
|
590
|
+
|
|
549
591
|
handlePopupResize(popupSize) {
|
|
550
592
|
const {
|
|
551
593
|
height,
|
|
@@ -559,17 +601,22 @@ const Popup = function (Component) {
|
|
|
559
601
|
isPopupReady,
|
|
560
602
|
position
|
|
561
603
|
} = this.state;
|
|
604
|
+
|
|
562
605
|
if (isPopupReady && this.size && (oldHeight !== height || width !== oldWidth)) {
|
|
563
606
|
this.handlePopupPosition(position, true);
|
|
564
607
|
}
|
|
608
|
+
|
|
565
609
|
this.size = popupSize;
|
|
566
610
|
}
|
|
611
|
+
|
|
567
612
|
getTargetRef(el) {
|
|
568
613
|
this.placeHolderElement = el;
|
|
569
614
|
}
|
|
615
|
+
|
|
570
616
|
getContainerRef(el) {
|
|
571
617
|
this.dropElement = el;
|
|
572
618
|
}
|
|
619
|
+
|
|
573
620
|
render() {
|
|
574
621
|
const {
|
|
575
622
|
isPopupReady,
|
|
@@ -585,11 +632,14 @@ const Popup = function (Component) {
|
|
|
585
632
|
getContainerRef: this.getContainerRef
|
|
586
633
|
}));
|
|
587
634
|
}
|
|
635
|
+
|
|
588
636
|
}
|
|
637
|
+
|
|
589
638
|
Popup.displayName = Component.displayName || Component.name || Popup.name;
|
|
590
639
|
Popup.contextTypes = {
|
|
591
640
|
direction: PropTypes.string
|
|
592
641
|
};
|
|
593
642
|
return hoistStatics(Popup, Component);
|
|
594
643
|
};
|
|
644
|
+
|
|
595
645
|
export default Popup;
|
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
/* eslint-disable no-undef */
|
|
2
|
+
|
|
2
3
|
/**** Libraries ****/
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import ReactDOM from 'react-dom';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
/**** Components ****/
|
|
8
|
+
|
|
7
9
|
import Popup from '../Popup';
|
|
10
|
+
|
|
8
11
|
class SamplePopup extends React.Component {
|
|
9
12
|
constructor(props) {
|
|
10
13
|
super(props);
|
|
11
14
|
}
|
|
15
|
+
|
|
12
16
|
render() {
|
|
13
17
|
return /*#__PURE__*/React.createElement("div", null, "Sample Popup");
|
|
14
18
|
}
|
|
19
|
+
|
|
15
20
|
}
|
|
21
|
+
|
|
16
22
|
class SamplePopupCopy extends React.Component {
|
|
17
23
|
constructor(props) {
|
|
18
24
|
super(props);
|
|
19
25
|
}
|
|
26
|
+
|
|
20
27
|
render() {
|
|
21
28
|
return /*#__PURE__*/React.createElement("div", {
|
|
22
29
|
"data-id": "samplePopup",
|
|
@@ -25,26 +32,33 @@ class SamplePopupCopy extends React.Component {
|
|
|
25
32
|
}
|
|
26
33
|
}, "Sample Popup");
|
|
27
34
|
}
|
|
35
|
+
|
|
28
36
|
}
|
|
37
|
+
|
|
29
38
|
SamplePopupCopy.propTypes = {
|
|
30
39
|
removeClose: PropTypes.func
|
|
31
40
|
};
|
|
41
|
+
|
|
32
42
|
class SamplePopupCopy1 extends React.Component {
|
|
33
43
|
constructor(props) {
|
|
34
44
|
super(props);
|
|
35
45
|
}
|
|
46
|
+
|
|
36
47
|
render() {
|
|
37
48
|
return /*#__PURE__*/React.createElement("div", {
|
|
38
49
|
"data-id": "samplePopup"
|
|
39
50
|
}, "Sample Popup");
|
|
40
51
|
}
|
|
52
|
+
|
|
41
53
|
}
|
|
54
|
+
|
|
42
55
|
describe('Popup component conditions', () => {
|
|
43
56
|
it('should click same popup with removeClose', () => {
|
|
44
57
|
let PopupWrapperComponent = Popup(SamplePopupCopy);
|
|
45
58
|
let div = document.createElement('div');
|
|
46
59
|
document.body.append(div);
|
|
47
60
|
/*eslint-disable */
|
|
61
|
+
|
|
48
62
|
let popupDom = ReactDOM.render( /*#__PURE__*/React.createElement(PopupWrapperComponent, null), div);
|
|
49
63
|
/*eslint-enable */
|
|
50
64
|
|
|
@@ -87,6 +101,7 @@ describe('Popup component conditions', () => {
|
|
|
87
101
|
let div = document.createElement('div');
|
|
88
102
|
document.body.append(div);
|
|
89
103
|
/*eslint-disable */
|
|
104
|
+
|
|
90
105
|
let popupDom = ReactDOM.render( /*#__PURE__*/React.createElement(PopupWrapperComponent, null), div);
|
|
91
106
|
/*eslint-enable */
|
|
92
107
|
|
|
@@ -108,15 +123,12 @@ describe('Popup component conditions', () => {
|
|
|
108
123
|
let PopupWrapperComponent = Popup(SamplePopupCopy1);
|
|
109
124
|
let popupDom = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(PopupWrapperComponent, null));
|
|
110
125
|
popupDom.togglePopup();
|
|
111
|
-
expect(popupDom.state.isPopupOpen).toBeTruthy();
|
|
126
|
+
expect(popupDom.state.isPopupOpen).toBeTruthy(); //TestUtils.Simulate.keyUp(document, {keyCode:27});
|
|
112
127
|
|
|
113
|
-
//TestUtils.Simulate.keyUp(document, {keyCode:27});
|
|
114
128
|
let e = document.createEvent('HTMLEvents');
|
|
115
129
|
e.initEvent('keyup', false, true);
|
|
116
130
|
e.keyCode = 27;
|
|
117
131
|
document.dispatchEvent(e);
|
|
118
132
|
expect(popupDom.state.isPopupOpen).toBeFalsy();
|
|
119
133
|
});
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
//Group Popup Handling Open and close
|
|
134
|
+
}); //Group Popup Handling Open and close
|
package/es/Popup/viewPort.js
CHANGED
|
@@ -4,6 +4,7 @@ let viewPort = {
|
|
|
4
4
|
if (!el) {
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
|
+
|
|
7
8
|
let rectTemp = el.getBoundingClientRect();
|
|
8
9
|
let rect = {
|
|
9
10
|
height: rectTemp.height || el.clientHeight,
|
|
@@ -26,9 +27,11 @@ let viewPort = {
|
|
|
26
27
|
x: 0,
|
|
27
28
|
y: 0
|
|
28
29
|
};
|
|
30
|
+
|
|
29
31
|
if (customFrame) {
|
|
30
32
|
customFrameRect = customFrame.getBoundingClientRect();
|
|
31
33
|
}
|
|
34
|
+
|
|
32
35
|
let newRect = {
|
|
33
36
|
top: rect.top - customFrameRect.top,
|
|
34
37
|
left: rect.left - customFrameRect.left,
|
|
@@ -61,6 +64,7 @@ let viewPort = {
|
|
|
61
64
|
if (!el) {
|
|
62
65
|
return;
|
|
63
66
|
}
|
|
67
|
+
|
|
64
68
|
let elRects = viewPort.frameRelativeRects(el, customFrame);
|
|
65
69
|
let {
|
|
66
70
|
rect
|
|
@@ -78,9 +82,11 @@ let viewPort = {
|
|
|
78
82
|
needArrow,
|
|
79
83
|
isAbsolute
|
|
80
84
|
} = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
85
|
+
|
|
81
86
|
if (!el) {
|
|
82
87
|
return;
|
|
83
88
|
}
|
|
89
|
+
|
|
84
90
|
let elViewPortEle = viewPort.getViewPortEle(el);
|
|
85
91
|
let elRects = viewPort.frameRelativeRects(el, customFrame, elViewPortEle);
|
|
86
92
|
let {
|
|
@@ -95,13 +101,12 @@ let viewPort = {
|
|
|
95
101
|
let relativeBoxDocumentRects = viewPort.frameRelativeRects(relativeBox, customFrame);
|
|
96
102
|
let {
|
|
97
103
|
rectGap: documentGap
|
|
98
|
-
} = relativeBoxDocumentRects;
|
|
99
|
-
|
|
100
|
-
//rect => PopOverContainer, relativeBoxGap => PopOverTarget
|
|
101
|
-
|
|
104
|
+
} = relativeBoxDocumentRects; //rect => PopOverContainer, relativeBoxGap => PopOverTarget
|
|
102
105
|
//Horizontal ~ ----- X axis
|
|
103
106
|
//Vertical ~ ||||||| Y axis
|
|
107
|
+
|
|
104
108
|
let paddingSpace = 5; // space between target and relative element
|
|
109
|
+
|
|
105
110
|
let arrowSize = needArrow ? 10 : 0;
|
|
106
111
|
rect.height = rect.height + (needArrow ? arrowSize : paddingSpace);
|
|
107
112
|
rect.width = rect.width + (needArrow ? arrowSize : paddingSpace);
|
|
@@ -284,6 +289,7 @@ let viewPort = {
|
|
|
284
289
|
if (!el) {
|
|
285
290
|
return;
|
|
286
291
|
}
|
|
292
|
+
|
|
287
293
|
let elRects = viewPort.frameRelativeRects(el, customFrame);
|
|
288
294
|
let {
|
|
289
295
|
rectGap
|
|
@@ -310,9 +316,11 @@ let viewPort = {
|
|
|
310
316
|
needArrow,
|
|
311
317
|
isAbsolute
|
|
312
318
|
});
|
|
319
|
+
|
|
313
320
|
if (!viewPortPossibilities) {
|
|
314
321
|
return;
|
|
315
322
|
}
|
|
323
|
+
|
|
316
324
|
let {
|
|
317
325
|
views,
|
|
318
326
|
viewsOffset,
|
|
@@ -321,10 +329,12 @@ let viewPort = {
|
|
|
321
329
|
} = viewPortPossibilities;
|
|
322
330
|
let view = null;
|
|
323
331
|
let isViewFound = false;
|
|
332
|
+
|
|
324
333
|
if (!isViewFound && defaultView && views[defaultView]) {
|
|
325
334
|
view = defaultView;
|
|
326
335
|
isViewFound = true;
|
|
327
336
|
}
|
|
337
|
+
|
|
328
338
|
if (!isViewFound) {
|
|
329
339
|
if (customOrder.length > 0) {
|
|
330
340
|
isViewFound = customOrder.some(position => {
|
|
@@ -342,9 +352,11 @@ let viewPort = {
|
|
|
342
352
|
});
|
|
343
353
|
}
|
|
344
354
|
}
|
|
355
|
+
|
|
345
356
|
if (!isViewFound) {
|
|
346
357
|
view = defaultView;
|
|
347
358
|
}
|
|
359
|
+
|
|
348
360
|
return {
|
|
349
361
|
view,
|
|
350
362
|
views,
|