@knapsack/renderer-react-components 4.86.7 → 4.86.8--canary.519222a.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.
|
@@ -1,7 +1,55 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
export declare const CardPropTypes: {
|
|
4
|
+
({ align, isDark, headerSlot, img, title, body, children, handleClick, }: {
|
|
5
|
+
align: string;
|
|
6
|
+
isDark: boolean;
|
|
7
|
+
headerSlot: React.ReactNode;
|
|
8
|
+
img: string;
|
|
9
|
+
title: string;
|
|
10
|
+
body: string;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
handleClick: (count: number) => void;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
defaultProps: {
|
|
15
|
+
align: string;
|
|
16
|
+
children: any;
|
|
17
|
+
handleClick: () => void;
|
|
18
|
+
isDark: boolean;
|
|
19
|
+
};
|
|
20
|
+
propTypes: {
|
|
21
|
+
/**
|
|
22
|
+
* The card title
|
|
23
|
+
*/
|
|
24
|
+
title: PropTypes.Validator<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Card alignment
|
|
27
|
+
*/
|
|
28
|
+
align: PropTypes.Requireable<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Card content
|
|
31
|
+
*/
|
|
32
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
33
|
+
/**
|
|
34
|
+
* Header slot content
|
|
35
|
+
*/
|
|
36
|
+
headerSlot: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
37
|
+
/**
|
|
38
|
+
* Click handler function
|
|
39
|
+
*/
|
|
40
|
+
handleClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
41
|
+
/**
|
|
42
|
+
* Dark theme variant
|
|
43
|
+
*/
|
|
44
|
+
isDark: PropTypes.Requireable<boolean>;
|
|
45
|
+
/**
|
|
46
|
+
* Card image URL
|
|
47
|
+
*/
|
|
48
|
+
img: PropTypes.Validator<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Card body text
|
|
51
|
+
*/
|
|
52
|
+
body: PropTypes.Validator<string>;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
7
55
|
//# sourceMappingURL=card-prop-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card-prop-types.d.ts","sourceRoot":"","sources":["../../src/test-fixtures/card-prop-types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"card-prop-types.d.ts","sourceRoot":"","sources":["../../src/test-fixtures/card-prop-types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,eAAO,MAAM,aAAa;8EASvB;QACD,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,OAAO,CAAC;QAChB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;QAC5B,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;KACtC;;;;;;;;QAoCC;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;CAxCJ,CAAC"}
|
|
@@ -1,50 +1,53 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
this.setState((prevState) => {
|
|
14
|
-
// @ts-expect-error purposely not typed
|
|
15
|
-
const newCount = prevState.count + 1;
|
|
16
|
-
// @ts-expect-error purposely not typed
|
|
17
|
-
this.props.handleClick(newCount);
|
|
18
|
-
return { count: newCount };
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
render() {
|
|
22
|
-
return (_jsxs("aside", {
|
|
23
|
-
// @ts-expect-error purposely not typed
|
|
24
|
-
className: `card card--align-${this.props.align}${
|
|
25
|
-
// @ts-expect-error purposely not typed
|
|
26
|
-
this.props.isDark ? ' card--dark' : ''}`, children: [this.props.headerSlot, _jsx("div", { className: "card__img",
|
|
27
|
-
// @ts-expect-error purposely not typed
|
|
28
|
-
style: { backgroundImage: `url("${this.props.img}")` } }), _jsxs("div", { className: "card__contents", children: [_jsx("h3", { className: "card__title", children: this.props.title }), _jsxs("p", { children: ["Count:", this.state.count] }), _jsx("button", { onClick: this.handleButtonClick, type: "button", children: "Add" }), _jsx("p", { className: "card__body", children: this.props.body })] }), _jsx("footer", { className: "card__footer", children: this.props.children })] }));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
// @ts-expect-error purposely not typed
|
|
4
|
+
export const CardPropTypes = ({ align, isDark, headerSlot, img, title, body, children, handleClick, }) => {
|
|
5
|
+
const [count, setCount] = React.useState(0);
|
|
6
|
+
const handleButtonClick = () => {
|
|
7
|
+
const newCount = count + 1;
|
|
8
|
+
handleClick(newCount);
|
|
9
|
+
setCount(newCount);
|
|
10
|
+
};
|
|
11
|
+
return (_jsxs("aside", { className: `card card--align-${align}${isDark ? ' card--dark' : ''}`, children: [headerSlot, _jsx("div", { className: "card__img", style: { backgroundImage: `url("${img}")` } }), _jsxs("div", { className: "card__contents", children: [_jsx("h3", { className: "card__title", children: title }), _jsxs("p", { children: ["Count: ", count] }), _jsx("button", { onClick: handleButtonClick, type: "button", children: "Add" }), _jsx("p", { className: "card__body", children: body })] }), _jsx("footer", { className: "card__footer", children: children })] }));
|
|
12
|
+
};
|
|
32
13
|
CardPropTypes.defaultProps = {
|
|
33
14
|
align: 'left',
|
|
34
15
|
children: null,
|
|
35
16
|
handleClick: () => { },
|
|
36
17
|
isDark: false,
|
|
37
18
|
};
|
|
38
|
-
// @ts-expect-error purposely not typed
|
|
39
19
|
CardPropTypes.propTypes = {
|
|
40
20
|
/**
|
|
41
21
|
* The card title
|
|
42
22
|
*/
|
|
43
23
|
title: PropTypes.string.isRequired,
|
|
24
|
+
/**
|
|
25
|
+
* Card alignment
|
|
26
|
+
*/
|
|
44
27
|
align: PropTypes.oneOf(['left', 'right']),
|
|
28
|
+
/**
|
|
29
|
+
* Card content
|
|
30
|
+
*/
|
|
45
31
|
children: PropTypes.node,
|
|
32
|
+
/**
|
|
33
|
+
* Header slot content
|
|
34
|
+
*/
|
|
46
35
|
headerSlot: PropTypes.node.isRequired,
|
|
36
|
+
/**
|
|
37
|
+
* Click handler function
|
|
38
|
+
*/
|
|
47
39
|
handleClick: PropTypes.func,
|
|
40
|
+
/**
|
|
41
|
+
* Dark theme variant
|
|
42
|
+
*/
|
|
48
43
|
isDark: PropTypes.bool,
|
|
44
|
+
/**
|
|
45
|
+
* Card image URL
|
|
46
|
+
*/
|
|
47
|
+
img: PropTypes.string.isRequired,
|
|
48
|
+
/**
|
|
49
|
+
* Card body text
|
|
50
|
+
*/
|
|
51
|
+
body: PropTypes.string.isRequired,
|
|
49
52
|
};
|
|
50
53
|
//# sourceMappingURL=card-prop-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card-prop-types.js","sourceRoot":"","sources":["../../src/test-fixtures/card-prop-types.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,MAAM,
|
|
1
|
+
{"version":3,"file":"card-pr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B,MAAM,EAAE,KAAK;CACd,CAAC;AAEF,aAAa,CAAC,SAAS,GAAG;IACxB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IAClC;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB;;OAEG;IACH,UAAU,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACrC;;OAEG;IACH,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B;;OAEG;IACH,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB;;OAEG;IACH,GAAG,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IAChC;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;CAClC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knapsack/renderer-react-components",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "4.86.
|
|
4
|
+
"version": "4.86.8--canary.519222a.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./demo-wrapper": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"lint": "eslint ./"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@knapsack/eslint-config-starter": "4.86.
|
|
39
|
-
"@knapsack/prettier-config": "4.86.
|
|
40
|
-
"@knapsack/types": "4.86.
|
|
41
|
-
"@knapsack/typescript-config-starter": "4.86.
|
|
38
|
+
"@knapsack/eslint-config-starter": "4.86.8--canary.519222a.0",
|
|
39
|
+
"@knapsack/prettier-config": "4.86.8--canary.519222a.0",
|
|
40
|
+
"@knapsack/types": "4.86.8--canary.519222a.0",
|
|
41
|
+
"@knapsack/typescript-config-starter": "4.86.8--canary.519222a.0",
|
|
42
42
|
"@types/node": "^20.19.22",
|
|
43
43
|
"@types/prop-types": "^15.7.15",
|
|
44
44
|
"@types/react": "^18.3.26",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"directory": "apps/client/libs/renderer-react-components",
|
|
57
57
|
"type": "git"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "519222a10517f12a86c5cb83cee58fafa7c222ee"
|
|
60
60
|
}
|