@edu-tosel/design 1.0.125 → 1.0.126

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.125",
3
+ "version": "1.0.126",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.125
1
+ 1.0.126
@@ -17,6 +17,7 @@ const heightSize = {
17
17
  };
18
18
  export default function SelectLG({ state, selectOptions: selectOptionsInput, placeholder, option, }) {
19
19
  const selectOptions = selectOptionsInput?.map(toSelectOption);
20
+ const [filteredOptions, setFilteredOptions] = useState();
20
21
  const id = useId();
21
22
  const { isDark } = option ?? {};
22
23
  const { setIsOwn, setIsOwnId } = useActionStore();
@@ -25,7 +26,6 @@ export default function SelectLG({ state, selectOptions: selectOptionsInput, pla
25
26
  const [search, setSearch] = useState("");
26
27
  const [isOpen, setIsOpen] = useState(false);
27
28
  const [isHover, setIsHover] = useState(false);
28
- const [filteredOptions, setFilterdOptions] = useState();
29
29
  const [index, setIndex] = useState();
30
30
  const listRef = useRef(null);
31
31
  const itemRefs = useRef([]);
@@ -47,8 +47,9 @@ export default function SelectLG({ state, selectOptions: selectOptionsInput, pla
47
47
  }
48
48
  };
49
49
  useEffect(() => {
50
- setFilterdOptions(selectOptions?.filter(({ title }) => title?.includes(search)));
51
- }, [search, selectOptions]);
50
+ const responses = selectOptions?.filter(({ title }) => title?.includes(search));
51
+ setFilteredOptions(responses);
52
+ }, [search]);
52
53
  useEffect(() => {
53
54
  if (typeof index === "number" && itemRefs.current[index]) {
54
55
  itemRefs.current[index]?.scrollIntoView({ block: "nearest" });
@@ -105,7 +106,7 @@ export default function SelectLG({ state, selectOptions: selectOptionsInput, pla
105
106
  leave: { top: isLong ? 88 : 44 },
106
107
  config: { duration: 0 },
107
108
  });
108
- 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.value)?.title })) : (_jsx("div", { className: "text-xs pl-1", children: placeholder ?? "선택해주세요" })) }), inputTransition((styles, item) => isLong &&
109
+ return (_jsxs("div", { className: cn(container), onClick: () => setIsOwn(true), onKeyDown: onKeyDown, 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.value)?.title })) : (_jsx("div", { className: "text-xs pl-1", children: placeholder ?? "선택해주세요" })) }), inputTransition((styles, item) => isLong &&
109
110
  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
111
  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
112
  setValue(value);