@edu-tosel/design 1.0.13 → 1.0.15

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 (158) hide show
  1. package/asset/fonts/TimesNewerRoman-Bold.otf +0 -0
  2. package/asset/fonts/TimesNewerRoman-BoldItalic.otf +0 -0
  3. package/board/template/CanvasBoard.d.ts +1 -1
  4. package/board/template/CanvasBoard.js +3 -3
  5. package/board/template/ManageBoard.d.ts +3 -3
  6. package/board/template/ManageBoard.js +17 -21
  7. package/board/template/PaperBoard.d.ts +1 -1
  8. package/board/template/PaperBoard.js +4 -4
  9. package/board/widget/Board.js +12 -18
  10. package/board/widget/DataField.d.ts +4 -3
  11. package/board/widget/DataField.js +19 -13
  12. package/board/widget/Header.d.ts +1 -1
  13. package/board/widget/Header.js +11 -9
  14. package/board/widget/Tags.d.ts +14 -3
  15. package/card/index.d.ts +1 -0
  16. package/card/index.js +1 -0
  17. package/card/template/AddCard.d.ts +2 -0
  18. package/card/template/AddCard.js +11 -0
  19. package/card/template/ChartCard.js +1 -1
  20. package/card/template/InfoCard.d.ts +32 -2
  21. package/card/template/InfoCard.design.d.ts +2 -0
  22. package/card/template/InfoCard.design.js +23 -0
  23. package/card/template/InfoCard.js +72 -8
  24. package/card/template/ReportCard.d.ts +1 -1
  25. package/card/template/ReportCard.js +3 -11
  26. package/card/template/RowCard.d.ts +2 -5
  27. package/card/template/RowCard.js +16 -18
  28. package/card/template/TableCard.d.ts +4 -2
  29. package/card/template/TableCard.js +22 -9
  30. package/card/template/TrumpCard.js +2 -2
  31. package/card/widget/Card.d.ts +1 -1
  32. package/card/widget/Card.js +40 -13
  33. package/deck/index.d.ts +1 -1
  34. package/deck/index.js +1 -1
  35. package/deck/template/Deck.d.ts +6 -0
  36. package/deck/template/Deck.design.d.ts +2 -0
  37. package/deck/template/Deck.design.js +21 -0
  38. package/deck/template/Deck.js +11 -0
  39. package/deck/widget/Deck.d.ts +2 -0
  40. package/deck/widget/Deck.js +14 -0
  41. package/globals.css +119 -1
  42. package/html/index.d.ts +4 -0
  43. package/html/index.js +4 -0
  44. package/html/widget/Button.d.ts +2 -0
  45. package/html/widget/Button.js +15 -0
  46. package/html/widget/DatePicker.d.ts +3 -0
  47. package/html/widget/DatePicker.js +23 -0
  48. package/html/widget/Input.d.ts +2 -0
  49. package/html/widget/Input.js +22 -0
  50. package/html/widget/Select.d.ts +2 -0
  51. package/html/widget/Select.js +160 -0
  52. package/html/widget/Toggle.d.ts +2 -0
  53. package/html/widget/Toggle.js +13 -0
  54. package/index.d.ts +2 -2
  55. package/index.js +2 -2
  56. package/interface/Board.d.ts +16 -19
  57. package/interface/Card.d.ts +47 -37
  58. package/{deck → interface}/Deck.d.ts +4 -7
  59. package/interface/HTMLElement.d.ts +22 -14
  60. package/interface/HTMLElement.js +7 -1
  61. package/interface/Modal.d.ts +6 -1
  62. package/interface/Overlay.d.ts +20 -0
  63. package/interface/Overlay.js +1 -0
  64. package/interface/Property.d.ts +12 -1
  65. package/interface/Shelf.d.ts +22 -0
  66. package/interface/Shelf.js +1 -0
  67. package/interface/Widget.d.ts +19 -0
  68. package/interface/index.d.ts +3 -0
  69. package/interface/index.js +3 -0
  70. package/layout/index.d.ts +4 -1
  71. package/layout/index.js +4 -1
  72. package/layout/template/Gallery.d.ts +7 -0
  73. package/layout/template/Gallery.js +6 -0
  74. package/layout/template/Shelf.d.ts +8 -0
  75. package/layout/template/Shelf.js +41 -0
  76. package/layout/{dashboard → template/dashboard}/Header.d.ts +0 -1
  77. package/layout/template/dashboard/Header.js +17 -0
  78. package/layout/{dashboard → template/dashboard}/index.d.ts +5 -1
  79. package/layout/template/dashboard/index.js +33 -0
  80. package/layout/template/report/Header.js +11 -0
  81. package/layout/widget/Events.d.ts +8 -0
  82. package/layout/widget/Events.js +44 -0
  83. package/layout/widget/Shelf.d.ts +2 -0
  84. package/layout/widget/Shelf.js +25 -0
  85. package/{board → layout}/widget/Tab.js +6 -8
  86. package/modal/index.d.ts +1 -3
  87. package/modal/index.js +1 -3
  88. package/modal/template/Alert.d.ts +2 -0
  89. package/modal/template/Alert.js +8 -0
  90. package/modal/template/Input.d.ts +6 -0
  91. package/modal/template/Input.js +6 -0
  92. package/modal/template/index.d.ts +7 -0
  93. package/modal/template/index.js +7 -0
  94. package/modal/widget/Modal.design.d.ts +2 -0
  95. package/modal/widget/Modal.design.js +64 -0
  96. package/navigation/Navigation.d.ts +1 -1
  97. package/navigation/Navigation.js +21 -17
  98. package/overlay/index.d.ts +1 -0
  99. package/overlay/index.js +1 -0
  100. package/overlay/template/Info.d.ts +2 -0
  101. package/overlay/template/Info.js +5 -0
  102. package/overlay/template/Manage.d.ts +2 -0
  103. package/overlay/template/Manage.js +17 -0
  104. package/overlay/template/index.d.ts +7 -0
  105. package/overlay/template/index.js +7 -0
  106. package/overlay/widget/Overlay.design.d.ts +2 -0
  107. package/overlay/widget/Overlay.design.js +25 -0
  108. package/package.json +6 -2
  109. package/store/index.d.ts +10 -3
  110. package/store/index.js +38 -11
  111. package/tailwind.config.ts +56 -0
  112. package/text/Formatter.d.ts +3 -0
  113. package/text/Formatter.js +18 -0
  114. package/text/index.d.ts +1 -0
  115. package/text/index.js +1 -0
  116. package/util/checkPathMatch.d.ts +2 -0
  117. package/util/checkPathMatch.js +8 -0
  118. package/util/colors.d.ts +2 -1
  119. package/util/colors.js +2 -1
  120. package/util/convertUnixTimestampToDate.d.ts +1 -0
  121. package/util/convertUnixTimestampToDate.js +5 -0
  122. package/util/index.d.ts +3 -0
  123. package/util/index.js +3 -0
  124. package/util/isDebug.d.ts +1 -0
  125. package/util/isDebug.js +5 -0
  126. package/util/sortByOrder.d.ts +4 -0
  127. package/util/sortByOrder.js +20 -0
  128. package/version.txt +1 -1
  129. package/card/template/InfoCardCssCase.d.ts +0 -25
  130. package/card/template/InfoCardCssCase.js +0 -32
  131. package/card/template/PropfileCard.d.ts +0 -2
  132. package/card/template/PropfileCard.js +0 -6
  133. package/deck/Deck.js +0 -22
  134. package/interface/Menu.d.ts +0 -6
  135. package/layout/dashboard/Header.js +0 -19
  136. package/layout/dashboard/index.js +0 -10
  137. package/layout/report/Header.js +0 -11
  138. package/menu/index.d.ts +0 -1
  139. package/menu/index.js +0 -1
  140. package/menu/template/SideMenu.d.ts +0 -2
  141. package/menu/template/SideMenu.js +0 -20
  142. package/menu/widget/HTMLElement.d.ts +0 -8
  143. package/menu/widget/HTMLElement.js +0 -9
  144. package/modal/AlertModal.d.ts +0 -2
  145. package/modal/AlertModal.js +0 -8
  146. package/modal/ControllerModal.d.ts +0 -6
  147. package/modal/ControllerModal.js +0 -6
  148. package/modal/Modal.d.ts +0 -2
  149. package/modal/Modal.js +0 -31
  150. package/modal/TestModal.d.ts +0 -7
  151. package/modal/TestModal.js +0 -6
  152. package/shelf/Shelf.d.ts +0 -3
  153. package/shelf/Shelf.js +0 -4
  154. package/shelf/index.d.ts +0 -1
  155. package/shelf/index.js +0 -1
  156. /package/interface/{Menu.js → Deck.js} +0 -0
  157. /package/layout/{report → template/report}/Header.d.ts +0 -0
  158. /package/{board → layout}/widget/Tab.d.ts +0 -0
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { LineBreaks } from "../../text";
3
3
  import { Card } from "../widget/Card";
