@edu-tosel/design 1.0.65 → 1.0.66

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 (41) hide show
  1. package/asset/SVG.d.ts +2 -0
  2. package/asset/svg/Direction.d.ts +4 -0
  3. package/asset/svg/Direction.js +11 -0
  4. package/asset/svg/Direction.tsx +40 -0
  5. package/card/design/Card.design.js +13 -12
  6. package/card/design/CustomCard.design.d.ts +2 -0
  7. package/card/design/CustomCard.design.js +23 -0
  8. package/card/index.d.ts +1 -0
  9. package/card/index.js +1 -0
  10. package/card/template/CustomCard.d.ts +3 -0
  11. package/card/template/CustomCard.js +6 -0
  12. package/card/template/InfoCard/Academy.d.ts +1 -1
  13. package/card/template/InfoCard/Academy.js +4 -4
  14. package/card/template/NavCard.js +5 -1
  15. package/card/template/ProgressCard/Small.js +1 -1
  16. package/interface/Action.d.ts +6 -1
  17. package/interface/Board.d.ts +2 -1
  18. package/interface/Card.d.ts +5 -1
  19. package/interface/Data.d.ts +41 -0
  20. package/interface/Data.js +4 -0
  21. package/interface/Property.d.ts +8 -24
  22. package/interface/index.d.ts +2 -1
  23. package/interface/index.js +2 -1
  24. package/interface/widget/index.d.ts +1 -0
  25. package/layout/design/DataField.design.js +6 -4
  26. package/layout/design/Row.design/SelectRoll.d.ts +7 -0
  27. package/layout/design/Row.design/SelectRoll.js +39 -0
  28. package/layout/design/{Row.design.d.ts → Row.design/index.d.ts} +1 -1
  29. package/layout/design/{Row.design.js → Row.design/index.js} +13 -6
  30. package/layout/template/DataField.js +1 -1
  31. package/layout/template/Gallery.d.ts +3 -1
  32. package/layout/template/Gallery.js +4 -2
  33. package/layout/template/Row.js +1 -1
  34. package/layout/template/Tab.d.ts +1 -0
  35. package/layout/template/Tab.js +5 -3
  36. package/package.json +1 -1
  37. package/version.txt +1 -1
  38. package/widget/design/Label.design.js +1 -0
  39. package/widget/template/Input/Form.d.ts +1 -1
  40. package/widget/template/Input/Form.js +3 -2
  41. package/widget/template/Obstacle.js +2 -2
