@edu-tosel/design 1.0.8 → 1.0.10

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 (55) hide show
  1. package/board/index.d.ts +1 -0
  2. package/board/index.js +1 -0
  3. package/board/template/PaperBoard.d.ts +2 -0
  4. package/board/template/PaperBoard.js +10 -0
  5. package/board/widget/Board.d.ts +1 -1
  6. package/board/widget/Board.js +34 -6
  7. package/board/widget/DataField.js +1 -1
  8. package/board/widget/Header.js +1 -1
  9. package/board/widget/Tab.js +8 -6
  10. package/card/index.d.ts +1 -0
  11. package/card/index.js +1 -0
  12. package/card/template/ChartCard.d.ts +1 -1
  13. package/card/template/ChartCard.js +7 -2
  14. package/card/template/InfoCard.d.ts +1 -1
  15. package/card/template/InfoCard.js +6 -3
  16. package/card/template/InfoCardCssCase.d.ts +25 -0
  17. package/card/template/InfoCardCssCase.js +32 -0
  18. package/card/template/PropfileCard.d.ts +2 -0
  19. package/card/template/PropfileCard.js +6 -0
  20. package/card/template/ReportCard.d.ts +20 -0
  21. package/card/template/ReportCard.js +23 -0
  22. package/card/template/RowCard.js +1 -1
  23. package/card/template/TableCard.js +8 -3
  24. package/card/template/TrumpCard.js +1 -1
  25. package/card/widget/Card.d.ts +1 -1
  26. package/card/widget/Card.js +19 -16
  27. package/deck/Deck.d.ts +5 -3
  28. package/deck/Deck.js +13 -7
  29. package/interaction/template/Exception.js +2 -1
  30. package/interaction/widget/LoadingSpinner.js +2 -2
  31. package/interaction/widget/LoadingWorm.d.ts +1 -0
  32. package/interaction/widget/LoadingWorm.js +23 -0
  33. package/interface/Board.d.ts +6 -1
  34. package/interface/Card.d.ts +17 -10
  35. package/interface/Interaction.d.ts +0 -1
  36. package/interface/Modal.d.ts +0 -1
  37. package/interface/Property.d.ts +14 -2
  38. package/interface/Property.js +0 -13
  39. package/layout/dashboard/index.d.ts +0 -1
  40. package/modal/TestModal.d.ts +0 -1
  41. package/navigation/Navigation.d.ts +0 -1
  42. package/package.json +1 -1
  43. package/shelf/Shelf.d.ts +0 -1
  44. package/tailwind.config.ts +30 -1
  45. package/text/LineBreaks.d.ts +3 -3
  46. package/text/LineBreaks.js +4 -3
  47. package/util/classNames.d.ts +5 -1
  48. package/util/classNames.js +15 -2
  49. package/util/colors.d.ts +1 -0
  50. package/util/colors.js +1 -0
  51. package/util/hooks.d.ts +4 -0
  52. package/util/hooks.js +26 -0
  53. package/util/index.d.ts +2 -0
  54. package/util/index.js +2 -0
  55. package/version.txt +1 -1
package/board/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import "../globals.css";
2
2
  export { default as CanvasBoard } from "./template/CanvasBoard";
3
3
  export { default as ManageBoard } from "./template/ManageBoard";
4
+ export { default as PaperBoard } from "./template/PaperBoard";
package/board/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  import "../globals.css";
2
2
  export { default as CanvasBoard } from "./template/CanvasBoard";
3
3
  export { default as ManageBoard } from "./template/ManageBoard";
