@edu-tosel/design 1.0.14 → 1.0.16

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 (86) hide show
  1. package/README.md +0 -5
  2. package/board/template/CanvasBoard.js +1 -1
  3. package/board/template/ManageBoard.js +5 -5
  4. package/board/widget/Board.js +4 -4
  5. package/board/widget/DataField.d.ts +3 -5
  6. package/board/widget/DataField.js +16 -20
  7. package/board/widget/Header.d.ts +1 -1
  8. package/board/widget/Header.js +10 -8
  9. package/card/template/AddCard.d.ts +1 -1
  10. package/card/template/AddCard.js +11 -5
  11. package/card/template/InfoCard.design.js +1 -1
  12. package/card/template/InfoCard.js +7 -7
  13. package/card/template/RowCard.d.ts +2 -5
  14. package/card/template/RowCard.js +15 -13
  15. package/card/template/TableCard.js +1 -1
  16. package/card/widget/Card.js +11 -5
  17. package/globals.css +92 -0
  18. package/html/index.d.ts +1 -0
  19. package/html/index.js +1 -0
  20. package/html/widget/DatePicker.d.ts +3 -0
  21. package/html/widget/DatePicker.js +23 -0
  22. package/html/widget/Input.d.ts +1 -1
  23. package/html/widget/Input.js +2 -1
  24. package/html/widget/Select.d.ts +1 -1
  25. package/html/widget/Select.js +23 -14
  26. package/html/widget/Toggle.d.ts +2 -0
  27. package/html/widget/Toggle.js +13 -0
  28. package/index.d.ts +0 -2
  29. package/index.js +0 -2
  30. package/interface/Board.d.ts +9 -8
  31. package/interface/Card.d.ts +10 -1
  32. package/interface/HTMLElement.d.ts +16 -14
  33. package/interface/HTMLElement.js +7 -1
  34. package/interface/Modal.d.ts +1 -0
  35. package/interface/Overlay.d.ts +17 -0
  36. package/interface/Property.d.ts +4 -2
  37. package/interface/index.d.ts +1 -0
  38. package/interface/index.js +1 -0
  39. package/layout/template/Shelf.js +3 -3
  40. package/layout/template/dashboard/index.js +10 -4
  41. package/layout/widget/Events.js +6 -0
  42. package/layout/widget/Shelf.js +3 -2
  43. package/modal/template/Input.d.ts +1 -1
  44. package/modal/template/Input.js +2 -2
  45. package/modal/widget/Modal.design.d.ts +1 -1
  46. package/modal/widget/Modal.design.js +3 -3
  47. package/navigation/Navigation.js +8 -13
  48. package/overlay/template/Info.d.ts +2 -0
  49. package/overlay/template/Info.js +5 -0
  50. package/overlay/template/Manage.d.ts +2 -0
  51. package/overlay/template/Manage.js +17 -0
  52. package/overlay/template/index.d.ts +6 -2
  53. package/overlay/template/index.js +6 -5
  54. package/overlay/widget/Overlay.design.d.ts +2 -0
  55. package/overlay/widget/Overlay.design.js +25 -0
  56. package/package.json +4 -1
  57. package/store/index.d.ts +3 -0
  58. package/store/index.js +12 -3
  59. package/tailwind.config.ts +20 -0
  60. package/util/checkPathMatch.d.ts +2 -0
  61. package/util/checkPathMatch.js +8 -0
  62. package/util/index.d.ts +1 -0
  63. package/util/index.js +1 -0
  64. package/version.txt +1 -1
  65. package/deck/index.d.ts +0 -1
  66. package/deck/index.js +0 -1
  67. package/deck/template/Deck.d.ts +0 -6
  68. package/deck/template/Deck.design.d.ts +0 -2
  69. package/deck/template/Deck.design.js +0 -21
  70. package/deck/template/Deck.js +0 -11
  71. package/deck/widget/Deck.d.ts +0 -2
  72. package/deck/widget/Deck.js +0 -14
  73. package/interface/Deck.d.ts +0 -15
  74. package/interface/Deck.js +0 -1
  75. package/interface/Menu.d.ts +0 -6
  76. package/interface/Menu.js +0 -1
  77. package/menu/index.d.ts +0 -1
  78. package/menu/index.js +0 -1
  79. package/menu/template/SideMenu.d.ts +0 -2
  80. package/menu/template/SideMenu.js +0 -20
  81. package/menu/widget/HTMLElement.d.ts +0 -8
  82. package/menu/widget/HTMLElement.js +0 -9
  83. package/overlay/template/Overlay.design.d.ts +0 -2
  84. package/overlay/template/Overlay.design.js +0 -5
  85. package/overlay/widget/Overlay.d.ts +0 -2
  86. package/overlay/widget/Overlay.js +0 -17
package/README.md CHANGED
@@ -20,11 +20,6 @@ Card 컴포넌트는 여러가지 요소를 담고 있는 컨테이너이다.
20
20
 
21
21
  일반적으로 가장 최소 단위의 컴포넌트로 사용되며, 다양한 요소를 담을 수 있다.
