@enact/ui 4.9.0-alpha.3 → 5.0.0-alpha.1
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 -1
- package/AnnounceDecorator/AnnounceDecorator.js +2 -2
- package/BodyText/BodyText.js +2 -2
- package/BodyText/tests/BodyText-specs.js +1 -1
- package/Button/Button.js +2 -2
- package/CHANGELOG.md +25 -0
- package/Cancelable/Cancelable.js +1 -1
- package/Cancelable/tests/Cancelable-specs.js +2 -2
- package/Changeable/Changeable.js +1 -1
- package/ComponentOverride/ComponentOverride.js +2 -2
- package/FloatingLayer/FloatingLayer.js +2 -2
- package/FloatingLayer/FloatingLayerContainer.js +1 -1
- package/FloatingLayer/FloatingLayerDecorator.js +2 -2
- package/FloatingLayer/Scrim.js +2 -2
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +1 -1
- package/ForwardRef/ForwardRef.js +1 -1
- package/Group/Group.js +2 -2
- package/Group/GroupItem.js +2 -2
- package/Group/tests/Group-specs.js +1 -1
- package/Heading/Heading.js +2 -2
- package/Icon/Icon.js +2 -2
- package/Icon/Icon.module.css +0 -1
- package/Icon/tests/Icon-specs.js +1 -1
- package/Image/Image.js +2 -2
- package/Image/tests/Image-specs.js +1 -1
- package/ImageItem/ImageItem.js +2 -2
- package/ImageItem/tests/ImageItem-specs.js +2 -2
- package/Item/Item.js +2 -2
- package/LabeledIcon/LabeledIcon.js +2 -2
- package/Layout/Cell.js +2 -2
- package/Layout/Layout.js +2 -2
- package/Layout/tests/Layout-specs.js +2 -2
- package/Marquee/MarqueeBase.js +2 -2
- package/Marquee/MarqueeController.js +1 -1
- package/Marquee/MarqueeDecorator.js +19 -27
- package/Marquee/index.d.ts +10 -14
- package/Marquee/tests/Marquee-specs.js +1 -1
- package/Marquee/useMarqueeController.js +15 -11
- package/Measurable/Measurable.js +1 -1
- package/Measurable/tests/Measurable-specs.js +2 -2
- package/Media/Media.js +2 -2
- package/Placeholder/PlaceholderControllerDecorator.js +1 -1
- package/Placeholder/PlaceholderDecorator.js +1 -1
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +1 -1
- package/ProgressBar/ProgressBar.js +2 -2
- package/Repeater/Repeater.js +2 -2
- package/Repeater/tests/Repeater-specs.js +2 -2
- package/Resizable/Resizable.js +1 -1
- package/Resizable/tests/Resizable-specs.js +1 -1
- package/Resizable/tests/useResize-specs.js +1 -1
- package/Resizable/useResize.js +1 -1
- package/Routable/Link.js +2 -2
- package/Routable/Routable.js +2 -2
- package/Routable/Router.js +2 -2
- package/Routable/tests/Routable-specs.js +1 -1
- package/Scroller/Scroller.d.ts +0 -120
- package/Scroller/Scroller.js +1 -9
- package/Scroller/ScrollerBasic.js +2 -2
- package/Skinnable/Skinnable.js +2 -2
- package/Skinnable/tests/Skinnable-specs.js +1 -1
- package/Skinnable/tests/useSkins-specs.js +1 -1
- package/Slider/Knob.js +2 -2
- package/Slider/PositionDecorator.js +1 -1
- package/Slider/Slider.js +2 -2
- package/Slottable/Slottable.js +1 -3
- package/Slottable/useSlots.js +2 -2
- package/Spinner/Spinner.js +2 -2
- package/ToggleIcon/ToggleIcon.js +2 -2
- package/Toggleable/Toggle.js +1 -1
- package/Toggleable/Toggleable.js +3 -3
- package/Toggleable/useToggle.js +1 -1
- package/Touchable/ClickAllow.js +1 -1
- package/Touchable/Drag.js +1 -1
- package/Touchable/Flick.js +1 -1
- package/Touchable/Hold.js +1 -1
- package/Touchable/Pinch.js +1 -1
- package/Touchable/Touch.js +1 -1
- package/Touchable/Touchable.js +2 -2
- package/Touchable/config.js +1 -1
- package/Touchable/tests/Touchable-specs.js +1 -1
- package/Touchable/tests/useTouch-specs.js +2 -2
- package/Touchable/useTouch.js +1 -1
- package/Transition/Transition.js +2 -2
- package/Transition/tests/Transition-specs.js +2 -2
- package/ViewManager/Arranger.js +1 -1
- package/ViewManager/TransitionGroup.js +1 -1
- package/ViewManager/View.js +1 -1
- package/ViewManager/ViewManager.js +3 -3
- package/ViewManager/tests/ViewManager-specs.js +1 -1
- package/VirtualList/VirtualList.d.ts +0 -158
- package/VirtualList/VirtualList.js +1 -15
- package/VirtualList/VirtualListBasic.js +2 -2
- package/VirtualList/tests/VirtualGridList-native-specs.js +2 -2
- package/VirtualList/tests/VirtualGridList-specs.js +2 -2
- package/VirtualList/tests/VirtualList-native-specs.js +2 -2
- package/VirtualList/tests/VirtualList-specs.js +2 -2
- package/internal/IdProvider/IdProvider.js +1 -1
- package/internal/IdProvider/Provider.js +1 -1
- package/internal/IdProvider/tests/IdProvider-specs.js +1 -1
- package/internal/IdProvider/tests/useId-specs.js +1 -1
- package/internal/Pure/Pure.js +1 -1
- package/internal/Pure/tests/Pure-specs.js +1 -1
- package/package.json +3 -3
- package/resolution/ResolutionDecorator.js +1 -1
- package/resolution/index.js +1 -1
- package/styles/core.less +1 -5
- package/styles/mixins.less +5 -18
- package/useScroll/ScrollAnimator.js +1 -1
- package/useScroll/Scrollbar.js +2 -2
- package/useScroll/Scrollbar.module.css +1 -4
- package/useScroll/ScrollbarTrack.js +2 -2
- package/useScroll/ScrollbarTrack.module.css +0 -1
- package/useScroll/useScroll.js +3 -3
- package/useScroll/useScroll.module.css +0 -3
- package/GridListImageItem/GridListImageItem.d.ts +0 -85
- package/GridListImageItem/GridListImageItem.js +0 -250
- package/GridListImageItem/GridListImageItem.module.css +0 -28
- package/GridListImageItem/package.json +0 -3
- package/IconButton/IconButton.d.ts +0 -115
- package/IconButton/IconButton.js +0 -253
- package/IconButton/IconButton.module.css +0 -12
- package/IconButton/package.json +0 -3
- package/IconButton/tests/IconButton-specs.js +0 -29
- package/RadioDecorator/RadioControllerDecorator.js +0 -101
- package/RadioDecorator/RadioDecorator.d.ts +0 -35
- package/RadioDecorator/RadioDecorator.js +0 -177
- package/RadioDecorator/package.json +0 -3
- package/RadioDecorator/tests/RadioDecorator-specs.js +0 -247
- package/Scrollable/ScrollAnimator.js +0 -130
- package/Scrollable/ScrollThumb.js +0 -57
- package/Scrollable/ScrollThumb.module.css +0 -35
- package/Scrollable/Scrollable.js +0 -1430
- package/Scrollable/Scrollable.module.css +0 -39
- package/Scrollable/ScrollableNative.js +0 -1429
- package/Scrollable/Scrollbar.js +0 -281
- package/Scrollable/Scrollbar.module.css +0 -27
- package/Scrollable/package.json +0 -3
- package/Scroller/UiScroller.module.css +0 -10
- package/Scroller/UiScrollerBase.js +0 -372
- package/SlotItem/SlotItem.d.ts +0 -118
- package/SlotItem/SlotItem.js +0 -248
- package/SlotItem/SlotItem.module.css +0 -12
- package/SlotItem/package.json +0 -3
- package/SlotItem/tests/SlotItem-specs.js +0 -24
- package/ToggleItem/ToggleItem.d.ts +0 -132
- package/ToggleItem/ToggleItem.js +0 -301
- package/ToggleItem/ToggleItem.module.css +0 -9
- package/ToggleItem/package.json +0 -3
- package/ToggleItem/tests/ToggleItem-specs.js +0 -120
- package/VirtualList/UiVirtualList.module.css +0 -26
- package/VirtualList/UiVirtualListBase.js +0 -1410
- package/VirtualList/VirtualListBase.js +0 -33
package/IconButton/IconButton.js
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = exports.IconButtonDecorator = exports.IconButtonBase = exports.IconButton = void 0;
|
|
7
|
-
var _deprecate = _interopRequireDefault(require("@enact/core/internal/deprecate"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
9
|
-
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
10
|
-
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var _compose = _interopRequireDefault(require("ramda/src/compose"));
|
|
12
|
-
var _react = require("react");
|
|
13
|
-
var _ComponentOverride = _interopRequireDefault(require("../ComponentOverride"));
|
|
14
|
-
var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
|
|
15
|
-
var _Touchable = _interopRequireDefault(require("../Touchable"));
|
|
16
|
-
var _IconButtonModule = _interopRequireDefault(require("./IconButton.module.css"));
|
|
17
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
var _excluded = ["buttonComponent", "children", "componentRef", "css", "flip", "icon", "iconComponent", "size"];
|
|
19
|
-
/**
|
|
20
|
-
* An {@link ui/Icon.Icon|Icon} that acts like a {@link ui/Button.Button|Button}.
|
|
21
|
-
*
|
|
22
|
-
* You may specify an image or a font-based icon by setting the `children` to either the path
|
|
23
|
-
* to the image or a string from an {@link ui/Icon.Icon.iconList|iconList}. This is unstyled,
|
|
24
|
-
* but can easily be extended and customized by a theme or application.
|
|
25
|
-
*
|
|
26
|
-
* @module ui/IconButton
|
|
27
|
-
* @exports IconButton
|
|
28
|
-
* @exports IconButtonBase
|
|
29
|
-
* @exports IconButtonDecorator
|
|
30
|
-
* @deprecated Will be removed in 5.0.0. Use {@link ui/Button} instead.
|
|
31
|
-
*/
|
|
32
|
-
/**
|
|
33
|
-
* A ui-styled button without any behavior.
|
|
34
|
-
*
|
|
35
|
-
* @class IconButtonBase
|
|
36
|
-
* @memberof ui/IconButton
|
|
37
|
-
* @ui
|
|
38
|
-
* @public
|
|
39
|
-
*/
|
|
40
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
41
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
42
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
43
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
44
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
45
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
46
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
47
|
-
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; }
|
|
48
|
-
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; }
|
|
49
|
-
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; }
|
|
50
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
51
|
-
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); }
|
|
52
|
-
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; }
|
|
53
|
-
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; }
|
|
54
|
-
var IconButtonBase = exports.IconButtonBase = (0, _kind["default"])({
|
|
55
|
-
name: 'ui:IconButton',
|
|
56
|
-
propTypes: /** @lends ui/IconButton.IconButtonBase.prototype */{
|
|
57
|
-
/**
|
|
58
|
-
* This is the root component used to render the button and will receive all props except
|
|
59
|
-
* `icon`.
|
|
60
|
-
*
|
|
61
|
-
* @type {Component|Element}
|
|
62
|
-
* @required
|
|
63
|
-
* @public
|
|
64
|
-
*/
|
|
65
|
-
buttonComponent: _propTypes["default"].componentOverride.isRequired,
|
|
66
|
-
/**
|
|
67
|
-
* The component used to render the {@link ui/IconButton.IconButtonBase.icon|icon}.
|
|
68
|
-
*
|
|
69
|
-
* This component will receive the `flip` and `size` property set on the `IconButton` as well as the
|
|
70
|
-
* `icon` class to customize its styling.
|
|
71
|
-
*
|
|
72
|
-
* @type {Component}
|
|
73
|
-
* @required
|
|
74
|
-
* @public
|
|
75
|
-
*/
|
|
76
|
-
iconComponent: _propTypes["default"].component.isRequired,
|
|
77
|
-
/**
|
|
78
|
-
* Additional children that follow the icon.
|
|
79
|
-
*
|
|
80
|
-
* If `icon` isn't specified but `children` is, `children` is used as the icon's value.
|
|
81
|
-
*
|
|
82
|
-
* @see {@link ui/Icon.IconBase.children}
|
|
83
|
-
* @type {Node}
|
|
84
|
-
* @public
|
|
85
|
-
*/
|
|
86
|
-
children: _propTypes2["default"].node,
|
|
87
|
-
/**
|
|
88
|
-
* Called with a reference to the root component.
|
|
89
|
-
*
|
|
90
|
-
* When using {@link ui/IconButton.IconButton}, the `ref` prop is forwarded to this
|
|
91
|
-
* component as `componentRef`.
|
|
92
|
-
*
|
|
93
|
-
* @type {Object|Function}
|
|
94
|
-
* @public
|
|
95
|
-
*/
|
|
96
|
-
componentRef: _propTypes["default"].ref,
|
|
97
|
-
/**
|
|
98
|
-
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
99
|
-
* corresponding internal elements and states of this component.
|
|
100
|
-
*
|
|
101
|
-
* The following classes are supported:
|
|
102
|
-
*
|
|
103
|
-
* * `iconButton` - The root component class
|
|
104
|
-
* * `icon` - The {@link ui/IconButton.IconButtonBase.iconComponent|icon component} class
|
|
105
|
-
* * `large` - Applied when `size` prop is `'large'`
|
|
106
|
-
* * `small` - Applied when `size` prop is `'small'`
|
|
107
|
-
* * `pressed` - Applied when `pressed` prop is `true`
|
|
108
|
-
*
|
|
109
|
-
* @type {Object}
|
|
110
|
-
* @public
|
|
111
|
-
*/
|
|
112
|
-
css: _propTypes2["default"].object,
|
|
113
|
-
/**
|
|
114
|
-
* Disables IconButton.
|
|
115
|
-
*
|
|
116
|
-
* When `true`, the button is shown as disabled and does not generate
|
|
117
|
-
* `onClick` {@link /docs/developer-guide/glossary/#event|events}.
|
|
118
|
-
*
|
|
119
|
-
* @type {Boolean}
|
|
120
|
-
* @default false
|
|
121
|
-
* @public
|
|
122
|
-
*/
|
|
123
|
-
disabled: _propTypes2["default"].bool,
|
|
124
|
-
/**
|
|
125
|
-
* Flip the icon horizontally, vertically or both.
|
|
126
|
-
*
|
|
127
|
-
* @type {('both'|'horizontal'|'vertical')}
|
|
128
|
-
* @public
|
|
129
|
-
*/
|
|
130
|
-
flip: _propTypes2["default"].string,
|
|
131
|
-
/**
|
|
132
|
-
* The icon displayed within the IconButton.
|
|
133
|
-
*
|
|
134
|
-
* If not specified, `children` is used as the icon value instead.
|
|
135
|
-
*
|
|
136
|
-
* @type {String}
|
|
137
|
-
* @public
|
|
138
|
-
*/
|
|
139
|
-
icon: _propTypes2["default"].string,
|
|
140
|
-
/**
|
|
141
|
-
* Applies the `pressed` CSS class.
|
|
142
|
-
*
|
|
143
|
-
* @type {Boolean}
|
|
144
|
-
* @default false
|
|
145
|
-
* @public
|
|
146
|
-
*/
|
|
147
|
-
pressed: _propTypes2["default"].bool,
|
|
148
|
-
/**
|
|
149
|
-
* Applies the `selected` CSS class.
|
|
150
|
-
*
|
|
151
|
-
* @type {Boolean}
|
|
152
|
-
* @default false
|
|
153
|
-
* @public
|
|
154
|
-
*/
|
|
155
|
-
selected: _propTypes2["default"].bool,
|
|
156
|
-
/**
|
|
157
|
-
* The size of the button.
|
|
158
|
-
*
|
|
159
|
-
* Applies the CSS class which can be customized by
|
|
160
|
-
* {@link /docs/developer-guide/theming/|theming}.
|
|
161
|
-
*
|
|
162
|
-
* @type {String}
|
|
163
|
-
* @public
|
|
164
|
-
*/
|
|
165
|
-
size: _propTypes2["default"].string
|
|
166
|
-
},
|
|
167
|
-
defaultProps: {
|
|
168
|
-
disabled: false,
|
|
169
|
-
pressed: false,
|
|
170
|
-
selected: false
|
|
171
|
-
},
|
|
172
|
-
styles: {
|
|
173
|
-
css: _IconButtonModule["default"],
|
|
174
|
-
className: 'iconButton',
|
|
175
|
-
publicClassNames: true
|
|
176
|
-
},
|
|
177
|
-
computed: {
|
|
178
|
-
className: function className(_ref) {
|
|
179
|
-
var size = _ref.size,
|
|
180
|
-
styler = _ref.styler;
|
|
181
|
-
return styler.append(size);
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
render: (0, _deprecate["default"])(function (_ref2) {
|
|
185
|
-
var buttonComponent = _ref2.buttonComponent,
|
|
186
|
-
children = _ref2.children,
|
|
187
|
-
componentRef = _ref2.componentRef,
|
|
188
|
-
css = _ref2.css,
|
|
189
|
-
flip = _ref2.flip,
|
|
190
|
-
icon = _ref2.icon,
|
|
191
|
-
Icon = _ref2.iconComponent,
|
|
192
|
-
size = _ref2.size,
|
|
193
|
-
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
194
|
-
// To support the simpler use case of only specifying the icon as the children within
|
|
195
|
-
// <IconButton>, this falls back on using children if icon isn't specified.
|
|
196
|
-
if (!icon && children) {
|
|
197
|
-
icon = children;
|
|
198
|
-
children = null;
|
|
199
|
-
}
|
|
200
|
-
return (0, _ComponentOverride["default"])(_objectSpread(_objectSpread({}, rest), {}, {
|
|
201
|
-
component: buttonComponent,
|
|
202
|
-
size: size,
|
|
203
|
-
minWidth: false,
|
|
204
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {
|
|
205
|
-
flip: flip,
|
|
206
|
-
size: size,
|
|
207
|
-
className: css.icon,
|
|
208
|
-
children: icon
|
|
209
|
-
}, "icon")].concat(_toConsumableArray(_react.Children.toArray(children))),
|
|
210
|
-
ref: componentRef
|
|
211
|
-
}));
|
|
212
|
-
}, {
|
|
213
|
-
name: 'ui/IconButton',
|
|
214
|
-
replacedBy: 'ui/Button',
|
|
215
|
-
until: '5.0.0'
|
|
216
|
-
})
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* A higher-order component that adds universal button behaviors to an {@link ui/IconButton.IconButtonBase|IconButtonBase}.
|
|
221
|
-
*
|
|
222
|
-
* @hoc
|
|
223
|
-
* @memberof ui/IconButton
|
|
224
|
-
* @mixes ui/ForwardRef.ForwardRef
|
|
225
|
-
* @mixes ui/Touchable.Touchable
|
|
226
|
-
* @public
|
|
227
|
-
*/
|
|
228
|
-
var IconButtonDecorator = exports.IconButtonDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
|
|
229
|
-
prop: 'componentRef'
|
|
230
|
-
}), (0, _Touchable["default"])({
|
|
231
|
-
activeProp: 'pressed'
|
|
232
|
-
}));
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* A minimally styled, but interactive, Button ready for customization by a theme.
|
|
236
|
-
*
|
|
237
|
-
* Example:
|
|
238
|
-
* ```
|
|
239
|
-
* <IconButton size="small">
|
|
240
|
-
* plus
|
|
241
|
-
* </IconButton>
|
|
242
|
-
* ```
|
|
243
|
-
*
|
|
244
|
-
* @class IconButton
|
|
245
|
-
* @extends ui/IconButton.IconButtonBase
|
|
246
|
-
* @mixes ui/IconButton.IconButtonDecorator
|
|
247
|
-
* @omit componentRef
|
|
248
|
-
* @memberof ui/IconButton
|
|
249
|
-
* @ui
|
|
250
|
-
* @public
|
|
251
|
-
*/
|
|
252
|
-
var IconButton = exports.IconButton = IconButtonDecorator(IconButtonBase);
|
|
253
|
-
var _default = exports["default"] = IconButton;
|
package/IconButton/package.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = require("react");
|
|
4
|
-
var _react2 = require("@testing-library/react");
|
|
5
|
-
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
|
6
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
-
describe('IconButton', function () {
|
|
9
|
-
var Button = /*#__PURE__*/(0, _react.forwardRef)(function (props, fn) {
|
|
10
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
11
|
-
ref: fn
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
function Icon() {
|
|
15
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
|
|
16
|
-
}
|
|
17
|
-
test('should return a DOM node reference for `componentRef`', function () {
|
|
18
|
-
var ref = jest.fn();
|
|
19
|
-
(0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton["default"], {
|
|
20
|
-
ref: ref,
|
|
21
|
-
buttonComponent: Button,
|
|
22
|
-
iconComponent: Icon,
|
|
23
|
-
children: "star"
|
|
24
|
-
}));
|
|
25
|
-
var expected = 'DIV';
|
|
26
|
-
var actual = ref.mock.calls[0][0].nodeName;
|
|
27
|
-
expect(actual).toBe(expected);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = exports.RadioControllerDecorator = exports.RadioContext = void 0;
|
|
7
|
-
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
8
|
-
var _deprecate = _interopRequireDefault(require("@enact/core/internal/deprecate"));
|
|
9
|
-
var _Registry = _interopRequireDefault(require("@enact/core/internal/Registry"));
|
|
10
|
-
var _react = require("react");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
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; }
|
|
14
|
-
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; }
|
|
15
|
-
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; }
|
|
16
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
|
-
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
18
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
19
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
20
|
-
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); }
|
|
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); }
|
|
22
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
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
|
-
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
|
-
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() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
27
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
28
|
-
var RadioContext = exports.RadioContext = /*#__PURE__*/(0, _react.createContext)();
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* A higher-order component that establishes a radio group context for its descendants.
|
|
32
|
-
*
|
|
33
|
-
* Any descendants that are wrapped by {@link ui/RadioDecorator.RadioDecorator} will be mutually exclusive.
|
|
34
|
-
*
|
|
35
|
-
* @class RadioControllerDecorator
|
|
36
|
-
* @memberof ui/RadioDecorator
|
|
37
|
-
* @hoc
|
|
38
|
-
* @public
|
|
39
|
-
* @deprecated Will be removed in 5.0.0.
|
|
40
|
-
*/
|
|
41
|
-
var RadioControllerDecorator = exports.RadioControllerDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
42
|
-
var _class;
|
|
43
|
-
return _class = /*#__PURE__*/function (_Component) {
|
|
44
|
-
_inherits(_class, _Component);
|
|
45
|
-
var _super = _createSuper(_class);
|
|
46
|
-
function _class(props) {
|
|
47
|
-
var _this;
|
|
48
|
-
_classCallCheck(this, _class);
|
|
49
|
-
_this = _super.call(this, props);
|
|
50
|
-
_this.active = null;
|
|
51
|
-
_this.registry = _Registry["default"].create(_this.handleNotify.bind(_assertThisInitialized(_this)));
|
|
52
|
-
return _this;
|
|
53
|
-
}
|
|
54
|
-
_createClass(_class, [{
|
|
55
|
-
key: "handleNotify",
|
|
56
|
-
value: function handleNotify(ev, instance) {
|
|
57
|
-
if (ev.action === 'activate') {
|
|
58
|
-
this.activate(instance);
|
|
59
|
-
} else if (ev.action === 'deactivate') {
|
|
60
|
-
this.deactivate(instance);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "activate",
|
|
65
|
-
value: function activate(item) {
|
|
66
|
-
var _this2 = this;
|
|
67
|
-
// if the active radio item isn't item and item is active, try to deactivate all the
|
|
68
|
-
// other radio items
|
|
69
|
-
if (this.active && this.active !== item) {
|
|
70
|
-
this.registry.notify({
|
|
71
|
-
action: 'deactivate'
|
|
72
|
-
}, function (i) {
|
|
73
|
-
return i === _this2.active;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
this.active = item;
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
|
-
key: "deactivate",
|
|
80
|
-
value: function deactivate(item) {
|
|
81
|
-
if (this.active === item) {
|
|
82
|
-
this.active = null;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}, {
|
|
86
|
-
key: "render",
|
|
87
|
-
value: function render() {
|
|
88
|
-
(0, _deprecate["default"])({
|
|
89
|
-
name: 'ui/RadioDecorator.RadioControllerDecorator',
|
|
90
|
-
until: '5.0.0'
|
|
91
|
-
});
|
|
92
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RadioContext.Provider, {
|
|
93
|
-
value: this.registry.register,
|
|
94
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread({}, this.props))
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}]);
|
|
98
|
-
return _class;
|
|
99
|
-
}(_react.Component), _class.displayName = 'RadioControllerDecorator', _class;
|
|
100
|
-
});
|
|
101
|
-
var _default = exports["default"] = RadioControllerDecorator;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// Type definitions for ui/RadioDecorator
|
|
2
|
-
|
|
3
|
-
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
4
|
-
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
5
|
-
|
|
6
|
-
export interface RadioControllerDecoratorProps {}
|
|
7
|
-
export function RadioControllerDecorator<P>(
|
|
8
|
-
Component: React.ComponentType<P> | string,
|
|
9
|
-
): React.ComponentType<P & RadioControllerDecoratorProps>;
|
|
10
|
-
|
|
11
|
-
export interface RadioDecoratorConfig extends Object {
|
|
12
|
-
/**
|
|
13
|
-
* The event indicating the wrapped component is activated
|
|
14
|
-
*/
|
|
15
|
-
activate?: string;
|
|
16
|
-
/**
|
|
17
|
-
* The event indicating the wrapped component is deactivated
|
|
18
|
-
*/
|
|
19
|
-
deactivate?: string;
|
|
20
|
-
/**
|
|
21
|
-
* The name of a boolean prop that activates the wrapped component when it is true.
|
|
22
|
-
*/
|
|
23
|
-
prop?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface RadioDecoratorProps {}
|
|
26
|
-
export function RadioDecorator<P>(
|
|
27
|
-
config: RadioDecoratorConfig,
|
|
28
|
-
Component: React.ComponentType<P> | string,
|
|
29
|
-
): React.ComponentType<P & RadioDecoratorProps>;
|
|
30
|
-
|
|
31
|
-
export function RadioDecorator<P>(
|
|
32
|
-
Component: React.ComponentType<P> | string,
|
|
33
|
-
): React.ComponentType<P & RadioDecoratorProps>;
|
|
34
|
-
|
|
35
|
-
export default RadioDecorator;
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "RadioControllerDecorator", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _RadioControllerDecorator.RadioControllerDecorator;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
exports["default"] = exports.RadioDecorator = void 0;
|
|
13
|
-
var _deprecate = _interopRequireDefault(require("@enact/core/internal/deprecate"));
|
|
14
|
-
var _handle = require("@enact/core/handle");
|
|
15
|
-
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
16
|
-
var _react = require("react");
|
|
17
|
-
var _RadioControllerDecorator = require("./RadioControllerDecorator");
|
|
18
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
20
|
-
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; }
|
|
21
|
-
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; }
|
|
22
|
-
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; }
|
|
23
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
24
|
-
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
25
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
26
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
27
|
-
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); }
|
|
28
|
-
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); }
|
|
29
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
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
|
-
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
|
-
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() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
34
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /**
|
|
35
|
-
* A higher-order component that manages activation of components.
|
|
36
|
-
*
|
|
37
|
-
* @module ui/RadioDecorator
|
|
38
|
-
* @exports RadioDecorator
|
|
39
|
-
* @exports RadioControllerDecorator
|
|
40
|
-
* @deprecated Will be removed in 5.0.0.
|
|
41
|
-
*/ /**
|
|
42
|
-
* Default config for `RadioDecorator`.
|
|
43
|
-
*
|
|
44
|
-
* @memberof ui/RadioDecorator.RadioDecorator
|
|
45
|
-
* @hocconfig
|
|
46
|
-
*/
|
|
47
|
-
var defaultConfig = {
|
|
48
|
-
/**
|
|
49
|
-
* The event indicating the wrapped component is activated
|
|
50
|
-
*
|
|
51
|
-
* @type {String}
|
|
52
|
-
* @default null
|
|
53
|
-
* @memberof ui/RadioDecorator.RadioDecorator.defaultConfig
|
|
54
|
-
*/
|
|
55
|
-
activate: null,
|
|
56
|
-
/**
|
|
57
|
-
* The event indicating the wrapped component is deactivated
|
|
58
|
-
*
|
|
59
|
-
* @type {String}
|
|
60
|
-
* @default null
|
|
61
|
-
* @memberof ui/RadioDecorator.RadioDecorator.defaultConfig
|
|
62
|
-
*/
|
|
63
|
-
deactivate: null,
|
|
64
|
-
/**
|
|
65
|
-
* The name of a boolean prop that activates the wrapped component when it is true.
|
|
66
|
-
*
|
|
67
|
-
* @type {String}
|
|
68
|
-
* @default 'active'
|
|
69
|
-
* @memberof ui/RadioDecorator.RadioDecorator.defaultConfig
|
|
70
|
-
*/
|
|
71
|
-
prop: 'active'
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* A higher-order component (HOC) that allows another component to have a mutually exclusive
|
|
76
|
-
* relationship with other descendants of the same {@link ui/RadioDecorator.RadioControllerDecorator}.
|
|
77
|
-
*
|
|
78
|
-
* When the `activate` event for the wrapped component is called, the component is activated and the
|
|
79
|
-
* previously activated component, if any, is deactivated by invoking the `deactivate` event.
|
|
80
|
-
*
|
|
81
|
-
* @class RadioDecorator
|
|
82
|
-
* @memberof ui/RadioDecorator
|
|
83
|
-
* @hoc
|
|
84
|
-
* @public
|
|
85
|
-
*/
|
|
86
|
-
var RadioDecorator = exports.RadioDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
87
|
-
var _class;
|
|
88
|
-
var activate = config.activate,
|
|
89
|
-
deactivate = config.deactivate,
|
|
90
|
-
prop = config.prop;
|
|
91
|
-
return _class = /*#__PURE__*/function (_Component) {
|
|
92
|
-
_inherits(_class, _Component);
|
|
93
|
-
var _super = _createSuper(_class);
|
|
94
|
-
function _class() {
|
|
95
|
-
var _this;
|
|
96
|
-
_classCallCheck(this, _class);
|
|
97
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
98
|
-
args[_key] = arguments[_key];
|
|
99
|
-
}
|
|
100
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
101
|
-
/*
|
|
102
|
-
* Invoked by a `RadioControllerDecorator` when the wrapped component should be deactivated
|
|
103
|
-
*
|
|
104
|
-
* @returns {undefined}
|
|
105
|
-
*/
|
|
106
|
-
_this.deactivate = function () {
|
|
107
|
-
if (_this.props[prop]) {
|
|
108
|
-
(0, _handle.forwardCustom)(deactivate)(null, _this.props);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
_this.handleActivate = function () {
|
|
112
|
-
if (_this.controller) {
|
|
113
|
-
_this.controller.notify({
|
|
114
|
-
action: 'activate'
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
(0, _handle.forwardCustom)(activate)(null, _this.props);
|
|
118
|
-
};
|
|
119
|
-
_this.handleDeactivate = function () {
|
|
120
|
-
if (_this.controller) {
|
|
121
|
-
_this.controller.notify({
|
|
122
|
-
action: 'deactivate'
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
(0, _handle.forwardCustom)(deactivate)(null, _this.props);
|
|
126
|
-
};
|
|
127
|
-
return _this;
|
|
128
|
-
}
|
|
129
|
-
_createClass(_class, [{
|
|
130
|
-
key: "componentDidMount",
|
|
131
|
-
value: function componentDidMount() {
|
|
132
|
-
if (this.context && typeof this.context === 'function') {
|
|
133
|
-
this.controller = this.context(this.handleDeactivate);
|
|
134
|
-
this.notifyController();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}, {
|
|
138
|
-
key: "componentDidUpdate",
|
|
139
|
-
value: function componentDidUpdate() {
|
|
140
|
-
this.notifyController();
|
|
141
|
-
}
|
|
142
|
-
}, {
|
|
143
|
-
key: "componentWillUnmount",
|
|
144
|
-
value: function componentWillUnmount() {
|
|
145
|
-
if (this.controller) {
|
|
146
|
-
this.controller.unregister();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}, {
|
|
150
|
-
key: "notifyController",
|
|
151
|
-
value: function notifyController() {
|
|
152
|
-
if (this.controller && prop && this.props[prop]) {
|
|
153
|
-
this.controller.notify({
|
|
154
|
-
action: 'activate'
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}, {
|
|
159
|
-
key: "render",
|
|
160
|
-
value: function render() {
|
|
161
|
-
(0, _deprecate["default"])({
|
|
162
|
-
name: 'ui/RadioDecorator.RadioDecorator',
|
|
163
|
-
until: '5.0.0'
|
|
164
|
-
});
|
|
165
|
-
var props = this.props;
|
|
166
|
-
if (activate || deactivate) {
|
|
167
|
-
props = Object.assign({}, this.props);
|
|
168
|
-
if (activate) props[activate] = this.handleActivate;
|
|
169
|
-
if (deactivate) props[deactivate] = this.handleDeactivate;
|
|
170
|
-
}
|
|
171
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread({}, props));
|
|
172
|
-
}
|
|
173
|
-
}]);
|
|
174
|
-
return _class;
|
|
175
|
-
}(_react.Component), _class.displayName = 'RadioDecorator', _class.contextType = _RadioControllerDecorator.RadioContext, _class;
|
|
176
|
-
});
|
|
177
|
-
var _default = exports["default"] = RadioDecorator;
|