@zohodesk/components 1.0.0-temp-211.2 → 1.0.0-temp-217
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/es/AvatarTeam/props/propTypes.js +2 -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/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/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 -1
- 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/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/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/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 -1
- 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/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
package/lib/Popup/Popup.js
CHANGED
|
@@ -9,10 +9,10 @@ exports["default"] = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
12
|
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
|
|
15
13
|
|
|
14
|
+
var _propTypes = require("./props/propTypes");
|
|
15
|
+
|
|
16
16
|
var _Common = require("../utils/Common.js");
|
|
17
17
|
|
|
18
18
|
var _viewPort = _interopRequireDefault(require("./viewPort"));
|
|
@@ -21,6 +21,8 @@ var _PositionMapping = require("./PositionMapping.js");
|
|
|
21
21
|
|
|
22
22
|
var _ResizeObserver = _interopRequireDefault(require("@zohodesk/virtualizer/lib/commons/ResizeObserver.js"));
|
|
23
23
|
|
|
24
|
+
var _intersectionObserver = require("./intersectionObserver");
|
|
25
|
+
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
27
|
|
|
26
28
|
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); }
|
|
@@ -151,6 +153,14 @@ var Popup = function Popup(Component) {
|
|
|
151
153
|
_this.handleDocumentMouseDown = _this.handleDocumentMouseDown.bind(_assertThisInitialized(_this));
|
|
152
154
|
_this.handleDocumentFocus = _this.handleDocumentFocus.bind(_assertThisInitialized(_this));
|
|
153
155
|
_this.handleGetNeedPrevent = _this.handleGetNeedPrevent.bind(_assertThisInitialized(_this));
|
|
156
|
+
_this.handleBlockScroll = _this.handleBlockScroll.bind(_assertThisInitialized(_this));
|
|
157
|
+
_this.handlePositionChange = _this.handlePositionChange.bind(_assertThisInitialized(_this));
|
|
158
|
+
_this.preventKeyboardScroll = _this.preventKeyboardScroll.bind(_assertThisInitialized(_this));
|
|
159
|
+
_this.addScrollBlockListeners = _this.addScrollBlockListeners.bind(_assertThisInitialized(_this));
|
|
160
|
+
_this.removeScrollBlockListeners = _this.removeScrollBlockListeners.bind(_assertThisInitialized(_this));
|
|
161
|
+
_this.handleAddingScrollBlock = _this.handleAddingScrollBlock.bind(_assertThisInitialized(_this));
|
|
162
|
+
_this.handleRemovingScrollBlock = _this.handleRemovingScrollBlock.bind(_assertThisInitialized(_this));
|
|
163
|
+
_this.handleIntersectionObserver = _this.handleIntersectionObserver.bind(_assertThisInitialized(_this));
|
|
154
164
|
_this.popupObserver = new _ResizeObserver["default"](_this.handlePopupResize); //dropBoxSize
|
|
155
165
|
|
|
156
166
|
_this.size = null;
|
|
@@ -164,6 +174,7 @@ var Popup = function Popup(Component) {
|
|
|
164
174
|
scrollDebounceTime = _this$getScrollDeboun.scrollDebounceTime;
|
|
165
175
|
|
|
166
176
|
_this.handleScroll = (0, _Common.debounce)(_this.handleScroll.bind(_assertThisInitialized(_this)), scrollDebounceTime);
|
|
177
|
+
_this.handleDebouncedPositionChange = (0, _Common.debounce)(_this.handlePositionChange.bind(_assertThisInitialized(_this)), 100);
|
|
167
178
|
return _this;
|
|
168
179
|
}
|
|
169
180
|
|
|
@@ -216,6 +227,12 @@ var Popup = function Popup(Component) {
|
|
|
216
227
|
this.size = null;
|
|
217
228
|
this.popupObserver.disconnect();
|
|
218
229
|
}
|
|
230
|
+
|
|
231
|
+
if (isPopupReady) {
|
|
232
|
+
this.handleAddingScrollBlock();
|
|
233
|
+
} else {
|
|
234
|
+
this.handleRemovingScrollBlock();
|
|
235
|
+
}
|
|
219
236
|
}
|
|
220
237
|
}
|
|
221
238
|
}, {
|
|
@@ -236,6 +253,7 @@ var Popup = function Popup(Component) {
|
|
|
236
253
|
|
|
237
254
|
return res;
|
|
238
255
|
}, popups);
|
|
256
|
+
this.handleRemovingScrollBlock();
|
|
239
257
|
var noPopups = true;
|
|
240
258
|
|
|
241
259
|
for (var i in popups) {
|
|
@@ -259,6 +277,112 @@ var Popup = function Popup(Component) {
|
|
|
259
277
|
document.removeEventListener('focus', this.handleDocumentFocus, true);
|
|
260
278
|
}
|
|
261
279
|
}
|
|
280
|
+
}, {
|
|
281
|
+
key: "handleAddingScrollBlock",
|
|
282
|
+
value: function handleAddingScrollBlock() {
|
|
283
|
+
var _this$props = this.props,
|
|
284
|
+
isAbsolutePositioningNeeded = _this$props.isAbsolutePositioningNeeded,
|
|
285
|
+
isOutsideScrollBlocked = _this$props.isOutsideScrollBlocked;
|
|
286
|
+
|
|
287
|
+
if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
|
|
288
|
+
(0, _intersectionObserver.addIntersectionObserver)(this.placeHolderElement, this.handleIntersectionObserver);
|
|
289
|
+
this.addScrollBlockListeners();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}, {
|
|
293
|
+
key: "handleRemovingScrollBlock",
|
|
294
|
+
value: function handleRemovingScrollBlock() {
|
|
295
|
+
var _this$props2 = this.props,
|
|
296
|
+
isAbsolutePositioningNeeded = _this$props2.isAbsolutePositioningNeeded,
|
|
297
|
+
isOutsideScrollBlocked = _this$props2.isOutsideScrollBlocked;
|
|
298
|
+
|
|
299
|
+
if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
|
|
300
|
+
(0, _intersectionObserver.removeIntersectionObserver)(this.placeHolderElement, this.handleIntersectionObserver);
|
|
301
|
+
this.removeScrollBlockListeners();
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}, {
|
|
305
|
+
key: "addScrollBlockListeners",
|
|
306
|
+
value: function addScrollBlockListeners() {
|
|
307
|
+
document.addEventListener('wheel', this.handleBlockScroll, {
|
|
308
|
+
capture: true,
|
|
309
|
+
passive: false
|
|
310
|
+
});
|
|
311
|
+
document.addEventListener('touchmove', this.handleBlockScroll, {
|
|
312
|
+
capture: true,
|
|
313
|
+
passive: false
|
|
314
|
+
});
|
|
315
|
+
document.addEventListener('scroll', this.handleDebouncedPositionChange, {
|
|
316
|
+
capture: true,
|
|
317
|
+
passive: false
|
|
318
|
+
});
|
|
319
|
+
document.addEventListener('keydown', this.preventKeyboardScroll, {
|
|
320
|
+
capture: true,
|
|
321
|
+
passive: false
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}, {
|
|
325
|
+
key: "removeScrollBlockListeners",
|
|
326
|
+
value: function removeScrollBlockListeners() {
|
|
327
|
+
document.removeEventListener('wheel', this.handleBlockScroll, {
|
|
328
|
+
capture: true,
|
|
329
|
+
passive: false
|
|
330
|
+
});
|
|
331
|
+
document.removeEventListener('touchmove', this.handleBlockScroll, {
|
|
332
|
+
capture: true,
|
|
333
|
+
passive: false
|
|
334
|
+
});
|
|
335
|
+
document.removeEventListener('scroll', this.handleDebouncedPositionChange, {
|
|
336
|
+
capture: true,
|
|
337
|
+
passive: false
|
|
338
|
+
});
|
|
339
|
+
document.removeEventListener('keydown', this.preventKeyboardScroll, {
|
|
340
|
+
capture: true,
|
|
341
|
+
passive: false
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
}, {
|
|
345
|
+
key: "handleBlockScroll",
|
|
346
|
+
value: function handleBlockScroll(event) {
|
|
347
|
+
// const targetElement = this.placeHolderElement;
|
|
348
|
+
var containerElement = this.dropElement;
|
|
349
|
+
|
|
350
|
+
if (containerElement && containerElement !== event.target && !containerElement.contains(event.target)) {
|
|
351
|
+
// --- Scroll exclude Target & Container elements --- For reference. Will adopt in future
|
|
352
|
+
// if(
|
|
353
|
+
// (containerElement && (containerElement !== event.target && !containerElement.contains(event.target)))
|
|
354
|
+
// && (targetElement && (targetElement !== event.target && !targetElement.contains(event.target)))
|
|
355
|
+
// ) {
|
|
356
|
+
event.preventDefault();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}, {
|
|
360
|
+
key: "handlePositionChange",
|
|
361
|
+
value: function handlePositionChange(event) {
|
|
362
|
+
var targetElement = this.placeHolderElement;
|
|
363
|
+
var containerElement = this.dropElement;
|
|
364
|
+
|
|
365
|
+
if (containerElement && containerElement !== event.target && !containerElement.contains(event.target) && targetElement && targetElement !== event.target && !targetElement.contains(event.target) && event.target.contains(targetElement)) {
|
|
366
|
+
this.handlePopupPosition(this.state.position); // this.closePopupOnly(event);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}, {
|
|
370
|
+
key: "preventKeyboardScroll",
|
|
371
|
+
value: function preventKeyboardScroll(event) {
|
|
372
|
+
var containerElement = this.dropElement;
|
|
373
|
+
var keys = [32, 37, 38, 39, 40]; // Space, Arrow keys
|
|
374
|
+
|
|
375
|
+
if (containerElement && containerElement !== event.target && !containerElement.contains(event.target) && keys.includes(event.keyCode)) {
|
|
376
|
+
event.preventDefault();
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}, {
|
|
380
|
+
key: "handleIntersectionObserver",
|
|
381
|
+
value: function handleIntersectionObserver(entry) {
|
|
382
|
+
if (entry.intersectionRatio === 0) {
|
|
383
|
+
this.closePopupOnly();
|
|
384
|
+
}
|
|
385
|
+
}
|
|
262
386
|
}, {
|
|
263
387
|
key: "getGroup",
|
|
264
388
|
value: function getGroup() {
|
|
@@ -587,15 +711,19 @@ var Popup = function Popup(Component) {
|
|
|
587
711
|
_ref6$left = _ref6.left,
|
|
588
712
|
oldLeft = _ref6$left === void 0 ? '' : _ref6$left,
|
|
589
713
|
_ref6$top = _ref6.top,
|
|
590
|
-
oldTop = _ref6$top === void 0 ? '' : _ref6$top
|
|
714
|
+
oldTop = _ref6$top === void 0 ? '' : _ref6$top,
|
|
715
|
+
_ref6$bottom = _ref6.bottom,
|
|
716
|
+
oldBottom = _ref6$bottom === void 0 ? '' : _ref6$bottom;
|
|
591
717
|
|
|
592
718
|
var _ref7 = viewsOffset[view] || {},
|
|
593
719
|
_ref7$left = _ref7.left,
|
|
594
720
|
left = _ref7$left === void 0 ? '' : _ref7$left,
|
|
595
721
|
_ref7$top = _ref7.top,
|
|
596
|
-
top = _ref7$top === void 0 ? '' : _ref7$top
|
|
722
|
+
top = _ref7$top === void 0 ? '' : _ref7$top,
|
|
723
|
+
_ref7$bottom = _ref7.bottom,
|
|
724
|
+
bottom = _ref7$bottom === void 0 ? '' : _ref7$bottom;
|
|
597
725
|
|
|
598
|
-
var changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top; // let isInViewPort = viewPort.isInViewPort(
|
|
726
|
+
var changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top || oldBottom !== bottom; // let isInViewPort = viewPort.isInViewPort(
|
|
599
727
|
// placeHolderElement,
|
|
600
728
|
// scrollContainer
|
|
601
729
|
// );
|
|
@@ -705,9 +833,8 @@ var Popup = function Popup(Component) {
|
|
|
705
833
|
}(_react["default"].Component);
|
|
706
834
|
|
|
707
835
|
Popup.displayName = Component.displayName || Component.name || Popup.name;
|
|
708
|
-
Popup.contextTypes =
|
|
709
|
-
|
|
710
|
-
};
|
|
836
|
+
Popup.contextTypes = _propTypes.ContextTypes;
|
|
837
|
+
Popup.propTypes = _propTypes.PopupPropTypes;
|
|
711
838
|
return (0, _hoistNonReactStatics["default"])(Popup, Component);
|
|
712
839
|
};
|
|
713
840
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.addIntersectionObserver = addIntersectionObserver;
|
|
7
|
+
exports.removeIntersectionObserver = removeIntersectionObserver;
|
|
8
|
+
|
|
9
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
+
|
|
11
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
|
|
15
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
16
|
+
|
|
17
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
18
|
+
|
|
19
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
20
|
+
|
|
21
|
+
var observerCallbacks = null;
|
|
22
|
+
var intersectionObserver = null;
|
|
23
|
+
|
|
24
|
+
function handleObserverCallbacks(entries) {
|
|
25
|
+
entries.forEach(function (entry) {
|
|
26
|
+
var oldCallbacks = observerCallbacks.get(entry.target);
|
|
27
|
+
|
|
28
|
+
if (Array.isArray(oldCallbacks) && oldCallbacks.length) {
|
|
29
|
+
oldCallbacks.forEach(function (callback) {
|
|
30
|
+
callback && callback(entry);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function addIntersectionObserver(element, callback, options) {
|
|
37
|
+
if (!!element && typeof callback == 'function') {
|
|
38
|
+
if (intersectionObserver === null && observerCallbacks === null) {
|
|
39
|
+
intersectionObserver = new IntersectionObserver(function (entries) {
|
|
40
|
+
handleObserverCallbacks(entries);
|
|
41
|
+
}, options);
|
|
42
|
+
observerCallbacks = new Map();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
intersectionObserver.observe(element);
|
|
46
|
+
var oldCallbacks = observerCallbacks.get(element) || [];
|
|
47
|
+
observerCallbacks.set(element, [].concat(_toConsumableArray(oldCallbacks), [callback]));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function removeIntersectionObserver(element, callback) {
|
|
52
|
+
if (!!element && typeof callback == 'function') {
|
|
53
|
+
var oldCallbacks = observerCallbacks ? observerCallbacks.get(element) : null;
|
|
54
|
+
|
|
55
|
+
if (Array.isArray(oldCallbacks)) {
|
|
56
|
+
var callbacks = oldCallbacks.filter(function (handler) {
|
|
57
|
+
return handler !== callback;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (intersectionObserver && callbacks.length === 0) {
|
|
61
|
+
observerCallbacks["delete"](element);
|
|
62
|
+
intersectionObserver.unobserve(element);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (intersectionObserver && observerCallbacks && observerCallbacks.size === 0) {
|
|
67
|
+
intersectionObserver.disconnect();
|
|
68
|
+
intersectionObserver = null;
|
|
69
|
+
observerCallbacks = null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PopupWrappersPropTypes = exports.PopupPropTypes = exports.ContextTypes = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
+
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
+
|
|
16
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
|
|
18
|
+
var ContextTypes = {
|
|
19
|
+
direction: _propTypes["default"].string
|
|
20
|
+
};
|
|
21
|
+
exports.ContextTypes = ContextTypes;
|
|
22
|
+
var PopupPropTypes = {
|
|
23
|
+
popupGroup: _propTypes["default"].string,
|
|
24
|
+
isArrow: _propTypes["default"].bool,
|
|
25
|
+
isPopupOpen: _propTypes["default"].bool,
|
|
26
|
+
closeOnScroll: _propTypes["default"].bool,
|
|
27
|
+
isOutsideScrollBlocked: _propTypes["default"].bool,
|
|
28
|
+
needResizeHandling: _propTypes["default"].bool,
|
|
29
|
+
isAbsolutePositioningNeeded: _propTypes["default"].bool,
|
|
30
|
+
scrollDebounceTime: _propTypes["default"].number,
|
|
31
|
+
customOrder: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
32
|
+
checkBeforeClose: _propTypes["default"].func
|
|
33
|
+
};
|
|
34
|
+
exports.PopupPropTypes = PopupPropTypes;
|
|
35
|
+
|
|
36
|
+
var PopupWrappersPropTypes = _objectSpread(_objectSpread({
|
|
37
|
+
openPopupOnly: _propTypes["default"].func,
|
|
38
|
+
closePopupOnly: _propTypes["default"].func,
|
|
39
|
+
togglePopup: _propTypes["default"].func,
|
|
40
|
+
removeClose: _propTypes["default"].func,
|
|
41
|
+
isPopupReady: _propTypes["default"].bool,
|
|
42
|
+
position: _propTypes["default"].oneOf(['bottomRight', 'bottomLeft', 'bottomCenter', 'topRight', 'topLeft', 'topCenter', 'rightTop', 'rightBottom', 'rightCenter', 'leftTop', 'leftBottom', 'leftCenter']),
|
|
43
|
+
getTargetRef: _propTypes["default"].func,
|
|
44
|
+
getContainerRef: _propTypes["default"].func
|
|
45
|
+
}, PopupPropTypes), {}, {
|
|
46
|
+
isRestrictScroll: _propTypes["default"].bool,
|
|
47
|
+
positionsOffset: _propTypes["default"].object,
|
|
48
|
+
targetOffset: _propTypes["default"].object
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
exports.PopupWrappersPropTypes = PopupWrappersPropTypes;
|
package/lib/Radio/Radio.js
CHANGED
|
@@ -17,6 +17,8 @@ var _Label = _interopRequireDefault(require("../Label/Label"));
|
|
|
17
17
|
|
|
18
18
|
var _Layout = require("../Layout");
|
|
19
19
|
|
|
20
|
+
var _CssProvider = _interopRequireDefault(require("../Provider/CssProvider"));
|
|
21
|
+
|
|
20
22
|
var _RadioModule = _interopRequireDefault(require("./Radio.module.css"));
|
|
21
23
|
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -106,8 +108,9 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
106
108
|
customRadio = _customClass$customRa2 === void 0 ? '' : _customClass$customRa2,
|
|
107
109
|
_customClass$customLa = customClass.customLabel,
|
|
108
110
|
customLabel = _customClass$customLa === void 0 ? '' : _customClass$customLa;
|
|
109
|
-
var accessMode = isReadOnly ? _RadioModule["default"].readonly : disabled ?
|
|
111
|
+
var accessMode = isReadOnly ? _RadioModule["default"].readonly : disabled ? (0, _CssProvider["default"])('isDisabled') : _RadioModule["default"].pointer;
|
|
110
112
|
var toolTip = disabled ? disabledTitle : title ? title : null;
|
|
113
|
+
var isEditable = !(isReadOnly || disabled);
|
|
111
114
|
var ariaHidden = a11y.ariaHidden,
|
|
112
115
|
_a11y$role = a11y.role,
|
|
113
116
|
role = _a11y$role === void 0 ? 'radio' : _a11y$role,
|
|
@@ -117,7 +120,7 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
117
120
|
ariaLabel = a11y.ariaLabel,
|
|
118
121
|
ariaLabelledby = a11y.ariaLabelledby,
|
|
119
122
|
_a11y$ariaReadonly = a11y.ariaReadonly,
|
|
120
|
-
ariaReadonly = _a11y$ariaReadonly === void 0 ?
|
|
123
|
+
ariaReadonly = _a11y$ariaReadonly === void 0 ? !isEditable ? true : false : _a11y$ariaReadonly;
|
|
121
124
|
var _customProps$Containe = customProps.ContainerProps,
|
|
122
125
|
ContainerProps = _customProps$Containe === void 0 ? {} : _customProps$Containe,
|
|
123
126
|
_customProps$LabelPro = customProps.LabelProps,
|
|
@@ -128,11 +131,11 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
128
131
|
isInline: text ? false : true,
|
|
129
132
|
alignBox: "row",
|
|
130
133
|
align: "both",
|
|
131
|
-
className: "".concat(_RadioModule["default"].container, " ").concat(active && !disabled ? _RadioModule["default"].active : '', " ").concat(accessMode, " ").concat(
|
|
134
|
+
className: "".concat(_RadioModule["default"].container, " ").concat(active && !disabled ? _RadioModule["default"].active : '', " ").concat(accessMode, " ").concat(!isEditable ? '' : _RadioModule["default"].hoverEfffect, " ").concat(checked ? _RadioModule["default"].checked : '', " ").concat(customRadioWrap),
|
|
132
135
|
"data-title": toolTip,
|
|
133
136
|
onClick: !isReadOnly && !disabled ? this.onChange : '',
|
|
134
137
|
"aria-checked": ariaChecked,
|
|
135
|
-
tabindex:
|
|
138
|
+
tabindex: !isEditable || ariaHidden ? '-1' : tabIndex || '0',
|
|
136
139
|
eleRef: this.handleGetRef,
|
|
137
140
|
role: role,
|
|
138
141
|
"aria-Hidden": ariaHidden,
|
|
@@ -140,7 +143,7 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
140
143
|
"aria-labelledby": ariaLabelledby,
|
|
141
144
|
"aria-readonly": ariaReadonly
|
|
142
145
|
}, ContainerProps), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
143
|
-
className: "".concat(_RadioModule["default"].radio, " ").concat(checked ? "".concat(_RadioModule["default"]["rdBox".concat(palette)]) : '', " \n ").concat(
|
|
146
|
+
className: "".concat(_RadioModule["default"].radio, " ").concat(checked ? "".concat(_RadioModule["default"]["rdBox".concat(palette)]) : '', " \n ").concat(!isEditable ? '' : "".concat(_RadioModule["default"]["hover".concat(palette)]), " ").concat(_RadioModule["default"][size], " ").concat(isFilled ? _RadioModule["default"].filled : '', " ").concat(_RadioModule["default"]["centerPath".concat(palette)], " ").concat(customRadio, " ").concat(!isEditable ? "".concat(_RadioModule["default"].disabled) : '')
|
|
144
147
|
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
145
148
|
type: "hidden",
|
|
146
149
|
id: id,
|
|
@@ -163,7 +166,7 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
163
166
|
className: "".concat(_RadioModule["default"].centerPath)
|
|
164
167
|
}) : null))), text && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
165
168
|
flexible: true,
|
|
166
|
-
className: _RadioModule["default"].text
|
|
169
|
+
className: "".concat(_RadioModule["default"].text, " ").concat(disabled ? "".concat(_RadioModule["default"].disabled) : '')
|
|
167
170
|
}, /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
168
171
|
text: text,
|
|
169
172
|
palette: labelPalette,
|
|
@@ -173,7 +176,7 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
173
176
|
dataId: "".concat(text, "_label"),
|
|
174
177
|
variant: variant,
|
|
175
178
|
title: toolTip ? toolTip : text,
|
|
176
|
-
customClass: "".concat(checked && active ? "".concat(_RadioModule["default"]["".concat(palette, "checkedActive")]) : '', " \n ").concat(_RadioModule["default"]["".concat(palette, "Label")], " ").concat(
|
|
179
|
+
customClass: "".concat(checked && active ? "".concat(_RadioModule["default"]["".concat(palette, "checkedActive")]) : '', " \n ").concat(_RadioModule["default"]["".concat(palette, "Label")], " ").concat(isEditable ? _RadioModule["default"].pointer : '', " ").concat(isReadOnly ? _RadioModule["default"].readonly : '', " ").concat(customLabel)
|
|
177
180
|
}, LabelProps))), children, renderRightPlaceholderNode ? renderRightPlaceholderNode : null);
|
|
178
181
|
}
|
|
179
182
|
}]);
|