@edu-tosel/design 1.0.184 → 1.0.187

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 (62) hide show
  1. package/_test/asset/mock/academies.d.ts +5 -0
  2. package/_test/asset/mock/academies.js +52 -0
  3. package/_test/asset/mock/academy.d.ts +28 -0
  4. package/_test/asset/mock/academy.js +419 -0
  5. package/_test/asset/mock/chartData.d.ts +6 -0
  6. package/_test/asset/mock/chartData.js +104 -0
  7. package/_test/asset/mock/index.d.ts +3 -0
  8. package/_test/asset/mock/index.js +3 -0
  9. package/_test/interface/Exam.d.ts +56 -0
  10. package/_test/interface/Exam.js +55 -0
  11. package/_test/interface/Property.d.ts +3 -0
  12. package/_test/interface/Property.js +9 -0
  13. package/_test/interface/index.d.ts +2 -0
  14. package/_test/interface/index.js +2 -0
  15. package/asset/SVG.d.ts +2 -0
  16. package/asset/SVG.js +2 -0
  17. package/asset/SVG.tsx +2 -0
  18. package/asset/svg/HallofFame.d.ts +4 -0
  19. package/asset/svg/HallofFame.js +4 -0
  20. package/asset/svg/HallofFame.tsx +179 -0
  21. package/hook/index.d.ts +1 -0
  22. package/hook/index.js +1 -0
  23. package/hook/usePageLoaded.d.ts +4 -0
  24. package/hook/usePageLoaded.js +21 -0
  25. package/layout/template/Archive/Header.js +4 -0
  26. package/layout/template/Regexam/Banner.js +2 -2
  27. package/layout/template/Ticket/Layout.d.ts +4 -1
  28. package/layout/template/Ticket/Layout.js +4 -3
  29. package/layout/template/Ticket/Ticket.js +2 -2
  30. package/layout/template/Ticket/academy/Academy.d.ts +19 -0
  31. package/layout/template/Ticket/academy/Academy.js +144 -0
  32. package/layout/template/Ticket/academy/AcademyTicket.d.ts +21 -0
  33. package/layout/template/Ticket/academy/AcademyTicket.js +57 -0
  34. package/layout/template/Ticket/index.d.ts +5 -0
  35. package/layout/template/Ticket/index.js +4 -0
  36. package/layout/template/Transcript/design/Organism/BarCardCol.d.ts +4 -0
  37. package/layout/template/Transcript/design/Organism/BarCardCol.js +30 -0
  38. package/layout/template/Transcript/design/Organism/BarCardRow.d.ts +4 -0
  39. package/layout/template/Transcript/design/Organism/BarCardRow.js +30 -0
  40. package/layout/template/Transcript/design/Transcript.d.ts +6 -0
  41. package/layout/template/Transcript/design/Transcript.design.d.ts +7 -0
  42. package/layout/template/Transcript/design/Transcript.design.js +120 -62
  43. package/layout/template/Transcript/design/atom/CardTitle.d.ts +3 -0
  44. package/layout/template/Transcript/design/atom/CardTitle.js +11 -0
  45. package/layout/template/Transcript/design/atom/CardTitleDivided.d.ts +0 -0
  46. package/layout/template/Transcript/design/atom/CardTitleDivided.js +1 -0
  47. package/layout/template/Transcript/design/atom/IdCard.d.ts +12 -0
  48. package/layout/template/Transcript/design/atom/IdCard.js +74 -0
  49. package/layout/template/Transcript/design/atom/PrintBoxStyles.d.ts +4 -0
  50. package/layout/template/Transcript/design/atom/PrintBoxStyles.js +4 -0
  51. package/layout/template/Transcript/design/atom/ScriptStyle.d.ts +0 -0
  52. package/layout/template/Transcript/design/atom/ScriptStyle.js +1 -0
  53. package/layout/template/Transcript/design/molecule/BarGraph.d.ts +9 -0
  54. package/layout/template/Transcript/design/molecule/BarGraph.js +65 -0
  55. package/package.json +2 -1
  56. package/style/size.js +1 -1
  57. package/tailwind.config.ts +10 -1
  58. package/util/copyToClipboard.d.ts +1 -0
  59. package/util/copyToClipboard.js +16 -0
  60. package/util/index.d.ts +1 -0
  61. package/util/index.js +1 -0
  62. package/version.txt +1 -1
