@edu-tosel/design 1.0.1 → 1.0.3
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 +44 -30
- package/asset/json/credit-lottie.json +1 -0
- package/asset/json/loading-lottie.json +1 -0
- package/asset/json/test.svg +1 -0
- package/board/index.d.ts +2 -2
- package/board/index.js +2 -2
- package/board/template/CanvasBoard.d.ts +2 -0
- package/board/template/CanvasBoard.js +10 -0
- package/board/template/ManageBoard.d.ts +4 -0
- package/board/template/ManageBoard.js +27 -0
- package/board/widget/Board.d.ts +2 -0
- package/board/widget/Board.js +29 -0
- package/board/widget/DataField.d.ts +6 -0
- package/board/widget/DataField.js +24 -0
- package/board/widget/Header.d.ts +2 -0
- package/board/widget/Header.js +22 -0
- package/board/widget/Tags.d.ts +3 -0
- package/board/widget/Tags.js +30 -0
- package/card/index.d.ts +5 -4
- package/card/index.js +5 -4
- package/card/{ChartCard.d.ts → template/ChartCard.d.ts} +1 -2
- package/card/{ChartCard.js → template/ChartCard.js} +1 -2
- package/card/{ProfileCard.js → template/ProfileCard.js} +2 -2
- package/card/template/RowCard.d.ts +5 -0
- package/card/template/RowCard.js +26 -0
- package/card/{TableCard.d.ts → template/TableCard.d.ts} +1 -2
- package/card/{TableCard.js → template/TableCard.js} +1 -2
- package/card/{TrumpCard.d.ts → template/TrumpCard.d.ts} +1 -1
- package/card/template/TrumpCard.js +19 -0
- package/card/{Card.d.ts → widget/Card.d.ts} +1 -2
- package/card/widget/Card.js +45 -0
- package/deck/Deck.d.ts +1 -0
- package/deck/Deck.js +11 -10
- package/globals.css +6 -6
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/interface/Board.d.ts +45 -6
- package/interface/Card.d.ts +3 -0
- package/interface/HTMLElement.d.ts +13 -0
- package/interface/HTMLElement.js +1 -0
- package/interface/Modal.d.ts +1 -1
- package/interface/Property.d.ts +3 -1
- package/interface/Property.js +2 -0
- package/interface/index.d.ts +0 -1
- package/interface/index.js +0 -1
- package/layout/dashboard/index.js +1 -1
- package/menu/SideMenu.d.ts +1 -0
- package/menu/SideMenu.js +14 -0
- package/menu/index.d.ts +1 -0
- package/menu/index.js +1 -0
- package/modal/ControllerModal.d.ts +6 -0
- package/modal/ControllerModal.js +6 -0
- package/modal/Modal.js +7 -2
- package/modal/index.d.ts +1 -0
- package/modal/index.js +1 -0
- package/navigation/Navigation.js +3 -5
- package/package.json +4 -2
- package/shelf/Shelf.d.ts +1 -1
- package/shelf/Shelf.js +2 -2
- package/shelf/index.d.ts +1 -1
- package/shelf/index.js +1 -1
- package/store/index.d.ts +6 -0
- package/store/index.js +21 -0
- package/tailwind.config.ts +176 -51
- package/version.txt +1 -1
- package/board/Board.d.ts +0 -2
- package/board/Board.js +0 -14
- package/board/CanvasBoard.d.ts +0 -2
- package/board/CanvasBoard.js +0 -11
- package/board/Header.d.ts +0 -6
- package/board/Header.js +0 -12
- package/board/ListBoard.d.ts +0 -7
- package/board/ListBoard.js +0 -7
- package/card/Card.js +0 -32
- package/card/TrumpCard.js +0 -19
- /package/card/{ProfileCard.d.ts → template/ProfileCard.d.ts} +0 -0
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/interface/Board.d.ts
CHANGED
|
@@ -1,10 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Dispatch } from "react";
|
|
2
|
+
import { Button, Size } from "./Property";
|
|
3
|
+
export interface BoardHeaderProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
tags?: {
|
|
6
|
+
selects?: {
|
|
7
|
+
title: string;
|
|
8
|
+
onChange: Dispatch<string>;
|
|
9
|
+
options: [string | number, string][];
|
|
10
|
+
width?: Size;
|
|
11
|
+
}[];
|
|
12
|
+
inputs?: {
|
|
13
|
+
title: string;
|
|
14
|
+
onChange: Dispatch<string>;
|
|
15
|
+
placeholder: string;
|
|
16
|
+
width?: Size;
|
|
17
|
+
}[];
|
|
6
18
|
};
|
|
7
19
|
options?: {
|
|
8
|
-
|
|
20
|
+
colors?: {
|
|
21
|
+
bgColor?: string;
|
|
22
|
+
textColor?: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface BoardProps {
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
options?: {
|
|
29
|
+
widgets?: [string, React.ReactNode][];
|
|
30
|
+
tabs?: Button[];
|
|
31
|
+
color?: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface ManageBoardProps<T> extends BoardProps {
|
|
35
|
+
data: {
|
|
36
|
+
dataSets: {
|
|
37
|
+
title?: string;
|
|
38
|
+
items: T[];
|
|
39
|
+
renderItem: (items: T) => React.ReactNode;
|
|
40
|
+
}[];
|
|
41
|
+
dataField?: {
|
|
42
|
+
fields: Record<string, string>;
|
|
43
|
+
sizes: Record<string, string>;
|
|
44
|
+
};
|
|
45
|
+
gap?: number;
|
|
9
46
|
};
|
|
47
|
+
header?: BoardHeaderProps;
|
|
48
|
+
subWidget?: React.ReactNode;
|
|
10
49
|
}
|
package/interface/Card.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ import { ImageSize, Size } from "./Property";
|
|
|
15
15
|
export interface CardProps {
|
|
16
16
|
children: React.ReactNode;
|
|
17
17
|
options?: {
|
|
18
|
+
boundary?: "shadow" | "border" | "none";
|
|
19
|
+
rounded?: string;
|
|
18
20
|
height?: Size;
|
|
19
21
|
width?: Size;
|
|
20
22
|
text?: {
|
|
@@ -22,6 +24,7 @@ export interface CardProps {
|
|
|
22
24
|
color?: string;
|
|
23
25
|
};
|
|
24
26
|
onClick?: () => unknown | (() => Promise<unknown>);
|
|
27
|
+
overflow?: "hiden" | "auto";
|
|
25
28
|
};
|
|
26
29
|
}
|
|
27
30
|
export interface ChartCardProps {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Dispatch } from "react";
|
|
2
|
+
import { Size } from "./Property";
|
|
3
|
+
export interface HTMLElement {
|
|
4
|
+
title: string;
|
|
5
|
+
onChange: Dispatch<string>;
|
|
6
|
+
width?: Size;
|
|
7
|
+
}
|
|
8
|
+
export interface HTMLSelectElement extends HTMLElement {
|
|
9
|
+
selectOptions?: [string | number, string][];
|
|
10
|
+
}
|
|
11
|
+
export interface HTMLInputElement extends HTMLElement {
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/interface/Modal.d.ts
CHANGED
package/interface/Property.d.ts
CHANGED
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
* @property {"md"} md - Medium size
|
|
9
9
|
* @property {"lg"} lg - Large size
|
|
10
10
|
* @property {"xl"} xl - Extra large size
|
|
11
|
+
* @property {"2xl"} 2xl - Double extra large size
|
|
12
|
+
* @property {"full"} full - Full size
|
|
11
13
|
*/
|
|
12
|
-
export type Size = "xs" | "sm" | "md" | "lg" | "xl";
|
|
14
|
+
export type Size = "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full";
|
|
13
15
|
/**
|
|
14
16
|
* Image size type
|
|
15
17
|
* @enum {string}
|
package/interface/Property.js
CHANGED
package/interface/index.d.ts
CHANGED
package/interface/index.js
CHANGED
|
@@ -6,5 +6,5 @@ import { cn } from "../../util";
|
|
|
6
6
|
export function DashboardLayout({ subject, colors, navigations, children, }) {
|
|
7
7
|
const [title, image, imageUrl] = subject ?? ["", "", ""];
|
|
8
8
|
const [bgColor, textColor] = colors ?? ["white", "black"];
|
|
9
|
-
return (_jsxs("div", { className: cn(`bg-${bgColor}`, `text-${textColor}`, `min-h-screen font-pretendard-medium`), children: [_jsx(Header, { title: title, image: [image, imageUrl] }), _jsxs("div", { className: "flex gap-12
|
|
9
|
+
return (_jsxs("div", { className: cn(`bg-${bgColor}`, `text-${textColor}`, `min-h-screen h-screen xl:h-auto font-pretendard-medium`), children: [_jsx(Header, { title: title, image: [image, imageUrl] }), _jsxs("div", { className: "h-full flex gap-12 pt-20 xl:gap-8 xl:pl-2 2xl:px-9 xl:pt-10 xl:m-0 ", children: [_jsx(NavigationContainer, { children: navigations.map((nav, index) => (_jsx(Fragment, { children: nav }, index))) }), children] })] }));
|
|
10
10
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function SideMenu(): import("react/jsx-runtime").JSX.Element;
|
package/menu/SideMenu.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useWidgetStore } from "../store";
|
|
3
|
+
import { cn } from "../util";
|
|
4
|
+
export default function SideMenu() {
|
|
5
|
+
const { tempData, clearTempData, events, removeView } = useWidgetStore();
|
|
6
|
+
const isOpen = events.some(({ event }) => event === "sideMenu");
|
|
7
|
+
const positions = "absolute top-20 right-0";
|
|
8
|
+
const sizes = `${isOpen ? "w-160" : "w-0"} h-full bg-gray-200`;
|
|
9
|
+
const styles = `${isOpen ? "opacity-100 z-30" : "opacity-0 z-0"} bg-gray-200 duration-500 `;
|
|
10
|
+
return (_jsx("div", { className: cn(positions, sizes, styles), children: _jsxs("div", { className: "relative w-full h-full", children: [_jsx("div", { children: Object.entries(tempData).map(([key, value]) => (_jsxs("div", { className: "text-2xl font-bold", children: [key, ": ", value] }, key))) }), _jsx("button", { onClick: () => {
|
|
11
|
+
clearTempData();
|
|
12
|
+
return removeView("sideMenu");
|
|
13
|
+
}, className: "absolute left-0 top-2/5 text-3xl font-bold", children: ">" })] }) }));
|
|
14
|
+
}
|
package/menu/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SideMenu } from "./SideMenu";
|
package/menu/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SideMenu } from "./SideMenu";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Modal } from "./Modal";
|
|
3
|
+
export default function ControllerModal({ options, }) {
|
|
4
|
+
const { buttons } = options ?? {};
|
|
5
|
+
return (_jsx(Modal, { options: { width: "lg", height: "xl", buttons }, children: _jsx("div", { className: "w-full h-120 border-2 " }) }));
|
|
6
|
+
}
|
package/modal/Modal.js
CHANGED
|
@@ -8,6 +8,8 @@ const widthSize = {
|
|
|
8
8
|
md: "w-2/3 min-w-76 max-w-176",
|
|
9
9
|
lg: "w-full min-w-76 max-w-360",
|
|
10
10
|
xl: "w-2/3 min-w-76 max-w-176",
|
|
11
|
+
"2xl": "w-2/3 min-w-76 max-w-176",
|
|
12
|
+
full: "w-full",
|
|
11
13
|
};
|
|
12
14
|
const heightSize = {
|
|
13
15
|
xs: "",
|
|
@@ -15,12 +17,15 @@ const heightSize = {
|
|
|
15
17
|
md: "h-72 sm:h-48",
|
|
16
18
|
lg: "h-120",
|
|
17
19
|
xl: "h-180",
|
|
20
|
+
"2xl": "w-2/3 min-w-76 max-w-176",
|
|
21
|
+
full: "h-full",
|
|
18
22
|
};
|
|
19
23
|
export function Modal({ children, options }) {
|
|
20
24
|
const { buttons, width, height } = options ?? {};
|
|
21
25
|
const { clearModal } = useWidgetStore();
|
|
22
26
|
const sizes = `${heightSize[height ?? "sm"]} ${widthSize[width ?? "md"]}`;
|
|
23
|
-
const
|
|
24
|
-
|
|
27
|
+
const paddings = "pt-18 px-25";
|
|
28
|
+
const styles = "rounded-xl bg-white relative overflow-hidden";
|
|
29
|
+
return (_jsx("div", { className: background, children: _jsxs("div", { className: cn(sizes, styles, paddings), children: [children, _jsx(_Fragment, { children: buttons ? (_jsx("div", { className: `${absolute.br(8, 10)} flex justify-end gap-4`, children: buttons.map(([text, onClick]) => (_jsx("button", { className: "rounded-2xl bg-black px-8 py-2 text-2xl font-bold text-white", onClick: onClick, children: text }, text))) })) : null }), _jsx("button", { className: absolute.tl(5, 7) +
|
|
25
30
|
"bg-black rounded-full h-9 w-9 flex justify-center items-center", onClick: clearModal, children: _jsx("div", { className: "x-shape" }) })] }) }));
|
|
26
31
|
}
|
package/modal/index.d.ts
CHANGED
package/modal/index.js
CHANGED
package/navigation/Navigation.js
CHANGED
|
@@ -8,9 +8,7 @@ export const buttonClassNames = (href, nowPath, color) => {
|
|
|
8
8
|
"font-bold w-full xl:w-50 h-11 xl:rounded-2xl flex justify-center xl:justify-start xl:pl-5",
|
|
9
9
|
].join(" ");
|
|
10
10
|
const checkPathMatch = (href, nowPath) => {
|
|
11
|
-
|
|
12
|
-
return !nowPath.slice(1).includes("/");
|
|
13
|
-
return nowPath.includes(href);
|
|
11
|
+
return href.split("/").pop() === nowPath.split("/").pop();
|
|
14
12
|
};
|
|
15
13
|
const toggle = checkPathMatch(href, nowPath)
|
|
16
14
|
? `bg-${bg}`
|
|
@@ -18,9 +16,9 @@ export const buttonClassNames = (href, nowPath, color) => {
|
|
|
18
16
|
return [classNames, toggle].join(" ");
|
|
19
17
|
};
|
|
20
18
|
export function NavigationContainer({ children, }) {
|
|
21
|
-
const
|
|
19
|
+
const displays = "flex flex-row xl:flex-col z-40";
|
|
22
20
|
const positions = "fixed bottom-0 left-0 xl:static";
|
|
23
21
|
const sizes = "w-full xl:w-auto";
|
|
24
22
|
const styles = "";
|
|
25
|
-
return (_jsx("div", { className: cn(
|
|
23
|
+
return (_jsx("div", { className: cn(displays, positions, sizes, styles), children: children }));
|
|
26
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edu-tosel/design",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "UI components for International TOSEL Committee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jsx",
|
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"react": "^18.2.0",
|
|
16
16
|
"react-dom": "^18.2.0",
|
|
17
|
+
"react-lottie-player": "^1.5.6",
|
|
17
18
|
"react-router-dom": "^6.21.3",
|
|
18
19
|
"recharts": "^2.11.0",
|
|
19
20
|
"tailwind-scrollbar-hide": "^1.1.7",
|
|
20
21
|
"tailwindcss-animate": "^1.0.7",
|
|
21
|
-
"typescript": "^5.2.2"
|
|
22
|
+
"typescript": "^5.2.2",
|
|
23
|
+
"zustand": "^4.5.0"
|
|
22
24
|
},
|
|
23
25
|
"devDependencies": {}
|
|
24
26
|
}
|
package/shelf/Shelf.d.ts
CHANGED
package/shelf/Shelf.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export function Shelf({ children }) {
|
|
3
|
-
return
|
|
2
|
+
export default function Shelf({ children }) {
|
|
3
|
+
return _jsx("div", { className: "inline-flex flex-col gap-8 xl:w-auto", children: children });
|
|
4
4
|
}
|
package/shelf/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { default as Shelf } from "./Shelf";
|
package/shelf/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { default as Shelf } from "./Shelf";
|
package/store/index.d.ts
CHANGED
|
@@ -2,9 +2,15 @@ import { WidgetEvent } from "../interface/Widget";
|
|
|
2
2
|
interface WidgetProps {
|
|
3
3
|
events: WidgetEvent[];
|
|
4
4
|
setView: (prop: string) => void;
|
|
5
|
+
removeView: (prop: string) => void;
|
|
5
6
|
setModal: (prop: string) => void;
|
|
6
7
|
removeModal: (prop: string) => void;
|
|
7
8
|
clearModal: () => void;
|
|
9
|
+
order: [string, "asc" | "desc"];
|
|
10
|
+
setOrder: (prop: string) => void;
|
|
11
|
+
tempData: Record<string, string | number>;
|
|
12
|
+
setTempData: (prop: Record<string, string | number>) => void;
|
|
13
|
+
clearTempData: () => void;
|
|
8
14
|
}
|
|
9
15
|
export declare const useWidgetStore: import("zustand").UseBoundStore<import("zustand").StoreApi<WidgetProps>>;
|
|
10
16
|
export {};
|
package/store/index.js
CHANGED
|
@@ -4,6 +4,24 @@ export const useWidgetStore = create((set) => ({
|
|
|
4
4
|
setView: (prop) => set((state) => ({
|
|
5
5
|
events: [...state.events, { event: prop, type: "view" }],
|
|
6
6
|
})),
|
|
7
|
+
removeView: (prop) => {
|
|
8
|
+
set((state) => ({
|
|
9
|
+
events: state.events.filter(({ event }) => event !== prop),
|
|
10
|
+
}));
|
|
11
|
+
},
|
|
12
|
+
order: ["", "asc"],
|
|
13
|
+
setOrder: (prop) => {
|
|
14
|
+
set((state) => {
|
|
15
|
+
if (state.order[0] !== prop) {
|
|
16
|
+
return {
|
|
17
|
+
order: [prop, "asc"],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
order: [prop, state.order[1] === "asc" ? "desc" : "asc"],
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
},
|
|
7
25
|
setModal: (prop) => set((state) => ({
|
|
8
26
|
events: [...state.events, { event: prop, type: "modal" }],
|
|
9
27
|
})),
|
|
@@ -15,4 +33,7 @@ export const useWidgetStore = create((set) => ({
|
|
|
15
33
|
clearModal: () => set((state) => ({
|
|
16
34
|
events: state.events.filter(({ type }) => type !== "modal"),
|
|
17
35
|
})),
|
|
36
|
+
tempData: {},
|
|
37
|
+
setTempData: (prop) => set((state) => ({ tempData: { ...state.tempData, ...prop } })),
|
|
38
|
+
clearTempData: () => set({ tempData: {} }),
|
|
18
39
|
}));
|