@edu-tosel/design 1.0.95 → 1.0.97

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 (68) hide show
  1. package/card/design/Card.design.d.ts +1 -1
  2. package/card/design/Card.design.js +8 -3
  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/ReceiptCard.design.d.ts +1 -0
  8. package/card/design/ReceiptCard.design.js +5 -0
  9. package/card/design/SubmitCard.design.d.ts +7 -0
  10. package/card/design/SubmitCard.design.js +12 -0
  11. package/card/design/TableCard.design.d.ts +1 -1
  12. package/card/design/TableCard.design.js +8 -3
  13. package/card/design/widget/TitleBox.design.d.ts +4 -0
  14. package/card/design/widget/TitleBox.design.js +16 -0
  15. package/card/index.d.ts +2 -0
  16. package/card/index.js +2 -0
  17. package/card/template/ControlCard.d.ts +4 -0
  18. package/card/template/ControlCard.js +6 -0
  19. package/card/template/ProgressCard/Small.d.ts +1 -1
  20. package/card/template/ProgressCard/Small.js +15 -6
  21. package/card/template/SubmitCard/index.d.ts +2 -0
  22. package/card/template/SubmitCard/index.js +5 -0
  23. package/card/template/TableCard.d.ts +4 -2
  24. package/card/template/TableCard.js +3 -2
  25. package/interface/Card.d.ts +24 -5
  26. package/interface/Property.d.ts +2 -0
  27. package/interface/TextBox.d.ts +20 -0
  28. package/interface/TextBox.js +1 -0
  29. package/interface/index.d.ts +1 -0
  30. package/interface/index.js +1 -0
  31. package/interface/widget/Box.d.ts +25 -0
  32. package/interface/widget/Box.js +1 -0
  33. package/interface/widget/Cluster.d.ts +18 -0
  34. package/interface/widget/Cluster.js +1 -0
  35. package/interface/widget/Obstacle.d.ts +2 -0
  36. package/interface/widget/Select.d.ts +7 -0
  37. package/interface/widget/WidgetOption.d.ts +13 -0
  38. package/interface/widget/WidgetOption.js +1 -0
  39. package/interface/widget/index.d.ts +3 -1
  40. package/interface/widget/index.js +2 -0
  41. package/layout/design/TextBox.design.d.ts +2 -0
  42. package/layout/design/TextBox.design.js +34 -0
  43. package/layout/index.d.ts +1 -0
  44. package/layout/index.js +1 -0
  45. package/layout/template/TextBox.d.ts +7 -0
  46. package/layout/template/TextBox.js +10 -0
  47. package/package.json +1 -1
  48. package/version.txt +1 -1
  49. package/widget/design/Label.design.js +10 -4
  50. package/widget/design/Obstacle.design.d.ts +1 -1
  51. package/widget/design/Obstacle.design.js +3 -2
  52. package/widget/index.d.ts +2 -0
  53. package/widget/index.js +2 -0
  54. package/widget/template/Box/CountBox.d.ts +2 -0
  55. package/widget/template/Box/CountBox.js +23 -0
  56. package/widget/template/Box/CountWithScript.d.ts +2 -0
  57. package/widget/template/Box/CountWithScript.js +22 -0
  58. package/widget/template/Box/InfoBox.d.ts +1 -0
  59. package/widget/template/Box/InfoBox.js +4 -0
  60. package/widget/template/Box/index.d.ts +9 -0
  61. package/widget/template/Box/index.js +9 -0
  62. package/widget/template/Cluster/index.d.ts +2 -0
  63. package/widget/template/Cluster/index.js +23 -0
  64. package/widget/template/Select/Switch.js +19 -2
  65. package/widget/template/Select/Toggle.d.ts +2 -0
  66. package/widget/template/Select/Toggle.js +29 -0
  67. package/widget/template/Select/index.d.ts +2 -0
  68. 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,8 @@
1
1
  import { Fragment as _Fragment, 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";
4
6
  const widthSize = {
5
7
  "4xs": "w-15",
6
8
  "3xs": "w-40",
@@ -27,10 +29,13 @@ const heightSize = {
27
29
  "2xl": "h-127.5", // 510px
28
30
  "3xl": "h-138.5", // 554px
29
31
  full: "h-full", // 100%
30
- auto: "h-auto min-h-80", // 100%
32
+ auto: "h-auto p-5", // 100%
31
33
  };
32
- export default function CardDesign({ header, children, option, debug, }) {
34
+ export default function CardDesign({ header, disabled, children, option, debug, }) {
33
35
  const { setIsOwn } = useActionStore();
36
+ const { isDisabled, obstacle, disabledAction } = disabled ?? {
37
+ isDisabled: false,
38
+ };
34
39
  const { className, boundary, rounded, height, width, text, background, onClick, onMouse, overflow, } = option ?? {};
35
40
  const container = {
36
41
  positions: "relative",
@@ -49,5 +54,5 @@ export default function CardDesign({ header, children, option, debug, }) {
49
54
  overflow,
50
55
  className,
51
56
  };
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 })] }));
57
+ return (_jsx("div", { onMouseEnter: onMouse ? () => onMouse[1](true) : () => { }, onMouseLeave: onMouse ? () => onMouse[1](false) : () => { }, className: cn(container), children: _jsxs(Action.Show, { actions: [[isDisabled, obstacle ?? _jsx(Obstacle.Blur, {})]], children: [header && _jsx(_Fragment, { children: header }), _jsx("div", { onClick: onClick && onClick, className: cn(body), children: children })] }) }));
53
58
  }
