@sb1/ffe-cards-react 100.12.4 → 101.0.0

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 (39) hide show
  1. package/es/CardBase.js +11 -37
  2. package/es/GroupCard/GroupCard.js +7 -31
  3. package/es/GroupCard/GroupCardElement.js +6 -31
  4. package/es/GroupCard/GroupCardFooter.js +6 -31
  5. package/es/GroupCard/GroupCardTitle.js +6 -31
  6. package/es/IconCard/IconCard.js +19 -36
  7. package/es/IllustrationCard/IllustrationCard.js +11 -34
  8. package/es/ImageCard/ImageCard.js +16 -41
  9. package/es/StippledCard/StippledCard.js +18 -43
  10. package/es/TextCard/TextCard.js +6 -31
  11. package/es/components/CardAction.js +3 -25
  12. package/es/components/CardName.js +2 -24
  13. package/es/components/ComponentBase.js +2 -24
  14. package/es/components/Subtext.js +2 -24
  15. package/es/components/Text.js +2 -24
  16. package/es/components/Title.js +3 -25
  17. package/es/components/WithCardAction.js +12 -35
  18. package/es/fixedForwardRef.js +1 -1
  19. package/es/mergeRefs.js +2 -2
  20. package/lib/CardBase.js +14 -40
  21. package/lib/GroupCard/GroupCard.js +9 -33
  22. package/lib/GroupCard/GroupCardElement.js +9 -34
  23. package/lib/GroupCard/GroupCardFooter.js +9 -34
  24. package/lib/GroupCard/GroupCardTitle.js +9 -34
  25. package/lib/IconCard/IconCard.js +18 -35
  26. package/lib/IllustrationCard/IllustrationCard.js +10 -33
  27. package/lib/ImageCard/ImageCard.js +19 -44
  28. package/lib/StippledCard/StippledCard.js +21 -46
  29. package/lib/TextCard/TextCard.js +9 -34
  30. package/lib/components/CardAction.js +4 -26
  31. package/lib/components/CardName.js +5 -27
  32. package/lib/components/ComponentBase.js +3 -25
  33. package/lib/components/Subtext.js +5 -27
  34. package/lib/components/Text.js +5 -27
  35. package/lib/components/Title.js +6 -28
  36. package/lib/components/WithCardAction.js +16 -39
  37. package/lib/fixedForwardRef.js +1 -1
  38. package/lib/mergeRefs.js +2 -2
  39. package/package.json +6 -6
@@ -1,49 +1,26 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
25
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
4
  };
27
5
  Object.defineProperty(exports, "__esModule", { value: true });
28
6
  exports.IllustrationCard = void 0;
