@enact/limestone 1.10.0 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/PULL_REQUEST_TEMPLATE.md +1 -0
- package/ActionGuide/ActionGuide.d.ts +1 -1
- package/ActionGuide/ActionGuide.module.css +7 -0
- package/Alert/Alert.d.ts +9 -0
- package/Alert/Alert.js +63 -21
- package/Alert/Alert.module.css +41 -9
- package/Alert/AlertImage.module.css +5 -1
- package/Alert/tests/Alert-specs.js +6 -2
- package/BodyText/BodyText.d.ts +1 -1
- package/BodyText/BodyText.js +14 -9
- package/BodyText/BodyText.module.css +22 -1
- package/Button/Button.d.ts +3 -3
- package/Button/Button.module.css +81 -63
- package/CHANGELOG.md +87 -0
- package/Card/Card.d.ts +81 -9
- package/Card/Card.js +324 -84
- package/Card/Card.module.css +200 -25
- package/Card/tests/Card-specs.js +100 -0
- package/Checkbox/Checkbox.d.ts +2 -2
- package/Checkbox/Checkbox.module.css +2 -5
- package/CheckboxItem/CheckboxItem.d.ts +8 -1
- package/CheckboxItem/CheckboxItem.js +39 -12
- package/CheckboxItem/CheckboxItem.module.css +228 -4
- package/Chips/Chip.module.css +5 -2
- package/ContextualMenuDecorator/ContextualMenuDecorator.d.ts +2 -2
- package/ContextualPopupDecorator/ContextualPopup.module.css +1 -1
- package/ContextualPopupDecorator/ContextualPopupDecorator.js +2 -4
- package/ContextualPopupDecorator/tests/ContextualPopupDecorator-specs.js +39 -2
- package/Dropdown/Dropdown.d.ts +2 -2
- package/Dropdown/Dropdown.module.css +7 -7
- package/FixedPopupPanels/FixedPopupPanels.d.ts +2 -2
- package/FlexiblePopupPanels/FlexiblePopupPanels.module.css +15 -3
- package/FlexiblePopupPanels/index.d.ts +2 -2
- package/FormCheckboxItem/FormCheckboxItem.d.ts +1 -1
- package/FormCheckboxItem/FormCheckboxItem.js +1 -0
- package/FormCheckboxItem/FormCheckboxItem.module.css +1 -1
- package/Heading/Heading.d.ts +2 -2
- package/Heading/Heading.module.css +16 -0
- package/Icon/Icon.d.ts +22 -1
- package/Icon/Icon.js +21 -0
- package/Icon/Icon.module.css +12 -0
- package/Icon/IconList.js +43 -1
- package/IconItem/IconItem.d.ts +2 -2
- package/IconItem/IconItem.module.css +27 -14
- package/Image/Image.d.ts +1 -1
- package/Image/Image.module.css +1 -1
- package/ImageItem/ImageItem.d.ts +2 -2
- package/ImageItem/ImageItem.js +3 -16
- package/ImageItem/ImageItem.module.css +122 -97
- package/ImageItem/tests/ImageItem-specs.js +6 -5
- package/Input/Input.module.css +33 -16
- package/Input/InputField.module.css +22 -4
- package/Input/index.d.ts +1 -1
- package/Input/tests/Input-specs.js +2 -2
- package/Input/tests/InputField-specs.js +1 -1
- package/Item/Item.d.ts +2 -2
- package/Item/Item.module.css +29 -16
- package/KeyGuide/KeyGuide.d.ts +2 -2
- package/KeyGuide/KeyGuide.module.css +10 -0
- package/MediaOverlay/MediaOverlay.d.ts +2 -2
- package/MediaOverlay/MediaOverlay.module.css +18 -9
- package/MediaPlayer/MediaControls.module.css +3 -0
- package/MediaPlayer/MediaSlider.module.css +1 -0
- package/MediaPlayer/Times.module.css +5 -1
- package/MediaPlayer/index.d.ts +2 -2
- package/PageViews/PageViews.module.css +6 -1
- package/Panels/Header.module.css +74 -56
- package/Panels/Panel.module.css +1 -1
- package/Panels/index.d.ts +1 -1
- package/Picker/Picker.d.ts +1 -1
- package/Popup/Popup.module.css +4 -1
- package/PopupTabLayout/PopupTabLayout.d.ts +6 -6
- package/PopupTabLayout/PopupTabLayout.module.css +24 -6
- package/ProgressBar/ProgressBar.d.ts +1 -1
- package/ProgressBar/ProgressBar.module.css +12 -12
- package/ProgressBar/ProgressBarTooltip.module.css +7 -7
- package/ProgressButton/ProgressButton.d.ts +2 -2
- package/QuickGuidePanels/QuickGuidePanels.module.css +1 -1
- package/RadioItem/RadioItem.d.ts +1 -1
- package/RadioItem/RadioItem.module.css +21 -18
- package/Scroller/EditableWrapper.js +2 -1
- package/Scroller/Scroller.d.ts +12 -0
- package/Scroller/Scroller.js +15 -0
- package/Scroller/Scroller.module.css +10 -0
- package/Scroller/tests/Scroller-specs.js +120 -2
- package/Scroller/useThemeScroller.js +25 -2
- package/Slider/Slider.d.ts +1 -1
- package/Slider/Slider.module.css +539 -303
- package/Spinner/Spinner.d.ts +1 -1
- package/Spinner/Spinner.module.css +2 -2
- package/Steps/Steps.d.ts +1 -1
- package/Steps/Steps.js +12 -6
- package/Steps/Steps.module.css +19 -2
- package/Switch/Switch.module.css +17 -6
- package/SwitchItem/SwitchItem.d.ts +1 -1
- package/TabLayout/RefocusDecorator.js +1 -1
- package/TabLayout/TabGroup.module.css +13 -7
- package/TabLayout/TabLayout.js +4 -0
- package/ThemeDecorator/ThemeDecorator.d.ts +1 -1
- package/ThemeDecorator/ThemeDecorator.module.css +22 -1
- package/TimePicker/TimePicker.module.css +3 -0
- package/TooltipDecorator/Tooltip.js +68 -7
- package/TooltipDecorator/Tooltip.module.css +44 -23
- package/TooltipDecorator/TooltipDecorator.d.ts +52 -0
- package/TooltipDecorator/TooltipDecorator.js +42 -0
- package/TooltipDecorator/TooltipLabel.js +67 -14
- package/TooltipDecorator/tests/TooltipDecorator-specs.js +46 -0
- package/TooltipDecorator/useTooltip.js +14 -2
- package/VideoPlayer/Feedback.module.css +3 -0
- package/VideoPlayer/FeedbackTooltip.module.css +7 -0
- package/VideoPlayer/MediaTitle.module.css +9 -1
- package/VirtualList/VirtualList.d.ts +24 -0
- package/VirtualList/VirtualList.js +30 -0
- package/VirtualList/tests/stickTo-specs.js +115 -0
- package/VirtualList/tests/useEvent-specs.js +39 -0
- package/VirtualList/useEvent.js +45 -10
- package/VirtualList/useThemeVirtualList.js +20 -2
- package/WizardPanels/WizardPanels.module.css +1 -1
- package/fonts/Limestone_Icons.ttf +0 -0
- package/internal/DateComponentPicker/DateComponentPicker.module.css +3 -3
- package/internal/DateTime/DateTime.module.css +3 -0
- package/internal/Picker/Picker.js +8 -10
- package/internal/Picker/Picker.module.css +92 -137
- package/package.json +14 -17
- package/styles/color-mixins.less +4 -60
- package/styles/colors-game.less +5 -5
- package/styles/colors.less +9 -10
- package/styles/mixins.less +0 -46
- package/styles/motion-mixins.less +16 -7
- package/styles/motions.less +2 -2
- package/styles/variables.less +186 -69
- package/useScroll/ScrollbarPlaceholder.js +8 -3
- package/useScroll/useScroll.js +3 -1
package/Card/Card.js
CHANGED
|
@@ -11,6 +11,7 @@ var _Card = require("@enact/ui/Card");
|
|
|
11
11
|
var _Layout = require("@enact/ui/Layout");
|
|
12
12
|
var _Touchable = _interopRequireDefault(require("@enact/ui/Touchable"));
|
|
13
13
|
var _resolution = _interopRequireDefault(require("@enact/ui/resolution"));
|
|
14
|
+
var _react = require("react");
|
|
14
15
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
16
|
var _compose = _interopRequireDefault(require("ramda/src/compose"));
|
|
16
17
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
@@ -22,7 +23,7 @@ var _ProgressBar = _interopRequireDefault(require("../ProgressBar"));
|
|
|
22
23
|
var _Skinnable = _interopRequireDefault(require("../Skinnable"));
|
|
23
24
|
var _CardModule = _interopRequireDefault(require("./Card.module.css"));
|
|
24
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
-
var _excluded = ["css", "disabled", "icon", "imageSize", "
|
|
26
|
+
var _excluded = ["captionImageSize", "css", "disabled", "icon", "imageSize", "primaryBadge", "primaryBadgeSize", "secondaryBadge", "secondaryBadgeSize", "showDuration", "duration", "progress", "showProgressBar", "style"];
|
|
26
27
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
27
28
|
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; }
|
|
28
29
|
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; }
|
|
@@ -46,6 +47,62 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
46
47
|
* @exports CardBase
|
|
47
48
|
* @exports CardDecorator
|
|
48
49
|
*/
|
|
50
|
+
var formatDuration = function formatDuration(duration) {
|
|
51
|
+
if (!duration || duration < 0) return '00:00';
|
|
52
|
+
var hours = Math.floor(duration / 3600);
|
|
53
|
+
var minutes = Math.floor(duration % 3600 / 60);
|
|
54
|
+
var seconds = duration % 60;
|
|
55
|
+
var mm = String(minutes).padStart(2, '0');
|
|
56
|
+
var ss = String(seconds).padStart(2, '0');
|
|
57
|
+
if (hours > 0) {
|
|
58
|
+
var hh = String(hours).padStart(2, '0');
|
|
59
|
+
return "".concat(hh, ":").concat(mm, ":").concat(ss);
|
|
60
|
+
}
|
|
61
|
+
return "".concat(mm, ":").concat(ss);
|
|
62
|
+
};
|
|
63
|
+
var getBadge = function getBadge(badge, size, className) {
|
|
64
|
+
var element = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
65
|
+
children: badge
|
|
66
|
+
});
|
|
67
|
+
var elementSize = {};
|
|
68
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(badge)) element = badge;
|
|
69
|
+
if (size) {
|
|
70
|
+
elementSize = typeof size === 'object' ? {
|
|
71
|
+
width: _resolution["default"].scaleToRem(size.width),
|
|
72
|
+
height: _resolution["default"].scaleToRem(size.height)
|
|
73
|
+
} : {
|
|
74
|
+
fontSize: _resolution["default"].scaleToRem(size)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return /*#__PURE__*/(0, _react.cloneElement)(element, {
|
|
78
|
+
className: className,
|
|
79
|
+
style: _objectSpread({}, elementSize)
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
var getImageIcons = function getImageIcons(images, key, className) {
|
|
83
|
+
if (!images) return null;
|
|
84
|
+
var getCellElement = function getCellElement(src) {
|
|
85
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
|
|
86
|
+
className: className,
|
|
87
|
+
component: _Image["default"],
|
|
88
|
+
shrink: true,
|
|
89
|
+
src: src
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
if (Array.isArray(images)) {
|
|
93
|
+
return images.map(function (src, idx) {
|
|
94
|
+
return /*#__PURE__*/(0, _react.cloneElement)(getCellElement(src), {
|
|
95
|
+
key: "".concat(key).concat(idx)
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(images)) {
|
|
100
|
+
return /*#__PURE__*/(0, _react.cloneElement)(images, {
|
|
101
|
+
className: className
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return getCellElement(images);
|
|
105
|
+
};
|
|
49
106
|
var getDefaultImageSize = function getDefaultImageSize(orientation) {
|
|
50
107
|
var sizes = {
|
|
51
108
|
vertical: {
|
|
@@ -59,6 +116,17 @@ var getDefaultImageSize = function getDefaultImageSize(orientation) {
|
|
|
59
116
|
};
|
|
60
117
|
return sizes[orientation];
|
|
61
118
|
};
|
|
119
|
+
var getLabelIcons = function getLabelIcons(icons, key, className) {
|
|
120
|
+
if (!icons) return null;
|
|
121
|
+
return icons.map(function (labelIcon, index) {
|
|
122
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
|
|
123
|
+
shrink: true,
|
|
124
|
+
children: /*#__PURE__*/(0, _react.cloneElement)(labelIcon, {
|
|
125
|
+
className: className
|
|
126
|
+
})
|
|
127
|
+
}, "".concat(key).concat(index));
|
|
128
|
+
}) || null;
|
|
129
|
+
};
|
|
62
130
|
|
|
63
131
|
/**
|
|
64
132
|
* A Limestone styled base component for {@link limestone/Card.Card|Card}.
|
|
@@ -89,6 +157,47 @@ var CardBase = exports.CardBase = (0, _kind["default"])({
|
|
|
89
157
|
* @public
|
|
90
158
|
*/
|
|
91
159
|
'aria-label': _propTypes["default"].string,
|
|
160
|
+
/**
|
|
161
|
+
* Sources for the image icon.
|
|
162
|
+
*
|
|
163
|
+
* An array of String values or Objects of values used to determine which image will appear on
|
|
164
|
+
* a specific screenSize. This prop is only used when `orientation` is `'vertical'`.
|
|
165
|
+
*
|
|
166
|
+
* @type {String[]|Object[]}
|
|
167
|
+
* @public
|
|
168
|
+
*/
|
|
169
|
+
captionImageIconsSrc: _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object])),
|
|
170
|
+
/**
|
|
171
|
+
* The size of the caption images.
|
|
172
|
+
*
|
|
173
|
+
* The following properties should be provided:
|
|
174
|
+
* * `height` - The height of the image
|
|
175
|
+
* * `width` - The width of the image
|
|
176
|
+
*
|
|
177
|
+
* @type {Object}
|
|
178
|
+
* @default {height: 96, width: 96}
|
|
179
|
+
* @public
|
|
180
|
+
*/
|
|
181
|
+
captionImageSize: _propTypes["default"].shape({
|
|
182
|
+
height: _propTypes["default"].number,
|
|
183
|
+
width: _propTypes["default"].number
|
|
184
|
+
}),
|
|
185
|
+
/**
|
|
186
|
+
* Determines whether the caption will overflow the card container or not.
|
|
187
|
+
* It only applies when `orientation` is `'vertical'` and `captionOverlay` and `captionOverlayOnFocus` is `false`.
|
|
188
|
+
*
|
|
189
|
+
* @type {Boolean}
|
|
190
|
+
* @public
|
|
191
|
+
*/
|
|
192
|
+
captionOverflow: _propTypes["default"].bool,
|
|
193
|
+
/**
|
|
194
|
+
* Determines whether the caption will overflow the card container and show only on card focus.
|
|
195
|
+
* It only applies when `orientation` is `'vertical'` and `captionOverlay` and `captionOverlayOnFocus` is `false`.
|
|
196
|
+
*
|
|
197
|
+
* @type {Boolean}
|
|
198
|
+
* @public
|
|
199
|
+
*/
|
|
200
|
+
captionOverflowOnFocus: _propTypes["default"].bool,
|
|
92
201
|
/**
|
|
93
202
|
* Determines whether the caption will be placed over the image or not.
|
|
94
203
|
* It only applies when `orientation` is `'vertical'`.
|
|
@@ -112,6 +221,14 @@ var CardBase = exports.CardBase = (0, _kind["default"])({
|
|
|
112
221
|
* @public
|
|
113
222
|
*/
|
|
114
223
|
centered: _propTypes["default"].bool,
|
|
224
|
+
/**
|
|
225
|
+
* Centers the title and `imageIconSrc` horizontally and vertically.
|
|
226
|
+
* It only applies when `captionOverlay` or `captionOverlayOnFocus` is `true`.
|
|
227
|
+
*
|
|
228
|
+
* @type {Boolean}
|
|
229
|
+
* @public
|
|
230
|
+
*/
|
|
231
|
+
centeredTitle: _propTypes["default"].bool,
|
|
115
232
|
/**
|
|
116
233
|
* The primary caption displayed with the image.
|
|
117
234
|
*
|
|
@@ -141,6 +258,20 @@ var CardBase = exports.CardBase = (0, _kind["default"])({
|
|
|
141
258
|
* @public
|
|
142
259
|
*/
|
|
143
260
|
disabled: _propTypes["default"].bool,
|
|
261
|
+
/**
|
|
262
|
+
* Media's entire duration in seconds.
|
|
263
|
+
*
|
|
264
|
+
* @type {Number}
|
|
265
|
+
* @public
|
|
266
|
+
*/
|
|
267
|
+
duration: _propTypes["default"].number,
|
|
268
|
+
/**
|
|
269
|
+
* Determines whether the `Duration` will be placed over the image or not.
|
|
270
|
+
*
|
|
271
|
+
* @type {Boolean}
|
|
272
|
+
* @public
|
|
273
|
+
*/
|
|
274
|
+
durationOverlay: _propTypes["default"].bool,
|
|
144
275
|
/**
|
|
145
276
|
* Fits the image to its height and width and positions it on the center of the Card.
|
|
146
277
|
*
|
|
@@ -167,20 +298,21 @@ var CardBase = exports.CardBase = (0, _kind["default"])({
|
|
|
167
298
|
/**
|
|
168
299
|
* Source for the image icon.
|
|
169
300
|
*
|
|
170
|
-
* String value or Object of values used to determine which image will appear on
|
|
171
|
-
* a specific screenSize. This prop is only used when `orientation` is `'vertical'`.
|
|
301
|
+
* String value or element or Object of values used to determine which image will appear on
|
|
302
|
+
* a specific screenSize. This prop is only used when `orientation` is `'vertical'` or `centeredTitle` is `true`.
|
|
172
303
|
*
|
|
173
|
-
* @type {String|Object}
|
|
304
|
+
* @type {String|Object|Element}
|
|
174
305
|
* @public
|
|
175
306
|
*/
|
|
176
|
-
imageIconSrc: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object]),
|
|
307
|
+
imageIconSrc: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object, _propTypes["default"].element]),
|
|
177
308
|
/**
|
|
178
309
|
* The size of the image.
|
|
179
310
|
*
|
|
180
311
|
* The following properties should be provided:
|
|
181
312
|
* * `height` - The height of the image
|
|
182
313
|
* * `width` - The width of the image
|
|
183
|
-
|
|
314
|
+
*
|
|
315
|
+
* @type {Object}
|
|
184
316
|
* @default {height: 432, width: 768}
|
|
185
317
|
* @public
|
|
186
318
|
*/
|
|
@@ -195,6 +327,15 @@ var CardBase = exports.CardBase = (0, _kind["default"])({
|
|
|
195
327
|
* @public
|
|
196
328
|
*/
|
|
197
329
|
label: _propTypes["default"].string,
|
|
330
|
+
/**
|
|
331
|
+
* Icons to be included with the secondary caption.
|
|
332
|
+
*
|
|
333
|
+
* Typically, up to 3 icons are used.
|
|
334
|
+
*
|
|
335
|
+
* @type {Element|Element[]}
|
|
336
|
+
* @public
|
|
337
|
+
*/
|
|
338
|
+
labelIcons: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].arrayOf(_propTypes["default"].element)]),
|
|
198
339
|
/**
|
|
199
340
|
* The layout orientation of the component.
|
|
200
341
|
*
|
|
@@ -219,12 +360,26 @@ var CardBase = exports.CardBase = (0, _kind["default"])({
|
|
|
219
360
|
*/
|
|
220
361
|
pressed: _propTypes["default"].bool,
|
|
221
362
|
/**
|
|
222
|
-
* The primary badge
|
|
363
|
+
* The primary badge.
|
|
223
364
|
*
|
|
224
|
-
* @type {String
|
|
365
|
+
* @type {Element|String}
|
|
225
366
|
* @public
|
|
226
367
|
*/
|
|
227
|
-
|
|
368
|
+
primaryBadge: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].string]),
|
|
369
|
+
/**
|
|
370
|
+
* The size of the primary badge. Can be a number or an object with specific dimensions.
|
|
371
|
+
* The following properties should be provided for the object:
|
|
372
|
+
* * `height` - The height of the badge
|
|
373
|
+
* * `width` - The width of the badge
|
|
374
|
+
*
|
|
375
|
+
* @type {Object|Number}
|
|
376
|
+
* @default {width: 108, height: 108}
|
|
377
|
+
* @public
|
|
378
|
+
*/
|
|
379
|
+
primaryBadgeSize: _propTypes["default"].oneOfType([_propTypes["default"].number, _propTypes["default"].shape({
|
|
380
|
+
height: _propTypes["default"].number,
|
|
381
|
+
width: _propTypes["default"].number
|
|
382
|
+
})]),
|
|
228
383
|
/**
|
|
229
384
|
* The progress displayed inside the ProgressBar
|
|
230
385
|
*
|
|
@@ -232,6 +387,13 @@ var CardBase = exports.CardBase = (0, _kind["default"])({
|
|
|
232
387
|
* @public
|
|
233
388
|
*/
|
|
234
389
|
progress: _propTypes["default"].number,
|
|
390
|
+
/**
|
|
391
|
+
* Determines whether the `ProgressBar` will be placed over the image or not.
|
|
392
|
+
*
|
|
393
|
+
* @type {Boolean}
|
|
394
|
+
* @public
|
|
395
|
+
*/
|
|
396
|
+
progressBarOverlay: _propTypes["default"].bool,
|
|
235
397
|
/**
|
|
236
398
|
* Set to `true` to display the image with rounded corners.
|
|
237
399
|
*
|
|
@@ -240,12 +402,26 @@ var CardBase = exports.CardBase = (0, _kind["default"])({
|
|
|
240
402
|
*/
|
|
241
403
|
roundedImage: _propTypes["default"].bool,
|
|
242
404
|
/**
|
|
243
|
-
* The secondary badge
|
|
405
|
+
* The secondary badge.
|
|
244
406
|
*
|
|
245
|
-
* @type {String
|
|
407
|
+
* @type {Element|String}
|
|
246
408
|
* @public
|
|
247
409
|
*/
|
|
248
|
-
|
|
410
|
+
secondaryBadge: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].string]),
|
|
411
|
+
/**
|
|
412
|
+
* The size of the secondary badge. Can be a number or an object with specific dimensions.
|
|
413
|
+
* The following properties should be provided for the object:
|
|
414
|
+
* * `height` - The height of the badge
|
|
415
|
+
* * `width` - The width of the badge
|
|
416
|
+
*
|
|
417
|
+
* @type {Object|Number}
|
|
418
|
+
* @default {width: 108, height: 108}
|
|
419
|
+
* @public
|
|
420
|
+
*/
|
|
421
|
+
secondaryBadgeSize: _propTypes["default"].oneOfType([_propTypes["default"].number, _propTypes["default"].shape({
|
|
422
|
+
height: _propTypes["default"].number,
|
|
423
|
+
width: _propTypes["default"].number
|
|
424
|
+
})]),
|
|
249
425
|
/**
|
|
250
426
|
* A ternary caption displayed with the image.
|
|
251
427
|
*
|
|
@@ -253,6 +429,15 @@ var CardBase = exports.CardBase = (0, _kind["default"])({
|
|
|
253
429
|
* @public
|
|
254
430
|
*/
|
|
255
431
|
secondaryLabel: _propTypes["default"].string,
|
|
432
|
+
/**
|
|
433
|
+
* Icons to be included with the ternary caption.
|
|
434
|
+
*
|
|
435
|
+
* Typically, up to 3 icons are used.
|
|
436
|
+
*
|
|
437
|
+
* @type {Element|Element[]}
|
|
438
|
+
* @public
|
|
439
|
+
*/
|
|
440
|
+
secondaryLabelIcons: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].arrayOf(_propTypes["default"].element)]),
|
|
256
441
|
/**
|
|
257
442
|
* Applies a selected visual effect to the image.
|
|
258
443
|
*
|
|
@@ -260,6 +445,13 @@ var CardBase = exports.CardBase = (0, _kind["default"])({
|
|
|
260
445
|
* @public
|
|
261
446
|
*/
|
|
262
447
|
selected: _propTypes["default"].bool,
|
|
448
|
+
/**
|
|
449
|
+
* Activates the 'Duration'.
|
|
450
|
+
*
|
|
451
|
+
* @type {Boolean}
|
|
452
|
+
* @public
|
|
453
|
+
*/
|
|
454
|
+
showDuration: _propTypes["default"].bool,
|
|
263
455
|
/**
|
|
264
456
|
* Activates the 'ProgressBar'.
|
|
265
457
|
*
|
|
@@ -311,68 +503,75 @@ var CardBase = exports.CardBase = (0, _kind["default"])({
|
|
|
311
503
|
return _captionOverlay || captionOverlayOnFocus;
|
|
312
504
|
},
|
|
313
505
|
children: function children(_ref3) {
|
|
314
|
-
var
|
|
506
|
+
var captionImageIconsSrc = _ref3.captionImageIconsSrc,
|
|
507
|
+
captionOverlay = _ref3.captionOverlay,
|
|
315
508
|
captionOverlayOnFocus = _ref3.captionOverlayOnFocus,
|
|
316
509
|
centered = _ref3.centered,
|
|
510
|
+
centeredTitle = _ref3.centeredTitle,
|
|
317
511
|
_children = _ref3.children,
|
|
318
512
|
css = _ref3.css,
|
|
513
|
+
duration = _ref3.duration,
|
|
514
|
+
durationOverlay = _ref3.durationOverlay,
|
|
319
515
|
index = _ref3['data-index'],
|
|
320
516
|
imageIconSrc = _ref3.imageIconSrc,
|
|
321
517
|
label = _ref3.label,
|
|
518
|
+
labelIcons = _ref3.labelIcons,
|
|
322
519
|
orientation = _ref3.orientation,
|
|
323
520
|
progress = _ref3.progress,
|
|
521
|
+
progressBarOverlay = _ref3.progressBarOverlay,
|
|
324
522
|
secondaryLabel = _ref3.secondaryLabel,
|
|
523
|
+
secondaryLabelIcons = _ref3.secondaryLabelIcons,
|
|
524
|
+
showDuration = _ref3.showDuration,
|
|
325
525
|
showProgressBar = _ref3.showProgressBar,
|
|
326
526
|
splitCaption = _ref3.splitCaption,
|
|
327
527
|
withoutMarquee = _ref3.withoutMarquee;
|
|
528
|
+
var isCenteredTitle = (captionOverlay || captionOverlayOnFocus) && orientation === 'vertical' && centeredTitle;
|
|
328
529
|
var hasImageIcon = imageIconSrc && orientation === 'vertical';
|
|
329
|
-
var
|
|
530
|
+
var hasCaptionImageIcons = captionImageIconsSrc && captionImageIconsSrc.filter(Boolean).length && orientation === 'vertical';
|
|
531
|
+
var alignment = centered && !imageIconSrc || isCenteredTitle ? {
|
|
330
532
|
alignment: 'center'
|
|
331
533
|
} : null;
|
|
332
|
-
var
|
|
534
|
+
var labelsProps = withoutMarquee ? {
|
|
535
|
+
style: {
|
|
536
|
+
textAlign: alignment === null || alignment === void 0 ? void 0 : alignment.alignment
|
|
537
|
+
}
|
|
538
|
+
} : _objectSpread({}, alignment);
|
|
539
|
+
var CaptionsComponent = isCenteredTitle ? _Layout.Column : _Layout.Row;
|
|
540
|
+
var LabelsComponent = withoutMarquee ? 'div' : _Marquee.Marquee;
|
|
541
|
+
var captions = /*#__PURE__*/(0, _jsxRuntime.jsxs)(CaptionsComponent, {
|
|
333
542
|
className: css.captions,
|
|
334
|
-
children: [hasImageIcon ? /*#__PURE__*/(0, _jsxRuntime.
|
|
335
|
-
className: css.
|
|
336
|
-
|
|
337
|
-
shrink: true,
|
|
338
|
-
src: imageIconSrc
|
|
339
|
-
}) : null, withoutMarquee ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Layout.Cell, {
|
|
340
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
341
|
-
style: {
|
|
342
|
-
textAlign: alignment === null || alignment === void 0 ? void 0 : alignment.alignment
|
|
343
|
-
},
|
|
543
|
+
children: [hasImageIcon ? getImageIcons(imageIconSrc, null, css.imageIcon) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Layout.Cell, {
|
|
544
|
+
className: css.captionCell,
|
|
545
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(LabelsComponent, _objectSpread(_objectSpread({}, labelsProps), {}, {
|
|
344
546
|
className: css.caption,
|
|
345
547
|
children: _children
|
|
346
|
-
}),
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
children: label
|
|
370
|
-
})) : null, typeof secondaryLabel !== 'undefined' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Marquee.Marquee, _objectSpread(_objectSpread({}, alignment), {}, {
|
|
371
|
-
className: css.label,
|
|
372
|
-
marqueeOn: "hover",
|
|
373
|
-
children: secondaryLabel
|
|
374
|
-
})) : null, showProgressBar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProgressBar["default"], {
|
|
548
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Layout.Column, {
|
|
549
|
+
className: css.labels,
|
|
550
|
+
children: [typeof label !== 'undefined' ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Layout.Row, {
|
|
551
|
+
className: css.labelContainer,
|
|
552
|
+
children: [getLabelIcons(labelIcons, 'labelIcons', css.labelIcon), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
|
|
553
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(LabelsComponent, _objectSpread(_objectSpread({}, labelsProps), {}, {
|
|
554
|
+
className: css.label,
|
|
555
|
+
children: label
|
|
556
|
+
}))
|
|
557
|
+
})]
|
|
558
|
+
}) : null, typeof secondaryLabel !== 'undefined' ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Layout.Row, {
|
|
559
|
+
className: css.labelContainer,
|
|
560
|
+
children: [getLabelIcons(secondaryLabelIcons, 'secondaryLabelIcons', css.labelIcon), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
|
|
561
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(LabelsComponent, _objectSpread(_objectSpread({}, labelsProps), {}, {
|
|
562
|
+
className: css.label,
|
|
563
|
+
children: secondaryLabel
|
|
564
|
+
}))
|
|
565
|
+
})]
|
|
566
|
+
}) : null, hasCaptionImageIcons ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Row, {
|
|
567
|
+
className: css.captionImageIconsContainer,
|
|
568
|
+
children: getImageIcons(captionImageIconsSrc, 'captionImageIcons', css.captionImageIcon)
|
|
569
|
+
}) : null]
|
|
570
|
+
}), showProgressBar && !progressBarOverlay && !isCenteredTitle ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProgressBar["default"], {
|
|
375
571
|
progress: progress
|
|
572
|
+
}) : null, showDuration && !durationOverlay && !showProgressBar ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
573
|
+
className: css.duration,
|
|
574
|
+
children: formatDuration(duration)
|
|
376
575
|
}) : null]
|
|
377
576
|
})]
|
|
378
577
|
});
|
|
@@ -415,50 +614,87 @@ var CardBase = exports.CardBase = (0, _kind["default"])({
|
|
|
415
614
|
}) : selectedCaptions;
|
|
416
615
|
},
|
|
417
616
|
className: function className(_ref4) {
|
|
418
|
-
var
|
|
617
|
+
var captionOverflow = _ref4.captionOverflow,
|
|
618
|
+
captionOverflowOnFocus = _ref4.captionOverflowOnFocus,
|
|
619
|
+
captionOverlay = _ref4.captionOverlay,
|
|
419
620
|
captionOverlayOnFocus = _ref4.captionOverlayOnFocus,
|
|
621
|
+
centeredTitle = _ref4.centeredTitle,
|
|
622
|
+
durationOverlay = _ref4.durationOverlay,
|
|
420
623
|
icon = _ref4.icon,
|
|
624
|
+
label = _ref4.label,
|
|
421
625
|
pressed = _ref4.pressed,
|
|
626
|
+
progressBarOverlay = _ref4.progressBarOverlay,
|
|
422
627
|
roundedImage = _ref4.roundedImage,
|
|
423
628
|
hasContainer = _ref4.hasContainer,
|
|
424
629
|
orientation = _ref4.orientation,
|
|
630
|
+
secondaryLabel = _ref4.secondaryLabel,
|
|
425
631
|
styler = _ref4.styler;
|
|
426
632
|
return styler.append({
|
|
633
|
+
captionOverflow: captionOverflow && orientation === 'vertical' && !captionOverlay && !captionOverlayOnFocus,
|
|
634
|
+
captionOverflowOnFocus: !captionOverflow && captionOverflowOnFocus && orientation === 'vertical' && !captionOverlay && !captionOverlayOnFocus,
|
|
427
635
|
captionOverlay: captionOverlay && orientation === 'vertical',
|
|
428
636
|
captionOverlayOnFocus: !captionOverlay && captionOverlayOnFocus && orientation === 'vertical',
|
|
637
|
+
centeredTitle: centeredTitle,
|
|
638
|
+
durationOverlay: durationOverlay,
|
|
429
639
|
pressed: pressed,
|
|
430
640
|
roundedImage: roundedImage,
|
|
431
|
-
hasContainer: orientation === 'horizontal' || hasContainer && !captionOverlay,
|
|
432
|
-
|
|
641
|
+
hasContainer: orientation === 'horizontal' || hasContainer && !captionOverlay && !captionOverlayOnFocus,
|
|
642
|
+
hasLabel: orientation === 'vertical' && label && secondaryLabel,
|
|
643
|
+
isCheckIcon: icon === 'check',
|
|
644
|
+
progressBarOverlay: progressBarOverlay
|
|
433
645
|
});
|
|
434
646
|
},
|
|
435
|
-
|
|
436
|
-
var
|
|
437
|
-
|
|
438
|
-
|
|
647
|
+
showDuration: function showDuration(_ref5) {
|
|
648
|
+
var _showDuration = _ref5.showDuration,
|
|
649
|
+
showProgressBar = _ref5.showProgressBar,
|
|
650
|
+
durationOverlay = _ref5.durationOverlay;
|
|
651
|
+
return _showDuration && durationOverlay && !showProgressBar;
|
|
652
|
+
},
|
|
653
|
+
showProgressBar: function showProgressBar(_ref6) {
|
|
654
|
+
var _showProgressBar = _ref6.showProgressBar,
|
|
655
|
+
progressBarOverlay = _ref6.progressBarOverlay;
|
|
656
|
+
return _showProgressBar && progressBarOverlay;
|
|
657
|
+
},
|
|
658
|
+
splitCaption: function splitCaption(_ref7) {
|
|
659
|
+
var captionOverlay = _ref7.captionOverlay,
|
|
660
|
+
captionOverlayOnFocus = _ref7.captionOverlayOnFocus,
|
|
661
|
+
_splitCaption = _ref7.splitCaption;
|
|
439
662
|
return (captionOverlay || captionOverlayOnFocus) && _splitCaption;
|
|
440
663
|
}
|
|
441
664
|
},
|
|
442
|
-
render: function render(
|
|
665
|
+
render: function render(_ref8) {
|
|
443
666
|
var _imageSize$height, _imageSize$width;
|
|
444
|
-
var
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
667
|
+
var captionImageSize = _ref8.captionImageSize,
|
|
668
|
+
css = _ref8.css,
|
|
669
|
+
disabled = _ref8.disabled,
|
|
670
|
+
icon = _ref8.icon,
|
|
671
|
+
imageSize = _ref8.imageSize,
|
|
672
|
+
primaryBadge = _ref8.primaryBadge,
|
|
673
|
+
primaryBadgeSize = _ref8.primaryBadgeSize,
|
|
674
|
+
secondaryBadge = _ref8.secondaryBadge,
|
|
675
|
+
secondaryBadgeSize = _ref8.secondaryBadgeSize,
|
|
676
|
+
showDuration = _ref8.showDuration,
|
|
677
|
+
duration = _ref8.duration,
|
|
678
|
+
progress = _ref8.progress,
|
|
679
|
+
showProgressBar = _ref8.showProgressBar,
|
|
680
|
+
style = _ref8.style,
|
|
681
|
+
rest = _objectWithoutProperties(_ref8, _excluded);
|
|
682
|
+
delete rest.captionImageIconsSrc;
|
|
683
|
+
delete rest.captionOverflow;
|
|
684
|
+
delete rest.captionOverflowOnFocus;
|
|
452
685
|
delete rest.captionOverlayOnFocus;
|
|
453
686
|
delete rest.centered;
|
|
454
|
-
delete rest.
|
|
455
|
-
delete rest.
|
|
456
|
-
delete rest.secondaryLabel;
|
|
457
|
-
delete rest.showProgressBar;
|
|
458
|
-
delete rest.imageIconSrc;
|
|
687
|
+
delete rest.centeredTitle;
|
|
688
|
+
delete rest.durationOverlay;
|
|
459
689
|
delete rest.hasContainer;
|
|
690
|
+
delete rest.imageIconSrc;
|
|
691
|
+
delete rest.label;
|
|
692
|
+
delete rest.labelIcons;
|
|
460
693
|
delete rest.pressed;
|
|
694
|
+
delete rest.progressBarOverlay;
|
|
461
695
|
delete rest.roundedImage;
|
|
696
|
+
delete rest.secondaryLabel;
|
|
697
|
+
delete rest.secondaryLabelIcons;
|
|
462
698
|
delete rest.withoutMarquee;
|
|
463
699
|
var defaultImageSize = getDefaultImageSize(rest.orientation);
|
|
464
700
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.Card, _objectSpread(_objectSpread({}, rest), {}, {
|
|
@@ -467,23 +703,27 @@ var CardBase = exports.CardBase = (0, _kind["default"])({
|
|
|
467
703
|
"data-webos-voice-intent": "Select",
|
|
468
704
|
disabled: disabled,
|
|
469
705
|
imageComponent: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Image["default"], {
|
|
470
|
-
children: [
|
|
471
|
-
className: css.primaryBadge,
|
|
472
|
-
src: primaryBadgeSrc
|
|
473
|
-
}) : null, secondaryBadgeSrc ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image["default"], {
|
|
474
|
-
className: css.secondaryBadge,
|
|
475
|
-
src: secondaryBadgeSrc
|
|
476
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
706
|
+
children: [primaryBadge ? getBadge(primaryBadge, primaryBadgeSize, css.primaryBadge) : null, secondaryBadge ? getBadge(secondaryBadge, secondaryBadgeSize, css.secondaryBadge) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
477
707
|
className: css.selectionContainer,
|
|
478
708
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon["default"], {
|
|
479
709
|
className: css.selectionIcon,
|
|
480
710
|
children: icon
|
|
481
711
|
})
|
|
482
|
-
})
|
|
712
|
+
}), showDuration ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
713
|
+
className: css.duration,
|
|
714
|
+
children: formatDuration(duration)
|
|
715
|
+
}) : null, showProgressBar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProgressBar["default"], {
|
|
716
|
+
className: css.progress,
|
|
717
|
+
progress: progress
|
|
718
|
+
}) : null]
|
|
483
719
|
}),
|
|
484
|
-
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
720
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, style), {}, {
|
|
485
721
|
'--card-image-height': _resolution["default"].scaleToRem((_imageSize$height = imageSize === null || imageSize === void 0 ? void 0 : imageSize.height) !== null && _imageSize$height !== void 0 ? _imageSize$height : defaultImageSize.height),
|
|
486
722
|
'--card-image-width': _resolution["default"].scaleToRem((_imageSize$width = imageSize === null || imageSize === void 0 ? void 0 : imageSize.width) !== null && _imageSize$width !== void 0 ? _imageSize$width : defaultImageSize.width)
|
|
723
|
+
}, (captionImageSize === null || captionImageSize === void 0 ? void 0 : captionImageSize.height) && {
|
|
724
|
+
'--caption-image-height': _resolution["default"].scaleToRem(captionImageSize.height)
|
|
725
|
+
}), (captionImageSize === null || captionImageSize === void 0 ? void 0 : captionImageSize.width) && {
|
|
726
|
+
'--caption-image-width': _resolution["default"].scaleToRem(captionImageSize.width)
|
|
487
727
|
})
|
|
488
728
|
}));
|
|
489
729
|
}
|