@edu-tosel/design 1.0.14 → 1.0.15
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/board/template/CanvasBoard.js +1 -1
- package/board/template/ManageBoard.js +5 -5
- package/board/widget/Board.js +4 -4
- package/board/widget/DataField.d.ts +3 -5
- package/board/widget/DataField.js +16 -20
- package/board/widget/Header.d.ts +1 -1
- package/board/widget/Header.js +10 -8
- package/card/template/InfoCard.design.js +1 -1
- package/card/template/InfoCard.js +7 -7
- package/card/template/RowCard.d.ts +2 -5
- package/card/template/RowCard.js +15 -13
- package/card/template/TableCard.js +1 -1
- package/card/widget/Card.js +11 -5
- package/globals.css +92 -0
- package/html/index.d.ts +1 -0
- package/html/index.js +1 -0
- package/html/widget/DatePicker.d.ts +3 -0
- package/html/widget/DatePicker.js +23 -0
- package/html/widget/Input.d.ts +1 -1
- package/html/widget/Input.js +2 -1
- package/html/widget/Select.d.ts +1 -1
- package/html/widget/Select.js +9 -10
- package/html/widget/Toggle.d.ts +2 -0
- package/html/widget/Toggle.js +13 -0
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/interface/Board.d.ts +9 -8
- package/interface/Card.d.ts +8 -1
- package/interface/HTMLElement.d.ts +16 -14
- package/interface/HTMLElement.js +7 -1
- package/interface/Overlay.d.ts +17 -0
- package/interface/Property.d.ts +4 -2
- package/interface/index.d.ts +1 -0
- package/interface/index.js +1 -0
- package/layout/template/Shelf.js +3 -3
- package/layout/template/dashboard/index.js +10 -4
- package/layout/widget/Events.js +6 -0
- package/layout/widget/Shelf.js +3 -2
- package/navigation/Navigation.js +8 -13
- package/overlay/template/Info.d.ts +2 -0
- package/overlay/template/Info.js +5 -0
- package/overlay/template/Manage.d.ts +2 -0
- package/overlay/template/Manage.js +17 -0
- package/overlay/template/index.d.ts +6 -2
- package/overlay/template/index.js +6 -5
- package/overlay/widget/Overlay.design.d.ts +2 -0
- package/overlay/widget/Overlay.design.js +25 -0
- package/package.json +4 -1
- package/store/index.d.ts +3 -0
- package/store/index.js +12 -3
- package/tailwind.config.ts +19 -0
- package/util/checkPathMatch.d.ts +2 -0
- package/util/checkPathMatch.js +8 -0
- package/version.txt +1 -1
- package/interface/Menu.d.ts +0 -6
- package/interface/Menu.js +0 -1
- package/menu/index.d.ts +0 -1
- package/menu/index.js +0 -1
- package/menu/template/SideMenu.d.ts +0 -2
- package/menu/template/SideMenu.js +0 -20
- package/menu/widget/HTMLElement.d.ts +0 -8
- package/menu/widget/HTMLElement.js +0 -9
- package/overlay/template/Overlay.design.d.ts +0 -2
- package/overlay/template/Overlay.design.js +0 -5
- package/overlay/widget/Overlay.d.ts +0 -2
- package/overlay/widget/Overlay.js +0 -17
package/interface/Card.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export interface ChartCardProps extends Omit<CardProps, "children"> {
|
|
|
60
60
|
export interface TableCardProps<T> extends Omit<CardProps, "children"> {
|
|
61
61
|
dataSets: T[];
|
|
62
62
|
dataField: {
|
|
63
|
-
[p in keyof T]: DataField
|
|
63
|
+
[p in keyof T]: Partial<DataField>;
|
|
64
64
|
};
|
|
65
65
|
options?: CardOptions;
|
|
66
66
|
}
|
|
@@ -88,4 +88,11 @@ export interface InfoCardProps extends CardProps {
|
|
|
88
88
|
export interface AddCardProps extends Omit<CardProps, "children"> {
|
|
89
89
|
onClick: OnClick;
|
|
90
90
|
}
|
|
91
|
+
export interface RowCardProps<T> {
|
|
92
|
+
onClick?: OnClick;
|
|
93
|
+
dataSet: T;
|
|
94
|
+
dataField?: {
|
|
95
|
+
[p in keyof T]?: Partial<DataField>;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
91
98
|
export {};
|
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { OnClick, Size, State } from "./Property";
|
|
2
|
+
export declare const HTMLElementType: {
|
|
3
|
+
readonly TEXT: "text";
|
|
4
|
+
readonly BUTTON: "button";
|
|
5
|
+
readonly INPUT: "input";
|
|
6
|
+
readonly SELECT: "select";
|
|
7
|
+
readonly TOGGLE: "toggle";
|
|
8
|
+
};
|
|
9
|
+
export type HTMLElementType = (typeof HTMLElementType)[keyof typeof HTMLElementType];
|
|
4
10
|
export interface HTMLElement {
|
|
5
11
|
options?: {
|
|
6
12
|
width?: Size;
|
|
7
13
|
};
|
|
8
14
|
}
|
|
9
|
-
export interface HTMLElementSetting {
|
|
10
|
-
[key: string]: {
|
|
11
|
-
label: string;
|
|
12
|
-
type: HTMLElementType;
|
|
13
|
-
placeholder?: string;
|
|
14
|
-
options?: [string, string][];
|
|
15
|
-
onChnage?: Dispatch<string>;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
15
|
export interface HTMLButtonElement extends HTMLElement {
|
|
19
16
|
title: string;
|
|
20
17
|
onClick: OnClick;
|
|
21
18
|
}
|
|
22
19
|
export interface HTMLSelectElement extends HTMLElement {
|
|
23
|
-
|
|
20
|
+
state: State<string>;
|
|
24
21
|
selectOptions?: [string | number, string][];
|
|
25
22
|
}
|
|
26
23
|
export interface HTMLInputElement extends HTMLElement {
|
|
27
|
-
|
|
24
|
+
state: State<string>;
|
|
28
25
|
placeholder?: string;
|
|
29
26
|
}
|
|
27
|
+
export interface HTMLToggleElement extends HTMLElement {
|
|
28
|
+
state: State<boolean>;
|
|
29
|
+
labels: [[true, string], [false, string]];
|
|
30
|
+
isDisabled?: boolean;
|
|
31
|
+
}
|
package/interface/HTMLElement.js
CHANGED
package/interface/Overlay.d.ts
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
import { HTMLElementType } from "./HTMLElement";
|
|
2
|
+
import { State, Titles } from "./Property";
|
|
1
3
|
export interface OverlayProps {
|
|
4
|
+
titles: Titles;
|
|
2
5
|
isVisible?: boolean;
|
|
6
|
+
event?: string;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface InfoOverlayProps extends OverlayProps {
|
|
10
|
+
}
|
|
11
|
+
export interface ManageOverlayProps extends InfoOverlayProps {
|
|
12
|
+
elements?: {
|
|
13
|
+
title: string;
|
|
14
|
+
state: State<string> | State<boolean>;
|
|
15
|
+
type: HTMLElementType;
|
|
16
|
+
selectOptions?: [string | number, string][];
|
|
17
|
+
labels?: [string | boolean, string][];
|
|
18
|
+
isDisabled?: boolean;
|
|
19
|
+
}[];
|
|
3
20
|
}
|
package/interface/Property.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ import { Dispatch, SetStateAction } from "react";
|
|
|
9
9
|
* const [state, setState] = useState<T>(initialState);
|
|
10
10
|
* @typedef {Array<T, Dispatch<SetStateAction<T>>>} State
|
|
11
11
|
*/
|
|
12
|
-
export type
|
|
12
|
+
export type StateAction<T> = Dispatch<SetStateAction<T>>;
|
|
13
|
+
export type State<T> = [T, StateAction<T>];
|
|
13
14
|
/**
|
|
14
15
|
* Size type
|
|
15
16
|
* @enum {string}
|
|
@@ -47,7 +48,8 @@ export type Titles = {
|
|
|
47
48
|
};
|
|
48
49
|
export type DataField = {
|
|
49
50
|
title: string | number;
|
|
50
|
-
|
|
51
|
+
type: string;
|
|
52
|
+
size: string | number;
|
|
51
53
|
};
|
|
52
54
|
export interface Log<K extends string, T extends string | number> {
|
|
53
55
|
prints: K[];
|
package/interface/index.d.ts
CHANGED
package/interface/index.js
CHANGED
package/layout/template/Shelf.js
CHANGED
|
@@ -3,13 +3,13 @@ import { cn } from "../../util";
|
|
|
3
3
|
import ShelfDesign from "../widget/Shelf";
|
|
4
4
|
function Shelf({ titles, debug, children }) {
|
|
5
5
|
const container = {
|
|
6
|
-
displays: "inline-flex flex-col gap-
|
|
6
|
+
displays: "inline-flex flex-col gap-12 w-full",
|
|
7
7
|
};
|
|
8
8
|
return (_jsx(ShelfDesign, { titles: titles, classNames: cn(container), debug: debug, children: children }));
|
|
9
9
|
}
|
|
10
10
|
function Wrap({ classNames, titles, children, debug, }) {
|
|
11
11
|
const container = {
|
|
12
|
-
displays: "flex flex-row flex-wrap gap-x-
|
|
12
|
+
displays: "flex flex-row flex-wrap gap-x-7.5",
|
|
13
13
|
classNames,
|
|
14
14
|
};
|
|
15
15
|
return (_jsx(ShelfDesign, { titles: titles, classNames: cn(container), options: {
|
|
@@ -19,7 +19,7 @@ function Wrap({ classNames, titles, children, debug, }) {
|
|
|
19
19
|
}
|
|
20
20
|
function Row({ titles, children, debug }) {
|
|
21
21
|
const container = {
|
|
22
|
-
displays: "flex flex-row gap-
|
|
22
|
+
displays: "flex flex-row gap-7.5",
|
|
23
23
|
};
|
|
24
24
|
return (_jsx(ShelfDesign, { titles: titles, classNames: cn(container), options: {
|
|
25
25
|
titleSize: "text-lg xl:text-2xl",
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment } from "react";
|
|
2
|
+
import { Fragment, useEffect } from "react";
|
|
3
3
|
import { NavigationContainer } from "../../../navigation";
|
|
4
4
|
import { Header } from "./Header";
|
|
5
5
|
import { cn } from "../../../util";
|
|
6
6
|
import { useWidgetStore } from "../../../store";
|
|
7
7
|
function Layout({ subject, colors, navigations, children, }) {
|
|
8
|
-
const { isDark, setFlag } = useWidgetStore();
|
|
8
|
+
const { isDark, flag, setFlag, isOwn, setIsOwn, clearView } = useWidgetStore();
|
|
9
9
|
const [title, image, imageUrl] = subject ?? ["", "", ""];
|
|
10
10
|
const [bgColor, textColor] = colors ?? ["white", "black"];
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (isOwn) {
|
|
13
|
+
return setIsOwn(false);
|
|
14
|
+
}
|
|
15
|
+
return clearView();
|
|
16
|
+
}, [flag]);
|
|
11
17
|
const container = {
|
|
12
18
|
sizes: "min-h-screen h-screen xl:h-auto",
|
|
13
19
|
background: !isDark ? `bg-${bgColor}` : "bg-black/80",
|
|
@@ -16,8 +22,8 @@ function Layout({ subject, colors, navigations, children, }) {
|
|
|
16
22
|
};
|
|
17
23
|
const body = {
|
|
18
24
|
sizes: "h-full ",
|
|
19
|
-
displays: "flex gap-12 xl:gap-
|
|
20
|
-
paddings: "pt-15 xl:pl-2 2xl:px-
|
|
25
|
+
displays: "flex gap-12 xl:gap-7.5 ",
|
|
26
|
+
paddings: "pt-15 xl:pl-2 2xl:px-12 xl:pt-7.5",
|
|
21
27
|
};
|
|
22
28
|
return (_jsxs("div", { className: cn(container), onClick: setFlag, children: [_jsx(Header, { title: title, image: [image, imageUrl] }), _jsxs("div", { className: cn(body), children: [_jsx(NavigationContainer, { children: navigations.map((nav, index) => (_jsx(Fragment, { children: nav }, index))) }), children] })] }));
|
|
23
29
|
}
|
package/layout/widget/Events.js
CHANGED
|
@@ -7,8 +7,14 @@ function Show({ widgets, children }) {
|
|
|
7
7
|
const isVisible = typeof flag === "boolean"
|
|
8
8
|
? flag
|
|
9
9
|
: events?.some(({ event }) => event === flag);
|
|
10
|
+
const event = () => {
|
|
11
|
+
if (typeof flag === "string") {
|
|
12
|
+
return flag;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
10
15
|
if (React.isValidElement(Component)) {
|
|
11
16
|
const ComponentWithVisibility = React.cloneElement(Component, {
|
|
17
|
+
event: event(),
|
|
12
18
|
isVisible,
|
|
13
19
|
});
|
|
14
20
|
return _jsx(Fragment, { children: ComponentWithVisibility }, index);
|
package/layout/widget/Shelf.js
CHANGED
|
@@ -4,10 +4,11 @@ import { cn, isDebug } from "../../util";
|
|
|
4
4
|
export default function Shelf({ children, classNames, options, titles, debug, }) {
|
|
5
5
|
const { titleSize, subtitleSize } = options ?? {};
|
|
6
6
|
const container = {
|
|
7
|
+
displays: "flex flex-col gap-4",
|
|
7
8
|
debug: debug && isDebug(`border-2 border-${debug}`),
|
|
8
9
|
};
|
|
9
10
|
const titleBox = {
|
|
10
|
-
container: "flex flex-col
|
|
11
|
+
container: "flex flex-col text-gray-dim",
|
|
11
12
|
title: {
|
|
12
13
|
text: titleSize ?? "text-xl xl:text-3xl",
|
|
13
14
|
font: "font-bold",
|
|
@@ -20,5 +21,5 @@ export default function Shelf({ children, classNames, options, titles, debug, })
|
|
|
20
21
|
sizes: "w-full",
|
|
21
22
|
classNames,
|
|
22
23
|
};
|
|
23
|
-
return (_jsxs("div", { className: cn(container), children: [titles && (_jsxs("div", { className: cn(titleBox.container), children: [_jsx("div", { className: cn(titleBox.title), children: titles
|
|
24
|
+
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
25
|
}
|
package/navigation/Navigation.js
CHANGED
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { cn } from "../util";
|
|
3
3
|
import { useWidgetStore } from "../store";
|
|
4
|
+
import checkPathMatch from "../util/checkPathMatch";
|
|
4
5
|
export const buttonClassNames = (href, nowPath, color) => {
|
|
5
6
|
const { isDark } = useWidgetStore();
|
|
6
7
|
const [bg, [text, selectedText]] = color ?? ["white", ["white", "black"]];
|
|
7
|
-
const
|
|
8
|
-
center.
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
const checkPathMatch = (href, nowPath) => {
|
|
12
|
-
const nowPathFormat = nowPath
|
|
13
|
-
.split("/")
|
|
14
|
-
.filter((segment) => !/^\d+$/.test(segment))
|
|
15
|
-
.join("/");
|
|
16
|
-
return href.split("/").pop() === nowPathFormat.split("/").pop();
|
|
8
|
+
const container = {
|
|
9
|
+
displays: "flex flex-row items-center justify-center xl:justify-start gap-2.5",
|
|
10
|
+
sizes: " w-full xl:w-51 h-11 ",
|
|
11
|
+
styles: "xl:rounded-2xl xl:pl-5 font-bold ",
|
|
17
12
|
};
|
|
18
13
|
const toggle = checkPathMatch(href, nowPath)
|
|
19
14
|
? !isDark
|
|
20
15
|
? `bg-${bg} text-${selectedText}`
|
|
21
16
|
: "bg-white text-black"
|
|
22
17
|
: (!isDark ? "bg-white " : "bg-black ") +
|
|
23
|
-
`xl:bg-transparent text-${text} dark:text-white`;
|
|
24
|
-
return [
|
|
18
|
+
`xl:bg-transparent xl:hover:bg-white/50 hover:text-green-dark text-${text} dark:text-white`;
|
|
19
|
+
return [cn(container), toggle].join(" ");
|
|
25
20
|
};
|
|
26
21
|
export function NavigationContainer({ children, }) {
|
|
27
22
|
const container = {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import OverlayDesign from "../widget/Overlay.design";
|
|
3
|
+
export default function Info({ event, isVisible, }) {
|
|
4
|
+
return (_jsx(OverlayDesign, { titles: { title: "유저 관리" }, event: event, isVisible: isVisible, children: _jsx("div", { children: "TEST" }) }));
|
|
5
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Select, Toggle } from "../..";
|
|
3
|
+
import OverlayDesign from "../widget/Overlay.design";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
export default function Manage({ titles, isVisible, event, elements, }) {
|
|
6
|
+
const id = useId();
|
|
7
|
+
return (_jsx(OverlayDesign, { titles: titles, event: event, isVisible: isVisible, children: elements?.map(({ title, type, labels, state, isDisabled, selectOptions }) => {
|
|
8
|
+
if (type === "select")
|
|
9
|
+
return (_jsx(Frame, { title: title, children: _jsx(Select, { state: state, selectOptions: selectOptions }) }, id + title));
|
|
10
|
+
if (type === "toggle")
|
|
11
|
+
return (_jsx(Frame, { title: title, children: _jsx(Toggle, { state: state, labels: labels, isDisabled: isDisabled }) }, id + title));
|
|
12
|
+
return null;
|
|
13
|
+
}) }));
|
|
14
|
+
}
|
|
15
|
+
function Frame({ title, children, }) {
|
|
16
|
+
return (_jsxs("div", { className: "flex items-center gap-3.75", children: [_jsx("div", { className: "w-20 text-sm font-bold text-gray-dim", children: title }), children] }));
|
|
17
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import Info from "./Info";
|
|
2
|
+
import Manage from "./Manage";
|
|
3
|
+
declare const Overlay: {
|
|
4
|
+
Info: typeof Info;
|
|
5
|
+
Manage: typeof Manage;
|
|
6
|
+
};
|
|
3
7
|
export default Overlay;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import Info from "./Info";
|
|
2
|
+
import Manage from "./Manage";
|
|
3
|
+
const Overlay = {
|
|
4
|
+
Info,
|
|
5
|
+
Manage,
|
|
6
|
+
};
|
|
6
7
|
export default Overlay;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTransition, animated } from "react-spring";
|
|
3
|
+
import { cn } from "../../util";
|
|
4
|
+
import { useWidgetStore } from "../../store";
|
|
5
|
+
export default function OverlayDesign({ titles, children, event, isVisible, }) {
|
|
6
|
+
const { removeView, setIsOwn } = useWidgetStore();
|
|
7
|
+
const { title } = titles;
|
|
8
|
+
const container = {
|
|
9
|
+
positions: "absolute top-0 right-0 z-30",
|
|
10
|
+
sizes: "h-full h",
|
|
11
|
+
styles: "box-shadow-sm bg-white",
|
|
12
|
+
};
|
|
13
|
+
const body = {
|
|
14
|
+
positions: "relative",
|
|
15
|
+
paddings: "pt-12 pl-12",
|
|
16
|
+
displays: "flex flex-col gap-3.5",
|
|
17
|
+
};
|
|
18
|
+
const transitions = useTransition(isVisible, {
|
|
19
|
+
from: { width: "0%" },
|
|
20
|
+
enter: { width: "80%", maxWidth: "540px" },
|
|
21
|
+
leave: { width: "0%" },
|
|
22
|
+
config: { duration: 300 },
|
|
23
|
+
});
|
|
24
|
+
return transitions((styles, item) => item && (_jsxs(animated.div, { style: styles, className: cn(container), onClick: () => setIsOwn(true), children: [_jsxs("div", { className: cn(body), children: [_jsx("div", { className: "font-bold text-2xl", children: title }), _jsx("div", { className: "flex flex-col gap-3", children: children })] }), event && (_jsx("button", { className: "absolute top-3 left-3 bg-black w-6 h-6", onClick: () => removeView(event) }))] })));
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edu-tosel/design",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "UI components for International TOSEL Committee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jsx",
|
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"scripts": {},
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"date-fns": "^2.30.0",
|
|
18
|
+
"date-fns-tz": "^2.0.1",
|
|
17
19
|
"react": "^18.2.0",
|
|
20
|
+
"react-datepicker": "^6.4.0",
|
|
18
21
|
"react-dom": "^18.2.0",
|
|
19
22
|
"react-icons": "^5.0.1",
|
|
20
23
|
"react-lottie-player": "^1.5.6",
|
package/store/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ interface WidgetProps {
|
|
|
3
3
|
events: WidgetEvent[];
|
|
4
4
|
setView: (prop: string) => void;
|
|
5
5
|
removeView: (prop: string) => void;
|
|
6
|
+
clearView: () => void;
|
|
6
7
|
setModal: (prop: string) => void;
|
|
7
8
|
removeModal: (prop: string) => void;
|
|
8
9
|
clearModal: () => void;
|
|
@@ -13,6 +14,8 @@ interface WidgetProps {
|
|
|
13
14
|
clearTempData: () => void;
|
|
14
15
|
flag: boolean;
|
|
15
16
|
setFlag: () => void;
|
|
17
|
+
isOwn: boolean;
|
|
18
|
+
setIsOwn: (prop: boolean) => void;
|
|
16
19
|
isDark: boolean;
|
|
17
20
|
setDark: () => void;
|
|
18
21
|
}
|
package/store/index.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { create } from "zustand";
|
|
2
2
|
export const useWidgetStore = create((set) => ({
|
|
3
3
|
events: [],
|
|
4
|
-
setView: (prop) => set((state) =>
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
setView: (prop) => set((state) => {
|
|
5
|
+
if (state.events.find(({ event }) => event === prop) !== undefined)
|
|
6
|
+
return state;
|
|
7
|
+
return {
|
|
8
|
+
events: [...state.events, { event: prop, type: "view" }],
|
|
9
|
+
};
|
|
10
|
+
}),
|
|
7
11
|
removeView: (prop) => {
|
|
8
12
|
set((state) => ({
|
|
9
13
|
events: state.events.filter(({ event }) => event !== prop),
|
|
10
14
|
}));
|
|
11
15
|
},
|
|
16
|
+
clearView: () => set((state) => ({
|
|
17
|
+
events: state.events.filter(({ type }) => type !== "view"),
|
|
18
|
+
})),
|
|
12
19
|
order: {},
|
|
13
20
|
setOrder: (id, prop) => {
|
|
14
21
|
set((state) => {
|
|
@@ -52,6 +59,8 @@ export const useWidgetStore = create((set) => ({
|
|
|
52
59
|
clearTempData: () => set({ tempData: {} }),
|
|
53
60
|
flag: false,
|
|
54
61
|
setFlag: () => set((state) => ({ flag: !state.flag })),
|
|
62
|
+
isOwn: false,
|
|
63
|
+
setIsOwn: (prop) => set({ isOwn: prop }),
|
|
55
64
|
isDark: false,
|
|
56
65
|
setDark: () => set((state) => ({ isDark: !state.isDark })),
|
|
57
66
|
}));
|
package/tailwind.config.ts
CHANGED
|
@@ -84,6 +84,8 @@ export default {
|
|
|
84
84
|
"sun-calc": "calc(50% - 6rem)",
|
|
85
85
|
1: "0.25rem",
|
|
86
86
|
2.5: "0.625rem",
|
|
87
|
+
3.75: "0.9375rem",
|
|
88
|
+
4.75: "1.1875rem",
|
|
87
89
|
6.25: "1.5625rem",
|
|
88
90
|
6.5: "1.625rem",
|
|
89
91
|
7: "1.75rem",
|
|
@@ -93,6 +95,7 @@ export default {
|
|
|
93
95
|
11: "2.75rem",
|
|
94
96
|
12: "3rem",
|
|
95
97
|
13.25: "3.3125rem",
|
|
98
|
+
13.75: "3.4375rem",
|
|
96
99
|
14: "3.5rem",
|
|
97
100
|
14.5: "3.625rem",
|
|
98
101
|
15: "3.75rem",
|
|
@@ -100,6 +103,8 @@ export default {
|
|
|
100
103
|
18: "4.5rem",
|
|
101
104
|
18.75: "4.6875rem",
|
|
102
105
|
19: "4.75rem",
|
|
106
|
+
19.25: "4.8125rem",
|
|
107
|
+
21: "5.25rem",
|
|
103
108
|
21.75: "5.4375rem",
|
|
104
109
|
22: "5.5rem",
|
|
105
110
|
23: "5.75rem",
|
|
@@ -120,11 +125,14 @@ export default {
|
|
|
120
125
|
48: "12rem",
|
|
121
126
|
49: "12.25rem",
|
|
122
127
|
50: "12.5rem",
|
|
128
|
+
51: "12.75rem",
|
|
123
129
|
52: "13rem",
|
|
130
|
+
52.5: "13.125rem",
|
|
124
131
|
54: "13.5rem",
|
|
125
132
|
56: "14rem",
|
|
126
133
|
62: "15.5rem",
|
|
127
134
|
64: "16rem",
|
|
135
|
+
67.5: "16.875rem",
|
|
128
136
|
68: "17rem",
|
|
129
137
|
69: "17.25rem",
|
|
130
138
|
70: "17.5rem",
|
|
@@ -157,13 +165,24 @@ export default {
|
|
|
157
165
|
132: "33rem",
|
|
158
166
|
135: "33.75rem",
|
|
159
167
|
136: "34rem",
|
|
168
|
+
138.75: "34.6875rem",
|
|
160
169
|
140: "35rem",
|
|
161
170
|
144: "36rem",
|
|
171
|
+
145: "36.25rem",
|
|
172
|
+
145.25: "36.375rem",
|
|
173
|
+
146: "36.5rem",
|
|
174
|
+
147: "36.75rem",
|
|
162
175
|
148: "37rem",
|
|
176
|
+
151.5: "37.875rem",
|
|
177
|
+
151.75: "37.9375rem",
|
|
178
|
+
152: "38rem",
|
|
179
|
+
153: "38.25rem",
|
|
163
180
|
158: "39.5rem",
|
|
181
|
+
159: "39.75rem",
|
|
164
182
|
160: "40rem",
|
|
165
183
|
164: "41rem",
|
|
166
184
|
168: "42rem",
|
|
185
|
+
171.5: "42.875rem",
|
|
167
186
|
172: "43rem",
|
|
168
187
|
176: "44rem",
|
|
169
188
|
178: "44.5rem",
|
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.15
|
package/interface/Menu.d.ts
DELETED
package/interface/Menu.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/menu/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as SideMenu } from "./template/SideMenu";
|
package/menu/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as SideMenu } from "./template/SideMenu";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useWidgetStore } from "../../store";
|
|
3
|
-
import { cn } from "../../util";
|
|
4
|
-
import HTMLElement from "../widget/HTMLElement";
|
|
5
|
-
export default function SideMenu({ log, setting, buttons, }) {
|
|
6
|
-
const { tempData, setTempData, clearTempData, events, removeView } = useWidgetStore();
|
|
7
|
-
const isOpen = events.some(({ event }) => event === "sideMenu");
|
|
8
|
-
const positions = "absolute top-20 right-0";
|
|
9
|
-
const paddings = "pt-8";
|
|
10
|
-
const sizes = `${isOpen ? "w-160" : "w-0"} h-full xl:h-158`;
|
|
11
|
-
const styles = `${isOpen ? "opacity-100 z-30" : "opacity-0 z-0"} bg-gray-200 duration-500`;
|
|
12
|
-
const { prints, logs } = log ?? {};
|
|
13
|
-
return (_jsx("div", { className: cn(positions, sizes, styles, paddings), children: _jsxs("div", { className: `relative w-full h-full flex flex-col items-center gap-12 ${isOpen ? "block" : "hidden"}`, children: [_jsxs("div", { className: "w-9/10 border-2 border-black p-2 h-80 relative", children: [_jsx("div", { className: "grid grid-cols-2", children: Object.entries(setting).map(([key, value]) => (_jsxs("div", { className: "text-base font-bold flex gap-2", children: [_jsxs("div", { className: "w-16", children: [value["label"], ":"] }), _jsx(HTMLElement, { type: value["type"], value: tempData[key], options: value["options"], onChange: (value) => setTempData({
|
|
14
|
-
...tempData,
|
|
15
|
-
[key]: value,
|
|
16
|
-
}) })] }, key))) }), _jsx("div", { className: "absolute bottom-2 right-2 flex justify-end gap-2", children: buttons?.map(([title, onClick]) => (_jsx("button", { onClick: onClick, className: "px-2 py-1 bg-blue-500 text-white", children: title }, title))) })] }), _jsx("div", { className: "border-2 border-black w-9/10 p-2 h-48 overflow-y-scroll", children: logs?.map((log, i) => (_jsx("div", { className: "text-base flex gap-2", children: prints?.map((print) => (_jsx("div", { className: "", children: log[print] }, print))) }, i))) }), _jsx("button", { onClick: () => {
|
|
17
|
-
clearTempData();
|
|
18
|
-
return removeView("sideMenu");
|
|
19
|
-
}, className: "absolute left-0 top-2/5 text-3xl font-bold", children: ">" })] }) }));
|
|
20
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Dispatch } from "react";
|
|
2
|
-
import { HTMLElementType } from "../../interface";
|
|
3
|
-
export default function HTMLElement({ type, value, options, onChange, }: {
|
|
4
|
-
type: HTMLElementType;
|
|
5
|
-
value: string | number;
|
|
6
|
-
options?: [string, string][];
|
|
7
|
-
onChange?: Dispatch<string>;
|
|
8
|
-
}): import("react/jsx-runtime").JSX.Element | undefined;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export default function HTMLElement({ type, value, options, onChange, }) {
|
|
3
|
-
if (type === "text")
|
|
4
|
-
return _jsx("div", { children: value });
|
|
5
|
-
if (type === "input")
|
|
6
|
-
return (_jsx("input", { className: "w-32", value: value, onChange: (e) => onChange?.(e.target.value) }));
|
|
7
|
-
if (type === "select")
|
|
8
|
-
return (_jsx("select", { value: value, onChange: (e) => onChange?.(e.target.value), children: options?.map(([value, label]) => (_jsx("option", { value: value, children: label }, value))) }));
|
|
9
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}
|