@edu-tosel/design 1.0.269 → 1.0.271

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.
@@ -3,7 +3,7 @@ import { useState } from "react";
3
3
  import { IoIosSearch } from "react-icons/io";
4
4
  import dayjs from "dayjs";
5
5
  import { LineBreaks } from "../../../text";
6
- import { StatusText } from "./StatusText";
6
+ import { Tag } from "./molecule/Banner";
7
7
  export default function Many({ events }) {
8
8
  const [filter, setFilter] = useState("모두보기");
9
9
  const [searchQuery, setSearchQuery] = useState("");
@@ -25,5 +25,5 @@ export default function Many({ events }) {
25
25
  return false;
26
26
  })
27
27
  .filter((event) => event.title.includes(searchQuery));
28
- return (_jsx("div", { className: "min-h-screen w-full mx-auto", children: _jsx("div", { className: "mmd:max-w-300 h-full flex flex-col mx-auto px-10", children: _jsxs(_Fragment, { children: [_jsxs("div", { className: "flex flex-col sm:flex-row justify-between min-h-14.5 border-b-1", children: [_jsxs("div", { className: "w-full mb-5 h-9 sm:w-80 sm:h-9.5 flex items-center bg-[#f0f0f0]/10 rounded-xl", children: [_jsx(IoIosSearch, { className: "text-xl text-green-dark mr-3" }), _jsx("input", { type: "text", placeholder: "\uD0A4\uC6CC\uB4DC\uB97C \uC785\uB825\uD558\uC138\uC694.", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), className: "w-full h-full text-sm bg-[#f0f0f0]/10 placeholder:text-[#7f7f7f] placeholder:font-light outline-none" })] }), _jsx("div", { className: "flex h-9 pb-5 sm:pb-0 sm:h-9.5 items-center sm:justify-center ", children: ["모두보기", "진행 중", "예정된", "토셀소식"].map((item) => (_jsx("div", { className: `text-xs sm:text-2xs md:text-xs p-2 sm:p-3 flex items-center justify-center cursor-pointer rounded-lg ${filter === item ? "bg-green-dark/10 text-green-dark" : ""}`, onClick: () => setFilter(item), children: item }, item))) })] }), _jsx("div", { className: "pt-5 grid sm:grid-cols-2 mmd:grid-cols-3 gap-5 rounded-xl", children: filteredEvents.map((event) => (_jsxs("div", { onClick: event.onClick, className: "w-full max-h-84 shadow-md rounded-xl cursor-pointer box-shadow-green transition-all duration-500", children: [_jsx("div", { className: "w-full max-h-50 rounded-t-xl overflow-hidden relative", children: _jsx("img", { src: event.thumbnail, alt: "", className: "w-full" }) }), _jsxs("div", { className: "w-full min-h-34 p-8 gap-3 flex flex-col", children: [_jsx("div", { className: "flex items-center", children: _jsx(StatusText, { event: event }) }), _jsx(LineBreaks, { className: "text-sm font-bold text-gray-dark flex items-center", texts: event.title })] })] }, event.id))) })] }) }) }));
28
+ return (_jsx("div", { className: "min-h-screen w-full mx-auto", children: _jsx("div", { className: "mmd:max-w-300 h-full flex flex-col mx-auto px-10", children: _jsxs(_Fragment, { children: [_jsxs("div", { className: "flex flex-col sm:flex-row justify-between min-h-14.5 border-b-1", children: [_jsxs("div", { className: "w-full mb-5 h-9 sm:w-80 sm:h-9.5 flex items-center bg-[#f0f0f0]/10 rounded-xl", children: [_jsx(IoIosSearch, { className: "text-xl text-green-dark mr-3" }), _jsx("input", { type: "text", placeholder: "\uD0A4\uC6CC\uB4DC\uB97C \uC785\uB825\uD558\uC138\uC694.", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), className: "w-full h-full text-sm bg-[#f0f0f0]/10 placeholder:text-[#7f7f7f] placeholder:font-light outline-none" })] }), _jsx("div", { className: "flex h-9 pb-5 sm:pb-0 sm:h-9.5 items-center sm:justify-center ", children: ["모두보기", "진행 중", "예정된", "토셀소식"].map((item) => (_jsx("div", { className: `text-xs sm:text-2xs md:text-xs p-2 sm:p-3 flex items-center justify-center cursor-pointer rounded-lg ${filter === item ? "bg-green-dark/10 text-green-dark" : ""}`, onClick: () => setFilter(item), children: item }, item))) })] }), _jsx("div", { className: "pt-5 grid sm:grid-cols-2 mmd:grid-cols-3 gap-5 rounded-xl", children: filteredEvents.map((event) => (_jsxs("div", { onClick: event.onClick, className: "w-full max-h-84 shadow-md rounded-xl cursor-pointer box-shadow-green transition-all duration-500", children: [_jsx("div", { className: "w-full max-h-50 rounded-t-xl overflow-hidden relative", children: _jsx("img", { src: event.thumbnail, alt: "", className: "w-full" }) }), _jsxs("div", { className: "w-full min-h-34 p-8 gap-3 flex flex-col", children: [_jsx("div", { className: "flex items-center", children: _jsx(Tag, { event: event }) }), _jsx(LineBreaks, { className: "text-sm font-bold text-gray-dark flex items-center", texts: event.title })] })] }, event.id))) })] }) }) }));
29
29
  }
