@edu-tosel/design 1.0.85 → 1.0.87
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/card/design/RollCard.design.js +1 -1
- package/interface/Modal.d.ts +22 -3
- package/interface/index.d.ts +1 -0
- package/interface/index.js +1 -0
- package/interface/widget/Select.d.ts +13 -0
- package/interface/widget/index.d.ts +3 -2
- package/layout/template/Tab.js +1 -1
- package/modal/design/Modal.design.js +3 -2
- package/modal/template/Alert.js +1 -1
- package/modal/template/Confirm/Confirm.d.ts +1 -1
- package/modal/template/Confirm/Confirm.js +17 -1
- package/modal/template/Confirm/index.d.ts +1 -2
- package/modal/template/Confirm/index.js +0 -2
- package/modal/template/Input.js +1 -1
- package/package.json +1 -1
- package/version.txt +1 -1
- package/widget/template/Input/Form.d.ts +1 -1
- package/widget/template/Input/Form.js +25 -20
- package/widget/template/Select/Switch.js +1 -3
- package/widget/template/Select/Tag.d.ts +1 -15
- package/modal/template/Confirm/Switch.d.ts +0 -7
- package/modal/template/Confirm/Switch.js +0 -15
|
@@ -24,7 +24,7 @@ export default function RollCardDesign({ titles, state, disabled, isFixed, child
|
|
|
24
24
|
};
|
|
25
25
|
return (_jsxs(Card, { option: {
|
|
26
26
|
width: "2xl",
|
|
27
|
-
height: !isFixed && isOpen ? "
|
|
27
|
+
height: !isFixed && isOpen ? "2xs" : "4xs",
|
|
28
28
|
background: isDisabled || flag ? "bg-green-dark/10" : "bg-white",
|
|
29
29
|
className: "p-7.5 flex flex-col gap-y-6",
|
|
30
30
|
}, children: [_jsxs(Shelf.Row, { className: "justify-between", children: [_jsxs(Shelf.Col, { className: "gap-y-2.5", children: [_jsxs(Shelf.Row, { className: "gap-x-2.5 items-center", children: [titles.icon && _jsx("img", { src: titles.icon, alt: "icon" }), _jsx("div", { className: "text-xl leading-none font-pretendard-bold text-green-dark", children: titles.title })] }), _jsx("div", { className: "leading-none", children: titles.subtitle })] }), _jsxs("div", { className: "flex gap-3.5 items-center", children: [_jsx(Label, { title: !isDisabled
|
package/interface/Modal.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { Button, Scripts, Size, State, Titles } from "./Property";
|
|
3
3
|
import { ShowAction } from "./Action";
|
|
4
|
+
import { InputWidget, SelectSwitchProps, SelectTagProps } from "./widget";
|
|
4
5
|
interface Option {
|
|
6
|
+
className?: string;
|
|
5
7
|
width: Size;
|
|
6
8
|
height: Size;
|
|
7
9
|
padding: boolean;
|
|
@@ -15,12 +17,29 @@ interface ModalProps {
|
|
|
15
17
|
titles: Titles;
|
|
16
18
|
children: ReactNode;
|
|
17
19
|
showAction?: ShowAction;
|
|
18
|
-
className?: string;
|
|
19
20
|
option?: Partial<Option>;
|
|
20
21
|
debug?: string;
|
|
21
22
|
}
|
|
22
|
-
interface ConfirmModalProps extends ModalProps {
|
|
23
|
+
interface ConfirmModalProps<T = any> extends ModalProps {
|
|
23
24
|
buttons: [Button, Button];
|
|
25
|
+
widgets?: ConfirmModalWidget<T>[];
|
|
26
|
+
}
|
|
27
|
+
type ConfirmModalWidget<T = string> = ConfirmModalSelectSwitchProps<T> | ConfirmModalSelectTagProps<T> | ConfirmModalInputFormProps | ConfirmModalNodeProps;
|
|
28
|
+
interface ConfirmModalSelectSwitchProps<T> {
|
|
29
|
+
type: "selectSwitch";
|
|
30
|
+
data: SelectSwitchProps<T>;
|
|
31
|
+
}
|
|
32
|
+
interface ConfirmModalSelectTagProps<T> {
|
|
33
|
+
type: "selectTag";
|
|
34
|
+
data: SelectTagProps<T>;
|
|
35
|
+
}
|
|
36
|
+
interface ConfirmModalInputFormProps {
|
|
37
|
+
type: "inputForm";
|
|
38
|
+
data: InputWidget;
|
|
39
|
+
}
|
|
40
|
+
interface ConfirmModalNodeProps {
|
|
41
|
+
type?: undefined;
|
|
42
|
+
data: ReactNode;
|
|
24
43
|
}
|
|
25
44
|
interface AlertModalProps extends Omit<ModalProps, "children"> {
|
|
26
45
|
scripts: Scripts;
|
|
@@ -35,4 +54,4 @@ interface DaumPostcode {
|
|
|
35
54
|
interface DaumPostcodeModalProps extends Omit<ModalProps, "titles" | "children"> {
|
|
36
55
|
state: State<DaumPostcode>;
|
|
37
56
|
}
|
|
38
|
-
export type { ModalProps, ConfirmModalProps, AlertModalProps, DaumPostcodeModalProps, };
|
|
57
|
+
export type { ModalProps, ConfirmModalProps, ConfirmModalWidget, AlertModalProps, DaumPostcodeModalProps, };
|
package/interface/index.d.ts
CHANGED
package/interface/index.js
CHANGED
|
@@ -22,6 +22,19 @@ export interface SelectSwitchProps<T> {
|
|
|
22
22
|
className?: string;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
+
export interface SelectTagProps<T> {
|
|
26
|
+
state: State<T[]>;
|
|
27
|
+
selectOptions: {
|
|
28
|
+
title: string;
|
|
29
|
+
value: T;
|
|
30
|
+
}[];
|
|
31
|
+
selectHow?: "one" | "plural";
|
|
32
|
+
option?: {
|
|
33
|
+
className?: string;
|
|
34
|
+
background?: string;
|
|
35
|
+
text?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
25
38
|
export interface SelectHandleProps<T> {
|
|
26
39
|
state: State<T>;
|
|
27
40
|
selectOptions: SelectOptionInput<T>[];
|
|
@@ -31,12 +31,13 @@ export interface LabelWidget extends Widget {
|
|
|
31
31
|
}
|
|
32
32
|
type InputType = "text" | "password" | "date" | "email" | "phone" | "number";
|
|
33
33
|
export interface InputWidget extends Widget {
|
|
34
|
+
title?: string;
|
|
34
35
|
state: State<string> | State<string | undefined>;
|
|
35
36
|
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
36
37
|
placeholder?: string;
|
|
37
|
-
isValid?: boolean;
|
|
38
|
+
isValid?: boolean | ((value: string) => boolean);
|
|
38
39
|
type?: InputType;
|
|
39
|
-
|
|
40
|
+
button?: LabelWidget;
|
|
40
41
|
maxLength?: number;
|
|
41
42
|
disabled?: Disabled;
|
|
42
43
|
}
|
package/layout/template/Tab.js
CHANGED
|
@@ -20,7 +20,7 @@ export default function Tab({ tabs, option, state, }) {
|
|
|
20
20
|
displays: "hidden xl:flex xl:items-center xl:gap-2.5",
|
|
21
21
|
sizes: "w-auto",
|
|
22
22
|
paddings: "p-2.5",
|
|
23
|
-
backgrounds: boundary ?? "bg-
|
|
23
|
+
backgrounds: boundary ?? "bg-gray-light",
|
|
24
24
|
styles: "rounded-xl ",
|
|
25
25
|
};
|
|
26
26
|
const button = {
|
|
@@ -35,11 +35,12 @@ export default function ModalDesign({ titles, showAction, children, option, debu
|
|
|
35
35
|
}, []);
|
|
36
36
|
const background = {
|
|
37
37
|
positions: "z-50 fixed top-0 left-0",
|
|
38
|
-
displays: position
|
|
38
|
+
displays: !position && "flex items-center justify-center ",
|
|
39
39
|
sizes: "min-h-screen w-full ",
|
|
40
40
|
styles: !noBackground && "bg-black/10 backdrop-blur-sm ",
|
|
41
41
|
};
|
|
42
42
|
const container = {
|
|
43
|
+
positions: position,
|
|
43
44
|
paddings: "p-5",
|
|
44
45
|
sizes: `${heightSize[height ?? "lg"]} ${widthSize[width ?? "md"]}`,
|
|
45
46
|
styles: "rounded-xl bg-white relative overflow-hidden",
|
|
@@ -48,7 +49,7 @@ export default function ModalDesign({ titles, showAction, children, option, debu
|
|
|
48
49
|
};
|
|
49
50
|
const titleBox = {
|
|
50
51
|
displays: "flex flex-col items-end",
|
|
51
|
-
sizes: "w-full",
|
|
52
|
+
sizes: "w-full min-h-[83px]",
|
|
52
53
|
};
|
|
53
54
|
const transitions = useTransition(isVisible, {
|
|
54
55
|
from: { opacity: 0 },
|
package/modal/template/Alert.js
CHANGED
|
@@ -3,5 +3,5 @@ import ModalDesign from "../design/Modal.design";
|
|
|
3
3
|
export default function Alert({ titles, showAction, scripts, option, }) {
|
|
4
4
|
const { script } = scripts ?? {};
|
|
5
5
|
const { buttons } = option ?? {};
|
|
6
|
-
return (_jsx(ModalDesign, { titles: titles, showAction: showAction, className: "pt-18 px-25"
|
|
6
|
+
return (_jsx(ModalDesign, { titles: titles, showAction: showAction, option: { buttons, className: "pt-18 px-25" }, children: _jsx("div", { className: "flex flex-col gap-3", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsx("div", { className: "h-2 w-14 rounded-full bg-pale-lavender" }), _jsx("div", { className: "text-xl font-pretendard-bold", children: script })] }) }) }));
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ConfirmModalProps } from "../../../interface/Modal";
|
|
2
|
-
export default function Confirm(props: ConfirmModalProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function Confirm(props: Omit<ConfirmModalProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createElement as _createElement } from "react";
|
|
2
3
|
import { cn } from "../../../util";
|
|
4
|
+
import { Input, Select } from "../../../widget";
|
|
3
5
|
import ConfirmModalDesign from "../../design/ConfirmModal.design";
|
|
4
6
|
export default function Confirm(props) {
|
|
7
|
+
const { className } = props.option ?? {};
|
|
5
8
|
const container = {
|
|
6
9
|
displays: "flex flex-col",
|
|
7
10
|
margins: "mt-2.5",
|
|
11
|
+
className,
|
|
8
12
|
sizes: "w-full h-60",
|
|
9
13
|
};
|
|
10
|
-
return (_jsx(ConfirmModalDesign, { ...props, children: _jsx("div", { className: cn(container), children: props.
|
|
14
|
+
return (_jsx(ConfirmModalDesign, { ...props, children: _jsx("div", { className: cn(container), children: props.widgets?.map((widget, index) => (_createElement(ConfirmModalWidget, { ...widget, key: index }))) }), option: {
|
|
15
|
+
...props.option,
|
|
11
16
|
width: "md",
|
|
12
17
|
height: "lg",
|
|
13
18
|
} }));
|
|
14
19
|
}
|
|
20
|
+
function ConfirmModalWidget({ type, data }) {
|
|
21
|
+
if (type === "selectSwitch")
|
|
22
|
+
return _jsx(Select.Switch, { ...data });
|
|
23
|
+
if (type === "selectTag")
|
|
24
|
+
return _jsx(Select.Tag, { ...data });
|
|
25
|
+
if (type === "inputForm")
|
|
26
|
+
return _jsx(Input.Form, { ...data });
|
|
27
|
+
if (typeof type === "undefined")
|
|
28
|
+
return data;
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ConfirmModalProps } from "../../../interface/Modal";
|
|
2
|
-
declare function ConfirmModal(props: ConfirmModalProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare function ConfirmModal(props: Omit<ConfirmModalProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
declare namespace ConfirmModal {
|
|
4
4
|
var Alert: typeof import("./Alert").default;
|
|
5
5
|
var Input: typeof import("./Input").default;
|
|
6
6
|
var Reimage: typeof import("./Reimage").default;
|
|
7
|
-
var Switch: typeof import("./Switch").default;
|
|
8
7
|
var Tag: typeof import("./Tag").default;
|
|
9
8
|
}
|
|
10
9
|
export default ConfirmModal;
|
|
@@ -4,13 +4,11 @@ import Alert from "./Alert";
|
|
|
4
4
|
import Input from "./Input";
|
|
5
5
|
import Reimage from "./Reimage";
|
|
6
6
|
import Tag from "./Tag";
|
|
7
|
-
import Switch from "./Switch";
|
|
8
7
|
function ConfirmModal(props) {
|
|
9
8
|
return _jsx(Confirm, { ...props });
|
|
10
9
|
}
|
|
11
10
|
ConfirmModal.Alert = Alert;
|
|
12
11
|
ConfirmModal.Input = Input;
|
|
13
12
|
ConfirmModal.Reimage = Reimage;
|
|
14
|
-
ConfirmModal.Switch = Switch;
|
|
15
13
|
ConfirmModal.Tag = Tag;
|
|
16
14
|
export default ConfirmModal;
|
package/modal/template/Input.js
CHANGED
|
@@ -2,5 +2,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import ModalDesign from "../design/Modal.design";
|
|
3
3
|
export default function Input({ titles, showAction, option, state, }) {
|
|
4
4
|
const { buttons } = option ?? {};
|
|
5
|
-
return (_jsx(ModalDesign, { titles: titles, showAction: showAction, className: "pt-18 px-25"
|
|
5
|
+
return (_jsx(ModalDesign, { titles: titles, showAction: showAction, option: { buttons, className: "pt-18 px-25" }, children: _jsx("input", { className: "border-2 border-black w-80 h-8", value: state[0], onChange: (e) => state[1](e.target.value) }) }));
|
|
6
6
|
}
|
package/package.json
CHANGED
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.87
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { InputWidget } from "../../../interface";
|
|
2
|
-
export default function
|
|
2
|
+
export default function InputForm({ title, state, placeholder, isValid, type, button, maxLength, disabled, }: InputWidget): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { useRef, useState } from "react";
|
|
|
3
3
|
import { cn, gradient } from "../../../util";
|
|
4
4
|
import Label from "../Label";
|
|
5
5
|
import Obstacle from "../Obstacle";
|
|
6
|
-
export default function
|
|
6
|
+
export default function InputForm({ title, state, placeholder, isValid, type, button, maxLength, disabled, }) {
|
|
7
7
|
const [value, setValue] = state;
|
|
8
8
|
const [onFocus, setOnFocus] = useState(false);
|
|
9
9
|
const ref = useRef(null);
|
|
@@ -16,15 +16,20 @@ export default function LG({ state, placeholder, isValid, type, label, maxLength
|
|
|
16
16
|
fonts: "leading-none text-gray-medium font-pretendard-medium",
|
|
17
17
|
animation: value || onFocus ? "top-2.625 text-xs" : "top-4.375 text-base",
|
|
18
18
|
};
|
|
19
|
-
const styleByFlag = (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const styleByFlag = () => {
|
|
20
|
+
const gray = "bg-gray-light border-green-dark";
|
|
21
|
+
const green = "bg-green-dark/10 text-green-dark border-green-dark";
|
|
22
|
+
const red = "bg-crimson-burgundy/10 text-crimson-burgundy border-crimson-burgundy";
|
|
23
|
+
if (typeof isValid === "undefined")
|
|
24
|
+
return gray;
|
|
25
|
+
if (typeof isValid === "function")
|
|
26
|
+
return isValid(value ?? "") ? green : red;
|
|
27
|
+
if (isValid)
|
|
28
|
+
return green;
|
|
29
|
+
return red;
|
|
25
30
|
};
|
|
26
31
|
const inputBox = {
|
|
27
|
-
styles: styleByFlag(
|
|
32
|
+
styles: styleByFlag(),
|
|
28
33
|
sizes: "w-102.5 h-13.5",
|
|
29
34
|
paddings: `${placeholder && "pt-3"} pl-5`,
|
|
30
35
|
fonts: "text-sm",
|
|
@@ -34,16 +39,16 @@ export default function LG({ state, placeholder, isValid, type, label, maxLength
|
|
|
34
39
|
!(isValid === false) &&
|
|
35
40
|
"shadow-[0px_0px_10px_0px_rgba(16,86,82,0.38)]",
|
|
36
41
|
};
|
|
37
|
-
return (_jsxs("div", { className: cn(container), children: [_jsx("div", { onClick: () => ref.current?.focus(), className: cn(placeholderBox), children: placeholder }), _jsx("input", { ref: ref, className: cn(inputBox), value: value, onFocus: () => setOnFocus(true), onBlur: () => setOnFocus(false), onChange: (e) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
return (_jsxs("div", { children: [title && _jsx("div", { className: "text-gray-dark", children: title }), _jsxs("div", { className: cn(container), children: [_jsx("div", { onClick: () => ref.current?.focus(), className: cn(placeholderBox), children: placeholder }), _jsx("input", { ref: ref, className: cn(inputBox), value: value, onFocus: () => setOnFocus(true), onBlur: () => setOnFocus(false), onChange: (e) => {
|
|
43
|
+
if (maxLength && e.target.value.length > maxLength)
|
|
44
|
+
return;
|
|
45
|
+
setValue(e.target.value);
|
|
46
|
+
}, type: type ?? "text" }), button && (_jsx(Label.Button, { title: button.title, onClick: button.onClick, option: {
|
|
47
|
+
width: "sm",
|
|
48
|
+
height: "xs",
|
|
49
|
+
className: "absolute top-3.5 right-3.75",
|
|
50
|
+
background: button.option?.background ?? gradient.bg.greenToRed,
|
|
51
|
+
text: button.option?.text ?? "text-white",
|
|
52
|
+
...button.option,
|
|
53
|
+
} })), _jsx(Obstacle, { disabled: disabled })] })] }));
|
|
49
54
|
}
|
|
@@ -38,8 +38,6 @@ function SelectSwitch({ state, selectOptions: selectOptionsInput, option, }) {
|
|
|
38
38
|
textSizes: textSize[size ?? "md"],
|
|
39
39
|
styles: "rounded-full ",
|
|
40
40
|
});
|
|
41
|
-
return (_jsx("div", { className: cn(container), children: selectOptions?.map(({ value, icon, title }) => {
|
|
42
|
-
return (_jsxs("button", { onClick: () => state[1](value), className: cn(button(value === state[0])), children: [icon && _jsx("img", { src: icon }), _jsx("div", { children: title })] }));
|
|
43
|
-
}) }));
|
|
41
|
+
return (_jsx("div", { className: cn(container), children: selectOptions?.map(({ value, icon, title }) => (_jsxs("button", { onClick: () => state[1](value), className: cn(button(value === state[0])), children: [icon && _jsx("img", { src: icon }), _jsx("div", { children: title })] }, String(value)))) }));
|
|
44
42
|
}
|
|
45
43
|
export default SelectSwitch;
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
interface SelectTagProps<T> {
|
|
3
|
-
state: State<T[]>;
|
|
4
|
-
selectOptions: {
|
|
5
|
-
title: string;
|
|
6
|
-
value: T;
|
|
7
|
-
}[];
|
|
8
|
-
selectHow?: "one" | "plural";
|
|
9
|
-
option?: {
|
|
10
|
-
className?: string;
|
|
11
|
-
background?: string;
|
|
12
|
-
text?: string;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
1
|
+
import { SelectTagProps } from "../../../interface";
|
|
15
2
|
export default function SelectTag<T>(props: SelectTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ConfirmModalProps } from "../../../interface/Modal";
|
|
2
|
-
import { SelectSwitchProps } from "../../../interface/widget/Select";
|
|
3
|
-
interface SwitchModalProps<T> extends ConfirmModalProps {
|
|
4
|
-
switch: SelectSwitchProps<T>;
|
|
5
|
-
}
|
|
6
|
-
declare function SwitchModal<T>(props: SwitchModalProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export default SwitchModal;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Select } from "../../../widget";
|
|
3
|
-
import ConfirmModalDesign from "../../design/ConfirmModal.design";
|
|
4
|
-
import { cn } from "../../../util";
|
|
5
|
-
function SwitchModalDesign(props) {
|
|
6
|
-
const container = {
|
|
7
|
-
displays: "flex flex-col justify-center items-center",
|
|
8
|
-
sizes: "w-full",
|
|
9
|
-
};
|
|
10
|
-
return (_jsx(ConfirmModalDesign, { ...props, children: _jsx("div", { className: cn(container), children: props.children }) }));
|
|
11
|
-
}
|
|
12
|
-
function SwitchModal(props) {
|
|
13
|
-
return (_jsx(SwitchModalDesign, { ...props, children: _jsxs(_Fragment, { children: [_jsx(Select.Switch, { ...props.switch }), props.children] }) }));
|
|
14
|
-
}
|
|
15
|
-
export default SwitchModal;
|