@edu-tosel/design 1.0.306 → 1.0.307

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/asset/SVG.d.ts CHANGED
@@ -73,5 +73,9 @@ declare const SVG: {
73
73
  Search: typeof Search;
74
74
  MiniClose: typeof MiniClose;
75
75
  MiniCheck: typeof MiniCheck;
76
+ TestOption: {
77
+ Home: ({ color }: import("./svg/TestOption").TestOptionProps) => import("react/jsx-runtime").JSX.Element;
78
+ Official: ({ color }: import("./svg/TestOption").TestOptionProps) => import("react/jsx-runtime").JSX.Element;
79
+ };
76
80
  };
77
81
  export default SVG;
package/asset/SVG.js CHANGED
@@ -18,6 +18,7 @@ import User from "./svg/User";
18
18
  import Search from "./svg/Search";
19
19
  import MiniClose from "./svg/MiniClose";
20
20
  import MiniCheck from "./svg/MiniCheck";
21
+ import TestOption from "./svg/TestOption";
21
22
  const SVG = {
22
23
  TOSEL,
23
24
  Close,
@@ -39,5 +40,6 @@ const SVG = {
39
40
  Search,
40
41
  MiniClose,
41
42
  MiniCheck,
43
+ TestOption,
42
44
  };
43
45
  export default SVG;
package/asset/SVG.tsx CHANGED
@@ -18,6 +18,7 @@ import User from "./svg/User";
18
18
  import Search from "./svg/Search";
19
19
  import MiniClose from "./svg/MiniClose";
20
20
  import MiniCheck from "./svg/MiniCheck";
21
+ import TestOption from "./svg/TestOption";
21
22
 
22
23
  const SVG = {
23
24
  TOSEL,
@@ -40,6 +41,7 @@ const SVG = {
40
41
  Search,
41
42
  MiniClose,
42
43
  MiniCheck,
44
+ TestOption,
43
45
  };
44
46
 
45
47
  export default SVG;
@@ -0,0 +1,10 @@
1
+ export interface TestOptionProps {
2
+ color?: string;
3
+ }
4
+ declare const TestOption: {
5
+ Home: typeof Home;
6
+ Official: typeof Official;
7
+ };
8
+ declare function Home({ color }: TestOptionProps): import("react/jsx-runtime").JSX.Element;
9
+ declare function Official({ color }: TestOptionProps): import("react/jsx-runtime").JSX.Element;
10
+ export default TestOption;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../util";
3
+ const TestOption = {
4
+ Home,
5
+ Official,
6
+ };
7
+ function Home({ color }) {
8
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: cn("size-6", color || "text-white"), children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" }) }));
9
+ }
10
+ function Official({ color }) {
11
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: cn("size-6", color || "text-white"), children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M12 21v-8.25M15.75 21v-8.25M8.25 21v-8.25M3 9l9-6 9 6m-1.5 12V10.332A48.36 48.36 0 0 0 12 9.75c-2.551 0-5.056.2-7.5.582V21M3 21h18M12 6.75h.008v.008H12V6.75Z" }) }));
12
+ }
13
+ export default TestOption;
@@ -0,0 +1,51 @@
1
+ import { OnClick } from "../../interface";
2
+ import { cn } from "../../util";
3
+
4
+ export interface TestOptionProps {
5
+ color?: string; // 테일윈드 텍스트 색상 클래스 (예: "text-red-500", "text-blue-400")
6
+ }
7
+
8
+ const TestOption = {
9
+ Home,
10
+ Official,
11
+ };
12
+
13
+ function Home({ color }: TestOptionProps) {
14
+ return (
15
+ <svg
16
+ xmlns="http://www.w3.org/2000/svg"
17
+ fill="none"
18
+ viewBox="0 0 24 24"
19
+ stroke-width="1.5"
20
+ stroke="currentColor"
21
+ className={cn("size-6", color || "text-white")}
22
+ >
23
+ <path
24
+ stroke-linecap="round"
25
+ stroke-linejoin="round"
26
+ d="m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"
27
+ />
28
+ </svg>
29
+ );
30
+ }
31
+
32
+ function Official({ color }: TestOptionProps) {
33
+ return (
34
+ <svg
35
+ xmlns="http://www.w3.org/2000/svg"
36
+ fill="none"
37
+ viewBox="0 0 24 24"
38
+ stroke-width="1.5"
39
+ stroke="currentColor"
40
+ className={cn("size-6", color || "text-white")}
41
+ >
42
+ <path
43
+ stroke-linecap="round"
44
+ stroke-linejoin="round"
45
+ d="M12 21v-8.25M15.75 21v-8.25M8.25 21v-8.25M3 9l9-6 9 6m-1.5 12V10.332A48.36 48.36 0 0 0 12 9.75c-2.551 0-5.056.2-7.5.582V21M3 21h18M12 6.75h.008v.008H12V6.75Z"
46
+ />
47
+ </svg>
48
+ );
49
+ }
50
+
51
+ export default TestOption;
@@ -13,10 +13,6 @@ export default function RollCardDesign({ titles, state, disabled, isFixed, child
13
13
  useEffect(() => {
14
14
  if (isFixed) {
15
15
  setFlag(true);
16
- const timer = setTimeout(() => {
17
- setFlag(false);
18
- }, 800);
19
- return () => clearTimeout(timer);
20
16
  }
21
17
  }, [isFixed]);
22
18
  const childBox = {
@@ -27,7 +23,8 @@ export default function RollCardDesign({ titles, state, disabled, isFixed, child
27
23
  return (_jsxs(Card, { option: {
28
24
  width: "3xl",
29
25
  height: isMobile ? (!isFixed && isOpen ? "2xs" : "4xs") : "2xs",
30
- background: isDisabled || flag ? "bg-green-dark/10" : "bg-white",
26
+ background: isDisabled || flag ? "bg-green-light" : "bg-white",
27
+ boundary: isFixed ? "" : "shadow-main hover:shadow-green", // isFixed일 때 그림자 제거
31
28
  className: "p-7.5 flex flex-col gap-y-6",
32
29
  }, children: [_jsxs("div", { className: "flex flex-col gap-y-3.5 sm:flex-row justify-between", children: [_jsxs(Shelf.Col, { className: "gap-y-2.5", children: [_jsxs("div", { className: "flex 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 justify-between sm:justify-start gap-3.5 items-center", children: [_jsx(Label, { title: !isDisabled
33
30
  ? isFixed
@@ -1,10 +1,12 @@
1
1
  import { Widget } from ".";
2
2
  import { Size, State } from "../Property";
3
+ import { ReactNode } from "react";
3
4
  type SelectOptionTuple<T> = [T, string];
4
5
  export interface SelectOption<T> {
5
6
  value: T;
6
7
  title?: string;
7
8
  icon?: string;
9
+ iconComponent?: ReactNode;
8
10
  }
9
11
  export type SelectOptionInput<T> = SelectOption<T> | SelectOptionTuple<T>;
10
12
  export declare function toSelectOption<T>(option: SelectOptionInput<T>): SelectOption<T>;
@@ -19,6 +21,8 @@ export interface SelectSwitchProps<T> {
19
21
  option?: {
20
22
  size?: Size;
21
23
  text?: string;
24
+ selectedText?: string;
25
+ unselectedText?: string;
22
26
  className?: string;
23
27
  };
24
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.306",
3
+ "version": "1.0.307",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.306
1
+ 1.0.307
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { toSelectOption, } from "../../../interface/widget/Select";
3
3
  import { cn } from "../../../util";
4
+ import React from "react";
4
5
  const paddingSize = {
5
6
  sm: "p-1",
6
7
  md: "p-1.5",
@@ -38,7 +39,7 @@ const boundarySize = {
38
39
  };
39
40
  function SelectSwitch({ state, selectOptions: selectOptionsInput, option, }) {
40
41
  const selectOptions = selectOptionsInput.map(toSelectOption);
41
- const { text, size, className } = option ?? {};
42
+ const { text, selectedText, unselectedText, size, className } = option ?? {};
42
43
  const container = {
43
44
  className,
44
45
  };
@@ -51,12 +52,28 @@ function SelectSwitch({ state, selectOptions: selectOptionsInput, option, }) {
51
52
  };
52
53
  const button = (flag) => ({
53
54
  displays: "flex flex-1 gap-x-3 justify-center items-center",
54
- backgrounds: flag ? "bg-white" : "bg-transparent",
55
+ backgrounds: flag ? "bg-white shadow-main" : "bg-transparent",
55
56
  sizes: size === "sm" && buttonSize[size ?? "sm"],
56
- text,
57
+ text: flag ? selectedText || text : unselectedText || text, // 선택 상태에 따라 다른 텍스트 스타일 적용
57
58
  textSizes: textSize[size ?? "md"],
58
59
  boundaries: boundarySize[size ?? "md"],
60
+ animations: !flag && "hover:bg-white/50",
59
61
  });
60
- 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)))) }) }));
62
+ return (_jsx("div", { className: cn(container), children: _jsx("div", { className: cn(body), children: selectOptions?.map(({ value, icon, iconComponent, title }) => {
63
+ const isSelected = value === state[0];
64
+ const currentTextColor = isSelected
65
+ ? selectedText || text
66
+ : unselectedText || text;
67
+ return (_jsxs("button", { onClick: () => state[1](value), className: cn(button(isSelected)), children: [iconComponent
68
+ ? typeof iconComponent === "object" &&
69
+ iconComponent !== null &&
70
+ "type" in iconComponent
71
+ ? // React 컴포넌트인 경우 color prop을 추가해서 클론
72
+ React.cloneElement(iconComponent, {
73
+ color: currentTextColor,
74
+ })
75
+ : iconComponent
76
+ : icon && _jsx("img", { src: icon }), _jsx("div", { children: title })] }, String(value)));
77
+ }) }) }));
61
78
  }
62
79
  export default SelectSwitch;