@@ -0,0 +1,74 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { useResponsive } from "../../../../../hook";
4
+ import { cn, copyToClipboard } from "../../../../../util";
5
+ import { LevelToStyleMap } from "../Transcript.design";
6
+ import QRCode from "react-qr-code";
7
+ export const EXAM_TYPE = {
8
+ REG: "REG",
9
+ CMP: "CMP",
10
+ IST: "IST",
11
+ OLY: "OLY",
12
+ };
13
+ function getStylefromLevel(level, field) {
14
+ return LevelToStyleMap[level]?.[field] || "Unknown";
15
+ }
16
+ const examTypeMap = {
17
+ REG: "정기시험",
18
+ IST: "기관시험",
19
+ CMP: "경시대회",
20
+ };
21
+ export function getStringfromType(ExamType) {
22
+ return examTypeMap[ExamType] || "Unknown";
23
+ }
24
+ export default function IdCard({ info }) {
25
+ const [isExpanded, setIsExpanded] = useState(false);
26
+ const togglecard = () => setIsExpanded(!isExpanded);
27
+ //반응형 info 카드 height 문제로 눌러서 자세히 보기 차후 구현 예정
28
+ const isXS = useResponsive("xs");
29
+ const cardWrapper = {
30
+ displays: "flex flex-col self-auto overflow-hidden",
31
+ sizes: "w-full rounded-lg h-fit",
32
+ backgrounds: "bg-white shadow-main",
33
+ spacings: "p-3",
34
+ printOptions: "print:bg-white print:shadow-none",
35
+ };
36
+ const imgBox = {
37
+ displays: "relative shrink-0 overflow-hidden",
38
+ sizes: "h-30 aspect-7/9 rounded-lg",
39
+ backgrounds: info.imgSrc ?? "bg-jr-blue-light",
40
+ outlines: "border-2 border-slate-200",
41
+ };
42
+ const qrBox = {
43
+ displays: "shrink-0 hidden sm:block relative overflow-hidden",
44
+ sizes: "h-30 p-2 aspect-square rounded-lg",
45
+ textStyles: "text-jr-blue",
46
+ backgrounds: "bg-white print:border-2 print:border-green-dark",
47
+ groupAction: "group duration-300 hover:scale-110",
48
+ };
49
+ const copyButtonWrapper = {
50
+ display: "absolute flex justify-center items-center",
51
+ positions: "top-0 left-0",
52
+ sizes: "h-full w-full backdrop-blur-sm",
53
+ graphics: "opacity-0 bg-white/80 ",
54
+ animations: "duration-300 group-hover:opacity-100",
55
+ };
56
+ const copyButton = {
57
+ displays: "flex justify-center items-center",
58
+ sizes: "w-20 h-8 rounded-lg",
59
+ colors: "bg-green-light border border-green-dark",
60
+ textStyles: "text-xs text-green-dark font-medium text-center",
61
+ animations: "hover:bg-green-dark hover:text-white duration-300 cursor-pointer",
62
+ };
63
+ const levelTag = {
64
+ display: "flex justify-center items-center",
65
+ textStyles: "text-center",
66
+ variableStyle: `text-center text-xs font-bold ${getStylefromLevel(info.level, "textcolor")}`,
67
+ backgrounds: getStylefromLevel(info.level, "bgcolor"),
68
+ sizes: isXS
69
+ ? "rounded-md w-fit h-fit px-2 py-1"
70
+ : "rounded-md w-full h-full",
71
+ printOptions: "print:w-fit print:h-fit print:px-2 print:py-1",
72
+ };
73
+ return (_jsxs("div", { className: "flex flex-row w-full h-fit mt-5 gap-5", children: [_jsxs("div", { className: cn(cardWrapper), children: [_jsxs("div", { className: "flex flex-row justify-between items-center pb-1 w-full h-fit border-b-2 border-green-dark", children: [_jsxs("div", { className: "flex flex-col", children: [_jsxs("div", { className: "flex flex-[3] text-sm truncate font-bold text-green-dark", children: [info.name, " ", info.nickname && _jsxs("span", { children: [" \u00A0/ ", info.nickname] })] }), _jsx("div", { className: "flex flex-[1] text-sm", children: info.birthday })] }), _jsx("div", { className: "w-fit h-full xs:block hidden", children: _jsx("div", { className: cn(levelTag), children: getStylefromLevel(info.level, "name") }) })] }), _jsx("div", {}), _jsxs("div", { className: "flex flex-col xs:flex-row w-full h-fit mt-2", children: [_jsxs("div", { className: "flex flex-[3] text-sm truncate", children: [_jsx("div", { className: "flex flex-[2] text-green-dark", children: "\uC218\uD5D8\uBC88\uD638:" }), _jsx("div", { className: "flex flex-[3]", children: info.code })] }), _jsxs("div", { className: "flex flex-[3] text-sm truncate", children: [_jsx("div", { className: "flex flex-[2] text-green-dark", children: "\uC2DC\uD5D8\uC77C:" }), _jsx("div", { className: "flex flex-[3]", children: info.examDate })] })] }), _jsxs("div", { className: "flex flex-col xs:flex-row w-full h-fit", children: [_jsxs("div", { className: "flex flex-[3] text-sm truncate", children: [_jsx("div", { className: "flex flex-[2] text-green-dark", children: "\uC720\uD6A8\uAE30\uAC04:" }), _jsx("div", { className: "flex flex-[3]", children: info.examValidAt })] }), _jsxs("div", { className: "flex flex-[3] text-sm truncate", children: [_jsx("div", { className: "flex flex-[2] text-green-dark", children: "\uC2DC\uD5D8\uD68C\uCC28:" }), _jsx("div", { className: "flex flex-[3]", children: info.examName })] })] })] }), _jsxs("div", { className: cn(qrBox), children: [info.qrSrc && _jsx(QRCode, { value: info.qrSrc, className: "w-full h-full" }), _jsx("div", { className: "absolute top-0 left-0 w-full h-full flex justify-center items-center ", children: _jsx("img", { src: "/images/img-favicon-main.png", alt: "", className: "size-8" }) }), info.qrSrc && (_jsx("div", { className: cn(copyButtonWrapper), children: _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("div", { className: "flex justify-center items-center ", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", className: "size-6 stroke-green-dark", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25" }) }) }), _jsx("div", { className: cn(copyButton), onClick: () => copyToClipboard(info.qrSrc), children: "\uACF5\uC720\uD558\uAE30" })] }) }))] }), _jsxs("div", { className: "flex flex-col shrink-0", children: [_jsxs("div", { className: cn(imgBox), children: [_jsx("img", { src: info.imgSrc, alt: "", className: "object-cover w-full h-auto" }), _jsx("div", { className: "absolute w-full h-full flex items-center justify-center", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", className: "size-6 stroke-jr-blue/50", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M17.982 18.725A7.488 7.488 0 0 0 12 15.75a7.488 7.488 0 0 0-5.982 2.975m11.963 0a9 9 0 1 0-11.963 0m11.963 0A8.966 8.966 0 0 1 12 21a8.966 8.966 0 0 1-5.982-2.275M15 9.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" }) }) })] }), !isXS && (_jsx("div", { className: "w-full h-full mt-3 flex", children: _jsx("div", { className: "w-full h-full block xs:hidden", children: _jsx("div", { className: cn(levelTag), children: getStylefromLevel(info.level, "name") }) }) }))] })] }));
74
+ }
@@ -0,0 +1,4 @@
1
+ export declare const printBoxStyles: {
2
+ shadow: string;
3
+ colors: string;
4
+ };
@@ -0,0 +1,4 @@
1
+ export const printBoxStyles = {
2
+ shadow: "print:shadow-none",
3
+ colors: "print:bg-white print:border print:border-gray-medium/70",
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,9 @@
1
+ interface SectionBarProps {
2
+ title: string;
3
+ score: number;
4
+ subScore?: number;
5
+ total: number;
6
+ scale?: number;
7
+ }
8
+ export declare function BarGraph({ score, subScore, total, title, scale, }: SectionBarProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,65 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { usePageLoaded } from "../../../../../hook";
4
+ import { cn } from "../../../../../util";
5
+ export function BarGraph({ score, subScore, total, title, scale, }) {
6
+ const isLoaded = usePageLoaded();
7
+ const [currentWidth, setCurrentWidth] = useState(0);
8
+ const widthPercentage = (score / total) * 100;
9
+ const subScorePercentage = subScore ? (subScore / total) * 100 : undefined;
10
+ useEffect(() => {
11
+ if (isLoaded) {
12
+ let width = 0;
13
+ const interval = setInterval(() => {
14
+ width += 1;
15
+ if (width >= widthPercentage) {
16
+ clearInterval(interval);
17
+ setCurrentWidth(widthPercentage);
18
+ }
19
+ else {
20
+ setCurrentWidth(width);
21
+ }
22
+ }, 10); // 속도 조정 가능
23
+ }
24
+ }, [isLoaded, widthPercentage]);
25
+ const setWrapper = {
26
+ displays: "flex flex-col sm:flex-row justify-center items-center",
27
+ sizes: "w-full h-fit",
28
+ spacings: "p-5 gap-5",
29
+ };
30
+ const bar = {
31
+ displays: "relative flex flex-row justify-start",
32
+ sizes: "w-full h-4 rounded-full",
33
+ backgroudns: "bg-gray-light print:bg-green-light",
34
+ spacings: "my-auto",
35
+ };
36
+ const barFill = {
37
+ sizes: "h-full rounded-full",
38
+ animations: "transition-all duration-500 ease-out",
39
+ backgrounds: "bg-gradient-to-r from-crimson-burgundy to-green-dark shadow-green",
40
+ printOptions: "print:shadow-none",
41
+ };
42
+ const scoreTag = {
43
+ sizes: "h-5 w-10 rounded-md",
44
+ position: "-translate-x-14 -translate-y-2",
45
+ backgrounds: "bg-white border-2 border-green-dark",
46
+ textStyles: "font-bold text-xs text-center text-green-dark",
47
+ };
48
+ const subScoreTag = {
49
+ sizes: "h-5 w-fit rounded-md flex flex-row gap-2",
50
+ position: "-translate-x-30 translate-y-6",
51
+ };
52
+ // 눈금 배열 생성
53
+ const scaleTicks = scale
54
+ ? Array.from({ length: total / scale + 1 }, (_, index) => index * scale)
55
+ : undefined;
56
+ return (_jsx("div", { className: cn(setWrapper), children: _jsxs("div", { className: "relative w-full h-20 flex flex-[1] justify-center items-center px-5 pt-8 pb-2 overflow-visible", children: [_jsxs("div", { className: cn(bar), children: [_jsx("div", { className: "absolute top-0 left-0 w-full h-full flex", children: _jsx("div", { className: cn(barFill, "duration-0 opacity-0 print:opacity-100"), style: {
57
+ width: `${widthPercentage}%`,
58
+ } }) }), _jsx("div", { className: cn(barFill, "opacity-100 print:opacity-0"), style: {
59
+ width: `${currentWidth}%`,
60
+ } }), _jsx("div", { className: "absolute w-full text-green-dark -translate-y-12 font-bold text-sm h-fit text-center", children: title })] }), _jsx("div", { className: "absolute flex w-full h-full justify-between items-center p-5 text-sm text-gray-medium -translate-y-5", children: scaleTicks && scaleTicks.map((tick) => _jsx("div", { children: tick }, tick)) }), _jsx("div", { className: "absolute flex w-full h-full justify-start items-center", style: {
61
+ transform: `translateX(${widthPercentage}%)`,
62
+ }, children: _jsx("div", { className: cn(scoreTag), children: score.toFixed(1) }) }), subScore && (_jsx("div", { className: "absolute flex w-full h-full justify-start items-center", style: {
63
+ transform: `translateX(${subScorePercentage}%)`,
64
+ }, children: _jsxs("div", { className: cn(subScoreTag), children: [_jsx("div", { className: "font-medium text-xs text-center text-gray-dark", children: "\uC804\uCCB4\uD3C9\uADE0:" }), _jsx("div", { className: "font-medium text-xs text-center text-gray-dark", children: subScore.toFixed(2) }), _jsx("div", { className: "text-green-dark", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "size-4", children: _jsx("path", { fillRule: "evenodd", d: "M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm.53 5.47a.75.75 0 0 0-1.06 0l-3 3a.75.75 0 1 0 1.06 1.06l1.72-1.72v5.69a.75.75 0 0 0 1.5 0v-5.69l1.72 1.72a.75.75 0 1 0 1.06-1.06l-3-3Z", clipRule: "evenodd" }) }) })] }) }))] }) }));
65
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.184",
3
+ "version": "1.0.187",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
@@ -28,6 +28,7 @@
28
28
  "react-dom": "^18.2.0",
29
29
  "react-icons": "^5.0.1",
30
30
  "react-lottie-player": "^1.5.6",
31
+ "react-qr-code": "^2.0.15",
31
32
  "react-router-dom": "^6.21.3",
32
33
  "react-spring": "^9.7.3",
33
34
  "react-to-print": "^2.15.1",
package/style/size.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export const paperSize = {
2
- a4: "print:w-[210mm] print:h-[297mm]",
2
+ a4: "print:w-[210mm] print:h-[297mm] print:px-[19mm] print:py-[5mm]",
3
3
  };
@@ -98,7 +98,8 @@ export default {
98
98
  "silver-pale": "#DFD8CA",
99
99
 
100
100
  // Brand Colors
101
- "cocoon-green": "#B1CE83",
101
+ "co-green": "#4FCA3E",
102
+ "co-green-light": "#DCF4D8",
102
103
  "ps-pink": "#E3006E",
103
104
  "ps-pink-light": "#FFBADB",
104
105
  "st-orange": "#ED6A00",
@@ -109,6 +110,8 @@ export default {
109
110
  "jr-blue-light": "#D6EEFF",
110
111
  "hj-blue": "#385EAB",
111
112
  "hj-blue-light": "#A8BFE5",
113
+ "ad-gray": "#4C4C4C",
114
+ "ad-gray-light": "#F0F0F0",
112
115
  // Gradation Colors
113
116
  },
114
117
  maxHeight: {
@@ -349,6 +352,12 @@ export default {
349
352
  100: "25rem",
350
353
  128: "32rem",
351
354
  },
355
+
356
+ aspectRatio: {
357
+ "3/4": "3 / 4", // 인물사진
358
+ "7/9": "7 / 9", // 증명사진
359
+ },
360
+
352
361
  borderRadius: {
353
362
  lgx: "0.625rem",
354
363
  },
@@ -0,0 +1 @@
1
+ export default function copyToClipboard(value: string | undefined): void;
@@ -0,0 +1,16 @@
1
+ export default function copyToClipboard(value) {
2
+ const textToCopy = value ?? "";
3
+ if (textToCopy) {
4
+ navigator.clipboard
5
+ .writeText(textToCopy)
6
+ .then(() => {
7
+ alert(`클립보드에 복사되었습니다.`); // 복사된 값을 alert로 출력
8
+ })
9
+ .catch((err) => {
10
+ console.error("복사에 실패했습니다:", err);
11
+ });
12
+ }
13
+ else {
14
+ alert("복사할 값이 없습니다."); // 값이 없을 경우 alert로 알림
15
+ }
16
+ }
package/util/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { default as checkPathMatch } from "./checkPathMatch";
7
7
  export { default as createSetter } from "./createSetter";
8
8
  export { default as compareDates } from "./compareDates";
9
9
  export { default as convertDateToString } from "./convertDateToString";
10
+ export { default as copyToClipboard } from "./copyToClipboard";
10
11
  export * from "../style/colors";
11
12
  export * from "./pattern";
12
13
  export * from "./shape";
package/util/index.js CHANGED
@@ -7,6 +7,7 @@ export { default as checkPathMatch } from "./checkPathMatch";
7
7
  export { default as createSetter } from "./createSetter";
8
8
  export { default as compareDates } from "./compareDates";
9
9
  export { default as convertDateToString } from "./convertDateToString";
10
+ export { default as copyToClipboard } from "./copyToClipboard";
10
11
  export * from "../style/colors";
11
12
  export * from "./pattern";
12
13
  export * from "./shape";
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.184
1
+ 1.0.187