@sb1/ffe-cards-react 17.1.8 → 17.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.
package/es/IconCard/IconCard.js
CHANGED
|
@@ -25,12 +25,12 @@ 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
|
-
React.cloneElement(icon, __assign(__assign({}, icon.props), { className: classNames('ffe-icon-card__icon', icon.props.className) })),
|
|
33
|
-
React.createElement("div", { className: "ffe-icon-card__body" }, typeof children === 'function'
|
|
31
|
+
var content = [
|
|
32
|
+
React.cloneElement(icon, __assign(__assign({}, icon.props), { key: 'icon', className: classNames('ffe-icon-card__icon', icon.props.className) })),
|
|
33
|
+
React.createElement("div", { className: "ffe-icon-card__body", key: "body" }, typeof children === 'function'
|
|
34
34
|
? children({
|
|
35
35
|
Text: Text,
|
|
36
36
|
Subtext: Subtext,
|
|
@@ -38,7 +38,9 @@ function IconCardWithForwardRef(props, ref) {
|
|
|
38
38
|
CardName: CardName,
|
|
39
39
|
CardAction: CardAction,
|
|
40
40
|
})
|
|
41
|
-
: children)
|
|
41
|
+
: children),
|
|
42
|
+
];
|
|
43
|
+
return (React.createElement(React.Fragment, null, iconPosition === 'right' ? content.reverse() : content));
|
|
42
44
|
}));
|
|
43
45
|
}
|
|
44
46
|
export var IconCard = fixedForwardRef(IconCardWithForwardRef);
|
package/lib/IconCard/IconCard.js
CHANGED
|
@@ -31,12 +31,12 @@ 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
|
-
react_1.default.cloneElement(icon, __assign(__assign({}, icon.props), { className: (0, classnames_1.default)('ffe-icon-card__icon', icon.props.className) })),
|
|
39
|
-
react_1.default.createElement("div", { className: "ffe-icon-card__body" }, typeof children === 'function'
|
|
37
|
+
var content = [
|
|
38
|
+
react_1.default.cloneElement(icon, __assign(__assign({}, icon.props), { key: 'icon', className: (0, classnames_1.default)('ffe-icon-card__icon', icon.props.className) })),
|
|
39
|
+
react_1.default.createElement("div", { className: "ffe-icon-card__body", key: "body" }, typeof children === 'function'
|
|
40
40
|
? children({
|
|
41
41
|
Text: components_1.Text,
|
|
42
42
|
Subtext: components_1.Subtext,
|
|
@@ -44,7 +44,9 @@ function IconCardWithForwardRef(props, ref) {
|
|
|
44
44
|
CardName: components_1.CardName,
|
|
45
45
|
CardAction: CardAction,
|
|
46
46
|
})
|
|
47
|
-
: children)
|
|
47
|
+
: children),
|
|
48
|
+
];
|
|
49
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, iconPosition === 'right' ? content.reverse() : content));
|
|
48
50
|
}));
|
|
49
51
|
}
|
|
50
52
|
exports.IconCard = (0, fixedForwardRef_1.fixedForwardRef)(IconCardWithForwardRef);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-cards-react",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.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.
|
|
29
|
+
"@sb1/ffe-cards": "^19.3.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": "971eab5ac865d8b368dc44b78781c2a6d4e55e78"
|
|
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;
|