@enact/ui 4.8.0 → 4.9.0-alpha.2

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.
Files changed (53) hide show
  1. package/AnnounceDecorator/Announce.js +1 -1
  2. package/CHANGELOG.md +18 -0
  3. package/Cancelable/Cancelable.js +1 -1
  4. package/Changeable/Changeable.js +1 -1
  5. package/FloatingLayer/FloatingLayer.js +1 -1
  6. package/FloatingLayer/Scrim.js +1 -1
  7. package/Layout/Cell.js +14 -2
  8. package/Layout/Layout.d.ts +8 -1
  9. package/Marquee/MarqueeController.js +23 -284
  10. package/Marquee/MarqueeDecorator.js +1 -1
  11. package/Marquee/index.d.ts +18 -18
  12. package/Marquee/useMarqueeController.js +273 -0
  13. package/Media/Media.js +1 -1
  14. package/Placeholder/PlaceholderControllerDecorator.js +1 -1
  15. package/Placeholder/PlaceholderDecorator.js +1 -1
  16. package/RadioDecorator/RadioControllerDecorator.js +1 -1
  17. package/RadioDecorator/RadioDecorator.js +1 -1
  18. package/Repeater/Repeater.js +7 -3
  19. package/Routable/Link.js +1 -1
  20. package/Routable/Router.js +1 -1
  21. package/Scrollable/Scrollable.js +1 -1
  22. package/Scrollable/ScrollableNative.js +2 -2
  23. package/Scrollable/Scrollbar.js +1 -1
  24. package/Scroller/Scroller.js +20 -18
  25. package/Scroller/Scroller.module.css +3 -0
  26. package/Scroller/ScrollerBasic.js +2 -2
  27. package/Scroller/UiScroller.module.css +3 -0
  28. package/Scroller/UiScrollerBase.js +2 -2
  29. package/Slider/PositionDecorator.js +1 -1
  30. package/Slottable/tests/Slottable-specs.js +2 -4
  31. package/Toggleable/Toggleable.js +11 -5
  32. package/Touchable/ClickAllow.js +1 -1
  33. package/Touchable/Touch.js +3 -3
  34. package/Touchable/Touchable.js +11 -6
  35. package/Transition/Transition.js +1 -1
  36. package/ViewManager/TransitionGroup.js +1 -1
  37. package/ViewManager/View.js +1 -1
  38. package/ViewManager/ViewManager.js +1 -1
  39. package/ViewManager/tests/ViewManager-specs.js +1 -1
  40. package/VirtualList/UiVirtualList.module.css +3 -0
  41. package/VirtualList/UiVirtualListBase.js +2 -2
  42. package/VirtualList/VirtualList.d.ts +13 -13
  43. package/VirtualList/VirtualList.js +25 -21
  44. package/VirtualList/VirtualList.module.css +3 -0
  45. package/VirtualList/VirtualListBasic.js +2 -2
  46. package/internal/Pure/Pure.js +1 -1
  47. package/internal/Pure/tests/Pure-specs.js +1 -1
  48. package/package.json +5 -5
  49. package/resolution/ResolutionDecorator.js +1 -1
  50. package/resolution/tests/resolution-specs.js +503 -13
  51. package/useScroll/Scrollbar.js +18 -8
  52. package/useScroll/ScrollbarTrack.js +7 -8
  53. package/useScroll/useScroll.js +1 -1
