@edu-tosel/design 1.0.90 → 1.0.91
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/interface/Modal.d.ts +10 -2
- package/interface/widget/Select.d.ts +8 -1
- package/modal/template/Confirm/Confirm.js +6 -1
- package/package.json +1 -1
- package/version.txt +1 -1
- package/widget/template/Pagination.d.ts +2 -3
- package/widget/template/Select/Handle.js +6 -4
- package/widget/template/Select/Pagination.d.ts +2 -0
- package/widget/template/Select/Pagination.js +27 -0
- package/widget/template/Select/Select.LG.js +3 -3
- package/widget/template/Select/Select.js +3 -3
- package/widget/template/Select/Switch.js +4 -2
- package/widget/template/Select/index.d.ts +2 -0
- package/widget/template/Select/index.js +9 -1
package/interface/Modal.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
|
+
import { InputWidget, SelectHandleProps, SelectPaginationProps, SelectSwitchProps, SelectTagProps } from "./widget";
|
|
5
5
|
interface Option {
|
|
6
6
|
className?: string;
|
|
7
7
|
width: Size;
|
|
@@ -25,15 +25,23 @@ interface ConfirmModalProps<T = any> extends ModalProps {
|
|
|
25
25
|
buttons: [Button, Button];
|
|
26
26
|
widgets?: ConfirmModalWidget<T>[];
|
|
27
27
|
}
|
|
28
|
-
type ConfirmModalWidget<T = string> = ConfirmModalSelectSwitchProps<T> | ConfirmModalSelectTagProps<T> | ConfirmModalInputFormProps | ConfirmModalNodeProps;
|
|
28
|
+
type ConfirmModalWidget<T = string> = ConfirmModalSelectSwitchProps<T> | ConfirmModalSelectHandleProps<T> | ConfirmModalSelectTagProps<T> | ConfirmModalPaginationProps<T> | ConfirmModalInputFormProps | ConfirmModalNodeProps;
|
|
29
29
|
interface ConfirmModalSelectSwitchProps<T> {
|
|
30
30
|
type: "selectSwitch";
|
|
31
31
|
data: SelectSwitchProps<T>;
|
|
32
32
|
}
|
|
33
|
+
interface ConfirmModalSelectHandleProps<T> {
|
|
34
|
+
type: "selectHandle";
|
|
35
|
+
data: SelectHandleProps<T>;
|
|
36
|
+
}
|
|
33
37
|
interface ConfirmModalSelectTagProps<T> {
|
|
34
38
|
type: "selectTag";
|
|
35
39
|
data: SelectTagProps<T>;
|
|
36
40
|
}
|
|
41
|
+
interface ConfirmModalPaginationProps<T> {
|
|
42
|
+
type: "selectPagination";
|
|
43
|
+
data: SelectPaginationProps<T>;
|
|
44
|
+
}
|
|
37
45
|
interface ConfirmModalInputFormProps {
|
|
38
46
|
type: "inputForm";
|
|
39
47
|
data: InputWidget;
|
|
@@ -2,8 +2,8 @@ import { Widget } from ".";
|
|
|
2
2
|
import { Size, State } from "../Property";
|
|
3
3
|
type SelectOptionTuple<T> = [T, string];
|
|
4
4
|
export interface SelectOption<T> {
|
|
5
|
-
title: string;
|
|
6
5
|
value: T;
|
|
6
|
+
title?: string;
|
|
7
7
|
icon?: string;
|
|
8
8
|
}
|
|
9
9
|
export type SelectOptionInput<T> = SelectOption<T> | SelectOptionTuple<T>;
|
|
@@ -42,4 +42,11 @@ export interface SelectHandleProps<T> {
|
|
|
42
42
|
className?: string;
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
+
export interface SelectPaginationProps<T> {
|
|
46
|
+
state: State<T>;
|
|
47
|
+
selectOptions: SelectOptionInput<T>[];
|
|
48
|
+
option?: {
|
|
49
|
+
className?: string;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
45
52
|
export {};
|
|
@@ -18,8 +18,13 @@ export default function Confirm(props) {
|
|
|
18
18
|
} }));
|
|
19
19
|
}
|
|
20
20
|
function ConfirmModalWidget({ type, data }) {
|
|
21
|
+
const arrange = "w-full justify-center flex";
|
|
21
22
|
if (type === "selectSwitch")
|
|
22
|
-
return _jsx(Select.Switch, { ...data });
|
|
23
|
+
return _jsx(Select.Switch, { ...data, option: { className: arrange } });
|
|
24
|
+
if (type === "selectHandle")
|
|
25
|
+
return _jsx(Select.Handle, { ...data, option: { className: arrange } });
|
|
26
|
+
if (type === "selectPagination")
|
|
27
|
+
return (_jsx(Select.Pagination, { ...data, option: { className: "flex w-full justify-end" } }));
|
|
23
28
|
if (type === "selectTag")
|
|
24
29
|
return _jsx(Select.Tag, { ...data });
|
|
25
30
|
if (type === "inputForm")
|
package/package.json
CHANGED
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.91
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { State } from "../../interface";
|
|
2
|
-
interface
|
|
2
|
+
export interface SelectPaginationProps<T> {
|
|
3
3
|
state: State<T>;
|
|
4
4
|
selectOptions: T[];
|
|
5
5
|
}
|
|
6
|
-
export default function Pagination<T>({ state, selectOptions, }:
|
|
7
|
-
export {};
|
|
6
|
+
export default function Pagination<T>({ state, selectOptions, }: SelectPaginationProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,10 +10,12 @@ export default function SelectHandle({ state, selectOptions: selectOptionsInput,
|
|
|
10
10
|
.map(({ value }) => value)
|
|
11
11
|
?.indexOf(state?.[0]);
|
|
12
12
|
const container = {
|
|
13
|
+
className,
|
|
14
|
+
};
|
|
15
|
+
const body = {
|
|
13
16
|
positions: "relative",
|
|
14
17
|
sizes: "w-102.5 h-10",
|
|
15
18
|
styles: "rounded-full bg-gray-light p-1.25",
|
|
16
|
-
className,
|
|
17
19
|
};
|
|
18
20
|
const area = {
|
|
19
21
|
sizes: `${widthSizes[Math.round(((valueIndex + 1) / length) * 100)]} h-7.5`,
|
|
@@ -26,7 +28,7 @@ export default function SelectHandle({ state, selectOptions: selectOptionsInput,
|
|
|
26
28
|
sizes: "w-5 h-5",
|
|
27
29
|
styles: "rounded-full bg-white",
|
|
28
30
|
};
|
|
29
|
-
return (
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
return (_jsx("div", { className: cn(container), children: _jsxs("div", { className: cn(body), children: [_jsx("div", { className: cn(area), children: _jsx("div", { className: cn(handle) }) }), _jsx("div", { className: "absolute flex w-full h-full top-0 left-0", children: selectOptions?.map(({ value }) => (_jsx("button", { onClick: () => {
|
|
32
|
+
return state?.[1](value);
|
|
33
|
+
}, className: "flex flex-1 h-10 " }, value))) })] }) }));
|
|
32
34
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../../util";
|
|
3
|
+
import { toSelectOption } from "../../../interface";
|
|
4
|
+
import SVG from "../../../asset/SVG";
|
|
5
|
+
export default function Pagination({ state, selectOptions: selectOptionsInput, option, }) {
|
|
6
|
+
const { className } = option ?? {};
|
|
7
|
+
const selectOptions = selectOptionsInput?.map(toSelectOption);
|
|
8
|
+
const [value, setValue] = state;
|
|
9
|
+
const container = {
|
|
10
|
+
className,
|
|
11
|
+
};
|
|
12
|
+
const body = {
|
|
13
|
+
displays: "flex items-center justify-between",
|
|
14
|
+
sizes: "w-23.5 h-6.25",
|
|
15
|
+
backgrounds: "bg-gray-dark",
|
|
16
|
+
boundaries: "rounded-full px-2.5",
|
|
17
|
+
fonts: "text-xs",
|
|
18
|
+
};
|
|
19
|
+
const index = selectOptions.indexOf(selectOptions.find((option) => option.value === value) ?? selectOptions[0]);
|
|
20
|
+
return (_jsx("div", { className: cn(container), children: _jsxs("div", { className: cn(body), children: [_jsx(SVG.Symbol.LessThan, { onClick: () => {
|
|
21
|
+
if (index > 0)
|
|
22
|
+
setValue(selectOptions[index - 1].value);
|
|
23
|
+
} }), _jsxs("div", { className: "flex items-center gap-x-[3px] text-white", children: [index + 1, _jsx("div", { className: "text-gray-medium text-base font-pretendard-bold", children: "/" }), selectOptions.length] }), _jsx(SVG.Symbol.GreaterThan, { onClick: () => {
|
|
24
|
+
if (index < selectOptions.length - 1)
|
|
25
|
+
setValue(selectOptions[index + 1].value);
|
|
26
|
+
} })] }) }));
|
|
27
|
+
}
|
|
@@ -36,7 +36,7 @@ export default function SelectLG({ state, selectOptions: selectOptionsInput, pla
|
|
|
36
36
|
if (typeof index === "undefined")
|
|
37
37
|
return setIndex(0);
|
|
38
38
|
if (e.key === "Enter") {
|
|
39
|
-
setText(filteredOptions[index]?.title);
|
|
39
|
+
setText(String(filteredOptions[index]?.title));
|
|
40
40
|
return setValue(filteredOptions[index]?.value);
|
|
41
41
|
}
|
|
42
42
|
if (e.key === "ArrowDown") {
|
|
@@ -47,7 +47,7 @@ export default function SelectLG({ state, selectOptions: selectOptionsInput, pla
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
useEffect(() => {
|
|
50
|
-
setFilterdOptions(selectOptions?.filter(({ title }) => title
|
|
50
|
+
setFilterdOptions(selectOptions?.filter(({ title }) => title?.includes(search)));
|
|
51
51
|
}, [search, selectOptions]);
|
|
52
52
|
useEffect(() => {
|
|
53
53
|
if (typeof index === "number" && itemRefs.current[index]) {
|
|
@@ -109,7 +109,7 @@ export default function SelectLG({ state, selectOptions: selectOptionsInput, pla
|
|
|
109
109
|
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) => {
|
|
110
110
|
return (item && (_jsx(animated.div, { style: styles, className: cn(body), ref: listRef, children: filteredOptions?.map(({ value, title }, order) => (_jsx("section", { children: _jsx("button", { ref: (el) => (itemRefs.current[order] = el), onClick: () => {
|
|
111
111
|
setValue(value);
|
|
112
|
-
setText(title);
|
|
112
|
+
setText(String(title));
|
|
113
113
|
return setIsOpen(false);
|
|
114
114
|
}, className: cn(label(order === index)), children: title }) }, id + value))) })));
|
|
115
115
|
})] }));
|
|
@@ -32,7 +32,7 @@ export default function Select({ state, selectOptions: selectOptionsInput, place
|
|
|
32
32
|
if (typeof index === "undefined")
|
|
33
33
|
return setIndex(0);
|
|
34
34
|
if (e.key === "Enter") {
|
|
35
|
-
setText(filteredOptions[index]?.title);
|
|
35
|
+
setText(String(filteredOptions[index]?.title));
|
|
36
36
|
return setValue(filteredOptions[index]?.value);
|
|
37
37
|
}
|
|
38
38
|
if (e.key === "ArrowDown")
|
|
@@ -41,7 +41,7 @@ export default function Select({ state, selectOptions: selectOptionsInput, place
|
|
|
41
41
|
return setIndex((index - 1 + filteredOptions.length) % filteredOptions.length);
|
|
42
42
|
};
|
|
43
43
|
useEffect(() => {
|
|
44
|
-
setFilterdOptions(selectOptions?.filter(({ title }) => text.includes(title)));
|
|
44
|
+
setFilterdOptions(selectOptions?.filter(({ title }) => text.includes(String(title))));
|
|
45
45
|
}, [search, selectOptions]);
|
|
46
46
|
// scrollIntoViews
|
|
47
47
|
const listRef = useRef(null);
|
|
@@ -113,7 +113,7 @@ export default function Select({ state, selectOptions: selectOptionsInput, place
|
|
|
113
113
|
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) => {
|
|
114
114
|
return (item && (_jsx(animated.div, { style: styles, className: cn(body), ref: listRef, children: filteredOptions?.map(({ value, title }, order) => (_jsx("section", { children: _jsx("button", { ref: (el) => (itemRefs.current[order] = el), onClick: () => {
|
|
115
115
|
setValue(value);
|
|
116
|
-
setText(title);
|
|
116
|
+
setText(String(title));
|
|
117
117
|
return setIsOpen(false);
|
|
118
118
|
}, className: cn(label, order === index ? "w-full" : "w-auto"), children: title }) }, id + value))) })));
|
|
119
119
|
})] }));
|
|
@@ -25,11 +25,13 @@ function SelectSwitch({ state, selectOptions: selectOptionsInput, option, }) {
|
|
|
25
25
|
const selectOptions = selectOptionsInput.map(toSelectOption);
|
|
26
26
|
const { text, size, className } = option ?? {};
|
|
27
27
|
const container = {
|
|
28
|
+
className,
|
|
29
|
+
};
|
|
30
|
+
const body = {
|
|
28
31
|
sizes: `${widthSize[size ?? "md"]} ${heightSize[size ?? "md"]}`,
|
|
29
32
|
displays: `flex ${gapSize[size ?? "md"]}`,
|
|
30
33
|
paddings: paddingSize[size ?? "md"],
|
|
31
34
|
styles: "rounded-full bg-gray-light",
|
|
32
|
-
className,
|
|
33
35
|
};
|
|
34
36
|
const button = (flag) => ({
|
|
35
37
|
displays: "flex flex-1 gap-x-3 justify-center items-center",
|
|
@@ -38,6 +40,6 @@ function SelectSwitch({ state, selectOptions: selectOptionsInput, option, }) {
|
|
|
38
40
|
textSizes: textSize[size ?? "md"],
|
|
39
41
|
styles: "rounded-full ",
|
|
40
42
|
});
|
|
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)))) }));
|
|
43
|
+
return (_jsx("div", { className: cn(container), children: _jsx("div", { className: cn(body), 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)))) }) }));
|
|
42
44
|
}
|
|
43
45
|
export default SelectSwitch;
|
|
@@ -4,11 +4,13 @@ import Tag from "./Tag";
|
|
|
4
4
|
import Handle from "./Handle";
|
|
5
5
|
import Switch from "./Switch";
|
|
6
6
|
import Swipe from "./Swipe";
|
|
7
|
+
import Pagination from "./Pagination";
|
|
7
8
|
declare const Select: typeof _Select & {
|
|
8
9
|
LG: typeof LG;
|
|
9
10
|
Tag: typeof Tag;
|
|
10
11
|
Handle: typeof Handle;
|
|
11
12
|
Switch: typeof Switch;
|
|
12
13
|
Swipe: typeof Swipe;
|
|
14
|
+
Pagination: typeof Pagination;
|
|
13
15
|
};
|
|
14
16
|
export default Select;
|
|
@@ -4,5 +4,13 @@ import Tag from "./Tag";
|
|
|
4
4
|
import Handle from "./Handle";
|
|
5
5
|
import Switch from "./Switch";
|
|
6
6
|
import Swipe from "./Swipe";
|
|
7
|
-
|
|
7
|
+
import Pagination from "./Pagination";
|
|
8
|
+
const Select = Object.assign(_Select, {
|
|
9
|
+
LG,
|
|
10
|
+
Tag,
|
|
11
|
+
Handle,
|
|
12
|
+
Switch,
|
|
13
|
+
Swipe,
|
|
14
|
+
Pagination,
|
|
15
|
+
});
|
|
8
16
|
export default Select;
|