4
4
  export default function TrumpCard({ titles, options }) {
5
- const { title, subTitle, color: titleColor } = titles;
5
+ const { title, subtitle, color: titleColor } = titles;
6
6
  const { onClick, width, image, subButton } = options ?? {};
7
7
  const [buttonText, buttonBgColor, buttonAction] = subButton ?? [
8
8
  null,
@@ -15,5 +15,5 @@ export default function TrumpCard({ titles, options }) {
15
15
  return "w-full h-full object-cover";
16
16
  return "absolute bottom-0 right-0 w-full xs:w-auto max-w-120 z-0 max-h-44 object-contain";
17
17
  };
18
- return (_jsxs(Card, { options: { width: width ?? "xs", onClick }, children: [_jsxs("div", { className: `absolute top-8 left-8 w-48 flex flex-col gap-2 z-10 text-${titleColor}`, children: [_jsx("div", { className: "text-xl font-bold", children: title }), _jsx(LineBreaks, { texts: subTitle ?? [""] }), subButton ? (_jsx("button", { className: `text-white rounded-md bg-${buttonBgColor} w-45 h-11 flex justify-center items-center`, onClick: buttonAction, children: buttonText })) : null] }), path ? (_jsx("img", { src: path, alt: "trump-image", loading: "lazy", className: imageClassNames() })) : null] }));
18
+ return (_jsxs(Card, { options: { width: width ?? "xs", onClick }, children: [_jsxs("div", { className: `absolute top-8 left-8 w-48 flex flex-col gap-2 z-10 text-${titleColor}`, children: [_jsx("div", { className: "text-xl font-bold", children: title }), _jsx(LineBreaks, { texts: subtitle ?? "" }), subButton ? (_jsx("button", { className: `text-white rounded-md bg-${buttonBgColor} w-45 h-11 flex justify-center items-center`, onClick: buttonAction, children: buttonText })) : null] }), path ? (_jsx("img", { src: path, alt: "trump-image", loading: "lazy", className: imageClassNames() })) : null] }));
19
19
  }
@@ -1,2 +1,2 @@
1
1
  import { CardProps } from "../../interface/Card";
2
- export declare function Card({ children, options, debug }: CardProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function Card({ header, children, options, debug }: CardProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn } from "../../util";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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,18 +12,19 @@ const widthSize = {
11
12
  auto: "w-auto",
12
13
  };
13
14
  const heightSize = {
14
- xs: "min-h-16",
15
- sm: "h-72 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
- export function Card({ children, options, debug }) {
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
- const { size: textSize, color: textColor } = text ?? {};
27
+ const { size: textSize } = text ?? {};
26
28
  const { color: bgColor } = background ?? {};
27
29
  const setBoundary = () => {
28
30
  if (boundary === "shadow")
@@ -37,12 +39,37 @@ export function Card({ children, options, debug }) {
37
39
  positions: "relative",
38
40
  sizes: `${widthSize[width ?? "sm"]} ${heightSize[height ?? "sm"]}`,
39
41
  onClick: onClick ? "cursor-pointer" : "",
40
- text: `text-${textSize ?? "base"}`,
42
+ text: `text-${textSize ?? "base"} text-black dark:text-white`,
41
43
  boundary: setBoundary(),
42
44
  rounded: `rounded-${rounded ?? "xl"}`,
43
- bgColor: `bg-${bgColor ?? "white/80"}`,
44
- styles: "duration-500 overflow-hidden",
45
- debug: debug && import.meta.env.MODE && `border-2 border-${debug}`,
45
+ bgColor: `bg-${bgColor ?? "white/80"} dark:bg-black/80`,
46
+ styles: "duration-500 ",
47
+ debug: debug && isDebug(`border-2 border-${debug}`),
48
+ overflow: "overflow-hidden",
46
49
  };
47
- return (_jsx("div", { onClick: onClick, className: cn(container, `${classNames}`), children: children }));
50
+ const headerStyle = {
51
+ container: {
52
+ positions: "relative",
53
+ sizes: "h-11 ",
54
+ },
55
+ body: {
56
+ positions: "absolute top-0 left-0",
57
+ displays: "flex items-center pl-4",
58
+ sizes: "w-full h-full",
59
+ styles: `bg-${bgColor ?? "gray-300"} text-black font-bold`,
60
+ },
61
+ block: {
62
+ sizes: "w-full h-full",
63
+ },
64
+ };
65
+ const body = {
66
+ sizes: "h-full",
67
+ overflow: `overflow-${overflow ?? "hidden"}`,
68
+ classNames,
69
+ };
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 })] }));
48
75
  }
