@edu-tosel/design 0.1.9 → 1.0.1

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.
Binary file
Binary file
Binary file
package/board/Board.d.ts CHANGED
@@ -1,7 +1,2 @@
1
- /// <reference types="react" />
2
- export declare function Board({ children, options, }: {
3
- children: React.ReactNode;
4
- options: {
5
- height?: number;
6
- };
7
- }): import("react/jsx-runtime").JSX.Element;
1
+ import { BoardProps } from "../interface/Board";
2
+ export declare function Board({ children, widget, options }: BoardProps): import("react/jsx-runtime").JSX.Element;
package/board/Board.js CHANGED
@@ -1,9 +1,14 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- export function Board({ children, options, }) {
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useWidgetStore } from "../store";
3
+ export function Board({ children, widget, options }) {
4
+ const { events } = useWidgetStore();
3
5
  const { height } = options ?? {};
6
+ const { widgets } = widget ?? {};
4
7
  const classNames = [
5
8
  `min-h-screen xl:min-h-0 xl:h-186 `,
6
9
  "xl:rounded-xl bg-white/80 relative w-full ",
7
10
  ].join(" ");
8
- return _jsx("div", { className: classNames + "", children: children });
11
+ return (_jsxs("div", { className: classNames + "", children: [children, _jsx(_Fragment, { children: widgets?.map(([widgetEvent, Component]) => {
12
+ return events?.some(({ event }) => event === widgetEvent) ? (_jsx(_Fragment, { children: Component })) : null;
13
+ }) })] }));
9
14
  }
@@ -1,7 +1,2 @@
1
- /// <reference types="react" />
2
- export declare function CanvasBoard({ children, options, }: {
3
- children: React.ReactNode;
4
- options?: {
5
- height?: number;
6
- };
7
- }): import("react/jsx-runtime").JSX.Element;
1
+ import { BoardProps } from "../interface/Board";
2
+ export declare function CanvasBoard({ children, widget, options }: BoardProps): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cn } from "../util";
3
3
  import { Board } from "./Board";
