@edu-tosel/design 1.0.53 → 1.0.55
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 +42 -42
- package/asset/SVG.d.ts +1 -0
- package/asset/SVG.tsx +27 -27
- package/asset/svg/Close.tsx +32 -32
- package/asset/svg/Direction.tsx +36 -36
- package/asset/svg/Email.tsx +20 -20
- package/asset/svg/Icon.tsx +186 -186
- package/asset/svg/Image.tsx +24 -24
- package/asset/svg/Notification.tsx +34 -34
- package/asset/svg/Operation.d.ts +2 -0
- package/asset/svg/Operation.js +4 -0
- package/asset/svg/Operation.tsx +130 -104
- package/asset/svg/Phone.tsx +20 -20
- package/asset/svg/Profile.tsx +27 -27
- package/asset/svg/Symbol.tsx +60 -60
- package/asset/svg/TOSEL.tsx +63 -63
- package/card/design/RollCard.design.d.ts +1 -1
- package/card/design/RollCard.design.js +13 -6
- package/globals.css +226 -226
- package/interface/Card.d.ts +1 -1
- package/modal/template/Postcode.js +6 -4
- package/package.json +1 -1
- package/tailwind.config.ts +619 -619
- package/version.txt +1 -1
- package/widget/template/Select/Select.LG.d.ts +1 -1
- package/widget/template/Select/Select.LG.js +75 -14
- package/widget/template/Select/Select.js +1 -1
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.55
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { HTMLSelectElement } from "../../../interface";
|
|
2
|
-
export default function SelectLG<T>({ state, }: HTMLSelectElement<T>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function SelectLG<T>({ state, selectOptions, placeholder, options, }: HTMLSelectElement<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useId, useState } from "react";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
3
3
|
import { useActionStore } from "../../../store";
|
|
4
4
|
import { useFlag } from "../../../hook";
|
|
5
|
-
|
|
5
|
+
import { cn } from "../../../util";
|
|
6
|
+
import { useTransition, animated } from "react-spring";
|
|
6
7
|
const widthSize = {
|
|
7
8
|
xs: "w-10",
|
|
8
9
|
sm: "w-22.5",
|
|
9
|
-
md: "w-
|
|
10
|
+
md: "w-38",
|
|
10
11
|
lg: "w-50",
|
|
11
12
|
};
|
|
12
13
|
const heightSize = {
|
|
13
14
|
xs: "h-6.5",
|
|
15
|
+
sm: "h-9",
|
|
14
16
|
};
|
|
15
|
-
export default function SelectLG({ state,
|
|
16
|
-
// selectOptions,
|
|
17
|
-
// placeholder,
|
|
18
|
-
// options,
|
|
19
|
-
}) {
|
|
17
|
+
export default function SelectLG({ state, selectOptions, placeholder, options, }) {
|
|
20
18
|
const id = useId();
|
|
21
19
|
const { setIsOwn, setIsOwnId } = useActionStore();
|
|
22
20
|
const [value, setValue] = state;
|
|
@@ -26,6 +24,8 @@ export default function SelectLG({ state,
|
|
|
26
24
|
const [isHover, setIsHover] = useState(false);
|
|
27
25
|
const [filteredOptions, setFilterdOptions] = useState([]);
|
|
28
26
|
const [index, setIndex] = useState();
|
|
27
|
+
const listRef = useRef(null);
|
|
28
|
+
const itemRefs = useRef([]);
|
|
29
29
|
useFlag({ state: [false, setIsOpen], safe: "overlay" });
|
|
30
30
|
const onKeyDown = (e) => {
|
|
31
31
|
if (!filteredOptions)
|
|
@@ -36,10 +36,71 @@ export default function SelectLG({ state,
|
|
|
36
36
|
setText(filteredOptions[index][1]);
|
|
37
37
|
return setValue(filteredOptions[index][0]);
|
|
38
38
|
}
|
|
39
|
-
if (e.key === "ArrowDown")
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
if (e.key === "ArrowDown") {
|
|
40
|
+
setIndex((index + 1) % filteredOptions.length);
|
|
41
|
+
}
|
|
42
|
+
if (e.key === "ArrowUp") {
|
|
43
|
+
setIndex((index - 1 + filteredOptions.length) % filteredOptions.length);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
setFilterdOptions(selectOptions?.filter(([_, text]) => text.includes(search)));
|
|
48
|
+
}, [search, selectOptions]);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (typeof index === "number" && itemRefs.current[index]) {
|
|
51
|
+
itemRefs.current[index]?.scrollIntoView({ block: "nearest" });
|
|
52
|
+
}
|
|
53
|
+
}, [index]);
|
|
54
|
+
const isLong = selectOptions && selectOptions.length >= 4;
|
|
55
|
+
const container = {
|
|
56
|
+
positions: "relative ",
|
|
57
|
+
displays: "flex flex-col",
|
|
58
|
+
};
|
|
59
|
+
const button = {
|
|
60
|
+
displays: "flex items-center",
|
|
61
|
+
sizes: `${widthSize[options?.width ?? "md"]} ${heightSize[options?.height ?? "sm"]}`,
|
|
62
|
+
styles: "pl-1 rounded-md focus:outline-none duration-100 text-gray-400",
|
|
63
|
+
shadow: isOpen || isHover ? "box-shadow" : "shadow-none",
|
|
64
|
+
};
|
|
65
|
+
const input = {
|
|
66
|
+
positions: "absolute z-30",
|
|
67
|
+
layouts: cn(button),
|
|
68
|
+
styles: "focus:outline-none text-xs pl-1.5",
|
|
69
|
+
};
|
|
70
|
+
const body = {
|
|
71
|
+
positions: "absolute z-30",
|
|
72
|
+
displays: "flex flex-col gap-1",
|
|
73
|
+
sizes: `${widthSize[options?.width ?? "md"]} min-h-6.5 max-h-40`,
|
|
74
|
+
paddings: "p-2",
|
|
75
|
+
styles: "bg-white box-shadow rounded-md box-shadow overflow-y-scroll",
|
|
76
|
+
};
|
|
77
|
+
const label = {
|
|
78
|
+
displays: "flex items-center",
|
|
79
|
+
sizes: "h-7 w-full",
|
|
80
|
+
paddings: "px-2",
|
|
81
|
+
styles: "rounded-sm duration-500",
|
|
82
|
+
fonts: "text-xs text-gray-dim hover:bg-green-dark hover:text-white",
|
|
43
83
|
};
|
|
44
|
-
|
|
84
|
+
const inputTransition = useTransition(isOpen, {
|
|
85
|
+
from: { top: 44 },
|
|
86
|
+
enter: { top: 44 },
|
|
87
|
+
leave: { top: 44 },
|
|
88
|
+
config: { duration: 0 },
|
|
89
|
+
});
|
|
90
|
+
const bodyTransitions = useTransition(isOpen, {
|
|
91
|
+
from: { top: isLong ? 88 : 44 },
|
|
92
|
+
enter: { top: isLong ? 88 : 44 },
|
|
93
|
+
leave: { top: isLong ? 88 : 44 },
|
|
94
|
+
config: { duration: 0 },
|
|
95
|
+
});
|
|
96
|
+
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 &&
|
|
97
|
+
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) => {
|
|
98
|
+
return (item && (_jsx(animated.div, { style: styles, className: cn(body), ref: listRef, children: filteredOptions?.map(([value, text], order) => (_jsx("section", { children: _jsx("button", { ref: (el) => (itemRefs.current[order] = el), onClick: () => {
|
|
99
|
+
setValue(value);
|
|
100
|
+
setText(text);
|
|
101
|
+
return setIsOpen(false);
|
|
102
|
+
}, className: cn(label, order === index
|
|
103
|
+
? "bg-green-dark text-white w-full"
|
|
104
|
+
: "w-auto"), children: text }) }, id + value))) })));
|
|
105
|
+
})] }));
|
|
45
106
|
}
|