@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.
Files changed (76) hide show
  1. package/README.md +44 -30
  2. package/asset/json/credit-lottie.json +1 -0
  3. package/asset/json/loading-lottie.json +1 -0
  4. package/asset/json/test.svg +1 -0
  5. package/board/index.d.ts +2 -2
  6. package/board/index.js +2 -2
  7. package/board/template/CanvasBoard.d.ts +2 -0
  8. package/board/template/CanvasBoard.js +10 -0
  9. package/board/template/ManageBoard.d.ts +4 -0
  10. package/board/template/ManageBoard.js +27 -0
  11. package/board/widget/Board.d.ts +2 -0
  12. package/board/widget/Board.js +29 -0
  13. package/board/widget/DataField.d.ts +6 -0
  14. package/board/widget/DataField.js +24 -0
  15. package/board/widget/Header.d.ts +2 -0
  16. package/board/widget/Header.js +22 -0
  17. package/board/widget/Tags.d.ts +3 -0
  18. package/board/widget/Tags.js +30 -0
  19. package/card/index.d.ts +5 -4
  20. package/card/index.js +5 -4
  21. package/card/{ChartCard.d.ts → template/ChartCard.d.ts} +1 -2
  22. package/card/{ChartCard.js → template/ChartCard.js} +1 -2
  23. package/card/{ProfileCard.js → template/ProfileCard.js} +2 -2
  24. package/card/template/RowCard.d.ts +5 -0
  25. package/card/template/RowCard.js +26 -0
  26. package/card/{TableCard.d.ts → template/TableCard.d.ts} +1 -2
  27. package/card/{TableCard.js → template/TableCard.js} +1 -2
  28. package/card/{TrumpCard.d.ts → template/TrumpCard.d.ts} +1 -1
  29. package/card/template/TrumpCard.js +19 -0
  30. package/card/{Card.d.ts → widget/Card.d.ts} +1 -2
  31. package/card/widget/Card.js +45 -0
  32. package/deck/Deck.d.ts +1 -0
  33. package/deck/Deck.js +11 -10
  34. package/globals.css +6 -6
  35. package/index.d.ts +1 -0
  36. package/index.js +1 -0
  37. package/interface/Board.d.ts +45 -6
  38. package/interface/Card.d.ts +3 -0
  39. package/interface/HTMLElement.d.ts +13 -0
  40. package/interface/HTMLElement.js +1 -0
  41. package/interface/Modal.d.ts +1 -1
  42. package/interface/Property.d.ts +3 -1
  43. package/interface/Property.js +2 -0
  44. package/interface/index.d.ts +0 -1
  45. package/interface/index.js +0 -1
  46. package/layout/dashboard/index.js +1 -1
  47. package/menu/SideMenu.d.ts +1 -0
  48. package/menu/SideMenu.js +14 -0
  49. package/menu/index.d.ts +1 -0
  50. package/menu/index.js +1 -0
  51. package/modal/ControllerModal.d.ts +6 -0
  52. package/modal/ControllerModal.js +6 -0
  53. package/modal/Modal.js +7 -2
  54. package/modal/index.d.ts +1 -0
  55. package/modal/index.js +1 -0
  56. package/navigation/Navigation.js +3 -5
  57. package/package.json +4 -2
  58. package/shelf/Shelf.d.ts +1 -1
  59. package/shelf/Shelf.js +2 -2
  60. package/shelf/index.d.ts +1 -1
  61. package/shelf/index.js +1 -1
  62. package/store/index.d.ts +6 -0
  63. package/store/index.js +21 -0
  64. package/tailwind.config.ts +176 -51
  65. package/version.txt +1 -1
  66. package/board/Board.d.ts +0 -2
  67. package/board/Board.js +0 -14
  68. package/board/CanvasBoard.d.ts +0 -2
  69. package/board/CanvasBoard.js +0 -11
  70. package/board/Header.d.ts +0 -6
  71. package/board/Header.js +0 -12
  72. package/board/ListBoard.d.ts +0 -7
  73. package/board/ListBoard.js +0 -7
  74. package/card/Card.js +0 -32
  75. package/card/TrumpCard.js +0 -19
  76. /package/card/{ProfileCard.d.ts → template/ProfileCard.d.ts} +0 -0