4
- export function CanvasBoard({ children, options, }) {
4
+ export function CanvasBoard({ children, widget, options }) {
5
5
  const { height } = options ?? {};
6
6
  const layouts = "flex flex-wrap gap-12 ";
7
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";
8
+ const paddings = "pb-36 xl:pb-12 px-2 xs:px-4 xl:pl-8 xl:pr-2 pt-2 xs:pt-4 xl:pt-8";
9
9
  const styles = "xl:overflow-y-scroll ";
10
- return (_jsx(Board, { options: { height }, children: _jsx("div", { className: cn(layouts, sizes, paddings, styles), children: children }) }));
10
+ return (_jsx(Board, { widget: widget, options: { height }, children: _jsx("div", { className: cn(layouts, sizes, paddings, styles), children: children }) }));
11
11
  }
package/card/Card.d.ts CHANGED
@@ -1,15 +1,3 @@
1
- /// <reference types="react" />
2
1
  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;
2
+ import { CardProps } from "../interface/Card";
3
+ export declare function Card({ children, options }: CardProps): import("react/jsx-runtime").JSX.Element;
package/card/Card.js CHANGED
@@ -2,23 +2,25 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import "../globals.css";
3
3
  import { cn } from "../util";
4
4
  const widthSize = {
5
- small: "md:w-60",
6
- medium: "md:w-90",
7
- large: "md:w-135",
8
- xLarge: "md:w-225",
5
+ xs: "",
6
+ sm: "md:w-60",
7
+ md: "md:w-90",
8
+ lg: "md:w-135",
9
+ xl: "md:w-225",
9
10
  };
10
11
  const heightSize = {
11
- small: "h-72 sm:h-48",
12
- medium: "h-72 sm:h-48",
13
- large: "h-80",
14
- xLarge: "h-80",
12
+ xs: "",
13
+ sm: "h-72 sm:h-48",
14
+ md: "h-72 sm:h-48",
15
+ lg: "h-80",
16
+ xl: "h-125",
15
17
  };
16
- export function Card({ children, options, }) {
18
+ export function Card({ children, options }) {
17
19
  const { height, width, text, onClick } = options ?? {};
18
20
  const { size: textSize, color: textColor } = text ?? {};
19
21
  const sizes = [
20
- `${heightSize[height ?? "small"]}`,
21
- `w-full ${widthSize[width ?? "small"]}`,
22
+ `${heightSize[height ?? "sm"]}`,
23
+ `w-full ${widthSize[width ?? "sm"]}`,
22
24
  ].join(" ");
23
25
  const positions = "relative";
24
26
  const styles = [
@@ -1,20 +1,3 @@
1
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
- }
2
+ import { ChartCardProps } from "../interface/Card";
19
3
  export declare function ChartCard({ data, xAxis, yAxis, lines, bars, areas, }: ChartCardProps): import("react/jsx-runtime").JSX.Element;
20
- export {};
package/card/ChartCard.js CHANGED
@@ -3,5 +3,5 @@ import "../globals.css";
3
3
  import { Area, Bar, ComposedChart, Line, ResponsiveContainer, Tooltip, XAxis, YAxis, } from "recharts";
4
4
  import { Card } from "./Card";
5
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)))] }) }) }));
6
+ return (_jsx(Card, { options: { width: "xl", height: "lg", 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
7
  }
@@ -4,5 +4,5 @@ import { colorsByLevel } from "../util";
4
4
  export function ProfileCard({ info, gradeData, }) {
5
5
  const { name, birthday, image } = info;
6
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] : "" })] })] })] }) }));
7
+ return (_jsx(Card, { options: { width: "sm" }, 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
8
  }
@@ -1,12 +1,3 @@
1
1
  import "../globals.css";
2
- export declare function TableCard({ data, fields, sizes, options, }: {
3
- data: Record<string, string | number>[];
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;
2
+ import { TableCardProps } from "../interface/Card";
3
+ export declare function TableCard({ data, fields, sizes, options }: TableCardProps): import("react/jsx-runtime").JSX.Element;
package/card/TableCard.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import "../globals.css";
3
3
  import { Card } from "./Card";
4
- export function TableCard({ data, fields, sizes, options, }) {
4
+ export function TableCard({ data, fields, sizes, options }) {
5
5
  const { color } = options ?? {};
6
6
  const { background: bgColor, text: textColor } = color ?? {};
7
7
  const keys = Object.keys(fields);
@@ -9,5 +9,5 @@ export function TableCard({ data, fields, sizes, options, }) {
9
9
  `flex h-11 items-center font-bold pl-4`,
10
10
  `bg-${bgColor ?? "gray-300"} text-${textColor ?? "black"}`,
11
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)))] }) }));
12
+ return (_jsx(Card, { options: { width: "lg", height: "lg" }, 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
13
  }
@@ -1,19 +1,2 @@
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 {};
1
+ import { TrumpCardProps } from "../interface/Card";
2
+ export declare function TrumpCard({ titles, options }: TrumpCardProps): import("react/jsx-runtime").JSX.Element;
package/card/TrumpCard.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { LineBreaks } from "../text";
3
3
  import { Card } from "./Card";
4
- export function TrumpCard({ titles, options, }) {
4
+ export function TrumpCard({ titles, options }) {
5
5
  const { title, subTitle, color: titleColor } = titles;
6
6
  const { onClick, width, image, subButton } = options ?? {};
7
7
  const [buttonText, buttonBgColor, buttonAction] = subButton ?? [
package/deck/Deck.js CHANGED
@@ -3,10 +3,10 @@ export function Deck({ children, titles, options, }) {
3
3
  const { title, subTitle, gapTitle } = titles ?? {};
4
4
  const { height, gapX, gapY } = options ?? {};
5
5
  const containerClassNames = [
6
- `flex flex-col h-${height ?? "auto"} gap-${gapTitle ?? 4} `,
6
+ `flex sm:w-full flex-col h-${height ?? "auto"} gap-${gapTitle ?? 4} `,
7
7
  ].join(" ");
8
8
  const bodyClassNames = [
9
- `flex flex-col sm:flex-row `,
9
+ `flex flex-col sm:flex-row sm:w-full `,
10
10
  `gap-x-${gapX ?? 5} gap-y-${gapY ?? 5}`,
11
11
  "duration-500",
12
12
  ].join(" ");
package/globals.css CHANGED
@@ -4,22 +4,22 @@
4
4
 
5
5
  @font-face {
6
6
  font-family: "Pretendard-Medium";
7
- src: url("/fonts/Pretendard-Medium.otf") format("opentype");
7
+ src: url("../src/asset/fonts/Pretendard-Medium.otf") format("opentype");
8
8
  }
9
9
 
10
10
  @font-face {
11
11
  font-family: "Kostar";
12
- src: url("/fonts/Kostar.ttf") format("truetype");
12
+ src: url("../src/asset/fonts/Kostar.ttf") format("truetype");
13
13
  }
14
14
 
15
15
  @font-face {
16
16
  font-family: "NicoMoji";
17
- src: url("/fonts/NicoMoji.ttf") format("truetype");
17
+ src: url("../src/asset/fonts/NicoMoji.ttf") format("truetype");
18
18
  }
19
19
 
20
20
  @font-face {
21
21
  font-family: "Megrim";
22
- src: url("/fonts/Megrim.ttf") format("trueType");
22
+ src: url("../src/asset/fonts/Megrim.ttf") format("trueType");
23
23
  }
24
24
 
25
25
  ::-webkit-scrollbar {
@@ -38,3 +38,30 @@
38
38
  .box-shadow {
39
39
  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.15);
40
40
  }
41
+
42
+ .x-shape {
43
+ position: relative;
44
+ width: 0.83625rem;
45
+ height: 0.83625rem;
46
+ }
47
+
48
+ .x-shape::before,
49
+ .x-shape::after {
50
+ content: "";
51
+ position: absolute;
52
+ top: 50%;
53
+ left: 50%;
54
+ width: 2.5px;
55
+ border-radius: 2px;
56
+ height: 100%;
57
+ background-color: white;
58
+ transform-origin: center;
59
+ }
60
+
61
+ .x-shape::before {
62
+ transform: translate(-50%, -50%) rotate(45deg);
63
+ }
64
+
65
+ .x-shape::after {
66
+ transform: translate(-50%, -50%) rotate(-45deg);
67
+ }
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ export interface BoardProps {
3
+ children: React.ReactNode;
4
+ widget?: {
5
+ widgets: [[string, React.ReactNode]];
6
+ };
7
+ options?: {
8
+ height?: number;
9
+ };
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,70 @@
1
+ /// <reference types="react" />
2
+ import { ImageSize, Size } from "./Property";
3
+ /**
4
+ * CardProps is an interface.
5
+ * @interface CardProps
6
+ * @property {React.ReactNode} children
7
+ * @property {object} options
8
+ * @property {Size} options.height
9
+ * @property {Size} options.width
10
+ * @property {object} options.text
11
+ * @property {string} options.text.size
12
+ * @property {string} options.text.color
13
+ * @property {() => unknown | (() => Promise<unknown>)} options.onClick
14
+ */
15
+ export interface CardProps {
16
+ children: React.ReactNode;
17
+ options?: {
18
+ height?: Size;
19
+ width?: Size;
20
+ text?: {
21
+ size?: string;
22
+ color?: string;
23
+ };
24
+ onClick?: () => unknown | (() => Promise<unknown>);
25
+ };
26
+ }
27
+ export interface ChartCardProps {
28
+ data: Record<string, string | number>[];
29
+ xAxis: string;
30
+ yAxis: string;
31
+ lines?: {
32
+ dataKey: string;
33
+ stroke: string;
34
+ }[];
35
+ bars?: {
36
+ dataKey: string;
37
+ fill: string;
38
+ }[];
39
+ areas?: {
40
+ dataKey: string;
41
+ fill: string;
42
+ }[];
43
+ }
44
+ export interface TableCardProps {
45
+ data: Record<string, string | number>[];
46
+ fields: Record<string, string>;
47
+ sizes: Record<string, string>;
48
+ options?: {
49
+ color?: {
50
+ background: string;
51
+ text: string;
52
+ };
53
+ };
54
+ }
55
+ export interface TrumpCardProps {
56
+ titles: {
57
+ title: string;
58
+ subTitle?: string[];
59
+ color?: string;
60
+ };
61
+ options?: {
62
+ width?: Size;
63
+ image?: {
64
+ path: string;
65
+ size?: ImageSize;
66
+ };
67
+ onClick?: () => unknown | (() => Promise<unknown>);
68
+ subButton?: [string, string, () => unknown | (() => Promise<unknown>)];
69
+ };
70
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { Button, Scripts, Size } from "./Property";
3
+ export interface ModalProps {
4
+ children: React.ReactNode;
5
+ options?: {
6
+ width?: Size;
7
+ height?: Size;
8
+ padding?: Record<string, number>;
9
+ buttons?: Button[];
10
+ };
11
+ }
12
+ export interface AlertModalProps {
13
+ title: string;
14
+ scripts: Scripts;
15
+ options?: {
16
+ buttons?: Button[];
17
+ };
18
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Size type
3
+ * @enum {string}
4
+ * @readonly
5
+ * @description - Size type for the component
6
+ * @property {"xs"} xs - Extra small size
7
+ * @property {"sm"} sm - Small size
8
+ * @property {"md"} md - Medium size
9
+ * @property {"lg"} lg - Large size
10
+ * @property {"xl"} xl - Extra large size
11
+ */
12
+ export type Size = "xs" | "sm" | "md" | "lg" | "xl";
13
+ /**
14
+ * Image size type
15
+ * @enum {string}
16
+ * @readonly
17
+ * @description - Size type for the image
18
+ * @property {"sub"} sub - Sub size
19
+ * @property {"full"} full - Full size
20
+ */
21
+ export type ImageSize = "sub" | "full";
22
+ export type OnClick = () => unknown | Promise<unknown>;
23
+ export type Button = [string, OnClick];
24
+ export type Scripts = {
25
+ script: string;
26
+ subScript?: string;
27
+ };
28
+ export type Titles = {
29
+ title: string;
30
+ subTitle?: string[];
31
+ color?: string;
32
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Size type
3
+ * @enum {string}
4
+ * @readonly
5
+ * @description - Size type for the component
6
+ * @property {"xs"} xs - Extra small size
7
+ * @property {"sm"} sm - Small size
8
+ * @property {"md"} md - Medium size
9
+ * @property {"lg"} lg - Large size
10
+ * @property {"xl"} xl - Extra large size
11
+ */
12
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface WidgetEvent {
2
+ event: string;
3
+ type: "view" | "modal";
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from "./Property";
2
+ export * from "./Widget";
3
+ export * from "./Board";
@@ -0,0 +1,3 @@
1
+ export * from "./Property";
2
+ export * from "./Widget";
3
+ export * from "./Board";
@@ -0,0 +1,2 @@
1
+ import { AlertModalProps } from "../interface/Modal";
2
+ export default function AlertModal({ title, scripts, options, }: AlertModalProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { col } from "../util";
3
+ import { Modal } from "./Modal";
4
+ export default function AlertModal({ title, scripts, options, }) {
5
+ const { script, subScript } = scripts ?? {};
6
+ const { buttons } = options ?? {};
7
+ return (_jsx(Modal, { options: { buttons }, children: _jsx("div", { className: col(3) + "pl-25 pt-18 h-full pb-12", children: _jsxs("div", { className: col(6), children: [_jsx("div", { className: "text-3xl font-bold", children: title }), _jsx("div", { className: "h-2 w-14 rounded-full bg-pale-lavender" }), _jsx("div", { className: "text-xl font-bold", children: script })] }) }) }));
8
+ }
package/modal/Modal.d.ts CHANGED
@@ -1,8 +1,2 @@
1
- /// <reference types="react" />
2
- export declare function NoticeModal({ titles, children, buttons, close, }: {
3
- titles?: string[];
4
- children: React.ReactNode;
5
- buttons?: [string, () => unknown | (() => Promise<unknown>)][];
6
- close: () => void;
7
- }): import("react/jsx-runtime").JSX.Element;
8
- export declare function AlertModal(): import("react/jsx-runtime").JSX.Element;
1
+ import { ModalProps } from "../interface/Modal";
2
+ export declare function Modal({ children, options }: ModalProps): import("react/jsx-runtime").JSX.Element;
package/modal/Modal.js CHANGED
@@ -1,21 +1,26 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { col, absolute } from "../util";
3
- function Modal({ children }) {
4
- const classNames = [
5
- "z-50 flex min-h-screen w-full items-center justify-center bg-black/10 backdrop-blur-sm fixed top-0 left-0",
6
- ].join(" ");
7
- const modalClassNames = [
8
- "h-100 w-2/3 min-w-76 max-w-176 rounded-xl bg-white relative",
9
- ].join(" ");
10
- return (_jsx("div", { className: classNames, children: _jsx("div", { className: modalClassNames, children: children }) }));
11
- }
12
- export function NoticeModal({ titles, children, buttons, close, }) {
13
- const [title, subTitle] = titles || ["", ""];
14
- const buttonClassNames = [
15
- "rounded-2xl bg-black px-8 py-2 text-lg font-bold text-white",
16
- ].join(" ");
17
- return (_jsxs(Modal, { children: [_jsxs("div", { className: col(3) + "px-25 pt-18 h-full pb-12", children: [_jsxs("div", { className: col(6), children: [_jsx("div", { className: "text-3xl font-bold", children: title }), _jsx("div", { className: "h-2 w-14 rounded-full bg-pale-lavender" }), _jsx("div", { className: "text-xl font-bold", children: subTitle })] }), _jsx("div", { children: children }), buttons ? (_jsx("div", { className: "mt-auto flex justify-end gap-4", children: buttons.map(([text, onClick]) => (_jsx("button", { className: buttonClassNames, onClick: onClick, children: text }, text))) })) : null] }), _jsx("button", { className: absolute.tl(5, 7) + "bg-black rounded-full h-9 w-9", onClick: close })] }));
18
- }
19
- export function AlertModal() {
20
- return (_jsx("div", { children: _jsx("div", {}) }));
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useWidgetStore } from "../store";
3
+ import { absolute, cn } from "../util";
4
+ const background = "z-50 flex min-h-screen w-full items-center justify-center bg-black/10 backdrop-blur-sm fixed top-0 left-0";
5
+ const widthSize = {
6
+ xs: "w-2/3 min-w-76 max-w-176",
7
+ sm: "w-2/3 min-w-76 max-w-176",
8
+ md: "w-2/3 min-w-76 max-w-176",
9
+ lg: "w-full min-w-76 max-w-360",
10
+ xl: "w-2/3 min-w-76 max-w-176",
11
+ };
12
+ const heightSize = {
13
+ xs: "",
14
+ sm: "h-100",
15
+ md: "h-72 sm:h-48",
16
+ lg: "h-120",
17
+ xl: "h-180",
18
+ };
19
+ export function Modal({ children, options }) {
20
+ const { buttons, width, height } = options ?? {};
21
+ const { clearModal } = useWidgetStore();
22
+ 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) +
25
+ "bg-black rounded-full h-9 w-9 flex justify-center items-center", onClick: clearModal, children: _jsx("div", { className: "x-shape" }) })] }) }));
21
26
  }
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { Button } from "../interface";
3
+ export default function TestModal({ children, options, }: {
4
+ children: React.ReactNode;
5
+ options?: {
6
+ buttons?: Button[];
7
+ };
8
+ }): 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 TestModal({ children, options, }) {
4
+ const { buttons } = options ?? {};
5
+ return (_jsx(Modal, { options: { width: "lg", height: "xl", buttons }, children: _jsx("div", { className: "pt-18 pl-25", children: children }) }));
6
+ }
package/modal/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export * from "./Modal";
1
+ export { default as TestModal } from "./TestModal";
2
+ export { default as AlertModal } from "./AlertModal";
package/modal/index.js CHANGED
@@ -1 +1,2 @@
1
- export * from "./Modal";
1
+ export { default as TestModal } from "./TestModal";
2
+ export { default as AlertModal } from "./AlertModal";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "0.1.9",
3
+ "version": "1.0.1",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
@@ -0,0 +1,10 @@
1
+ import { WidgetEvent } from "../interface/Widget";
2
+ interface WidgetProps {
3
+ events: WidgetEvent[];
4
+ setView: (prop: string) => void;
5
+ setModal: (prop: string) => void;
6
+ removeModal: (prop: string) => void;
7
+ clearModal: () => void;
8
+ }
9
+ export declare const useWidgetStore: import("zustand").UseBoundStore<import("zustand").StoreApi<WidgetProps>>;
10
+ export {};
package/store/index.js ADDED
@@ -0,0 +1,18 @@
1
+ import { create } from "zustand";
2
+ export const useWidgetStore = create((set) => ({
3
+ events: [],
4
+ setView: (prop) => set((state) => ({
5
+ events: [...state.events, { event: prop, type: "view" }],
6
+ })),
7
+ setModal: (prop) => set((state) => ({
8
+ events: [...state.events, { event: prop, type: "modal" }],
9
+ })),
10
+ removeModal: (prop) => {
11
+ set((state) => ({
12
+ events: state.events.filter(({ event }) => event !== prop),
13
+ }));
14
+ },
15
+ clearModal: () => set((state) => ({
16
+ events: state.events.filter(({ type }) => type !== "modal"),
17
+ })),
18
+ }));
@@ -275,8 +275,9 @@ export default {
275
275
  xs: "480px",
276
276
  sm: "640px",
277
277
  md: "768px", // IPad Mini
278
- ml: "964px", // IPad Air, IPad Pro 11.
278
+ xm: "964px", // IPad Air, IPad Pro 11.
279
279
  lg: "1024px", // IPad Mini Horizontal Viewport
280
+ ml: "1160px", // IPad Air, IPad Pro 11.
280
281
  xl: "1280px",
281
282
  "2xl": "1536px",
282
283
  },
package/version.txt CHANGED
@@ -1 +1 @@
1
- 0.1.9
1
+ 1.0.1