@zohodesk/components 1.0.0-temp-210.3 → 1.0.0-temp-212
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/.cli/propValidation_report.html +1 -1
- package/README.md +5 -4
- package/es/Accordion/Accordion.js +2 -2
- package/es/Accordion/AccordionItem.js +4 -4
- package/es/Accordion/__tests__/Accordion.spec.js +1 -1
- package/es/Accordion/__tests__/AccordionItem.spec.js +1 -1
- package/es/Accordion/index.js +2 -2
- package/es/Animation/Animation.js +3 -3
- package/es/Animation/__tests__/Animation.spec.js +1 -1
- package/es/Animation/utils.js +1 -1
- package/es/AppContainer/AppContainer.js +9 -9
- package/es/AppContainer/__tests__/AppContainer.spec.js +1 -1
- package/es/Avatar/Avatar.js +5 -5
- package/es/Avatar/__tests__/Avatar.spec.js +1 -1
- package/es/AvatarTeam/AvatarTeam.js +4 -4
- package/es/AvatarTeam/__tests__/AvatarTeam.spec.js +1 -1
- package/es/Button/Button.js +13 -6
- package/es/Button/__tests__/Button.spec.js +1 -1
- package/es/Button/css/Button.module.css +78 -0
- package/es/Button/css/cssJSLogic.js +7 -3
- package/es/Button/index.js +2 -2
- package/es/Button/props/defaultProps.js +1 -1
- package/es/Buttongroup/Buttongroup.js +3 -3
- package/es/Buttongroup/__tests__/Buttongroup.spec.js +1 -1
- package/es/Card/Card.js +5 -5
- package/es/Card/__tests__/Card.spec.js +1 -1
- package/es/Card/index.js +4 -4
- package/es/CheckBox/CheckBox.js +6 -6
- package/es/CheckBox/__tests__/CheckBox.spec.js +1 -1
- package/es/DateTime/CalendarView.js +6 -6
- package/es/DateTime/DateTime.js +15 -15
- package/es/DateTime/DateTimePopupFooter.js +5 -5
- package/es/DateTime/DateTimePopupHeader.js +4 -4
- package/es/DateTime/DateWidget.js +17 -17
- package/es/DateTime/DaysRow.js +3 -3
- package/es/DateTime/Time.js +5 -5
- package/es/DateTime/YearView.js +6 -6
- package/es/DateTime/__tests__/CalendarView.spec.js +1 -1
- package/es/DateTime/__tests__/DateTime.spec.js +1 -1
- package/es/DateTime/__tests__/DateTimePopupFooter.spec.js +1 -1
- package/es/DateTime/__tests__/DateTimePopupHeader.spec.js +1 -1
- package/es/DateTime/__tests__/DateWidget.spec.js +1 -1
- package/es/DateTime/__tests__/DaysRow.spec.js +1 -1
- package/es/DateTime/__tests__/Time.spec.js +1 -1
- package/es/DateTime/__tests__/YearView.spec.js +1 -1
- package/es/DateTime/dateFormatUtils/dateFormat.js +4 -4
- package/es/DateTime/dateFormatUtils/dayChange.js +2 -2
- package/es/DateTime/dateFormatUtils/index.js +3 -3
- package/es/DateTime/dateFormatUtils/monthChange.js +2 -2
- package/es/DateTime/dateFormatUtils/timeChange.js +2 -2
- package/es/DateTime/dateFormatUtils/yearChange.js +2 -2
- package/es/DateTime/index.js +1 -1
- package/es/DateTime/props/propTypes.js +1 -1
- package/es/DateTime/validator.js +2 -2
- package/es/DropBox/DropBox.js +9 -9
- package/es/DropBox/DropBoxElement/DropBoxElement.js +6 -6
- package/es/DropBox/DropBoxElement/__tests__/DropBoxElement.spec.js +1 -1
- package/es/DropBox/DropBoxElement/css/cssJSLogic.js +1 -1
- package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +1 -1
- package/es/DropBox/__tests__/DropBox.spec.js +1 -1
- package/es/DropBox/css/cssJSLogic.js +1 -1
- package/es/DropBox/props/defaultProps.js +1 -1
- package/es/DropBox/props/propTypes.js +1 -1
- package/es/DropBox/utils/isMobilePopover.js +1 -1
- package/es/DropDown/DropDown.js +4 -4
- package/es/DropDown/DropDownHeading.js +3 -3
- package/es/DropDown/DropDownItem.js +3 -3
- package/es/DropDown/DropDownSearch.js +4 -4
- package/es/DropDown/DropDownSeparator.js +2 -2
- package/es/DropDown/__tests__/DropDown.spec.js +1 -1
- package/es/DropDown/__tests__/DropDownHeading.spec.js +1 -1
- package/es/DropDown/__tests__/DropDownItem.spec.js +1 -1
- package/es/DropDown/__tests__/DropDownSearch.spec.js +1 -1
- package/es/DropDown/__tests__/DropDownSeparator.spec.js +1 -1
- package/es/DropDown/index.js +7 -7
- package/es/DropDown/props/propTypes.js +1 -1
- package/es/Heading/Heading.js +4 -4
- package/es/Heading/__tests__/Heading.spec.js +1 -1
- package/es/Label/Label.js +4 -4
- package/es/Label/__tests__/Label.spec.js +1 -1
- package/es/Layout/Box.js +4 -4
- package/es/Layout/Container.js +4 -4
- package/es/Layout/__tests__/Box.spec.js +1 -1
- package/es/Layout/__tests__/Container.spec.js +1 -1
- package/es/Layout/index.js +2 -2
- package/es/ListItem/ListContainer.js +6 -6
- package/es/ListItem/ListItem.js +5 -5
- package/es/ListItem/ListItemWithAvatar.js +7 -7
- package/es/ListItem/ListItemWithCheckBox.js +6 -6
- package/es/ListItem/ListItemWithIcon.js +5 -5
- package/es/ListItem/ListItemWithRadio.js +6 -6
- package/es/ListItem/__tests__/ListContainer.spec.js +1 -1
- package/es/ListItem/__tests__/ListItem.spec.js +1 -1
- package/es/ListItem/__tests__/ListItemWithAvatar.spec.js +1 -1
- package/es/ListItem/__tests__/ListItemWithCheckBox.spec.js +1 -1
- package/es/ListItem/__tests__/ListItemWithIcon.spec.js +1 -1
- package/es/ListItem/__tests__/ListItemWithRadio.spec.js +1 -1
- package/es/ListItem/index.js +6 -6
- package/es/Modal/Modal.js +3 -3
- package/es/Modal/__tests__/Modal.spec.js +1 -1
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +17 -17
- package/es/MultiSelect/AdvancedMultiSelect.js +17 -17
- package/es/MultiSelect/EmptyState.js +3 -3
- package/es/MultiSelect/MobileHeader/MobileHeader.js +5 -5
- package/es/MultiSelect/MobileHeader/__tests__/MobileHeader.spec.js +1 -1
- package/es/MultiSelect/MultiSelect.js +20 -20
- package/es/MultiSelect/MultiSelectHeader.js +4 -4
- package/es/MultiSelect/MultiSelectWithAvatar.js +16 -16
- package/es/MultiSelect/SelectedOptions.js +5 -5
- package/es/MultiSelect/Suggestions.js +6 -6
- package/es/MultiSelect/__tests__/AdvancedGroupMultiSelect.spec.js +1 -1
- package/es/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +1 -1
- package/es/MultiSelect/__tests__/EmptyState.spec.js +1 -1
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +1 -1
- package/es/MultiSelect/__tests__/MultiSelectHeader.spec.js +1 -1
- package/es/MultiSelect/__tests__/MultiSelectWithAvatar.spec.js +1 -1
- package/es/MultiSelect/__tests__/SelectedOptions.spec.js +1 -1
- package/es/MultiSelect/__tests__/Suggestions.spec.js +1 -1
- package/es/MultiSelect/index.js +4 -4
- package/es/MultiSelect/props/defaultProps.js +1 -1
- package/es/PopOver/PopOver.js +6 -6
- package/es/PopOver/__tests__/PopOver.spec.js +1 -1
- package/es/PopOver/index.js +3 -3
- package/es/Popup/Popup.js +11 -109
- package/es/Provider/AvatarSize.js +1 -1
- package/es/Provider/CssProvider.js +1 -1
- package/es/Provider/IdProvider.js +2 -2
- package/es/Provider/LibraryContext.js +5 -3
- package/es/Provider/ZindexProvider.js +2 -2
- package/es/Provider/index.js +4 -4
- package/es/Radio/Radio.js +5 -5
- package/es/Radio/__tests__/Radio.spec.js +1 -1
- package/es/Responsive/CustomResponsive.js +7 -7
- package/es/Responsive/ResizeComponent.js +2 -2
- package/es/Responsive/ResizeObserver.js +21 -85
- package/es/Responsive/ResizeObserverWithPolyfill.js +140 -0
- package/es/Responsive/Responsive.js +6 -6
- package/es/Responsive/index.js +3 -3
- package/es/Responsive/utils/index.js +1 -1
- package/es/Responsive/windowResizeObserver.js +1 -1
- package/es/ResponsiveDropBox/ResponsiveDropBox.js +6 -6
- package/es/ResponsiveDropBox/__tests__/ResponsiveDropBox.spec.js +1 -1
- package/es/ResponsiveDropBox/props/propTypes.js +1 -1
- package/es/Ribbon/Ribbon.js +3 -3
- package/es/Ribbon/__tests__/Ribbon.spec.js +1 -1
- package/es/RippleEffect/RippleEffect.js +4 -4
- package/es/RippleEffect/__tests__/RippleEffect.spec.js +1 -1
- package/es/Select/GroupSelect.js +16 -16
- package/es/Select/Select.js +15 -15
- package/es/Select/SelectWithAvatar.js +17 -17
- package/es/Select/SelectWithIcon.js +13 -13
- package/es/Select/__tests__/GroupSelect.spec.js +1 -1
- package/es/Select/__tests__/Select.spec.js +1 -1
- package/es/Select/__tests__/SelectWithAvatar.spec.js +1 -1
- package/es/Select/__tests__/SelectWithIcon.spec.js +1 -1
- package/es/Select/index.js +4 -4
- package/es/Select/props/defaultProps.js +1 -1
- package/es/Stencils/Stencils.js +3 -3
- package/es/Stencils/__tests__/Stencils.spec.js +1 -1
- package/es/Switch/Switch.js +5 -5
- package/es/Switch/__tests__/Switch.spec.js +1 -1
- package/es/Tab/Tab.js +5 -5
- package/es/Tab/TabContent.js +4 -4
- package/es/Tab/TabContentWrapper.js +3 -3
- package/es/Tab/TabWrapper.js +3 -3
- package/es/Tab/Tabs.js +13 -13
- package/es/Tab/__tests__/Tab.spec.js +1 -1
- package/es/Tab/__tests__/TabContent.spec.js +1 -1
- package/es/Tab/__tests__/TabContentWrapper.spec.js +1 -1
- package/es/Tab/__tests__/TabWrapper.spec.js +1 -1
- package/es/Tab/__tests__/Tabs.spec.js +1 -1
- package/es/Tab/index.js +5 -5
- package/es/Tag/Tag.js +7 -7
- package/es/Tag/__tests__/Tag.spec.js +1 -1
- package/es/TextBox/TextBox.js +3 -3
- package/es/TextBox/__tests__/TextBox.spec.js +1 -1
- package/es/TextBoxIcon/TextBoxIcon.js +6 -6
- package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +1 -1
- package/es/TextBoxIcon/props/propTypes.js +1 -1
- package/es/Textarea/Textarea.js +3 -3
- package/es/Textarea/__tests__/Textarea.spec.js +1 -1
- package/es/Tooltip/Tooltip.js +6 -6
- package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +3 -3
- package/es/VelocityAnimation/VelocityAnimation/__tests__/VelocityAnimation.spec.js +1 -1
- package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +3 -3
- package/es/VelocityAnimation/VelocityAnimationGroup/__tests__/VelocityAnimationGroup.spec.js +1 -1
- package/es/VelocityAnimation/index.js +2 -2
- package/es/css.js +37 -37
- package/es/deprecated/PortalLayer/PortalLayer.js +3 -3
- package/es/index.js +39 -39
- package/es/semantic/Button/Button.js +3 -3
- package/es/semantic/Button/__tests__/Button.spec.js +1 -1
- package/es/semantic/index.js +1 -1
- package/es/utils/Common.js +1 -1
- package/es/utils/ContextOptimizer.js +1 -1
- package/es/utils/cssUtils.js +1 -1
- package/es/utils/datetime/common.js +1 -1
- package/es/utils/dropDownUtils.js +1 -1
- package/es/utils/index.js +1 -1
- package/es/v1/Accordion/Accordion.js +2 -2
- package/es/v1/Accordion/AccordionItem.js +4 -4
- package/es/v1/Accordion/index.js +2 -2
- package/es/v1/Animation/Animation.js +3 -3
- package/es/v1/Animation/utils.js +1 -1
- package/es/v1/AppContainer/AppContainer.js +8 -8
- package/es/v1/Avatar/Avatar.js +5 -5
- package/es/v1/AvatarTeam/AvatarTeam.js +4 -4
- package/es/v1/Button/Button.js +4 -4
- package/es/v1/Button/props/defaultProps.js +1 -1
- package/es/v1/Buttongroup/Buttongroup.js +3 -3
- package/es/v1/Card/Card.js +5 -5
- package/es/v1/Card/index.js +4 -4
- package/es/v1/CheckBox/CheckBox.js +6 -6
- package/es/v1/DateTime/CalendarView.js +7 -7
- package/es/v1/DateTime/DateTime.js +15 -15
- package/es/v1/DateTime/DateTimePopupFooter.js +5 -5
- package/es/v1/DateTime/DateTimePopupHeader.js +4 -4
- package/es/v1/DateTime/DateWidget.js +17 -17
- package/es/v1/DateTime/DaysRow.js +3 -3
- package/es/v1/DateTime/Time.js +5 -5
- package/es/v1/DateTime/YearView.js +6 -6
- package/es/v1/DateTime/index.js +1 -1
- package/es/v1/DateTime/props/propTypes.js +1 -1
- package/es/v1/DropBox/DropBox.js +9 -9
- package/es/v1/DropBox/DropBoxElement/DropBoxElement.js +6 -6
- package/es/v1/DropBox/props/defaultProps.js +1 -1
- package/es/v1/DropBox/props/propTypes.js +1 -1
- package/es/v1/DropBox/utils/isMobilePopover.js +1 -1
- package/es/v1/DropDown/DropDown.js +4 -4
- package/es/v1/DropDown/DropDownHeading.js +3 -3
- package/es/v1/DropDown/DropDownItem.js +3 -3
- package/es/v1/DropDown/DropDownSearch.js +4 -4
- package/es/v1/DropDown/DropDownSeparator.js +2 -2
- package/es/v1/DropDown/props/propTypes.js +1 -1
- package/es/v1/Heading/Heading.js +4 -4
- package/es/v1/Label/Label.js +4 -4
- package/es/v1/Layout/Box.js +4 -4
- package/es/v1/Layout/Container.js +4 -4
- package/es/v1/Layout/index.js +2 -2
- package/es/v1/ListItem/ListContainer.js +6 -6
- package/es/v1/ListItem/ListItem.js +5 -5
- package/es/v1/ListItem/ListItemWithAvatar.js +7 -7
- package/es/v1/ListItem/ListItemWithCheckBox.js +6 -6
- package/es/v1/ListItem/ListItemWithIcon.js +5 -5
- package/es/v1/ListItem/ListItemWithRadio.js +6 -6
- package/es/v1/ListItem/index.js +6 -6
- package/es/v1/Modal/Modal.js +3 -3
- package/es/v1/MultiSelect/AdvancedGroupMultiSelect.js +17 -17
- package/es/v1/MultiSelect/AdvancedMultiSelect.js +17 -17
- package/es/v1/MultiSelect/EmptyState.js +3 -3
- package/es/v1/MultiSelect/MobileHeader/MobileHeader.js +5 -5
- package/es/v1/MultiSelect/MultiSelect.js +19 -19
- package/es/v1/MultiSelect/MultiSelectHeader.js +4 -4
- package/es/v1/MultiSelect/MultiSelectWithAvatar.js +16 -16
- package/es/v1/MultiSelect/SelectedOptions.js +5 -5
- package/es/v1/MultiSelect/Suggestions.js +6 -6
- package/es/v1/MultiSelect/index.js +4 -4
- package/es/v1/MultiSelect/props/defaultProps.js +1 -1
- package/es/v1/PopOver/PopOver.js +6 -6
- package/es/v1/Popup/Popup.js +11 -99
- package/es/v1/Radio/Radio.js +5 -5
- package/es/v1/ResponsiveDropBox/ResponsiveDropBox.js +6 -6
- package/es/v1/ResponsiveDropBox/props/propTypes.js +1 -1
- package/es/v1/Ribbon/Ribbon.js +3 -3
- package/es/v1/RippleEffect/RippleEffect.js +4 -4
- package/es/v1/Select/GroupSelect.js +16 -16
- package/es/v1/Select/Select.js +15 -15
- package/es/v1/Select/SelectWithAvatar.js +17 -17
- package/es/v1/Select/SelectWithIcon.js +13 -13
- package/es/v1/Select/index.js +4 -4
- package/es/v1/Select/props/defaultProps.js +1 -1
- package/es/v1/Stencils/Stencils.js +3 -3
- package/es/v1/Switch/Switch.js +5 -5
- package/es/v1/Tab/Tab.js +5 -5
- package/es/v1/Tab/TabContent.js +4 -4
- package/es/v1/Tab/TabContentWrapper.js +3 -3
- package/es/v1/Tab/TabWrapper.js +3 -3
- package/es/v1/Tab/Tabs.js +13 -13
- package/es/v1/Tab/index.js +5 -5
- package/es/v1/Tag/Tag.js +7 -7
- package/es/v1/TextBox/TextBox.js +3 -3
- package/es/v1/TextBoxIcon/TextBoxIcon.js +6 -6
- package/es/v1/TextBoxIcon/props/propTypes.js +1 -1
- package/es/v1/Textarea/Textarea.js +3 -3
- package/es/v1/Tooltip/Tooltip.js +6 -6
- package/es/v1/Typography/Typography.js +4 -4
- package/es/v1/Typography/css/cssJSLogic.js +1 -1
- package/es/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +3 -3
- package/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +3 -3
- package/es/v1/semantic/Button/Button.js +3 -3
- package/es/v1/semantic/index.js +1 -1
- package/lib/Button/Button.js +24 -2
- package/lib/Button/css/Button.module.css +78 -0
- package/lib/Button/css/cssJSLogic.js +13 -10
- package/lib/Popup/Popup.js +9 -117
- package/lib/Provider/LibraryContext.js +3 -1
- package/lib/Responsive/ResizeObserver.js +20 -88
- package/lib/Responsive/ResizeObserverWithPolyfill.js +168 -0
- package/lib/v1/Popup/Popup.js +9 -105
- package/package.json +6 -6
- package/result.json +1 -1
- package/es/Popup/intersectionObserver.js +0 -39
- package/es/Popup/props/propTypes.js +0 -31
- package/lib/Popup/intersectionObserver.js +0 -62
- package/lib/Popup/props/propTypes.js +0 -44
package/es/PopOver/PopOver.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { PopOver_defaultProps, PopOverContainer_defaultProps } from
|
|
3
|
-
import { PopOver_propTypes, PopOverTarget_propTypes, PopOverContainer_propTypes } from
|
|
4
|
-
import Popup from
|
|
5
|
-
import { Box } from
|
|
6
|
-
import ResponsiveDropBox from
|
|
7
|
-
import style from
|
|
2
|
+
import { PopOver_defaultProps, PopOverContainer_defaultProps } from './props/defaultProps';
|
|
3
|
+
import { PopOver_propTypes, PopOverTarget_propTypes, PopOverContainer_propTypes } from './props/propTypes';
|
|
4
|
+
import Popup from '../Popup/Popup';
|
|
5
|
+
import { Box } from '../Layout';
|
|
6
|
+
import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
|
|
7
|
+
import style from './PopOver.module.css';
|
|
8
8
|
|
|
9
9
|
class PopOver extends React.Component {
|
|
10
10
|
constructor(props) {
|
package/es/PopOver/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as PopOver } from
|
|
2
|
-
export { PopOverTarget } from
|
|
3
|
-
export { PopOverContainer } from
|
|
1
|
+
export { default as PopOver } from './PopOver';
|
|
2
|
+
export { PopOverTarget } from './PopOver';
|
|
3
|
+
export { PopOverContainer } from './PopOver';
|
package/es/Popup/Popup.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**** Libraries ****/
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
3
4
|
import hoistStatics from 'hoist-non-react-statics';
|
|
4
|
-
import { PopupPropTypes, ContextTypes } from "./props/propTypes";
|
|
5
5
|
/**** Methods ****/
|
|
6
6
|
|
|
7
|
-
import { debounce, isDescendant, isTextSelected, cancelBubblingEffect } from
|
|
8
|
-
import viewPort from
|
|
9
|
-
import { absolutePositionMapping, rtlAbsolutePositionMapping, rtlFixedPositionMapping } from
|
|
7
|
+
import { debounce, isDescendant, isTextSelected, cancelBubblingEffect } from '../utils/Common.js';
|
|
8
|
+
import viewPort from './viewPort';
|
|
9
|
+
import { absolutePositionMapping, rtlAbsolutePositionMapping, rtlFixedPositionMapping } from './PositionMapping.js';
|
|
10
10
|
import ResizeObserver from '@zohodesk/virtualizer/lib/commons/ResizeObserver.js';
|
|
11
|
-
import { addIntersectionObserver, removeIntersectionObserver } from "./intersectionObserver";
|
|
12
11
|
let lastOpenedGroup = [];
|
|
13
12
|
let popups = {};
|
|
14
13
|
|
|
@@ -90,12 +89,6 @@ const Popup = function (Component) {
|
|
|
90
89
|
this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
|
|
91
90
|
this.handleDocumentFocus = this.handleDocumentFocus.bind(this);
|
|
92
91
|
this.handleGetNeedPrevent = this.handleGetNeedPrevent.bind(this);
|
|
93
|
-
this.handleBlockScroll = this.handleBlockScroll.bind(this);
|
|
94
|
-
this.handlePositionChange = this.handlePositionChange.bind(this);
|
|
95
|
-
this.preventKeyboardScroll = this.preventKeyboardScroll.bind(this);
|
|
96
|
-
this.addScrollBlockListeners = this.addScrollBlockListeners.bind(this);
|
|
97
|
-
this.removeScrollBlockListeners = this.removeScrollBlockListeners.bind(this);
|
|
98
|
-
this.handleIntersectionObserver = this.handleIntersectionObserver.bind(this);
|
|
99
92
|
this.popupObserver = new ResizeObserver(this.handlePopupResize); //dropBoxSize
|
|
100
93
|
|
|
101
94
|
this.size = null;
|
|
@@ -108,7 +101,6 @@ const Popup = function (Component) {
|
|
|
108
101
|
scrollDebounceTime
|
|
109
102
|
} = this.getScrollDebounceTime(this);
|
|
110
103
|
this.handleScroll = debounce(this.handleScroll.bind(this), scrollDebounceTime);
|
|
111
|
-
this.handleDebouncedPositionChange = debounce(this.handlePositionChange.bind(this), 100);
|
|
112
104
|
}
|
|
113
105
|
|
|
114
106
|
componentDidMount() {
|
|
@@ -152,9 +144,7 @@ const Popup = function (Component) {
|
|
|
152
144
|
dropElement
|
|
153
145
|
} = this;
|
|
154
146
|
const {
|
|
155
|
-
needResizeHandling: propResizeHandling
|
|
156
|
-
isAbsolutePositioningNeeded,
|
|
157
|
-
isOutsideScrollBlocked
|
|
147
|
+
needResizeHandling: propResizeHandling
|
|
158
148
|
} = this.props;
|
|
159
149
|
|
|
160
150
|
if (oldStateOpen !== isPopupReady) {
|
|
@@ -164,16 +154,6 @@ const Popup = function (Component) {
|
|
|
164
154
|
this.size = null;
|
|
165
155
|
this.popupObserver.disconnect();
|
|
166
156
|
}
|
|
167
|
-
|
|
168
|
-
if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
|
|
169
|
-
if (isPopupReady) {
|
|
170
|
-
addIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
|
|
171
|
-
this.addScrollBlockListeners();
|
|
172
|
-
} else {
|
|
173
|
-
removeIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
|
|
174
|
-
this.removeScrollBlockListeners();
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
157
|
}
|
|
178
158
|
}
|
|
179
159
|
|
|
@@ -189,7 +169,6 @@ const Popup = function (Component) {
|
|
|
189
169
|
|
|
190
170
|
return res;
|
|
191
171
|
}, popups);
|
|
192
|
-
this.removeScrollBlockListeners();
|
|
193
172
|
let noPopups = true;
|
|
194
173
|
|
|
195
174
|
for (const i in popups) {
|
|
@@ -214,82 +193,6 @@ const Popup = function (Component) {
|
|
|
214
193
|
}
|
|
215
194
|
}
|
|
216
195
|
|
|
217
|
-
addScrollBlockListeners() {
|
|
218
|
-
document.addEventListener('wheel', this.handleBlockScroll, {
|
|
219
|
-
capture: true,
|
|
220
|
-
passive: false
|
|
221
|
-
});
|
|
222
|
-
document.addEventListener('touchmove', this.handleBlockScroll, {
|
|
223
|
-
capture: true,
|
|
224
|
-
passive: false
|
|
225
|
-
});
|
|
226
|
-
document.addEventListener('scroll', this.handleDebouncedPositionChange, {
|
|
227
|
-
capture: true,
|
|
228
|
-
passive: false
|
|
229
|
-
});
|
|
230
|
-
document.addEventListener('keydown', this.preventKeyboardScroll, {
|
|
231
|
-
capture: true,
|
|
232
|
-
passive: false
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
removeScrollBlockListeners() {
|
|
237
|
-
document.removeEventListener('wheel', this.handleBlockScroll, {
|
|
238
|
-
capture: true,
|
|
239
|
-
passive: false
|
|
240
|
-
});
|
|
241
|
-
document.removeEventListener('touchmove', this.handleBlockScroll, {
|
|
242
|
-
capture: true,
|
|
243
|
-
passive: false
|
|
244
|
-
});
|
|
245
|
-
document.removeEventListener('scroll', this.handleDebouncedPositionChange, {
|
|
246
|
-
capture: true,
|
|
247
|
-
passive: false
|
|
248
|
-
});
|
|
249
|
-
document.removeEventListener('keydown', this.preventKeyboardScroll, {
|
|
250
|
-
capture: true,
|
|
251
|
-
passive: false
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
handleBlockScroll(event) {
|
|
256
|
-
// const targetElement = this.placeHolderElement;
|
|
257
|
-
const containerElement = this.dropElement;
|
|
258
|
-
|
|
259
|
-
if (containerElement && containerElement !== event.target && !containerElement.contains(event.target)) {
|
|
260
|
-
// --- Scroll exclude Target & Container elements --- For reference. Will adopt in future
|
|
261
|
-
// if(
|
|
262
|
-
// (containerElement && (containerElement !== event.target && !containerElement.contains(event.target)))
|
|
263
|
-
// && (targetElement && (targetElement !== event.target && !targetElement.contains(event.target)))
|
|
264
|
-
// ) {
|
|
265
|
-
event.preventDefault();
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
handlePositionChange(event) {
|
|
270
|
-
const targetElement = this.placeHolderElement;
|
|
271
|
-
const containerElement = this.dropElement;
|
|
272
|
-
|
|
273
|
-
if (containerElement && containerElement !== event.target && !containerElement.contains(event.target) && targetElement && targetElement !== event.target && !targetElement.contains(event.target) && event.target.contains(targetElement)) {
|
|
274
|
-
this.handlePopupPosition(this.state.position); // this.closePopupOnly(event);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
preventKeyboardScroll(event) {
|
|
279
|
-
const containerElement = this.dropElement;
|
|
280
|
-
const keys = [32, 37, 38, 39, 40]; // Space, Arrow keys
|
|
281
|
-
|
|
282
|
-
if (containerElement && containerElement !== event.target && !containerElement.contains(event.target) && keys.includes(event.keyCode)) {
|
|
283
|
-
event.preventDefault();
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
handleIntersectionObserver(entry) {
|
|
288
|
-
if (entry.intersectionRatio === 0) {
|
|
289
|
-
this.closePopupOnly();
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
196
|
getGroup() {
|
|
294
197
|
const {
|
|
295
198
|
popupGroup
|
|
@@ -620,15 +523,13 @@ const Popup = function (Component) {
|
|
|
620
523
|
} = betterPosition || {};
|
|
621
524
|
const {
|
|
622
525
|
left: oldLeft = '',
|
|
623
|
-
top: oldTop = ''
|
|
624
|
-
bottom: oldBottom = ''
|
|
526
|
+
top: oldTop = ''
|
|
625
527
|
} = positionsOffset[position] || {};
|
|
626
528
|
const {
|
|
627
529
|
left = '',
|
|
628
|
-
top = ''
|
|
629
|
-
bottom = ''
|
|
530
|
+
top = ''
|
|
630
531
|
} = viewsOffset[view] || {};
|
|
631
|
-
const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top
|
|
532
|
+
const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top; // let isInViewPort = viewPort.isInViewPort(
|
|
632
533
|
// placeHolderElement,
|
|
633
534
|
// scrollContainer
|
|
634
535
|
// );
|
|
@@ -734,8 +635,9 @@ const Popup = function (Component) {
|
|
|
734
635
|
}
|
|
735
636
|
|
|
736
637
|
Popup.displayName = Component.displayName || Component.name || Popup.name;
|
|
737
|
-
Popup.contextTypes =
|
|
738
|
-
|
|
638
|
+
Popup.contextTypes = {
|
|
639
|
+
direction: PropTypes.string
|
|
640
|
+
};
|
|
739
641
|
return hoistStatics(Popup, Component);
|
|
740
642
|
};
|
|
741
643
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useNumberGenerator, getNumberGenerators } from
|
|
2
|
-
import { getLibraryConfig } from
|
|
1
|
+
import { useNumberGenerator, getNumberGenerators } from './NumberGenerator/NumberGenerator';
|
|
2
|
+
import { getLibraryConfig } from './Config';
|
|
3
3
|
let globalId = getLibraryConfig('idCounter'),
|
|
4
4
|
deletedIndexes = [],
|
|
5
5
|
globalPrefix;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import LibraryContextInit from
|
|
4
|
-
import { getLibraryConfig } from
|
|
3
|
+
import LibraryContextInit from './LibraryContextInit';
|
|
4
|
+
import { getLibraryConfig } from './Config';
|
|
5
5
|
|
|
6
6
|
const LibraryContextProvider = _ref => {
|
|
7
7
|
let {
|
|
@@ -9,13 +9,15 @@ const LibraryContextProvider = _ref => {
|
|
|
9
9
|
direction,
|
|
10
10
|
coloredTagVariant,
|
|
11
11
|
hasTagColorInheritedToText,
|
|
12
|
+
a11y_strikeThroughButtons,
|
|
12
13
|
children
|
|
13
14
|
} = _ref;
|
|
14
15
|
const [value, setValue] = useState({
|
|
15
16
|
isReducedMotion,
|
|
16
17
|
direction,
|
|
17
18
|
coloredTagVariant,
|
|
18
|
-
hasTagColorInheritedToText
|
|
19
|
+
hasTagColorInheritedToText,
|
|
20
|
+
a11y_strikeThroughButtons
|
|
19
21
|
});
|
|
20
22
|
|
|
21
23
|
function setGlobalContext(key, data) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useNumberGenerator, getNumberGenerators } from
|
|
2
|
-
import { getLibraryConfig } from
|
|
1
|
+
import { useNumberGenerator, getNumberGenerators } from './NumberGenerator/NumberGenerator';
|
|
2
|
+
import { getLibraryConfig } from './Config';
|
|
3
3
|
let globalId = getLibraryConfig('zindexCounter'),
|
|
4
4
|
deletedIndexes = [],
|
|
5
5
|
globalPrefix;
|
package/es/Provider/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { getLibraryConfig, setLibraryConfig } from
|
|
2
|
-
export { default as LibraryContextProvider } from
|
|
3
|
-
export { removeGlobalZIndexPrefix, setInitialZIndex, useZIndex, getZIndex } from
|
|
4
|
-
export { setGlobalIdPrefix, removeGlobalIdPrefix, useUniqueId, getUniqueId } from
|
|
1
|
+
export { getLibraryConfig, setLibraryConfig } from './Config';
|
|
2
|
+
export { default as LibraryContextProvider } from './LibraryContext';
|
|
3
|
+
export { removeGlobalZIndexPrefix, setInitialZIndex, useZIndex, getZIndex } from './ZindexProvider';
|
|
4
|
+
export { setGlobalIdPrefix, removeGlobalIdPrefix, useUniqueId, getUniqueId } from './IdProvider';
|
package/es/Radio/Radio.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint css-modules/no-unused-class: [2, { markAsUsed: ['small', 'medium'] }] */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { defaultProps } from
|
|
4
|
-
import { propTypes } from
|
|
5
|
-
import Label from
|
|
6
|
-
import { Container, Box } from
|
|
7
|
-
import style from
|
|
3
|
+
import { defaultProps } from './props/defaultProps';
|
|
4
|
+
import { propTypes } from './props/propTypes';
|
|
5
|
+
import Label from '../Label/Label';
|
|
6
|
+
import { Container, Box } from '../Layout';
|
|
7
|
+
import style from './Radio.module.css';
|
|
8
8
|
export default class Radio extends React.Component {
|
|
9
9
|
constructor(props) {
|
|
10
10
|
super(props);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useState, useRef, useMemo } from 'react';
|
|
2
|
-
import { CustomResponsiveSender_defaultProps, CustomResponsiveReceiver_defaultProps } from
|
|
3
|
-
import { CustomResponsiveSender_propTypes, CustomResponsiveReceiver_propTypes } from
|
|
4
|
-
import ResizeObserver from
|
|
5
|
-
import DOMRefWrapper from
|
|
6
|
-
import shallowCompare from
|
|
7
|
-
import { isBreackPointMatched, Subscribale, isTouchDevice, windowResizeObserver } from
|
|
8
|
-
import { ContextOptimizer } from
|
|
2
|
+
import { CustomResponsiveSender_defaultProps, CustomResponsiveReceiver_defaultProps } from './props/defaultProps';
|
|
3
|
+
import { CustomResponsiveSender_propTypes, CustomResponsiveReceiver_propTypes } from './props/propTypes';
|
|
4
|
+
import ResizeObserver from './ResizeObserver';
|
|
5
|
+
import DOMRefWrapper from './RefWrapper';
|
|
6
|
+
import shallowCompare from './utils/shallowCompare';
|
|
7
|
+
import { isBreackPointMatched, Subscribale, isTouchDevice, windowResizeObserver } from './sizeObservers';
|
|
8
|
+
import { ContextOptimizer } from '../utils/ContextOptimizer'; // const commonBreakPoints = [ 480, 640, 768, 1024, 1440 ];
|
|
9
9
|
// const otherBreakPoints = [320, 360, 375, 720, 1280, 1600, 1920];
|
|
10
10
|
// defaultResponsiveId means if ResponsiveSender do not recive id This will be id
|
|
11
11
|
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// 2) debounce Mutation observer and resize observer
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import ResizeObserver from
|
|
8
|
-
import { getElementSpace, debounce } from
|
|
7
|
+
import ResizeObserver from './ResizeObserver';
|
|
8
|
+
import { getElementSpace, debounce } from '../utils/Common';
|
|
9
9
|
export default class ResizeComponent extends React.Component {
|
|
10
10
|
constructor(props) {
|
|
11
11
|
super(props);
|
|
@@ -1,68 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function getSize(element) {
|
|
9
|
-
let {
|
|
10
|
-
offsetHeight,
|
|
11
|
-
offsetWidth
|
|
12
|
-
} = element; // const { height, width } = element.getBoundingClientRect();
|
|
1
|
+
function getBorderBoxSizeFromEntry(entry) {
|
|
2
|
+
const {
|
|
3
|
+
borderBoxSize
|
|
4
|
+
} = entry;
|
|
5
|
+
return borderBoxSize[0];
|
|
6
|
+
}
|
|
13
7
|
|
|
8
|
+
function getSize(entry) {
|
|
9
|
+
const borderBoxSize = getBorderBoxSizeFromEntry(entry);
|
|
14
10
|
return {
|
|
15
|
-
height:
|
|
16
|
-
width:
|
|
11
|
+
height: borderBoxSize.blockSize,
|
|
12
|
+
width: borderBoxSize.inlineSize
|
|
17
13
|
};
|
|
18
14
|
}
|
|
19
15
|
|
|
20
|
-
function dispatch() {
|
|
21
|
-
let resizeResponsive = new Event('resizeResponsive');
|
|
22
|
-
window.dispatchEvent(resizeResponsive);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (!hasResizeObserver) {
|
|
26
|
-
let interval = null;
|
|
27
|
-
window.addEventListener('resize', () => {
|
|
28
|
-
clearTimeout(interval);
|
|
29
|
-
interval = setTimeout(dispatch, 100);
|
|
30
|
-
});
|
|
31
|
-
} // NOTE: this is not full polyfill , we just wrote what types of changes wlli
|
|
32
|
-
|
|
33
|
-
|
|
34
16
|
export default class ResizeObserverPolyfill {
|
|
35
17
|
constructor(onResize) {
|
|
36
|
-
// method finding
|
|
37
|
-
this.transitionEndHandler = this.transitionEndHandler.bind(this);
|
|
38
|
-
this.resizeHandlerDispatch = this.resizeHandlerDispatch.bind(this);
|
|
39
18
|
this.resizeHandler = this.resizeHandler.bind(this);
|
|
40
|
-
this.replaceResizeHandler = this.replaceResizeHandler.bind(this);
|
|
41
|
-
this.debounce = this.debounce.bind(this);
|
|
42
19
|
this.onResize = onResize;
|
|
43
20
|
this.targetNode = null;
|
|
44
21
|
this.size = {
|
|
45
22
|
height: 0,
|
|
46
23
|
width: 0
|
|
47
24
|
};
|
|
48
|
-
|
|
49
|
-
if (hasResizeObserver) {
|
|
50
|
-
this.resizeObserverInstance = new window.ResizeObserver(this.resizeHandlerDispatch);
|
|
51
|
-
} else {
|
|
52
|
-
this.mutationObserverInstance = new window.MutationObserver(this.resizeHandlerDispatch);
|
|
53
|
-
}
|
|
25
|
+
this.resizeObserverInstance = new window.ResizeObserver(this.resizeHandler);
|
|
54
26
|
}
|
|
55
27
|
|
|
56
28
|
replaceResizeHandler(onResize) {
|
|
57
29
|
this.onResize = onResize;
|
|
58
30
|
}
|
|
59
31
|
|
|
60
|
-
|
|
61
|
-
|
|
32
|
+
getEntry(entries) {
|
|
33
|
+
return entries[0];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
resizeHandler(entries) {
|
|
37
|
+
if (!this.targetNode || !entries.length) {
|
|
62
38
|
return;
|
|
63
39
|
}
|
|
64
40
|
|
|
65
|
-
const
|
|
41
|
+
const entry = this.getEntry(entries);
|
|
42
|
+
const currentSize = getSize(entry);
|
|
66
43
|
|
|
67
44
|
if (this.size && currentSize.height === this.size.height && currentSize.width === this.size.width) {
|
|
68
45
|
return;
|
|
@@ -73,48 +50,9 @@ export default class ResizeObserverPolyfill {
|
|
|
73
50
|
return true;
|
|
74
51
|
}
|
|
75
52
|
|
|
76
|
-
resizeHandlerDispatch() {
|
|
77
|
-
if (!this.resizeHandler() || hasResizeObserver) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
dispatch();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
debounce() {
|
|
85
|
-
clearTimeout(this.interval);
|
|
86
|
-
this.interval = setTimeout(this.resizeHandler, 100);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
transitionEndHandler(event) {
|
|
90
|
-
if (event.propertyName.indexOf('color') === -1) {
|
|
91
|
-
this.resizeHandlerDispatch();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
addEventListeners(targetNode) {
|
|
96
|
-
targetNode.addEventListener('transitionend', this.transitionEndHandler);
|
|
97
|
-
window.addEventListener('resizeResponsive', this.debounce);
|
|
98
|
-
targetNode.addEventListener('animationend', this.resizeHandlerDispatch);
|
|
99
|
-
targetNode.addEventListener('webkitAnimationEnd', this.resizeHandlerDispatch);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
removeEventListeners(targetNode) {
|
|
103
|
-
targetNode.removeEventListener('transitionend', this.transitionEndHandler);
|
|
104
|
-
window.removeEventListener('resizeResponsive', this.debounce);
|
|
105
|
-
targetNode.removeEventListener('animationend', this.resizeHandlerDispatch);
|
|
106
|
-
targetNode.removeEventListener('webkitAnimationEnd', this.resizeHandlerDispatch);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
53
|
observe(targetNode) {
|
|
110
54
|
this.targetNode = targetNode;
|
|
111
|
-
|
|
112
|
-
if (hasResizeObserver) {
|
|
113
|
-
this.resizeObserverInstance.observe(targetNode);
|
|
114
|
-
} else {
|
|
115
|
-
this.addEventListeners(targetNode);
|
|
116
|
-
this.mutationObserverInstance.observe(targetNode, mutationObserverOptions);
|
|
117
|
-
}
|
|
55
|
+
this.resizeObserverInstance.observe(targetNode);
|
|
118
56
|
}
|
|
119
57
|
|
|
120
58
|
replaceObservationElement(targetNode) {
|
|
@@ -124,12 +62,10 @@ export default class ResizeObserverPolyfill {
|
|
|
124
62
|
|
|
125
63
|
this.targetNode && this.disconnect();
|
|
126
64
|
targetNode && this.observe(targetNode);
|
|
127
|
-
targetNode && this.resizeHandlerDispatch();
|
|
128
65
|
}
|
|
129
66
|
|
|
130
67
|
disconnect() {
|
|
131
|
-
this.
|
|
132
|
-
hasResizeObserver ? this.resizeObserverInstance.disconnect() : this.mutationObserverInstance.disconnect();
|
|
68
|
+
this.resizeObserverInstance.disconnect();
|
|
133
69
|
this.targetNode = null;
|
|
134
70
|
this.size = {
|
|
135
71
|
height: 0,
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
const hasResizeObserver = !!window.ResizeObserver;
|
|
2
|
+
const mutationObserverOptions = {
|
|
3
|
+
//NOTE: we donot consider child Count
|
|
4
|
+
// childList: true,
|
|
5
|
+
attributes: true
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
function getSize(element) {
|
|
9
|
+
let {
|
|
10
|
+
offsetHeight,
|
|
11
|
+
offsetWidth
|
|
12
|
+
} = element; // const { height, width } = element.getBoundingClientRect();
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
height: offsetHeight,
|
|
16
|
+
width: offsetWidth
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function dispatch() {
|
|
21
|
+
let resizeResponsive = new Event('resizeResponsive');
|
|
22
|
+
window.dispatchEvent(resizeResponsive);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!hasResizeObserver) {
|
|
26
|
+
let interval = null;
|
|
27
|
+
window.addEventListener('resize', () => {
|
|
28
|
+
clearTimeout(interval);
|
|
29
|
+
interval = setTimeout(dispatch, 100);
|
|
30
|
+
});
|
|
31
|
+
} // NOTE: this is not full polyfill , we just wrote what types of changes wlli
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export default class ResizeObserverPolyfill {
|
|
35
|
+
constructor(onResize) {
|
|
36
|
+
// method finding
|
|
37
|
+
this.transitionEndHandler = this.transitionEndHandler.bind(this);
|
|
38
|
+
this.resizeHandlerDispatch = this.resizeHandlerDispatch.bind(this);
|
|
39
|
+
this.resizeHandler = this.resizeHandler.bind(this);
|
|
40
|
+
this.replaceResizeHandler = this.replaceResizeHandler.bind(this);
|
|
41
|
+
this.debounce = this.debounce.bind(this);
|
|
42
|
+
this.onResize = onResize;
|
|
43
|
+
this.targetNode = null;
|
|
44
|
+
this.size = {
|
|
45
|
+
height: 0,
|
|
46
|
+
width: 0
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
if (hasResizeObserver) {
|
|
50
|
+
this.resizeObserverInstance = new window.ResizeObserver(this.resizeHandlerDispatch);
|
|
51
|
+
} else {
|
|
52
|
+
this.mutationObserverInstance = new window.MutationObserver(this.resizeHandlerDispatch);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
replaceResizeHandler(onResize) {
|
|
57
|
+
this.onResize = onResize;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
resizeHandler() {
|
|
61
|
+
if (!this.targetNode) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const currentSize = getSize(this.targetNode); // if (this.size && shallowCompare(currentSize, this.size)) {
|
|
66
|
+
|
|
67
|
+
if (this.size && currentSize.height === this.size.height && currentSize.width === this.size.width) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this.size = currentSize;
|
|
72
|
+
this.onResize(this.size, this.targetNode);
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
resizeHandlerDispatch() {
|
|
77
|
+
if (!this.resizeHandler() || hasResizeObserver) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
dispatch();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
debounce() {
|
|
85
|
+
clearTimeout(this.interval);
|
|
86
|
+
this.interval = setTimeout(this.resizeHandler, 100);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
transitionEndHandler(event) {
|
|
90
|
+
if (event.propertyName.indexOf('color') === -1) {
|
|
91
|
+
this.resizeHandlerDispatch();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
addEventListeners(targetNode) {
|
|
96
|
+
targetNode.addEventListener('transitionend', this.transitionEndHandler);
|
|
97
|
+
window.addEventListener('resizeResponsive', this.debounce);
|
|
98
|
+
targetNode.addEventListener('animationend', this.resizeHandlerDispatch);
|
|
99
|
+
targetNode.addEventListener('webkitAnimationEnd', this.resizeHandlerDispatch);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
removeEventListeners(targetNode) {
|
|
103
|
+
targetNode.removeEventListener('transitionend', this.transitionEndHandler);
|
|
104
|
+
window.removeEventListener('resizeResponsive', this.debounce);
|
|
105
|
+
targetNode.removeEventListener('animationend', this.resizeHandlerDispatch);
|
|
106
|
+
targetNode.removeEventListener('webkitAnimationEnd', this.resizeHandlerDispatch);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
observe(targetNode) {
|
|
110
|
+
this.targetNode = targetNode;
|
|
111
|
+
|
|
112
|
+
if (hasResizeObserver) {
|
|
113
|
+
this.resizeObserverInstance.observe(targetNode);
|
|
114
|
+
} else {
|
|
115
|
+
this.addEventListeners(targetNode);
|
|
116
|
+
this.mutationObserverInstance.observe(targetNode, mutationObserverOptions);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
replaceObservationElement(targetNode) {
|
|
121
|
+
if (this.targetNode === targetNode) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
this.targetNode && this.disconnect();
|
|
126
|
+
targetNode && this.observe(targetNode);
|
|
127
|
+
targetNode && this.resizeHandlerDispatch();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
disconnect() {
|
|
131
|
+
this.targetNode && this.removeEventListeners(this.targetNode);
|
|
132
|
+
hasResizeObserver ? this.resizeObserverInstance.disconnect() : this.mutationObserverInstance.disconnect();
|
|
133
|
+
this.targetNode = null;
|
|
134
|
+
this.size = {
|
|
135
|
+
height: 0,
|
|
136
|
+
width: 0
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useState, useMemo } from 'react'; // import React, { useState, useMemo, useCallback, useContext } from 'react';
|
|
2
2
|
|
|
3
|
-
import { ResponsiveSender_defaultProps, ResponsiveReceiver_defaultProps } from
|
|
4
|
-
import { ResponsiveSender_propTypes, ResponsiveReceiver_propTypes } from
|
|
5
|
-
import ResizeObserver from
|
|
6
|
-
import DOMRefWrapper from
|
|
7
|
-
import { windowResizeObserver } from
|
|
8
|
-
import { getBreakPointValue, defaultMatcher } from
|
|
3
|
+
import { ResponsiveSender_defaultProps, ResponsiveReceiver_defaultProps } from './props/defaultProps';
|
|
4
|
+
import { ResponsiveSender_propTypes, ResponsiveReceiver_propTypes } from './props/propTypes';
|
|
5
|
+
import ResizeObserver from './ResizeObserver';
|
|
6
|
+
import DOMRefWrapper from './RefWrapper';
|
|
7
|
+
import { windowResizeObserver } from './windowResizeObserver';
|
|
8
|
+
import { getBreakPointValue, defaultMatcher } from './utils/'; // const sortedBreackPointKey = [ 'MOBILE_XS', 'MOBILE_S', 'MOBILE_M', 'MOBILE', 'TABLET_S', 'TABLET_M', 'TABLET', 'LAPTOP_S', 'LAPTOP_M', 'LAPTOP', 'MONITOR_M', 'MONITOR'];
|
|
9
9
|
|
|
10
10
|
export const ResponsiveContext = /*#__PURE__*/React.createContext({});
|
|
11
11
|
const defaultResponsiveId = 'parentReceiver';
|