@edu-tosel/design 1.0.63 → 1.0.65

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.
@@ -0,0 +1 @@
1
+ export declare const widthSizes: Record<string | number, string>;
package/asset/sizes.js ADDED
@@ -0,0 +1,202 @@
1
+ export const widthSizes = {
2
+ 1: "w-1/100",
3
+ 2: "w-2/100",
4
+ 3: "w-3/100",
5
+ 4: "w-4/100",
6
+ 5: "w-5/100",
7
+ 6: "w-6/100",
8
+ 7: "w-7/100",
9
+ 8: "w-8/100",
10
+ 9: "w-9/100",
11
+ 10: "w-10/100",
12
+ 11: "w-11/100",
13
+ 12: "w-12/100",
14
+ 13: "w-13/100",
15
+ 14: "w-14/100",
16
+ 15: "w-15/100",
17
+ 16: "w-16/100",
18
+ 17: "w-17/100",
19
+ 18: "w-18/100",
20
+ 19: "w-19/100",
21
+ 20: "w-20/100",
22
+ 21: "w-21/100",
23
+ 22: "w-22/100",
24
+ 23: "w-23/100",
25
+ 24: "w-24/100",
26
+ 25: "w-25/100",
27
+ 26: "w-26/100",
28
+ 27: "w-27/100",
29
+ 28: "w-28/100",
30
+ 29: "w-29/100",
31
+ 30: "w-30/100",
32
+ 31: "w-31/100",
33
+ 32: "w-32/100",
34
+ 33: "w-33/100",
35
+ 34: "w-34/100",
36
+ 35: "w-35/100",
37
+ 36: "w-36/100",
38
+ 37: "w-37/100",
39
+ 38: "w-38/100",
40
+ 39: "w-39/100",
41
+ 40: "w-40/100",
42
+ 41: "w-41/100",
43
+ 42: "w-42/100",
44
+ 43: "w-43/100",
45
+ 44: "w-44/100",
46
+ 45: "w-45/100",
47
+ 46: "w-46/100",
48
+ 47: "w-47/100",
49
+ 48: "w-48/100",
50
+ 49: "w-49/100",
51
+ 50: "w-50/100",
52
+ 51: "w-51/100",
53
+ 52: "w-52/100",
54
+ 53: "w-53/100",
55
+ 54: "w-54/100",
56
+ 55: "w-55/100",
57
+ 56: "w-56/100",
58
+ 57: "w-57/100",
59
+ 58: "w-58/100",
60
+ 59: "w-59/100",
61
+ 60: "w-60/100",
62
+ 61: "w-61/100",
63
+ 62: "w-62/100",
64
+ 63: "w-63/100",
65
+ 64: "w-64/100",
66
+ 65: "w-65/100",
67
+ 66: "w-66/100",
68
+ 67: "w-67/100",
69
+ 68: "w-68/100",
70
+ 69: "w-69/100",
71
+ 70: "w-70/100",
72
+ 71: "w-71/100",
73
+ 72: "w-72/100",
74
+ 73: "w-73/100",
75
+ 74: "w-74/100",
76
+ 75: "w-75/100",
77
+ 76: "w-76/100",
78
+ 77: "w-77/100",
79
+ 78: "w-78/100",
80
+ 79: "w-79/100",
81
+ 80: "w-80/100",
82
+ 81: "w-81/100",
83
+ 82: "w-82/100",
84
+ 83: "w-83/100",
85
+ 84: "w-84/100",
86
+ 85: "w-85/100",
87
+ 86: "w-86/100",
88
+ 87: "w-87/100",
89
+ 88: "w-88/100",
90
+ 89: "w-89/100",
91
+ 90: "w-90/100",
92
+ 91: "w-91/100",
93
+ 92: "w-92/100",
94
+ 93: "w-93/100",
95
+ 94: "w-94/100",
96
+ 95: "w-95/100",
97
+ 96: "w-96/100",
98
+ 97: "w-97/100",
99
+ 98: "w-98/100",
100
+ 99: "w-99/100",
101
+ 100: "w-full",
102
+ "1%": "w-1/100",
103
+ "2%": "w-2/100",
104
+ "3%": "w-3/100",
105
+ "4%": "w-4/100",
106
+ "5%": "w-5/100",
107
+ "6%": "w-6/100",
108
+ "7%": "w-7/100",
109
+ "8%": "w-8/100",
110
+ "9%": "w-9/100",
111
+ "10%": "w-10/100",
112
+ "11%": "w-11/100",
113
+ "12%": "w-12/100",
114
+ "13%": "w-13/100",
115
+ "14%": "w-14/100",
116
+ "15%": "w-15/100",
117
+ "16%": "w-16/100",
118
+ "17%": "w-17/100",
119
+ "18%": "w-18/100",
120
+ "19%": "w-19/100",
121
+ "20%": "w-20/100",
122
+ "21%": "w-21/100",
123
+ "22%": "w-22/100",
124
+ "23%": "w-23/100",
125
+ "24%": "w-24/100",
126
+ "25%": "w-25/100",
127
+ "26%": "w-26/100",
128
+ "27%": "w-27/100",
129
+ "28%": "w-28/100",
130
+ "29%": "w-29/100",
131
+ "30%": "w-30/100",
132
+ "31%": "w-31/100",
133
+ "32%": "w-32/100",
134
+ "33%": "w-33/100",
135
+ "34%": "w-34/100",
136
+ "35%": "w-35/100",
137
+ "36%": "w-36/100",
138
+ "37%": "w-37/100",
139
+ "38%": "w-38/100",
140
+ "39%": "w-39/100",
141
+ "40%": "w-40/100",
142
+ "41%": "w-41/100",
143
+ "42%": "w-42/100",
144
+ "43%": "w-43/100",
145
+ "44%": "w-44/100",
146
+ "45%": "w-45/100",
147
+ "46%": "w-46/100",
148
+ "47%": "w-47/100",
149
+ "48%": "w-48/100",
150
+ "49%": "w-49/100",
151
+ "50%": "w-50/100",
152
+ "51%": "w-51/100",
153
+ "52%": "w-52/100",
154
+ "53%": "w-53/100",
155
+ "54%": "w-54/100",
156
+ "55%": "w-55/100",
157
+ "56%": "w-56/100",
158
+ "57%": "w-57/100",
159
+ "58%": "w-58/100",
160
+ "59%": "w-59/100",
161
+ "60%": "w-60/100",
162
+ "61%": "w-61/100",
163
+ "62%": "w-62/100",
164
+ "63%": "w-63/100",
165
+ "64%": "w-64/100",
166
+ "65%": "w-65/100",
167
+ "66%": "w-66/100",
168
+ "67%": "w-67/100",
169
+ "68%": "w-68/100",
170
+ "69%": "w-69/100",
171
+ "70%": "w-70/100",
172
+ "71%": "w-71/100",
173
+ "72%": "w-72/100",
174
+ "73%": "w-73/100",
175
+ "74%": "w-74/100",
176
+ "75%": "w-75/100",
177
+ "76%": "w-76/100",
178
+ "77%": "w-77/100",
179
+ "78%": "w-78/100",
180
+ "79%": "w-79/100",
181
+ "80%": "w-80/100",
182
+ "81%": "w-81/100",
183
+ "82%": "w-82/100",
184
+ "83%": "w-83/100",
185
+ "84%": "w-84/100",
186
+ "85%": "w-85/100",
187
+ "86%": "w-86/100",
188
+ "87%": "w-87/100",
189
+ "88%": "w-88/100",
190
+ "89%": "w-89/100",
191
+ "90%": "w-90/100",
192
+ "91%": "w-91/100",
193
+ "92%": "w-92/100",
194
+ "93%": "w-93/100",
195
+ "94%": "w-94/100",
196
+ "95%": "w-95/100",
197
+ "96%": "w-96/100",
198
+ "97%": "w-97/100",
199
+ "98%": "w-98/100",
200
+ "99%": "w-99/100",
201
+ "100%": "w-full",
202
+ };
package/asset/sizes.ts ADDED
@@ -0,0 +1,202 @@
1
+ export const widthSizes = {
2
+ 1: "w-1/100",
3
+ 2: "w-2/100",
4
+ 3: "w-3/100",
5
+ 4: "w-4/100",
6
+ 5: "w-5/100",
7
+ 6: "w-6/100",
8
+ 7: "w-7/100",
9
+ 8: "w-8/100",
10
+ 9: "w-9/100",
11
+ 10: "w-10/100",
12
+ 11: "w-11/100",
13
+ 12: "w-12/100",
14
+ 13: "w-13/100",
15
+ 14: "w-14/100",
16
+ 15: "w-15/100",
17
+ 16: "w-16/100",
18
+ 17: "w-17/100",
19
+ 18: "w-18/100",
20
+ 19: "w-19/100",
21
+ 20: "w-20/100",
22
+ 21: "w-21/100",
23
+ 22: "w-22/100",
24
+ 23: "w-23/100",
25
+ 24: "w-24/100",
26
+ 25: "w-25/100",
27
+ 26: "w-26/100",
28
+ 27: "w-27/100",
29
+ 28: "w-28/100",
30
+ 29: "w-29/100",
31
+ 30: "w-30/100",
32
+ 31: "w-31/100",
33
+ 32: "w-32/100",
34
+ 33: "w-33/100",
35
+ 34: "w-34/100",
36
+ 35: "w-35/100",
37
+ 36: "w-36/100",
38
+ 37: "w-37/100",
39
+ 38: "w-38/100",
40
+ 39: "w-39/100",
41
+ 40: "w-40/100",
42
+ 41: "w-41/100",
43
+ 42: "w-42/100",
44
+ 43: "w-43/100",
45
+ 44: "w-44/100",
46
+ 45: "w-45/100",
47
+ 46: "w-46/100",
48
+ 47: "w-47/100",
49
+ 48: "w-48/100",
50
+ 49: "w-49/100",
51
+ 50: "w-50/100",
52
+ 51: "w-51/100",
53
+ 52: "w-52/100",
54
+ 53: "w-53/100",
55
+ 54: "w-54/100",
56
+ 55: "w-55/100",
57
+ 56: "w-56/100",
58
+ 57: "w-57/100",
59
+ 58: "w-58/100",
60
+ 59: "w-59/100",
61
+ 60: "w-60/100",
62
+ 61: "w-61/100",
63
+ 62: "w-62/100",
64
+ 63: "w-63/100",
65
+ 64: "w-64/100",
66
+ 65: "w-65/100",
67
+ 66: "w-66/100",
68
+ 67: "w-67/100",
69
+ 68: "w-68/100",
70
+ 69: "w-69/100",
71
+ 70: "w-70/100",
72
+ 71: "w-71/100",
73
+ 72: "w-72/100",
74
+ 73: "w-73/100",
75
+ 74: "w-74/100",
76
+ 75: "w-75/100",
77
+ 76: "w-76/100",
78
+ 77: "w-77/100",
79
+ 78: "w-78/100",
80
+ 79: "w-79/100",
81
+ 80: "w-80/100",
82
+ 81: "w-81/100",
83
+ 82: "w-82/100",
84
+ 83: "w-83/100",
85
+ 84: "w-84/100",
86
+ 85: "w-85/100",
87
+ 86: "w-86/100",
88
+ 87: "w-87/100",
89
+ 88: "w-88/100",
90
+ 89: "w-89/100",
91
+ 90: "w-90/100",
92
+ 91: "w-91/100",
93
+ 92: "w-92/100",
94
+ 93: "w-93/100",
95
+ 94: "w-94/100",
96
+ 95: "w-95/100",
97
+ 96: "w-96/100",
98
+ 97: "w-97/100",
99
+ 98: "w-98/100",
100
+ 99: "w-99/100",
101
+ 100: "w-full",
102
+ "1%": "w-1/100",
103
+ "2%": "w-2/100",
104
+ "3%": "w-3/100",
105
+ "4%": "w-4/100",
106
+ "5%": "w-5/100",
107
+ "6%": "w-6/100",
108
+ "7%": "w-7/100",
109
+ "8%": "w-8/100",
110
+ "9%": "w-9/100",
111
+ "10%": "w-10/100",
112
+ "11%": "w-11/100",
113
+ "12%": "w-12/100",
114
+ "13%": "w-13/100",
115
+ "14%": "w-14/100",
116
+ "15%": "w-15/100",
117
+ "16%": "w-16/100",
118
+ "17%": "w-17/100",
119
+ "18%": "w-18/100",
120
+ "19%": "w-19/100",
121
+ "20%": "w-20/100",
122
+ "21%": "w-21/100",
123
+ "22%": "w-22/100",
124
+ "23%": "w-23/100",
125
+ "24%": "w-24/100",
126
+ "25%": "w-25/100",
127
+ "26%": "w-26/100",
128
+ "27%": "w-27/100",
129
+ "28%": "w-28/100",
130
+ "29%": "w-29/100",
131
+ "30%": "w-30/100",
132
+ "31%": "w-31/100",
133
+ "32%": "w-32/100",
134
+ "33%": "w-33/100",
135
+ "34%": "w-34/100",
136
+ "35%": "w-35/100",
137
+ "36%": "w-36/100",
138
+ "37%": "w-37/100",
139
+ "38%": "w-38/100",
140
+ "39%": "w-39/100",
141
+ "40%": "w-40/100",
142
+ "41%": "w-41/100",
143
+ "42%": "w-42/100",
144
+ "43%": "w-43/100",
145
+ "44%": "w-44/100",
146
+ "45%": "w-45/100",
147
+ "46%": "w-46/100",
148
+ "47%": "w-47/100",
149
+ "48%": "w-48/100",
150
+ "49%": "w-49/100",
151
+ "50%": "w-50/100",
152
+ "51%": "w-51/100",
153
+ "52%": "w-52/100",
154
+ "53%": "w-53/100",
155
+ "54%": "w-54/100",
156
+ "55%": "w-55/100",
157
+ "56%": "w-56/100",
158
+ "57%": "w-57/100",
159
+ "58%": "w-58/100",
160
+ "59%": "w-59/100",
161
+ "60%": "w-60/100",
162
+ "61%": "w-61/100",
163
+ "62%": "w-62/100",
164
+ "63%": "w-63/100",
165
+ "64%": "w-64/100",
166
+ "65%": "w-65/100",
167
+ "66%": "w-66/100",
168
+ "67%": "w-67/100",
169
+ "68%": "w-68/100",
170
+ "69%": "w-69/100",
171
+ "70%": "w-70/100",
172
+ "71%": "w-71/100",
173
+ "72%": "w-72/100",
174
+ "73%": "w-73/100",
175
+ "74%": "w-74/100",
176
+ "75%": "w-75/100",
177
+ "76%": "w-76/100",
178
+ "77%": "w-77/100",
179
+ "78%": "w-78/100",
180
+ "79%": "w-79/100",
181
+ "80%": "w-80/100",
182
+ "81%": "w-81/100",
183
+ "82%": "w-82/100",
184
+ "83%": "w-83/100",
185
+ "84%": "w-84/100",
186
+ "85%": "w-85/100",
187
+ "86%": "w-86/100",
188
+ "87%": "w-87/100",
189
+ "88%": "w-88/100",
190
+ "89%": "w-89/100",
191
+ "90%": "w-90/100",
192
+ "91%": "w-91/100",
193
+ "92%": "w-92/100",
194
+ "93%": "w-93/100",
195
+ "94%": "w-94/100",
196
+ "95%": "w-95/100",
197
+ "96%": "w-96/100",
198
+ "97%": "w-97/100",
199
+ "98%": "w-98/100",
200
+ "99%": "w-99/100",
201
+ "100%": "w-full",
202
+ } as Record<number | string, string>;
@@ -37,9 +37,10 @@ export interface InputWidget extends Widget {
37
37
  state: State<string> | State<string | undefined>;
38
38
  onKeyDown?: (e: React.KeyboardEvent) => void;
39
39
  placeholder?: string;
40
- flag?: boolean;
40
+ isValid?: boolean;
41
41
  type?: InputType;
42
42
  label?: LabelWidget;
43
+ maxLength?: number;
43
44
  }
