@edu-tosel/design 1.0.12 → 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,14 +1,19 @@
1
1
  import { Button, Scripts, Size } from "./Property";
2
2
  export interface ModalProps {
3
+ isVisible?: boolean;
3
4
  children: React.ReactNode;
5
+ classNames?: string;
4
6
  options?: {
5
7
  width?: Size;
6
8
  height?: Size;
7
9
  padding?: boolean;
8
10
  buttons?: Button[];
11
+ isCloseButton?: boolean;
12
+ closeButtonColor?: string;
9
13
  };
14
+ debug?: string;
10
15
  }
11
- export interface AlertModalProps {
16
+ export interface AlertModalProps extends Omit<ModalProps, "children"> {
12
17
  title: string;
13
18
  scripts: Scripts;
14
19
  options?: {
@@ -0,0 +1,3 @@
1
+ export interface OverlayProps {
2
+ isVisible?: boolean;
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -42,11 +42,20 @@ export type Scripts = {
42
42
  export type Titles = {
43
43
  title: string;
44
44
  subtitle?: string | string[];
45
+ isSub?: boolean;
45
46
  color?: string;
46
47
  };
48
+ export type DataField = {
49
+ title: string | number;
50
+ size?: string | number;
51
+ };
47
52
  export interface Log<K extends string, T extends string | number> {
48
53
  prints: K[];
49
54
  logs: {
50
55
  [p in K]: T;
51
56
  }[] | undefined;
52
57
  }
58
+ export interface Order {
59
+ orderBy: string;
60
+ orderHow: "asc" | "desc" | "";
61
+ }
@@ -0,0 +1,22 @@
1
+ import { Button, Titles } from "./Property";
2
+ import { EventsProps } from "./Widget";
3
+ interface Options<T> {
4
+ titleSize?: string;
5
+ subtitleSize?: string;
6
+ overflowScroll?: boolean;
7
+ width?: T;
8
+ height?: number;
9
+ gapX?: number;
10
+ gapY?: number;
11
+ }
12
+ export interface ShelfProps<T> {
13
+ children: React.ReactNode;
14
+ widgets?: EventsProps & {
15
+ tabs?: Button[];
16
+ };
17
+ titles?: Titles;
18
+ debug?: string;
19
+ classNames?: string;
20
+ options?: Options<T>;
21
+ }
22
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -2,3 +2,22 @@ export interface WidgetEvent {
2
2
  event: string;
3
3
  type: "view" | "modal";
4
4
  }
5
+ type Event<T extends boolean | string | null | undefined> = [
6
+ T,
7
+ React.ReactNode
8
+ ];
9
+ export type Show = Event<boolean | string>;
10
+ export type Replace = Event<boolean | string | null | undefined>;
11
+ export interface ShowProps {
12
+ widgets?: Show[];
13
+ children: React.ReactNode;
14
+ }
15
+ export interface ReplaceProps {
16
+ widgets?: Replace[];
17
+ children: React.ReactNode;
18
+ }
19
+ export interface EventsProps {
20
+ replaces?: Event<boolean | string | null | undefined>[];
21
+ shows?: Event<boolean | string>[];
22
+ }
23
+ export {};
@@ -1,3 +1,5 @@
1
+ export * from "./Card";
1
2
  export * from "./HTMLElement";
2
3
  export * from "./Property";
4
+ export * from "./Shelf";
3
5
  export * from "./Widget";
@@ -1,3 +1,5 @@
1
+ export * from "./Card";
1
2
  export * from "./HTMLElement";
2
3
  export * from "./Property";
4
+ export * from "./Shelf";
3
5
  export * from "./Widget";
package/layout/index.d.ts CHANGED
@@ -1 +1,4 @@
1
- export * from "./dashboard";
1
+ export { default as Events } from "./widget/Events";
2
+ export { default as Dashboard } from "./template/dashboard";
3
+ export { default as Gallery } from "./template/Gallery";
4
+ export { default as Shelf } from "./template/Shelf";
package/layout/index.js CHANGED
@@ -1 +1,4 @@
1
- export * from "./dashboard";
1
+ export { default as Events } from "./widget/Events";
2
+ export { default as Dashboard } from "./template/dashboard";
3
+ export { default as Gallery } from "./template/Gallery";
4
+ export { default as Shelf } from "./template/Shelf";
@@ -0,0 +1,7 @@
1
+ import { Button, EventsProps } from "../../interface";
2
+ export default function Gallery({ widgets, children, }: {
3
+ widgets?: EventsProps & {
4
+ tabs?: Button[];
5
+ };
6
+ children: React.ReactNode;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Events from "../widget/Events";
3
+ import Tab from "../widget/Tab";
4
+ export default function Gallery({ widgets, children, }) {
5
+ return (_jsxs("div", { className: "relative w-full flex", children: [_jsx(Events.Replace, { widgets: widgets?.replaces, children: _jsx(Events.Show, { widgets: widgets?.shows, children: children }) }), widgets?.tabs && _jsx(Tab, { tabs: widgets?.tabs })] }));
6
+ }
@@ -0,0 +1,8 @@
1
+ import { ShelfProps } from "../../interface/Shelf";
2
+ declare function Shelf({ titles, debug, children }: ShelfProps<string | number>): import("react/jsx-runtime").JSX.Element;
3
+ declare namespace Shelf {
4
+ var Wrap: ({ classNames, titles, children, debug, }: ShelfProps<string | number>) => import("react/jsx-runtime").JSX.Element;
5
+ var Row: ({ titles, children, debug }: ShelfProps<string | number>) => import("react/jsx-runtime").JSX.Element;
6
+ var Col: ({ titles, children, debug }: ShelfProps<string | number>) => import("react/jsx-runtime").JSX.Element;
7
+ }
8
+ export default Shelf;
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../util";
3
+ import ShelfDesign from "../widget/Shelf";
4
+ function Shelf({ titles, debug, children }) {
5
+ const container = {
6
+ displays: "inline-flex flex-col gap-8 w-full",
7
+ };
8
+ return (_jsx(ShelfDesign, { titles: titles, classNames: cn(container), debug: debug, children: children }));
9
+ }
10
+ function Wrap({ classNames, titles, children, debug, }) {
11
+ const container = {
12
+ displays: "flex flex-row flex-wrap gap-x-4",
13
+ classNames,
14
+ };
15
+ return (_jsx(ShelfDesign, { titles: titles, classNames: cn(container), options: {
16
+ titleSize: "text-lg xl:text-2xl",
17
+ subtitleSize: "text-sm",
18
+ }, debug: debug, children: children }));
19
+ }
20
+ function Row({ titles, children, debug }) {
21
+ const container = {
22
+ displays: "flex flex-row gap-y-5",
23
+ };
24
+ return (_jsx(ShelfDesign, { titles: titles, classNames: cn(container), options: {
25
+ titleSize: "text-lg xl:text-2xl",
26
+ subtitleSize: "text-sm",
27
+ }, debug: debug, children: children }));
28
+ }
29
+ function Col({ titles, children, debug }) {
30
+ const container = {
31
+ displays: "flex flex-col flex-wrap gap-y-5",
32
+ };
33
+ return (_jsx(ShelfDesign, { titles: titles, classNames: cn(container), options: {
34
+ titleSize: "text-lg xl:text-2xl",
35
+ subtitleSize: "text-sm",
36
+ }, debug: debug, children: children }));
37
+ }
38
+ Shelf.Wrap = Wrap;
39
+ Shelf.Row = Row;
40
+ Shelf.Col = Col;
41
+ export default Shelf;
@@ -1,4 +1,3 @@
1
- import "../../globals.css";
2
1
  export declare function Header({ title, image, }: {
3
2
  title: string;
4
3
  image?: [string, string];
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { cn, gradient } from "../../../util";
4
+ import { useWidgetStore } from "../../../store";
5
+ export function Header({ title, image, }) {
6
+ const { isDark, setDark } = useWidgetStore();
7
+ const [isOpen, setIsOpen] = useState(false);
8
+ const [src, href] = image ?? [];
9
+ const container = {
10
+ positions: "fixed xl:static top-0 left-0 z-40",
11
+ displays: "flex items-center justify-between ",
12
+ sizes: "h-15 w-full",
13
+ background: !isDark ? `bg-${gradient.greenToRed}` : "bg-black",
14
+ styles: "px-5 xl:px-8 2xl:px-16 ",
15
+ };
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" })] }));
17
+ }
@@ -1,6 +1,10 @@
1
- export declare function DashboardLayout({ subject, colors, navigations, children, }: {
1
+ declare function Layout({ subject, colors, navigations, children, }: {
2
2
  subject: [string, string, string];
3
3
  colors?: [string, string];
4
4
  navigations: React.ReactNode[];
5
5
  children: React.ReactNode;
6
6
  }): import("react/jsx-runtime").JSX.Element;
7
+ declare const Dashboard: {
8
+ Layout: typeof Layout;
9
+ };
10
+ export default Dashboard;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment } from "react";
3
+ import { NavigationContainer } from "../../../navigation";
4
+ import { Header } from "./Header";
5
+ import { cn } from "../../../util";
6
+ import { useWidgetStore } from "../../../store";
7
+ function Layout({ subject, colors, navigations, children, }) {
8
+ const { isDark, setFlag } = useWidgetStore();
9
+ const [title, image, imageUrl] = subject ?? ["", "", ""];
10
+ const [bgColor, textColor] = colors ?? ["white", "black"];
11
+ const container = {
12
+ sizes: "min-h-screen h-screen xl:h-auto",
13
+ background: !isDark ? `bg-${bgColor}` : "bg-black/80",
14
+ styles: `text-${textColor} font-pretendard-medium`,
15
+ dark: isDark && "dark",
16
+ };
17
+ const body = {
18
+ sizes: "h-full ",
19
+ displays: "flex gap-12 xl:gap-8 ",
20
+ paddings: "pt-15 xl:pl-2 2xl:px-9 xl:pt-10",
21
+ };
22
+ 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] })] }));
23
+ }
24
+ const Dashboard = {
25
+ Layout,
26
+ };
27
+ export default Dashboard;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../../util";
3
+ export default function Header({ groupName, examName, }) {
4
+ const container = {
5
+ positions: "relative z-20",
6
+ displays: "flex flex-col items-center ",
7
+ sizes: "w-full max-w-280",
8
+ styles: "py-8 bg-white shadow-md",
9
+ };
10
+ return (_jsxs("div", { className: cn(container), children: [_jsxs("div", { className: "flex justify-between w-full items-center px-2", children: [_jsx("img", { src: "/images/logos/itc.png", alt: "itc", width: 80 }), _jsx("div", { className: "flex items-center", children: _jsx("div", { className: "text-5xl font-bold", children: examName }) }), _jsx("img", { src: "/images/logos/badge-tosel-lab.png", alt: "tosel-lab", width: 80 })] }), _jsxs("div", { className: "", children: ["\uC9C0\uC815\uAD50\uC721\uAE30\uAD00: ", groupName] })] }));
11
+ }
@@ -0,0 +1,8 @@
1
+ import { ReplaceProps, ShowProps } from "./../../interface/Widget";
2
+ declare function Show({ widgets, children }: ShowProps): import("react/jsx-runtime").JSX.Element;
3
+ declare function Replace({ widgets, children }: ReplaceProps): import("react/jsx-runtime").JSX.Element;
4
+ declare const Events: {
5
+ Show: typeof Show;
6
+ Replace: typeof Replace;
7
+ };
8
+ export default Events;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { Fragment } from "react";
3
+ import { useWidgetStore } from "../../store";
4
+ function Show({ widgets, children }) {
5
+ const { events } = useWidgetStore();
6
+ return (_jsxs(_Fragment, { children: [children, widgets?.map(([flag, Component], index) => {
7
+ const isVisible = typeof flag === "boolean"
8
+ ? flag
9
+ : events?.some(({ event }) => event === flag);
10
+ if (React.isValidElement(Component)) {
11
+ const ComponentWithVisibility = React.cloneElement(Component, {
12
+ isVisible,
13
+ });
14
+ return _jsx(Fragment, { children: ComponentWithVisibility }, index);
15
+ }
16
+ return null;
17
+ })] }));
18
+ }
19
+ function Replace({ widgets, children }) {
20
+ const { events } = useWidgetStore();
21
+ if (!widgets)
22
+ return _jsx(_Fragment, { children: children });
23
+ const trueComponents = widgets
24
+ .filter(([widget]) => widget)
25
+ .map(([flag, Component], index) => {
26
+ if (typeof flag === "string") {
27
+ return events?.some(({ event }) => event === flag) ? (_jsx(_Fragment, { children: Component })) : null;
28
+ }
29
+ return _jsx(Fragment, { children: Component }, index);
30
+ })
31
+ .filter((component) => component !== null);
32
+ return _jsx(_Fragment, { children: trueComponents.length > 0 ? trueComponents : children });
33
+ }
34
+ const Events = {
35
+ Show,
36
+ Replace,
37
+ };
38
+ export default Events;
@@ -0,0 +1,2 @@
1
+ import { ShelfProps } from "../../interface";
2
+ export default function Shelf<T extends string | number>({ children, classNames, options, titles, debug, }: ShelfProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { LineBreaks } from "../../text";
3
+ import { cn, isDebug } from "../../util";
4
+ export default function Shelf({ children, classNames, options, titles, debug, }) {
5
+ const { titleSize, subtitleSize } = options ?? {};
6
+ const container = {
7
+ debug: debug && isDebug(`border-2 border-${debug}`),
8
+ };
9
+ const titleBox = {
10
+ container: "flex flex-col pb-2",
11
+ title: {
12
+ text: titleSize ?? "text-xl xl:text-3xl",
13
+ font: "font-bold",
14
+ },
15
+ subtitle: {
16
+ text: subtitleSize ?? "text-base xl:text-lg",
17
+ },
18
+ };
19
+ const childrenBox = {
20
+ sizes: "w-full",
21
+ classNames,
22
+ };
23
+ return (_jsxs("div", { className: cn(container), children: [titles && (_jsxs("div", { className: cn(titleBox.container), children: [_jsx("div", { className: cn(titleBox.title), children: titles.title }), _jsx(LineBreaks, { className: cn(titleBox.subtitle), texts: titles?.subtitle })] })), _jsx("div", { className: cn(childrenBox), children: children })] }));
24
+ }
@@ -4,16 +4,14 @@ import { cn } from "../../util";
4
4
  export default function Tab({ tabs }) {
5
5
  const [tabsSelection, setTabsSelection] = useState(tabs.map((_, i) => i === 0));
6
6
  const container = {
7
- positions: "xl:absolute xl:-bottom-14 xl:left-0 z-5",
8
- displays: "hidden xl:flex xl:items-end xl:gap-4",
9
- sizes: "xl:h-16",
10
- paddings: "xl:px-8 xl:pb-2 ",
11
- styles: "bg-white/50 rounded-b-xl ",
7
+ positions: "xl:absolute xl:-bottom-18 xl:left-0 z-5",
8
+ displays: "hidden xl:flex xl:items-center xl:gap-2.5",
9
+ sizes: "xl:h-14.5",
10
+ paddings: "px-2.5",
11
+ styles: "bg-white/30 rounded-xl ",
12
12
  };
13
13
  return (_jsx("div", { className: cn(container), children: tabs.map(([title, onClick], index) => (_jsx("button", { onClick: () => {
14
14
  setTabsSelection(tabsSelection.map((_, i) => i === index));
15
15
  return onClick();
16
- }, className: `h-9 w-32 rounded-md ${tabsSelection[index]
17
- ? "border-4 border-blue-500"
18
- : "border-4 border-red-500"}`, children: title }, title))) }));
16
+ }, className: `text-green-dark duration-500 h-9 w-32 rounded-md ${tabsSelection[index] && "bg-white rounded-2xl"}`, children: title }, title))) }));
19
17
  }