4
+ export { default as PaperBoard } from "./template/PaperBoard";
@@ -0,0 +1,2 @@
1
+ import { PaperBoardProps } from "../../interface/Board";
2
+ export default function PaperBoard({ children, debug }: PaperBoardProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../util";
3
+ import { Board } from "../widget/Board";
4
+ export default function PaperBoard({ children, debug }) {
5
+ const container = {
6
+ displays: "flex flex-col items-center gap-7.5",
7
+ paddings: "px-4 pt-3",
8
+ };
9
+ return (_jsx(Board, { options: { width: "lg", height: "full" }, debug: debug, children: _jsx("div", { className: cn(container), children: children }) }));
10
+ }
@@ -1,2 +1,2 @@
1
1
  import { BoardProps } from "../../interface/Board";
2
- export declare function Board({ children, widgets }: BoardProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function Board({ children, widgets, options, debug }: BoardProps): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,42 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useWidgetStore } from "../../store";
3
3
  import Tab from "./Tab";
4
- export function Board({ children, widgets }) {
4
+ import { cn } from "../../util";
5
+ const widthSize = {
6
+ xs: "w-20",
7
+ sm: "w-24",
8
+ md: "w-28",
9
+ lg: "w-full max-w-280",
10
+ xl: "w-full",
11
+ "2xl": "w-40",
12
+ full: "w-full",
13
+ auto: "w-auto",
14
+ };
15
+ const heightSize = {
16
+ xs: "h-20",
17
+ sm: "h-24",
18
+ md: "h-28",
19
+ lg: "h-full xl:h-178 xl:min-h-0",
20
+ xl: "h-36",
21
+ "2xl": "h-40",
22
+ full: "min-h-screen h-full",
23
+ auto: "h-auto",
24
+ };
25
+ export function Board({ children, widgets, options, debug }) {
5
26
  const { events } = useWidgetStore();
6
27
  const { components, tabs } = widgets ?? {};
7
- const classNames = [
8
- `h-full xl:min-h-0 `,
9
- "xl:rounded-xl bg-white relative w-full z-10 overflow-hidden",
10
- ].join(" ");
11
- return (_jsxs("div", { className: "h-full xl:min-h-0 xl:h-178 w-full relative ", children: [_jsxs("div", { className: classNames, children: [children, components?.map(([flag, Component]) => {
28
+ const { width, height } = options ?? {};
29
+ const container = {
30
+ positions: "relative",
31
+ width: widthSize[width ?? "full"],
32
+ debug: debug && import.meta.env.MODE && `border-2 border-${debug}`,
33
+ };
34
+ const body = {
35
+ positions: "relative z-10 ",
36
+ sizes: `w-full ${heightSize[height ?? "lg"]} overflow-hidden `,
37
+ styles: "xl:rounded-xl bg-white",
38
+ };
39
+ return (_jsxs("div", { className: cn(container), children: [_jsxs("div", { className: cn(body), children: [children, components?.map(([flag, Component]) => {
12
40
  if (typeof flag === "boolean")
13
41
  return flag ? _jsx(_Fragment, { children: Component }) : null;
14
42
  return events?.some(({ event }) => event === flag) ? (_jsx(_Fragment, { children: Component })) : null;
@@ -20,5 +20,5 @@ export default function BoardDataField({ dataField, }) {
20
20
  displays: "xl:hidden block ",
21
21
  sizes: container.sizes,
22
22
  };
23
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(container.positions, container.displays, container.sizes, container.styles), children: _jsx("div", { className: cn(dataFieldContainer.displays, dataFieldContainer.sizes, dataFieldContainer.paddings, dataFieldContainer.styles), children: Object.entries(fields).map(([key, value]) => (_jsx("div", { className: `w-${`${sizes[key]}/100` ?? "auto"}`, children: _jsxs("button", { onClick: () => setOrder(key), className: "flex items-center gap-1", children: [_jsx("div", { children: value }), _jsx("div", { className: "text-xs", children: orderBy === key ? (orderHow === "asc" ? "▼" : "▲") : "" })] }) }, key))) }) }), _jsx("div", { className: cn(block.sizes, block.displays) })] }));
23
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(container), children: _jsx("div", { className: cn(dataFieldContainer), children: Object.entries(fields).map(([key, value]) => (_jsx("div", { className: `w-${`${sizes[key]}/100` ?? "auto"}`, children: _jsxs("button", { onClick: () => setOrder(key), className: "flex items-center gap-1", children: [_jsx("div", { children: value }), _jsx("div", { className: "text-xs", children: orderBy === key ? (orderHow === "asc" ? "▼" : "▲") : "" })] }) }, key))) }) }), _jsx("div", { className: cn(block) })] }));
24
24
  }
@@ -18,5 +18,5 @@ export default function BoardHeader({ title, tags, options, }) {
18
18
  displays: "xl:hidden block ",
19
19
  sizes: container.sizes,
20
20
  };
21
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: cn(container.positions, container.paddings, container.sizes, container.styles), children: [_jsx("div", { className: "text-xl font-bold", children: title }), _jsxs("div", { className: "flex items-center ml-auto gap-4", children: [selects?.map(({ width, title, options, onChange }) => (_jsx(Select, { width: width, title: title, selectOptions: options, onChange: onChange }, title))), inputs?.map(({ width, title, placeholder, onChange }) => (_jsx(Input, { width: width, title: title, placeholder: placeholder, onChange: onChange }, title + placeholder)))] })] }), _jsx("div", { className: cn(block.sizes, block.displays) })] }));
21
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: cn(container), children: [_jsx("div", { className: "text-xl font-bold", children: title }), _jsxs("div", { className: "flex items-center ml-auto gap-4", children: [selects?.map(({ width, title, options, onChange }) => (_jsx(Select, { width: width, title: title, selectOptions: options, onChange: onChange }, title))), inputs?.map(({ width, title, placeholder, onChange }) => (_jsx(Input, { width: width, title: title, placeholder: placeholder, onChange: onChange }, title + placeholder)))] })] }), _jsx("div", { className: cn(block) })] }));
22
22
  }
@@ -3,12 +3,14 @@ import { useState } from "react";
3
3
  import { cn } from "../../util";
