@sb1/ffe-cards-react 17.1.8 → 17.3.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.
- package/es/IconCard/IconCard.js +17 -13
- package/es/IllustrationCard/IllustrationCard.js +19 -13
- package/lib/IconCard/IconCard.js +17 -13
- package/lib/IllustrationCard/IllustrationCard.js +19 -13
- package/package.json +3 -3
- package/types/IconCard/IconCard.d.ts +4 -0
- package/types/IllustrationCard/IllustrationCard.d.ts +4 -0
package/es/IconCard/IconCard.js
CHANGED
|
@@ -25,20 +25,24 @@ import classNames from 'classnames';
|
|
|
25
25
|
import { WithCardAction, Text, Subtext, Title, CardName } from '../components';
|
|
26
26
|
import { fixedForwardRef } from '../fixedForwardRef';
|
|
27
27
|
function IconCardWithForwardRef(props, ref) {
|
|
28
|
-
var className = props.className, condensed = props.condensed, icon = props.icon, children = props.children, rest = __rest(props, ["className", "condensed", "icon", "children"]);
|
|
29
|
-
return (React.createElement(WithCardAction, __assign({ baseClassName: "ffe-icon-card", className: classNames('ffe-icon-card', { 'ffe-icon-card--condensed': condensed }, className) }, rest, { ref: ref }), function (_a) {
|
|
28
|
+
var className = props.className, condensed = props.condensed, icon = props.icon, children = props.children, iconPosition = props.iconPosition, rest = __rest(props, ["className", "condensed", "icon", "children", "iconPosition"]);
|
|
29
|
+
return (React.createElement(WithCardAction, __assign({ baseClassName: "ffe-icon-card", className: classNames('ffe-icon-card', { 'ffe-icon-card--condensed': condensed }, { 'ffe-icon-card--right': iconPosition === 'right' }, className) }, rest, { ref: ref }), function (_a) {
|
|
30
30
|
var CardAction = _a.CardAction;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
var bodyElement = (React.createElement("div", { className: "ffe-icon-card__body" }, typeof children === 'function'
|
|
32
|
+
? children({
|
|
33
|
+
Text: Text,
|
|
34
|
+
Subtext: Subtext,
|
|
35
|
+
Title: Title,
|
|
36
|
+
CardName: CardName,
|
|
37
|
+
CardAction: CardAction,
|
|
38
|
+
})
|
|
39
|
+
: children));
|
|
40
|
+
var iconElement = React.cloneElement(icon, __assign(__assign({}, icon.props), { className: classNames('ffe-icon-card__icon', icon.props.className) }));
|
|
41
|
+
return iconPosition === 'right' ? (React.createElement(React.Fragment, null,
|
|
42
|
+
bodyElement,
|
|
43
|
+
iconElement)) : (React.createElement(React.Fragment, null,
|
|
44
|
+
iconElement,
|
|
45
|
+
bodyElement));
|
|
42
46
|
}));
|
|
43
47
|
}
|
|
44
48
|
export var IconCard = fixedForwardRef(IconCardWithForwardRef);
|
|
@@ -25,20 +25,26 @@ import classNames from 'classnames';
|
|
|
25
25
|
import { WithCardAction, Text, Subtext, Title, CardName } from '../components';
|
|
26
26
|
import { fixedForwardRef } from '../fixedForwardRef';
|
|
27
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({ baseClassName: "ffe-illustration-card", className: classNames('ffe-illustration-card', { 'ffe-illustration-card--condensed': condensed },
|
|
28
|
+
var className = props.className, condensed = props.condensed, img = props.img, illustrationPosition = props.illustrationPosition, children = props.children, rest = __rest(props, ["className", "condensed", "img", "illustrationPosition", "children"]);
|
|
29
|
+
return (React.createElement(WithCardAction, __assign({ baseClassName: "ffe-illustration-card", className: classNames('ffe-illustration-card', { 'ffe-illustration-card--condensed': condensed }, {
|
|
30
|
+
'ffe-illustration-card--right': illustrationPosition === 'right',
|
|
31
|
+
}, className) }, rest, { ref: ref }), function (_a) {
|
|
30
32
|
var CardAction = _a.CardAction;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
var illustrationElement = (React.createElement("div", { className: classNames('ffe-illustration-card__illustration') }, img));
|
|
34
|
+
var bodyElement = (React.createElement("div", { className: "ffe-illustration-card__body" }, typeof children === 'function'
|
|
35
|
+
? children({
|
|
36
|
+
Text: Text,
|
|
37
|
+
Subtext: Subtext,
|
|
38
|
+
Title: Title,
|
|
39
|
+
CardName: CardName,
|
|
40
|
+
CardAction: CardAction,
|
|
41
|
+
})
|
|
42
|
+
: children));
|
|
43
|
+
return illustrationPosition === 'right' ? (React.createElement(React.Fragment, null,
|
|
44
|
+
bodyElement,
|
|
45
|
+
illustrationElement)) : (React.createElement(React.Fragment, null,
|
|
46
|
+
illustrationElement,
|
|
47
|
+
bodyElement));
|
|
42
48
|
}));
|
|
43
49
|
}
|
|
44
50
|
export var IllustrationCard = fixedForwardRef(IllustrationCardWithForwardRef);
|
package/lib/IconCard/IconCard.js
CHANGED
|
@@ -31,20 +31,24 @@ var classnames_1 = __importDefault(require("classnames"));
|
|
|
31
31
|
var components_1 = require("../components");
|
|
32
32
|
var fixedForwardRef_1 = require("../fixedForwardRef");
|
|
33
33
|
function IconCardWithForwardRef(props, ref) {
|
|
34
|
-
var className = props.className, condensed = props.condensed, icon = props.icon, children = props.children, rest = __rest(props, ["className", "condensed", "icon", "children"]);
|
|
35
|
-
return (react_1.default.createElement(components_1.WithCardAction, __assign({ baseClassName: "ffe-icon-card", className: (0, classnames_1.default)('ffe-icon-card', { 'ffe-icon-card--condensed': condensed }, className) }, rest, { ref: ref }), function (_a) {
|
|
34
|
+
var className = props.className, condensed = props.condensed, icon = props.icon, children = props.children, iconPosition = props.iconPosition, rest = __rest(props, ["className", "condensed", "icon", "children", "iconPosition"]);
|
|
35
|
+
return (react_1.default.createElement(components_1.WithCardAction, __assign({ baseClassName: "ffe-icon-card", className: (0, classnames_1.default)('ffe-icon-card', { 'ffe-icon-card--condensed': condensed }, { 'ffe-icon-card--right': iconPosition === 'right' }, className) }, rest, { ref: ref }), function (_a) {
|
|
36
36
|
var CardAction = _a.CardAction;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
var bodyElement = (react_1.default.createElement("div", { className: "ffe-icon-card__body" }, typeof children === 'function'
|
|
38
|
+
? children({
|
|
39
|
+
Text: components_1.Text,
|
|
40
|
+
Subtext: components_1.Subtext,
|
|
41
|
+
Title: components_1.Title,
|
|
42
|
+
CardName: components_1.CardName,
|
|
43
|
+
CardAction: CardAction,
|
|
44
|
+
})
|
|
45
|
+
: children));
|
|
46
|
+
var iconElement = react_1.default.cloneElement(icon, __assign(__assign({}, icon.props), { className: (0, classnames_1.default)('ffe-icon-card__icon', icon.props.className) }));
|
|
47
|
+
return iconPosition === 'right' ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
48
|
+
bodyElement,
|
|
49
|
+
iconElement)) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
50
|
+
iconElement,
|
|
51
|
+
bodyElement));
|
|
48
52
|
}));
|
|
49
53
|
}
|
|
50
54
|
exports.IconCard = (0, fixedForwardRef_1.fixedForwardRef)(IconCardWithForwardRef);
|
|
@@ -31,20 +31,26 @@ var classnames_1 = __importDefault(require("classnames"));
|
|
|
31
31
|
var components_1 = require("../components");
|
|
32
32
|
var fixedForwardRef_1 = require("../fixedForwardRef");
|
|
33
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({ baseClassName: "ffe-illustration-card", className: (0, classnames_1.default)('ffe-illustration-card', { 'ffe-illustration-card--condensed': condensed },
|
|
34
|
+
var className = props.className, condensed = props.condensed, img = props.img, illustrationPosition = props.illustrationPosition, children = props.children, rest = __rest(props, ["className", "condensed", "img", "illustrationPosition", "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 }, {
|
|
36
|
+
'ffe-illustration-card--right': illustrationPosition === 'right',
|
|
37
|
+
}, className) }, rest, { ref: ref }), function (_a) {
|
|
36
38
|
var CardAction = _a.CardAction;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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'
|
|
41
|
+
? children({
|
|
42
|
+
Text: components_1.Text,
|
|
43
|
+
Subtext: components_1.Subtext,
|
|
44
|
+
Title: components_1.Title,
|
|
45
|
+
CardName: components_1.CardName,
|
|
46
|
+
CardAction: CardAction,
|
|
47
|
+
})
|
|
48
|
+
: children));
|
|
49
|
+
return illustrationPosition === 'right' ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
50
|
+
bodyElement,
|
|
51
|
+
illustrationElement)) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
52
|
+
illustrationElement,
|
|
53
|
+
bodyElement));
|
|
48
54
|
}));
|
|
49
55
|
}
|
|
50
56
|
exports.IllustrationCard = (0, fixedForwardRef_1.fixedForwardRef)(IllustrationCardWithForwardRef);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-cards-react",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.3.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.
|
|
29
|
+
"@sb1/ffe-cards": "^19.4.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@sb1/ffe-buildtool": "^0.7.1",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "781eac1e0f317aee3d93b69039b91d866602a0db"
|
|
44
44
|
}
|
|
@@ -5,6 +5,8 @@ export type IconCardProps<As extends ElementType = 'div'> = Omit<ComponentAsProp
|
|
|
5
5
|
icon: ReactElement;
|
|
6
6
|
/** Smaller icon and less space */
|
|
7
7
|
condensed?: boolean;
|
|
8
|
+
/** Position icon at left (default) or right of the card content */
|
|
9
|
+
iconPosition?: 'right' | 'left';
|
|
8
10
|
children: React.ReactNode | ((cardRenderProps: CardRenderProps) => React.ReactNode);
|
|
9
11
|
};
|
|
10
12
|
export declare const IconCard: <As extends ElementType>(props: Omit<ComponentAsPropParams<As>, "children"> & {
|
|
@@ -12,5 +14,7 @@ export declare const IconCard: <As extends ElementType>(props: Omit<ComponentAsP
|
|
|
12
14
|
icon: ReactElement;
|
|
13
15
|
/** Smaller icon and less space */
|
|
14
16
|
condensed?: boolean;
|
|
17
|
+
/** Position icon at left (default) or right of the card content */
|
|
18
|
+
iconPosition?: "right" | "left";
|
|
15
19
|
children: React.ReactNode | ((cardRenderProps: CardRenderProps) => React.ReactNode);
|
|
16
20
|
} & React.RefAttributes<any>) => React.JSX.Element;
|
|
@@ -5,6 +5,8 @@ export type IllustrationCardProps<As extends ElementType = 'div'> = Omit<Compone
|
|
|
5
5
|
img: ReactElement;
|
|
6
6
|
/** Smaller illustration and less space */
|
|
7
7
|
condensed?: boolean;
|
|
8
|
+
/** Position illustration at left (default) or right of the card content */
|
|
9
|
+
illustrationPosition?: 'right' | 'left';
|
|
8
10
|
children: React.ReactNode | ((cardRenderProps: CardRenderProps) => React.ReactNode);
|
|
9
11
|
};
|
|
10
12
|
export declare const IllustrationCard: <As extends ElementType>(props: Omit<ComponentAsPropParams<As>, "children"> & {
|
|
@@ -12,5 +14,7 @@ export declare const IllustrationCard: <As extends ElementType>(props: Omit<Comp
|
|
|
12
14
|
img: ReactElement;
|
|
13
15
|
/** Smaller illustration and less space */
|
|
14
16
|
condensed?: boolean;
|
|
17
|
+
/** Position illustration at left (default) or right of the card content */
|
|
18
|
+
illustrationPosition?: "right" | "left";
|
|
15
19
|
children: React.ReactNode | ((cardRenderProps: CardRenderProps) => React.ReactNode);
|
|
16
20
|
} & React.RefAttributes<any>) => React.JSX.Element;
|