ag-common 0.0.274 → 0.0.277
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.
|
@@ -62,11 +62,19 @@ exports.ButtonBase = (0, styled_components_1.css) `
|
|
|
62
62
|
background-color: #888;
|
|
63
63
|
}
|
|
64
64
|
`;
|
|
65
|
-
const
|
|
65
|
+
const BaseButton = styled_components_1.default.button `
|
|
66
|
+
${exports.ButtonBase}
|
|
67
|
+
`;
|
|
68
|
+
const BaseA = styled_components_1.default.a `
|
|
66
69
|
${exports.ButtonBase}
|
|
67
70
|
`;
|
|
68
71
|
const Button = (props) => {
|
|
69
72
|
var _a;
|
|
70
|
-
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
|
+
const Component = props.href
|
|
75
|
+
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
BaseA
|
|
77
|
+
: BaseButton;
|
|
78
|
+
return (react_1.default.createElement(Component, Object.assign({ className: props.className, "data-invert": props.invert, "data-disabled": (_a = props.disabled) !== null && _a !== void 0 ? _a : false, role: "button", title: props.title || undefined }, props), props.children));
|
|
71
79
|
};
|
|
72
80
|
exports.Button = Button;
|
|
@@ -2,7 +2,8 @@ export interface TableItem {
|
|
|
2
2
|
content: JSX.Element;
|
|
3
3
|
groupTitle: string;
|
|
4
4
|
}
|
|
5
|
-
export declare const Table: ({ children, className, }: {
|
|
5
|
+
export declare const Table: ({ children, className, headerRow, }: {
|
|
6
6
|
children: TableItem[];
|
|
7
7
|
className?: string | undefined;
|
|
8
|
+
headerRow?: JSX.Element | undefined;
|
|
8
9
|
}) => JSX.Element;
|
|
@@ -12,20 +12,34 @@ const Base = styled_components_1.default.div `
|
|
|
12
12
|
flex-flow: column;
|
|
13
13
|
width: 100%;
|
|
14
14
|
`;
|
|
15
|
-
const
|
|
15
|
+
const TableRow = styled_components_1.default.div `
|
|
16
|
+
display: flex;
|
|
16
17
|
border: solid 1px #ccc;
|
|
18
|
+
&[data-header='true'] {
|
|
19
|
+
border-bottom: solid 1px #888;
|
|
20
|
+
}
|
|
21
|
+
&:not(:first-of-type) {
|
|
22
|
+
border-top: 0;
|
|
23
|
+
}
|
|
17
24
|
`;
|
|
18
25
|
const Group = styled_components_1.default.div `
|
|
19
26
|
display: flex;
|
|
20
27
|
flex-flow: column;
|
|
28
|
+
width: 100%;
|
|
21
29
|
`;
|
|
22
30
|
const GroupTitle = styled_components_1.default.div `
|
|
23
31
|
font-size: 1.5rem;
|
|
24
32
|
`;
|
|
25
|
-
const
|
|
33
|
+
const GroupWrap = styled_components_1.default.div `
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-flow: row;
|
|
36
|
+
`;
|
|
37
|
+
const Table = ({ children, className, headerRow, }) => {
|
|
26
38
|
const grouped = (0, groupBy_1.groupByList)(children, (s) => s.groupTitle);
|
|
27
|
-
return (react_1.default.createElement(Base, { className: className }, grouped.map((group) => (react_1.default.createElement(
|
|
28
|
-
react_1.default.createElement(GroupTitle,
|
|
29
|
-
|
|
39
|
+
return (react_1.default.createElement(Base, { className: className }, grouped.map((group) => (react_1.default.createElement(GroupWrap, { key: 'gk' + group.key },
|
|
40
|
+
group.key && (react_1.default.createElement(GroupTitle, { key: `gt${group.key}` }, group.key)),
|
|
41
|
+
react_1.default.createElement(Group, { key: `g${group.key}` },
|
|
42
|
+
headerRow && (react_1.default.createElement(TableRow, { "data-header": "true", key: `headrow${group.key}` }, headerRow)),
|
|
43
|
+
group.items.map((item) => (react_1.default.createElement(TableRow, { key: item.content.key }, item.content)))))))));
|
|
30
44
|
};
|
|
31
45
|
exports.Table = Table;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ag-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.277",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Andrei Gec <@andreigec> (https://gec.dev/)",
|
|
@@ -26,9 +26,11 @@
|
|
|
26
26
|
"react": "18.2.0",
|
|
27
27
|
"react-dom": "18.2.0",
|
|
28
28
|
"react-hot-toast": "2.x",
|
|
29
|
-
"styled-components": "5.x",
|
|
30
29
|
"typescript": "4.x"
|
|
31
30
|
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"styled-components": ">=5"
|
|
33
|
+
},
|
|
32
34
|
"devDependencies": {
|
|
33
35
|
"@babel/core": "7.18.6",
|
|
34
36
|
"@storybook/addon-actions": "6.5.9",
|
|
@@ -56,7 +58,8 @@
|
|
|
56
58
|
"eslint-plugin-react": "7.30.1",
|
|
57
59
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
58
60
|
"prettier": "2.7.1",
|
|
59
|
-
"rimraf": "3.0.2"
|
|
61
|
+
"rimraf": "3.0.2",
|
|
62
|
+
"styled-components": "5.3.5"
|
|
60
63
|
},
|
|
61
64
|
"files": [
|
|
62
65
|
"dist/**/*",
|