@sb1/ffe-cards-react 16.1.2 → 16.2.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.
@@ -0,0 +1,44 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import React from 'react';
24
+ import classNames from 'classnames';
25
+ import { WithCardAction, Text, Subtext, Title, CardName } from '../components';
26
+ import { fixedForwardRef } from '../fixedForwardRef';
27
+ function IllustrationCardWithForwardRef(props, ref) {
28
+ var className = props.className, condensed = props.condensed, img = props.img, children = props.children, rest = __rest(props, ["className", "condensed", "img", "children"]);
29
+ return (React.createElement(WithCardAction, __assign({ className: classNames('ffe-illustration-card', { 'ffe-illustration-card--condensed': condensed }, className) }, rest, { ref: ref }), function (_a) {
30
+ var CardAction = _a.CardAction;
31
+ return (React.createElement(React.Fragment, null,
32
+ React.createElement("div", { className: classNames('ffe-illustration-card__illustration') }, img),
33
+ React.createElement("div", { className: "ffe-illustration-card__body" }, typeof children === 'function'
34
+ ? children({
35
+ Text: Text,
36
+ Subtext: Subtext,
37
+ Title: Title,
38
+ CardName: CardName,
39
+ CardAction: CardAction,
40
+ })
41
+ : children)));
42
+ }));
43
+ }
44
+ export var IllustrationCard = fixedForwardRef(IllustrationCardWithForwardRef);
package/es/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { CardBase } from './CardBase';
2
2
  export { TextCard } from './TextCard/TextCard';
3
3
  export { IconCard } from './IconCard/IconCard';
4
+ export { IllustrationCard, } from './IllustrationCard/IllustrationCard';
4
5
  export { ImageCard } from './ImageCard/ImageCard';
5
6
  export { StippledCard } from './StippledCard/StippledCard';
@@ -0,0 +1,50 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ 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");
33
+ function IllustrationCardWithForwardRef(props, ref) {
34
+ var className = props.className, condensed = props.condensed, img = props.img, children = props.children, rest = __rest(props, ["className", "condensed", "img", "children"]);
35
+ return (react_1.default.createElement(components_1.WithCardAction, __assign({ className: (0, classnames_1.default)('ffe-illustration-card', { 'ffe-illustration-card--condensed': condensed }, className) }, rest, { ref: ref }), function (_a) {
36
+ var CardAction = _a.CardAction;
37
+ return (react_1.default.createElement(react_1.default.Fragment, null,
38
+ react_1.default.createElement("div", { className: (0, classnames_1.default)('ffe-illustration-card__illustration') }, img),
39
+ react_1.default.createElement("div", { className: "ffe-illustration-card__body" }, typeof children === 'function'
40
+ ? children({
41
+ Text: components_1.Text,
42
+ Subtext: components_1.Subtext,
43
+ Title: components_1.Title,
44
+ CardName: components_1.CardName,
45
+ CardAction: CardAction,
46
+ })
47
+ : children)));
48
+ }));
49
+ }
50
+ exports.IllustrationCard = (0, fixedForwardRef_1.fixedForwardRef)(IllustrationCardWithForwardRef);
package/lib/index.js CHANGED
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StippledCard = exports.ImageCard = exports.IconCard = exports.TextCard = exports.CardBase = void 0;
3
+ exports.StippledCard = exports.ImageCard = exports.IllustrationCard = exports.IconCard = exports.TextCard = exports.CardBase = void 0;
4
4
  var CardBase_1 = require("./CardBase");
5
5
  Object.defineProperty(exports, "CardBase", { enumerable: true, get: function () { return CardBase_1.CardBase; } });
6
6
  var TextCard_1 = require("./TextCard/TextCard");
7
7
  Object.defineProperty(exports, "TextCard", { enumerable: true, get: function () { return TextCard_1.TextCard; } });
8
8
  var IconCard_1 = require("./IconCard/IconCard");
9
9
  Object.defineProperty(exports, "IconCard", { enumerable: true, get: function () { return IconCard_1.IconCard; } });
10
+ var IllustrationCard_1 = require("./IllustrationCard/IllustrationCard");
11
+ Object.defineProperty(exports, "IllustrationCard", { enumerable: true, get: function () { return IllustrationCard_1.IllustrationCard; } });
10
12
  var ImageCard_1 = require("./ImageCard/ImageCard");
11
13
  Object.defineProperty(exports, "ImageCard", { enumerable: true, get: function () { return ImageCard_1.ImageCard; } });
12
14
  var StippledCard_1 = require("./StippledCard/StippledCard");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-cards-react",
3
- "version": "16.1.2",
3
+ "version": "16.2.0",
4
4
  "description": "React implementation of ffe-react",
5
5
  "license": "MIT",
6
6
  "author": "SpareBank 1",
@@ -26,7 +26,7 @@
26
26
  "test:watch": "ffe-buildtool jest --watch"
27
27
  },
28
28
  "dependencies": {
29
- "@sb1/ffe-cards": "^19.0.1"
29
+ "@sb1/ffe-cards": "^19.1.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@sb1/ffe-buildtool": "^0.6.4",
@@ -40,5 +40,5 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "53ab99e3064a4f4db22861457bfa5af5322058ab"
43
+ "gitHead": "5a3e9e42efa757cd3daf0b5c416f418d8d3037a0"
44
44
  }
@@ -0,0 +1,16 @@
1
+ import React, { ElementType, ReactElement } from 'react';
2
+ import { CardRenderProps, ComponentAsPropParams } from '../types';
3
+ export type IllustrationCardProps<As extends ElementType = 'div'> = Omit<ComponentAsPropParams<As>, 'children'> & {
4
+ /** Element of illustration */
5
+ img: ReactElement;
6
+ /** Smaller illustration and less space */
7
+ condensed?: boolean;
8
+ children: React.ReactNode | ((cardRenderProps: CardRenderProps) => React.ReactNode);
9
+ };
10
+ export declare const IllustrationCard: <As extends ElementType>(props: Omit<ComponentAsPropParams<As>, "children"> & {
11
+ /** Element of illustration */
12
+ img: ReactElement;
13
+ /** Smaller illustration and less space */
14
+ condensed?: boolean;
15
+ children: React.ReactNode | ((cardRenderProps: CardRenderProps) => React.ReactNode);
16
+ } & React.RefAttributes<any>) => React.JSX.Element;
package/types/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { CardBase, CardBaseProps } from './CardBase';
2
2
  export { TextCard, TextCardProps } from './TextCard/TextCard';
3
3
  export { IconCard, IconCardProps } from './IconCard/IconCard';
4
+ export { IllustrationCard, IllustrationCardProps, } from './IllustrationCard/IllustrationCard';
4
5
  export { ImageCard, ImageCardProps } from './ImageCard/ImageCard';
5
6
  export { StippledCard, StippledCardProps } from './StippledCard/StippledCard';