@@ -0,0 +1,273 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useMarqueeController = exports["default"] = exports.MarqueeControllerContext = void 0;
7
+ var _handle = require("@enact/core/handle");
8
+ var _util = require("@enact/core/util");
9
+ var _react = require("react");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
15
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
+ var STATE = {
17
+ inactive: 0,
18
+ // Marquee is not necessary (render or focus not happened)
19
+ active: 1,
20
+ // Marquee in progress, awaiting complete
21
+ ready: 2 // Marquee completed or not needed, but state is active
22
+ };
23
+ var MarqueeControllerContext = exports.MarqueeControllerContext = /*#__PURE__*/(0, _react.createContext)(null);
24
+ var forwardBlur = (0, _handle.forward)('onBlur');
25
+ var forwardFocus = (0, _handle.forward)('onFocus');
26
+ var useMarqueeController = exports.useMarqueeController = function useMarqueeController(props) {
27
+ var mutableRef = (0, _react.useRef)({
28
+ controlled: [],
29
+ isFocused: false,
30
+ isHovered: false
31
+ });
32
+
33
+ /*
34
+ * Invokes the `action` handler for each synchronized component except the invoking
35
+ * `component`.
36
+ *
37
+ * @param {String} action `'start'` or `'stop'`
38
+ * @param {Object} component A previously registered component
39
+ *
40
+ * @returns {undefined}
41
+ */
42
+ var dispatch = (0, _react.useCallback)(function (action, component) {
43
+ mutableRef.current.controlled.forEach(function (controlled) {
44
+ var controlledComponent = controlled.component,
45
+ handler = controlled[action];
46
+ if (component !== controlledComponent && typeof handler === 'function') {
47
+ var complete = handler.call(controlledComponent);
48
+
49
+ // Returning `true` from a start request means that the marqueeing is
50
+ // unnecessary and is therefore not awaiting a finish
51
+ if (action === 'start' && complete) {
52
+ controlled.state = STATE.ready;
53
+ } else if (action === 'start') {
54
+ controlled.state = STATE.active;
55
+ }
56
+ } else if (action === 'start' && component === controlledComponent) {
57
+ controlled.state = STATE.active;
58
+ }
59
+ });
60
+ }, []);
61
+
62
+ /*
63
+ * Marks all components with the passed-in state
64
+ *
65
+ * @param {Enum} state The state to set
66
+ *
67
+ * @returns {undefined}
68
+ */
69
+ var markAll = (0, _react.useCallback)(function (state) {
70
+ mutableRef.current.controlled.forEach(function (c) {
71
+ c.state = state;
72
+ });
73
+ }, []);
74
+
75
+ /*
76
+ * Marks `component` as ready for next marquee action
77
+ *
78
+ * @param {Object} component A previously registered component
79
+ *
80
+ * @returns {Boolean} `true` if no components are STATE.active
81
+ */
82
+ var markReady = (0, _react.useCallback)(function (component) {
83
+ var complete = true;
84
+ mutableRef.current.controlled.forEach(function (c) {
85
+ if (c.component === component) {
86
+ c.state = STATE.ready;
87
+ }
88
+ complete = complete && c.state !== STATE.active;
89
+ });
90
+ return complete;
91
+ }, []);
92
+
93
+ /*
94
+ * Checks that all components are inactive
95
+ *
96
+ * @returns {Boolean} `true` if any components should be running
97
+ */
98
+ var allInactive = (0, _react.useCallback)(function () {
99
+ var activeOrReady = mutableRef.current.controlled.reduce(function (res, component) {
100
+ return res || !(component.state === STATE.inactive);
101
+ }, false);
102
+ return !activeOrReady;
103
+ }, []);
104
+
105
+ /*
106
+ * Checks for any components currently marqueeing
107
+ *
108
+ * @returns {Boolean} `true` if any component is marqueeing
109
+ */
110
+ var anyRunning = (0, _react.useCallback)(function () {
111
+ return mutableRef.current.controlled.reduce(function (res, component) {
112
+ return res || component.state === STATE.active;
113
+ }, false);
114
+ }, []);
115
+ var doCancel = (0, _react.useCallback)(function () {
116
+ if (mutableRef.current.isHovered || mutableRef.current.isFocused) {
117
+ return;
118
+ }
119
+ markAll(STATE.inactive);
120
+ dispatch('stop');
121
+ }, [dispatch, markAll]);
122
+ var cancelJob = (0, _react.useMemo)(function () {
123
+ return new _util.Job(function () {
124
+ return doCancel();
125
+ }, 30);
126
+ }, [doCancel]);
127
+
128
+ /*
129
+ * Registers `component` with a set of handlers for `start` and `stop`.
130
+ *
131
+ * @param {Object} component A component, typically a React component instance, on
132
+ * which handlers will be dispatched.
133
+ * @param {Object} handlers An object containing `start` and `stop` functions
134
+ *
135
+ * @returns {undefined}
136
+ */
137
+ var handleRegister = (0, _react.useCallback)(function (component, handlers) {
138
+ var needStart = !allInactive() || mutableRef.current.isFocused;
139
+ mutableRef.current.controlled.push(_objectSpread(_objectSpread({}, handlers), {}, {
140
+ state: STATE.inactive,
141
+ component: component
142
+ }));
143
+ if (needStart) {
144
+ dispatch('start');
145
+ }
146
+ }, [allInactive, dispatch]);
147
+
148
+ /*
149
+ * Unregisters `component` for synchronization
150
+ *
151
+ * @param {Object} component A previously registered component
152
+ *
153
+ * @returns {undefined}
154
+ */
155
+ var handleUnregister = (0, _react.useCallback)(function (component) {
156
+ var wasRunning = false;
157
+ for (var i = 0; i < mutableRef.current.controlled.length; i++) {
158
+ if (mutableRef.current.controlled[i].component === component) {
159
+ wasRunning = mutableRef.current.controlled[i].state === STATE.active;
160
+ mutableRef.current.controlled.splice(i, 1);
161
+ break;
162
+ }
163
+ }
164
+ if (wasRunning && !anyRunning()) {
165
+ dispatch('start');
166
+ }
167
+ }, [anyRunning, dispatch]);
168
+
169
+ /*
170
+ * Handler for the `start` context function
171
+ *
172
+ * @param {Object} component A previously registered component
173
+ *
174
+ * @returns {undefined}f
175
+ */
176
+ var handleStart = (0, _react.useCallback)(function (component) {
177
+ cancelJob.stop();
178
+ if (!anyRunning()) {
179
+ markAll(STATE.ready);
180
+ dispatch('start', component);
181
+ }
182
+ }, [anyRunning, cancelJob, dispatch, markAll]);
183
+
184
+ /*
185
+ * Handler for the `cancel` context function
186
+ *
187
+ * @param {Object} component A previously registered component
188
+ *
189
+ * @returns {undefined}
190
+ */
191
+ var handleCancel = (0, _react.useCallback)(function () {
192
+ if (anyRunning()) {
193
+ cancelJob.start();
194
+ }
195
+ }, [anyRunning, cancelJob]);
196
+
197
+ /*
198
+ * Handler for the `complete` context function
199
+ *
200
+ * @param {Object} component A previously registered component
201
+ *
202
+ * @returns {undefined}
203
+ */
204
+ var handleComplete = (0, _react.useCallback)(function (component) {
205
+ var complete = markReady(component);
206
+ if (complete) {
207
+ markAll(STATE.ready);
208
+ dispatch('start');
209
+ }
210
+ }, [dispatch, markAll, markReady]);
211
+ var handleEnter = (0, _react.useCallback)(function () {
212
+ mutableRef.current.isHovered = true;
213
+ if (!anyRunning()) {
214
+ dispatch('start');
215
+ }
216
+ cancelJob.stop();
217
+ }, [anyRunning, cancelJob, dispatch]);
218
+ var handleLeave = (0, _react.useCallback)(function () {
219
+ mutableRef.current.isHovered = false;
220
+ cancelJob.start();
221
+ }, [cancelJob]);
222
+
223
+ /*
224
+ * Handler for the focus event
225
+ */
226
+ var handleFocus = (0, _react.useCallback)(function (ev) {
227
+ mutableRef.current.isFocused = true;
228
+ if (!anyRunning()) {
229
+ dispatch('start');
230
+ }
231
+ cancelJob.stop();
232
+ forwardFocus(ev, props);
233
+ }, [anyRunning, cancelJob, dispatch, props]);
234
+
235
+ /*
236
+ * Handler for the blur event
237
+ */
238
+ var handleBlur = (0, _react.useCallback)(function (ev) {
239
+ mutableRef.current.isFocused = false;
240
+ if (anyRunning()) {
241
+ cancelJob.start();
242
+ }
243
+ forwardBlur(ev, props);
244
+ }, [anyRunning, cancelJob, props]);
245
+ (0, _react.useEffect)(function () {
246
+ return function () {
247
+ cancelJob.stop();
248
+ };
249
+ }, [cancelJob]);
250
+ var value = (0, _react.useMemo)(function () {
251
+ return {
252
+ cancel: handleCancel,
253
+ complete: handleComplete,
254
+ enter: handleEnter,
255
+ leave: handleLeave,
256
+ register: handleRegister,
257
+ start: handleStart,
258
+ unregister: handleUnregister
259
+ };
260
+ }, [handleCancel, handleComplete, handleEnter, handleLeave, handleRegister, handleStart, handleUnregister]);
261
+ var provideMarqueeControllerContext = (0, _react.useCallback)(function (children) {
262
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(MarqueeControllerContext.Provider, {
263
+ value: value,
264
+ children: children
265
+ });
266
+ }, [value]);
267
+ return {
268
+ handleBlur: handleBlur,
269
+ handleFocus: handleFocus,
270
+ provideMarqueeControllerContext: provideMarqueeControllerContext
271
+ };
272
+ };
273
+ var _default = exports["default"] = useMarqueeController;
package/Media/Media.js CHANGED
@@ -27,7 +27,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
27
27
  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); }; }
