@enact/ui 5.0.0-alpha.4 → 5.0.0-beta.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.
Files changed (71) hide show
  1. package/AnnounceDecorator/AnnounceDecorator.js +2 -2
  2. package/BodyText/BodyText.js +2 -2
  3. package/Button/Button.js +2 -4
  4. package/CHANGELOG.md +22 -0
  5. package/Cancelable/tests/Cancelable-specs.js +2 -2
  6. package/Card/Card.d.ts +77 -0
  7. package/Card/Card.js +215 -0
  8. package/Card/Card.module.css +31 -0
  9. package/Card/package.json +3 -0
  10. package/Card/tests/Card-specs.js +90 -0
  11. package/ComponentOverride/ComponentOverride.js +2 -2
  12. package/FloatingLayer/FloatingLayer.js +2 -2
  13. package/FloatingLayer/FloatingLayerDecorator.js +2 -2
  14. package/FloatingLayer/Scrim.js +2 -2
  15. package/FloatingLayer/useFloatingLayer.js +1 -1
  16. package/FloatingLayer/useFloatingLayerDecorator.js +1 -1
  17. package/ForwardRef/ForwardRef.js +34 -11
  18. package/Group/Group.js +2 -2
  19. package/Group/GroupItem.js +2 -5
  20. package/Heading/Heading.js +2 -2
  21. package/Icon/Icon.js +3 -2
  22. package/Image/Image.js +2 -2
  23. package/ImageItem/ImageItem.js +2 -2
  24. package/Item/Item.js +2 -2
  25. package/LabeledIcon/LabeledIcon.js +2 -2
  26. package/Layout/Cell.js +2 -2
  27. package/Layout/Layout.js +2 -2
  28. package/Marquee/MarqueeBase.js +2 -2
  29. package/Marquee/MarqueeDecorator.js +2 -2
  30. package/Marquee/useMarqueeController.js +1 -1
  31. package/Media/Media.js +2 -2
  32. package/Placeholder/PlaceholderControllerDecorator.js +1 -1
  33. package/Placeholder/tests/PlaceholderDecorator-specs.js +1 -1
  34. package/ProgressBar/ProgressBar.js +2 -2
  35. package/Repeater/Repeater.js +2 -2
  36. package/Resizable/tests/Resizable-specs.js +1 -1
  37. package/Resizable/tests/useResize-specs.js +1 -1
  38. package/Resizable/useResize.js +1 -1
  39. package/Routable/Link.js +2 -2
  40. package/Routable/Routable.js +3 -3
  41. package/Routable/Router.js +2 -2
  42. package/Routable/useLink.js +1 -1
  43. package/Scroller/Scroller.js +1 -1
  44. package/Scroller/ScrollerBasic.js +2 -2
  45. package/Skinnable/Skinnable.js +2 -2
  46. package/Skinnable/useSkins.js +2 -2
  47. package/Slider/Knob.js +2 -2
  48. package/Slider/Slider.js +2 -2
  49. package/Slottable/useSlots.js +2 -2
  50. package/Spinner/Spinner.js +2 -2
  51. package/ToggleIcon/ToggleIcon.js +2 -2
  52. package/Toggleable/Toggleable.js +2 -2
  53. package/Toggleable/useToggle.js +2 -2
  54. package/Touchable/Touchable.js +17 -7
  55. package/Touchable/tests/Touchable-specs.js +2 -2
  56. package/Touchable/tests/useTouch-specs.js +2 -2
  57. package/Transition/Transition.js +2 -2
  58. package/ViewManager/ViewManager.js +2 -2
  59. package/VirtualList/VirtualList.js +2 -2
  60. package/VirtualList/VirtualListBasic.js +2 -2
  61. package/VirtualList/tests/VirtualGridList-native-specs.js +2 -2
  62. package/VirtualList/tests/VirtualGridList-specs.js +2 -2
  63. package/VirtualList/tests/VirtualList-native-specs.js +2 -2
  64. package/VirtualList/tests/VirtualList-specs.js +2 -2
  65. package/package.json +4 -4
  66. package/resolution/index.d.ts +5 -1
  67. package/resolution/resolution.js +5 -1
  68. package/resolution/tests/resolution-specs.js +46 -19
  69. package/useScroll/Scrollbar.js +2 -2
  70. package/useScroll/ScrollbarTrack.js +17 -6
  71. package/useScroll/useScroll.js +8 -11
