@edu-tosel/design 1.0.13 → 1.0.14

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 (140) hide show
  1. package/asset/fonts/TimesNewerRoman-Bold.otf +0 -0
  2. package/asset/fonts/TimesNewerRoman-BoldItalic.otf +0 -0
  3. package/board/template/CanvasBoard.d.ts +1 -1
  4. package/board/template/CanvasBoard.js +2 -2
  5. package/board/template/ManageBoard.d.ts +3 -3
  6. package/board/template/ManageBoard.js +17 -21
  7. package/board/template/PaperBoard.d.ts +1 -1
  8. package/board/template/PaperBoard.js +4 -4
  9. package/board/widget/Board.js +8 -14
  10. package/board/widget/DataField.d.ts +7 -4
  11. package/board/widget/DataField.js +15 -5
  12. package/board/widget/Header.js +3 -3
  13. package/board/widget/Tags.d.ts +14 -3
  14. package/card/index.d.ts +1 -0
  15. package/card/index.js +1 -0
  16. package/card/template/AddCard.d.ts +2 -0
  17. package/card/template/AddCard.js +11 -0
  18. package/card/template/ChartCard.js +1 -1
  19. package/card/template/InfoCard.d.ts +32 -2
  20. package/card/template/InfoCard.design.d.ts +2 -0
  21. package/card/template/InfoCard.design.js +23 -0
  22. package/card/template/InfoCard.js +72 -8
  23. package/card/template/ReportCard.d.ts +1 -1
  24. package/card/template/ReportCard.js +3 -11
  25. package/card/template/RowCard.js +3 -7
  26. package/card/template/TableCard.d.ts +4 -2
  27. package/card/template/TableCard.js +22 -9
  28. package/card/template/TrumpCard.js +2 -2
  29. package/card/widget/Card.d.ts +1 -1
  30. package/card/widget/Card.js +31 -10
  31. package/deck/index.d.ts +1 -1
  32. package/deck/index.js +1 -1
  33. package/deck/template/Deck.d.ts +6 -0
  34. package/deck/template/Deck.design.d.ts +2 -0
  35. package/deck/template/Deck.design.js +21 -0
  36. package/deck/template/Deck.js +11 -0
  37. package/deck/widget/Deck.d.ts +2 -0
  38. package/deck/widget/Deck.js +14 -0
  39. package/globals.css +27 -1
  40. package/html/index.d.ts +3 -0
  41. package/html/index.js +3 -0
  42. package/html/widget/Button.d.ts +2 -0
  43. package/html/widget/Button.js +15 -0
  44. package/html/widget/Input.d.ts +2 -0
  45. package/html/widget/Input.js +21 -0
  46. package/html/widget/Select.d.ts +2 -0
  47. package/html/widget/Select.js +161 -0
  48. package/index.d.ts +2 -1
  49. package/index.js +2 -1
  50. package/interface/Board.d.ts +12 -16
  51. package/interface/Card.d.ts +41 -38
  52. package/{deck → interface}/Deck.d.ts +4 -7
  53. package/interface/Deck.js +1 -0
  54. package/interface/HTMLElement.d.ts +11 -5
  55. package/interface/Modal.d.ts +6 -1
  56. package/interface/Overlay.d.ts +3 -0
  57. package/interface/Overlay.js +1 -0
  58. package/interface/Property.d.ts +9 -0
  59. package/interface/Shelf.d.ts +22 -0
  60. package/interface/Shelf.js +1 -0
  61. package/interface/Widget.d.ts +19 -0
  62. package/interface/index.d.ts +2 -0
  63. package/interface/index.js +2 -0
  64. package/layout/index.d.ts +4 -1
  65. package/layout/index.js +4 -1
  66. package/layout/template/Gallery.d.ts +7 -0
  67. package/layout/template/Gallery.js +6 -0
  68. package/layout/template/Shelf.d.ts +8 -0
  69. package/layout/template/Shelf.js +41 -0
  70. package/layout/{dashboard → template/dashboard}/Header.d.ts +0 -1
  71. package/layout/template/dashboard/Header.js +17 -0
  72. package/layout/{dashboard → template/dashboard}/index.d.ts +5 -1
  73. package/layout/template/dashboard/index.js +27 -0
  74. package/layout/template/report/Header.js +11 -0
  75. package/layout/widget/Events.d.ts +8 -0
  76. package/layout/widget/Events.js +38 -0
  77. package/layout/widget/Shelf.d.ts +2 -0
  78. package/layout/widget/Shelf.js +24 -0
  79. package/{board → layout}/widget/Tab.js +6 -8
  80. package/modal/index.d.ts +1 -3
  81. package/modal/index.js +1 -3
  82. package/modal/template/Alert.d.ts +2 -0
  83. package/modal/template/Alert.js +8 -0
  84. package/modal/template/Input.d.ts +6 -0
  85. package/modal/template/Input.js +6 -0
  86. package/modal/template/index.d.ts +7 -0
  87. package/modal/template/index.js +7 -0
  88. package/modal/widget/Modal.design.d.ts +2 -0
  89. package/modal/widget/Modal.design.js +64 -0
  90. package/navigation/Navigation.d.ts +1 -1
  91. package/navigation/Navigation.js +19 -10
  92. package/overlay/index.d.ts +1 -0
  93. package/overlay/index.js +1 -0
  94. package/overlay/template/Overlay.design.d.ts +2 -0
  95. package/overlay/template/Overlay.design.js +5 -0
  96. package/overlay/template/index.d.ts +3 -0
  97. package/overlay/template/index.js +6 -0
  98. package/overlay/widget/Overlay.d.ts +2 -0
  99. package/overlay/widget/Overlay.js +17 -0
  100. package/package.json +3 -2
  101. package/store/index.d.ts +7 -3
  102. package/store/index.js +26 -8
  103. package/tailwind.config.ts +37 -0
  104. package/text/Formatter.d.ts +3 -0
  105. package/text/Formatter.js +18 -0
  106. package/text/index.d.ts +1 -0
  107. package/text/index.js +1 -0
  108. package/util/colors.d.ts +2 -1
  109. package/util/colors.js +2 -1
  110. package/util/convertUnixTimestampToDate.d.ts +1 -0
  111. package/util/convertUnixTimestampToDate.js +5 -0
  112. package/util/index.d.ts +3 -0
  113. package/util/index.js +3 -0
  114. package/util/isDebug.d.ts +1 -0
  115. package/util/isDebug.js +5 -0
  116. package/util/sortByOrder.d.ts +4 -0
  117. package/util/sortByOrder.js +20 -0
  118. package/version.txt +1 -1
  119. package/card/template/InfoCardCssCase.d.ts +0 -25
  120. package/card/template/InfoCardCssCase.js +0 -32
  121. package/card/template/PropfileCard.d.ts +0 -2
  122. package/card/template/PropfileCard.js +0 -6
  123. package/deck/Deck.js +0 -22
  124. package/layout/dashboard/Header.js +0 -19
  125. package/layout/dashboard/index.js +0 -10
  126. package/layout/report/Header.js +0 -11
  127. package/modal/AlertModal.d.ts +0 -2
  128. package/modal/AlertModal.js +0 -8
  129. package/modal/ControllerModal.d.ts +0 -6
  130. package/modal/ControllerModal.js +0 -6
  131. package/modal/Modal.d.ts +0 -2
  132. package/modal/Modal.js +0 -31
  133. package/modal/TestModal.d.ts +0 -7
  134. package/modal/TestModal.js +0 -6
  135. package/shelf/Shelf.d.ts +0 -3
  136. package/shelf/Shelf.js +0 -4
  137. package/shelf/index.d.ts +0 -1
  138. package/shelf/index.js +0 -1
  139. /package/layout/{report → template/report}/Header.d.ts +0 -0
  140. /package/{board → layout}/widget/Tab.d.ts +0 -0
