@enact/limestone 1.3.0 → 1.9.4
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/.github/workflows/ci-branch.yml +21 -0
- package/.github/workflows/ci-pull-request.yml +16 -0
- package/.github/workflows/ci-reusable.yml +73 -0
- package/ActionGuide/ActionGuide.d.ts +5 -4
- package/ActionGuide/ActionGuide.module.css +1 -1
- package/Alert/Alert.d.ts +4 -2
- package/Alert/Alert.js +4 -1
- package/Alert/Alert.module.css +36 -0
- package/BodyText/BodyText.d.ts +5 -4
- package/BodyText/BodyText.module.css +7 -7
- package/Button/Button.d.ts +17 -12
- package/Button/Button.js +1 -1
- package/Button/Button.module.css +195 -268
- package/CHANGELOG.md +226 -0
- package/Card/Card.d.ts +36 -8
- package/Card/Card.js +157 -20
- package/Card/Card.module.css +277 -58
- package/Card/tests/Card-specs.js +30 -0
- package/Checkbox/Checkbox.d.ts +8 -7
- package/Checkbox/Checkbox.js +3 -1
- package/Checkbox/Checkbox.module.css +213 -120
- package/Checkbox/tests/Checkbox-specs.js +1 -1
- package/CheckboxItem/CheckboxItem.d.ts +22 -7
- package/CheckboxItem/CheckboxItem.js +69 -4
- package/Chips/Chip.js +60 -7
- package/Chips/Chip.module.css +3 -3
- package/Chips/Chips.js +26 -12
- package/Chips/Chips.module.css +1 -1
- package/Chips/tests/Chip-specs.js +19 -9
- package/Chips/tests/Chips-specs.js +19 -19
- package/ContextualMenuDecorator/ContextualMenuDecorator.d.ts +4 -5
- package/ContextualPopupDecorator/ContextualPopup.module.css +34 -34
- package/ContextualPopupDecorator/ContextualPopupDecorator.js +557 -549
- package/DatePicker/DatePicker.d.ts +4 -5
- package/DayPicker/DayPicker.d.ts +8 -7
- package/Dropdown/Dropdown.d.ts +11 -13
- package/Dropdown/Dropdown.module.css +9 -9
- package/Dropdown/DropdownList.js +16 -11
- package/FixedPopupPanels/FixedPopupPanels.d.ts +4 -2
- package/FixedPopupPanels/FixedPopupPanels.module.css +18 -18
- package/FlexiblePopupPanels/FlexiblePopupPanels.module.css +23 -23
- package/FormCheckboxItem/FormCheckboxItem.d.ts +5 -4
- package/Heading/Heading.d.ts +8 -7
- package/Heading/Heading.module.css +5 -5
- package/Icon/Icon.d.ts +14 -4
- package/Icon/Icon.js +48 -2
- package/Icon/Icon.module.css +1 -1
- package/Icon/IconList.js +25 -1
- package/IconItem/IconItem.d.ts +13 -12
- package/IconItem/IconItem.js +15 -0
- package/IconItem/IconItem.module.css +107 -1
- package/Image/Image.d.ts +5 -4
- package/ImageItem/ImageItem.d.ts +11 -10
- package/ImageItem/ImageItem.js +37 -31
- package/ImageItem/ImageItem.module.css +30 -30
- package/ImageItem/tests/ImageItem-specs.js +3 -10
- package/Input/Input.js +9 -2
- package/Input/Input.module.css +37 -8
- package/Input/InputField.js +5 -1
- package/Input/InputField.module.css +17 -2
- package/Input/InputFieldSpotlightDecorator.js +213 -229
- package/Input/index.d.ts +15 -18
- package/Input/tests/InputField-specs.js +21 -0
- package/Item/Item.d.ts +16 -9
- package/Item/Item.js +20 -2
- package/Item/Item.module.css +1 -1
- package/KeyGuide/KeyGuide.d.ts +8 -7
- package/KeyGuide/KeyGuide.module.css +25 -1
- package/Marquee/Marquee.d.ts +2 -4
- package/MediaOverlay/MediaOverlay.d.ts +12 -11
- package/MediaOverlay/MediaOverlay.js +43 -21
- package/MediaOverlay/MediaOverlay.module.css +114 -15
- package/MediaPlayer/MediaControls.js +195 -13
- package/MediaPlayer/MediaControls.module.css +3 -2
- package/MediaPlayer/MediaSlider.module.css +7 -20
- package/MediaPlayer/index.d.ts +59 -7
- package/PageViews/PageViews.js +165 -80
- package/PageViews/PageViewsRouter.js +9 -0
- package/PageViews/tests/PageViews-specs.js +84 -0
- package/Panels/Header.js +48 -30
- package/Panels/Header.module.css +83 -31
- package/Panels/Panel.module.css +1 -1
- package/Panels/index.d.ts +7 -8
- package/Picker/Picker.d.ts +4 -5
- package/Picker/Picker.module.css +2 -2
- package/Popup/Popup.js +242 -240
- package/Popup/Popup.module.css +24 -24
- package/PopupTabLayout/PopupTabLayout.d.ts +5 -7
- package/PopupTabLayout/PopupTabLayout.js +15 -9
- package/PopupTabLayout/PopupTabLayout.module.css +53 -16
- package/PopupTabLayout/PopupTabLayoutStateContext.js +8 -0
- package/ProgressBar/ProgressBar.d.ts +5 -4
- package/ProgressBar/ProgressBarTooltip.module.css +12 -12
- package/ProgressButton/ProgressButton.d.ts +4 -5
- package/QuickGuidePanels/QuickGuidePanels.module.css +2 -2
- package/RadioItem/RadioItem.d.ts +18 -5
- package/RadioItem/RadioItem.js +67 -2
- package/RadioItem/RadioItem.module.css +36 -36
- package/RangePicker/RangePicker.module.css +2 -2
- package/Scroller/EditableWrapper.js +11 -4
- package/Scroller/Scroller.d.ts +20 -16
- package/Scroller/Scroller.js +9 -3
- package/Scroller/Scroller.module.css +4 -4
- package/Slider/Slider.d.ts +16 -14
- package/Slider/Slider.js +37 -4
- package/Slider/Slider.module.css +314 -91
- package/Slider/tests/Slider-specs.js +2 -1
- package/Spinner/Spinner.d.ts +5 -4
- package/Spinner/Spinner.module.css +9 -9
- package/Steps/Steps.d.ts +5 -4
- package/Steps/Steps.js +9 -5
- package/Switch/Switch.d.ts +8 -7
- package/Switch/Switch.module.css +100 -13
- package/SwitchItem/SwitchItem.d.ts +9 -6
- package/TabLayout/RefocusDecorator.js +15 -9
- package/TabLayout/TabGroup.js +3 -2
- package/TabLayout/TabGroup.module.css +2 -2
- package/TabLayout/TabLayout.d.ts +6 -0
- package/TabLayout/TabLayout.js +11 -1
- package/TabLayout/TabLayout.module.css +18 -0
- package/TabLayout/tests/TabLayout-specs.js +52 -0
- package/ThemeDecorator/ThemeDecorator.d.ts +9 -10
- package/ThemeDecorator/fontGenerator.js +1 -1
- package/ThemeDecorator/screenTypes.json +1 -0
- package/TimePicker/TimePicker.module.css +1 -1
- package/TooltipDecorator/Tooltip.module.css +1 -2
- package/TooltipDecorator/tests/util-specs.js +12 -0
- package/TooltipDecorator/useTooltip.js +1 -1
- package/TooltipDecorator/util.js +18 -11
- package/VideoPlayer/Feedback.js +3 -0
- package/VideoPlayer/Feedback.module.css +5 -9
- package/VideoPlayer/FeedbackIcons.js +1 -1
- package/VideoPlayer/FeedbackTooltip.module.css +55 -11
- package/VideoPlayer/VideoPlayer.d.ts +44 -18
- package/VideoPlayer/VideoPlayer.js +128 -23
- package/VideoPlayer/VideoPlayer.module.css +28 -11
- package/VirtualList/VirtualList.d.ts +9 -2
- package/VirtualList/VirtualList.js +31 -6
- package/VirtualList/tests/VirtualGridList-translate-specs.js +3 -0
- package/VirtualList/tests/VirtualList-specs.js +28 -1
- package/VirtualList/tests/VirtualList-translate-specs.js +4 -1
- package/VirtualList/tests/useEvent-specs.js +39 -0
- package/VirtualList/useEvent.js +45 -10
- package/VirtualList/useThemeVirtualList.js +3 -0
- package/WizardPanels/WizardPanels.module.css +2 -2
- package/WizardPanels/index.d.ts +4 -2
- package/fonts/Limestone_Icons.ttf +0 -0
- package/internal/$L/$L.js +3 -3
- package/internal/DateComponentPicker/DateComponentPicker.module.css +2 -2
- package/internal/DateTime/DateTime.module.css +1 -0
- package/internal/Panels/PanelsRouter.js +16 -5
- package/internal/Picker/Picker.module.css +2 -2
- package/internal/SharedStateDecorator/SharedStateDecorator.js +76 -99
- package/internal/validators/validators.js +21 -2
- package/package.json +14 -14
- package/styles/colors-highcontrast.less +9 -1
- package/styles/colors.less +11 -7
- package/styles/motion-mixins.less +66 -0
- package/styles/motions.less +78 -0
- package/styles/variables.less +176 -150
- package/useScroll/HoverToScroll.js +8 -5
- package/useScroll/ScrollbarTrack.module.css +8 -8
- package/useScroll/useEvent.js +7 -1
- package/useScroll/useScroll.js +2 -0
- package/useScroll/useScroll.module.css +6 -6
- package/.travis.yml +0 -40
package/PageViews/PageViews.js
CHANGED
|
@@ -6,10 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = exports.PageViews = void 0;
|
|
7
7
|
var _handle = _interopRequireWildcard(require("@enact/core/handle"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
9
|
+
var _keymap = require("@enact/core/keymap");
|
|
9
10
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
10
11
|
var _util = require("@enact/core/util");
|
|
11
12
|
var _I18nDecorator = require("@enact/i18n/I18nDecorator");
|
|
13
|
+
var _spotlight = _interopRequireDefault(require("@enact/spotlight"));
|
|
12
14
|
var _SpotlightContainerDecorator = _interopRequireWildcard(require("@enact/spotlight/SpotlightContainerDecorator"));
|
|
15
|
+
var _Spottable = _interopRequireDefault(require("@enact/spotlight/Spottable"));
|
|
13
16
|
var _Changeable = _interopRequireDefault(require("@enact/ui/Changeable"));
|
|
14
17
|
var _Layout = require("@enact/ui/Layout");
|
|
15
18
|
var _ViewManager = _interopRequireWildcard(require("@enact/ui/ViewManager"));
|
|
@@ -25,16 +28,37 @@ var _Steps = _interopRequireDefault(require("../Steps"));
|
|
|
25
28
|
var _PageViewsRouter = require("./PageViewsRouter");
|
|
26
29
|
var _PageViewsModule = _interopRequireDefault(require("./PageViews.module.css"));
|
|
27
30
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
|
-
var _excluded = ["css", "componentRef", "fullContents", "index", "pageIndicatorPosition", "pageIndicatorType", "renderNextButton", "renderPrevButton", "renderViewManager", "stepHintAriaLabel", "steps"];
|
|
31
|
+
var _excluded = ["css", "componentRef", "fullContents", "index", "pageIndicatorPosition", "pageIndicatorType", "renderNextButton", "renderPrevButton", "renderViewManager", "stepHintAriaLabel", "steps", "uniqueId"];
|
|
29
32
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
30
33
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
31
|
-
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; }
|
|
32
|
-
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; }
|
|
33
34
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
34
35
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
36
|
+
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; }
|
|
37
|
+
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; }
|
|
35
38
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
36
39
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
37
|
-
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); }
|
|
40
|
+
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); }
|
|
41
|
+
var isLeft = (0, _keymap.is)('left');
|
|
42
|
+
var isRight = (0, _keymap.is)('right');
|
|
43
|
+
var handlePageChange = function handlePageChange(index, onChange, totalIndex) {
|
|
44
|
+
if (onChange && index !== totalIndex && totalIndex) {
|
|
45
|
+
var nextIndex = index < totalIndex - 1 ? index + 1 : index;
|
|
46
|
+
onChange({
|
|
47
|
+
type: 'onChange',
|
|
48
|
+
index: nextIndex
|
|
49
|
+
});
|
|
50
|
+
} else if (onChange && index !== 0) {
|
|
51
|
+
var prevIndex = index > 0 ? index - 1 : index;
|
|
52
|
+
onChange({
|
|
53
|
+
type: 'onChange',
|
|
54
|
+
index: prevIndex
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var SpottableCell = (0, _Spottable["default"])(_Layout.Cell);
|
|
59
|
+
var SpottableColumn = (0, _SpotlightContainerDecorator["default"])(_Layout.Column);
|
|
60
|
+
|
|
61
|
+
/**
|
|
38
62
|
* A PageViews that has page indicator with corresponding pages.
|
|
39
63
|
*
|
|
40
64
|
* @example
|
|
@@ -62,6 +86,13 @@ var PageViewsBase = (0, _kind["default"])({
|
|
|
62
86
|
* @private
|
|
63
87
|
*/
|
|
64
88
|
arranger: _ViewManager.shape,
|
|
89
|
+
/**
|
|
90
|
+
* When `true`, disables Spotlight outside the container and enables 5-way navigation between panels.
|
|
91
|
+
*
|
|
92
|
+
* @type {Boolean}
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
bannerMode: _propTypes2["default"].bool,
|
|
65
96
|
/**
|
|
66
97
|
* {@link limestone/PageViews.Page|Page} to be rendered.
|
|
67
98
|
*
|
|
@@ -163,7 +194,14 @@ var PageViewsBase = (0, _kind["default"])({
|
|
|
163
194
|
* @type {Number}
|
|
164
195
|
* @private
|
|
165
196
|
*/
|
|
166
|
-
totalIndex: _propTypes2["default"].number
|
|
197
|
+
totalIndex: _propTypes2["default"].number,
|
|
198
|
+
/**
|
|
199
|
+
* A unique identifier for each PageViews component.
|
|
200
|
+
*
|
|
201
|
+
* @type {String}
|
|
202
|
+
* @private
|
|
203
|
+
*/
|
|
204
|
+
uniqueId: _propTypes2["default"].string
|
|
167
205
|
},
|
|
168
206
|
defaultProps: {
|
|
169
207
|
arranger: _Panels.BasicArranger,
|
|
@@ -176,32 +214,62 @@ var PageViewsBase = (0, _kind["default"])({
|
|
|
176
214
|
publicClassNames: true
|
|
177
215
|
},
|
|
178
216
|
handlers: {
|
|
179
|
-
|
|
217
|
+
onKeyDown: (0, _handle["default"])((0, _handle.forProp)('bannerMode', true), function (ev, _ref) {
|
|
180
218
|
var index = _ref.index,
|
|
181
219
|
onChange = _ref.onChange,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
220
|
+
rtl = _ref.rtl,
|
|
221
|
+
totalIndex = _ref.totalIndex,
|
|
222
|
+
uniqueId = _ref.uniqueId;
|
|
223
|
+
_spotlight["default"].set('banner-container' + uniqueId, {
|
|
224
|
+
navigableFilter: function navigableFilter(node) {
|
|
225
|
+
return node.classList.contains(_PageViewsModule["default"].viewManager);
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
if (!rtl && isRight(ev.keyCode) || rtl && isLeft(ev.keyCode)) {
|
|
229
|
+
handlePageChange(index, onChange, totalIndex);
|
|
230
|
+
} else if (!rtl && isLeft(ev.keyCode) || rtl && isRight(ev.keyCode)) {
|
|
231
|
+
handlePageChange(index, onChange);
|
|
189
232
|
}
|
|
190
233
|
}),
|
|
191
|
-
|
|
192
|
-
var
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
onChange({
|
|
197
|
-
type: 'onChange',
|
|
198
|
-
index: prevIndex
|
|
199
|
-
});
|
|
200
|
-
}
|
|
234
|
+
onMouseOver: (0, _handle["default"])((0, _handle.forProp)('bannerMode', true), function (ev, _ref2) {
|
|
235
|
+
var uniqueId = _ref2.uniqueId;
|
|
236
|
+
return _spotlight["default"].set('banner-container' + uniqueId, {
|
|
237
|
+
navigableFilter: null
|
|
238
|
+
});
|
|
201
239
|
}),
|
|
202
|
-
|
|
240
|
+
onNextClick: (0, _handle["default"])((0, _handle.forwardCustomWithPrevent)('onNextClick'), function (ev, _ref3) {
|
|
203
241
|
var index = _ref3.index,
|
|
204
|
-
|
|
242
|
+
onChange = _ref3.onChange,
|
|
243
|
+
totalIndex = _ref3.totalIndex;
|
|
244
|
+
handlePageChange(index, onChange, totalIndex);
|
|
245
|
+
}),
|
|
246
|
+
onPrevClick: (0, _handle["default"])((0, _handle.forwardCustomWithPrevent)('onPrevClick'), function (ev, _ref4) {
|
|
247
|
+
var index = _ref4.index,
|
|
248
|
+
onChange = _ref4.onChange;
|
|
249
|
+
handlePageChange(index, onChange);
|
|
250
|
+
}),
|
|
251
|
+
onPointerOver: (0, _handle["default"])((0, _handle.forProp)('bannerMode', true), function (ev, _ref5) {
|
|
252
|
+
var uniqueId = _ref5.uniqueId;
|
|
253
|
+
return _spotlight["default"].set('banner-container' + uniqueId, {
|
|
254
|
+
navigableFilter: null
|
|
255
|
+
});
|
|
256
|
+
}),
|
|
257
|
+
onStepsClick: (0, _handle["default"])((0, _handle.forProp)('bannerMode', true), (0, _handle.forwardCustomWithPrevent)('onStepsClick'), function (ev, _ref6) {
|
|
258
|
+
var onChange = _ref6.onChange;
|
|
259
|
+
var node = ev.target;
|
|
260
|
+
var index = parseInt(node.getAttribute('data-index'));
|
|
261
|
+
if (node.children.length) return;
|
|
262
|
+
onChange({
|
|
263
|
+
type: 'onChange',
|
|
264
|
+
index: index
|
|
265
|
+
});
|
|
266
|
+
}),
|
|
267
|
+
onTransition: function onTransition(ev, _ref7) {
|
|
268
|
+
var index = _ref7.index,
|
|
269
|
+
_onTransition = _ref7.onTransition,
|
|
270
|
+
uniqueId = _ref7.uniqueId;
|
|
271
|
+
_spotlight["default"].focus('banner-view-manager' + uniqueId);
|
|
272
|
+
_spotlight["default"].resume();
|
|
205
273
|
if (_onTransition) {
|
|
206
274
|
_onTransition({
|
|
207
275
|
type: 'onTransition',
|
|
@@ -209,9 +277,10 @@ var PageViewsBase = (0, _kind["default"])({
|
|
|
209
277
|
});
|
|
210
278
|
}
|
|
211
279
|
},
|
|
212
|
-
onWillTransition: function onWillTransition(ev,
|
|
213
|
-
var index =
|
|
214
|
-
_onWillTransition =
|
|
280
|
+
onWillTransition: function onWillTransition(ev, _ref8) {
|
|
281
|
+
var index = _ref8.index,
|
|
282
|
+
_onWillTransition = _ref8.onWillTransition;
|
|
283
|
+
_spotlight["default"].pause();
|
|
215
284
|
if (_onWillTransition) {
|
|
216
285
|
_onWillTransition({
|
|
217
286
|
type: 'onWillTransition',
|
|
@@ -221,20 +290,20 @@ var PageViewsBase = (0, _kind["default"])({
|
|
|
221
290
|
}
|
|
222
291
|
},
|
|
223
292
|
computed: {
|
|
224
|
-
className: function className(
|
|
225
|
-
var fullContents =
|
|
226
|
-
pageIndicatorPosition =
|
|
227
|
-
pageIndicatorType =
|
|
228
|
-
styler =
|
|
293
|
+
className: function className(_ref9) {
|
|
294
|
+
var fullContents = _ref9.fullContents,
|
|
295
|
+
pageIndicatorPosition = _ref9.pageIndicatorPosition,
|
|
296
|
+
pageIndicatorType = _ref9.pageIndicatorType,
|
|
297
|
+
styler = _ref9.styler;
|
|
229
298
|
return styler.append({
|
|
230
299
|
fullContents: fullContents
|
|
231
300
|
}, "indicator".concat((0, _util.cap)(pageIndicatorPosition)), pageIndicatorType);
|
|
232
301
|
},
|
|
233
|
-
renderNextButton: function renderNextButton(
|
|
234
|
-
var css =
|
|
235
|
-
onNextClick =
|
|
236
|
-
index =
|
|
237
|
-
totalIndex =
|
|
302
|
+
renderNextButton: function renderNextButton(_ref0) {
|
|
303
|
+
var css = _ref0.css,
|
|
304
|
+
onNextClick = _ref0.onNextClick,
|
|
305
|
+
index = _ref0.index,
|
|
306
|
+
totalIndex = _ref0.totalIndex;
|
|
238
307
|
var isNextButtonVisible = index < totalIndex - 1;
|
|
239
308
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
|
|
240
309
|
className: css.navButtonCell,
|
|
@@ -249,10 +318,10 @@ var PageViewsBase = (0, _kind["default"])({
|
|
|
249
318
|
}) : null
|
|
250
319
|
});
|
|
251
320
|
},
|
|
252
|
-
renderPrevButton: function renderPrevButton(
|
|
253
|
-
var css =
|
|
254
|
-
index =
|
|
255
|
-
onPrevClick =
|
|
321
|
+
renderPrevButton: function renderPrevButton(_ref1) {
|
|
322
|
+
var css = _ref1.css,
|
|
323
|
+
index = _ref1.index,
|
|
324
|
+
onPrevClick = _ref1.onPrevClick;
|
|
256
325
|
var isPrevButtonVisible = index !== 0;
|
|
257
326
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
|
|
258
327
|
className: css.navButtonCell,
|
|
@@ -267,16 +336,21 @@ var PageViewsBase = (0, _kind["default"])({
|
|
|
267
336
|
}) : null
|
|
268
337
|
});
|
|
269
338
|
},
|
|
270
|
-
renderViewManager: function renderViewManager(
|
|
271
|
-
var arranger =
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
339
|
+
renderViewManager: function renderViewManager(_ref10) {
|
|
340
|
+
var arranger = _ref10.arranger,
|
|
341
|
+
bannerMode = _ref10.bannerMode,
|
|
342
|
+
css = _ref10.css,
|
|
343
|
+
index = _ref10.index,
|
|
344
|
+
noAnimation = _ref10.noAnimation,
|
|
345
|
+
onTransition = _ref10.onTransition,
|
|
346
|
+
onWillTransition = _ref10.onWillTransition,
|
|
347
|
+
reverseTransition = _ref10.reverseTransition,
|
|
348
|
+
uniqueId = _ref10.uniqueId,
|
|
349
|
+
children = _ref10.children;
|
|
350
|
+
var CellComponent = bannerMode ? SpottableCell : _Layout.Cell;
|
|
351
|
+
var props = {};
|
|
352
|
+
if (bannerMode) props.spotlightId = "banner-view-manager" + uniqueId;
|
|
353
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(CellComponent, _objectSpread(_objectSpread({
|
|
280
354
|
arranger: arranger,
|
|
281
355
|
className: css.viewManager,
|
|
282
356
|
component: _ViewManager["default"],
|
|
@@ -285,28 +359,31 @@ var PageViewsBase = (0, _kind["default"])({
|
|
|
285
359
|
noAnimation: typeof ENACT_PACK_NO_ANIMATION !== 'undefined' && ENACT_PACK_NO_ANIMATION || noAnimation,
|
|
286
360
|
onTransition: onTransition,
|
|
287
361
|
onWillTransition: onWillTransition,
|
|
288
|
-
reverseTransition: reverseTransition
|
|
362
|
+
reverseTransition: reverseTransition
|
|
363
|
+
}, props), {}, {
|
|
289
364
|
children: children
|
|
290
|
-
});
|
|
365
|
+
}));
|
|
291
366
|
},
|
|
292
|
-
stepHintAriaLabel: function stepHintAriaLabel(
|
|
367
|
+
stepHintAriaLabel: function stepHintAriaLabel(_ref11) {
|
|
293
368
|
var _children$index;
|
|
294
|
-
var children =
|
|
295
|
-
index =
|
|
296
|
-
totalIndex =
|
|
369
|
+
var children = _ref11.children,
|
|
370
|
+
index = _ref11.index,
|
|
371
|
+
totalIndex = _ref11.totalIndex;
|
|
297
372
|
var pageHint = new _IString["default"]((0, _$L["default"])('Page {current} out of {total}')).format({
|
|
298
373
|
current: index + 1,
|
|
299
374
|
total: totalIndex
|
|
300
375
|
});
|
|
301
376
|
return "".concat(pageHint, " ").concat((children === null || children === void 0 || (_children$index = children[index]) === null || _children$index === void 0 ? void 0 : _children$index.props['aria-label']) || '');
|
|
302
377
|
},
|
|
303
|
-
steps: function steps(
|
|
304
|
-
var
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
378
|
+
steps: function steps(_ref12) {
|
|
379
|
+
var bannerMode = _ref12.bannerMode,
|
|
380
|
+
css = _ref12.css,
|
|
381
|
+
index = _ref12.index,
|
|
382
|
+
onNextClick = _ref12.onNextClick,
|
|
383
|
+
onPrevClick = _ref12.onPrevClick,
|
|
384
|
+
onStepsClick = _ref12.onStepsClick,
|
|
385
|
+
pageIndicatorType = _ref12.pageIndicatorType,
|
|
386
|
+
totalIndex = _ref12.totalIndex;
|
|
310
387
|
var isPrevButtonVisible = index !== 0;
|
|
311
388
|
var isNextButtonVisible = index < totalIndex - 1;
|
|
312
389
|
var isStepVisible = totalIndex !== 1;
|
|
@@ -317,6 +394,7 @@ var PageViewsBase = (0, _kind["default"])({
|
|
|
317
394
|
css: css,
|
|
318
395
|
current: index + 1,
|
|
319
396
|
highlightCurrentOnly: true,
|
|
397
|
+
onClick: onStepsClick,
|
|
320
398
|
total: totalIndex
|
|
321
399
|
})
|
|
322
400
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Layout.Row, {
|
|
@@ -325,6 +403,7 @@ var PageViewsBase = (0, _kind["default"])({
|
|
|
325
403
|
className: css.navButtonCell,
|
|
326
404
|
shrink: true,
|
|
327
405
|
children: isPrevButtonVisible ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button["default"], {
|
|
406
|
+
spotlightDisabled: bannerMode,
|
|
328
407
|
"aria-label": (0, _$L["default"])('Previous'),
|
|
329
408
|
className: css.navButton,
|
|
330
409
|
icon: "arrowlargeleft",
|
|
@@ -344,6 +423,7 @@ var PageViewsBase = (0, _kind["default"])({
|
|
|
344
423
|
className: css.navButtonCell,
|
|
345
424
|
shrink: true,
|
|
346
425
|
children: isNextButtonVisible ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button["default"], {
|
|
426
|
+
spotlightDisabled: bannerMode,
|
|
347
427
|
"aria-label": (0, _$L["default"])('Next'),
|
|
348
428
|
className: css.navButton,
|
|
349
429
|
icon: "arrowlargeright",
|
|
@@ -356,37 +436,42 @@ var PageViewsBase = (0, _kind["default"])({
|
|
|
356
436
|
});
|
|
357
437
|
}
|
|
358
438
|
},
|
|
359
|
-
render: function render(
|
|
360
|
-
var css =
|
|
361
|
-
componentRef =
|
|
362
|
-
fullContents =
|
|
363
|
-
index =
|
|
364
|
-
pageIndicatorPosition =
|
|
365
|
-
pageIndicatorType =
|
|
366
|
-
renderNextButton =
|
|
367
|
-
renderPrevButton =
|
|
368
|
-
renderViewManager =
|
|
369
|
-
stepHintAriaLabel =
|
|
370
|
-
steps =
|
|
371
|
-
|
|
439
|
+
render: function render(_ref13) {
|
|
440
|
+
var css = _ref13.css,
|
|
441
|
+
componentRef = _ref13.componentRef,
|
|
442
|
+
fullContents = _ref13.fullContents,
|
|
443
|
+
index = _ref13.index,
|
|
444
|
+
pageIndicatorPosition = _ref13.pageIndicatorPosition,
|
|
445
|
+
pageIndicatorType = _ref13.pageIndicatorType,
|
|
446
|
+
renderNextButton = _ref13.renderNextButton,
|
|
447
|
+
renderPrevButton = _ref13.renderPrevButton,
|
|
448
|
+
renderViewManager = _ref13.renderViewManager,
|
|
449
|
+
stepHintAriaLabel = _ref13.stepHintAriaLabel,
|
|
450
|
+
steps = _ref13.steps,
|
|
451
|
+
uniqueId = _ref13.uniqueId,
|
|
452
|
+
rest = _objectWithoutProperties(_ref13, _excluded);
|
|
372
453
|
delete rest.arranger;
|
|
454
|
+
delete rest.bannerMode;
|
|
373
455
|
delete rest.children;
|
|
374
456
|
delete rest.noAnimation;
|
|
375
|
-
delete rest.onTransition;
|
|
376
457
|
delete rest.onNextClick;
|
|
458
|
+
delete rest.onStepsClick;
|
|
377
459
|
delete rest.onPrevClick;
|
|
460
|
+
delete rest.onTransition;
|
|
378
461
|
delete rest.onWillTransition;
|
|
379
462
|
delete rest.reverseTransition;
|
|
463
|
+
delete rest.rtl;
|
|
380
464
|
delete rest.totalIndex;
|
|
381
465
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({
|
|
382
466
|
role: "region",
|
|
383
467
|
"aria-labelledby": "pageViews_index_".concat(index),
|
|
384
468
|
ref: componentRef
|
|
385
469
|
}, rest), {}, {
|
|
386
|
-
children: [!fullContents && pageIndicatorPosition === 'top' ? steps : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
470
|
+
children: [!fullContents && pageIndicatorPosition === 'top' ? steps : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(SpottableColumn, {
|
|
387
471
|
"aria-label": stepHintAriaLabel,
|
|
388
472
|
className: css.contentsArea,
|
|
389
473
|
id: "pageViews_index_".concat(index),
|
|
474
|
+
spotlightId: "banner-container" + uniqueId,
|
|
390
475
|
children: fullContents ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
391
476
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Row, {
|
|
392
477
|
className: css.horizontalLayout,
|
|
@@ -7,6 +7,7 @@ exports.PageViewsRouter = PageViewsRouter;
|
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
9
9
|
var _useChainRefs = _interopRequireDefault(require("@enact/core/useChainRefs"));
|
|
10
|
+
var _spotlight = _interopRequireDefault(require("@enact/spotlight"));
|
|
10
11
|
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
11
12
|
var _react = require("react");
|
|
12
13
|
var _Panels = require("../internal/Panels");
|
|
@@ -53,6 +54,7 @@ function PageViewsRouter(Wrapped) {
|
|
|
53
54
|
onWillTransition = _ref.onWillTransition,
|
|
54
55
|
rtl = _ref.rtl,
|
|
55
56
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
57
|
+
var uniqueId = (0, _react.useId)();
|
|
56
58
|
var totalIndex = _react.Children.count(children);
|
|
57
59
|
var _useToggleRole = (0, _Panels.useToggleRole)(),
|
|
58
60
|
a11yRef = _useToggleRole.ref,
|
|
@@ -74,6 +76,11 @@ function PageViewsRouter(Wrapped) {
|
|
|
74
76
|
focusOnWillTransition(ev);
|
|
75
77
|
a11yOnWillTransition(ev);
|
|
76
78
|
}, [a11yOnWillTransition, focusOnWillTransition]);
|
|
79
|
+
(0, _react.useEffect)(function () {
|
|
80
|
+
return function () {
|
|
81
|
+
_spotlight["default"].resume();
|
|
82
|
+
};
|
|
83
|
+
}, []);
|
|
77
84
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread(_objectSpread(_objectSpread({}, rest), transition), {}, {
|
|
78
85
|
componentRef: ref,
|
|
79
86
|
"data-spotlight-id": spotlightId,
|
|
@@ -81,6 +88,8 @@ function PageViewsRouter(Wrapped) {
|
|
|
81
88
|
totalIndex: totalIndex,
|
|
82
89
|
onWillTransition: handleWillTransition,
|
|
83
90
|
reverseTransition: reverseTransition,
|
|
91
|
+
rtl: rtl,
|
|
92
|
+
uniqueId: uniqueId,
|
|
84
93
|
children: children
|
|
85
94
|
}));
|
|
86
95
|
};
|
|
@@ -189,4 +189,88 @@ describe('PageViews Specs', function () {
|
|
|
189
189
|
expect(actual).toMatchObject(expected);
|
|
190
190
|
});
|
|
191
191
|
}));
|
|
192
|
+
test('should render accept `fullContents` prop', function () {
|
|
193
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsxs)(_.PageViews, {
|
|
194
|
+
fullContents: true,
|
|
195
|
+
pageIndicatorType: "number",
|
|
196
|
+
index: 1,
|
|
197
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Page, {
|
|
198
|
+
children: "I got contents"
|
|
199
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Page, {
|
|
200
|
+
children: "I got contents"
|
|
201
|
+
})]
|
|
202
|
+
}));
|
|
203
|
+
var panel = _react.screen.getByRole('region');
|
|
204
|
+
var expected = 'fullContents';
|
|
205
|
+
expect(panel).toHaveClass(expected);
|
|
206
|
+
});
|
|
207
|
+
test('should navigate on Page Indicator click when `bannerMode` is true', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
208
|
+
var handleChange = jest.fn();
|
|
209
|
+
var handleStepsClick = jest.fn();
|
|
210
|
+
var user = _userEvent["default"].setup();
|
|
211
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsxs)(_.PageViews, {
|
|
212
|
+
bannerMode: true,
|
|
213
|
+
index: 2,
|
|
214
|
+
onChange: handleChange,
|
|
215
|
+
onStepsClick: handleStepsClick,
|
|
216
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Page, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Page, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Page, {})]
|
|
217
|
+
}));
|
|
218
|
+
var indicatorDot = _react.screen.getByRole('list').children[1];
|
|
219
|
+
var expected = {
|
|
220
|
+
type: 'onStepsClick'
|
|
221
|
+
};
|
|
222
|
+
yield user.click(indicatorDot);
|
|
223
|
+
yield (0, _react.waitFor)(function () {
|
|
224
|
+
expect(handleChange).toHaveBeenCalledWith({
|
|
225
|
+
index: 1,
|
|
226
|
+
type: 'onChange'
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
yield (0, _react.waitFor)(function () {
|
|
230
|
+
var actual = handleStepsClick.mock.calls.length && handleStepsClick.mock.calls[0][0];
|
|
231
|
+
expect(actual).toMatchObject(expected);
|
|
232
|
+
});
|
|
233
|
+
}));
|
|
234
|
+
test('should navigate via 5-way left key when `bannerMode` is true', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
235
|
+
var handleChange = jest.fn();
|
|
236
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsxs)(_.PageViews, {
|
|
237
|
+
bannerMode: true,
|
|
238
|
+
index: 1,
|
|
239
|
+
onChange: handleChange,
|
|
240
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Page, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Page, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Page, {})]
|
|
241
|
+
}));
|
|
242
|
+
var pageViews = _react.screen.getByRole('region').children[0];
|
|
243
|
+
yield _react.fireEvent.keyDown(pageViews, {
|
|
244
|
+
which: 37,
|
|
245
|
+
keyCode: 37,
|
|
246
|
+
code: 37
|
|
247
|
+
});
|
|
248
|
+
yield (0, _react.waitFor)(function () {
|
|
249
|
+
expect(handleChange).toHaveBeenCalledWith({
|
|
250
|
+
index: 0,
|
|
251
|
+
type: 'onChange'
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
}));
|
|
255
|
+
test('should navigate via 5-way right key when `bannerMode` is true', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
256
|
+
var handleChange = jest.fn();
|
|
257
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsxs)(_.PageViews, {
|
|
258
|
+
bannerMode: true,
|
|
259
|
+
index: 1,
|
|
260
|
+
onChange: handleChange,
|
|
261
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Page, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Page, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Page, {})]
|
|
262
|
+
}));
|
|
263
|
+
var pageViews = _react.screen.getByRole('region').children[0];
|
|
264
|
+
yield _react.fireEvent.keyDown(pageViews, {
|
|
265
|
+
which: 39,
|
|
266
|
+
keyCode: 39,
|
|
267
|
+
code: 39
|
|
268
|
+
});
|
|
269
|
+
yield (0, _react.waitFor)(function () {
|
|
270
|
+
expect(handleChange).toHaveBeenCalledWith({
|
|
271
|
+
index: 2,
|
|
272
|
+
type: 'onChange'
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
}));
|
|
192
276
|
});
|