@@ -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
  }
@@ -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
+ }
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from "react";
2
+ import { LabelWidget } from "../../interface";
3
+ export interface SubmitCardProps {
4
+ children?: ReactNode;
5
+ button?: LabelWidget;
6
+ }
7
+ export default function SubmitCardDesign({ children, button, }: SubmitCardProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import CardDesign from "./Card.design";
3
+ import { Label } from "../../widget";
4
+ export default function SubmitCardDesign({ children, button, }) {
5
+ return (_jsxs(CardDesign, { option: {
6
+ width: "lg",
7
+ height: "lg",
8
+ className: "p-5",
9
+ }, children: [children, button && (_jsx(Label.Button, { ...button, option: {
10
+ className: "absolute bottom-5 right-5",
11
+ } }))] }));
12
+ }
@@ -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, dataSet, dataField, option, }: TableCardProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -6,16 +6,21 @@ import Card from "./Card.design";
6
6
  import { DataField, Action, Row, Lock } from "../..";
7
7
  import { Obstacle } from "../..";
8
8
  import { v4 } from "uuid";
9
- export default function TableCardDesign({ dataSet, dataField, option, }) {
9
+ export default function TableCardDesign({ header, dataSet, dataField, option, }) {
10
10
  const { width, height, padding, boundary, isDisabled, disabledScript } = option ?? {};
11
11
  const { order } = useActionStore();
12
12
  const id = useId();
13
13
  const orders = order[id] ?? [];
14
14
  const container = {
15
15
  className: option?.className,
16
- paddings: padding ?? "pb-10",
16
+ paddings: !header ? "pb-10" : "pb-25",
17
17
  };
18
- return (_jsx(Card, { header: !option?.noHeader && _jsx(DataField.Card, { id: id, dataField: dataField }), option: {
18
+ const headerBox = {
19
+ displays: "flex items-center justify-center",
20
+ sizes: "w-full h-15",
21
+ styles: "overflow-hidden",
22
+ };
23
+ return (_jsx(Card, { header: !option?.noHeader && (_jsxs("div", { children: [_jsx(DataField.Card, { id: id, dataField: dataField }), header && _jsx("div", { className: cn(headerBox), children: header })] })), option: {
19
24
  boundary,
20
25
  className: cn(container),
21
26
  width: width ?? "lg",
@@ -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,9 +1,11 @@
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";
7
8
  export { default as ProgressCard } from "./template/ProgressCard";
8
9
  export { default as RollCard } from "./template/RollCard";
9
10
  export { default as TableCard } from "./template/TableCard";
11
+ export { default as SubmitCard } from "./template/SubmitCard";
package/card/index.js CHANGED
@@ -1,9 +1,11 @@
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";
7
8
  export { default as ProgressCard } from "./template/ProgressCard";
8
9
  export { default as RollCard } from "./template/RollCard";
9
10
  export { default as TableCard } from "./template/TableCard";
11
+ export { default as SubmitCard } from "./template/SubmitCard";
@@ -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
+ }
@@ -1,2 +1,2 @@
1
1
  import { ProgressCardProps } from "../../../interface";
2
- export default function ProgressCardSmall({ titles, displays, checks, nowFocus, theme, }: ProgressCardProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function ProgressCardSmall({ titles, displays, checks, nowFocus, theme, option, }: ProgressCardProps): import("react/jsx-runtime").JSX.Element;
@@ -10,7 +10,8 @@ const text = {
10
10
  green: "text-green-dark",
11
11
  blue: "text-blue-navy",
12
12
  };
13
- export default function ProgressCardSmall({ titles, displays, checks, nowFocus, theme = "green", }) {
13
+ export default function ProgressCardSmall({ titles, displays, checks, nowFocus, theme = "green", option, }) {
14
+ const { size = "md" } = option ?? {};
14
15
  const progressBox = {
15
16
  positions: "absolute top-2.5 left-2.5",
16
17
  displays: "flex",
@@ -25,13 +26,21 @@ export default function ProgressCardSmall({ titles, displays, checks, nowFocus,
25
26
  });
26
27
  const titleBox = {
27
28
  positions: "absolute top-2.5 right-2.5",
28
- sizes: "max-w-32.5 w-full h-16",
29
- displays: "flex flex-col items-end gap-y-3",
29
+ sizes: "max-w-40 w-full h-16",
30
+ displays: "flex flex-col items-end",
30
31
  backgrounds: nowFocus === true ? bgLight[theme ?? "green"] : "bg-transparent",
31
- boundaries: "rounded-[10px] pt-2 pr-3.5",
32
+ boundaries: "rounded-[10px]",
33
+ styles: titles.size === "md"
34
+ ? "pt-2 pr-3.5 gap-y-3"
35
+ : "justify-center gap-y-1.5 pr-2",
36
+ };
37
+ const titleStyle = {
38
+ texts: "leading-none",
39
+ sizes: titles.size === "sm" ? "text-[12px]" : "text-[20px] font-pretendard-bold",
40
+ styles: text[theme],
32
41
  };
33
42
  return (_jsxs(CardDesign, { option: {
34
- width: "md",
43
+ width: size ?? "md",
35
44
  height: "5xs",
36
- }, children: [_jsx("div", { className: cn(progressBox), children: displays.map(({ title, subtitle }, index) => (_jsxs("div", { className: cn(stepBox(index === nowFocus)), children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "leading-none text-[12px] font-pretendard-bold", children: title }), _jsx(SVG.Operation.Checked, { flag: checks[index], size: 25, theme: "green" })] }), _jsx("div", { className: `text-[12px] ${text[theme]}`, children: subtitle })] }, title))) }), _jsxs("div", { className: cn(titleBox), children: [_jsx("div", { className: `text-[20px] leading-none font-pretendard-bold ${text[theme]}`, children: titles.title }), _jsx("div", { className: `text-[12px] leading-none ${text[theme]}`, children: titles.subtitle })] })] }));
45
+ }, children: [_jsx("div", { className: cn(progressBox), children: displays.map(({ title, subtitle }, index) => (_jsxs("div", { className: cn(stepBox(index === nowFocus)), children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "leading-none text-[12px] font-pretendard-bold", children: title }), _jsx(SVG.Operation.Checked, { flag: checks[index], size: 25, theme: "green" })] }), _jsx("div", { className: `text-[12px] ${text[theme]}`, children: subtitle })] }, title))) }), _jsxs("div", { className: cn(titleBox), children: [_jsx("div", { className: cn(titleStyle), children: titles.title }), _jsx("div", { className: `text-[12px] leading-none ${text[theme]}`, children: titles.subtitle })] })] }));
37
46
  }