@@ -1,2 +1,2 @@
1
1
  import { BoardProps } from "../../interface/Board";
2
- export default function CanvasBoard({ children, options }: BoardProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function CanvasBoard({ children, options, widgets, }: BoardProps): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cn } from "../../util";
3
3
  import { Board } from "../widget/Board";
4
- export default function CanvasBoard({ children, options }) {
4
+ export default function CanvasBoard({ children, options, widgets, }) {
5
5
  const layouts = "flex flex-col lg:flex-row lg:flex-wrap gap-7.5 ";
6
6
  const sizes = "h-full ";
7
7
  const paddings = "pb-36 xl:pb-0 px-2 xs:px-4 xl:pl-8 xl:pr-2 pt-2 xs:pt-4 xl:pt-8";
8
8
  const styles = "overflow-y-scroll ";
9
- return (_jsx(Board, { options: { ...options, isRounded: true }, children: _jsx("div", { className: cn(layouts, sizes, paddings, styles), children: children }) }));
9
+ return (_jsx(Board, { widgets: widgets, options: { ...options, isRounded: true }, children: _jsx("div", { className: cn(layouts, sizes, paddings, styles), children: children }) }));
10
10
  }
@@ -1,4 +1,4 @@
1
1
  import { ManageBoardProps } from "../../interface/Board";
2
- type Item = Record<string, any>;
3
- export default function ManageBoard<T extends Item>({ header, data, widgets, }: ManageBoardProps<T>): import("react/jsx-runtime").JSX.Element;
4
- export {};
2
+ export default function ManageBoard<K extends string, T extends {
3
+ [p in K]: any;
4
+ }>({ header, data, widgets, options }: ManageBoardProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,27 +1,23 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Deck } from "../../deck";
3
- import { cn } from "../../util";
2
+ import { Events, Shelf } from "../..";
4
3
  import { Board } from "../widget/Board";
5
4
  import BoardHeader from "../widget/Header";
6
5
  import BoardDataField from "../widget/DataField";
6
+ import { cn, sortByOrder } from "../../util";
7
7
  import { useWidgetStore } from "../../store";
8
- import { Exception } from "../../interaction";
9
- export default function ManageBoard({ header, data, widgets, }) {
10
- const { order: [orderBy, orderHow], } = useWidgetStore();
11
- const { dataSets, dataField, gap } = data;
12
- const positions = `flex flex-col gap-${gap ?? 0}`;
13
- const sizes = `h-full ${dataField ? "xl:h-135" : "xl:h-158"}`;
14
- const paddings = "pb-60 xl:pb-0 px-2 xs:px-4 xl:px-8";
15
- const styles = "overflow-y-scroll";
16
- return (_jsxs(Board, { widgets: widgets, options: { isRounded: true }, children: [_jsx(BoardHeader, { ...header }), dataField && _jsx(BoardDataField, { dataField: dataField }), _jsx("div", { className: cn(positions, sizes, paddings, styles), children: _jsx(Exception, { exceptions: widgets?.exceptions, children: dataSets.map(({ title: deckTitle, items, renderItem }) => deckTitle ? (_jsx("div", { className: "pt-4", children: _jsx(Deck, { titles: { title: deckTitle ?? "" }, children: items?.map((item) => renderItem(item)) }) }, deckTitle)) : (items
17
- ?.slice()
18
- .sort((a, b) => {
19
- if (orderBy) {
20
- if (orderHow === "asc")
21
- return a[orderBy] > b[orderBy] ? 1 : -1;
22
- return a[orderBy] < b[orderBy] ? 1 : -1;
23
- }
24
- return 0;
25
- })
26
- .map((item) => renderItem(item)))) }) }), widgets?.menu] }));
8
+ import { useId } from "react";
9
+ export default function ManageBoard({ header, data, widgets, options }) {
10
+ const { classNames, noPadding } = options ?? {};
11
+ const { dataSets, dataField } = data;
12
+ const { order } = useWidgetStore();
13
+ const id = useId();
14
+ const orders = order[id] ?? [];
15
+ const container = {
16
+ displays: "flex flex-col gap-8",
17
+ sizes: `h-full ${header ? (dataField ? "xl:h-135" : "xl:h-158") : "xl:h-full"}`,
18
+ paddings: `${!noPadding ? "pt-8 pb-60 px-2 xs:px-4 xl:px-8 xl:pb-6 " : ""}`,
19
+ styles: "overflow-y-scroll",
20
+ };
21
+ return (_jsxs(Board, { widgets: widgets, options: { isRounded: true }, children: [header && _jsx(BoardHeader, { ...header }), dataField && _jsx(BoardDataField, { id: id, dataField: dataField }), _jsx("div", { className: cn(container), children: _jsx(Events.Replace, { widgets: widgets?.replaces, children: dataSets.map(({ title, subtitle, items, renderItem, interaction }) => (_jsxs(Shelf.Wrap, { titles: { title: title ?? "", subtitle: subtitle }, classNames: classNames, children: [items &&
22
+ sortByOrder(items, orders)?.map((item) => renderItem(item)), interaction] }, id + title))) }) })] }));
27
23
  }
@@ -1,2 +1,2 @@
1
1
  import { PaperBoardProps } from "../../interface/Board";
2
- export default function PaperBoard({ children, debug }: PaperBoardProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function PaperBoard({ children, debug, options, }: PaperBoardProps): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cn } from "../../util";
3
3
  import { Board } from "../widget/Board";
4
- export default function PaperBoard({ children, debug }) {
4
+ export default function PaperBoard({ children, debug, options, }) {
5
+ const { classNames } = options ?? {};
5
6
  const container = {
6
- displays: "flex flex-col items-center gap-7.5",
7
- paddings: "px-4 pt-5 pb-16",
7
+ displays: "flex flex-col gap-7.5",
8
8
  };
9
- return (_jsx(Board, { options: { width: "lg", height: "full", isRounded: false }, debug: debug, children: _jsx("div", { className: cn(container), children: children }) }));
9
+ return (_jsx(Board, { options: { width: "lg", height: "full", isRounded: false, classNames }, debug: debug, children: _jsx("div", { className: cn(container), children: children }) }));
10
10
  }
@@ -1,7 +1,6 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useWidgetStore } from "../../store";
3
- import Tab from "./Tab";
4
- import { cn } from "../../util";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn, isDebug } from "../../util";
3
+ import { Events } from "../../layout";
5
4
  const widthSize = {
6
5
  xs: "w-20",
7
6
  sm: "w-24",
@@ -23,23 +22,18 @@ const heightSize = {
23
22
  auto: "h-auto",
24
23
  };
25
24
  export function Board({ children, widgets, options, debug }) {
26
- const { events } = useWidgetStore();
27
- const { components, tabs } = widgets ?? {};
28
- const { width, height, isRounded } = options ?? {};
25
+ const { shows } = widgets ?? {};
26
+ const { width, height, isRounded, classNames } = options ?? {};
29
27
  const container = {
30
28
  positions: "relative",
31
29
  width: widthSize[width ?? "full"],
32
- debug: debug && import.meta.env.MODE && `border-2 border-${debug}`,
30
+ debug: debug && isDebug(`border-2 border-${debug}`),
33
31
  };
34
32
  const body = {
35
33
  positions: "relative z-10 ",
36
34
  sizes: `w-full ${heightSize[height ?? "lg"]} overflow-hidden `,
37
- styles: "bg-white",
35
+ styles: "bg-white text-black",
38
36
  rounded: `rounded-none ${isRounded ? "xl:rounded-xl" : ""}`,
39
37
  };
40
- return (_jsxs("div", { className: cn(container), children: [_jsxs("div", { className: cn(body), children: [children, components?.map(([flag, Component]) => {
41
- if (typeof flag === "boolean")
42
- return flag ? _jsx(_Fragment, { children: Component }) : null;
43
- return events?.some(({ event }) => event === flag) ? (_jsx(_Fragment, { children: Component })) : null;
44
- })] }), tabs && _jsx(Tab, { tabs: tabs })] }));
38
+ return (_jsx("div", { className: cn(container), children: _jsx("div", { className: cn(body), children: _jsx(Events.Show, { widgets: shows, children: _jsx("div", { className: "h-full " + classNames, children: children }) }) }) }));
45
39
  }
@@ -1,6 +1,9 @@
1
- export default function BoardDataField({ dataField, }: {
2
- dataField: {
3
- fields: Record<string, string>;
4
- sizes: Record<string, string>;
1
+ import { DataField } from "../../interface";
2
+ export default function BoardDataField<K extends string, T extends {
3
+ [p in K]: any;
4
+ }>({ id, dataField, }: {
5
+ id: string;
6
+ dataField?: {
7
+ [p in keyof T]: DataField;
5
8
  };
6
9
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { cn } from "../../util";
3
3
  import { useWidgetStore } from "./../../store";
4
- export default function BoardDataField({ dataField, }) {
5
- const { order: [orderBy, orderHow], setOrder, } = useWidgetStore();
6
- const { fields, sizes } = dataField;
4
+ export default function BoardDataField({ id, dataField, }) {
5
+ const { order, setOrder } = useWidgetStore();
6
+ const orders = order[id] ?? [];
7
7
  const container = {
8
- positions: "fixed top-40 left-0 xl:static",
8
+ positions: "fixed top-35 left-0 xl:static z-20",
9
9
  displays: "flex items-center",
10
10
  styles: `bg-gray-200`,
11
11
  sizes: "w-full h-23",
@@ -20,5 +20,15 @@ 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), 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) })] }));
23
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(container), children: _jsx("div", { className: cn(dataFieldContainer), children: dataField &&
24
+ Object.entries(dataField).map(([key, { title, size }]) => (_jsx("div", { className: `w-${size}/100`, children: _jsxs("button", { onClick: () => setOrder(id, key), className: "flex items-center gap-1", children: [_jsx("div", { children: title }), _jsx("div", { className: "text-xs", children: orders?.map(({ orderBy, orderHow }) => {
25
+ if (orderBy === key) {
26
+ if (orderHow === "asc")
27
+ return "▲";
28
+ else if (orderHow === "desc")
29
+ return "▼";
30
+ else
31
+ return "";
32
+ }
33
+ }) })] }) }, id + key))) }) }), _jsx("div", { className: cn(block) })] }));
24
34
  }
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { cn } from "../../util";
3
- import { Input, Select } from "./Tags";
3
+ import { Input, Select } from "../../html";
4
4
  export default function BoardHeader({ title, tags, options, }) {
5
5
  const { selects, inputs } = tags ?? {};
6
6
  const { colors } = options ?? {};
@@ -9,7 +9,7 @@ export default function BoardHeader({ title, tags, options, }) {
9
9
  textColor: "black",
10
10
  };
11
11
  const container = {
12
- positions: "fixed top-20 left-0 xl:static flex items-center",
12
+ positions: "fixed top-15 left-0 z-20 xl:static flex items-center",
13
13
  paddings: "px-12",
14
14
  styles: `bg-${bgColor} text-${textColor} pl-12 pr-9`,
15
15
  sizes: "w-full h-20",
@@ -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), 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) })] }));
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 }, index) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { children: title }), _jsx(Select, { options: { width }, selectOptions: options, onChange: onChange }, title)] }, index))), inputs?.map(({ width, title, placeholder, onChange }, index) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { children: title }), _jsx(Input, { placeholder: placeholder, onChange: onChange, options: { width } })] }, index)))] })] }), _jsx("div", { className: cn(block) })] }));
22
22
  }
