@akinon/ui-card 0.0.6 → 0.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/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +67 -0
- package/dist/esm/index.d.ts +17 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +62 -0
- package/package.json +20 -13
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -7617
- /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAEtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC;AAErC,eAAO,MAAM,IAAI,mCAAoC,SAAS,sBAE7D,CAAC;AAEF,eAAO,MAAM,QAAQ,gDAAe,CAAC;AAErC,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,QAAQ,UAAW,aAAa,sBAmE5C,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.NavCards = exports.CardMeta = exports.Card = void 0;
|
|
15
|
+
const icons_1 = require("@akinon/icons");
|
|
16
|
+
const ui_theme_1 = require("@akinon/ui-theme");
|
|
17
|
+
const ui_typography_1 = require("@akinon/ui-typography");
|
|
18
|
+
const antd_1 = require("antd");
|
|
19
|
+
const React = require("react");
|
|
20
|
+
const Card = (_a) => {
|
|
21
|
+
var { children } = _a, restCardProps = __rest(_a, ["children"]);
|
|
22
|
+
return React.createElement(antd_1.Card, Object.assign({}, restCardProps), children);
|
|
23
|
+
};
|
|
24
|
+
exports.Card = Card;
|
|
25
|
+
exports.CardMeta = antd_1.Card.Meta;
|
|
26
|
+
const NavCards = (props) => {
|
|
27
|
+
return (React.createElement(antd_1.ConfigProvider, { theme: {
|
|
28
|
+
token: {
|
|
29
|
+
colorTextBase: ui_theme_1.theme.colors.neutral['950'],
|
|
30
|
+
colorText: ui_theme_1.theme.colors.neutral['950'],
|
|
31
|
+
fontSizeHeading4: ui_theme_1.fontSize * 1.125
|
|
32
|
+
},
|
|
33
|
+
components: {
|
|
34
|
+
Card: {
|
|
35
|
+
colorBgContainer: ui_theme_1.theme.colors.neutral['100']
|
|
36
|
+
},
|
|
37
|
+
Typography: {
|
|
38
|
+
titleMarginBottom: 0,
|
|
39
|
+
// TODO: this is not working for all titles, https://github.com/ant-design/ant-design/issues/46243
|
|
40
|
+
// titleMarginTop: 0,
|
|
41
|
+
fontWeightStrong: 500
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} },
|
|
45
|
+
React.createElement("div", { style: { overflow: 'hidden' } },
|
|
46
|
+
React.createElement(antd_1.Row, { gutter: [16, 16], style: { padding: '1.5rem 2rem' } }, props.items.map(({ title, text, iconColor, icon, onClick }, i) => (React.createElement(antd_1.Col, { key: i, span: 8 },
|
|
47
|
+
React.createElement(antd_1.Card, { bordered: false, onClick: onClick, bodyStyle: {
|
|
48
|
+
padding: 0,
|
|
49
|
+
height: '127px',
|
|
50
|
+
overflow: 'hidden',
|
|
51
|
+
borderRadius: '0.5rem',
|
|
52
|
+
cursor: 'pointer'
|
|
53
|
+
} },
|
|
54
|
+
React.createElement(antd_1.Flex, { justify: "space-between" },
|
|
55
|
+
React.createElement("div", { style: {
|
|
56
|
+
background: iconColor,
|
|
57
|
+
fontSize: ui_theme_1.fontSize * 2.5,
|
|
58
|
+
width: '80px',
|
|
59
|
+
padding: '2rem 1.25rem',
|
|
60
|
+
color: ui_theme_1.theme.colors.neutral['100']
|
|
61
|
+
} },
|
|
62
|
+
React.createElement(icons_1.Icon, { icon: icon })),
|
|
63
|
+
React.createElement(antd_1.Flex, { vertical: true, justify: "flex-start", style: { padding: '1.25rem' } },
|
|
64
|
+
React.createElement(ui_typography_1.Title, { level: 4, style: { marginBlockStart: 0 } }, title),
|
|
65
|
+
React.createElement(ui_typography_1.Text, null, text)))))))))));
|
|
66
|
+
};
|
|
67
|
+
exports.NavCards = NavCards;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CardProps as AntCardProps } from 'antd';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export type CardProps = AntCardProps;
|
|
4
|
+
export declare const Card: ({ children, ...restCardProps }: CardProps) => React.JSX.Element;
|
|
5
|
+
export declare const CardMeta: React.FC<import("antd/es/card").CardMetaProps>;
|
|
6
|
+
export type SingleNavCard = {
|
|
7
|
+
title: string;
|
|
8
|
+
text: string;
|
|
9
|
+
icon: string;
|
|
10
|
+
iconColor: string;
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
};
|
|
13
|
+
export type NavCardsProps = {
|
|
14
|
+
items: SingleNavCard[];
|
|
15
|
+
};
|
|
16
|
+
export declare const NavCards: (props: NavCardsProps) => React.JSX.Element;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAEtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC;AAErC,eAAO,MAAM,IAAI,mCAAoC,SAAS,sBAE7D,CAAC;AAEF,eAAO,MAAM,QAAQ,gDAAe,CAAC;AAErC,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,QAAQ,UAAW,aAAa,sBAmE5C,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { Icon } from '@akinon/icons';
|
|
13
|
+
import { fontSize, theme } from '@akinon/ui-theme';
|
|
14
|
+
import { Text, Title } from '@akinon/ui-typography';
|
|
15
|
+
import { Card as AntCard, Col, ConfigProvider, Flex, Row } from 'antd';
|
|
16
|
+
import * as React from 'react';
|
|
17
|
+
export const Card = (_a) => {
|
|
18
|
+
var { children } = _a, restCardProps = __rest(_a, ["children"]);
|
|
19
|
+
return React.createElement(AntCard, Object.assign({}, restCardProps), children);
|
|
20
|
+
};
|
|
21
|
+
export const CardMeta = AntCard.Meta;
|
|
22
|
+
export const NavCards = (props) => {
|
|
23
|
+
return (React.createElement(ConfigProvider, { theme: {
|
|
24
|
+
token: {
|
|
25
|
+
colorTextBase: theme.colors.neutral['950'],
|
|
26
|
+
colorText: theme.colors.neutral['950'],
|
|
27
|
+
fontSizeHeading4: fontSize * 1.125
|
|
28
|
+
},
|
|
29
|
+
components: {
|
|
30
|
+
Card: {
|
|
31
|
+
colorBgContainer: theme.colors.neutral['100']
|
|
32
|
+
},
|
|
33
|
+
Typography: {
|
|
34
|
+
titleMarginBottom: 0,
|
|
35
|
+
// TODO: this is not working for all titles, https://github.com/ant-design/ant-design/issues/46243
|
|
36
|
+
// titleMarginTop: 0,
|
|
37
|
+
fontWeightStrong: 500
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
} },
|
|
41
|
+
React.createElement("div", { style: { overflow: 'hidden' } },
|
|
42
|
+
React.createElement(Row, { gutter: [16, 16], style: { padding: '1.5rem 2rem' } }, props.items.map(({ title, text, iconColor, icon, onClick }, i) => (React.createElement(Col, { key: i, span: 8 },
|
|
43
|
+
React.createElement(AntCard, { bordered: false, onClick: onClick, bodyStyle: {
|
|
44
|
+
padding: 0,
|
|
45
|
+
height: '127px',
|
|
46
|
+
overflow: 'hidden',
|
|
47
|
+
borderRadius: '0.5rem',
|
|
48
|
+
cursor: 'pointer'
|
|
49
|
+
} },
|
|
50
|
+
React.createElement(Flex, { justify: "space-between" },
|
|
51
|
+
React.createElement("div", { style: {
|
|
52
|
+
background: iconColor,
|
|
53
|
+
fontSize: fontSize * 2.5,
|
|
54
|
+
width: '80px',
|
|
55
|
+
padding: '2rem 1.25rem',
|
|
56
|
+
color: theme.colors.neutral['100']
|
|
57
|
+
} },
|
|
58
|
+
React.createElement(Icon, { icon: icon })),
|
|
59
|
+
React.createElement(Flex, { vertical: true, justify: "flex-start", style: { padding: '1.25rem' } },
|
|
60
|
+
React.createElement(Title, { level: 4, style: { marginBlockStart: 0 } }, title),
|
|
61
|
+
React.createElement(Text, null, text)))))))))));
|
|
62
|
+
};
|
package/package.json
CHANGED
|
@@ -1,41 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/ui-card",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"module": "dist/index.js",
|
|
6
|
+
"main": "dist/esm/index.js",
|
|
7
|
+
"module": "dist/esm/index.js",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"antd": "5.11.0",
|
|
13
|
-
"@akinon/icons": "0.
|
|
14
|
-
"@akinon/ui-
|
|
15
|
-
"@akinon/ui-
|
|
13
|
+
"@akinon/icons": "0.3.0",
|
|
14
|
+
"@akinon/ui-typography": "0.2.0",
|
|
15
|
+
"@akinon/ui-theme": "0.4.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"clean-package": "2.2.0",
|
|
19
|
-
"
|
|
19
|
+
"copyfiles": "^2.4.1",
|
|
20
|
+
"rimraf": "^5.0.5",
|
|
21
|
+
"typescript": "^5.2.2",
|
|
22
|
+
"@akinon/vite-config": "0.3.0",
|
|
20
23
|
"@akinon/eslint-config": "0.1.0",
|
|
21
|
-
"@akinon/typescript-config": "0.
|
|
24
|
+
"@akinon/typescript-config": "0.1.0"
|
|
22
25
|
},
|
|
23
26
|
"peerDependencies": {
|
|
24
27
|
"react": ">=18",
|
|
25
28
|
"react-dom": ">=18"
|
|
26
29
|
},
|
|
27
30
|
"clean-package": "../../../clean-package.config.json",
|
|
28
|
-
"types": "dist/index.d.ts",
|
|
31
|
+
"types": "dist/esm/index.d.ts",
|
|
29
32
|
"exports": {
|
|
30
33
|
".": {
|
|
31
|
-
"types": "./dist/index.d.ts",
|
|
32
|
-
"import": "./dist/index.js",
|
|
33
|
-
"require": "./dist/index.
|
|
34
|
+
"types": "./dist/esm/index.d.ts",
|
|
35
|
+
"import": "./dist/esm/index.js",
|
|
36
|
+
"require": "./dist/cjs/index.js"
|
|
34
37
|
},
|
|
35
38
|
"./package.json": "./package.json"
|
|
36
39
|
},
|
|
37
40
|
"scripts": {
|
|
38
|
-
"build": "
|
|
41
|
+
"build": "pnpm run build:esm && pnpm run build:commonjs && pnpm run copy:files",
|
|
42
|
+
"build:esm": "tsc --outDir dist/esm",
|
|
43
|
+
"build:commonjs": "tsc --module commonjs --outDir dist/cjs",
|
|
44
|
+
"copy:files": "copyfiles -u 1 src/**/*.css dist/esm && copyfiles -u 1 src/**/*.css dist/cjs",
|
|
45
|
+
"clean": "rimraf dist/",
|
|
39
46
|
"lint": "eslint *.ts*",
|
|
40
47
|
"test": "vitest run",
|
|
41
48
|
"test:ui": "vitest --ui",
|