@@ -42,8 +42,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
42
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; }
43
43
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
44
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); }
45
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
46
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
45
+ 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; }
46
+ 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; }
47
47
  var defaultConfig = {
48
48
  /**
49
49
  * Configures the prop name to pass the announce function.
@@ -32,8 +32,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
32
32
  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; }
33
33
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
34
34
  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); }
35
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
36
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
35
+ 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; }
36
+ 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
37
  var BodyTextBase = exports.BodyTextBase = (0, _kind["default"])({
38
38
  name: 'ui:BodyText',
39
39
  propTypes: /** @lends ui/BodyText.BodyTextBase.prototype */{
package/Button/Button.js CHANGED
@@ -15,8 +15,8 @@ var _ButtonModule = _interopRequireDefault(require("./Button.module.css"));
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
16
  var _excluded = ["children", "componentRef", "css", "decoration", "disabled", "icon"];
17
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
18
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
19
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
18
+ 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; }
19
+ 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; }
20
20
  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; }
21
21
  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; }
22
22
  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; }
@@ -219,8 +219,6 @@ var ButtonBase = exports.ButtonBase = (0, _kind["default"])({
219
219
  // configured to handle.
220
220
  if (typeof iconComponent !== 'string') {
221
221
  props.size = size;
222
- // the following inadvertently triggers a linting rule
223
- // eslint-disable-next-line enact/prop-types
224
222
  props.flip = iconFlip;
225
223
  }
226
224
  if (_icon !== true) {
package/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  The following is a curated list of changes in the Enact ui module, newest changes on the top.
4
4
 
5
+ ## [5.0.0-beta.1] - 2025-04-29
6
+
7
+ No significant changes.
8
+
9
+ ## [4.9.8] - 2025-04-24
10
+
11
+ No significant changes.
12
+
13
+ ## [4.9.7] - 2025-04-16
14
+
15
+ No significant changes.
16
+
17
+ ## [5.0.0-alpha.5] - 2025-04-04
18
+
19
+ ### Added
20
+
21
+ - `ui/Card` component
22
+
23
+ ## [4.9.6] - 2025-03-27
24
+
25
+ No significant changes.
26
+
5
27
  ## [5.0.0-alpha.4] - 2025-01-21
6
28
 
7
29
  ### Fixed
@@ -9,8 +9,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
9
9
  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; }
10
10
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
11
11
  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); }