@@ -1,3 +1,14 @@
1
- import { HTMLInputElement, HTMLSelectElement } from "../../interface/HTMLElement";
2
- export declare function Select({ title, width, onChange, selectOptions, }: HTMLSelectElement): import("react/jsx-runtime").JSX.Element;
3
- export declare function Input({ title, onChange, placeholder, width, }: HTMLInputElement): import("react/jsx-runtime").JSX.Element;
1
+ import { Dispatch } from "react";
2
+ import { Size } from "../../interface";
3
+ export declare function Select({ title, width, onChange, selectOptions, }: {
4
+ title: string;
5
+ width?: Size;
6
+ onChange: Dispatch<string>;
7
+ selectOptions?: [string | number, string][];
8
+ }): import("react/jsx-runtime").JSX.Element;
9
+ export declare function Input({ title, onChange, placeholder, width, }: {
10
+ title: string;
11
+ onChange: Dispatch<string>;
12
+ placeholder?: string;
13
+ width?: Size;
14
+ }): import("react/jsx-runtime").JSX.Element;
package/card/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { default as AddCard } from "./template/AddCard";
1
2
  export { default as ProfileCard } from "./template/ProfileCard";
2
3
  export { default as TrumpCard } from "./template/TrumpCard";
3
4
  export { default as ChartCard } from "./template/ChartCard";