22
22
 
23
- ### Deck
24
-
25
- Deck 컴포넌트는 여러가지 Card 컴포넌트를 담고 있는 컨테이너이다.
26
-
27
- Deck 컴포넌트는 담고있는 Card 컴포넌트들을 수평 정렬한다.
28
23
 
29
24
  ### Layout
30
25
 
@@ -4,7 +4,7 @@ import { Board } from "../widget/Board";
4
4
  export default function CanvasBoard({ children, options, widgets, }) {
5
5
  const layouts = "flex flex-col lg:flex-row lg:flex-wrap gap-7.5 ";
6
6
  const sizes = "h-full ";
7
- const paddings = "pb-36 xl:pb-0 px-2 xs:px-4 xl:pl-8 xl:pr-2 pt-2 xs:pt-4 xl:pt-8";
7
+ const paddings = "pb-36 xl:pb-0 px-2 xs:px-4 xl:pl-7.5 xl:pr-2 pt-2 xs:pt-4 xl:pt-7.5";
8
8
  const styles = "overflow-y-scroll ";
9
9
  return (_jsx(Board, { widgets: widgets, options: { ...options, isRounded: true }, children: _jsx("div", { className: cn(layouts, sizes, paddings, styles), children: children }) }));
10
10
  }
@@ -13,11 +13,11 @@ export default function ManageBoard({ header, data, widgets, options }) {
13
13
  const id = useId();
14
14
  const orders = order[id] ?? [];
15
15
  const container = {
16
- displays: "flex flex-col gap-8",
17
- sizes: `h-full ${header ? (dataField ? "xl:h-135" : "xl:h-158") : "xl:h-full"}`,
18
- paddings: `${!noPadding ? "pt-8 pb-60 px-2 xs:px-4 xl:px-8 xl:pb-6 " : ""}`,
16
+ displays: "flex flex-col gap-12",
17
+ sizes: `h-full ${header ? (dataField ? "xl:h-138.75" : "xl:h-153") : "xl:h-full"}`,
18
+ paddings: `${!noPadding ? "pt-7.5 pb-60 px-2 xs:pl-4 xl:pl-7.5 xl:pb-7.5 " : ""} `,
19
19
  styles: "overflow-y-scroll",
20
20
  };
21
- return (_jsxs(Board, { widgets: widgets, options: { isRounded: true }, children: [header && _jsx(BoardHeader, { ...header }), dataField && _jsx(BoardDataField, { id: id, dataField: dataField }), _jsx("div", { className: cn(container), children: _jsx(Events.Replace, { widgets: widgets?.replaces, children: dataSets.map(({ title, subtitle, items, renderItem, interaction }) => (_jsxs(Shelf.Wrap, { titles: { title: title ?? "", subtitle: subtitle }, classNames: classNames, children: [items &&
22
- sortByOrder(items, orders)?.map((item) => renderItem(item)), interaction] }, id + title))) }) })] }));
21
+ return (_jsxs(Board, { widgets: widgets, options: { isRounded: true }, children: [header && _jsx(BoardHeader, { ...header }), dataField && _jsx(BoardDataField, { id: id, dataField: dataField }), _jsx("div", { className: cn(container), children: _jsx(Events.Replace, { widgets: widgets?.replaces, children: dataSets.map(({ titles, items, renderItem, interaction }, index) => (_jsxs(Shelf.Wrap, { titles: titles, classNames: classNames, children: [items &&
22
+ sortByOrder(items, orders)?.map((item) => renderItem(item)), interaction] }, id + index))) }) })] }));
23
23
  }
