@edu-tosel/design 1.0.14 → 1.0.16
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/README.md +0 -5
- 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/AddCard.d.ts +1 -1
- package/card/template/AddCard.js +11 -5
- 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 +23 -14
- package/html/widget/Toggle.d.ts +2 -0
- package/html/widget/Toggle.js +13 -0
- package/index.d.ts +0 -2
- package/index.js +0 -2
- package/interface/Board.d.ts +9 -8
- package/interface/Card.d.ts +10 -1
- package/interface/HTMLElement.d.ts +16 -14
- package/interface/HTMLElement.js +7 -1
- package/interface/Modal.d.ts +1 -0
- 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/modal/template/Input.d.ts +1 -1
- package/modal/template/Input.js +2 -2
- package/modal/widget/Modal.design.d.ts +1 -1
- package/modal/widget/Modal.design.js +3 -3
- 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 +20 -0
- package/util/checkPathMatch.d.ts +2 -0
- package/util/checkPathMatch.js +8 -0
- package/util/index.d.ts +1 -0
- package/util/index.js +1 -0
- package/version.txt +1 -1
- package/deck/index.d.ts +0 -1
- package/deck/index.js +0 -1
- package/deck/template/Deck.d.ts +0 -6
- package/deck/template/Deck.design.d.ts +0 -2
- package/deck/template/Deck.design.js +0 -21
- package/deck/template/Deck.js +0 -11
- package/deck/widget/Deck.d.ts +0 -2
- package/deck/widget/Deck.js +0 -14
- package/interface/Deck.d.ts +0 -15
- package/interface/Deck.js +0 -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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const widthSize = {
|
|
3
|
+
xs: "w-32",
|
|
4
|
+
sm: "w-48",
|
|
5
|
+
md: "w-64",
|
|
6
|
+
lg: "w-96",
|
|
7
|
+
xl: "w-128",
|
|
8
|
+
"2xl": "w-144",
|
|
9
|
+
full: "w-full",
|
|
10
|
+
};
|
|
11
|
+
export default function Toggle({ state: [chekced, setChecked], isDisabled, labels, }) {
|
|
12
|
+
return (_jsxs("div", { className: "w-24 h-6 flex", children: [_jsx("label", { htmlFor: "", className: "inline-flex items-center gap-2 ", children: _jsx("input", { disabled: isDisabled, type: "checkbox", className: "bg-red-crimson appearance-none relative rounded-full w-10 h-5 cursor-pointer", checked: chekced, onChange: (e) => setChecked(e.target.checked) }) }), _jsx("div", { className: "ml-2 transition-all", children: labels.map(([status, label]) => (status === chekced ? label : "")) })] }));
|
|
13
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import "./globals.css";
|
|
2
2
|
export * from "./board";
|
|
3
3
|
export * from "./card";
|
|
4
|
-
export * from "./deck";
|
|
5
4
|
export * from "./layout";
|
|
6
5
|
export * from "./html";
|
|
7
6
|
export * from "./interaction";
|
|
8
|
-
export * from "./menu";
|
|
9
7
|
export * from "./modal";
|
|
10
8
|
export * from "./navigation";
|
|
11
9
|
export * from "./overlay";
|
package/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import "./globals.css";
|
|
2
2
|
export * from "./board";
|
|
3
3
|
export * from "./card";
|
|
4
|
-
export * from "./deck";
|
|
5
4
|
export * from "./layout";
|
|
6
5
|
export * from "./html";
|
|
7
6
|
export * from "./interaction";
|
|
8
|
-
export * from "./menu";
|
|
9
7
|
export * from "./modal";
|
|
10
8
|
export * from "./navigation";
|
|
11
9
|
export * from "./overlay";
|
package/interface/Board.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { DataField, Size } from "./Property";
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DataField, Size, State, Titles } from "./Property";
|
|
3
3
|
import { EventsProps } from "./Widget";
|
|
4
4
|
interface OptionsProps {
|
|
5
5
|
classNames?: string;
|
|
@@ -16,16 +16,18 @@ export interface BoardProps {
|
|
|
16
16
|
debug?: string;
|
|
17
17
|
}
|
|
18
18
|
export interface BoardHeaderProps {
|
|
19
|
-
|
|
19
|
+
titles?: Titles & {
|
|
20
|
+
icon?: string;
|
|
21
|
+
};
|
|
20
22
|
tags?: {
|
|
21
23
|
selects?: {
|
|
22
24
|
title: string;
|
|
23
|
-
|
|
25
|
+
state: State<string>;
|
|
24
26
|
options: [string | number, string][];
|
|
25
27
|
width?: Size;
|
|
26
28
|
}[];
|
|
27
29
|
inputs?: {
|
|
28
|
-
|
|
30
|
+
state: State<string>;
|
|
29
31
|
placeholder?: string;
|
|
30
32
|
title?: string;
|
|
31
33
|
width?: Size;
|
|
@@ -41,14 +43,13 @@ export interface BoardHeaderProps {
|
|
|
41
43
|
export interface ManageBoardProps<T> extends BoardProps {
|
|
42
44
|
data: {
|
|
43
45
|
dataSets: {
|
|
44
|
-
title?: string;
|
|
45
|
-
subtitle?: string;
|
|
46
46
|
items: T[] | undefined;
|
|
47
47
|
renderItem: (item: T) => React.ReactNode;
|
|
48
|
+
titles?: Titles;
|
|
48
49
|
interaction?: React.ReactNode;
|
|
49
50
|
}[];
|
|
50
51
|
dataField?: {
|
|
51
|
-
[p in keyof T]
|
|
52
|
+
[p in keyof T]?: Partial<DataField>;
|
|
52
53
|
};
|
|
53
54
|
gap?: number;
|
|
54
55
|
};
|
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
|
}
|
|
@@ -86,6 +86,15 @@ export interface InfoCardProps extends CardProps {
|
|
|
86
86
|
} & CardOptions;
|
|
87
87
|
}
|
|
88
88
|
export interface AddCardProps extends Omit<CardProps, "children"> {
|
|
89
|
+
title?: string;
|
|
90
|
+
icon?: string;
|
|
89
91
|
onClick: OnClick;
|
|
90
92
|
}
|
|
93
|
+
export interface RowCardProps<T> {
|
|
94
|
+
onClick?: OnClick;
|
|
95
|
+
dataSet: T;
|
|
96
|
+
dataField?: {
|
|
97
|
+
[p in keyof T]?: Partial<DataField>;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
91
100
|
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/Modal.d.ts
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
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { State } from "../../interface";
|
|
2
2
|
import { ModalProps } from "../../interface/Modal";
|
|
3
|
-
export default function Input<T>({ isVisible, title, options, state, }: Omit<ModalProps, "children"> & {
|
|
3
|
+
export default function Input<T>({ isVisible, event, title, options, state, }: Omit<ModalProps, "children"> & {
|
|
4
4
|
title?: string;
|
|
5
5
|
state: State<T>;
|
|
6
6
|
}): import("react/jsx-runtime").JSX.Element;
|
package/modal/template/Input.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import ModalDesign from "../widget/Modal.design";
|
|
3
|
-
export default function Input({ isVisible, title, options, state, }) {
|
|
3
|
+
export default function Input({ isVisible, event, title, options, state, }) {
|
|
4
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) })] }));
|
|
5
|
+
return (_jsxs(ModalDesign, { isVisible: isVisible, event: event, 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
6
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ModalProps } from "../../interface/Modal";
|
|
2
|
-
export default function ModalDesign({ isVisible, children, options, debug, }: ModalProps): import("react").ReactPortal;
|
|
2
|
+
export default function ModalDesign({ isVisible, event, children, options, debug, }: ModalProps): import("react").ReactPortal;
|
|
@@ -22,9 +22,9 @@ const heightSize = {
|
|
|
22
22
|
"2xl": "w-2/3 min-w-76 max-w-176",
|
|
23
23
|
full: "h-full",
|
|
24
24
|
};
|
|
25
|
-
export default function ModalDesign({ isVisible, children, options, debug, }) {
|
|
25
|
+
export default function ModalDesign({ isVisible, event, children, options, debug, }) {
|
|
26
26
|
const { buttons, width, height, closeButtonColor, isCloseButton } = options ?? {};
|
|
27
|
-
const {
|
|
27
|
+
const { setIsOwn, removeModal } = useWidgetStore();
|
|
28
28
|
const background = {
|
|
29
29
|
positions: "z-50 fixed top-0 left-0",
|
|
30
30
|
displays: "flex items-center justify-center ",
|
|
@@ -60,5 +60,5 @@ export default function ModalDesign({ isVisible, children, options, debug, }) {
|
|
|
60
60
|
leave: { opacity: 0 },
|
|
61
61
|
config: { duration: 200 },
|
|
62
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:
|
|
63
|
+
return ReactDOM.createPortal(transitions((styles, item) => item && (_jsx(animated.div, { style: styles, className: cn(background), onClick: () => setIsOwn(true), 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 && event && (_jsx("button", { className: cn(closeButton), onClick: () => removeModal(event), children: _jsx("div", { className: "x-shape" }) }))] }) }))), document.body);
|
|
64
64
|
}
|
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.16",
|
|
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
|
}));
|