@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.
- package/asset/fonts/TimesNewerRoman-Bold.otf +0 -0
- package/asset/fonts/TimesNewerRoman-BoldItalic.otf +0 -0
- package/board/template/CanvasBoard.d.ts +1 -1
- package/board/template/CanvasBoard.js +2 -2
- package/board/template/ManageBoard.d.ts +3 -3
- package/board/template/ManageBoard.js +17 -21
- package/board/template/PaperBoard.d.ts +1 -1
- package/board/template/PaperBoard.js +4 -4
- package/board/widget/Board.js +8 -14
- package/board/widget/DataField.d.ts +7 -4
- package/board/widget/DataField.js +15 -5
- package/board/widget/Header.js +3 -3
- package/board/widget/Tags.d.ts +14 -3
- package/card/index.d.ts +1 -0
- package/card/index.js +1 -0
- package/card/template/AddCard.d.ts +2 -0
- package/card/template/AddCard.js +11 -0
- package/card/template/ChartCard.js +1 -1
- package/card/template/InfoCard.d.ts +32 -2
- package/card/template/InfoCard.design.d.ts +2 -0
- package/card/template/InfoCard.design.js +23 -0
- package/card/template/InfoCard.js +72 -8
- package/card/template/ReportCard.d.ts +1 -1
- package/card/template/ReportCard.js +3 -11
- package/card/template/RowCard.js +3 -7
- package/card/template/TableCard.d.ts +4 -2
- package/card/template/TableCard.js +22 -9
- package/card/template/TrumpCard.js +2 -2
- package/card/widget/Card.d.ts +1 -1
- package/card/widget/Card.js +31 -10
- package/deck/index.d.ts +1 -1
- package/deck/index.js +1 -1
- package/deck/template/Deck.d.ts +6 -0
- package/deck/template/Deck.design.d.ts +2 -0
- package/deck/template/Deck.design.js +21 -0
- package/deck/template/Deck.js +11 -0
- package/deck/widget/Deck.d.ts +2 -0
- package/deck/widget/Deck.js +14 -0
- package/globals.css +27 -1
- package/html/index.d.ts +3 -0
- package/html/index.js +3 -0
- package/html/widget/Button.d.ts +2 -0
- package/html/widget/Button.js +15 -0
- package/html/widget/Input.d.ts +2 -0
- package/html/widget/Input.js +21 -0
- package/html/widget/Select.d.ts +2 -0
- package/html/widget/Select.js +161 -0
- package/index.d.ts +2 -1
- package/index.js +2 -1
- package/interface/Board.d.ts +12 -16
- package/interface/Card.d.ts +41 -38
- package/{deck → interface}/Deck.d.ts +4 -7
- package/interface/Deck.js +1 -0
- package/interface/HTMLElement.d.ts +11 -5
- package/interface/Modal.d.ts +6 -1
- package/interface/Overlay.d.ts +3 -0
- package/interface/Overlay.js +1 -0
- package/interface/Property.d.ts +9 -0
- package/interface/Shelf.d.ts +22 -0
- package/interface/Shelf.js +1 -0
- package/interface/Widget.d.ts +19 -0
- package/interface/index.d.ts +2 -0
- package/interface/index.js +2 -0
- package/layout/index.d.ts +4 -1
- package/layout/index.js +4 -1
- package/layout/template/Gallery.d.ts +7 -0
- package/layout/template/Gallery.js +6 -0
- package/layout/template/Shelf.d.ts +8 -0
- package/layout/template/Shelf.js +41 -0
- package/layout/{dashboard → template/dashboard}/Header.d.ts +0 -1
- package/layout/template/dashboard/Header.js +17 -0
- package/layout/{dashboard → template/dashboard}/index.d.ts +5 -1
- package/layout/template/dashboard/index.js +27 -0
- package/layout/template/report/Header.js +11 -0
- package/layout/widget/Events.d.ts +8 -0
- package/layout/widget/Events.js +38 -0
- package/layout/widget/Shelf.d.ts +2 -0
- package/layout/widget/Shelf.js +24 -0
- package/{board → layout}/widget/Tab.js +6 -8
- package/modal/index.d.ts +1 -3
- package/modal/index.js +1 -3
- package/modal/template/Alert.d.ts +2 -0
- package/modal/template/Alert.js +8 -0
- package/modal/template/Input.d.ts +6 -0
- package/modal/template/Input.js +6 -0
- package/modal/template/index.d.ts +7 -0
- package/modal/template/index.js +7 -0
- package/modal/widget/Modal.design.d.ts +2 -0
- package/modal/widget/Modal.design.js +64 -0
- package/navigation/Navigation.d.ts +1 -1
- package/navigation/Navigation.js +19 -10
- package/overlay/index.d.ts +1 -0
- package/overlay/index.js +1 -0
- package/overlay/template/Overlay.design.d.ts +2 -0
- package/overlay/template/Overlay.design.js +5 -0
- package/overlay/template/index.d.ts +3 -0
- package/overlay/template/index.js +6 -0
- package/overlay/widget/Overlay.d.ts +2 -0
- package/overlay/widget/Overlay.js +17 -0
- package/package.json +3 -2
- package/store/index.d.ts +7 -3
- package/store/index.js +26 -8
- package/tailwind.config.ts +37 -0
- package/text/Formatter.d.ts +3 -0
- package/text/Formatter.js +18 -0
- package/text/index.d.ts +1 -0
- package/text/index.js +1 -0
- package/util/colors.d.ts +2 -1
- package/util/colors.js +2 -1
- package/util/convertUnixTimestampToDate.d.ts +1 -0
- package/util/convertUnixTimestampToDate.js +5 -0
- package/util/index.d.ts +3 -0
- package/util/index.js +3 -0
- package/util/isDebug.d.ts +1 -0
- package/util/isDebug.js +5 -0
- package/util/sortByOrder.d.ts +4 -0
- package/util/sortByOrder.js +20 -0
- package/version.txt +1 -1
- package/card/template/InfoCardCssCase.d.ts +0 -25
- package/card/template/InfoCardCssCase.js +0 -32
- package/card/template/PropfileCard.d.ts +0 -2
- package/card/template/PropfileCard.js +0 -6
- package/deck/Deck.js +0 -22
- package/layout/dashboard/Header.js +0 -19
- package/layout/dashboard/index.js +0 -10
- package/layout/report/Header.js +0 -11
- package/modal/AlertModal.d.ts +0 -2
- package/modal/AlertModal.js +0 -8
- package/modal/ControllerModal.d.ts +0 -6
- package/modal/ControllerModal.js +0 -6
- package/modal/Modal.d.ts +0 -2
- package/modal/Modal.js +0 -31
- package/modal/TestModal.d.ts +0 -7
- package/modal/TestModal.js +0 -6
- package/shelf/Shelf.d.ts +0 -3
- package/shelf/Shelf.js +0 -4
- package/shelf/index.d.ts +0 -1
- package/shelf/index.js +0 -1
- /package/layout/{report → template/report}/Header.d.ts +0 -0
- /package/{board → layout}/widget/Tab.d.ts +0 -0
package/card/widget/Card.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from "../../util";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn, isDebug } from "../../util";
|
|
3
3
|
const widthSize = {
|
|
4
4
|
xs: "w-full md:w-60",
|
|
5
5
|
sm: "w-full md:w-90",
|
|
@@ -12,7 +12,7 @@ const widthSize = {
|
|
|
12
12
|
};
|
|
13
13
|
const heightSize = {
|
|
14
14
|
xs: "min-h-16",
|
|
15
|
-
sm: "h-
|
|
15
|
+
sm: "h-48",
|
|
16
16
|
md: "h-72 sm:h-48",
|
|
17
17
|
lg: "h-80",
|
|
18
18
|
xl: "h-125",
|
|
@@ -20,9 +20,9 @@ const heightSize = {
|
|
|
20
20
|
full: "h-full",
|
|
21
21
|
auto: "h-auto min-h-80",
|
|
22
22
|
};
|
|
23
|
-
export function Card({ children, options, debug }) {
|
|
23
|
+
export function Card({ header, children, options, debug }) {
|
|
24
24
|
const { classNames, boundary, rounded, height, width, text, background, onClick, overflow, } = options ?? {};
|
|
25
|
-
const { size: textSize
|
|
25
|
+
const { size: textSize } = text ?? {};
|
|
26
26
|
const { color: bgColor } = background ?? {};
|
|
27
27
|
const setBoundary = () => {
|
|
28
28
|
if (boundary === "shadow")
|
|
@@ -37,12 +37,33 @@ export function Card({ children, options, debug }) {
|
|
|
37
37
|
positions: "relative",
|
|
38
38
|
sizes: `${widthSize[width ?? "sm"]} ${heightSize[height ?? "sm"]}`,
|
|
39
39
|
onClick: onClick ? "cursor-pointer" : "",
|
|
40
|
-
text: `text-${textSize ?? "base"}`,
|
|
40
|
+
text: `text-${textSize ?? "base"} text-black dark:text-white`,
|
|
41
41
|
boundary: setBoundary(),
|
|
42
42
|
rounded: `rounded-${rounded ?? "xl"}`,
|
|
43
|
-
bgColor: `bg-${bgColor ?? "white/80"}`,
|
|
44
|
-
styles: "duration-500
|
|
45
|
-
debug: debug &&
|
|
43
|
+
bgColor: `bg-${bgColor ?? "white/80"} dark:bg-black/80`,
|
|
44
|
+
styles: "duration-500 ",
|
|
45
|
+
debug: debug && isDebug(`border-2 border-${debug}`),
|
|
46
|
+
overflow: "overflow-hidden",
|
|
46
47
|
};
|
|
47
|
-
|
|
48
|
+
const headerStyle = {
|
|
49
|
+
container: {
|
|
50
|
+
positions: "relative",
|
|
51
|
+
sizes: "h-11 ",
|
|
52
|
+
},
|
|
53
|
+
body: {
|
|
54
|
+
positions: "absolute top-0 left-0",
|
|
55
|
+
displays: "flex items-center pl-4",
|
|
56
|
+
sizes: "w-full h-full",
|
|
57
|
+
styles: `bg-${bgColor ?? "gray-300"} text-black font-bold`,
|
|
58
|
+
},
|
|
59
|
+
block: {
|
|
60
|
+
sizes: "w-full h-full",
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
const body = {
|
|
64
|
+
sizes: "h-full",
|
|
65
|
+
overflow: `overflow-${overflow ?? "hidden"}`,
|
|
66
|
+
classNames,
|
|
67
|
+
};
|
|
68
|
+
return (_jsxs("div", { className: cn(container), children: [header && (_jsxs("div", { className: cn(headerStyle.container), children: [_jsx("div", { className: cn(headerStyle.body), children: header }), _jsx("div", { className: cn(headerStyle.block) })] })), _jsx("div", { onClick: onClick, className: cn(body), children: children })] }));
|
|
48
69
|
}
|
package/deck/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { default as Deck } from "./template/Deck";
|
package/deck/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { default as Deck } from "./template/Deck";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DeckProps } from "../../interface/Deck";
|
|
2
|
+
declare function Deck<T extends string | number>(props: DeckProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare namespace Deck {
|
|
4
|
+
var Sub: <T extends string | number>({ titles, children, options, debug, }: DeckProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
}
|
|
6
|
+
export default Deck;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn, isDebug } from "../../util";
|
|
3
|
+
import { Deck } from "./../widget/Deck";
|
|
4
|
+
export default function DeckDesign({ children, titles, options, debug, }) {
|
|
5
|
+
const { title, subtitle, isSub } = titles ?? {};
|
|
6
|
+
const { height } = options ?? {};
|
|
7
|
+
const container = {
|
|
8
|
+
displays: "flex flex-col gap-4",
|
|
9
|
+
sizes: `w-full h-${height ?? "auto"} `,
|
|
10
|
+
debug: debug && isDebug(`border-2 border-${debug}`),
|
|
11
|
+
};
|
|
12
|
+
const titleBox = {
|
|
13
|
+
container: "flex flex-col gap-1",
|
|
14
|
+
title: {
|
|
15
|
+
text: isSub ? "text-base xl:text-lg" : "text-xl xl:text-2xl",
|
|
16
|
+
font: "font-bold",
|
|
17
|
+
},
|
|
18
|
+
subtitle: isSub ? "text-xs xl:text-sm" : "text-sm xl:text-base",
|
|
19
|
+
};
|
|
20
|
+
return (_jsxs("div", { className: cn(container), children: [titles && (_jsxs("div", { children: [_jsx("div", { className: cn(titleBox.title), children: title }), _jsx("div", { className: cn(titleBox.subtitle), children: subtitle })] })), _jsx(Deck, { children: children })] }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import DeckDesign from "./Deck.design";
|
|
3
|
+
function Deck(props) {
|
|
4
|
+
return _jsx(DeckDesign, { ...props });
|
|
5
|
+
}
|
|
6
|
+
function Sub({ titles, children, options, debug, }) {
|
|
7
|
+
const { title, subtitle } = titles ?? { title: "" };
|
|
8
|
+
return (_jsx(DeckDesign, { titles: { title, subtitle, isSub: true }, debug: debug, ...options, children: children }));
|
|
9
|
+
}
|
|
10
|
+
Deck.Sub = Sub;
|
|
11
|
+
export default Deck;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../util";
|
|
3
|
+
export function Deck({ children, options, }) {
|
|
4
|
+
const { flex, justify, gapX, gapY, overflowScroll } = options ?? {};
|
|
5
|
+
const body = {
|
|
6
|
+
displays: `flex flex-col flex-wrap gap-y-${gapY ?? 5}`,
|
|
7
|
+
flex: flex === "col" ? "sm:flex-col" : "sm:flex-row",
|
|
8
|
+
justify: `justify-${justify ?? "start"}`,
|
|
9
|
+
gapX: `${`gap-x-${gapX ?? 7.5}`}`,
|
|
10
|
+
sizes: "sm:w-full ",
|
|
11
|
+
styles: `${overflowScroll ? "overflow-x-scroll" : ""} duration-500`,
|
|
12
|
+
};
|
|
13
|
+
return _jsx("div", { className: cn(body), children: children });
|
|
14
|
+
}
|
package/globals.css
CHANGED
|
@@ -19,11 +19,28 @@
|
|
|
19
19
|
|
|
20
20
|
@font-face {
|
|
21
21
|
font-family: "Megrim";
|
|
22
|
-
src: url("./asset/fonts/Megrim.ttf") format("
|
|
22
|
+
src: url("./asset/fonts/Megrim.ttf") format("truetype");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@font-face {
|
|
26
|
+
font-family: "Times-Newer-Roman-Bold";
|
|
27
|
+
src: url("./asset/fonts/TimesNewerRoman-Bold.otf") format("opentype");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@font-face {
|
|
31
|
+
font-family: "Times-Newer-Roman-BoldItalic";
|
|
32
|
+
src: url("./asset/fonts/TimesNewerRoman-BoldItalic.otf") format("opentype");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
input[type="date"]::-webkit-inner-spin-button,
|
|
36
|
+
input[type="date"]::-webkit-calendar-picker-indicator {
|
|
37
|
+
display: none;
|
|
38
|
+
-webkit-appearance: none;
|
|
23
39
|
}
|
|
24
40
|
|
|
25
41
|
::-webkit-scrollbar {
|
|
26
42
|
width: 3px;
|
|
43
|
+
padding-right: 10px;
|
|
27
44
|
}
|
|
28
45
|
|
|
29
46
|
::-webkit-scrollbar-track {
|
|
@@ -65,3 +82,12 @@
|
|
|
65
82
|
.x-shape::after {
|
|
66
83
|
transform: translate(-50%, -50%) rotate(-45deg);
|
|
67
84
|
}
|
|
85
|
+
|
|
86
|
+
.border-inner {
|
|
87
|
+
box-shadow: 0 0 0 1px #e5e7eb inset, 0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
88
|
+
0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
89
|
+
}
|
|
90
|
+
.asdfasdf:hover {
|
|
91
|
+
box-shadow: 0 0 0 1px #e5e7eb inset, 0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
92
|
+
0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
93
|
+
}
|
package/html/index.d.ts
ADDED
package/html/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../util";
|
|
3
|
+
const widthSize = {
|
|
4
|
+
md: "w-45",
|
|
5
|
+
lg: "w-50",
|
|
6
|
+
};
|
|
7
|
+
const heightSize = {
|
|
8
|
+
md: "h-11",
|
|
9
|
+
};
|
|
10
|
+
export default function Button({ title, onClick }) {
|
|
11
|
+
const container = {
|
|
12
|
+
sizes: "",
|
|
13
|
+
};
|
|
14
|
+
return (_jsx("button", { onClick: onClick, className: cn(container), children: title }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { cn } from "../../util";
|
|
4
|
+
const widthSize = {
|
|
5
|
+
xs: "w-28",
|
|
6
|
+
sm: "w-48",
|
|
7
|
+
md: "w-64",
|
|
8
|
+
lg: "w-96",
|
|
9
|
+
xl: "w-128",
|
|
10
|
+
"2xl": "w-144",
|
|
11
|
+
full: "w-full",
|
|
12
|
+
};
|
|
13
|
+
export default function Input({ onChange, placeholder, options, }) {
|
|
14
|
+
const { width } = options ?? {};
|
|
15
|
+
const id = useId();
|
|
16
|
+
const container = {
|
|
17
|
+
width: `${widthSize[width ?? "md"]} h-10`,
|
|
18
|
+
styles: "rounded-full pl-4 border-4",
|
|
19
|
+
};
|
|
20
|
+
return (_jsx("input", { className: cn(container), id: id, type: "text", placeholder: placeholder ?? "", onChange: (e) => onChange(e.target.value) }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
import { BiChevronDown } from "react-icons/bi";
|
|
5
|
+
import { useWidgetStore } from "../../store";
|
|
6
|
+
import { cn } from "../../util";
|
|
7
|
+
const widthSize = {
|
|
8
|
+
xs: "w-32",
|
|
9
|
+
sm: "w-48",
|
|
10
|
+
md: "w-64",
|
|
11
|
+
lg: "w-96",
|
|
12
|
+
xl: "w-128",
|
|
13
|
+
"2xl": "w-144",
|
|
14
|
+
full: "w-full",
|
|
15
|
+
};
|
|
16
|
+
export default function Select({ onChange, selectOptions, options, }) {
|
|
17
|
+
const arrayId = useId();
|
|
18
|
+
// isActive 드롭다운 이벤트 통제
|
|
19
|
+
const { flag } = useWidgetStore();
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!isButton)
|
|
22
|
+
setIsActive(false);
|
|
23
|
+
return setIsButton(false);
|
|
24
|
+
}, [flag]);
|
|
25
|
+
const [isActive, setIsActive] = useState(false);
|
|
26
|
+
const [isButton, setIsButton] = useState(false);
|
|
27
|
+
const [selectedItem, setSelectedItem] = useState(null);
|
|
28
|
+
const handleItemClick = (title) => {
|
|
29
|
+
setSelectedItem(title);
|
|
30
|
+
setIsActive(false);
|
|
31
|
+
};
|
|
32
|
+
// css
|
|
33
|
+
const levels = [
|
|
34
|
+
"CoCoon",
|
|
35
|
+
"PreStarter",
|
|
36
|
+
"Starter",
|
|
37
|
+
"Basic",
|
|
38
|
+
"Junior",
|
|
39
|
+
"HighJunior",
|
|
40
|
+
];
|
|
41
|
+
const colorMap = {
|
|
42
|
+
CoCoon: "bg-cocoon-green",
|
|
43
|
+
PreStarter: "bg-ps-pink",
|
|
44
|
+
Starter: "bg-st-orange",
|
|
45
|
+
Basic: "bg-ba-yellow",
|
|
46
|
+
Junior: "bg-jr-blue",
|
|
47
|
+
HighJunior: "bg-hj-blue",
|
|
48
|
+
};
|
|
49
|
+
const isActiveCss = () => {
|
|
50
|
+
if (isActive)
|
|
51
|
+
return `shadow-md border-inner rounded-md`;
|
|
52
|
+
};
|
|
53
|
+
const tagCss = `bg-slate-200 p-1 pl-2 pr-2 rounded-md`;
|
|
54
|
+
const dropdownTop = selectOptions && selectOptions.length > 6 ? "top-24" : "top-12";
|
|
55
|
+
const { width } = options ?? {};
|
|
56
|
+
const dropdown = {
|
|
57
|
+
size: `${widthSize[width ?? "sm"]} h-10`,
|
|
58
|
+
styles: "cursor-pointer pt-4 pb-4 pl-4 pr-4 font-bold text-sm bg-white",
|
|
59
|
+
display: `flex items-center`,
|
|
60
|
+
hover: `hover:rounded-md`,
|
|
61
|
+
effect: `transition-all`,
|
|
62
|
+
function: `${isActiveCss()}`,
|
|
63
|
+
etc: "asdfasdf",
|
|
64
|
+
};
|
|
65
|
+
const dropdownInput = {
|
|
66
|
+
size: `${widthSize[width ?? "sm"]} h-10 `,
|
|
67
|
+
styles: "shadow-md text-sm p-4 font-bold bg-white text-left cursor-text border-1 rounded-md ",
|
|
68
|
+
display: "absolute top-12 flex items-center z-10 ",
|
|
69
|
+
focus: "focus:outline-none focus:border-[#44C5F3] focus:border-1 ",
|
|
70
|
+
};
|
|
71
|
+
const dropdownContent = {
|
|
72
|
+
size: `${widthSize[width ?? "sm"]} min-h-8 max-h-48 overflow-y-auto `,
|
|
73
|
+
styles: `text-sm mt-1 border-1 rounded-md`,
|
|
74
|
+
display: `absolute z-40`,
|
|
75
|
+
function: `${dropdownTop}`,
|
|
76
|
+
};
|
|
77
|
+
const dropdownItem = {
|
|
78
|
+
size: `${widthSize[width ?? "full"]} h-8 `,
|
|
79
|
+
styles: `text-sm text-left p-4 font-bold cursor-pointer `,
|
|
80
|
+
display: `flex items-center z-40`,
|
|
81
|
+
hover: `hover:bg-slate-200 `,
|
|
82
|
+
effect: `transition-all `,
|
|
83
|
+
};
|
|
84
|
+
// input
|
|
85
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
86
|
+
const filteredOptions = selectOptions?.filter(([_, title]) => title.toLowerCase().includes(searchTerm.toLowerCase())) || [];
|
|
87
|
+
// Keyboard event handling
|
|
88
|
+
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
const handleKeyDown = (event) => {
|
|
91
|
+
if (!isActive)
|
|
92
|
+
return;
|
|
93
|
+
// Arrow Up
|
|
94
|
+
if (event.key === "ArrowUp") {
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
const currentIndex = filteredOptions.findIndex(([_, title]) => title === selectedItem);
|
|
97
|
+
const newIndex = currentIndex === -1
|
|
98
|
+
? 0
|
|
99
|
+
: (currentIndex - 1 + filteredOptions.length) %
|
|
100
|
+
filteredOptions.length;
|
|
101
|
+
setSelectedItem(filteredOptions[newIndex][1]);
|
|
102
|
+
setSelectedIndex(newIndex);
|
|
103
|
+
}
|
|
104
|
+
// Arrow Down
|
|
105
|
+
if (event.key === "ArrowDown") {
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
const currentIndex = filteredOptions.findIndex(([_, title]) => title === selectedItem);
|
|
108
|
+
const newIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % filteredOptions.length;
|
|
109
|
+
setSelectedItem(filteredOptions[newIndex][1]);
|
|
110
|
+
setSelectedIndex(newIndex);
|
|
111
|
+
}
|
|
112
|
+
// Enter
|
|
113
|
+
if (event.key === "Enter") {
|
|
114
|
+
if (selectedItem) {
|
|
115
|
+
setIsActive(false);
|
|
116
|
+
onChange(selectedItem);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Esc
|
|
120
|
+
if (event.key === "Escape") {
|
|
121
|
+
setIsActive(false);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
125
|
+
// 선택된 항목 스크롤을 조정하는 함수
|
|
126
|
+
const scrollIntoView = () => {
|
|
127
|
+
if (selectedIndex === -1)
|
|
128
|
+
return;
|
|
129
|
+
const dropdownContent = document.querySelector(".dropdown-content");
|
|
130
|
+
if (!dropdownContent)
|
|
131
|
+
return;
|
|
132
|
+
const selectedItemElement = dropdownContent.children[selectedIndex];
|
|
133
|
+
if (!selectedItemElement)
|
|
134
|
+
return;
|
|
135
|
+
const dropdownRect = dropdownContent.getBoundingClientRect();
|
|
136
|
+
const selectedItemRect = selectedItemElement.getBoundingClientRect();
|
|
137
|
+
if (selectedItemRect.top < dropdownRect.top) {
|
|
138
|
+
dropdownContent.scrollTop -= dropdownRect.top - selectedItemRect.top;
|
|
139
|
+
}
|
|
140
|
+
else if (selectedItemRect.bottom > dropdownRect.bottom) {
|
|
141
|
+
dropdownContent.scrollTop +=
|
|
142
|
+
selectedItemRect.bottom - dropdownRect.bottom;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
scrollIntoView();
|
|
146
|
+
window.addEventListener("resize", scrollIntoView);
|
|
147
|
+
return () => {
|
|
148
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
149
|
+
window.removeEventListener("resize", scrollIntoView);
|
|
150
|
+
};
|
|
151
|
+
}, [isActive, selectedIndex, filteredOptions, selectedItem, onChange]);
|
|
152
|
+
return (_jsxs("div", { className: "relative", children: [_jsxs("div", { className: cn(dropdown), onClick: () => {
|
|
153
|
+
setIsActive(!isActive);
|
|
154
|
+
setIsButton(true);
|
|
155
|
+
}, children: [_jsx("div", { className: `w-4 h-4 mr-2 ${selectedItem && colorMap[selectedItem]
|
|
156
|
+
? colorMap[selectedItem]
|
|
157
|
+
: "hidden"}` }), _jsx("div", { className: `${!selectedItem || levels.includes(selectedItem) ? "" : tagCss}`, children: selectedItem || (_jsx("span", { className: "text-zinc-400", children: "\uC635\uC158\uC744 \uC120\uD0DD\uD558\uC138\uC694" })) }), isActive && _jsx(BiChevronDown, { className: "ml-auto" })] }), isActive && selectOptions && selectOptions.length > 6 && (_jsx("input", { type: "text", placeholder: "\uAC80\uC0C9\uC5B4\uB97C \uC785\uB825\uD558\uC138\uC694", className: cn(dropdownInput), value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), onClick: (e) => e.stopPropagation() })), isActive && filteredOptions && (_jsx("div", { className: "dropdown-content " + cn(dropdownContent), children: filteredOptions.map(([id, title], index) => (_jsxs("div", { className: cn(dropdownItem) +
|
|
158
|
+
(selectedIndex === index ? "bg-slate-200" : "bg-white"), onClick: () => handleItemClick(title), children: [_jsx("div", { className: `w-4 h-4 mr-2 ${colorMap[title] && levels.includes(title)
|
|
159
|
+
? colorMap[title]
|
|
160
|
+
: "hidden"}` }), _jsx("div", { className: `${levels.includes(title) ? "" : tagCss}`, children: title })] }, id))) }))] }));
|
|
161
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ export * from "./board";
|
|
|
3
3
|
export * from "./card";
|
|
4
4
|
export * from "./deck";
|
|
5
5
|
export * from "./layout";
|
|
6
|
+
export * from "./html";
|
|
6
7
|
export * from "./interaction";
|
|
7
8
|
export * from "./menu";
|
|
8
9
|
export * from "./modal";
|
|
9
10
|
export * from "./navigation";
|
|
10
|
-
export * from "./
|
|
11
|
+
export * from "./overlay";
|
|
11
12
|
export * from "./text";
|
package/index.js
CHANGED
|
@@ -3,9 +3,10 @@ export * from "./board";
|
|
|
3
3
|
export * from "./card";
|
|
4
4
|
export * from "./deck";
|
|
5
5
|
export * from "./layout";
|
|
6
|
+
export * from "./html";
|
|
6
7
|
export * from "./interaction";
|
|
7
8
|
export * from "./menu";
|
|
8
9
|
export * from "./modal";
|
|
9
10
|
export * from "./navigation";
|
|
10
|
-
export * from "./
|
|
11
|
+
export * from "./overlay";
|
|
11
12
|
export * from "./text";
|
package/interface/Board.d.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { Dispatch } from "react";
|
|
2
|
-
import {
|
|
1
|
+
import React, { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import { DataField, Size } from "./Property";
|
|
3
|
+
import { EventsProps } from "./Widget";
|
|
3
4
|
interface OptionsProps {
|
|
5
|
+
classNames?: string;
|
|
4
6
|
width?: Size;
|
|
5
7
|
height?: Size;
|
|
6
8
|
color?: string;
|
|
7
9
|
isRounded?: boolean;
|
|
8
|
-
|
|
9
|
-
interface WidgetsProps {
|
|
10
|
-
exceptions?: [boolean, React.ReactNode][];
|
|
11
|
-
components?: [boolean | string, React.ReactNode][];
|
|
12
|
-
tabs?: Button[];
|
|
10
|
+
noPadding?: boolean;
|
|
13
11
|
}
|
|
14
12
|
export interface BoardProps {
|
|
15
13
|
children?: React.ReactNode;
|
|
16
|
-
widgets?:
|
|
14
|
+
widgets?: EventsProps;
|
|
17
15
|
options?: OptionsProps;
|
|
18
16
|
debug?: string;
|
|
19
17
|
}
|
|
@@ -22,14 +20,14 @@ export interface BoardHeaderProps {
|
|
|
22
20
|
tags?: {
|
|
23
21
|
selects?: {
|
|
24
22
|
title: string;
|
|
25
|
-
onChange: Dispatch<string
|
|
23
|
+
onChange: Dispatch<SetStateAction<string>>;
|
|
26
24
|
options: [string | number, string][];
|
|
27
25
|
width?: Size;
|
|
28
26
|
}[];
|
|
29
27
|
inputs?: {
|
|
30
|
-
title: string;
|
|
31
28
|
onChange: Dispatch<string>;
|
|
32
|
-
placeholder
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
title?: string;
|
|
33
31
|
width?: Size;
|
|
34
32
|
}[];
|
|
35
33
|
};
|
|
@@ -44,19 +42,17 @@ export interface ManageBoardProps<T> extends BoardProps {
|
|
|
44
42
|
data: {
|
|
45
43
|
dataSets: {
|
|
46
44
|
title?: string;
|
|
45
|
+
subtitle?: string;
|
|
47
46
|
items: T[] | undefined;
|
|
48
47
|
renderItem: (item: T) => React.ReactNode;
|
|
48
|
+
interaction?: React.ReactNode;
|
|
49
49
|
}[];
|
|
50
50
|
dataField?: {
|
|
51
|
-
|
|
52
|
-
sizes: Record<string, string>;
|
|
51
|
+
[p in keyof T]: DataField;
|
|
53
52
|
};
|
|
54
53
|
gap?: number;
|
|
55
54
|
};
|
|
56
55
|
header?: BoardHeaderProps;
|
|
57
|
-
widgets?: {
|
|
58
|
-
menu?: React.ReactNode;
|
|
59
|
-
} & WidgetsProps;
|
|
60
56
|
}
|
|
61
57
|
export interface PaperBoardProps extends BoardProps {
|
|
62
58
|
}
|
package/interface/Card.d.ts
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
import { ImageSize, Size } from "./Property";
|
|
1
|
+
import { Button, DataField, ImageSize, OnClick, Size, Titles } from "./Property";
|
|
2
|
+
interface CardOptions {
|
|
3
|
+
classNames?: string;
|
|
4
|
+
boundary?: "shadow" | "border" | "none";
|
|
5
|
+
rounded?: string;
|
|
6
|
+
height?: Size;
|
|
7
|
+
width?: Size;
|
|
8
|
+
background?: {
|
|
9
|
+
color?: string;
|
|
10
|
+
};
|
|
11
|
+
text?: {
|
|
12
|
+
size?: string;
|
|
13
|
+
color?: string;
|
|
14
|
+
};
|
|
15
|
+
border?: {
|
|
16
|
+
color?: string;
|
|
17
|
+
};
|
|
18
|
+
onClick?: () => unknown | (() => Promise<unknown>);
|
|
19
|
+
overflow?: "hiden" | "y-scroll" | "auto";
|
|
20
|
+
}
|
|
2
21
|
/**
|
|
3
22
|
* CardProps is an interface.
|
|
4
23
|
* @interface CardProps
|
|
@@ -13,22 +32,8 @@ import { ImageSize, Size } from "./Property";
|
|
|
13
32
|
*/
|
|
14
33
|
export interface CardProps {
|
|
15
34
|
children: React.ReactNode;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
boundary?: "shadow" | "border" | "none";
|
|
19
|
-
rounded?: string;
|
|
20
|
-
height?: Size;
|
|
21
|
-
width?: Size;
|
|
22
|
-
background?: {
|
|
23
|
-
color?: string;
|
|
24
|
-
};
|
|
25
|
-
text?: {
|
|
26
|
-
size?: string;
|
|
27
|
-
color?: string;
|
|
28
|
-
};
|
|
29
|
-
onClick?: () => unknown | (() => Promise<unknown>);
|
|
30
|
-
overflow?: "hiden" | "auto";
|
|
31
|
-
};
|
|
35
|
+
header?: React.ReactNode;
|
|
36
|
+
options?: CardOptions;
|
|
32
37
|
debug?: string;
|
|
33
38
|
}
|
|
34
39
|
export interface ChartCardProps extends Omit<CardProps, "children"> {
|
|
@@ -52,17 +57,15 @@ export interface ChartCardProps extends Omit<CardProps, "children"> {
|
|
|
52
57
|
score: number;
|
|
53
58
|
};
|
|
54
59
|
}
|
|
55
|
-
export interface TableCardProps extends Omit<CardProps, "children"> {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
export interface TableCardProps<T> extends Omit<CardProps, "children"> {
|
|
61
|
+
dataSets: T[];
|
|
62
|
+
dataField: {
|
|
63
|
+
[p in keyof T]: DataField;
|
|
64
|
+
};
|
|
65
|
+
options?: CardOptions;
|
|
59
66
|
}
|
|
60
67
|
export interface TrumpCardProps {
|
|
61
|
-
titles:
|
|
62
|
-
title: string;
|
|
63
|
-
subTitle?: string[];
|
|
64
|
-
color?: string;
|
|
65
|
-
};
|
|
68
|
+
titles: Titles;
|
|
66
69
|
options?: {
|
|
67
70
|
width?: Size;
|
|
68
71
|
image?: {
|
|
@@ -73,16 +76,16 @@ export interface TrumpCardProps {
|
|
|
73
76
|
subButton?: [string, string, () => unknown | (() => Promise<unknown>)];
|
|
74
77
|
};
|
|
75
78
|
}
|
|
76
|
-
export interface InfoCardProps {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
};
|
|
79
|
+
export interface InfoCardProps extends CardProps {
|
|
80
|
+
titles: Titles;
|
|
81
|
+
button?: Button;
|
|
82
|
+
options?: {
|
|
83
|
+
titleBorderColor?: string;
|
|
84
|
+
rightTextColor?: string;
|
|
85
|
+
buttonBackgroundColor?: string;
|
|
86
|
+
} & CardOptions;
|
|
87
|
+
}
|
|
88
|
+
export interface AddCardProps extends Omit<CardProps, "children"> {
|
|
89
|
+
onClick: OnClick;
|
|
88
90
|
}
|
|
91
|
+
export {};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { Titles } from "./Property";
|
|
2
|
+
export interface DeckProps<T> {
|
|
2
3
|
children: React.ReactNode;
|
|
3
|
-
titles?:
|
|
4
|
-
title: string;
|
|
5
|
-
subtitle?: string;
|
|
6
|
-
gapTitle?: number;
|
|
7
|
-
};
|
|
4
|
+
titles?: Titles;
|
|
8
5
|
options?: {
|
|
9
6
|
flex?: "col" | "row";
|
|
10
7
|
justify?: "between";
|
|
@@ -15,4 +12,4 @@ export declare function Deck<T extends string | number>({ children, titles, opti
|
|
|
15
12
|
gapY?: number;
|
|
16
13
|
};
|
|
17
14
|
debug?: string;
|
|
18
|
-
}
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Dispatch } from "react";
|
|
2
|
-
import { Size } from "./Property";
|
|
3
|
-
export type HTMLElementType = "text" | "input" | "select";
|
|
2
|
+
import { OnClick, Size } from "./Property";
|
|
3
|
+
export type HTMLElementType = "text" | "button" | "input" | "select";
|
|
4
4
|
export interface HTMLElement {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
options?: {
|
|
6
|
+
width?: Size;
|
|
7
|
+
};
|
|
8
8
|
}
|
|
9
9
|
export interface HTMLElementSetting {
|
|
10
10
|
[key: string]: {
|
|
@@ -15,9 +15,15 @@ export interface HTMLElementSetting {
|
|
|
15
15
|
onChnage?: Dispatch<string>;
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
+
export interface HTMLButtonElement extends HTMLElement {
|
|
19
|
+
title: string;
|
|
20
|
+
onClick: OnClick;
|
|
21
|
+
}
|
|
18
22
|
export interface HTMLSelectElement extends HTMLElement {
|
|
23
|
+
onChange: Dispatch<string>;
|
|
19
24
|
selectOptions?: [string | number, string][];
|
|
20
25
|
}
|
|
21
26
|
export interface HTMLInputElement extends HTMLElement {
|
|
27
|
+
onChange: Dispatch<string>;
|
|
22
28
|
placeholder?: string;
|
|
23
29
|
}
|