12
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
13
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
12
+ 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; }
13
+ 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; }
14
14
  describe('Cancelable', function () {
15
15
  // Suite-wide setup
16
16
  var Component = function Component(_ref) {
package/Card/Card.d.ts ADDED
@@ -0,0 +1,77 @@
1
+ // Type definitions for ui/Card
2
+
3
+ import { ForwardRefProps as ui_ForwardRef_ForwardRefProps } from "@enact/ui/ForwardRef";
4
+ import * as React from "react";
5
+
6
+ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
7
+ type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
8
+
9
+ export interface CardBaseProps {
10
+ /**
11
+ * Determines whether the caption will be placed over the image or not.
12
+ */
13
+ captionOverlay?: boolean;
14
+ /**
15
+ * The caption node to be displayed with the image.
16
+ */
17
+ children?: React.ReactNode;
18
+ /**
19
+ * Called with a reference to the root component.
20
+ *
21
+ * When using , the `ref` prop is forwarded to this component
22
+ as `componentRef` .
23
+ */
24
+ componentRef?: object | Function;
25
+ /**
26
+ * Customizes the component by mapping the supplied collection of CSS class names to the
27
+ corresponding internal elements and states of this component.
28
+ *
29
+ * The following classes are supported.
30
+ */
31
+ css?: object;
32
+ /**
33
+ * The component used to render the image component.
34
+ */
35
+ imageComponent?: React.ComponentType | JSX.Element;
36
+ /**
37
+ * The layout orientation of the component.
38
+ */
39
+ orientation?: "horizontal" | "vertical";
40
+ /**
41
+ * A placeholder image to be displayed before the image is loaded.
42
+ */
43
+ placeholder?: string;
44
+ /**
45
+ * Applies a selected visual effect to the image.
46
+ */
47
+ selected?: boolean;
48
+ /**
49
+ * String value or object of values used to determine which image will appear on a specific
50
+ screenSize.
51
+ */
52
+ src?: string | object;
53
+ }
54
+ /**
55
+ * A basic card without any behavior.
56
+ */
57
+
58
+ export class CardBase extends React.Component<
59
+ Merge<React.HTMLProps<HTMLElement>, CardBaseProps>
60
+ > {}
61
+
62
+ export interface CardDecoratorProps extends ui_ForwardRef_ForwardRefProps {}
63
+ export function CardDecorator<P>(
64
+ Component: React.ComponentType<P> | string,
65
+ ): React.ComponentType<P & CardDecoratorProps>;
66
+
67
+ export interface CardProps
68
+ extends Omit<Merge<CardBaseProps, CardDecoratorProps>, "componentRef"> {}
69
+ /**
70
+ * A minimally styled Card ready for customization by a theme.
71
+ */
72
+
73
+ export class Card extends React.Component<
74
+ Merge<React.HTMLProps<HTMLElement>, CardProps>
75
+ > {}
76
+
77
+ export default Card;
package/Card/Card.js ADDED
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.CardDecorator = exports.CardBase = exports.Card = void 0;
7
+ var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
8
+ var _kind = _interopRequireDefault(require("@enact/core/kind"));
9
+ var _propTypes2 = _interopRequireDefault(require("prop-types"));
10
+ var _compose = _interopRequireDefault(require("ramda/src/compose"));
11
+ var _ComponentOverride = _interopRequireDefault(require("../ComponentOverride"));
12
+ var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
13
+ var _Image = _interopRequireDefault(require("../Image"));
14
+ var _Layout = require("../Layout");
15
+ var _CardModule = _interopRequireDefault(require("./Card.module.css"));
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+ var _excluded = ["imageComponent"],
18
+ _excluded2 = ["captionOverlay", "children", "componentRef", "css", "imageComponent", "orientation", "placeholder", "src"];
19
+ /**
20
+ * Unstyled card components and behaviors to be customized by a theme or application.
21
+ *
22
+ * @module ui/Card
23
+ * @exports Card
24
+ * @exports CardBase
25
+ * @exports CardDecorator
26
+ */
27
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
28
+ 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; }
29
+ 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; }
30
+ 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; }
31
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
32
+ 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); }
33
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
34
+ 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; }
35
+ function ImageOverride(_ref) {
36
+ var imageComponent = _ref.imageComponent,
37
+ rest = _objectWithoutProperties(_ref, _excluded);
38
+ return (0, _ComponentOverride["default"])(_objectSpread({
39
+ component: imageComponent
40
+ }, rest));
41
+ }
42
+
43
+ /**
44
+ * A basic card without any behavior.
45
+ *
46
+ * @class CardBase
47
+ * @memberof ui/Card
48
+ * @ui
49
+ * @public
50
+ */
51
+ var CardBase = exports.CardBase = (0, _kind["default"])({
52
+ name: 'ui:Card',
53
+ propTypes: /** @lends ui/Card.CardBase.prototype */{
54
+ /**
55
+ * Determines whether the caption will be placed over the image or not.
56
+ *
57
+ * @type {Boolean}
58
+ * @default false
59
+ * @public
60
+ */
61
+ captionOverlay: _propTypes2["default"].bool,
62
+ /**
63
+ * The caption node to be displayed with the image.
64
+ * @type {Node}
65
+ * @public
66
+ */
67
+ children: _propTypes2["default"].node,
68
+ /**
69
+ * Called with a reference to the root component.
70
+ *
71
+ * When using {@link ui/Card.Card}, the `ref` prop is forwarded to this component
72
+ * as `componentRef`.
73
+ *
74
+ * @type {Object|Function}
75
+ * @public
76
+ */
77
+ componentRef: _propTypes["default"].ref,
78
+ /**
79
+ * Customizes the component by mapping the supplied collection of CSS class names to the
80
+ * corresponding internal elements and states of this component.
81
+ *
82
+ * The following classes are supported.
83
+ *
84
+ * @type {Object}
85
+ * @public
86
+ */
87
+ css: _propTypes2["default"].object,
88
+ /**
89
+ * The component used to render the image component.
90
+ *
91
+ * @type {Component|Element}
92
+ * @default {@link ui/Image.Image}
93
+ * @public
94
+ */
95
+ imageComponent: _propTypes["default"].componentOverride,
96
+ /**
97
+ * The layout orientation of the component.
98
+ *
99
+ * @type {('horizontal'|'vertical')}
100
+ * @default 'vertical'
101
+ * @public
102
+ */
103
+ orientation: _propTypes2["default"].oneOf(['horizontal', 'vertical']),
104
+ /**
105
+ * A placeholder image to be displayed before the image is loaded.
106
+ *
107
+ * @type {String}
108
+ * @public
109
+ */
110
+ placeholder: _propTypes2["default"].string,
111
+ /**
112
+ * Applies a selected visual effect to the image.
113
+ *
114
+ * @type {Boolean}
115
+ * @default false
116
+ * @public
117
+ */
118
+ selected: _propTypes2["default"].bool,
119
+ /**
120
+ * String value or object of values used to determine which image will appear on a specific
121
+ * screenSize.
122
+ *
123
+ * @type {String|Object}
124
+ * @public
125
+ */
126
+ src: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object])
127
+ },
128
+ defaultProps: {
129
+ imageComponent: _Image["default"],
130
+ orientation: 'vertical'
131
+ },
132
+ styles: {
133
+ css: _CardModule["default"],
134
+ className: 'card',
135
+ publicClassNames: true
136
+ },
137
+ computed: {
138
+ className: function className(_ref2) {
139
+ var captionOverlay = _ref2.captionOverlay,
140
+ orientation = _ref2.orientation,
141
+ selected = _ref2.selected,
142
+ styler = _ref2.styler;
143
+ return styler.append({
144
+ captionOverlay: captionOverlay && orientation === 'vertical',
145
+ selected: selected,
146
+ horizontal: orientation === 'horizontal',
147
+ vertical: orientation === 'vertical'
148
+ });
149
+ }
150
+ },
151
+ render: function render(_ref3) {
152
+ var captionOverlay = _ref3.captionOverlay,
153
+ children = _ref3.children,
154
+ componentRef = _ref3.componentRef,
155
+ css = _ref3.css,
156
+ imageComponent = _ref3.imageComponent,
157
+ orientation = _ref3.orientation,
158
+ placeholder = _ref3.placeholder,
159
+ src = _ref3.src,
160
+ rest = _objectWithoutProperties(_ref3, _excluded2);
161
+ var isHorizontal = orientation === 'horizontal';
162
+ var isCaptionOverlay = captionOverlay && !isHorizontal;
163
+ var Component = isHorizontal ? _Layout.Row : _Layout.Column;
164
+ var Wrapped = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
165
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
166
+ className: css.image,
167
+ component: ImageOverride,
168
+ imageComponent: imageComponent,
169
+ placeholder: placeholder,
170
+ shrink: isHorizontal,
171
+ src: src
172
+ }), children ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
173
+ className: css.children,
174
+ shrink: !isHorizontal
175
+ // eslint-disable-next-line no-undefined
176
+ ,
177
+ align: isHorizontal ? 'center' : undefined,
178
+ children: children
179
+ }) : null]
180
+ });
181
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, _objectSpread(_objectSpread({}, rest), {}, {
182
+ ref: componentRef,
183
+ children: isCaptionOverlay ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
184
+ className: css.imageContainer,
185
+ children: Wrapped
186
+ }) : Wrapped
187
+ }));
188
+ }
189
+ });
190
+
191
+ /**
192
+ * A higher-order component that adds behaviors to an {@link ui/Card.CardBase|Card}.
193
+ *
194
+ * @hoc
195
+ * @memberof ui/Card
196
+ * @mixes ui/ForwardRef.ForwardRef
197
+ * @public
198
+ */
199
+ var CardDecorator = exports.CardDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
200
+ prop: 'componentRef'
201
+ }));
202
+
203
+ /**
204
+ * A minimally styled Card ready for customization by a theme.
205
+ *
206
+ * @class Card
207
+ * @memberof ui/Card
208
+ * @extends ui/Card.CardBase
209
+ * @mixes ui/Card.CardDecorator
210
+ * @omit componentRef
211
+ * @ui
212
+ * @public
213
+ */
214
+ var Card = exports.Card = CardDecorator(CardBase);
215
+ var _default = exports["default"] = Card;
@@ -0,0 +1,31 @@
1
+ .card {
2
+ box-sizing: border-box;
3
+ }
4
+ .card .image {
5
+ display: block;
6
+ margin: 0;
7
+ }
8
+ .card .children,
9
+ .card.selected {
10
+ /* Public Class Names */
11
+ }
12
+ .card.captionOverlay .imageContainer {
13
+ height: 100%;
14
+ position: relative;
15
+ }
16
+ .card.captionOverlay .children {
17
+ position: absolute;
18
+ width: 100%;
19
+ bottom: 0;
20
+ left: 50%;
21
+ transform: translate(-50%);
22
+ z-index: 1;
23
+ }
24
+ .card.horizontal .image {
25
+ width: 50%;
26
+ height: 100%;
27
+ }
28
+ .card.vertical .image {
29
+ width: 100%;
30
+ height: 100%;
31
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "main": "Card.js"
3
+ }
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ require("@testing-library/jest-dom");
4
+ var _react = require("@testing-library/react");
5
+ var _Card = _interopRequireWildcard(require("../Card"));
6
+ var _jsxRuntime = require("react/jsx-runtime");
7
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
8
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
9
+ var src = {
10
+ 'hd': 'https://placehold.co/200x200/000000/ffffff/png',
11
+ 'fhd': 'https://placehold.co/300x300/000000/ffffff/png',
12
+ 'uhd': 'https://placehold.co/600x600/000000/ffffff/png'
13
+ };
14
+ describe('Card', function () {
15
+ test('should support `children` prop', function () {
16
+ var children = 'children';
17
+ (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.CardBase, {
18
+ src: src.hd,
19
+ children: children
20
+ }));
21
+ var expected = children;
22
+ var card = _react.screen.getByText(children);
23
+ expect(card).toHaveTextContent(expected);
24
+ });
25
+ test('should apply `.horizontal` when `orientation="horizontal"`', function () {
26
+ (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.CardBase, {
27
+ "data-testid": "card",
28
+ orientation: "horizontal",
29
+ src: src
30
+ }));
31
+ var expected = 'horizontal';
32
+ var card = _react.screen.getByTestId('card');
33
+ expect(card).toHaveClass(expected);
34
+ });
35
+ test('should apply `.vertical` when `oreintation="vertical"`', function () {
36
+ (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.CardBase, {
37
+ "data-testid": "card",
38
+ orientation: "vertical",
39
+ src: src
40
+ }));
41
+ var expected = 'vertical';
42
+ var card = _react.screen.getByTestId('card');
43
+ expect(card).toHaveClass(expected);
44
+ });
45
+ test('should apply `.selected` when `selected`', function () {
46
+ (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.CardBase, {
47
+ "data-testid": "card",
48
+ selected: true,
49
+ src: src
50
+ }));
51
+ var expected = 'selected';
52
+ var card = _react.screen.getByTestId('card');
53
+ expect(card).toHaveClass(expected);
54
+ });
55
+ test('should apply `.captionOverlay` when `captionOverlay`', function () {
56
+ (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.CardBase, {
57
+ "data-testid": "card",
58
+ captionOverlay: true,
59
+ src: src
60
+ }));
61
+ var expected = 'captionOverlay';
62
+ var card = _react.screen.getByTestId('card');
63
+ expect(card).toHaveClass(expected);
64
+ });
65
+ test('should support string for `src` prop', function () {
66
+ (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.CardBase, {
67
+ src: src.hd
68
+ }));
69
+ var expected = src.hd;
70
+ var imgElement = _react.screen.getAllByRole('img')[1];
71
+ expect(imgElement).toHaveAttribute('src', expected);
72
+ });
73
+ test('should support object for `src` prop', function () {
74
+ (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.CardBase, {
75
+ src: src
76
+ }));
77
+ var imgElementSrc = _react.screen.getAllByRole('img')[1];
78
+ expect(imgElementSrc).not.toBeNull();
79
+ });
80
+ test('should return a DOM node reference for `componentRef`', function () {
81
+ var ref = jest.fn();
82
+ (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Card["default"], {
83
+ ref: ref,
84
+ src: src
85
+ }));
86
+ var expected = 'DIV';
87
+ var actual = ref.mock.calls[0][0].nodeName;
88
+ expect(actual).toBe(expected);
89
+ });
90
+ });
@@ -67,8 +67,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
67
67
  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; }