package/card/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { default as AddCard } from "./template/AddCard";
1
2
  export { default as ProfileCard } from "./template/ProfileCard";
2
3
  export { default as TrumpCard } from "./template/TrumpCard";
3
4
  export { default as ChartCard } from "./template/ChartCard";
@@ -0,0 +1,2 @@
1
+ import { AddCardProps } from "../../interface";
2
+ export default function AddCard({ onClick, options }: AddCardProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../util";
3
+ import { Card } from "../widget/Card";
4
+ export default function AddCard({ onClick, options }) {
5
+ const { width } = options ?? {};
6
+ const container = {
7
+ displays: "flex justify-center items-center",
8
+ text: "text-3xl",
9
+ };
10
+ return _jsx(Card, { options: { width, classNames: cn(container), onClick }, children: "+" });
11
+ }
@@ -5,7 +5,7 @@ export default function ChartCard({ data, xAxis, yAxis, lines, bars, areas, opti
5
5
  const { width, height } = options ?? {};
6
6
  return (_jsxs(Card, { options: {
7
7
  classNames: "pt-4 pr-4",
8
- width: width ?? "xl",
8
+ width: width ?? "full",
9
9
  height: height ?? "lg",
10
10
  text: { size: "xs" },
11
11
  }, children: [_jsx(ResponsiveContainer, { width: "100%", height: "100%", children: _jsxs(ComposedChart, { data: data, children: [_jsx(XAxis, { dataKey: xAxis }), _jsx(YAxis, { dataKey: yAxis }), _jsx(Tooltip, {}), _jsx(Legend, {}), lines?.map((line) => (_jsx(Line, { ...line }, line.dataKey))), bars?.map((bar) => (_jsx(Bar, { ...bar }, bar.dataKey))), areas?.map((area) => (_jsx(Area, { ...area }, area.dataKey))), average && (_jsx(_Fragment, { children: _jsx(ReferenceLine, { x: average.x, stroke: "#ff0000" }) }))] }) }), average && (_jsxs("div", { className: "absolute top-0 left-0 w-full h-full flex justify-center items-center text-3xl text-gray-300 font-bold", children: ["\uD3C9\uADE0: ", average?.score, "\uC810"] }))] }));
@@ -1,2 +1,32 @@
1
- import { InfoCardProps } from "../../interface/Card";
2
- export default function InfoCard({ type, titles, button }: InfoCardProps): import("react/jsx-runtime").JSX.Element;
1
+ import { InfoCardProps, Button } from "../../interface";
2
+ declare function Exam({ titles, data, }: Omit<InfoCardProps, "children"> & {
3
+ data: {
4
+ status: string;
5
+ examDate: string;
6
+ endDate: string;
7
+ manager: string;
8
+ isPublic: boolean;
9
+ };
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ declare function Product({ titles, data, }: Omit<InfoCardProps, "children"> & {
12
+ data: {
13
+ date?: string;
14
+ status?: string;
15
+ receiver?: string | null;
16
+ requester?: string | null;
17
+ button?: Button;
18
+ };
19
+ }): import("react/jsx-runtime").JSX.Element;
20
+ declare function Item({ titles, data, }: Omit<InfoCardProps, "children"> & {
21
+ data: {
22
+ item: string;
23
+ };
24
+ }): import("react/jsx-runtime").JSX.Element;
25
+ declare function Profile(props: Partial<InfoCardProps>): import("react/jsx-runtime").JSX.Element;
26
+ declare const InfoCard: {
27
+ Exam: typeof Exam;
28
+ Product: typeof Product;
29
+ Item: typeof Item;
30
+ Profile: typeof Profile;
31
+ };
32
+ export default InfoCard;
@@ -0,0 +1,2 @@
1
+ import { InfoCardProps } from "../../interface/Card";
2
+ export declare function InfoCardDesign({ titles: { title, subtitle }, debug, options, children, }: InfoCardProps): 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 } from "../../util";
3
+ import { Card } from "../widget/Card";
4
+ export function InfoCardDesign({ titles: { title, subtitle }, debug, options, children, }) {
5
+ const { titleBorderColor, rightTextColor } = options ?? {};
6
+ const container = {
7
+ paddings: "pt-5 px-5",
8
+ };
9
+ const topBox = {
10
+ container: {
11
+ displays: "flex justify-between",
12
+ sizes: "w-full h-13.25",
13
+ styles: `border-${titleBorderColor} border-b-2 pb-2.5`,
14
+ },
15
+ titleText: "h-6 font-bold text-lg ",
16
+ subtitleText: "h-5 text-sm font-extralight",
17
+ right: {
18
+ fontColor: `text-${rightTextColor ?? "black"}`,
19
+ displays: "flex flex-col-reverse",
20
+ },
21
+ };
22
+ return (_jsxs(Card, { options: { ...options, classNames: cn(container) }, debug: debug, children: [_jsx("div", { className: cn(topBox.container), children: _jsxs("div", { children: [_jsx("div", { className: cn(topBox.titleText), children: title }), _jsx("div", { className: cn(topBox.subtitleText), children: subtitle ?? "No Data" })] }) }), children] }));
23
+ }
@@ -1,9 +1,73 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Card } from "../widget/Card";
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 }) })] }) }));
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { cn } from "../../util";
4
+ import { InfoCardDesign } from "./InfoCard.design";
5
+ function Exam({ titles, data, }) {
6
+ const { status, isPublic, manager, examDate, endDate } = data;
7
+ const container = {
8
+ positions: "relative",
9
+ displays: "flex flex-col gap-6.5 pt-2.5",
10
+ sizes: "h-25 w-full",
11
+ };
12
+ const style = {
13
+ positions: "absolute bottom-0 right-0",
14
+ sizes: "w-22 h-6",
15
+ displays: "flex justify-center items-center",
16
+ styles: "text-black rounded-md text-sm",
17
+ background: `bg-gray-light`,
18
+ };
19
+ return (_jsx(InfoCardDesign, { titles: titles, options: {
20
+ titleBorderColor: "red-crimson",
21
+ rightTextColor: "red-crimson",
22
+ width: "sm",
23
+ height: "sm",
24
+ buttonBackgroundColor: "gray-light",
25
+ }, children: _jsxs("div", { className: cn(container), children: [_jsxs("div", { className: "flex gap-4 font-bold", children: [manager, " / ", isPublic ? "공개시험" : "비공개시험"] }), _jsxs("div", { children: [_jsxs("div", { className: "text-sm", children: ["\uC811\uC218\uB9C8\uAC10: ", endDate] }), _jsxs("div", { className: "text-sm", children: ["\uC2DC\uD5D8\uC77C: ", examDate] })] }), _jsx("div", { className: cn(style), children: status })] }) }));
9
26
  }
