@edu-tosel/design 1.0.70 → 1.0.72

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.
@@ -19,6 +19,7 @@ export interface Widget {
19
19
  text?: string;
20
20
  disabled?: Disabled;
21
21
  rounded?: string;
22
+ isDark?: boolean;
22
23
  };
23
24
  }
24
25
  export interface LabelWidget extends Widget {
@@ -34,11 +34,14 @@ export default function SelectRoll({ item, entry, state, data, }) {
34
34
  useEffect(() => {
35
35
  setRows(rows?.map((row) => {
36
36
  if (row === item) {
37
- return { ...row, [key]: keys[index] };
37
+ const temp = { ...row, [key]: keys[index] };
38
+ console.log("temp", temp);
39
+ return temp;
38
40
  }
41
+ console.log("not changed");
39
42
  return row;
40
43
  }));
41
- }, [index]);
44
+ }, [index, setIndex]);
42
45
  return (_jsx("div", { className: cn(container), children: _jsxs("div", { className: cn(body), onMouseLeave: () => setIsHover(false), onMouseEnter: () => setIsHover(true), children: [values[index], _jsx("button", { onClick: () => {
43
46
  if (index > 0) {
44
47
  setIndex(index - 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
package/store/index.d.ts CHANGED
@@ -19,6 +19,7 @@ interface ActionProps {
19
19
  isOwnId: string;
20
20
  setIsOwnId: (prop: string) => void;
21
21
  isDark: boolean;
22
+ dark: () => void;
22
23
  setDark: () => void;
23
24
  }
24
25
  export declare const useActionStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ActionProps>>;
package/store/index.js CHANGED
@@ -65,5 +65,6 @@ export const useActionStore = create((set) => ({
65
65
  isOwnId: "",
66
66
  setIsOwnId: (prop) => set({ isOwnId: prop }),
67
67
  isDark: false,
68
+ dark: () => set(() => ({ isDark: true })),
68
69
  setDark: () => set((state) => ({ isDark: !state.isDark })),
69
70
  }));
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.70
1
+ 1.0.72
@@ -16,6 +16,7 @@ const heightSize = {
16
16
  };
17
17
  export default function SelectLG({ state, selectOptions, placeholder, option, }) {
18
18
  const id = useId();
19
+ const { isDark } = option ?? {};
19
20
  const { setIsOwn, setIsOwnId } = useActionStore();
20
21
  const [value, setValue] = state;
21
22
  const [text, setText] = useState("");
@@ -60,6 +61,7 @@ export default function SelectLG({ state, selectOptions, placeholder, option, })
60
61
  displays: "flex items-center",
61
62
  sizes: `${widthSize[option?.width ?? "md"]} ${heightSize[option?.height ?? "sm"]}`,
62
63
  styles: "pl-1 rounded-md focus:outline-none duration-100 text-gray-400",
64
+ backgrounds: isDark && "bg-[#282828]",
63
65
  shadow: isOpen || isHover ? "box-shadow" : "shadow-none",
64
66
  };
65
67
  const input = {
@@ -72,15 +74,23 @@ export default function SelectLG({ state, selectOptions, placeholder, option, })
72
74
  displays: "flex flex-col gap-1",
73
75
  sizes: `${widthSize[option?.width ?? "md"]} min-h-6.5 max-h-40`,
74
76
  paddings: "p-2",
75
- styles: "bg-white box-shadow rounded-md box-shadow overflow-y-scroll",
77
+ backgrounds: !isDark ? "bg-white" : "bg-[#282828]",
78
+ styles: "box-shadow rounded-md box-shadow overflow-y-scroll",
76
79
  };
77
- const label = {
80
+ const label = (flag) => ({
78
81
  displays: "flex items-center",
79
82
  sizes: "h-7 w-full",
80
83
  paddings: "px-2",
81
84
  styles: "rounded-sm duration-500",
82
- fonts: "text-xs text-gray-dim hover:bg-green-dark hover:text-white",
83
- };
85
+ backgrounds: !flag
86
+ ? !isDark
87
+ ? "hover:bg-green-dark"
88
+ : "bg-[#282828] hover:bg-[#8F7B39] "
89
+ : !isDark
90
+ ? "bg-green-dark"
91
+ : "bg-[#8F7B39]",
92
+ fonts: !isDark ? "text-xs text-gray-dim hover:text-white" : "text-white ",
93
+ });
84
94
  const inputTransition = useTransition(isOpen, {
85
95
  from: { top: 44 },
86
96
  enter: { top: 44 },
@@ -93,14 +103,12 @@ export default function SelectLG({ state, selectOptions, placeholder, option, })
93
103
  leave: { top: isLong ? 88 : 44 },
94
104
  config: { duration: 0 },
95
105
  });
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 &&
106
+ 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(false)), children: selectOptions?.find((option) => value === option[0])?.[1] })) : (_jsx("div", { className: "text-xs pl-1", children: placeholder ?? "선택해주세요" })) }), inputTransition((styles, item) => isLong &&
97
107
  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
108
  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
109
  setValue(value);
100
110
  setText(text);
101
111
  return setIsOpen(false);
102
- }, className: cn(label, order === index
103
- ? "bg-green-dark text-white w-full"
104
- : "w-auto"), children: text }) }, id + value))) })));
112
+ }, className: cn(label(order === index)), children: text }) }, id + value))) })));
105
113
  })] }));
106
114
  }