4
4
  export default function Tab({ tabs }) {
5
5
  const [tabsSelection, setTabsSelection] = useState(tabs.map((_, i) => i === 0));
6
- const positions = "xl:absolute xl:-bottom-14 xl:left-0 z-5";
7
- const displays = "hidden xl:flex xl:items-end xl:gap-4";
8
- const sizes = "xl:h-16";
9
- const paddings = "xl:px-8 xl:pb-2 ";
10
- const styles = "bg-white/50 rounded-b-xl ";
11
- return (_jsx("div", { className: cn(displays, positions, sizes, paddings, styles), children: tabs.map(([title, onClick], index) => (_jsx("button", { onClick: () => {
6
+ const container = {
7
+ positions: "xl:absolute xl:-bottom-14 xl:left-0 z-5",
8
+ displays: "hidden xl:flex xl:items-end xl:gap-4",
9
+ sizes: "xl:h-16",
10
+ paddings: "xl:px-8 xl:pb-2 ",
11
+ styles: "bg-white/50 rounded-b-xl ",
12
+ };
13
+ return (_jsx("div", { className: cn(container), children: tabs.map(([title, onClick], index) => (_jsx("button", { onClick: () => {
12
14
  setTabsSelection(tabsSelection.map((_, i) => i === index));
13
15
  return onClick();
14
16
  }, className: `h-9 w-32 rounded-md ${tabsSelection[index]
package/card/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export { default as ChartCard } from "./template/ChartCard";
4
4
  export { default as TableCard } from "./template/TableCard";
5
5
  export { default as RowCard } from "./template/RowCard";
6
6
  export { default as InfoCard } from "./template/InfoCard";
7
+ export { default as ReportCard } from "./template/ReportCard";
package/card/index.js CHANGED
@@ -4,3 +4,4 @@ export { default as ChartCard } from "./template/ChartCard";
4
4
  export { default as TableCard } from "./template/TableCard";
5
5
  export { default as RowCard } from "./template/RowCard";
6
6
  export { default as InfoCard } from "./template/InfoCard";
7
+ export { default as ReportCard } from "./template/ReportCard";
@@ -1,2 +1,2 @@
1
1
  import { ChartCardProps } from "../../interface/Card";
2
- export default function ChartCard({ data, xAxis, yAxis, lines, bars, areas, }: ChartCardProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function ChartCard({ data, xAxis, yAxis, lines, bars, areas, options, }: ChartCardProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Area, Bar, ComposedChart, Line, ResponsiveContainer, Tooltip, XAxis, YAxis, } from "recharts";
3
3
  import { Card } from "../widget/Card";
4
- export default function ChartCard({ data, xAxis, yAxis, lines, bars, areas, }) {
5
- 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)))] }) }) }));
4
+ export default function ChartCard({ data, xAxis, yAxis, lines, bars, areas, options, }) {
5
+ const { width, height } = options ?? {};
6
+ return (_jsx(Card, { options: {
7
+ width: width ?? "xl",
8
+ height: height ?? "lg",
9
+ text: { size: "xs" },
10
+ }, 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
11
  }
@@ -1,2 +1,2 @@
1
1
  import { InfoCardProps } from "../../interface/Card";
2
- export default function InfoCard({ type }: InfoCardProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function InfoCard({ type, titles, button }: InfoCardProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Deck } from "../..";
3
2
  import { Card } from "../widget/Card";
4
- export default function InfoCard({ type }) {
5
- return (_jsxs(Deck, { children: [_jsx(Card, { options: { width: "xs", height: "lg" }, children: _jsxs("div", { className: "p-5", children: [_jsx("div", { children: type }), _jsx("div", {})] }) }), _jsx(Card, { options: { width: "md" }, children: _jsxs("div", { className: "p-5", children: [_jsx("div", { children: type }), _jsx("div", {})] }) })] }));
3
+ import { sizeBySetting, bgColorBySetting, lineColorBySetting, fontColorBySetting, btnSizeBySetting, } from "./InfoCardCssCase";
4
+ export default function InfoCard({ type, titles, button }) {
5
+ return (_jsx(Card, { options: {
6
+ width: sizeBySetting.widthSize[type],
7
+ height: sizeBySetting.heightSize[type],
8
+ }, children: _jsxs("div", { className: "relative w-full h-full p-5 bg-" + `${bgColorBySetting[type]}`, children: [_jsxs("div", { className: `h-18 w-full border-b-2 border-[${lineColorBySetting[type]}] flex justify-between`, children: [_jsxs("div", { className: "w-auto", children: [_jsx("div", { className: "h-9 font-bold text-xl text-" + `${titles.color}`, children: titles.title }), _jsx("div", { className: "h-8 text-md font-thin ", children: titles.subTitle })] }), _jsx("div", { className: `w-auto flex flex-col-reverse text-${fontColorBySetting} p-2`, children: _jsx("span", { className: `text-xs font-thin font-semibold inline-block align-bottom `, children: "\uC218\uC815\uD558\uAE30" }) })] }), _jsx("div", {}), _jsx("div", { className: `absolute bottom-4 right-4 ${button.display}`, children: _jsx("button", { className: `text-white rounded-md bg-${button.color} ${btnSizeBySetting[type]} flex justify-center items-center`, children: button.title }) })] }) }));
6
9
  }
@@ -0,0 +1,25 @@
1
+ import { Size } from "../../interface/Property";
2
+ export declare const sizeBySetting: {
3
+ widthSize: Record<string, Size>;
4
+ heightSize: Record<string, Size>;
5
+ };
6
+ export declare const bgColorBySetting: {
7
+ information: string;
8
+ profile: string;
9
+ profileSmall: string;
10
+ };
11
+ export declare const lineColorBySetting: {
12
+ information: string;
13
+ profile: string;
14
+ profileSmall: string;
15
+ };
16
+ export declare const fontColorBySetting: {
17
+ information: string;
18
+ profile: string;
19
+ profileSmall: string;
20
+ };
21
+ export declare const btnSizeBySetting: {
22
+ information: string;
23
+ profile: string;
24
+ profileSmall: string;
25
+ };
@@ -0,0 +1,32 @@
1
+ export const sizeBySetting = {
2
+ widthSize: {
3
+ information: "md",
4
+ profile: "sm",
5
+ profileSmall: "xs",
6
+ },
7
+ heightSize: {
8
+ information: "lg",
9
+ profile: "md",
10
+ profileSmall: "lg",
11
+ },
12
+ };
13
+ export const bgColorBySetting = {
14
+ information: "gradient-to-r from-green-dark/20 to-red-crimson/20",
15
+ profile: "white",
16
+ profileSmall: "white",
17
+ };
18
+ export const lineColorBySetting = {
19
+ information: "#760023",
20
+ profile: "#173A8B",
21
+ profileSmall: "#173A8B",
22
+ };
23
+ export const fontColorBySetting = {
24
+ information: "red-crimson",
25
+ profile: "blue-navy",
26
+ profileSmall: "blue-navy",
27
+ };
28
+ export const btnSizeBySetting = {
29
+ information: "w-45 h-11",
30
+ profile: "w-22 h-7 text-xs",
31
+ profileSmall: "w-45 h-11",
32
+ };
@@ -0,0 +1,2 @@
1
+ import { InfoCardProps } from "../../interface/Card";
2
+ export default function ProfileCard({ titles, button }: InfoCardProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Card } from "../widget/Card";
3
+ import { gradient } from "../../util";
4
+ export default function ProfileCard({ titles, button }) {
5
+ return (_jsx(Card, { options: { width: "lg", height: "lg" }, children: _jsxs("div", { className: "relative w-full h-full p-5 bg-" + `${gradient.green_to_red}`, children: [_jsxs("div", { className: "h-18 w-full border-b-2 border-[#760023] flex justify-between", children: [_jsxs("div", { className: "w-auto", children: [_jsx("div", { className: "h-9 font-bold text-xl text-" + `${titles.color}`, children: titles.title }), _jsx("div", { className: "h-8 text-md font-thin ", children: titles.subTitle })] }), _jsx("div", { className: "w-auto flex flex-col-reverse text-red-crimson p-2", children: _jsx("span", { className: "text-xs font-thin border-b-1 border-[#760023] font-semibold inline-block align-bottom ", children: "\uC218\uC815\uD558\uAE30" }) })] }), _jsx("div", {}), _jsx("div", { className: `absolute bottom-4 right-4 ${button.display}`, children: _jsx("button", { className: `text-white rounded-md bg-${button.color} w-45 h-11 flex justify-center items-center`, children: button.title }) })] }) }));
6
+ }
@@ -0,0 +1,20 @@
1
+ import { Titles } from "../../interface";
2
+ export default function ReportCard({ titles, type, dataSets, dataField, }: {
3
+ titles: Titles;
4
+ type: "table" | "chart";
5
+ dataSets: {
6
+ items: Record<string, string | number>[];
7
+ };
8
+ dataField: {
9
+ fields: Record<string, string>;
10
+ axis?: {
11
+ x: string;
12
+ y: string;
13
+ };
14
+ lines?: {
15
+ dataKey: string;
16
+ stroke: string;
17
+ }[];
18
+ sizes?: Record<string, string>;
19
+ };
20
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { LineBreaks } from "../../text";
3
+ import { cn } from "../../util";
4
+ import ChartCard from "./ChartCard";
5
+ import TableCard from "./TableCard";
6
+ export default function ReportCard({ titles, type, dataSets, dataField, }) {
7
+ const { title, subtitle } = titles;
8
+ const { axis, fields, lines, sizes } = dataField;
9
+ const container = {
10
+ displays: "flex flex-col gap-4",
11
+ };
12
+ const titleBox = {
13
+ container: "flex flex-col gap-1",
14
+ title: "text-lg font-bold",
15
+ subtitle: "text-sm",
16
+ };
17
+ return (_jsxs("div", { className: cn(container), children: [_jsxs("div", { className: cn(titleBox.container), children: [_jsx("div", { className: cn(titleBox.title), children: title }), _jsx(LineBreaks, { className: cn(titleBox.subtitle), texts: subtitle })] }), type === "table" && sizes ? (_jsx(TableCard, { sizes: sizes, fields: fields, data: dataSets.items, options: {
18
+ width: "full",
19
+ height: "auto",
20
+ } })) : axis && type === "chart" ? (_jsx(ChartCard, { data: dataSets.items, xAxis: axis.x, yAxis: axis.y, lines: lines, options: {
21
+ width: "full",
22
+ } })) : null] }));
23
+ }
@@ -11,7 +11,7 @@ export default function RowCard({ row, fields, sizes, }) {
11
11
  height: "xs",
12
12
  boundary: "none",
13
13
  rounded: "none",
14
- }, children: _jsxs("div", { className: "flex items-center h-full", children: [entries.map(([type, key, value]) => (_jsx("div", { className: `w-${`${sizes[key]}/100` ?? "auto"}`, children: Array.isArray(type) && type[0] === "select" ? (_jsx(Select, { type: type, entry: [key, value], row: rowState, setRow: setRowState }, key + type + value.toString())) : (_jsx("div", { className: "w-full truncate", children: value ?? "No Data" }, key + value.toString())) }, key))), _jsx("button", { onClick: () => {
14
+ }, children: _jsxs("div", { className: "flex items-center h-full", children: [entries.map(([type, key, value]) => (_jsx("div", { className: `w-${`${sizes[key]}/100` ?? "auto"}`, children: Array.isArray(type) && type[0] === "select" ? (_jsx(Select, { type: type, entry: [key, value], row: rowState, setRow: setRowState }, key + type + value.toString())) : (_jsx("div", { className: "w-full truncate", children: value ?? "No Data" }, key)) }, key))), _jsx("button", { onClick: () => {
15
15
  setTempData(row);
16
16
  setView("sideMenu");
17
17
  }, children: "click" })] }) }));
@@ -1,12 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../util";
2
3
  import { Card } from "../widget/Card";
3
4
  export default function TableCard({ data, fields, sizes, options, }) {
4
- const { color } = options ?? {};
5
- const { background: bgColor, text: textColor } = color ?? {};
5
+ const { width, height, background, text, overflow } = options ?? {};
6
+ const { color: bgColor } = background ?? {};
7
+ const { color: textColor } = text ?? {};
6
8
  const keys = Object.keys(fields);
9
+ const container = {
10
+ text: "text-xs xs:text-sm sm:text-base",
11
+ };
7
12
  const fieldsClassNames = [
8
13
  `flex h-11 items-center font-bold pl-4`,
9
14
  `bg-${bgColor ?? "gray-300"} text-${textColor ?? "black"}`,
10
15
  ].join(" ");
11
- 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)))] }) }));
16
+ return (_jsx(Card, { options: { width: width ?? "lg", height: height ?? "lg", overflow }, children: _jsxs("div", { className: cn(container), 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
17
  }
@@ -15,5 +15,5 @@ export default function TrumpCard({ titles, options }) {
15
15
  return "w-full h-full object-cover";
16
16
  return "absolute bottom-0 right-0 w-full xs:w-auto max-w-120 z-0 max-h-44 object-contain";
17
17
  };
18
- return (_jsxs(Card, { options: { width: width ?? "xs", 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] }));
18
+ return (_jsxs(Card, { options: { width: width ?? "xs", 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, { 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
19
  }
@@ -1,2 +1,2 @@
1
1
  import { CardProps } from "../../interface/Card";
2
- export declare function Card({ children, options }: CardProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function Card({ children, options, debug }: CardProps): import("react/jsx-runtime").JSX.Element;
@@ -4,10 +4,11 @@ const widthSize = {
4
4
  xs: "w-full md:w-60",
5
5
  sm: "w-full md:w-90",
6
6
  md: "w-full md:w-112.5",
7
- lg: "w-full md:w-127.5",
7
+ lg: "w-full lg:w-127.5",
8
8
  xl: "w-full lg:w-187.5",
9
9
  "2xl": "w-full lg:w-247.5",
10
10
  full: "w-full",
11
+ auto: "w-auto",
11
12
  };
12
13
  const heightSize = {
13
14
  xs: "min-h-16",
@@ -16,10 +17,13 @@ const heightSize = {
16
17
  lg: "h-80",
17
18
  xl: "h-125",
18
19
  "2xl": "",
20
+ full: "h-full",
21
+ auto: "h-auto min-h-80",
19
22
  };
20
- export function Card({ children, options }) {
21
- const { boundary, rounded, height, width, text, onClick } = options ?? {};
23
+ export function Card({ children, options, debug }) {
24
+ const { boundary, rounded, height, width, text, background, onClick, overflow, } = options ?? {};
22
25
  const { size: textSize, color: textColor } = text ?? {};
26
+ const { color: bgColor } = background ?? {};
23
27
  const setBoundary = () => {
24
28
  if (boundary === "shadow")
25
29
  return "box-shadow";
@@ -29,17 +33,16 @@ export function Card({ children, options }) {
29
33
  return "";
30
34
  return "box-shadow";
31
35
  };
32
- const sizes = [
33
- `${heightSize[height ?? "sm"]}`,
34
- `${widthSize[width ?? "sm"]}`,
35
- ].join(" ");
36
- const positions = "relative";
37
- const styles = [
38
- `${onClick ? "cursor-pointer" : ""}`,
39
- `text-${textSize ?? "base"}`,
40
- setBoundary(),
41
- `rounded-${rounded ?? "xl"}`,
42
- `bg-white/80 duration-500 overflow-hidden`,
43
- ].join(" ");
44
- return (_jsx("div", { onClick: onClick, className: cn(sizes, positions, styles), children: children }));
36
+ const container = {
37
+ positions: "relative",
38
+ sizes: `${widthSize[width ?? "sm"]} ${heightSize[height ?? "sm"]}`,
39
+ onClick: onClick ? "cursor-pointer" : "",
40
+ text: `text-${textSize ?? "base"}`,
41
+ boundary: setBoundary(),
42
+ rounded: `rounded-${rounded ?? "xl"}`,
43
+ bgColor: `bg-${bgColor ?? "white/80"}`,
44
+ styles: "duration-500 overflow-hidden",
45
+ debug: debug && import.meta.env.MODE && `border-2 border-${debug}`,
46
+ };
47
+ return (_jsx("div", { onClick: onClick, className: cn(container), children: children }));
45
48
  }
package/deck/Deck.d.ts CHANGED
@@ -1,16 +1,18 @@
1
- /// <reference types="react" />
2
- export declare function Deck<T extends string | number>({ children, titles, options, }: {
1
+ export declare function Deck<T extends string | number>({ children, titles, options, debug, }: {
3
2
  children: React.ReactNode;
4
3
  titles?: {
5
4
  title: string;
6
- subTitle?: string;
5
+ subtitle?: string;
7
6
  gapTitle?: number;
8
7
  };
9
8
  options?: {
9
+ flex?: "col" | "row";
10
+ justify?: "between";
10
11
  overflowScroll?: boolean;
11
12
  width?: T;
12
13
  height?: number;
13
14
  gapX?: number;
14
15
  gapY?: number;
15
16
  };
17
+ debug?: string;
16
18
  }): import("react/jsx-runtime").JSX.Element;
package/deck/Deck.js CHANGED
@@ -1,15 +1,21 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn } from "../util";
3
- export function Deck({ children, titles, options, }) {
4
- const { title, subTitle, gapTitle } = titles ?? {};
5
- const { height, gapX, gapY, overflowScroll } = options ?? {};
3
+ export function Deck({ children, titles, options, debug, }) {
4
+ const { title, subtitle, gapTitle } = titles ?? {};
5
+ const { flex, height, justify, gapX, gapY, overflowScroll } = options ?? {};
6
6
  const container = {
7
- positions: `flex flex-col gap-${gapTitle ?? 4}`,
8
- sizes: `sm:w-full h-${height ?? "auto"} `,
7
+ displays: `flex flex-col gap-${gapTitle ?? 4}`,
8
+ sizes: `w-full h-${height ?? "auto"} `,
9
+ debug: debug &&
10
+ import.meta.env.MODE === "development" &&
11
+ `border-2 border-${debug}`,
9
12
  };
10
13
  const body = {
11
- positions: `flex flex-col sm:flex-row sm:w-full gap-x-${gapX ?? 7.5} gap-y-${gapY ?? 5}`,
14
+ displays: `flex flex-col sm:flex-${flex ?? "row"} gap-y-${gapY ?? 5}`,
15
+ justify: `justify-${justify ?? "start"}`,
16
+ gapX: `${`gap-x-${gapX ?? 7.5}`}`,
17
+ sizes: "sm:w-full ",
12
18
  styles: `${overflowScroll ? "overflow-x-scroll" : ""} duration-500`,
13
19
  };
14
- return (_jsxs("div", { className: cn(container.positions, container.sizes), 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: cn(body.positions, body.styles), children: children })] }));
20
+ return (_jsxs("div", { className: cn(container), children: [_jsxs("div", { children: [_jsx("div", { className: "text-xl xl:text-2xl font-bold", children: title }), _jsx("div", { className: "", children: subtitle })] }), _jsx("div", { className: cn(body), children: children })] }));
15
21
  }
@@ -1,9 +1,10 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Fragment } from "react";
2
3
  export default function Exception({ exceptions, children }) {
3
4
  if (!exceptions)
4
5
  return _jsx(_Fragment, { children: children });
5
6
  const trueComponents = exceptions
6
7
  .filter(([exception]) => exception)
7
- .map(([, component]) => component);
8
+ .map(([, Component], index) => (_jsx(Fragment, { children: Component }, index)));
8
9
  return _jsx(_Fragment, { children: trueComponents.length > 0 ? trueComponents : children });
9
10
  }
@@ -1,5 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // NOTE: This is Prototype code and should be replaced with a proper loading spinner
3
3
  export default function LoadingSpinner() {
4
- return (_jsx("div", { className: "w-full h-full flex items-center justify-center", children: _jsx("div", { className: "h-16 w-16 animate-spin rounded-full border-6 border-black border-r-transparent flex justify-center items-center", children: _jsx("div", { className: "h-12 w-12 animate-spin rounded-full border-6 border-red-500 border-r-transparent " }) }) }));
4
+ return (_jsx("div", { className: "w-full h-full flex items-center justify-center", children: _jsx("div", { className: "w-30 h-30", children: _jsxs("svg", { "aria-hidden": "true", className: "inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600", viewBox: "0 0 100 101", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z", fill: "currentColor" }), _jsx("path", { d: "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z", fill: "currentFill" })] }) }) }));
5
5
  }
@@ -0,0 +1 @@
1
+ export default function LoadingWorm(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn, gradient, useEase } from "../../util";
3
+ export default function LoadingWorm() {
4
+ const numbers = [-2, -1, 0, 1, 2];
5
+ const ease = useEase(1000, 500);
6
+ return (_jsx("div", { className: "w-full h-full flex justify-center items-center", children: _jsx("div", { className: "relative w-25 h-22 ", children: numbers.map((number) => (_jsx(SubComponent, { index: number, ease: ease }, number))) }) }));
7
+ }
8
+ function SubComponent({ index, ease, }) {
9
+ const [flag, timer] = ease;
10
+ const positions = [
11
+ `absolute`,
12
+ index < 0
13
+ ? `-left-${flag ? Math.abs(index) * 4 : 0}`
14
+ : `left-${flag ? Math.abs(index) * 4 : 0}`,
15
+ index < 0
16
+ ? `-top-${flag ? Math.abs(index) * 4 : 0}`
17
+ : `top-${flag ? Math.abs(index) * 4 : 0}`,
18
+ `z-${50 - index}`,
19
+ ].join(" ");
20
+ const sizes = "w-25 h-22";
21
+ const styles = `duration-${timer} rounded-lg bg-${gradient.lab}`;
22
+ return (_jsxs("div", { className: cn(positions, sizes, styles), children: [_jsxs("div", { children: ["Index is ", index] }), _jsxs("div", { className: "text-xs", children: [timer, "ms \uB3D9\uC548 ", flag.toString()] })] }));
23
+ }
@@ -1,6 +1,8 @@
1
1
  import { Dispatch } from "react";
2
2
  import { Button, Size } from "./Property";
3
3
  interface OptionsProps {
4
+ width?: Size;
5
+ height?: Size;
4
6
  color?: string;
5
7
  }
6
8
  interface WidgetsProps {
@@ -12,6 +14,7 @@ export interface BoardProps {
12
14
  children?: React.ReactNode;
13
15
  widgets?: WidgetsProps;
14
16
  options?: OptionsProps;
17
+ debug?: string;
15
18
  }
16
19
  export interface BoardHeaderProps {
17
20
  title?: string;
@@ -41,7 +44,7 @@ export interface ManageBoardProps<T> extends BoardProps {
41
44
  dataSets: {
42
45
  title?: string;
43
46
  items: T[] | undefined;
44
- renderItem: (items: T) => React.ReactNode;
47
+ renderItem: (item: T) => React.ReactNode;
45
48
  }[];
46
49
  dataField?: {
47
50
  fields: Record<string, string>;
@@ -54,4 +57,6 @@ export interface ManageBoardProps<T> extends BoardProps {
54
57
  menu?: React.ReactNode;
55
58
  } & WidgetsProps;
56
59
  }
60
+ export interface PaperBoardProps extends BoardProps {
61
+ }
57
62
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ImageSize, Size } from "./Property";
3
2
  /**
4
3
  * CardProps is an interface.
@@ -19,6 +18,9 @@ export interface CardProps {
19
18
  rounded?: string;
20
19
  height?: Size;
21
20
  width?: Size;
21
+ background?: {
22
+ color?: string;
23
+ };
22
24
  text?: {
23
25
  size?: string;
24
26
  color?: string;
@@ -26,8 +28,9 @@ export interface CardProps {
26
28
  onClick?: () => unknown | (() => Promise<unknown>);
27
29
  overflow?: "hiden" | "auto";
28
30
  };
31
+ debug?: string;
29
32
  }
30
- export interface ChartCardProps {
33
+ export interface ChartCardProps extends Omit<CardProps, "children"> {
31
34
  data: Record<string, string | number>[];
32
35
  xAxis: string;
33
36
  yAxis: string;
@@ -44,16 +47,10 @@ export interface ChartCardProps {
44
47
  fill: string;
45
48
  }[];
46
49
  }
47
- export interface TableCardProps {
50
+ export interface TableCardProps extends Omit<CardProps, "children"> {
48
51
  data: Record<string, string | number>[];
49
52
  fields: Record<string, string>;
50
53
  sizes: Record<string, string>;
51
- options?: {
52
- color?: {
53
- background: string;
54
- text: string;
55
- };
56
- };
57
54
  }
58
55
  export interface TrumpCardProps {
59
56
  titles: {
@@ -72,5 +69,15 @@ export interface TrumpCardProps {
72
69
  };
73
70
  }
74
71
  export interface InfoCardProps {
75
- type: "information" | "profile" | "prpfileSmall";
72
+ type: "information" | "profile" | "profileSmall";
73
+ titles: {
74
+ title: string;
75
+ subTitle?: string[];
76
+ color?: string;
77
+ };
78
+ button: {
79
+ title: string;
80
+ display: "inline-block" | "none";
81
+ color?: string;
82
+ };
76
83
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface ExceptionProps {
3
2
  exceptions?: [boolean, React.ReactNode][];
4
3
  children: React.ReactNode;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Button, Scripts, Size } from "./Property";
3
2
  export interface ModalProps {
4
3
  children: React.ReactNode;
@@ -1,3 +1,15 @@
1
+ import { Dispatch, SetStateAction } from "react";
2
+ /**
3
+ * State type for the React component
4
+ * @template T
5
+ * @description - State type for the component
6
+ * @property {T} 0 - State value
7
+ * @property {Dispatch<SetStateAction<T>>} 1 - State setter
8
+ * @example
9
+ * const [state, setState] = useState<T>(initialState);
10
+ * @typedef {Array<T, Dispatch<SetStateAction<T>>>} State
11
+ */
12
+ export type State<T> = [T, Dispatch<SetStateAction<T>>];
1
13
  /**
2
14
  * Size type
3
15
  * @enum {string}
@@ -11,7 +23,7 @@
11
23
  * @property {"2xl"} 2xl - Double extra large size
12
24
  * @property {"full"} full - Full size
13
25
  */
14
- export type Size = "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full";
26
+ export type Size = "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full" | "auto";
15
27
  /**
16
28
  * Image size type
17
29
  * @enum {string}
@@ -29,7 +41,7 @@ export type Scripts = {
29
41
  };
30
42
  export type Titles = {
31
43
  title: string;
32
- subTitle?: string[];
44
+ subtitle?: string | string[];
33
45
  color?: string;
34
46
  };
35
47
  export interface Log<K extends string, T extends string | number> {
@@ -1,14 +1 @@
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
- * @property {"2xl"} 2xl - Double extra large size
12
- * @property {"full"} full - Full size
13
- */
14
1
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare function DashboardLayout({ subject, colors, navigations, children, }: {
3
2
  subject: [string, string, string];
4
3
  colors?: [string, string];
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Button } from "../interface";
3
2
  export default function TestModal({ children, options, }: {
4
3
  children: React.ReactNode;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const buttonClassNames: (href: string, nowPath: string, color?: [string, string]) => string;
3
2
  export declare function NavigationContainer({ children, }: {
4
3
  children: React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
package/shelf/Shelf.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export default function Shelf({ children }: {
3
2
  children: React.ReactNode;
4
3
  }): import("react/jsx-runtime").JSX.Element;
@@ -55,8 +55,8 @@ export default {
55
55
  "jr-blue-light": "#D6EEFF",
56
56
  "hj-blue": "#385EAB",
57
57
  "hj-blue-light": "#A8BFE5",
58
+ // Gradation Colors
58
59
  },
59
-
60
60
  maxHeight: {
61
61
  44: "11rem",
62
62
  "9/10": "90%",
@@ -85,6 +85,7 @@ export default {
85
85
  36: "9rem",
86
86
  38: "9.5rem",
87
87
  40: "10rem",
88
+ 41: "10.25rem",
88
89
  42: "10.5rem",
89
90
  44: "11rem",
90
91
  45: "11.25rem",
@@ -279,11 +280,13 @@ export default {
279
280
  "2/10": "5%",
280
281
  "1/5": "20%",
281
282
  "2/5": "40%",
283
+ "4/5": "80%",
282
284
  "1/4": "25%",
283
285
  "1/3": "33.3333333%",
284
286
  "5/100": "5%",
285
287
  "10/100": "10%",
286
288
  "15/100": "15%",
289
+ "36/100": "36%",
287
290
  "43/100": "43%",
288
291
  "46/100": "46%",
289
292
  },
@@ -416,6 +419,23 @@ export default {
416
419
  "7/10": "70%",
417
420
  "9/10": "90%",
418
421
  },
422
+ zIndex: {
423
+ "50": "50",
424
+ "49": "49",
425
+ "48": "48",
426
+ "47": "47",
427
+ "46": "46",
428
+ "45": "45",
429
+ "44": "44",
430
+ "43": "43",
431
+ "42": "42",
432
+ "41": "41",
433
+ "40": "40",
434
+ "30": "30",
435
+ "20": "20",
436
+ "10": "10",
437
+ "0": "0",
438
+ },
419
439
  },
420
440
  },
421
441
  safelist: [
@@ -476,6 +496,9 @@ export default {
476
496
  {
477
497
  pattern: /left-.*/,
478
498
  },
499
+ {
500
+ pattern: /-left-.*/,
501
+ },
479
502
  {
480
503
  pattern: /right*.*/,
481
504
  },
@@ -520,6 +543,12 @@ export default {
520
543
  {
521
544
  pattern: /delay-.*/,
522
545
  },
546
+ {
547
+ pattern: /overflow-.*/,
548
+ },
549
+ {
550
+ pattern: /duration-.*/,
551
+ },
523
552
  ],
524
553
  plugins: [tailwindcssAnimate],
525
554
  } satisfies Config;
@@ -1,4 +1,4 @@
1
- export declare function LineBreaks({ texts, gap }: {
2
- texts: string[];
3
- gap?: number;
1
+ export declare function LineBreaks({ texts, className, }: {
2
+ texts?: string[] | string;
3
+ className?: string;
4
4
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { col } from "../util";
3
- export function LineBreaks({ texts, gap }) {
4
- return (_jsx("div", { className: col(gap), children: texts.map((text, index) => (_jsx("div", { className: "leading-tight", children: text }, index))) }));
2
+ export function LineBreaks({ texts, className, }) {
3
+ return (_jsx("div", { className: className, children: typeof texts === "string"
4
+ ? texts
5
+ : texts?.map((text, index) => (_jsx("div", { className: "leading-tight", children: text }, index))) }));
5
6
  }
@@ -1 +1,5 @@
1
- export default function classNames(...props: string[]): string;
1
+ type ClassNames = string | {
2
+ [key: string]: string | undefined | false;
3
+ };
4
+ export default function classNames(...props: ClassNames[]): string;
5
+ export {};
@@ -1,4 +1,17 @@
1
1
  export default function classNames(...props) {
2
- const array = props.map((prop) => prop.split(" "));
3
- return array.flat().join(" ");
2
+ const classNames = props.reduce((acc, cur) => {
3
+ if (typeof cur === "string") {
4
+ return [...acc, cur];
5
+ }
6
+ if (typeof cur === "object") {
7
+ const values = Object.values(cur).map((value) => {
8
+ if (!value)
9
+ return "";
10
+ return value;
11
+ });
12
+ return [...acc, ...values];
13
+ }
14
+ return acc;
15
+ }, []);
16
+ return classNames.join(" ");
4
17
  }
package/util/colors.d.ts CHANGED
@@ -7,4 +7,5 @@ export declare const colorsByLevel: {
7
7
  };
8
8
  export declare const gradient: {
9
9
  lab: string;
10
+ green_to_red: string;
10
11
  };
package/util/colors.js CHANGED
@@ -7,4 +7,5 @@ export const colorsByLevel = {
7
7
  };
8
8
  export const gradient = {
9
9
  lab: "gradient-to-br from-violet-light/20 to-blue-sky/40 ",
10
+ green_to_red: "gradient-to-r from-green-dark/20 to-red-crimson/20",
10
11
  };
@@ -0,0 +1,4 @@
1
+ export declare function useEase(inTime: number, outTime: number): readonly [boolean, number];
2
+ type Event = readonly [boolean, string];
3
+ export declare function useEvents(args: Event[]): string[];
4
+ export {};
package/util/hooks.js ADDED
@@ -0,0 +1,26 @@
1
+ import { useEffect, useState } from "react";
2
+ export function useEase(inTime, outTime) {
3
+ const [flag, setFlag] = useState(false);
4
+ useEffect(() => {
5
+ const id = setTimeout(() => {
6
+ setFlag((prev) => !prev);
7
+ }, flag ? inTime : outTime);
8
+ return () => clearTimeout(id);
9
+ }, [flag, inTime, outTime]);
10
+ return [flag, flag ? inTime : outTime];
11
+ }
12
+ export function useEvents(args) {
13
+ const [events, setEvents] = useState([]);
14
+ args.forEach(([flag, event]) => {
15
+ useEffect(() => {
16
+ if (flag) {
17
+ setEvents((prev) => {
18
+ if (!prev.includes(event))
19
+ return [...prev, event];
20
+ return prev;
21
+ });
22
+ }
23
+ }, [flag]);
24
+ });
25
+ return events;
26
+ }
package/util/index.d.ts CHANGED
@@ -2,6 +2,8 @@ export { default as cn } from "./classNames";
2
2
  export * from "./colors";
3
3
  export * from "./display";
4
4
  export * from "./displayResponsive";
5
+ export * from "./hooks";
5
6
  export * from "./pattern";
6
7
  export * from "./position";
7
8
  export * from "./shape";
9
+ export * from "./hooks";
package/util/index.js CHANGED
@@ -2,6 +2,8 @@ export { default as cn } from "./classNames";
2
2
  export * from "./colors";
3
3
  export * from "./display";
4
4
  export * from "./displayResponsive";
5
+ export * from "./hooks";
5
6
  export * from "./pattern";
6
7
  export * from "./position";
7
8
  export * from "./shape";
9
+ export * from "./hooks";
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.8
1
+ 1.0.10