27
+ function Product({ titles, data, }) {
28
+ const { date, status, receiver, requester, button } = data;
29
+ const container = {
30
+ positions: "relative",
31
+ displays: "flex flex-col pt-2.5",
32
+ sizes: "h-25 w-full",
33
+ };
34
+ const style = {
35
+ positions: "absolute bottom-0 right-0",
36
+ sizes: "w-22 h-6",
37
+ displays: "flex justify-center items-center",
38
+ styles: "rounded-md text-sm",
39
+ animation: "text-black bg-gray-light hover:bg-blue-sky hover:text-white duration-500",
40
+ };
41
+ const [hover, setHover] = useState(false);
42
+ return (_jsx(InfoCardDesign, { titles: titles, options: {
43
+ titleBorderColor: "jr-blue",
44
+ rightTextColor: "red-crimson",
45
+ width: "sm",
46
+ height: "sm",
47
+ buttonBackgroundColor: "gray-light",
48
+ }, children: _jsxs("div", { className: cn(container), children: [_jsxs("div", { children: ["\uC77C\uC2DC: ", date] }), _jsxs("div", { children: ["\uC694\uCCAD\uC790: ", requester ?? "No Data"] }), _jsxs("div", { children: ["\uC218\uC2E0\uC790: ", receiver ?? "No Data"] }), _jsx("button", { className: cn(style), onClick: () => button?.[1](), onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), children: !hover ? status : button?.[0] ?? "완료" })] }) }));
49
+ }
50
+ function Item({ titles, data, }) {
51
+ const { item } = data;
52
+ return (_jsx(InfoCardDesign, { titles: titles, options: {
53
+ titleBorderColor: "blue-navy",
54
+ rightTextColor: "blue-navy",
55
+ width: "xs",
56
+ height: "md",
57
+ }, children: _jsx("div", { children: item }) }));
58
+ }
59
+ function Profile(props) {
60
+ return (_jsx(InfoCardDesign, { titles: { title: "ㅎㅇ" }, options: {
61
+ titleBorderColor: "blue-navy",
62
+ rightTextColor: "blue-navy",
63
+ width: "sm",
64
+ height: "md",
65
+ }, ...props, children: _jsx(_Fragment, {}) }));
66
+ }
67
+ const InfoCard = {
68
+ Exam,
69
+ Product,
70
+ Item,
71
+ Profile,
72
+ };
73
+ export default InfoCard;
@@ -1,5 +1,5 @@
1
1
  import { Titles } from "../../interface";
