@edu-tosel/design 0.1.4 → 0.1.6
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/README.md +32 -31
- package/board/Board.d.ts +7 -0
- package/board/Board.js +9 -0
- package/board/CanvasBoard.d.ts +7 -0
- package/board/CanvasBoard.js +11 -0
- package/board/Header.d.ts +6 -0
- package/board/Header.js +12 -0
- package/board/ListBoard.d.ts +7 -0
- package/board/ListBoard.js +7 -0
- package/board/index.d.ts +3 -19
- package/board/index.js +3 -47
- package/card/Card.d.ts +15 -14
- package/card/Card.js +30 -32
- package/card/ChartCard.d.ts +20 -0
- package/card/ChartCard.js +7 -0
- package/card/ProfileCard.d.ts +14 -14
- package/card/ProfileCard.js +8 -20
- package/card/TableCard.d.ts +12 -0
- package/card/TableCard.js +13 -0
- package/card/TrumpCard.d.ts +19 -0
- package/card/TrumpCard.js +19 -0
- package/card/index.d.ts +4 -1
- package/card/index.js +4 -1
- package/deck/Deck.d.ts +15 -0
- package/deck/Deck.js +14 -0
- package/deck/index.d.ts +1 -18
- package/deck/index.js +1 -28
- package/{style.css → globals.css} +40 -41
- package/index.d.ts +9 -0
- package/index.js +9 -0
- package/{header/index.d.ts → layout/dashboard/Header.d.ts} +5 -5
- package/layout/dashboard/Header.js +19 -0
- package/layout/dashboard/index.d.ts +7 -0
- package/layout/dashboard/index.js +10 -0
- package/layout/index.d.ts +1 -0
- package/layout/index.js +1 -0
- package/modal/Modal.d.ts +8 -0
- package/modal/Modal.js +21 -0
- package/modal/index.d.ts +1 -9
- package/modal/index.js +1 -35
- package/navigation/Navigation.d.ts +5 -0
- package/navigation/Navigation.js +26 -0
- package/navigation/index.d.ts +1 -6
- package/navigation/index.js +1 -24
- package/package.json +6 -30
- package/shelf/Shelf.d.ts +4 -0
- package/shelf/Shelf.js +4 -0
- package/shelf/index.d.ts +1 -0
- package/shelf/index.js +1 -0
- package/tailwind.config.js +389 -319
- package/text/LineBreaks.d.ts +4 -0
- package/text/LineBreaks.js +5 -0
- package/text/index.d.ts +1 -5
- package/text/index.js +1 -18
- package/util/classNames.d.ts +1 -1
- package/util/classNames.js +4 -8
- package/util/colors.d.ts +10 -10
- package/util/colors.js +10 -10
- package/util/display.d.ts +25 -25
- package/util/display.js +25 -55
- package/util/displayResponsive.d.ts +3 -3
- package/util/displayResponsive.js +15 -15
- package/util/index.d.ts +7 -7
- package/util/index.js +7 -7
- package/util/pattern.d.ts +7 -7
- package/util/pattern.js +15 -15
- package/util/position.d.ts +14 -14
- package/util/position.js +44 -56
- package/util/shape.d.ts +1 -1
- package/util/shape.js +3 -3
- package/version.txt +1 -1
- package/header/index.js +0 -25
package/README.md
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
# TOSEL
|
|
2
|
-
TOSEL 통합 디자인 시스템에 맞춘 UI 라이브러리
|
|
3
|
-
|
|
4
|
-
## Tech Stack
|
|
5
|
-
- tailwindcss 3.4.
|
|
6
|
-
- React 18
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
npm
|
|
16
|
-
npm run
|
|
17
|
-
npm run
|
|
18
|
-
npm run
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
###
|
|
27
|
-
###
|
|
28
|
-
###
|
|
29
|
-
###
|
|
30
|
-
###
|
|
31
|
-
###
|
|
1
|
+
# TOSEL Design Library
|
|
2
|
+
TOSEL 통합 디자인 시스템에 맞춘 UI 라이브러리
|
|
3
|
+
|
|
4
|
+
## Tech Stack
|
|
5
|
+
- tailwindcss 3.4.1
|
|
6
|
+
- React 18
|
|
7
|
+
- Vite 5
|
|
8
|
+
|
|
9
|
+
## Getting Start
|
|
10
|
+
```bash
|
|
11
|
+
# 설치
|
|
12
|
+
npm install @edu-tosel/ui@latest
|
|
13
|
+
|
|
14
|
+
# 개발환경
|
|
15
|
+
npm install # 의존성 설치
|
|
16
|
+
npm run dev # 개발자 환경에서 실행
|
|
17
|
+
npm run test # jest 실행
|
|
18
|
+
npm run build # 빌드
|
|
19
|
+
npm run publish # npm 배포
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Folder Structure
|
|
23
|
+
### asset
|
|
24
|
+
tailwindcss를 조합한 커스텀 클래스 보관
|
|
25
|
+
|
|
26
|
+
### board
|
|
27
|
+
### card
|
|
28
|
+
### deck
|
|
29
|
+
### header
|
|
30
|
+
### modal
|
|
31
|
+
### navigation
|
|
32
|
+
### text
|
|
32
33
|
문자열 조작 컴포넌트 보관
|
package/board/Board.d.ts
ADDED
package/board/Board.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function Board({ children, options, }) {
|
|
3
|
+
const { height } = options ?? {};
|
|
4
|
+
const classNames = [
|
|
5
|
+
`min-h-screen xl:min-h-0 xl:h-186 `,
|
|
6
|
+
"xl:rounded-xl bg-white/80 relative w-full ",
|
|
7
|
+
].join(" ");
|
|
8
|
+
return _jsx("div", { className: classNames + "", children: children });
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../util";
|
|
3
|
+
import { Board } from "./Board";
|
|
4
|
+
export function CanvasBoard({ children, options, }) {
|
|
5
|
+
const { height } = options ?? {};
|
|
6
|
+
const layouts = "flex flex-wrap gap-12 ";
|
|
7
|
+
const sizes = "h-full ";
|
|
8
|
+
const paddings = "pb-36 xl:pb-12 px-2 xs:px-4 xl:pl-10 xl:pr-2 pt-2 xs:pt-4 xl:pt-8";
|
|
9
|
+
const styles = "xl:overflow-y-scroll ";
|
|
10
|
+
return (_jsx(Board, { options: { height }, children: _jsx("div", { className: cn(layouts, sizes, paddings, styles), children: children }) }));
|
|
11
|
+
}
|
package/board/Header.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { between, center } from "../util";
|
|
3
|
+
export function Header({ title, colors, childrens, }) {
|
|
4
|
+
const [bgColor, textColor] = colors ?? ["bg", "text"];
|
|
5
|
+
const headerClassNames = [
|
|
6
|
+
center.row + between.row,
|
|
7
|
+
`bg-${bgColor || "white-off"}`,
|
|
8
|
+
`text-${textColor || "black"}`,
|
|
9
|
+
"w-full h-22 px-12 ",
|
|
10
|
+
].join(" ");
|
|
11
|
+
return (_jsxs("div", { className: headerClassNames, children: [_jsx("div", { className: "text-xl font-bold", children: title }), _jsx("div", { className: "flex", children: childrens?.map((children) => children) })] }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Board } from "./Board";
|
|
3
|
+
export function ListBoard({ children, options, }) {
|
|
4
|
+
const { height } = options ?? {};
|
|
5
|
+
const classNames = ["pt-8 px-12 overflow-y-scroll h-full pb-32"].join(" ");
|
|
6
|
+
return (_jsx(Board, { options: { height }, children: _jsx("div", { className: classNames, children: children }) }));
|
|
7
|
+
}
|
package/board/index.d.ts
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
options?: {
|
|
6
|
-
height?: number;
|
|
7
|
-
};
|
|
8
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export declare function ListBoard({ children, header, options, }: {
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
header: {
|
|
12
|
-
title: string;
|
|
13
|
-
colors?: [string, string];
|
|
14
|
-
childrens?: React.ReactNode[];
|
|
15
|
-
};
|
|
16
|
-
options?: {
|
|
17
|
-
height?: number;
|
|
18
|
-
};
|
|
19
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import "../globals.css";
|
|
2
|
+
export * from "./CanvasBoard";
|
|
3
|
+
export * from "./ListBoard";
|
package/board/index.js
CHANGED
|
@@ -1,47 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import "../style.css";
|
|
14
|
-
import { center, between } from "../util";
|
|
15
|
-
function Header(_a) {
|
|
16
|
-
var title = _a.title, colors = _a.colors, childrens = _a.childrens;
|
|
17
|
-
var _b = colors !== null && colors !== void 0 ? colors : ["bg", "text"], bgColor = _b[0], textColor = _b[1];
|
|
18
|
-
var headerClassNames = [
|
|
19
|
-
center.row + between.row,
|
|
20
|
-
"bg-".concat(bgColor || "white-off"),
|
|
21
|
-
"text-".concat(textColor || "black"),
|
|
22
|
-
"w-full h-22 px-12",
|
|
23
|
-
].join(" ");
|
|
24
|
-
return (_jsxs("div", __assign({ className: headerClassNames }, { children: [_jsx("div", __assign({ className: "text-xl font-bold" }, { children: title })), _jsx("div", __assign({ className: "flex" }, { children: childrens === null || childrens === void 0 ? void 0 : childrens.map(function (children) { return children; }) }))] })));
|
|
25
|
-
}
|
|
26
|
-
function Board(_a) {
|
|
27
|
-
var children = _a.children, header = _a.header, options = _a.options;
|
|
28
|
-
var height = (options !== null && options !== void 0 ? options : {}).height;
|
|
29
|
-
var classNames = [
|
|
30
|
-
"h-".concat(height !== null && height !== void 0 ? height : 186, " ").concat(header ? "" : "pt-8"),
|
|
31
|
-
"rounded-xl bg-white/80 overflow-hidden relative w-full",
|
|
32
|
-
].join(" ");
|
|
33
|
-
return (_jsxs("div", __assign({ className: classNames }, { children: [header ? _jsx(Header, __assign({}, header)) : null, _jsx("div", __assign({ className: "h-full" }, { children: children }))] })));
|
|
34
|
-
}
|
|
35
|
-
export function CanvasBoard(_a) {
|
|
36
|
-
var children = _a.children, options = _a.options;
|
|
37
|
-
var height = (options !== null && options !== void 0 ? options : {}).height;
|
|
38
|
-
var classNames = ["px-12"].join(" ");
|
|
39
|
-
return (_jsx(Board, __assign({ options: { height: height } }, { children: _jsx("div", __assign({ className: classNames }, { children: children })) })));
|
|
40
|
-
}
|
|
41
|
-
export function ListBoard(_a) {
|
|
42
|
-
var children = _a.children, header = _a.header, options = _a.options;
|
|
43
|
-
var title = header.title, colors = header.colors, childrens = header.childrens;
|
|
44
|
-
var height = (options !== null && options !== void 0 ? options : {}).height;
|
|
45
|
-
var classNames = ["scrollbar pt-8 px-12 overflow-y-scroll h-full pb-32"].join(" ");
|
|
46
|
-
return (_jsx(Board, __assign({ header: { title: title, colors: colors, childrens: childrens }, options: { height: height } }, { children: _jsx("div", __assign({ className: classNames }, { children: children })) })));
|
|
47
|
-
}
|
|
1
|
+
import "../globals.css";
|
|
2
|
+
export * from "./CanvasBoard";
|
|
3
|
+
export * from "./ListBoard";
|
package/card/Card.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import "../
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "../globals.css";
|
|
3
|
+
export type Size = "small" | "medium" | "large" | "xLarge";
|
|
4
|
+
export declare function Card({ children, options, }: {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
options?: {
|
|
7
|
+
height?: Size;
|
|
8
|
+
width?: Size;
|
|
9
|
+
text?: {
|
|
10
|
+
size?: string;
|
|
11
|
+
color?: string;
|
|
12
|
+
};
|
|
13
|
+
onClick?: () => unknown | (() => Promise<unknown>);
|
|
14
|
+
};
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
package/card/Card.js
CHANGED
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return (_jsxs("div", __assign({ className: classNames }, { children: [header ? _jsx(Header, __assign({}, header)) : null, _jsx("div", __assign({ className: "h-full" }, { children: children }))] })));
|
|
32
|
-
}
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "../globals.css";
|
|
3
|
+
import { cn } from "../util";
|
|
4
|
+
const widthSize = {
|
|
5
|
+
small: "md:w-60",
|
|
6
|
+
medium: "md:w-90",
|
|
7
|
+
large: "md:w-135",
|
|
8
|
+
xLarge: "md:w-225",
|
|
9
|
+
};
|
|
10
|
+
const heightSize = {
|
|
11
|
+
small: "h-72 sm:h-48",
|
|
12
|
+
medium: "h-72 sm:h-48",
|
|
13
|
+
large: "h-80",
|
|
14
|
+
xLarge: "h-80",
|
|
15
|
+
};
|
|
16
|
+
export function Card({ children, options, }) {
|
|
17
|
+
const { height, width, text, onClick } = options ?? {};
|
|
18
|
+
const { size: textSize, color: textColor } = text ?? {};
|
|
19
|
+
const sizes = [
|
|
20
|
+
`${heightSize[height ?? "small"]}`,
|
|
21
|
+
`w-full ${widthSize[width ?? "small"]}`,
|
|
22
|
+
].join(" ");
|
|
23
|
+
const positions = "relative";
|
|
24
|
+
const styles = [
|
|
25
|
+
`${onClick ? "cursor-pointer" : ""}`,
|
|
26
|
+
`text-${textSize ?? "base"}`,
|
|
27
|
+
`rounded-xl bg-white/80 overflow-hidden box-shadow duration-500`,
|
|
28
|
+
].join(" ");
|
|
29
|
+
return (_jsx("div", { onClick: onClick, className: cn(sizes, positions, styles), children: children }));
|
|
30
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "../globals.css";
|
|
2
|
+
interface ChartCardProps {
|
|
3
|
+
data: Record<string, string | number>[];
|
|
4
|
+
xAxis: string;
|
|
5
|
+
yAxis: string;
|
|
6
|
+
lines?: {
|
|
7
|
+
dataKey: string;
|
|
8
|
+
stroke: string;
|
|
9
|
+
}[];
|
|
10
|
+
bars?: {
|
|
11
|
+
dataKey: string;
|
|
12
|
+
fill: string;
|
|
13
|
+
}[];
|
|
14
|
+
areas?: {
|
|
15
|
+
dataKey: string;
|
|
16
|
+
fill: string;
|
|
17
|
+
}[];
|
|
18
|
+
}
|
|
19
|
+
export declare function ChartCard({ data, xAxis, yAxis, lines, bars, areas, }: ChartCardProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "../globals.css";
|
|
3
|
+
import { Area, Bar, ComposedChart, Line, ResponsiveContainer, Tooltip, XAxis, YAxis, } from "recharts";
|
|
4
|
+
import { Card } from "./Card";
|
|
5
|
+
export function ChartCard({ data, xAxis, yAxis, lines, bars, areas, }) {
|
|
6
|
+
return (_jsx(Card, { options: { width: "xLarge", height: "large", text: { size: "xs" } }, children: _jsx(ResponsiveContainer, { width: "100%", height: "100%", children: _jsxs(ComposedChart, { data: data, children: [_jsx(XAxis, { dataKey: xAxis }), _jsx(YAxis, { dataKey: yAxis }), _jsx(Tooltip, {}), lines?.map((line) => (_jsx(Line, { ...line }, line.dataKey))), bars?.map((bar) => (_jsx(Bar, { ...bar }, bar.dataKey))), areas?.map((area) => (_jsx(Area, { ...area }, area.dataKey)))] }) }) }));
|
|
7
|
+
}
|
package/card/ProfileCard.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
type Level = "PS" | "ST" | "BA" | "JR" | "HJ";
|
|
2
|
-
export declare function ProfileCard
|
|
3
|
-
info: {
|
|
4
|
-
name: string;
|
|
5
|
-
birthday: string;
|
|
6
|
-
image?: string;
|
|
7
|
-
};
|
|
8
|
-
gradeData?: {
|
|
9
|
-
level?: Level;
|
|
10
|
-
score?: number;
|
|
11
|
-
grade?: number;
|
|
12
|
-
};
|
|
13
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export {};
|
|
1
|
+
type Level = "PS" | "ST" | "BA" | "JR" | "HJ";
|
|
2
|
+
export declare function ProfileCard({ info, gradeData, }: {
|
|
3
|
+
info: {
|
|
4
|
+
name: string;
|
|
5
|
+
birthday: string;
|
|
6
|
+
image?: string;
|
|
7
|
+
};
|
|
8
|
+
gradeData?: {
|
|
9
|
+
level?: Level;
|
|
10
|
+
score?: number;
|
|
11
|
+
grade?: number;
|
|
12
|
+
};
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
package/card/ProfileCard.js
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { Card } from "./Card";
|
|
14
|
-
import { colorsByLevel } from "../util";
|
|
15
|
-
export function ProfileCard(_a) {
|
|
16
|
-
var info = _a.info, gradeData = _a.gradeData;
|
|
17
|
-
var name = info.name, birthday = info.birthday, image = info.image;
|
|
18
|
-
var _b = gradeData !== null && gradeData !== void 0 ? gradeData : {}, level = _b.level, score = _b.score, grade = _b.grade;
|
|
19
|
-
return (_jsx(Card, __assign({ options: { width: 84 } }, { children: _jsxs("div", __assign({ className: "flex" }, { children: [_jsx("img", { src: image, alt: "profile", className: "h-20 w-20 overflow-hidden rounded-full object-cover " }), _jsxs("div", __assign({ className: "ml-auto flex flex-col gap-4" }, { children: [_jsxs("div", __assign({ className: "flex w-52 items-end gap-2 border-b-2 border-blue-navy pb-2" }, { children: [_jsx("div", __assign({ className: "text-xl font-bold" }, { children: name })), _jsx("div", { children: birthday })] })), _jsxs("div", { children: [_jsx("div", { children: "\uD559\uC6D0\uC0DD" }), _jsx("div", { children: level ? colorsByLevel[level] : "" })] })] }))] })) })));
|
|
20
|
-
}
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Card } from "./Card";
|
|
3
|
+
import { colorsByLevel } from "../util";
|
|
4
|
+
export function ProfileCard({ info, gradeData, }) {
|
|
5
|
+
const { name, birthday, image } = info;
|
|
6
|
+
const { level, score, grade } = gradeData ?? {};
|
|
7
|
+
return (_jsx(Card, { options: { width: "small" }, children: _jsxs("div", { className: "flex", children: [_jsx("img", { src: image, alt: "profile", className: "h-20 w-20 overflow-hidden rounded-full object-cover " }), _jsxs("div", { className: "ml-auto flex flex-col gap-4", children: [_jsxs("div", { className: "flex w-52 items-end gap-2 border-b-2 border-blue-navy pb-2", children: [_jsx("div", { className: "text-xl font-bold", children: name }), _jsx("div", { children: birthday })] }), _jsxs("div", { children: [_jsx("div", { children: "\uD559\uC6D0\uC0DD" }), _jsx("div", { children: level ? colorsByLevel[level] : "" })] })] })] }) }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "../globals.css";
|
|
2
|
+
export declare function TableCard({ data, fields, sizes, options, }: {
|
|
3
|
+
data: Record<string, string>[];
|
|
4
|
+
fields: Record<string, string>;
|
|
5
|
+
sizes: Record<string, string>;
|
|
6
|
+
options?: {
|
|
7
|
+
color?: {
|
|
8
|
+
background: string;
|
|
9
|
+
text: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "../globals.css";
|
|
3
|
+
import { Card } from "./Card";
|
|
4
|
+
export function TableCard({ data, fields, sizes, options, }) {
|
|
5
|
+
const { color } = options ?? {};
|
|
6
|
+
const { background: bgColor, text: textColor } = color ?? {};
|
|
7
|
+
const keys = Object.keys(fields);
|
|
8
|
+
const fieldsClassNames = [
|
|
9
|
+
`flex h-11 items-center font-bold pl-4`,
|
|
10
|
+
`bg-${bgColor ?? "gray-300"} text-${textColor ?? "black"}`,
|
|
11
|
+
].join(" ");
|
|
12
|
+
return (_jsx(Card, { options: { width: "large", height: "large" }, children: _jsxs("div", { className: "overflow-hidden text-xs xs:text-sm sm:text-base", children: [_jsx("div", { className: fieldsClassNames, children: keys.map((key) => (_jsx("div", { className: `w-${sizes[key]}`, children: fields[key] }, key))) }), data.map((row, index) => (_jsx("div", { className: "flex items-center pl-4 h-11 ", children: keys.map((key) => (_jsx("div", { className: `truncate w-${sizes[key] ?? "auto"}`, children: row[key] }, key))) }, index)))] }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Size } from "./Card";
|
|
2
|
+
type ImageSize = "sub" | "full";
|
|
3
|
+
export declare function TrumpCard({ titles, options, }: {
|
|
4
|
+
titles: {
|
|
5
|
+
title: string;
|
|
6
|
+
subTitle?: string[];
|
|
7
|
+
color?: string;
|
|
8
|
+
};
|
|
9
|
+
options?: {
|
|
10
|
+
width?: Size;
|
|
11
|
+
image?: {
|
|
12
|
+
path: string;
|
|
13
|
+
size?: ImageSize;
|
|
14
|
+
};
|
|
15
|
+
onClick?: () => unknown | (() => Promise<unknown>);
|
|
16
|
+
subButton?: [string, string, () => unknown | (() => Promise<unknown>)];
|
|
17
|
+
};
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LineBreaks } from "../text";
|
|
3
|
+
import { Card } from "./Card";
|
|
4
|
+
export function TrumpCard({ titles, options, }) {
|
|
5
|
+
const { title, subTitle, color: titleColor } = titles;
|
|
6
|
+
const { onClick, width, image, subButton } = options ?? {};
|
|
7
|
+
const [buttonText, buttonBgColor, buttonAction] = subButton ?? [
|
|
8
|
+
null,
|
|
9
|
+
"red-crimson",
|
|
10
|
+
() => { },
|
|
11
|
+
];
|
|
12
|
+
const { path, size } = image ?? { size: "sub" };
|
|
13
|
+
const imageClassNames = () => {
|
|
14
|
+
if (size === "full")
|
|
15
|
+
return "w-full h-full object-cover";
|
|
16
|
+
return "absolute bottom-0 right-0 w-full xs:w-auto max-w-120 z-0 max-h-44 object-contain";
|
|
17
|
+
};
|
|
18
|
+
return (_jsxs(Card, { options: { width: width, onClick: onClick }, children: [_jsxs("div", { className: `absolute top-8 left-8 w-48 flex flex-col gap-2 z-10 text-${titleColor}`, children: [_jsx("div", { className: "text-xl font-bold", children: title }), _jsx(LineBreaks, { gap: 0, texts: subTitle ?? [""] }), subButton ? (_jsx("button", { className: `text-white rounded-md bg-${buttonBgColor} w-45 h-11 flex justify-center items-center`, onClick: buttonAction, children: buttonText })) : null] }), path ? (_jsx("img", { src: path, alt: "trump-image", loading: "lazy", className: imageClassNames() })) : null] }));
|
|
19
|
+
}
|
package/card/index.d.ts
CHANGED
package/card/index.js
CHANGED
package/deck/Deck.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare function Deck<T extends string | number>({ children, titles, options, }: {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
titles?: {
|
|
5
|
+
title: string;
|
|
6
|
+
subTitle?: string;
|
|
7
|
+
gapTitle?: number;
|
|
8
|
+
};
|
|
9
|
+
options?: {
|
|
10
|
+
width?: T;
|
|
11
|
+
height?: number;
|
|
12
|
+
gapX?: number;
|
|
13
|
+
gapY?: number;
|
|
14
|
+
};
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
package/deck/Deck.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function Deck({ children, titles, options, }) {
|
|
3
|
+
const { title, subTitle, gapTitle } = titles ?? {};
|
|
4
|
+
const { height, gapX, gapY } = options ?? {};
|
|
5
|
+
const containerClassNames = [
|
|
6
|
+
`flex flex-col h-${height ?? "auto"} gap-${gapTitle ?? 4} `,
|
|
7
|
+
].join(" ");
|
|
8
|
+
const bodyClassNames = [
|
|
9
|
+
`flex flex-col sm:flex-row `,
|
|
10
|
+
`gap-x-${gapX ?? 5} gap-y-${gapY ?? 5}`,
|
|
11
|
+
"duration-500",
|
|
12
|
+
].join(" ");
|
|
13
|
+
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: "pl-1", children: [_jsx("div", { className: "text-xl xl:text-2xl font-bold", children: title }), _jsx("div", { className: "", children: subTitle })] }), _jsx("div", { className: bodyClassNames, children: children })] }));
|
|
14
|
+
}
|
package/deck/index.d.ts
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import "../style.css";
|
|
3
|
-
export declare function Deck<T extends string | number>({ children, titles, options, }: {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
titles?: {
|
|
6
|
-
title: string;
|
|
7
|
-
subTitle?: string;
|
|
8
|
-
gapTitle?: number;
|
|
9
|
-
};
|
|
10
|
-
options?: {
|
|
11
|
-
direction?: "row" | "col" | "wrap";
|
|
12
|
-
justify?: "start" | "end" | "center" | "between" | "around" | "evenly";
|
|
13
|
-
width?: T;
|
|
14
|
-
height?: number;
|
|
15
|
-
gapX?: number;
|
|
16
|
-
gapY?: number;
|
|
17
|
-
};
|
|
18
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export * from "./Deck";
|
package/deck/index.js
CHANGED
|
@@ -1,28 +1 @@
|
|
|
1
|
-
|
|
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
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import "../style.css";
|
|
14
|
-
export function Deck(_a) {
|
|
15
|
-
var children = _a.children, titles = _a.titles, options = _a.options;
|
|
16
|
-
var _b = titles !== null && titles !== void 0 ? titles : {}, title = _b.title, subTitle = _b.subTitle, gapTitle = _b.gapTitle;
|
|
17
|
-
var _c = options !== null && options !== void 0 ? options : {}, direction = _c.direction, height = _c.height, width = _c.width, gapX = _c.gapX, gapY = _c.gapY, justify = _c.justify;
|
|
18
|
-
var classNames = [
|
|
19
|
-
"flex flex-col",
|
|
20
|
-
"h-".concat(height !== null && height !== void 0 ? height : "auto", " w-").concat(width !== null && width !== void 0 ? width : "full", " gap-").concat(gapTitle !== null && gapTitle !== void 0 ? gapTitle : 4, " "),
|
|
21
|
-
].join(" ");
|
|
22
|
-
var bodyClassNames = [
|
|
23
|
-
"flex-".concat(direction !== null && direction !== void 0 ? direction : "row", " justify-").concat(justify !== null && justify !== void 0 ? justify : "start"),
|
|
24
|
-
"gap-x-".concat(gapX !== null && gapX !== void 0 ? gapX : 5, " gap-y-").concat(gapY !== null && gapY !== void 0 ? gapY : 5),
|
|
25
|
-
"flex w-full duration-500",
|
|
26
|
-
].join(" ");
|
|
27
|
-
return (_jsxs("div", __assign({ className: classNames }, { children: [_jsxs("div", __assign({ className: "pl-1" }, { children: [_jsx("div", __assign({ className: "text-2xl font-bold" }, { children: title })), _jsx("div", __assign({ className: "" }, { children: subTitle }))] })), _jsx("div", __assign({ className: bodyClassNames }, { children: children }))] })));
|
|
28
|
-
}
|
|
1
|
+
export * from "./Deck";
|