@enact/limestone 1.9.3 → 1.10.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/.github/workflows/ci-reusable.yml +2 -2
- package/ActionGuide/ActionGuide.module.css +4 -0
- package/Alert/Alert.d.ts +9 -0
- package/Alert/Alert.js +35 -4
- package/Alert/Alert.module.css +12 -1
- package/Alert/tests/Alert-specs.js +91 -0
- package/BodyText/BodyText.module.css +21 -0
- package/Button/Button.module.css +72 -40
- package/Button/tests/Button-specs.js +26 -0
- package/CHANGELOG.md +74 -0
- package/Card/Card.d.ts +4 -4
- package/Card/Card.js +10 -8
- package/Card/Card.module.css +31 -7
- package/Card/tests/Card-specs.js +39 -5
- package/Checkbox/Checkbox.module.css +4 -0
- package/CheckboxItem/CheckboxItem.js +6 -4
- package/Chips/Chip.js +12 -6
- package/Chips/Chip.module.css +3 -0
- package/Chips/Chips.js +12 -6
- package/Chips/tests/Chip-specs.js +25 -5
- package/Chips/tests/Chips-specs.js +12 -2
- package/ColorPicker/ColorPicker.js +27 -25
- package/ContextualPopupDecorator/ContextualPopupDecorator.js +32 -22
- package/DayPicker/DaySelectorDecorator.js +12 -7
- package/Dropdown/Dropdown.module.css +4 -0
- package/Dropdown/DropdownList.js +74 -53
- package/FlexiblePopupPanels/useNavButtonFocus.js +7 -10
- package/Heading/Heading.d.ts +1 -1
- package/Heading/Heading.js +2 -2
- package/Heading/Heading.module.css +16 -0
- package/Icon/Icon.d.ts +1 -0
- package/Icon/Icon.js +1 -0
- package/Icon/Icon.module.css +12 -0
- package/Icon/IconList.js +2 -0
- package/IconItem/IconItem.module.css +19 -3
- package/IconItem/tests/IconItem-specs.js +30 -1
- package/Image/Image.js +6 -4
- package/ImageItem/ImageItem.module.css +17 -0
- package/Input/Input.js +12 -1
- package/Input/Input.module.css +25 -9
- package/Input/InputField.js +75 -24
- package/Input/InputField.module.css +280 -45
- package/Input/InputFieldDecoratorIcon.js +1 -0
- package/Input/InputFieldSpotlightDecorator.js +53 -8
- package/Input/index.d.ts +105 -93
- package/Input/tests/Input-specs.js +26 -0
- package/Input/tests/InputField-specs.js +149 -3
- package/Input/tests/InputPopup-specs.js +1 -1
- package/Item/Item.module.css +2 -1
- package/KeyGuide/KeyGuide.js +29 -27
- package/KeyGuide/KeyGuide.module.css +10 -0
- package/MediaOverlay/MediaOverlay.module.css +16 -4
- package/MediaOverlay/tests/MediaOverlay-specs.js +29 -0
- package/MediaPlayer/MediaControls.module.css +3 -0
- package/MediaPlayer/Times.module.css +4 -0
- package/MediaPlayer/tests/util-specs.js +4 -1
- package/PageViews/PageViews.js +134 -69
- package/PageViews/PageViews.module.css +7 -0
- package/PageViews/PageViewsRouter.js +91 -42
- package/PageViews/tests/PageViews-specs.js +87 -0
- package/Panels/Header.js +6 -4
- package/Panels/Header.module.css +37 -31
- package/Popup/Popup.js +5 -4
- package/PopupTabLayout/PopupTabLayout.js +11 -9
- package/PopupTabLayout/PopupTabLayout.module.css +18 -0
- package/RadioItem/RadioItem.js +7 -5
- package/RadioItem/RadioItem.module.css +5 -0
- package/Scroller/EditableWrapper.js +19 -15
- package/Scroller/Scroller.js +11 -10
- package/Scroller/Scroller.module.css +10 -0
- package/Scroller/tests/Scroller-specs.js +91 -2
- package/Scroller/useThemeScroller.js +6 -3
- package/Slider/Slider.d.ts +4 -0
- package/Slider/Slider.js +40 -16
- package/Slider/Slider.module.css +150 -3
- package/Slider/SliderBehaviorDecorator.js +16 -14
- package/Slider/tests/Slider-specs.js +51 -0
- package/Slider/utils.js +23 -7
- package/Spinner/Spinner.js +10 -8
- package/Steps/Steps.module.css +3 -0
- package/Switch/Switch.module.css +15 -1
- package/TabLayout/RefocusDecorator.js +14 -12
- package/TabLayout/TabGroup.module.css +1 -1
- package/TabLayout/tests/TabGroup-specs.js +1 -1
- package/ThemeDecorator/AccessibilityDecorator.js +12 -11
- package/ThemeDecorator/I18nFontDecorator.js +6 -4
- package/ThemeDecorator/ThemeDecorator.d.ts +7 -0
- package/ThemeDecorator/ThemeDecorator.js +24 -9
- package/TimePicker/TimePicker.module.css +3 -0
- package/TimePicker/TimePickerBase.js +5 -3
- package/TooltipDecorator/Tooltip.module.css +4 -0
- package/TooltipDecorator/TooltipDecorator.js +12 -7
- package/TooltipDecorator/tests/useTooltip-specs.js +5 -2
- package/VideoPlayer/Feedback.module.css +3 -0
- package/VideoPlayer/FeedbackTooltip.module.css +7 -0
- package/VideoPlayer/MediaTitle.module.css +8 -0
- package/VideoPlayer/VideoPlayer.js +25 -24
- package/VirtualList/VirtualList.js +20 -18
- package/VirtualList/useSpotlight.js +1 -1
- package/fonts/Limestone_Icons.ttf +0 -0
- package/internal/AsyncRenderChildren/AsyncRenderChildren.js +9 -5
- package/internal/AsyncRenderChildren/tests/AsyncRenderChildren-specs.js +4 -1
- package/internal/DateTime/DateTime.module.css +3 -0
- package/internal/DateTime/DateTimeDecorator.js +5 -4
- package/internal/Panels/PanelsRouter.js +35 -29
- package/internal/Panels/useAutoFocus.js +10 -6
- package/internal/Panels/useFocusOnTransition.js +4 -3
- package/internal/Picker/Picker.js +7 -5
- package/internal/Picker/Picker.module.css +22 -0
- package/internal/Picker/SpottablePicker.js +15 -13
- package/internal/SharedStateDecorator/SharedStateDecorator.js +6 -4
- package/package.json +15 -12
- package/styles/colors.less +1 -0
- package/styles/variables.less +118 -26
- package/useScroll/HoverToScroll.js +15 -12
- package/useScroll/Scrollbar.js +14 -10
- package/useScroll/ScrollbarPlaceholder.js +4 -1
- package/useScroll/ScrollbarTrack.js +7 -5
- package/useScroll/useEvent.js +7 -2
- package/useScroll/useScroll.js +10 -2
|
@@ -116,7 +116,8 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
116
116
|
var WrappedWithRef = (0, _WithRef.WithRef)(Wrapped);
|
|
117
117
|
|
|
118
118
|
// eslint-disable-next-line no-shadow
|
|
119
|
-
var
|
|
119
|
+
var _ContextualPopupDecorator = function ContextualPopupDecorator(props) {
|
|
120
|
+
(0, _util.checkPropTypes)(_ContextualPopupDecorator, props);
|
|
120
121
|
var componentProps = (0, _util.setDefaultProps)(props, contextualPopupDecoratorDefaultProps);
|
|
121
122
|
var _useState = (0, _react.useState)(null),
|
|
122
123
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -137,12 +138,15 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
137
138
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
138
139
|
containerPosition = _useState6[0],
|
|
139
140
|
setContainerPosition = _useState6[1];
|
|
140
|
-
var _useState7 = (0, _react.useState)(
|
|
141
|
+
var _useState7 = (0, _react.useState)(componentProps.direction),
|
|
141
142
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
142
143
|
direction = _useState8[0],
|
|
143
144
|
setDirection = _useState8[1];
|
|
145
|
+
var _useState9 = (0, _react.useState)(null),
|
|
146
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
147
|
+
holeBounds = _useState0[0],
|
|
148
|
+
setHoleBounds = _useState0[1];
|
|
144
149
|
var adjustedDirection = (0, _react.useRef)(componentProps.direction);
|
|
145
|
-
var containerId = (0, _react.useRef)(_spotlight["default"].add(componentProps.popupSpotlightId));
|
|
146
150
|
var containerNode = (0, _react.useRef)(null);
|
|
147
151
|
var clientSiblingRef = (0, _react.useRef)(null);
|
|
148
152
|
var overflow = (0, _react.useRef)({});
|
|
@@ -153,6 +157,9 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
153
157
|
var findClientSiblingRef = (0, _react.useRef)(null);
|
|
154
158
|
var keyDownRef = (0, _react.useRef)(null);
|
|
155
159
|
var keyUpRef = (0, _react.useRef)(null);
|
|
160
|
+
var containerId = (0, _react.useMemo)(function () {
|
|
161
|
+
return _spotlight["default"].add(componentProps.popupSpotlightId);
|
|
162
|
+
}, [componentProps.popupSpotlightId]);
|
|
156
163
|
if (componentProps.setApiProvider) {
|
|
157
164
|
componentProps.setApiProvider();
|
|
158
165
|
}
|
|
@@ -172,7 +179,9 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
172
179
|
var generateId = (0, _react.useCallback)(function () {
|
|
173
180
|
return Math.random().toString(36).substring(2, 10);
|
|
174
181
|
}, []);
|
|
175
|
-
var id = (0, _react.
|
|
182
|
+
var id = (0, _react.useMemo)(function () {
|
|
183
|
+
return generateId();
|
|
184
|
+
}, [generateId]);
|
|
176
185
|
var adjustRTL = (0, _react.useCallback)(function (position) {
|
|
177
186
|
var pos = position;
|
|
178
187
|
if (componentProps.rtl) {
|
|
@@ -253,7 +262,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
253
262
|
return containerNode.current && containerNode.current.getBoundingClientRect().width || 0;
|
|
254
263
|
}, []);
|
|
255
264
|
var updateLeaveFor = (0, _react.useCallback)(function (localActivator) {
|
|
256
|
-
_spotlight["default"].set(containerId
|
|
265
|
+
_spotlight["default"].set(containerId, {
|
|
257
266
|
leaveFor: {
|
|
258
267
|
up: localActivator,
|
|
259
268
|
down: localActivator,
|
|
@@ -261,7 +270,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
261
270
|
right: localActivator
|
|
262
271
|
}
|
|
263
272
|
});
|
|
264
|
-
}, []);
|
|
273
|
+
}, [containerId]);
|
|
265
274
|
var getContainerPosition = (0, _react.useCallback)(function (localContainerNode, clientNode) {
|
|
266
275
|
var _distances2 = distances(),
|
|
267
276
|
ARROW_OFFSET = _distances2.ARROW_OFFSET,
|
|
@@ -451,14 +460,14 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
451
460
|
}, []);
|
|
452
461
|
var spotPopupContent = (0, _react.useCallback)(function () {
|
|
453
462
|
var localSpotlightRestrict = componentProps.spotlightRestrict;
|
|
454
|
-
var spottableDescendants = _spotlight["default"].getSpottableDescendants(containerId
|
|
463
|
+
var spottableDescendants = _spotlight["default"].getSpottableDescendants(containerId);
|
|
455
464
|
if (localSpotlightRestrict === 'self-only' && spottableDescendants.length && _spotlight["default"].getCurrent()) {
|
|
456
465
|
_spotlight["default"].getCurrent().blur();
|
|
457
466
|
}
|
|
458
|
-
if (!_spotlight["default"].focus(containerId
|
|
459
|
-
_spotlight["default"].setActiveContainer(containerId
|
|
467
|
+
if (!_spotlight["default"].focus(containerId)) {
|
|
468
|
+
_spotlight["default"].setActiveContainer(containerId);
|
|
460
469
|
}
|
|
461
|
-
}, [componentProps]);
|
|
470
|
+
}, [componentProps, containerId]);
|
|
462
471
|
var handleKeyUp = (0, _react.useCallback)(function () {
|
|
463
472
|
return (0, _handle.handle)((0, _handle.forProp)('open', true), (0, _handle.forKey)('enter'), function () {
|
|
464
473
|
return _spotlight["default"].getCurrent() === activator;
|
|
@@ -495,7 +504,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
495
504
|
var current = _spotlight["default"].getCurrent();
|
|
496
505
|
var localDirection = (0, _spotlight.getDirection)(ev.keyCode);
|
|
497
506
|
if (!localDirection) return;
|
|
498
|
-
var hasSpottables = _spotlight["default"].getSpottableDescendants(containerId
|
|
507
|
+
var hasSpottables = _spotlight["default"].getSpottableDescendants(containerId).length > 0;
|
|
499
508
|
var spotlessSpotlightModal = componentProps.spotlightRestrict === 'self-only' && !hasSpottables;
|
|
500
509
|
var shouldSpotPopup = current === activator && localDirection === PositionToDirection[adjustedDirection.current.split(' ')[0]] && hasSpottables;
|
|
501
510
|
if (shouldSpotPopup || spotlessSpotlightModal) {
|
|
@@ -507,7 +516,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
507
516
|
spotPopupContent();
|
|
508
517
|
}
|
|
509
518
|
}
|
|
510
|
-
}, [activator, componentProps, handleDirectionalKey, spotPopupContent]);
|
|
519
|
+
}, [activator, componentProps, containerId, handleDirectionalKey, spotPopupContent]);
|
|
511
520
|
|
|
512
521
|
// handle key event from contextual popup and closes the popup
|
|
513
522
|
var handleContainerKeyDown = (0, _react.useCallback)(function (ev) {
|
|
@@ -562,7 +571,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
562
571
|
}
|
|
563
572
|
}, [componentProps, handleKeyDown, handleKeyUp]);
|
|
564
573
|
(0, _react.useEffect)(function () {
|
|
565
|
-
var localId = containerId
|
|
574
|
+
var localId = containerId;
|
|
566
575
|
if (componentProps.open) {
|
|
567
576
|
(0, _dispatcher.on)('keydown', keyDownRef.current);
|
|
568
577
|
(0, _dispatcher.on)('keyup', keyUpRef.current);
|
|
@@ -626,7 +635,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
626
635
|
skin = componentProps.skin,
|
|
627
636
|
spotlightRestrict = componentProps.spotlightRestrict,
|
|
628
637
|
rest = _objectWithoutProperties(componentProps, _excluded);
|
|
629
|
-
var idFloatLayer = "".concat(id
|
|
638
|
+
var idFloatLayer = "".concat(id, "_floatLayer");
|
|
630
639
|
var scrimType = rest.scrimType;
|
|
631
640
|
delete rest.scrimType;
|
|
632
641
|
|
|
@@ -641,10 +650,11 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
641
650
|
if (!noSkin) {
|
|
642
651
|
rest.skin = skin;
|
|
643
652
|
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
653
|
+
(0, _react.useEffect)(function () {
|
|
654
|
+
if (clientSiblingRef !== null && clientSiblingRef !== void 0 && clientSiblingRef.current && holepunchScrim) {
|
|
655
|
+
setHoleBounds(clientSiblingRef.current.getBoundingClientRect());
|
|
656
|
+
}
|
|
657
|
+
}, [holepunchScrim]);
|
|
648
658
|
delete rest.direction;
|
|
649
659
|
delete rest.onClose;
|
|
650
660
|
delete rest.onOpen;
|
|
@@ -677,7 +687,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
677
687
|
offset: noArrow ? offset : 'none',
|
|
678
688
|
showArrow: !noArrow,
|
|
679
689
|
skin: skin,
|
|
680
|
-
spotlightId: containerId
|
|
690
|
+
spotlightId: containerId,
|
|
681
691
|
spotlightRestrict: spotlightRestrict,
|
|
682
692
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PopupComponent, _objectSpread({}, popupPropsRef))
|
|
683
693
|
}))]
|
|
@@ -689,8 +699,8 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
689
699
|
}))]
|
|
690
700
|
});
|
|
691
701
|
};
|
|
692
|
-
|
|
693
|
-
|
|
702
|
+
_ContextualPopupDecorator.displayName = 'ContextualPopupDecorator';
|
|
703
|
+
_ContextualPopupDecorator.propTypes = /** @lends limestone/ContextualPopupDecorator.ContextualPopupDecorator.prototype */{
|
|
694
704
|
/**
|
|
695
705
|
* The component rendered within the
|
|
696
706
|
* {@link limestone/ContextualPopupDecorator.ContextualPopup|ContextualPopup}.
|
|
@@ -840,7 +850,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
840
850
|
*/
|
|
841
851
|
spotlightRestrict: _propTypes2["default"].oneOf(['none', 'self-first', 'self-only'])
|
|
842
852
|
};
|
|
843
|
-
return
|
|
853
|
+
return _ContextualPopupDecorator;
|
|
844
854
|
});
|
|
845
855
|
|
|
846
856
|
/**
|
|
@@ -207,13 +207,18 @@ var daySelectorDecoratorDefaultProps = {
|
|
|
207
207
|
* @private
|
|
208
208
|
*/
|
|
209
209
|
var DaySelectorDecorator = exports.DaySelectorDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
210
|
-
var
|
|
211
|
-
var daySelectorDecoratorProps = (0,
|
|
210
|
+
var _DaySelector = function DaySelector(props) {
|
|
211
|
+
var daySelectorDecoratorProps = (0, _react.useMemo)(function () {
|
|
212
|
+
return (0, _util.setDefaultProps)(props, daySelectorDecoratorDefaultProps);
|
|
213
|
+
}, [props]);
|
|
214
|
+
(0, _util.checkPropTypes)(_DaySelector, daySelectorDecoratorProps);
|
|
212
215
|
var dayNameLength = daySelectorDecoratorProps.dayNameLength,
|
|
213
216
|
locale = daySelectorDecoratorProps.locale,
|
|
214
217
|
selected = daySelectorDecoratorProps.selected,
|
|
215
218
|
rest = _objectWithoutProperties(daySelectorDecoratorProps, _excluded);
|
|
216
|
-
var state =
|
|
219
|
+
var state = (0, _react.useMemo)(function () {
|
|
220
|
+
return getLocaleState(dayNameLength, locale);
|
|
221
|
+
}, [dayNameLength, locale]);
|
|
217
222
|
var localSelected = localizeSelected(selected, state);
|
|
218
223
|
var abbreviatedDayNames = orderDays(state.abbreviatedDayNames, state);
|
|
219
224
|
var fullDayNames = orderDays(state.fullDayNames, state);
|
|
@@ -243,8 +248,8 @@ var DaySelectorDecorator = exports.DaySelectorDecorator = (0, _hoc["default"])(f
|
|
|
243
248
|
})
|
|
244
249
|
}));
|
|
245
250
|
};
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
_DaySelector.displayName = 'DaySelectorDecorator';
|
|
252
|
+
_DaySelector.propTypes = /** @lends limestone/DayPicker.DaySelectorDecorator.prototype */{
|
|
248
253
|
/**
|
|
249
254
|
* The "aria-label" for the selector.
|
|
250
255
|
*
|
|
@@ -295,7 +300,7 @@ var DaySelectorDecorator = exports.DaySelectorDecorator = (0, _hoc["default"])(f
|
|
|
295
300
|
*/
|
|
296
301
|
selected: _propTypes["default"].oneOfType([_propTypes["default"].number, _propTypes["default"].arrayOf(_propTypes["default"].number)])
|
|
297
302
|
};
|
|
298
|
-
|
|
299
|
-
return
|
|
303
|
+
_DaySelector.defaultPropValues = daySelectorDecoratorDefaultProps;
|
|
304
|
+
return _DaySelector;
|
|
300
305
|
});
|
|
301
306
|
var _default = exports["default"] = DaySelectorDecorator;
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
padding: 0 var(--primitive-spacing-48);
|
|
51
51
|
margin: 0;
|
|
52
52
|
}
|
|
53
|
+
.dropdown .button.small {
|
|
54
|
+
min-width: unset;
|
|
55
|
+
max-width: unset;
|
|
56
|
+
}
|
|
53
57
|
:global(.spotlight-input-key) .dropdown .button:not([disabled]):global(.spottable):focus.pressed .bg,
|
|
54
58
|
:global(.spotlight-input-mouse) .dropdown .button:not([disabled]):global(.spottable):focus.pressed .bg,
|
|
55
59
|
:global(.spotlight-input-key) .dropdown .button:not([disabled]):global(.spottable):focus:active .bg,
|
package/Dropdown/DropdownList.js
CHANGED
|
@@ -9,6 +9,7 @@ var _handle = require("@enact/core/handle");
|
|
|
9
9
|
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
11
11
|
var _WithRef = require("@enact/core/internal/WithRef");
|
|
12
|
+
var _util = require("@enact/core/util");
|
|
12
13
|
var _spotlight = _interopRequireDefault(require("@enact/spotlight"));
|
|
13
14
|
var _IdProvider = _interopRequireDefault(require("@enact/ui/internal/IdProvider"));
|
|
14
15
|
var _resolution = _interopRequireDefault(require("@enact/ui/resolution"));
|
|
@@ -17,12 +18,12 @@ var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
|
17
18
|
var _compose = _interopRequireDefault(require("ramda/src/compose"));
|
|
18
19
|
var _react = require("react");
|
|
19
20
|
var _$L = _interopRequireDefault(require("../internal/$L"));
|
|
21
|
+
var _util2 = require("../internal/util");
|
|
20
22
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
21
23
|
var _Item = _interopRequireDefault(require("../Item"));
|
|
22
24
|
var _Skinnable = _interopRequireDefault(require("../Skinnable"));
|
|
23
25
|
var _VirtualList = _interopRequireDefault(require("../VirtualList"));
|
|
24
26
|
var _DropdownModule = _interopRequireDefault(require("./Dropdown.module.css"));
|
|
25
|
-
var _util = require("../internal/util");
|
|
26
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
28
|
var _excluded = ["index"],
|
|
28
29
|
_excluded2 = ["key"],
|
|
@@ -34,13 +35,21 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
34
35
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
35
36
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
36
37
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
38
|
+
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; }
|
|
39
|
+
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; }
|
|
37
40
|
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; }
|
|
38
41
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
39
42
|
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; }
|
|
40
43
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
41
44
|
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); }
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
var ReadyState = {
|
|
46
|
+
// Initial state. Scrolling and focusing pending
|
|
47
|
+
INIT: 0,
|
|
48
|
+
// Scroll requested
|
|
49
|
+
SCROLLED: 1,
|
|
50
|
+
// Focus completed or not required
|
|
51
|
+
DONE: 2
|
|
52
|
+
};
|
|
44
53
|
var isSelectedValid = exports.isSelectedValid = function isSelectedValid(_ref) {
|
|
45
54
|
var children = _ref.children,
|
|
46
55
|
selected = _ref.selected;
|
|
@@ -65,6 +74,31 @@ var indexFromKey = function indexFromKey(children, key) {
|
|
|
65
74
|
}
|
|
66
75
|
return index;
|
|
67
76
|
};
|
|
77
|
+
var stateReducer = function stateReducer(prevState, _ref3) {
|
|
78
|
+
var adjustedFocusIndex = _ref3.adjustedFocusIndex,
|
|
79
|
+
props = _ref3.props,
|
|
80
|
+
type = _ref3.type;
|
|
81
|
+
switch (type) {
|
|
82
|
+
case ReadyState.INIT:
|
|
83
|
+
return {
|
|
84
|
+
prevChildren: props.children,
|
|
85
|
+
prevFocused: adjustedFocusIndex,
|
|
86
|
+
prevSelected: props.selected,
|
|
87
|
+
prevSelectedKey: getKey(props),
|
|
88
|
+
ready: ReadyState.INIT
|
|
89
|
+
};
|
|
90
|
+
case ReadyState.SCROLLED:
|
|
91
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
92
|
+
ready: ReadyState.SCROLLED
|
|
93
|
+
});
|
|
94
|
+
case ReadyState.DONE:
|
|
95
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
96
|
+
ready: ReadyState.DONE
|
|
97
|
+
});
|
|
98
|
+
default:
|
|
99
|
+
return prevState;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
68
102
|
var DropdownListBase = exports.DropdownListBase = (0, _kind["default"])({
|
|
69
103
|
name: 'DropdownListBase',
|
|
70
104
|
propTypes: {
|
|
@@ -122,9 +156,9 @@ var DropdownListBase = exports.DropdownListBase = (0, _kind["default"])({
|
|
|
122
156
|
className: 'dropdownList'
|
|
123
157
|
},
|
|
124
158
|
handlers: {
|
|
125
|
-
itemRenderer: function itemRenderer(
|
|
126
|
-
var index =
|
|
127
|
-
rest = _objectWithoutProperties(
|
|
159
|
+
itemRenderer: function itemRenderer(_ref4, props) {
|
|
160
|
+
var index = _ref4.index,
|
|
161
|
+
rest = _objectWithoutProperties(_ref4, _excluded);
|
|
128
162
|
var children = props.children,
|
|
129
163
|
selected = props.selected;
|
|
130
164
|
var isSelected = index === selected;
|
|
@@ -159,16 +193,16 @@ var DropdownListBase = exports.DropdownListBase = (0, _kind["default"])({
|
|
|
159
193
|
}
|
|
160
194
|
},
|
|
161
195
|
computed: {
|
|
162
|
-
className: function className(
|
|
163
|
-
var children =
|
|
164
|
-
styler =
|
|
165
|
-
width =
|
|
196
|
+
className: function className(_ref5) {
|
|
197
|
+
var children = _ref5.children,
|
|
198
|
+
styler = _ref5.styler,
|
|
199
|
+
width = _ref5.width;
|
|
166
200
|
return styler.append(typeof width === 'string' ? width : null, {
|
|
167
201
|
verticalScrollbar: (children === null || children === void 0 ? void 0 : children.length) > 5
|
|
168
202
|
});
|
|
169
203
|
},
|
|
170
|
-
dataSize: function dataSize(
|
|
171
|
-
var children =
|
|
204
|
+
dataSize: function dataSize(_ref6) {
|
|
205
|
+
var children = _ref6.children;
|
|
172
206
|
return children ? children.length : 0;
|
|
173
207
|
},
|
|
174
208
|
// Note: Retaining this in case we need to support different item sizes for large text mode:
|
|
@@ -176,19 +210,19 @@ var DropdownListBase = exports.DropdownListBase = (0, _kind["default"])({
|
|
|
176
210
|
itemSize: function itemSize() {
|
|
177
211
|
return 156;
|
|
178
212
|
},
|
|
179
|
-
maxItems: function maxItems(
|
|
180
|
-
var children =
|
|
213
|
+
maxItems: function maxItems(_ref7) {
|
|
214
|
+
var children = _ref7.children;
|
|
181
215
|
return (children === null || children === void 0 ? void 0 : children.length) > 5;
|
|
182
216
|
}
|
|
183
217
|
},
|
|
184
|
-
render: function render(
|
|
185
|
-
var dataSize =
|
|
186
|
-
id =
|
|
187
|
-
itemSize =
|
|
188
|
-
maxItems =
|
|
189
|
-
scrollTo =
|
|
190
|
-
width =
|
|
191
|
-
rest = _objectWithoutProperties(
|
|
218
|
+
render: function render(_ref8) {
|
|
219
|
+
var dataSize = _ref8.dataSize,
|
|
220
|
+
id = _ref8.id,
|
|
221
|
+
itemSize = _ref8.itemSize,
|
|
222
|
+
maxItems = _ref8.maxItems,
|
|
223
|
+
scrollTo = _ref8.scrollTo,
|
|
224
|
+
width = _ref8.width,
|
|
225
|
+
rest = _objectWithoutProperties(_ref8, _excluded3);
|
|
192
226
|
delete rest.children;
|
|
193
227
|
delete rest.onSelect;
|
|
194
228
|
delete rest.selected;
|
|
@@ -217,30 +251,23 @@ var DropdownListBase = exports.DropdownListBase = (0, _kind["default"])({
|
|
|
217
251
|
});
|
|
218
252
|
}
|
|
219
253
|
});
|
|
220
|
-
var ReadyState = {
|
|
221
|
-
// Initial state. Scrolling and focusing pending
|
|
222
|
-
INIT: 0,
|
|
223
|
-
// Scroll requested
|
|
224
|
-
SCROLLED: 1,
|
|
225
|
-
// Focus completed or not required
|
|
226
|
-
DONE: 2
|
|
227
|
-
};
|
|
228
254
|
var DropdownListSpotlightDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
229
255
|
var WrappedWithRef = (0, _WithRef.WithRef)(Wrapped);
|
|
230
256
|
|
|
231
257
|
// eslint-disable-next-line no-shadow
|
|
232
|
-
var
|
|
258
|
+
var _DropdownListSpotlightDecorator = function DropdownListSpotlightDecorator(props) {
|
|
259
|
+
(0, _util.checkPropTypes)(_DropdownListSpotlightDecorator, props);
|
|
233
260
|
var clientSiblingRef = (0, _react.useRef)(null);
|
|
234
|
-
var
|
|
261
|
+
var _useReducer = (0, _react.useReducer)(stateReducer, {
|
|
235
262
|
prevChildren: props.children,
|
|
236
263
|
prevFocused: null,
|
|
237
264
|
prevSelected: props.selected,
|
|
238
265
|
prevSelectedKey: getKey(props),
|
|
239
266
|
ready: isSelectedValid(props) ? ReadyState.INIT : ReadyState.DONE
|
|
240
267
|
}),
|
|
241
|
-
|
|
242
|
-
state =
|
|
243
|
-
|
|
268
|
+
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
269
|
+
state = _useReducer2[0],
|
|
270
|
+
dispatch = _useReducer2[1];
|
|
244
271
|
var scrollToRef = (0, _react.useRef)(function () {});
|
|
245
272
|
var lastFocusedKey = (0, _react.useRef)(null);
|
|
246
273
|
(0, _react.useEffect)(function () {
|
|
@@ -250,10 +277,8 @@ var DropdownListSpotlightDecorator = (0, _hoc["default"])(function (config, Wrap
|
|
|
250
277
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
251
278
|
|
|
252
279
|
var focusSelected = function focusSelected() {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
ready: ReadyState.DONE
|
|
256
|
-
});
|
|
280
|
+
dispatch({
|
|
281
|
+
type: ReadyState.DONE
|
|
257
282
|
});
|
|
258
283
|
};
|
|
259
284
|
var resetFocus = (0, _react.useCallback)(function (keysDiffer) {
|
|
@@ -264,12 +289,10 @@ var DropdownListSpotlightDecorator = (0, _hoc["default"])(function (config, Wrap
|
|
|
264
289
|
adjustedFocusIndex = targetIndex;
|
|
265
290
|
}
|
|
266
291
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
prevSelectedKey: getKey(props),
|
|
272
|
-
ready: ReadyState.INIT
|
|
292
|
+
dispatch({
|
|
293
|
+
adjustedFocusIndex: adjustedFocusIndex,
|
|
294
|
+
props: props,
|
|
295
|
+
type: ReadyState.INIT
|
|
273
296
|
});
|
|
274
297
|
}, [props]);
|
|
275
298
|
var scrollIntoView = (0, _react.useCallback)(function () {
|
|
@@ -287,10 +310,8 @@ var DropdownListSpotlightDecorator = (0, _hoc["default"])(function (config, Wrap
|
|
|
287
310
|
// @lime-item-small-height * 2 (TODO: large text mode not supported!)
|
|
288
311
|
stickTo: 'start' // offset from the top of the dropdown
|
|
289
312
|
});
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
ready: ReadyState.SCROLLED
|
|
293
|
-
});
|
|
313
|
+
dispatch({
|
|
314
|
+
type: ReadyState.SCROLLED
|
|
294
315
|
});
|
|
295
316
|
}, [props, state.prevFocused]);
|
|
296
317
|
(0, _react.useEffect)(function () {
|
|
@@ -301,7 +322,7 @@ var DropdownListSpotlightDecorator = (0, _hoc["default"])(function (config, Wrap
|
|
|
301
322
|
} else {
|
|
302
323
|
var key = getKey(props);
|
|
303
324
|
var keysDiffer = key && state.prevSelectedKey && key !== state.prevSelectedKey;
|
|
304
|
-
if (keysDiffer || (!key || !state.prevSelectedKey) && state.prevSelected !== props.selected || !(0,
|
|
325
|
+
if (keysDiffer || (!key || !state.prevSelectedKey) && state.prevSelected !== props.selected || !(0, _util2.compareChildren)(state.prevChildren, props.children)) {
|
|
305
326
|
resetFocus(keysDiffer);
|
|
306
327
|
}
|
|
307
328
|
}
|
|
@@ -332,8 +353,8 @@ var DropdownListSpotlightDecorator = (0, _hoc["default"])(function (config, Wrap
|
|
|
332
353
|
scrollTo: setScrollTo
|
|
333
354
|
}));
|
|
334
355
|
};
|
|
335
|
-
|
|
336
|
-
|
|
356
|
+
_DropdownListSpotlightDecorator.displayName = 'DropdownListSpotlightDecorator';
|
|
357
|
+
_DropdownListSpotlightDecorator.propTypes = {
|
|
337
358
|
/*
|
|
338
359
|
* Passed by DropdownBase to resume Spotlight
|
|
339
360
|
*
|
|
@@ -353,7 +374,7 @@ var DropdownListSpotlightDecorator = (0, _hoc["default"])(function (config, Wrap
|
|
|
353
374
|
*/
|
|
354
375
|
selected: _propTypes2["default"].number
|
|
355
376
|
};
|
|
356
|
-
return
|
|
377
|
+
return _DropdownListSpotlightDecorator;
|
|
357
378
|
});
|
|
358
379
|
var DropdownListDecorator = (0, _compose["default"])(DropdownListSpotlightDecorator, (0, _IdProvider["default"])({
|
|
359
380
|
generateProp: null,
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.NavButtonFocusDecorator = void 0;
|
|
7
7
|
exports.useNavButtonFocus = useNavButtonFocus;
|
|
8
|
+
var _util = require("@enact/core/util");
|
|
8
9
|
var _spotlight = _interopRequireDefault(require("@enact/spotlight"));
|
|
9
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
-
var _react = require("react");
|
|
11
11
|
var _FlexiblePopupPanelsModule = _interopRequireDefault(require("./FlexiblePopupPanels.module.css"));
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
var _excluded = ["index"];
|
|
@@ -23,14 +23,11 @@ var prevButtonSelector = ".".concat(_FlexiblePopupPanelsModule["default"].navCel
|
|
|
23
23
|
var nextButtonSelector = ".".concat(_FlexiblePopupPanelsModule["default"].navCellAfter, " .").concat(_FlexiblePopupPanelsModule["default"].navButton);
|
|
24
24
|
function useNavButtonFocus(_ref) {
|
|
25
25
|
var index = _ref.index;
|
|
26
|
+
var prevIndex = (0, _util.usePrevious)(index);
|
|
26
27
|
var autoFocus;
|
|
27
|
-
var _useRef = (0, _react.useRef)({
|
|
28
|
-
index: index
|
|
29
|
-
}),
|
|
30
|
-
ref = _useRef.current;
|
|
31
28
|
|
|
32
29
|
// on index change
|
|
33
|
-
if (index !==
|
|
30
|
+
if (index !== prevIndex) {
|
|
34
31
|
var current = _spotlight["default"].getCurrent();
|
|
35
32
|
// if the currently focused component is a nav button
|
|
36
33
|
if (current && current.classList.contains(_FlexiblePopupPanelsModule["default"].navButton)) {
|
|
@@ -39,7 +36,6 @@ function useNavButtonFocus(_ref) {
|
|
|
39
36
|
// set autoFocus to point to the selector for the appropriate button
|
|
40
37
|
autoFocus = prevButtonFocused ? prevButtonSelector : nextButtonSelector;
|
|
41
38
|
}
|
|
42
|
-
ref.index = index;
|
|
43
39
|
}
|
|
44
40
|
return {
|
|
45
41
|
autoFocus: autoFocus
|
|
@@ -47,9 +43,10 @@ function useNavButtonFocus(_ref) {
|
|
|
47
43
|
}
|
|
48
44
|
var NavButtonFocusDecorator = exports.NavButtonFocusDecorator = function NavButtonFocusDecorator(Wrapped) {
|
|
49
45
|
// eslint-disable-next-line no-shadow
|
|
50
|
-
function NavButtonFocusDecorator(
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
function NavButtonFocusDecorator(props) {
|
|
47
|
+
(0, _util.checkPropTypes)(NavButtonFocusDecorator, props);
|
|
48
|
+
var index = props.index,
|
|
49
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
53
50
|
var nav = useNavButtonFocus({
|
|
54
51
|
index: index
|
|
55
52
|
});
|
package/Heading/Heading.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ corresponding internal elements and states of this component.
|
|
|
36
36
|
* If the `spacing` prop is not set (defaulting to "auto"), these values automatically set
|
|
37
37
|
the spacing to the correlated names.
|
|
38
38
|
*/
|
|
39
|
-
size?: "large" | "medium" | "small" | "tiny";
|
|
39
|
+
size?: "large" | "medium" | "small" | "tiny" | "title" | "subtitle";
|
|
40
40
|
/**
|
|
41
41
|
* The size of the spacing around the Heading.
|
|
42
42
|
*
|
package/Heading/Heading.js
CHANGED
|
@@ -86,11 +86,11 @@ var HeadingBase = exports.HeadingBase = (0, _kind["default"])({
|
|
|
86
86
|
* If the `spacing` prop is not set (defaulting to "auto"), these values automatically set
|
|
87
87
|
* the spacing to the correlated names.
|
|
88
88
|
*
|
|
89
|
-
* @type {('large'|'medium'|'small'|'tiny')}
|
|
89
|
+
* @type {('large'|'medium'|'small'|'tiny'|'title'|'subtitle')}
|
|
90
90
|
* @default 'tiny'
|
|
91
91
|
* @public
|
|
92
92
|
*/
|
|
93
|
-
size: _propTypes["default"].oneOf(['large', 'medium', 'small', 'tiny']),
|
|
93
|
+
size: _propTypes["default"].oneOf(['large', 'medium', 'small', 'tiny', 'title', 'subtitle']),
|
|
94
94
|
/**
|
|
95
95
|
* The size for slotBefore and slotAfter.
|
|
96
96
|
* This size is used for remeasuring marquee metrics for Panels.Header.
|
|
@@ -93,6 +93,10 @@
|
|
|
93
93
|
:global(.enact-locale-vi) .heading.subtitle {
|
|
94
94
|
font-size: 1rem;
|
|
95
95
|
}
|
|
96
|
+
.heading.subtitle:global(.largeText) {
|
|
97
|
+
font-size: 1.375rem;
|
|
98
|
+
line-height: 1.75rem;
|
|
99
|
+
}
|
|
96
100
|
.heading.large {
|
|
97
101
|
font-family: "Limestone";
|
|
98
102
|
font-weight: var(--primitive-font-weight-semibold);
|
|
@@ -136,6 +140,18 @@
|
|
|
136
140
|
margin-bottom: 0;
|
|
137
141
|
min-height: 0;
|
|
138
142
|
}
|
|
143
|
+
.heading:global(.largeText).large {
|
|
144
|
+
font-size: var(--primitive-font-size-86);
|
|
145
|
+
}
|
|
146
|
+
.heading:global(.largeText).medium {
|
|
147
|
+
font-size: var(--primitive-font-size-80);
|
|
148
|
+
}
|
|
149
|
+
.heading:global(.largeText).small {
|
|
150
|
+
font-size: var(--primitive-font-size-66);
|
|
151
|
+
}
|
|
152
|
+
.heading:global(.largeText).tiny {
|
|
153
|
+
font-size: var(--primitive-font-size-58);
|
|
154
|
+
}
|
|
139
155
|
.heading:global(.neutral) {
|
|
140
156
|
color: var(--semantic-color-on-background-main);
|
|
141
157
|
}
|
package/Icon/Icon.d.ts
CHANGED
package/Icon/Icon.js
CHANGED
package/Icon/Icon.module.css
CHANGED
|
@@ -24,6 +24,18 @@
|
|
|
24
24
|
.icon.tiny {
|
|
25
25
|
--icon-size: 1.25rem;
|
|
26
26
|
}
|
|
27
|
+
.icon:global(.largeText).large {
|
|
28
|
+
--icon-size: 2.1rem;
|
|
29
|
+
}
|
|
30
|
+
.icon:global(.largeText).medium {
|
|
31
|
+
--icon-size: 1.95rem;
|
|
32
|
+
}
|
|
33
|
+
.icon:global(.largeText).small {
|
|
34
|
+
--icon-size: 1.8rem;
|
|
35
|
+
}
|
|
36
|
+
.icon:global(.largeText).tiny {
|
|
37
|
+
--icon-size: 1.5rem;
|
|
38
|
+
}
|
|
27
39
|
.icon.dingbat {
|
|
28
40
|
font-family: "LG Icons";
|
|
29
41
|
}
|