@sb1/ffe-cards-react 15.2.6 → 16.1.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/CardBase.js +11 -5
- package/es/IconCard/IconCard.js +18 -8
- package/es/ImageCard/ImageCard.js +20 -10
- package/es/StippledCard/StippledCard.js +20 -10
- package/es/TextCard/TextCard.js +10 -6
- package/es/components/CardAction.js +29 -0
- package/es/components/WithCardAction.js +49 -0
- package/es/components/index.js +2 -0
- package/es/mergeRefs.js +13 -0
- package/lib/CardBase.js +11 -5
- package/lib/IconCard/IconCard.js +17 -7
- package/lib/ImageCard/ImageCard.js +19 -9
- package/lib/StippledCard/StippledCard.js +19 -9
- package/lib/TextCard/TextCard.js +9 -5
- package/lib/components/CardAction.js +35 -0
- package/lib/components/WithCardAction.js +78 -0
- package/lib/components/index.js +5 -1
- package/lib/mergeRefs.js +17 -0
- package/package.json +5 -5
- package/types/CardBase.d.ts +5 -8
- package/types/IconCard/IconCard.d.ts +2 -2
- package/types/ImageCard/ImageCard.d.ts +2 -2
- package/types/StippledCard/StippledCard.d.ts +2 -2
- package/types/TextCard/TextCard.d.ts +2 -2
- package/types/components/CardAction.d.ts +8 -0
- package/types/components/WithCardAction.d.ts +13 -0
- package/types/components/index.d.ts +2 -0
- package/types/mergeRefs.d.ts +2 -0
- package/types/types.d.ts +7 -6
package/es/CardBase.js
CHANGED
|
@@ -21,19 +21,25 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import React from 'react';
|
|
24
|
-
import { fixedForwardRef } from './fixedForwardRef';
|
|
25
24
|
import classNames from 'classnames';
|
|
25
|
+
import { WithCardAction } from './components';
|
|
26
|
+
import { fixedForwardRef } from './fixedForwardRef';
|
|
26
27
|
function CardBaseWithForwardRef(props, ref) {
|
|
27
28
|
var _a;
|
|
28
|
-
var
|
|
29
|
-
|
|
29
|
+
var className = props.className, shadow = props.shadow, noMargin = props.noMargin, textCenter = props.textCenter, bgColor = props.bgColor, bgDarkmodeColor = props.bgDarkmodeColor, noPadding = props.noPadding, children = props.children, rest = __rest(props, ["className", "shadow", "noMargin", "textCenter", "bgColor", "bgDarkmodeColor", "noPadding", "children"]);
|
|
30
|
+
var withCardActionProps = __assign({}, rest);
|
|
31
|
+
return (React.createElement(WithCardAction, __assign({ className: classNames('ffe-card-base', className, (_a = {},
|
|
30
32
|
_a["ffe-card-base--bg-".concat(bgColor)] = bgColor,
|
|
31
33
|
_a["ffe-card-base--dm-bg-".concat(bgDarkmodeColor)] = bgDarkmodeColor,
|
|
32
34
|
_a['ffe-card-base--box-shadow'] = shadow,
|
|
33
35
|
_a['ffe-card-base--no-margin'] = noMargin,
|
|
34
36
|
_a['ffe-card-base--text-center'] = textCenter,
|
|
35
37
|
_a['ffe-card-base--no-padding'] = noPadding,
|
|
36
|
-
_a
|
|
37
|
-
|
|
38
|
+
_a)) }, withCardActionProps, { ref: ref }), function (_a) {
|
|
39
|
+
var CardAction = _a.CardAction;
|
|
40
|
+
return typeof children === 'function'
|
|
41
|
+
? children({ CardAction: CardAction })
|
|
42
|
+
: children;
|
|
43
|
+
}));
|
|
38
44
|
}
|
|
39
45
|
export var CardBase = fixedForwardRef(CardBaseWithForwardRef);
|
package/es/IconCard/IconCard.js
CHANGED
|
@@ -21,15 +21,25 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import React from 'react';
|
|
24
|
-
import { fixedForwardRef } from '../fixedForwardRef';
|
|
25
24
|
import classNames from 'classnames';
|
|
26
|
-
import { Text, Subtext, Title, CardName } from '../components';
|
|
25
|
+
import { WithCardAction, Text, Subtext, Title, CardName } from '../components';
|
|
26
|
+
import { fixedForwardRef } from '../fixedForwardRef';
|
|
27
27
|
function IconCardWithForwardRef(props, ref) {
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
:
|
|
28
|
+
var className = props.className, condensed = props.condensed, icon = props.icon, children = props.children, rest = __rest(props, ["className", "condensed", "icon", "children"]);
|
|
29
|
+
var withCardActionProps = __assign({}, rest);
|
|
30
|
+
return (React.createElement(WithCardAction, __assign({ className: classNames('ffe-icon-card', { 'ffe-icon-card--condensed': condensed }, className) }, withCardActionProps, { ref: ref }), function (_a) {
|
|
31
|
+
var CardAction = _a.CardAction;
|
|
32
|
+
return (React.createElement(React.Fragment, null,
|
|
33
|
+
React.cloneElement(icon, __assign(__assign({}, icon.props), { className: classNames('ffe-icon-card__icon', icon.props.className) })),
|
|
34
|
+
React.createElement("div", { className: "ffe-icon-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
|
+
}));
|
|
34
44
|
}
|
|
35
45
|
export var IconCard = fixedForwardRef(IconCardWithForwardRef);
|
|
@@ -21,17 +21,27 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import React from 'react';
|
|
24
|
-
import { fixedForwardRef } from '../fixedForwardRef';
|
|
25
24
|
import classNames from 'classnames';
|
|
26
|
-
import {
|
|
25
|
+
import { CardName, Subtext, Text, Title, WithCardAction } from '../components';
|
|
26
|
+
import { fixedForwardRef } from '../fixedForwardRef';
|
|
27
27
|
function ImageCardWithForwardRef(props, ref) {
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
var className = props.className, imageSrc = props.imageSrc, imageAltText = props.imageAltText, children = props.children, rest = __rest(props, ["className", "imageSrc", "imageAltText", "children"]);
|
|
29
|
+
var withCardActionProps = __assign({}, rest);
|
|
30
|
+
return (React.createElement(WithCardAction, __assign({ className: classNames('ffe-image-card', className) }, withCardActionProps, { ref: ref }), function (_a) {
|
|
31
|
+
var CardAction = _a.CardAction;
|
|
32
|
+
return (React.createElement(React.Fragment, null,
|
|
33
|
+
React.createElement("div", { className: "ffe-image-card__image-container" },
|
|
34
|
+
React.createElement("div", { className: "ffe-image-card__image-overlay" }),
|
|
35
|
+
React.createElement("img", { src: imageSrc, alt: imageAltText, className: "ffe-image-card__image" })),
|
|
36
|
+
React.createElement("div", { className: "ffe-image-card__body" }, typeof children === 'function'
|
|
37
|
+
? children({
|
|
38
|
+
Text: Text,
|
|
39
|
+
Subtext: Subtext,
|
|
40
|
+
Title: Title,
|
|
41
|
+
CardName: CardName,
|
|
42
|
+
CardAction: CardAction,
|
|
43
|
+
})
|
|
44
|
+
: children)));
|
|
45
|
+
}));
|
|
36
46
|
}
|
|
37
47
|
export var ImageCard = fixedForwardRef(ImageCardWithForwardRef);
|
|
@@ -21,17 +21,27 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import React from 'react';
|
|
24
|
-
import { fixedForwardRef } from '../fixedForwardRef';
|
|
25
24
|
import classNames from 'classnames';
|
|
26
|
-
import {
|
|
25
|
+
import { CardName, Subtext, Text, Title, WithCardAction } from '../components';
|
|
26
|
+
import { fixedForwardRef } from '../fixedForwardRef';
|
|
27
27
|
function StippledCardWithForwardRef(props, ref) {
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
var className = props.className, condensed = props.condensed, img = props.img, children = props.children, rest = __rest(props, ["className", "condensed", "img", "children"]);
|
|
29
|
+
var withCardActionProps = __assign({}, rest);
|
|
30
|
+
return (React.createElement(WithCardAction, __assign({ className: classNames('ffe-stippled-card', { 'ffe-stippled-card--condensed': condensed }, className) }, withCardActionProps, { ref: ref }), function (_a) {
|
|
31
|
+
var CardAction = _a.CardAction;
|
|
32
|
+
return (React.createElement(React.Fragment, null,
|
|
33
|
+
React.createElement("div", { className: classNames('ffe-stippled-card__img', {
|
|
34
|
+
'ffe-stippled-card__img--icon': (img === null || img === void 0 ? void 0 : img.type) === 'icon',
|
|
35
|
+
}), "aria-hidden": (img === null || img === void 0 ? void 0 : img.type) === 'icon' }, img === null || img === void 0 ? void 0 : img.element),
|
|
36
|
+
React.createElement("div", null, typeof children === 'function'
|
|
37
|
+
? children({
|
|
38
|
+
CardName: CardName,
|
|
39
|
+
Title: Title,
|
|
40
|
+
Text: Text,
|
|
41
|
+
Subtext: Subtext,
|
|
42
|
+
CardAction: CardAction,
|
|
43
|
+
})
|
|
44
|
+
: children)));
|
|
45
|
+
}));
|
|
36
46
|
}
|
|
37
47
|
export var StippledCard = fixedForwardRef(StippledCardWithForwardRef);
|
package/es/TextCard/TextCard.js
CHANGED
|
@@ -21,13 +21,17 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import React from 'react';
|
|
24
|
-
import { fixedForwardRef } from '../fixedForwardRef';
|
|
25
24
|
import classNames from 'classnames';
|
|
26
|
-
import {
|
|
25
|
+
import { CardName, Subtext, Text, Title, WithCardAction } from '../components';
|
|
26
|
+
import { fixedForwardRef } from '../fixedForwardRef';
|
|
27
27
|
function TextCardWithForwardRef(props, ref) {
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
var className = props.className, leftAlign = props.leftAlign, children = props.children, rest = __rest(props, ["className", "leftAlign", "children"]);
|
|
29
|
+
var withCardActionProps = __assign({}, rest);
|
|
30
|
+
return (React.createElement(WithCardAction, __assign({ className: classNames('ffe-text-card', { 'ffe-text-card--left-align': leftAlign }, className) }, withCardActionProps, { ref: ref }), function (_a) {
|
|
31
|
+
var CardAction = _a.CardAction;
|
|
32
|
+
return typeof children === 'function'
|
|
33
|
+
? children({ Text: Text, Subtext: Subtext, Title: Title, CardName: CardName, CardAction: CardAction })
|
|
34
|
+
: children;
|
|
35
|
+
}));
|
|
32
36
|
}
|
|
33
37
|
export var TextCard = fixedForwardRef(TextCardWithForwardRef);
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { fixedForwardRef } from '../fixedForwardRef';
|
|
25
|
+
function CardActionWithRef(props, ref) {
|
|
26
|
+
var _a = props.as, Comp = _a === void 0 ? 'a' : _a, rest = __rest(props, ["as"]);
|
|
27
|
+
return React.createElement(Comp, __assign({}, rest, { ref: ref }));
|
|
28
|
+
}
|
|
29
|
+
export var CardAction = fixedForwardRef(CardActionWithRef);
|
|
@@ -0,0 +1,49 @@
|
|
|
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, { useCallback, useRef } from 'react';
|
|
24
|
+
import classNames from 'classnames';
|
|
25
|
+
import { mergeRefs } from '../mergeRefs';
|
|
26
|
+
import { CardAction } from './CardAction';
|
|
27
|
+
import { fixedForwardRef } from '../fixedForwardRef';
|
|
28
|
+
function WithCardActionForwardRef(props, ref) {
|
|
29
|
+
var children = props.children, _a = props.as, Comp = _a === void 0 ? 'div' : _a, onClick = props.onClick, rest = __rest(props, ["children", "as", "onClick"]);
|
|
30
|
+
var actionInnerRef = useRef(null);
|
|
31
|
+
var PartialAppliedCardAction = useCallback(function (_a, actionRef) {
|
|
32
|
+
var className = _a.className, restCardAction = __rest(_a, ["className"]);
|
|
33
|
+
return (React.createElement(CardAction, __assign({ className: classNames(className, 'ffe-card__action', {
|
|
34
|
+
'ffe-card__action--raw': !className,
|
|
35
|
+
}), ref: actionRef
|
|
36
|
+
? mergeRefs([actionRef, actionInnerRef])
|
|
37
|
+
: actionInnerRef }, restCardAction)));
|
|
38
|
+
}, []);
|
|
39
|
+
return (React.createElement(Comp, __assign({}, rest, { onClick: function (e) {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
if (!((_a = actionInnerRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
42
|
+
(_b = actionInnerRef.current) === null || _b === void 0 ? void 0 : _b.click();
|
|
43
|
+
}
|
|
44
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
45
|
+
}, ref: ref }), children({
|
|
46
|
+
CardAction: fixedForwardRef(PartialAppliedCardAction),
|
|
47
|
+
})));
|
|
48
|
+
}
|
|
49
|
+
export var WithCardAction = fixedForwardRef(WithCardActionForwardRef);
|
package/es/components/index.js
CHANGED
package/es/mergeRefs.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function mergeRefs(refs) {
|
|
2
|
+
return function (value) {
|
|
3
|
+
refs.forEach(function (ref) {
|
|
4
|
+
if (typeof ref === 'function') {
|
|
5
|
+
ref(value);
|
|
6
|
+
}
|
|
7
|
+
else if (ref != null) {
|
|
8
|
+
// eslint-disable-next-line no-param-reassign
|
|
9
|
+
ref.current = value;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
}
|
package/lib/CardBase.js
CHANGED
|
@@ -27,19 +27,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
exports.CardBase = void 0;
|
|
29
29
|
var react_1 = __importDefault(require("react"));
|
|
30
|
-
var fixedForwardRef_1 = require("./fixedForwardRef");
|
|
31
30
|
var classnames_1 = __importDefault(require("classnames"));
|
|
31
|
+
var components_1 = require("./components");
|
|
32
|
+
var fixedForwardRef_1 = require("./fixedForwardRef");
|
|
32
33
|
function CardBaseWithForwardRef(props, ref) {
|
|
33
34
|
var _a;
|
|
34
|
-
var
|
|
35
|
-
|
|
35
|
+
var className = props.className, shadow = props.shadow, noMargin = props.noMargin, textCenter = props.textCenter, bgColor = props.bgColor, bgDarkmodeColor = props.bgDarkmodeColor, noPadding = props.noPadding, children = props.children, rest = __rest(props, ["className", "shadow", "noMargin", "textCenter", "bgColor", "bgDarkmodeColor", "noPadding", "children"]);
|
|
36
|
+
var withCardActionProps = __assign({}, rest);
|
|
37
|
+
return (react_1.default.createElement(components_1.WithCardAction, __assign({ className: (0, classnames_1.default)('ffe-card-base', className, (_a = {},
|
|
36
38
|
_a["ffe-card-base--bg-".concat(bgColor)] = bgColor,
|
|
37
39
|
_a["ffe-card-base--dm-bg-".concat(bgDarkmodeColor)] = bgDarkmodeColor,
|
|
38
40
|
_a['ffe-card-base--box-shadow'] = shadow,
|
|
39
41
|
_a['ffe-card-base--no-margin'] = noMargin,
|
|
40
42
|
_a['ffe-card-base--text-center'] = textCenter,
|
|
41
43
|
_a['ffe-card-base--no-padding'] = noPadding,
|
|
42
|
-
_a
|
|
43
|
-
|
|
44
|
+
_a)) }, withCardActionProps, { ref: ref }), function (_a) {
|
|
45
|
+
var CardAction = _a.CardAction;
|
|
46
|
+
return typeof children === 'function'
|
|
47
|
+
? children({ CardAction: CardAction })
|
|
48
|
+
: children;
|
|
49
|
+
}));
|
|
44
50
|
}
|
|
45
51
|
exports.CardBase = (0, fixedForwardRef_1.fixedForwardRef)(CardBaseWithForwardRef);
|
package/lib/IconCard/IconCard.js
CHANGED
|
@@ -27,15 +27,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
exports.IconCard = void 0;
|
|
29
29
|
var react_1 = __importDefault(require("react"));
|
|
30
|
-
var fixedForwardRef_1 = require("../fixedForwardRef");
|
|
31
30
|
var classnames_1 = __importDefault(require("classnames"));
|
|
32
31
|
var components_1 = require("../components");
|
|
32
|
+
var fixedForwardRef_1 = require("../fixedForwardRef");
|
|
33
33
|
function IconCardWithForwardRef(props, ref) {
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
:
|
|
34
|
+
var className = props.className, condensed = props.condensed, icon = props.icon, children = props.children, rest = __rest(props, ["className", "condensed", "icon", "children"]);
|
|
35
|
+
var withCardActionProps = __assign({}, rest);
|
|
36
|
+
return (react_1.default.createElement(components_1.WithCardAction, __assign({ className: (0, classnames_1.default)('ffe-icon-card', { 'ffe-icon-card--condensed': condensed }, className) }, withCardActionProps, { ref: ref }), function (_a) {
|
|
37
|
+
var CardAction = _a.CardAction;
|
|
38
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
39
|
+
react_1.default.cloneElement(icon, __assign(__assign({}, icon.props), { className: (0, classnames_1.default)('ffe-icon-card__icon', icon.props.className) })),
|
|
40
|
+
react_1.default.createElement("div", { className: "ffe-icon-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
|
+
}));
|
|
40
50
|
}
|
|
41
51
|
exports.IconCard = (0, fixedForwardRef_1.fixedForwardRef)(IconCardWithForwardRef);
|
|
@@ -27,17 +27,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
exports.ImageCard = void 0;
|
|
29
29
|
var react_1 = __importDefault(require("react"));
|
|
30
|
-
var fixedForwardRef_1 = require("../fixedForwardRef");
|
|
31
30
|
var classnames_1 = __importDefault(require("classnames"));
|
|
32
31
|
var components_1 = require("../components");
|
|
32
|
+
var fixedForwardRef_1 = require("../fixedForwardRef");
|
|
33
33
|
function ImageCardWithForwardRef(props, ref) {
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
var className = props.className, imageSrc = props.imageSrc, imageAltText = props.imageAltText, children = props.children, rest = __rest(props, ["className", "imageSrc", "imageAltText", "children"]);
|
|
35
|
+
var withCardActionProps = __assign({}, rest);
|
|
36
|
+
return (react_1.default.createElement(components_1.WithCardAction, __assign({ className: (0, classnames_1.default)('ffe-image-card', className) }, withCardActionProps, { ref: ref }), function (_a) {
|
|
37
|
+
var CardAction = _a.CardAction;
|
|
38
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
39
|
+
react_1.default.createElement("div", { className: "ffe-image-card__image-container" },
|
|
40
|
+
react_1.default.createElement("div", { className: "ffe-image-card__image-overlay" }),
|
|
41
|
+
react_1.default.createElement("img", { src: imageSrc, alt: imageAltText, className: "ffe-image-card__image" })),
|
|
42
|
+
react_1.default.createElement("div", { className: "ffe-image-card__body" }, typeof children === 'function'
|
|
43
|
+
? children({
|
|
44
|
+
Text: components_1.Text,
|
|
45
|
+
Subtext: components_1.Subtext,
|
|
46
|
+
Title: components_1.Title,
|
|
47
|
+
CardName: components_1.CardName,
|
|
48
|
+
CardAction: CardAction,
|
|
49
|
+
})
|
|
50
|
+
: children)));
|
|
51
|
+
}));
|
|
42
52
|
}
|
|
43
53
|
exports.ImageCard = (0, fixedForwardRef_1.fixedForwardRef)(ImageCardWithForwardRef);
|
|
@@ -27,17 +27,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
exports.StippledCard = void 0;
|
|
29
29
|
var react_1 = __importDefault(require("react"));
|
|
30
|
-
var fixedForwardRef_1 = require("../fixedForwardRef");
|
|
31
30
|
var classnames_1 = __importDefault(require("classnames"));
|
|
32
31
|
var components_1 = require("../components");
|
|
32
|
+
var fixedForwardRef_1 = require("../fixedForwardRef");
|
|
33
33
|
function StippledCardWithForwardRef(props, ref) {
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
var className = props.className, condensed = props.condensed, img = props.img, children = props.children, rest = __rest(props, ["className", "condensed", "img", "children"]);
|
|
35
|
+
var withCardActionProps = __assign({}, rest);
|
|
36
|
+
return (react_1.default.createElement(components_1.WithCardAction, __assign({ className: (0, classnames_1.default)('ffe-stippled-card', { 'ffe-stippled-card--condensed': condensed }, className) }, withCardActionProps, { ref: ref }), function (_a) {
|
|
37
|
+
var CardAction = _a.CardAction;
|
|
38
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
39
|
+
react_1.default.createElement("div", { className: (0, classnames_1.default)('ffe-stippled-card__img', {
|
|
40
|
+
'ffe-stippled-card__img--icon': (img === null || img === void 0 ? void 0 : img.type) === 'icon',
|
|
41
|
+
}), "aria-hidden": (img === null || img === void 0 ? void 0 : img.type) === 'icon' }, img === null || img === void 0 ? void 0 : img.element),
|
|
42
|
+
react_1.default.createElement("div", null, typeof children === 'function'
|
|
43
|
+
? children({
|
|
44
|
+
CardName: components_1.CardName,
|
|
45
|
+
Title: components_1.Title,
|
|
46
|
+
Text: components_1.Text,
|
|
47
|
+
Subtext: components_1.Subtext,
|
|
48
|
+
CardAction: CardAction,
|
|
49
|
+
})
|
|
50
|
+
: children)));
|
|
51
|
+
}));
|
|
42
52
|
}
|
|
43
53
|
exports.StippledCard = (0, fixedForwardRef_1.fixedForwardRef)(StippledCardWithForwardRef);
|
package/lib/TextCard/TextCard.js
CHANGED
|
@@ -27,13 +27,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
exports.TextCard = void 0;
|
|
29
29
|
var react_1 = __importDefault(require("react"));
|
|
30
|
-
var fixedForwardRef_1 = require("../fixedForwardRef");
|
|
31
30
|
var classnames_1 = __importDefault(require("classnames"));
|
|
32
31
|
var components_1 = require("../components");
|
|
32
|
+
var fixedForwardRef_1 = require("../fixedForwardRef");
|
|
33
33
|
function TextCardWithForwardRef(props, ref) {
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
var className = props.className, leftAlign = props.leftAlign, children = props.children, rest = __rest(props, ["className", "leftAlign", "children"]);
|
|
35
|
+
var withCardActionProps = __assign({}, rest);
|
|
36
|
+
return (react_1.default.createElement(components_1.WithCardAction, __assign({ className: (0, classnames_1.default)('ffe-text-card', { 'ffe-text-card--left-align': leftAlign }, className) }, withCardActionProps, { ref: ref }), function (_a) {
|
|
37
|
+
var CardAction = _a.CardAction;
|
|
38
|
+
return typeof children === 'function'
|
|
39
|
+
? children({ Text: components_1.Text, Subtext: components_1.Subtext, Title: components_1.Title, CardName: components_1.CardName, CardAction: CardAction })
|
|
40
|
+
: children;
|
|
41
|
+
}));
|
|
38
42
|
}
|
|
39
43
|
exports.TextCard = (0, fixedForwardRef_1.fixedForwardRef)(TextCardWithForwardRef);
|
|
@@ -0,0 +1,35 @@
|
|
|
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.CardAction = void 0;
|
|
29
|
+
var react_1 = __importDefault(require("react"));
|
|
30
|
+
var fixedForwardRef_1 = require("../fixedForwardRef");
|
|
31
|
+
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 }));
|
|
34
|
+
}
|
|
35
|
+
exports.CardAction = (0, fixedForwardRef_1.fixedForwardRef)(CardActionWithRef);
|
|
@@ -0,0 +1,78 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
37
|
+
var t = {};
|
|
38
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
39
|
+
t[p] = s[p];
|
|
40
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
41
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
42
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
43
|
+
t[p[i]] = s[p[i]];
|
|
44
|
+
}
|
|
45
|
+
return t;
|
|
46
|
+
};
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.WithCardAction = void 0;
|
|
52
|
+
var react_1 = __importStar(require("react"));
|
|
53
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
54
|
+
var mergeRefs_1 = require("../mergeRefs");
|
|
55
|
+
var CardAction_1 = require("./CardAction");
|
|
56
|
+
var fixedForwardRef_1 = require("../fixedForwardRef");
|
|
57
|
+
function WithCardActionForwardRef(props, ref) {
|
|
58
|
+
var children = props.children, _a = props.as, Comp = _a === void 0 ? 'div' : _a, onClick = props.onClick, rest = __rest(props, ["children", "as", "onClick"]);
|
|
59
|
+
var actionInnerRef = (0, react_1.useRef)(null);
|
|
60
|
+
var PartialAppliedCardAction = (0, react_1.useCallback)(function (_a, actionRef) {
|
|
61
|
+
var className = _a.className, restCardAction = __rest(_a, ["className"]);
|
|
62
|
+
return (react_1.default.createElement(CardAction_1.CardAction, __assign({ className: (0, classnames_1.default)(className, 'ffe-card__action', {
|
|
63
|
+
'ffe-card__action--raw': !className,
|
|
64
|
+
}), ref: actionRef
|
|
65
|
+
? (0, mergeRefs_1.mergeRefs)([actionRef, actionInnerRef])
|
|
66
|
+
: actionInnerRef }, restCardAction)));
|
|
67
|
+
}, []);
|
|
68
|
+
return (react_1.default.createElement(Comp, __assign({}, rest, { onClick: function (e) {
|
|
69
|
+
var _a, _b;
|
|
70
|
+
if (!((_a = actionInnerRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
71
|
+
(_b = actionInnerRef.current) === null || _b === void 0 ? void 0 : _b.click();
|
|
72
|
+
}
|
|
73
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
74
|
+
}, ref: ref }), children({
|
|
75
|
+
CardAction: (0, fixedForwardRef_1.fixedForwardRef)(PartialAppliedCardAction),
|
|
76
|
+
})));
|
|
77
|
+
}
|
|
78
|
+
exports.WithCardAction = (0, fixedForwardRef_1.fixedForwardRef)(WithCardActionForwardRef);
|
package/lib/components/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Title = exports.Text = exports.Subtext = exports.CardName = void 0;
|
|
3
|
+
exports.CardAction = exports.WithCardAction = exports.Title = exports.Text = exports.Subtext = exports.CardName = void 0;
|
|
4
4
|
var CardName_1 = require("./CardName");
|
|
5
5
|
Object.defineProperty(exports, "CardName", { enumerable: true, get: function () { return CardName_1.CardName; } });
|
|
6
6
|
var Subtext_1 = require("./Subtext");
|
|
@@ -9,3 +9,7 @@ var Text_1 = require("./Text");
|
|
|
9
9
|
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return Text_1.Text; } });
|
|
10
10
|
var Title_1 = require("./Title");
|
|
11
11
|
Object.defineProperty(exports, "Title", { enumerable: true, get: function () { return Title_1.Title; } });
|
|
12
|
+
var WithCardAction_1 = require("./WithCardAction");
|
|
13
|
+
Object.defineProperty(exports, "WithCardAction", { enumerable: true, get: function () { return WithCardAction_1.WithCardAction; } });
|
|
14
|
+
var CardAction_1 = require("./CardAction");
|
|
15
|
+
Object.defineProperty(exports, "CardAction", { enumerable: true, get: function () { return CardAction_1.CardAction; } });
|
package/lib/mergeRefs.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeRefs = void 0;
|
|
4
|
+
function mergeRefs(refs) {
|
|
5
|
+
return function (value) {
|
|
6
|
+
refs.forEach(function (ref) {
|
|
7
|
+
if (typeof ref === 'function') {
|
|
8
|
+
ref(value);
|
|
9
|
+
}
|
|
10
|
+
else if (ref != null) {
|
|
11
|
+
// eslint-disable-next-line no-param-reassign
|
|
12
|
+
ref.current = value;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
exports.mergeRefs = mergeRefs;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-cards-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.1.0",
|
|
4
4
|
"description": "React implementation of ffe-react",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SpareBank 1",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"test:watch": "ffe-buildtool jest --watch"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@sb1/ffe-cards": "^
|
|
29
|
+
"@sb1/ffe-cards": "^19.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@sb1/ffe-buildtool": "^0.6.
|
|
33
|
-
"@sb1/ffe-icons-react": "^10.0.
|
|
32
|
+
"@sb1/ffe-buildtool": "^0.6.4",
|
|
33
|
+
"@sb1/ffe-icons-react": "^10.0.5",
|
|
34
34
|
"react": "^16.9.0",
|
|
35
35
|
"react-dom": "^16.9.0"
|
|
36
36
|
},
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "05bff605c7ba31315c43502a94476248b5d1186d"
|
|
44
44
|
}
|
package/types/CardBase.d.ts
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import React, { ElementType } from 'react';
|
|
2
|
+
import { WithCardActionProps } from './components';
|
|
2
3
|
import { ComponentAsPropParams } from './types';
|
|
3
4
|
type BgColor = 'sand-30' | 'sand-70' | 'frost-30' | 'syrin-30' | 'syrin-70';
|
|
4
5
|
type BgColorDarkmode = 'natt' | 'svart' | 'koksgraa';
|
|
5
|
-
export type CardBaseProps<As extends ElementType = '
|
|
6
|
+
export type CardBaseProps<As extends ElementType = 'div'> = Omit<ComponentAsPropParams<As>, 'children'> & {
|
|
6
7
|
shadow?: boolean;
|
|
7
8
|
noMargin?: boolean;
|
|
8
9
|
textCenter?: boolean;
|
|
9
|
-
clickable?: boolean;
|
|
10
10
|
bgColor?: BgColor;
|
|
11
11
|
bgDarkmodeColor?: BgColorDarkmode;
|
|
12
12
|
noPadding?: boolean;
|
|
13
|
+
children: WithCardActionProps['children'] | React.ReactNode;
|
|
13
14
|
};
|
|
14
|
-
export declare const CardBase: <As extends React.ElementType>(props: {
|
|
15
|
-
as?: As | undefined;
|
|
16
|
-
} & import("./types").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As>, "as" & {
|
|
17
|
-
ref: React.ForwardedRef<any>;
|
|
18
|
-
}> & {
|
|
15
|
+
export declare const CardBase: <As extends React.ElementType>(props: Omit<ComponentAsPropParams<As>, "children"> & {
|
|
19
16
|
shadow?: boolean | undefined;
|
|
20
17
|
noMargin?: boolean | undefined;
|
|
21
18
|
textCenter?: boolean | undefined;
|
|
22
|
-
clickable?: boolean | undefined;
|
|
23
19
|
bgColor?: BgColor | undefined;
|
|
24
20
|
bgDarkmodeColor?: BgColorDarkmode | undefined;
|
|
25
21
|
noPadding?: boolean | undefined;
|
|
22
|
+
children: WithCardActionProps['children'] | React.ReactNode;
|
|
26
23
|
} & React.RefAttributes<any>) => React.JSX.Element;
|
|
27
24
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ElementType, ReactElement } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export type IconCardProps<As extends ElementType = '
|
|
2
|
+
import { CardRenderProps, ComponentAsPropParams } from '../types';
|
|
3
|
+
export type IconCardProps<As extends ElementType = 'div'> = Omit<ComponentAsPropParams<As>, 'children'> & {
|
|
4
4
|
/** Element of icon */
|
|
5
5
|
icon: ReactElement;
|
|
6
6
|
/** Smaller icon and less space */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ElementType } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export type ImageCardProps<As extends ElementType = '
|
|
2
|
+
import { CardRenderProps, ComponentAsPropParams } from '../types';
|
|
3
|
+
export type ImageCardProps<As extends ElementType = 'div'> = Omit<ComponentAsPropParams<As>, 'children'> & {
|
|
4
4
|
/** The src for the image */
|
|
5
5
|
imageSrc: string;
|
|
6
6
|
/** The alt text for the image */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ElementType, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export type StippledCardProps<As extends ElementType = '
|
|
2
|
+
import { CardRenderProps, ComponentAsPropParams } from '../types';
|
|
3
|
+
export type StippledCardProps<As extends ElementType = 'div'> = Omit<ComponentAsPropParams<As>, 'children'> & {
|
|
4
4
|
/** Smaller icon and less space */
|
|
5
5
|
condensed?: boolean;
|
|
6
6
|
/** Image to be rendered*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ElementType } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export type TextCardProps<As extends ElementType = '
|
|
2
|
+
import { CardRenderProps, ComponentAsPropParams } from '../types';
|
|
3
|
+
export type TextCardProps<As extends ElementType = 'div'> = Omit<ComponentAsPropParams<As>, 'children'> & {
|
|
4
4
|
/** Left-aligned text on the card */
|
|
5
5
|
leftAlign?: boolean;
|
|
6
6
|
/** Function that's passed available sub-components as arguments, or regular children */
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ElementType } from 'react';
|
|
2
|
+
import { ComponentAsPropParams } from '../types';
|
|
3
|
+
export type CardActionProps<As extends ElementType = 'a'> = ComponentAsPropParams<As>;
|
|
4
|
+
export declare const CardAction: <As extends React.ElementType>(props: {
|
|
5
|
+
as?: As | undefined;
|
|
6
|
+
} & import("../types").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As>, "as" & {
|
|
7
|
+
ref: React.ForwardedRef<any>;
|
|
8
|
+
}> & React.RefAttributes<any>) => React.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { ElementType } from 'react';
|
|
2
|
+
import { CardAction } from './CardAction';
|
|
3
|
+
import { ComponentAsPropParams } from '../types';
|
|
4
|
+
export type WithCardActionProps<As extends ElementType = 'div'> = Omit<ComponentAsPropParams<As>, 'children'> & {
|
|
5
|
+
children: (props: {
|
|
6
|
+
CardAction: typeof CardAction;
|
|
7
|
+
}) => React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export declare const WithCardAction: <As extends React.ElementType>(props: Omit<ComponentAsPropParams<As>, "children"> & {
|
|
10
|
+
children: (props: {
|
|
11
|
+
CardAction: typeof CardAction;
|
|
12
|
+
}) => React.ReactNode;
|
|
13
|
+
} & React.RefAttributes<any>) => React.JSX.Element;
|
|
@@ -2,3 +2,5 @@ export { CardName, CardNameProps } from './CardName';
|
|
|
2
2
|
export { Subtext, SubtextProps } from './Subtext';
|
|
3
3
|
export { Text, TextProps } from './Text';
|
|
4
4
|
export { Title, TitleProps } from './Title';
|
|
5
|
+
export { WithCardAction, WithCardActionProps } from './WithCardAction';
|
|
6
|
+
export { CardAction, CardActionProps } from './CardAction';
|
package/types/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { ComponentPropsWithRef, ElementType, ForwardedRef } from 'react';
|
|
2
|
+
import { CardName, Subtext, Text, Title, CardAction } from './components';
|
|
3
3
|
export type DistributiveOmit<T, Omitted extends PropertyKey> = T extends any ? Omit<T, Omitted> : never;
|
|
4
4
|
export type ComponentAsPropParams<As extends ElementType> = {
|
|
5
5
|
as?: As;
|
|
@@ -8,8 +8,9 @@ export type ComponentAsPropParams<As extends ElementType> = {
|
|
|
8
8
|
}>;
|
|
9
9
|
export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
10
10
|
export interface CardRenderProps {
|
|
11
|
-
CardName:
|
|
12
|
-
Title:
|
|
13
|
-
Subtext:
|
|
14
|
-
Text:
|
|
11
|
+
CardName: typeof CardName;
|
|
12
|
+
Title: typeof Title;
|
|
13
|
+
Subtext: typeof Subtext;
|
|
14
|
+
Text: typeof Text;
|
|
15
|
+
CardAction: typeof CardAction;
|
|
15
16
|
}
|