@edu-tosel/design 1.0.78 → 1.0.80

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.
@@ -5,6 +5,7 @@ import { cn, sortByOrder } from "../../util";
5
5
  import Card from "./Card.design";
6
6
  import { DataField, Action, Row, Lock } from "../..";
7
7
  import { Obstacle } from "../..";
8
+ import { v4 } from "uuid";
8
9
  export default function TableCardDesign({ dataSet, dataField, option, }) {
9
10
  const { width, height, padding, boundary, isDisabled, disabledScript } = option ?? {};
10
11
  const { order } = useActionStore();
@@ -21,7 +22,12 @@ export default function TableCardDesign({ dataSet, dataField, option, }) {
21
22
  height: height ?? "3xl",
22
23
  overflow: "overflow-y-scroll overflow-x-hidden",
23
24
  noPadding: true,
24
- }, children: _jsxs(Action.Replace, { actions: dataSet?.replaces, children: [sortByOrder({ items: dataSet?.items, orders }).map((item, index) => dataSet.renderItem ? (dataSet.renderItem(item)) : (_jsx(Row.Card, { item: item, onClick: () => dataSet.onClick?.(item), dataField: dataField, height: option?.rowHeight, noHover: option?.noHover, noPadding: option?.noRowPadding }, id + index))), _jsx(Obstacle, { disabled: isDisabled }), _jsx(Obstacle.Blur, { disabled: isDisabled, option: {
25
+ }, children: _jsxs(Action.Replace, { actions: dataSet?.replaces, children: [sortByOrder({ items: dataSet?.items, orders }).map((item) => {
26
+ const uuid = v4();
27
+ if (dataSet.renderItem)
28
+ return dataSet.renderItem(item);
29
+ return (_jsx(Row.Card, { item: item, onClick: () => dataSet.onClick?.(item), dataField: dataField, height: option?.rowHeight, noHover: option?.noHover, noPadding: option?.noRowPadding }, uuid));
30
+ }), _jsx(Obstacle, { disabled: isDisabled }), _jsx(Obstacle.Blur, { disabled: isDisabled, option: {
25
31
  position: "top-10",
26
32
  }, children: _jsx(Lock, { script: disabledScript }) })] }) }));
27
33
  }
@@ -50,6 +50,6 @@ export interface RowElementProps<T> {
50
50
  item: T;
51
51
  entry: [string, unknown];
52
52
  stateAction?: (item: T) => void;
53
- data?: DataFieldType;
53
+ data?: DataFieldType<T>;
54
54
  }
55
55
  export {};
@@ -12,15 +12,15 @@ export type DataSet<T = any> = {
12
12
  onClick?: OnClick<T>;
13
13
  replaces?: Replace[];
14
14
  };
15
- type DataFieldProps = {
15
+ type DataFieldProps<T> = {
16
16
  title: string | number;
17
17
  size: string | number;
18
- data?: DataFieldType;
18
+ data?: DataFieldType<T>;
19
19
  };
20
20
  export type DataField<T = any> = Partial<{
21
- [p in keyof T]: Partial<DataFieldProps>;
21
+ [p in keyof T]: Partial<DataFieldProps<T>>;
22
22
  }>;
23
- export type DataFieldType = DataFiledTypeText | DataSelectRoll | DataButton;
23
+ export type DataFieldType<T> = DataFiledTypeText | DataSelectRoll | DataButton<T>;
24
24
  type DataFiledTypeText = {
25
25
  type: "text";
26
26
  };
@@ -37,15 +37,15 @@ type DataSelectRoll = {
37
37
  options: SelectRollOption[];
38
38
  };
39
39
  declare function isDataSelectRoll(obj: any): obj is DataSelectRoll;
40
- type DataButton = {
40
+ type DataButton<T> = {
41
41
  type: "button";
42
- onClick: OnClick;
42
+ onClick: OnClick<T>;
43
43
  hoverTitle?: string;
44
44
  option?: {
45
45
  text?: string;
46
46
  background?: string;
47
47
  };
48
48
  };
49
- declare function isDataButton(obj: any): obj is DataButton;
49
+ declare function isDataButton<T>(obj: any): obj is DataButton<T>;
50
50
  export type { DataFiledTypeText, DataSelectRoll };
51
51
  export { isDataSelectRoll, isDataButton };
@@ -1,12 +1,21 @@
1
+ import { Widget } from ".";
1
2
  import { Size, State } from "../Property";
2
- interface SelectOption<T> {
3
+ type SelectOptionTuple<T> = [T, string];
4
+ export interface SelectOption<T> {
3
5
  title: string;
4
6
  value: T;
5
7
  icon?: string;
6
8
  }
9
+ export type SelectOptionInput<T> = SelectOption<T> | SelectOptionTuple<T>;
10
+ export declare function toSelectOption<T>(option: SelectOptionInput<T>): SelectOption<T>;
11
+ export interface SelectWidget<T> extends Widget {
12
+ state: State<T>;
13
+ selectOptions?: SelectOptionInput<T>[];
14
+ placeholder?: string;
15
+ }
7
16
  export interface SelectSwitchProps<T> {
8
17
  state: State<T>;
9
- selectOptions: SelectOption<T>[];
18
+ selectOptions: SelectOptionInput<T>[];
10
19
  option?: {
11
20
  size?: Size;
12
21
  text?: string;
@@ -15,7 +24,7 @@ export interface SelectSwitchProps<T> {
15
24
  }
16
25
  export interface SelectHandleProps<T> {
17
26
  state: State<T>;
18
- options: SelectOption<T>[];
27
+ selectOptions: SelectOptionInput<T>[];
19
28
  option?: {
20
29
  className?: string;
21
30
  };
@@ -1 +1,9 @@
1
- export {};
1
+ export function toSelectOption(option) {
2
+ if (Array.isArray(option)) {
3
+ const [value, title] = option;
4
+ return { value, title };
5
+ }
6
+ else {
7
+ return option;
8
+ }
9
+ }
@@ -1,7 +1,9 @@
1
1
  import { Color } from "../Color";
2
2
  import { Disabled, OnClick, Size, State } from "../Property";
3
+ import { SelectOptionInput } from "./Select";
3
4
  export * from "./Carousel";
4
5
  export * from "./Switch";
6
+ export * from "./Select";
5
7
  export declare const WidgetType: {
6
8
  readonly TEXT: "text";
7
9
  readonly BUTTON: "button";
@@ -27,12 +29,6 @@ export interface LabelWidget extends Widget {
27
29
  hoverState?: State<boolean>;
28
30
  onClick?: OnClick;
29
31
  }
30
- export type SelectOption<T> = [T, string];
31
- export interface SelectWidget<T> extends Widget {
32
- state: State<T>;
33
- selectOptions?: SelectOption<T>[];
34
- placeholder?: string;
35
- }
36
32
  type InputType = "text" | "password" | "date" | "email" | "phone" | "number";
37
33
  export interface InputWidget extends Widget {
38
34
  state: State<string> | State<string | undefined>;
@@ -53,7 +49,7 @@ export interface WidgetFrame {
53
49
  title: string;
54
50
  type: WidgetType;
55
51
  state: State<any>;
56
- selectOptions?: SelectOption<string | number>[];
52
+ selectOptions?: SelectOptionInput<string | number>[];
57
53
  labels?: [string | boolean, string][];
58
54
  disabled?: Disabled;
59
55
  onClick?: OnClick;
@@ -1,5 +1,6 @@
1
1
  export * from "./Carousel";
2
2
  export * from "./Switch";
3
+ export * from "./Select";
3
4
  export const WidgetType = {
4
5
  TEXT: "text",
5
6
  BUTTON: "button",
@@ -1,2 +1,2 @@
1
1
  import { DataFieldProps } from "../../interface";
2
- export default function DataFieldDesign<T extends Record<string, any>>({ id, dataField, option, }: DataFieldProps<T>): import("react/jsx-runtime").JSX.Element;
2
+ export default function DataFieldDesign<T = any>({ id, dataField, option, }: DataFieldProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -23,7 +23,8 @@ export default function DataFieldDesign({ id, dataField, option, }) {
23
23
  sizes: container.sizes,
24
24
  };
25
25
  return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(container), children: dataField &&
26
- Object.keys(dataField).map((key) => (_jsx("div", { className: widthSizes[dataField[key]?.size], children: _jsxs("button", { onClick: () => setOrder(id, key), className: "flex items-center", children: [_jsx("div", { children: dataField[key]?.title }), _jsx("div", { className: "text-xs", children: orders?.map(({ orderBy, orderHow }) => {
26
+ Object.keys(dataField).map((key) => (_jsx("div", { className: widthSizes[dataField[key]
27
+ ?.size], children: _jsxs("button", { onClick: () => setOrder(id, key), className: "flex items-center", children: [_jsx("div", { children: dataField[key]?.title }), _jsx("div", { className: "text-xs", children: orders?.map(({ orderBy, orderHow }) => {
27
28
  if (orderBy === key) {
28
29
  if (orderHow === "asc")
29
30
  return _jsx(SVG.Direction.Asc, {});
@@ -45,6 +45,6 @@ function RowElement(props) {
45
45
  return _jsx(SelectRoll, { item: item, entry: props.entry, data: data });
46
46
  }
47
47
  if (isDataButton(data))
48
- return (_jsx(Label.Button, { title: item[key], hoverTitle: data.hoverTitle, onClick: data.onClick, option: { ...data.option, width: "xs", height: "xs" } }));
48
+ return (_jsx(Label.Button, { title: item[key], hoverTitle: data.hoverTitle, onClick: () => data.onClick(item), option: { ...data.option, width: "xs", height: "xs" } }));
49
49
  return _jsx(_Fragment, { children: item[key] });
50
50
  }
@@ -1,5 +1,5 @@
1
1
  import { DataFieldProps } from "../../interface";
2
- declare function Board<T>({ id, dataField }: DataFieldProps<T>): import("react/jsx-runtime").JSX.Element;
2
+ declare function Board<T extends Record<string, any>>({ id, dataField, }: DataFieldProps<T>): import("react/jsx-runtime").JSX.Element;
3
3
  declare function Card<T>({ id, dataField }: DataFieldProps<T>): import("react/jsx-runtime").JSX.Element;
4
4
  declare const DataField: {
5
5
  Board: typeof Board;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import DataFieldDesign from "../design/DataField.design";
3
- function Board({ id, dataField }) {
3
+ function Board({ id, dataField, }) {
4
4
  return (_jsx(DataFieldDesign, { id: id, dataField: dataField, option: {
5
5
  position: "fixed top-34 xl:top-0 left-0 xl:relative z-20",
6
6
  padding: "px-2 xs:px-4 xl:px-7.5",
@@ -1,11 +1,11 @@
1
1
  import { RowProps } from "../../interface";
2
2
  declare function Row<T>({ item, dataField, onClick, buttons, dot }: RowProps<T>): import("react/jsx-runtime").JSX.Element;
3
3
  declare namespace Row {
4
- var Card: <T>({ item, dataField, stateAction, onClick, buttons, height, noPadding, noHover, dot, }: Omit<RowProps<T>, "option"> & {
4
+ var Board: <T>({ item, dataField, onClick, buttons, dot, option, }: RowProps<T>) => import("react/jsx-runtime").JSX.Element;
5
+ var Card: <T>({ item, dataField, stateAction, onClick, buttons, height, noPadding, noHover, dot, option, }: RowProps<T> & {
5
6
  height?: string | undefined;
6
7
  noPadding?: boolean | undefined;
7
8
  noHover?: boolean | undefined;
8
9
  }) => import("react/jsx-runtime").JSX.Element;
9
- var Board: <T>({ item, dataField, onClick, buttons, dot, option, }: RowProps<T>) => import("react/jsx-runtime").JSX.Element;
10
10
  }
11
11
  export default Row;
@@ -18,15 +18,16 @@ function Board({ item, dataField, onClick, buttons, dot, option, }) {
18
18
  text: "text-xl",
19
19
  } }, id));
20
20
  }
21
- function Card({ item, dataField, stateAction, onClick, buttons, height, noPadding, noHover, dot, }) {
21
+ function Card({ item, dataField, stateAction, onClick, buttons, height, noPadding, noHover, dot, option, }) {
22
22
  const id = useId();
23
23
  return (_jsx(RowDesign, { onClick: onClick, item: item, stateAction: stateAction, dataField: dataField, buttons: buttons, dot: dot, option: {
24
+ ...option,
24
25
  size: `w-full ${height ?? "h-15"}`,
25
26
  padding: !noPadding ? "px-2 xs:px-4 xl:px-5" : "",
26
27
  text: "text-base",
27
28
  noHover,
28
29
  } }, id));
29
30
  }
30
- Row.Card = Card;
31
31
  Row.Board = Board;
32
+ Row.Card = Card;
32
33
  export default Row;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.78",
3
+ "version": "1.0.80",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
@@ -29,6 +29,7 @@
29
29
  "tailwind-scrollbar-hide": "^1.1.7",
30
30
  "tailwindcss-animate": "^1.0.7",
31
31
  "typescript": "^5.2.2",
32
+ "uuid": "^10.0.0",
32
33
  "zustand": "^4.5.0"
33
34
  },
34
35
  "devDependencies": {}
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.78
1
+ 1.0.80
@@ -1,2 +1,2 @@
1
1
  import { SelectHandleProps } from "../../../interface/widget/Select";
2
- export default function SelectHandle<T>({ state, options, option, }: SelectHandleProps<T>): import("react/jsx-runtime").JSX.Element;
2
+ export default function SelectHandle<T>({ state, selectOptions: selectOptionsInput, option, }: SelectHandleProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { widthSizes } from "../../../asset/sizes";
3
+ import { toSelectOption, } from "../../../interface/widget/Select";
3
4
  import { cn, gradient } from "../../../util";
4
- export default function SelectHandle({ state, options, option, }) {
5
+ export default function SelectHandle({ state, selectOptions: selectOptionsInput, option, }) {
6
+ const selectOptions = selectOptionsInput?.map(toSelectOption);
5
7
  const { className } = option ?? {};
6
- const length = options?.length;
7
- const valueIndex = Object.values(options)
8
+ const length = selectOptions?.length;
9
+ const valueIndex = Object.values(selectOptions)
8
10
  .map(({ value }) => value)
9
11
  ?.indexOf(state?.[0]);
10
12
  const container = {
@@ -24,7 +26,7 @@ export default function SelectHandle({ state, options, option, }) {
24
26
  sizes: "w-5 h-5",
25
27
  styles: "rounded-full bg-white",
26
28
  };
27
- return (_jsxs("div", { className: cn(container), children: [_jsx("div", { className: cn(area), children: _jsx("div", { className: cn(handle) }) }), _jsx("div", { className: "absolute flex w-full h-full top-0 left-0", children: options?.map(({ value }) => (_jsx("button", { onClick: () => {
29
+ return (_jsxs("div", { className: cn(container), children: [_jsx("div", { className: cn(area), children: _jsx("div", { className: cn(handle) }) }), _jsx("div", { className: "absolute flex w-full h-full top-0 left-0", children: selectOptions?.map(({ value }) => (_jsx("button", { onClick: () => {
28
30
  return state?.[1](value);
29
31
  }, className: "flex flex-1 h-10 " }, value))) })] }));
30
32
  }
@@ -1,2 +1,2 @@
1
1
  import { SelectWidget } from "../../../interface";
2
- export default function SelectLG<T>({ state, selectOptions, placeholder, option, }: SelectWidget<T>): import("react/jsx-runtime").JSX.Element;
2
+ export default function SelectLG<T>({ state, selectOptions: selectOptionsInput, placeholder, option, }: SelectWidget<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { toSelectOption, } from "../../../interface";
2
3
  import { useEffect, useId, useRef, useState } from "react";
3
4
  import { useActionStore } from "../../../store";
4
5
  import { useFlag } from "../../../hook";
@@ -14,7 +15,8 @@ const heightSize = {
14
15
  xs: "h-6.5",
15
16
  sm: "h-9",
16
17
  };
17
- export default function SelectLG({ state, selectOptions, placeholder, option, }) {
18
+ export default function SelectLG({ state, selectOptions: selectOptionsInput, placeholder, option, }) {
19
+ const selectOptions = selectOptionsInput?.map(toSelectOption);
18
20
  const id = useId();
19
21
  const { isDark } = option ?? {};
20
22
  const { setIsOwn, setIsOwnId } = useActionStore();
@@ -23,7 +25,7 @@ export default function SelectLG({ state, selectOptions, placeholder, option, })
23
25
  const [search, setSearch] = useState("");
24
26
  const [isOpen, setIsOpen] = useState(false);
25
27
  const [isHover, setIsHover] = useState(false);
26
- const [filteredOptions, setFilterdOptions] = useState([]);
28
+ const [filteredOptions, setFilterdOptions] = useState();
27
29
  const [index, setIndex] = useState();
28
30
  const listRef = useRef(null);
29
31
  const itemRefs = useRef([]);
@@ -34,8 +36,8 @@ export default function SelectLG({ state, selectOptions, placeholder, option, })
34
36
  if (typeof index === "undefined")
35
37
  return setIndex(0);
36
38
  if (e.key === "Enter") {
37
- setText(filteredOptions[index][1]);
38
- return setValue(filteredOptions[index][0]);
39
+ setText(filteredOptions[index]?.title);
40
+ return setValue(filteredOptions[index]?.value);
39
41
  }
40
42
  if (e.key === "ArrowDown") {
41
43
  setIndex((index + 1) % filteredOptions.length);
@@ -45,7 +47,7 @@ export default function SelectLG({ state, selectOptions, placeholder, option, })
45
47
  }
46
48
  };
47
49
  useEffect(() => {
48
- setFilterdOptions(selectOptions?.filter(([_, text]) => text.includes(search)));
50
+ setFilterdOptions(selectOptions?.filter(({ title }) => title.includes(search)));
49
51
  }, [search, selectOptions]);
50
52
  useEffect(() => {
51
53
  if (typeof index === "number" && itemRefs.current[index]) {
@@ -103,12 +105,12 @@ export default function SelectLG({ state, selectOptions, placeholder, option, })
103
105
  leave: { top: isLong ? 88 : 44 },
104
106
  config: { duration: 0 },
105
107
  });
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 &&
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 &&
107
109
  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) => {
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: () => {
110
+ 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: () => {
109
111
  setValue(value);
110
- setText(text);
112
+ setText(title);
111
113
  return setIsOpen(false);
112
- }, className: cn(label(order === index)), children: text }) }, id + value))) })));
114
+ }, className: cn(label(order === index)), children: title }) }, id + value))) })));
113
115
  })] }));
114
116
  }
@@ -1,2 +1,2 @@
1
1
  import { SelectWidget } from "../../../interface";
2
- export default function Select<T>({ state, selectOptions, placeholder, option, }: SelectWidget<T>): import("react/jsx-runtime").JSX.Element;
2
+ export default function Select<T>({ state, selectOptions: selectOptionsInput, placeholder, option, }: SelectWidget<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useId, useRef, useState } from "react";
3
+ import { toSelectOption, } from "../../../interface";
3
4
  import { cn } from "../../../util";
4
5
  import { useTransition, animated } from "react-spring";
5
6
  import { useActionStore } from "../../../store";
@@ -13,7 +14,8 @@ const widthSize = {
13
14
  const heightSize = {
14
15
  xs: "h-6.5",
15
16
  };
16
- export default function Select({ state, selectOptions, placeholder, option, }) {
17
+ export default function Select({ state, selectOptions: selectOptionsInput, placeholder, option, }) {
18
+ const selectOptions = selectOptionsInput?.map(toSelectOption);
17
19
  const id = useId();
18
20
  const { setIsOwn, setIsOwnId } = useActionStore();
19
21
  const [value, setValue] = state;
@@ -21,7 +23,7 @@ export default function Select({ state, selectOptions, placeholder, option, }) {
21
23
  const [search, setSearch] = useState("");
22
24
  const [isOpen, setIsOpen] = useState(false);
23
25
  const [isHover, setIsHover] = useState(false);
24
- const [filteredOptions, setFilterdOptions] = useState([]);
26
+ const [filteredOptions, setFilterdOptions] = useState();
25
27
  const [index, setIndex] = useState();
26
28
  useFlag({ state: [false, setIsOpen], safe: "overlay" });
27
29
  const onKeyDown = (e) => {
@@ -30,8 +32,8 @@ export default function Select({ state, selectOptions, placeholder, option, }) {
30
32
  if (typeof index === "undefined")
31
33
  return setIndex(0);
32
34
  if (e.key === "Enter") {
33
- setText(filteredOptions[index][1]);
34
- return setValue(filteredOptions[index][0]);
35
+ setText(filteredOptions[index]?.title);
36
+ return setValue(filteredOptions[index]?.value);
35
37
  }
36
38
  if (e.key === "ArrowDown")
37
39
  return setIndex((index + 1) % filteredOptions.length);
@@ -39,9 +41,9 @@ export default function Select({ state, selectOptions, placeholder, option, }) {
39
41
  return setIndex((index - 1 + filteredOptions.length) % filteredOptions.length);
40
42
  };
41
43
  useEffect(() => {
42
- setFilterdOptions(selectOptions?.filter(([_, text]) => text.includes(search)));
44
+ setFilterdOptions(selectOptions?.filter(({ title }) => text.includes(title)));
43
45
  }, [search, selectOptions]);
44
- // scrollIntoView
46
+ // scrollIntoViews
45
47
  const listRef = useRef(null);
46
48
  const itemRefs = useRef([]);
47
49
  useEffect(() => {
@@ -107,12 +109,12 @@ export default function Select({ state, selectOptions, placeholder, option, }) {
107
109
  duration: 0,
108
110
  },
109
111
  });
110
- 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 &&
112
+ 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.value)?.title })) : (_jsx("div", { className: "text-xs pl-1", children: placeholder ?? "선택해주세요" })) }), inputTransition((styles, item) => isLong &&
111
113
  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) => {
112
- 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: () => {
114
+ 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: () => {
113
115
  setValue(value);
114
- setText(text);
116
+ setText(title);
115
117
  return setIsOpen(false);
116
- }, className: cn(label, order === index ? "w-full" : "w-auto"), children: text }) }, id + value))) })));
118
+ }, className: cn(label, order === index ? "w-full" : "w-auto"), children: title }) }, id + value))) })));
117
119
  })] }));
118
120
  }
@@ -1,3 +1,3 @@
1
1
  import { SelectSwitchProps } from "../../../interface/widget/Select";
2
- declare function SelectSwitch<T>({ state, selectOptions, option, }: SelectSwitchProps<T>): import("react/jsx-runtime").JSX.Element;
2
+ declare function SelectSwitch<T>({ state, selectOptions: selectOptionsInput, option, }: SelectSwitchProps<T>): import("react/jsx-runtime").JSX.Element;
3
3
  export default SelectSwitch;
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { toSelectOption, } from "../../../interface/widget/Select";
2
3
  import { cn } from "../../../util";
3
4
  const paddingSize = {
4
5
  md: "p-1.5",
@@ -20,7 +21,8 @@ const textSize = {
20
21
  md: "text-sm",
21
22
  lg: "text-base",
22
23
  };
23
- function SelectSwitch({ state, selectOptions, option, }) {
24
+ function SelectSwitch({ state, selectOptions: selectOptionsInput, option, }) {
25
+ const selectOptions = selectOptionsInput.map(toSelectOption);
24
26
  const { text, size, className } = option ?? {};
25
27
  const container = {
26
28
  sizes: `${widthSize[size ?? "md"]} ${heightSize[size ?? "md"]}`,