@edu-tosel/design 1.0.309 → 1.0.311
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/package.json
CHANGED
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.311
|
|
@@ -3,7 +3,7 @@ import { cn } from "../../../util";
|
|
|
3
3
|
import { selectOne, selectPlural } from "../../../util/select";
|
|
4
4
|
export default function SelectTag(props) {
|
|
5
5
|
const { state, selectOptions, selectHow, option } = props;
|
|
6
|
-
const { className, background, text } = option || {
|
|
6
|
+
const { className, background, text, unselectedHoverBackground, unselectedHoverText, } = option || {
|
|
7
7
|
selectHow: "plural",
|
|
8
8
|
};
|
|
9
9
|
const container = {
|
|
@@ -15,14 +15,29 @@ export default function SelectTag(props) {
|
|
|
15
15
|
background ?? "bg-green-dark",
|
|
16
16
|
text ?? "text-white",
|
|
17
17
|
].join(" ");
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
const unselectedHoverStyle = [
|
|
19
|
+
unselectedHoverBackground
|
|
20
|
+
? unselectedHoverBackground.startsWith("hover:")
|
|
21
|
+
? unselectedHoverBackground
|
|
22
|
+
: `hover:${unselectedHoverBackground.replace("bg-", "")}`
|
|
23
|
+
: "hover:bg-gray-light",
|
|
24
|
+
unselectedHoverText
|
|
25
|
+
? unselectedHoverText.startsWith("hover:")
|
|
26
|
+
? unselectedHoverText
|
|
27
|
+
: `hover:${unselectedHoverText.replace("text-", "")}`
|
|
28
|
+
: "hover:text-gray-dark",
|
|
29
|
+
].join(" ");
|
|
30
|
+
const button = (key) => {
|
|
31
|
+
const isSelected = state[0].includes(key);
|
|
32
|
+
return {
|
|
33
|
+
sizes: "h-10",
|
|
34
|
+
styles: "rounded-md",
|
|
35
|
+
animations: "duration-300 transition-all",
|
|
36
|
+
boundaries: isSelected
|
|
37
|
+
? isSelectedStyle // 선택된 태그는 호버 스타일 제거
|
|
38
|
+
: `bg-gray-light/50 text-gray-medium/80 ${unselectedHoverStyle}`,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
26
41
|
return (_jsx("div", { className: cn(container), children: selectOptions.map(({ title, value }) => (_jsx("button", { onClick: () => selectHow === "one"
|
|
27
42
|
? selectOne({ state, key: value })
|
|
28
43
|
: selectPlural({ state, key: value }), className: cn(button(value)), children: title }, value))) }));
|
|
@@ -6,17 +6,21 @@ export default function SelectToggle({ state, selectOptions: selectOptionsInput,
|
|
|
6
6
|
const [value, setValue] = state;
|
|
7
7
|
const isOff = value === selectOptions[0].value;
|
|
8
8
|
const container = {
|
|
9
|
-
positions: "relative",
|
|
10
9
|
displays: "flex items-center",
|
|
11
|
-
sizes: "w-10 h-
|
|
10
|
+
sizes: "w-10 h-fit",
|
|
12
11
|
backgrounds: isOff ? "bg-crimson-burgundy" : "bg-green-dark",
|
|
13
12
|
boundaries: "rounded-full p-0.5",
|
|
13
|
+
animations: "duration-300",
|
|
14
14
|
};
|
|
15
|
-
const
|
|
15
|
+
const knobWrapper = {
|
|
16
|
+
displays: "relative",
|
|
17
|
+
sizes: "w-full h-4",
|
|
18
|
+
};
|
|
19
|
+
const knob = {
|
|
16
20
|
positions: "absolute",
|
|
17
|
-
locations: isOff ? "left-0
|
|
18
|
-
sizes: "
|
|
19
|
-
backgrounds: "bg-white",
|
|
21
|
+
locations: isOff ? "left-0" : "left-[calc(100%-1rem)]",
|
|
22
|
+
sizes: "size-4",
|
|
23
|
+
backgrounds: "bg-white shadow-main",
|
|
20
24
|
boundaries: "rounded-full",
|
|
21
25
|
animations: "duration-200",
|
|
22
26
|
};
|
|
@@ -26,5 +30,5 @@ export default function SelectToggle({ state, selectOptions: selectOptionsInput,
|
|
|
26
30
|
return setValue(selectOptions[0].value);
|
|
27
31
|
};
|
|
28
32
|
const selectedTitle = selectOptions?.find((option) => option.value === value)?.title;
|
|
29
|
-
return (_jsxs("div", { className: "flex items-center gap-x-1.5 ", children: [selectedTitle && option?.isText && (_jsx("div", { className: "text-sm leading-none", children: selectedTitle })), _jsx("button", { onClick: toggle, className: cn(container), children: _jsx("div", { className: cn(
|
|
33
|
+
return (_jsxs("div", { className: "flex items-center gap-x-1.5 ", children: [selectedTitle && option?.isText && (_jsx("div", { className: "text-sm leading-none", children: selectedTitle })), _jsx("button", { onClick: toggle, className: cn(container), children: _jsx("div", { className: cn(knobWrapper), children: _jsx("div", { className: cn(knob) }) }) })] }));
|
|
30
34
|
}
|