@edu-tosel/design 1.0.96 → 1.0.98

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.
Files changed (57) hide show
  1. package/card/design/Card.design.d.ts +1 -1
  2. package/card/design/Card.design.js +16 -5
  3. package/card/design/ControlCard.design.d.ts +2 -0
  4. package/card/design/ControlCard.design.js +41 -0
  5. package/card/design/CustomCard.design.d.ts +1 -1
  6. package/card/design/CustomCard.design.js +8 -20
  7. package/card/design/NavCard.design.js +1 -1
  8. package/card/design/ReceiptCard.design.d.ts +1 -0
  9. package/card/design/ReceiptCard.design.js +5 -0
  10. package/card/design/TableCard.design.d.ts +1 -1
  11. package/card/design/TableCard.design.js +20 -14
  12. package/card/design/widget/TitleBox.design.d.ts +4 -0
  13. package/card/design/widget/TitleBox.design.js +16 -0
  14. package/card/index.d.ts +1 -0
  15. package/card/index.js +1 -0
  16. package/card/template/ControlCard.d.ts +4 -0
  17. package/card/template/ControlCard.js +6 -0
  18. package/card/template/NavCard.js +1 -1
  19. package/card/template/TableCard.d.ts +4 -2
  20. package/card/template/TableCard.js +4 -4
  21. package/interface/Card.d.ts +21 -5
  22. package/interface/Property.d.ts +1 -0
  23. package/interface/widget/Box.d.ts +25 -0
  24. package/interface/widget/Box.js +1 -0
  25. package/interface/widget/Cluster.d.ts +18 -0
  26. package/interface/widget/Cluster.js +1 -0
  27. package/interface/widget/Obstacle.d.ts +2 -0
  28. package/interface/widget/Select.d.ts +7 -0
  29. package/interface/widget/WidgetOption.d.ts +13 -0
  30. package/interface/widget/WidgetOption.js +1 -0
  31. package/interface/widget/index.d.ts +3 -1
  32. package/interface/widget/index.js +2 -0
  33. package/layout/template/promotion/Layout.d.ts +1 -3
  34. package/layout/template/promotion/Layout.js +65 -3
  35. package/layout/template/promotion/Thumbnail.js +1 -7
  36. package/package.json +1 -1
  37. package/version.txt +1 -1
  38. package/widget/design/Label.design.js +16 -11
  39. package/widget/design/Obstacle.design.d.ts +1 -1
  40. package/widget/design/Obstacle.design.js +3 -2
  41. package/widget/index.d.ts +2 -0
  42. package/widget/index.js +2 -0
  43. package/widget/template/Box/CountBox.d.ts +2 -0
  44. package/widget/template/Box/CountBox.js +23 -0
  45. package/widget/template/Box/CountWithScript.d.ts +2 -0
  46. package/widget/template/Box/CountWithScript.js +22 -0
  47. package/widget/template/Box/InfoBox.d.ts +1 -0
  48. package/widget/template/Box/InfoBox.js +4 -0
  49. package/widget/template/Box/index.d.ts +9 -0
  50. package/widget/template/Box/index.js +9 -0
  51. package/widget/template/Cluster/index.d.ts +2 -0
  52. package/widget/template/Cluster/index.js +23 -0
  53. package/widget/template/Select/Switch.js +19 -2
  54. package/widget/template/Select/Toggle.d.ts +2 -0
  55. package/widget/template/Select/Toggle.js +29 -0
  56. package/widget/template/Select/index.d.ts +2 -0
  57. package/widget/template/Select/index.js +2 -0
@@ -1,2 +1,2 @@
1
1
  import { CardProps } from "../../interface/Card";
