@edu-tosel/design 1.0.16 → 1.0.18

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 (116) hide show
  1. package/board/template/CanvasBoard.js +2 -2
  2. package/board/template/ManageBoard.js +3 -4
  3. package/board/template/PaperBoard.js +1 -1
  4. package/board/widget/Header.js +1 -1
  5. package/card/index.d.ts +3 -5
  6. package/card/index.js +3 -5
  7. package/card/template/AddCard.js +1 -1
  8. package/card/template/ChartCard.js +2 -2
  9. package/card/template/InfoCard.d.ts +13 -20
  10. package/card/template/InfoCard.js +47 -40
  11. package/card/template/NavCard.d.ts +15 -0
  12. package/card/template/NavCard.js +44 -0
  13. package/card/template/TableCard.js +9 -17
  14. package/card/widget/{Card.js → Card.design.js} +12 -27
  15. package/card/{template → widget}/InfoCard.design.js +7 -7
  16. package/card/widget/NavCard.design.d.ts +2 -0
  17. package/card/widget/NavCard.design.js +32 -0
  18. package/globals.css +18 -2
  19. package/html/index.d.ts +2 -1
  20. package/html/index.js +2 -1
  21. package/html/template/Label.d.ts +8 -0
  22. package/html/template/Label.js +14 -0
  23. package/html/widget/DatePicker.js +1 -1
  24. package/html/widget/EmailInput.d.ts +2 -0
  25. package/html/widget/EmailInput.js +44 -0
  26. package/html/widget/Input.js +6 -4
  27. package/html/widget/Label.design.d.ts +2 -0
  28. package/html/widget/Label.design.js +36 -0
  29. package/html/widget/Select.js +5 -5
  30. package/html/widget/Toggle.d.ts +1 -1
  31. package/html/widget/Toggle.js +3 -2
  32. package/interaction/index.d.ts +2 -5
  33. package/interaction/index.js +2 -5
  34. package/interaction/template/Loading.d.ts +9 -0
  35. package/interaction/template/Loading.js +9 -0
  36. package/interaction/template/NoData.d.ts +5 -0
  37. package/interaction/template/NoData.js +9 -0
  38. package/interaction/widget/Jumper.design.d.ts +1 -0
  39. package/interaction/widget/{LoadingJumper.js → Jumper.design.js} +1 -1
  40. package/interaction/widget/Script.design.d.ts +3 -0
  41. package/interaction/widget/{NoData.js → Script.design.js} +2 -2
  42. package/interaction/widget/Spinner.design.d.ts +1 -0
  43. package/interaction/widget/{LoadingSpinner.js → Spinner.design.js} +1 -1
  44. package/interaction/widget/Worm.design.d.ts +1 -0
  45. package/interaction/widget/{LoadingWorm.js → Worm.design.js} +2 -2
  46. package/interface/Card.d.ts +48 -41
  47. package/interface/HTMLElement.d.ts +7 -3
  48. package/interface/Layout.d.ts +20 -0
  49. package/interface/Layout.js +1 -0
  50. package/interface/Property.d.ts +1 -1
  51. package/interface/Widget.d.ts +23 -0
  52. package/interface/index.d.ts +1 -0
  53. package/interface/index.js +1 -0
  54. package/layout/index.d.ts +3 -1
  55. package/layout/index.js +3 -1
  56. package/layout/template/DataField.d.ts +8 -0
  57. package/layout/template/DataField.js +16 -0
  58. package/layout/{widget → template}/Events.d.ts +1 -1
  59. package/layout/template/Gallery.js +2 -2
  60. package/layout/template/Row.d.ts +8 -0
  61. package/layout/template/Row.js +24 -0
  62. package/layout/template/Shelf.js +1 -1
  63. package/layout/template/dashboard/Header.d.ts +2 -4
  64. package/layout/template/dashboard/Header.js +7 -5
  65. package/layout/template/dashboard/index.d.ts +2 -6
  66. package/layout/template/dashboard/index.js +6 -6
  67. package/layout/widget/DataField.design.d.ts +2 -0
  68. package/{board/widget/DataField.js → layout/widget/DataField.design.js} +8 -8
  69. package/layout/widget/Row.design.d.ts +2 -0
  70. package/layout/widget/Row.design.js +16 -0
  71. package/modal/template/Alert.js +1 -2
  72. package/navigation/Navigation.js +2 -2
  73. package/overlay/template/Manage.js +1 -1
  74. package/package.json +1 -1
  75. package/tailwind.config.ts +15 -91
  76. package/text/Formatter.d.ts +1 -1
  77. package/text/Formatter.js +76 -13
  78. package/util/colors.d.ts +8 -1
  79. package/util/colors.js +6 -3
  80. package/util/index.d.ts +0 -3
  81. package/util/index.js +0 -3
  82. package/version.txt +1 -1
  83. package/board/widget/DataField.d.ts +0 -7
  84. package/board/widget/Tags.d.ts +0 -14
  85. package/board/widget/Tags.js +0 -30
  86. package/card/template/ProfileCard.d.ts +0 -14
  87. package/card/template/ProfileCard.js +0 -8
  88. package/card/template/ReportCard.d.ts +0 -33
  89. package/card/template/ReportCard.js +0 -15
  90. package/card/template/RowCard.d.ts +0 -2
  91. package/card/template/RowCard.js +0 -24
  92. package/card/template/TrumpCard.d.ts +0 -2
  93. package/card/template/TrumpCard.js +0 -19
  94. package/html/widget/Button.d.ts +0 -2
  95. package/html/widget/Button.js +0 -15
  96. package/interaction/template/Exception.d.ts +0 -2
  97. package/interaction/template/Exception.js +0 -10
  98. package/interaction/widget/LoadingJumper.d.ts +0 -1
  99. package/interaction/widget/LoadingSpinner.d.ts +0 -1
  100. package/interaction/widget/LoadingWorm.d.ts +0 -1
  101. package/interaction/widget/NoData.d.ts +0 -1
  102. package/util/display.d.ts +0 -25
  103. package/util/display.js +0 -25
  104. package/util/displayResponsive.d.ts +0 -3
  105. package/util/displayResponsive.js +0 -15
  106. package/util/position.d.ts +0 -14
  107. package/util/position.js +0 -44
  108. /package/board/widget/{Board.d.ts → Board.design.d.ts} +0 -0
  109. /package/board/widget/{Board.js → Board.design.js} +0 -0
  110. /package/card/widget/{Card.d.ts → Card.design.d.ts} +0 -0
  111. /package/card/{template → widget}/InfoCard.design.d.ts +0 -0
  112. /package/layout/{widget → template}/Events.js +0 -0
  113. /package/layout/widget/{Shelf.d.ts → Shelf.design.d.ts} +0 -0
  114. /package/layout/widget/{Shelf.js → Shelf.design.js} +0 -0
  115. /package/layout/widget/{Tab.d.ts → Tab.design.d.ts} +0 -0
  116. /package/layout/widget/{Tab.js → Tab.design.js} +0 -0