44
45
  export interface CheckBoxWidget extends Widget {
45
46
  state: State<boolean>;
@@ -3,6 +3,7 @@ import { useId } from "react";
3
3
  import { ColorSet } from "../../interface";
4
4
  import { cn } from "../../util";
5
5
  import { Label } from "../../widget";
6
+ import { widthSizes } from "../../asset/sizes";
6
7
  export default function RowDesign({ item, dataField, option, onClick, buttons, dot, }) {
7
8
  const { size, padding, text, noHover, className, isPointer } = option ?? {};
8
9
  const id = useId();
@@ -26,7 +27,7 @@ export default function RowDesign({ item, dataField, option, onClick, buttons, d
26
27
  styles: "rounded-full",
27
28
  };
28
29
  return (_jsxs("div", { className: cn(container), onClick: () => onClick?.(), children: [typeof dot !== "undefined" && _jsx("div", { className: cn(flagBox) }), dataField &&
29
- Object.keys(dataField).map((key) => (_jsx("div", { className: cn(`w-${dataField[key]?.size}/100`, 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: {
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: {
30
31
  background: option?.background ?? "bg-crimson-dark",
31
32
  text: option?.text ?? "text-white",
32
33
  width: "xs",
@@ -2,5 +2,5 @@ import { InputWidget } from "../../../interface";
2
2
  interface InputWithTitleProps extends InputWidget {
3
3
  title: string;
4
4
  }
5
- declare function WithTitle({ title, placeholder, state, flag, type, }: InputWithTitleProps): import("react/jsx-runtime").JSX.Element;
5
+ declare function WithTitle(props: InputWithTitleProps): import("react/jsx-runtime").JSX.Element;
6
6
  export default WithTitle;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Input } from "../../../widget";
3
- function WithTitle({ title, placeholder, state, flag, type, }) {
4
- return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("div", { className: "leading-none", children: title }), _jsx(Input.Form, { placeholder: placeholder, state: state, flag: flag, type: type })] }));
3
+ function WithTitle(props) {
4
+ return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("div", { className: "leading-none", children: props.title }), _jsx(Input.Form, { ...props })] }));
5
5
  }
6
6
  export default WithTitle;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.63",
3
+ "version": "1.0.65",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
@@ -592,7 +592,6 @@ export default {
592
592
  },
593
593
  },
594
594
  safelist: [
595
- { pattern: /w-.*/ },
596
595
  {
597
596
  pattern: /top-.*/,
598
597
  },
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.63
1
+ 1.0.65
@@ -1,2 +1,2 @@
1
1
  import { InputWidget } from "../../../interface";
2
- export default function LG({ state, placeholder, flag, type, label, }: InputWidget): import("react/jsx-runtime").JSX.Element;
2
+ export default function LG({ state, placeholder, isValid, type, label, maxLength, }: InputWidget): import("react/jsx-runtime").JSX.Element;
@@ -2,7 +2,7 @@ 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, flag, type, label, }) {
5
+ export default function LG({ state, placeholder, isValid, type, label, maxLength, }) {
6
6
  const [value, setValue] = state;
7
7
  const [onFocus, setOnFocus] = useState(false);
8
8
  const ref = useRef(null);
@@ -23,17 +23,21 @@ export default function LG({ state, placeholder, flag, type, label, }) {
23
23
  return "bg-crimson-burgundy/10 text-crimson-burgundy border-crimson-burgundy";
24
24
  };
25
25
  const inputBox = {
26
- styles: styleByFlag(flag),
26
+ styles: styleByFlag(isValid),
27
27
  sizes: "w-102.5 h-13.5",
28
28
  paddings: `${placeholder && "pt-3"} pl-5`,
29
29
  fonts: "text-sm",
30
30
  boundaries: "rounded-md outline-none",
31
31
  focuses: onFocus ? "border " : "border-0",
32
32
  shadows: onFocus &&
33
- !(flag === false) &&
33
+ !(isValid === false) &&
34
34
  "shadow-[0px_0px_10px_0px_rgba(16,86,82,0.38)]",
35
35
  };
36
- return (_jsxs("div", { className: cn(container), children: [_jsx("div", { onClick: () => ref.current?.focus(), className: cn(placeholderBox), children: placeholder }), _jsx("input", { ref: ref, className: cn(inputBox), value: value, onFocus: () => setOnFocus(true), onBlur: () => setOnFocus(false), onChange: (e) => setValue(e.target.value), type: type ?? "text" }), label && (_jsx(Label.Button, { title: label.title, onClick: label.onClick, option: {
36
+ return (_jsxs("div", { className: cn(container), children: [_jsx("div", { onClick: () => ref.current?.focus(), className: cn(placeholderBox), children: placeholder }), _jsx("input", { ref: ref, className: cn(inputBox), value: value, onFocus: () => setOnFocus(true), onBlur: () => setOnFocus(false), onChange: (e) => {
37
+ if (maxLength && e.target.value.length > maxLength)
38
+ return;
39
+ setValue(e.target.value);
40
+ }, type: type ?? "text" }), label && (_jsx(Label.Button, { title: label.title, onClick: label.onClick, option: {
37
41
  width: "sm",
38
42
  height: "xs",
39
43
  className: "absolute top-3.5 right-3.75",
@@ -1,6 +1,6 @@
1
1
  import { Widget, State } from "../../interface";
2
- export interface HTMLToggleElement extends Widget {
2
+ export interface ToggleWidget extends Widget {
3
3
  state: State<boolean>;
4
4
  labels?: [[true, string], [false, string]];
5
5
  }
6
- export default function Toggle({ state: [chekced, setChecked], labels, option, }: HTMLToggleElement): import("react/jsx-runtime").JSX.Element;
6
+ export default function Toggle({ state: [chekced, setChecked], labels, option, }: ToggleWidget): import("react/jsx-runtime").JSX.Element;