28
28
  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); }
29
29
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
30
- 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; } }
30
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
31
31
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /**
32
32
  * A representation of `HTMLMediaElement` component with an ability to attach a custom event
33
33
  * handler.
@@ -25,7 +25,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
25
25
  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); }; }
26
26
  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); }
27
27
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
28
- 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; } }
28
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
29
29
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /**
30
30
  * Default config for `PlaceholderControllerDecorator`.
31
31
  *
@@ -22,7 +22,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
22
22
  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); }; }
23
23
  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); }
24
24
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
25
- 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; } }
25
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
26
26
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /**
27
27
  * Default config for PlaceholderDecorator.
28
28
  *
@@ -23,7 +23,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
23
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); }; }
24
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); }
25
25
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
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; } }
26
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
27
27
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
28
28
  var RadioContext = exports.RadioContext = /*#__PURE__*/(0, _react.createContext)();
29
29
 
@@ -30,7 +30,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
30
30
  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); }; }
31
31
  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); }
32
32
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
33
- 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; } }
33
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
34
34
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /**
35
35
  * A higher-order component that manages activation of components.
36
36
  *
@@ -9,7 +9,8 @@ var _kind = _interopRequireDefault(require("@enact/core/kind"));
9
9
  var _propTypes2 = _interopRequireDefault(require("prop-types"));
10
10
  var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
- var _excluded = ["component", "componentRef"];
12
+ var _excluded = ["key"],
13
+ _excluded2 = ["component", "componentRef"];
13
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
14
15
  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; }
15
16
  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; }
@@ -129,14 +130,17 @@ var RepeaterBase = exports.RepeaterBase = (0, _kind["default"])({
129
130
  }, itemProps), {}, _defineProperty({}, childProp, data));
130
131
  }
131
132
  if (indexProp) props[indexProp] = index;
132
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, _objectSpread({}, props));
133
+ var _props = _objectSpread({}, props),
134
+ key = _props.key,
135
+ rest = _objectWithoutProperties(_props, _excluded);
136
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, _objectSpread({}, rest), key);
133
137
  });
134
138
  }
135
139
  },
136
140
  render: function render(_ref2) {
137
141
  var Component = _ref2.component,
138
142
  componentRef = _ref2.componentRef,
139
- rest = _objectWithoutProperties(_ref2, _excluded);
143
+ rest = _objectWithoutProperties(_ref2, _excluded2);
140
144
  delete rest.childComponent;
141
145
  delete rest.childProp;
142
146
  delete rest.indexProp;
package/Routable/Link.js CHANGED
@@ -30,7 +30,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
30
30
  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); }; }
31
31
  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); }
32
32
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
33
- 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; } }
33
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
34
34
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
35
35
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
36
36
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -39,7 +39,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
39
39
  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); }; }
40
40
  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); }
41
41
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
42
- 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; } }
42
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
43
43
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
44
44
  var RouterBase = exports.RouterBase = (_class = /*#__PURE__*/function (_ReactComponent) {
45
45
  _inherits(RouterBase, _ReactComponent);
@@ -40,7 +40,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
40
40
  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
41
  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); }