29
- var react_1 = __importDefault(require("react"));
30
- var classnames_1 = __importDefault(require("classnames"));
31
- var components_1 = require("../components");
32
- var fixedForwardRef_1 = require("../fixedForwardRef");
7
+ const react_1 = __importDefault(require("react"));
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const components_1 = require("../components");
10
+ const fixedForwardRef_1 = require("../fixedForwardRef");
33
11
  function IllustrationCardWithForwardRef(props, ref) {
34
- var className = props.className, condensed = props.condensed, img = props.img, illustrationPosition = props.illustrationPosition, noMargin = props.noMargin, _a = props.appearance, appearance = _a === void 0 ? 'default' : _a, children = props.children, rest = __rest(props, ["className", "condensed", "img", "illustrationPosition", "noMargin", "appearance", "children"]);
35
- return (react_1.default.createElement(components_1.WithCardAction, __assign({ baseClassName: "ffe-illustration-card", className: (0, classnames_1.default)('ffe-illustration-card', { 'ffe-illustration-card--condensed': condensed }, { 'ffe-illustration-card--no-margin': noMargin }, {
12
+ const { className, condensed, img, illustrationPosition, noMargin, appearance = 'default', children, ...rest } = props;
13
+ return (react_1.default.createElement(components_1.WithCardAction, { baseClassName: "ffe-illustration-card", className: (0, classnames_1.default)('ffe-illustration-card', { 'ffe-illustration-card--condensed': condensed }, { 'ffe-illustration-card--no-margin': noMargin }, {
36
14
  'ffe-illustration-card--right': illustrationPosition === 'right',
37
- }, { ' ffe-default-mode': appearance === 'default' }, className) }, rest, { ref: ref }), function (_a) {
38
- var CardAction = _a.CardAction;
39
- var illustrationElement = (react_1.default.createElement("div", { className: (0, classnames_1.default)('ffe-illustration-card__illustration') }, img));
40
- var bodyElement = (react_1.default.createElement("div", { className: "ffe-illustration-card__body" }, typeof children === 'function'
15
+ }, { ' ffe-default-mode': appearance === 'default' }, className), ...rest, ref: ref }, ({ CardAction }) => {
16
+ const illustrationElement = (react_1.default.createElement("div", { className: (0, classnames_1.default)('ffe-illustration-card__illustration') }, img));
17
+ const bodyElement = (react_1.default.createElement("div", { className: "ffe-illustration-card__body" }, typeof children === 'function'
41
18
  ? children({
42
19
  Text: components_1.Text,
43
20
  Subtext: components_1.Subtext,
44
21
  Title: components_1.Title,
45
22
  CardName: components_1.CardName,
46
- CardAction: CardAction,
23
+ CardAction,
47
24
  })
48
25
  : children));
49
26
  return illustrationPosition === 'right' ? (react_1.default.createElement(react_1.default.Fragment, null,
@@ -1,55 +1,30 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
25
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
4
  };
27
5
  Object.defineProperty(exports, "__esModule", { value: true });
28
6
  exports.ImageCard = void 0;
29
- var react_1 = __importDefault(require("react"));
30
- var classnames_1 = __importDefault(require("classnames"));
31
- var components_1 = require("../components");
32
- var fixedForwardRef_1 = require("../fixedForwardRef");
7
+ const react_1 = __importDefault(require("react"));
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const components_1 = require("../components");
10
+ const fixedForwardRef_1 = require("../fixedForwardRef");
33
11
  function ImageCardWithForwardRef(props, ref) {
34
- var className = props.className, imageSrc = props.imageSrc, imageAltText = props.imageAltText, noMargin = props.noMargin, _a = props.appearance, appearance = _a === void 0 ? 'default' : _a, children = props.children, rest = __rest(props, ["className", "imageSrc", "imageAltText", "noMargin", "appearance", "children"]);
35
- return (react_1.default.createElement(components_1.WithCardAction, __assign({ baseClassName: "ffe-image-card", className: (0, classnames_1.default)('ffe-image-card', {
12
+ const { className, imageSrc, imageAltText, noMargin, appearance = 'default', children, ...rest } = props;
13
+ return (react_1.default.createElement(components_1.WithCardAction, { baseClassName: "ffe-image-card", className: (0, classnames_1.default)('ffe-image-card', {
36
14
  'ffe-image-card--no-margin': noMargin,
37
15
  'ffe-default-mode': appearance === 'default',
38
- }, className) }, rest, { ref: ref }), function (_a) {
39
- var CardAction = _a.CardAction;
40
- return (react_1.default.createElement(react_1.default.Fragment, null,
41
- react_1.default.createElement("div", { className: "ffe-image-card__image-container" },
42
- react_1.default.createElement("div", { className: "ffe-image-card__image-overlay" }),
43
- react_1.default.createElement("img", { src: imageSrc, alt: imageAltText, className: "ffe-image-card__image" })),
44
- react_1.default.createElement("div", { className: "ffe-image-card__body" }, typeof children === 'function'
45
- ? children({
46
- Text: components_1.Text,
47
- Subtext: components_1.Subtext,
48
- Title: components_1.Title,
49
- CardName: components_1.CardName,
50
- CardAction: CardAction,
51
- })
52
- : children)));
53
- }));
16
+ }, className), ...rest, ref: ref }, ({ CardAction }) => (react_1.default.createElement(react_1.default.Fragment, null,
17
+ react_1.default.createElement("div", { className: "ffe-image-card__image-container" },
18
+ react_1.default.createElement("div", { className: "ffe-image-card__image-overlay" }),
19
+ react_1.default.createElement("img", { src: imageSrc, alt: imageAltText, className: "ffe-image-card__image" })),
20
+ react_1.default.createElement("div", { className: "ffe-image-card__body" }, typeof children === 'function'
21
+ ? children({
22
+ Text: components_1.Text,
23
+ Subtext: components_1.Subtext,
24
+ Title: components_1.Title,
25
+ CardName: components_1.CardName,
26
+ CardAction,
27
+ })
28
+ : children)))));
54
29
  }
55
30
  exports.ImageCard = (0, fixedForwardRef_1.fixedForwardRef)(ImageCardWithForwardRef);
@@ -1,55 +1,30 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
25
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
4
  };
27
5
  Object.defineProperty(exports, "__esModule", { value: true });
28
6
  exports.StippledCard = void 0;
29
- var react_1 = __importDefault(require("react"));
30
- var classnames_1 = __importDefault(require("classnames"));
31
- var components_1 = require("../components");
32
- var fixedForwardRef_1 = require("../fixedForwardRef");
7
+ const react_1 = __importDefault(require("react"));
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const components_1 = require("../components");
10
+ const fixedForwardRef_1 = require("../fixedForwardRef");
33
11
  function StippledCardWithForwardRef(props, ref) {
34
- var className = props.className, condensed = props.condensed, img = props.img, noMargin = props.noMargin, rightImg = props.rightImg, children = props.children, rest = __rest(props, ["className", "condensed", "img", "noMargin", "rightImg", "children"]);
35
- return (react_1.default.createElement(components_1.WithCardAction, __assign({ baseClassName: "ffe-stippled-card", className: (0, classnames_1.default)('ffe-stippled-card', { 'ffe-stippled-card--condensed': condensed }, { 'ffe-stippled-card--no-margin': noMargin }, className) }, rest, { ref: ref }), function (_a) {
36
- var CardAction = _a.CardAction;
37
- return (react_1.default.createElement(react_1.default.Fragment, null,
38
- img && (react_1.default.createElement("div", { className: (0, classnames_1.default)('ffe-stippled-card__img', {
39
- 'ffe-stippled-card__img--icon': (img === null || img === void 0 ? void 0 : img.type) === 'icon',
40
- }), "aria-hidden": (img === null || img === void 0 ? void 0 : img.type) === 'icon' }, img === null || img === void 0 ? void 0 : img.element)),
41
- react_1.default.createElement("div", { className: 'ffe-stippled-card__content' }, typeof children === 'function'
42
- ? children({
43
- CardName: components_1.CardName,
44
- Title: components_1.Title,
45
- Text: components_1.Text,
46
- Subtext: components_1.Subtext,
47
- CardAction: CardAction,
48
- })
49
- : children),
50
- rightImg && (react_1.default.createElement("div", { className: (0, classnames_1.default)('ffe-stippled-card__img', {
51
- 'ffe-stippled-card__img--icon': (rightImg === null || rightImg === void 0 ? void 0 : rightImg.type) === 'icon',
52
- }), "aria-hidden": (rightImg === null || rightImg === void 0 ? void 0 : rightImg.type) === 'icon' }, rightImg === null || rightImg === void 0 ? void 0 : rightImg.element))));
53
- }));
12
+ const { className, condensed, img, noMargin, rightImg, children, ...rest } = props;
13
+ return (react_1.default.createElement(components_1.WithCardAction, { baseClassName: "ffe-stippled-card", className: (0, classnames_1.default)('ffe-stippled-card', { 'ffe-stippled-card--condensed': condensed }, { 'ffe-stippled-card--no-margin': noMargin }, className), ...rest, ref: ref }, ({ CardAction }) => (react_1.default.createElement(react_1.default.Fragment, null,
14
+ img && (react_1.default.createElement("div", { className: (0, classnames_1.default)('ffe-stippled-card__img', {
15
+ 'ffe-stippled-card__img--icon': (img === null || img === void 0 ? void 0 : img.type) === 'icon',
16
+ }), "aria-hidden": (img === null || img === void 0 ? void 0 : img.type) === 'icon' }, img === null || img === void 0 ? void 0 : img.element)),
17
+ react_1.default.createElement("div", { className: 'ffe-stippled-card__content' }, typeof children === 'function'
18
+ ? children({
19
+ CardName: components_1.CardName,
20
+ Title: components_1.Title,
21
+ Text: components_1.Text,
22
+ Subtext: components_1.Subtext,
23
+ CardAction,
24
+ })
25
+ : children),
26
+ rightImg && (react_1.default.createElement("div", { className: (0, classnames_1.default)('ffe-stippled-card__img', {
27
+ 'ffe-stippled-card__img--icon': (rightImg === null || rightImg === void 0 ? void 0 : rightImg.type) === 'icon',
28
+ }), "aria-hidden": (rightImg === null || rightImg === void 0 ? void 0 : rightImg.type) === 'icon' }, rightImg === null || rightImg === void 0 ? void 0 : rightImg.element))))));
54
29
  }
55
30
  exports.StippledCard = (0, fixedForwardRef_1.fixedForwardRef)(StippledCardWithForwardRef);
@@ -1,46 +1,21 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
25
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
4
  };
27
5
  Object.defineProperty(exports, "__esModule", { value: true });
28
6
  exports.TextCard = void 0;
29
- var react_1 = __importDefault(require("react"));
30
- var classnames_1 = __importDefault(require("classnames"));
31
- var components_1 = require("../components");
32
- var fixedForwardRef_1 = require("../fixedForwardRef");
7
+ const react_1 = __importDefault(require("react"));
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const components_1 = require("../components");
10
+ const fixedForwardRef_1 = require("../fixedForwardRef");
33
11
  function TextCardWithForwardRef(props, ref) {
34
- var className = props.className, leftAlign = props.leftAlign, noMargin = props.noMargin, _a = props.appearance, appearance = _a === void 0 ? 'default' : _a, children = props.children, rest = __rest(props, ["className", "leftAlign", "noMargin", "appearance", "children"]);
35
- return (react_1.default.createElement(components_1.WithCardAction, __assign({ baseClassName: "ffe-text-card", className: (0, classnames_1.default)('ffe-text-card', {
12
+ const { className, leftAlign, noMargin, appearance = 'default', children, ...rest } = props;
13
+ return (react_1.default.createElement(components_1.WithCardAction, { baseClassName: "ffe-text-card", className: (0, classnames_1.default)('ffe-text-card', {
36
14
  'ffe-text-card--left-align': leftAlign,
37
15
  'ffe-text-card--no-margin': noMargin,
38
16
  'ffe-default-mode': appearance === 'default',
39
- }, className) }, rest, { ref: ref }), function (_a) {
40
- var CardAction = _a.CardAction;
41
- return typeof children === 'function'
42
- ? children({ Text: components_1.Text, Subtext: components_1.Subtext, Title: components_1.Title, CardName: components_1.CardName, CardAction: CardAction })
43
- : children;
44
- }));
17
+ }, className), ...rest, ref: ref }, ({ CardAction }) => typeof children === 'function'
18
+ ? children({ Text: components_1.Text, Subtext: components_1.Subtext, Title: components_1.Title, CardName: components_1.CardName, CardAction })
19
+ : children));
45
20
  }
46
21
  exports.TextCard = (0, fixedForwardRef_1.fixedForwardRef)(TextCardWithForwardRef);
@@ -1,35 +1,13 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
25
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
4
  };
27
5
  Object.defineProperty(exports, "__esModule", { value: true });
28
6
  exports.CardAction = void 0;
29
- var react_1 = __importDefault(require("react"));
30
- var fixedForwardRef_1 = require("../fixedForwardRef");
7
+ const react_1 = __importDefault(require("react"));
8
+ const fixedForwardRef_1 = require("../fixedForwardRef");
31
9
  function CardActionWithRef(props, ref) {
32
- var _a = props.as, Comp = _a === void 0 ? 'a' : _a, rest = __rest(props, ["as"]);
33
- return react_1.default.createElement(Comp, __assign({}, rest, { ref: ref }));
10
+ const { as: Comp = 'a', ...rest } = props;
11
+ return react_1.default.createElement(Comp, { ...rest, ref: ref });
34
12
  }
35
13
  exports.CardAction = (0, fixedForwardRef_1.fixedForwardRef)(CardActionWithRef);
@@ -1,35 +1,13 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
25
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
4
  };
27
5
  Object.defineProperty(exports, "__esModule", { value: true });
28
6
  exports.CardName = CardName;
29
- var react_1 = __importDefault(require("react"));
30
- var classnames_1 = __importDefault(require("classnames"));
31
- var ComponentBase_1 = require("./ComponentBase");
7
+ const react_1 = __importDefault(require("react"));
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const ComponentBase_1 = require("./ComponentBase");
32
10
  function CardName(props) {
33
- var className = props.className, rest = __rest(props, ["className"]);
34
- return (react_1.default.createElement(ComponentBase_1.ComponentBase, __assign({ className: (0, classnames_1.default)('ffe-card-body__card-name', className) }, rest)));
11
+ const { className, ...rest } = props;
12
+ return (react_1.default.createElement(ComponentBase_1.ComponentBase, { className: (0, classnames_1.default)('ffe-card-body__card-name', className), ...rest }));
35
13
  }
@@ -1,33 +1,11 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
25
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
4
  };
27
5
  Object.defineProperty(exports, "__esModule", { value: true });
28
6
  exports.ComponentBase = ComponentBase;
29
- var react_1 = __importDefault(require("react"));
7
+ const react_1 = __importDefault(require("react"));
30
8
  function ComponentBase(props) {
31
- var _a = props.as, Comp = _a === void 0 ? 'p' : _a, rest = __rest(props, ["as"]);
32
- return react_1.default.createElement(Comp, __assign({}, rest));
9
+ const { as: Comp = 'p', ...rest } = props;
10
+ return react_1.default.createElement(Comp, { ...rest });
33
11
  }
@@ -1,35 +1,13 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
25
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
4
  };
27
5
  Object.defineProperty(exports, "__esModule", { value: true });
28
6
  exports.Subtext = Subtext;
29
- var react_1 = __importDefault(require("react"));
30
- var classnames_1 = __importDefault(require("classnames"));
31
- var ComponentBase_1 = require("./ComponentBase");
7
+ const react_1 = __importDefault(require("react"));
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const ComponentBase_1 = require("./ComponentBase");
32
10
  function Subtext(props) {
33
- var className = props.className, rest = __rest(props, ["className"]);
34
- return (react_1.default.createElement(ComponentBase_1.ComponentBase, __assign({ className: (0, classnames_1.default)('ffe-card-body__subtext', className) }, rest)));
11
+ const { className, ...rest } = props;
12
+ return (react_1.default.createElement(ComponentBase_1.ComponentBase, { className: (0, classnames_1.default)('ffe-card-body__subtext', className), ...rest }));
35
13
  }
@@ -1,35 +1,13 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
25
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
4
  };
27
5
  Object.defineProperty(exports, "__esModule", { value: true });
28
6
  exports.Text = Text;
29
- var react_1 = __importDefault(require("react"));
30
- var classnames_1 = __importDefault(require("classnames"));
31
- var ComponentBase_1 = require("./ComponentBase");
7
+ const react_1 = __importDefault(require("react"));
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const ComponentBase_1 = require("./ComponentBase");
32
10
  function Text(props) {
33
- var className = props.className, rest = __rest(props, ["className"]);
34
- return (react_1.default.createElement(ComponentBase_1.ComponentBase, __assign({ className: (0, classnames_1.default)('ffe-card-body__text', className) }, rest)));
11
+ const { className, ...rest } = props;
12
+ return (react_1.default.createElement(ComponentBase_1.ComponentBase, { className: (0, classnames_1.default)('ffe-card-body__text', className), ...rest }));
35
13
  }
@@ -1,37 +1,15 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
25
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
4
  };
27
5
  Object.defineProperty(exports, "__esModule", { value: true });
28
6
  exports.Title = Title;
29
- var react_1 = __importDefault(require("react"));
30
- var classnames_1 = __importDefault(require("classnames"));
31
- var ComponentBase_1 = require("./ComponentBase");
7
+ const react_1 = __importDefault(require("react"));
8
+ const classnames_1 = __importDefault(require("classnames"));
9
+ const ComponentBase_1 = require("./ComponentBase");
32
10
  function Title(props) {
33
- var className = props.className, overflowEllipsis = props.overflowEllipsis, rest = __rest(props, ["className", "overflowEllipsis"]);
34
- return (react_1.default.createElement(ComponentBase_1.ComponentBase, __assign({ className: (0, classnames_1.default)('ffe-card-body__title', {
11
+ const { className, overflowEllipsis, ...rest } = props;
12
+ return (react_1.default.createElement(ComponentBase_1.ComponentBase, { className: (0, classnames_1.default)('ffe-card-body__title', {
35
13
  'ffe-card-body__title--overflow-ellipsis': overflowEllipsis,
36
- }, className) }, rest)));
14
+ }, className), ...rest }));
37
15
  }
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
3
  if (k2 === undefined) k2 = k;
15
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -43,56 +32,44 @@ var __importStar = (this && this.__importStar) || (function () {
43
32
  return result;
44
33
  };
45
34
  })();
46
- var __rest = (this && this.__rest) || function (s, e) {
47
- var t = {};
48
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
49
- t[p] = s[p];
50
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
51
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
52
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
53
- t[p[i]] = s[p[i]];
54
- }
55
- return t;
56
- };
57
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
58
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
59
37
  };