@@ -15,8 +15,8 @@ const heightSize = {
15
15
  xs: "h-20",
16
16
  sm: "h-24",
17
17
  md: "h-28",
18
- lg: "h-full xl:h-178 xl:min-h-0",
19
- xl: "h-36",
18
+ lg: "h-full xl:h-171.5 xl:min-h-0",
19
+ xl: "h-full xl:h-171.5 xl:min-h-0",
20
20
  "2xl": "h-40",
21
21
  full: "min-h-screen h-full",
22
22
  auto: "h-auto",
@@ -30,8 +30,8 @@ export function Board({ children, widgets, options, debug }) {
30
30
  debug: debug && isDebug(`border-2 border-${debug}`),
31
31
  };
32
32
  const body = {
33
- positions: "relative z-10 ",
34
- sizes: `w-full ${heightSize[height ?? "lg"]} overflow-hidden `,
33
+ positions: "relative",
34
+ sizes: `w-full ${heightSize[height ?? "xl"]} overflow-hidden `,
35
35
  styles: "bg-white text-black",
36
36
  rounded: `rounded-none ${isRounded ? "xl:rounded-xl" : ""}`,
37
37
  };
@@ -1,9 +1,7 @@
1
1
  import { DataField } from "../../interface";
2
- export default function BoardDataField<K extends string, T extends {
3
- [p in K]: any;
4
- }>({ id, dataField, }: {
2
+ export default function BoardDataField<T extends Record<string, any>>({ id, dataField, }: {
5
3
  id: string;
6
- dataField?: {
7
- [p in keyof T]: DataField;
4
+ dataField: {
5
+ [p in keyof T]?: Partial<DataField>;
8
6
  };
9
7
  }): import("react/jsx-runtime").JSX.Element;
@@ -5,30 +5,26 @@ export default function BoardDataField({ id, dataField, }) {
5
5
  const { order, setOrder } = useWidgetStore();
6
6
  const orders = order[id] ?? [];
7
7
  const container = {
8
- positions: "fixed top-35 left-0 xl:static z-20",
8
+ positions: "fixed top-34 xl:top-0 left-0 xl:relative z-20",
9
9
  displays: "flex items-center",
10
- styles: `bg-gray-200`,
11
- sizes: "w-full h-23",
12
- };
13
- const dataFieldContainer = {
14
- displays: "flex items-center",
15
- sizes: "w-full h-12",
16
- paddings: "px-2 xs:px-4 xl:px-8",
17
- styles: "bg-white-off",
10
+ sizes: "w-full h-13.75",
11
+ paddings: "px-2 xs:px-4 xl:px-7.5",
12
+ styles: "bg-white",
13
+ test: "box-shadow-sm",
18
14
  };
19
15
  const block = {
20
16
  displays: "xl:hidden block ",
21
17
  sizes: container.sizes,
22
18
  };
23
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(container), children: _jsx("div", { className: cn(dataFieldContainer), children: dataField &&
24
- Object.entries(dataField).map(([key, { title, size }]) => (_jsx("div", { className: `w-${size}/100`, children: _jsxs("button", { onClick: () => setOrder(id, key), className: "flex items-center gap-1", children: [_jsx("div", { children: title }), _jsx("div", { className: "text-xs", children: orders?.map(({ orderBy, orderHow }) => {
25
- if (orderBy === key) {
26
- if (orderHow === "asc")
27
- return "";
28
- else if (orderHow === "desc")
29
- return "";
30
- else
31
- return "";
32
- }
33
- }) })] }) }, id + key))) }) }), _jsx("div", { className: cn(block) })] }));
19
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(container), children: dataField &&
20
+ 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 }) => {
21
+ if (orderBy === key) {
22
+ if (orderHow === "asc")
23
+ 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" }) }));
24
+ else if (orderHow === "desc")
25
+ 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" }) }));
26
+ else
27
+ return "";
28
+ }
29
+ }) })] }) }, id + key))) }), _jsx("div", { className: cn(block) })] }));
34
30
  }
@@ -1,2 +1,2 @@
1
1
  import { BoardHeaderProps } from "./../../interface/Board";
2
- export default function BoardHeader({ title, tags, options, }: BoardHeaderProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function BoardHeader({ titles, tags, options, }: BoardHeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -1,22 +1,24 @@
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 { Input, Select } from "../../html";
4
- export default function BoardHeader({ title, tags, options, }) {
4
+ export default function BoardHeader({ titles, tags, options, }) {
5
+ const { title, icon } = titles ?? {};
5
6
  const { selects, inputs } = tags ?? {};
6
7
  const { colors } = options ?? {};
7
8
  const { bgColor, textColor } = colors ?? {
8
- bgColor: "gray-200",
9
+ bgColor: "white",
9
10
  textColor: "black",
10
11
  };
11
12
  const container = {
12
- positions: "fixed top-15 left-0 z-20 xl:static flex items-center",
13
- paddings: "px-12",
14
- styles: `bg-${bgColor} text-${textColor} pl-12 pr-9`,
15
- sizes: "w-full h-20",
13
+ positions: "fixed top-15 xl:top-0 left-0 z-20 xl:relative flex items-center",
14
+ paddings: "px-7.5",
15
+ styles: `bg-${bgColor} text-${textColor}`,
16
+ sizes: "w-full h-19",
17
+ border: "border-b-2 border-green-dark",
16
18
  };
17
19
  const block = {
18
20
  displays: "xl:hidden block ",
19
- sizes: container.sizes,
21
+ sizes: "w-full h-22",
20
22
  };
21
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: cn(container), children: [_jsx("div", { className: "text-xl font-bold", children: title }), _jsxs("div", { className: "flex items-center ml-auto gap-4", children: [selects?.map(({ width, title, options, onChange }, index) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { children: title }), _jsx(Select, { options: { width }, selectOptions: options, onChange: onChange }, title)] }, index))), inputs?.map(({ width, title, placeholder, onChange }, index) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { children: title }), _jsx(Input, { placeholder: placeholder, onChange: onChange, options: { width } })] }, index)))] })] }), _jsx("div", { className: cn(block) })] }));
23
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: cn(container), children: [_jsxs("div", { className: "flex items-center gap-2.5", children: [icon && _jsx("img", { src: icon, className: "fill-blue-500" }), _jsx("div", { className: "text-2xl font-bold text-green-dark", children: title })] }), _jsxs("div", { className: "flex items-center ml-auto gap-4", children: [selects?.map(({ width, title, options, state }, index) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { children: title }), _jsx(Select, { options: { width }, selectOptions: options, state: state }, title)] }, index))), inputs?.map(({ width, title, placeholder, state }, index) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { children: title }), _jsx(Input, { placeholder: placeholder, state: state, options: { width } })] }, index)))] })] }), _jsx("div", { className: cn(block) })] }));
22
24
  }