42
42
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
43
- 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; } }
43
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
44
44
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /**
45
45
  * Unstyled scrollable components and behaviors to be customized by a theme or application.
46
46
  *
@@ -40,7 +40,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
40
40
  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
41
  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); }
42
42
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
43
- 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; } }
43
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
44
44
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
45
45
  var constants = exports.constants = {
46
46
  epsilon: 1,
@@ -327,7 +327,7 @@ var ScrollableBaseNative = exports.ScrollableBaseNative = /*#__PURE__*/function
327
327
  _this.scrollStartOnScroll();
328
328
  }
329
329
  if (_this.props.rtl && canScrollHorizontally) {
330
- scrollLeft = _platform.platform.ios || _platform.platform.safari || _platform.platform.chrome >= 85 || _platform.platform.androidChrome >= 85 ? -scrollLeft : bounds.maxLeft - scrollLeft;
330
+ scrollLeft = _platform.platform.chrome < 85 ? bounds.maxLeft - scrollLeft : -scrollLeft;
331
331
  }
332
332
  if (scrollLeft !== _this.scrollLeft) {
333
333
  _this.setScrollLeft(scrollLeft);
@@ -36,7 +36,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
36
36
  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); }; }
37
37
  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); }
38
38
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
- 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; } }
39
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
40
40
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
41
41
  var minThumbSize = 18,