60
38
  Object.defineProperty(exports, "__esModule", { value: true });
61
39
  exports.WithCardAction = void 0;
62
- var react_1 = __importStar(require("react"));
63
- var classnames_1 = __importDefault(require("classnames"));
64
- var mergeRefs_1 = require("../mergeRefs");
65
- var CardAction_1 = require("./CardAction");
66
- var fixedForwardRef_1 = require("../fixedForwardRef");
40
+ const react_1 = __importStar(require("react"));
41
+ const classnames_1 = __importDefault(require("classnames"));
42
+ const mergeRefs_1 = require("../mergeRefs");
43
+ const CardAction_1 = require("./CardAction");
44
+ const fixedForwardRef_1 = require("../fixedForwardRef");
67
45
  function WithCardActionForwardRef(props, ref) {
68
- var children = props.children, _a = props.as, Comp = _a === void 0 ? 'div' : _a, onClick = props.onClick, className = props.className, baseClassName = props.baseClassName, rest = __rest(props, ["children", "as", "onClick", "className", "baseClassName"]);
69
- var cardActionInnerRef = (0, react_1.useRef)(null);
70
- var _b = (0, react_1.useState)(), isUsingCardAction = _b[0], setIsUsingCardAction = _b[1];
46
+ const { children, as: Comp = 'div', onClick, className, baseClassName, ...rest } = props;
47
+ const cardActionInnerRef = (0, react_1.useRef)(null);
48
+ const [isUsingCardAction, setIsUsingCardAction] = (0, react_1.useState)();
71
49
  /** Før att hover og focus skall fungera i browsers som ikke støtter :has.
72
50
  * Allt med klassen '--clickable' kan eftervart fjernes. */
73
- (0, react_1.useEffect)(function () {
74
- var isStillUsingCardAction = !!cardActionInnerRef.current;
51
+ (0, react_1.useEffect)(() => {
52
+ const isStillUsingCardAction = !!cardActionInnerRef.current;
75
53
  if (isUsingCardAction !== isStillUsingCardAction) {
76
54
  setIsUsingCardAction(isStillUsingCardAction);
77
55
  }
78
56
  }, [isUsingCardAction]);
79
- var PartialAppliedCardAction = (0, react_1.useCallback)(function (_a, cardActionRef) {
80
- var cardActionClassName = _a.className, restCardAction = __rest(_a, ["className"]);
81
- return (react_1.default.createElement(CardAction_1.CardAction, __assign({ className: (0, classnames_1.default)(cardActionClassName, 'ffe-card__action', {
57
+ const PartialAppliedCardAction = (0, react_1.useCallback)(({ className: cardActionClassName, ...restCardAction }, cardActionRef) => {
58
+ return (react_1.default.createElement(CardAction_1.CardAction, { className: (0, classnames_1.default)(cardActionClassName, 'ffe-card__action', {
82
59
  'ffe-card__action--raw': !cardActionClassName,
83
60
  }), ref: cardActionRef
84
61
  ? (0, mergeRefs_1.mergeRefs)([cardActionRef, cardActionInnerRef])
85
- : cardActionInnerRef }, restCardAction)));
62
+ : cardActionInnerRef, ...restCardAction }));
86
63
  }, []);
87
- return (react_1.default.createElement(Comp, __assign({}, rest, { className: (0, classnames_1.default)(className, isUsingCardAction && "".concat(baseClassName, "--clickable")), onClick: function (e) {
64
+ return (react_1.default.createElement(Comp, { ...rest, className: (0, classnames_1.default)(className, isUsingCardAction && `${baseClassName}--clickable`), onClick: (e) => {
88
65
  var _a, _b, _c;
89
- var hasSelectedText = !!((_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.toString().length);
66
+ const hasSelectedText = !!((_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.toString().length);
90
67
  if (!hasSelectedText &&
91
68
  !((_b = cardActionInnerRef.current) === null || _b === void 0 ? void 0 : _b.contains(e.target))) {
92
69
  (_c = cardActionInnerRef.current) === null || _c === void 0 ? void 0 : _c.click();
93
70
  }
94
71
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
95
- }, ref: ref }), children({
72
+ }, ref: ref }, children({
96
73
  CardAction: (0, fixedForwardRef_1.fixedForwardRef)(PartialAppliedCardAction),
97
74
  })));
98
75
  }
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fixedForwardRef = void 0;
4
- var react_1 = require("react");
4
+ const react_1 = require("react");
5
5
  exports.fixedForwardRef = react_1.forwardRef;
package/lib/mergeRefs.js CHANGED
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mergeRefs = mergeRefs;
4
4
  function mergeRefs(refs) {
5
- return function (value) {
6
- refs.forEach(function (ref) {
5
+ return value => {
6
+ refs.forEach(ref => {
7
7
  if (typeof ref === 'function') {
8
8
  ref(value);
9
9
  }