package/asset/SVG.d.ts CHANGED
@@ -14,6 +14,8 @@ declare const SVG: {
14
14
  Close: typeof Close;
15
15
  Direction: {
16
16
  Right: ({ className }: Direction) => import("react/jsx-runtime").JSX.Element;
17
+ Asc: () => import("react/jsx-runtime").JSX.Element;
18
+ Desc: () => import("react/jsx-runtime").JSX.Element;
17
19
  };
18
20
  Email: typeof Email;
19
21
  Icon: {
@@ -2,7 +2,11 @@ interface Direction {
2
2
  className?: string;
3
3
  }
4
4
  declare function Right({ className }: Direction): import("react/jsx-runtime").JSX.Element;
5
+ declare function Asc(): import("react/jsx-runtime").JSX.Element;
6
+ declare function Desc(): import("react/jsx-runtime").JSX.Element;
5
7
  declare const Direction: {
6
8
  Right: typeof Right;
9
+ Asc: typeof Asc;
10
+ Desc: typeof Desc;
7
11
  };
8
12
  export default Direction;
@@ -1,8 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from "react";
2
3
  function Right({ className }) {
3
4
  return (_jsxs("svg", { className: className, xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: [_jsx("path", { d: "M21 12C21 13.1819 20.7672 14.3522 20.3149 15.4442C19.8626 16.5361 19.1997 17.5282 18.364 18.364C17.5282 19.1997 16.5361 19.8626 15.4442 20.3149C14.3522 20.7672 13.1819 21 12 21C10.8181 21 9.64778 20.7672 8.55585 20.3149C7.46392 19.8626 6.47177 19.1997 5.63604 18.364C4.80031 17.5282 4.13738 16.5361 3.68508 15.4442C3.23279 14.3522 3 13.1819 3 12C3 9.61305 3.94821 7.32387 5.63604 5.63604C7.32387 3.94821 9.61305 3 12 3C14.3869 3 16.6761 3.94821 18.364 5.63604C20.0518 7.32387 21 9.61305 21 12Z", fill: "#105652", stroke: "#105652", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M12.75 15L15.75 12M15.75 12L12.75 9M15.75 12H8.25", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }));
4
5
  }
6
+ function Asc() {
7
+ const id = useId();
8
+ return (_jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M7.15859 15.0437C6.7079 15.9134 7.27152 17 8.17239 17H15.8279C16.7282 17 17.2919 15.9134 16.8417 15.0437L13.0145 7.65229C12.5638 6.78257 11.4365 6.78257 10.9858 7.65229L7.15859 15.0437Z", fill: "#105652" }) }, id));
9
+ }
10
+ function Desc() {
11
+ const id = useId();
12
+ return (_jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M16.8414 8.95628C17.2921 8.08657 16.7285 7 15.8276 7L8.1721 7C7.27176 7 6.70813 8.08657 7.15831 8.95628L10.9855 16.3477C11.4362 17.2174 12.5635 17.2174 13.0142 16.3477L16.8414 8.95628Z", fill: "#105652" }) }, id));
13
+ }
5
14
  const Direction = {
6
15
  Right,
16
+ Asc,
17
+ Desc,
7
18
  };
8
19
  export default Direction;
@@ -1,3 +1,4 @@
1
+ import { useId } from "react";
1
2
  interface Direction {
2
3
  className?: string;
3
4
  }
@@ -30,7 +31,46 @@ function Right({ className }: Direction) {
30
31
  );
31
32
  }
32
33
 
34
+ function Asc() {
35
+ const id = useId();
36
+ return (
37
+ <svg
38
+ key={id}
39
+ width="24"
40
+ height="24"
41
+ viewBox="0 0 24 24"
42
+ fill="none"
43
+ xmlns="http://www.w3.org/2000/svg"
44
+ >
45
+ <path
46
+ d="M7.15859 15.0437C6.7079 15.9134 7.27152 17 8.17239 17H15.8279C16.7282 17 17.2919 15.9134 16.8417 15.0437L13.0145 7.65229C12.5638 6.78257 11.4365 6.78257 10.9858 7.65229L7.15859 15.0437Z"
47
+ fill="#105652"
48
+ />
49
+ </svg>
50
+ );
51
+ }
52
+ function Desc() {
53
+ const id = useId();
54
+ return (
55
+ <svg
56
+ key={id}
57
+ width="24"
58
+ height="24"
59
+ viewBox="0 0 24 24"
60
+ fill="none"
61
+ xmlns="http://www.w3.org/2000/svg"
62
+ >
63
+ <path
64
+ d="M16.8414 8.95628C17.2921 8.08657 16.7285 7 15.8276 7L8.1721 7C7.27176 7 6.70813 8.08657 7.15831 8.95628L10.9855 16.3477C11.4362 17.2174 12.5635 17.2174 13.0142 16.3477L16.8414 8.95628Z"
65
+ fill="#105652"
66
+ />
67
+ </svg>
68
+ );
69
+ }
70
+
33
71
  const Direction = {
34
72
  Right,
73
+ Asc,
74
+ Desc,
35
75
  };
36
76
  export default Direction;
@@ -15,18 +15,19 @@ const widthSize = {
15
15
  auto: "w-auto",
16
16
  };
17
17
  const heightSize = {
18
- "4xs": "h-21",
19
- "3xs": "h-30",
20
- "2xs": "h-40",
21
- xs: "h-45",
22
- sm: "h-52.5",
23
- md: "h-67.5",
24
- lg: "h-112.5",
25
- xl: "h-125.5",
26
- "2xl": "h-127.5",
27
- "3xl": "h-138.5",
28
- full: "h-full",
29
- auto: "h-auto min-h-80",
18
+ "5xs": "h-21", // 84px
19
+ "4xs": "h-30", // 120px
20
+ "3xs": "h-40", // 160px
21
+ "2xs": "h-45", // 180px
22
+ xs: "h-50", // 200px
23
+ sm: "h-52.5", // 210px
24
+ md: "h-67.5", // 270px
25
+ lg: "h-112.5", // 450px
26
+ xl: "h-125.5", // 502px
27
+ "2xl": "h-127.5", // 510px
28
+ "3xl": "h-138.5", // 554px
29
+ full: "h-full", // 100%
30
+ auto: "h-auto min-h-80", // 100%
30
31
  };
31
32
  export default function CardDesign({ header, children, option, debug, }) {
32
33
  const { setIsOwn } = useActionStore();
@@ -0,0 +1,2 @@
1
+ import { CustomCardProps } from "../../interface";
2
+ export default function CustomCardDesign({ titles, option, children, }: CustomCardProps): 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
+ 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] }));
23
+ }
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 CustomCard } from "./template/CustomCard";
4
5
  export { default as InfoCard } from "./template/InfoCard";
5
6
  export { default as NavCard } from "./template/NavCard";
6
7
  export { default as ProgressCard } from "./template/ProgressCard";
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 CustomCard } from "./template/CustomCard";
4
5
  export { default as InfoCard } from "./template/InfoCard";
5
6
  export { default as NavCard } from "./template/NavCard";
6
7
  export { default as ProgressCard } from "./template/ProgressCard";
@@ -0,0 +1,3 @@
1
+ import { CustomCardProps } from "./../../interface";
2
+ declare function CustomCard(props: CustomCardProps): import("react/jsx-runtime").JSX.Element;
3
+ export default CustomCard;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import CustomCardDesign from "../design/CustomCard.design";
3
+ function CustomCard(props) {
4
+ return _jsx(CustomCardDesign, { ...props });
5
+ }
6
+ export default CustomCard;
@@ -13,7 +13,7 @@ interface StudentCardProps extends Omit<InfoCardProps, "titles" | "children"> {
13
13
  createdAt: string;
14
14
  };
15
15
  }
16
- declare function Academy({ titles, data, buttons }: AcademyCardProps): import("react/jsx-runtime").JSX.Element;
16
+ declare function Academy({ titles, data, buttons, option }: AcademyCardProps): import("react/jsx-runtime").JSX.Element;
17
17
  declare namespace Academy {
18
18
  var Digital: ({ image, data }: StudentCardProps) => import("react/jsx-runtime").JSX.Element;
19
19
  }
@@ -2,13 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { InfoCardDesign } from "../../design/InfoCard.design";
3
3
  import SVG from "../../../asset/SVG";
4
4
  import { Label } from "../../../widget";
5
- function Academy({ titles, data, buttons }) {
5
+ function Academy({ titles, data, buttons, option }) {
6
6
  return (_jsx(InfoCardDesign, { titles: titles, option: {
7
+ ...option,
7
8
  titleBorder: "border-green-dark",
8
9
  background: "",
9
- boundary: "",
10
- width: "xs",
11
- height: "md",
10
+ width: option?.width ?? "xs",
11
+ height: option?.height ?? "md",
12
12
  }, children: _jsxs("div", { className: "mt-2.5 flex flex-col gap-2.5", children: [_jsx("div", { className: "w-full", children: data.address }), _jsx("div", { className: "flex gap-2.5", children: buttons.map(({ title, onClick }, index) => (_jsx(Label.Button, { title: title, onClick: onClick, option: {
13
13
  background: !index ? "bg-gray-medium" : "bg-green-dark",
14
14
  text: "text-white",
@@ -1,7 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import NavCardDesign from "../design/NavCard.design";
3
3
  function Banner({ titles, option }) {
4
- return (_jsx(NavCardDesign, { titles: titles, option: { ...option, width: option?.width ?? "xl", height: "sm" } }));
4
+ return (_jsx(NavCardDesign, { titles: titles, option: {
5
+ ...option,
6
+ width: option?.width ?? "xl",
7
+ height: option?.height ?? "sm",
8
+ } }));
5
9
  }
6
10
  function _Button({ titles, onClick, option }) {
7
11
  return (_jsx(NavCardDesign, { titles: titles, option: {
@@ -29,6 +29,6 @@ export default function ProgressCardSmall({ titles, steps, theme = "green", }) {
29
29
  };
30
30
  return (_jsxs(CardDesign, { option: {
31
31
  width: "md",
32
- height: "4xs",
32
+ height: "5xs",
33
33
  }, children: [_jsx("div", { className: cn(progressBox), children: steps.map(([{ title, subtitle }, value]) => (_jsxs("div", { className: cn(stepBox(value)), 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: value, size: 25, theme: theme })] }), _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 })] })] }));
34
34
  }
@@ -1,5 +1,6 @@
1
1
  import { LabelWidget } from "./widget";
2
- import { DataField, OnClick, Size } from "./Property";
2
+ import { OnClick, Size } from "./Property";
3
+ import { DataField, DataFieldType } from "./Data";
3
4
  import { Color } from "./Color";
4
5
  export interface ActionEvent {
5
6
  event: string;
@@ -44,4 +45,8 @@ export interface RowProps<T> {
44
45
  className?: string;
45
46
  };
46
47
  }
48
+ export interface RowElementProps {
49
+ item: string;
50
+ data?: DataFieldType;
51
+ }
47
52
  export {};
@@ -1,4 +1,5 @@
1
- import { DataField, DataSet, Size, Titles } from "./Property";
1
+ import { Size, Titles } from "./Property";
2
+ import { DataSet, DataField } from "./Data";
2
3
  import { ActionProps } from "./Action";
3
4
  import { InputWidget, LabelWidget, SelectWidget } from "./widget";
4
5
  interface BoardOption {
@@ -1,4 +1,5 @@
1
- import { Button, DataField, DataSet, Disabled, OnClick, Size, State, Step, Titles } from "./Property";
1
+ import { Button, Disabled, OnClick, Size, State, Step, Titles } from "./Property";
2
+ import { DataSet, DataField } from "./Data";
2
3
  import { Theme } from "./Theme";
3
4
  import { Flexify } from "./UtilityType";
4
5
  interface CardOption {
@@ -44,6 +45,9 @@ export interface ChartCardProps extends Omit<CardProps, "children"> {
44
45
  score: number;
45
46
  };
46
47
  }
48
+ export interface CustomCardProps extends Flexify<CardProps, "children"> {
49
+ titles: Titles;
50
+ }
47
51
  export interface ButtonInLay {
48
52
  title: string;
49
53
  onClick: OnClick;
@@ -0,0 +1,41 @@
1
+ import { Replace } from "./Action";
2
+ import { OnClick, Titles } from "./Property";
3
+ export interface DataPackage<T> {
4
+ dataField: DataField<T>;
5
+ dataSet: Omit<DataSet<T>, "renderItem">;
6
+ }
7
+ export type DataSet<T = any> = {
8
+ items?: T[];
9
+ renderItem: (item: T, index?: number) => React.ReactNode;
10
+ titles?: Titles;
11
+ interaction?: React.ReactNode;
12
+ onClick?: OnClick<T>;
13
+ replaces?: Replace[];
14
+ };
15
+ type DataFieldProps = {
16
+ title: string | number;
17
+ size: string | number;
18
+ data?: DataFieldType;
19
+ };
20
+ export type DataField<T = any> = Partial<{
21
+ [p in keyof T]: Partial<DataFieldProps>;
22
+ }>;
23
+ export type DataFieldType = DataFiledTypeText | DataSelectRoll;
24
+ type DataFiledTypeText = {
25
+ type: "text";
26
+ };
27
+ interface SelectRollOption {
28
+ key: string;
29
+ value: string;
30
+ option?: {
31
+ text?: string;
32
+ background?: string;
33
+ };
34
+ }
35
+ type DataSelectRoll = {
36
+ type: "selectRoll";
37
+ options: SelectRollOption[];
38
+ };
39
+ declare function isDataSelectRoll(obj: any): obj is DataSelectRoll;
40
+ export type { DataFiledTypeText, DataSelectRoll };
41
+ export { isDataSelectRoll };
@@ -0,0 +1,4 @@
1
+ function isDataSelectRoll(obj) {
2
+ return typeof obj === "object" && obj.type === "selectRoll";
3
+ }
4
+ export { isDataSelectRoll };
@@ -1,5 +1,4 @@
1
1
  import { Dispatch, SetStateAction } from "react";
2
- import { Replace } from "./Action";
3
2
  import { LabelWidget } from "./widget";
4
3
  /**
5
4
  * State type for the React component
@@ -18,16 +17,21 @@ export type State<T> = [T, StateAction<T>];
18
17
  * @enum {string}
19
18
  * @readonly
20
19
  * @description - Size type for the component
20
+ * @property {"5xs"} 5xs - Five extra small size
21
+ * @property {"4xs"} 4xs - Four extra small size
22
+ * @property {"3xs"} 3xs - Three extra small size
23
+ * @property {"2xs"} 2xs - Double extra small size
21
24
  * @property {"xs"} xs - Extra small size
22
25
  * @property {"sm"} sm - Small size
23
26
  * @property {"md"} md - Medium size
24
27
  * @property {"lg"} lg - Large size
25
28
  * @property {"xl"} xl - Extra large size
26
29
  * @property {"2xl"} 2xl - Double extra large size
30
+ * @property {"3xl"} 3xl - Three extra large size
31
+ * @property {"full"} full - Full size
27
32
  * @property {"full"} full - Full size
28
33
  */
29
- export type ImageSize = "sub" | "full";
30
- export type Size = "4xs" | "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | "auto";
34
+ export type Size = "5xs" | "4xs" | "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | "auto";
31
35
  /**
32
36
  * Image size type
33
37
  * @enum {string}
@@ -36,6 +40,7 @@ export type Size = "4xs" | "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2
36
40
  * @property {"sub"} sub - Sub size
37
41
  * @property {"full"} full - Full size
38
42
  */
43
+ export type ImageSize = "sub" | "full";
39
44
  export type OnClick<Request = unknown, Response = unknown> = (prop?: Request) => Response | ((prop?: Request) => Promise<Response>);
40
45
  export interface Button extends LabelWidget {
41
46
  }
@@ -53,26 +58,6 @@ export type Titles = {
53
58
  titleColor?: string;
54
59
  subtitleColor?: string;
55
60
  };
56
- export type DataSet<T = any> = {
57
- items?: T[];
58
- renderItem: (item: T, index?: number) => React.ReactNode;
59
- titles?: Titles;
60
- interaction?: React.ReactNode;
61
- onClick?: OnClick<T>;
62
- replaces?: Replace[];
63
- };
64
- type DataFieldType = {
65
- title: string | number;
66
- type: string;
67
- size: string | number;
68
- };
69
- export type DataField<T = any> = Partial<{
70
- [p in keyof T]: Partial<DataFieldType>;
71
- }>;
72
- export interface DataPackage<T> {
73
- dataField: DataField<T>;
74
- dataSet: Omit<DataSet<T>, "renderItem">;
75
- }
76
61
  export interface Log<K extends string, T extends string | number> {
77
62
  prints: K[];
78
63
  logs: {
@@ -84,4 +69,3 @@ export interface Order {
84
69
  orderHow: "asc" | "desc" | "";
85
70
  }
86
71
  export type Step = [Titles, boolean];
87
- export {};
@@ -1,7 +1,8 @@
1
+ export * from "./widget";
1
2
  export * from "./Action";
2
3
  export * from "./Card";
3
4
  export * from "./Color";
4
- export * from "./widget";
5
+ export * from "./Data";
5
6
  export * from "./Layout";
6
7
  export * from "./Overlay";
7
8
  export * from "./Property";
@@ -1,7 +1,8 @@
1
+ export * from "./widget";
1
2
  export * from "./Action";
2
3
  export * from "./Card";
3
4
  export * from "./Color";
4
- export * from "./widget";
5
+ export * from "./Data";
5
6
  export * from "./Layout";
6
7
  export * from "./Overlay";
7
8
  export * from "./Property";
@@ -41,6 +41,7 @@ export interface InputWidget extends Widget {
41
41
  type?: InputType;
42
42
  label?: LabelWidget;
43
43
  maxLength?: number;
44
+ disabled?: Disabled;
44
45
  }
45
46
  export interface CheckBoxWidget extends Widget {
46
47
  state: State<boolean>;
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { cn } from "../../util";
3
3
  import { useActionStore } from "../../store";
4
+ import { widthSizes } from "../../asset/sizes";
5
+ import SVG from "../../asset/SVG";
4
6
  const heightSize = {
5
7
  sm: "h-10",
6
8
  md: "h-13.75",
@@ -21,14 +23,14 @@ export default function DataFieldDesign({ id, dataField, option, }) {
21
23
  sizes: container.sizes,
22
24
  };
23
25
  return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(container), children: dataField &&
24
- Object.keys(dataField).map((key) => (_jsx("div", { className: `w-${dataField[key]?.size}/100`, 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]?.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 }) => {
25
27
  if (orderBy === key) {
26
28
  if (orderHow === "asc")
27
- return (_jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M7.15859 15.0437C6.7079 15.9134 7.27152 17 8.17239 17H15.8279C16.7282 17 17.2919 15.9134 16.8417 15.0437L13.0145 7.65229C12.5638 6.78257 11.4365 6.78257 10.9858 7.65229L7.15859 15.0437Z", fill: "#105652" }) }, id + key + "asc"));
29
+ return _jsx(SVG.Direction.Asc, {});
28
30
  else if (orderHow === "desc")
29
- return (_jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M16.8414 8.95628C17.2921 8.08657 16.7285 7 15.8276 7L8.1721 7C7.27176 7 6.70813 8.08657 7.15831 8.95628L10.9855 16.3477C11.4362 17.2174 12.5635 17.2174 13.0142 16.3477L16.8414 8.95628Z", fill: "#105652" }) }, id + key + "asc"));
31
+ return _jsx(SVG.Direction.Desc, {});
30
32
  else
31
- return "";
33
+ return null;
32
34
  }
33
35
  }) })] }) }, id + key))) }), position && _jsx("div", { className: cn(block) })] }));
34
36
  }
@@ -0,0 +1,7 @@
1
+ import { DataSelectRoll } from "../../../interface";
2
+ interface SelectRollProps {
3
+ item: string | number;
4
+ data: DataSelectRoll;
5
+ }
6
+ export default function SelectRoll({ item, data }: SelectRollProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { cn } from "../../../util";
4
+ export default function SelectRoll({ item, data }) {
5
+ const { options } = data ?? {};
6
+ const [isHover, setIsHover] = useState(false);
7
+ const keys = options?.map((option) => option.key);
8
+ const values = options?.map((option) => option.value);
9
+ const [index, setIndex] = useState(keys?.indexOf(String(item)) ?? 0);
10
+ const container = {
11
+ styles: "group cursor-default",
12
+ displays: "flex justify-center",
13
+ sizes: "w-[120px] ",
14
+ };
15
+ const body = {
16
+ positions: "relative",
17
+ displays: "flex justify-center items-center",
18
+ backgrounds: options[index].option?.background,
19
+ texts: options[index].option?.text,
20
+ sizes: "w-[120px] h-[30px]",
21
+ transitions: "duration-300",
22
+ hoverAct: isHover ? "w-[120px]" : "w-[100px]",
23
+ fonts: "text-[12px]",
24
+ styles: "rounded-[6px] leading-none overflow-hidden",
25
+ };
26
+ const toggle = {
27
+ positions: "absolute ",
28
+ displays: "flex justify-center items-center",
29
+ sizes: "w-[20px] h-full",
30
+ styles: "duration-300 text-gray-dark",
31
+ };
32
+ return (_jsx("div", { className: cn(container), children: _jsxs("div", { className: cn(body), onMouseLeave: () => setIsHover(false), onMouseEnter: () => setIsHover(true), children: [values[index], _jsx("button", { onClick: () => {
33
+ if (index > 0)
34
+ setIndex(index - 1);
35
+ }, className: cn(toggle, "-left-4 group-hover:left-1"), children: "-" }), _jsx("button", { onClick: () => {
36
+ if (index < keys.length - 1)
37
+ setIndex(index + 1);
38
+ }, className: cn(toggle, "-right-4 group-hover:right-1"), children: "+" })] }) }));
39
+ }
@@ -1,2 +1,2 @@
1
- import { RowProps } from "../../interface";
1
+ import { RowProps } from "../../../interface";
2
2
  export default function RowDesign<T>({ item, dataField, option, onClick, buttons, dot, }: RowProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,10 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useId } from "react";
3
- import { ColorSet } from "../../interface";
4
- import { cn } from "../../util";
5
- import { Label } from "../../widget";
6
- import { widthSizes } from "../../asset/sizes";
3
+ import { ColorSet, isDataSelectRoll, } from "../../../interface";
4
+ import { cn } from "../../../util";
5
+ import { Label } from "../../../widget";
6
+ import { widthSizes } from "../../../asset/sizes";
7
+ import SelectRoll from "./SelectRoll";
7
8
  export default function RowDesign({ item, dataField, option, onClick, buttons, dot, }) {
8
9
  const { size, padding, text, noHover, className, isPointer } = option ?? {};
9
10
  const id = useId();
@@ -27,10 +28,16 @@ export default function RowDesign({ item, dataField, option, onClick, buttons, d
27
28
  styles: "rounded-full",
28
29
  };
29
30
  return (_jsxs("div", { className: cn(container), onClick: () => onClick?.(), children: [typeof dot !== "undefined" && _jsx("div", { className: cn(flagBox) }), dataField &&
30
- Object.keys(dataField).map((key) => (_jsx("div", { className: cn(widthSizes[dataField[key]?.size], itemBox), children: String(item[key]) }, id + key))), _jsx("div", { className: "absolute right-4 xl:right-8 flex gap-4", children: buttons?.map(({ title, onClick, option }) => (_jsx(Label.Button, { title: title, onClick: onClick, option: {
31
+ Object.keys(dataField).map((key) => (_jsx("div", { className: cn(widthSizes[dataField[key]?.size], itemBox), children: _jsx(RowElement, { data: dataField[key]?.data, item: item[key] }) }, id + key))), _jsx("div", { className: "absolute right-4 xl:right-8 flex gap-4", children: buttons?.map(({ title, onClick, option }) => (_jsx(Label.Button, { title: title, onClick: onClick, option: {
31
32
  background: option?.background ?? "bg-crimson-dark",
32
33
  text: option?.text ?? "text-white",
33
34
  width: "xs",
34
35
  height: "xs",
35
36
  } }, id + title))) })] }));
36
37
  }
38
+ function RowElement(props) {
39
+ const { data } = props;
40
+ if (isDataSelectRoll(data))
41
+ return _jsx(SelectRoll, { item: props.item, data: data });
42
+ return _jsx(_Fragment, { children: props.item });
43
+ }
@@ -9,7 +9,7 @@ function Board({ id, dataField }) {
9
9
  function Card({ id, dataField }) {
10
10
  return (_jsx(DataFieldDesign, { id: id, dataField: dataField, option: {
11
11
  height: "sm",
12
- padding: "px-2 xs:px-4 xl:px-7.5",
12
+ padding: "px-2 xs:px-4 xl:px-5",
13
13
  } }));
14
14
  }
15
15
  const DataField = {
@@ -5,6 +5,8 @@ export default function Gallery({ action, children, option, }: {
5
5
  };
6
6
  children: React.ReactNode;
7
7
  option?: {
8
- tabTextColor?: string;
8
+ text?: string;
9
+ background?: string;
10
+ boundary?: string;
9
11
  };
10
12
  }): import("react/jsx-runtime").JSX.Element;
@@ -3,12 +3,14 @@ import Action from "./Action";
3
3
  import Tab from "./Tab";
4
4
  import { cn } from "../../util";
5
5
  export default function Gallery({ action, children, option, }) {
6
- const { tabTextColor } = option ?? {};
6
+ const { text, background, boundary } = option ?? {};
7
7
  const tabBox = {
8
8
  positions: "xl:absolute xl:-bottom-18 xl:left-0 z-5",
9
9
  };
10
10
  return (_jsxs("div", { className: "relative w-full flex", children: [_jsx(Action.Replace, { actions: action?.replaces, children: _jsx(Action.Show, { actions: action?.shows, children: children }) }), action?.tabs && (_jsx(Tab, { tabs: action?.tabs, option: {
11
11
  className: cn(tabBox),
12
- text: tabTextColor,
12
+ text,
13
+ background,
14
+ boundary,
13
15
  } }))] }));
14
16
  }
@@ -22,7 +22,7 @@ function Card({ item, dataField, onClick, buttons, height, noPadding, noHover, d
22
22
  const id = useId();
23
23
  return (_jsx(RowDesign, { onClick: onClick, item: item, dataField: dataField, buttons: buttons, dot: dot, option: {
24
24
  size: `w-full ${height ?? "h-15"}`,
25
- padding: !noPadding ? "px-2 xs:px-4 xl:px-7.5" : "",
25
+ padding: !noPadding ? "px-2 xs:px-4 xl:px-5" : "",
26
26
  text: "text-base",
27
27
  noHover,
28
28
  } }, id));
@@ -5,6 +5,7 @@ interface Options {
5
5
  className?: string;
6
6
  width?: Size;
7
7
  height?: Size;
8
+ boundary?: string;
8
9
  }
9
10
  export default function Tab({ tabs, option, state, }: {
10
11
  tabs: (Button & {
@@ -10,7 +10,7 @@ const heightSize = {
10
10
  lg: "h-9",
11
11
  };
12
12
  export default function Tab({ tabs, option, state, }) {
13
- const { className, background, text, width, height } = option ?? {};
13
+ const { className, background, boundary, text, width, height } = option ?? {};
14
14
  const [tabsSelection, setTabsSelection] = state
15
15
  ? state
16
16
  : useState(tabs.map((_, i) => i === 0));
@@ -20,7 +20,7 @@ export default function Tab({ tabs, option, state, }) {
20
20
  displays: "hidden xl:flex xl:items-center xl:gap-2.5",
21
21
  sizes: "w-auto",
22
22
  paddings: "p-2.5",
23
- backgrounds: background ?? "bg-white/30",
23
+ backgrounds: boundary ?? "bg-white/30",
24
24
  styles: "rounded-xl ",
25
25
  };
26
26
  const button = {
@@ -32,6 +32,8 @@ export default function Tab({ tabs, option, state, }) {
32
32
  !isStatic &&
33
33
  setTabsSelection(tabsSelection.map((_, i) => i === index));
34
34
  return onClick && onClick();
35
- }, className: cn(button, `${!isStatic && tabsSelection[index] && "bg-white rounded-2xl"}`, `${isStatic &&
35
+ }, className: cn(button, `${!isStatic &&
36
+ tabsSelection[index] &&
37
+ `${background ?? "bg-white"} rounded-2xl`}`, `${isStatic &&
36
38
  `${option?.background ?? "bg-green-dark"} ${option?.text ?? "text-white"} `}`), children: title }, title))) }));
37
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.65",
3
+ "version": "1.0.66",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.65
1
+ 1.0.66
@@ -10,6 +10,7 @@ const widthSize = {
10
10
  const heightSize = {
11
11
  xs: "h-6.25",
12
12
  sm: "h-11.25",
13
+ md: "h-12.25",
13
14
  };
14
15
  export default function LabelDesign({ title, onClick, option, hoverState, }) {
15
16
  const [hover, setHover] = hoverState ?? [false, () => { }];
@@ -1,2 +1,2 @@
1
1
  import { InputWidget } from "../../../interface";
2
- export default function LG({ state, placeholder, isValid, type, label, maxLength, }: InputWidget): import("react/jsx-runtime").JSX.Element;
2
+ export default function LG({ state, placeholder, isValid, type, label, maxLength, disabled, }: InputWidget): import("react/jsx-runtime").JSX.Element;
@@ -2,7 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useRef, useState } from "react";
3
3
  import { cn, gradient } from "../../../util";
4
4
  import Label from "../Label";
5
- export default function LG({ state, placeholder, isValid, type, label, maxLength, }) {
5
+ import Obstacle from "../Obstacle";
6
+ export default function LG({ state, placeholder, isValid, type, label, maxLength, disabled, }) {
6
7
  const [value, setValue] = state;
7
8
  const [onFocus, setOnFocus] = useState(false);
8
9
  const ref = useRef(null);
@@ -44,5 +45,5 @@ export default function LG({ state, placeholder, isValid, type, label, maxLength
44
45
  background: label.option?.background ?? gradient.bg.greenToRed,
45
46
  text: label.option?.text ?? "text-white",
46
47
  ...label.option,
47
- } }))] }));
48
+ } })), _jsx(Obstacle, { disabled: disabled })] }));
48
49
  }
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cn } from "../../util";
3
3
  export default function Obstacle({ disabled }) {
4
4
  const obstacle = {
5
- positions: "absolute",
5
+ positions: "absolute top-0 left-0",
6
6
  sizes: "w-full h-full",
7
- background: "bg-white/80 ",
7
+ background: "bg-white/30",
8
8
  };
9
9
  return (disabled && (_jsx("div", { onClick: typeof disabled === "function" ? disabled : undefined, className: cn(obstacle) })));
10
10
  }