@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
package/Card/Card.module.css
CHANGED
|
@@ -103,18 +103,19 @@ Motion Mixins
|
|
|
103
103
|
border-style: solid;
|
|
104
104
|
}
|
|
105
105
|
.card .selectionContainer .selectionIcon {
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
--icon-size: 1rem;
|
|
107
|
+
width: 1.25rem;
|
|
108
|
+
height: 1.25rem;
|
|
108
109
|
border-radius: 50%;
|
|
109
110
|
margin: 0;
|
|
110
|
-
line-height: 1.
|
|
111
|
+
line-height: 1.25rem;
|
|
111
112
|
z-index: 3;
|
|
112
113
|
}
|
|
113
114
|
.card:not(.isCheckIcon) .selectionContainer .selectionIcon {
|
|
114
|
-
--icon-size:
|
|
115
|
-
width:
|
|
116
|
-
height:
|
|
117
|
-
line-height:
|
|
115
|
+
--icon-size: 3rem;
|
|
116
|
+
width: 3.75rem;
|
|
117
|
+
height: 3.75rem;
|
|
118
|
+
line-height: 3.75rem;
|
|
118
119
|
}
|
|
119
120
|
.card .primaryBadge,
|
|
120
121
|
.card .secondaryBadge {
|
|
@@ -342,6 +343,29 @@ Motion Mixins
|
|
|
342
343
|
transform: scale(1.1);
|
|
343
344
|
transition: transform var(--lime-release-motion-duration) var(--lime-release-motion-easing-function);
|
|
344
345
|
}
|
|
346
|
+
.card:global(.largeText) .caption {
|
|
347
|
+
font-size: var(--primitive-font-size-72);
|
|
348
|
+
line-height: 2.08333rem;
|
|
349
|
+
}
|
|
350
|
+
.card:global(.largeText) .label {
|
|
351
|
+
font-size: var(--primitive-font-size-58);
|
|
352
|
+
line-height: 1.45833rem;
|
|
353
|
+
}
|
|
354
|
+
.card:global(.largeText).captionOverlay.splitCaption .label {
|
|
355
|
+
font-size: var(--primitive-font-size-72);
|
|
356
|
+
}
|
|
357
|
+
.card:global(.largeText) .selectionContainer .selectionIcon {
|
|
358
|
+
--icon-size: 3.6rem;
|
|
359
|
+
}
|
|
360
|
+
.card:global(.largeText):is(.isCheckIcon) .selectionContainer .selectionIcon {
|
|
361
|
+
--icon-size: 1.20833rem;
|
|
362
|
+
width: 1.5rem;
|
|
363
|
+
height: 1.5rem;
|
|
364
|
+
line-height: 1.45833rem;
|
|
365
|
+
}
|
|
366
|
+
.card:global(.largeText).vertical:not(.captionOverlay):not(.captionOverlayOnFocus):is(.hasLabel) .image {
|
|
367
|
+
height: calc(var(--card-image-height) - 36px);
|
|
368
|
+
}
|
|
345
369
|
.card:global(.neutral) .selectionContainer {
|
|
346
370
|
border-color: transparent;
|
|
347
371
|
}
|
package/Card/tests/Card-specs.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
require("@testing-library/jest-dom");
|
|
4
4
|
var _react = require("@testing-library/react");
|
|
5
|
-
var _Card = require("../Card");
|
|
5
|
+
var _Card = _interopRequireWildcard(require("../Card"));
|
|
6
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
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); }
|
|
7
8
|
var src = {
|
|
8
9
|
'hd': 'https://placehold.co/200x200/000000/ffffff/png',
|
|
9
10
|
'fhd': 'https://placehold.co/300x300/000000/ffffff/png',
|
|
@@ -46,7 +47,8 @@ describe('Card', function () {
|
|
|
46
47
|
var imageIconSrc = 'imageIconSrc';
|
|
47
48
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.CardBase, {
|
|
48
49
|
imageIconSrc: imageIconSrc,
|
|
49
|
-
orientation: "vertical"
|
|
50
|
+
orientation: "vertical",
|
|
51
|
+
src: src
|
|
50
52
|
}));
|
|
51
53
|
var expected = imageIconSrc;
|
|
52
54
|
var actual = _react.screen.getAllByRole('img')[2].children.item(0);
|
|
@@ -56,7 +58,8 @@ describe('Card', function () {
|
|
|
56
58
|
var imageIconSrc = 'imageIconSrc';
|
|
57
59
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.CardBase, {
|
|
58
60
|
imageIconSrc: imageIconSrc,
|
|
59
|
-
orientation: "horizontal"
|
|
61
|
+
orientation: "horizontal",
|
|
62
|
+
src: src
|
|
60
63
|
}));
|
|
61
64
|
var expected = 2;
|
|
62
65
|
var actual = _react.screen.getAllByRole('img').length;
|
|
@@ -67,7 +70,8 @@ describe('Card', function () {
|
|
|
67
70
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.CardBase, {
|
|
68
71
|
"data-testid": "card",
|
|
69
72
|
fitImage: true,
|
|
70
|
-
imageIconSrc: imageIconSrc
|
|
73
|
+
imageIconSrc: imageIconSrc,
|
|
74
|
+
src: src
|
|
71
75
|
}));
|
|
72
76
|
var expected = 'fitImage';
|
|
73
77
|
var actual = _react.screen.getByTestId('card');
|
|
@@ -75,7 +79,8 @@ describe('Card', function () {
|
|
|
75
79
|
});
|
|
76
80
|
test('should have "Select" voice intent', function () {
|
|
77
81
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.CardBase, {
|
|
78
|
-
"data-testid": "card"
|
|
82
|
+
"data-testid": "card",
|
|
83
|
+
src: src
|
|
79
84
|
}));
|
|
80
85
|
var card = _react.screen.getByTestId('card');
|
|
81
86
|
expect(card).toHaveAttribute('data-webos-voice-intent', 'Select');
|
|
@@ -92,4 +97,33 @@ describe('Card', function () {
|
|
|
92
97
|
var actual = _react.screen.getByText('children');
|
|
93
98
|
expect(actual).not.toHaveAttribute(expected);
|
|
94
99
|
});
|
|
100
|
+
test('should be pressed when selected', function () {
|
|
101
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Card["default"], {
|
|
102
|
+
"data-testid": "card",
|
|
103
|
+
src: src
|
|
104
|
+
}));
|
|
105
|
+
var card = _react.screen.getByTestId('card');
|
|
106
|
+
|
|
107
|
+
// Select by key
|
|
108
|
+
_react.fireEvent.keyDown(card, {
|
|
109
|
+
key: 'Enter',
|
|
110
|
+
code: 'Enter',
|
|
111
|
+
keyCode: 13,
|
|
112
|
+
which: 13
|
|
113
|
+
});
|
|
114
|
+
expect(card).toHaveClass('pressed');
|
|
115
|
+
_react.fireEvent.keyUp(card, {
|
|
116
|
+
key: 'Enter',
|
|
117
|
+
code: 'Enter',
|
|
118
|
+
keyCode: 13,
|
|
119
|
+
which: 13
|
|
120
|
+
});
|
|
121
|
+
expect(card).not.toHaveClass('pressed');
|
|
122
|
+
|
|
123
|
+
// Select by pointer
|
|
124
|
+
_react.fireEvent.mouseDown(card);
|
|
125
|
+
expect(card).toHaveClass('pressed');
|
|
126
|
+
_react.fireEvent.mouseUp(card);
|
|
127
|
+
expect(card).not.toHaveClass('pressed');
|
|
128
|
+
});
|
|
95
129
|
});
|
|
@@ -91,6 +91,10 @@ Motion Mixins
|
|
|
91
91
|
border-radius: var(--semantic-radius-full);
|
|
92
92
|
position: relative;
|
|
93
93
|
text-align: center;
|
|
94
|
+
--icon-size: 1.25rem;
|
|
95
|
+
}
|
|
96
|
+
.checkbox .icon:global(.largeText) {
|
|
97
|
+
--icon-size: 1.5rem;
|
|
94
98
|
}
|
|
95
99
|
.checkbox.selected.checkmark .icon::after {
|
|
96
100
|
content: '';
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.CheckboxItemGroup = exports.CheckboxItemDecorator = exports.CheckboxItemBase = exports.CheckboxItem = void 0;
|
|
7
7
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
8
|
+
var _util = require("@enact/core/util");
|
|
8
9
|
var _Group = _interopRequireDefault(require("@enact/ui/Group"));
|
|
9
10
|
var _Pure = _interopRequireDefault(require("@enact/ui/internal/Pure"));
|
|
10
11
|
var _Slottable = _interopRequireDefault(require("@enact/ui/Slottable"));
|
|
@@ -225,14 +226,11 @@ var CheckboxItem = exports.CheckboxItem = (0, _Pure["default"])(CheckboxItemDeco
|
|
|
225
226
|
* @public
|
|
226
227
|
*/
|
|
227
228
|
var _CheckboxItemGroup = exports.CheckboxItemGroup = function CheckboxItemGroup(props) {
|
|
229
|
+
(0, _util.checkPropTypes)(_CheckboxItemGroup, props);
|
|
228
230
|
var children = props.children,
|
|
229
231
|
groupId = props.groupId,
|
|
230
232
|
itemProps = props.itemProps,
|
|
231
233
|
rest = _objectWithoutProperties(props, _excluded2);
|
|
232
|
-
_CheckboxItemGroup.propTypes = {
|
|
233
|
-
groupId: _propTypes["default"].string,
|
|
234
|
-
itemProps: _propTypes["default"].object
|
|
235
|
-
};
|
|
236
234
|
if (typeof children[0] === 'string') {
|
|
237
235
|
// The case of multiple checkbox items are represented by string array instead of `CheckboxItem` components using `ui/Group`
|
|
238
236
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -272,4 +270,8 @@ var _CheckboxItemGroup = exports.CheckboxItemGroup = function CheckboxItemGroup(
|
|
|
272
270
|
});
|
|
273
271
|
}
|
|
274
272
|
};
|
|
273
|
+
_CheckboxItemGroup.propTypes = {
|
|
274
|
+
groupId: _propTypes["default"].string,
|
|
275
|
+
itemProps: _propTypes["default"].object
|
|
276
|
+
};
|
|
275
277
|
var _default = exports["default"] = CheckboxItem;
|
package/Chips/Chip.js
CHANGED
|
@@ -61,6 +61,7 @@ var ChipDefaultProps = {
|
|
|
61
61
|
* position: 'right'
|
|
62
62
|
* }}
|
|
63
63
|
* icon="check"
|
|
64
|
+
* id="chip"
|
|
64
65
|
* >
|
|
65
66
|
* Label
|
|
66
67
|
* </Chip>
|
|
@@ -71,12 +72,13 @@ var ChipDefaultProps = {
|
|
|
71
72
|
* @ui
|
|
72
73
|
* @public
|
|
73
74
|
*/
|
|
74
|
-
var
|
|
75
|
+
var _ChipBase = exports.ChipBase = function ChipBase(props) {
|
|
75
76
|
var _use = (0, _react.use)(_Chips.ChipsContext),
|
|
76
77
|
handleChipDelete = _use.handleChipDelete,
|
|
77
78
|
getNextTargetFromDeleteButton = _use.getNextTargetFromDeleteButton,
|
|
78
79
|
registerChild = _use.registerChild;
|
|
79
80
|
var chipProps = (0, _util.setDefaultProps)(props, ChipDefaultProps);
|
|
81
|
+
(0, _util.checkPropTypes)(_ChipBase, chipProps);
|
|
80
82
|
var checked = chipProps.checked,
|
|
81
83
|
children = chipProps.children,
|
|
82
84
|
className = chipProps.className,
|
|
@@ -92,11 +94,15 @@ var ChipBase = exports.ChipBase = function ChipBase(props) {
|
|
|
92
94
|
var ariaLabel = children + ' ' + (0, _$L["default"])('Chip') + ' ' + (0, _$L["default"])('button');
|
|
93
95
|
var buttonClassName = (0, _classnames["default"])(_ChipModule["default"].deleteButtonContainer, _ChipModule["default"][(deleteButton === null || deleteButton === void 0 ? void 0 : deleteButton.position) || 'right']);
|
|
94
96
|
var chipClassName = (0, _classnames["default"])(className, deleteButton === null || deleteButton === void 0 ? void 0 : deleteButton.position);
|
|
97
|
+
var chipRef = (0, _react.useRef)(null);
|
|
95
98
|
var containerRef = (0, _react.useRef)(null);
|
|
96
|
-
var clientRef = (0, _react.useRef)(null);
|
|
97
99
|
var deleteButtonRef = (0, _react.useRef)(null);
|
|
98
|
-
var chipRef = clientRef || ref;
|
|
99
100
|
var isHovering = (0, _react.useRef)(false);
|
|
101
|
+
(0, _react.useEffect)(function () {
|
|
102
|
+
if (!chipRef.current) {
|
|
103
|
+
chipRef.current = ref.current;
|
|
104
|
+
}
|
|
105
|
+
}, [ref]);
|
|
100
106
|
(0, _react.useEffect)(function () {
|
|
101
107
|
if (chipRef.current && registerChild) {
|
|
102
108
|
registerChild(chipRef, id);
|
|
@@ -228,8 +234,7 @@ var ChipBase = exports.ChipBase = function ChipBase(props) {
|
|
|
228
234
|
})]
|
|
229
235
|
}));
|
|
230
236
|
};
|
|
231
|
-
|
|
232
|
-
ChipBase.propTypes = /** @lends limestone/Chips.Chip.prototype */{
|
|
237
|
+
_ChipBase.propTypes = /** @lends limestone/Chips.Chip.prototype */{
|
|
233
238
|
/**
|
|
234
239
|
* A label displayed in the chip content.
|
|
235
240
|
*
|
|
@@ -291,6 +296,7 @@ ChipBase.propTypes = /** @lends limestone/Chips.Chip.prototype */{
|
|
|
291
296
|
*/
|
|
292
297
|
isImage: _propTypes["default"].bool
|
|
293
298
|
};
|
|
299
|
+
_ChipBase.displayName = 'Chip';
|
|
294
300
|
|
|
295
301
|
/**
|
|
296
302
|
* Limestone-specific Chip behaviors to apply to {@link limestone/Chips.Chip|Chip}.
|
|
@@ -301,5 +307,5 @@ ChipBase.propTypes = /** @lends limestone/Chips.Chip.prototype */{
|
|
|
301
307
|
* @public
|
|
302
308
|
*/
|
|
303
309
|
var ChipDecorator = exports.ChipDecorator = (0, _compose["default"])(_Skinnable["default"]);
|
|
304
|
-
var Chip = exports.Chip = ChipDecorator(
|
|
310
|
+
var Chip = exports.Chip = ChipDecorator(_ChipBase);
|
|
305
311
|
var _default = exports["default"] = Chip;
|
package/Chips/Chip.module.css
CHANGED
package/Chips/Chips.js
CHANGED
|
@@ -33,6 +33,9 @@ var ChipsContext = exports.ChipsContext = /*#__PURE__*/(0, _react.createContext)
|
|
|
33
33
|
var ChipsDefaultProps = {
|
|
34
34
|
orientation: 'vertical'
|
|
35
35
|
};
|
|
36
|
+
var generateAriaId = function generateAriaId() {
|
|
37
|
+
return Math.random().toString(36).substring(2, 10);
|
|
38
|
+
};
|
|
36
39
|
|
|
37
40
|
/**
|
|
38
41
|
* A container that surrounds the chips.
|
|
@@ -42,7 +45,7 @@ var ChipsDefaultProps = {
|
|
|
42
45
|
* <Chips>
|
|
43
46
|
* {chips.map(({id, icon, children}) => {
|
|
44
47
|
* return (
|
|
45
|
-
* <Chip key={id} icon={icon} onClick={onClick}>
|
|
48
|
+
* <Chip key={id} id={id} icon={icon} onClick={onClick}>
|
|
46
49
|
* {children}
|
|
47
50
|
* </Chip>
|
|
48
51
|
* );
|
|
@@ -55,8 +58,9 @@ var ChipsDefaultProps = {
|
|
|
55
58
|
* @ui
|
|
56
59
|
* @public
|
|
57
60
|
*/
|
|
58
|
-
var
|
|
61
|
+
var _ChipsBase = exports.ChipsBase = function ChipsBase(props) {
|
|
59
62
|
var chipsProps = (0, _util.setDefaultProps)(props, ChipsDefaultProps);
|
|
63
|
+
(0, _util.checkPropTypes)(_ChipsBase, chipsProps);
|
|
60
64
|
var children = chipsProps.children,
|
|
61
65
|
className = chipsProps.className,
|
|
62
66
|
orientation = chipsProps.orientation,
|
|
@@ -67,7 +71,9 @@ var ChipsBase = exports.ChipsBase = function ChipsBase(props) {
|
|
|
67
71
|
var ariaLabel = new _IString["default"]((0, _$L["default"])('{total} items in total')).format({
|
|
68
72
|
total: children === null || children === void 0 ? void 0 : children.length
|
|
69
73
|
});
|
|
70
|
-
var ariaId =
|
|
74
|
+
var ariaId = (0, _react.useMemo)(function () {
|
|
75
|
+
return generateAriaId();
|
|
76
|
+
}, []);
|
|
71
77
|
var getPreviousChip = (0, _react.useCallback)(function (id) {
|
|
72
78
|
var currentIndex = childRefs.current.findIndex(function (child) {
|
|
73
79
|
return child.id === id;
|
|
@@ -176,8 +182,7 @@ var ChipsBase = exports.ChipsBase = function ChipsBase(props) {
|
|
|
176
182
|
}))
|
|
177
183
|
});
|
|
178
184
|
};
|
|
179
|
-
|
|
180
|
-
ChipsBase.propTypes = /** @lends limestone/Chips.Chips.prototype */{
|
|
185
|
+
_ChipsBase.propTypes = /** @lends limestone/Chips.Chips.prototype */{
|
|
181
186
|
/**
|
|
182
187
|
* {@link limestone/Chips.Chip|Chip} to be rendered
|
|
183
188
|
*
|
|
@@ -194,6 +199,7 @@ ChipsBase.propTypes = /** @lends limestone/Chips.Chips.prototype */{
|
|
|
194
199
|
*/
|
|
195
200
|
orientation: _propTypes["default"].oneOf(['horizontal', 'vertical'])
|
|
196
201
|
};
|
|
202
|
+
_ChipsBase.displayName = 'Chips';
|
|
197
203
|
|
|
198
204
|
/**
|
|
199
205
|
* Applies Limestone specific behaviors to {@link limestone/Chips.Chips|Chips} components.
|
|
@@ -225,5 +231,5 @@ var ChipsDecorator = exports.ChipsDecorator = (0, _compose["default"])((0, _Spot
|
|
|
225
231
|
* @ui
|
|
226
232
|
* @public
|
|
227
233
|
*/
|
|
228
|
-
var Chips = exports.Chips = ChipsDecorator(
|
|
234
|
+
var Chips = exports.Chips = ChipsDecorator(_ChipsBase);
|
|
229
235
|
var _default = exports["default"] = Chips;
|
|
@@ -9,7 +9,9 @@ describe('Chip', function () {
|
|
|
9
9
|
var icon = 'star';
|
|
10
10
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
11
11
|
"data-testid": "chip",
|
|
12
|
-
icon: icon
|
|
12
|
+
icon: icon,
|
|
13
|
+
id: "minimal-chip",
|
|
14
|
+
children: "Chip"
|
|
13
15
|
}));
|
|
14
16
|
var expected = 983080; // decimal converted charCode of Unicode 'star' character
|
|
15
17
|
var actual = _react.screen.getByTestId('chip').textContent.codePointAt();
|
|
@@ -19,8 +21,10 @@ describe('Chip', function () {
|
|
|
19
21
|
var svg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MDAiIGhlaWdodD0iNzAwIiB2aWV3Qm94PSIwIDAgNzAwIDcwMCI+PGRlZnM+PHN0eWxlPi5hLC5ie2ZpbGw6I2ZmZjt9LmJ7b3BhY2l0eTowLjg7fTwvc3R5bGU+PC9kZWZzPjxwb2x5Z29uIGNsYXNzPSJhIiBwb2ludHM9IjM0OS45IDUyNy44IDE5OS45IDQyOS44IDE5OS45IDM3NC40IDM1MC4xIDQ3Mi43IDM0OS45IDM0OC41IDE5OS45IDI2MS4xIDE5OS45IDIwOS4zIDM1MCAyOTMuNiAzNTAgMjkzLjYgMzUwLjIgMjkzLjcgMzQ5LjkgMTY5LjMgMTAyLjcgNDguNSAxMDIuNyA0NzIuNiAzNTAuMSA2NTEuNiAzNDkuOSA1MjcuOCIvPjxwb2x5Z29uIGNsYXNzPSJiIiBwb2ludHM9IjM1MC4xIDY1MS42IDU5Ny4zIDQ3Mi44IDU5Ny4zIDM2Ni4zIDM0OS45IDUyNy44IDM1MC4xIDY1MS42Ii8+PHBvbHlnb24gY2xhc3M9ImIiIHBvaW50cz0iMzUwLjEgNDcyLjcgNTIzLjUgMzU5LjMgNTIzLjUgMjQ3LjQgMzQ5LjkgMzQ4LjUgMzUwLjEgNDcyLjciLz48cG9seWdvbiBjbGFzcz0iYiIgcG9pbnRzPSIzNTAgMjkzLjYgMzUwIDI5My42IDM1MC4yIDI5My43IDU5Ny4zIDE1NC44IDU5Ny4zIDQ4LjQgMzQ5LjkgMTY5LjMgMzUwIDI5My42Ii8+PC9zdmc+';
|
|
20
22
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
21
23
|
"data-testid": "chip",
|
|
24
|
+
id: "chip",
|
|
22
25
|
icon: svg,
|
|
23
|
-
isImage: true
|
|
26
|
+
isImage: true,
|
|
27
|
+
children: "Chip"
|
|
24
28
|
}));
|
|
25
29
|
var actual = _react.screen.queryAllByRole('img')[0].firstChild;
|
|
26
30
|
expect(actual).toHaveAttribute('src', svg);
|
|
@@ -28,6 +32,7 @@ describe('Chip', function () {
|
|
|
28
32
|
test('should support `children` prop', function () {
|
|
29
33
|
var children = 'label';
|
|
30
34
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
35
|
+
id: "chip",
|
|
31
36
|
children: children
|
|
32
37
|
}));
|
|
33
38
|
var expected = children;
|
|
@@ -38,9 +43,11 @@ describe('Chip', function () {
|
|
|
38
43
|
var position = 'top';
|
|
39
44
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
40
45
|
"data-testid": "chip",
|
|
46
|
+
id: "chip",
|
|
41
47
|
deleteButton: {
|
|
42
48
|
position: position
|
|
43
|
-
}
|
|
49
|
+
},
|
|
50
|
+
children: "Chip"
|
|
44
51
|
}));
|
|
45
52
|
var chip = _react.screen.getByTestId('chip');
|
|
46
53
|
var deleteButton = chip.querySelector('.deleteButtonContainer');
|
|
@@ -51,9 +58,11 @@ describe('Chip', function () {
|
|
|
51
58
|
var position = 'bottom';
|
|
52
59
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
53
60
|
"data-testid": "chip",
|
|
61
|
+
id: "chip",
|
|
54
62
|
deleteButton: {
|
|
55
63
|
position: position
|
|
56
|
-
}
|
|
64
|
+
},
|
|
65
|
+
children: "Chip"
|
|
57
66
|
}));
|
|
58
67
|
var chip = _react.screen.getByTestId('chip');
|
|
59
68
|
var deleteButton = chip.querySelector('.deleteButtonContainer');
|
|
@@ -64,9 +73,11 @@ describe('Chip', function () {
|
|
|
64
73
|
var position = 'right';
|
|
65
74
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
66
75
|
"data-testid": "chip",
|
|
76
|
+
id: "chip",
|
|
67
77
|
deleteButton: {
|
|
68
78
|
position: position
|
|
69
|
-
}
|
|
79
|
+
},
|
|
80
|
+
children: "Chip"
|
|
70
81
|
}));
|
|
71
82
|
var chip = _react.screen.getByTestId('chip');
|
|
72
83
|
var deleteButton = chip.querySelector('.deleteButtonContainer');
|
|
@@ -76,6 +87,7 @@ describe('Chip', function () {
|
|
|
76
87
|
test('should render without delete button when deleteButton is false', function () {
|
|
77
88
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
78
89
|
"data-testid": "chip",
|
|
90
|
+
id: "chip",
|
|
79
91
|
deleteButton: false,
|
|
80
92
|
children: "Test Chip"
|
|
81
93
|
}));
|
|
@@ -86,6 +98,7 @@ describe('Chip', function () {
|
|
|
86
98
|
test('should render without delete button when deleteButton is undefined', function () {
|
|
87
99
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
88
100
|
"data-testid": "chip",
|
|
101
|
+
id: "chip",
|
|
89
102
|
children: "Test Chip"
|
|
90
103
|
}));
|
|
91
104
|
var chip = _react.screen.getByTestId('chip');
|
|
@@ -95,6 +108,7 @@ describe('Chip', function () {
|
|
|
95
108
|
test('should handle disabled state', function () {
|
|
96
109
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
97
110
|
"data-testid": "chip",
|
|
111
|
+
id: "chip",
|
|
98
112
|
disabled: true,
|
|
99
113
|
children: "Disabled Chip"
|
|
100
114
|
}));
|
|
@@ -104,6 +118,7 @@ describe('Chip', function () {
|
|
|
104
118
|
test('should handle disabled state with delete button', function () {
|
|
105
119
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
106
120
|
"data-testid": "chip",
|
|
121
|
+
id: "chip",
|
|
107
122
|
disabled: true,
|
|
108
123
|
deleteButton: {
|
|
109
124
|
position: 'right'
|
|
@@ -118,6 +133,7 @@ describe('Chip', function () {
|
|
|
118
133
|
test('should use default delete button icon when not specified', function () {
|
|
119
134
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
120
135
|
"data-testid": "chip",
|
|
136
|
+
id: "chip",
|
|
121
137
|
deleteButton: {
|
|
122
138
|
position: 'right'
|
|
123
139
|
},
|
|
@@ -130,6 +146,7 @@ describe('Chip', function () {
|
|
|
130
146
|
test('should use custom delete button icon when specified', function () {
|
|
131
147
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
132
148
|
"data-testid": "chip",
|
|
149
|
+
id: "chip",
|
|
133
150
|
deleteButton: {
|
|
134
151
|
position: 'right',
|
|
135
152
|
icon: 'trash'
|
|
@@ -152,6 +169,7 @@ describe('Chip', function () {
|
|
|
152
169
|
test('should handle onClick events', function () {
|
|
153
170
|
var mockOnClick = jest.fn();
|
|
154
171
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
172
|
+
id: "chip",
|
|
155
173
|
onClick: mockOnClick,
|
|
156
174
|
children: "Clickable Chip"
|
|
157
175
|
}));
|
|
@@ -164,6 +182,7 @@ describe('Chip', function () {
|
|
|
164
182
|
var children = 'Star Chip';
|
|
165
183
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
166
184
|
"data-testid": "chip",
|
|
185
|
+
id: "chip",
|
|
167
186
|
icon: icon,
|
|
168
187
|
children: children
|
|
169
188
|
}));
|
|
@@ -178,6 +197,7 @@ describe('Chip', function () {
|
|
|
178
197
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
179
198
|
className: customClass,
|
|
180
199
|
"data-testid": "chip",
|
|
200
|
+
id: "chip",
|
|
181
201
|
children: "Test Chip"
|
|
182
202
|
}));
|
|
183
203
|
var chipButton = _react.screen.getByRole('checkbox');
|
|
@@ -15,6 +15,7 @@ describe('Chips', function () {
|
|
|
15
15
|
var defaultProps = {
|
|
16
16
|
orientation: 'vertical',
|
|
17
17
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
18
|
+
id: "chip1",
|
|
18
19
|
deleteButton: {
|
|
19
20
|
icon: 'closex',
|
|
20
21
|
position: 'right',
|
|
@@ -22,6 +23,7 @@ describe('Chips', function () {
|
|
|
22
23
|
},
|
|
23
24
|
children: "Chip 1"
|
|
24
25
|
}, "chip1"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
26
|
+
id: "chip2",
|
|
25
27
|
deleteButton: {
|
|
26
28
|
icon: 'closex',
|
|
27
29
|
position: 'right',
|
|
@@ -296,8 +298,16 @@ describe('Chips', function () {
|
|
|
296
298
|
position: 'right',
|
|
297
299
|
onDelete: mockDeleteWithParams
|
|
298
300
|
},
|
|
299
|
-
children: "
|
|
300
|
-
}, "chip1")
|
|
301
|
+
children: "Chip 1"
|
|
302
|
+
}, "chip1"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
303
|
+
id: "chip2",
|
|
304
|
+
deleteButton: {
|
|
305
|
+
icon: 'closex',
|
|
306
|
+
position: 'right',
|
|
307
|
+
onDelete: mockDeleteWithParams
|
|
308
|
+
},
|
|
309
|
+
children: "Chip 2"
|
|
310
|
+
}, "chip2")]
|
|
301
311
|
};
|
|
302
312
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chips.ChipsBase, _objectSpread({}, propsWithParams)));
|
|
303
313
|
var deleteButtons = getAllDeleteButtons();
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.ColorPickerDecorator = exports.ColorPickerBase = exports.ColorPicker = void 0;
|
|
7
7
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
8
|
+
var _util = require("@enact/core/util");
|
|
8
9
|
var _Spottable = _interopRequireDefault(require("@enact/spotlight/Spottable"));
|
|
9
10
|
var _Layout = require("@enact/ui/Layout");
|
|
10
11
|
var _Toggleable = _interopRequireDefault(require("@enact/ui/Toggleable"));
|
|
@@ -63,11 +64,12 @@ var SpottableButton = (0, _Spottable["default"])(_Button.ButtonBase);
|
|
|
63
64
|
* @ui
|
|
64
65
|
* @private
|
|
65
66
|
*/
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
var _PopupContent = function PopupContent(props) {
|
|
68
|
+
(0, _util.checkPropTypes)(_PopupContent, props);
|
|
69
|
+
var color = props.color,
|
|
70
|
+
colorHandler = props.colorHandler,
|
|
71
|
+
css = props.css,
|
|
72
|
+
presetColors = props.presetColors;
|
|
71
73
|
var _useState = (0, _react.useState)(0),
|
|
72
74
|
_useState2 = _slicedToArray(_useState, 2),
|
|
73
75
|
hue = _useState2[0],
|
|
@@ -173,7 +175,7 @@ var PopupContent = function PopupContent(_ref) {
|
|
|
173
175
|
})]
|
|
174
176
|
});
|
|
175
177
|
};
|
|
176
|
-
|
|
178
|
+
_PopupContent.propTypes = {
|
|
177
179
|
/**
|
|
178
180
|
* Indicates the color.
|
|
179
181
|
*
|
|
@@ -295,13 +297,13 @@ var ColorPickerBase = exports.ColorPickerBase = (0, _kind["default"])({
|
|
|
295
297
|
text: _propTypes["default"].string
|
|
296
298
|
},
|
|
297
299
|
handlers: {
|
|
298
|
-
handleClosePopup: function handleClosePopup(ev,
|
|
299
|
-
var onTogglePopup =
|
|
300
|
+
handleClosePopup: function handleClosePopup(ev, _ref) {
|
|
301
|
+
var onTogglePopup = _ref.onTogglePopup;
|
|
300
302
|
onTogglePopup();
|
|
301
303
|
},
|
|
302
|
-
handleOpenPopup: function handleOpenPopup(ev,
|
|
303
|
-
var disabled =
|
|
304
|
-
onTogglePopup =
|
|
304
|
+
handleOpenPopup: function handleOpenPopup(ev, _ref2) {
|
|
305
|
+
var disabled = _ref2.disabled,
|
|
306
|
+
onTogglePopup = _ref2.onTogglePopup;
|
|
305
307
|
if (!disabled) {
|
|
306
308
|
onTogglePopup();
|
|
307
309
|
}
|
|
@@ -311,19 +313,19 @@ var ColorPickerBase = exports.ColorPickerBase = (0, _kind["default"])({
|
|
|
311
313
|
css: _ColorPickerModule["default"],
|
|
312
314
|
publicClassNames: true
|
|
313
315
|
},
|
|
314
|
-
render: function render(
|
|
315
|
-
var color =
|
|
316
|
-
colorHandler =
|
|
317
|
-
css =
|
|
318
|
-
|
|
319
|
-
disabled =
|
|
320
|
-
handleClosePopup =
|
|
321
|
-
handleOpenPopup =
|
|
322
|
-
|
|
323
|
-
popupOpen =
|
|
324
|
-
presetColors =
|
|
325
|
-
text =
|
|
326
|
-
rest = _objectWithoutProperties(
|
|
316
|
+
render: function render(_ref3) {
|
|
317
|
+
var color = _ref3.color,
|
|
318
|
+
colorHandler = _ref3.colorHandler,
|
|
319
|
+
css = _ref3.css,
|
|
320
|
+
_ref3$disabled = _ref3.disabled,
|
|
321
|
+
disabled = _ref3$disabled === void 0 ? false : _ref3$disabled,
|
|
322
|
+
handleClosePopup = _ref3.handleClosePopup,
|
|
323
|
+
handleOpenPopup = _ref3.handleOpenPopup,
|
|
324
|
+
_ref3$popupOpen = _ref3.popupOpen,
|
|
325
|
+
popupOpen = _ref3$popupOpen === void 0 ? false : _ref3$popupOpen,
|
|
326
|
+
presetColors = _ref3.presetColors,
|
|
327
|
+
text = _ref3.text,
|
|
328
|
+
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
327
329
|
delete rest.onTogglePopup;
|
|
328
330
|
var CloseIcon = (0, _react.useCallback)(function (props) {
|
|
329
331
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon["default"], _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -377,7 +379,7 @@ var ColorPickerBase = exports.ColorPickerBase = (0, _kind["default"])({
|
|
|
377
379
|
size: "small"
|
|
378
380
|
})
|
|
379
381
|
})]
|
|
380
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
382
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PopupContent, {
|
|
381
383
|
color: color,
|
|
382
384
|
colorHandler: colorHandler,
|
|
383
385
|
css: css,
|