@edu-tosel/design 1.0.35 → 1.0.36
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/ManageBoard.js +1 -1
- package/card/design/Card.design.js +1 -0
- package/card/design/InfoCard.design.d.ts +1 -1
- package/card/design/InfoCard.design.js +6 -5
- package/card/design/TableCard.design.d.ts +1 -3
- package/card/design/TableCard.design.js +2 -2
- package/card/template/InfoCard/Finance.d.ts +24 -1
- package/card/template/InfoCard/Finance.js +47 -4
- package/card/template/TableCard.d.ts +2 -4
- package/globals.css +17 -5
- package/hook/useFlag.d.ts +4 -1
- package/hook/useFlag.js +5 -2
- package/html/design/Select.design.js +17 -19
- package/html/widget/CheckBox.d.ts +2 -0
- package/html/widget/CheckBox.js +20 -0
- package/html/widget/Toggle.js +1 -1
- package/interface/Board.d.ts +3 -10
- package/interface/Card.d.ts +4 -10
- package/interface/HTMLElement.d.ts +6 -0
- package/interface/Layout.d.ts +1 -0
- package/interface/Property.d.ts +19 -2
- package/interface/Widget.d.ts +3 -6
- package/layout/design/Row.design.d.ts +1 -1
- package/layout/design/Row.design.js +6 -2
- package/layout/design/Shelf.design.js +4 -2
- package/layout/template/Row.d.ts +9 -10
- package/layout/template/Row.js +11 -5
- package/layout/widget/dashboard/Header.js +3 -3
- package/overlay/widget/Overlay.design.js +1 -1
- package/package.json +1 -1
- package/store/index.d.ts +4 -2
- package/store/index.js +2 -0
- package/tailwind.config.ts +557 -553
- package/util/sortByOrder.d.ts +4 -3
- package/util/sortByOrder.js +6 -6
- package/version.txt +1 -1
|
@@ -17,5 +17,5 @@ export default function ManageBoard({ header, dataSets, dataField, widgets, opti
|
|
|
17
17
|
styles: "overflow-y-scroll",
|
|
18
18
|
};
|
|
19
19
|
return (_jsxs(Board, { widgets: widgets, buttons: buttons, options: { isRounded: true }, children: [header && _jsx(BoardHeader, { ...header }), dataField && _jsx(DataField.Board, { id: id, dataField: dataField }), _jsx("div", { className: cn(container), children: _jsx(Events.Replace, { widgets: widgets?.replaces, children: dataSets.map(({ titles, items, renderItem, interaction }, index) => (_jsxs(Shelf.Wrap, { titles: titles, options: { gap: "x" }, className: className, children: [items &&
|
|
20
|
-
sortByOrder(items, orders)?.map((item) => renderItem(item)), interaction] }, id + index))) }) })] }));
|
|
20
|
+
sortByOrder({ items, orders })?.map((item) => renderItem(item)), interaction] }, id + index))) }) })] }));
|
|
21
21
|
}
|
|
@@ -2,6 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { cn, isDebug } from "../../util";
|
|
3
3
|
import { useWidgetStore } from "../../store";
|
|
4
4
|
const widthSize = {
|
|
5
|
+
"2xs": "w-20",
|
|
5
6
|
xs: "w-full md:w-60",
|
|
6
7
|
sm: "w-full md:w-90",
|
|
7
8
|
md: "w-full md:w-112.5",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { InfoCardProps } from "../../interface/Card";
|
|
2
|
-
export declare function InfoCardDesign({ titles: { title, subtitle }, debug, options, children, }: InfoCardProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function InfoCardDesign({ titles: { title, subtitle }, topRight, debug, options, children, }: InfoCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../../util";
|
|
3
3
|
import Card from "./Card.design";
|
|
4
|
-
export function InfoCardDesign({ titles: { title, subtitle }, debug, options, children, }) {
|
|
4
|
+
export function InfoCardDesign({ titles: { title, subtitle }, topRight, debug, options, children, }) {
|
|
5
5
|
const { titleBorder, text } = options ?? {};
|
|
6
6
|
const container = {
|
|
7
|
+
displays: "flex flex-col",
|
|
7
8
|
paddings: "pt-5 px-5",
|
|
8
9
|
};
|
|
9
10
|
const topBox = {
|
|
10
11
|
container: {
|
|
11
|
-
displays: "flex justify-between",
|
|
12
|
+
displays: "flex justify-between items-end",
|
|
12
13
|
sizes: "w-full h-13.25",
|
|
13
14
|
styles: `${titleBorder} border-b-2 pb-2.5`,
|
|
14
15
|
},
|
|
15
|
-
titleText: "h-6 font-pretendard-bold text-xl w-52 truncate",
|
|
16
|
-
subtitleText: "h-
|
|
16
|
+
titleText: "h-6 font-pretendard-bold text-xl w-52 truncate leading-none",
|
|
17
|
+
subtitleText: "h-4.75 text-base font-extralight flex items-center leading-none",
|
|
17
18
|
right: {
|
|
18
19
|
fontColor: `${text ?? "text-black"}`,
|
|
19
20
|
displays: "flex flex-col-reverse",
|
|
20
21
|
},
|
|
21
22
|
};
|
|
22
|
-
return (_jsxs(Card, { options: { ...options, className: cn(container) }, debug: debug, children: [
|
|
23
|
+
return (_jsxs(Card, { options: { ...options, className: cn(container) }, debug: debug, children: [_jsxs("div", { className: cn(topBox.container), children: [_jsxs("div", { className: "text-gray-dim ", children: [_jsx("div", { className: cn(topBox.titleText), children: title }), _jsx("div", { className: cn(topBox.subtitleText), children: subtitle ?? "" })] }), topRight] }), children] }));
|
|
23
24
|
}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import { TableCardProps } from "../../interface";
|
|
2
|
-
export default function TableCardDesign<
|
|
3
|
-
[p in K]: any;
|
|
4
|
-
}>({ dataSet, dataField, options }: TableCardProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function TableCardDesign<T>({ dataSet, dataField, options, }: TableCardProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { useWidgetStore } from "../../store";
|
|
|
4
4
|
import { cn, sortByOrder } from "../../util";
|
|
5
5
|
import Card from "./Card.design";
|
|
6
6
|
import { DataField, Events, Row } from "../..";
|
|
7
|
-
export default function TableCardDesign({ dataSet, dataField, options }) {
|
|
7
|
+
export default function TableCardDesign({ dataSet, dataField, options, }) {
|
|
8
8
|
const { width, height } = options ?? {};
|
|
9
9
|
const { order } = useWidgetStore();
|
|
10
10
|
const id = useId();
|
|
@@ -19,5 +19,5 @@ export default function TableCardDesign({ dataSet, dataField, options }) {
|
|
|
19
19
|
height: height ?? "lg",
|
|
20
20
|
overflow: "y-scroll",
|
|
21
21
|
noPadding: true,
|
|
22
|
-
}, children: _jsx(Events.Replace, { widgets: dataSet?.replaces, children: sortByOrder(dataSet
|
|
22
|
+
}, children: _jsx(Events.Replace, { widgets: dataSet?.replaces, children: sortByOrder({ items: dataSet?.items, orders }).map((item, index) => (_jsx(Row.Card, { item: item, onClick: () => dataSet.onClick?.(item), dataField: dataField, height: options?.rowHeight, noHover: options?.noHover, noPadding: options?.noRowPadding }, id + index))) }) }));
|
|
23
23
|
}
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import { DataPackage, InfoCardProps, State } from "../../../interface";
|
|
2
|
+
export interface InfoCardFinanceProps<N, C> extends Omit<InfoCardProps, "children"> {
|
|
3
|
+
data: {
|
|
4
|
+
taxRate: number;
|
|
5
|
+
taxState: State<boolean>;
|
|
6
|
+
dataSets?: {
|
|
7
|
+
title: string;
|
|
8
|
+
sum: number | string;
|
|
9
|
+
tax: number | string;
|
|
10
|
+
total: number | string;
|
|
11
|
+
rate: number | string;
|
|
12
|
+
result: number | string;
|
|
13
|
+
number?: DataPackage<N> & {
|
|
14
|
+
title: string;
|
|
15
|
+
};
|
|
16
|
+
amount?: DataPackage<C> & {
|
|
17
|
+
title: string;
|
|
18
|
+
};
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export default function Finance<N, C extends {
|
|
23
|
+
sum: number;
|
|
24
|
+
}>({ titles, data, }: InfoCardFinanceProps<N, C>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,53 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../../util";
|
|
2
3
|
import { InfoCardDesign } from "../../design/InfoCard.design";
|
|
3
|
-
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
export default function Finance({ titles, data, }) {
|
|
6
|
+
const { taxRate, taxState, dataSets } = data;
|
|
7
|
+
const [taxOn, setTaxOn] = taxState;
|
|
8
|
+
const id = useId();
|
|
4
9
|
return (_jsx(InfoCardDesign, { titles: {
|
|
5
|
-
title:
|
|
10
|
+
title: titles.title,
|
|
11
|
+
subtitle: titles.subtitle,
|
|
6
12
|
}, options: {
|
|
13
|
+
titleBorder: "border-green-dark",
|
|
7
14
|
width: "2xl",
|
|
8
15
|
height: "xl",
|
|
9
|
-
}, children: _jsx("div", { children: "\
|
|
16
|
+
}, topRight: _jsxs("div", { className: "flex items-center gap-2.5 text-xs ", children: [_jsx("button", { onClick: () => setTaxOn(!taxOn), className: cn("w-4 h-4 rounded-md", taxOn ? "bg-green-dark" : "border-1") }), _jsxs("div", { children: ["\uC0AC\uC5C5\uC18C\uB4DD\uC138 ", taxRate, "%"] })] }), children: _jsxs("div", { className: "flex flex-col", children: [_jsx("div", { className: "flex gap-7.5 mt-4.25 border-b-1 border-green-dark pb-2.5 ", children: dataSets?.map(({ title, sum, tax, total, rate, amount, number, result }, index) => (_jsxs("div", { className: "flex flex-col gap-2.5", children: [_jsx("div", { className: "font-pretendard-bold text-green-dark", children: title }), _jsxs("div", { className: "flex gap-2.5", children: [_jsxs("div", { className: "flex flex-col justify-between w-20", children: [number && (_jsx(Numbers, { title: number.title, dataSet: number.dataSet, dataField: number.dataField })), _jsx(Result, { title: "\uBE44\uC728", amount: `${rate}%` })] }), amount && (_jsxs("div", { className: "flex flex-col", children: [_jsx(Amount, { title: amount.title, dataSet: amount.dataSet, dataField: amount.dataField }), _jsxs("div", { className: "flex flex-col gap-1.5 mt-2.5", children: [_jsx(Result, { title: "\uD569\uACC4", amount: sum, cnTitle: "text-gray-dim" }), _jsx(Result, { title: "\uC0AC\uC5C5\uC18C\uB4DD\uC138", amount: `${typeof tax === "number" && tax ? "-" : ""}${tax.toLocaleString()}`, cnTitle: "text-gray-dim", cnAmount: "text-crimson-burgundy" }), _jsx(Result, { title: "\uCD1D\uACC4", amount: total, background: "bg-green-dark/10", cnTitle: "font-pretendard-bold" })] }), _jsx(Result, { title: "\uC9C0\uAE09\uBD84", amount: result, background: "bg-green-dark", cnTitle: "font-pretendard-bold text-white", className: "text-white mt-5" })] }))] })] }, id + index))) }), _jsx("div", { className: "flex items-center h-15.5", children: _jsx("div", { className: "w-45 h-10 bg-gray-light rounded-md" }) })] }) }));
|
|
17
|
+
}
|
|
18
|
+
function Numbers({ title, dataSet, dataField, }) {
|
|
19
|
+
const id = useId();
|
|
20
|
+
const itemBox = {
|
|
21
|
+
displays: "flex items-center justify-center ",
|
|
22
|
+
sizes: "w-1/2 h-5",
|
|
23
|
+
};
|
|
24
|
+
return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("div", { className: "text-xs", children: title }), _jsxs("div", { className: "flex flex-col w-full h-36 pt-2.5 rounded-md bg-gray-light text-sm", children: [_jsx("div", { className: "flex items-center font-pretendard-bold", children: Object.keys(dataField).map((key) => (_jsx("div", { className: "flex items-center justify-center w-1/2 h-5", children: dataField[key]?.title }, key))) }), dataSet.items?.map((item, index) => (_jsx("div", { className: "flex items-center", children: dataField &&
|
|
25
|
+
Object.keys(dataField).map((key, index) => (_jsx("div", { className: cn(itemBox, index % 2 === 0 ? "text-gray-dim" : "text-green-dark"), children: String(item[key]) }, key))) }, id + index)))] })] }));
|
|
26
|
+
}
|
|
27
|
+
function Amount({ title, dataSet, dataField, }) {
|
|
28
|
+
const id = useId();
|
|
29
|
+
const amountBox = {
|
|
30
|
+
displays: "flex items-center justify-end ",
|
|
31
|
+
sizes: "w-1/2 h-5 pr-2.5",
|
|
32
|
+
};
|
|
33
|
+
return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("div", { className: "text-xs", children: title }), _jsxs("div", { className: "relative flex flex-col w-full h-36 pt-2.5 rounded-md bg-gray-light text-sm", children: [_jsx("div", { className: "absolute top-0 right-0 bg-green-light w-1/2 h-full rounded-md z-0" }), _jsx("div", { className: "flex items-center z-10", children: Object.keys(dataField).map((key) => (_jsx("div", { className: "flex items-center pl-2.5 text-start w-1/2 h-5 font-pretendard-bold", children: dataField[key]?.title }, key))) }), dataSet.items?.map((item, index) => (_jsx("div", { className: "flex items-center z-10", children: dataField &&
|
|
34
|
+
Object.keys(dataField).map((key, index) => (_jsx("div", { className: cn(amountBox, index % 2 === 0 ? "text-gray-dim" : "text-green-dark"), children: Number(item[key]).toLocaleString() }, key))) }, id + index)))] })] }));
|
|
35
|
+
}
|
|
36
|
+
function Result({ title, amount, background, cnTitle, cnAmount, className, }) {
|
|
37
|
+
const container = {
|
|
38
|
+
displays: "flex items-center justify-between",
|
|
39
|
+
paddings: "px-2.5",
|
|
40
|
+
styles: "rounded-md w-full h-6 text-xs text-green-dark",
|
|
41
|
+
backgrounds: background ?? "bg-gray-light",
|
|
42
|
+
className,
|
|
43
|
+
};
|
|
44
|
+
const titleBox = {
|
|
45
|
+
styles: "w-20 text-center",
|
|
46
|
+
cnTitle,
|
|
47
|
+
};
|
|
48
|
+
const amountBox = {
|
|
49
|
+
styles: "w-20 text-end",
|
|
50
|
+
cnAmount,
|
|
51
|
+
};
|
|
52
|
+
return (_jsxs("div", { className: cn(container), children: [_jsx("div", { className: cn(titleBox), children: title }), _jsx("div", { className: cn(amountBox), children: amount?.toLocaleString() })] }));
|
|
10
53
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { TableCardProps } from "../../interface";
|
|
2
|
-
declare function TableCard<
|
|
3
|
-
[p in K]: any;
|
|
4
|
-
}>(props: TableCardProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare function TableCard<T>(props: TableCardProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
5
3
|
declare namespace TableCard {
|
|
6
|
-
var Log: <
|
|
4
|
+
var Log: <T>(props: TableCardProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
7
5
|
}
|
|
8
6
|
export default TableCard;
|
package/globals.css
CHANGED
|
@@ -185,7 +185,7 @@ input[type="date"]::-webkit-calendar-picker-indicator {
|
|
|
185
185
|
width: 16rem !important;
|
|
186
186
|
}
|
|
187
187
|
/* toggle button */
|
|
188
|
-
[type="checkbox"]::before {
|
|
188
|
+
.toggle[type="checkbox"]::before {
|
|
189
189
|
content: "";
|
|
190
190
|
position: absolute;
|
|
191
191
|
left: 1px;
|
|
@@ -197,18 +197,30 @@ input[type="date"]::-webkit-calendar-picker-indicator {
|
|
|
197
197
|
background-color: white;
|
|
198
198
|
transition: left 100ms linear;
|
|
199
199
|
}
|
|
200
|
-
[type="checkbox"]:checked::before {
|
|
200
|
+
.toggle[type="checkbox"]:checked::before {
|
|
201
201
|
background-color: white;
|
|
202
202
|
left: 1.32rem;
|
|
203
203
|
}
|
|
204
|
-
[type="checkbox"]:checked {
|
|
204
|
+
.toggle[type="checkbox"]:checked {
|
|
205
205
|
background-color: #105652;
|
|
206
206
|
}
|
|
207
|
-
[type="checkbox"]:disabled {
|
|
207
|
+
.toggle[type="checkbox"]:disabled {
|
|
208
208
|
opacity: 0.3;
|
|
209
209
|
cursor: not-allowed;
|
|
210
210
|
}
|
|
211
|
-
[type="checkbox"]:disabled + span {
|
|
211
|
+
.toggle[type="checkbox"]:disabled + span {
|
|
212
212
|
opacity: 0.3;
|
|
213
213
|
cursor: not-allowed;
|
|
214
214
|
}
|
|
215
|
+
|
|
216
|
+
/* checkbox */
|
|
217
|
+
.check-box[type="checkbox"]:checked {
|
|
218
|
+
border-color: transparent;
|
|
219
|
+
background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M5.707 7.293a1 1 0 0 0-1.414 1.414l2 2a1 1 0 0 0 1.414 0l4-4a1 1 0 0 0-1.414-1.414L7 8.586 5.707 7.293z'/%3e%3c/svg%3e");
|
|
220
|
+
background-size: 150%;
|
|
221
|
+
background-position: 50%;
|
|
222
|
+
background-repeat: no-repeat;
|
|
223
|
+
}
|
|
224
|
+
.check-box[type="checkbox"]:disabled {
|
|
225
|
+
background-color: #7f7f7f;
|
|
226
|
+
}
|
package/hook/useFlag.d.ts
CHANGED
package/hook/useFlag.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
2
|
import { useWidgetStore } from "../store";
|
|
3
|
-
export default function useFlag(state) {
|
|
3
|
+
export default function useFlag({ safe, state, }) {
|
|
4
4
|
const [value, action] = state;
|
|
5
5
|
const { flag, isOwn, setIsOwn } = useWidgetStore();
|
|
6
|
+
safe;
|
|
6
7
|
useEffect(() => {
|
|
7
8
|
if (isOwn) {
|
|
8
9
|
return setIsOwn(false);
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
+
else {
|
|
12
|
+
return action(value);
|
|
13
|
+
}
|
|
11
14
|
}, [flag]);
|
|
12
15
|
}
|
|
@@ -14,14 +14,15 @@ const heightSize = {
|
|
|
14
14
|
};
|
|
15
15
|
export default function SelectDesign({ state, selectOptions, placeholder, options, }) {
|
|
16
16
|
const id = useId();
|
|
17
|
-
const { setIsOwn } = useWidgetStore();
|
|
17
|
+
const { setIsOwn, setIsOwnId } = useWidgetStore();
|
|
18
18
|
const [value, setValue] = state;
|
|
19
19
|
const [text, setText] = useState("");
|
|
20
20
|
const [search, setSearch] = useState("");
|
|
21
21
|
const [isOpen, setIsOpen] = useState(false);
|
|
22
|
+
const [isHover, setIsHover] = useState(false);
|
|
22
23
|
const [filteredOptions, setFilterdOptions] = useState([]);
|
|
23
24
|
const [index, setIndex] = useState();
|
|
24
|
-
useFlag([false, setIsOpen]);
|
|
25
|
+
useFlag({ state: [false, setIsOpen], safe: "overlay" });
|
|
25
26
|
const onKeyDown = (e) => {
|
|
26
27
|
if (!filteredOptions)
|
|
27
28
|
return;
|
|
@@ -47,7 +48,8 @@ export default function SelectDesign({ state, selectOptions, placeholder, option
|
|
|
47
48
|
const button = {
|
|
48
49
|
displays: "flex items-center",
|
|
49
50
|
sizes: `${widthSize[options?.width ?? "md"]} ${heightSize[options?.height ?? "xs"]}`,
|
|
50
|
-
styles: "pl-1 rounded-md
|
|
51
|
+
styles: "pl-1 rounded-md focus:outline-none duration-100 text-gray-400",
|
|
52
|
+
shadow: isOpen || isHover ? "box-shadow" : "shadow-none",
|
|
51
53
|
};
|
|
52
54
|
const input = {
|
|
53
55
|
positions: "absolute",
|
|
@@ -55,7 +57,7 @@ export default function SelectDesign({ state, selectOptions, placeholder, option
|
|
|
55
57
|
styles: "focus:outline-none text-xs pl-1.5",
|
|
56
58
|
};
|
|
57
59
|
const body = {
|
|
58
|
-
positions: "absolute",
|
|
60
|
+
positions: "absolute z-40",
|
|
59
61
|
displays: "flex flex-col gap-1",
|
|
60
62
|
sizes: `${widthSize[options?.width ?? "md"]} min-h-6.5 max-h-23.75`,
|
|
61
63
|
paddings: "pl-1 py-1",
|
|
@@ -70,37 +72,33 @@ export default function SelectDesign({ state, selectOptions, placeholder, option
|
|
|
70
72
|
};
|
|
71
73
|
const inputTransition = useTransition(isOpen, {
|
|
72
74
|
from: {
|
|
73
|
-
|
|
74
|
-
top: 0,
|
|
75
|
+
top: 32,
|
|
75
76
|
},
|
|
76
77
|
enter: {
|
|
77
|
-
opacity: 1,
|
|
78
78
|
top: 32,
|
|
79
|
-
config: { duration: 150 },
|
|
80
79
|
},
|
|
81
80
|
leave: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
top: 32,
|
|
82
|
+
},
|
|
83
|
+
config: {
|
|
84
|
+
duration: 0,
|
|
85
85
|
},
|
|
86
86
|
});
|
|
87
87
|
const bodyTransitions = useTransition(isOpen, {
|
|
88
88
|
from: {
|
|
89
|
-
|
|
90
|
-
top: 0,
|
|
89
|
+
top: isLong ? 64 : 32,
|
|
91
90
|
},
|
|
92
91
|
enter: {
|
|
93
|
-
opacity: 1,
|
|
94
92
|
top: isLong ? 64 : 32,
|
|
95
|
-
config: { duration: 150 },
|
|
96
93
|
},
|
|
97
94
|
leave: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
top: isLong ? 64 : 32,
|
|
96
|
+
},
|
|
97
|
+
config: {
|
|
98
|
+
duration: 0,
|
|
101
99
|
},
|
|
102
100
|
});
|
|
103
|
-
return (_jsxs("div", { className: cn(container), onKeyDown: onKeyDown, onClick: () => setIsOwn(true), children: [_jsx("button", { onClick: () => setIsOpen(!isOpen), className: cn(button), children: value ? (_jsx("div", { className: cn(label), children: selectOptions?.find((option) => value === option[0])?.[1] })) : (_jsx("div", { className: "text-xs pl-1", children: placeholder ?? "선택해주세요" })) }), inputTransition((styles, item) => isLong &&
|
|
101
|
+
return (_jsxs("div", { className: cn(container), onKeyDown: onKeyDown, onClick: () => setIsOwn(true), children: [_jsx("button", { onClick: () => setIsOpen(!isOpen), className: cn(button), onMouseEnter: () => setIsHover(true), onMouseLeave: () => setIsHover(false), children: value ? (_jsx("div", { className: cn(label), children: selectOptions?.find((option) => value === option[0])?.[1] })) : (_jsx("div", { className: "text-xs pl-1", children: placeholder ?? "선택해주세요" })) }), inputTransition((styles, item) => isLong &&
|
|
104
102
|
item && (_jsx(animated.input, { style: styles, placeholder: "\uAC80\uC0C9\uC5B4\uB97C \uC785\uB825\uD558\uC138\uC694", className: cn(input), onChange: (e) => setSearch(e.target.value) }))), bodyTransitions((styles, item) => {
|
|
105
103
|
return (item && (_jsx(animated.div, { style: styles, className: cn(body), children: filteredOptions?.map(([value, text], order) => (_jsx("section", { children: _jsx("button", { onClick: () => {
|
|
106
104
|
setValue(value);
|
|
@@ -0,0 +1,20 @@
|
|
|
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 Checkbox({ state: [checked, setChecked], labels, options, color, }) {
|
|
12
|
+
const checkBoxColor = {
|
|
13
|
+
red: "checked:bg-[#910023]",
|
|
14
|
+
blue: "checked:bg-[#173A8B]",
|
|
15
|
+
green: "checked:bg-[#DFE6E5]",
|
|
16
|
+
};
|
|
17
|
+
const { disabled } = options ?? {};
|
|
18
|
+
console.log(checked);
|
|
19
|
+
return (_jsxs("div", { className: "w-auto h-6 flex items-center ", children: [_jsx("input", { type: "checkbox", className: `check-box mr-2 appearance-none w-6 h-6 border-2 border-[#E8EBF3] rounded-md ${checkBoxColor[color]} hover:box-shadow`, disabled: typeof disabled === "boolean" && disabled, checked: checked, onChange: (e) => setChecked(e.target.checked) }), _jsx("label", { htmlFor: "checkbox1", children: labels })] }));
|
|
20
|
+
}
|
package/html/widget/Toggle.js
CHANGED
|
@@ -10,5 +10,5 @@ const widthSize = {
|
|
|
10
10
|
};
|
|
11
11
|
export default function Toggle({ state: [chekced, setChecked], labels, options, }) {
|
|
12
12
|
const { disabled } = options ?? {};
|
|
13
|
-
return (_jsxs("div", { className: "w-24 h-6 flex", children: [_jsx("label", { htmlFor: "", className: "inline-flex items-center gap-2 ", children: _jsx("input", { disabled: typeof disabled === "boolean" && disabled, 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
|
+
return (_jsxs("div", { className: "w-24 h-6 flex", children: [_jsx("label", { htmlFor: "", className: "inline-flex items-center gap-2 ", children: _jsx("input", { disabled: typeof disabled === "boolean" && disabled, type: "checkbox", className: "toggle 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 : "")) })] }));
|
|
14
14
|
}
|
package/interface/Board.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataField, Size, Titles } from "./Property";
|
|
1
|
+
import { DataField, DataSet, Size, Titles } from "./Property";
|
|
2
2
|
import { EventsProps } from "./Widget";
|
|
3
3
|
import { HTMLInputElement, HTMLLabelElement, HTMLSelectElement } from "./HTMLElement";
|
|
4
4
|
interface OptionsProps {
|
|
@@ -37,15 +37,8 @@ export interface CanvasBoardProps<B> extends BoardProps<B> {
|
|
|
37
37
|
export interface ManageBoardProps<B, K extends string, T extends {
|
|
38
38
|
[p in K]: any;
|
|
39
39
|
}> extends BoardProps<B> {
|
|
40
|
-
dataSets:
|
|
41
|
-
|
|
42
|
-
renderItem: (item: T) => React.ReactNode;
|
|
43
|
-
titles?: Titles;
|
|
44
|
-
interaction?: React.ReactNode;
|
|
45
|
-
}[];
|
|
46
|
-
dataField?: {
|
|
47
|
-
[p in keyof T]?: Partial<DataField>;
|
|
48
|
-
};
|
|
40
|
+
dataSets: DataSet<T>[];
|
|
41
|
+
dataField?: DataField<T>;
|
|
49
42
|
}
|
|
50
43
|
export interface PaperBoardProps<B> extends BoardProps<B> {
|
|
51
44
|
}
|
package/interface/Card.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Button, DataField, Disabled, ImageSize, OnClick, Size, Titles } from "./Property";
|
|
2
|
-
import { Replace } from "./Widget";
|
|
1
|
+
import { Button, DataField, DataSet, Disabled, ImageSize, OnClick, Size, Titles } from "./Property";
|
|
3
2
|
interface CardOptions {
|
|
4
3
|
className?: string;
|
|
5
4
|
boundary?: string;
|
|
@@ -71,6 +70,7 @@ export interface NavCardButtonInLayProps extends NavCardProps {
|
|
|
71
70
|
}
|
|
72
71
|
export interface InfoCardProps extends CardProps {
|
|
73
72
|
titles: Titles;
|
|
73
|
+
topRight?: React.ReactNode;
|
|
74
74
|
button?: Button;
|
|
75
75
|
options?: {
|
|
76
76
|
titleBorder?: string;
|
|
@@ -136,14 +136,8 @@ export interface AddCardProps extends Omit<CardProps, "children"> {
|
|
|
136
136
|
onClick: OnClick;
|
|
137
137
|
}
|
|
138
138
|
export interface TableCardProps<T> extends Omit<CardProps, "children"> {
|
|
139
|
-
dataSet:
|
|
140
|
-
|
|
141
|
-
onClick?: OnClick<T>;
|
|
142
|
-
replaces?: Replace[];
|
|
143
|
-
};
|
|
144
|
-
dataField: {
|
|
145
|
-
[p in keyof T]?: Partial<DataField>;
|
|
146
|
-
};
|
|
139
|
+
dataSet: Omit<DataSet<T>, "renderItem">;
|
|
140
|
+
dataField?: DataField<T>;
|
|
147
141
|
options?: CardOptions & {
|
|
148
142
|
className?: string;
|
|
149
143
|
limit?: number;
|
|
@@ -36,6 +36,12 @@ export interface HTMLToggleElement extends HTMLElement {
|
|
|
36
36
|
state: State<boolean>;
|
|
37
37
|
labels: [[true, string], [false, string]];
|
|
38
38
|
}
|
|
39
|
+
export type ColorType = "red" | "blue" | "green";
|
|
40
|
+
export interface HTMLCheckBoxElement extends HTMLElement {
|
|
41
|
+
state: State<boolean>;
|
|
42
|
+
labels: string;
|
|
43
|
+
color: ColorType;
|
|
44
|
+
}
|
|
39
45
|
export interface HTMLElementFrame {
|
|
40
46
|
title: string;
|
|
41
47
|
type: HTMLElementType;
|
package/interface/Layout.d.ts
CHANGED
package/interface/Property.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import { Replace } from "./Widget";
|
|
2
3
|
/**
|
|
3
4
|
* State type for the React component
|
|
4
5
|
* @template T
|
|
@@ -25,7 +26,7 @@ export type State<T> = [T, StateAction<T>];
|
|
|
25
26
|
* @property {"full"} full - Full size
|
|
26
27
|
*/
|
|
27
28
|
export type ImageSize = "sub" | "full";
|
|
28
|
-
export type Size = "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full" | "auto";
|
|
29
|
+
export type Size = "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full" | "auto";
|
|
29
30
|
/**
|
|
30
31
|
* Image size type
|
|
31
32
|
* @enum {string}
|
|
@@ -49,11 +50,26 @@ export type Titles = {
|
|
|
49
50
|
titleColor?: string;
|
|
50
51
|
subtitleColor?: string;
|
|
51
52
|
};
|
|
52
|
-
export type
|
|
53
|
+
export type DataSet<T = any> = {
|
|
54
|
+
items?: T[];
|
|
55
|
+
renderItem: (item: T) => React.ReactNode;
|
|
56
|
+
titles?: Titles;
|
|
57
|
+
interaction?: React.ReactNode;
|
|
58
|
+
onClick?: OnClick<T>;
|
|
59
|
+
replaces?: Replace[];
|
|
60
|
+
};
|
|
61
|
+
type DataFieldType = {
|
|
53
62
|
title: string | number;
|
|
54
63
|
type: string;
|
|
55
64
|
size: string | number;
|
|
56
65
|
};
|
|
66
|
+
export type DataField<T = any> = Partial<{
|
|
67
|
+
[p in keyof T]: Partial<DataFieldType>;
|
|
68
|
+
}>;
|
|
69
|
+
export interface DataPackage<T> {
|
|
70
|
+
dataField: DataField<T>;
|
|
71
|
+
dataSet: Omit<DataSet<T>, "renderItem">;
|
|
72
|
+
}
|
|
57
73
|
export interface Log<K extends string, T extends string | number> {
|
|
58
74
|
prints: K[];
|
|
59
75
|
logs: {
|
|
@@ -64,3 +80,4 @@ export interface Order {
|
|
|
64
80
|
orderBy: string;
|
|
65
81
|
orderHow: "asc" | "desc" | "";
|
|
66
82
|
}
|
|
83
|
+
export {};
|
package/interface/Widget.d.ts
CHANGED
|
@@ -24,9 +24,7 @@ export interface EventsProps {
|
|
|
24
24
|
}
|
|
25
25
|
export interface DataFieldProps<T> {
|
|
26
26
|
id: string;
|
|
27
|
-
dataField
|
|
28
|
-
[p in keyof T]?: Partial<DataField>;
|
|
29
|
-
};
|
|
27
|
+
dataField?: DataField<T>;
|
|
30
28
|
options?: {
|
|
31
29
|
position?: string;
|
|
32
30
|
padding?: string;
|
|
@@ -34,9 +32,7 @@ export interface DataFieldProps<T> {
|
|
|
34
32
|
}
|
|
35
33
|
export interface RowProps<T> {
|
|
36
34
|
item: T;
|
|
37
|
-
dataField?:
|
|
38
|
-
[p in keyof T]?: Partial<DataField>;
|
|
39
|
-
};
|
|
35
|
+
dataField?: DataField<T>;
|
|
40
36
|
onClick?: OnClick<T>;
|
|
41
37
|
buttons?: HTMLLabelElement[];
|
|
42
38
|
options?: {
|
|
@@ -45,6 +41,7 @@ export interface RowProps<T> {
|
|
|
45
41
|
padding?: string;
|
|
46
42
|
text?: string;
|
|
47
43
|
noHover?: boolean;
|
|
44
|
+
className?: string;
|
|
48
45
|
};
|
|
49
46
|
}
|
|
50
47
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RowProps } from "../../interface";
|
|
2
|
-
export default function RowDesign<T
|
|
2
|
+
export default function RowDesign<T>({ item, dataField, options, onClick, buttons, }: RowProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { useId } from "react";
|
|
|
3
3
|
import { cn } from "../../util";
|
|
4
4
|
import { Label } from "../../html";
|
|
5
5
|
export default function RowDesign({ item, dataField, options, onClick, buttons, }) {
|
|
6
|
-
const { size, padding, text, noHover } = options ?? {};
|
|
6
|
+
const { size, padding, text, noHover, className } = options ?? {};
|
|
7
7
|
const id = useId();
|
|
8
8
|
const container = {
|
|
9
9
|
positions: "relative",
|
|
@@ -13,8 +13,12 @@ export default function RowDesign({ item, dataField, options, onClick, buttons,
|
|
|
13
13
|
text: text,
|
|
14
14
|
styles: !noHover && "hover:bg-gray-100 duration-100",
|
|
15
15
|
};
|
|
16
|
+
const itemBox = {
|
|
17
|
+
styles: "truncate",
|
|
18
|
+
className,
|
|
19
|
+
};
|
|
16
20
|
return (_jsxs("div", { className: cn(container), onClick: () => onClick?.(), children: [dataField &&
|
|
17
|
-
Object.keys(dataField).map((key) => (_jsx("div", { className: `w-${dataField[key]?.size}/100
|
|
21
|
+
Object.keys(dataField).map((key) => (_jsx("div", { className: cn(`w-${dataField[key]?.size}/100`, itemBox), children: String(item[key]) }, id + key))), _jsx("div", { className: "absolute right-4 xl:right-8 flex gap-4", children: buttons?.map(({ title, onClick, options }) => (_jsx(Label.Button, { title: title, onClick: onClick, options: {
|
|
18
22
|
background: options?.background ?? "bg-crimson-dark",
|
|
19
23
|
text: options?.text ?? "text-white",
|
|
20
24
|
width: "xs",
|
|
@@ -2,16 +2,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { LineBreaks } from "../../text";
|
|
3
3
|
import { cn, isDebug } from "../../util";
|
|
4
4
|
export default function Shelf({ children, className, options, titles, debug, }) {
|
|
5
|
+
const { title, titleColor } = titles ?? {};
|
|
5
6
|
const { titleSize, subtitleSize } = options ?? {};
|
|
6
7
|
const container = {
|
|
7
8
|
displays: "flex flex-col gap-6",
|
|
8
9
|
debug: debug && isDebug(`border-2 border-${debug}`),
|
|
9
10
|
};
|
|
10
11
|
const titleBox = {
|
|
11
|
-
container: "flex flex-col
|
|
12
|
+
container: "flex flex-col h-6 leading-none",
|
|
12
13
|
title: {
|
|
13
14
|
text: titleSize ?? "text-xl xl:text-xl",
|
|
14
15
|
font: "font-pretendard-bold",
|
|
16
|
+
titleColor: titleColor ?? "text-gray-dim",
|
|
15
17
|
},
|
|
16
18
|
subtitle: {
|
|
17
19
|
text: subtitleSize ?? "text-base xl:text-lg",
|
|
@@ -21,5 +23,5 @@ export default function Shelf({ children, className, options, titles, debug, })
|
|
|
21
23
|
sizes: "w-full",
|
|
22
24
|
className,
|
|
23
25
|
};
|
|
24
|
-
return (_jsxs("div", { className: cn(container), children: [titles && (_jsxs("div", { className: cn(titleBox.container), children: [_jsx("div", { className: cn(titleBox.title), children:
|
|
26
|
+
return (_jsxs("div", { className: cn(container), children: [titles && (_jsxs("div", { className: cn(titleBox.container), children: [_jsx("div", { className: cn(titleBox.title), children: title }), _jsx(LineBreaks, { className: cn(titleBox.subtitle), texts: titles?.subtitle })] })), _jsx("div", { className: cn(childrenBox), children: children })] }));
|
|
25
27
|
}
|
package/layout/template/Row.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { RowProps } from "../../interface";
|
|
2
|
-
declare function
|
|
3
|
-
declare
|
|
4
|
-
height
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Board:
|
|
10
|
-
|
|
11
|
-
};
|
|
2
|
+
declare function Row<T>({ item, dataField, onClick, buttons }: RowProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare namespace Row {
|
|
4
|
+
var Card: <T>({ item, dataField, onClick, buttons, height, noPadding, noHover, }: Omit<RowProps<T>, "options"> & {
|
|
5
|
+
height?: string | undefined;
|
|
6
|
+
noPadding?: boolean | undefined;
|
|
7
|
+
noHover?: boolean | undefined;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
var Board: <T>({ item, dataField, onClick, buttons }: RowProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
}
|
|
12
11
|
export default Row;
|
package/layout/template/Row.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from "react";
|
|
3
3
|
import RowDesign from "../design/Row.design";
|
|
4
|
-
function
|
|
4
|
+
function Row({ item, dataField, onClick, buttons }) {
|
|
5
|
+
return (_jsx(RowDesign, { onClick: onClick, item: item, dataField: dataField, buttons: buttons, options: {
|
|
6
|
+
size: "w-full h-12",
|
|
7
|
+
noHover: true,
|
|
8
|
+
text: "text-xs",
|
|
9
|
+
className: "text-center",
|
|
10
|
+
} }));
|
|
11
|
+
}
|
|
12
|
+
function Board({ item, dataField, onClick, buttons }) {
|
|
5
13
|
const id = useId();
|
|
6
14
|
return (_jsx(RowDesign, { onClick: onClick, item: item, dataField: dataField, buttons: buttons, options: {
|
|
7
15
|
size: "w-full h-12",
|
|
@@ -18,8 +26,6 @@ function Card({ item, dataField, onClick, buttons, height, noPadding, noHover, }
|
|
|
18
26
|
noHover,
|
|
19
27
|
} }, id));
|
|
20
28
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Card,
|
|
24
|
-
};
|
|
29
|
+
Row.Card = Card;
|
|
30
|
+
Row.Board = Board;
|
|
25
31
|
export default Row;
|