@@ -0,0 +1,2 @@
1
+ import { SubmitCardProps } from "../../design/SubmitCard.design";
2
+ export default function SubmitCard(props: SubmitCardProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import SubmitCardDesign from "../../design/SubmitCard.design";
3
+ export default function SubmitCard(props) {
4
+ return _jsx(SubmitCardDesign, { ...props });
5
+ }
@@ -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: {
@@ -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
  };
@@ -144,5 +151,17 @@ export interface ProgressCardProps {
144
151
  nowFocus?: number | boolean;
145
152
  displays: Titles[];
146
153
  theme?: Theme;
154
+ option?: {
155
+ size?: Size;
156
+ };
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;
147
166
  }
148
167
  export {};
@@ -58,6 +58,8 @@ export type Titles = {
58
58
  color?: string;
59
59
  titleColor?: string;
60
60
  subtitleColor?: string;
61
+ size?: Size;
62
+ icon?: string;
61
63
  };
62
64
  export interface Log<K extends string, T extends string | number> {
63
65
  prints: K[];
@@ -0,0 +1,20 @@
1
+ import { Size, Titles } from "./Property";
2
+ export interface TextBoxDesignProps {
3
+ titles: Titles;
4
+ option?: {
5
+ isCenter?: boolean;
6
+ size?: Size;
7
+ className?: string;
8
+ };
9
+ children?: React.ReactNode;
10
+ }
11
+ export interface TextBoxProps extends Omit<TextBoxDesignProps, "children"> {
12
+ }
13
+ export interface TextBoxWithImageProps extends TextBoxProps {
14
+ image: {
15
+ src: string;
16
+ width?: string;
17
+ height?: string;
18
+ className?: string;
19
+ };
20
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -9,3 +9,4 @@ export * from "./Overlay";
9
9
  export * from "./Property";
10
10
  export * from "./Theme";
11
11
  export * from "./Shelf";
12
+ export * from "./TextBox";
@@ -9,3 +9,4 @@ export * from "./Overlay";
9
9
  export * from "./Property";
10
10
  export * from "./Theme";
11
11
  export * from "./Shelf";
12
+ export * from "./TextBox";
@@ -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 = {
@@ -0,0 +1,2 @@
1
+ import { TextBoxDesignProps } from "../../interface";
2
+ export default function TextBoxDesign({ titles, children, option, }: TextBoxDesignProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { LineBreaks } from "../../text";
3
+ import { cn } from "../../util";
4
+ const titleSize = {
5
+ md: "text-[16px]",
6
+ lg: "text-[20px]",
7
+ };
8
+ const subtitleSize = {
9
+ md: "text-[12px]",
10
+ lg: "text-[16px]",
11
+ };
12
+ export default function TextBoxDesign({ titles, children, option, }) {
13
+ const { title, subtitle, titleColor, color, subtitleColor } = titles;
14
+ const { size, isCenter, className } = option ?? {};
15
+ console.log(isCenter);
16
+ const container = {
17
+ displays: "flex flex-col",
18
+ center: isCenter && "items-center",
19
+ styles: color,
20
+ className: className ?? "gap-y-2",
21
+ };
22
+ const titleBox = {
23
+ colors: titleColor ?? color ?? "text-gray-dark",
24
+ sizes: titleSize[size ?? "md"],
25
+ fonts: "font-pretendard-bold",
26
+ styles: "leading-tight",
27
+ };
28
+ const subtitleBox = {
29
+ colors: subtitleColor ?? color ?? "text-gray-medium",
30
+ sizes: subtitleSize[size ?? "md"],
31
+ center: isCenter && "text-center",
32
+ };
33
+ return (_jsxs("div", { className: cn(container), children: [_jsx("div", { className: cn(titleBox), children: title }), children, _jsx(LineBreaks, { texts: subtitle, className: cn(subtitleBox) })] }));
34
+ }
package/layout/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export { default as Gallery } from "./template/Gallery";
8
8
  export { default as Row } from "./template/Row";
9
9
  export { default as Shelf } from "./template/Shelf";
10
10
  export { default as Tab } from "./template/Tab";
11
+ export { default as TextBox } from "./template/TextBox";
package/layout/index.js CHANGED
@@ -8,3 +8,4 @@ export { default as Gallery } from "./template/Gallery";
8
8
  export { default as Row } from "./template/Row";
9
9
  export { default as Shelf } from "./template/Shelf";
10
10
  export { default as Tab } from "./template/Tab";
11
+ export { default as TextBox } from "./template/TextBox";
@@ -0,0 +1,7 @@
1
+ import { TextBoxProps, TextBoxWithImageProps } from "../../interface";
2
+ declare function TitleBox(props: TextBoxProps): import("react/jsx-runtime").JSX.Element;
3
+ declare namespace TitleBox {
4
+ var Image: typeof TitleBoxWithImage;
5
+ }
6
+ declare function TitleBoxWithImage({ titles, image, option }: TextBoxWithImageProps): import("react/jsx-runtime").JSX.Element;
7
+ export default TitleBox;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import TextBoxDesign from "../design/TextBox.design";
3
+ function TitleBox(props) {
4
+ return _jsx(TextBoxDesign, { ...props });
5
+ }
6
+ function TitleBoxWithImage({ titles, image, option }) {
7
+ return (_jsx(TextBoxDesign, { titles: titles, option: { isCenter: true, size: "lg", className: "gap-y-8", ...option }, children: _jsx("img", { src: image.src, width: image.width, height: image.height, className: image.className }) }));
8
+ }
9
+ TitleBox.Image = TitleBoxWithImage;
10
+ export default TitleBox;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.95",
3
+ "version": "1.0.97",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.95
1
+ 1.0.97
@@ -2,24 +2,28 @@ 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 ?? {};
22
+ const { width, height, text, background, className, disabled, boundary } = option ?? {};
20
23
  const container = {
21
24
  positions: "relative z-10",
22
25
  sizes: `${widthSize[width ?? "sm"]} ${heightSize[height ?? "xs"]}`,
26
+ className,
23
27
  };
24
28
  const body = {
25
29
  positions: "absolute top-0 left-0",
@@ -30,7 +34,9 @@ export default function LabelDesign({ title, onClick, option, hoverState, }) {
30
34
  texts: text ?? "text-gray-dim",
31
35
  animation: "duration-500",
32
36
  fonts: "font-pretendard-light",
33
- styles: height !== "xs" ? "rounded-lgx" : "rounded-md text-xs",
37
+ styles: height === "xs" || height === "2xs" || height === "3xs"
38
+ ? "rounded-md text-xs"
39
+ : "rounded-lgx",
34
40
  };
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 })] }) }));
41
+ 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
42
  }
@@ -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;