@@ -3,4 +3,7 @@ interface BannerProps {
3
3
  event: Event;
4
4
  }
5
5
  export default function BannerMolecule({ event }: BannerProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function Tag({ event }: {
7
+ event: Event;
8
+ }): import("react/jsx-runtime").JSX.Element;
6
9
  export {};
@@ -28,7 +28,7 @@ export default function BannerMolecule({ event }) {
28
28
  text: [button?.option?.text, "font-bold"].join(" "),
29
29
  } })] })] }));
30
30
  }
31
- function Tag({ event }) {
31
+ export function Tag({ event }) {
32
32
  const { tag } = convertEventElement(event);
33
33
  const container = {
34
34
  selfAligns: "self-start",
@@ -16,14 +16,18 @@ export default function MyPageLayout({ header, profile, navigations, children, o
16
16
  return clearView();
17
17
  }, [flag]);
18
18
  const container = {
19
- sizes: "min-h-screen h-screen xl:h-auto",
19
+ sizes: "h-screen",
20
20
  background: `${background ?? "bg-white"}`,
21
21
  styles: "font-pretendard-medium",
22
22
  };
23
+ const spacer = {
24
+ displays: "flex shrink-0",
25
+ sizes: "w-full h-15 xl:h-22.5",
26
+ };
23
27
  const body = {
24
- displays: "flex gap-12 xl:gap-7.5 ",
25
- sizes: "h-full ",
26
- paddings: "pt-15 xl:pl-2 2xl:px-12 xl:pt-7.5",
28
+ sizes: "h-[calc(100%-60px)] xl:h-[calc(100%-90px)]",
29
+ displays: "flex gap-0 xl:gap-7.5 relative",
30
+ paddings: "xl:px-5 2xl:pl-12 2xl:pr-11.25",
27
31
  };
28
- return (_jsxs("div", { className: cn(container), onClick: setFlag, children: [_jsx(Header, { ...header }), _jsxs("div", { className: cn(body), children: [_jsxs(Navigation.Container, { children: [_jsx(Profile.Preview, { username: profile.username, email: profile.email, image: profile.image }), navigations.map((nav, index) => (_jsx(Fragment, { children: nav }, index)))] }), children] })] }));
32
+ return (_jsxs("div", { className: cn(container), onClick: setFlag, children: [_jsx(Header, { ...header }), _jsx("div", { className: cn(spacer) }), _jsxs("div", { className: cn(body), children: [_jsxs(Navigation.Container, { children: [_jsx(Profile.Preview, { username: profile.username, email: profile.email, image: profile.image }), navigations.map((nav, index) => (_jsx(Fragment, { children: nav }, index)))] }), children] })] }));
29
33
  }
@@ -0,0 +1,10 @@
1
+ import { OnClick } from "../../../interface";
2
+ interface Content {
3
+ image: string;
4
+ onClick: OnClick;
5
+ background?: string;
6
+ }
7
+ export default function Float({ contents }: {
8
+ contents: Content[];
9
+ }): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../../util";
3
+ export default function Float({ contents }) {
4
+ const container = {
5
+ displays: "fixed bottom-12 right-12 z-40",
6
+ };
7
+ const buttonBox = (background) => ({
8
+ displays: "flex justify-center items-center",
9
+ sizes: "w-24 h-24",
10
+ styles: "rounded-full bg-black overflow-hidden",
11
+ backgrounds: background ?? "bg-white",
12
+ shadows: "box-shadow",
13
+ });
14
+ return (_jsx("div", { className: cn(container), children: contents.map(({ image, onClick, background }) => (_jsx("button", { onClick: onClick, className: cn(buttonBox(background)), children: _jsx("img", { src: image, alt: "image", className: "object-contain" }) }, image))) }));
15
+ }
@@ -63,9 +63,8 @@ export default function NewsPaper({ banners, browse, option, }) {
63
63
  return (_jsxs("div", { className: cn(container), children: [_jsx("div", { className: cn(deckTitlePositioning), children: _jsxs("div", { className: cn(deckTitle), children: [_jsx("div", { children: "\uC0C8\uB85C\uC6B4 \uC18C\uC2DD" }), _jsx(Label.Button, { title: "\uB354 \uBCF4\uAE30", onClick: browse, option: {
64
64
  width: "xs",
65
65
  height: "xs",
66
- text: "text-white hover:text-green-dark",
67
- background: "bg-green-dark hover:bg-white",
68
- boundary: "border-2 hover:border-white border-green-dark",
66
+ text: "text-white hover:text-green-dark font-bold",
67
+ background: "bg-green-dark hover:bg-green-light",
69
68
  } })] }) }), _jsx("div", { className: cn(cardPositioning), children: _jsx("div", { className: cn(cardWrapper), ref: scrollContainerRef, children: _jsx("div", { className: cn(cardDeck), children: banners.map((banner) => (_jsx(Banner, { ...banner }, banner.image.src))) }) }) }), _jsxs("div", { className: cn(buttonPositioning), children: [_jsx("div", { className: cn(hoverButton), onClick: () => handleScroll("left"), children: _jsx("img", { src: "images/home/handle-left.svg", alt: "" }) }), _jsx("div", { className: cn(hoverButton), onClick: () => handleScroll("right"), children: _jsx("img", { src: "images/home/handle-right.svg", alt: "" }) })] })] }));
70
69
  }
71
70
  function Banner({ onClick, image, option }) {
@@ -3,7 +3,7 @@ import { cn } from "../../../util";
3
3
  export default function ShortcutBanner({ shortcuts, }) {
4
4
  const container = {
5
5
  displays: "flex justify-center items-center",
6
- spacings: "px-5 pt-16 pb-24"
6
+ spacings: "px-5 pt-16 pb-24",
7
7
  };
8
8
  const buttonWrapper = {
9
9
  displays: "flex justify-center items-center flex-wrap",
@@ -13,20 +13,20 @@ export default function ShortcutBanner({ shortcuts, }) {
13
13
  };
14
14
  const buttonSet = {
15
15
  displays: "group flex flex-col justify-center items-center",
16
- sizes: "w-16 hover:scale-110",
17
- animation: "duration-300",
18
- spacings: "gap-2"
16
+ sizes: "w-16",
17
+ spacings: "gap-2",
19
18
  };
20
19
  const tagBox = {
21
20
  displays: "flex justify-center items-center",
22
21
  sizes: "w-full h-6.25 ",
23
- fonts: "text-xs font-pretendard-var font-medium text-gray-medium group-hover:text-green-dark",
24
- styles: "bg-gray-light/40 group-hover:bg-green-light rounded-md",
25
- sapcings: "",
22
+ fonts: "text-xs font-pretendard-var font-medium text-gray-dark group-hover:text-green-dark",
23
+ animation: "duration-100",
26
24
  };
27
25
  const iconContainer = {
28
- sizes: "w-16 h-16 rounded-lg",
29
- background: "group-hover:bg-gray-light/40"
26
+ sizes: "w-16 h-16 rounded-lg overflow-hidden",
27
+ shadows: "shadow-icon-default",
28
+ animation: "duration-100",
29
+ hoveraction: "group-hover:shadow-icon-hover group-hover:scale-105",
30
30
  };
31
31
  return (_jsx("div", { className: cn(container), children: _jsx("div", { className: cn(buttonWrapper), children: shortcuts.map((shortcut) => (_jsxs("button", { onClick: shortcut.onClick, className: cn(buttonSet), children: [_jsx("div", { className: cn(iconContainer), children: _jsx("img", { src: shortcut.icon, alt: shortcut.title }) }), _jsx("div", { className: cn(tagBox), children: shortcut.title })] }, shortcut.title))) }) }));
32
32
  }
@@ -5,6 +5,7 @@ import Announcement from "./Announcement";
5
5
  import NewsPaper from "./NewsPaper";
6
6
  import Service from "./Service";
7
7
  import Shortcut from "./Shortcut";
8
+ import Float from "./Float";
8
9
  declare const Home: {
9
10
  Layout: typeof Layout;
10
11
  Navigation: typeof Navigation;
@@ -13,5 +14,6 @@ declare const Home: {
13
14
  Shortcut: typeof Shortcut;
14
15
  Service: typeof Service;
15
16
  NewsPaper: typeof NewsPaper;
17
+ Float: typeof Float;
16
18
  };
17
19
  export default Home;
@@ -5,6 +5,7 @@ import Announcement from "./Announcement";
5
5
  import NewsPaper from "./NewsPaper";
6
6
  import Service from "./Service";
7
7
  import Shortcut from "./Shortcut";
8
+ import Float from "./Float";
8
9
  const Home = {
9
10
  Layout,
10
11
  Navigation,
@@ -13,5 +14,6 @@ const Home = {
13
14
  Shortcut,
14
15
  Service,
15
16
  NewsPaper,
17
+ Float,
16
18
  };
17
19
  export default Home;
@@ -57,6 +57,37 @@ export default function Navigation({ browser, calendar, notice, event, }) {
57
57
  setIsHidden(true);
58
58
  return setIsOpen(true);
59
59
  };
60
+ //tooltip
61
+ const [position, setPosition] = useState({ x: 0, y: 0 });
62
+ const [tooltipText, setTooltipText] = useState(null);
63
+ const handleMouseMove = (event) => {
64
+ const viewportScale = window.visualViewport?.scale || 1; // 뷰포트 확대 비율
65
+ // 마우스 좌표를 확대 비율을 고려하여 보정
66
+ const correctedX = event.clientX / viewportScale + 20; // 커서 기준 10px 우측
67
+ const correctedY = (event.clientY - 230) / viewportScale + 10; // 커서 기준 10px 아래
68
+ // 툴팁이 화면을 벗어나지 않도록 조정
69
+ const tooltipWidth = 120; // 예상 툴팁 너비
70
+ const tooltipHeight = 40; // 예상 툴팁 높이
71
+ const viewportWidth = window.innerWidth;
72
+ const viewportHeight = window.innerHeight;
73
+ let adjustedX = correctedX;
74
+ let adjustedY = correctedY;
75
+ if (adjustedX + tooltipWidth > viewportWidth) {
76
+ adjustedX = viewportWidth - tooltipWidth - 10; // 오른쪽 경계 제한
77
+ }
78
+ if (adjustedY + tooltipHeight > viewportHeight) {
79
+ adjustedY = viewportHeight - tooltipHeight - 10; // 하단 경계 제한
80
+ }
81
+ setPosition({ x: adjustedX, y: adjustedY });
82
+ };
83
+ const handleMouseEnter = (event) => {
84
+ const text = event.currentTarget.getAttribute("data-tooltip");
85
+ if (text)
86
+ setTooltipText(text);
87
+ };
88
+ const handleMouseLeave = () => {
89
+ setTooltipText(null);
90
+ };
60
91
  const blurContainer = {
61
92
  positions: "fixed inset-0 z-40",
62
93
  sizes: "h-screen w-full",
@@ -75,7 +106,7 @@ export default function Navigation({ browser, calendar, notice, event, }) {
75
106
  boundaries: "rounded-t-lg rounded-b-none md:rounded-r-lg md:rounded-l-none",
76
107
  };
77
108
  const iconWrapper = {
78
- displays: "flex justify-center items-center",
109
+ displays: "relative flex justify-center items-center",
79
110
  sizes: "w-8 h-8 rounded-md",
80
111
  animations: "hover:bg-white/20",
81
112
  };
@@ -99,7 +130,11 @@ export default function Navigation({ browser, calendar, notice, event, }) {
99
130
  textStyles: "text-lg font-bold text-green-dark",
100
131
  };
101
132
  return (_jsxs(_Fragment, { children: [overlayCoverTransition((styles, item) => item && (_jsx(animated.div, { style: styles, className: "bg-white h-screen fixed top-0 left-0 z-40 flex flex-col justify-center items-center overflow-hidden gap-y-14 ", children: _jsxs("div", { className: "flex flex-col justify-center items-center overflow-hidden gap-y-14 transition-none", children: [_jsx("img", { src: "/images/logos/tosel.png", alt: "tosel", width: 368.56, height: 80.07 }), _jsxs("div", { role: "status", children: [_jsxs("svg", { "aria-hidden": "true", className: "w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-green-dark", 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" })] }), _jsx("span", { className: "sr-only", children: "Loading..." })] }), _jsx("div", { children: "dashboard loading..." })] }) }))), overlayPopTransition((styles, item) => type &&
102
- item && (_jsx(animated.div, { style: styles, className: cn(blurContainer), children: _jsxs("div", { className: cn(itemBody), onClick: (e) => e.stopPropagation(), children: [_jsxs("div", { className: cn(scrollTitleWrapper), children: [_jsx("div", { className: cn(scrollTitle), children: navigationTypeString[type] }), _jsx("div", { className: "" })] }), _jsx("div", { className: cn(itemsContainer), children: _jsx(NavigationItem, { type: type, calendar: calendar, notice: notice, event: event }) })] }) }))), _jsx("div", { className: "fixed bottom-0 md:top-1/2 md:-translate-y-1/2 flex justify-center items-center z-45", children: _jsxs("div", { onClick: (e) => e.stopPropagation(), className: cn(container), children: [_jsx("div", { className: cn(iconWrapper), onClick: () => handleOpen("calendar"), children: _jsx(SVG.Icon.Calendar, { size: isMobile ? "md" : "lg" }) }), _jsx("div", { className: cn(iconWrapper), onClick: () => handleOpen("notification"), children: _jsx(SVG.Icon.Notification, { size: isMobile ? "md" : "lg" }) }), _jsx("div", { className: cn(iconWrapper), onClick: () => handleOpen("search"), children: _jsx(SVG.Icon.Search, { size: isMobile ? "md" : "lg" }) }), _jsx("div", { className: cn(iconWrapper), onClick: () => handleOpen("browser"), children: _jsx(SVG.Icon.Browser, { size: isMobile ? "md" : "lg" }) }), _jsx("div", { className: cn(iconWrapper), onClick: () => handleOpen("event"), children: _jsx(SVG.Icon.Newspaper, { size: isMobile ? "md" : "lg" }) })] }) })] }));
133
+ item && (_jsx(animated.div, { style: styles, className: cn(blurContainer), children: _jsxs("div", { className: cn(itemBody), onClick: (e) => e.stopPropagation(), children: [_jsxs("div", { className: cn(scrollTitleWrapper), children: [_jsx("div", { className: cn(scrollTitle), children: navigationTypeString[type] }), _jsx("div", { className: "" })] }), _jsx("div", { className: cn(itemsContainer), children: _jsx(NavigationItem, { type: type, calendar: calendar, notice: notice, event: event }) })] }) }))), _jsx("div", { className: "fixed bottom-0 md:top-1/2 md:-translate-y-1/2 flex justify-center items-center z-45", children: _jsxs("div", { onClick: (e) => e.stopPropagation(), className: cn(container), children: [_jsx("button", { className: cn(iconWrapper), onClick: () => handleOpen("calendar"), "data-tooltip": "\uC2DC\uD5D8\uC77C\uC815", onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onMouseMove: handleMouseMove, children: _jsx(SVG.Icon.Calendar, { size: isMobile ? "md" : "lg" }) }), _jsx("button", { className: cn(iconWrapper), onClick: () => handleOpen("notification"), "data-tooltip": "\uACF5\uC9C0\uC0AC\uD56D", onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onMouseMove: handleMouseMove, children: _jsx(SVG.Icon.Notification, { size: isMobile ? "md" : "lg" }) }), _jsx("button", { className: cn(iconWrapper), onClick: () => handleOpen("search"), "data-tooltip": "\uAC80\uC0C9\uD558\uAE30", onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onMouseMove: handleMouseMove, children: _jsx(SVG.Icon.Search, { size: isMobile ? "md" : "lg" }) }), _jsx("button", { className: cn(iconWrapper), onClick: () => handleOpen("browser"), "data-tooltip": "\uB300\uC2DC\uBCF4\uB4DC", onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onMouseMove: handleMouseMove, children: _jsx(SVG.Icon.Browser, { size: isMobile ? "md" : "lg" }) }), _jsx("button", { className: cn(iconWrapper), onClick: () => handleOpen("event"), "data-tooltip": "\uC0C8\uC18C\uC2DD", onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onMouseMove: handleMouseMove, children: _jsx(SVG.Icon.Newspaper, { size: isMobile ? "md" : "lg" }) }), tooltipText && (_jsx("div", { className: "absolute bg-gray-900 text-white text-sm px-3 py-1 rounded-lg transition-opacity duration-200 w-20 text-center", style: {
134
+ left: `${position.x}px`,
135
+ top: `${position.y}px`,
136
+ pointerEvents: "none",
137
+ }, children: tooltipText }))] }) })] }));
103
138
  }
104
139
  const navigationTypeString = {
105
140
  calendar: "시험 접수 일정",
@@ -0,0 +1,4 @@
1
+ import { ReactNode } from "react";
2
+ export default function Pop({ children }: {
3
+ children: ReactNode;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../util";
3
+ import { useActionStore } from "../../store";
4
+ export default function Pop({ children }) {
5
+ const { events, clearModal } = useActionStore();
6
+ const isOpen = events.find((event) => event.type === "modal");
7
+ const container = {
8
+ positions: "fixed inset-0 z-100",
9
+ displays: "flex flex-col justify-center items-center",
10
+ backgrounds: "bg-black/20 backdrop-blur-sm duration-300",
11
+ animation: isOpen
12
+ ? "opacity-100 pointer-events-auto"
13
+ : "opacity-0 pointer-events-none",
14
+ };
15
+ const wrapper = {
16
+ displays: "flex flex-col justify-end items-center",
17
+ sizes: "w-full h-full",
18
+ //debug: "border-2 border-red-500",
19
+ };
20
+ const body = {
21
+ displays: "flex flex-col rounded-tl-lg rounded-tr-lg bg-white",
22
+ sizes: "w-full h-fit max-w-120",
23
+ spacings: "p-5 gap-5",
24
+ position: isOpen ? "translate-y-0" : "translate-y-full",
25
+ animation: "duration-300",
26
+ pointer: "pointer-events-auto",
27
+ };
28
+ return (_jsx("div", { className: cn(container), onClick: () => clearModal(), children: _jsx("div", { className: cn(wrapper), children: _jsx("div", { className: cn(body), children: children }) }) }));
29
+ }
@@ -1,7 +1,13 @@
1
- import Alert from "./Alert";
2
- import Input from "./Input";
3
- declare const Modal: {
4
- Alert: typeof Alert;
5
- Input: typeof Input;
6
- };
1
+ import _Input from "./Input";
2
+ import { ConfirmModalWidget, ModalProps } from "../../interface/Modal";
3
+ import { Button } from "../../interface";
4
+ interface ModalExtends<T = any> extends Omit<ModalProps, "children"> {
5
+ buttons?: [Button] | [Button, Button];
6
+ widgets?: ConfirmModalWidget<T>[];
7
+ }
8
+ declare function Modal({ titles, showAction, buttons, widgets, option }: ModalExtends): import("react/jsx-runtime").JSX.Element;
9
+ declare namespace Modal {
10
+ var Alert: typeof import("./Alert").default;
11
+ var Input: typeof _Input;
12
+ }
7
13
  export default Modal;
@@ -1,7 +1,63 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createElement as _createElement } from "react";
1
3
  import Alert from "./Alert";
2
- import Input from "./Input";
3
- const Modal = {
4
- Alert,
5
- Input,
6
- };
4
+ import _Input from "./Input";
5
+ import { Input, Label, Select } from "../../widget";
6
+ import { cn } from "../../util";
7
+ import ModalDesign from "../design/Modal.design";
8
+ import { useResponsive } from "../../hook";
9
+ import ModalPop from "../organism/Pop";
10
+ function Modal({ titles, showAction, buttons, widgets, option }) {
11
+ const isMd = useResponsive("md");
12
+ const { className } = option ?? {};
13
+ const container = {
14
+ displays: "flex flex-col h-full",
15
+ };
16
+ const buttonBox = {
17
+ displays: "flex gap-3",
18
+ };
19
+ const widgetBox = {
20
+ displays: "flex flex-col",
21
+ sizes: "w-full min-h-64 ",
22
+ styles: className ?? "mt-2.5",
23
+ };
24
+ if (!isMd)
25
+ return (_jsx(ModalPop, { children: _jsxs("div", { className: cn(container), children: [_jsx("div", { className: cn(widgetBox), children: widgets?.map((widget, index) => (_createElement(ModalWidget, { ...widget, key: index }))) }), buttons && (_jsx("div", { className: cn(buttonBox), children: buttons.map(({ title, onClick, option, disabled }) => (_jsx(Label.Button, { title: title, onClick: onClick, disabled: disabled, option: {
26
+ ...option,
27
+ width: "full",
28
+ height: "lg",
29
+ } }, title))) }))] }) }));
30
+ return (_jsx(ModalDesign, { titles: titles, showAction: showAction, option: option, children: _jsxs("div", { className: cn(container), children: [_jsx("div", { className: cn(widgetBox), children: widgets?.map((widget, index) => (_createElement(ModalWidget, { ...widget, key: index }))) }), buttons && (_jsx("div", { className: cn(buttonBox), children: buttons.map(({ title, onClick, option, disabled }) => (_jsx(Label.Button, { title: title, onClick: onClick, disabled: disabled, option: {
31
+ ...option,
32
+ width: option?.width ?? "lg",
33
+ height: "lg",
34
+ } }, title))) }))] }) }));
35
+ }
36
+ function ModalWidget({ type, data }) {
37
+ const arrange = "w-full justify-center flex";
38
+ if (type === "selectSwitch")
39
+ return (_jsx(Select.Switch, { ...data, option: {
40
+ ...data.option,
41
+ className: arrange,
42
+ } }));
43
+ if (type === "selectHandle")
44
+ return (_jsx(Select.Handle, { ...data, option: {
45
+ ...data.option,
46
+ className: arrange,
47
+ } }));
48
+ if (type === "selectPagination")
49
+ return (_jsx(Select.Pagination, { ...data, option: {
50
+ ...data.option,
51
+ className: "flex w-full justify-end",
52
+ } }));
53
+ if (type === "selectTag")
54
+ return _jsx(Select.Tag, { ...data });
55
+ if (type === "inputForm")
56
+ return _jsx(Input.Form, { ...data });
57
+ if (typeof type === "undefined")
58
+ return data;
59
+ return null;
60
+ }
61
+ Modal.Alert = Alert;
62
+ Modal.Input = _Input;
7
63
  export default Modal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.269",
3
+ "version": "1.0.271",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
@@ -34,6 +34,8 @@ export default {
34
34
  main: "0 2px 10px 0px rgba(0, 0, 0, 0.14)",
35
35
  "main-small": "0 0px 5px 0px rgba(0, 0, 0, 0.1)",
36
36
  "main-hover": "0 10px 12px 0px rgba(0, 0, 0, 0.3)",
37
+ "icon-default": "0 3px 7px 0px rgba(0, 0, 0, 0.1)",
38
+ "icon-hover": "0 3px 10px 0px rgba(6, 86, 82, 0.38)",
37
39
  green: "0 0px 10px 0px rgba(16, 86, 82, 0.38)",
38
40
  },
39
41
  flex: {
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.269
1
+ 1.0.271
@@ -18,6 +18,7 @@ const heightSize = {
18
18
  xs: "h-7.5",
19
19
  sm: "h-11.25",
20
20
  md: "h-12.25",
21
+ lg: "h-[45px]",
21
22
  };
22
23
  export default function LabelDesign({ title, onClick, disabled, option, hoverState, }) {
23
24
  const [hover, setHover] = hoverState ?? [false, () => { }];
@@ -35,7 +36,7 @@ export default function LabelDesign({ title, onClick, disabled, option, hoverSta
35
36
  clickable: onClick && "cursor-pointer",
36
37
  texts: text ?? "text-gray-dim",
37
38
  animation: "duration-500",
38
- fonts: "font-pretendard-light",
39
+ fonts: "font-pretendard-var font-medium",
39
40
  boundary,
40
41
  styles: height === "xs" ||
41
42
  height === "2xs" ||