2
- export default function ReportCard({ titles, type, dataSets, dataField, }: {
2
+ export default function ReportCard({ titles, dataField, }: {
3
3
  titles: Titles;
4
4
  type: "text" | "table" | "chart";
5
5
  dataSets: {
@@ -1,9 +1,6 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { LineBreaks } from "../../text";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import { cn } from "../../util";
4
- import ChartCard from "./ChartCard";
5
- import TableCard from "./TableCard";
6
- export default function ReportCard({ titles, type, dataSets, dataField, }) {
3
+ export default function ReportCard({ titles, dataField, }) {
7
4
  const { title, subtitle } = titles;
8
5
  const { axis, fields, lines, bars, areas, sizes } = dataField;
9
6
  const container = {
@@ -14,10 +11,5 @@ export default function ReportCard({ titles, type, dataSets, dataField, }) {
14
11
  title: "text-lg font-bold",
15
12
  subtitle: "text-sm",
16
13
  };
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 === "text" ? (_jsx("div", { children: "text" })) : 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, bars: bars, areas: areas, average: dataSets.average, options: {
21
- width: "full",
22
- } })) : null] }));
14
+ return (_jsx("div", { className: cn(container) }));
23
15
  }
@@ -1,20 +1,16 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Card } from "../widget/Card";
3
- import { useWidgetStore } from "../../store";
4
3
  import { useId, useState } from "react";
