@enact/ui 4.5.2 → 4.6.0
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/AnnounceDecorator/Announce.js +1 -40
- package/AnnounceDecorator/AnnounceDecorator.js +3 -21
- package/AnnounceDecorator/tests/Announce-specs.js +2 -7
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
- package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
- package/AnnounceDecorator/useAnnounce.js +0 -6
- package/BodyText/BodyText.d.ts +1 -1
- package/BodyText/BodyText.js +8 -28
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.d.ts +6 -6
- package/Button/Button.js +33 -63
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +30 -0
- package/Cancelable/Cancelable.js +8 -47
- package/Cancelable/cancelHandler.js +5 -12
- package/Cancelable/modalHandler.js +3 -11
- package/Cancelable/tests/Cancelable-specs.js +3 -57
- package/Changeable/Changeable.js +2 -34
- package/Changeable/tests/Changeable-specs.js +20 -66
- package/ComponentOverride/ComponentOverride.js +1 -13
- package/FloatingLayer/FloatingLayer.js +17 -73
- package/FloatingLayer/FloatingLayerContainer.js +0 -15
- package/FloatingLayer/FloatingLayerDecorator.js +4 -17
- package/FloatingLayer/Scrim.js +9 -53
- package/FloatingLayer/index.js +0 -4
- package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
- package/FloatingLayer/tests/Scrim-specs.js +0 -9
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
- package/FloatingLayer/useFloatingLayer.js +3 -14
- package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
- package/ForwardRef/ForwardRef.js +1 -10
- package/GridListImageItem/GridListImageItem.d.ts +1 -1
- package/GridListImageItem/GridListImageItem.js +18 -51
- package/Group/Group.js +5 -36
- package/Group/GroupItem.js +16 -33
- package/Group/tests/Group-specs.js +0 -32
- package/Heading/Heading.js +8 -36
- package/Heading/tests/Heading-specs.js +81 -14
- package/Icon/Icon.d.ts +4 -4
- package/Icon/Icon.js +19 -53
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.d.ts +4 -4
- package/IconButton/IconButton.js +17 -55
- package/IconButton/tests/IconButton-specs.js +0 -7
- package/Image/Image.js +17 -46
- package/Image/tests/Image-specs.js +0 -14
- package/ImageItem/ImageItem.js +18 -47
- package/ImageItem/tests/ImageItem-specs.js +0 -25
- package/Item/Item.js +9 -33
- package/Item/tests/Item-specs.js +0 -24
- package/LabeledIcon/LabeledIcon.d.ts +2 -2
- package/LabeledIcon/LabeledIcon.js +22 -53
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +18 -44
- package/Layout/Layout.d.ts +16 -16
- package/Layout/Layout.js +23 -46
- package/Layout/tests/Layout-specs.js +10 -39
- package/Marquee/MarqueeBase.js +29 -63
- package/Marquee/MarqueeController.js +11 -72
- package/Marquee/MarqueeDecorator.js +70 -196
- package/Marquee/index.js +1 -5
- package/Marquee/tests/Marquee-specs.js +295 -87
- package/Measurable/Measurable.js +12 -34
- package/Measurable/tests/Measurable-specs.js +115 -0
- package/Media/Media.js +15 -65
- package/Media/tests/Media-specs.js +168 -0
- package/Placeholder/PlaceholderControllerDecorator.js +7 -43
- package/Placeholder/PlaceholderDecorator.js +7 -38
- package/Placeholder/index.js +1 -5
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
- package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
- package/ProgressBar/ProgressBar.js +14 -45
- package/ProgressBar/tests/ProgressBar-specs.js +0 -17
- package/RadioDecorator/RadioControllerDecorator.js +1 -29
- package/RadioDecorator/RadioDecorator.js +4 -42
- package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
- package/Repeater/Repeater.js +9 -33
- package/Repeater/tests/Repeater-specs.js +0 -38
- package/Resizable/Resizable.js +9 -37
- package/Resizable/tests/Resizable-specs.js +34 -0
- package/Routable/Link.js +11 -47
- package/Routable/Routable.d.ts +2 -2
- package/Routable/Routable.js +12 -35
- package/Routable/Route.js +0 -6
- package/Routable/Router.js +15 -58
- package/Routable/tests/Routable-specs.js +7 -33
- package/Routable/tests/Router-specs.js +18 -44
- package/Routable/useLink.js +4 -8
- package/Routable/util.js +18 -24
- package/Scrollable/ScrollAnimator.js +49 -65
- package/Scrollable/ScrollThumb.js +2 -13
- package/Scrollable/Scrollable.js +180 -387
- package/Scrollable/ScrollableNative.js +189 -392
- package/Scrollable/Scrollbar.js +30 -102
- package/Scroller/Scroller.js +15 -39
- package/Scroller/ScrollerBasic.js +34 -89
- package/Scroller/UiScrollerBase.js +31 -84
- package/Scroller/tests/Scroller-specs.js +56 -0
- package/Skinnable/Skinnable.js +11 -38
- package/Skinnable/tests/Skinnable-specs.js +3 -74
- package/Skinnable/tests/useSkins-specs.js +1 -13
- package/Skinnable/tests/util-specs.js +0 -14
- package/Skinnable/useSkins.js +8 -15
- package/Skinnable/util.js +9 -20
- package/Slider/Knob.js +5 -24
- package/Slider/PositionDecorator.js +16 -54
- package/Slider/Slider.d.ts +2 -2
- package/Slider/Slider.js +29 -67
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.d.ts +1 -1
- package/SlotItem/SlotItem.js +17 -43
- package/SlotItem/tests/SlotItem-specs.js +0 -5
- package/Slottable/Slottable.js +4 -12
- package/Slottable/tests/Slottable-specs.js +19 -46
- package/Slottable/tests/useSlots-specs.js +27 -65
- package/Slottable/useSlots.js +8 -33
- package/Spinner/Spinner.d.ts +1 -1
- package/Spinner/Spinner.js +16 -43
- package/Spinner/tests/Spinner-specs.js +0 -15
- package/ToggleIcon/ToggleIcon.js +10 -36
- package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
- package/ToggleItem/ToggleItem.d.ts +3 -3
- package/ToggleItem/ToggleItem.js +18 -55
- package/ToggleItem/tests/ToggleItem-specs.js +0 -30
- package/Toggleable/Toggle.js +1 -15
- package/Toggleable/Toggleable.js +12 -45
- package/Toggleable/tests/Toggleable-specs.js +28 -96
- package/Toggleable/useToggle.js +3 -19
- package/Touchable/ClickAllow.js +5 -14
- package/Touchable/Drag.js +16 -54
- package/Touchable/Flick.js +11 -42
- package/Touchable/Hold.js +21 -68
- package/Touchable/Touch.js +37 -65
- package/Touchable/Touchable.js +32 -71
- package/Touchable/config.js +8 -22
- package/Touchable/tests/Touchable-specs.js +270 -119
- package/Touchable/tests/useTouch-specs.js +6 -80
- package/Touchable/useTouch.js +17 -34
- package/Transition/Transition.js +37 -118
- package/Transition/tests/Transition-specs.js +20 -60
- package/ViewManager/Arranger.js +10 -22
- package/ViewManager/TransitionGroup.js +32 -107
- package/ViewManager/View.js +35 -91
- package/ViewManager/ViewManager.d.ts +1 -1
- package/ViewManager/ViewManager.js +20 -84
- package/ViewManager/tests/View-specs.js +0 -17
- package/ViewManager/tests/ViewManager-specs.js +236 -305
- package/ViewManager/tests/test-utils.js +0 -8
- package/VirtualList/UiVirtualListBase.js +259 -409
- package/VirtualList/VirtualList.d.ts +4 -4
- package/VirtualList/VirtualList.js +29 -69
- package/VirtualList/VirtualListBase.js +0 -3
- package/VirtualList/VirtualListBasic.js +273 -431
- package/VirtualList/tests/VirtualGridList-native-specs.js +161 -0
- package/VirtualList/tests/VirtualGridList-specs.js +614 -0
- package/VirtualList/tests/VirtualList-native-specs.js +152 -0
- package/VirtualList/tests/VirtualList-specs.js +423 -95
- package/internal/IdProvider/IdProvider.js +7 -21
- package/internal/IdProvider/Provider.js +4 -17
- package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
- package/internal/IdProvider/tests/useId-specs.js +6 -20
- package/internal/IdProvider/useId.js +0 -6
- package/internal/Pure/Pure.js +3 -30
- package/internal/Pure/tests/Pure-specs.js +88 -0
- package/internal/localized-fonts/localized-fonts.js +33 -62
- package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
- package/internal/selection/selection.js +1 -6
- package/internal/selection/tests/selection-specs.js +6 -4
- package/internal/validators/tests/validators-specs.js +80 -0
- package/internal/validators/validators.js +14 -34
- package/package.json +9 -3
- package/resolution/ResolutionDecorator.js +4 -40
- package/resolution/index.js +0 -7
- package/resolution/resolution.js +42 -80
- package/resolution/tests/ResolutionDecorator-specs.js +4 -11
- package/resolution/tests/resolution-specs.js +2 -2
- package/useControlledState/tests/useControlledState-specs.js +15 -46
- package/useControlledState/useControlledState.js +11 -22
- package/useScroll/ScrollAnimator.js +49 -65
- package/useScroll/Scrollbar.js +22 -58
- package/useScroll/ScrollbarTrack.js +3 -19
- package/useScroll/useScroll.js +267 -454
- package/useScroll/utilDOM.js +8 -14
- package/useScroll/utilEvent.js +0 -4
|
@@ -4,25 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.ComponentOverride = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
var _reactIs = require("react-is");
|
|
11
|
-
|
|
12
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
|
|
14
10
|
var _excluded = ["component"];
|
|
15
|
-
|
|
16
11
|
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; }
|
|
17
|
-
|
|
18
12
|
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; }
|
|
19
|
-
|
|
20
13
|
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; }
|
|
21
|
-
|
|
22
14
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
23
|
-
|
|
24
15
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
25
|
-
|
|
26
16
|
/**
|
|
27
17
|
* Utility to either create or clone a component instance with the given set of props.
|
|
28
18
|
*
|
|
@@ -68,11 +58,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
68
58
|
*/
|
|
69
59
|
var ComponentOverride = function ComponentOverride(_ref) {
|
|
70
60
|
var Component = _ref.component,
|
|
71
|
-
|
|
72
|
-
|
|
61
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
73
62
|
return Component && ((0, _reactIs.isValidElementType)(Component) && /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, _objectSpread({}, props)) || /*#__PURE__*/(0, _react.isValidElement)(Component) && /*#__PURE__*/(0, _react.cloneElement)(Component, props)) || null;
|
|
74
63
|
};
|
|
75
|
-
|
|
76
64
|
exports.ComponentOverride = ComponentOverride;
|
|
77
65
|
var _default = ComponentOverride;
|
|
78
66
|
exports["default"] = _default;
|
|
@@ -4,65 +4,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.FloatingLayerBase = exports.FloatingLayer = void 0;
|
|
7
|
-
|
|
8
7
|
var _dispatcher = require("@enact/core/dispatcher");
|
|
9
|
-
|
|
10
8
|
var _handle = require("@enact/core/handle");
|
|
11
|
-
|
|
12
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
10
|
var _invariant = _interopRequireDefault(require("invariant"));
|
|
15
|
-
|
|
16
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
-
|
|
18
12
|
var _react = require("react");
|
|
19
|
-
|
|
20
13
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
21
|
-
|
|
22
14
|
var _Cancelable = _interopRequireDefault(require("../Cancelable"));
|
|
23
|
-
|
|
24
15
|
var _FloatingLayerDecorator = require("./FloatingLayerDecorator");
|
|
25
|
-
|
|
26
16
|
var _Scrim = _interopRequireDefault(require("./Scrim"));
|
|
27
|
-
|
|
28
17
|
var _FloatingLayerModule = _interopRequireDefault(require("./FloatingLayer.module.css"));
|
|
29
|
-
|
|
30
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
|
-
|
|
32
19
|
var _excluded = ["children", "className", "floatLayerClassName", "open", "scrimType"];
|
|
33
|
-
|
|
34
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
35
|
-
|
|
36
21
|
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; }
|
|
37
|
-
|
|
38
22
|
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; }
|
|
39
|
-
|
|
40
23
|
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; }
|
|
41
|
-
|
|
42
24
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
43
|
-
|
|
44
25
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
45
|
-
|
|
46
26
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
47
|
-
|
|
48
27
|
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); } }
|
|
49
|
-
|
|
50
28
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
51
|
-
|
|
52
29
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
53
|
-
|
|
54
30
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
55
|
-
|
|
56
31
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
57
|
-
|
|
58
32
|
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
59
|
-
|
|
60
33
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
61
|
-
|
|
62
34
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
63
|
-
|
|
64
35
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
65
|
-
|
|
66
36
|
/**
|
|
67
37
|
* A component that creates an entry point to the new render tree.
|
|
68
38
|
*
|
|
@@ -75,14 +45,10 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
75
45
|
*/
|
|
76
46
|
var FloatingLayerBase = /*#__PURE__*/function (_Component) {
|
|
77
47
|
_inherits(FloatingLayerBase, _Component);
|
|
78
|
-
|
|
79
48
|
var _super = _createSuper(FloatingLayerBase);
|
|
80
|
-
|
|
81
49
|
function FloatingLayerBase(props) {
|
|
82
50
|
var _this;
|
|
83
|
-
|
|
84
51
|
_classCallCheck(this, FloatingLayerBase);
|
|
85
|
-
|
|
86
52
|
_this = _super.call(this, props);
|
|
87
53
|
_this.handleNotify = (0, _handle.oneOf)([(0, _handle.forEventProp)('action', 'close'), (0, _handle.call)('handleClose')], [(0, _handle.forEventProp)('action', 'mount'), (0, _handle.call)('setFloatingLayer')]).bind(_assertThisInitialized(_this));
|
|
88
54
|
_this.handleClose = (0, _handle.handle)((0, _handle.forProp)('open', true), (0, _handle.forwardCustom)('onDismiss')).bind(_assertThisInitialized(_this));
|
|
@@ -93,28 +59,23 @@ var FloatingLayerBase = /*#__PURE__*/function (_Component) {
|
|
|
93
59
|
}
|
|
94
60
|
};
|
|
95
61
|
})).bind(_assertThisInitialized(_this));
|
|
96
|
-
|
|
97
62
|
_this.handleScroll = function (ev) {
|
|
98
63
|
var currentTarget = ev.currentTarget;
|
|
99
64
|
currentTarget.scrollTop = 0;
|
|
100
65
|
currentTarget.scrollLeft = 0;
|
|
101
66
|
};
|
|
102
|
-
|
|
103
67
|
_this.stopPropagation = function (ev) {
|
|
104
68
|
ev.nativeEvent.stopImmediatePropagation();
|
|
105
|
-
|
|
106
69
|
if (_this.props.children.props.onClick) {
|
|
107
70
|
_this.props.children.props.onClick();
|
|
108
71
|
}
|
|
109
72
|
};
|
|
110
|
-
|
|
111
73
|
_this.node = null;
|
|
112
74
|
_this.state = {
|
|
113
75
|
readyToRender: false
|
|
114
76
|
};
|
|
115
77
|
return _this;
|
|
116
78
|
}
|
|
117
|
-
|
|
118
79
|
_createClass(FloatingLayerBase, [{
|
|
119
80
|
key: "componentDidMount",
|
|
120
81
|
value: function componentDidMount() {
|
|
@@ -123,7 +84,6 @@ var FloatingLayerBase = /*#__PURE__*/function (_Component) {
|
|
|
123
84
|
if (this.context && typeof this.context === 'function') {
|
|
124
85
|
this.controller = this.context(this.handleNotify.bind(this));
|
|
125
86
|
}
|
|
126
|
-
|
|
127
87
|
if (this.props.scrimType === 'none' && this.props.open) {
|
|
128
88
|
(0, _dispatcher.on)('click', this.handleClick);
|
|
129
89
|
}
|
|
@@ -132,9 +92,8 @@ var FloatingLayerBase = /*#__PURE__*/function (_Component) {
|
|
|
132
92
|
key: "componentDidUpdate",
|
|
133
93
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
134
94
|
var _this$props = this.props,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
95
|
+
open = _this$props.open,
|
|
96
|
+
scrimType = _this$props.scrimType;
|
|
138
97
|
if (prevProps.open && !open) {
|
|
139
98
|
// when open changes to false, forward close
|
|
140
99
|
(0, _handle.forwardCustom)('onClose')(null, this.props);
|
|
@@ -146,7 +105,6 @@ var FloatingLayerBase = /*#__PURE__*/function (_Component) {
|
|
|
146
105
|
// the open prop changed in this cycle, forward open
|
|
147
106
|
(0, _handle.forwardCustom)('onOpen')(null, this.props);
|
|
148
107
|
}
|
|
149
|
-
|
|
150
108
|
if (scrimType === 'none') {
|
|
151
109
|
if (!prevProps.open && open) {
|
|
152
110
|
(0, _dispatcher.on)('click', this.handleClick);
|
|
@@ -162,9 +120,7 @@ var FloatingLayerBase = /*#__PURE__*/function (_Component) {
|
|
|
162
120
|
(0, _dispatcher.off)('scroll', this.handleScroll, this.floatingLayer);
|
|
163
121
|
this.floatingLayer = null;
|
|
164
122
|
}
|
|
165
|
-
|
|
166
123
|
(0, _dispatcher.off)('click', this.handleClick);
|
|
167
|
-
|
|
168
124
|
if (this.controller) {
|
|
169
125
|
this.controller.unregister();
|
|
170
126
|
}
|
|
@@ -174,9 +130,10 @@ var FloatingLayerBase = /*#__PURE__*/function (_Component) {
|
|
|
174
130
|
value: function setFloatingLayer(_ref) {
|
|
175
131
|
var floatingLayer = _ref.floatingLayer;
|
|
176
132
|
var isNewLayer = !this.floatingLayer && floatingLayer;
|
|
177
|
-
this.floatingLayer = floatingLayer;
|
|
178
|
-
// we need to render the layer.
|
|
133
|
+
this.floatingLayer = floatingLayer;
|
|
179
134
|
|
|
135
|
+
// the first time we have a valid floating layer container and this instance is set to open,
|
|
136
|
+
// we need to render the layer.
|
|
180
137
|
if (isNewLayer && this.props.open && !this.state.readyToRender) {
|
|
181
138
|
this.readyToRender();
|
|
182
139
|
}
|
|
@@ -195,20 +152,18 @@ var FloatingLayerBase = /*#__PURE__*/function (_Component) {
|
|
|
195
152
|
key: "render",
|
|
196
153
|
value: function render() {
|
|
197
154
|
var _this$props2 = this.props,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
155
|
+
children = _this$props2.children,
|
|
156
|
+
className = _this$props2.className,
|
|
157
|
+
floatLayerClassName = _this$props2.floatLayerClassName,
|
|
158
|
+
open = _this$props2.open,
|
|
159
|
+
scrimType = _this$props2.scrimType,
|
|
160
|
+
rest = _objectWithoutProperties(_this$props2, _excluded);
|
|
205
161
|
var mergedClassName = (0, _classnames["default"])(floatLayerClassName, _FloatingLayerModule["default"].floatingLayer, className);
|
|
206
162
|
delete rest.floatLayerId;
|
|
207
163
|
delete rest.noAutoDismiss;
|
|
208
164
|
delete rest.onClose;
|
|
209
165
|
delete rest.onDismiss;
|
|
210
166
|
delete rest.onOpen;
|
|
211
|
-
|
|
212
167
|
if (open && this.state.readyToRender) {
|
|
213
168
|
return /*#__PURE__*/_reactDom["default"].createPortal( /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({
|
|
214
169
|
className: mergedClassName
|
|
@@ -221,19 +176,14 @@ var FloatingLayerBase = /*#__PURE__*/function (_Component) {
|
|
|
221
176
|
})]
|
|
222
177
|
})), this.floatingLayer);
|
|
223
178
|
}
|
|
224
|
-
|
|
225
179
|
return null;
|
|
226
180
|
}
|
|
227
181
|
}]);
|
|
228
|
-
|
|
229
182
|
return FloatingLayerBase;
|
|
230
183
|
}(_react.Component);
|
|
231
|
-
|
|
232
184
|
exports.FloatingLayerBase = FloatingLayerBase;
|
|
233
185
|
FloatingLayerBase.displayName = 'FloatingLayer';
|
|
234
|
-
FloatingLayerBase.propTypes =
|
|
235
|
-
/** @lends ui/FloatingLayer.FloatingLayerBase.prototype */
|
|
236
|
-
{
|
|
186
|
+
FloatingLayerBase.propTypes = /** @lends ui/FloatingLayer.FloatingLayerBase.prototype */{
|
|
237
187
|
/**
|
|
238
188
|
* CSS classes for FloatingLayer.
|
|
239
189
|
*
|
|
@@ -242,7 +192,6 @@ FloatingLayerBase.propTypes =
|
|
|
242
192
|
* @public
|
|
243
193
|
*/
|
|
244
194
|
floatLayerClassName: _propTypes["default"].string,
|
|
245
|
-
|
|
246
195
|
/**
|
|
247
196
|
* Element id for floating layer.
|
|
248
197
|
*
|
|
@@ -251,7 +200,6 @@ FloatingLayerBase.propTypes =
|
|
|
251
200
|
* @public
|
|
252
201
|
*/
|
|
253
202
|
floatLayerId: _propTypes["default"].string,
|
|
254
|
-
|
|
255
203
|
/**
|
|
256
204
|
* Prevents FloatingLayer from hiding when the user presses cancel/back (e.g. `ESC`) key or
|
|
257
205
|
* clicks outside the floating layer.
|
|
@@ -261,7 +209,6 @@ FloatingLayerBase.propTypes =
|
|
|
261
209
|
* @public
|
|
262
210
|
*/
|
|
263
211
|
noAutoDismiss: _propTypes["default"].bool,
|
|
264
|
-
|
|
265
212
|
/**
|
|
266
213
|
* Called when floating layer is closed.
|
|
267
214
|
*
|
|
@@ -269,7 +216,6 @@ FloatingLayerBase.propTypes =
|
|
|
269
216
|
* @public
|
|
270
217
|
*/
|
|
271
218
|
onClose: _propTypes["default"].func,
|
|
272
|
-
|
|
273
219
|
/**
|
|
274
220
|
* Called when a closing action is invoked.
|
|
275
221
|
*
|
|
@@ -286,7 +232,6 @@ FloatingLayerBase.propTypes =
|
|
|
286
232
|
* @public
|
|
287
233
|
*/
|
|
288
234
|
onDismiss: _propTypes["default"].func,
|
|
289
|
-
|
|
290
235
|
/**
|
|
291
236
|
* Called when floating layer is opened. It will only be invoked for the first render.
|
|
292
237
|
*
|
|
@@ -294,7 +239,6 @@ FloatingLayerBase.propTypes =
|
|
|
294
239
|
* @public
|
|
295
240
|
*/
|
|
296
241
|
onOpen: _propTypes["default"].func,
|
|
297
|
-
|
|
298
242
|
/**
|
|
299
243
|
* Renders the floating layer and its components.
|
|
300
244
|
*
|
|
@@ -303,7 +247,6 @@ FloatingLayerBase.propTypes =
|
|
|
303
247
|
* @public
|
|
304
248
|
*/
|
|
305
249
|
open: _propTypes["default"].bool,
|
|
306
|
-
|
|
307
250
|
/**
|
|
308
251
|
* The scrim type that overlays FloatingLayer.
|
|
309
252
|
*
|
|
@@ -323,11 +266,12 @@ FloatingLayerBase.defaultProps = {
|
|
|
323
266
|
open: false,
|
|
324
267
|
scrimType: 'translucent'
|
|
325
268
|
};
|
|
326
|
-
var handleCancel = (0, _handle.handle)(
|
|
269
|
+
var handleCancel = (0, _handle.handle)(
|
|
270
|
+
// can't use forProp safely since either could be undefined ~= false
|
|
327
271
|
function (ev, _ref2) {
|
|
328
272
|
var open = _ref2.open,
|
|
329
|
-
|
|
330
|
-
|
|
273
|
+
noAutoDismiss = _ref2.noAutoDismiss,
|
|
274
|
+
onDismiss = _ref2.onDismiss;
|
|
331
275
|
return open && !noAutoDismiss && onDismiss;
|
|
332
276
|
}, (0, _handle.forwardCustom)('onDismiss', function () {
|
|
333
277
|
return {
|
|
@@ -336,6 +280,7 @@ function (ev, _ref2) {
|
|
|
336
280
|
}
|
|
337
281
|
};
|
|
338
282
|
}), _handle.stop);
|
|
283
|
+
|
|
339
284
|
/**
|
|
340
285
|
* FloatingLayer that mixes {@link ui/Cancelable.Cancelable} to handle FloatingLayer dismissal.
|
|
341
286
|
*
|
|
@@ -348,7 +293,6 @@ function (ev, _ref2) {
|
|
|
348
293
|
* @mixes ui/Cancelable.Cancelable
|
|
349
294
|
* @public
|
|
350
295
|
*/
|
|
351
|
-
|
|
352
296
|
var FloatingLayer = (0, _Cancelable["default"])({
|
|
353
297
|
modal: true,
|
|
354
298
|
onCancel: handleCancel
|
|
@@ -4,23 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.FloatingLayerContainer = void 0;
|
|
7
|
-
|
|
8
7
|
var _Registry = _interopRequireDefault(require("@enact/core/internal/Registry"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
9
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
-
|
|
14
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); } }
|
|
15
|
-
|
|
16
11
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
|
-
|
|
18
12
|
var FloatingLayerContainer = /*#__PURE__*/function () {
|
|
19
13
|
function FloatingLayerContainer(config) {
|
|
20
14
|
var _this = this;
|
|
21
|
-
|
|
22
15
|
_classCallCheck(this, FloatingLayerContainer);
|
|
23
|
-
|
|
24
16
|
this.getFloatingLayer = function () {
|
|
25
17
|
// FIXME: if a component that resides in the floating layer is rendered at the same time
|
|
26
18
|
// as the floating layer, this.floatingLayer may not have been initialized yet since
|
|
@@ -28,21 +20,17 @@ var FloatingLayerContainer = /*#__PURE__*/function () {
|
|
|
28
20
|
// introduce issues (e.g. for duplicate layer ids).
|
|
29
21
|
return _this.floatingLayer || typeof document !== 'undefined' && document.getElementById(_this.config.floatLayerId) || null;
|
|
30
22
|
};
|
|
31
|
-
|
|
32
23
|
this.handleNotify = function (_ref) {
|
|
33
24
|
var action = _ref.action;
|
|
34
|
-
|
|
35
25
|
if (action === 'register') {
|
|
36
26
|
_this.notifyMount();
|
|
37
27
|
} else if (action === 'closeAll') {
|
|
38
28
|
_this.handleCloseAll();
|
|
39
29
|
}
|
|
40
30
|
};
|
|
41
|
-
|
|
42
31
|
this.setFloatingLayer = function (node) {
|
|
43
32
|
_this.floatingLayer = node;
|
|
44
33
|
};
|
|
45
|
-
|
|
46
34
|
var floatLayerId = config.floatLayerId;
|
|
47
35
|
this.registry = _Registry["default"].create(this.handleNotify);
|
|
48
36
|
this.floatingLayer = null;
|
|
@@ -50,7 +38,6 @@ var FloatingLayerContainer = /*#__PURE__*/function () {
|
|
|
50
38
|
floatLayerId: floatLayerId
|
|
51
39
|
};
|
|
52
40
|
}
|
|
53
|
-
|
|
54
41
|
_createClass(FloatingLayerContainer, [{
|
|
55
42
|
key: "load",
|
|
56
43
|
value: function load() {
|
|
@@ -72,10 +59,8 @@ var FloatingLayerContainer = /*#__PURE__*/function () {
|
|
|
72
59
|
});
|
|
73
60
|
}
|
|
74
61
|
}]);
|
|
75
|
-
|
|
76
62
|
return FloatingLayerContainer;
|
|
77
63
|
}();
|
|
78
|
-
|
|
79
64
|
exports.FloatingLayerContainer = FloatingLayerContainer;
|
|
80
65
|
var _default = FloatingLayerContainer;
|
|
81
66
|
exports["default"] = _default;
|
|
@@ -16,27 +16,16 @@ Object.defineProperty(exports, "useFloatingLayerDecorator", {
|
|
|
16
16
|
return _useFloatingLayerDecorator.useFloatingLayerDecorator;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
|
|
20
19
|
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
21
|
-
|
|
22
20
|
var _useFloatingLayerDecorator = require("./useFloatingLayerDecorator");
|
|
23
|
-
|
|
24
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
-
|
|
26
22
|
var _excluded = ["className"];
|
|
27
|
-
|
|
28
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
|
-
|
|
30
24
|
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; }
|
|
31
|
-
|
|
32
25
|
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; }
|
|
33
|
-
|
|
34
26
|
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; }
|
|
35
|
-
|
|
36
27
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
37
|
-
|
|
38
28
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
39
|
-
|
|
40
29
|
/**
|
|
41
30
|
* Default config for {@link ui/FloatingLayer.FloatingLayerDecorator}.
|
|
42
31
|
*
|
|
@@ -53,7 +42,6 @@ var defaultConfig = {
|
|
|
53
42
|
* @memberof ui/FloatingLayer.FloatingLayerDecorator.defaultConfig
|
|
54
43
|
*/
|
|
55
44
|
floatLayerId: 'floatLayer',
|
|
56
|
-
|
|
57
45
|
/**
|
|
58
46
|
* Class name to be applied to wrapped component.
|
|
59
47
|
* It can be used when you want to only apply
|
|
@@ -66,6 +54,7 @@ var defaultConfig = {
|
|
|
66
54
|
*/
|
|
67
55
|
wrappedClassName: ''
|
|
68
56
|
};
|
|
57
|
+
|
|
69
58
|
/**
|
|
70
59
|
* A higher-order component that adds a FloatingLayer adjacent to the wrapped component.
|
|
71
60
|
*
|
|
@@ -78,15 +67,14 @@ var defaultConfig = {
|
|
|
78
67
|
* @hoc
|
|
79
68
|
* @public
|
|
80
69
|
*/
|
|
81
|
-
|
|
82
70
|
var FloatingLayerDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
83
71
|
var floatLayerId = config.floatLayerId,
|
|
84
|
-
|
|
72
|
+
wrappedClassName = config.wrappedClassName;
|
|
85
73
|
|
|
74
|
+
// eslint-disable-next-line no-shadow
|
|
86
75
|
function FloatingLayerDecorator(props) {
|
|
87
76
|
var className = props.className,
|
|
88
|
-
|
|
89
|
-
|
|
77
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
90
78
|
var hook = (0, _useFloatingLayerDecorator.useFloatingLayerDecorator)({
|
|
91
79
|
className: className,
|
|
92
80
|
floatLayerId: floatLayerId
|
|
@@ -95,7 +83,6 @@ var FloatingLayerDecorator = (0, _hoc["default"])(defaultConfig, function (confi
|
|
|
95
83
|
className: wrappedClassName
|
|
96
84
|
}), "floatWrapped"));
|
|
97
85
|
}
|
|
98
|
-
|
|
99
86
|
return FloatingLayerDecorator;
|
|
100
87
|
});
|
|
101
88
|
exports.FloatingLayerDecorator = FloatingLayerDecorator;
|
package/FloatingLayer/Scrim.js
CHANGED
|
@@ -4,54 +4,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.Scrim = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _ScrimModule = _interopRequireDefault(require("./Scrim.module.css"));
|
|
13
|
-
|
|
14
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
|
|
16
11
|
var _excluded = ["type"];
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
13
|
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; }
|
|
21
|
-
|
|
22
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; }
|
|
23
|
-
|
|
24
15
|
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; }
|
|
25
|
-
|
|
26
16
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
27
|
-
|
|
28
17
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
29
|
-
|
|
30
18
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
31
|
-
|
|
32
19
|
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); } }
|
|
33
|
-
|
|
34
20
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
35
|
-
|
|
36
21
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
37
|
-
|
|
38
22
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
39
|
-
|
|
40
23
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
41
|
-
|
|
42
24
|
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
43
|
-
|
|
44
25
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
45
|
-
|
|
46
26
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
|
-
|
|
48
27
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
49
|
-
|
|
50
28
|
var transparentClassName = _ScrimModule["default"].scrim + ' enact-fit ' + _ScrimModule["default"].transparent;
|
|
51
|
-
var translucentClassName = _ScrimModule["default"].scrim + ' enact-fit ' + _ScrimModule["default"].translucent;
|
|
52
|
-
// most Scrim is visible to avoid stacking scrims.
|
|
29
|
+
var translucentClassName = _ScrimModule["default"].scrim + ' enact-fit ' + _ScrimModule["default"].translucent;
|
|
53
30
|
|
|
31
|
+
// Stores references to any Scrim instances whose type is translucent to ensure that only the top-
|
|
32
|
+
// most Scrim is visible to avoid stacking scrims.
|
|
54
33
|
var scrimStack = [];
|
|
34
|
+
|
|
55
35
|
/**
|
|
56
36
|
* Pushes a translucent scrim to the top of the stack and hiding the previously top
|
|
57
37
|
*
|
|
@@ -59,18 +39,16 @@ var scrimStack = [];
|
|
|
59
39
|
* @returns {undefined}
|
|
60
40
|
* @private
|
|
61
41
|
*/
|
|
62
|
-
|
|
63
42
|
function pushTranslucentScrim(scrim) {
|
|
64
43
|
var last = scrimStack.length - 1;
|
|
65
|
-
|
|
66
44
|
if (last >= 0) {
|
|
67
45
|
// if there are other translucent scrims, hide the topmost one assuming the others have been
|
|
68
46
|
// hidden correctly by previous calls
|
|
69
47
|
scrimStack[last].hide();
|
|
70
48
|
}
|
|
71
|
-
|
|
72
49
|
scrimStack.push(scrim);
|
|
73
50
|
}
|
|
51
|
+
|
|
74
52
|
/**
|
|
75
53
|
* Removes a translucent scrim from the stack. If the scrim was the top-most, removing it will show
|
|
76
54
|
* the next scrim. If not, it will just be removed
|
|
@@ -79,16 +57,12 @@ function pushTranslucentScrim(scrim) {
|
|
|
79
57
|
* @returns {undefined}
|
|
80
58
|
* @private
|
|
81
59
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
60
|
function removeTranslucentScrim(scrim) {
|
|
85
61
|
var index = scrimStack.indexOf(scrim);
|
|
86
62
|
var last = scrimStack.length - 1;
|
|
87
|
-
|
|
88
63
|
if (index === last) {
|
|
89
64
|
// if scrim is the top of the stack (most likely case), show the one below it then pop it
|
|
90
65
|
scrimStack.pop();
|
|
91
|
-
|
|
92
66
|
if (scrimStack.length) {
|
|
93
67
|
scrimStack[scrimStack.length - 1].show();
|
|
94
68
|
}
|
|
@@ -97,6 +71,7 @@ function removeTranslucentScrim(scrim) {
|
|
|
97
71
|
scrimStack.splice(index, 1);
|
|
98
72
|
}
|
|
99
73
|
}
|
|
74
|
+
|
|
100
75
|
/**
|
|
101
76
|
* {@link ui/FloatingLayer.Scrim} provides an overlay that will prevent taps from propagating
|
|
102
77
|
* to the controls that it covers.
|
|
@@ -106,43 +81,31 @@ function removeTranslucentScrim(scrim) {
|
|
|
106
81
|
* @ui
|
|
107
82
|
* @private
|
|
108
83
|
*/
|
|
109
|
-
|
|
110
|
-
|
|
111
84
|
var Scrim = /*#__PURE__*/function (_Component) {
|
|
112
85
|
_inherits(Scrim, _Component);
|
|
113
|
-
|
|
114
86
|
var _super = _createSuper(Scrim);
|
|
115
|
-
|
|
116
87
|
function Scrim(props) {
|
|
117
88
|
var _this;
|
|
118
|
-
|
|
119
89
|
_classCallCheck(this, Scrim);
|
|
120
|
-
|
|
121
90
|
_this = _super.call(this, props);
|
|
122
|
-
|
|
123
91
|
_this.show = function () {
|
|
124
92
|
return _this.setState({
|
|
125
93
|
visible: true
|
|
126
94
|
});
|
|
127
95
|
};
|
|
128
|
-
|
|
129
96
|
_this.hide = function () {
|
|
130
97
|
return _this.setState({
|
|
131
98
|
visible: false
|
|
132
99
|
});
|
|
133
100
|
};
|
|
134
|
-
|
|
135
101
|
_this.state = {
|
|
136
102
|
visible: true
|
|
137
103
|
};
|
|
138
|
-
|
|
139
104
|
if (props.type === 'translucent') {
|
|
140
105
|
pushTranslucentScrim(_assertThisInitialized(_this));
|
|
141
106
|
}
|
|
142
|
-
|
|
143
107
|
return _this;
|
|
144
108
|
}
|
|
145
|
-
|
|
146
109
|
_createClass(Scrim, [{
|
|
147
110
|
key: "componentDidUpdate",
|
|
148
111
|
value: function componentDidUpdate(prevProps) {
|
|
@@ -162,15 +125,13 @@ var Scrim = /*#__PURE__*/function (_Component) {
|
|
|
162
125
|
value: function render() {
|
|
163
126
|
if (this.state.visible) {
|
|
164
127
|
var _this$props = this.props,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
128
|
+
type = _this$props.type,
|
|
129
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
168
130
|
var className = type === 'transparent' ? transparentClassName : translucentClassName;
|
|
169
131
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, rest), {}, {
|
|
170
132
|
className: className
|
|
171
133
|
}));
|
|
172
134
|
}
|
|
173
|
-
|
|
174
135
|
return null;
|
|
175
136
|
}
|
|
176
137
|
}], [{
|
|
@@ -181,18 +142,13 @@ var Scrim = /*#__PURE__*/function (_Component) {
|
|
|
181
142
|
visible: true
|
|
182
143
|
};
|
|
183
144
|
}
|
|
184
|
-
|
|
185
145
|
return null;
|
|
186
146
|
}
|
|
187
147
|
}]);
|
|
188
|
-
|
|
189
148
|
return Scrim;
|
|
190
149
|
}(_react.Component);
|
|
191
|
-
|
|
192
150
|
exports.Scrim = Scrim;
|
|
193
|
-
Scrim.propTypes =
|
|
194
|
-
/** @lends ui/FloatingLayer.Scrim.prototype */
|
|
195
|
-
{
|
|
151
|
+
Scrim.propTypes = /** @lends ui/FloatingLayer.Scrim.prototype */{
|
|
196
152
|
/**
|
|
197
153
|
* Types of scrim. It can be either `'transparent'` or `'translucent'`.
|
|
198
154
|
*
|
package/FloatingLayer/index.js
CHANGED
|
@@ -28,13 +28,9 @@ Object.defineProperty(exports, "useFloatingLayer", {
|
|
|
28
28
|
return _useFloatingLayer.useFloatingLayer;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
|
|
32
31
|
var _FloatingLayer = require("./FloatingLayer");
|
|
33
|
-
|
|
34
32
|
var _FloatingLayerDecorator = require("./FloatingLayerDecorator");
|
|
35
|
-
|
|
36
33
|
var _useFloatingLayer = require("./useFloatingLayer");
|
|
37
|
-
|
|
38
34
|
/**
|
|
39
35
|
* FloatingLayer provides a way to render a component into a node outside of its parent component.
|
|
40
36
|
*
|