@zohodesk/components 1.0.0-temp-199.5 → 1.0.0-temp-215
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 +19 -0
- package/es/CheckBox/CheckBox.js +6 -5
- package/es/CheckBox/CheckBox.module.css +5 -2
- package/es/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +64 -64
- package/es/DateTime/DateTime.js +8 -4
- package/es/DateTime/DateWidget.js +8 -1
- package/es/DateTime/props/propTypes.js +5 -0
- package/es/DropBox/DropBoxElement/DropBoxElement.js +1 -0
- package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +53 -48
- package/es/DropBox/DropBoxElement/css/cssJSLogic.js +4 -4
- package/es/ListItem/ListItem.js +2 -2
- package/es/ListItem/ListItem.module.css +18 -85
- package/es/ListItem/ListItemWithAvatar.js +3 -3
- package/es/ListItem/ListItemWithIcon.js +2 -2
- package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +2 -2
- package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +1 -1
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +4 -7
- package/es/MultiSelect/AdvancedMultiSelect.js +5 -4
- package/es/MultiSelect/MultiSelect.js +6 -9
- package/es/MultiSelect/Suggestions.js +4 -8
- package/es/MultiSelect/props/defaultProps.js +4 -6
- package/es/MultiSelect/props/propTypes.js +7 -7
- package/es/Popup/Popup.js +173 -35
- package/es/Popup/intersectionObserver.js +33 -23
- package/es/Popup/props/propTypes.js +1 -1
- package/es/Radio/Radio.js +9 -7
- package/es/Radio/Radio.module.css +1 -1
- package/es/Radio/__tests__/__snapshots__/Radio.spec.js.snap +77 -77
- package/es/Select/GroupSelect.js +9 -7
- package/es/Select/SelectWithAvatar.js +2 -7
- package/es/Select/SelectWithIcon.js +2 -4
- package/es/Select/props/defaultProps.js +1 -2
- package/es/Select/props/propTypes.js +5 -3
- package/es/Textarea/Textarea.js +4 -2
- package/es/Textarea/Textarea.module.css +1 -1
- package/es/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +41 -41
- package/es/Textarea/props/propTypes.js +2 -1
- package/es/Typography/Typography.js +38 -0
- package/es/Typography/css/Typography.module.css +489 -0
- package/es/Typography/css/cssJSLogic.js +56 -0
- package/es/Typography/props/defaultProps.js +8 -0
- package/es/Typography/props/propTypes.js +27 -0
- package/es/Typography/utils/index.js +50 -0
- package/es/index.js +1 -1
- package/es/v1/MultiSelect/AdvancedMultiSelect.js +1 -2
- package/es/v1/MultiSelect/MultiSelect.js +2 -7
- package/es/v1/MultiSelect/Suggestions.js +4 -8
- package/es/v1/MultiSelect/props/defaultProps.js +2 -4
- package/es/v1/MultiSelect/props/propTypes.js +2 -6
- package/es/v1/Select/GroupSelect.js +2 -7
- package/es/v1/Select/SelectWithAvatar.js +2 -7
- package/es/v1/Select/props/defaultProps.js +2 -4
- package/es/v1/Select/props/propTypes.js +2 -6
- package/es/v1/Typography/Typography.js +1 -1
- package/lib/CheckBox/CheckBox.js +5 -4
- package/lib/CheckBox/CheckBox.module.css +5 -2
- package/lib/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +64 -64
- package/lib/DateTime/DateTime.js +11 -5
- package/lib/DateTime/DateWidget.js +8 -1
- package/lib/DateTime/props/propTypes.js +5 -0
- package/lib/DropBox/DropBoxElement/DropBoxElement.js +1 -0
- package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +53 -48
- package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +2 -2
- package/lib/ListItem/ListItem.js +2 -2
- package/lib/ListItem/ListItem.module.css +18 -85
- package/lib/ListItem/ListItemWithAvatar.js +3 -3
- package/lib/ListItem/ListItemWithIcon.js +2 -2
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +2 -2
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +1 -1
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +5 -7
- package/lib/MultiSelect/AdvancedMultiSelect.js +5 -5
- package/lib/MultiSelect/MultiSelect.js +7 -8
- package/lib/MultiSelect/Suggestions.js +4 -8
- package/lib/MultiSelect/props/defaultProps.js +4 -6
- package/lib/MultiSelect/props/propTypes.js +7 -7
- package/lib/Popup/Popup.js +212 -74
- package/lib/Popup/intersectionObserver.js +35 -25
- package/lib/Popup/props/propTypes.js +1 -1
- package/lib/Radio/Radio.js +10 -7
- package/lib/Radio/Radio.module.css +1 -1
- package/lib/Radio/__tests__/__snapshots__/Radio.spec.js.snap +77 -77
- package/lib/Select/GroupSelect.js +10 -8
- package/lib/Select/SelectWithAvatar.js +3 -8
- package/lib/Select/SelectWithIcon.js +3 -5
- package/lib/Select/props/defaultProps.js +1 -2
- package/lib/Select/props/propTypes.js +5 -3
- package/lib/Textarea/Textarea.js +4 -2
- package/lib/Textarea/Textarea.module.css +1 -1
- package/lib/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +41 -41
- package/lib/Textarea/props/propTypes.js +2 -1
- package/lib/Typography/Typography.js +56 -0
- package/lib/Typography/css/Typography.module.css +489 -0
- package/lib/Typography/css/cssJSLogic.js +48 -0
- package/lib/Typography/props/defaultProps.js +15 -0
- package/lib/Typography/props/propTypes.js +38 -0
- package/lib/Typography/utils/index.js +59 -0
- package/lib/index.js +1 -1
- package/lib/v1/MultiSelect/AdvancedMultiSelect.js +1 -3
- package/lib/v1/MultiSelect/MultiSelect.js +3 -8
- package/lib/v1/MultiSelect/Suggestions.js +4 -8
- package/lib/v1/MultiSelect/props/defaultProps.js +2 -4
- package/lib/v1/MultiSelect/props/propTypes.js +2 -6
- package/lib/v1/Select/GroupSelect.js +3 -8
- package/lib/v1/Select/SelectWithAvatar.js +3 -8
- package/lib/v1/Select/props/defaultProps.js +2 -4
- package/lib/v1/Select/props/propTypes.js +2 -6
- package/lib/v1/Typography/Typography.js +2 -2
- package/package.json +4 -4
- package/result.json +1 -1
- /package/es/v1/Typography/css/{Typography.module.css → v1_Typography.module.css} +0 -0
- /package/lib/v1/Typography/css/{Typography.module.css → v1_Typography.module.css} +0 -0
|
@@ -876,11 +876,8 @@ class AdvancedGroupMultiSelect extends React.Component {
|
|
|
876
876
|
needEffect,
|
|
877
877
|
autoComplete,
|
|
878
878
|
getTargetRef,
|
|
879
|
-
|
|
879
|
+
isFocus
|
|
880
880
|
} = this.props;
|
|
881
|
-
const {
|
|
882
|
-
suggestionsProps
|
|
883
|
-
} = customProps;
|
|
884
881
|
let {
|
|
885
882
|
clearText = 'Clear all'
|
|
886
883
|
} = i18nKeys;
|
|
@@ -908,6 +905,7 @@ class AdvancedGroupMultiSelect extends React.Component {
|
|
|
908
905
|
let setAriaId = this.getNextAriaId();
|
|
909
906
|
let ariaErrorId = this.getNextAriaId();
|
|
910
907
|
const isShowClearIcon = !isReadOnly && !isDisabled && selectedGroupOptions.length > 1;
|
|
908
|
+
const isEditable = !(isReadOnly || isDisabled);
|
|
911
909
|
return /*#__PURE__*/React.createElement("div", {
|
|
912
910
|
className: `${style.wrapper} ${isDisabled ? style.disabled : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''}`,
|
|
913
911
|
"data-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
|
|
@@ -924,7 +922,7 @@ class AdvancedGroupMultiSelect extends React.Component {
|
|
|
924
922
|
}, children) : /*#__PURE__*/React.createElement(Container, {
|
|
925
923
|
align: "vertical",
|
|
926
924
|
alignBox: "row",
|
|
927
|
-
className: `${style.container} ${style[size]} ${isActive && needBorder ? style.active : ''} ${needBorder ? style.hasBorder : ''} ${style[`borderColor_${borderColor}`]} ${customClass}`,
|
|
925
|
+
className: `${style.container} ${style[size]} ${isActive && needBorder || isEditable && isFocus && needBorder ? style.active : ''} ${needBorder ? style.hasBorder : ''} ${style[`borderColor_${borderColor}`]} ${customClass}`,
|
|
928
926
|
eleRef: this.selectedOptionContainerRef,
|
|
929
927
|
wrap: "wrap"
|
|
930
928
|
}, /*#__PURE__*/React.createElement(SelectedOptions, {
|
|
@@ -1059,8 +1057,7 @@ class AdvancedGroupMultiSelect extends React.Component {
|
|
|
1059
1057
|
a11y: {
|
|
1060
1058
|
role: 'option'
|
|
1061
1059
|
},
|
|
1062
|
-
dataId: `${dataId}_Options
|
|
1063
|
-
...suggestionsProps
|
|
1060
|
+
dataId: `${dataId}_Options`
|
|
1064
1061
|
}));
|
|
1065
1062
|
}) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
1066
1063
|
options: revampedGroups,
|
|
@@ -372,7 +372,8 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
372
372
|
isAbsolutePositioningNeeded,
|
|
373
373
|
positionsOffset,
|
|
374
374
|
targetOffset,
|
|
375
|
-
isRestrictScroll
|
|
375
|
+
isRestrictScroll,
|
|
376
|
+
isFocus
|
|
376
377
|
} = this.props;
|
|
377
378
|
let {
|
|
378
379
|
SuggestionsProps = {},
|
|
@@ -414,6 +415,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
414
415
|
disabledOptions
|
|
415
416
|
});
|
|
416
417
|
let isShowClearIcon = !isReadOnly && !isDisabled && isShowClear;
|
|
418
|
+
const isEditable = !(isReadOnly || isDisabled);
|
|
417
419
|
return /*#__PURE__*/React.createElement("div", {
|
|
418
420
|
className: `${style.wrapper} ${isDisabled ? style.disabled : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''} ${containerClass}`,
|
|
419
421
|
"data-id": dataIdMultiSelectComp,
|
|
@@ -424,7 +426,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
424
426
|
}, /*#__PURE__*/React.createElement(Container, {
|
|
425
427
|
align: "vertical",
|
|
426
428
|
alignBox: "row",
|
|
427
|
-
className: `${style.container} ${style[size]} ${isActive && needBorder ? style.active : ''} ${needBorder ? style.hasBorder : ''} ${needBorder ? !isDisabled ? style[`borderColor_${borderColor}`] : style.borderColor_transparent : ''}`,
|
|
429
|
+
className: `${style.container} ${style[size]} ${isActive && needBorder || isEditable && isFocus && needBorder ? style.active : ''} ${needBorder ? style.hasBorder : ''} ${needBorder ? !isDisabled ? style[`borderColor_${borderColor}`] : style.borderColor_transparent : ''}`,
|
|
428
430
|
eleRef: this.selectedOptionContainerRef,
|
|
429
431
|
wrap: "wrap"
|
|
430
432
|
}, /*#__PURE__*/React.createElement(SelectedOptions, {
|
|
@@ -549,8 +551,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
549
551
|
role: 'option'
|
|
550
552
|
},
|
|
551
553
|
dataId: `${dataIdMultiSelectComp}_Options`,
|
|
552
|
-
...SuggestionsProps
|
|
553
|
-
needMultiLineText: true
|
|
554
|
+
...SuggestionsProps
|
|
554
555
|
}) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
555
556
|
isLoading: isFetchingOptions,
|
|
556
557
|
options: options,
|
|
@@ -877,7 +877,8 @@ export class MultiSelectComponent extends React.Component {
|
|
|
877
877
|
setAriaId,
|
|
878
878
|
isPopupOpen,
|
|
879
879
|
ariaErrorId,
|
|
880
|
-
customProps
|
|
880
|
+
customProps,
|
|
881
|
+
isFocus
|
|
881
882
|
} = this.props;
|
|
882
883
|
let {
|
|
883
884
|
isActive,
|
|
@@ -899,13 +900,14 @@ export class MultiSelectComponent extends React.Component {
|
|
|
899
900
|
disabledOptions
|
|
900
901
|
});
|
|
901
902
|
const isShowClearIcon = !isReadOnly && !isDisabled && !disableAction && isShowClear;
|
|
903
|
+
const isEditable = !(isReadOnly || isDisabled || disableAction);
|
|
902
904
|
let {
|
|
903
905
|
TextBoxIconProps = {}
|
|
904
906
|
} = customProps;
|
|
905
907
|
return /*#__PURE__*/React.createElement(Container, {
|
|
906
908
|
align: "vertical",
|
|
907
909
|
alignBox: "row",
|
|
908
|
-
className: `${style.container} ${style[size]} ${needBorder ? !disableAction ? style[`borderColor_${borderColor}`] : style.borderColor_transparent : ''} ${isActive && needBorder || isResponsive ? style.active : ''} ${textBoxClass} ${needBorder ? style.hasBorder : ''}`,
|
|
910
|
+
className: `${style.container} ${style[size]} ${needBorder ? !disableAction ? style[`borderColor_${borderColor}`] : style.borderColor_transparent : ''} ${isActive && needBorder || isResponsive || isEditable && isFocus && needBorder ? style.active : ''} ${textBoxClass} ${needBorder ? style.hasBorder : ''}`,
|
|
909
911
|
eleRef: this.selectedOptionContainerRef,
|
|
910
912
|
wrap: "wrap"
|
|
911
913
|
}, /*#__PURE__*/React.createElement(SelectedOptions, {
|
|
@@ -1015,12 +1017,8 @@ export class MultiSelectComponent extends React.Component {
|
|
|
1015
1017
|
boxSize,
|
|
1016
1018
|
isLoading,
|
|
1017
1019
|
selectAllText,
|
|
1018
|
-
needSelectAll
|
|
1019
|
-
customProps
|
|
1020
|
+
needSelectAll
|
|
1020
1021
|
} = this.props;
|
|
1021
|
-
const {
|
|
1022
|
-
suggestionsProps = {}
|
|
1023
|
-
} = customProps;
|
|
1024
1022
|
const {
|
|
1025
1023
|
selectedOptions,
|
|
1026
1024
|
searchStr,
|
|
@@ -1110,8 +1108,7 @@ export class MultiSelectComponent extends React.Component {
|
|
|
1110
1108
|
selectedOptions: selectedOptionIds,
|
|
1111
1109
|
a11y: {
|
|
1112
1110
|
role: 'option'
|
|
1113
|
-
}
|
|
1114
|
-
...suggestionsProps
|
|
1111
|
+
}
|
|
1115
1112
|
}) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
1116
1113
|
isLoading: isFetchingOptions,
|
|
1117
1114
|
options: options,
|
|
@@ -27,8 +27,7 @@ export default class Suggestions extends React.PureComponent {
|
|
|
27
27
|
avatarPalette,
|
|
28
28
|
palette,
|
|
29
29
|
htmlId,
|
|
30
|
-
a11y
|
|
31
|
-
needMultiLineText
|
|
30
|
+
a11y
|
|
32
31
|
} = this.props;
|
|
33
32
|
const {
|
|
34
33
|
ariaParentRole,
|
|
@@ -93,8 +92,7 @@ export default class Suggestions extends React.PureComponent {
|
|
|
93
92
|
size: listItemSize,
|
|
94
93
|
avatarPalette: avatarPalette,
|
|
95
94
|
palette: palette,
|
|
96
|
-
a11y: list_a11y
|
|
97
|
-
needMultiLineText: needMultiLineText
|
|
95
|
+
a11y: list_a11y
|
|
98
96
|
});
|
|
99
97
|
} else if (optionType === 'icon') {
|
|
100
98
|
return /*#__PURE__*/React.createElement(ListItemWithIcon, { ...commonProps,
|
|
@@ -114,8 +112,7 @@ export default class Suggestions extends React.PureComponent {
|
|
|
114
112
|
iconSize: iconSize,
|
|
115
113
|
size: listItemSize,
|
|
116
114
|
palette: palette,
|
|
117
|
-
a11y: list_a11y
|
|
118
|
-
needMultiLineText: needMultiLineText
|
|
115
|
+
a11y: list_a11y
|
|
119
116
|
});
|
|
120
117
|
}
|
|
121
118
|
|
|
@@ -134,8 +131,7 @@ export default class Suggestions extends React.PureComponent {
|
|
|
134
131
|
active: isActive,
|
|
135
132
|
size: listItemSize,
|
|
136
133
|
palette: palette,
|
|
137
|
-
a11y: list_a11y
|
|
138
|
-
needMultiLineText: needMultiLineText
|
|
134
|
+
a11y: list_a11y
|
|
139
135
|
});
|
|
140
136
|
})));
|
|
141
137
|
}
|
|
@@ -37,8 +37,7 @@ export const AdvancedGroupMultiSelect_defaultProps = {
|
|
|
37
37
|
needEffect: true,
|
|
38
38
|
palette: 'default',
|
|
39
39
|
isLoading: false,
|
|
40
|
-
dataSelectorId: 'advancedGroupMultiSelect'
|
|
41
|
-
customProps: {}
|
|
40
|
+
dataSelectorId: 'advancedGroupMultiSelect'
|
|
42
41
|
};
|
|
43
42
|
export const AdvancedMultiSelect_defaultProps = {
|
|
44
43
|
animationStyle: 'bounce',
|
|
@@ -155,14 +154,13 @@ export const MultiSelectWithAvatar_defaultProps = {
|
|
|
155
154
|
isLoading: false,
|
|
156
155
|
dataSelectorId: 'multiSelectWithAvatar',
|
|
157
156
|
keepSelectedOptions: false,
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
customProps: {},
|
|
158
|
+
needResponsive: true
|
|
160
159
|
};
|
|
161
160
|
export const SelectedOptions_defaultProps = {
|
|
162
161
|
size: 'medium',
|
|
163
162
|
dataId: 'selectedOptions'
|
|
164
163
|
};
|
|
165
164
|
export const Suggestions_defaultProps = {
|
|
166
|
-
a11y: {}
|
|
167
|
-
needMultiLineText: false
|
|
165
|
+
a11y: {}
|
|
168
166
|
};
|
|
@@ -110,9 +110,9 @@ export const MultiSelect_propTypes = {
|
|
|
110
110
|
setAriaId: PropTypes.string,
|
|
111
111
|
ariaErrorId: PropTypes.string,
|
|
112
112
|
customProps: PropTypes.shape({
|
|
113
|
-
TextBoxIconProps: PropTypes.object
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
TextBoxIconProps: PropTypes.object
|
|
114
|
+
}),
|
|
115
|
+
isFocus: PropTypes.bool
|
|
116
116
|
};
|
|
117
117
|
export const MultiSelectHeader_propTypes = {
|
|
118
118
|
dataId: PropTypes.string,
|
|
@@ -177,8 +177,7 @@ export const Suggestions_propTypes = {
|
|
|
177
177
|
logo: PropTypes.string,
|
|
178
178
|
optionType: PropTypes.string,
|
|
179
179
|
listItemProps: PropTypes.object
|
|
180
|
-
}))
|
|
181
|
-
needMultiLineText: PropTypes.bool
|
|
180
|
+
}))
|
|
182
181
|
};
|
|
183
182
|
export const AdvancedGroupMultiSelect_propTypes = {
|
|
184
183
|
animationStyle: PropTypes.string,
|
|
@@ -249,7 +248,7 @@ export const AdvancedGroupMultiSelect_propTypes = {
|
|
|
249
248
|
searchStr: PropTypes.string,
|
|
250
249
|
children: PropTypes.node,
|
|
251
250
|
dataSelectorId: PropTypes.string,
|
|
252
|
-
|
|
251
|
+
isFocus: PropTypes.bool
|
|
253
252
|
};
|
|
254
253
|
export const AdvancedMultiSelect_propTypes = { ...MultiSelect_propTypes,
|
|
255
254
|
selectedOptionDetails: PropTypes.string,
|
|
@@ -324,5 +323,6 @@ export const AdvancedMultiSelect_propTypes = { ...MultiSelect_propTypes,
|
|
|
324
323
|
}),
|
|
325
324
|
isLoading: PropTypes.bool,
|
|
326
325
|
dataSelectorId: PropTypes.string,
|
|
327
|
-
customClass: PropTypes.object
|
|
326
|
+
customClass: PropTypes.object,
|
|
327
|
+
isFocus: PropTypes.bool
|
|
328
328
|
};
|
package/es/Popup/Popup.js
CHANGED
|
@@ -9,6 +9,7 @@ import viewPort from "./viewPort";
|
|
|
9
9
|
import { absolutePositionMapping, rtlAbsolutePositionMapping, rtlFixedPositionMapping } from "./PositionMapping.js";
|
|
10
10
|
import ResizeObserver from '@zohodesk/virtualizer/lib/commons/ResizeObserver.js';
|
|
11
11
|
import { addIntersectionObserver, removeIntersectionObserver } from "./intersectionObserver";
|
|
12
|
+
import { positionMapping } from "../DropBox/DropBoxPositionMapping.js";
|
|
12
13
|
let lastOpenedGroup = [];
|
|
13
14
|
let popups = {};
|
|
14
15
|
|
|
@@ -95,7 +96,15 @@ const Popup = function (Component) {
|
|
|
95
96
|
this.preventKeyboardScroll = this.preventKeyboardScroll.bind(this);
|
|
96
97
|
this.addScrollBlockListeners = this.addScrollBlockListeners.bind(this);
|
|
97
98
|
this.removeScrollBlockListeners = this.removeScrollBlockListeners.bind(this);
|
|
99
|
+
this.handleAddingScrollBlock = this.handleAddingScrollBlock.bind(this);
|
|
100
|
+
this.handleRemovingScrollBlock = this.handleRemovingScrollBlock.bind(this);
|
|
98
101
|
this.handleIntersectionObserver = this.handleIntersectionObserver.bind(this);
|
|
102
|
+
this.updateVisibilityOnIntersection = this.updateVisibilityOnIntersection.bind(this);
|
|
103
|
+
this.handleAddingScrollToUpdatePosition = this.handleAddingScrollToUpdatePosition.bind(this);
|
|
104
|
+
this.handleRemovingScrollToUpdatePosition = this.handleRemovingScrollToUpdatePosition.bind(this);
|
|
105
|
+
this.updatePositionOnScroll = this.updatePositionOnScroll.bind(this);
|
|
106
|
+
this.setContainerDynamicPositioning = this.setContainerDynamicPositioning.bind(this);
|
|
107
|
+
this.positionRef = /*#__PURE__*/React.createRef();
|
|
99
108
|
this.popupObserver = new ResizeObserver(this.handlePopupResize); //dropBoxSize
|
|
100
109
|
|
|
101
110
|
this.size = null;
|
|
@@ -152,9 +161,7 @@ const Popup = function (Component) {
|
|
|
152
161
|
dropElement
|
|
153
162
|
} = this;
|
|
154
163
|
const {
|
|
155
|
-
needResizeHandling: propResizeHandling
|
|
156
|
-
isAbsolutePositioningNeeded,
|
|
157
|
-
isOutsideScrollBlocked
|
|
164
|
+
needResizeHandling: propResizeHandling
|
|
158
165
|
} = this.props;
|
|
159
166
|
|
|
160
167
|
if (oldStateOpen !== isPopupReady) {
|
|
@@ -165,14 +172,12 @@ const Popup = function (Component) {
|
|
|
165
172
|
this.popupObserver.disconnect();
|
|
166
173
|
}
|
|
167
174
|
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
this.removeScrollBlockListeners();
|
|
175
|
-
}
|
|
175
|
+
if (isPopupReady) {
|
|
176
|
+
this.handleAddingScrollBlock();
|
|
177
|
+
this.handleAddingScrollToUpdatePosition();
|
|
178
|
+
} else {
|
|
179
|
+
this.handleRemovingScrollBlock();
|
|
180
|
+
this.handleRemovingScrollToUpdatePosition();
|
|
176
181
|
}
|
|
177
182
|
}
|
|
178
183
|
}
|
|
@@ -189,8 +194,7 @@ const Popup = function (Component) {
|
|
|
189
194
|
|
|
190
195
|
return res;
|
|
191
196
|
}, popups);
|
|
192
|
-
|
|
193
|
-
this.removeScrollBlockListeners();
|
|
197
|
+
this.handleRemovingScrollBlock();
|
|
194
198
|
let noPopups = true;
|
|
195
199
|
|
|
196
200
|
for (const i in popups) {
|
|
@@ -215,6 +219,110 @@ const Popup = function (Component) {
|
|
|
215
219
|
}
|
|
216
220
|
}
|
|
217
221
|
|
|
222
|
+
handleAddingScrollBlock() {
|
|
223
|
+
const {
|
|
224
|
+
isAbsolutePositioningNeeded,
|
|
225
|
+
fixedPopupScrollBehavior
|
|
226
|
+
} = this.props;
|
|
227
|
+
|
|
228
|
+
if (fixedPopupScrollBehavior === 'block' && !isAbsolutePositioningNeeded) {
|
|
229
|
+
addIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
|
|
230
|
+
this.addScrollBlockListeners();
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
handleRemovingScrollBlock() {
|
|
235
|
+
const {
|
|
236
|
+
isAbsolutePositioningNeeded,
|
|
237
|
+
fixedPopupScrollBehavior
|
|
238
|
+
} = this.props;
|
|
239
|
+
|
|
240
|
+
if (fixedPopupScrollBehavior === 'block' && !isAbsolutePositioningNeeded) {
|
|
241
|
+
removeIntersectionObserver(this.placeHolderElement, this.handleIntersectionObserver);
|
|
242
|
+
this.removeScrollBlockListeners();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
handleAddingScrollToUpdatePosition() {
|
|
247
|
+
const {
|
|
248
|
+
isAbsolutePositioningNeeded,
|
|
249
|
+
fixedPopupScrollBehavior
|
|
250
|
+
} = this.props;
|
|
251
|
+
|
|
252
|
+
if (fixedPopupScrollBehavior === 'scroll' && !isAbsolutePositioningNeeded) {
|
|
253
|
+
addIntersectionObserver(this.placeHolderElement, this.updateVisibilityOnIntersection);
|
|
254
|
+
document.addEventListener('scroll', this.updatePositionOnScroll, {
|
|
255
|
+
capture: true,
|
|
256
|
+
passive: false
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
handleRemovingScrollToUpdatePosition() {
|
|
262
|
+
const {
|
|
263
|
+
isAbsolutePositioningNeeded,
|
|
264
|
+
fixedPopupScrollBehavior
|
|
265
|
+
} = this.props;
|
|
266
|
+
|
|
267
|
+
if (fixedPopupScrollBehavior === 'scroll' && !isAbsolutePositioningNeeded) {
|
|
268
|
+
removeIntersectionObserver(this.placeHolderElement, this.updateVisibilityOnIntersection);
|
|
269
|
+
document.removeEventListener('scroll', this.updatePositionOnScroll, {
|
|
270
|
+
capture: true,
|
|
271
|
+
passive: false
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
setContainerDynamicPositioning() {
|
|
277
|
+
const {
|
|
278
|
+
placeHolderElement,
|
|
279
|
+
dropElement,
|
|
280
|
+
defaultPosition
|
|
281
|
+
} = this;
|
|
282
|
+
|
|
283
|
+
if (!dropElement) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const needArrow = this.getNeedArrow(this);
|
|
288
|
+
const isAbsolute = this.getIsAbsolutePopup(this);
|
|
289
|
+
const customOrder = this.getCustomPositionOrder(this);
|
|
290
|
+
const styleToApply = {
|
|
291
|
+
top: '',
|
|
292
|
+
left: '',
|
|
293
|
+
right: '',
|
|
294
|
+
bottom: ''
|
|
295
|
+
};
|
|
296
|
+
requestAnimationFrame(() => {
|
|
297
|
+
const betterPosition = viewPort.betterView(dropElement, placeHolderElement, defaultPosition, '', {
|
|
298
|
+
needArrow,
|
|
299
|
+
isAbsolute,
|
|
300
|
+
customOrder
|
|
301
|
+
});
|
|
302
|
+
const {
|
|
303
|
+
view,
|
|
304
|
+
viewsOffset
|
|
305
|
+
} = betterPosition || {};
|
|
306
|
+
Object.assign(styleToApply, viewsOffset[view]);
|
|
307
|
+
Object.assign(dropElement.style, {
|
|
308
|
+
inset: `${styleToApply.top !== '' ? `${styleToApply.top}px` : 'auto'} ${styleToApply.right !== '' ? `${styleToApply.right}px` : 'auto'} ${styleToApply.bottom !== '' ? `${styleToApply.bottom}px` : 'auto'} ${styleToApply.left !== '' ? `${styleToApply.left}px` : 'auto'}`
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
if (this.positionRef.current !== view) {
|
|
312
|
+
dropElement.setAttribute('data-position', `${view}`);
|
|
313
|
+
dropElement.setAttribute('data-direction', `${positionMapping[view].direction}`);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
updatePositionOnScroll(e) {
|
|
319
|
+
if (e.target.contains(this.placeHolderElement)) {
|
|
320
|
+
// Set position for the dropbox
|
|
321
|
+
this.setContainerDynamicPositioning();
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
218
326
|
addScrollBlockListeners() {
|
|
219
327
|
document.addEventListener('wheel', this.handleBlockScroll, {
|
|
220
328
|
capture: true,
|
|
@@ -291,6 +399,20 @@ const Popup = function (Component) {
|
|
|
291
399
|
}
|
|
292
400
|
}
|
|
293
401
|
|
|
402
|
+
updateVisibilityOnIntersection(entry) {
|
|
403
|
+
const {
|
|
404
|
+
dropElement
|
|
405
|
+
} = this;
|
|
406
|
+
|
|
407
|
+
if (entry.intersectionRatio === 0 && entry.isIntersecting === false) {
|
|
408
|
+
dropElement.setAttribute('data-visible', 'hidden');
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
if (entry.isIntersecting === true) {
|
|
412
|
+
dropElement.setAttribute('data-visible', 'visible');
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
294
416
|
getGroup() {
|
|
295
417
|
const {
|
|
296
418
|
popupGroup
|
|
@@ -519,6 +641,10 @@ const Popup = function (Component) {
|
|
|
519
641
|
placeHolderElement,
|
|
520
642
|
dropElement
|
|
521
643
|
} = this;
|
|
644
|
+
const {
|
|
645
|
+
fixedPopupScrollBehavior,
|
|
646
|
+
isAbsolutePositioningNeeded
|
|
647
|
+
} = this.props;
|
|
522
648
|
const needArrow = this.getNeedArrow(this);
|
|
523
649
|
const isAbsolute = this.getIsAbsolutePopup(this);
|
|
524
650
|
const customOrder = this.getCustomPositionOrder(this);
|
|
@@ -548,29 +674,41 @@ const Popup = function (Component) {
|
|
|
548
674
|
isPopupReady
|
|
549
675
|
} = this.state;
|
|
550
676
|
const scrollContainer = placeHolderElement.closest('[data-scroll=true]') || document.body;
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
isPopupReady: true,
|
|
567
|
-
position: view,
|
|
568
|
-
positions: views,
|
|
569
|
-
positionsOffset: viewsOffset,
|
|
570
|
-
targetOffset,
|
|
571
|
-
popupOffset,
|
|
572
|
-
isAbsolutePositioningNeeded: isAbsolute
|
|
677
|
+
|
|
678
|
+
if (fixedPopupScrollBehavior === 'scroll' && !isAbsolutePositioningNeeded) {
|
|
679
|
+
if (!isPopupReady) {
|
|
680
|
+
this.setState({
|
|
681
|
+
isPopupReady: true,
|
|
682
|
+
isAbsolutePositioningNeeded: isAbsolute
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
this.setContainerDynamicPositioning();
|
|
687
|
+
} else {
|
|
688
|
+
const betterPosition = viewPort.betterView(dropElement, placeHolderElement, defaultPosition, scrollContainer, {
|
|
689
|
+
needArrow,
|
|
690
|
+
isAbsolute,
|
|
691
|
+
customOrder
|
|
573
692
|
});
|
|
693
|
+
const {
|
|
694
|
+
view,
|
|
695
|
+
views,
|
|
696
|
+
viewsOffset,
|
|
697
|
+
targetOffset,
|
|
698
|
+
popupOffset
|
|
699
|
+
} = betterPosition || {};
|
|
700
|
+
|
|
701
|
+
if (position !== view || !isPopupReady) {
|
|
702
|
+
this.setState({
|
|
703
|
+
isPopupReady: true,
|
|
704
|
+
position: view,
|
|
705
|
+
positions: views,
|
|
706
|
+
positionsOffset: viewsOffset,
|
|
707
|
+
targetOffset,
|
|
708
|
+
popupOffset,
|
|
709
|
+
isAbsolutePositioningNeeded: isAbsolute
|
|
710
|
+
});
|
|
711
|
+
}
|
|
574
712
|
}
|
|
575
713
|
});
|
|
576
714
|
};
|
|
@@ -2,38 +2,48 @@ let observerCallbacks = null;
|
|
|
2
2
|
let intersectionObserver = null;
|
|
3
3
|
|
|
4
4
|
function handleObserverCallbacks(entries) {
|
|
5
|
-
entries.
|
|
5
|
+
entries.forEach(entry => {
|
|
6
6
|
let oldCallbacks = observerCallbacks.get(entry.target);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
|
|
8
|
+
if (Array.isArray(oldCallbacks) && oldCallbacks.length) {
|
|
9
|
+
oldCallbacks.forEach(callback => {
|
|
10
|
+
callback && callback(entry);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
10
13
|
});
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
export function addIntersectionObserver(element, callback, options) {
|
|
14
|
-
if (
|
|
15
|
-
intersectionObserver
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
if (!!element && typeof callback == 'function') {
|
|
18
|
+
if (intersectionObserver === null && observerCallbacks === null) {
|
|
19
|
+
intersectionObserver = new IntersectionObserver(entries => {
|
|
20
|
+
handleObserverCallbacks(entries);
|
|
21
|
+
}, options);
|
|
22
|
+
observerCallbacks = new Map();
|
|
23
|
+
}
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
intersectionObserver.observe(element);
|
|
26
|
+
let oldCallbacks = observerCallbacks.get(element) || [];
|
|
27
|
+
observerCallbacks.set(element, [...oldCallbacks, callback]);
|
|
28
|
+
}
|
|
24
29
|
}
|
|
25
30
|
export function removeIntersectionObserver(element, callback) {
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
if (!!element && typeof callback == 'function') {
|
|
32
|
+
let oldCallbacks = observerCallbacks ? observerCallbacks.get(element) : null;
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
if (Array.isArray(oldCallbacks)) {
|
|
35
|
+
let callbacks = oldCallbacks.filter(handler => handler !== callback);
|
|
36
|
+
|
|
37
|
+
if (intersectionObserver && callbacks.length === 0) {
|
|
38
|
+
observerCallbacks.delete(element);
|
|
39
|
+
intersectionObserver.unobserve(element);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
33
42
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
if (intersectionObserver && observerCallbacks && observerCallbacks.size === 0) {
|
|
44
|
+
intersectionObserver.disconnect();
|
|
45
|
+
intersectionObserver = null;
|
|
46
|
+
observerCallbacks = null;
|
|
47
|
+
}
|
|
38
48
|
}
|
|
39
49
|
}
|
|
@@ -7,7 +7,7 @@ export const PopupPropTypes = {
|
|
|
7
7
|
isArrow: PropTypes.bool,
|
|
8
8
|
isPopupOpen: PropTypes.bool,
|
|
9
9
|
closeOnScroll: PropTypes.bool,
|
|
10
|
-
|
|
10
|
+
fixedPopupScrollBehavior: PropTypes.oneOf(['scroll', 'block', 'none']),
|
|
11
11
|
needResizeHandling: PropTypes.bool,
|
|
12
12
|
isAbsolutePositioningNeeded: PropTypes.bool,
|
|
13
13
|
scrollDebounceTime: PropTypes.number,
|
package/es/Radio/Radio.js
CHANGED
|
@@ -4,6 +4,7 @@ import { defaultProps } from "./props/defaultProps";
|
|
|
4
4
|
import { propTypes } from "./props/propTypes";
|
|
5
5
|
import Label from "../Label/Label";
|
|
6
6
|
import { Container, Box } from "../Layout";
|
|
7
|
+
import CssProvider from "../Provider/CssProvider";
|
|
7
8
|
import style from "./Radio.module.css";
|
|
8
9
|
export default class Radio extends React.Component {
|
|
9
10
|
constructor(props) {
|
|
@@ -57,8 +58,9 @@ export default class Radio extends React.Component {
|
|
|
57
58
|
customRadio = '',
|
|
58
59
|
customLabel = ''
|
|
59
60
|
} = customClass;
|
|
60
|
-
let accessMode = isReadOnly ? style.readonly : disabled ?
|
|
61
|
+
let accessMode = isReadOnly ? style.readonly : disabled ? CssProvider('isDisabled') : style.pointer;
|
|
61
62
|
let toolTip = disabled ? disabledTitle : title ? title : null;
|
|
63
|
+
const isEditable = !(isReadOnly || disabled);
|
|
62
64
|
let {
|
|
63
65
|
ariaHidden,
|
|
64
66
|
role = 'radio',
|
|
@@ -66,7 +68,7 @@ export default class Radio extends React.Component {
|
|
|
66
68
|
ariaChecked = checked,
|
|
67
69
|
ariaLabel,
|
|
68
70
|
ariaLabelledby,
|
|
69
|
-
ariaReadonly =
|
|
71
|
+
ariaReadonly = !isEditable ? true : false
|
|
70
72
|
} = a11y;
|
|
71
73
|
let {
|
|
72
74
|
ContainerProps = {},
|
|
@@ -78,11 +80,11 @@ export default class Radio extends React.Component {
|
|
|
78
80
|
isInline: text ? false : true,
|
|
79
81
|
alignBox: "row",
|
|
80
82
|
align: "both",
|
|
81
|
-
className: `${style.container} ${active && !disabled ? style.active : ''} ${accessMode} ${
|
|
83
|
+
className: `${style.container} ${active && !disabled ? style.active : ''} ${accessMode} ${!isEditable ? '' : style.hoverEfffect} ${checked ? style.checked : ''} ${customRadioWrap}`,
|
|
82
84
|
"data-title": toolTip,
|
|
83
85
|
onClick: !isReadOnly && !disabled ? this.onChange : '',
|
|
84
86
|
"aria-checked": ariaChecked,
|
|
85
|
-
tabindex:
|
|
87
|
+
tabindex: !isEditable || ariaHidden ? '-1' : tabIndex || '0',
|
|
86
88
|
eleRef: this.handleGetRef,
|
|
87
89
|
role: role,
|
|
88
90
|
"aria-Hidden": ariaHidden,
|
|
@@ -92,7 +94,7 @@ export default class Radio extends React.Component {
|
|
|
92
94
|
...ContainerProps
|
|
93
95
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
94
96
|
className: `${style.radio} ${checked ? `${style[`rdBox${palette}`]}` : ''}
|
|
95
|
-
${
|
|
97
|
+
${!isEditable ? '' : `${style[`hover${palette}`]}`} ${style[size]} ${isFilled ? style.filled : ''} ${style[`centerPath${palette}`]} ${customRadio} ${!isEditable ? `${style.disabled}` : ''}`
|
|
96
98
|
}, /*#__PURE__*/React.createElement("input", {
|
|
97
99
|
type: "hidden",
|
|
98
100
|
id: id,
|
|
@@ -115,7 +117,7 @@ export default class Radio extends React.Component {
|
|
|
115
117
|
className: `${style.centerPath}`
|
|
116
118
|
}) : null))), text && /*#__PURE__*/React.createElement(Box, {
|
|
117
119
|
flexible: true,
|
|
118
|
-
className: style.text
|
|
120
|
+
className: `${style.text} ${disabled ? `${style.disabled}` : ''}`
|
|
119
121
|
}, /*#__PURE__*/React.createElement(Label, {
|
|
120
122
|
text: text,
|
|
121
123
|
palette: labelPalette,
|
|
@@ -126,7 +128,7 @@ export default class Radio extends React.Component {
|
|
|
126
128
|
variant: variant,
|
|
127
129
|
title: toolTip ? toolTip : text,
|
|
128
130
|
customClass: `${checked && active ? `${style[`${palette}checkedActive`]}` : ''}
|
|
129
|
-
${style[`${palette}Label`]} ${
|
|
131
|
+
${style[`${palette}Label`]} ${isEditable ? style.pointer : ''} ${isReadOnly ? style.readonly : ''} ${customLabel}`,
|
|
130
132
|
...LabelProps
|
|
131
133
|
})), children, renderRightPlaceholderNode ? renderRightPlaceholderNode : null);
|
|
132
134
|
}
|