5
4
  export default function RowCard({ row, fields, sizes, }) {
5
+ const id = useId();
6
6
  const [rowState, setRowState] = useState(row);
7
- const { setView, setTempData } = useWidgetStore();
8
7
  const entries = Object.entries(fields).map(([key, type]) => [type, key, rowState[key]]);
9
8
  return (_jsx(Card, { options: {
10
9
  width: "full",
11
10
  height: "xs",
12
11
  boundary: "none",
13
12
  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)) }, key))), _jsx("button", { onClick: () => {
15
- setTempData(row);
16
- setView("sideMenu");
17
- }, children: "click" })] }) }));
13
+ }, children: _jsx("div", { className: "flex items-center h-full px-2 xs:px-4 xl:px-8", 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)) }, id + key))) }) }));
18
14
  }
19
15
  function Select({ type, entry, row, setRow, }) {
20
16
  const id = useId();
@@ -1,2 +1,4 @@
1
- import { TableCardProps } from "../../interface/Card";
2
- export default function TableCard({ data, fields, sizes, options, }: TableCardProps): import("react/jsx-runtime").JSX.Element;
1
+ import { TableCardProps } from "../../interface";
2
+ export default function TableCard<K extends string, T extends {
3
+ [p in K]: any;
4
+ }>({ dataSets, dataField, options }: TableCardProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,17 +1,30 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { cn } from "../../util";
2
+ import { useId } from "react";
3
+ import { useWidgetStore } from "../../store";
4
+ import { cn, sortByOrder } from "../../util";
3
5
  import { Card } from "../widget/Card";
4
- export default function TableCard({ data, fields, sizes, options, }) {
5
- const { width, height, background, text, overflow } = options ?? {};
6
+ export default function TableCard({ dataSets, dataField, options }) {
7
+ const { width, height, background, text } = options ?? {};
6
8
  const { color: bgColor } = background ?? {};
7
9
  const { color: textColor } = text ?? {};
8
- const keys = Object.keys(fields);
10
+ const { order, setOrder } = useWidgetStore();
11
+ const id = useId();
12
+ const orders = order[id] ?? [];
9
13
  const container = {
10
14
  text: "text-xs xs:text-sm sm:text-base",
11
15
  };
12
- const fieldsClassNames = [
13
- `flex h-11 items-center font-bold pl-4`,
14
- `bg-${bgColor ?? "gray-300"} text-${textColor ?? "black"}`,
15
- ].join(" ");
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]}/100`, 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]}/100` ?? "auto"}`, children: row[key] }, key))) }, index)))] }) }));
16
+ return (_jsx(Card, { header: Object.entries(dataField).map(([key, { title, size }]) => (_jsx("div", { className: `w-${size}/100`, children: _jsxs("button", { onClick: () => setOrder(id, key), className: "flex items-center gap-1", children: [_jsx("div", { children: title }), _jsx("div", { className: "text-xs", children: orders?.map(({ orderBy, orderHow }) => {
17
+ if (orderBy === key) {
18
+ if (orderHow === "asc")
19
+ return "▲";
20
+ else if (orderHow === "desc")
21
+ return "▼";
22
+ else
23
+ return "";
24
+ }
25
+ }) })] }) }, id + key))), options: {
26
+ width: width ?? "full",
27
+ height: height ?? "lg",
28
+ overflow: "y-scroll",
29
+ }, children: _jsx("div", { className: cn(container), children: sortByOrder(dataSets, orders).map((data, index) => (_jsx("div", { className: "flex items-center pl-4 h-11 ", children: Object.entries(data).map(([key, value]) => (_jsx("div", { className: `w-${dataField[key].size}/100`, children: String(value) }, id + key))) }, id + index))) }) }));
17
30
  }
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { LineBreaks } from "../../text";
3
3
  import { Card } from "../widget/Card";
4
4
  export default function TrumpCard({ titles, options }) {
5
- const { title, subTitle, color: titleColor } = titles;
5
+ const { title, subtitle, color: titleColor } = titles;
6
6
  const { onClick, width, image, subButton } = options ?? {};
7
7
  const [buttonText, buttonBgColor, buttonAction] = subButton ?? [
8
8
  null,
@@ -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 }, 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] }));
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, debug }: CardProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function Card({ header, children, options, debug }: CardProps): import("react/jsx-runtime").JSX.Element;