@@ -1,2 +1,2 @@
1
1
  import { AddCardProps } from "../../interface";
2
- export default function AddCard({ onClick, options }: AddCardProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function AddCard({ title, icon, onClick, options, }: AddCardProps): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,17 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn } from "../../util";
3
3
  import { Card } from "../widget/Card";
4
- export default function AddCard({ onClick, options }) {
4
+ export default function AddCard({ title, icon, onClick, options, }) {
5
5
  const { width } = options ?? {};
6
6
  const container = {
7
- displays: "flex justify-center items-center",
8
- text: "text-3xl",
7
+ displays: "flex flex-col justify-center items-center gap-2",
8
+ text: "text-xs",
9
+ styles: "duration-500 hover:bg-gray-light",
9
10
  };
10
- return _jsx(Card, { options: { width, classNames: cn(container), onClick }, children: "+" });
11
+ const iconBody = {
12
+ displays: "flex items-center justify-center ",
13
+ sizes: "w-9 h-9",
14
+ styles: "bg-gray-light rounded-full",
15
+ };
16
+ return (_jsxs(Card, { options: { width, classNames: cn(container), onClick }, children: [icon && (_jsx("div", { className: cn(iconBody), children: _jsx("img", { src: icon }) })), title && _jsx("div", { children: title })] }));
11
17
  }
@@ -13,7 +13,7 @@ export function InfoCardDesign({ titles: { title, subtitle }, debug, options, ch
13
13
  styles: `border-${titleBorderColor} border-b-2 pb-2.5`,
14
14
  },
15
15
  titleText: "h-6 font-bold text-lg ",
16
- subtitleText: "h-5 text-sm font-extralight",
16
+ subtitleText: "h-4.75 text-sm font-extralight",
17
17
  right: {
18
18
  fontColor: `text-${rightTextColor ?? "black"}`,
19
19
  displays: "flex flex-col-reverse",
@@ -6,8 +6,8 @@ function Exam({ titles, data, }) {
6
6
  const { status, isPublic, manager, examDate, endDate } = data;
7
7
  const container = {
8
8
  positions: "relative",
9
- displays: "flex flex-col gap-6.5 pt-2.5",
10
- sizes: "h-25 w-full",
9
+ displays: "flex flex-col justify-between mt-2.5",
10
+ sizes: "h-19.25 w-full",
11
11
  };
12
12
  const style = {
13
13
  positions: "absolute bottom-0 right-0",
@@ -22,14 +22,14 @@ function Exam({ titles, data, }) {
22
22
  width: "sm",
23
23
  height: "sm",
24
24
  buttonBackgroundColor: "gray-light",
25
- }, children: _jsxs("div", { className: cn(container), children: [_jsxs("div", { className: "flex gap-4 font-bold", children: [manager, " / ", isPublic ? "공개시험" : "비공개시험"] }), _jsxs("div", { children: [_jsxs("div", { className: "text-sm", children: ["\uC811\uC218\uB9C8\uAC10: ", endDate] }), _jsxs("div", { className: "text-sm", children: ["\uC2DC\uD5D8\uC77C: ", examDate] })] }), _jsx("div", { className: cn(style), children: status })] }) }));
25
+ }, children: _jsxs("div", { className: cn(container), children: [_jsxs("div", { className: "flex gap-4 font-bold ", children: [manager, " / ", isPublic ? "공개시험" : "비공개시험"] }), _jsxs("div", { children: [_jsxs("div", { className: "text-xs", children: ["\uC811\uC218\uB9C8\uAC10: ", endDate] }), _jsxs("div", { className: "text-xs", children: ["\uC2DC\uD5D8\uC77C: ", examDate] })] }), _jsx("div", { className: cn(style), children: status })] }) }));
26
26
  }
