@enact/ui 4.9.2 → 5.0.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.
- package/AnnounceDecorator/Announce.js +20 -22
- package/AnnounceDecorator/AnnounceDecorator.js +5 -5
- package/AnnounceDecorator/tests/Announce-specs.js +1 -1
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +1 -1
- package/AnnounceDecorator/tests/useAnnounce-specs.js +1 -1
- package/AnnounceDecorator/useAnnounce.js +1 -1
- package/BodyText/BodyText.js +5 -5
- package/BodyText/tests/BodyText-specs.js +1 -1
- package/Button/Button.js +5 -5
- package/Button/tests/Button-specs.js +3 -3
- package/CHANGELOG.md +33 -0
- package/Cancelable/Cancelable.js +22 -24
- package/Cancelable/tests/Cancelable-specs.js +4 -4
- package/Changeable/Changeable.js +22 -24
- package/Changeable/tests/Changeable-specs.js +1 -1
- package/ComponentOverride/ComponentOverride.js +4 -4
- package/FloatingLayer/FloatingLayer.js +20 -22
- package/FloatingLayer/FloatingLayerContainer.js +6 -7
- package/FloatingLayer/FloatingLayerDecorator.js +5 -5
- package/FloatingLayer/Scrim.js +18 -20
- package/FloatingLayer/tests/FloatingLayer-specs.js +1 -1
- package/FloatingLayer/tests/Scrim-specs.js +1 -1
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +2 -2
- package/FloatingLayer/useFloatingLayer.js +4 -4
- package/FloatingLayer/useFloatingLayerDecorator.js +1 -1
- package/ForwardRef/ForwardRef.js +3 -3
- package/Group/Group.js +5 -5
- package/Group/GroupItem.js +5 -5
- package/Group/tests/Group-specs.js +4 -4
- package/Heading/Heading.js +5 -5
- package/Heading/tests/Heading-specs.js +1 -1
- package/Icon/Icon.js +5 -5
- package/Icon/tests/Icon-specs.js +1 -1
- package/Image/Image.js +5 -5
- package/Image/tests/Image-specs.js +1 -1
- package/ImageItem/ImageItem.js +5 -5
- package/ImageItem/tests/ImageItem-specs.js +3 -3
- package/Item/Item.js +5 -5
- package/Item/tests/Item-specs.js +3 -3
- package/LabeledIcon/LabeledIcon.js +5 -5
- package/LabeledIcon/tests/LabeledIcon-specs.js +1 -1
- package/Layout/Cell.js +5 -5
- package/Layout/Layout.js +5 -5
- package/Layout/tests/Layout-specs.js +7 -7
- package/Marquee/MarqueeBase.js +5 -5
- package/Marquee/MarqueeController.js +3 -3
- package/Marquee/MarqueeDecorator.js +30 -51
- package/Marquee/index.d.ts +10 -14
- package/Marquee/index.js +1 -1
- package/Marquee/tests/Marquee-specs.js +5 -6
- package/Marquee/useMarqueeController.js +2 -2
- package/Measurable/Measurable.js +8 -8
- package/Measurable/tests/Measurable-specs.js +8 -10
- package/Media/Media.js +17 -19
- package/Placeholder/PlaceholderControllerDecorator.js +22 -24
- package/Placeholder/PlaceholderDecorator.js +20 -22
- package/Placeholder/index.js +1 -1
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +2 -2
- package/Placeholder/tests/PlaceholderDecorator-specs.js +1 -1
- package/ProgressBar/ProgressBar.js +5 -5
- package/ProgressBar/tests/ProgressBar-specs.js +1 -1
- package/Repeater/Repeater.js +5 -5
- package/Repeater/tests/Repeater-specs.js +3 -3
- package/Resizable/Resizable.js +3 -3
- package/Resizable/tests/Resizable-specs.js +2 -2
- package/Resizable/tests/useResize-specs.js +3 -3
- package/Resizable/useResize.js +3 -3
- package/Routable/Link.js +17 -19
- package/Routable/Routable.js +5 -5
- package/Routable/Route.js +1 -1
- package/Routable/Router.js +22 -24
- package/Routable/tests/Routable-specs.js +9 -9
- package/Routable/tests/Router-specs.js +1 -1
- package/Routable/util.js +1 -1
- package/Scroller/Scroller.d.ts +0 -120
- package/Scroller/Scroller.js +3 -11
- package/Scroller/ScrollerBasic.js +19 -21
- package/Scroller/tests/Scroller-specs.js +1 -1
- package/Skinnable/Skinnable.js +5 -5
- package/Skinnable/tests/Skinnable-specs.js +3 -3
- package/Skinnable/tests/useSkins-specs.js +3 -3
- package/Skinnable/util.js +1 -1
- package/Slider/Knob.js +5 -5
- package/Slider/PositionDecorator.js +25 -27
- package/Slider/Slider.js +5 -5
- package/Slider/tests/Slider-specs.js +1 -1
- package/Slottable/Slottable.js +3 -5
- package/Slottable/tests/Slottable-specs.js +1 -1
- package/Slottable/tests/useSlots-specs.js +1 -1
- package/Slottable/useSlots.js +5 -5
- package/Spinner/Spinner.js +5 -5
- package/ToggleIcon/ToggleIcon.js +5 -5
- package/ToggleIcon/tests/ToggleIcon-specs.js +3 -3
- package/Toggleable/Toggle.js +6 -7
- package/Toggleable/Toggleable.js +6 -6
- package/Toggleable/tests/Toggleable-specs.js +1 -1
- package/Toggleable/useToggle.js +8 -8
- package/Touchable/ClickAllow.js +5 -6
- package/Touchable/Drag.js +6 -6
- package/Touchable/Flick.js +7 -8
- package/Touchable/Hold.js +7 -8
- package/Touchable/Pinch.js +6 -6
- package/Touchable/Touch.js +6 -7
- package/Touchable/Touchable.js +5 -5
- package/Touchable/config.js +2 -2
- package/Touchable/tests/Touchable-specs.js +3 -3
- package/Touchable/tests/useTouch-specs.js +5 -5
- package/Touchable/useTouch.js +7 -7
- package/Transition/Transition.js +17 -19
- package/Transition/tests/Transition-specs.js +7 -7
- package/ViewManager/Arranger.js +3 -3
- package/ViewManager/TransitionGroup.js +18 -20
- package/ViewManager/View.js +15 -17
- package/ViewManager/ViewManager.js +25 -27
- package/ViewManager/tests/View-specs.js +1 -1
- package/ViewManager/tests/ViewManager-specs.js +16 -18
- package/VirtualList/VirtualList.d.ts +0 -158
- package/VirtualList/VirtualList.js +3 -17
- package/VirtualList/VirtualListBasic.js +42 -43
- package/VirtualList/tests/VirtualGridList-native-specs.js +4 -4
- package/VirtualList/tests/VirtualGridList-specs.js +6 -6
- package/VirtualList/tests/VirtualList-native-specs.js +5 -5
- package/VirtualList/tests/VirtualList-specs.js +7 -7
- package/internal/IdProvider/IdProvider.js +3 -3
- package/internal/IdProvider/Provider.js +5 -6
- package/internal/IdProvider/tests/IdProvider-specs.js +3 -3
- package/internal/IdProvider/tests/useId-specs.js +3 -3
- package/internal/IdProvider/useId.js +1 -1
- package/internal/Pure/Pure.js +20 -22
- package/internal/Pure/tests/Pure-specs.js +15 -17
- package/internal/localized-fonts/localized-fonts.js +4 -4
- package/internal/selection/selection.js +1 -1
- package/package.json +5 -4
- package/resolution/ResolutionDecorator.js +21 -23
- package/resolution/index.js +2 -2
- package/resolution/tests/ResolutionDecorator-specs.js +1 -1
- package/useControlledState/tests/useControlledState-specs.js +5 -5
- package/useControlledState/useControlledState.js +4 -4
- package/useScroll/ScrollAnimator.js +6 -7
- package/useScroll/Scrollbar.js +5 -5
- package/useScroll/ScrollbarTrack.js +5 -5
- package/useScroll/useScroll.js +9 -9
- package/useScroll/utilDOM.js +1 -1
- 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 -11
- 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 -34
- package/Scrollable/Scrollable.js +0 -1430
- package/Scrollable/Scrollable.module.css +0 -36
- package/Scrollable/ScrollableNative.js +0 -1429
- package/Scrollable/Scrollbar.js +0 -281
- package/Scrollable/Scrollbar.module.css +0 -24
- 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/SlotItem/SlotItem.js
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = exports.SlotItemDecorator = exports.SlotItemBase = exports.SlotItem = 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 _Slottable = _interopRequireDefault(require("../Slottable"));
|
|
13
|
-
var _SlotItemModule = _interopRequireDefault(require("./SlotItem.module.css"));
|
|
14
|
-
var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
|
|
15
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
var _excluded = ["children", "component", "componentRef", "inline", "slotAfter", "slotBefore"];
|
|
17
|
-
/**
|
|
18
|
-
* An unstyled item component that accepts multiple positions of children.
|
|
19
|
-
*
|
|
20
|
-
* Using the usual `children` prop, as well as two additional props: `slotBefore`, and `slotAfter`.
|
|
21
|
-
* It is able to be customized by a theme or application.
|
|
22
|
-
*
|
|
23
|
-
* @module ui/SlotItem
|
|
24
|
-
* @exports SlotItem
|
|
25
|
-
* @exports SlotItemBase
|
|
26
|
-
* @exports SlotItemDecorator
|
|
27
|
-
* @deprecated Will be removed in 5.0.0.
|
|
28
|
-
*/
|
|
29
|
-
/**
|
|
30
|
-
* A ui-styled `SlotItem` without any behavior.
|
|
31
|
-
*
|
|
32
|
-
* @class SlotItemBase
|
|
33
|
-
* @memberof ui/SlotItem
|
|
34
|
-
* @ui
|
|
35
|
-
* @public
|
|
36
|
-
*/
|
|
37
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
38
|
-
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; }
|
|
39
|
-
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; }
|
|
40
|
-
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; }
|
|
41
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
42
|
-
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); }
|
|
43
|
-
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; }
|
|
44
|
-
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
|
-
var SlotItemBase = exports.SlotItemBase = (0, _kind["default"])({
|
|
46
|
-
name: 'SlotItem',
|
|
47
|
-
propTypes: /** @lends ui/SlotItem.SlotItemBase.prototype */{
|
|
48
|
-
/**
|
|
49
|
-
* The type of component to use to render the item.
|
|
50
|
-
*
|
|
51
|
-
* This component will receive the `inline` prop and any additional unhandled props provided
|
|
52
|
-
* to `SlotItem`. A derivative of {@link ui/Item.Item|Item} is recommended.
|
|
53
|
-
*
|
|
54
|
-
* @type {Component}
|
|
55
|
-
* @required
|
|
56
|
-
* @public
|
|
57
|
-
*/
|
|
58
|
-
component: _propTypes["default"].component.isRequired,
|
|
59
|
-
/**
|
|
60
|
-
* Controls the visibility state of the slots.
|
|
61
|
-
*
|
|
62
|
-
* One, both, or neither slot can be shown. Choosing `'after'` will leave `slotBefore`
|
|
63
|
-
* visible at all times; only `slotAfter` will have its visibility toggled. Valid values
|
|
64
|
-
* are `'before'`, `'after'` and `'both'`. Omitting the property will result in
|
|
65
|
-
* no-auto-hiding for either slot so they will both be present.
|
|
66
|
-
*
|
|
67
|
-
* In order for `autoHide` to have a visual affect, the `hidden` class must be tied to
|
|
68
|
-
* another condition such as focus.
|
|
69
|
-
*
|
|
70
|
-
* ```
|
|
71
|
-
* .slot.hidden:not(:focus) {
|
|
72
|
-
* display: none;
|
|
73
|
-
* }
|
|
74
|
-
* ```
|
|
75
|
-
*
|
|
76
|
-
* @type {Boolean}
|
|
77
|
-
* @public
|
|
78
|
-
*/
|
|
79
|
-
autoHide: _propTypes2["default"].oneOf(['after', 'before', 'both']),
|
|
80
|
-
/**
|
|
81
|
-
* Called with a reference to the root component.
|
|
82
|
-
*
|
|
83
|
-
* When using {@link ui/SlotItem.SlotItem}, the `ref` prop is forwarded to this component
|
|
84
|
-
* as `componentRef`.
|
|
85
|
-
*
|
|
86
|
-
* @type {Object|Function}
|
|
87
|
-
* @public
|
|
88
|
-
*/
|
|
89
|
-
componentRef: _propTypes["default"].ref,
|
|
90
|
-
/**
|
|
91
|
-
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
92
|
-
* corresponding internal elements and states of this component.
|
|
93
|
-
*
|
|
94
|
-
* The following classes are supported:
|
|
95
|
-
*
|
|
96
|
-
* * `slotItem` - The root class name
|
|
97
|
-
* * `slot` - Applied to both slots
|
|
98
|
-
* * `after` - Applied to the slot that falls after the content
|
|
99
|
-
* * `before` - Applied to the slot that falls before the content
|
|
100
|
-
* * `hidden` - Applied to a slot when that slot is supposed to be hidden, according to
|
|
101
|
-
* `autoHide` prop
|
|
102
|
-
*
|
|
103
|
-
* @type {Object}
|
|
104
|
-
* @public
|
|
105
|
-
*/
|
|
106
|
-
css: _propTypes2["default"].object,
|
|
107
|
-
/**
|
|
108
|
-
* Applies inline styling to the component.
|
|
109
|
-
*
|
|
110
|
-
* @type {Boolean}
|
|
111
|
-
* @default false
|
|
112
|
-
* @public
|
|
113
|
-
*/
|
|
114
|
-
inline: _propTypes2["default"].bool,
|
|
115
|
-
/**
|
|
116
|
-
* The layout technique for `SlotItem`.
|
|
117
|
-
*
|
|
118
|
-
* `"flex"` is applied as a default and gives basic flex support to the wrapping elements.
|
|
119
|
-
* This may be set to `null` to define your own layout method.
|
|
120
|
-
*
|
|
121
|
-
* @type {String}
|
|
122
|
-
* @default 'flex'
|
|
123
|
-
* @public
|
|
124
|
-
*/
|
|
125
|
-
layout: _propTypes2["default"].oneOf(['flex']),
|
|
126
|
-
/**
|
|
127
|
-
* Nodes to be inserted after `children` and hidden using `autoHide`.
|
|
128
|
-
*
|
|
129
|
-
* If nothing is specified, nothing, not even an empty container, is rendered in this place.
|
|
130
|
-
*
|
|
131
|
-
* @type {Node}
|
|
132
|
-
* @public
|
|
133
|
-
*/
|
|
134
|
-
slotAfter: _propTypes2["default"].node,
|
|
135
|
-
/**
|
|
136
|
-
* Nodes to be inserted before `children` and hidden using `autoHide`.
|
|
137
|
-
*
|
|
138
|
-
* If nothing is specified, nothing, not even an empty container, is rendered in this place.
|
|
139
|
-
*
|
|
140
|
-
* @type {Node}
|
|
141
|
-
* @public
|
|
142
|
-
*/
|
|
143
|
-
slotBefore: _propTypes2["default"].node
|
|
144
|
-
},
|
|
145
|
-
defaultProps: {
|
|
146
|
-
inline: false,
|
|
147
|
-
layout: 'flex'
|
|
148
|
-
},
|
|
149
|
-
styles: {
|
|
150
|
-
css: _SlotItemModule["default"],
|
|
151
|
-
className: 'slotItem',
|
|
152
|
-
publicClassNames: true
|
|
153
|
-
},
|
|
154
|
-
computed: {
|
|
155
|
-
className: function className(_ref) {
|
|
156
|
-
var inline = _ref.inline,
|
|
157
|
-
layout = _ref.layout,
|
|
158
|
-
styler = _ref.styler;
|
|
159
|
-
return styler.append(layout, {
|
|
160
|
-
inline: inline
|
|
161
|
-
});
|
|
162
|
-
},
|
|
163
|
-
slotBefore: function slotBefore(_ref2) {
|
|
164
|
-
var _slotBefore = _ref2.slotBefore,
|
|
165
|
-
autoHide = _ref2.autoHide,
|
|
166
|
-
styler = _ref2.styler;
|
|
167
|
-
return _slotBefore ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
168
|
-
className: styler.join('slot', 'before', {
|
|
169
|
-
hidden: autoHide === 'before' || autoHide === 'both'
|
|
170
|
-
}),
|
|
171
|
-
children: _slotBefore
|
|
172
|
-
}) : null;
|
|
173
|
-
},
|
|
174
|
-
slotAfter: function slotAfter(_ref3) {
|
|
175
|
-
var _slotAfter = _ref3.slotAfter,
|
|
176
|
-
autoHide = _ref3.autoHide,
|
|
177
|
-
styler = _ref3.styler;
|
|
178
|
-
return _slotAfter ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
179
|
-
className: styler.join('slot', 'after', {
|
|
180
|
-
hidden: autoHide === 'after' || autoHide === 'both'
|
|
181
|
-
}),
|
|
182
|
-
children: _slotAfter
|
|
183
|
-
}) : null;
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
render: (0, _deprecate["default"])(function (_ref4) {
|
|
187
|
-
var children = _ref4.children,
|
|
188
|
-
Component = _ref4.component,
|
|
189
|
-
componentRef = _ref4.componentRef,
|
|
190
|
-
inline = _ref4.inline,
|
|
191
|
-
slotAfter = _ref4.slotAfter,
|
|
192
|
-
slotBefore = _ref4.slotBefore,
|
|
193
|
-
rest = _objectWithoutProperties(_ref4, _excluded);
|
|
194
|
-
delete rest.autoHide;
|
|
195
|
-
delete rest.layout;
|
|
196
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, _objectSpread(_objectSpread({
|
|
197
|
-
ref: componentRef
|
|
198
|
-
}, rest), {}, {
|
|
199
|
-
inline: inline,
|
|
200
|
-
children: [slotBefore, children, slotAfter]
|
|
201
|
-
}));
|
|
202
|
-
}, {
|
|
203
|
-
name: 'ui/SlotItem',
|
|
204
|
-
until: '5.0.0'
|
|
205
|
-
})
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* A ui-specific higher-order component (HOC) with slot behaviors to apply to {@link ui/SlotItem.SlotItemBase|SlotItem}.
|
|
210
|
-
*
|
|
211
|
-
* @class SlotItemDecorator
|
|
212
|
-
* @memberof ui/SlotItem
|
|
213
|
-
* @mixes ui/Slottable.Slottable
|
|
214
|
-
* @mixes ui/ForwardRef.ForwardRef
|
|
215
|
-
* @hoc
|
|
216
|
-
* @public
|
|
217
|
-
*/
|
|
218
|
-
var SlotItemDecorator = exports.SlotItemDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
|
|
219
|
-
prop: 'componentRef'
|
|
220
|
-
}), (0, _Slottable["default"])({
|
|
221
|
-
slots: ['slotAfter', 'slotBefore']
|
|
222
|
-
}));
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* A ui-styled item with built-in support for slots.
|
|
226
|
-
*
|
|
227
|
-
* Example:
|
|
228
|
-
* ```
|
|
229
|
-
* <SlotItem component={Item} autoHide="both">
|
|
230
|
-
* <slotBefore>
|
|
231
|
-
* <Icon>flag</Icon>
|
|
232
|
-
* <Icon>star</Icon>
|
|
233
|
-
* </slotBefore>
|
|
234
|
-
* An Item that will show some icons slotBefore and slotAfter this text when spotted
|
|
235
|
-
* <Icon slot="slotAfter">trash</Icon>
|
|
236
|
-
* </SlotItem>
|
|
237
|
-
* ```
|
|
238
|
-
*
|
|
239
|
-
* @class SlotItem
|
|
240
|
-
* @memberof ui/SlotItem
|
|
241
|
-
* @extends ui/SlotItem.SlotItemBase
|
|
242
|
-
* @mixes ui/SlotItem.SlotItemDecorator
|
|
243
|
-
* @omit componentRef
|
|
244
|
-
* @ui
|
|
245
|
-
* @public
|
|
246
|
-
*/
|
|
247
|
-
var SlotItem = exports.SlotItem = SlotItemDecorator(SlotItemBase);
|
|
248
|
-
var _default = exports["default"] = SlotItem;
|
package/SlotItem/package.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = require("@testing-library/react");
|
|
4
|
-
var _react2 = require("react");
|
|
5
|
-
var _SlotItem = _interopRequireDefault(require("../SlotItem"));
|
|
6
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
-
describe('SlotItem', function () {
|
|
9
|
-
test('should return a DOM node reference for `componentRef`', function () {
|
|
10
|
-
var component = /*#__PURE__*/(0, _react2.forwardRef)(function (props, fn) {
|
|
11
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
12
|
-
ref: fn
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
var ref = jest.fn();
|
|
16
|
-
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SlotItem["default"], {
|
|
17
|
-
ref: ref,
|
|
18
|
-
component: component
|
|
19
|
-
}));
|
|
20
|
-
var expected = 'DIV';
|
|
21
|
-
var actual = ref.mock.calls[0][0].nodeName;
|
|
22
|
-
expect(actual).toBe(expected);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// Type definitions for ui/ToggleItem
|
|
2
|
-
|
|
3
|
-
import { ForwardRefProps as ui_ForwardRef_ForwardRefProps } from "@enact/ui/ForwardRef";
|
|
4
|
-
import { TouchableProps as ui_Touchable_TouchableProps } from "@enact/ui/Touchable";
|
|
5
|
-
import { ToggleableProps as ui_Toggleable_ToggleableProps } from "@enact/ui/Toggleable";
|
|
6
|
-
import * as React from "react";
|
|
7
|
-
|
|
8
|
-
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
9
|
-
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
10
|
-
|
|
11
|
-
export interface ToggleItemBaseProps {
|
|
12
|
-
/**
|
|
13
|
-
* The main content of the toggle item.
|
|
14
|
-
*/
|
|
15
|
-
children: React.ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* The type of component to use to render as root element.
|
|
18
|
-
*
|
|
19
|
-
* This receives the `css` prop for theme extension and therefore must be a custom
|
|
20
|
-
component and not a simple HTML DOM node. Recommended component or themed
|
|
21
|
-
derivative:
|
|
22
|
-
*/
|
|
23
|
-
component: React.ComponentType;
|
|
24
|
-
/**
|
|
25
|
-
* The `Icon` to render in this item.
|
|
26
|
-
*
|
|
27
|
-
* This component receives the `selected` prop and value,
|
|
28
|
-
and must therefore respond to it in some way. It is recommended to use
|
|
29
|
-
for this.
|
|
30
|
-
*/
|
|
31
|
-
iconComponent: React.ComponentType | JSX.Element;
|
|
32
|
-
/**
|
|
33
|
-
* Called with a reference to the root component.
|
|
34
|
-
*
|
|
35
|
-
* When using , the `ref` prop is forwarded to this
|
|
36
|
-
component as `componentRef` .
|
|
37
|
-
*/
|
|
38
|
-
componentRef?: object | Function;
|
|
39
|
-
/**
|
|
40
|
-
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
41
|
-
corresponding internal elements and states of this component.
|
|
42
|
-
*
|
|
43
|
-
* The following classes are supported:
|
|
44
|
-
* * `toggleItem` - The root class name
|
|
45
|
-
*/
|
|
46
|
-
css?: object;
|
|
47
|
-
/**
|
|
48
|
-
* Applies a disabled visual state to the toggle item.
|
|
49
|
-
*/
|
|
50
|
-
disabled?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* An optional prop that lets you override the icon of the `iconComponent` component.
|
|
53
|
-
*
|
|
54
|
-
* This accepts any string that the component supports, provided
|
|
55
|
-
the recommendations of `iconComponent` are followed.
|
|
56
|
-
*/
|
|
57
|
-
icon?: string | object;
|
|
58
|
-
/**
|
|
59
|
-
* Specifies on which side ( `'before'` or `'after'` ) of `children` the icon appears.
|
|
60
|
-
*/
|
|
61
|
-
iconPosition?: "before" | "after";
|
|
62
|
-
/**
|
|
63
|
-
* An additional customizable icon component.
|
|
64
|
-
*
|
|
65
|
-
* Supports more granular positioning rules. This should only be used _after_ specifying the
|
|
66
|
-
`icon` property, as the positioning for this offers the ability to place this in front of
|
|
67
|
-
or behind the existing `icon` . See `itemIconPosition` for options.
|
|
68
|
-
*/
|
|
69
|
-
itemIcon?: React.ReactNode;
|
|
70
|
-
/**
|
|
71
|
-
* Specifies where `itemIcon` appears.
|
|
72
|
-
* * `'before'` - first element in the item
|
|
73
|
-
* * `'beforeChildren'` - before `children` . If `iconPosition` is `'before'` , `icon` will be
|
|
74
|
-
before `itemIcon`
|
|
75
|
-
* * `'afterChildren'` - after `children` . If iconPosition `is` 'after' `, ` icon `will be
|
|
76
|
-
after` itemIcon`
|
|
77
|
-
* * `'after'` - the last element in the item
|
|
78
|
-
*/
|
|
79
|
-
itemIconPosition?: "before" | "beforeChildren" | "afterChildren" | "after";
|
|
80
|
-
/**
|
|
81
|
-
* Called when the toggle item is toggled. Developers should generally use `onToggle` instead.
|
|
82
|
-
*/
|
|
83
|
-
onTap?: Function;
|
|
84
|
-
/**
|
|
85
|
-
* Called when the toggle item is toggled.
|
|
86
|
-
*/
|
|
87
|
-
onToggle?: Function;
|
|
88
|
-
/**
|
|
89
|
-
* Applies the provided `icon` .
|
|
90
|
-
*/
|
|
91
|
-
selected?: boolean;
|
|
92
|
-
/**
|
|
93
|
-
* The value that will be sent to the `onToggle` handler.
|
|
94
|
-
*/
|
|
95
|
-
value?: any;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* A minimally styled toggle item without any behavior, ripe for extension.
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
export class ToggleItemBase extends React.Component<
|
|
102
|
-
Merge<React.HTMLProps<HTMLElement>, ToggleItemBaseProps>
|
|
103
|
-
> {}
|
|
104
|
-
|
|
105
|
-
export interface ToggleItemDecoratorProps
|
|
106
|
-
extends Merge<
|
|
107
|
-
Merge<ui_ForwardRef_ForwardRefProps, ui_Touchable_TouchableProps>,
|
|
108
|
-
ui_Toggleable_ToggleableProps
|
|
109
|
-
> {}
|
|
110
|
-
export function ToggleItemDecorator<P>(
|
|
111
|
-
Component: React.ComponentType<P> | string,
|
|
112
|
-
): React.ComponentType<P & ToggleItemDecoratorProps>;
|
|
113
|
-
|
|
114
|
-
export interface ToggleItemProps
|
|
115
|
-
extends Omit<
|
|
116
|
-
Merge<ToggleItemBaseProps, ToggleItemDecoratorProps>,
|
|
117
|
-
"componentRef"
|
|
118
|
-
> {}
|
|
119
|
-
/**
|
|
120
|
-
* An unstyled item with built-in support for toggling.
|
|
121
|
-
*
|
|
122
|
-
* Example:
|
|
123
|
-
* ```
|
|
124
|
-
<ToggleItem icon="lock" iconPosition="before">Toggle Me</ToggleItem>
|
|
125
|
-
```
|
|
126
|
-
*/
|
|
127
|
-
|
|
128
|
-
export class ToggleItem extends React.Component<
|
|
129
|
-
Merge<React.HTMLProps<HTMLElement>, ToggleItemProps>
|
|
130
|
-
> {}
|
|
131
|
-
|
|
132
|
-
export default ToggleItem;
|