package/modal/index.d.ts CHANGED
@@ -1,3 +1 @@
1
- export { default as TestModal } from "./TestModal";
2
- export { default as AlertModal } from "./AlertModal";
3
- export { default as ControllerModal } from "./ControllerModal";
1
+ export { default as Modal } from "./template";
package/modal/index.js CHANGED
@@ -1,3 +1 @@
1
- export { default as TestModal } from "./TestModal";
2
- export { default as AlertModal } from "./AlertModal";
3
- export { default as ControllerModal } from "./ControllerModal";
1
+ export { default as Modal } from "./template";
@@ -0,0 +1,2 @@
1
+ import { AlertModalProps } from "../../interface/Modal";
2
+ export default function Alert({ isVisible, title, scripts, options, }: AlertModalProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { col } from "../../util";
3
+ import ModalDesign from "../widget/Modal.design";
4
+ export default function Alert({ isVisible, title, scripts, options, }) {
5
+ const { script, subScript } = scripts ?? {};
6
+ 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 })] }) }) }));
8
+ }
@@ -0,0 +1,6 @@
1
+ import { State } from "../../interface";
2
+ import { ModalProps } from "../../interface/Modal";
3
+ export default function Input<T>({ isVisible, title, options, state, }: Omit<ModalProps, "children"> & {
4
+ title?: string;
5
+ state: State<T>;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import ModalDesign from "../widget/Modal.design";
3
+ export default function Input({ isVisible, title, options, state, }) {
4
+ const { buttons } = options ?? {};
5
+ return (_jsxs(ModalDesign, { isVisible: isVisible, classNames: "pt-18 px-25", options: { buttons, isCloseButton: true }, children: [_jsx("div", { className: "text-xl font-bold", children: title }), _jsx("input", { className: "border-2 border-black w-80 h-8", value: state[0], onChange: (e) => state[1](e.target.value) })] }));
6
+ }
@@ -0,0 +1,7 @@
1
+ import Alert from "./Alert";
2
+ import Input from "./Input";
3
+ declare const Modal: {
4
+ Alert: typeof Alert;
5
+ Input: typeof Input;
6
+ };
7
+ export default Modal;
@@ -0,0 +1,7 @@
1
+ import Alert from "./Alert";
2
+ import Input from "./Input";
3
+ const Modal = {
4
+ Alert,
5
+ Input,
6
+ };
7
+ export default Modal;
@@ -0,0 +1,2 @@
1
+ import { ModalProps } from "../../interface/Modal";
2
+ export default function ModalDesign({ isVisible, children, options, debug, }: ModalProps): import("react").ReactPortal;
@@ -0,0 +1,64 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import ReactDOM from "react-dom";
3
+ import { useTransition, animated } from "react-spring";
4
+ import { useWidgetStore } from "../../store";
5
+ import { cn } from "../../util";
6
+ import isDebug from "../../util/isDebug";
7
+ const widthSize = {
8
+ xs: "w-2/3 min-w-76 max-w-176",
9
+ sm: "w-2/3 min-w-76 max-w-176",
10
+ md: "w-2/3 min-w-76 max-w-176",
11
+ lg: "w-full min-w-76 max-w-360",
12
+ xl: "w-2/3 min-w-76 max-w-360",
13
+ "2xl": "w-2/3 min-w-76 max-w-360",
14
+ full: "w-full",
15
+ };
16
+ const heightSize = {
17
+ xs: "",
18
+ sm: "h-100",
19
+ md: "h-72 sm:h-48",
20
+ lg: "h-120",
21
+ xl: "h-180",
22
+ "2xl": "w-2/3 min-w-76 max-w-176",
23
+ full: "h-full",
24
+ };
25
+ export default function ModalDesign({ isVisible, children, options, debug, }) {
26
+ const { buttons, width, height, closeButtonColor, isCloseButton } = options ?? {};
27
+ const { clearModal } = useWidgetStore();
28
+ const background = {
29
+ positions: "z-50 fixed top-0 left-0",
30
+ displays: "flex items-center justify-center ",
31
+ sizes: "min-h-screen w-full ",
32
+ styles: "bg-black/10 backdrop-blur-sm ",
33
+ };
34
+ const container = {
35
+ paddings: "pl-25 pt-18 pb-12",
36
+ sizes: `${heightSize[height ?? "sm"]} ${widthSize[width ?? "md"]}`,
37
+ styles: "rounded-xl bg-white relative overflow-hidden",
38
+ debug: debug && isDebug(`border-2 border-${debug}`),
39
+ };
40
+ const button = {
41
+ container: {
42
+ positions: "absolute bottom-8 right-10",
43
+ displays: "flex justify-end gap-4",
44
+ },
45
+ body: {
46
+ paddings: "px-8 py-2 ",
47
+ styles: "rounded-2xl bg-black text-2xl font-bold text-white",
48
+ },
49
+ };
50
+ const closeButton = {
51
+ positions: "absolute top-5 left-7",
52
+ displays: "flex justify-center items-center",
53
+ sizes: "h-9 w-9",
54
+ background: closeButtonColor ?? "bg-black",
55
+ styles: "rounded-full",
56
+ };
57
+ const transitions = useTransition(isVisible, {
58
+ from: { opacity: 0 },
59
+ enter: { opacity: 1 },
60
+ leave: { opacity: 0 },
61
+ config: { duration: 200 },
62
+ });
63
+ return ReactDOM.createPortal(transitions((styles, item) => item && (_jsx(animated.div, { style: styles, className: cn(background), children: _jsxs("div", { className: cn(container), children: [children, buttons ? (_jsx("div", { className: cn(button.container), children: buttons.map(([text, onClick]) => (_jsx("button", { className: cn(button.body), onClick: onClick, children: text }, text))) })) : null, isCloseButton && (_jsx("button", { className: cn(closeButton), onClick: clearModal, children: _jsx("div", { className: "x-shape" }) }))] }) }))), document.body);
64
+ }
@@ -1,4 +1,4 @@
1
- export declare const buttonClassNames: (href: string, nowPath: string, color?: [string, string]) => string;
1
+ export declare const buttonClassNames: (href: string, nowPath: string, color?: [string, [string, string]]) => string;
2
2
  export declare function NavigationContainer({ children, }: {
3
3
  children: React.ReactNode;
4
4
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,24 +1,33 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { center, cn } from "../util";
3
+ import { useWidgetStore } from "../store";
3
4
  export const buttonClassNames = (href, nowPath, color) => {
4
- const [bg, text] = color ?? ["white", "black"];
5
+ const { isDark } = useWidgetStore();
6
+ const [bg, [text, selectedText]] = color ?? ["white", ["white", "black"]];
5
7
  const classNames = [
6
8
  center.row(6),
7
- `text-${text}`,
8
9
  "font-bold w-full xl:w-50 h-11 xl:rounded-2xl flex justify-center xl:justify-start xl:pl-5",
9
10
  ].join(" ");
10
11
  const checkPathMatch = (href, nowPath) => {
11
- return href.split("/").pop() === nowPath.split("/").pop();
12
+ const nowPathFormat = nowPath
13
+ .split("/")
14
+ .filter((segment) => !/^\d+$/.test(segment))
15
+ .join("/");
16
+ return href.split("/").pop() === nowPathFormat.split("/").pop();
12
17
  };
13
18
  const toggle = checkPathMatch(href, nowPath)
14
- ? `bg-${bg}`
15
- : "bg-gray-500 xl:bg-transparent";
19
+ ? !isDark
20
+ ? `bg-${bg} text-${selectedText}`
21
+ : "bg-white text-black"
22
+ : (!isDark ? "bg-white " : "bg-black ") +
23
+ `xl:bg-transparent text-${text} dark:text-white`;
16
24
  return [classNames, toggle].join(" ");
17
25
  };
18
26
  export function NavigationContainer({ children, }) {
19
- const displays = "flex flex-row xl:flex-col z-40";
20
- const positions = "fixed bottom-0 left-0 xl:static";
21
- const sizes = "w-full xl:w-auto";
22
- const styles = "";
23
- return (_jsx("div", { className: cn(displays, positions, sizes, styles), children: children }));
27
+ const container = {
28
+ positions: "fixed xl:static bottom-0 left-0 z-40",
29
+ displays: "flex flex-row xl:flex-col",
30
+ sizes: "w-full xl:w-auto",
31
+ };
32
+ return _jsx("div", { className: cn(container), children: children });
24
33
  }
@@ -0,0 +1 @@
1
+ export { default as Overlay } from "./template";
@@ -0,0 +1 @@
1
+ export { default as Overlay } from "./template";
@@ -0,0 +1,2 @@
1
+ import { OverlayProps } from "../../interface/Overlay";
2
+ export default function OverlayDesign(props: OverlayProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Overlay from "./../widget/Overlay";
3
+ export default function OverlayDesign(props) {
4
+ return _jsx(Overlay, { ...props });
5
+ }
@@ -0,0 +1,3 @@
1
+ import { OverlayProps } from "../../interface/Overlay";
2
+ declare function Overlay(props: OverlayProps): import("react/jsx-runtime").JSX.Element;
3
+ export default Overlay;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import OverlayDesign from "./Overlay.design";
3
+ function Overlay(props) {
4
+ return _jsx(OverlayDesign, { ...props });
5
+ }
6
+ export default Overlay;
@@ -0,0 +1,2 @@
1
+ import { OverlayProps } from "../../interface/Overlay";
2
+ export default function Overlay({ isVisible }: OverlayProps): JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useTransition, animated } from "react-spring";
3
+ import { cn } from "../../util";
4
+ export default function Overlay({ isVisible }) {
5
+ const container = {
6
+ positions: "absolute top-0 right-0 z-40",
7
+ sizes: "h-full ",
8
+ styles: "bg-black",
9
+ };
10
+ const transitions = useTransition(isVisible, {
11
+ from: { opacity: 0, width: "0%" },
12
+ enter: { opacity: 1, width: "33.3333%" },
13
+ leave: { opacity: 0, width: "0%" },
14
+ config: { duration: 500 },
15
+ });
16
+ return transitions((styles, item) => item && (_jsx(animated.div, { style: styles, className: cn(container), children: _jsx("div", { className: "text-white text-3xl", children: "TEST" }) })));
17
+ }