@zohodesk/components 1.0.0-temp-211.2 → 1.0.0-temp-216
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 +118 -31
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +5 -0
- package/assets/Appearance/dark/themes/blue/blue_ComponentTheme_DarkTheme.module.css +4 -0
- package/assets/Appearance/dark/themes/green/green_ComponentTheme_DarkTheme.module.css +4 -0
- package/assets/Appearance/dark/themes/orange/orange_ComponentTheme_DarkTheme.module.css +4 -0
- package/assets/Appearance/dark/themes/red/red_ComponentTheme_DarkTheme.module.css +4 -0
- package/assets/Appearance/dark/themes/yellow/yellow_ComponentTheme_DarkTheme.module.css +4 -0
- package/assets/Appearance/light/mode/Component_LightMode.module.css +5 -0
- package/assets/Appearance/light/themes/blue/blue_ComponentTheme_LightTheme.module.css +4 -0
- package/assets/Appearance/light/themes/green/green_ComponentTheme_LightTheme.module.css +4 -0
- package/assets/Appearance/light/themes/orange/orange_ComponentTheme_LightTheme.module.css +4 -0
- package/assets/Appearance/light/themes/red/red_ComponentTheme_LightTheme.module.css +4 -0
- package/assets/Appearance/light/themes/yellow/yellow_ComponentTheme_LightTheme.module.css +4 -0
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +5 -0
- package/assets/Appearance/pureDark/themes/blue/blue_ComponentTheme_PureDarkTheme.module.css +4 -0
- package/assets/Appearance/pureDark/themes/green/green_ComponentTheme_PureDarkTheme.module.css +4 -0
- package/assets/Appearance/pureDark/themes/orange/orange_ComponentTheme_PureDarkTheme.module.css +4 -0
- package/assets/Appearance/pureDark/themes/red/red_ComponentTheme_PureDarkTheme.module.css +4 -0
- package/assets/Appearance/pureDark/themes/yellow/yellow_ComponentTheme_PureDarkTheme.module.css +4 -0
- package/es/AvatarTeam/props/propTypes.js +2 -1
- package/es/Button/Button.js +9 -2
- package/es/Button/css/Button.module.css +82 -0
- package/es/Button/css/cssJSLogic.js +6 -1
- 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/CalendarView.js +17 -12
- package/es/DateTime/DateTime.js +26 -8
- package/es/DateTime/DateTime.module.css +5 -5
- package/es/DateTime/DateWidget.js +13 -2
- package/es/DateTime/DaysRow.js +3 -2
- package/es/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +7 -7
- package/es/DateTime/props/defaultProps.js +9 -3
- package/es/DateTime/props/propTypes.js +16 -4
- package/es/DropBox/DropBoxElement/DropBoxElement.js +3 -1
- package/es/DropBox/DropBoxElement/__tests__/__snapshots__/DropBoxElement.spec.js.snap +1 -0
- package/es/DropBox/__tests__/__snapshots__/DropBox.spec.js.snap +1 -0
- package/es/DropDown/__tests__/__snapshots__/DropDown.spec.js.snap +1 -0
- package/es/ListItem/ListItemWithAvatar.js +7 -3
- package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +2 -2
- package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +1 -1
- package/es/ListItem/props/propTypes.js +6 -1
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +4 -2
- package/es/MultiSelect/AdvancedMultiSelect.js +4 -2
- package/es/MultiSelect/MultiSelect.js +11 -3
- package/es/MultiSelect/props/propTypes.js +6 -3
- package/es/Popup/Popup.js +125 -7
- package/es/Popup/intersectionObserver.js +49 -0
- package/es/Popup/props/propTypes.js +30 -0
- package/es/Provider/LibraryContext.js +2 -2
- 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/Responsive/ResizeObserver.js +21 -85
- package/es/Responsive/ResizeObserverWithPolyfill.js +140 -0
- package/es/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +1 -0
- package/es/Select/GroupSelect.js +15 -3
- package/es/Select/props/defaultProps.js +2 -1
- package/es/Select/props/propTypes.js +5 -1
- package/es/Switch/Switch.js +3 -27
- package/es/Switch/Switch.module.css +15 -126
- package/es/Tag/Tag.js +10 -3
- package/es/Tag/props/defaultProps.js +2 -1
- package/es/Tag/props/propTypes.js +7 -1
- package/es/TextBox/TextBox.js +1 -1
- 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 -2
- package/es/v1/AppContainer/AppContainer.js +0 -6
- package/es/v1/DateTime/CalendarView.js +9 -6
- package/es/v1/DateTime/DateTime.js +18 -4
- package/es/v1/DateTime/DateWidget.js +5 -1
- package/es/v1/DateTime/DaysRow.js +3 -2
- package/es/v1/DateTime/props/defaultProps.js +9 -3
- package/es/v1/DateTime/props/propTypes.js +11 -4
- package/es/v1/MultiSelect/MultiSelect.js +7 -1
- package/es/v1/Select/GroupSelect.js +5 -0
- package/es/v1/Typography/Typography.js +1 -1
- package/lib/AvatarTeam/props/propTypes.js +3 -1
- package/lib/Button/Button.js +24 -2
- package/lib/Button/css/Button.module.css +82 -0
- package/lib/Button/css/cssJSLogic.js +6 -2
- 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/CalendarView.js +17 -12
- package/lib/DateTime/DateTime.js +38 -9
- package/lib/DateTime/DateTime.module.css +5 -5
- package/lib/DateTime/DateWidget.js +13 -2
- package/lib/DateTime/DaysRow.js +3 -2
- package/lib/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +7 -7
- package/lib/DateTime/props/defaultProps.js +9 -3
- package/lib/DateTime/props/propTypes.js +16 -4
- package/lib/DropBox/DropBoxElement/DropBoxElement.js +3 -1
- package/lib/DropBox/DropBoxElement/__tests__/__snapshots__/DropBoxElement.spec.js.snap +1 -0
- package/lib/DropBox/__tests__/__snapshots__/DropBox.spec.js.snap +1 -0
- package/lib/DropDown/__tests__/__snapshots__/DropDown.spec.js.snap +1 -0
- package/lib/ListItem/ListItemWithAvatar.js +8 -4
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +2 -2
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +1 -1
- package/lib/ListItem/props/propTypes.js +8 -1
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +4 -2
- package/lib/MultiSelect/AdvancedMultiSelect.js +4 -2
- package/lib/MultiSelect/MultiSelect.js +11 -3
- package/lib/MultiSelect/props/propTypes.js +8 -6
- package/lib/Popup/Popup.js +135 -8
- package/lib/Popup/intersectionObserver.js +72 -0
- package/lib/Popup/props/propTypes.js +51 -0
- package/lib/Provider/LibraryContext.js +2 -2
- 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/Responsive/ResizeObserver.js +20 -88
- package/lib/Responsive/ResizeObserverWithPolyfill.js +168 -0
- package/lib/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +1 -0
- package/lib/Select/GroupSelect.js +17 -5
- package/lib/Select/props/defaultProps.js +2 -1
- package/lib/Select/props/propTypes.js +5 -1
- package/lib/Switch/Switch.js +4 -34
- package/lib/Switch/Switch.module.css +15 -126
- package/lib/Tag/Tag.js +10 -5
- package/lib/Tag/props/defaultProps.js +2 -1
- package/lib/Tag/props/propTypes.js +9 -1
- package/lib/TextBox/TextBox.js +1 -1
- 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 -10
- package/lib/v1/AppContainer/AppContainer.js +0 -12
- package/lib/v1/DateTime/CalendarView.js +9 -6
- package/lib/v1/DateTime/DateTime.js +27 -4
- package/lib/v1/DateTime/DateWidget.js +5 -1
- package/lib/v1/DateTime/DaysRow.js +3 -2
- package/lib/v1/DateTime/props/defaultProps.js +9 -3
- package/lib/v1/DateTime/props/propTypes.js +11 -4
- package/lib/v1/MultiSelect/MultiSelect.js +7 -1
- package/lib/v1/Select/GroupSelect.js +5 -0
- package/lib/v1/Typography/Typography.js +2 -2
- package/package.json +8 -8
- package/propValidationArg.json +1 -1
- package/result.json +1 -1
- package/es/SwitchNew/SwitchNew.js +0 -118
- package/es/SwitchNew/SwitchNew.module.css +0 -155
- package/es/SwitchNew/props/defaultProps.js +0 -9
- package/es/SwitchNew/props/propTypes.js +0 -32
- package/lib/SwitchNew/SwitchNew.js +0 -148
- package/lib/SwitchNew/SwitchNew.module.css +0 -155
- package/lib/SwitchNew/props/defaultProps.js +0 -16
- package/lib/SwitchNew/props/propTypes.js +0 -43
- /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
|
@@ -11,59 +11,31 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
11
11
|
|
|
12
12
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
attributes: true
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
function getSize(element) {
|
|
22
|
-
var offsetHeight = element.offsetHeight,
|
|
23
|
-
offsetWidth = element.offsetWidth; // const { height, width } = element.getBoundingClientRect();
|
|
14
|
+
function getBorderBoxSizeFromEntry(entry) {
|
|
15
|
+
var borderBoxSize = entry.borderBoxSize;
|
|
16
|
+
return borderBoxSize[0];
|
|
17
|
+
}
|
|
24
18
|
|
|
19
|
+
function getSize(entry) {
|
|
20
|
+
var borderBoxSize = getBorderBoxSizeFromEntry(entry);
|
|
25
21
|
return {
|
|
26
|
-
height:
|
|
27
|
-
width:
|
|
22
|
+
height: borderBoxSize.blockSize,
|
|
23
|
+
width: borderBoxSize.inlineSize
|
|
28
24
|
};
|
|
29
25
|
}
|
|
30
26
|
|
|
31
|
-
function dispatch() {
|
|
32
|
-
var resizeResponsive = new Event('resizeResponsive');
|
|
33
|
-
window.dispatchEvent(resizeResponsive);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (!hasResizeObserver) {
|
|
37
|
-
var interval = null;
|
|
38
|
-
window.addEventListener('resize', function () {
|
|
39
|
-
clearTimeout(interval);
|
|
40
|
-
interval = setTimeout(dispatch, 100);
|
|
41
|
-
});
|
|
42
|
-
} // NOTE: this is not full polyfill , we just wrote what types of changes wlli
|
|
43
|
-
|
|
44
|
-
|
|
45
27
|
var ResizeObserverPolyfill = /*#__PURE__*/function () {
|
|
46
28
|
function ResizeObserverPolyfill(onResize) {
|
|
47
29
|
_classCallCheck(this, ResizeObserverPolyfill);
|
|
48
30
|
|
|
49
|
-
// method finding
|
|
50
|
-
this.transitionEndHandler = this.transitionEndHandler.bind(this);
|
|
51
|
-
this.resizeHandlerDispatch = this.resizeHandlerDispatch.bind(this);
|
|
52
31
|
this.resizeHandler = this.resizeHandler.bind(this);
|
|
53
|
-
this.replaceResizeHandler = this.replaceResizeHandler.bind(this);
|
|
54
|
-
this.debounce = this.debounce.bind(this);
|
|
55
32
|
this.onResize = onResize;
|
|
56
33
|
this.targetNode = null;
|
|
57
34
|
this.size = {
|
|
58
35
|
height: 0,
|
|
59
36
|
width: 0
|
|
60
37
|
};
|
|
61
|
-
|
|
62
|
-
if (hasResizeObserver) {
|
|
63
|
-
this.resizeObserverInstance = new window.ResizeObserver(this.resizeHandlerDispatch);
|
|
64
|
-
} else {
|
|
65
|
-
this.mutationObserverInstance = new window.MutationObserver(this.resizeHandlerDispatch);
|
|
66
|
-
}
|
|
38
|
+
this.resizeObserverInstance = new window.ResizeObserver(this.resizeHandler);
|
|
67
39
|
}
|
|
68
40
|
|
|
69
41
|
_createClass(ResizeObserverPolyfill, [{
|
|
@@ -71,14 +43,20 @@ var ResizeObserverPolyfill = /*#__PURE__*/function () {
|
|
|
71
43
|
value: function replaceResizeHandler(onResize) {
|
|
72
44
|
this.onResize = onResize;
|
|
73
45
|
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "getEntry",
|
|
48
|
+
value: function getEntry(entries) {
|
|
49
|
+
return entries[0];
|
|
50
|
+
}
|
|
74
51
|
}, {
|
|
75
52
|
key: "resizeHandler",
|
|
76
|
-
value: function resizeHandler() {
|
|
77
|
-
if (!this.targetNode) {
|
|
53
|
+
value: function resizeHandler(entries) {
|
|
54
|
+
if (!this.targetNode || !entries.length) {
|
|
78
55
|
return;
|
|
79
56
|
}
|
|
80
57
|
|
|
81
|
-
var
|
|
58
|
+
var entry = this.getEntry(entries);
|
|
59
|
+
var currentSize = getSize(entry);
|
|
82
60
|
|
|
83
61
|
if (this.size && currentSize.height === this.size.height && currentSize.width === this.size.width) {
|
|
84
62
|
return;
|
|
@@ -88,55 +66,11 @@ var ResizeObserverPolyfill = /*#__PURE__*/function () {
|
|
|
88
66
|
this.onResize(this.size, this.targetNode);
|
|
89
67
|
return true;
|
|
90
68
|
}
|
|
91
|
-
}, {
|
|
92
|
-
key: "resizeHandlerDispatch",
|
|
93
|
-
value: function resizeHandlerDispatch() {
|
|
94
|
-
if (!this.resizeHandler() || hasResizeObserver) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
dispatch();
|
|
99
|
-
}
|
|
100
|
-
}, {
|
|
101
|
-
key: "debounce",
|
|
102
|
-
value: function debounce() {
|
|
103
|
-
clearTimeout(this.interval);
|
|
104
|
-
this.interval = setTimeout(this.resizeHandler, 100);
|
|
105
|
-
}
|
|
106
|
-
}, {
|
|
107
|
-
key: "transitionEndHandler",
|
|
108
|
-
value: function transitionEndHandler(event) {
|
|
109
|
-
if (event.propertyName.indexOf('color') === -1) {
|
|
110
|
-
this.resizeHandlerDispatch();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}, {
|
|
114
|
-
key: "addEventListeners",
|
|
115
|
-
value: function addEventListeners(targetNode) {
|
|
116
|
-
targetNode.addEventListener('transitionend', this.transitionEndHandler);
|
|
117
|
-
window.addEventListener('resizeResponsive', this.debounce);
|
|
118
|
-
targetNode.addEventListener('animationend', this.resizeHandlerDispatch);
|
|
119
|
-
targetNode.addEventListener('webkitAnimationEnd', this.resizeHandlerDispatch);
|
|
120
|
-
}
|
|
121
|
-
}, {
|
|
122
|
-
key: "removeEventListeners",
|
|
123
|
-
value: function removeEventListeners(targetNode) {
|
|
124
|
-
targetNode.removeEventListener('transitionend', this.transitionEndHandler);
|
|
125
|
-
window.removeEventListener('resizeResponsive', this.debounce);
|
|
126
|
-
targetNode.removeEventListener('animationend', this.resizeHandlerDispatch);
|
|
127
|
-
targetNode.removeEventListener('webkitAnimationEnd', this.resizeHandlerDispatch);
|
|
128
|
-
}
|
|
129
69
|
}, {
|
|
130
70
|
key: "observe",
|
|
131
71
|
value: function observe(targetNode) {
|
|
132
72
|
this.targetNode = targetNode;
|
|
133
|
-
|
|
134
|
-
if (hasResizeObserver) {
|
|
135
|
-
this.resizeObserverInstance.observe(targetNode);
|
|
136
|
-
} else {
|
|
137
|
-
this.addEventListeners(targetNode);
|
|
138
|
-
this.mutationObserverInstance.observe(targetNode, mutationObserverOptions);
|
|
139
|
-
}
|
|
73
|
+
this.resizeObserverInstance.observe(targetNode);
|
|
140
74
|
}
|
|
141
75
|
}, {
|
|
142
76
|
key: "replaceObservationElement",
|
|
@@ -147,13 +81,11 @@ var ResizeObserverPolyfill = /*#__PURE__*/function () {
|
|
|
147
81
|
|
|
148
82
|
this.targetNode && this.disconnect();
|
|
149
83
|
targetNode && this.observe(targetNode);
|
|
150
|
-
targetNode && this.resizeHandlerDispatch();
|
|
151
84
|
}
|
|
152
85
|
}, {
|
|
153
86
|
key: "disconnect",
|
|
154
87
|
value: function disconnect() {
|
|
155
|
-
this.
|
|
156
|
-
hasResizeObserver ? this.resizeObserverInstance.disconnect() : this.mutationObserverInstance.disconnect();
|
|
88
|
+
this.resizeObserverInstance.disconnect();
|
|
157
89
|
this.targetNode = null;
|
|
158
90
|
this.size = {
|
|
159
91
|
height: 0,
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
|
|
10
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11
|
+
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
|
|
14
|
+
var hasResizeObserver = !!window.ResizeObserver;
|
|
15
|
+
var mutationObserverOptions = {
|
|
16
|
+
//NOTE: we donot consider child Count
|
|
17
|
+
// childList: true,
|
|
18
|
+
attributes: true
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function getSize(element) {
|
|
22
|
+
var offsetHeight = element.offsetHeight,
|
|
23
|
+
offsetWidth = element.offsetWidth; // const { height, width } = element.getBoundingClientRect();
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
height: offsetHeight,
|
|
27
|
+
width: offsetWidth
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function dispatch() {
|
|
32
|
+
var resizeResponsive = new Event('resizeResponsive');
|
|
33
|
+
window.dispatchEvent(resizeResponsive);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!hasResizeObserver) {
|
|
37
|
+
var interval = null;
|
|
38
|
+
window.addEventListener('resize', function () {
|
|
39
|
+
clearTimeout(interval);
|
|
40
|
+
interval = setTimeout(dispatch, 100);
|
|
41
|
+
});
|
|
42
|
+
} // NOTE: this is not full polyfill , we just wrote what types of changes wlli
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
var ResizeObserverPolyfill = /*#__PURE__*/function () {
|
|
46
|
+
function ResizeObserverPolyfill(onResize) {
|
|
47
|
+
_classCallCheck(this, ResizeObserverPolyfill);
|
|
48
|
+
|
|
49
|
+
// method finding
|
|
50
|
+
this.transitionEndHandler = this.transitionEndHandler.bind(this);
|
|
51
|
+
this.resizeHandlerDispatch = this.resizeHandlerDispatch.bind(this);
|
|
52
|
+
this.resizeHandler = this.resizeHandler.bind(this);
|
|
53
|
+
this.replaceResizeHandler = this.replaceResizeHandler.bind(this);
|
|
54
|
+
this.debounce = this.debounce.bind(this);
|
|
55
|
+
this.onResize = onResize;
|
|
56
|
+
this.targetNode = null;
|
|
57
|
+
this.size = {
|
|
58
|
+
height: 0,
|
|
59
|
+
width: 0
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
if (hasResizeObserver) {
|
|
63
|
+
this.resizeObserverInstance = new window.ResizeObserver(this.resizeHandlerDispatch);
|
|
64
|
+
} else {
|
|
65
|
+
this.mutationObserverInstance = new window.MutationObserver(this.resizeHandlerDispatch);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
_createClass(ResizeObserverPolyfill, [{
|
|
70
|
+
key: "replaceResizeHandler",
|
|
71
|
+
value: function replaceResizeHandler(onResize) {
|
|
72
|
+
this.onResize = onResize;
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "resizeHandler",
|
|
76
|
+
value: function resizeHandler() {
|
|
77
|
+
if (!this.targetNode) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var currentSize = getSize(this.targetNode); // if (this.size && shallowCompare(currentSize, this.size)) {
|
|
82
|
+
|
|
83
|
+
if (this.size && currentSize.height === this.size.height && currentSize.width === this.size.width) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
this.size = currentSize;
|
|
88
|
+
this.onResize(this.size, this.targetNode);
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
key: "resizeHandlerDispatch",
|
|
93
|
+
value: function resizeHandlerDispatch() {
|
|
94
|
+
if (!this.resizeHandler() || hasResizeObserver) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
dispatch();
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
key: "debounce",
|
|
102
|
+
value: function debounce() {
|
|
103
|
+
clearTimeout(this.interval);
|
|
104
|
+
this.interval = setTimeout(this.resizeHandler, 100);
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
key: "transitionEndHandler",
|
|
108
|
+
value: function transitionEndHandler(event) {
|
|
109
|
+
if (event.propertyName.indexOf('color') === -1) {
|
|
110
|
+
this.resizeHandlerDispatch();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}, {
|
|
114
|
+
key: "addEventListeners",
|
|
115
|
+
value: function addEventListeners(targetNode) {
|
|
116
|
+
targetNode.addEventListener('transitionend', this.transitionEndHandler);
|
|
117
|
+
window.addEventListener('resizeResponsive', this.debounce);
|
|
118
|
+
targetNode.addEventListener('animationend', this.resizeHandlerDispatch);
|
|
119
|
+
targetNode.addEventListener('webkitAnimationEnd', this.resizeHandlerDispatch);
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
key: "removeEventListeners",
|
|
123
|
+
value: function removeEventListeners(targetNode) {
|
|
124
|
+
targetNode.removeEventListener('transitionend', this.transitionEndHandler);
|
|
125
|
+
window.removeEventListener('resizeResponsive', this.debounce);
|
|
126
|
+
targetNode.removeEventListener('animationend', this.resizeHandlerDispatch);
|
|
127
|
+
targetNode.removeEventListener('webkitAnimationEnd', this.resizeHandlerDispatch);
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
key: "observe",
|
|
131
|
+
value: function observe(targetNode) {
|
|
132
|
+
this.targetNode = targetNode;
|
|
133
|
+
|
|
134
|
+
if (hasResizeObserver) {
|
|
135
|
+
this.resizeObserverInstance.observe(targetNode);
|
|
136
|
+
} else {
|
|
137
|
+
this.addEventListeners(targetNode);
|
|
138
|
+
this.mutationObserverInstance.observe(targetNode, mutationObserverOptions);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}, {
|
|
142
|
+
key: "replaceObservationElement",
|
|
143
|
+
value: function replaceObservationElement(targetNode) {
|
|
144
|
+
if (this.targetNode === targetNode) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
this.targetNode && this.disconnect();
|
|
149
|
+
targetNode && this.observe(targetNode);
|
|
150
|
+
targetNode && this.resizeHandlerDispatch();
|
|
151
|
+
}
|
|
152
|
+
}, {
|
|
153
|
+
key: "disconnect",
|
|
154
|
+
value: function disconnect() {
|
|
155
|
+
this.targetNode && this.removeEventListeners(this.targetNode);
|
|
156
|
+
hasResizeObserver ? this.resizeObserverInstance.disconnect() : this.mutationObserverInstance.disconnect();
|
|
157
|
+
this.targetNode = null;
|
|
158
|
+
this.size = {
|
|
159
|
+
height: 0,
|
|
160
|
+
width: 0
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}]);
|
|
164
|
+
|
|
165
|
+
return ResizeObserverPolyfill;
|
|
166
|
+
}();
|
|
167
|
+
|
|
168
|
+
exports["default"] = ResizeObserverPolyfill;
|
|
@@ -51,6 +51,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
51
51
|
|
|
52
52
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
53
53
|
|
|
54
|
+
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); }
|
|
55
|
+
|
|
54
56
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
55
57
|
|
|
56
58
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -664,11 +666,16 @@ var GroupSelectComponent = /*#__PURE__*/function (_PureComponent) {
|
|
|
664
666
|
htmlId = _this$props9.htmlId,
|
|
665
667
|
iconOnHover = _this$props9.iconOnHover,
|
|
666
668
|
isLoading = _this$props9.isLoading,
|
|
667
|
-
dataSelectorId = _this$props9.dataSelectorId
|
|
669
|
+
dataSelectorId = _this$props9.dataSelectorId,
|
|
670
|
+
customProps = _this$props9.customProps;
|
|
668
671
|
i18nKeys = Object.assign({}, i18nKeys, {
|
|
669
672
|
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
670
673
|
searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage
|
|
671
674
|
});
|
|
675
|
+
var _i18nKeys = i18nKeys,
|
|
676
|
+
TextBoxIcon_i18n = _i18nKeys.TextBoxIcon_i18n,
|
|
677
|
+
_i18nKeys$TextBox_all = _i18nKeys.TextBox_ally_label,
|
|
678
|
+
TextBox_ally_label = _i18nKeys$TextBox_all === void 0 ? 'Click to select options' : _i18nKeys$TextBox_all;
|
|
672
679
|
var _this$state3 = this.state,
|
|
673
680
|
selectedId = _this$state3.selectedId,
|
|
674
681
|
hoverIndex = _this$state3.hoverIndex,
|
|
@@ -687,6 +694,10 @@ var GroupSelectComponent = /*#__PURE__*/function (_PureComponent) {
|
|
|
687
694
|
|
|
688
695
|
var setAriaId = this.getNextAriaId();
|
|
689
696
|
var ariaErrorId = this.getNextAriaId();
|
|
697
|
+
var _customProps$TextBoxI = customProps.TextBoxIconProps,
|
|
698
|
+
TextBoxIconProps = _customProps$TextBoxI === void 0 ? {} : _customProps$TextBoxI,
|
|
699
|
+
_customProps$TextBoxP = customProps.TextBoxProps,
|
|
700
|
+
TextBoxProps = _customProps$TextBoxP === void 0 ? {} : _customProps$TextBoxP;
|
|
690
701
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
691
702
|
className: "".concat(_SelectModule["default"].container, " ").concat(_SelectModule["default"]["box_".concat(size)], " ").concat(isReadOnly ? _SelectModule["default"].readonly : '', " ").concat(borderColor === 'transparent' ? _SelectModule["default"].transparentContainer : '', " ").concat(iconOnHover && (isReadOnly || isDisabled) ? _SelectModule["default"].iconOnHoverReadonly : iconOnHover && !(isReadOnly || isDisabled) ? _SelectModule["default"].iconOnHoverStyle : ''),
|
|
692
703
|
"data-id": dataIdSlctComp,
|
|
@@ -699,7 +710,7 @@ var GroupSelectComponent = /*#__PURE__*/function (_PureComponent) {
|
|
|
699
710
|
ref: getTargetRef,
|
|
700
711
|
"data-id": "".concat(isDisabled ? "".concat(dataId, "_disabled") : isReadOnly ? "".concat(dataId, "_readOnly") : dataId),
|
|
701
712
|
"data-test-id": "".concat(isDisabled ? "".concat(dataId, "_disabled") : isReadOnly ? "".concat(dataId, "_readOnly") : dataId)
|
|
702
|
-
}, children ? children : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, needSelectDownIcon ? /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], {
|
|
713
|
+
}, children ? children : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, needSelectDownIcon ? /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], _extends({
|
|
703
714
|
isDisabled: isDisabled,
|
|
704
715
|
iconRotated: isPopupOpen,
|
|
705
716
|
inputRef: this.valueInputRef,
|
|
@@ -727,16 +738,17 @@ var GroupSelectComponent = /*#__PURE__*/function (_PureComponent) {
|
|
|
727
738
|
ariaActivedescendant: selectedId,
|
|
728
739
|
ariaOwns: setAriaId
|
|
729
740
|
},
|
|
741
|
+
i18nKeys: TextBoxIcon_i18n,
|
|
730
742
|
isFocus: isPopupReady,
|
|
731
743
|
autoComplete: false
|
|
732
|
-
}, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
744
|
+
}, TextBoxIconProps), /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
733
745
|
align: "both",
|
|
734
746
|
dataId: dataIdDownIcon
|
|
735
747
|
}, /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
|
|
736
748
|
name: "ZD-down",
|
|
737
749
|
size: "7",
|
|
738
750
|
iconClass: _SelectModule["default"].arrowIcon
|
|
739
|
-
}))) : /*#__PURE__*/_react["default"].createElement(_TextBox["default"], {
|
|
751
|
+
}))) : /*#__PURE__*/_react["default"].createElement(_TextBox["default"], _extends({
|
|
740
752
|
isDisabled: isDisabled,
|
|
741
753
|
inputRef: this.valueInputRef,
|
|
742
754
|
maxLength: maxLength,
|
|
@@ -766,7 +778,7 @@ var GroupSelectComponent = /*#__PURE__*/function (_PureComponent) {
|
|
|
766
778
|
},
|
|
767
779
|
autoComplete: false,
|
|
768
780
|
isFocus: isPopupReady
|
|
769
|
-
}))), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
|
|
781
|
+
}, TextBoxProps)))), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
|
|
770
782
|
query: this.responsiveFunc,
|
|
771
783
|
responsiveId: "Helmet"
|
|
772
784
|
}, function (_ref5) {
|
|
@@ -82,7 +82,8 @@ var GroupSelect_defaultProps = {
|
|
|
82
82
|
isRestrictScroll: false,
|
|
83
83
|
i18nKeys: {},
|
|
84
84
|
iconOnHover: false,
|
|
85
|
-
isLoading: false
|
|
85
|
+
isLoading: false,
|
|
86
|
+
customProps: {}
|
|
86
87
|
};
|
|
87
88
|
exports.GroupSelect_defaultProps = GroupSelect_defaultProps;
|
|
88
89
|
var SelectWithAvatar_defaultProps = {
|
|
@@ -191,7 +191,11 @@ var GroupSelect_propTypes = {
|
|
|
191
191
|
}),
|
|
192
192
|
isLoading: _propTypes["default"].bool,
|
|
193
193
|
dataSelectorId: _propTypes["default"].string,
|
|
194
|
-
isDefaultSelectValue: _propTypes["default"].bool
|
|
194
|
+
isDefaultSelectValue: _propTypes["default"].bool,
|
|
195
|
+
customProps: _propTypes["default"].shape({
|
|
196
|
+
TextBoxProps: _propTypes["default"].object,
|
|
197
|
+
TextBoxIconProps: _propTypes["default"].object
|
|
198
|
+
})
|
|
195
199
|
};
|
|
196
200
|
exports.GroupSelect_propTypes = GroupSelect_propTypes;
|
|
197
201
|
|
package/lib/Switch/Switch.js
CHANGED
|
@@ -17,8 +17,6 @@ var _Layout = require("../Layout");
|
|
|
17
17
|
|
|
18
18
|
var _Label = _interopRequireDefault(require("../Label/Label"));
|
|
19
19
|
|
|
20
|
-
var _LibraryContextInit = _interopRequireDefault(require("../Provider/LibraryContextInit"));
|
|
21
|
-
|
|
22
20
|
var _SwitchModule = _interopRequireDefault(require("./Switch.module.css"));
|
|
23
21
|
|
|
24
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -69,8 +67,8 @@ var Switch = /*#__PURE__*/function (_React$Component) {
|
|
|
69
67
|
onChange && onChange(!checked, e);
|
|
70
68
|
}
|
|
71
69
|
}, {
|
|
72
|
-
key: "
|
|
73
|
-
value: function
|
|
70
|
+
key: "render",
|
|
71
|
+
value: function render() {
|
|
74
72
|
var _this$props2 = this.props,
|
|
75
73
|
id = _this$props2.id,
|
|
76
74
|
name = _this$props2.name,
|
|
@@ -101,8 +99,6 @@ var Switch = /*#__PURE__*/function (_React$Component) {
|
|
|
101
99
|
_customClass$customLa = customClass.customLabel,
|
|
102
100
|
customLabel = _customClass$customLa === void 0 ? '' : _customClass$customLa;
|
|
103
101
|
size !== 'small' ? size = 'switch_medium' : size = 'switch_small';
|
|
104
|
-
var isOnOffLabelEnabled = context.a11y_onOffLabel;
|
|
105
|
-
var onOffLabelType = '';
|
|
106
102
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, _extends({
|
|
107
103
|
align: "vertical",
|
|
108
104
|
isCover: false,
|
|
@@ -129,26 +125,9 @@ var Switch = /*#__PURE__*/function (_React$Component) {
|
|
|
129
125
|
htmlFor: id,
|
|
130
126
|
"data-id": dataId,
|
|
131
127
|
"data-test-id": dataId,
|
|
132
|
-
className: "".concat(_SwitchModule["default"].label, " ").concat(_SwitchModule["default"]["".concat(size, "Label")], " ").concat(customSwitch
|
|
128
|
+
className: "".concat(_SwitchModule["default"].label, " ").concat(_SwitchModule["default"]["".concat(size, "Label")], " ").concat(customSwitch),
|
|
133
129
|
tabIndex: isReadOnly || disabled ? '-1' : '0'
|
|
134
|
-
}, /*#__PURE__*/_react["default"].createElement("
|
|
135
|
-
className: _SwitchModule["default"].thumb
|
|
136
|
-
}, isOnOffLabelEnabled && onOffLabelType === 'thumb' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
137
|
-
className: _SwitchModule["default"].onOffIndicationHolder
|
|
138
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
139
|
-
className: "".concat(_SwitchModule["default"].onOffIndication, " ").concat(checked ? _SwitchModule["default"].onIndication : _SwitchModule["default"].offIndication)
|
|
140
|
-
}))), isOnOffLabelEnabled && /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
141
|
-
align: "vertical",
|
|
142
|
-
alignBox: checked ? 'row' : 'row-reverse',
|
|
143
|
-
className: _SwitchModule["default"].onOffLabel,
|
|
144
|
-
isCover: false
|
|
145
|
-
}, onOffLabelType === 'labelOnTrack' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
146
|
-
className: _SwitchModule["default"].onOffIndicationText
|
|
147
|
-
}, checked ? 'ON' : 'OFF'), isOnOffLabelEnabled && onOffLabelType === 'track' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
148
|
-
className: "".concat(_SwitchModule["default"].onOffIndication, " ").concat(checked ? _SwitchModule["default"].onIndication : _SwitchModule["default"].offIndication, " ").concat(_SwitchModule["default"].thumbIndication)
|
|
149
|
-
})))), isOnOffLabelEnabled && onOffLabelType === 'labelSide' && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
150
|
-
className: "".concat(_SwitchModule["default"].labelText, " ").concat(size === "switch_medium" ? _SwitchModule["default"].mediumLabelText : _SwitchModule["default"].smallLabelText)
|
|
151
|
-
}, checked ? 'On' : 'Off'), text && /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
130
|
+
})), text && /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
152
131
|
text: text,
|
|
153
132
|
palette: labelPalette,
|
|
154
133
|
id: id,
|
|
@@ -158,15 +137,6 @@ var Switch = /*#__PURE__*/function (_React$Component) {
|
|
|
158
137
|
customClass: customLabel
|
|
159
138
|
}, LabelProps)));
|
|
160
139
|
}
|
|
161
|
-
}, {
|
|
162
|
-
key: "render",
|
|
163
|
-
value: function render() {
|
|
164
|
-
var _this2 = this;
|
|
165
|
-
|
|
166
|
-
return /*#__PURE__*/_react["default"].createElement(_LibraryContextInit["default"].Consumer, null, function (context) {
|
|
167
|
-
return _this2.renderSwitch(context);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
140
|
}]);
|
|
171
141
|
|
|
172
142
|
return Switch;
|