@@ -1,17 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
- import { cn, gradient } from "../../../util";
3
+ import { cn } from "../../../util";
4
4
  import { useWidgetStore } from "../../../store";
5
- export function Header({ title, image, }) {
5
+ export function Header({ title, logo, options }) {
6
+ const { text, background, className } = options ?? {};
6
7
  const { isDark, setDark } = useWidgetStore();
7
8
  const [isOpen, setIsOpen] = useState(false);
8
- const [src, href] = image ?? [];
9
9
  const container = {
10
10
  positions: "fixed xl:static top-0 left-0 z-40",
11
11
  displays: "flex items-center justify-between ",
12
12
  sizes: "h-15 w-full",
13
- background: !isDark ? `bg-${gradient.greenToRed}` : "bg-black",
13
+ background: `${background ?? "bg-white"} dark:bg-black`,
14
+ text: `${text ?? "text-black"} dark:text-white`,
14
15
  styles: "px-5 xl:px-8 2xl:px-16 ",
16
+ className,
15
17
  };
16
- return (_jsxs("div", { className: cn(container), children: [_jsxs("div", { className: "flex h-12 items-center gap-8 xl:gap-24 2xl:gap-22", children: [src && href ? (_jsx("a", { href: href, children: _jsx("img", { src: src, alt: "logo", className: "h-6.25 w-28.78" }) })) : (_jsx("div", { className: "text-2xl", children: "TOSEL" })), _jsx("div", { className: "text-3xl font-bold text-white ", children: title })] }), _jsx("button", { onClick: setDark, className: "text-white", children: "DARK" })] }));
18
+ return (_jsxs("div", { className: cn(container), children: [_jsxs("div", { className: "flex h-12 items-center gap-8 xl:gap-24 2xl:gap-26", children: [logo ? (_jsx("a", { href: logo.href, children: _jsx("img", { src: logo.image, alt: "logo", className: "h-6.25 w-28.78" }) })) : (_jsx("div", { className: "text-2xl", children: "TOSEL" })), _jsx("div", { className: "text-3xl font-bold", children: title })] }), _jsx("button", { onClick: setDark, children: "DARK" })] }));
17
19
  }
@@ -1,9 +1,5 @@
1
- declare function Layout({ subject, colors, navigations, children, }: {
2
- subject: [string, string, string];
3
- colors?: [string, string];
4
- navigations: React.ReactNode[];
5
- children: React.ReactNode;
6
- }): import("react/jsx-runtime").JSX.Element;
1
+ import { DashboardProps } from "../../../interface";
2
+ declare function Layout({ header, navigations, children, options }: DashboardProps): import("react/jsx-runtime").JSX.Element;
7
3
  declare const Dashboard: {
8
4
  Layout: typeof Layout;
9
5
  };
@@ -4,10 +4,10 @@ import { NavigationContainer } from "../../../navigation";
4
4
  import { Header } from "./Header";
5
5
  import { cn } from "../../../util";
6
6
  import { useWidgetStore } from "../../../store";
7
- function Layout({ subject, colors, navigations, children, }) {
7
+ function Layout({ header, navigations, children, options }) {
8
8
  const { isDark, flag, setFlag, isOwn, setIsOwn, clearView } = useWidgetStore();
9
- const [title, image, imageUrl] = subject ?? ["", "", ""];
10
- const [bgColor, textColor] = colors ?? ["white", "black"];
9
+ const { title, options: headerOptions, logo } = header;
10
+ const { background } = options ?? {};
11
11
  useEffect(() => {
12
12
  if (isOwn) {
13
13
  return setIsOwn(false);
@@ -16,8 +16,8 @@ function Layout({ subject, colors, navigations, children, }) {
16
16
  }, [flag]);
17
17
  const container = {
18
18
  sizes: "min-h-screen h-screen xl:h-auto",
19
- background: !isDark ? `bg-${bgColor}` : "bg-black/80",
20
- styles: `text-${textColor} font-pretendard-medium`,
19
+ background: `${background ?? "bg-gray-light"} dark:bg-black/80`,
20
+ styles: "font-pretendard-medium",
21
21
  dark: isDark && "dark",
22
22
  };
23
23
  const body = {
@@ -25,7 +25,7 @@ function Layout({ subject, colors, navigations, children, }) {
25
25
  displays: "flex gap-12 xl:gap-7.5 ",
26
26
  paddings: "pt-15 xl:pl-2 2xl:px-12 xl:pt-7.5",
27
27
  };
28
- return (_jsxs("div", { className: cn(container), onClick: setFlag, children: [_jsx(Header, { title: title, image: [image, imageUrl] }), _jsxs("div", { className: cn(body), children: [_jsx(NavigationContainer, { children: navigations.map((nav, index) => (_jsx(Fragment, { children: nav }, index))) }), children] })] }));
28
+ return (_jsxs("div", { className: cn(container), onClick: setFlag, children: [_jsx(Header, { title: title, options: headerOptions, logo: logo }), _jsxs("div", { className: cn(body), children: [_jsx(NavigationContainer, { children: navigations.map((nav, index) => (_jsx(Fragment, { children: nav }, index))) }), children] })] }));
29
29
  }
30
30
  const Dashboard = {
31
31
  Layout,
@@ -0,0 +1,2 @@
1
+ import { DataFieldProps } from "../../interface";
2
+ export default function DataFieldDesign<T extends Record<string, any>>({ id, dataField, options, }: DataFieldProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,23 +1,23 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { cn } from "../../util";
3
- import { useWidgetStore } from "./../../store";
4
- export default function BoardDataField({ id, dataField, }) {
3
+ import { useWidgetStore } from "../../store";
4
+ export default function DataFieldDesign({ id, dataField, options, }) {
5
5
  const { order, setOrder } = useWidgetStore();
6
+ const { padding, position } = options ?? {};
6
7
  const orders = order[id] ?? [];
7
8
  const container = {
8
- positions: "fixed top-34 xl:top-0 left-0 xl:relative z-20",
9
+ positions: position && position,
9
10
  displays: "flex items-center",
10
11
  sizes: "w-full h-13.75",
11
- paddings: "px-2 xs:px-4 xl:px-7.5",
12
- styles: "bg-white",
13
- test: "box-shadow-sm",
12
+ paddings: padding && padding,
13
+ styles: "bg-white box-shadow-sm font-bold",
14
14
  };
15
15
  const block = {
16
16
  displays: "xl:hidden block ",
17
17
  sizes: container.sizes,
18
18
  };
19
19
  return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(container), children: dataField &&
20
- Object.keys(dataField).map((key) => (_jsx("div", { className: `w-${dataField[key]?.size}/100 `, children: _jsxs("button", { onClick: () => setOrder(id, key), className: "flex items-center", children: [_jsx("div", { children: dataField[key]?.title }), _jsx("div", { className: "text-xs", children: orders?.map(({ orderBy, orderHow }) => {
20
+ Object.keys(dataField).map((key) => (_jsx("div", { className: `w-${dataField[key]?.size}/100`, children: _jsxs("button", { onClick: () => setOrder(id, key), className: "flex items-center", children: [_jsx("div", { children: dataField[key]?.title }), _jsx("div", { className: "text-xs", children: orders?.map(({ orderBy, orderHow }) => {
21
21
  if (orderBy === key) {
22
22
  if (orderHow === "asc")
23
23
  return (_jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M7.15859 15.0437C6.7079 15.9134 7.27152 17 8.17239 17H15.8279C16.7282 17 17.2919 15.9134 16.8417 15.0437L13.0145 7.65229C12.5638 6.78257 11.4365 6.78257 10.9858 7.65229L7.15859 15.0437Z", fill: "#105652" }) }));
@@ -26,5 +26,5 @@ export default function BoardDataField({ id, dataField, }) {
26
26
  else
27
27
  return "";
28
28
  }
29
- }) })] }) }, id + key))) }), _jsx("div", { className: cn(block) })] }));
29
+ }) })] }) }, id + key))) }), position && _jsx("div", { className: cn(block) })] }));
30
30
  }