27
27
  function Product({ titles, data, }) {
28
28
  const { date, status, receiver, requester, button } = data;
29
29
  const container = {
30
30
  positions: "relative",
31
- displays: "flex flex-col pt-2.5",
32
- sizes: "h-25 w-full",
31
+ displays: "flex flex-col mt-2.5",
32
+ sizes: "h-19.25 w-full",
33
33
  };
34
34
  const style = {
35
35
  positions: "absolute bottom-0 right-0",
@@ -45,7 +45,7 @@ function Product({ titles, data, }) {
45
45
  width: "sm",
46
46
  height: "sm",
47
47
  buttonBackgroundColor: "gray-light",
48
- }, children: _jsxs("div", { className: cn(container), children: [_jsxs("div", { children: ["\uC77C\uC2DC: ", date] }), _jsxs("div", { children: ["\uC694\uCCAD\uC790: ", requester ?? "No Data"] }), _jsxs("div", { children: ["\uC218\uC2E0\uC790: ", receiver ?? "No Data"] }), _jsx("button", { className: cn(style), onClick: () => button?.[1](), onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), children: !hover ? status : button?.[0] ?? "완료" })] }) }));
48
+ }, children: _jsxs("div", { className: cn(container), children: [_jsxs("div", { className: "text-sm", children: ["\uC77C\uC2DC: ", date] }), _jsxs("div", { className: "text-sm", children: ["\uC694\uCCAD\uC790: ", requester ?? "No Data"] }), _jsxs("div", { className: "text-sm", children: ["\uC218\uC2E0\uC790: ", receiver ?? "No Data"] }), _jsx("button", { className: cn(style), onClick: () => button?.[1](), onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), children: !hover ? status : button?.[0] ?? "완료" })] }) }));
49
49
  }
50
50
  function Item({ titles, data, }) {
51
51
  const { item } = data;
@@ -53,7 +53,7 @@ function Item({ titles, data, }) {
53
53
  titleBorderColor: "blue-navy",
54
54
  rightTextColor: "blue-navy",
55
55
  width: "xs",
56
- height: "md",
56
+ height: "sm",
57
57
  }, children: _jsx("div", { children: item }) }));
58
58
  }
59
59
  function Profile(props) {
@@ -1,5 +1,2 @@
1
- export default function RowCard<T extends Record<string, any>>({ row, fields, sizes, }: {
2
- row: T;
3
- fields: Partial<Record<keyof T, "text" | ["select", [string, string][]]>>;
4
- sizes: Partial<Record<keyof T, string>>;
5
- }): import("react/jsx-runtime").JSX.Element;
1
+ import { RowCardProps } from "../../interface";
2
+ export default function RowCard<T extends Record<string, any>>({ onClick, dataSet, dataField, }: RowCardProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,22 +1,24 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { cn } from "../../util";
2
4
  import { Card } from "../widget/Card";
3
- import { useId, useState } from "react";
4
- export default function RowCard({ row, fields, sizes, }) {
5
+ import { useWidgetStore } from "../../store";
6
+ export default function RowCard({ onClick, dataSet, dataField, }) {
5
7
  const id = useId();
6
- const [rowState, setRowState] = useState(row);
7
- const entries = Object.entries(fields).map(([key, type]) => [type, key, rowState[key]]);
8
+ const { flag, setIsOwn } = useWidgetStore();
9
+ const container = {
10
+ displays: "flex items-center ",
11
+ sizes: "h-full",
12
+ paddings: "px-2 xs:px-4 xl:px-7.5 ",
13
+ styles: "text-xl hover:bg-gray-100 duration-100",
14
+ };
8
15
  return (_jsx(Card, { options: {
16
+ onClick,
17
+ classNames: cn(container),
9
18
  width: "full",
10
19
  height: "xs",
11
20
  boundary: "none",
12
21
  rounded: "none",
13
- }, children: _jsx("div", { className: "flex items-center h-full px-2 xs:px-4 xl:px-8", children: entries.map(([type, key, value]) => (_jsx("div", { className: `w-${`${sizes[key]}/100` ?? "auto"}`, children: Array.isArray(type) && type[0] === "select" ? (_jsx(Select, { type: type, entry: [key, value], row: rowState, setRow: setRowState }, key + type + value.toString())) : (_jsx("div", { className: "w-full truncate", children: value ?? "No Data" }, key)) }, id + key))) }) }));
14
- }
15
- function Select({ type, entry, row, setRow, }) {
16
- const id = useId();
17
- const [key, value] = entry;
18
- return (_jsx("select", { value: value, onChange: (e) => setRow({
19
- ...row,
20
- [key]: e.target.value,
21
- }), children: type[1].map(([value, title]) => (_jsx("option", { value: value, children: title }, id + value))) }, id));
22
+ }, children: dataField &&
23
+ Object.keys(dataField).map((key) => (_jsx("div", { className: `w-${dataField[key]?.size}/100 truncate`, children: dataSet[key] }, id + key))) }));
22
24
  }
