@esic-lab/data-core-ui 0.0.36 → 0.0.37

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.
package/dist/index.mjs ADDED
@@ -0,0 +1,3258 @@
1
+ // src/Button/PrimaryButton/PrimaryButton.tsx
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ function PrimaryButton({
4
+ title,
5
+ onClick,
6
+ iconLeft,
7
+ iconRight,
8
+ bgColor = "bg-primary-500",
9
+ textColor = "black",
10
+ disabled
11
+ }) {
12
+ return /* @__PURE__ */ jsx(
13
+ "button",
14
+ {
15
+ onClick,
16
+ disabled,
17
+ className: `flex justify-center w-full h-[42px] rounded-[6px] p-[10px] body-1 transition
18
+ ${disabled ? "text-gray-400 bg-gray-100 cursor-not-allowed" : `${bgColor} text-${textColor} cursor-pointer
19
+ hover:brightness-95 active:brightness-90`}`,
20
+ children: /* @__PURE__ */ jsxs("div", { className: "flex justify-center items-center gap-[10px]", children: [
21
+ iconLeft && /* @__PURE__ */ jsx("div", { children: iconLeft }),
22
+ title,
23
+ iconRight && /* @__PURE__ */ jsx("div", { children: iconRight })
24
+ ] })
25
+ }
26
+ );
27
+ }
28
+
29
+ // src/Button/SecondaryButton/SecondaryButton.tsx
30
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
31
+ function SecondaryButton({ title, onClick, iconLeft, iconRight, disabled }) {
32
+ return /* @__PURE__ */ jsx2(
33
+ "button",
34
+ {
35
+ onClick,
36
+ disabled,
37
+ className: `flex justify-center w-full h-[42px] rounded-[6px] p-[10px] border-[1px] body-1 transition ${disabled ? "text-gray-400 border-gray-400 bg-gray-100 cursor-not-allowed" : "cursor-pointer bg-white border-black text-black hover:bg-gray-100 active:bg-gray-200"}`,
38
+ children: /* @__PURE__ */ jsxs2("div", { className: "flex justify-center items-center gap-[10px]", children: [
39
+ iconLeft && /* @__PURE__ */ jsx2("div", { children: iconLeft }),
40
+ title,
41
+ iconRight && /* @__PURE__ */ jsx2("div", { children: iconRight })
42
+ ] })
43
+ }
44
+ );
45
+ }
46
+
47
+ // src/Button/GhostButton/GhostButton.tsx
48
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
49
+ function GhostButton({ title, onClick, iconLeft, iconRight, disabled }) {
50
+ return /* @__PURE__ */ jsx3(
51
+ "button",
52
+ {
53
+ onClick,
54
+ disabled,
55
+ className: `flex justify-center w-full h-[42px] rounded-[6px] p-[10px] body-1 transition
56
+ ${disabled ? "text-gray-400 bg-gray-100 cursor-not-allowed" : "bg-[#E9E9E9] cursor-pointer hover:bg-[#d6d6d6] active:bg-[#c4c4c4]"}`,
57
+ children: /* @__PURE__ */ jsxs3("div", { className: "flex justify-center items-center gap-[10px]", children: [
58
+ iconLeft && /* @__PURE__ */ jsx3("div", { children: iconLeft }),
59
+ title,
60
+ iconRight && /* @__PURE__ */ jsx3("div", { children: iconRight })
61
+ ] })
62
+ }
63
+ );
64
+ }
65
+
66
+ // src/Button/TabSelectionButton/TabSelectionButton.tsx
67
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
68
+ var TabSelectionButton = ({ title, now, onClickGoto }) => {
69
+ return /* @__PURE__ */ jsxs4("div", { className: "flex subtitle-2", children: [
70
+ title.map((text) => /* @__PURE__ */ jsx4(
71
+ "button",
72
+ {
73
+ onClick: () => onClickGoto(text.path),
74
+ className: `text-nowrap px-2 cursor-pointer ${now === text.path ? "border-b-primary-700 text-primary-700 border-b-2" : "border-b-gray-200 border-b-2"}`,
75
+ children: text.name
76
+ }
77
+ )),
78
+ /* @__PURE__ */ jsx4("div", { className: "border-b-gray-200 border-b-2 w-full" })
79
+ ] });
80
+ };
81
+
82
+ // src/Loader/Loader/Loader.tsx
83
+ import { jsx as jsx5 } from "react/jsx-runtime";
84
+ function Loader({ size = 25, color = "#000000" }) {
85
+ return /* @__PURE__ */ jsx5(
86
+ "div",
87
+ {
88
+ style: {
89
+ width: size,
90
+ height: size,
91
+ borderWidth: 4,
92
+ borderStyle: "solid",
93
+ borderColor: color,
94
+ borderTopColor: "transparent"
95
+ },
96
+ className: "rounded-full animate-spin"
97
+ }
98
+ );
99
+ }
100
+
101
+ // src/Checkbox/Checkbox/Checkbox.tsx
102
+ import { IconCheck } from "@tabler/icons-react";
103
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
104
+ function Checkbox({ label, checked, onChange, disabled }) {
105
+ const handleClick = () => {
106
+ if (!disabled) {
107
+ onChange(!checked);
108
+ }
109
+ };
110
+ return /* @__PURE__ */ jsxs5(
111
+ "div",
112
+ {
113
+ className: `flex gap-[10px] items-center
114
+ ${disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"}`,
115
+ "aria-disabled": disabled,
116
+ onClick: handleClick,
117
+ children: [
118
+ /* @__PURE__ */ jsx6(
119
+ "div",
120
+ {
121
+ className: `flex justify-center items-center border-[1px] border-black w-[24px] h-[24px] rounded-[8px] transition-colors duration-100
122
+ ${checked ? "bg-black text-white" : "bg-white text-black"}
123
+ ${disabled ? "pointer-events-none" : ""}`,
124
+ children: /* @__PURE__ */ jsx6(
125
+ "span",
126
+ {
127
+ className: `flex justify-center items-center transition-transform duration-150
128
+ ${checked ? "scale-100 opacity-100" : "scale-0 opacity-0"}`,
129
+ children: /* @__PURE__ */ jsx6(IconCheck, { size: 20 })
130
+ }
131
+ )
132
+ }
133
+ ),
134
+ label && /* @__PURE__ */ jsx6("p", { className: "body-1 select-none", children: label })
135
+ ]
136
+ }
137
+ );
138
+ }
139
+
140
+ // src/Checkbox/CheckboxGroup/CheckboxGroup.tsx
141
+ import { jsx as jsx7 } from "react/jsx-runtime";
142
+ function CheckboxGroup({ options, onChange, alignment = "vertical" }) {
143
+ return /* @__PURE__ */ jsx7("div", { className: `flex gap-4 ${alignment === "vertical" ? "flex-col" : ""}`, children: options.map((opt) => /* @__PURE__ */ jsx7(
144
+ Checkbox,
145
+ {
146
+ checked: opt.checked,
147
+ label: opt.label,
148
+ onChange: () => onChange(opt.label),
149
+ disabled: opt.disabled
150
+ },
151
+ opt.label
152
+ )) });
153
+ }
154
+
155
+ // src/Radio/Radio/Radio.tsx
156
+ import { jsx as jsx8 } from "react/jsx-runtime";
157
+ function Radio({ selected, onChange, disabled }) {
158
+ const handleClick = () => {
159
+ if (!disabled) {
160
+ onChange(!selected);
161
+ }
162
+ };
163
+ return /* @__PURE__ */ jsx8(
164
+ "div",
165
+ {
166
+ className: `
167
+ flex justify-center items-center w-[16px] h-[16px] border-[1px] border-black rounded-full
168
+ ${disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"}
169
+ `,
170
+ onClick: handleClick,
171
+ "aria-disabled": disabled,
172
+ children: selected && /* @__PURE__ */ jsx8("div", { className: `bg-black w-[10px] h-[10px] rounded-full transition-all duration-300` })
173
+ }
174
+ );
175
+ }
176
+
177
+ // src/Radio/RadioGroup/RadioGroup.tsx
178
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
179
+ function RadioGroup({ options, value, onChange, alignment = "horizontal" }) {
180
+ return /* @__PURE__ */ jsx9("div", { className: `flex gap-2 ${alignment === "vertical" ? "flex-col" : ""}`, children: options.map((opt) => /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2 cursor-pointer", children: [
181
+ /* @__PURE__ */ jsx9(Radio, { selected: value === opt.value, onChange: () => onChange(opt.value), disabled: opt.disabled }),
182
+ /* @__PURE__ */ jsx9("span", { className: `body-1 ${opt.disabled ? "text-gray-400 cursor-not-allowed" : ""}`, children: opt.label })
183
+ ] }, opt.value)) });
184
+ }
185
+
186
+ // src/Switch/Switch/Switch.tsx
187
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
188
+ function Switch({ label, checked, onChange, disabled }) {
189
+ const handleClick = () => {
190
+ if (!disabled) {
191
+ onChange(!checked);
192
+ }
193
+ };
194
+ return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-[10px]", children: [
195
+ label && /* @__PURE__ */ jsx10("p", { className: `body-1 ${disabled ? "opacity-50 select-none" : ""}`, children: label }),
196
+ /* @__PURE__ */ jsx10(
197
+ "button",
198
+ {
199
+ type: "button",
200
+ onClick: handleClick,
201
+ disabled,
202
+ "aria-disabled": disabled,
203
+ className: `
204
+ w-13 h-7 flex items-center rounded-full p-1 transition-colors duration-300
205
+ ${checked ? "bg-blue-500" : "bg-gray-300"}
206
+ ${disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"}
207
+ `,
208
+ children: /* @__PURE__ */ jsx10(
209
+ "div",
210
+ {
211
+ className: `bg-white w-5 h-5 rounded-full shadow-md transform transition-transform duration-300
212
+ ${checked ? "translate-x-6" : "translate-x-0"}`
213
+ }
214
+ )
215
+ }
216
+ )
217
+ ] });
218
+ }
219
+
220
+ // src/Switch/SwitchSelect/SwitchSelect.tsx
221
+ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
222
+ function SwitchSelect({
223
+ option,
224
+ onClick,
225
+ value,
226
+ label,
227
+ required,
228
+ color
229
+ }) {
230
+ return /* @__PURE__ */ jsxs8("div", { className: "flex flex-col container-input", children: [
231
+ label && /* @__PURE__ */ jsxs8("p", { className: `body-1`, children: [
232
+ label,
233
+ " ",
234
+ required && /* @__PURE__ */ jsx11("span", { className: "text-red-500", children: "*" })
235
+ ] }),
236
+ /* @__PURE__ */ jsx11("div", { className: "flex", children: option.map((item, index) => /* @__PURE__ */ jsx11(
237
+ "button",
238
+ {
239
+ onClick: () => onClick(item.value),
240
+ className: `
241
+ body-1 border-y-1 border-primary-500 cursor-pointer h-[32px] px-2
242
+ ${item.value === value ? `${color ? `bg-[${color}]` : `bg-primary-500`} text-white` : "bg-white text-primary-500"}
243
+ ${index === 0 ? "border-l-1 rounded-l-lg" : index === option.length - 1 ? "border-r-1 rounded-r-lg" : "border-x-1"}
244
+ `,
245
+ children: item.label
246
+ },
247
+ item.value
248
+ )) })
249
+ ] });
250
+ }
251
+
252
+ // src/NavBar/MenuNavBar/MenuNavBar.tsx
253
+ import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
254
+ function MenuNavBar({ menus, onClick }) {
255
+ return /* @__PURE__ */ jsx12("div", { className: "w-full h-full p-[10px] bg-white", children: menus?.map((menu, index) => /* @__PURE__ */ jsxs9("div", { className: `p-[10px] ${index !== 0 ? "mt-[10px]" : ""}`, children: [
256
+ /* @__PURE__ */ jsx12("p", { className: "p-[10px] w-[202px] h-[47px] subtitle-1", children: menu.title }),
257
+ menu?.subMenus.map((subMenu) => /* @__PURE__ */ jsxs9(
258
+ "div",
259
+ {
260
+ className: "group flex justify-center items-center gap-[10px] p-[10px] w-[202px] h-[47px] rounded-[6px] subtitle-2 cursor-pointer hover:bg-red-100 active:bg-primary-500 hover:text-white active:text-white",
261
+ onClick: () => onClick(subMenu.path),
262
+ children: [
263
+ /* @__PURE__ */ jsxs9("span", { className: "flex justify-center items-center w-[24px] h-[24px] text-[20px]", children: [
264
+ subMenu.icon && /* @__PURE__ */ jsx12("span", { className: `block ${subMenu.iconActive ? "group-active:hidden" : ""}`, children: subMenu.icon }),
265
+ subMenu.iconActive && /* @__PURE__ */ jsx12("span", { className: "hidden group-active:block", children: subMenu.iconActive })
266
+ ] }),
267
+ subMenu.title,
268
+ /* @__PURE__ */ jsx12("span", { className: "flex ml-auto", children: subMenu.customNode && subMenu.customNode })
269
+ ]
270
+ },
271
+ `sub_${subMenu.title}`
272
+ ))
273
+ ] }, `menu_${menu.title}`)) });
274
+ }
275
+
276
+ // src/NavBar/MenuNavBar/Sidebar.tsx
277
+ import { IconChevronLeftPipe, IconChevronRightPipe } from "@tabler/icons-react";
278
+ import { createContext, useContext, useState } from "react";
279
+ import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
280
+ var SidebarContext = createContext({ expanded: false });
281
+ function Sidebar({ children, logo }) {
282
+ const [expanded, setExpanded] = useState(true);
283
+ return /* @__PURE__ */ jsx13("aside", { className: "h-screen", children: /* @__PURE__ */ jsxs10("nav", { className: `h-full flex flex-col bg-white border-r shadow-sm duration-150 ${expanded ? "w-64" : "w-16"}`, children: [
284
+ /* @__PURE__ */ jsxs10("div", { className: "p-4 pb-2 flex justify-center items-center", children: [
285
+ expanded && logo && /* @__PURE__ */ jsx13("img", { src: logo, width: 120, className: "ml-auto" }),
286
+ /* @__PURE__ */ jsx13(
287
+ "button",
288
+ {
289
+ className: "p-1.5 rounded-lg bg-gray-50 hover:bg-gray-100 cursor-pointer ml-auto",
290
+ onClick: () => setExpanded((curr) => !curr),
291
+ children: expanded ? /* @__PURE__ */ jsx13(IconChevronLeftPipe, {}) : /* @__PURE__ */ jsx13(IconChevronRightPipe, {})
292
+ }
293
+ )
294
+ ] }),
295
+ /* @__PURE__ */ jsx13(SidebarContext.Provider, { value: { expanded }, children: /* @__PURE__ */ jsx13("ul", { className: "flex-1 px-3", children }) })
296
+ ] }) });
297
+ }
298
+
299
+ // src/NavBar/TopNavBar/TopNavBar.tsx
300
+ import { IconBellRinging } from "@tabler/icons-react";
301
+ import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
302
+ function TopNavBar({ onClickNoti, logo }) {
303
+ return /* @__PURE__ */ jsxs11("div", { className: "w-full h-full flex", children: [
304
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-[20px] p-[10px]", children: [
305
+ logo,
306
+ /* @__PURE__ */ jsx14("p", { className: "subtitle-1", children: "Project Management" })
307
+ ] }),
308
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center ml-auto gap-[20px] p-[10px]", children: [
309
+ /* @__PURE__ */ jsx14("div", { children: "Search" }),
310
+ /* @__PURE__ */ jsx14("div", { children: /* @__PURE__ */ jsx14(IconBellRinging, { onClick: onClickNoti, className: "cursor-pointer" }) }),
311
+ /* @__PURE__ */ jsx14("div", { className: "w-[40px] h-[40px] bg-gray-400 rounded-full cursor-pointer" })
312
+ ] })
313
+ ] });
314
+ }
315
+
316
+ // src/Table/DataTable/DataTable.tsx
317
+ import { IconSelector, IconSortAscending, IconSortDescending } from "@tabler/icons-react";
318
+ import { useState as useState2 } from "react";
319
+
320
+ // src/Table/Pagination/Pagination.tsx
321
+ import { IconArrowLeft, IconArrowRight } from "@tabler/icons-react";
322
+ import { useMemo } from "react";
323
+ import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
324
+ function Pagination({ totalItems, itemsPerPage, currentPage, onPageChange }) {
325
+ const totalPages = Math.ceil(totalItems / itemsPerPage);
326
+ const getPages = useMemo(() => {
327
+ if (totalPages <= 7) {
328
+ return Array.from({ length: totalPages }, (_, i) => i + 1);
329
+ }
330
+ const pages = [];
331
+ pages.push(1);
332
+ if (currentPage > 3) {
333
+ pages.push("...");
334
+ }
335
+ const start = Math.max(2, currentPage - 1);
336
+ const end = Math.min(totalPages - 1, currentPage + 1);
337
+ for (let i = start; i <= end; i++) {
338
+ pages.push(i);
339
+ }
340
+ if (currentPage < totalPages - 2) {
341
+ pages.push("...");
342
+ }
343
+ pages.push(totalPages);
344
+ return pages;
345
+ }, [totalPages, currentPage]);
346
+ if (totalPages <= 1) return null;
347
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-center gap-2 mt-4 body-1", children: [
348
+ /* @__PURE__ */ jsxs12(
349
+ "button",
350
+ {
351
+ className: "px-3 py-1 disabled:opacity-50 flex gap-[8px] cursor-pointer",
352
+ disabled: currentPage === 1,
353
+ onClick: () => onPageChange(currentPage - 1),
354
+ children: [
355
+ /* @__PURE__ */ jsx15(IconArrowLeft, {}),
356
+ "\u0E22\u0E49\u0E2D\u0E19\u0E01\u0E25\u0E31\u0E1A"
357
+ ]
358
+ }
359
+ ),
360
+ getPages.map(
361
+ (page, i) => typeof page === "string" ? /* @__PURE__ */ jsx15("span", { className: "px-2", children: page }, i) : /* @__PURE__ */ jsx15(
362
+ "button",
363
+ {
364
+ className: `w-[32px] h-[32px] rounded-[8px] px-3 py-1 cursor-pointer
365
+ ${currentPage === page ? "bg-black text-white" : "hover:bg-gray-100"}`,
366
+ onClick: () => onPageChange(page),
367
+ children: page
368
+ },
369
+ i
370
+ )
371
+ ),
372
+ /* @__PURE__ */ jsxs12(
373
+ "button",
374
+ {
375
+ className: "px-3 py-1 disabled:opacity-50 flex gap-[8px] cursor-pointer",
376
+ disabled: currentPage === totalPages,
377
+ onClick: () => onPageChange(currentPage + 1),
378
+ children: [
379
+ "\u0E16\u0E31\u0E14\u0E44\u0E1B",
380
+ /* @__PURE__ */ jsx15(IconArrowRight, {})
381
+ ]
382
+ }
383
+ )
384
+ ] });
385
+ }
386
+
387
+ // src/Table/DataTable/DataTable.tsx
388
+ import { Fragment, jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
389
+ function DataTable({ columns, data, onSort, isLoading }) {
390
+ const cols = Math.max(1, columns.length);
391
+ const gridClass = "grid [grid-template-columns:repeat(var(--cols),minmax(0,1fr))]";
392
+ const [sortConfig, setSortConfig] = useState2(null);
393
+ const [page, setPage] = useState2(1);
394
+ const onSorting = (config) => {
395
+ if (config) {
396
+ setSortConfig({ key: config?.key, direction: config?.direction });
397
+ onSort();
398
+ }
399
+ };
400
+ return /* @__PURE__ */ jsxs13("div", { className: "border rounded-md w-full h-full", children: [
401
+ /* @__PURE__ */ jsx16("div", { className: `${gridClass} font-semibold border-b border-gray-200`, style: { ["--cols"]: cols }, children: columns.map((col, i) => {
402
+ const isActive = sortConfig?.key === col.accessor;
403
+ const direction = isActive ? sortConfig?.direction : null;
404
+ return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-[8px] py-[8px] px-[16px] body-4 truncate", children: [
405
+ col.header,
406
+ col.sortable && /* @__PURE__ */ jsxs13(Fragment, { children: [
407
+ direction === null && /* @__PURE__ */ jsx16(
408
+ IconSelector,
409
+ {
410
+ size: 15,
411
+ className: "hover:text-red-400 cursor-pointer",
412
+ onClick: () => onSorting({ key: col.accessor, direction: "asc" })
413
+ }
414
+ ),
415
+ direction === "asc" && /* @__PURE__ */ jsx16(
416
+ IconSortAscending,
417
+ {
418
+ size: 15,
419
+ className: "cursor-pointer text-red-500",
420
+ onClick: () => onSorting({ key: col.accessor, direction: "desc" })
421
+ }
422
+ ),
423
+ direction === "desc" && /* @__PURE__ */ jsx16(
424
+ IconSortDescending,
425
+ {
426
+ size: 15,
427
+ className: "cursor-pointer text-red-500",
428
+ onClick: () => onSorting({ key: col.accessor, direction: null })
429
+ }
430
+ )
431
+ ] })
432
+ ] }, i);
433
+ }) }),
434
+ isLoading ? /* @__PURE__ */ jsx16("div", { className: "flex justify-center items-center w-full h-full", children: /* @__PURE__ */ jsx16(Loader, {}) }) : /* @__PURE__ */ jsx16(Fragment, { children: data.map((row, i) => /* @__PURE__ */ jsx16(
435
+ "div",
436
+ {
437
+ className: `${gridClass} ${data.length - 1 !== i ? "border-b border-gray-200" : ""} items-center`,
438
+ style: { ["--cols"]: cols },
439
+ children: columns.map((col, c) => /* @__PURE__ */ jsx16("div", { className: "py-[8px] px-[16px] body-3 truncate", children: typeof col.accessor === "function" ? col.accessor(row) : String(row[col.accessor]) }, c))
440
+ },
441
+ i
442
+ )) }),
443
+ /* @__PURE__ */ jsx16("div", { children: /* @__PURE__ */ jsx16(Pagination, { currentPage: page, itemsPerPage: 5, totalItems: 10, onPageChange: setPage }) })
444
+ ] });
445
+ }
446
+
447
+ // src/Table/DataTable/AntDataTable.tsx
448
+ import { ConfigProvider, Table } from "antd";
449
+ import { useState as useState3 } from "react";
450
+ import { Fragment as Fragment2, jsx as jsx17 } from "react/jsx-runtime";
451
+ function AntDataTable({
452
+ dataSource,
453
+ columns,
454
+ pageSize = 10,
455
+ rowCheckbox,
456
+ onRowSelect,
457
+ // onFilteredDataChange,
458
+ onFilter,
459
+ onChange,
460
+ width,
461
+ height,
462
+ pagination
463
+ }) {
464
+ const [selectedRowKeys, setSelectedRowKeys] = useState3([]);
465
+ const rowSelection = {
466
+ selectedRowKeys,
467
+ onChange: (newSelectedRowKeys) => {
468
+ setSelectedRowKeys(newSelectedRowKeys);
469
+ onRowSelect && onRowSelect(newSelectedRowKeys);
470
+ }
471
+ };
472
+ const handleChange = (paginationArgs, filters, sorter, extra) => {
473
+ onChange?.(paginationArgs, filters, sorter, extra);
474
+ onFilter(filters);
475
+ };
476
+ return /* @__PURE__ */ jsx17(Fragment2, { children: /* @__PURE__ */ jsx17(
477
+ ConfigProvider,
478
+ {
479
+ theme: {
480
+ components: {},
481
+ token: {
482
+ fontFamily: "Kanit",
483
+ fontSize: 14
484
+ }
485
+ },
486
+ children: /* @__PURE__ */ jsx17(
487
+ Table,
488
+ {
489
+ dataSource,
490
+ columns,
491
+ rowSelection: rowCheckbox ? rowSelection : void 0,
492
+ onChange: handleChange,
493
+ pagination: pagination ? { position: ["bottomCenter"], pageSize } : false,
494
+ style: { width },
495
+ scroll: { y: height }
496
+ }
497
+ )
498
+ }
499
+ ) });
500
+ }
501
+
502
+ // src/Calendar/Calendar/Calendar.tsx
503
+ import { useEffect, useRef, useState as useState4 } from "react";
504
+ import FullCalendar from "@fullcalendar/react";
505
+ import dayGridPlugin from "@fullcalendar/daygrid";
506
+ import timeGridPlugin from "@fullcalendar/timegrid";
507
+ import interactionPlugin from "@fullcalendar/interaction";
508
+ import thLocale from "@fullcalendar/core/locales/th";
509
+ import { IconChevronLeft, IconChevronRight, IconX } from "@tabler/icons-react";
510
+ import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
511
+ function Calendar({ events }) {
512
+ const calendarRef = useRef(null);
513
+ const [monthTitle, setMonthTitle] = useState4("");
514
+ const [openPopup, setOpenPopup] = useState4(false);
515
+ const [selectedEvent, setSelectedEvent] = useState4(null);
516
+ const updateTitle = () => {
517
+ const calendarApi = calendarRef.current?.getApi();
518
+ if (calendarApi) {
519
+ setMonthTitle(calendarApi.view.title);
520
+ }
521
+ };
522
+ const changeView = (viewName) => {
523
+ const calendarApi = calendarRef.current?.getApi();
524
+ calendarApi?.changeView(viewName);
525
+ };
526
+ useEffect(() => {
527
+ updateTitle();
528
+ }, []);
529
+ return /* @__PURE__ */ jsxs14("div", { className: "fc w-full h-full relative z-10", children: [
530
+ /* @__PURE__ */ jsxs14("div", { className: "flex mb-[8px]", children: [
531
+ /* @__PURE__ */ jsx18("p", { className: "headline-5", children: monthTitle }),
532
+ /* @__PURE__ */ jsxs14("div", { className: "flex gap-[10px] ml-auto", children: [
533
+ /* @__PURE__ */ jsx18(
534
+ "p",
535
+ {
536
+ className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
537
+ onClick: () => {
538
+ calendarRef.current.getApi().today();
539
+ updateTitle();
540
+ },
541
+ children: "\u0E27\u0E31\u0E19\u0E19\u0E35\u0E49"
542
+ }
543
+ ),
544
+ /* @__PURE__ */ jsx18(
545
+ "p",
546
+ {
547
+ className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
548
+ onClick: () => {
549
+ changeView("dayGridMonth");
550
+ updateTitle();
551
+ },
552
+ children: "Month"
553
+ }
554
+ ),
555
+ /* @__PURE__ */ jsx18(
556
+ "p",
557
+ {
558
+ className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
559
+ onClick: () => {
560
+ changeView("timeGridWeek");
561
+ updateTitle();
562
+ },
563
+ children: "Week"
564
+ }
565
+ ),
566
+ /* @__PURE__ */ jsx18(
567
+ "p",
568
+ {
569
+ className: "w-[80px] h-[35px] border-[1px] flex justify-center items-center rounded-[2px] body-3 cursor-pointer",
570
+ onClick: () => {
571
+ changeView("timeGridDay");
572
+ updateTitle();
573
+ },
574
+ children: "Day"
575
+ }
576
+ ),
577
+ /* @__PURE__ */ jsx18(
578
+ "button",
579
+ {
580
+ className: "cursor-pointer",
581
+ onClick: () => {
582
+ calendarRef.current?.getApi().prev();
583
+ updateTitle();
584
+ },
585
+ children: /* @__PURE__ */ jsx18(IconChevronLeft, {})
586
+ }
587
+ ),
588
+ /* @__PURE__ */ jsx18(
589
+ "button",
590
+ {
591
+ className: "cursor-pointer",
592
+ onClick: () => {
593
+ calendarRef.current?.getApi().next();
594
+ updateTitle();
595
+ },
596
+ children: /* @__PURE__ */ jsx18(IconChevronRight, {})
597
+ }
598
+ )
599
+ ] })
600
+ ] }),
601
+ /* @__PURE__ */ jsx18("div", { className: "relative z-10", children: /* @__PURE__ */ jsx18(
602
+ FullCalendar,
603
+ {
604
+ ref: calendarRef,
605
+ plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin],
606
+ events,
607
+ locale: thLocale,
608
+ slotLabelFormat: {
609
+ hour: "numeric",
610
+ minute: "2-digit"
611
+ },
612
+ firstDay: 0,
613
+ fixedWeekCount: false,
614
+ headerToolbar: false,
615
+ initialView: "dayGridMonth",
616
+ dayMaxEventRows: 4,
617
+ editable: true,
618
+ eventDrop: (info) => {
619
+ console.log("Event \u0E02\u0E2D\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48:", info.event.startStr);
620
+ },
621
+ eventClick: (info) => {
622
+ setOpenPopup(true);
623
+ setSelectedEvent({
624
+ title: info.event.title,
625
+ start: info.event._instance?.range.start.toISOString(),
626
+ end: info.event._instance?.range.end.toISOString()
627
+ });
628
+ },
629
+ eventContent: (arg) => {
630
+ return /* @__PURE__ */ jsx18(Fragment3, { children: /* @__PURE__ */ jsx18("div", { className: "flex items-center h-[28px] p-[4px] border-green-500 border-l-[10px] bg-red-400 rounded text-left text-white caption-1", children: arg.event.title }) });
631
+ },
632
+ moreLinkContent: (arg) => `+${arg.num} \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23`
633
+ }
634
+ ) }),
635
+ openPopup && /* @__PURE__ */ jsx18("div", { className: "fixed inset-0 flex justify-center items-center bg-black/50 z-50", children: /* @__PURE__ */ jsx18(EventPopUp, { event: selectedEvent, onClose: () => setOpenPopup(false) }) })
636
+ ] });
637
+ }
638
+ function EventPopUp({ event, onClose }) {
639
+ return /* @__PURE__ */ jsxs14("div", { className: "w-[500px] h-auto rounded-2xl bg-white relative z-50 shadow-2xl overflow-hidden", children: [
640
+ /* @__PURE__ */ jsx18("button", { className: "absolute top-3 right-3 rounded-full p-1 hover:bg-gray-200 transition", onClick: onClose, children: /* @__PURE__ */ jsx18(IconX, { className: "w-6 h-6 text-gray-600" }) }),
641
+ /* @__PURE__ */ jsx18("div", { className: "bg-red-400 text-left text-white px-6 py-4 headline-5", children: /* @__PURE__ */ jsx18("h2", { className: "text-lg font-semibold", children: event.title }) }),
642
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-col w-full p-6 gap-3 text-gray-700 body-3", children: [
643
+ /* @__PURE__ */ jsxs14("p", { children: [
644
+ /* @__PURE__ */ jsx18("span", { className: "font-medium", children: "\u0E40\u0E23\u0E34\u0E48\u0E21: " }),
645
+ event?.start?.toLocaleString?.() || String(event?.start)
646
+ ] }),
647
+ /* @__PURE__ */ jsxs14("p", { children: [
648
+ /* @__PURE__ */ jsx18("span", { className: "font-medium", children: "\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14: " }),
649
+ event?.end?.toLocaleString?.() || String(event?.end)
650
+ ] }),
651
+ /* @__PURE__ */ jsx18("h3", { className: "text-sm font-semibold text-gray-500 uppercase mb-2 hover:underline cursor-pointer", children: "\u0E23\u0E32\u0E22\u0E25\u0E30\u0E40\u0E2D\u0E35\u0E22\u0E14\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E15\u0E34\u0E21" })
652
+ ] })
653
+ ] });
654
+ }
655
+
656
+ // src/Input/TextInput/TextInput.tsx
657
+ import { IconEye, IconEyeOff } from "@tabler/icons-react";
658
+ import { useState as useState5 } from "react";
659
+ import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
660
+ function TextInput({
661
+ label,
662
+ placeholder,
663
+ type = "text",
664
+ maxLength,
665
+ required,
666
+ error,
667
+ value,
668
+ onChange,
669
+ disabled
670
+ }) {
671
+ const [showPassword, setShowPassword] = useState5(false);
672
+ const onShowPassword = () => {
673
+ setShowPassword(!showPassword);
674
+ };
675
+ const inputType = type === "password" ? showPassword ? "text" : "password" : "text";
676
+ return /* @__PURE__ */ jsxs15("div", { children: [
677
+ label && /* @__PURE__ */ jsxs15("p", { className: "body-1 mb-[8px]", children: [
678
+ label,
679
+ required && /* @__PURE__ */ jsx19("span", { className: "text-red-500", children: "\xA0*" })
680
+ ] }),
681
+ /* @__PURE__ */ jsxs15(
682
+ "div",
683
+ {
684
+ className: `border-[1px] rounded-[8px] w-full h-[40px] flex justify-center items-center
685
+ ${disabled ? "bg-gray-100 text-gray-400" : error ? "border-red-500" : ""}`,
686
+ children: [
687
+ /* @__PURE__ */ jsx19(
688
+ "input",
689
+ {
690
+ className: `w-full h-full px-[16px] ${disabled ? "cursor-not-allowed" : ""}`,
691
+ style: { outline: "none" },
692
+ placeholder,
693
+ type: inputType,
694
+ maxLength,
695
+ value,
696
+ onChange: (e) => onChange(e.target.value),
697
+ disabled
698
+ }
699
+ ),
700
+ type === "password" && (showPassword ? /* @__PURE__ */ jsx19(IconEye, { className: "text-gray-600 mr-[8px] cursor-pointer", onClick: onShowPassword }) : /* @__PURE__ */ jsx19(IconEyeOff, { className: "text-gray-600 mr-[8px] cursor-pointer", onClick: onShowPassword }))
701
+ ]
702
+ }
703
+ ),
704
+ error && /* @__PURE__ */ jsx19("p", { className: "text-red-500 body-1", children: error })
705
+ ] });
706
+ }
707
+
708
+ // src/Input/TextArea/TextArea.tsx
709
+ import { ConfigProvider as ConfigProvider2, Input } from "antd";
710
+ import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
711
+ var { TextArea } = Input;
712
+ function TextAreaInput({
713
+ label,
714
+ height = 4,
715
+ placeholder,
716
+ onChange,
717
+ value,
718
+ maxLength,
719
+ resizable,
720
+ showCount,
721
+ required,
722
+ error,
723
+ disabled
724
+ }) {
725
+ return /* @__PURE__ */ jsx20(Fragment4, { children: /* @__PURE__ */ jsx20(
726
+ ConfigProvider2,
727
+ {
728
+ theme: {
729
+ components: {},
730
+ token: {
731
+ fontFamily: "Kanit",
732
+ fontSize: 16
733
+ }
734
+ },
735
+ children: /* @__PURE__ */ jsxs16("div", { children: [
736
+ label && /* @__PURE__ */ jsxs16("p", { className: "body-1 mb-[8px]", children: [
737
+ label,
738
+ " ",
739
+ required && /* @__PURE__ */ jsx20("span", { className: "text-red-500", children: "\xA0*" })
740
+ ] }),
741
+ /* @__PURE__ */ jsx20(
742
+ TextArea,
743
+ {
744
+ value,
745
+ rows: height,
746
+ style: {
747
+ ...error && resizable ? { borderColor: "red" } : {},
748
+ ...disabled || !resizable ? { resize: "none" } : {}
749
+ },
750
+ placeholder,
751
+ maxLength,
752
+ showCount,
753
+ onChange: (e) => onChange(e.target.value),
754
+ disabled
755
+ }
756
+ ),
757
+ error && /* @__PURE__ */ jsx20("p", { className: "text-red-500 body-1", children: error })
758
+ ] })
759
+ }
760
+ ) });
761
+ }
762
+
763
+ // src/Input/InputField/InputField.tsx
764
+ import { ConfigProvider as ConfigProvider3, Input as Input2, Space } from "antd";
765
+ import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
766
+ function InputField({
767
+ value,
768
+ onChange,
769
+ placeholder = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
770
+ label,
771
+ required,
772
+ disabled,
773
+ error,
774
+ addonBefore,
775
+ addonAfter,
776
+ defaultValue,
777
+ className,
778
+ onClear,
779
+ statickey
780
+ }) {
781
+ return /* @__PURE__ */ jsx21(
782
+ ConfigProvider3,
783
+ {
784
+ theme: {
785
+ token: {
786
+ fontFamily: "Kanit"
787
+ }
788
+ },
789
+ children: /* @__PURE__ */ jsxs17("div", { className: "container-input", children: [
790
+ /* @__PURE__ */ jsxs17("div", { children: [
791
+ /* @__PURE__ */ jsx21("span", { className: "body-1", children: label }),
792
+ " ",
793
+ required && /* @__PURE__ */ jsx21("span", { className: "text-red-500", children: "*" })
794
+ ] }),
795
+ /* @__PURE__ */ jsxs17(Space.Compact, { children: [
796
+ statickey && /* @__PURE__ */ jsx21("span", { className: "items-center flex px-2 bg-gray-300 rounded-l-md body-1", children: statickey }),
797
+ /* @__PURE__ */ jsx21(
798
+ Input2,
799
+ {
800
+ value,
801
+ placeholder,
802
+ disabled,
803
+ className: `body-1 w-full ${className ?? ""}`,
804
+ onChange: (e) => onChange(e.target.value || void 0),
805
+ allowClear: true,
806
+ addonBefore,
807
+ addonAfter,
808
+ defaultValue,
809
+ onClear
810
+ }
811
+ )
812
+ ] }),
813
+ error && /* @__PURE__ */ jsx21("p", { className: "text-red-500 caption-1", children: error })
814
+ ] })
815
+ }
816
+ );
817
+ }
818
+
819
+ // src/Input/InputFieldNumber/InputFieldNumber.tsx
820
+ import { ConfigProvider as ConfigProvider4, InputNumber } from "antd";
821
+ import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
822
+ function InputFieldNumber({
823
+ value,
824
+ onChange,
825
+ placeholder = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
826
+ label,
827
+ required,
828
+ disabled,
829
+ error,
830
+ addonBefore,
831
+ addonAfter,
832
+ defaultValue,
833
+ className,
834
+ max,
835
+ min,
836
+ controls,
837
+ size,
838
+ changeOnWheel,
839
+ formatter,
840
+ parser
841
+ }) {
842
+ return /* @__PURE__ */ jsx22(
843
+ ConfigProvider4,
844
+ {
845
+ theme: {
846
+ token: {
847
+ fontFamily: "Kanit"
848
+ }
849
+ },
850
+ children: /* @__PURE__ */ jsxs18("div", { className: "container-input", children: [
851
+ /* @__PURE__ */ jsxs18("div", { children: [
852
+ /* @__PURE__ */ jsx22("span", { className: "body-1", children: label }),
853
+ " ",
854
+ required && /* @__PURE__ */ jsx22("span", { className: "text-red-500", children: "*" })
855
+ ] }),
856
+ /* @__PURE__ */ jsx22(
857
+ InputNumber,
858
+ {
859
+ value: value ?? void 0,
860
+ onChange: (val) => onChange(val),
861
+ placeholder,
862
+ disabled,
863
+ className: `body-1 !w-full ${className ?? ""}`,
864
+ addonBefore,
865
+ addonAfter,
866
+ defaultValue,
867
+ max,
868
+ min,
869
+ controls,
870
+ size,
871
+ changeOnWheel,
872
+ formatter,
873
+ parser
874
+ }
875
+ ),
876
+ error && /* @__PURE__ */ jsx22("p", { className: "text-red-500 caption-1", children: error })
877
+ ] })
878
+ }
879
+ );
880
+ }
881
+
882
+ // src/ColorPicker/ColorPickerBasic/ColorPicker.tsx
883
+ import { ConfigProvider as ConfigProvider5, ColorPicker } from "antd";
884
+ import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
885
+ function ColorPickerBasic({
886
+ value,
887
+ onChange,
888
+ required,
889
+ label,
890
+ error,
891
+ disabled,
892
+ allowClear,
893
+ defaultFormat,
894
+ className,
895
+ placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2A\u0E35"
896
+ }) {
897
+ return /* @__PURE__ */ jsx23(
898
+ ConfigProvider5,
899
+ {
900
+ theme: {
901
+ token: {
902
+ fontFamily: "Kanit",
903
+ fontSize: 16
904
+ }
905
+ },
906
+ children: /* @__PURE__ */ jsxs19("div", { className: "container-input", children: [
907
+ /* @__PURE__ */ jsxs19("div", { children: [
908
+ /* @__PURE__ */ jsx23("span", { className: "body-1", children: label }),
909
+ " ",
910
+ required && /* @__PURE__ */ jsx23("span", { className: "text-red-500", children: "*" })
911
+ ] }),
912
+ /* @__PURE__ */ jsx23(
913
+ ColorPicker,
914
+ {
915
+ defaultFormat,
916
+ className: `body-1 w-full ${className ?? ""}`,
917
+ value,
918
+ defaultValue: "#ffff",
919
+ onChange,
920
+ allowClear,
921
+ showText: (color) => {
922
+ const hex = color.toHexString();
923
+ if (!value) {
924
+ return /* @__PURE__ */ jsx23("span", { children: placeholder });
925
+ }
926
+ return /* @__PURE__ */ jsxs19("span", { children: [
927
+ "(",
928
+ hex,
929
+ ")"
930
+ ] });
931
+ },
932
+ disabled
933
+ }
934
+ ),
935
+ error && /* @__PURE__ */ jsx23("p", { className: "text-red-500 caption-1", children: error })
936
+ ] })
937
+ }
938
+ );
939
+ }
940
+
941
+ // src/ColorPicker/ColorPalettePickerBasic/ColorPalettePickerBasic.tsx
942
+ import { ConfigProvider as ConfigProvider6, ColorPicker as ColorPicker2, theme } from "antd";
943
+
944
+ // node_modules/@babel/runtime/helpers/esm/typeof.js
945
+ function _typeof(o) {
946
+ "@babel/helpers - typeof";
947
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
948
+ return typeof o2;
949
+ } : function(o2) {
950
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
951
+ }, _typeof(o);
952
+ }
953
+
954
+ // node_modules/@babel/runtime/helpers/esm/toPrimitive.js
955
+ function toPrimitive(t, r) {
956
+ if ("object" != _typeof(t) || !t) return t;
957
+ var e = t[Symbol.toPrimitive];
958
+ if (void 0 !== e) {
959
+ var i = e.call(t, r || "default");
960
+ if ("object" != _typeof(i)) return i;
961
+ throw new TypeError("@@toPrimitive must return a primitive value.");
962
+ }
963
+ return ("string" === r ? String : Number)(t);
964
+ }
965
+
966
+ // node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
967
+ function toPropertyKey(t) {
968
+ var i = toPrimitive(t, "string");
969
+ return "symbol" == _typeof(i) ? i : i + "";
970
+ }
971
+
972
+ // node_modules/@babel/runtime/helpers/esm/defineProperty.js
973
+ function _defineProperty(e, r, t) {
974
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
975
+ value: t,
976
+ enumerable: true,
977
+ configurable: true,
978
+ writable: true
979
+ }) : e[r] = t, e;
980
+ }
981
+
982
+ // node_modules/@ant-design/fast-color/es/FastColor.js
983
+ var round = Math.round;
984
+ function splitColorStr(str, parseNum) {
985
+ const match = str.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [];
986
+ const numList = match.map((item) => parseFloat(item));
987
+ for (let i = 0; i < 3; i += 1) {
988
+ numList[i] = parseNum(numList[i] || 0, match[i] || "", i);
989
+ }
990
+ if (match[3]) {
991
+ numList[3] = match[3].includes("%") ? numList[3] / 100 : numList[3];
992
+ } else {
993
+ numList[3] = 1;
994
+ }
995
+ return numList;
996
+ }
997
+ var parseHSVorHSL = (num, _, index) => index === 0 ? num : num / 100;
998
+ function limitRange(value, max) {
999
+ const mergedMax = max || 255;
1000
+ if (value > mergedMax) {
1001
+ return mergedMax;
1002
+ }
1003
+ if (value < 0) {
1004
+ return 0;
1005
+ }
1006
+ return value;
1007
+ }
1008
+ var FastColor = class _FastColor {
1009
+ constructor(input) {
1010
+ _defineProperty(this, "isValid", true);
1011
+ _defineProperty(this, "r", 0);
1012
+ _defineProperty(this, "g", 0);
1013
+ _defineProperty(this, "b", 0);
1014
+ _defineProperty(this, "a", 1);
1015
+ _defineProperty(this, "_h", void 0);
1016
+ _defineProperty(this, "_s", void 0);
1017
+ _defineProperty(this, "_l", void 0);
1018
+ _defineProperty(this, "_v", void 0);
1019
+ _defineProperty(this, "_max", void 0);
1020
+ _defineProperty(this, "_min", void 0);
1021
+ _defineProperty(this, "_brightness", void 0);
1022
+ function matchFormat(str) {
1023
+ return str[0] in input && str[1] in input && str[2] in input;
1024
+ }
1025
+ if (!input) {
1026
+ } else if (typeof input === "string") {
1027
+ let matchPrefix2 = function(prefix) {
1028
+ return trimStr.startsWith(prefix);
1029
+ };
1030
+ var matchPrefix = matchPrefix2;
1031
+ const trimStr = input.trim();
1032
+ if (/^#?[A-F\d]{3,8}$/i.test(trimStr)) {
1033
+ this.fromHexString(trimStr);
1034
+ } else if (matchPrefix2("rgb")) {
1035
+ this.fromRgbString(trimStr);
1036
+ } else if (matchPrefix2("hsl")) {
1037
+ this.fromHslString(trimStr);
1038
+ } else if (matchPrefix2("hsv") || matchPrefix2("hsb")) {
1039
+ this.fromHsvString(trimStr);
1040
+ }
1041
+ } else if (input instanceof _FastColor) {
1042
+ this.r = input.r;
1043
+ this.g = input.g;
1044
+ this.b = input.b;
1045
+ this.a = input.a;
1046
+ this._h = input._h;
1047
+ this._s = input._s;
1048
+ this._l = input._l;
1049
+ this._v = input._v;
1050
+ } else if (matchFormat("rgb")) {
1051
+ this.r = limitRange(input.r);
1052
+ this.g = limitRange(input.g);
1053
+ this.b = limitRange(input.b);
1054
+ this.a = typeof input.a === "number" ? limitRange(input.a, 1) : 1;
1055
+ } else if (matchFormat("hsl")) {
1056
+ this.fromHsl(input);
1057
+ } else if (matchFormat("hsv")) {
1058
+ this.fromHsv(input);
1059
+ } else {
1060
+ throw new Error("@ant-design/fast-color: unsupported input " + JSON.stringify(input));
1061
+ }
1062
+ }
1063
+ // ======================= Setter =======================
1064
+ setR(value) {
1065
+ return this._sc("r", value);
1066
+ }
1067
+ setG(value) {
1068
+ return this._sc("g", value);
1069
+ }
1070
+ setB(value) {
1071
+ return this._sc("b", value);
1072
+ }
1073
+ setA(value) {
1074
+ return this._sc("a", value, 1);
1075
+ }
1076
+ setHue(value) {
1077
+ const hsv = this.toHsv();
1078
+ hsv.h = value;
1079
+ return this._c(hsv);
1080
+ }
1081
+ // ======================= Getter =======================
1082
+ /**
1083
+ * Returns the perceived luminance of a color, from 0-1.
1084
+ * @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
1085
+ */
1086
+ getLuminance() {
1087
+ function adjustGamma(raw) {
1088
+ const val = raw / 255;
1089
+ return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
1090
+ }
1091
+ const R = adjustGamma(this.r);
1092
+ const G = adjustGamma(this.g);
1093
+ const B = adjustGamma(this.b);
1094
+ return 0.2126 * R + 0.7152 * G + 0.0722 * B;
1095
+ }
1096
+ getHue() {
1097
+ if (typeof this._h === "undefined") {
1098
+ const delta = this.getMax() - this.getMin();
1099
+ if (delta === 0) {
1100
+ this._h = 0;
1101
+ } else {
1102
+ this._h = round(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
1103
+ }
1104
+ }
1105
+ return this._h;
1106
+ }
1107
+ getSaturation() {
1108
+ if (typeof this._s === "undefined") {
1109
+ const delta = this.getMax() - this.getMin();
1110
+ if (delta === 0) {
1111
+ this._s = 0;
1112
+ } else {
1113
+ this._s = delta / this.getMax();
1114
+ }
1115
+ }
1116
+ return this._s;
1117
+ }
1118
+ getLightness() {
1119
+ if (typeof this._l === "undefined") {
1120
+ this._l = (this.getMax() + this.getMin()) / 510;
1121
+ }
1122
+ return this._l;
1123
+ }
1124
+ getValue() {
1125
+ if (typeof this._v === "undefined") {
1126
+ this._v = this.getMax() / 255;
1127
+ }
1128
+ return this._v;
1129
+ }
1130
+ /**
1131
+ * Returns the perceived brightness of the color, from 0-255.
1132
+ * Note: this is not the b of HSB
1133
+ * @see http://www.w3.org/TR/AERT#color-contrast
1134
+ */
1135
+ getBrightness() {
1136
+ if (typeof this._brightness === "undefined") {
1137
+ this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1e3;
1138
+ }
1139
+ return this._brightness;
1140
+ }
1141
+ // ======================== Func ========================
1142
+ darken(amount = 10) {
1143
+ const h = this.getHue();
1144
+ const s = this.getSaturation();
1145
+ let l = this.getLightness() - amount / 100;
1146
+ if (l < 0) {
1147
+ l = 0;
1148
+ }
1149
+ return this._c({
1150
+ h,
1151
+ s,
1152
+ l,
1153
+ a: this.a
1154
+ });
1155
+ }
1156
+ lighten(amount = 10) {
1157
+ const h = this.getHue();
1158
+ const s = this.getSaturation();
1159
+ let l = this.getLightness() + amount / 100;
1160
+ if (l > 1) {
1161
+ l = 1;
1162
+ }
1163
+ return this._c({
1164
+ h,
1165
+ s,
1166
+ l,
1167
+ a: this.a
1168
+ });
1169
+ }
1170
+ /**
1171
+ * Mix the current color a given amount with another color, from 0 to 100.
1172
+ * 0 means no mixing (return current color).
1173
+ */
1174
+ mix(input, amount = 50) {
1175
+ const color = this._c(input);
1176
+ const p = amount / 100;
1177
+ const calc = (key) => (color[key] - this[key]) * p + this[key];
1178
+ const rgba = {
1179
+ r: round(calc("r")),
1180
+ g: round(calc("g")),
1181
+ b: round(calc("b")),
1182
+ a: round(calc("a") * 100) / 100
1183
+ };
1184
+ return this._c(rgba);
1185
+ }
1186
+ /**
1187
+ * Mix the color with pure white, from 0 to 100.
1188
+ * Providing 0 will do nothing, providing 100 will always return white.
1189
+ */
1190
+ tint(amount = 10) {
1191
+ return this.mix({
1192
+ r: 255,
1193
+ g: 255,
1194
+ b: 255,
1195
+ a: 1
1196
+ }, amount);
1197
+ }
1198
+ /**
1199
+ * Mix the color with pure black, from 0 to 100.
1200
+ * Providing 0 will do nothing, providing 100 will always return black.
1201
+ */
1202
+ shade(amount = 10) {
1203
+ return this.mix({
1204
+ r: 0,
1205
+ g: 0,
1206
+ b: 0,
1207
+ a: 1
1208
+ }, amount);
1209
+ }
1210
+ onBackground(background) {
1211
+ const bg = this._c(background);
1212
+ const alpha = this.a + bg.a * (1 - this.a);
1213
+ const calc = (key) => {
1214
+ return round((this[key] * this.a + bg[key] * bg.a * (1 - this.a)) / alpha);
1215
+ };
1216
+ return this._c({
1217
+ r: calc("r"),
1218
+ g: calc("g"),
1219
+ b: calc("b"),
1220
+ a: alpha
1221
+ });
1222
+ }
1223
+ // ======================= Status =======================
1224
+ isDark() {
1225
+ return this.getBrightness() < 128;
1226
+ }
1227
+ isLight() {
1228
+ return this.getBrightness() >= 128;
1229
+ }
1230
+ // ======================== MISC ========================
1231
+ equals(other) {
1232
+ return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
1233
+ }
1234
+ clone() {
1235
+ return this._c(this);
1236
+ }
1237
+ // ======================= Format =======================
1238
+ toHexString() {
1239
+ let hex = "#";
1240
+ const rHex = (this.r || 0).toString(16);
1241
+ hex += rHex.length === 2 ? rHex : "0" + rHex;
1242
+ const gHex = (this.g || 0).toString(16);
1243
+ hex += gHex.length === 2 ? gHex : "0" + gHex;
1244
+ const bHex = (this.b || 0).toString(16);
1245
+ hex += bHex.length === 2 ? bHex : "0" + bHex;
1246
+ if (typeof this.a === "number" && this.a >= 0 && this.a < 1) {
1247
+ const aHex = round(this.a * 255).toString(16);
1248
+ hex += aHex.length === 2 ? aHex : "0" + aHex;
1249
+ }
1250
+ return hex;
1251
+ }
1252
+ /** CSS support color pattern */
1253
+ toHsl() {
1254
+ return {
1255
+ h: this.getHue(),
1256
+ s: this.getSaturation(),
1257
+ l: this.getLightness(),
1258
+ a: this.a
1259
+ };
1260
+ }
1261
+ /** CSS support color pattern */
1262
+ toHslString() {
1263
+ const h = this.getHue();
1264
+ const s = round(this.getSaturation() * 100);
1265
+ const l = round(this.getLightness() * 100);
1266
+ return this.a !== 1 ? `hsla(${h},${s}%,${l}%,${this.a})` : `hsl(${h},${s}%,${l}%)`;
1267
+ }
1268
+ /** Same as toHsb */
1269
+ toHsv() {
1270
+ return {
1271
+ h: this.getHue(),
1272
+ s: this.getSaturation(),
1273
+ v: this.getValue(),
1274
+ a: this.a
1275
+ };
1276
+ }
1277
+ toRgb() {
1278
+ return {
1279
+ r: this.r,
1280
+ g: this.g,
1281
+ b: this.b,
1282
+ a: this.a
1283
+ };
1284
+ }
1285
+ toRgbString() {
1286
+ return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
1287
+ }
1288
+ toString() {
1289
+ return this.toRgbString();
1290
+ }
1291
+ // ====================== Privates ======================
1292
+ /** Return a new FastColor object with one channel changed */
1293
+ _sc(rgb, value, max) {
1294
+ const clone = this.clone();
1295
+ clone[rgb] = limitRange(value, max);
1296
+ return clone;
1297
+ }
1298
+ _c(input) {
1299
+ return new this.constructor(input);
1300
+ }
1301
+ getMax() {
1302
+ if (typeof this._max === "undefined") {
1303
+ this._max = Math.max(this.r, this.g, this.b);
1304
+ }
1305
+ return this._max;
1306
+ }
1307
+ getMin() {
1308
+ if (typeof this._min === "undefined") {
1309
+ this._min = Math.min(this.r, this.g, this.b);
1310
+ }
1311
+ return this._min;
1312
+ }
1313
+ fromHexString(trimStr) {
1314
+ const withoutPrefix = trimStr.replace("#", "");
1315
+ function connectNum(index1, index2) {
1316
+ return parseInt(withoutPrefix[index1] + withoutPrefix[index2 || index1], 16);
1317
+ }
1318
+ if (withoutPrefix.length < 6) {
1319
+ this.r = connectNum(0);
1320
+ this.g = connectNum(1);
1321
+ this.b = connectNum(2);
1322
+ this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1;
1323
+ } else {
1324
+ this.r = connectNum(0, 1);
1325
+ this.g = connectNum(2, 3);
1326
+ this.b = connectNum(4, 5);
1327
+ this.a = withoutPrefix[6] ? connectNum(6, 7) / 255 : 1;
1328
+ }
1329
+ }
1330
+ fromHsl({
1331
+ h,
1332
+ s,
1333
+ l,
1334
+ a
1335
+ }) {
1336
+ this._h = h % 360;
1337
+ this._s = s;
1338
+ this._l = l;
1339
+ this.a = typeof a === "number" ? a : 1;
1340
+ if (s <= 0) {
1341
+ const rgb = round(l * 255);
1342
+ this.r = rgb;
1343
+ this.g = rgb;
1344
+ this.b = rgb;
1345
+ }
1346
+ let r = 0, g = 0, b = 0;
1347
+ const huePrime = h / 60;
1348
+ const chroma = (1 - Math.abs(2 * l - 1)) * s;
1349
+ const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
1350
+ if (huePrime >= 0 && huePrime < 1) {
1351
+ r = chroma;
1352
+ g = secondComponent;
1353
+ } else if (huePrime >= 1 && huePrime < 2) {
1354
+ r = secondComponent;
1355
+ g = chroma;
1356
+ } else if (huePrime >= 2 && huePrime < 3) {
1357
+ g = chroma;
1358
+ b = secondComponent;
1359
+ } else if (huePrime >= 3 && huePrime < 4) {
1360
+ g = secondComponent;
1361
+ b = chroma;
1362
+ } else if (huePrime >= 4 && huePrime < 5) {
1363
+ r = secondComponent;
1364
+ b = chroma;
1365
+ } else if (huePrime >= 5 && huePrime < 6) {
1366
+ r = chroma;
1367
+ b = secondComponent;
1368
+ }
1369
+ const lightnessModification = l - chroma / 2;
1370
+ this.r = round((r + lightnessModification) * 255);
1371
+ this.g = round((g + lightnessModification) * 255);
1372
+ this.b = round((b + lightnessModification) * 255);
1373
+ }
1374
+ fromHsv({
1375
+ h,
1376
+ s,
1377
+ v,
1378
+ a
1379
+ }) {
1380
+ this._h = h % 360;
1381
+ this._s = s;
1382
+ this._v = v;
1383
+ this.a = typeof a === "number" ? a : 1;
1384
+ const vv = round(v * 255);
1385
+ this.r = vv;
1386
+ this.g = vv;
1387
+ this.b = vv;
1388
+ if (s <= 0) {
1389
+ return;
1390
+ }
1391
+ const hh = h / 60;
1392
+ const i = Math.floor(hh);
1393
+ const ff = hh - i;
1394
+ const p = round(v * (1 - s) * 255);
1395
+ const q = round(v * (1 - s * ff) * 255);
1396
+ const t = round(v * (1 - s * (1 - ff)) * 255);
1397
+ switch (i) {
1398
+ case 0:
1399
+ this.g = t;
1400
+ this.b = p;
1401
+ break;
1402
+ case 1:
1403
+ this.r = q;
1404
+ this.b = p;
1405
+ break;
1406
+ case 2:
1407
+ this.r = p;
1408
+ this.b = t;
1409
+ break;
1410
+ case 3:
1411
+ this.r = p;
1412
+ this.g = q;
1413
+ break;
1414
+ case 4:
1415
+ this.r = t;
1416
+ this.g = p;
1417
+ break;
1418
+ case 5:
1419
+ default:
1420
+ this.g = p;
1421
+ this.b = q;
1422
+ break;
1423
+ }
1424
+ }
1425
+ fromHsvString(trimStr) {
1426
+ const cells = splitColorStr(trimStr, parseHSVorHSL);
1427
+ this.fromHsv({
1428
+ h: cells[0],
1429
+ s: cells[1],
1430
+ v: cells[2],
1431
+ a: cells[3]
1432
+ });
1433
+ }
1434
+ fromHslString(trimStr) {
1435
+ const cells = splitColorStr(trimStr, parseHSVorHSL);
1436
+ this.fromHsl({
1437
+ h: cells[0],
1438
+ s: cells[1],
1439
+ l: cells[2],
1440
+ a: cells[3]
1441
+ });
1442
+ }
1443
+ fromRgbString(trimStr) {
1444
+ const cells = splitColorStr(trimStr, (num, txt) => (
1445
+ // Convert percentage to number. e.g. 50% -> 128
1446
+ txt.includes("%") ? round(num / 100 * 255) : num
1447
+ ));
1448
+ this.r = cells[0];
1449
+ this.g = cells[1];
1450
+ this.b = cells[2];
1451
+ this.a = cells[3];
1452
+ }
1453
+ };
1454
+
1455
+ // node_modules/@ant-design/colors/es/generate.js
1456
+ var hueStep = 2;
1457
+ var saturationStep = 0.16;
1458
+ var saturationStep2 = 0.05;
1459
+ var brightnessStep1 = 0.05;
1460
+ var brightnessStep2 = 0.15;
1461
+ var lightColorCount = 5;
1462
+ var darkColorCount = 4;
1463
+ var darkColorMap = [{
1464
+ index: 7,
1465
+ amount: 15
1466
+ }, {
1467
+ index: 6,
1468
+ amount: 25
1469
+ }, {
1470
+ index: 5,
1471
+ amount: 30
1472
+ }, {
1473
+ index: 5,
1474
+ amount: 45
1475
+ }, {
1476
+ index: 5,
1477
+ amount: 65
1478
+ }, {
1479
+ index: 5,
1480
+ amount: 85
1481
+ }, {
1482
+ index: 4,
1483
+ amount: 90
1484
+ }, {
1485
+ index: 3,
1486
+ amount: 95
1487
+ }, {
1488
+ index: 2,
1489
+ amount: 97
1490
+ }, {
1491
+ index: 1,
1492
+ amount: 98
1493
+ }];
1494
+ function getHue(hsv, i, light) {
1495
+ var hue;
1496
+ if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
1497
+ hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
1498
+ } else {
1499
+ hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
1500
+ }
1501
+ if (hue < 0) {
1502
+ hue += 360;
1503
+ } else if (hue >= 360) {
1504
+ hue -= 360;
1505
+ }
1506
+ return hue;
1507
+ }
1508
+ function getSaturation(hsv, i, light) {
1509
+ if (hsv.h === 0 && hsv.s === 0) {
1510
+ return hsv.s;
1511
+ }
1512
+ var saturation;
1513
+ if (light) {
1514
+ saturation = hsv.s - saturationStep * i;
1515
+ } else if (i === darkColorCount) {
1516
+ saturation = hsv.s + saturationStep;
1517
+ } else {
1518
+ saturation = hsv.s + saturationStep2 * i;
1519
+ }
1520
+ if (saturation > 1) {
1521
+ saturation = 1;
1522
+ }
1523
+ if (light && i === lightColorCount && saturation > 0.1) {
1524
+ saturation = 0.1;
1525
+ }
1526
+ if (saturation < 0.06) {
1527
+ saturation = 0.06;
1528
+ }
1529
+ return Math.round(saturation * 100) / 100;
1530
+ }
1531
+ function getValue(hsv, i, light) {
1532
+ var value;
1533
+ if (light) {
1534
+ value = hsv.v + brightnessStep1 * i;
1535
+ } else {
1536
+ value = hsv.v - brightnessStep2 * i;
1537
+ }
1538
+ value = Math.max(0, Math.min(1, value));
1539
+ return Math.round(value * 100) / 100;
1540
+ }
1541
+ function generate(color) {
1542
+ var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1543
+ var patterns = [];
1544
+ var pColor = new FastColor(color);
1545
+ var hsv = pColor.toHsv();
1546
+ for (var i = lightColorCount; i > 0; i -= 1) {
1547
+ var c = new FastColor({
1548
+ h: getHue(hsv, i, true),
1549
+ s: getSaturation(hsv, i, true),
1550
+ v: getValue(hsv, i, true)
1551
+ });
1552
+ patterns.push(c);
1553
+ }
1554
+ patterns.push(pColor);
1555
+ for (var _i = 1; _i <= darkColorCount; _i += 1) {
1556
+ var _c = new FastColor({
1557
+ h: getHue(hsv, _i),
1558
+ s: getSaturation(hsv, _i),
1559
+ v: getValue(hsv, _i)
1560
+ });
1561
+ patterns.push(_c);
1562
+ }
1563
+ if (opts.theme === "dark") {
1564
+ return darkColorMap.map(function(_ref) {
1565
+ var index = _ref.index, amount = _ref.amount;
1566
+ return new FastColor(opts.backgroundColor || "#141414").mix(patterns[index], amount).toHexString();
1567
+ });
1568
+ }
1569
+ return patterns.map(function(c2) {
1570
+ return c2.toHexString();
1571
+ });
1572
+ }
1573
+
1574
+ // node_modules/@ant-design/colors/es/presets.js
1575
+ var red = ["#fff1f0", "#ffccc7", "#ffa39e", "#ff7875", "#ff4d4f", "#f5222d", "#cf1322", "#a8071a", "#820014", "#5c0011"];
1576
+ red.primary = red[5];
1577
+ var volcano = ["#fff2e8", "#ffd8bf", "#ffbb96", "#ff9c6e", "#ff7a45", "#fa541c", "#d4380d", "#ad2102", "#871400", "#610b00"];
1578
+ volcano.primary = volcano[5];
1579
+ var orange = ["#fff7e6", "#ffe7ba", "#ffd591", "#ffc069", "#ffa940", "#fa8c16", "#d46b08", "#ad4e00", "#873800", "#612500"];
1580
+ orange.primary = orange[5];
1581
+ var gold = ["#fffbe6", "#fff1b8", "#ffe58f", "#ffd666", "#ffc53d", "#faad14", "#d48806", "#ad6800", "#874d00", "#613400"];
1582
+ gold.primary = gold[5];
1583
+ var yellow = ["#feffe6", "#ffffb8", "#fffb8f", "#fff566", "#ffec3d", "#fadb14", "#d4b106", "#ad8b00", "#876800", "#614700"];
1584
+ yellow.primary = yellow[5];
1585
+ var lime = ["#fcffe6", "#f4ffb8", "#eaff8f", "#d3f261", "#bae637", "#a0d911", "#7cb305", "#5b8c00", "#3f6600", "#254000"];
1586
+ lime.primary = lime[5];
1587
+ var green = ["#f6ffed", "#d9f7be", "#b7eb8f", "#95de64", "#73d13d", "#52c41a", "#389e0d", "#237804", "#135200", "#092b00"];
1588
+ green.primary = green[5];
1589
+ var cyan = ["#e6fffb", "#b5f5ec", "#87e8de", "#5cdbd3", "#36cfc9", "#13c2c2", "#08979c", "#006d75", "#00474f", "#002329"];
1590
+ cyan.primary = cyan[5];
1591
+ var blue = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"];
1592
+ blue.primary = blue[5];
1593
+ var geekblue = ["#f0f5ff", "#d6e4ff", "#adc6ff", "#85a5ff", "#597ef7", "#2f54eb", "#1d39c4", "#10239e", "#061178", "#030852"];
1594
+ geekblue.primary = geekblue[5];
1595
+ var purple = ["#f9f0ff", "#efdbff", "#d3adf7", "#b37feb", "#9254de", "#722ed1", "#531dab", "#391085", "#22075e", "#120338"];
1596
+ purple.primary = purple[5];
1597
+ var magenta = ["#fff0f6", "#ffd6e7", "#ffadd2", "#ff85c0", "#f759ab", "#eb2f96", "#c41d7f", "#9e1068", "#780650", "#520339"];
1598
+ magenta.primary = magenta[5];
1599
+ var grey = ["#a6a6a6", "#999999", "#8c8c8c", "#808080", "#737373", "#666666", "#404040", "#1a1a1a", "#000000", "#000000"];
1600
+ grey.primary = grey[5];
1601
+ var presetPalettes = {
1602
+ red,
1603
+ volcano,
1604
+ orange,
1605
+ gold,
1606
+ yellow,
1607
+ lime,
1608
+ green,
1609
+ cyan,
1610
+ blue,
1611
+ geekblue,
1612
+ purple,
1613
+ magenta,
1614
+ grey
1615
+ };
1616
+ var redDark = ["#2a1215", "#431418", "#58181c", "#791a1f", "#a61d24", "#d32029", "#e84749", "#f37370", "#f89f9a", "#fac8c3"];
1617
+ redDark.primary = redDark[5];
1618
+ var volcanoDark = ["#2b1611", "#441d12", "#592716", "#7c3118", "#aa3e19", "#d84a1b", "#e87040", "#f3956a", "#f8b692", "#fad4bc"];
1619
+ volcanoDark.primary = volcanoDark[5];
1620
+ var orangeDark = ["#2b1d11", "#442a11", "#593815", "#7c4a15", "#aa6215", "#d87a16", "#e89a3c", "#f3b765", "#f8cf8d", "#fae3b7"];
1621
+ orangeDark.primary = orangeDark[5];
1622
+ var goldDark = ["#2b2111", "#443111", "#594214", "#7c5914", "#aa7714", "#d89614", "#e8b339", "#f3cc62", "#f8df8b", "#faedb5"];
1623
+ goldDark.primary = goldDark[5];
1624
+ var yellowDark = ["#2b2611", "#443b11", "#595014", "#7c6e14", "#aa9514", "#d8bd14", "#e8d639", "#f3ea62", "#f8f48b", "#fafab5"];
1625
+ yellowDark.primary = yellowDark[5];
1626
+ var limeDark = ["#1f2611", "#2e3c10", "#3e4f13", "#536d13", "#6f9412", "#8bbb11", "#a9d134", "#c9e75d", "#e4f88b", "#f0fab5"];
1627
+ limeDark.primary = limeDark[5];
1628
+ var greenDark = ["#162312", "#1d3712", "#274916", "#306317", "#3c8618", "#49aa19", "#6abe39", "#8fd460", "#b2e58b", "#d5f2bb"];
1629
+ greenDark.primary = greenDark[5];
1630
+ var cyanDark = ["#112123", "#113536", "#144848", "#146262", "#138585", "#13a8a8", "#33bcb7", "#58d1c9", "#84e2d8", "#b2f1e8"];
1631
+ cyanDark.primary = cyanDark[5];
1632
+ var blueDark = ["#111a2c", "#112545", "#15325b", "#15417e", "#1554ad", "#1668dc", "#3c89e8", "#65a9f3", "#8dc5f8", "#b7dcfa"];
1633
+ blueDark.primary = blueDark[5];
1634
+ var geekblueDark = ["#131629", "#161d40", "#1c2755", "#203175", "#263ea0", "#2b4acb", "#5273e0", "#7f9ef3", "#a8c1f8", "#d2e0fa"];
1635
+ geekblueDark.primary = geekblueDark[5];
1636
+ var purpleDark = ["#1a1325", "#24163a", "#301c4d", "#3e2069", "#51258f", "#642ab5", "#854eca", "#ab7ae0", "#cda8f0", "#ebd7fa"];
1637
+ purpleDark.primary = purpleDark[5];
1638
+ var magentaDark = ["#291321", "#40162f", "#551c3b", "#75204f", "#a02669", "#cb2b83", "#e0529c", "#f37fb7", "#f8a8cc", "#fad2e3"];
1639
+ magentaDark.primary = magentaDark[5];
1640
+ var greyDark = ["#151515", "#1f1f1f", "#2d2d2d", "#393939", "#494949", "#5a5a5a", "#6a6a6a", "#7b7b7b", "#888888", "#969696"];
1641
+ greyDark.primary = greyDark[5];
1642
+
1643
+ // src/ColorPicker/ColorPalettePickerBasic/ColorPalettePickerBasic.tsx
1644
+ import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
1645
+ function genPresets(presets = presetPalettes) {
1646
+ return Object.entries(presets).map(([label, colors]) => ({
1647
+ label,
1648
+ colors,
1649
+ key: label
1650
+ }));
1651
+ }
1652
+ function ColorPalettePickerBasic({
1653
+ value,
1654
+ onChange,
1655
+ required,
1656
+ label,
1657
+ error,
1658
+ disabled,
1659
+ allowClear,
1660
+ defaultFormat,
1661
+ className,
1662
+ placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2A\u0E35",
1663
+ onClear
1664
+ }) {
1665
+ const { token } = theme.useToken();
1666
+ const presets = genPresets({
1667
+ primary: generate(token.colorPrimary),
1668
+ red,
1669
+ green
1670
+ });
1671
+ return /* @__PURE__ */ jsx24(
1672
+ ConfigProvider6,
1673
+ {
1674
+ theme: {
1675
+ token: {
1676
+ fontFamily: "Kanit",
1677
+ fontSize: 16
1678
+ }
1679
+ },
1680
+ children: /* @__PURE__ */ jsxs20("div", { className: "container-input", children: [
1681
+ /* @__PURE__ */ jsxs20("div", { children: [
1682
+ /* @__PURE__ */ jsx24("span", { className: "body-1", children: label }),
1683
+ " ",
1684
+ required && /* @__PURE__ */ jsx24("span", { className: "text-red-500", children: "*" })
1685
+ ] }),
1686
+ /* @__PURE__ */ jsx24(
1687
+ ColorPicker2,
1688
+ {
1689
+ defaultFormat,
1690
+ className: `body-1 w-full ${className ?? ""}`,
1691
+ presets,
1692
+ value,
1693
+ defaultValue: "#ffff",
1694
+ onChange,
1695
+ allowClear,
1696
+ showText: (color) => {
1697
+ const hex = color.toHexString();
1698
+ if (!value) {
1699
+ return /* @__PURE__ */ jsx24("span", { children: placeholder });
1700
+ }
1701
+ return /* @__PURE__ */ jsxs20("span", { children: [
1702
+ "(",
1703
+ hex,
1704
+ ")"
1705
+ ] });
1706
+ },
1707
+ disabled,
1708
+ onClear
1709
+ }
1710
+ ),
1711
+ error && /* @__PURE__ */ jsx24("p", { className: "text-red-500 caption-1", children: error })
1712
+ ] })
1713
+ }
1714
+ );
1715
+ }
1716
+
1717
+ // src/Select/SelectField/SelectField.tsx
1718
+ import { Select, ConfigProvider as ConfigProvider7 } from "antd";
1719
+ import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
1720
+ function SelectField({
1721
+ value,
1722
+ onChange,
1723
+ placeholder = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
1724
+ label,
1725
+ required,
1726
+ error,
1727
+ disabled,
1728
+ defaultValue,
1729
+ options,
1730
+ mode,
1731
+ prefix,
1732
+ prefixSize = 20,
1733
+ handleSearch,
1734
+ className,
1735
+ onClear
1736
+ }) {
1737
+ return /* @__PURE__ */ jsx25(
1738
+ ConfigProvider7,
1739
+ {
1740
+ theme: {
1741
+ token: {
1742
+ fontFamily: "Kanit",
1743
+ fontSize: 16
1744
+ }
1745
+ },
1746
+ children: /* @__PURE__ */ jsxs21("div", { className: "container-input", children: [
1747
+ /* @__PURE__ */ jsxs21("div", { children: [
1748
+ /* @__PURE__ */ jsx25("span", { className: "body-1", children: label }),
1749
+ " ",
1750
+ required && /* @__PURE__ */ jsx25("span", { className: "text-red-500", children: "*" })
1751
+ ] }),
1752
+ /* @__PURE__ */ jsx25(
1753
+ Select,
1754
+ {
1755
+ showSearch: true,
1756
+ value,
1757
+ defaultValue,
1758
+ onChange,
1759
+ className: `body-1 flex justify-center w-full ${className ?? ""}`,
1760
+ placeholder,
1761
+ optionFilterProp: "label",
1762
+ filterOption: (input, option) => (option?.label ?? "").toString().toLowerCase().includes(input.toLowerCase()),
1763
+ disabled,
1764
+ options,
1765
+ mode,
1766
+ onSearch: handleSearch,
1767
+ prefix: prefix ? /* @__PURE__ */ jsx25(
1768
+ "span",
1769
+ {
1770
+ style: {
1771
+ width: prefixSize,
1772
+ height: prefixSize,
1773
+ display: "flex",
1774
+ alignItems: "center",
1775
+ justifyContent: "center"
1776
+ },
1777
+ children: prefix
1778
+ }
1779
+ ) : void 0,
1780
+ allowClear: true,
1781
+ onClear
1782
+ }
1783
+ ),
1784
+ error && /* @__PURE__ */ jsx25("p", { className: "text-red-500 caption-1", children: error })
1785
+ ] })
1786
+ }
1787
+ );
1788
+ }
1789
+
1790
+ // src/Select/SelectFieldGroup/SelectFieldGroup.tsx
1791
+ import { Select as Select2, ConfigProvider as ConfigProvider8 } from "antd";
1792
+ import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
1793
+ function SelectFieldGroup({
1794
+ value,
1795
+ onChange,
1796
+ placeholder = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
1797
+ label,
1798
+ required,
1799
+ error,
1800
+ disabled,
1801
+ defaultValue,
1802
+ options,
1803
+ mode,
1804
+ prefix,
1805
+ prefixSize = 20,
1806
+ handleSearch,
1807
+ className
1808
+ }) {
1809
+ return /* @__PURE__ */ jsx26(
1810
+ ConfigProvider8,
1811
+ {
1812
+ theme: {
1813
+ token: {
1814
+ fontFamily: "Kanit"
1815
+ }
1816
+ },
1817
+ children: /* @__PURE__ */ jsxs22("div", { className: "container-input", children: [
1818
+ /* @__PURE__ */ jsxs22("div", { children: [
1819
+ /* @__PURE__ */ jsx26("span", { className: "body-1", children: label }),
1820
+ " ",
1821
+ required && /* @__PURE__ */ jsx26("span", { className: "text-red-500", children: "*" })
1822
+ ] }),
1823
+ /* @__PURE__ */ jsx26(
1824
+ Select2,
1825
+ {
1826
+ showSearch: true,
1827
+ value,
1828
+ defaultValue,
1829
+ onChange,
1830
+ className: `body-1 flex justify-center w-full ${className ?? ""}`,
1831
+ placeholder,
1832
+ optionFilterProp: "label",
1833
+ filterOption: (input, option) => (option?.label ?? "").toString().toLowerCase().includes(input.toLowerCase()),
1834
+ disabled,
1835
+ options,
1836
+ mode,
1837
+ onSearch: handleSearch,
1838
+ prefix: prefix ? /* @__PURE__ */ jsx26(
1839
+ "span",
1840
+ {
1841
+ style: {
1842
+ width: prefixSize,
1843
+ height: prefixSize,
1844
+ display: "flex",
1845
+ alignItems: "center",
1846
+ justifyContent: "center"
1847
+ },
1848
+ children: prefix
1849
+ }
1850
+ ) : void 0,
1851
+ allowClear: true
1852
+ }
1853
+ ),
1854
+ error && /* @__PURE__ */ jsx26("p", { className: "text-red-500 caption-1", children: error })
1855
+ ] })
1856
+ }
1857
+ );
1858
+ }
1859
+
1860
+ // src/Select/SelectFieldStatus/SelectFieldStatus.tsx
1861
+ import { Select as Select3, ConfigProvider as ConfigProvider9 } from "antd";
1862
+
1863
+ // src/Select/SelectFieldStatus/StatusMockup.ts
1864
+ var status = [
1865
+ { value: "1", label: "\u0E40\u0E1B\u0E34\u0E14", color: "var(--color-gray-500)" },
1866
+ { value: "2", label: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23", color: "var(--color-yellow-400)" },
1867
+ { value: "3", label: "\u0E23\u0E2D\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A", color: "var(--color-red-400)" },
1868
+ { value: "4", label: "\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E2A\u0E34\u0E49\u0E19", color: "var(--color-green-400)" },
1869
+ { value: "5", label: "\u0E16\u0E39\u0E01\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01", color: "var(--color-gray-300)" }
1870
+ ];
1871
+
1872
+ // src/Select/SelectFieldStatus/SelectFieldStatus.tsx
1873
+ import { DownOutlined } from "@ant-design/icons";
1874
+ import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
1875
+ function SelectFieldStatus({
1876
+ value,
1877
+ onChange,
1878
+ placeholder,
1879
+ label,
1880
+ required,
1881
+ disabled,
1882
+ error,
1883
+ options,
1884
+ className
1885
+ }) {
1886
+ const selectedItem = status.find((s) => s.value === value);
1887
+ return /* @__PURE__ */ jsx27(
1888
+ ConfigProvider9,
1889
+ {
1890
+ theme: {
1891
+ components: {
1892
+ Select: {
1893
+ selectorBg: selectedItem?.color || "#ffff",
1894
+ hoverBorderColor: "#D9D9D9",
1895
+ activeBorderColor: "#D9D9D9",
1896
+ activeOutlineColor: "#D9D9D9"
1897
+ }
1898
+ },
1899
+ token: {
1900
+ fontFamily: "Kanit"
1901
+ }
1902
+ },
1903
+ children: /* @__PURE__ */ jsxs23("div", { className: "container-input", children: [
1904
+ /* @__PURE__ */ jsxs23("div", { children: [
1905
+ /* @__PURE__ */ jsx27("span", { className: "body-1", children: label }),
1906
+ " ",
1907
+ required && /* @__PURE__ */ jsx27("span", { className: "text-red-500", children: "*" })
1908
+ ] }),
1909
+ /* @__PURE__ */ jsx27(
1910
+ Select3,
1911
+ {
1912
+ disabled,
1913
+ suffixIcon: /* @__PURE__ */ jsx27(DownOutlined, { style: { color: value ? "#fff" : "#D9D9D9" } }),
1914
+ value,
1915
+ onChange,
1916
+ className: `body-3 custom-select flex justify-center w-full ${className ?? ""}`,
1917
+ placeholder,
1918
+ optionFilterProp: "label",
1919
+ filterOption: (input, option) => (option?.label ?? "").toString().toLowerCase().includes(input.toLowerCase()),
1920
+ options,
1921
+ showSearch: true
1922
+ }
1923
+ ),
1924
+ error && /* @__PURE__ */ jsx27("p", { className: "text-red-500 caption-1", children: error })
1925
+ ] })
1926
+ }
1927
+ );
1928
+ }
1929
+
1930
+ // src/Select/SelectFieldStatusReport/SelectFieldStatusReport.tsx
1931
+ import { Select as Select4, ConfigProvider as ConfigProvider10 } from "antd";
1932
+
1933
+ // src/Select/SelectFieldStatusReport/StatusReportMockup.ts
1934
+ var status2 = [
1935
+ { value: "1", label: "\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E2A\u0E34\u0E49\u0E19", color: "var(--color-green-400)" },
1936
+ { value: "2", label: "\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E2A\u0E34\u0E49\u0E19", color: "var(--color-red-500)" }
1937
+ ];
1938
+
1939
+ // src/Select/SelectFieldStatusReport/SelectFieldStatusReport.tsx
1940
+ import { DownOutlined as DownOutlined2 } from "@ant-design/icons";
1941
+ import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
1942
+ function SelectFieldStatusReport({
1943
+ value,
1944
+ onChange,
1945
+ placeholder,
1946
+ label,
1947
+ required,
1948
+ disabled,
1949
+ error,
1950
+ className,
1951
+ options
1952
+ }) {
1953
+ const selectedItem = status2.find((s) => s.value === value);
1954
+ return /* @__PURE__ */ jsx28(
1955
+ ConfigProvider10,
1956
+ {
1957
+ theme: {
1958
+ components: {
1959
+ Select: {
1960
+ selectorBg: selectedItem?.color || "#ffff",
1961
+ hoverBorderColor: "#D9D9D9",
1962
+ activeBorderColor: "#D9D9D9",
1963
+ activeOutlineColor: "#D9D9D9"
1964
+ }
1965
+ },
1966
+ token: {
1967
+ fontFamily: "Kanit"
1968
+ }
1969
+ },
1970
+ children: /* @__PURE__ */ jsxs24("div", { className: "container-input", children: [
1971
+ /* @__PURE__ */ jsxs24("div", { children: [
1972
+ /* @__PURE__ */ jsx28("span", { className: "body-1", children: label }),
1973
+ " ",
1974
+ required && /* @__PURE__ */ jsx28("span", { className: "text-red-500", children: "*" })
1975
+ ] }),
1976
+ /* @__PURE__ */ jsx28(
1977
+ Select4,
1978
+ {
1979
+ disabled,
1980
+ suffixIcon: /* @__PURE__ */ jsx28(DownOutlined2, { style: { color: value ? "#fff" : "#D9D9D9" } }),
1981
+ value,
1982
+ onChange,
1983
+ className: `body-3 custom-select flex justify-center w-full ${className ?? ""}`,
1984
+ placeholder,
1985
+ optionFilterProp: "label",
1986
+ filterOption: (input, option) => (option?.label ?? "").toString().toLowerCase().includes(input.toLowerCase()),
1987
+ options,
1988
+ showSearch: true
1989
+ }
1990
+ ),
1991
+ error && /* @__PURE__ */ jsx28("p", { className: "text-red-500 caption-1", children: error })
1992
+ ] })
1993
+ }
1994
+ );
1995
+ }
1996
+
1997
+ // src/Select/SelectFieldTag/SelectFieldTag.tsx
1998
+ import { Select as Select5, ConfigProvider as ConfigProvider11 } from "antd";
1999
+ import { useState as useState6 } from "react";
2000
+ import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
2001
+ function SelectFieldTag({
2002
+ label,
2003
+ required,
2004
+ placeholder,
2005
+ options,
2006
+ error,
2007
+ value: controlledValue,
2008
+ className,
2009
+ onChange,
2010
+ onClear
2011
+ }) {
2012
+ const [internalValue, setInternalValue] = useState6([]);
2013
+ const isControlled = controlledValue !== void 0;
2014
+ const value = isControlled ? controlledValue : internalValue;
2015
+ const [searchWord, setSearchWord] = useState6("");
2016
+ const handleChange = (val) => {
2017
+ const trimValue = val.map((v) => v.trim());
2018
+ const filtered = trimValue.filter((v) => v.trim() !== "");
2019
+ const latest = filtered.slice(-1);
2020
+ if (!isControlled) {
2021
+ setInternalValue(latest);
2022
+ }
2023
+ setSearchWord("");
2024
+ onChange?.(latest);
2025
+ };
2026
+ const handleSearch = (text) => {
2027
+ setSearchWord(text.trimStart());
2028
+ if (!isControlled) {
2029
+ setInternalValue([]);
2030
+ }
2031
+ onChange?.([]);
2032
+ };
2033
+ return /* @__PURE__ */ jsx29(
2034
+ ConfigProvider11,
2035
+ {
2036
+ theme: {
2037
+ token: {
2038
+ fontFamily: "Kanit"
2039
+ }
2040
+ },
2041
+ children: /* @__PURE__ */ jsxs25("div", { className: "container-input", children: [
2042
+ /* @__PURE__ */ jsxs25("div", { children: [
2043
+ /* @__PURE__ */ jsx29("span", { className: "body-1", children: label }),
2044
+ " ",
2045
+ required && /* @__PURE__ */ jsx29("span", { className: "text-red-500", children: "*" })
2046
+ ] }),
2047
+ /* @__PURE__ */ jsx29(
2048
+ Select5,
2049
+ {
2050
+ mode: "tags",
2051
+ className: `body-1 flex justify-center w-full ${className ?? ""}`,
2052
+ placeholder,
2053
+ value,
2054
+ onChange: handleChange,
2055
+ onSearch: handleSearch,
2056
+ filterOption: (input, option) => {
2057
+ if (!input.trim()) return true;
2058
+ return (option?.label).toLowerCase().includes(input.toLowerCase());
2059
+ },
2060
+ searchValue: searchWord,
2061
+ options,
2062
+ allowClear: true,
2063
+ onClear
2064
+ }
2065
+ ),
2066
+ error && /* @__PURE__ */ jsx29("p", { className: "text-red-500 caption-1", children: error })
2067
+ ] })
2068
+ }
2069
+ );
2070
+ }
2071
+
2072
+ // src/Select/SelectCustom/SelectCustom.tsx
2073
+ import { IconTrash } from "@tabler/icons-react";
2074
+ import { Select as Select6, ConfigProvider as ConfigProvider12 } from "antd";
2075
+ import { useState as useState7 } from "react";
2076
+ import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
2077
+ function SelectCustom({
2078
+ label = "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E42\u0E04\u0E23\u0E07\u0E01\u0E32\u0E23",
2079
+ placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01",
2080
+ options,
2081
+ required = false,
2082
+ onChange,
2083
+ error,
2084
+ onClear
2085
+ }) {
2086
+ const [value, setValue] = useState7([]);
2087
+ const [valueList, setValueList] = useState7([]);
2088
+ const handleChange = (selectedValues) => {
2089
+ const newValues = selectedValues.filter((v) => !valueList.includes(v));
2090
+ setValueList((prev) => {
2091
+ const updated = [...prev, ...newValues];
2092
+ onChange && onChange(updated);
2093
+ return updated;
2094
+ });
2095
+ setValue([]);
2096
+ };
2097
+ const handleDelete = (val) => {
2098
+ setValueList((prev) => {
2099
+ const updated = prev.filter((v) => v !== val);
2100
+ onChange && onChange(updated);
2101
+ return updated;
2102
+ });
2103
+ };
2104
+ const filteredOptions = options.filter((opt) => !valueList.includes(opt.value)).map((opt) => ({ value: opt.value, label: opt.label }));
2105
+ return /* @__PURE__ */ jsx30(
2106
+ ConfigProvider12,
2107
+ {
2108
+ theme: {
2109
+ token: {
2110
+ fontFamily: "Kanit",
2111
+ fontSize: 16
2112
+ }
2113
+ },
2114
+ children: /* @__PURE__ */ jsxs26("div", { className: "container-input", children: [
2115
+ /* @__PURE__ */ jsxs26("div", { children: [
2116
+ /* @__PURE__ */ jsx30("span", { className: "body-1", children: label }),
2117
+ " ",
2118
+ required && /* @__PURE__ */ jsx30("span", { className: "text-red-500", children: "*" })
2119
+ ] }),
2120
+ /* @__PURE__ */ jsx30(
2121
+ Select6,
2122
+ {
2123
+ value,
2124
+ onChange: handleChange,
2125
+ placeholder,
2126
+ options: filteredOptions,
2127
+ mode: "tags",
2128
+ onClear
2129
+ }
2130
+ ),
2131
+ error && /* @__PURE__ */ jsx30("p", { className: "text-red-500 caption-1", children: error }),
2132
+ /* @__PURE__ */ jsx30("div", { className: "w-full p-[2px] overflow-y-auto", children: valueList.map((v, index) => /* @__PURE__ */ jsxs26("div", { className: "flex justify-between items-center py-[2px] body-1", children: [
2133
+ /* @__PURE__ */ jsxs26("div", { className: "flex flex-row gap-[8px]", children: [
2134
+ /* @__PURE__ */ jsxs26("p", { children: [
2135
+ index + 1,
2136
+ "."
2137
+ ] }),
2138
+ /* @__PURE__ */ jsx30("p", { children: v })
2139
+ ] }),
2140
+ /* @__PURE__ */ jsx30(IconTrash, { className: "cursor-pointer", onClick: () => handleDelete(v) })
2141
+ ] }, index)) })
2142
+ ] })
2143
+ }
2144
+ );
2145
+ }
2146
+
2147
+ // src/SortFilter/SortFilter.tsx
2148
+ import { ConfigProvider as ConfigProvider13 } from "antd";
2149
+ import { CalendarOutlined } from "@ant-design/icons";
2150
+
2151
+ // src/SortFilter/DataMockSortFilter.ts
2152
+ var years = [
2153
+ { value: "\u0E1B\u0E35 2566", label: "\u0E1B\u0E35 2566" },
2154
+ { value: "\u0E1B\u0E35 2567", label: "\u0E1B\u0E35 2567" },
2155
+ { value: "\u0E1B\u0E35 2568", label: "\u0E1B\u0E35 2568" }
2156
+ ];
2157
+ var months = [
2158
+ { value: "\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21", label: "\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21" },
2159
+ { value: "\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C", label: "\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C" },
2160
+ { value: "\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21", label: "\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21" },
2161
+ { value: "\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19", label: "\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19" },
2162
+ { value: "\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21", label: "\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21" },
2163
+ { value: "\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19", label: "\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19" },
2164
+ { value: "\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21", label: "\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21" },
2165
+ { value: "\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21", label: "\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21" },
2166
+ { value: "\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19", label: "\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19" },
2167
+ { value: "\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21", label: "\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21" },
2168
+ { value: "\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19", label: "\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19" },
2169
+ { value: "\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21", label: "\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21" }
2170
+ ];
2171
+ var quarters = [
2172
+ { value: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 1", label: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 1" },
2173
+ { value: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 2", label: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 2" },
2174
+ { value: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 3", label: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 3" },
2175
+ { value: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 4", label: "\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A 4" }
2176
+ ];
2177
+
2178
+ // src/SortFilter/SortFilter.tsx
2179
+ import { useState as useState8 } from "react";
2180
+ import { IconSortDescending as IconSortDescending2, IconFilter } from "@tabler/icons-react";
2181
+ import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
2182
+ function SortFilter({
2183
+ showYear = true,
2184
+ showQuarter = true,
2185
+ showMonth = true,
2186
+ onSortClick,
2187
+ onFilterClick
2188
+ }) {
2189
+ const [yearValue, setYearValue] = useState8();
2190
+ const [monthValue, setMonthValue] = useState8();
2191
+ const [quarterValue, setQuartersValue] = useState8();
2192
+ return /* @__PURE__ */ jsx31(
2193
+ ConfigProvider13,
2194
+ {
2195
+ theme: {
2196
+ token: {
2197
+ fontFamily: "Kanit"
2198
+ }
2199
+ },
2200
+ children: /* @__PURE__ */ jsxs27("div", { className: "w-full flex items-center justify-between", children: [
2201
+ /* @__PURE__ */ jsxs27("div", { className: "w-full flex gap-[10px]", children: [
2202
+ showYear && /* @__PURE__ */ jsx31("div", { className: "w-[200px]", children: /* @__PURE__ */ jsx31(
2203
+ SelectField,
2204
+ {
2205
+ prefix: /* @__PURE__ */ jsx31(CalendarOutlined, {}),
2206
+ onChange: setYearValue,
2207
+ options: years.map((s) => ({
2208
+ value: s.value,
2209
+ label: s.label
2210
+ })),
2211
+ placeholder: "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E1B\u0E35",
2212
+ value: yearValue
2213
+ }
2214
+ ) }),
2215
+ showMonth && /* @__PURE__ */ jsx31("div", { className: "w-[200px]", children: /* @__PURE__ */ jsx31(
2216
+ SelectField,
2217
+ {
2218
+ prefix: /* @__PURE__ */ jsx31(CalendarOutlined, {}),
2219
+ onChange: setMonthValue,
2220
+ options: months.map((s) => ({
2221
+ value: s.value,
2222
+ label: s.label
2223
+ })),
2224
+ value: monthValue,
2225
+ placeholder: "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E40\u0E14\u0E37\u0E2D\u0E19"
2226
+ }
2227
+ ) }),
2228
+ showQuarter && /* @__PURE__ */ jsx31("div", { className: "w-[200px]", children: /* @__PURE__ */ jsx31(
2229
+ SelectField,
2230
+ {
2231
+ prefix: /* @__PURE__ */ jsx31(CalendarOutlined, {}),
2232
+ onChange: setQuartersValue,
2233
+ options: quarters.map((s) => ({
2234
+ value: s.value,
2235
+ label: s.label
2236
+ })),
2237
+ value: quarterValue,
2238
+ placeholder: "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A"
2239
+ }
2240
+ ) })
2241
+ ] }),
2242
+ /* @__PURE__ */ jsxs27("div", { className: "flex gap-[10px]", children: [
2243
+ /* @__PURE__ */ jsx31(
2244
+ IconSortDescending2,
2245
+ {
2246
+ size: 24,
2247
+ className: "cursor-pointer",
2248
+ onClick: onSortClick
2249
+ }
2250
+ ),
2251
+ /* @__PURE__ */ jsx31(
2252
+ IconFilter,
2253
+ {
2254
+ size: 24,
2255
+ className: "cursor-pointer",
2256
+ onClick: onFilterClick
2257
+ }
2258
+ )
2259
+ ] })
2260
+ ] })
2261
+ }
2262
+ );
2263
+ }
2264
+
2265
+ // src/Upload/FileUploader/FileUploader.tsx
2266
+ import { IconPaperclip, IconUpload, IconTrash as IconTrash2 } from "@tabler/icons-react";
2267
+ import { useRef as useRef2, useState as useState9 } from "react";
2268
+ import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
2269
+ function FileUploader({
2270
+ onUpload,
2271
+ onError,
2272
+ onRemove,
2273
+ accept,
2274
+ maxSize,
2275
+ disabled,
2276
+ mode = "drop",
2277
+ description,
2278
+ label
2279
+ }) {
2280
+ const [fileList, setFileList] = useState9([]);
2281
+ const [uploading, setUploading] = useState9(false);
2282
+ const [dragActive, setDragActive] = useState9(false);
2283
+ const inputRef = useRef2(null);
2284
+ const validateFile = (file) => {
2285
+ if (accept && !accept.includes(file.type)) {
2286
+ onError?.(`Invalid file type. file: ${file.name}`);
2287
+ throw new Error("Invalid file type");
2288
+ }
2289
+ if (maxSize && file.size > maxSize * 1024 * 1024) {
2290
+ onError?.(`Invalid file size. file: ${file.name}`);
2291
+ throw new Error("Invalid file size");
2292
+ }
2293
+ return true;
2294
+ };
2295
+ const handleUploadClick = () => {
2296
+ inputRef.current?.click();
2297
+ };
2298
+ const handleRemoveFile = async (index) => {
2299
+ try {
2300
+ if (onRemove) {
2301
+ await onRemove(index);
2302
+ }
2303
+ const updatedList = [...fileList];
2304
+ updatedList.splice(index, 1);
2305
+ setFileList(updatedList);
2306
+ } catch (error) {
2307
+ console.log(error);
2308
+ }
2309
+ };
2310
+ const handleUpload = (event) => {
2311
+ handleFileChange(event.target.files);
2312
+ };
2313
+ const handleDrop = (event) => {
2314
+ event.preventDefault();
2315
+ setDragActive(false);
2316
+ if (disabled) return;
2317
+ handleFileChange(event.dataTransfer.files);
2318
+ };
2319
+ const handleFileChange = async (files) => {
2320
+ if (!files) return;
2321
+ const fileArray = Array.from(files);
2322
+ for (const file of fileArray) {
2323
+ if (!validateFile(file)) continue;
2324
+ setUploading(true);
2325
+ try {
2326
+ if (onUpload) {
2327
+ await onUpload(file);
2328
+ }
2329
+ setFileList((prev) => [...prev, file]);
2330
+ } catch (err) {
2331
+ console.log("catch");
2332
+ console.error(err);
2333
+ } finally {
2334
+ setUploading(false);
2335
+ }
2336
+ }
2337
+ if (inputRef.current) inputRef.current.value = "";
2338
+ };
2339
+ return /* @__PURE__ */ jsxs28("div", { className: "w-full", children: [
2340
+ label && /* @__PURE__ */ jsx32("p", { className: "body-1", children: label }),
2341
+ /* @__PURE__ */ jsxs28("div", { children: [
2342
+ mode === "upload" ? /* @__PURE__ */ jsx32(
2343
+ "button",
2344
+ {
2345
+ type: "button",
2346
+ onClick: handleUploadClick,
2347
+ className: `h-[34px] flex justify-center items-center gap-2 w-full rounded-[2px] border border-gray-200 body-1
2348
+ ${disabled ? "cursor-not-allowed text-gray-400 bg-gray-100" : "cursor-pointer hover:text-primary-400 hover:border-primary-200 duration-300"}`,
2349
+ disabled: disabled ? disabled : uploading,
2350
+ children: uploading ? /* @__PURE__ */ jsxs28(Fragment5, { children: [
2351
+ /* @__PURE__ */ jsx32(Loader, { size: 15 }),
2352
+ " \u0E01\u0E33\u0E25\u0E31\u0E07\u0E2D\u0E31\u0E1B\u0E42\u0E2B\u0E25\u0E14"
2353
+ ] }) : /* @__PURE__ */ jsxs28(Fragment5, { children: [
2354
+ /* @__PURE__ */ jsx32(IconUpload, { size: 15, className: "text-gray-400" }),
2355
+ " \u0E41\u0E19\u0E1A\u0E44\u0E1F\u0E25\u0E4C"
2356
+ ] })
2357
+ }
2358
+ ) : /* @__PURE__ */ jsx32(
2359
+ "div",
2360
+ {
2361
+ className: `min-w-[400px] min-h-[120px] flex justify-center items-center border-2 border-dashed rounded-md p-4 transition-colors body-1
2362
+ ${dragActive ? "border-primary-500 bg-primary-50" : "border-gray-300 bg-white"}
2363
+ ${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
2364
+ `,
2365
+ onClick: handleUploadClick,
2366
+ onDragOver: (e) => {
2367
+ e.preventDefault();
2368
+ if (!disabled) setDragActive(true);
2369
+ },
2370
+ onDragLeave: () => setDragActive(false),
2371
+ onDrop: handleDrop,
2372
+ children: uploading ? /* @__PURE__ */ jsxs28("div", { className: "flex justify-center items-center gap-2", children: [
2373
+ /* @__PURE__ */ jsx32(Loader, { size: 15 }),
2374
+ " \u0E01\u0E33\u0E25\u0E31\u0E07\u0E2D\u0E31\u0E1B\u0E42\u0E2B\u0E25\u0E14"
2375
+ ] }) : /* @__PURE__ */ jsxs28("div", { className: "flex flex-col items-center gap-2", children: [
2376
+ /* @__PURE__ */ jsx32(IconUpload, { size: 20 }),
2377
+ /* @__PURE__ */ jsx32("span", { className: "body-1", children: "\u0E04\u0E25\u0E34\u0E01\u0E2B\u0E23\u0E37\u0E2D\u0E25\u0E32\u0E01\u0E44\u0E1F\u0E25\u0E4C\u0E21\u0E32\u0E17\u0E35\u0E48\u0E1A\u0E23\u0E34\u0E40\u0E27\u0E13\u0E19\u0E35\u0E49\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E2D\u0E31\u0E1B\u0E42\u0E2B\u0E25\u0E14" }),
2378
+ /* @__PURE__ */ jsx32("span", { className: "text-gray-400 body-3", children: "\u0E23\u0E2D\u0E07\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E2D\u0E31\u0E1B\u0E42\u0E2B\u0E25\u0E14\u0E41\u0E1A\u0E1A\u0E40\u0E14\u0E35\u0E48\u0E22\u0E27\u0E2B\u0E23\u0E37\u0E2D\u0E2B\u0E25\u0E32\u0E22\u0E44\u0E1F\u0E25\u0E4C" })
2379
+ ] })
2380
+ }
2381
+ ),
2382
+ /* @__PURE__ */ jsx32(
2383
+ "input",
2384
+ {
2385
+ type: "file",
2386
+ multiple: true,
2387
+ ref: inputRef,
2388
+ onChange: handleUpload,
2389
+ style: { display: "none" },
2390
+ accept: accept?.join(","),
2391
+ disabled
2392
+ }
2393
+ )
2394
+ ] }),
2395
+ description && /* @__PURE__ */ jsx32("p", { className: "text-gray-400 body-4", children: description }),
2396
+ /* @__PURE__ */ jsx32("div", { className: "mt-[8px]", children: fileList.length !== 0 && fileList.map((file, index) => /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2 rounded-[4px] px-[8px] py-[4px] body-1", children: [
2397
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2 w-[75%] overflow-hidden", children: [
2398
+ /* @__PURE__ */ jsx32("div", { className: "w-[15px] h-[15px]", children: /* @__PURE__ */ jsx32(IconPaperclip, { size: 15 }) }),
2399
+ /* @__PURE__ */ jsx32("span", { className: "truncate", children: file.name })
2400
+ ] }),
2401
+ /* @__PURE__ */ jsx32(
2402
+ IconTrash2,
2403
+ {
2404
+ size: 20,
2405
+ className: "ml-auto hover:text-red-500 cursor-pointer",
2406
+ onClick: () => handleRemoveFile(index)
2407
+ }
2408
+ )
2409
+ ] }, index)) })
2410
+ ] });
2411
+ }
2412
+
2413
+ // src/Message/Message/Message.tsx
2414
+ var messageApi = null;
2415
+ function setMessageApi(api) {
2416
+ messageApi = api;
2417
+ }
2418
+ function messageSuccess(content) {
2419
+ messageApi?.success({ content, className: "message message-success" });
2420
+ }
2421
+ function messageError(content) {
2422
+ messageApi?.error({ content, className: "message message-error" });
2423
+ }
2424
+ function messageWarning(content) {
2425
+ messageApi?.warning({ content, className: "message message-warning" });
2426
+ }
2427
+ function messageInfo(content) {
2428
+ messageApi?.info({ content, className: "message message-info" });
2429
+ }
2430
+ function messageLoading(content, duration) {
2431
+ messageApi?.loading({ content, duration, className: "message message-loading" });
2432
+ }
2433
+
2434
+ // src/Breadcrumb/Breadcrumb.tsx
2435
+ import { ConfigProvider as ConfigProvider14 } from "antd";
2436
+ import { Breadcrumb } from "antd";
2437
+ import { jsx as jsx33 } from "react/jsx-runtime";
2438
+ function Breadcrumbs({
2439
+ items,
2440
+ separator,
2441
+ itemRender,
2442
+ classname,
2443
+ params
2444
+ }) {
2445
+ return /* @__PURE__ */ jsx33(
2446
+ ConfigProvider14,
2447
+ {
2448
+ theme: {
2449
+ token: {
2450
+ fontFamily: "Kanit"
2451
+ }
2452
+ },
2453
+ children: /* @__PURE__ */ jsx33(
2454
+ Breadcrumb,
2455
+ {
2456
+ items,
2457
+ separator,
2458
+ itemRender,
2459
+ className: classname,
2460
+ params
2461
+ }
2462
+ )
2463
+ }
2464
+ );
2465
+ }
2466
+
2467
+ // src/HeadingPage/HeadingPage.tsx
2468
+ import { ConfigProvider as ConfigProvider15 } from "antd";
2469
+ import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
2470
+ function HeadingPage({ Heading }) {
2471
+ const today = (/* @__PURE__ */ new Date()).toLocaleDateString("th-TH", {
2472
+ weekday: "long",
2473
+ day: "numeric",
2474
+ month: "long",
2475
+ year: "numeric"
2476
+ });
2477
+ return /* @__PURE__ */ jsx34(
2478
+ ConfigProvider15,
2479
+ {
2480
+ theme: {
2481
+ token: {
2482
+ fontFamily: "Kanit"
2483
+ }
2484
+ },
2485
+ children: /* @__PURE__ */ jsxs29("div", { className: "flex flex-col gap-[10px] px-[20px] py-[10px]", children: [
2486
+ /* @__PURE__ */ jsx34("p", { className: "headline-5", children: Heading }),
2487
+ /* @__PURE__ */ jsxs29("p", { className: "body-1", children: [
2488
+ " \u0E27\u0E31\u0E19\u0E19\u0E35\u0E49 ",
2489
+ today
2490
+ ] })
2491
+ ] })
2492
+ }
2493
+ );
2494
+ }
2495
+
2496
+ // src/Progress/ProgressBar.tsx
2497
+ import { ConfigProvider as ConfigProvider16, Progress } from "antd";
2498
+ import { useEffect as useEffect2, useRef as useRef3, useState as useState10 } from "react";
2499
+ import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
2500
+ function ProgressBar({
2501
+ percent = 0,
2502
+ size = "default",
2503
+ checkpoints = [],
2504
+ showInfo,
2505
+ trailColor = "#DBE0E5",
2506
+ type,
2507
+ strokeLinecap,
2508
+ strokeWidth,
2509
+ steps,
2510
+ isCheckPoints
2511
+ }) {
2512
+ const [barWidth, setBarWidth] = useState10(0);
2513
+ const progressRef = useRef3(null);
2514
+ let strokeColor = "--color-green-500";
2515
+ const defaultStrokeWidth = type === "circle" ? 13 : strokeWidth ?? 8;
2516
+ const defaultSize = type === "circle" ? 43 : size;
2517
+ if (percent < 100 && checkpoints.length > 0) {
2518
+ const minCheckpoint = Math.min(...checkpoints);
2519
+ strokeColor = percent >= minCheckpoint ? "var(--color-green-500)" : "var(--color-red-500)";
2520
+ }
2521
+ useEffect2(() => {
2522
+ const inner = progressRef.current?.querySelector(".ant-progress-inner");
2523
+ if (!inner) return;
2524
+ const observer = new ResizeObserver(() => {
2525
+ setBarWidth(inner.offsetWidth);
2526
+ });
2527
+ observer.observe(inner);
2528
+ return () => observer.disconnect();
2529
+ }, []);
2530
+ return /* @__PURE__ */ jsx35(
2531
+ ConfigProvider16,
2532
+ {
2533
+ theme: {
2534
+ token: {
2535
+ fontFamily: "Kanit"
2536
+ }
2537
+ },
2538
+ children: /* @__PURE__ */ jsxs30("div", { className: "relative w-full", ref: progressRef, children: [
2539
+ /* @__PURE__ */ jsx35(
2540
+ Progress,
2541
+ {
2542
+ className: "w-full",
2543
+ percent,
2544
+ size: defaultSize,
2545
+ type,
2546
+ showInfo,
2547
+ trailColor,
2548
+ format: (percent2) => `${percent2}%`,
2549
+ strokeLinecap,
2550
+ strokeWidth: defaultStrokeWidth,
2551
+ steps,
2552
+ strokeColor
2553
+ }
2554
+ ),
2555
+ barWidth > 0 && isCheckPoints && type !== "circle" && checkpoints.map((cp) => /* @__PURE__ */ jsx35(
2556
+ "div",
2557
+ {
2558
+ className: "checkpoint absolute top-0",
2559
+ style: {
2560
+ left: `${cp / 100 * barWidth}px`,
2561
+ width: 0,
2562
+ height: 0,
2563
+ borderLeft: "6px solid transparent",
2564
+ borderRight: "6px solid transparent",
2565
+ borderTop: "10px solid red",
2566
+ transform: "translateX(-50%)"
2567
+ }
2568
+ },
2569
+ cp
2570
+ ))
2571
+ ] })
2572
+ }
2573
+ );
2574
+ }
2575
+
2576
+ // src/KpiSection/KpiSection.tsx
2577
+ import { ConfigProvider as ConfigProvider17, message } from "antd";
2578
+ import { useEffect as useEffect3, useState as useState12 } from "react";
2579
+
2580
+ // src/KpiSection/hooks/useGetKpiSection.ts
2581
+ import { useState as useState11 } from "react";
2582
+ import cuid from "cuid";
2583
+ function useGetKpiSection() {
2584
+ const [nameKpi, setNameKpi] = useState11("");
2585
+ const [kpiValue, setKpiValue] = useState11("");
2586
+ const [unitValue, setUnitValue] = useState11("");
2587
+ const [kpiList, setKpiList] = useState11([]);
2588
+ const [editingBackup, setEditingBackup] = useState11({});
2589
+ const [selected, setSelected] = useState11("2");
2590
+ const [errors, setErrors] = useState11({
2591
+ nameKpi: "",
2592
+ kpiValue: "",
2593
+ unitValue: ""
2594
+ });
2595
+ const [itemErrors, setItemErrors] = useState11({});
2596
+ const options = [
2597
+ { value: "1", label: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21" },
2598
+ { value: "2", label: "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02" }
2599
+ ];
2600
+ const handleAddKpi = (type) => {
2601
+ let newErrors = { nameKpi: "", kpiValue: "", unitValue: "" };
2602
+ let hasError = false;
2603
+ if (!nameKpi) {
2604
+ newErrors.nameKpi = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38";
2605
+ hasError = true;
2606
+ }
2607
+ if (type === "number") {
2608
+ if (!kpiValue) {
2609
+ newErrors.kpiValue = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38";
2610
+ hasError = true;
2611
+ }
2612
+ if (!unitValue) {
2613
+ newErrors.unitValue = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38";
2614
+ hasError = true;
2615
+ }
2616
+ }
2617
+ setErrors(newErrors);
2618
+ if (hasError) return;
2619
+ const newKpi = {
2620
+ id: cuid(),
2621
+ name: nameKpi,
2622
+ value: kpiValue,
2623
+ unit: unitValue,
2624
+ isEditing: false
2625
+ };
2626
+ setKpiList([...kpiList, newKpi]);
2627
+ setNameKpi("");
2628
+ setKpiValue("");
2629
+ setUnitValue("");
2630
+ setErrors({ nameKpi: "", kpiValue: "", unitValue: "" });
2631
+ };
2632
+ const handleEdit = (id) => {
2633
+ const current = kpiList.find((kpi) => kpi.id === id);
2634
+ if (current) {
2635
+ setEditingBackup((prev) => ({ ...prev, [id]: { ...current } }));
2636
+ }
2637
+ setKpiList(
2638
+ (prev) => prev.map((item) => item.id === id ? { ...item, isEditing: true } : item)
2639
+ );
2640
+ };
2641
+ const handleSave = (id, type) => {
2642
+ setKpiList((prev) => {
2643
+ return prev.map((item) => {
2644
+ if (item.id === id) {
2645
+ let hasError = false;
2646
+ const errorsForItem = {};
2647
+ if (!item.name) {
2648
+ errorsForItem.name = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38";
2649
+ hasError = true;
2650
+ }
2651
+ if (type === "number") {
2652
+ if (!item.value) {
2653
+ errorsForItem.value = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38";
2654
+ hasError = true;
2655
+ }
2656
+ if (!item.unit) {
2657
+ errorsForItem.unit = "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38";
2658
+ hasError = true;
2659
+ }
2660
+ }
2661
+ if (hasError) {
2662
+ setItemErrors((prev2) => ({ ...prev2, [id]: errorsForItem }));
2663
+ return item;
2664
+ }
2665
+ setItemErrors((prev2) => {
2666
+ const copy = { ...prev2 };
2667
+ delete copy[id];
2668
+ return copy;
2669
+ });
2670
+ return { ...item, isEditing: false };
2671
+ }
2672
+ return item;
2673
+ });
2674
+ });
2675
+ };
2676
+ const handleCancel = (id) => {
2677
+ const backup = editingBackup[id];
2678
+ if (backup) {
2679
+ setKpiList(
2680
+ (prev) => prev.map(
2681
+ (item) => item.id === id ? { ...backup, isEditing: false } : item
2682
+ )
2683
+ );
2684
+ setEditingBackup((prev) => {
2685
+ const copy = { ...prev };
2686
+ delete copy[id];
2687
+ return copy;
2688
+ });
2689
+ } else {
2690
+ setKpiList(
2691
+ (prev) => prev.map(
2692
+ (item) => item.id === id ? { ...item, isEditing: false } : item
2693
+ )
2694
+ );
2695
+ }
2696
+ };
2697
+ const handleDelete = (id) => {
2698
+ setKpiList((prev) => prev.filter((item) => item.id !== id));
2699
+ };
2700
+ return {
2701
+ handleAddKpi,
2702
+ handleEdit,
2703
+ handleSave,
2704
+ handleCancel,
2705
+ handleDelete,
2706
+ nameKpi,
2707
+ setNameKpi,
2708
+ kpiValue,
2709
+ setKpiValue,
2710
+ unitValue,
2711
+ setUnitValue,
2712
+ kpiList,
2713
+ setKpiList,
2714
+ editingBackup,
2715
+ setEditingBackup,
2716
+ options,
2717
+ selected,
2718
+ setSelected,
2719
+ errors,
2720
+ setErrors,
2721
+ itemErrors,
2722
+ setItemErrors
2723
+ };
2724
+ }
2725
+
2726
+ // src/KpiSection/KpiSection.tsx
2727
+ import { IconCheck as IconCheck2, IconCirclePlus, IconPencil, IconTrash as IconTrash3, IconX as IconX2 } from "@tabler/icons-react";
2728
+ import { Fragment as Fragment6, jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
2729
+ function KpiSection({ type, onChangeKpiList }) {
2730
+ const {
2731
+ handleAddKpi,
2732
+ handleEdit,
2733
+ handleSave,
2734
+ handleCancel,
2735
+ handleDelete,
2736
+ nameKpi,
2737
+ setNameKpi,
2738
+ kpiValue,
2739
+ setKpiValue,
2740
+ unitValue,
2741
+ setUnitValue,
2742
+ kpiList,
2743
+ setKpiList,
2744
+ errors,
2745
+ itemErrors,
2746
+ setItemErrors
2747
+ } = useGetKpiSection();
2748
+ const [messageApi2, messageContainer] = message.useMessage();
2749
+ const [hasShownError, setHasShownError] = useState12(false);
2750
+ useEffect3(() => {
2751
+ setMessageApi(messageApi2);
2752
+ }, [messageApi2]);
2753
+ useEffect3(() => {
2754
+ if (onChangeKpiList) {
2755
+ onChangeKpiList(kpiList);
2756
+ }
2757
+ }, [kpiList]);
2758
+ return /* @__PURE__ */ jsx36(
2759
+ ConfigProvider17,
2760
+ {
2761
+ theme: {
2762
+ token: {
2763
+ fontFamily: "Kanit",
2764
+ fontSize: 16
2765
+ }
2766
+ },
2767
+ children: /* @__PURE__ */ jsxs31("div", { className: "container-input", children: [
2768
+ messageContainer,
2769
+ type === "number" && /* @__PURE__ */ jsxs31("div", { className: "space-y-4", children: [
2770
+ /* @__PURE__ */ jsxs31("div", { className: "grid grid-cols-[1fr_200px_200px_50px] w-full gap-[24px] items-start", children: [
2771
+ /* @__PURE__ */ jsx36(
2772
+ InputField,
2773
+ {
2774
+ value: nameKpi,
2775
+ label: "\u0E0A\u0E37\u0E48\u0E2D\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E17\u0E35\u0E48\u0E04\u0E32\u0E14\u0E2B\u0E27\u0E31\u0E07 (KPI)",
2776
+ placeholder: "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
2777
+ required: true,
2778
+ onChange: (value) => setNameKpi(value ?? ""),
2779
+ className: "h-[32px]",
2780
+ error: errors.nameKpi
2781
+ }
2782
+ ),
2783
+ /* @__PURE__ */ jsx36(
2784
+ InputField,
2785
+ {
2786
+ value: kpiValue,
2787
+ label: "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E17\u0E35\u0E48\u0E04\u0E32\u0E14\u0E2B\u0E27\u0E31\u0E07 (KPI)",
2788
+ placeholder: "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
2789
+ required: true,
2790
+ onChange: (value) => {
2791
+ if (value === void 0 || value === "") {
2792
+ setKpiValue("");
2793
+ setHasShownError(false);
2794
+ } else if (/^\d*\.?\d*$/.test(value)) {
2795
+ setKpiValue(value);
2796
+ setHasShownError(false);
2797
+ } else {
2798
+ if (!hasShownError) {
2799
+ messageError("\u0E01\u0E23\u0E38\u0E13\u0E32\u0E01\u0E23\u0E2D\u0E01\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E40\u0E17\u0E48\u0E32\u0E19\u0E31\u0E49\u0E19");
2800
+ setHasShownError(true);
2801
+ }
2802
+ }
2803
+ },
2804
+ error: errors.kpiValue
2805
+ }
2806
+ ),
2807
+ /* @__PURE__ */ jsx36(
2808
+ InputField,
2809
+ {
2810
+ value: unitValue,
2811
+ label: "\u0E2B\u0E19\u0E48\u0E27\u0E22",
2812
+ placeholder: "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
2813
+ required: true,
2814
+ onChange: (value) => setUnitValue(value ?? ""),
2815
+ className: "h-[32px]",
2816
+ error: errors.unitValue
2817
+ }
2818
+ ),
2819
+ /* @__PURE__ */ jsx36("div", { className: `flex justify-end mt-[28px]`, children: /* @__PURE__ */ jsx36(
2820
+ IconCirclePlus,
2821
+ {
2822
+ className: "w-[40px] h-[40px] cursor-pointer hover:scale-110 transition",
2823
+ stroke: 1,
2824
+ onClick: () => handleAddKpi(type)
2825
+ }
2826
+ ) })
2827
+ ] }),
2828
+ /* @__PURE__ */ jsx36("div", { children: kpiList.map((kpi, index) => /* @__PURE__ */ jsxs31(
2829
+ "div",
2830
+ {
2831
+ className: "grid grid-cols-[30px_1fr_100px_120px_80px] items-start py-2 body-1 gap-[8px]",
2832
+ children: [
2833
+ /* @__PURE__ */ jsxs31("p", { className: `body-1 ${kpi.isEditing ? "mt-[12px]" : ""}`, children: [
2834
+ index + 1,
2835
+ "."
2836
+ ] }),
2837
+ kpi.isEditing ? /* @__PURE__ */ jsxs31(Fragment6, { children: [
2838
+ /* @__PURE__ */ jsx36(
2839
+ InputField,
2840
+ {
2841
+ value: kpi.name,
2842
+ onChange: (value) => setKpiList(
2843
+ (prev) => prev.map((item) => item.id === kpi.id ? { ...item, name: value ?? "" } : item)
2844
+ ),
2845
+ error: itemErrors[kpi.id]?.name
2846
+ }
2847
+ ),
2848
+ /* @__PURE__ */ jsx36(
2849
+ InputField,
2850
+ {
2851
+ value: kpi.value?.toString(),
2852
+ onChange: (value) => {
2853
+ if (value === void 0 || value === "") {
2854
+ setKpiList(
2855
+ (prev) => prev.map((item) => item.id === kpi.id ? { ...item, value: "" } : item)
2856
+ );
2857
+ setHasShownError(false);
2858
+ } else if (/^\d*\.?\d*$/.test(value)) {
2859
+ setKpiList(
2860
+ (prev) => prev.map((item) => item.id === kpi.id ? { ...item, value } : item)
2861
+ );
2862
+ setHasShownError(false);
2863
+ } else {
2864
+ if (!hasShownError) {
2865
+ messageError("\u0E01\u0E23\u0E38\u0E13\u0E32\u0E01\u0E23\u0E2D\u0E01\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E40\u0E17\u0E48\u0E32\u0E19\u0E31\u0E49\u0E19");
2866
+ setHasShownError(true);
2867
+ }
2868
+ }
2869
+ },
2870
+ error: itemErrors[kpi.id]?.value
2871
+ }
2872
+ ),
2873
+ /* @__PURE__ */ jsx36(
2874
+ InputField,
2875
+ {
2876
+ value: kpi.unit,
2877
+ onChange: (value) => setKpiList(
2878
+ (prev) => prev.map((item) => item.id === kpi.id ? { ...item, unit: value ?? "" } : item)
2879
+ ),
2880
+ error: itemErrors[kpi.id]?.unit
2881
+ }
2882
+ ),
2883
+ /* @__PURE__ */ jsxs31(
2884
+ "div",
2885
+ {
2886
+ className: `flex gap-2 justify-end self-center ${!!itemErrors[kpi.id]?.value || !!itemErrors[kpi.id]?.unit || !!itemErrors[kpi.id]?.name ? "mt-[-12px]" : ""}`,
2887
+ children: [
2888
+ /* @__PURE__ */ jsx36(
2889
+ IconCheck2,
2890
+ {
2891
+ className: "w-[30px] h-[30px] cursor-pointer",
2892
+ onClick: () => handleSave(kpi.id, type)
2893
+ }
2894
+ ),
2895
+ /* @__PURE__ */ jsx36(IconX2, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleCancel(kpi.id) })
2896
+ ]
2897
+ }
2898
+ )
2899
+ ] }) : /* @__PURE__ */ jsxs31(Fragment6, { children: [
2900
+ /* @__PURE__ */ jsx36("p", { className: "body-1", children: kpi.name }),
2901
+ /* @__PURE__ */ jsx36("p", { className: "body-1", children: kpi.value }),
2902
+ /* @__PURE__ */ jsx36("p", { className: "body-1", children: kpi.unit }),
2903
+ /* @__PURE__ */ jsxs31("div", { className: "flex gap-3 justify-end", children: [
2904
+ /* @__PURE__ */ jsx36(IconPencil, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleEdit(kpi.id) }),
2905
+ /* @__PURE__ */ jsx36(IconTrash3, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleDelete(kpi.id) })
2906
+ ] })
2907
+ ] })
2908
+ ]
2909
+ },
2910
+ kpi.id
2911
+ )) })
2912
+ ] }),
2913
+ type === "text" && /* @__PURE__ */ jsxs31("div", { className: "space-y-4", children: [
2914
+ /* @__PURE__ */ jsxs31("div", { className: "grid grid-cols-[1fr_50px] w-full gap-[24px] items-start", children: [
2915
+ /* @__PURE__ */ jsx36(
2916
+ InputField,
2917
+ {
2918
+ value: nameKpi,
2919
+ label: "\u0E0A\u0E37\u0E48\u0E2D\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C\u0E17\u0E35\u0E48\u0E04\u0E32\u0E14\u0E2B\u0E27\u0E31\u0E07 (KPI)",
2920
+ placeholder: "\u0E42\u0E1B\u0E23\u0E14\u0E23\u0E30\u0E1A\u0E38",
2921
+ required: true,
2922
+ onChange: (value) => setNameKpi(value ?? ""),
2923
+ className: "h-[32px]",
2924
+ error: errors.nameKpi
2925
+ }
2926
+ ),
2927
+ /* @__PURE__ */ jsx36("div", { className: `flex justify-end mt-[28px]`, children: /* @__PURE__ */ jsx36(
2928
+ IconCirclePlus,
2929
+ {
2930
+ className: "w-[40px] h-[40px] cursor-pointer hover:scale-110 transition",
2931
+ stroke: 1,
2932
+ onClick: () => handleAddKpi(type)
2933
+ }
2934
+ ) })
2935
+ ] }),
2936
+ /* @__PURE__ */ jsx36("div", { children: kpiList.map((kpi, index) => /* @__PURE__ */ jsxs31("div", { className: "grid grid-cols-[30px_1fr_80px] items-start py-2 body-1 gap-[8px]", children: [
2937
+ /* @__PURE__ */ jsxs31("p", { className: `body-1 ${kpi.isEditing ? "mt-[12px]" : ""}`, children: [
2938
+ index + 1,
2939
+ "."
2940
+ ] }),
2941
+ kpi.isEditing ? /* @__PURE__ */ jsxs31(Fragment6, { children: [
2942
+ /* @__PURE__ */ jsx36(
2943
+ InputField,
2944
+ {
2945
+ value: kpi.name,
2946
+ onChange: (value) => setKpiList(
2947
+ (prev) => prev.map((item) => item.id === kpi.id ? { ...item, name: value ?? "" } : item)
2948
+ ),
2949
+ error: itemErrors[kpi.id]?.name
2950
+ }
2951
+ ),
2952
+ /* @__PURE__ */ jsxs31(
2953
+ "div",
2954
+ {
2955
+ className: `flex gap-2 justify-end self-center ${!!itemErrors[kpi.id]?.name ? "mt-[-12px]" : ""}`,
2956
+ children: [
2957
+ /* @__PURE__ */ jsx36(
2958
+ IconCheck2,
2959
+ {
2960
+ className: "w-[30px] h-[30px] cursor-pointer",
2961
+ onClick: () => handleSave(kpi.id, type)
2962
+ }
2963
+ ),
2964
+ /* @__PURE__ */ jsx36(IconX2, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleCancel(kpi.id) })
2965
+ ]
2966
+ }
2967
+ )
2968
+ ] }) : /* @__PURE__ */ jsxs31(Fragment6, { children: [
2969
+ /* @__PURE__ */ jsx36("p", { className: "body-1", children: kpi.name }),
2970
+ /* @__PURE__ */ jsxs31("div", { className: "flex gap-3 justify-end", children: [
2971
+ /* @__PURE__ */ jsx36(IconPencil, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleEdit(kpi.id) }),
2972
+ /* @__PURE__ */ jsx36(IconTrash3, { className: "w-[30px] h-[30px] cursor-pointer", onClick: () => handleDelete(kpi.id) })
2973
+ ] })
2974
+ ] })
2975
+ ] }, kpi.id)) })
2976
+ ] })
2977
+ ] })
2978
+ }
2979
+ );
2980
+ }
2981
+
2982
+ // src/Modal/Modal/Modal.tsx
2983
+ import { Modal } from "antd";
2984
+ import { jsx as jsx37 } from "react/jsx-runtime";
2985
+ function AntDModal({ children, isOpen, width, onCancel }) {
2986
+ return /* @__PURE__ */ jsx37("div", { children: /* @__PURE__ */ jsx37(Modal, { open: isOpen, onCancel, width, centered: true, footer: null, children: /* @__PURE__ */ jsx37("div", { children }) }) });
2987
+ }
2988
+
2989
+ // src/Indicator/Indicator/Indicator.tsx
2990
+ import { IconCheck as IconCheck3, IconCirclePlus as IconCirclePlus2, IconPencil as IconPencil2, IconTrash as IconTrash4, IconX as IconX3 } from "@tabler/icons-react";
2991
+ import { useState as useState13 } from "react";
2992
+ import { Input as Input4 } from "antd";
2993
+ import { Fragment as Fragment7, jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
2994
+ function Indicator({
2995
+ option = [
2996
+ { value: "TEXT", label: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21" },
2997
+ { value: "NUMBER", label: "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02" }
2998
+ ],
2999
+ type,
3000
+ arrayData,
3001
+ setArrayData
3002
+ }) {
3003
+ const [valueSwitch, setValueSwitch] = useState13("TEXT");
3004
+ const [cacheData, setCacheData] = useState13({
3005
+ indicatorType: type,
3006
+ inputType: valueSwitch,
3007
+ textValue: "",
3008
+ numberValue: "",
3009
+ unit: ""
3010
+ });
3011
+ const [cacheEditData, setCacheEditData] = useState13({
3012
+ indicatorType: type,
3013
+ inputType: valueSwitch,
3014
+ textValue: "",
3015
+ numberValue: "",
3016
+ unit: ""
3017
+ });
3018
+ const [editIndex, setEditIndex] = useState13(null);
3019
+ const handleAddIndicator = () => {
3020
+ if (cacheData.textValue.trim() === "") return;
3021
+ setArrayData([
3022
+ ...arrayData,
3023
+ valueSwitch === "TEXT" ? {
3024
+ indicatorType: type,
3025
+ inputType: "TEXT",
3026
+ textValue: cacheData.textValue
3027
+ } : cacheData
3028
+ ]);
3029
+ setCacheData({
3030
+ indicatorType: type,
3031
+ inputType: valueSwitch,
3032
+ textValue: "",
3033
+ numberValue: "",
3034
+ unit: ""
3035
+ });
3036
+ };
3037
+ const handleChangeCashData = (key, value) => {
3038
+ setCacheData((prev) => ({
3039
+ ...prev,
3040
+ [key]: value
3041
+ }));
3042
+ console.log(cacheData);
3043
+ };
3044
+ const handleClick = (active) => {
3045
+ handleChangeCashData("inputType", active);
3046
+ setValueSwitch(active);
3047
+ };
3048
+ const handleDeleteIndicator = (index) => {
3049
+ const newData = arrayData.filter((_, i) => i !== index);
3050
+ setArrayData(newData);
3051
+ setEditIndex(null);
3052
+ };
3053
+ const handleEditIndicator = (index) => {
3054
+ setCacheEditData(arrayData[index]);
3055
+ setEditIndex(index);
3056
+ };
3057
+ const handleCancelEditIndicator = () => {
3058
+ setEditIndex(null);
3059
+ };
3060
+ const handleConfirmEditIndicator = (index) => {
3061
+ if (cacheEditData.textValue.trim() === "") return;
3062
+ const newData = [...arrayData];
3063
+ newData[index] = cacheEditData;
3064
+ setArrayData(newData);
3065
+ setEditIndex(null);
3066
+ };
3067
+ const handleChangeEditCashData = (e) => {
3068
+ const { name, value } = e.target;
3069
+ setCacheEditData((prev) => ({
3070
+ ...prev,
3071
+ [name]: value
3072
+ }));
3073
+ console.log(cacheEditData);
3074
+ };
3075
+ return /* @__PURE__ */ jsxs32("div", { className: "w-full", children: [
3076
+ /* @__PURE__ */ jsxs32(
3077
+ "div",
3078
+ {
3079
+ className: `space-x-2 grid ${valueSwitch === "TEXT" ? `grid-cols-[140px_1fr_50px]` : `grid-cols-[140px_1fr_200px_200px_50px]`} items-start`,
3080
+ children: [
3081
+ /* @__PURE__ */ jsx38(SwitchSelect, { option, onClick: handleClick, value: valueSwitch, label: "\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17", required: true }),
3082
+ /* @__PURE__ */ jsx38(
3083
+ InputField,
3084
+ {
3085
+ label: `\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
3086
+ value: cacheData.textValue,
3087
+ className: "h-[32px]",
3088
+ onChange: (e) => handleChangeCashData("textValue", String(e)),
3089
+ placeholder: `\u0E23\u0E30\u0E1A\u0E38\u0E0A\u0E37\u0E48\u0E2D\u0E15\u0E31\u0E27\u0E0A\u0E35\u0E49\u0E27\u0E31\u0E14${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
3090
+ required: true
3091
+ }
3092
+ ),
3093
+ valueSwitch === "NUMBER" && /* @__PURE__ */ jsxs32(Fragment7, { children: [
3094
+ /* @__PURE__ */ jsx38(
3095
+ InputFieldNumber,
3096
+ {
3097
+ label: `\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
3098
+ value: cacheData.numberValue ?? "",
3099
+ className: "h-[32px]",
3100
+ onChange: (e) => handleChangeCashData("numberValue", String(e)),
3101
+ placeholder: `\u0E23\u0E30\u0E1A\u0E38\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22${type === "OUTPUT" ? "\u0E1C\u0E25\u0E1C\u0E25\u0E34\u0E15" : "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C"}`,
3102
+ required: true
3103
+ }
3104
+ ),
3105
+ /* @__PURE__ */ jsx38(
3106
+ InputField,
3107
+ {
3108
+ label: `\u0E2B\u0E19\u0E48\u0E27\u0E22`,
3109
+ value: cacheData.unit ?? "",
3110
+ className: "h-[32px]",
3111
+ onChange: (e) => handleChangeCashData("unit", String(e)),
3112
+ placeholder: "\u0E23\u0E30\u0E1A\u0E38\u0E2B\u0E19\u0E48\u0E27\u0E22",
3113
+ required: true
3114
+ }
3115
+ )
3116
+ ] }),
3117
+ /* @__PURE__ */ jsx38(IconCirclePlus2, { onClick: handleAddIndicator, className: "mt-7 cursor-pointer", size: 32 })
3118
+ ]
3119
+ }
3120
+ ),
3121
+ /* @__PURE__ */ jsx38(Fragment7, { children: arrayData.map((item, index) => /* @__PURE__ */ jsxs32(
3122
+ "div",
3123
+ {
3124
+ className: `space-y-4 grid ${item.inputType === "TEXT" ? `grid-cols-[140px_1fr_50px_50px]` : `grid-cols-[140px_1fr_200px_150px_50px_50px]`} items-start`,
3125
+ children: [
3126
+ /* @__PURE__ */ jsx38("div", { className: "body-1 mt-2", children: item.inputType === "TEXT" ? "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21" : "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02" }),
3127
+ index === editIndex ? /* @__PURE__ */ jsx38(
3128
+ Input4,
3129
+ {
3130
+ className: "body-1 mt-2",
3131
+ variant: "underlined",
3132
+ value: cacheEditData.textValue,
3133
+ name: "textValue",
3134
+ onChange: (e) => handleChangeEditCashData(e)
3135
+ }
3136
+ ) : /* @__PURE__ */ jsx38("div", { className: "body-1 mt-2", children: item.textValue }),
3137
+ item.inputType === "NUMBER" && /* @__PURE__ */ jsxs32(Fragment7, { children: [
3138
+ index === editIndex ? /* @__PURE__ */ jsx38(
3139
+ Input4,
3140
+ {
3141
+ className: "body-1 mt-2",
3142
+ variant: "underlined",
3143
+ value: cacheEditData.numberValue,
3144
+ name: "numberValue",
3145
+ onChange: (e) => handleChangeEditCashData(e)
3146
+ }
3147
+ ) : /* @__PURE__ */ jsx38("div", { className: "body-1 mt-2", children: item.numberValue }),
3148
+ index === editIndex ? /* @__PURE__ */ jsx38(
3149
+ Input4,
3150
+ {
3151
+ className: "body-1 mt-2",
3152
+ variant: "underlined",
3153
+ value: cacheEditData.unit,
3154
+ name: "unit",
3155
+ onChange: (e) => handleChangeEditCashData(e)
3156
+ }
3157
+ ) : /* @__PURE__ */ jsx38("div", { className: "body-1 mt-2", children: item.unit })
3158
+ ] }),
3159
+ /* @__PURE__ */ jsx38("div", { className: "body-1 mt-2 flex", children: editIndex !== null ? editIndex === index ? /* @__PURE__ */ jsxs32("div", { className: "flex", children: [
3160
+ /* @__PURE__ */ jsx38(
3161
+ IconCheck3,
3162
+ {
3163
+ className: "cursor-pointer text-green-600",
3164
+ onClick: () => handleConfirmEditIndicator(index)
3165
+ }
3166
+ ),
3167
+ /* @__PURE__ */ jsx38(IconX3, { className: "cursor-pointer text-red-600", onClick: handleCancelEditIndicator })
3168
+ ] }) : void 0 : /* @__PURE__ */ jsx38(IconPencil2, { className: "cursor-pointer", onClick: () => handleEditIndicator(index) }) }),
3169
+ /* @__PURE__ */ jsx38("div", { className: "body-1 mt-2 cursor-pointer", children: /* @__PURE__ */ jsx38(IconTrash4, { onClick: () => handleDeleteIndicator(index) }) })
3170
+ ]
3171
+ }
3172
+ )) })
3173
+ ] });
3174
+ }
3175
+
3176
+ // src/FilterPopUp/FilterPopUp.tsx
3177
+ import { IconCheck as IconCheck4, IconFilter as IconFilter2, IconTrash as IconTrash5 } from "@tabler/icons-react";
3178
+ import { useState as useState14 } from "react";
3179
+ import { jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
3180
+ var FilterPopUp = (filter) => {
3181
+ const [isAction, setIsAction] = useState14(true);
3182
+ const [filterArray, setFilterArray] = useState14([""]);
3183
+ const handleClearFilter = () => {
3184
+ setFilterArray([]);
3185
+ };
3186
+ const handleSubmitFilter = () => {
3187
+ filter.handleSearch(filterArray);
3188
+ };
3189
+ return /* @__PURE__ */ jsxs33("div", { className: "relative", children: [
3190
+ /* @__PURE__ */ jsxs33("button", { className: "flex px-2 py-1 rounded-lg border-1", onClick: () => setIsAction(!isAction), children: [
3191
+ /* @__PURE__ */ jsx39(IconFilter2, {}),
3192
+ "filter"
3193
+ ] }),
3194
+ isAction ? /* @__PURE__ */ jsxs33("div", { className: "absolute bg-white p-5 rounded-lg shadow-2xl w-[600px]", children: [
3195
+ /* @__PURE__ */ jsxs33("div", { className: "flex justify-end", children: [
3196
+ /* @__PURE__ */ jsxs33("div", { className: "flex justify-end text-nowrap gap-2", children: [
3197
+ /* @__PURE__ */ jsx39(GhostButton, { title: "\u0E43\u0E0A\u0E49\u0E1F\u0E34\u0E25\u0E40\u0E15\u0E2D\u0E23\u0E4C", onClick: handleSubmitFilter, iconLeft: /* @__PURE__ */ jsx39(IconCheck4, {}) }),
3198
+ /* @__PURE__ */ jsx39(GhostButton, { title: "\u0E25\u0E49\u0E32\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14", onClick: handleClearFilter, iconLeft: /* @__PURE__ */ jsx39(IconTrash5, {}) })
3199
+ ] }),
3200
+ ""
3201
+ ] }),
3202
+ /* @__PURE__ */ jsx39(
3203
+ SelectCustom,
3204
+ {
3205
+ options: filter.selectionFilter,
3206
+ onChange: (list) => setFilterArray(list),
3207
+ label: "\u0E04\u0E49\u0E19\u0E2B\u0E32\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01"
3208
+ }
3209
+ )
3210
+ ] }) : void 0
3211
+ ] });
3212
+ };
3213
+ export {
3214
+ AntDModal,
3215
+ AntDataTable,
3216
+ Breadcrumbs,
3217
+ Calendar,
3218
+ Checkbox,
3219
+ CheckboxGroup,
3220
+ ColorPalettePickerBasic,
3221
+ ColorPickerBasic,
3222
+ DataTable,
3223
+ FileUploader,
3224
+ FilterPopUp,
3225
+ GhostButton,
3226
+ HeadingPage,
3227
+ Indicator,
3228
+ InputField,
3229
+ InputFieldNumber,
3230
+ KpiSection,
3231
+ Loader,
3232
+ MenuNavBar,
3233
+ PrimaryButton,
3234
+ ProgressBar,
3235
+ Radio,
3236
+ RadioGroup,
3237
+ SecondaryButton,
3238
+ SelectCustom,
3239
+ SelectField,
3240
+ SelectFieldGroup,
3241
+ SelectFieldStatus,
3242
+ SelectFieldStatusReport,
3243
+ SelectFieldTag,
3244
+ Sidebar,
3245
+ SortFilter,
3246
+ Switch,
3247
+ SwitchSelect,
3248
+ TabSelectionButton,
3249
+ TextAreaInput,
3250
+ TextInput,
3251
+ TopNavBar,
3252
+ messageError,
3253
+ messageInfo,
3254
+ messageLoading,
3255
+ messageSuccess,
3256
+ messageWarning,
3257
+ setMessageApi
3258
+ };