package/deck/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./Deck";
1
+ export { default as Deck } from "./template/Deck";
package/deck/index.js CHANGED
@@ -1 +1 @@
1
- export * from "./Deck";
1
+ export { default as Deck } from "./template/Deck";
@@ -0,0 +1,6 @@
1
+ import { DeckProps } from "../../interface/Deck";
2
+ declare function Deck<T extends string | number>(props: DeckProps<T>): import("react/jsx-runtime").JSX.Element;
3
+ declare namespace Deck {
4
+ var Sub: <T extends string | number>({ titles, children, options, debug, }: DeckProps<T>) => import("react/jsx-runtime").JSX.Element;
5
+ }
6
+ export default Deck;
@@ -0,0 +1,2 @@
1
+ import { DeckProps } from "../../interface/Deck";
2
+ export default function DeckDesign<T extends string | number>({ children, titles, options, debug, }: DeckProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn, isDebug } from "../../util";
3
+ import { Deck } from "./../widget/Deck";
4
+ export default function DeckDesign({ children, titles, options, debug, }) {
5
+ const { title, subtitle, isSub } = titles ?? {};
6
+ const { height } = options ?? {};
7
+ const container = {
8
+ displays: "flex flex-col gap-4",
9
+ sizes: `w-full h-${height ?? "auto"} `,
10
+ debug: debug && isDebug(`border-2 border-${debug}`),
11
+ };
12
+ const titleBox = {
13
+ container: "flex flex-col gap-1",
14
+ title: {
15
+ text: isSub ? "text-base xl:text-lg" : "text-xl xl:text-2xl",
16
+ font: "font-bold",
17
+ },
18
+ subtitle: isSub ? "text-xs xl:text-sm" : "text-sm xl:text-base",
19
+ };
20
+ return (_jsxs("div", { className: cn(container), children: [titles && (_jsxs("div", { children: [_jsx("div", { className: cn(titleBox.title), children: title }), _jsx("div", { className: cn(titleBox.subtitle), children: subtitle })] })), _jsx(Deck, { children: children })] }));
21
+ }
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import DeckDesign from "./Deck.design";
3
+ function Deck(props) {
4
+ return _jsx(DeckDesign, { ...props });
5
+ }
6
+ function Sub({ titles, children, options, debug, }) {
7
+ const { title, subtitle } = titles ?? { title: "" };
8
+ return (_jsx(DeckDesign, { titles: { title, subtitle, isSub: true }, debug: debug, ...options, children: children }));
9
+ }
10
+ Deck.Sub = Sub;
11
+ export default Deck;
@@ -0,0 +1,2 @@
1
+ import { DeckProps } from "../../interface/Deck";
2
+ export declare function Deck<T extends string | number>({ children, options, }: DeckProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../util";
3
+ export function Deck({ children, options, }) {
4
+ const { flex, justify, gapX, gapY, overflowScroll } = options ?? {};
5
+ const body = {
6
+ displays: `flex flex-col flex-wrap gap-y-${gapY ?? 5}`,
7
+ flex: flex === "col" ? "sm:flex-col" : "sm:flex-row",
8
+ justify: `justify-${justify ?? "start"}`,
9
+ gapX: `${`gap-x-${gapX ?? 7.5}`}`,
10
+ sizes: "sm:w-full ",
11
+ styles: `${overflowScroll ? "overflow-x-scroll" : ""} duration-500`,
12
+ };
13
+ return _jsx("div", { className: cn(body), children: children });
14
+ }
package/globals.css CHANGED
@@ -19,11 +19,28 @@
19
19
 
20
20
  @font-face {
21
21
  font-family: "Megrim";
22
- src: url("./asset/fonts/Megrim.ttf") format("trueType");
22
+ src: url("./asset/fonts/Megrim.ttf") format("truetype");
23
+ }
24
+
25
+ @font-face {
26
+ font-family: "Times-Newer-Roman-Bold";
27
+ src: url("./asset/fonts/TimesNewerRoman-Bold.otf") format("opentype");
28
+ }
29
+
30
+ @font-face {
31
+ font-family: "Times-Newer-Roman-BoldItalic";
32
+ src: url("./asset/fonts/TimesNewerRoman-BoldItalic.otf") format("opentype");
33
+ }
34
+
35
+ input[type="date"]::-webkit-inner-spin-button,
36
+ input[type="date"]::-webkit-calendar-picker-indicator {
37
+ display: none;
38
+ -webkit-appearance: none;
23
39
  }
24
40
 
25
41
  ::-webkit-scrollbar {
26
42
  width: 3px;
43
+ padding-right: 10px;
27
44
  }
28
45
 
29
46
  ::-webkit-scrollbar-track {
@@ -39,6 +56,10 @@
39
56
  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.15);
40
57
  }