@@ -0,0 +1,2 @@
1
+ import { RowProps } from "../../interface";
2
+ export default function RowDesign<T extends Record<string, any>>({ dataSet, dataField, options, onClick, }: RowProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { cn } from "../../util";
4
+ export default function RowDesign({ dataSet, dataField, options, onClick, }) {
5
+ const { size, padding, text } = options ?? {};
6
+ const id = useId();
7
+ const container = {
8
+ displays: "flex items-center ",
9
+ sizes: size,
10
+ paddings: padding,
11
+ text: text,
12
+ styles: "hover:bg-gray-100 duration-100",
13
+ };
14
+ return (_jsx("div", { className: cn(container), onClick: onClick, children: dataField &&
15
+ Object.keys(dataField).map((key) => (_jsx("div", { className: `w-${dataField[key]?.size}/100 truncate`, children: dataSet[key] }, id + key))) }));
16
+ }
@@ -1,8 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { col } from "../../util";
3
2
  import ModalDesign from "../widget/Modal.design";
4
3
  export default function Alert({ isVisible, title, scripts, options, }) {
5
4
  const { script, subScript } = scripts ?? {};
6
5
  const { buttons } = options ?? {};
7
- return (_jsx(ModalDesign, { isVisible: isVisible, classNames: "pt-18 px-25", options: { buttons, isCloseButton: true }, children: _jsx("div", { className: col(3), 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 })] }) }) }));
6
+ return (_jsx(ModalDesign, { isVisible: isVisible, classNames: "pt-18 px-25", options: { buttons, isCloseButton: true }, children: _jsx("div", { className: "flex flex-col gap-3", children: _jsxs("div", { className: "flex flex-col gap-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
7
  }
@@ -12,10 +12,10 @@ export const buttonClassNames = (href, nowPath, color) => {
12
12
  };
13
13
  const toggle = checkPathMatch(href, nowPath)
14
14
  ? !isDark
15
- ? `bg-${bg} text-${selectedText}`
15
+ ? `${bg} ${selectedText}`
16
16
  : "bg-white text-black"
17
17
  : (!isDark ? "bg-white " : "bg-black ") +
18
- `xl:bg-transparent xl:hover:bg-white/50 hover:text-green-dark text-${text} dark:text-white`;
18
+ `xl:bg-transparent xl:hover:bg-white/50 hover:text-green-dark ${text} dark:text-white`;
19
19
  return [cn(container), toggle].join(" ");
20
20
  };
21
21
  export function NavigationContainer({ children, }) {
@@ -8,7 +8,7 @@ export default function Manage({ titles, isVisible, event, elements, }) {
8
8
  if (type === "select")
9
9
  return (_jsx(Frame, { title: title, children: _jsx(Select, { state: state, selectOptions: selectOptions }) }, id + title));
10
10
  if (type === "toggle")
11
- return (_jsx(Frame, { title: title, children: _jsx(Toggle, { state: state, labels: labels, isDisabled: isDisabled }) }, id + title));
11
+ return (_jsx(Frame, { title: title, children: _jsx(Toggle, { state: state, labels: labels, options: { disabled: isDisabled } }) }, id + title));
12
12
  return null;
13
13
  }) }));
14
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
@@ -48,6 +48,8 @@ export default {
48
48
  colors: {
49
49
  "white-off": "#F5F5F5",
50
50
  "red-burgundy": "#933652",
51
+ "crimson-burgundy": "#910023",
52
+ "crimson-dark": "#760023",
51
53
  "red-crimson": "#760023",
52
54
  "red-velvet": "#AC647A",
53
55
  "green-dark": "#105652",
@@ -86,18 +88,25 @@ export default {
86
88
  2.5: "0.625rem",
87
89
  3.5: "0.875rem",
88
90
  3.75: "0.9375rem",
91
+ 4.25: "1.0625rem",
89
92
  4.75: "1.1875rem",
93
+ 5.25: "1.3125rem",
90
94
  6.25: "1.5625rem",
95
+ 6.4: "1.6rem",
91
96
  6.5: "1.625rem",
92
97
  7: "1.75rem",
93
98
  7.5: "1.875rem",
94
99
  8: "2rem",
95
100
  9: "2.25rem",
101
+ 9.25: "2.3125rem",
102
+ 10.25: "2.5625rem",
96
103
  11: "2.75rem",
104
+ 11.25: "2.8125rem",
97
105
  12: "3rem",
98
106
  13.25: "3.3125rem",
99
107
  13.75: "3.4375rem",
100
108
  14: "3.5rem",
109
+ 14.125: "3.53125rem",
101
110
  14.5: "3.625rem",
102
111
  15: "3.75rem",
103
112
  16: "4rem",
@@ -105,9 +114,14 @@ export default {
105
114
  18.75: "4.6875rem",
106
115
  19: "4.75rem",
107
116
  19.25: "4.8125rem",
117
+ 19.5: "4.875rem",
118
+ 20: "5rem",
119
+ 20.5: "5.125rem",
108
120
  21: "5.25rem",
121
+ 21.5: "5.375rem",
109
122
  21.75: "5.4375rem",
110
123
  22: "5.5rem",
124
+ 22.5: "5.625rem",
111
125
  23: "5.75rem",
112
126
  25: "6.25rem",
113
127
  26: "6.5rem",
@@ -121,6 +135,7 @@ export default {
121
135
  40: "10rem",
122
136
  41: "10.25rem",
123
137
  42: "10.5rem",
138
+ 43: "10.75rem",
124
139
  44: "11rem",
125
140
  45: "11.25rem",
126
141
  48: "12rem",
@@ -492,54 +507,7 @@ export default {
492
507
  },
493
508
  },
494
509
  safelist: [
495
- {
496
- pattern: /font-.*/,
497
- },
498
- {
499
- pattern: /animate-.*/,
500
- },
501
- {
502
- pattern: /shadow-.*/,
503
- },
504
-
505
- {
506
- pattern: /flex-.*/,
507
- },
508
- {
509
- pattern: /overflow-*./,
510
- },
511
- {
512
- pattern: /col-.*/,
513
- },
514
- {
515
- pattern: /row-.*/,
516
- },
517
- {
518
- pattern: /flex-.*/,
519
- },
520
- {
521
- pattern: /justify-.*/,
522
- },
523
- {
524
- pattern: /items-.*/,
525
- },
526
- {
527
- pattern: /grid-.*/,
528
- },
529
- {
530
- pattern: /gap-.*/,
531
- },
532
- {
533
- pattern: /border-.*/,
534
- },
535
- {
536
- pattern: /min-.*/,
537
- },
538
- {
539
- pattern: /max-.*/,
540
- },
541
510
  { pattern: /w-.*/ },
542
- { pattern: /h-.*/ },
543
511
  {
544
512
  pattern: /top-.*/,
545
513
  },
@@ -558,53 +526,9 @@ export default {
558
526
  {
559
527
  pattern: /right*.*/,
560
528
  },
561
- { pattern: /bg-.*/ },
562
- { pattern: /text-.*/ },
563
- {
564
- pattern: /p-.*/,
565
- },
566
- {
567
- pattern: /px-.*/,
568
- },
569
- {
570
- pattern: /pl-.*/,
571
- },
572
- {
573
- pattern: /py-.*/,
574
- },
575
- {
576
- pattern: /pb-.*/,
577
- },
578
- {
579
- pattern: /m-.*/,
580
- },
581
- {
582
- pattern: /mx-.*/,
583
- },
584
- {
585
- pattern: /my-.*/,
586
- },
587
- {
588
- pattern: /z-.*/,
589
- },
590
- {
591
- pattern: /from-.*/,
592
- },
593
- {
594
- pattern: /to-.*/,
595
- },
596
- {
597
- pattern: /via-.*/,
598
- },
599
529
  {
600
530
  pattern: /delay-.*/,
601
531
  },
602
- {
603
- pattern: /overflow-.*/,
604
- },
605
- {
606
- pattern: /duration-.*/,
607
- },
608
532
  ],
609
533
  plugins: [tailwindcssAnimate],
610
534
  darkMode: "selector",
@@ -1,3 +1,3 @@
1
- export declare function Formatter({ script }: {
1
+ export default function Formatter({ script }: {
2
2
  script: string;
3
3
  }): import("react/jsx-runtime").JSX.Element;
package/text/Formatter.js CHANGED
@@ -1,18 +1,81 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- export function Formatter({ script }) {
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Fragment, useId } from "react";
3
+ export default function Formatter({ script }) {
4
+ const parses = parseType(script);
5
+ const results = parses.map(([type, content], index) => {
6
+ if (type === "code")
7
+ return (_jsx("div", { className: "bg-gray-500 p-2", children: parseCodeLines(content) }, index));
8
+ else
9
+ return _jsx("div", { children: parseTextLines(content) }, index);
10
+ });
11
+ return _jsx("div", { className: "flex flex-col", children: results });
12
+ }
13
+ function parseType(script) {
14
+ const segments = script.split("```");
15
+ return segments.reduce((acc, segment, index) => {
16
+ if (index % 2 === 0) {
17
+ acc.push(["text", segment]);
18
+ }
19
+ else {
20
+ acc.push(["code", segment]);
21
+ }
22
+ return acc;
23
+ }, []);
24
+ }
25
+ function parseCodeLines(script) {
26
+ const lines = script.split("\n");
27
+ return lines.map((line, index) => _jsx("div", { children: line }, index));
28
+ }
29
+ function parseTextLines(script) {
3
30
  const lines = script.split("\n");
4
- const htmlRegex = /<div.*?>.*?<\/div>/gs;
5
- const result = lines.map((line, index) => {
6
- const htmlMatch = line.match(htmlRegex);
7
- if (htmlMatch)
8
- return (_jsx("div", { dangerouslySetInnerHTML: { __html: htmlMatch[0] } }, index));
9
- if (line.startsWith("# "))
31
+ return lines.map((line, index) => {
32
+ if (line === "") {
33
+ return _jsx("br", {}, index);
34
+ }
35
+ else if (line.startsWith("# ")) {
10
36
  return (_jsx("div", { className: "text-3xl", children: line.replace("# ", "") }, index));
11
- if (line.startsWith("## "))
37
+ }
38
+ else if (line.startsWith("## ")) {
12
39
  return (_jsx("div", { className: "text-2xl", children: line.replace("## ", "") }, index));
13
- if (line.startsWith("```"))
14
- return (_jsx("div", { className: "bg-gray-200 p-2", children: line.replace(/^```|```$/g, "") }, index));
15
- return _jsx("div", { children: line }, index);
40
+ }
41
+ else if (line.startsWith("### ")) {
42
+ return (_jsx("div", { className: "text-xl", children: line.replace("### ", "") }, index));
43
+ }
44
+ else {
45
+ return (_jsx("div", { children: _jsx(Parse, { script: line }) }, index));
46
+ }
47
+ });
48
+ }
49
+ function Parse({ script }) {
50
+ const id = useId();
51
+ const arrs = [[[], script]];
52
+ const arrs2 = parseStyles("**", "bold", arrs);
53
+ const arrs3 = parseStyles("*", "italic", arrs2);
54
+ const parseFontType = (types) => {
55
+ if (types.length === 0)
56
+ return "";
57
+ const classNames = types.map((type) => {
58
+ if (type === "bold")
59
+ return "font-bold";
60
+ if (type === "italic")
61
+ return "italic";
62
+ return "";
63
+ });
64
+ return classNames.join(" ");
65
+ };
66
+ return (_jsx(Fragment, { children: arrs3.map(([types, script], index) => (_jsx("span", { className: parseFontType(types), children: script }, id + index))) }, id));
67
+ }
68
+ function parseStyles(trigger, type, props) {
69
+ const result = props.flatMap(([types, script]) => {
70
+ const segments = script.split(trigger);
71
+ return segments.map((segment, index) => {
72
+ if (index % 2 !== 0) {
73
+ return [[...types, type], segment];
74
+ }
75
+ else {
76
+ return [[...types], segment];
77
+ }
78
+ });
16
79
  });
17
- return _jsx(_Fragment, { children: result });
80
+ return result;
18
81
  }
package/util/colors.d.ts CHANGED
@@ -5,8 +5,15 @@ export declare const colorsByLevel: {
5
5
  JR: string;
6
6
  HJ: string;
7
7
  };
8
- export declare const gradient: {
8
+ export declare const gradientBackground: {
9
9
  lab: string;
10
10
  greenToRed: string;
11
11
  greenToRedSoft: string;
12
12
  };
13
+ export declare const gradient: {
14
+ bg: {
15
+ lab: string;
16
+ greenToRed: string;
17
+ greenToRedSoft: string;
18
+ };
19
+ };
package/util/colors.js CHANGED
@@ -5,8 +5,11 @@ export const colorsByLevel = {
5
5
  JR: "jr-blue",
6
6
  HJ: "hj-blue",
7
7
  };
8
+ export const gradientBackground = {
9
+ lab: "bg-gradient-to-br from-violet-light/20 to-blue-sky/40 ",
10
+ greenToRed: "bg-gradient-to-r from-green-dark to-red-crimson",
11
+ greenToRedSoft: "bg-gradient-to-r from-green-dark/20 to-red-crimson/20",
12
+ };
8
13
  export const gradient = {
9
- lab: "gradient-to-br from-violet-light/20 to-blue-sky/40 ",
10
- greenToRed: "gradient-to-r from-green-dark to-red-crimson",
11
- greenToRedSoft: "gradient-to-r from-green-dark/20 to-red-crimson/20",
14
+ bg: gradientBackground,
12
15
  };
package/util/index.d.ts CHANGED
@@ -4,10 +4,7 @@ export { default as isDebug } from "./isDebug";
4
4
  export { default as sortByOrder } from "./sortByOrder";
5
5
  export { default as checkPathMatch } from "./checkPathMatch";
6
6
  export * from "./colors";
7
- export * from "./display";
8
- export * from "./displayResponsive";
9
7
  export * from "./hooks";
10
8
  export * from "./pattern";
11
- export * from "./position";
12
9
  export * from "./shape";
13
10
  export * from "./hooks";
package/util/index.js CHANGED
@@ -4,10 +4,7 @@ export { default as isDebug } from "./isDebug";
4
4
  export { default as sortByOrder } from "./sortByOrder";
5
5
  export { default as checkPathMatch } from "./checkPathMatch";
6
6
  export * from "./colors";
7
- export * from "./display";
8
- export * from "./displayResponsive";
9
7
  export * from "./hooks";
10
8
  export * from "./pattern";
11
- export * from "./position";
12
9
  export * from "./shape";
13
10
  export * from "./hooks";
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.16
1
+ 1.0.18
@@ -1,7 +0,0 @@
1
- import { DataField } from "../../interface";
2
- export default function BoardDataField<T extends Record<string, any>>({ id, dataField, }: {
3
- id: string;
4
- dataField: {
5
- [p in keyof T]?: Partial<DataField>;
6
- };
7
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +0,0 @@
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;
@@ -1,30 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId } from "react";
3
- export function Select({ title, width, onChange, selectOptions, }) {
4
- const id = useId();
5
- const widthSize = {
6
- xs: "w-32",
7
- sm: "w-48",
8
- md: "w-64",
9
- lg: "w-96",
10
- xl: "w-128",
11
- "2xl": "w-144",
12
- full: "w-full",
13
- };
14
- const classNames = `${widthSize[width ?? "md"]} h-10 rounded-full pl-4`;
15
- return (_jsxs("div", { className: "flex justify-center items-center gap-4", children: [_jsx("label", { htmlFor: id, className: "font-bold", children: title }), _jsx("select", { id: id, onChange: (e) => onChange(e.target.value), className: classNames, children: selectOptions?.map(([id, title]) => (_jsx("option", { value: id, children: title }, id))) })] }));
16
- }
17
- export function Input({ title, onChange, placeholder, width, }) {
18
- const id = useId();
19
- const widthSize = {
20
- xs: "w-28",
21
- sm: "w-48",
22
- md: "w-64",
23
- lg: "w-96",
24
- xl: "w-128",
25
- "2xl": "w-144",
26
- full: "w-full",
27
- };
28
- const classNames = `${widthSize[width ?? "md"]} h-10 rounded-full pl-4`;
29
- return (_jsxs("div", { className: "flex justify-center items-center gap-4", children: [_jsx("label", { htmlFor: id, className: "font-bold", children: title }), _jsx("input", { className: classNames, id: id, type: "text", placeholder: placeholder ?? "", onChange: (e) => onChange(e.target.value) })] }));
30
- }
@@ -1,14 +0,0 @@
1
- type Level = "PS" | "ST" | "BA" | "JR" | "HJ";
2
- export default function ProfileCard({ info, gradeData, }: {
3
- info: {
4
- name: string;
5
- birthday: string;
6
- image?: string;
7
- };
8
- gradeData?: {
9
- level?: Level;
10
- score?: number;
11
- grade?: number;
12
- };
13
- }): import("react/jsx-runtime").JSX.Element;
14
- export {};
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Card } from "../widget/Card";
3
- import { colorsByLevel } from "../../util";
4
- export default function ProfileCard({ info, gradeData, }) {
5
- const { name, birthday, image } = info;
6
- const { level, score, grade } = gradeData ?? {};
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
- }
@@ -1,33 +0,0 @@
1
- import { Titles } from "../../interface";
2
- export default function ReportCard({ titles, dataField, }: {
3
- titles: Titles;
4
- type: "text" | "table" | "chart";
5
- dataSets: {
6
- items: Record<string, string | number>[];
7
- average?: {
8
- x: string;
9
- score: number;
10
- };
11
- };
12
- dataField: {
13
- fields: Record<string, string>;
14
- axis?: {
15
- x: string;
16
- y: string;
17
- };
18
- lines?: {
19
- dataKey: string;
20
- stroke: string;
21
- }[];
22
- bars?: {
23
- name: string;
24
- dataKey: string;
25
- fill: string;
26
- }[];
27
- areas?: {
28
- dataKey: string;
29
- fill: string;
30
- }[];
31
- sizes?: Record<string, string>;
32
- };
33
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn } from "../../util";
3
- export default function ReportCard({ titles, dataField, }) {
4
- const { title, subtitle } = titles;
5
- const { axis, fields, lines, bars, areas, sizes } = dataField;
6
- const container = {
7
- displays: "flex flex-col gap-4",
8
- };
9
- const titleBox = {
10
- container: "flex flex-col gap-1",
11
- title: "text-lg font-bold",
12
- subtitle: "text-sm",
13
- };
14
- return (_jsx("div", { className: cn(container) }));
15
- }
@@ -1,2 +0,0 @@
1
- import { RowCardProps } from "../../interface";
2
- export default function RowCard<T extends Record<string, any>>({ onClick, dataSet, dataField, }: RowCardProps<T>): import("react/jsx-runtime").JSX.Element;