42
42
  // Size in pixels
@@ -38,6 +38,23 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
38
38
  * @exports ScrollerBasic
39
39
  */
40
40
  var nop = function nop() {};
41
+ var scrollerDefaultProps = {
42
+ cbScrollTo: nop,
43
+ direction: 'both',
44
+ horizontalScrollbar: 'auto',
45
+ noScrollByDrag: false,
46
+ noScrollByWheel: false,
47
+ onScroll: nop,
48
+ onScrollStart: nop,
49
+ onScrollStop: nop,
50
+ overscrollEffectOn: {
51
+ drag: false,
52
+ pageKey: false,
53
+ wheel: false
54
+ },
55
+ scrollMode: 'translate',
56
+ verticalScrollbar: 'auto'
57
+ };
41
58
 
42
59
  /**
43
60
  * An unstyled scroller.
@@ -56,7 +73,8 @@ var nop = function nop() {};
56
73
  var Scroller = exports.Scroller = function Scroller(props) {
57
74
  // Hooks
58
75
 
59
- var _useScroll = (0, _useScroll2["default"])(props),
76
+ var scrollerProps = Object.assign({}, scrollerDefaultProps, props);
77
+ var _useScroll = (0, _useScroll2["default"])(scrollerProps),
60
78
  scrollContentHandle = _useScroll.scrollContentHandle,
61
79
  ScrollContentWrapper = _useScroll.scrollContentWrapper,
62
80
  isHorizontalScrollbarVisible = _useScroll.isHorizontalScrollbarVisible,
@@ -261,21 +279,5 @@ Scroller.propTypes = /** @lends ui/Scroller.Scroller.prototype */{
261
279
  */
262
280
  verticalScrollbar: _propTypes["default"].oneOf(['auto', 'visible', 'hidden'])
263
281
  };
264
- Scroller.defaultProps = {
265
- cbScrollTo: nop,
266
- direction: 'both',
267
- horizontalScrollbar: 'auto',
268
- noScrollByDrag: false,
269
- noScrollByWheel: false,
270
- onScroll: nop,
271
- onScrollStart: nop,
272
- onScrollStop: nop,
273
- overscrollEffectOn: {
274
- drag: false,
275
- pageKey: false,
276
- wheel: false
277
- },
278
- scrollMode: 'translate',
279
- verticalScrollbar: 'auto'
280
- };
282
+ Scroller.defaultPropValues = scrollerDefaultProps;
281
283
  var _default = exports["default"] = Scroller;
@@ -1,6 +1,9 @@
1
1
  .scroller {
2
+ /* hide native scrollbar */
3
+ scrollbar-width: none;
2
4
  will-change: transform;
3
5
  /* hide native scrollbar */
6
+ /* NOTE: Needs to be revisited whether it can be replaced with scrollbar-width */
4
7
  }
5
8
  .scroller::-webkit-scrollbar {
6
9
  display: none;
@@ -28,7 +28,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
28
28
  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); }; }
29
29
  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); }
30
30
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
31
- 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; } }
31
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
32
32
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /**
33
33
  * An unstyled base scroller component.
34
34
  *
@@ -64,7 +64,7 @@ var ScrollerBasic = exports.ScrollerBasic = /*#__PURE__*/function (_Component) {
64
64
  };
65
65
  _this.getRtlPositionX = function (x) {
66
66
  if (_this.props.rtl) {
67
- return _platform.platform.ios || _platform.platform.safari || _platform.platform.chrome >= 85 || _platform.platform.androidChrome >= 85 ? -x : _this.scrollBounds.maxLeft - x;
67
+ return _platform.platform.chrome < 85 ? _this.scrollBounds.maxLeft - x : -x; // Chrome lower than 85 has a bug with RTL scrollLeft
68
68
  }
69
69
  return x;
70
70
  };