41
58
 
59
+ .box-shadow-sm {
60
+ box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
61
+ }
62
+
42
63
  .x-shape {
43
64
  position: relative;
44
65
  width: 0.83625rem;
@@ -65,3 +86,100 @@
65
86
  .x-shape::after {
66
87
  transform: translate(-50%, -50%) rotate(-45deg);
67
88
  }
89
+
90
+ .border-inner {
91
+ box-shadow: 0 0 0 1px #e5e7eb inset, 0 4px 6px -1px rgba(0, 0, 0, 0.1),
92
+ 0 2px 4px -1px rgba(0, 0, 0, 0.06);
93
+ }
94
+ .asdfasdf:hover {
95
+ box-shadow: 0 0 0 1px #e5e7eb inset, 0 4px 6px -1px rgba(0, 0, 0, 0.1),
96
+ 0 2px 4px -1px rgba(0, 0, 0, 0.06);
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
+ }
@@ -0,0 +1,4 @@
1
+ export { default as Button } from "./widget/Button";
2
+ export { default as Input } from "./widget/Input";
3
+ export { default as Select } from "./widget/Select";
4
+ export { default as Toggle } from "./widget/Toggle";
package/html/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { default as Button } from "./widget/Button";
2
+ export { default as Input } from "./widget/Input";
3
+ export { default as Select } from "./widget/Select";
4
+ export { default as Toggle } from "./widget/Toggle";
@@ -0,0 +1,2 @@
1
+ import { HTMLButtonElement } from "../../interface";
2
+ export default function Button({ title, onClick }: HTMLButtonElement): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../util";
3
+ const widthSize = {
4
+ md: "w-45",
5
+ lg: "w-50",
6
+ };
7
+ const heightSize = {
8
+ md: "h-11",
9
+ };
10
+ export default function Button({ title, onClick }) {
11
+ const container = {
12
+ sizes: "",
13
+ };
14
+ return (_jsx("button", { onClick: onClick, className: cn(container), children: title }));
15
+ }
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ import { HTMLInputElement } from "../../interface";
2
+ export default function Input({ state, placeholder, options, }: HTMLInputElement): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { cn } from "../../util";
4
+ const widthSize = {
5
+ xs: "w-28",
6
+ sm: "w-48",
7
+ md: "w-64",
8
+ lg: "w-96",
9
+ xl: "w-128",
10
+ "2xl": "w-144",
11
+ full: "w-full",
12
+ };
13
+ export default function Input({ state, placeholder, options, }) {
14
+ const [_, onChange] = state;
15
+ const { width } = options ?? {};
16
+ const id = useId();
17
+ const container = {
18
+ width: `${widthSize[width ?? "md"]} h-10`,
19
+ styles: "rounded-full pl-4 border-4",
20
+ };
21
+ return (_jsx("input", { className: cn(container), id: id, type: "text", placeholder: placeholder ?? "", onChange: (e) => onChange(e.target.value) }));
22
+ }
@@ -0,0 +1,2 @@
1
+ import { HTMLSelectElement } from "../../interface";
2
+ export default function Select({ state, selectOptions, options, }: HTMLSelectElement): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,160 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect } from "react";
3
+ import { BiChevronDown } from "react-icons/bi";
4
+ import { useWidgetStore } from "../../store";
5
+ import { cn } from "../../util";
6
+ const widthSize = {
7
+ xs: "w-32",
8
+ sm: "w-48",
9
+ md: "w-64",
10
+ lg: "w-96",
11
+ xl: "w-128",
12
+ "2xl": "w-144",
13
+ full: "w-full",
14
+ };
15
+ export default function Select({ state, selectOptions, options, }) {
16
+ const [value, setValue] = state;
17
+ // isActive 드롭다운 이벤트 통제
18
+ const { flag } = useWidgetStore();
19
+ useEffect(() => {
20
+ if (!isButton)
21
+ setIsActive(false);
22
+ return setIsButton(false);
23
+ }, [flag]);
24
+ const [isActive, setIsActive] = useState(false);
25
+ const [isButton, setIsButton] = useState(false);
26
+ const [selectedItem, setSelectedItem] = useState(null);
27
+ const handleItemClick = (title) => {
28
+ setSelectedItem(title);
29
+ setIsActive(false);
30
+ };
31
+ // css
32
+ const levels = [
33
+ "CoCoon",
34
+ "PreStarter",
35
+ "Starter",
36
+ "Basic",
37
+ "Junior",
38
+ "HighJunior",
39
+ ];
40
+ const colorMap = {
41
+ CoCoon: "bg-cocoon-green",
42
+ PreStarter: "bg-ps-pink",
43
+ Starter: "bg-st-orange",
44
+ Basic: "bg-ba-yellow",
45
+ Junior: "bg-jr-blue",
46
+ HighJunior: "bg-hj-blue",
47
+ };
48
+ const isActiveCss = () => {
49
+ if (isActive)
50
+ return `shadow-md border-inner rounded-md`;
51
+ };
52
+ const tagCss = `bg-slate-200 p-1 pl-2 pr-2 rounded-md`;
53
+ const dropdownTop = selectOptions && selectOptions.length > 6 ? "top-24" : "top-12";
54
+ const { width } = options ?? {};
55
+ const dropdown = {
56
+ size: `w-40 h-6`,
57
+ styles: "cursor-pointer pt-4 pb-4 pl-4 pr-4 font-bold text-sm bg-white",
58
+ display: `flex items-center`,
59
+ hover: `hover:rounded-md`,
60
+ effect: `transition-all`,
61
+ function: `${isActiveCss()}`,
62
+ etc: "asdfasdf",
63
+ };
64
+ const dropdownInput = {
65
+ size: `w-40 h-6 `,
66
+ styles: "shadow-md text-sm p-4 font-bold bg-white text-left cursor-text border-1 rounded-md ",
67
+ display: "absolute top-12 flex items-center z-10 ",
68
+ focus: "focus:outline-none focus:border-[#44C5F3] focus:border-1 ",
69
+ };
70
+ const dropdownContent = {
71
+ size: `w-40 min-h-6 max-h-48 overflow-y-auto `,
72
+ styles: `text-sm mt-1 border-1 rounded-md shadow-md`,
73
+ display: `absolute z-40`,
74
+ function: `${dropdownTop}`,
75
+ };
76
+ const dropdownItem = {
77
+ size: `${widthSize[width ?? "full"]} h-6 `,
78
+ styles: `text-sm text-left p-4 font-bold cursor-pointer `,
79
+ display: `flex items-center z-40`,
80
+ hover: `hover:bg-slate-200 `,
81
+ effect: `transition-all `,
82
+ };
83
+ // input
84
+ const [searchTerm, setSearchTerm] = useState("");
85
+ const filteredOptions = selectOptions?.filter(([_, title]) => title.toLowerCase().includes(searchTerm.toLowerCase())) || [];
86
+ // Keyboard event handling
87
+ const [selectedIndex, setSelectedIndex] = useState(-1);
88
+ useEffect(() => {
89
+ const handleKeyDown = (event) => {
90
+ if (!isActive)
91
+ return;
92
+ // Arrow Up
93
+ if (event.key === "ArrowUp") {
94
+ event.preventDefault();
95
+ const currentIndex = filteredOptions.findIndex(([_, title]) => title === selectedItem);
96
+ const newIndex = currentIndex === -1
97
+ ? 0
98
+ : (currentIndex - 1 + filteredOptions.length) %
99
+ filteredOptions.length;
100
+ setSelectedItem(filteredOptions[newIndex][1]);
101
+ setSelectedIndex(newIndex);
102
+ }
103
+ // Arrow Down
104
+ if (event.key === "ArrowDown") {
105
+ event.preventDefault();
106
+ const currentIndex = filteredOptions.findIndex(([_, title]) => title === selectedItem);
107
+ const newIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % filteredOptions.length;
108
+ setSelectedItem(filteredOptions[newIndex][1]);
109
+ setSelectedIndex(newIndex);
110
+ }
111
+ // Enter
112
+ if (event.key === "Enter") {
113
+ if (selectedItem) {
114
+ setIsActive(false);
115
+ setValue(selectedItem);
116
+ }
117
+ }
118
+ // Esc
119
+ if (event.key === "Escape") {
120
+ setIsActive(false);
121
+ }
122
+ };
123
+ window.addEventListener("keydown", handleKeyDown);
124
+ // 선택된 항목 스크롤을 조정하는 함수
125
+ const scrollIntoView = () => {
126
+ if (selectedIndex === -1)
127
+ return;
128
+ const dropdownContent = document.querySelector(".dropdown-content");
129
+ if (!dropdownContent)
130
+ return;
131
+ const selectedItemElement = dropdownContent.children[selectedIndex];
132
+ if (!selectedItemElement)
133
+ return;
134
+ const dropdownRect = dropdownContent.getBoundingClientRect();
135
+ const selectedItemRect = selectedItemElement.getBoundingClientRect();
136
+ if (selectedItemRect.top < dropdownRect.top) {
137
+ dropdownContent.scrollTop -= dropdownRect.top - selectedItemRect.top;
138
+ }
139
+ else if (selectedItemRect.bottom > dropdownRect.bottom) {
140
+ dropdownContent.scrollTop +=
141
+ selectedItemRect.bottom - dropdownRect.bottom;
142
+ }
143
+ };
144
+ scrollIntoView();
145
+ window.addEventListener("resize", scrollIntoView);
146
+ return () => {
147
+ window.removeEventListener("keydown", handleKeyDown);
148
+ window.removeEventListener("resize", scrollIntoView);
149
+ };
150
+ }, [isActive, selectedIndex, filteredOptions, selectedItem, setValue]);
151
+ return (_jsxs("div", { className: "relative", children: [_jsxs("div", { className: cn(dropdown), onClick: () => {
152
+ setIsActive(!isActive);
153
+ setIsButton(true);
154
+ }, children: [_jsx("div", { className: `w-4 h-4 mr-2 ${selectedItem && colorMap[selectedItem]
155
+ ? colorMap[selectedItem]
156
+ : "hidden"}` }), _jsx("div", { className: `${!selectedItem || levels.includes(selectedItem) ? "" : tagCss}`, children: selectedItem || (_jsx("span", { className: "text-zinc-400", children: "\uC635\uC158\uC744 \uC120\uD0DD\uD558\uC138\uC694" })) }), isActive && _jsx(BiChevronDown, { className: "ml-auto" })] }), isActive && selectOptions && selectOptions.length > 6 && (_jsx("input", { type: "text", placeholder: "\uAC80\uC0C9\uC5B4\uB97C \uC785\uB825\uD558\uC138\uC694", className: cn(dropdownInput), value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), onClick: (e) => e.stopPropagation() })), isActive && filteredOptions && (_jsx("div", { className: "dropdown-content " + cn(dropdownContent), children: filteredOptions.map(([id, title], index) => (_jsxs("div", { className: cn(dropdownItem) +
157
+ (selectedIndex === index ? "bg-slate-200" : "bg-white"), onClick: () => handleItemClick(title), children: [_jsx("div", { className: `w-4 h-4 mr-2 ${colorMap[title] && levels.includes(title)
158
+ ? colorMap[title]
159
+ : "hidden"}` }), _jsx("div", { className: `${levels.includes(title) ? "" : tagCss}`, children: title })] }, id))) }))] }));
160
+ }
@@ -0,0 +1,2 @@
1
+ import { HTMLToggleElement } from "../../interface";
2
+ export default function Toggle({ state: [chekced, setChecked], isDisabled, labels, }: HTMLToggleElement): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const widthSize = {
3
+ xs: "w-32",
4
+ sm: "w-48",
5
+ md: "w-64",
6
+ lg: "w-96",
7
+ xl: "w-128",
8
+ "2xl": "w-144",
9
+ full: "w-full",
10
+ };
11
+ export default function Toggle({ state: [chekced, setChecked], isDisabled, labels, }) {
12
+ return (_jsxs("div", { className: "w-24 h-6 flex", children: [_jsx("label", { htmlFor: "", className: "inline-flex items-center gap-2 ", children: _jsx("input", { disabled: isDisabled, type: "checkbox", className: "bg-red-crimson appearance-none relative rounded-full w-10 h-5 cursor-pointer", checked: chekced, onChange: (e) => setChecked(e.target.checked) }) }), _jsx("div", { className: "ml-2 transition-all", children: labels.map(([status, label]) => (status === chekced ? label : "")) })] }));
13
+ }
package/index.d.ts CHANGED
@@ -3,9 +3,9 @@ export * from "./board";
3
3
  export * from "./card";
4
4
  export * from "./deck";
5
5
  export * from "./layout";
6
+ export * from "./html";
6
7
  export * from "./interaction";
7
- export * from "./menu";
8
8
  export * from "./modal";
9
9
  export * from "./navigation";
10
- export * from "./shelf";
10
+ export * from "./overlay";
11
11
  export * from "./text";
package/index.js CHANGED
@@ -3,9 +3,9 @@ export * from "./board";
3
3
  export * from "./card";
4
4
  export * from "./deck";
5
5
  export * from "./layout";
6
+ export * from "./html";
6
7
  export * from "./interaction";
7
- export * from "./menu";
8
8
  export * from "./modal";
9
9
  export * from "./navigation";
10
- export * from "./shelf";
10
+ export * from "./overlay";
11
11
  export * from "./text";