68
68
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
69
69
  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); }
70
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
71
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
70
+ 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; }
71
+ 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; }
72
72
  var ComponentOverride = exports.ComponentOverride = function ComponentOverride(_ref) {
73
73
  var Component = _ref.component,
74
74
  props = _objectWithoutProperties(_ref, _excluded);
@@ -21,8 +21,8 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
21
21
  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; }
22
22
  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; }
23
23
  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; }
24
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
25
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
24
+ 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; }
25
+ 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; }
26
26
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
27
27
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
28
28
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
@@ -35,8 +35,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
35
35
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
36
36
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
37
37
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
38
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(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 (e.includes(n)) continue; t[n] = r[n]; } return t; }
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; }
40
40
  var defaultConfig = {
41
41
  /**
42
42
  * Element Id of the floatLayer
@@ -13,8 +13,8 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
13
13
  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; }
14
14
  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; }
15
15
  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; }
16
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
17
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
16
+ 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; }
17
+ 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; }
18
18
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
19
19
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
20
20
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
@@ -23,7 +23,7 @@ function useFloatingLayer() {
23
23
  setId(ev.floatingLayer.id);
24
24
  }
25
25
  }, [setId]);
26
- var registerFloatingLayer = (0, _react.useContext)(_FloatingLayerDecorator.FloatingLayerContext);
26
+ var registerFloatingLayer = (0, _react.use)(_FloatingLayerDecorator.FloatingLayerContext);
27
27
  (0, _react.useEffect)(function () {
28
28
  if (registerFloatingLayer) {
29
29
  registerFloatingLayer(handler);
@@ -50,7 +50,7 @@ function useFloatingLayerDecorator() {
50
50
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
51
51
 
52
52
  var provideFloatingLayer = (0, _react.useCallback)(function (children) {
53
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(FloatingLayerContext.Provider, {
53
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(FloatingLayerContext, {
54
54
  value: floating.registry.register,
55
55
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
56
56
  className: className,