2
- export default function CardDesign({ header, children, option, debug, }: CardProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function CardDesign({ header, disabled, children, option, debug, }: CardProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,9 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn, isDebug } from "../../util";
3
3
  import { useActionStore } from "../../store";
4
+ import { Action } from "../../layout";
5
+ import { Obstacle } from "../../widget";
6
+ import { useRef } from "react";
4
7
  const widthSize = {
5
8
  "4xs": "w-15",
6
9
  "3xs": "w-40",
@@ -27,13 +30,15 @@ const heightSize = {
27
30
  "2xl": "h-127.5", // 510px
28
31
  "3xl": "h-138.5", // 554px
29
32
  full: "h-full", // 100%
30
- auto: "h-auto min-h-80", // 100%
33
+ auto: "h-auto p-5", // 100%
31
34
  };
32
- export default function CardDesign({ header, children, option, debug, }) {
35
+ export default function CardDesign({ header, disabled, children, option, debug, }) {
33
36
  const { setIsOwn } = useActionStore();
37
+ const { isDisabled, obstacle, disabledAction } = disabled ?? {
38
+ isDisabled: false,
39
+ };
34
40
  const { className, boundary, rounded, height, width, text, background, onClick, onMouse, overflow, } = option ?? {};
35
41
  const container = {
36
- positions: "relative",
37
42
  sizes: `${widthSize[width ?? "sm"]} ${heightSize[height ?? "xs"]}`,
38
43
  onClick: onClick ? "cursor-pointer" : "",
39
44
  text: `${text ?? "text-base"} text-black dark:text-white`,
@@ -45,9 +50,15 @@ export default function CardDesign({ header, children, option, debug, }) {
45
50
  overflow: "overflow-hidden",
46
51
  };
47
52
  const body = {
53
+ positions: "relative",
48
54
  sizes: "w-full h-full",
49
55
  overflow,
50
56
  className,
51
57
  };
52
- return (_jsxs("div", { onMouseEnter: onMouse ? () => onMouse[1](true) : () => { }, onMouseLeave: onMouse ? () => onMouse[1](false) : () => { }, className: cn(container), children: [header && _jsx(_Fragment, { children: header }), _jsx("div", { onClick: onClick && onClick, className: cn(body), children: children })] }));
58
+ const containerRef = useRef(null);
59
+ const headerRef = useRef(null);
60
+ return (_jsxs("div", { onMouseEnter: onMouse ? () => onMouse[1](true) : () => { }, onMouseLeave: onMouse ? () => onMouse[1](false) : () => { }, className: cn(container), ref: containerRef, children: [header && _jsx("div", { ref: headerRef, children: header }), _jsx("div", { style: {
61
+ height: Number(containerRef.current?.offsetHeight) -
62
+ Number(headerRef.current?.offsetHeight),
63
+ }, className: "relative w-full h-full", children: _jsx(Action.Show, { actions: [[isDisabled, obstacle ?? _jsx(Obstacle.Blur, {})]], children: _jsx("div", { onClick: onClick && onClick, className: cn(body), children: children }) }) })] }));
53
64
  }
@@ -0,0 +1,2 @@
1
+ import { ControlCardProps } from "../../interface";
2
+ export default function ControlCardDesign<T>({ contents, option, }: ControlCardProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import CardDesign from "./Card.design";
3
+ import { cn } from "../../util";
4
+ import { LineBreaks } from "../../text";
5
+ import { Label, Select } from "../../widget";
6
+ export default function ControlCardDesign({ contents, option, }) {
7
+ return (_jsx(CardDesign, { option: {
8
+ className: "flex flex-col gap-y-5",
9
+ width: "lg",
10
+ height: "auto",
11
+ ...option,
12
+ }, children: contents.map((content) => (_jsx(ContentBox, { ...content }, content.titles.title))) }));
13
+ }
14
+ function ContentBox({ titles, widget }) {
15
+ const { title, subtitle, titleColor, icon } = titles;
16
+ const container = {
17
+ displays: "flex justify-between",
18
+ };
19
+ const titleBox = {
20
+ displays: "flex",
21
+ sizes: "h-6",
22
+ fonts: "font-pretendard-bold",
23
+ color: titleColor ?? "text-green-dark",
24
+ };
25
+ return (_jsxs("div", { className: cn(container), children: [_jsxs("div", { className: "flex gap-x-3", children: [_jsxs("div", { className: "flex gap-x-3 items-start", children: [icon && _jsx("img", { src: icon, width: 24 }), _jsx("div", { className: cn(titleBox), children: title })] }), _jsx(LineBreaks, { texts: subtitle, className: "mt-0.5" })] }), widget && _jsx(WidgetOption, { ...widget })] }));
26
+ }
27
+ function WidgetOption({ type, data }) {
28
+ if (type === "button")
29
+ return (_jsx(Label.Button, { ...data, option: {
30
+ width: "3xs",
31
+ height: "3xs",
32
+ text: "text-xs",
33
+ } }));
34
+ if (type === "selectSwitch")
35
+ return (_jsx(Select.Switch, { ...data, option: {
36
+ size: "sm",
37
+ } }));
38
+ if (type === "selectToggle")
39
+ return _jsx(Select.Toggle, { ...data });
40
+ return null;
41
+ }
@@ -1,2 +1,2 @@
1
1
  import { CustomCardProps } from "../../interface";
2
- export default function CustomCardDesign({ titles, option, children, }: CustomCardProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function CustomCardDesign({ titles, disabled, option, children, }: CustomCardProps): import("react/jsx-runtime").JSX.Element;
@@ -1,23 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { cn } from "../../util";
3
2
  import CardDesign from "./Card.design";
4
- export default function CustomCardDesign({ titles, option, children, }) {
5
- const titleBox = {
6
- positions: "relative z-10",
7
- displays: "flex flex-col gap-3",
8
- };
9
- const titleStyle = {
10
- fonts: "font-pretendard-bold leading-tight text-[16px]",
11
- styles: titles.titleColor,
12
- };
13
- const subtitleStyle = {
14
- fonts: "font-pretendard-medium leading-tight text-[12px]",
15
- styles: titles.subtitleColor,
16
- };
17
- return (_jsxs(CardDesign, { option: {
18
- ...option,
19
- width: option?.width ?? "lg",
20
- height: option?.height ?? "4xs",
21
- className: option?.className ?? "p-5",
22
- }, children: [_jsxs("div", { className: cn(titleBox), children: [_jsx("div", { className: cn(titleStyle), children: titles.title }), _jsx("div", { className: cn(subtitleStyle), children: titles.subtitle })] }), children ?? null] }));
3
+ import TitleBox from "./widget/TitleBox.design";
4
+ export default function CustomCardDesign({ titles, disabled, option, children, }) {
5
+ return (_jsxs("div", { children: [_jsx(TitleBox, { titles: titles }), _jsx(CardDesign, { disabled: disabled, option: {
6
+ ...option,
7
+ width: option?.width ?? "lg",
8
+ height: option?.height ?? "auto",
9
+ className: option?.className,
10
+ }, children: children ?? null })] }));
23
11
  }
@@ -29,8 +29,8 @@ export default function NavCardDesign({ titles, option }) {
29
29
  sizes: image?.size,
30
30
  };
31
31
  return (_jsxs(Card, { option: option, children: [_jsxs("div", { className: cn(textBox.container), children: [_jsx("div", { className: cn(textBox.title), children: title }), _jsx(LineBreaks, { className: cn(textBox.subtitle), texts: subtitle ?? "" })] }), buttonInLay && (_jsx(Label.Button, { title: buttonInLay.title, onClick: buttonInLay.onClick, option: {
32
- disabled: buttonInLay.disabled,
33
32
  className: "absolute bottom-7.5 left-7.5",
33
+ disabled: buttonInLay.disabled,
34
34
  background: buttonInLay?.background,
35
35
  text: buttonInLay?.text,
36
36
  } })), image && (_jsx("img", { src: image.path, alt: "trump-image", loading: "lazy", className: cn(imageBox) }))] }));
@@ -0,0 +1 @@
1
+ export default function ReceiptCard(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import CardDesign from "./Card.design";
3
+ export default function ReceiptCard() {
4
+ return (_jsx(CardDesign, { children: _jsx("div", {}) }));
5
+ }
@@ -1,2 +1,2 @@
1
1
  import { TableCardProps } from "../../interface";
2
- export default function TableCardDesign<T>({ dataSet, dataField, option, }: TableCardProps<T>): import("react/jsx-runtime").JSX.Element;
2
+ export default function TableCardDesign<T>({ header, disabled, dataSet, dataField, option, }: TableCardProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -3,31 +3,37 @@ import { useId } from "react";
3
3
  import { useActionStore } from "../../store";
4
4
  import { cn, sortByOrder } from "../../util";
5
5
  import Card from "./Card.design";
6
- import { DataField, Action, Row, Lock } from "../..";
7
- import { Obstacle } from "../..";
6
+ import { DataField, Action, Row } from "../..";
8
7
  import { v4 } from "uuid";
9
- export default function TableCardDesign({ dataSet, dataField, option, }) {
10
- const { width, height, padding, boundary, isDisabled, disabledScript } = option ?? {};
8
+ export default function TableCardDesign({ header, disabled, dataSet, dataField, option, }) {
9
+ const { isDisabled, obstacle, disabledAction } = disabled ?? {
10
+ isDisabled: false,
11
+ };
12
+ const { width, height, boundary, disabledScript } = option ?? {};
11
13
  const { order } = useActionStore();
12
14
  const id = useId();
13
15
  const orders = order[id] ?? [];
14
16
  const container = {
17
+ positions: "relative",
15
18
  className: option?.className,
16
- paddings: padding ?? "pb-10",
19
+ paddings: !header ? "pb-10" : "pb-25",
20
+ };
21
+ const headerBox = {
22
+ displays: "flex items-center justify-center",
23
+ sizes: "w-full h-15",
24
+ styles: "overflow-hidden",
17
25
  };
18
- return (_jsx(Card, { header: !option?.noHeader && _jsx(DataField.Card, { id: id, dataField: dataField }), option: {
26
+ return (_jsx(Card, { header: !option?.noHeader && (_jsxs("div", { children: [_jsx(DataField.Card, { id: id, dataField: dataField }), header && _jsx("div", { className: cn(headerBox), children: header })] })), disabled: disabled, option: {
19
27
  boundary,
20
28
  className: cn(container),
21
29
  width: width ?? "lg",
22
30
  height: height ?? "3xl",
23
31
  overflow: "overflow-y-scroll overflow-x-hidden",
24
32
  noPadding: true,
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: {
31
- position: "top-10",
32
- }, children: _jsx(Lock, { script: disabledScript }) })] }) }));
33
+ }, children: _jsx(Action.Replace, { actions: dataSet?.replaces, children: sortByOrder({ items: dataSet?.items, orders }).map((item) => {
34
+ const uuid = v4();
35
+ if (dataSet.renderItem)
36
+ return dataSet.renderItem(item);
37
+ return (_jsx(Row.Card, { item: item, onClick: () => dataSet.onClick?.(item), dataField: dataField, height: option?.rowHeight, noHover: option?.noHover, noPadding: option?.noRowPadding }, uuid));
38
+ }) }) }));
33
39
  }
@@ -0,0 +1,4 @@
1
+ import { Titles } from "../../../interface";
2
+ export default function TitleBox({ titles }: {
3
+ titles?: Titles;
4
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../../util";
3
+ export default function TitleBox({ titles }) {
4
+ const { title, titleColor } = titles ?? {};
5
+ const titleBox = {
6
+ displays: "flex items-center",
7
+ sizes: "w-full h-[44px]",
8
+ texts: "text-[20px]",
9
+ fonts: "font-pretendard-bold leading-tight",
10
+ boundaries: "pl-5",
11
+ styles: titleColor,
12
+ };
13
+ if (!titles)
14
+ return null;
15
+ return _jsx("div", { className: cn(titleBox), children: title });
16
+ }
package/card/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { default as AddCard } from "./template/AddCard";
2
2
  export { default as ChartCard } from "./template/ChartCard";
3
3
  export { default as ConfirmCard } from "./template/ConfirmCard";
4
+ export { default as ControlCard } from "./template/ControlCard";
4
5
  export { default as CustomCard } from "./template/CustomCard";
5
6
  export { default as InfoCard } from "./template/InfoCard";
6
7
  export { default as NavCard } from "./template/NavCard";
package/card/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { default as AddCard } from "./template/AddCard";
2
2
  export { default as ChartCard } from "./template/ChartCard";
3
3
  export { default as ConfirmCard } from "./template/ConfirmCard";
4
+ export { default as ControlCard } from "./template/ControlCard";
4
5
  export { default as CustomCard } from "./template/CustomCard";
5
6
  export { default as InfoCard } from "./template/InfoCard";
6
7
  export { default as NavCard } from "./template/NavCard";
@@ -0,0 +1,4 @@
1
+ import { ControlCardProps, Titles } from "../../interface";
2
+ export default function ControlCard<T>(props: ControlCardProps<T> & {
3
+ titles?: Titles;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import ControlCardDesign from "../design/ControlCard.design";
3
+ import TitleBox from "../design/widget/TitleBox.design";
4
+ export default function ControlCard(props) {
5
+ return (_jsxs("div", { children: [_jsx(TitleBox, { titles: props.titles }), _jsx(ControlCardDesign, { ...props })] }));
6
+ }
@@ -21,8 +21,8 @@ function ButtonInLay({ titles, buttonInLay, option }) {
21
21
  width: option?.width ?? "xs",
22
22
  height: option?.height ?? "sm",
23
23
  buttonInLay: {
24
- disabled: buttonInLay.disabled,
25
24
  ...buttonInLay,
25
+ disabled: buttonInLay.disabled,
26
26
  width: buttonInLay.width ?? "lg",
27
27
  height: "sm",
28
28
  },
@@ -1,5 +1,7 @@
1
- import { TableCardProps } from "../../interface";
2
- declare function TableCard<T>(props: TableCardProps<T>): import("react/jsx-runtime").JSX.Element;
1
+ import { TableCardProps, Titles } from "../../interface";
2
+ declare function TableCard<T>(props: TableCardProps<T> & {
3
+ titles?: Titles;
4
+ }): import("react/jsx-runtime").JSX.Element;
3
5
  declare namespace TableCard {
4
6
  var Log: <T>(props: TableCardProps<T>) => import("react/jsx-runtime").JSX.Element;
5
7
  }
@@ -1,7 +1,8 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import TableCardDesign from "../design/TableCard.design";
3
+ import TitleBox from "../design/widget/TitleBox.design";
3
4
  function TableCard(props) {
4
- return _jsx(TableCardDesign, { ...props });
5
+ return (_jsxs("div", { children: [_jsx(TitleBox, { titles: props.titles }), _jsx(TableCardDesign, { ...props })] }));
5
6
  }
6
7
  function Log(props) {
7
8
  return (_jsx(TableCardDesign, { dataField: props.dataField, dataSet: props.dataSet, option: {
@@ -10,11 +11,10 @@ function Log(props) {
10
11
  rowHeight: "h-5",
11
12
  onClick: props.option?.onClick,
12
13
  text: "text-white",
13
- padding: "p-7.5",
14
14
  noHeader: true,
15
15
  noHover: true,
16
16
  noRowPadding: true,
17
- className: "flex flex-col gap-2.5",
17
+ className: "flex flex-col gap-2.5 p-7.5",
18
18
  } }));
19
19
  }
20
20
  TableCard.Log = Log;
@@ -2,6 +2,8 @@ import { Button, Disabled, OnClick, Size, State, Titles } from "./Property";
2
2
  import { DataSet, DataField } from "./Data";
3
3
  import { Theme } from "./Theme";
4
4
  import { Flexify } from "./UtilityType";
5
+ import { ButtonWidgetOption, SelectSwitchWidgetOption, SelectToggleWidgetOption } from "./widget/WidgetOption";
6
+ import { ReactNode } from "react";
5
7
  interface CardOption {
6
8
  className?: string;
7
9
  boundary?: string;
@@ -19,10 +21,15 @@ interface CardOption {
19
21
  noShadow?: boolean;
20
22
  }
21
23
  export interface CardProps {
22
- children: React.ReactNode;
23
- header?: React.ReactNode;
24
+ children: ReactNode;
25
+ header?: ReactNode;
24
26
  option?: CardOption;
25
27
  debug?: string;
28
+ disabled?: {
29
+ isDisabled: boolean;
30
+ obstacle?: ReactNode;
31
+ disabledAction?: OnClick;
32
+ };
26
33
  }
27
34
  export interface ChartCardProps extends Omit<CardProps, "children"> {
28
35
  data: Record<string, string | number>[];
@@ -46,7 +53,7 @@ export interface ChartCardProps extends Omit<CardProps, "children"> {
46
53
  };
47
54
  }
48
55
  export interface CustomCardProps extends Flexify<CardProps, "children"> {
49
- titles: Titles;
56
+ titles?: Titles;
50
57
  }
51
58
  export interface ButtonInLay {
52
59
  title: string;
@@ -79,7 +86,7 @@ export interface NavCardButtonInLayProps extends NavCardProps {
79
86
  }
80
87
  export interface InfoCardProps extends CardProps {
81
88
  titles: Titles;
82
- topRight?: React.ReactNode;
89
+ topRight?: ReactNode;
83
90
  button?: Button;
84
91
  image?: string;
85
92
  option?: {
@@ -130,7 +137,7 @@ export interface TableCardProps<T> extends Omit<CardProps, "children"> {
130
137
  disabledScript?: string;
131
138
  };
132
139
  }
133
- export interface RollCardProps extends CardProps {
140
+ export interface RollCardProps extends Omit<CardProps, "disabled"> {
134
141
  titles: Titles & {
135
142
  icon?: string;
136
143
  };
@@ -148,4 +155,13 @@ export interface ProgressCardProps {
148
155
  size?: Size;
149
156
  };
150
157
  }
158
+ export type ControlContentWidgetOption<T> = ButtonWidgetOption | SelectSwitchWidgetOption<T> | SelectToggleWidgetOption<T>;
159
+ export interface ControlContent<T> {
160
+ titles: Titles;
161
+ widget?: ControlContentWidgetOption<T>;
162
+ }
163
+ export interface ControlCardProps<T> {
164
+ contents: ControlContent<T>[];
165
+ option?: CardOption;
166
+ }
151
167
  export {};
@@ -59,6 +59,7 @@ export type Titles = {
59
59
  titleColor?: string;
60
60
  subtitleColor?: string;
61
61
  size?: Size;
62
+ icon?: string;
62
63
  };
63
64
  export interface Log<K extends string, T extends string | number> {
64
65
  prints: K[];
@@ -0,0 +1,25 @@
1
+ interface BoxOption {
2
+ titleColor?: string;
3
+ background?: string;
4
+ }
5
+ export interface BoxProps {
6
+ title: string;
7
+ option?: BoxOption;
8
+ }
9
+ export interface CountBoxProps extends BoxProps {
10
+ count: number;
11
+ total?: number;
12
+ option?: BoxOption & {
13
+ countColor?: string;
14
+ totalColor?: string;
15
+ };
16
+ }
17
+ export interface CountWithScriptBoxProps extends BoxProps {
18
+ count?: number;
19
+ script?: string | string[];
20
+ option?: BoxOption & {
21
+ countColor?: string;
22
+ scriptColor?: string;
23
+ };
24
+ }
25
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import { BoxProps, CountBoxProps, CountWithScriptBoxProps } from "./Box";
2
+ interface BoxWidgetOption {
3
+ type: "box";
4
+ data: BoxProps;
5
+ }
6
+ interface CountBoxWidgetOption {
7
+ type: "countBox";
8
+ data: CountBoxProps;
9
+ }
10
+ interface CountWithScriptBoxWidgetOption {
11
+ type: "countWithScriptBox";
12
+ data: CountWithScriptBoxProps;
13
+ }
14
+ export type ClusterWidgetOption = BoxWidgetOption | CountBoxWidgetOption | CountWithScriptBoxWidgetOption;
15
+ export interface ClusterProps {
16
+ widgets: ClusterWidgetOption[][];
17
+ }
18
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,9 @@
1
+ import { ShowAction } from "../Action";
1
2
  import { Disabled } from "../Property";
2
3
  export interface ObstacleProps {
3
4
  disabled?: Disabled;
4
5
  children?: React.ReactNode;
6
+ showAction?: ShowAction;
5
7
  option?: {
6
8
  position?: string;
7
9
  size?: string;
@@ -49,4 +49,11 @@ export interface SelectPaginationProps<T> {
49
49
  className?: string;
50
50
  };
51
51
  }
52
+ export interface SelectToggleProps<T> {
53
+ state: State<T>;
54
+ selectOptions: [SelectOptionInput<T>, SelectOptionInput<T>];
55
+ option?: {
56
+ className?: string;
57
+ };
58
+ }
52
59
  export {};
@@ -0,0 +1,13 @@
1
+ import { LabelWidget, SelectSwitchProps, SelectToggleProps } from ".";
2
+ export interface ButtonWidgetOption {
3
+ type: "button";
4
+ data: LabelWidget;
5
+ }
6
+ export interface SelectSwitchWidgetOption<T> {
7
+ type: "selectSwitch";
8
+ data: SelectSwitchProps<T>;
9
+ }
10
+ export interface SelectToggleWidgetOption<T> {
11
+ type: "selectToggle";
12
+ data: SelectToggleProps<T>;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,9 @@
1
1
  import { Color } from "../Color";
2
2
  import { Disabled, OnClick, Size, State } from "../Property";
3
3
  import { SelectOptionInput } from "./Select";
4
+ export * from "./Box";
4
5
  export * from "./Carousel";
6
+ export * from "./Cluster";
5
7
  export * from "./Switch";
6
8
  export * from "./Select";
7
9
  export declare const WidgetType: {
@@ -20,7 +22,7 @@ export interface Widget {
20
22
  background?: string;
21
23
  text?: string;
22
24
  disabled?: Disabled;
23
- rounded?: string;
25
+ boundary?: string;
24
26
  isDark?: boolean;
25
27
  };
26
28
  }
@@ -1,4 +1,6 @@
1
+ export * from "./Box";
1
2
  export * from "./Carousel";
3
+ export * from "./Cluster";
2
4
  export * from "./Switch";
3
5
  export * from "./Select";
4
6
  export const WidgetType = {
@@ -1,3 +1 @@
1
- export default function Layout({ children }: {
2
- children: React.ReactNode;
3
- }): import("react/jsx-runtime").JSX.Element;
1
+ export default function Layout(): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,67 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import Thumbnail from "./Thumbnail";
3
- export default function Layout({ children }) {
4
- return (_jsxs("div", { className: "w-[1168px] h-full flex", children: [_jsx(Thumbnail, {}), children] }));
2
+ import { IoIosSearch } from "react-icons/io";
3
+ export default function Layout() {
4
+ // 0 : 기간 제한 있음
5
+ // 1 : 기간 제한 없음 -> 상시 이벤트
6
+ // 2 : 기간 제한 없음 & 소식
7
+ const eventsData = [
8
+ {
9
+ id: 1,
10
+ img: "/images/promotion/promotion1.png",
11
+ type: "0",
12
+ startDate: "2024-05-01",
13
+ endDate: "2024-12-31",
14
+ title: "5월 토셀 랩 세미나 개최",
15
+ body: "https://www.tosel.org/uploads/book-info-img/1697164321986Listening-Series_Pre-Starter.png",
16
+ },
17
+ {
18
+ id: 2,
19
+ img: "/images/promotion/promotion2.png",
20
+ type: "0",
21
+ regDate: "2024-09-01",
22
+ startDate: "2024-09-01",
23
+ endDate: "2024-09-30",
24
+ title: "83회 명예의 전당 등재자라면? 지금 바로 인터뷰에 참여해보세요",
25
+ body: "https://www.tosel.org/uploads/book-info-img/1697164321986Listening-Series_Pre-Starter.png",
26
+ },
27
+ {
28
+ id: 3,
29
+ img: "/images/promotion/promotion3.png",
30
+ type: "1",
31
+ regDate: "2024-09-01",
32
+ startDate: "0000-00-00",
33
+ endDate: "0000-00-00",
34
+ title: "소셜 로그인 이벤트! 네이버 계정 연동하고 쿠폰 받아가세요",
35
+ body: "https://www.tosel.org/uploads/book-info-img/1697164321986Listening-Series_Pre-Starter.png",
36
+ },
37
+ {
38
+ id: 4,
39
+ img: "/images/promotion/promotion4.png",
40
+ type: "2",
41
+ regDate: "2024-09-01",
42
+ startDate: "0000-00-00",
43
+ endDate: "0000-00-00",
44
+ title: "인사혁신처, 지방공기업 등에 TOSEL 확대 적용 발표",
45
+ body: "https://www.tosel.org/uploads/book-info-img/1697164321986Listening-Series_Pre-Starter.png",
46
+ },
47
+ {
48
+ id: 5,
49
+ img: "/images/promotion/promotion5.png",
50
+ type: "0",
51
+ regDate: "2024-09-01",
52
+ startDate: "2024-10-01",
53
+ endData: "2024-10-31",
54
+ title: "24년도 하반기 고려대학교 미래교육원 토셀 전문가 과정 모집",
55
+ },
56
+ {
57
+ id: 6,
58
+ img: "/images/promotion/promotion6.png",
59
+ type: "2",
60
+ regDate: "2024-09-01",
61
+ startDate: "0000-00-00",
62
+ endDate: "0000-00-00",
63
+ title: "토셀, 경찰대학교 편입학전형 / 졸업인증 평가 반영",
64
+ },
65
+ ];
66
+ return (_jsxs("div", { className: "min-h-screen w-full mx-auto", children: [_jsx("img", { src: "/images/promotion/promotionHeader.png", alt: "" }), _jsxs("div", { className: "w-[1160px] h-full flex flex-col mx-auto ", children: [_jsxs("div", { className: "flex justify-between h-14.5 border-b-1", children: [_jsxs("div", { className: "w-80 h-9.5 flex items-center bg-[#f0f0f0]/10 rounded-xl", children: [_jsx(IoIosSearch, { className: "text-2xl text-green-dark mr-3" }), _jsx("input", { type: "text", placeholder: "\uD0A4\uC6CC\uB4DC\uB97C \uC785\uB825\uD558\uC138\uC694.", className: "w-full h-full text-md bg-[#f0f0f0]/10 placehorder:text-[#7f7f7f] placehorder:font-light outline-none " })] }), _jsx("div", { className: "flex h-9.5 items-center justify-center", children: ["모두보기", "진행 중", "예정된", "토셀소식"].map((item) => (_jsx("div", { className: "text-xs p-3 flex items-center justify-center cursor-pointer", children: item }, item))) })] }), _jsx("div", { className: "pt-5", children: "asdf" })] })] }));
5
67
  }
@@ -1,10 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { HiOutlineBellSlash } from "react-icons/hi2";
3
- import { MdComputer } from "react-icons/md";
4
- import { CiCreditCard1 } from "react-icons/ci";
5
- import { IoShareSocialOutline } from "react-icons/io5";
6
- import { MdAccessTime } from "react-icons/md";
7
- import { IoIosSchool } from "react-icons/io";
8
2
  export default function Thumbnail() {
9
- return (_jsxs("div", { className: "w-[288px] flex flex-col mr-20", children: [_jsx("img", { src: "https://grepp-programmers.s3.amazonaws.com/production/file_resource/6246/Dev_Thumnail_Full_stack_Deceloper_3.png", alt: "", className: "w-full object-cover " }), _jsxs("div", { className: "font-bold text-left text-2xl p-1 mb-2 mt-2", children: ["[3\uAE30] K-Digital Training: ", _jsx("br", {}), "\uD0C0\uC785\uC2A4\uD06C\uB9BD\uD2B8\uB85C \uD568\uAED8\uD558\uB294 \uC6F9 \uD480 \uC0AC\uC774\uD074 \uAC1C\uBC1C(React, Node.js)"] }), _jsx("div", { className: "h-10", children: _jsx("button", { className: "w-full h-10 rounded-md bg-gradient-to-r from-violet-500 to-fuchsia-500 font-bold text-white", children: "\uD558\uB7EC\uAC00\uAE30" }) }), _jsxs("div", { className: "h-14 pt-4 pb-4 text-xs text-slate-300 flex justify-center items-center", children: [_jsx(HiOutlineBellSlash, { className: "mr-2" }), "\uC2E0\uCCAD \uC885\uB8CC\uC77C : ~2024-03-21"] }), _jsxs("div", { className: "h-auto pt-2 w-90/100", children: [_jsxs("div", { className: "text-slate-400 font-bold text-left flex items-center text-sm border-b-2 pt-2 pb-2", children: [_jsx("div", { className: "w-6", children: _jsx(IoIosSchool, { className: "mr-2" }) }), "\uC2E0\uCCAD \uAE30\uAC04 : 2024-04-19 ~ 2024-09-05 \uC885\uB8CC\uC77C \uC774\uD6C4 \uBB34\uC81C\uD55C \uC218\uAC15"] }), _jsxs("div", { className: "text-slate-400 font-bold text-left flex items-center text-sm border-b-2 pt-2 pb-2", children: [_jsx("div", { className: "w-6", children: _jsx(MdComputer, { className: "mr-2" }) }), "\uC628/\uC624\uD504\uB77C\uC778 \uCF54\uC2A4"] }), _jsxs("div", { className: "text-slate-400 font-bold text-left flex items-center text-sm border-b-2 pt-2 pb-2", children: [_jsx(CiCreditCard1, { className: "mr-2" }), "\u20A939,000"] }), _jsxs("div", { className: "text-slate-400 font-bold text-left flex items-center text-sm border-b-2 pt-2 pb-2", children: [_jsx(IoShareSocialOutline, { className: "mr-2" }), "\uACF5\uC720\uD558\uAE30"] }), _jsxs("div", { className: "text-slate-400 font-bold text-left flex items-center text-sm border-b-2 pt-2 pb-2", children: [_jsx(MdAccessTime, { className: "mr-2" }), "2024-05-02 \uB9C8\uC9C0\uB9C9 \uC5C5\uB370\uC774\uD2B8"] })] })] }));
3
+ return (_jsxs("div", { className: "w-[288px] flex flex-col mr-20", children: [_jsx("img", { src: "https://grepp-programmers.s3.amazonaws.com/production/file_resource/6246/Dev_Thumnail_Full_stack_Deceloper_3.png", alt: "", className: "w-full object-cover " }), _jsxs("div", { className: "font-bold text-left text-2xl p-1 mb-2 mt-2", children: ["[3\uAE30] K-Digital Training: ", _jsx("br", {}), "\uD0C0\uC785\uC2A4\uD06C\uB9BD\uD2B8\uB85C \uD568\uAED8\uD558\uB294 \uC6F9 \uD480 \uC0AC\uC774\uD074 \uAC1C\uBC1C(React, Node.js)"] }), _jsx("div", { className: "h-10", children: _jsx("button", { className: "w-full h-10 rounded-md bg-gradient-to-r from-violet-500 to-fuchsia-500 font-bold text-white", children: "\uD558\uB7EC\uAC00\uAE30" }) })] }));
10
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.96",
3
+ "version": "1.0.98",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.96
1
+ 1.0.98
@@ -2,35 +2,40 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn } from "../../util";
3
3
  import { Obstacle } from "../..";
4
4
  const widthSize = {
5
+ "3xs": "w-7",
5
6
  "2xs": "w-10",
6
7
  xs: "w-20",
7
8
  sm: "w-22.5",
8
9
  md: "w-45",
9
10
  lg: "w-50",
11
+ full: "w-full",
10
12
  };
11
13
  const heightSize = {
12
- "2xs": "h-6.25",
14
+ "3xs": "h-5.5", // 22px
15
+ "2xs": "h-6.25", // 25px
13
16
  xs: "h-7.5",
14
17
  sm: "h-11.25",
15
18
  md: "h-12.25",
16
19
  };
17
20
  export default function LabelDesign({ title, onClick, option, hoverState, }) {
18
21
  const [hover, setHover] = hoverState ?? [false, () => { }];
19
- const { width, height, text, background, className, disabled } = option ?? {};
20
- const container = {
21
- positions: "relative z-10",
22
- sizes: `${widthSize[width ?? "sm"]} ${heightSize[height ?? "xs"]}`,
23
- };
22
+ const { width, height, text, background, className, disabled, boundary } = option ?? {};
24
23
  const body = {
25
- positions: "absolute top-0 left-0",
26
- displays: "flex justify-center items-center",
24
+ positions: "relative z-10",
27
25
  sizes: "w-full h-full",
28
- clickable: onClick && "cursor-pointer",
26
+ displays: "flex justify-center items-center",
29
27
  background: background ?? "bg-gray-light",
28
+ clickable: onClick && "cursor-pointer",
30
29
  texts: text ?? "text-gray-dim",
31
30
  animation: "duration-500",
32
31
  fonts: "font-pretendard-light",
33
- styles: height !== "xs" ? "rounded-lgx" : "rounded-md text-xs",
32
+ styles: height === "xs" || height === "2xs" || height === "3xs"
33
+ ? "rounded-md text-xs"
34
+ : "rounded-lgx",
35
+ };
36
+ const container = {
37
+ className,
38
+ sizes: `${widthSize[width ?? "sm"]} ${heightSize[height ?? "xs"]}`,
34
39
  };
35
- return (_jsx("div", { className: className, children: _jsxs("div", { className: cn(container), children: [_jsx("div", { className: cn(body), onClick: onClick, onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), children: title }), _jsx(Obstacle, { disabled: disabled })] }) }));
40
+ return (_jsxs("div", { className: cn(container), children: [_jsx("div", { className: cn(body), onClick: onClick, onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), children: title }), _jsx(Obstacle, { disabled: disabled })] }));
36
41
  }
@@ -1,2 +1,2 @@
1
1
  import { ObstacleProps } from "../../interface/widget/Obstacle";
2
- export default function ObstacleDesign({ disabled, children, option, }: ObstacleProps): false | import("react/jsx-runtime").JSX.Element | undefined;
2
+ export default function ObstacleDesign({ showAction, disabled, children, option, }: ObstacleProps): false | import("react/jsx-runtime").JSX.Element | undefined;
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cn } from "../../util";
3
- export default function ObstacleDesign({ disabled, children, option, }) {
3
+ export default function ObstacleDesign({ showAction, disabled, children, option, }) {
4
+ const { isVisible } = showAction ?? {};
4
5
  const { position, background, size } = option ?? {};
5
6
  const obstacle = {
6
7
  default: "absolute z-20",
@@ -9,5 +10,5 @@ export default function ObstacleDesign({ disabled, children, option, }) {
9
10
  sizes: "w-full h-full",
10
11
  background: background ?? "bg-white/30",
11
12
  };
12
- return (disabled && (_jsx("div", { onClick: typeof disabled === "function" ? disabled : undefined, className: cn(obstacle), children: children })));
13
+ return ((isVisible || disabled) && (_jsx("div", { onClick: typeof disabled === "function" ? disabled : undefined, className: cn(obstacle), children: children })));
13
14
  }
package/widget/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
+ export { default as Box } from "./template/Box";
1
2
  export { default as Input } from "./template/Input";
3
+ export { default as Cluster } from "./template/Cluster";
2
4
  export { default as Counter } from "./template/Counter";
3
5
  export { default as Select } from "./template/Select";
4
6
  export { default as DatePicker } from "./template/DatePicker";
package/widget/index.js CHANGED
@@ -1,4 +1,6 @@
1
+ export { default as Box } from "./template/Box";
1
2
  export { default as Input } from "./template/Input";
3
+ export { default as Cluster } from "./template/Cluster";
2
4
  export { default as Counter } from "./template/Counter";
3
5
  export { default as Select } from "./template/Select";
4
6
  export { default as DatePicker } from "./template/DatePicker";
@@ -0,0 +1,2 @@
1
+ import { CountBoxProps } from "../../../interface";
2
+ export default function CountBox({ title, count, total, option, }: CountBoxProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../../util";
3
+ export default function CountBox({ title, count, total, option, }) {
4
+ const { background, titleColor, countColor } = option ?? {};
5
+ const container = {
6
+ displays: "flex flex-col gap-y-1",
7
+ sizes: "flex-1 h-[62px]",
8
+ boundaries: "rounded-[8px] pt-2.5 pl-2.5",
9
+ backgrounds: background ?? "bg-gray-light/30",
10
+ };
11
+ const titleBox = {
12
+ texts: "text-xs",
13
+ color: titleColor ?? "text-gray-medium",
14
+ };
15
+ const countBox = {
16
+ texts: "text-[20px]",
17
+ color: countColor ?? "text-black",
18
+ };
19
+ const totalBox = {
20
+ color: "text-gray-dark",
21
+ };
22
+ return (_jsxs("div", { className: cn(container), children: [_jsx("div", { className: cn(titleBox), children: title }), _jsxs("div", { className: "flex items-end leading-tight font-pretendard-bold", children: [_jsx("div", { className: cn(countBox), children: count }), total && (_jsxs("div", { className: "flex items-end text-xs", children: [_jsx("div", { className: "text-gray-medium", children: "/" }), _jsx("div", { className: cn(totalBox), children: total })] }))] })] }));
23
+ }
@@ -0,0 +1,2 @@
1
+ import { CountWithScriptBoxProps } from "../../../interface";
2
+ export default function CountWithScriptBox({ title, count, script, option, }: CountWithScriptBoxProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../../util";
3
+ import { LineBreaks } from "../../../text";
4
+ export default function CountWithScriptBox({ title, count, script, option, }) {
5
+ const { background, countColor, scriptColor } = option ?? {};
6
+ const container = {
7
+ displays: "flex justify-between items-start",
8
+ sizes: "flex-1 h-[75px]",
9
+ boundaries: "pt-2.5 pl-2.5 pr-[14px] rounded-[8px]",
10
+ backgrounds: background ?? "bg-gray-light/30",
11
+ };
12
+ const countBox = {
13
+ texts: "text-[20px]",
14
+ color: countColor ?? "text-black",
15
+ fonts: "font-pretendard-bold",
16
+ };
17
+ const scriptBox = {
18
+ texts: "text-xs",
19
+ color: scriptColor ?? "text-gray-medium",
20
+ };
21
+ return (_jsxs("div", { className: cn(container), children: [_jsxs("div", { className: "flex flex-col gap-y-1.5", children: [_jsx("div", { className: "text-[16px] leading-tight font-pretendard-bold", children: title }), _jsx(LineBreaks, { texts: script, className: cn(scriptBox) })] }), count && _jsx("div", { className: cn(countBox), children: count })] }));
22
+ }
@@ -0,0 +1 @@
1
+ export default function InfoBox(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export default function InfoBox() {
3
+ return _jsx("div", {});
4
+ }
@@ -0,0 +1,9 @@
1
+ import { BoxProps } from "../../../interface";
2
+ import CountBox from "./CountBox";
3
+ import CountWithScriptBox from "./CountWithScript";
4
+ declare function Box({ title }: BoxProps): import("react/jsx-runtime").JSX.Element;
5
+ declare namespace Box {
6
+ var Count: typeof CountBox;
7
+ var CountWithScript: typeof CountWithScriptBox;
8
+ }
9
+ export default Box;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import CountBox from "./CountBox";
3
+ import CountWithScriptBox from "./CountWithScript";
4
+ function Box({ title }) {
5
+ return _jsx("div", { className: "border-2 flex-1 h-16", children: title });
6
+ }
7
+ Box.Count = CountBox;
8
+ Box.CountWithScript = CountWithScriptBox;
9
+ export default Box;
@@ -0,0 +1,2 @@
1
+ import { ClusterProps } from "../../../interface";
2
+ export default function Cluster({ widgets }: ClusterProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box } from "../..";
3
+ import { cn } from "../../../util";
4
+ export default function Cluster({ widgets }) {
5
+ const container = {
6
+ displays: "flex flex-col gap-y-3",
7
+ sizes: "w-full",
8
+ };
9
+ const body = {
10
+ displays: "flex gap-x-2.5",
11
+ sizes: "w-full",
12
+ };
13
+ return (_jsx("div", { className: cn(container), children: widgets.map((columns) => (_jsx("div", { className: cn(body), children: columns.map((column, index) => (_jsx(ClusterWidget, { ...column }, index))) }))) }));
14
+ }
15
+ function ClusterWidget({ type, data }) {
16
+ if (type === "box")
17
+ return _jsx(Box, { ...data });
18
+ if (type === "countBox")
19
+ return _jsx(Box.Count, { ...data });
20
+ if (type === "countWithScriptBox")
21
+ return _jsx(Box.CountWithScript, { ...data });
22
+ return null;
23
+ }
@@ -2,25 +2,40 @@ 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
4
  const paddingSize = {
5
+ sm: "p-1",
5
6
  md: "p-1.5",
6
7
  lg: "p-2.5",
7
8
  };
8
9
  const widthSize = {
10
+ sm: "w-auto",
9
11
  md: "w-81",
10
12
  lg: "w-100",
11
13
  };
12
14
  const heightSize = {
15
+ sm: "h-7.5",
13
16
  md: "h-10.5",
14
17
  lg: "h-20",
15
18
  };
16
19
  const gapSize = {
20
+ sm: "gap-x-1",
17
21
  md: "gap-x-1.5",
18
22
  lg: "gap-x-2.5",
19
23
  };
20
24
  const textSize = {
25
+ sm: "text-xs",
21
26
  md: "text-sm",
22
27
  lg: "text-base",
23
28
  };
29
+ const buttonSize = {
30
+ sm: "w-[29px] h-[22px]",
31
+ md: "w-7 h-7",
32
+ lg: "w-12 h-12",
33
+ };
34
+ const boundarySize = {
35
+ sm: "rounded-[4px]",
36
+ md: "rounded-full",
37
+ lg: "rounded-full",
38
+ };
24
39
  function SelectSwitch({ state, selectOptions: selectOptionsInput, option, }) {
25
40
  const selectOptions = selectOptionsInput.map(toSelectOption);
26
41
  const { text, size, className } = option ?? {};
@@ -31,14 +46,16 @@ function SelectSwitch({ state, selectOptions: selectOptionsInput, option, }) {
31
46
  sizes: `${widthSize[size ?? "md"]} ${heightSize[size ?? "md"]}`,
32
47
  displays: `flex ${gapSize[size ?? "md"]}`,
33
48
  paddings: paddingSize[size ?? "md"],
34
- styles: "rounded-full bg-gray-light",
49
+ styles: "bg-gray-light",
50
+ boundaries: boundarySize[size ?? "md"],
35
51
  };
36
52
  const button = (flag) => ({
37
53
  displays: "flex flex-1 gap-x-3 justify-center items-center",
38
54
  backgrounds: flag ? "bg-white" : "bg-transparent",
55
+ sizes: size === "sm" && buttonSize[size ?? "sm"],
39
56
  text,
40
57
  textSizes: textSize[size ?? "md"],
41
- styles: "rounded-full ",
58
+ boundaries: boundarySize[size ?? "md"],
42
59
  });
43
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)))) }) }));
44
61
  }
@@ -0,0 +1,2 @@
1
+ import { SelectToggleProps } from "../../../interface";
2
+ export default function SelectToggle<T>({ state, selectOptions: selectOptionsInput, }: SelectToggleProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { toSelectOption } from "../../../interface";
3
+ import { cn } from "../../../util";
4
+ export default function SelectToggle({ state, selectOptions: selectOptionsInput, }) {
5
+ const selectOptions = selectOptionsInput?.map(toSelectOption);
6
+ const [value, setValue] = state;
7
+ const isOff = value === selectOptions[0].value;
8
+ const container = {
9
+ positions: "relative",
10
+ displays: "flex items-center",
11
+ sizes: "w-10 h-4.5",
12
+ backgrounds: isOff ? "bg-crimson-burgundy" : "bg-green-dark",
13
+ boundaries: "rounded-full p-0.5",
14
+ };
15
+ const controller = {
16
+ positions: "absolute",
17
+ locations: isOff ? "left-0.5" : "left-[calc(100%-1rem)]",
18
+ sizes: "w-[14px] h-[14px]",
19
+ backgrounds: "bg-white",
20
+ boundaries: "rounded-full",
21
+ animations: "duration-200",
22
+ };
23
+ const toggle = () => {
24
+ if (value === selectOptions[0].value)
25
+ return setValue(selectOptions[1].value);
26
+ return setValue(selectOptions[0].value);
27
+ };
28
+ return (_jsx("button", { onClick: toggle, className: cn(container), children: _jsx("div", { className: cn(controller) }) }));
29
+ }
@@ -5,6 +5,7 @@ import Handle from "./Handle";
5
5
  import Switch from "./Switch";
6
6
  import Swipe from "./Swipe";
7
7
  import Pagination from "./Pagination";
8
+ import Toggle from "./Toggle";
8
9
  declare const Select: typeof _Select & {
9
10
  LG: typeof LG;
10
11
  Tag: typeof Tag;
@@ -12,5 +13,6 @@ declare const Select: typeof _Select & {
12
13
  Switch: typeof Switch;
13
14
  Swipe: typeof Swipe;
14
15
  Pagination: typeof Pagination;
16
+ Toggle: typeof Toggle;
15
17
  };
16
18
  export default Select;
@@ -5,6 +5,7 @@ import Handle from "./Handle";
5
5
  import Switch from "./Switch";
6
6
  import Swipe from "./Swipe";
7
7
  import Pagination from "./Pagination";
8
+ import Toggle from "./Toggle";
8
9
  const Select = Object.assign(_Select, {
9
10
  LG,
10
11
  Tag,
@@ -12,5 +13,6 @@ const Select = Object.assign(_Select, {
12
13
  Switch,
13
14
  Swipe,
14
15
  Pagination,
16
+ Toggle,
15
17
  });
16
18
  export default Select;