package/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from "./board";
3
3
  export * from "./card";
4
4
  export * from "./deck";
5
5
  export * from "./layout";
6
+ export * from "./menu";
6
7
  export * from "./modal";
7
8
  export * from "./navigation";
8
9
  export * from "./shelf";
package/index.js CHANGED
@@ -3,6 +3,7 @@ export * from "./board";
3
3
  export * from "./card";
4
4
  export * from "./deck";
5
5
  export * from "./layout";
6
+ export * from "./menu";
6
7
  export * from "./modal";
7
8
  export * from "./navigation";
8
9
  export * from "./shelf";
@@ -1,10 +1,49 @@
1
- /// <reference types="react" />
2
- export interface BoardProps {
3
- children: React.ReactNode;
4
- widget?: {
5
- widgets: [[string, React.ReactNode]];
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
- height?: number;
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
  }
@@ -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 {};
@@ -5,7 +5,7 @@ export interface ModalProps {
5
5
  options?: {
6
6
  width?: Size;
7
7
  height?: Size;
8
- padding?: Record<string, number>;
8
+ padding?: boolean;
9
9
  buttons?: Button[];
10
10
  };
11
11
  }
@@ -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}
@@ -8,5 +8,7 @@
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
14
  export {};
@@ -1,3 +1,2 @@
1
1
  export * from "./Property";
2
2
  export * from "./Widget";
3
- export * from "./Board";
@@ -1,3 +1,2 @@
1
1
  export * from "./Property";
2
2
  export * from "./Widget";
3
- export * from "./Board";
@@ -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 xl:px-9 xl:pt-12 mt-20 xl:m-0", children: [_jsx(NavigationContainer, { children: navigations.map((nav, index) => (_jsx(Fragment, { children: nav }, index))) }), children] })] }));
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;
@@ -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
+ }
@@ -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 { Button } from "../interface";
2
+ export default function ControllerModal({ options, }: {
3
+ options?: {
4
+ buttons?: Button[];
5
+ };
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -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 styles = "rounded-xl bg-white relative";
24
- return (_jsx("div", { className: background, children: _jsxs("div", { className: cn(sizes, styles), children: [children, _jsx(_Fragment, { children: buttons ? (_jsx("div", { className: `${absolute.br(5, 7)} flex justify-end gap-4`, children: buttons.map(([text, onClick]) => (_jsx("button", { className: "rounded-2xl bg-black px-8 py-2 text-lg font-bold text-white", onClick: onClick, children: text }, text))) })) : null }), _jsx("button", { className: absolute.tl(5, 7) +
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
@@ -1,2 +1,3 @@
1
1
  export { default as TestModal } from "./TestModal";
2
2
  export { default as AlertModal } from "./AlertModal";
3
+ export { default as ControllerModal } from "./ControllerModal";
package/modal/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { default as TestModal } from "./TestModal";
2
2
  export { default as AlertModal } from "./AlertModal";
3
+ export { default as ControllerModal } from "./ControllerModal";
@@ -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
- if (href === "")
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 layouts = "flex flex-row xl:flex-col z-40";
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(layouts, positions, sizes, styles), children: children }));
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.1",
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
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- export declare function Shelf({ children }: {
2
+ export default function Shelf({ children }: {
3
3
  children: React.ReactNode;
4
4
  }): import("react/jsx-runtime").JSX.Element;
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 (_jsx("div", { className: "inline-flex flex-col gap-12 w-full xl:w-auto", children: children }));
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 * from "./Shelf";
1
+ export { default as Shelf } from "./Shelf";
package/shelf/index.js CHANGED
@@ -1 +1 @@
1
- export * from "./Shelf";
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
  }));