@@ -1,6 +1,9 @@
1
1
  .scroller {
2
+ /* hide native scrollbar */
3
+ scrollbar-width: none;
2
4
  will-change: transform;
3
5
  /* hide native scrollbar */
6
+ /* NOTE: Needs to be revisited whether it can be replaced with scrollbar-width */
4
7
  }
5
8
  .scroller::-webkit-scrollbar {
6
9
  display: none;
@@ -28,7 +28,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
28
28
  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); }; }
29
29
  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); }
30
30
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
31
- 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; } }
31
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
32
32
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /**
33
33
  * An unstyled base scroller component.
34
34
  *
@@ -64,7 +64,7 @@ var ScrollerBase = exports.ScrollerBase = /*#__PURE__*/function (_Component) {
64
64
  };
65
65
  _this.getRtlPositionX = function (x) {
66
66
  if (_this.props.rtl) {
67
- return _platform.platform.ios || _platform.platform.safari || _platform.platform.chrome >= 85 || _platform.platform.androidChrome >= 85 ? -x : _this.scrollBounds.maxLeft - x;
67
+ return _platform.platform.chrome < 85 ? _this.scrollBounds.maxLeft - x : -x;
68
68
  }
69
69
  return x;
70
70
  };
@@ -26,7 +26,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Objec
26
26
  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); }; }
27
27
  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); }
28
28
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
29
- 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; } }
29
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
30
30
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
31
31
  var validateRange = (0, _validators.validateRangeOnce)(function (props) {
32
32
  return props;
@@ -285,15 +285,13 @@ describe('Slottable Specs', function () {
285
285
  });
286
286
  test('should allow downstream component to have default value for unset slot', function () {
287
287
  function ComponentBase(_ref11) {
288
- var a = _ref11.a;
288
+ var _ref11$a = _ref11.a,
289
+ a = _ref11$a === void 0 ? 'Default A' : _ref11$a;
289
290
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
290
291
  "data-testid": "slottable",
291
292
  children: a
292
293
  });
293
294
  }
294
- ComponentBase.defaultProps = {
295
- a: 'Default A'
296
- };
297
295
  var Component = (0, _Slottable["default"])({
298
296
  slots: ['a']
299
297
  }, ComponentBase);
@@ -20,9 +20,12 @@ var _react = require("react");
20
20
  var _warning = _interopRequireDefault(require("warning"));
21
21
  var _useToggle = require("./useToggle");
22
22
  var _jsxRuntime = require("react/jsx-runtime");
23
+ var _excluded = ["disabled"];
23
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
24
25
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
25
26
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
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; }
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; }
26
29
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
27
30
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
28
31
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -165,12 +168,18 @@ var ToggleableHOC = exports.Toggleable = (0, _hoc["default"])(defaultConfig, fun
165
168
  return context.deactivate();
166
169
  }, (0, _handle.forwardCustom)(deactivate, adapter))
167
170
  };
168
- function Toggleable(props) {
171
+ function Toggleable(_ref) {
172
+ var _ref$disabled = _ref.disabled,
173
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
174
+ rest = _objectWithoutProperties(_ref, _excluded);
175
+ var props = _objectSpread({
176
+ disabled: disabled
177
+ }, rest);
169
178
  var updated = _objectSpread({}, props);
170
179
  var propSelected = props[prop];
171
180
  var hook = (0, _useToggle.useToggle)({
172
181
  defaultSelected: props[defaultPropKey],
173
- disabled: props.disabled,
182
+ disabled: disabled,
174
183
  onToggle: function onToggle(ev) {
175
184
  return (0, _handle.forwardCustom)(toggle, adapter)(ev, props);
176
185
  },
@@ -208,9 +217,6 @@ var ToggleableHOC = exports.Toggleable = (0, _hoc["default"])(defaultConfig, fun
208
217
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread({}, updated));
209
218
  }
210
219
  Toggleable.propTypes = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, defaultPropKey, _propTypes["default"].bool), "disabled", _propTypes["default"].bool), prop, _propTypes["default"].bool), toggle, _propTypes["default"].func);
211
- Toggleable.defaultProps = {
212
- disabled: false
213
- };
214
220
  return Toggleable;
215
221
  });
216
222
  var _default = exports["default"] = ToggleableHOC;