@@ -13,7 +13,7 @@ export default function TableCard({ dataSets, dataField, options }) {
13
13
  const container = {
14
14
  text: "text-xs xs:text-sm sm:text-base",
15
15
  };
16
- return (_jsx(Card, { header: Object.entries(dataField).map(([key, { title, size }]) => (_jsx("div", { className: `w-${size}/100`, children: _jsxs("button", { onClick: () => setOrder(id, key), className: "flex items-center gap-1", children: [_jsx("div", { children: title }), _jsx("div", { className: "text-xs", children: orders?.map(({ orderBy, orderHow }) => {
16
+ return (_jsx(Card, { header: Object.entries(dataField)?.map(([key, { title, size }]) => (_jsx("div", { className: `w-${size}/100`, children: _jsxs("button", { onClick: () => setOrder(id, key), className: "flex items-center gap-1", children: [_jsx("div", { children: title }), _jsx("div", { className: "text-xs", children: orders?.map(({ orderBy, orderHow }) => {
17
17
  if (orderBy === key) {
18
18
  if (orderHow === "asc")
19
19
  return "▲";
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn, isDebug } from "../../util";
3
+ import { useWidgetStore } from "../../store";
3
4
  const widthSize = {
4
5
  xs: "w-full md:w-60",
5
6
  sm: "w-full md:w-90",
@@ -11,16 +12,17 @@ const widthSize = {
11
12
  auto: "w-auto",
12
13
  };
13
14
  const heightSize = {
14
- xs: "min-h-16",
15
- sm: "h-48",
16
- md: "h-72 sm:h-48",
17
- lg: "h-80",
15
+ xs: "h-12",
16
+ sm: "h-45",
17
+ md: "h-52.5",
18
+ lg: "h-67.5",
18
19
  xl: "h-125",
19
20
  "2xl": "",
20
21
  full: "h-full",
21
22
  auto: "h-auto min-h-80",
22
23
  };
23
24
  export function Card({ header, children, options, debug }) {
25
+ const { setIsOwn } = useWidgetStore();
24
26
  const { classNames, boundary, rounded, height, width, text, background, onClick, overflow, } = options ?? {};
25
27
  const { size: textSize } = text ?? {};
26
28
  const { color: bgColor } = background ?? {};
@@ -65,5 +67,9 @@ export function Card({ header, children, options, debug }) {
65
67
  overflow: `overflow-${overflow ?? "hidden"}`,
66
68
  classNames,
67
69
  };
68
- return (_jsxs("div", { className: cn(container), children: [header && (_jsxs("div", { className: cn(headerStyle.container), children: [_jsx("div", { className: cn(headerStyle.body), children: header }), _jsx("div", { className: cn(headerStyle.block) })] })), _jsx("div", { onClick: onClick, className: cn(body), children: children })] }));
70
+ return (_jsxs("div", { className: cn(container), children: [header && (_jsxs("div", { className: cn(headerStyle.container), children: [_jsx("div", { className: cn(headerStyle.body), children: header }), _jsx("div", { className: cn(headerStyle.block) })] })), _jsx("div", { onClick: onClick &&
71
+ (() => {
72
+ setIsOwn(true);
73
+ return onClick();
74
+ }), className: cn(body), children: children })] }));
69
75
  }
package/globals.css CHANGED
@@ -56,6 +56,10 @@ input[type="date"]::-webkit-calendar-picker-indicator {
56
56
  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.15);
57
57
  }
58
58
 
59
+ .box-shadow-sm {
60
+ box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
61
+ }
62
+
59
63
  .x-shape {
60
64
  position: relative;
61
65
  width: 0.83625rem;
@@ -91,3 +95,91 @@ input[type="date"]::-webkit-calendar-picker-indicator {
91
95
  box-shadow: 0 0 0 1px #e5e7eb inset, 0 4px 6px -1px rgba(0, 0, 0, 0.1),
92
96
  0 2px 4px -1px rgba(0, 0, 0, 0.06);
93
97
  }
98
+ /* Date Picker Css */
99
+ .react-datepicker__day--selected {
100
+ background-color: #105652 !important;
101
+ }
102
+ .react-datepicker__header {
103
+ background: white !important;
104
+ border: none !important;
105
+ }
106
+ .react-datepicker {
107
+ box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.15) !important;
108
+ border-radius: 0.375rem !important;
109
+ border: none !important;
110
+ }
111
+ .react-datepicker__day--keyboard-selected {
112
+ background-color: white !important;
113
+ color: black !important;
114
+ }
115
+ .react-datepicker__day--outside-month {
116
+ color: rgb(161 161 170) !important;
117
+ }
118
+ .react-datepicker__month-container {
119
+ padding-top: 1rem;
120
+ padding-left: 1rem;
121
+ padding-right: 1rem;
122
+ padding-bottom: 0.5rem;
123
+ }
124
+ .react-datepicker-popper {
125
+ transform: translate(0px 295px) !important;
126
+ }
127
+ .react-datepicker__input-container {
128
+ text-align: center !important;
129
+ border-radius: 0.375rem !important;
130
+ transition: all 0.3s;
131
+ }
132
+ .react-datepicker__input-container > input {
133
+ cursor: pointer !important;
134
+ }
135
+ .react-datepicker__input-container:hover {
136
+ box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.15) !important;
137
+ }
138
+ .react-datepicker__navigation {
139
+ top: 18px !important;
140
+ }
141
+ .react-datepicker__navigation--next {
142
+ right: 20px !important;
143
+ }
144
+ .react-datepicker__navigation--previous {
145
+ left: 182px !important;
146
+ }
147
+ .react-datepicker__current-month {
148
+ text-align: left !important;
149
+ margin-left: 16px !important;
150
+ }
151
+ .react-datepicker__triangle {
152
+ display: none !important;
153
+ }
154
+ .react-datepicker__children-container {
155
+ width: 16rem !important;
156
+ }
157
+
158
+ /* toggle button */
159
+ [type="checkbox"]::before {
160
+ content: "";
161
+ position: absolute;
162
+ left: 1px;
163
+ top: 1px;
164
+ width: 1.1rem;
165
+ height: 1.1rem;
166
+ border-radius: 50%;
167
+ transform: scale(0.9);
168
+ background-color: white;
169
+ transition: left 100ms linear;
170
+ }
171
+ [type="checkbox"]:checked::before {
172
+ background-color: white;
173
+ left: 1.32rem;
174
+ }
175
+ [type="checkbox"]:checked {
176
+ background-color: #105652;
177
+ }
178
+ [type="checkbox"]:disabled {
179
+ opacity: 0.3;
180
+ cursor: not-allowed;
181
+ }
182
+ [type="checkbox"]:disabled + span {
183
+ opacity: 0.3;
184
+ cursor: not-allowed;
185
+ }
package/html/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default as Button } from "./widget/Button";
2
2
  export { default as Input } from "./widget/Input";
3
3
  export { default as Select } from "./widget/Select";
4
+ export { default as Toggle } from "./widget/Toggle";
package/html/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default as Button } from "./widget/Button";
2
2
  export { default as Input } from "./widget/Input";
3
3
  export { default as Select } from "./widget/Select";
4
+ export { default as Toggle } from "./widget/Toggle";
@@ -0,0 +1,3 @@
1
+ import { HTMLInputElement } from "../../interface";
2
+ import "react-datepicker/dist/react-datepicker.css";
3
+ export default function DatePicker({ options }: HTMLInputElement): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import ReactDatePicker from "react-datepicker";
4
+ import "react-datepicker/dist/react-datepicker.css";
5
+ import ko from "date-fns/locale/ko";
6
+ import { useRef } from "react";
7
+ const widthSize = {
8
+ xs: "w-28",
9
+ sm: "w-48",
10
+ md: "w-64",
11
+ lg: "w-96",
12
+ xl: "w-128",
13
+ "2xl": "w-144",
14
+ full: "w-full",
15
+ };
16
+ export default function DatePicker({ options }) {
17
+ const { width } = options ?? {};
18
+ const [selectedDate, setSelectedDate] = useState(new Date());
19
+ const calRef = useRef(null);
20
+ return (_jsx("div", { children: _jsx(ReactDatePicker, { dateFormat: "yyyy\uB144 MM\uC6D4 dd\uC77C", icon: "fa fa-calendar", minDate: new Date("1900-01-01"), maxDate: new Date("2100-01-01"), selected: selectedDate, shouldCloseOnSelect: false, ref: calRef, onChange: (date) => setSelectedDate(date), locale: ko, className: "bg-slate-200 p-1 pl-4 pr-4 text-left rounded-md hover:bg-white focus:bg-white transition-all asdfasdf focus:outline-none w-68 h-10", children: _jsx("div", { className: "w-full h-auto flex justify-end items-end pr-4 pb-4", children: _jsx("button", { className: "p-2 bg-green-dark text-white rounded-md pr-4 pl-4 hover:opacity-85 hover:shadow-md transition-all", onClick: () => {
21
+ calRef.current.setOpen(false);
22
+ }, children: "\uC800\uC7A5\uD558\uAE30" }) }) }) }));
23
+ }
@@ -1,2 +1,2 @@
1
1
  import { HTMLInputElement } from "../../interface";
2
- export default function Input({ onChange, placeholder, options, }: HTMLInputElement): import("react/jsx-runtime").JSX.Element;
2
+ export default function Input({ state, placeholder, options, }: HTMLInputElement): import("react/jsx-runtime").JSX.Element;
@@ -10,7 +10,8 @@ const widthSize = {
10
10
  "2xl": "w-144",
11
11
  full: "w-full",
12
12
  };
13
- export default function Input({ onChange, placeholder, options, }) {
13
+ export default function Input({ state, placeholder, options, }) {
14
+ const [_, onChange] = state;
14
15
  const { width } = options ?? {};
15
16
  const id = useId();
16
17
  const container = {
@@ -1,2 +1,2 @@
1
1
  import { HTMLSelectElement } from "../../interface";
2
- export default function Select({ onChange, selectOptions, options, }: HTMLSelectElement): import("react/jsx-runtime").JSX.Element;
2
+ export default function Select({ state, selectOptions, options, }: HTMLSelectElement): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId } from "react";
3
2
  import { useState, useEffect } from "react";
4
3
  import { BiChevronDown } from "react-icons/bi";
5
4
  import { useWidgetStore } from "../../store";
@@ -13,8 +12,8 @@ const widthSize = {
13
12
  "2xl": "w-144",
14
13
  full: "w-full",
15
14
  };
16
- export default function Select({ onChange, selectOptions, options, }) {
17
- const arrayId = useId();
15
+ export default function Select({ state, selectOptions, options, }) {
16
+ const [value, setValue] = state;
18
17
  // isActive 드롭다운 이벤트 통제
19
18
  const { flag } = useWidgetStore();
20
19
  useEffect(() => {
@@ -22,29 +21,39 @@ export default function Select({ onChange, selectOptions, options, }) {
22
21
  setIsActive(false);
23
22
  return setIsButton(false);
24
23
  }, [flag]);
24
+ const levelsKey = {
25
+ CoCoon: "CC",
26
+ "Pre-Starter": "PS",
27
+ Starter: "ST",
28
+ Basic: "BA",
29
+ Junior: "JR",
30
+ "High Junior": "HJ",
31
+ };
25
32
  const [isActive, setIsActive] = useState(false);
26
33
  const [isButton, setIsButton] = useState(false);
27
34
  const [selectedItem, setSelectedItem] = useState(null);
28
35
  const handleItemClick = (title) => {
29
36
  setSelectedItem(title);
30
37
  setIsActive(false);
38
+ const selectedValue = levelsKey[title] || title;
39
+ setValue(selectedValue);
31
40
  };
32
41
  // css
33
42
  const levels = [
34
43
  "CoCoon",
35
- "PreStarter",
44
+ "Pre-Starter",
36
45
  "Starter",
37
46
  "Basic",
38
47
  "Junior",
39
- "HighJunior",
48
+ "High Junior",
40
49
  ];
41
50
  const colorMap = {
42
51
  CoCoon: "bg-cocoon-green",
43
- PreStarter: "bg-ps-pink",
52
+ "Pre-Starter": "bg-ps-pink",
44
53
  Starter: "bg-st-orange",
45
54
  Basic: "bg-ba-yellow",
46
55
  Junior: "bg-jr-blue",
47
- HighJunior: "bg-hj-blue",
56
+ "High Junior": "bg-hj-blue",
48
57
  };
49
58
  const isActiveCss = () => {
50
59
  if (isActive)
@@ -54,7 +63,7 @@ export default function Select({ onChange, selectOptions, options, }) {
54
63
  const dropdownTop = selectOptions && selectOptions.length > 6 ? "top-24" : "top-12";
55
64
  const { width } = options ?? {};
56
65
  const dropdown = {
57
- size: `${widthSize[width ?? "sm"]} h-10`,
66
+ size: `w-40 h-6`,
58
67
  styles: "cursor-pointer pt-4 pb-4 pl-4 pr-4 font-bold text-sm bg-white",
59
68
  display: `flex items-center`,
60
69
  hover: `hover:rounded-md`,
@@ -63,19 +72,19 @@ export default function Select({ onChange, selectOptions, options, }) {
63
72
  etc: "asdfasdf",
64
73
  };
65
74
  const dropdownInput = {
66
- size: `${widthSize[width ?? "sm"]} h-10 `,
75
+ size: `w-40 h-6 `,
67
76
  styles: "shadow-md text-sm p-4 font-bold bg-white text-left cursor-text border-1 rounded-md ",
68
77
  display: "absolute top-12 flex items-center z-10 ",
69
78
  focus: "focus:outline-none focus:border-[#44C5F3] focus:border-1 ",
70
79
  };
71
80
  const dropdownContent = {
72
- size: `${widthSize[width ?? "sm"]} min-h-8 max-h-48 overflow-y-auto `,
73
- styles: `text-sm mt-1 border-1 rounded-md`,
81
+ size: `w-40 min-h-6 max-h-48 overflow-y-auto `,
82
+ styles: `text-sm mt-1 border-1 rounded-md shadow-md`,
74
83
  display: `absolute z-40`,
75
84
  function: `${dropdownTop}`,
76
85
  };
77
86
  const dropdownItem = {
78
- size: `${widthSize[width ?? "full"]} h-8 `,
87
+ size: `${widthSize[width ?? "full"]} h-6 `,
79
88
  styles: `text-sm text-left p-4 font-bold cursor-pointer `,
80
89
  display: `flex items-center z-40`,
81
90
  hover: `hover:bg-slate-200 `,
@@ -113,7 +122,7 @@ export default function Select({ onChange, selectOptions, options, }) {
113
122
  if (event.key === "Enter") {
114
123
  if (selectedItem) {
115
124
  setIsActive(false);
116
- onChange(selectedItem);
125
+ setValue(selectedItem);
117
126
  }
118
127
  }
119
128
  // Esc
@@ -148,7 +157,7 @@ export default function Select({ onChange, selectOptions, options, }) {
148
157
  window.removeEventListener("keydown", handleKeyDown);
149
158
  window.removeEventListener("resize", scrollIntoView);
150
159
  };
151
- }, [isActive, selectedIndex, filteredOptions, selectedItem, onChange]);
160
+ }, [isActive, selectedIndex, filteredOptions, selectedItem, setValue]);
152
161
  return (_jsxs("div", { className: "relative", children: [_jsxs("div", { className: cn(dropdown), onClick: () => {
153
162
  setIsActive(!isActive);
154
163
  setIsButton(true);