@esic-lab/data-core-ui 0.0.41 → 0.0.42

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.css CHANGED
@@ -32,6 +32,7 @@
32
32
  --color-green-400: #69c57d;
33
33
  --color-green-500: #43b75d;
34
34
  --color-green-600: #3da755;
35
+ --color-blue-100: #b0deff;
35
36
  --color-blue-500: #0095ff;
36
37
  --color-blue-800: #00528c;
37
38
  --color-indigo-100: oklch(93% 0.034 272.788);
@@ -348,9 +349,15 @@
348
349
  .mr-\[8px\] {
349
350
  margin-right: 8px;
350
351
  }
352
+ .mb-1 {
353
+ margin-bottom: calc(var(--spacing) * 1);
354
+ }
351
355
  .mb-2 {
352
356
  margin-bottom: calc(var(--spacing) * 2);
353
357
  }
358
+ .mb-3 {
359
+ margin-bottom: calc(var(--spacing) * 3);
360
+ }
354
361
  .mb-4 {
355
362
  margin-bottom: calc(var(--spacing) * 4);
356
363
  }
@@ -495,6 +502,9 @@
495
502
  .w-64 {
496
503
  width: calc(var(--spacing) * 64);
497
504
  }
505
+ .w-80 {
506
+ width: calc(var(--spacing) * 80);
507
+ }
498
508
  .w-\[10px\] {
499
509
  width: 10px;
500
510
  }
@@ -618,6 +628,9 @@
618
628
  .grid-cols-3 {
619
629
  grid-template-columns: repeat(3, minmax(0, 1fr));
620
630
  }
631
+ .grid-cols-7 {
632
+ grid-template-columns: repeat(7, minmax(0, 1fr));
633
+ }
621
634
  .grid-cols-\[1fr_50px\] {
622
635
  grid-template-columns: 1fr 50px;
623
636
  }
@@ -666,6 +679,9 @@
666
679
  .justify-start {
667
680
  justify-content: flex-start;
668
681
  }
682
+ .gap-1 {
683
+ gap: calc(var(--spacing) * 1);
684
+ }
669
685
  .gap-2 {
670
686
  gap: calc(var(--spacing) * 2);
671
687
  }
@@ -977,6 +993,9 @@
977
993
  .pb-2 {
978
994
  padding-bottom: calc(var(--spacing) * 2);
979
995
  }
996
+ .text-center {
997
+ text-align: center;
998
+ }
980
999
  .text-left {
981
1000
  text-align: left;
982
1001
  }
@@ -1093,6 +1112,15 @@
1093
1112
  var(--tw-ring-shadow),
1094
1113
  var(--tw-shadow);
1095
1114
  }
1115
+ .shadow-xl {
1116
+ --tw-shadow: 0 20px 25px -5px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 8px 10px -6px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
1117
+ box-shadow:
1118
+ var(--tw-inset-shadow),
1119
+ var(--tw-inset-ring-shadow),
1120
+ var(--tw-ring-offset-shadow),
1121
+ var(--tw-ring-shadow),
1122
+ var(--tw-shadow);
1123
+ }
1096
1124
  .outline {
1097
1125
  outline-style: var(--tw-outline-style);
1098
1126
  outline-width: 1px;
@@ -1288,6 +1316,13 @@
1288
1316
  }
1289
1317
  }
1290
1318
  }
1319
+ .hover\:bg-blue-100 {
1320
+ &:hover {
1321
+ @media (hover: hover) {
1322
+ background-color: var(--color-blue-100);
1323
+ }
1324
+ }
1325
+ }
1291
1326
  .hover\:bg-gray-100 {
1292
1327
  &:hover {
1293
1328
  @media (hover: hover) {
package/dist/index.d.mts CHANGED
@@ -271,7 +271,7 @@ interface DatePickerBasicProps {
271
271
  className?: string;
272
272
  size?: "small" | "middle" | "large";
273
273
  }
274
- declare function DatePickerBasic({ value, onChange, required, label, error, placeholder, disabled, defaultValue, minDate, maxDate, disabledDate, className, size, }: DatePickerBasicProps): react_jsx_runtime.JSX.Element;
274
+ declare function DatePickerBasic({ value, onChange, label, required, error, disabled, placeholder, minDate, maxDate, disabledDate, }: DatePickerBasicProps): react_jsx_runtime.JSX.Element;
275
275
 
276
276
  interface ColorPickerProps {
277
277
  value: string | null;
package/dist/index.d.ts CHANGED
@@ -271,7 +271,7 @@ interface DatePickerBasicProps {
271
271
  className?: string;
272
272
  size?: "small" | "middle" | "large";
273
273
  }
274
- declare function DatePickerBasic({ value, onChange, required, label, error, placeholder, disabled, defaultValue, minDate, maxDate, disabledDate, className, size, }: DatePickerBasicProps): react_jsx_runtime.JSX.Element;
274
+ declare function DatePickerBasic({ value, onChange, label, required, error, disabled, placeholder, minDate, maxDate, disabledDate, }: DatePickerBasicProps): react_jsx_runtime.JSX.Element;
275
275
 
276
276
  interface ColorPickerProps {
277
277
  value: string | null;
package/dist/index.js CHANGED
@@ -1285,68 +1285,114 @@ function InputFieldNumber({
1285
1285
  }
1286
1286
 
1287
1287
  // src/DatePicker/DatePickerBasic/DatePickerBasic.tsx
1288
- var import_antd5 = require("antd");
1288
+ var import_react8 = require("react");
1289
1289
  var import_dayjs = __toESM(require_dayjs_min());
1290
1290
  var import_th2 = __toESM(require_th());
1291
+ var import_buddhistEra = __toESM(require_buddhistEra());
1291
1292
  var import_date_fns = require("date-fns");
1292
1293
  var import_locale = require("date-fns/locale");
1293
- var import_th_TH = __toESM(require("antd/es/date-picker/locale/th_TH"));
1294
- var import_buddhistEra = __toESM(require_buddhistEra());
1295
1294
  var import_jsx_runtime23 = require("react/jsx-runtime");
1296
1295
  import_dayjs.default.extend(import_buddhistEra.default);
1297
- var buddhistLocale = {
1298
- ...import_th_TH.default,
1299
- lang: {
1300
- ...import_th_TH.default.lang,
1301
- fieldDateFormat: "BBBB-MM-DD",
1302
- fieldDateTimeFormat: "BBBB-MM-DD HH:mm:ss",
1303
- yearFormat: "BBBB",
1304
- cellYearFormat: "BBBB"
1305
- }
1306
- };
1296
+ import_dayjs.default.locale("th");
1307
1297
  function DatePickerBasic({
1308
1298
  value,
1309
1299
  onChange,
1310
- required,
1311
1300
  label,
1301
+ required,
1312
1302
  error,
1313
- placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
1314
1303
  disabled,
1315
- defaultValue,
1304
+ placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
1316
1305
  minDate,
1317
1306
  maxDate,
1318
- disabledDate,
1319
- className,
1320
- size = "middle"
1307
+ disabledDate
1321
1308
  }) {
1322
- const formatToThaiBE = (date) => {
1309
+ const [open, setOpen] = (0, import_react8.useState)(false);
1310
+ const current = value ? (0, import_dayjs.default)(value) : null;
1311
+ const today = (0, import_dayjs.default)();
1312
+ const formatThaiBE = (date) => {
1323
1313
  const formatted = (0, import_date_fns.format)(date, "dd MMMM yyyy", { locale: import_locale.th });
1324
- const year = parseInt((0, import_date_fns.format)(date, "yyyy"));
1325
- const yearBE = year + 543;
1326
- return formatted.replace(/\d{4}$/, String(yearBE));
1314
+ const year = parseInt((0, import_date_fns.format)(date, "yyyy")) + 543;
1315
+ return formatted.replace(/\d{4}$/, String(year));
1316
+ };
1317
+ const monthNames = [
1318
+ "\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21",
1319
+ "\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C",
1320
+ "\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21",
1321
+ "\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19",
1322
+ "\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21",
1323
+ "\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19",
1324
+ "\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21",
1325
+ "\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21",
1326
+ "\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19",
1327
+ "\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21",
1328
+ "\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19",
1329
+ "\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21"
1330
+ ];
1331
+ const [calendar, setCalendar] = (0, import_react8.useState)(current || today);
1332
+ const daysInMonth = calendar.daysInMonth();
1333
+ const firstDayOfMonth = calendar.startOf("month").day();
1334
+ const isDisabled = (date) => {
1335
+ if (disabledDate && disabledDate(date.toDate())) return true;
1336
+ if (minDate && date.isBefore((0, import_dayjs.default)(minDate), "day")) return true;
1337
+ if (maxDate && date.isAfter((0, import_dayjs.default)(maxDate), "day")) return true;
1338
+ return false;
1327
1339
  };
1328
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "container-input", style: { fontFamily: "Kanit", fontSize: 16 }, children: [
1329
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
1340
+ const handleSelect = (d) => {
1341
+ const selected = calendar.date(d);
1342
+ if (isDisabled(selected)) return;
1343
+ onChange(selected.toDate());
1344
+ setOpen(false);
1345
+ };
1346
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { fontFamily: "Kanit", fontSize: 16 }, className: "relative w-full", children: [
1347
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mb-1", children: [
1330
1348
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "body-1", children: label }),
1331
1349
  required && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-red-500", children: "*" })
1332
1350
  ] }),
1333
1351
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1334
- import_antd5.DatePicker,
1352
+ "div",
1335
1353
  {
1336
- className: `body-1 w-full ${className ?? ""}`,
1337
- placeholder,
1338
- disabled,
1339
- allowClear: true,
1340
- size,
1341
- value: value ? (0, import_dayjs.default)(value) : null,
1342
- defaultValue: defaultValue ? (0, import_dayjs.default)(defaultValue) : void 0,
1343
- minDate: minDate ? (0, import_dayjs.default)(minDate) : void 0,
1344
- maxDate: maxDate ? (0, import_dayjs.default)(maxDate) : void 0,
1345
- disabledDate: (d) => disabledDate ? disabledDate(d.toDate()) : false,
1346
- onChange: (d) => onChange(d ? d.toDate() : null),
1347
- format: (d) => d ? formatToThaiBE(d.toDate()) : "",
1348
- locale: buddhistLocale,
1349
- style: { fontFamily: "Kanit", fontSize: 16 }
1354
+ className: `border rounded px-3 py-2 cursor-pointer bg-white ${disabled ? "opacity-50" : ""}`,
1355
+ onClick: () => !disabled && setOpen(!open),
1356
+ children: value ? formatThaiBE(value) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-gray-400", children: placeholder })
1357
+ }
1358
+ ),
1359
+ open && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1360
+ "div",
1361
+ {
1362
+ className: "absolute z-50 mt-2 w-80 p-4 bg-white shadow-xl rounded-lg border",
1363
+ style: { fontFamily: "Kanit", fontSize: 16 },
1364
+ children: [
1365
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between items-center mb-3", children: [
1366
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { onClick: () => setCalendar(calendar.subtract(1, "month")), className: "px-2", children: "\u25C0" }),
1367
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "font-semibold", children: [
1368
+ monthNames[calendar.month()],
1369
+ " ",
1370
+ calendar.year() + 543
1371
+ ] }),
1372
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { onClick: () => setCalendar(calendar.add(1, "month")), className: "px-2", children: "\u25B6" })
1373
+ ] }),
1374
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "grid grid-cols-7 text-center text-gray-600 mb-2", children: ["\u0E2D\u0E32", "\u0E08", "\u0E2D", "\u0E1E", "\u0E1E\u0E24", "\u0E28", "\u0E2A"].map((d) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: d }, d)) }),
1375
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "grid grid-cols-7 gap-1 text-center", children: [
1376
+ Array(firstDayOfMonth).fill(null).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", {}, `empty-${i}`)),
1377
+ Array.from({ length: daysInMonth }, (_, i) => i + 1).map((d) => {
1378
+ const dateObj = calendar.date(d);
1379
+ const disabled2 = isDisabled(dateObj);
1380
+ const selected = current && dateObj.isSame(current, "day");
1381
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1382
+ "div",
1383
+ {
1384
+ onClick: () => !disabled2 && handleSelect(d),
1385
+ className: `py-1 rounded cursor-pointer
1386
+ ${selected ? "bg-blue-500 text-white" : ""}
1387
+ ${disabled2 ? "text-gray-400 cursor-not-allowed" : "hover:bg-blue-100"}
1388
+ `,
1389
+ children: d
1390
+ },
1391
+ d
1392
+ );
1393
+ })
1394
+ ] })
1395
+ ]
1350
1396
  }
1351
1397
  ),
1352
1398
  error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-red-500 caption-1", children: error })
@@ -1354,7 +1400,7 @@ function DatePickerBasic({
1354
1400
  }
1355
1401
 
1356
1402
  // src/ColorPicker/ColorPickerBasic/ColorPicker.tsx
1357
- var import_antd6 = require("antd");
1403
+ var import_antd5 = require("antd");
1358
1404
  var import_jsx_runtime24 = require("react/jsx-runtime");
1359
1405
  function ColorPickerBasic({
1360
1406
  value,
@@ -1369,7 +1415,7 @@ function ColorPickerBasic({
1369
1415
  placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2A\u0E35"
1370
1416
  }) {
1371
1417
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1372
- import_antd6.ConfigProvider,
1418
+ import_antd5.ConfigProvider,
1373
1419
  {
1374
1420
  theme: {
1375
1421
  token: {
@@ -1384,7 +1430,7 @@ function ColorPickerBasic({
1384
1430
  required && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-red-500", children: "*" })
1385
1431
  ] }),
1386
1432
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1387
- import_antd6.ColorPicker,
1433
+ import_antd5.ColorPicker,
1388
1434
  {
1389
1435
  defaultFormat,
1390
1436
  className: `body-1 w-full ${className ?? ""}`,
@@ -1413,7 +1459,7 @@ function ColorPickerBasic({
1413
1459
  }
1414
1460
 
1415
1461
  // src/ColorPicker/ColorPalettePickerBasic/ColorPalettePickerBasic.tsx
1416
- var import_antd7 = require("antd");
1462
+ var import_antd6 = require("antd");
1417
1463
 
1418
1464
  // node_modules/@babel/runtime/helpers/esm/typeof.js
1419
1465
  function _typeof(o) {
@@ -2136,14 +2182,14 @@ function ColorPalettePickerBasic({
2136
2182
  placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2A\u0E35",
2137
2183
  onClear
2138
2184
  }) {
2139
- const { token } = import_antd7.theme.useToken();
2185
+ const { token } = import_antd6.theme.useToken();
2140
2186
  const presets = genPresets({
2141
2187
  primary: generate(token.colorPrimary),
2142
2188
  red,
2143
2189
  green
2144
2190
  });
2145
2191
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2146
- import_antd7.ConfigProvider,
2192
+ import_antd6.ConfigProvider,
2147
2193
  {
2148
2194
  theme: {
2149
2195
  token: {
@@ -2158,7 +2204,7 @@ function ColorPalettePickerBasic({
2158
2204
  required && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-red-500", children: "*" })
2159
2205
  ] }),
2160
2206
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2161
- import_antd7.ColorPicker,
2207
+ import_antd6.ColorPicker,
2162
2208
  {
2163
2209
  defaultFormat,
2164
2210
  className: `body-1 w-full ${className ?? ""}`,
@@ -2189,7 +2235,7 @@ function ColorPalettePickerBasic({
2189
2235
  }
2190
2236
 
2191
2237
  // src/Select/SelectField/SelectField.tsx
2192
- var import_antd8 = require("antd");
2238
+ var import_antd7 = require("antd");
2193
2239
  var import_jsx_runtime26 = require("react/jsx-runtime");
2194
2240
  function SelectField({
2195
2241
  value,
@@ -2209,7 +2255,7 @@ function SelectField({
2209
2255
  onClear
2210
2256
  }) {
2211
2257
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2212
- import_antd8.ConfigProvider,
2258
+ import_antd7.ConfigProvider,
2213
2259
  {
2214
2260
  theme: {
2215
2261
  token: {
@@ -2224,7 +2270,7 @@ function SelectField({
2224
2270
  required && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-red-500", children: "*" })
2225
2271
  ] }),
2226
2272
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2227
- import_antd8.Select,
2273
+ import_antd7.Select,
2228
2274
  {
2229
2275
  showSearch: true,
2230
2276
  value,
@@ -2262,7 +2308,7 @@ function SelectField({
2262
2308
  }
2263
2309
 
2264
2310
  // src/Select/SelectFieldGroup/SelectFieldGroup.tsx
2265
- var import_antd9 = require("antd");
2311
+ var import_antd8 = require("antd");
2266
2312
  var import_jsx_runtime27 = require("react/jsx-runtime");
2267
2313
  function SelectFieldGroup({
2268
2314
  value,
@@ -2281,7 +2327,7 @@ function SelectFieldGroup({
2281
2327
  className
2282
2328
  }) {
2283
2329
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2284
- import_antd9.ConfigProvider,
2330
+ import_antd8.ConfigProvider,
2285
2331
  {
2286
2332
  theme: {
2287
2333
  token: {
@@ -2295,7 +2341,7 @@ function SelectFieldGroup({
2295
2341
  required && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-red-500", children: "*" })
2296
2342
  ] }),
2297
2343
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2298
- import_antd9.Select,
2344
+ import_antd8.Select,
2299
2345
  {
2300
2346
  showSearch: true,
2301
2347
  value,
@@ -2332,7 +2378,7 @@ function SelectFieldGroup({
2332
2378
  }
2333
2379
 
2334
2380
  // src/Select/SelectFieldStatus/SelectFieldStatus.tsx
2335
- var import_antd10 = require("antd");
2381
+ var import_antd9 = require("antd");
2336
2382
 
2337
2383
  // src/Select/SelectFieldStatus/StatusMockup.ts
2338
2384
  var status = [
@@ -2359,7 +2405,7 @@ function SelectFieldStatus({
2359
2405
  }) {
2360
2406
  const selectedItem = status.find((s) => s.value === value);
2361
2407
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2362
- import_antd10.ConfigProvider,
2408
+ import_antd9.ConfigProvider,
2363
2409
  {
2364
2410
  theme: {
2365
2411
  components: {
@@ -2381,7 +2427,7 @@ function SelectFieldStatus({
2381
2427
  required && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-red-500", children: "*" })
2382
2428
  ] }),
2383
2429
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2384
- import_antd10.Select,
2430
+ import_antd9.Select,
2385
2431
  {
2386
2432
  disabled,
2387
2433
  suffixIcon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_icons.DownOutlined, { style: { color: value ? "#fff" : "#D9D9D9" } }),
@@ -2402,7 +2448,7 @@ function SelectFieldStatus({
2402
2448
  }
2403
2449
 
2404
2450
  // src/Select/SelectFieldStatusReport/SelectFieldStatusReport.tsx
2405
- var import_antd11 = require("antd");
2451
+ var import_antd10 = require("antd");
2406
2452
 
2407
2453
  // src/Select/SelectFieldStatusReport/StatusReportMockup.ts
2408
2454
  var status2 = [
@@ -2426,7 +2472,7 @@ function SelectFieldStatusReport({
2426
2472
  }) {
2427
2473
  const selectedItem = status2.find((s) => s.value === value);
2428
2474
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2429
- import_antd11.ConfigProvider,
2475
+ import_antd10.ConfigProvider,
2430
2476
  {
2431
2477
  theme: {
2432
2478
  components: {
@@ -2448,7 +2494,7 @@ function SelectFieldStatusReport({
2448
2494
  required && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-red-500", children: "*" })
2449
2495
  ] }),
2450
2496
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2451
- import_antd11.Select,
2497
+ import_antd10.Select,
2452
2498
  {
2453
2499
  disabled,
2454
2500
  suffixIcon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_icons2.DownOutlined, { style: { color: value ? "#fff" : "#D9D9D9" } }),
@@ -2469,8 +2515,8 @@ function SelectFieldStatusReport({
2469
2515
  }
2470
2516
 
2471
2517
  // src/Select/SelectFieldTag/SelectFieldTag.tsx
2472
- var import_antd12 = require("antd");
2473
- var import_react8 = require("react");
2518
+ var import_antd11 = require("antd");
2519
+ var import_react9 = require("react");
2474
2520
  var import_jsx_runtime30 = require("react/jsx-runtime");
2475
2521
  function SelectFieldTag({
2476
2522
  label,
@@ -2483,10 +2529,10 @@ function SelectFieldTag({
2483
2529
  onChange,
2484
2530
  onClear
2485
2531
  }) {
2486
- const [internalValue, setInternalValue] = (0, import_react8.useState)([]);
2532
+ const [internalValue, setInternalValue] = (0, import_react9.useState)([]);
2487
2533
  const isControlled = controlledValue !== void 0;
2488
2534
  const value = isControlled ? controlledValue : internalValue;
2489
- const [searchWord, setSearchWord] = (0, import_react8.useState)("");
2535
+ const [searchWord, setSearchWord] = (0, import_react9.useState)("");
2490
2536
  const handleChange = (val) => {
2491
2537
  const trimValue = val.map((v) => v.trim());
2492
2538
  const filtered = trimValue.filter((v) => v.trim() !== "");
@@ -2505,7 +2551,7 @@ function SelectFieldTag({
2505
2551
  onChange?.([]);
2506
2552
  };
2507
2553
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2508
- import_antd12.ConfigProvider,
2554
+ import_antd11.ConfigProvider,
2509
2555
  {
2510
2556
  theme: {
2511
2557
  token: {
@@ -2519,7 +2565,7 @@ function SelectFieldTag({
2519
2565
  required && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-red-500", children: "*" })
2520
2566
  ] }),
2521
2567
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2522
- import_antd12.Select,
2568
+ import_antd11.Select,
2523
2569
  {
2524
2570
  mode: "tags",
2525
2571
  className: `body-1 flex justify-center w-full ${className ?? ""}`,
@@ -2545,8 +2591,8 @@ function SelectFieldTag({
2545
2591
 
2546
2592
  // src/Select/SelectCustom/SelectCustom.tsx
2547
2593
  var import_icons_react8 = require("@tabler/icons-react");
2548
- var import_antd13 = require("antd");
2549
- var import_react9 = require("react");
2594
+ var import_antd12 = require("antd");
2595
+ var import_react10 = require("react");
2550
2596
  var import_jsx_runtime31 = require("react/jsx-runtime");
2551
2597
  function SelectCustom({
2552
2598
  label = "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E42\u0E04\u0E23\u0E07\u0E01\u0E32\u0E23",
@@ -2557,8 +2603,8 @@ function SelectCustom({
2557
2603
  error,
2558
2604
  onClear
2559
2605
  }) {
2560
- const [value, setValue] = (0, import_react9.useState)([]);
2561
- const [valueList, setValueList] = (0, import_react9.useState)([]);
2606
+ const [value, setValue] = (0, import_react10.useState)([]);
2607
+ const [valueList, setValueList] = (0, import_react10.useState)([]);
2562
2608
  const handleChange = (selectedValues) => {
2563
2609
  const newValues = selectedValues.filter((v) => !valueList.includes(v));
2564
2610
  setValueList((prev) => {
@@ -2577,7 +2623,7 @@ function SelectCustom({
2577
2623
  };
2578
2624
  const filteredOptions = options.filter((opt) => !valueList.includes(opt.value)).map((opt) => ({ value: opt.value, label: opt.label }));
2579
2625
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2580
- import_antd13.ConfigProvider,
2626
+ import_antd12.ConfigProvider,
2581
2627
  {
2582
2628
  theme: {
2583
2629
  token: {
@@ -2592,7 +2638,7 @@ function SelectCustom({
2592
2638
  required && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-red-500", children: "*" })
2593
2639
  ] }),
2594
2640
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2595
- import_antd13.Select,
2641
+ import_antd12.Select,
2596
2642
  {
2597
2643
  value,
2598
2644
  onChange: handleChange,
@@ -2619,7 +2665,7 @@ function SelectCustom({
2619
2665
  }
2620
2666
 
2621
2667
  // src/SortFilter/SortFilter.tsx
2622
- var import_antd14 = require("antd");
2668
+ var import_antd13 = require("antd");
2623
2669
  var import_icons3 = require("@ant-design/icons");
2624
2670
 
2625
2671
  // src/SortFilter/DataMockSortFilter.ts
@@ -2650,7 +2696,7 @@ var quarters = [
2650
2696
  ];
2651
2697
 
2652
2698
  // src/SortFilter/SortFilter.tsx
2653
- var import_react10 = require("react");
2699
+ var import_react11 = require("react");
2654
2700
  var import_icons_react9 = require("@tabler/icons-react");
2655
2701
  var import_jsx_runtime32 = require("react/jsx-runtime");
2656
2702
  function SortFilter({
@@ -2660,11 +2706,11 @@ function SortFilter({
2660
2706
  onSortClick,
2661
2707
  onFilterClick
2662
2708
  }) {
2663
- const [yearValue, setYearValue] = (0, import_react10.useState)();
2664
- const [monthValue, setMonthValue] = (0, import_react10.useState)();
2665
- const [quarterValue, setQuartersValue] = (0, import_react10.useState)();
2709
+ const [yearValue, setYearValue] = (0, import_react11.useState)();
2710
+ const [monthValue, setMonthValue] = (0, import_react11.useState)();
2711
+ const [quarterValue, setQuartersValue] = (0, import_react11.useState)();
2666
2712
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
2667
- import_antd14.ConfigProvider,
2713
+ import_antd13.ConfigProvider,
2668
2714
  {
2669
2715
  theme: {
2670
2716
  token: {
@@ -2738,7 +2784,7 @@ function SortFilter({
2738
2784
 
2739
2785
  // src/Upload/FileUploader/FileUploader.tsx
2740
2786
  var import_icons_react10 = require("@tabler/icons-react");
2741
- var import_react11 = require("react");
2787
+ var import_react12 = require("react");
2742
2788
  var import_jsx_runtime33 = require("react/jsx-runtime");
2743
2789
  function FileUploader({
2744
2790
  onUpload,
@@ -2751,10 +2797,10 @@ function FileUploader({
2751
2797
  description,
2752
2798
  label
2753
2799
  }) {
2754
- const [fileList, setFileList] = (0, import_react11.useState)([]);
2755
- const [uploading, setUploading] = (0, import_react11.useState)(false);
2756
- const [dragActive, setDragActive] = (0, import_react11.useState)(false);
2757
- const inputRef = (0, import_react11.useRef)(null);
2800
+ const [fileList, setFileList] = (0, import_react12.useState)([]);
2801
+ const [uploading, setUploading] = (0, import_react12.useState)(false);
2802
+ const [dragActive, setDragActive] = (0, import_react12.useState)(false);
2803
+ const inputRef = (0, import_react12.useRef)(null);
2758
2804
  const validateFile = (file) => {
2759
2805
  if (accept && !accept.includes(file.type)) {
2760
2806
  onError?.(`Invalid file type. file: ${file.name}`);
@@ -2906,8 +2952,8 @@ function messageLoading(content, duration) {
2906
2952
  }
2907
2953
 
2908
2954
  // src/Breadcrumb/Breadcrumb.tsx
2955
+ var import_antd14 = require("antd");
2909
2956
  var import_antd15 = require("antd");
2910
- var import_antd16 = require("antd");
2911
2957
  var import_jsx_runtime34 = require("react/jsx-runtime");
2912
2958
  function Breadcrumbs({
2913
2959
  items,
@@ -2917,7 +2963,7 @@ function Breadcrumbs({
2917
2963
  params
2918
2964
  }) {
2919
2965
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2920
- import_antd15.ConfigProvider,
2966
+ import_antd14.ConfigProvider,
2921
2967
  {
2922
2968
  theme: {
2923
2969
  token: {
@@ -2925,7 +2971,7 @@ function Breadcrumbs({
2925
2971
  }
2926
2972
  },
2927
2973
  children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
2928
- import_antd16.Breadcrumb,
2974
+ import_antd15.Breadcrumb,
2929
2975
  {
2930
2976
  items,
2931
2977
  separator,
@@ -2939,7 +2985,7 @@ function Breadcrumbs({
2939
2985
  }
2940
2986
 
2941
2987
  // src/HeadingPage/HeadingPage.tsx
2942
- var import_antd17 = require("antd");
2988
+ var import_antd16 = require("antd");
2943
2989
  var import_jsx_runtime35 = require("react/jsx-runtime");
2944
2990
  function HeadingPage({ Heading }) {
2945
2991
  const today = (/* @__PURE__ */ new Date()).toLocaleDateString("th-TH", {
@@ -2949,7 +2995,7 @@ function HeadingPage({ Heading }) {
2949
2995
  year: "numeric"
2950
2996
  });
2951
2997
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2952
- import_antd17.ConfigProvider,
2998
+ import_antd16.ConfigProvider,
2953
2999
  {
2954
3000
  theme: {
2955
3001
  token: {
@@ -2968,8 +3014,8 @@ function HeadingPage({ Heading }) {
2968
3014
  }
2969
3015
 
2970
3016
  // src/Progress/ProgressBar.tsx
2971
- var import_antd18 = require("antd");
2972
- var import_react12 = require("react");
3017
+ var import_antd17 = require("antd");
3018
+ var import_react13 = require("react");
2973
3019
  var import_jsx_runtime36 = require("react/jsx-runtime");
2974
3020
  function ProgressBar({
2975
3021
  percent = 0,
@@ -2983,8 +3029,8 @@ function ProgressBar({
2983
3029
  steps,
2984
3030
  isCheckPoints
2985
3031
  }) {
2986
- const [barWidth, setBarWidth] = (0, import_react12.useState)(0);
2987
- const progressRef = (0, import_react12.useRef)(null);
3032
+ const [barWidth, setBarWidth] = (0, import_react13.useState)(0);
3033
+ const progressRef = (0, import_react13.useRef)(null);
2988
3034
  let strokeColor = "--color-green-500";
2989
3035
  const defaultStrokeWidth = type === "circle" ? 13 : strokeWidth ?? 8;
2990
3036
  const defaultSize = type === "circle" ? 43 : size;
@@ -2992,7 +3038,7 @@ function ProgressBar({
2992
3038
  const minCheckpoint = Math.min(...checkpoints);
2993
3039
  strokeColor = percent >= minCheckpoint ? "var(--color-green-500)" : "var(--color-red-500)";
2994
3040
  }
2995
- (0, import_react12.useEffect)(() => {
3041
+ (0, import_react13.useEffect)(() => {
2996
3042
  const inner = progressRef.current?.querySelector(".ant-progress-inner");
2997
3043
  if (!inner) return;
2998
3044
  const observer = new ResizeObserver(() => {
@@ -3002,7 +3048,7 @@ function ProgressBar({
3002
3048
  return () => observer.disconnect();
3003
3049
  }, []);
3004
3050
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3005
- import_antd18.ConfigProvider,
3051
+ import_antd17.ConfigProvider,
3006
3052
  {
3007
3053
  theme: {
3008
3054
  token: {
@@ -3011,7 +3057,7 @@ function ProgressBar({
3011
3057
  },
3012
3058
  children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "relative w-full", ref: progressRef, children: [
3013
3059
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3014
- import_antd18.Progress,
3060
+ import_antd17.Progress,
3015
3061
  {
3016
3062
  className: "w-full",
3017
3063
  percent,
@@ -3048,25 +3094,25 @@ function ProgressBar({
3048
3094
  }
3049
3095
 
3050
3096
  // src/KpiSection/KpiSection.tsx
3051
- var import_antd19 = require("antd");
3052
- var import_react14 = require("react");
3097
+ var import_antd18 = require("antd");
3098
+ var import_react15 = require("react");
3053
3099
 
3054
3100
  // src/KpiSection/hooks/useGetKpiSection.ts
3055
- var import_react13 = require("react");
3101
+ var import_react14 = require("react");
3056
3102
  var import_cuid = __toESM(require("cuid"));
3057
3103
  function useGetKpiSection() {
3058
- const [nameKpi, setNameKpi] = (0, import_react13.useState)("");
3059
- const [kpiValue, setKpiValue] = (0, import_react13.useState)("");
3060
- const [unitValue, setUnitValue] = (0, import_react13.useState)("");
3061
- const [kpiList, setKpiList] = (0, import_react13.useState)([]);
3062
- const [editingBackup, setEditingBackup] = (0, import_react13.useState)({});
3063
- const [selected, setSelected] = (0, import_react13.useState)("2");
3064
- const [errors, setErrors] = (0, import_react13.useState)({
3104
+ const [nameKpi, setNameKpi] = (0, import_react14.useState)("");
3105
+ const [kpiValue, setKpiValue] = (0, import_react14.useState)("");
3106
+ const [unitValue, setUnitValue] = (0, import_react14.useState)("");
3107
+ const [kpiList, setKpiList] = (0, import_react14.useState)([]);
3108
+ const [editingBackup, setEditingBackup] = (0, import_react14.useState)({});
3109
+ const [selected, setSelected] = (0, import_react14.useState)("2");
3110
+ const [errors, setErrors] = (0, import_react14.useState)({
3065
3111
  nameKpi: "",
3066
3112
  kpiValue: "",
3067
3113
  unitValue: ""
3068
3114
  });
3069
- const [itemErrors, setItemErrors] = (0, import_react13.useState)({});
3115
+ const [itemErrors, setItemErrors] = (0, import_react14.useState)({});
3070
3116
  const options = [
3071
3117
  { value: "1", label: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21" },
3072
3118
  { value: "2", label: "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02" }
@@ -3219,18 +3265,18 @@ function KpiSection({ type, onChangeKpiList }) {
3219
3265
  itemErrors,
3220
3266
  setItemErrors
3221
3267
  } = useGetKpiSection();
3222
- const [messageApi2, messageContainer] = import_antd19.message.useMessage();
3223
- const [hasShownError, setHasShownError] = (0, import_react14.useState)(false);
3224
- (0, import_react14.useEffect)(() => {
3268
+ const [messageApi2, messageContainer] = import_antd18.message.useMessage();
3269
+ const [hasShownError, setHasShownError] = (0, import_react15.useState)(false);
3270
+ (0, import_react15.useEffect)(() => {
3225
3271
  setMessageApi(messageApi2);
3226
3272
  }, [messageApi2]);
3227
- (0, import_react14.useEffect)(() => {
3273
+ (0, import_react15.useEffect)(() => {
3228
3274
  if (onChangeKpiList) {
3229
3275
  onChangeKpiList(kpiList);
3230
3276
  }
3231
3277
  }, [kpiList]);
3232
3278
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3233
- import_antd19.ConfigProvider,
3279
+ import_antd18.ConfigProvider,
3234
3280
  {
3235
3281
  theme: {
3236
3282
  token: {
@@ -3454,16 +3500,16 @@ function KpiSection({ type, onChangeKpiList }) {
3454
3500
  }
3455
3501
 
3456
3502
  // src/Modal/Modal/Modal.tsx
3457
- var import_antd20 = require("antd");
3503
+ var import_antd19 = require("antd");
3458
3504
  var import_jsx_runtime38 = require("react/jsx-runtime");
3459
3505
  function AntDModal({ children, isOpen, width, onCancel }) {
3460
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_antd20.Modal, { open: isOpen, onCancel, width, centered: true, footer: null, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children }) }) });
3506
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_antd19.Modal, { open: isOpen, onCancel, width, centered: true, footer: null, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children }) }) });
3461
3507
  }
3462
3508
 
3463
3509
  // src/Indicator/Indicator/Indicator.tsx
3464
3510
  var import_icons_react12 = require("@tabler/icons-react");
3465
- var import_react15 = require("react");
3466
- var import_antd21 = require("antd");
3511
+ var import_react16 = require("react");
3512
+ var import_antd20 = require("antd");
3467
3513
  var import_jsx_runtime39 = require("react/jsx-runtime");
3468
3514
  function Indicator({
3469
3515
  option = [
@@ -3474,22 +3520,22 @@ function Indicator({
3474
3520
  arrayData,
3475
3521
  setArrayData
3476
3522
  }) {
3477
- const [valueSwitch, setValueSwitch] = (0, import_react15.useState)("TEXT");
3478
- const [cacheData, setCacheData] = (0, import_react15.useState)({
3523
+ const [valueSwitch, setValueSwitch] = (0, import_react16.useState)("TEXT");
3524
+ const [cacheData, setCacheData] = (0, import_react16.useState)({
3479
3525
  indicatorType: type,
3480
3526
  inputType: valueSwitch,
3481
3527
  textValue: "",
3482
3528
  numberValue: "",
3483
3529
  unit: ""
3484
3530
  });
3485
- const [cacheEditData, setCacheEditData] = (0, import_react15.useState)({
3531
+ const [cacheEditData, setCacheEditData] = (0, import_react16.useState)({
3486
3532
  indicatorType: type,
3487
3533
  inputType: valueSwitch,
3488
3534
  textValue: "",
3489
3535
  numberValue: "",
3490
3536
  unit: ""
3491
3537
  });
3492
- const [editIndex, setEditIndex] = (0, import_react15.useState)(null);
3538
+ const [editIndex, setEditIndex] = (0, import_react16.useState)(null);
3493
3539
  const handleAddIndicator = () => {
3494
3540
  if (cacheData.textValue.trim() === "") return;
3495
3541
  setArrayData([
@@ -3599,7 +3645,7 @@ function Indicator({
3599
3645
  children: [
3600
3646
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "body-1 mt-2", children: item.inputType === "TEXT" ? "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21" : "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02" }),
3601
3647
  index === editIndex ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
3602
- import_antd21.Input,
3648
+ import_antd20.Input,
3603
3649
  {
3604
3650
  className: "body-1 mt-2",
3605
3651
  variant: "underlined",
@@ -3610,7 +3656,7 @@ function Indicator({
3610
3656
  ) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "body-1 mt-2", children: item.textValue }),
3611
3657
  item.inputType === "NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
3612
3658
  index === editIndex ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
3613
- import_antd21.Input,
3659
+ import_antd20.Input,
3614
3660
  {
3615
3661
  className: "body-1 mt-2",
3616
3662
  variant: "underlined",
@@ -3620,7 +3666,7 @@ function Indicator({
3620
3666
  }
3621
3667
  ) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "body-1 mt-2", children: item.numberValue }),
3622
3668
  index === editIndex ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
3623
- import_antd21.Input,
3669
+ import_antd20.Input,
3624
3670
  {
3625
3671
  className: "body-1 mt-2",
3626
3672
  variant: "underlined",
@@ -3649,11 +3695,11 @@ function Indicator({
3649
3695
 
3650
3696
  // src/FilterPopUp/FilterPopUp.tsx
3651
3697
  var import_icons_react13 = require("@tabler/icons-react");
3652
- var import_react16 = require("react");
3698
+ var import_react17 = require("react");
3653
3699
  var import_jsx_runtime40 = require("react/jsx-runtime");
3654
3700
  var FilterPopUp = (filter) => {
3655
- const [isAction, setIsAction] = (0, import_react16.useState)(true);
3656
- const [filterArray, setFilterArray] = (0, import_react16.useState)([""]);
3701
+ const [isAction, setIsAction] = (0, import_react17.useState)(true);
3702
+ const [filterArray, setFilterArray] = (0, import_react17.useState)([""]);
3657
3703
  const handleClearFilter = () => {
3658
3704
  setFilterArray([]);
3659
3705
  };
package/dist/index.mjs CHANGED
@@ -1231,65 +1231,111 @@ function InputFieldNumber({
1231
1231
  var import_dayjs = __toESM(require_dayjs_min());
1232
1232
  var import_th2 = __toESM(require_th());
1233
1233
  var import_buddhistEra = __toESM(require_buddhistEra());
1234
- import { DatePicker } from "antd";
1234
+ import { useState as useState6 } from "react";
1235
1235
  import { format } from "date-fns";
1236
1236
  import { th as thFns } from "date-fns/locale";
1237
- import th from "antd/es/date-picker/locale/th_TH";
1238
1237
  import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
1239
1238
  import_dayjs.default.extend(import_buddhistEra.default);
1240
- var buddhistLocale = {
1241
- ...th,
1242
- lang: {
1243
- ...th.lang,
1244
- fieldDateFormat: "BBBB-MM-DD",
1245
- fieldDateTimeFormat: "BBBB-MM-DD HH:mm:ss",
1246
- yearFormat: "BBBB",
1247
- cellYearFormat: "BBBB"
1248
- }
1249
- };
1239
+ import_dayjs.default.locale("th");
1250
1240
  function DatePickerBasic({
1251
1241
  value,
1252
1242
  onChange,
1253
- required,
1254
1243
  label,
1244
+ required,
1255
1245
  error,
1256
- placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
1257
1246
  disabled,
1258
- defaultValue,
1247
+ placeholder = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
1259
1248
  minDate,
1260
1249
  maxDate,
1261
- disabledDate,
1262
- className,
1263
- size = "middle"
1250
+ disabledDate
1264
1251
  }) {
1265
- const formatToThaiBE = (date) => {
1252
+ const [open, setOpen] = useState6(false);
1253
+ const current = value ? (0, import_dayjs.default)(value) : null;
1254
+ const today = (0, import_dayjs.default)();
1255
+ const formatThaiBE = (date) => {
1266
1256
  const formatted = format(date, "dd MMMM yyyy", { locale: thFns });
1267
- const year = parseInt(format(date, "yyyy"));
1268
- const yearBE = year + 543;
1269
- return formatted.replace(/\d{4}$/, String(yearBE));
1257
+ const year = parseInt(format(date, "yyyy")) + 543;
1258
+ return formatted.replace(/\d{4}$/, String(year));
1270
1259
  };
1271
- return /* @__PURE__ */ jsxs19("div", { className: "container-input", style: { fontFamily: "Kanit", fontSize: 16 }, children: [
1272
- /* @__PURE__ */ jsxs19("div", { children: [
1260
+ const monthNames = [
1261
+ "\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21",
1262
+ "\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C",
1263
+ "\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21",
1264
+ "\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19",
1265
+ "\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21",
1266
+ "\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19",
1267
+ "\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21",
1268
+ "\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21",
1269
+ "\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19",
1270
+ "\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21",
1271
+ "\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19",
1272
+ "\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21"
1273
+ ];
1274
+ const [calendar, setCalendar] = useState6(current || today);
1275
+ const daysInMonth = calendar.daysInMonth();
1276
+ const firstDayOfMonth = calendar.startOf("month").day();
1277
+ const isDisabled = (date) => {
1278
+ if (disabledDate && disabledDate(date.toDate())) return true;
1279
+ if (minDate && date.isBefore((0, import_dayjs.default)(minDate), "day")) return true;
1280
+ if (maxDate && date.isAfter((0, import_dayjs.default)(maxDate), "day")) return true;
1281
+ return false;
1282
+ };
1283
+ const handleSelect = (d) => {
1284
+ const selected = calendar.date(d);
1285
+ if (isDisabled(selected)) return;
1286
+ onChange(selected.toDate());
1287
+ setOpen(false);
1288
+ };
1289
+ return /* @__PURE__ */ jsxs19("div", { style: { fontFamily: "Kanit", fontSize: 16 }, className: "relative w-full", children: [
1290
+ /* @__PURE__ */ jsxs19("div", { className: "mb-1", children: [
1273
1291
  /* @__PURE__ */ jsx23("span", { className: "body-1", children: label }),
1274
1292
  required && /* @__PURE__ */ jsx23("span", { className: "text-red-500", children: "*" })
1275
1293
  ] }),
1276
1294
  /* @__PURE__ */ jsx23(
1277
- DatePicker,
1295
+ "div",
1278
1296
  {
1279
- className: `body-1 w-full ${className ?? ""}`,
1280
- placeholder,
1281
- disabled,
1282
- allowClear: true,
1283
- size,
1284
- value: value ? (0, import_dayjs.default)(value) : null,
1285
- defaultValue: defaultValue ? (0, import_dayjs.default)(defaultValue) : void 0,
1286
- minDate: minDate ? (0, import_dayjs.default)(minDate) : void 0,
1287
- maxDate: maxDate ? (0, import_dayjs.default)(maxDate) : void 0,
1288
- disabledDate: (d) => disabledDate ? disabledDate(d.toDate()) : false,
1289
- onChange: (d) => onChange(d ? d.toDate() : null),
1290
- format: (d) => d ? formatToThaiBE(d.toDate()) : "",
1291
- locale: buddhistLocale,
1292
- style: { fontFamily: "Kanit", fontSize: 16 }
1297
+ className: `border rounded px-3 py-2 cursor-pointer bg-white ${disabled ? "opacity-50" : ""}`,
1298
+ onClick: () => !disabled && setOpen(!open),
1299
+ children: value ? formatThaiBE(value) : /* @__PURE__ */ jsx23("span", { className: "text-gray-400", children: placeholder })
1300
+ }
1301
+ ),
1302
+ open && /* @__PURE__ */ jsxs19(
1303
+ "div",
1304
+ {
1305
+ className: "absolute z-50 mt-2 w-80 p-4 bg-white shadow-xl rounded-lg border",
1306
+ style: { fontFamily: "Kanit", fontSize: 16 },
1307
+ children: [
1308
+ /* @__PURE__ */ jsxs19("div", { className: "flex justify-between items-center mb-3", children: [
1309
+ /* @__PURE__ */ jsx23("button", { onClick: () => setCalendar(calendar.subtract(1, "month")), className: "px-2", children: "\u25C0" }),
1310
+ /* @__PURE__ */ jsxs19("div", { className: "font-semibold", children: [
1311
+ monthNames[calendar.month()],
1312
+ " ",
1313
+ calendar.year() + 543
1314
+ ] }),
1315
+ /* @__PURE__ */ jsx23("button", { onClick: () => setCalendar(calendar.add(1, "month")), className: "px-2", children: "\u25B6" })
1316
+ ] }),
1317
+ /* @__PURE__ */ jsx23("div", { className: "grid grid-cols-7 text-center text-gray-600 mb-2", children: ["\u0E2D\u0E32", "\u0E08", "\u0E2D", "\u0E1E", "\u0E1E\u0E24", "\u0E28", "\u0E2A"].map((d) => /* @__PURE__ */ jsx23("div", { children: d }, d)) }),
1318
+ /* @__PURE__ */ jsxs19("div", { className: "grid grid-cols-7 gap-1 text-center", children: [
1319
+ Array(firstDayOfMonth).fill(null).map((_, i) => /* @__PURE__ */ jsx23("div", {}, `empty-${i}`)),
1320
+ Array.from({ length: daysInMonth }, (_, i) => i + 1).map((d) => {
1321
+ const dateObj = calendar.date(d);
1322
+ const disabled2 = isDisabled(dateObj);
1323
+ const selected = current && dateObj.isSame(current, "day");
1324
+ return /* @__PURE__ */ jsx23(
1325
+ "div",
1326
+ {
1327
+ onClick: () => !disabled2 && handleSelect(d),
1328
+ className: `py-1 rounded cursor-pointer
1329
+ ${selected ? "bg-blue-500 text-white" : ""}
1330
+ ${disabled2 ? "text-gray-400 cursor-not-allowed" : "hover:bg-blue-100"}
1331
+ `,
1332
+ children: d
1333
+ },
1334
+ d
1335
+ );
1336
+ })
1337
+ ] })
1338
+ ]
1293
1339
  }
1294
1340
  ),
1295
1341
  error && /* @__PURE__ */ jsx23("p", { className: "text-red-500 caption-1", children: error })
@@ -2413,7 +2459,7 @@ function SelectFieldStatusReport({
2413
2459
 
2414
2460
  // src/Select/SelectFieldTag/SelectFieldTag.tsx
2415
2461
  import { Select as Select5, ConfigProvider as ConfigProvider11 } from "antd";
2416
- import { useState as useState6 } from "react";
2462
+ import { useState as useState7 } from "react";
2417
2463
  import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
2418
2464
  function SelectFieldTag({
2419
2465
  label,
@@ -2426,10 +2472,10 @@ function SelectFieldTag({
2426
2472
  onChange,
2427
2473
  onClear
2428
2474
  }) {
2429
- const [internalValue, setInternalValue] = useState6([]);
2475
+ const [internalValue, setInternalValue] = useState7([]);
2430
2476
  const isControlled = controlledValue !== void 0;
2431
2477
  const value = isControlled ? controlledValue : internalValue;
2432
- const [searchWord, setSearchWord] = useState6("");
2478
+ const [searchWord, setSearchWord] = useState7("");
2433
2479
  const handleChange = (val) => {
2434
2480
  const trimValue = val.map((v) => v.trim());
2435
2481
  const filtered = trimValue.filter((v) => v.trim() !== "");
@@ -2489,7 +2535,7 @@ function SelectFieldTag({
2489
2535
  // src/Select/SelectCustom/SelectCustom.tsx
2490
2536
  import { IconTrash } from "@tabler/icons-react";
2491
2537
  import { Select as Select6, ConfigProvider as ConfigProvider12 } from "antd";
2492
- import { useState as useState7 } from "react";
2538
+ import { useState as useState8 } from "react";
2493
2539
  import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
2494
2540
  function SelectCustom({
2495
2541
  label = "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E42\u0E04\u0E23\u0E07\u0E01\u0E32\u0E23",
@@ -2500,8 +2546,8 @@ function SelectCustom({
2500
2546
  error,
2501
2547
  onClear
2502
2548
  }) {
2503
- const [value, setValue] = useState7([]);
2504
- const [valueList, setValueList] = useState7([]);
2549
+ const [value, setValue] = useState8([]);
2550
+ const [valueList, setValueList] = useState8([]);
2505
2551
  const handleChange = (selectedValues) => {
2506
2552
  const newValues = selectedValues.filter((v) => !valueList.includes(v));
2507
2553
  setValueList((prev) => {
@@ -2593,7 +2639,7 @@ var quarters = [
2593
2639
  ];
2594
2640
 
2595
2641
  // src/SortFilter/SortFilter.tsx
2596
- import { useState as useState8 } from "react";
2642
+ import { useState as useState9 } from "react";
2597
2643
  import { IconSortDescending as IconSortDescending2, IconFilter } from "@tabler/icons-react";
2598
2644
  import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
2599
2645
  function SortFilter({
@@ -2603,9 +2649,9 @@ function SortFilter({
2603
2649
  onSortClick,
2604
2650
  onFilterClick
2605
2651
  }) {
2606
- const [yearValue, setYearValue] = useState8();
2607
- const [monthValue, setMonthValue] = useState8();
2608
- const [quarterValue, setQuartersValue] = useState8();
2652
+ const [yearValue, setYearValue] = useState9();
2653
+ const [monthValue, setMonthValue] = useState9();
2654
+ const [quarterValue, setQuartersValue] = useState9();
2609
2655
  return /* @__PURE__ */ jsx32(
2610
2656
  ConfigProvider13,
2611
2657
  {
@@ -2681,7 +2727,7 @@ function SortFilter({
2681
2727
 
2682
2728
  // src/Upload/FileUploader/FileUploader.tsx
2683
2729
  import { IconPaperclip, IconUpload, IconTrash as IconTrash2 } from "@tabler/icons-react";
2684
- import { useRef as useRef2, useState as useState9 } from "react";
2730
+ import { useRef as useRef2, useState as useState10 } from "react";
2685
2731
  import { Fragment as Fragment5, jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
2686
2732
  function FileUploader({
2687
2733
  onUpload,
@@ -2694,9 +2740,9 @@ function FileUploader({
2694
2740
  description,
2695
2741
  label
2696
2742
  }) {
2697
- const [fileList, setFileList] = useState9([]);
2698
- const [uploading, setUploading] = useState9(false);
2699
- const [dragActive, setDragActive] = useState9(false);
2743
+ const [fileList, setFileList] = useState10([]);
2744
+ const [uploading, setUploading] = useState10(false);
2745
+ const [dragActive, setDragActive] = useState10(false);
2700
2746
  const inputRef = useRef2(null);
2701
2747
  const validateFile = (file) => {
2702
2748
  if (accept && !accept.includes(file.type)) {
@@ -2912,7 +2958,7 @@ function HeadingPage({ Heading }) {
2912
2958
 
2913
2959
  // src/Progress/ProgressBar.tsx
2914
2960
  import { ConfigProvider as ConfigProvider16, Progress } from "antd";
2915
- import { useEffect as useEffect2, useRef as useRef3, useState as useState10 } from "react";
2961
+ import { useEffect as useEffect2, useRef as useRef3, useState as useState11 } from "react";
2916
2962
  import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
2917
2963
  function ProgressBar({
2918
2964
  percent = 0,
@@ -2926,7 +2972,7 @@ function ProgressBar({
2926
2972
  steps,
2927
2973
  isCheckPoints
2928
2974
  }) {
2929
- const [barWidth, setBarWidth] = useState10(0);
2975
+ const [barWidth, setBarWidth] = useState11(0);
2930
2976
  const progressRef = useRef3(null);
2931
2977
  let strokeColor = "--color-green-500";
2932
2978
  const defaultStrokeWidth = type === "circle" ? 13 : strokeWidth ?? 8;
@@ -2992,24 +3038,24 @@ function ProgressBar({
2992
3038
 
2993
3039
  // src/KpiSection/KpiSection.tsx
2994
3040
  import { ConfigProvider as ConfigProvider17, message } from "antd";
2995
- import { useEffect as useEffect3, useState as useState12 } from "react";
3041
+ import { useEffect as useEffect3, useState as useState13 } from "react";
2996
3042
 
2997
3043
  // src/KpiSection/hooks/useGetKpiSection.ts
2998
- import { useState as useState11 } from "react";
3044
+ import { useState as useState12 } from "react";
2999
3045
  import cuid from "cuid";
3000
3046
  function useGetKpiSection() {
3001
- const [nameKpi, setNameKpi] = useState11("");
3002
- const [kpiValue, setKpiValue] = useState11("");
3003
- const [unitValue, setUnitValue] = useState11("");
3004
- const [kpiList, setKpiList] = useState11([]);
3005
- const [editingBackup, setEditingBackup] = useState11({});
3006
- const [selected, setSelected] = useState11("2");
3007
- const [errors, setErrors] = useState11({
3047
+ const [nameKpi, setNameKpi] = useState12("");
3048
+ const [kpiValue, setKpiValue] = useState12("");
3049
+ const [unitValue, setUnitValue] = useState12("");
3050
+ const [kpiList, setKpiList] = useState12([]);
3051
+ const [editingBackup, setEditingBackup] = useState12({});
3052
+ const [selected, setSelected] = useState12("2");
3053
+ const [errors, setErrors] = useState12({
3008
3054
  nameKpi: "",
3009
3055
  kpiValue: "",
3010
3056
  unitValue: ""
3011
3057
  });
3012
- const [itemErrors, setItemErrors] = useState11({});
3058
+ const [itemErrors, setItemErrors] = useState12({});
3013
3059
  const options = [
3014
3060
  { value: "1", label: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21" },
3015
3061
  { value: "2", label: "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02" }
@@ -3163,7 +3209,7 @@ function KpiSection({ type, onChangeKpiList }) {
3163
3209
  setItemErrors
3164
3210
  } = useGetKpiSection();
3165
3211
  const [messageApi2, messageContainer] = message.useMessage();
3166
- const [hasShownError, setHasShownError] = useState12(false);
3212
+ const [hasShownError, setHasShownError] = useState13(false);
3167
3213
  useEffect3(() => {
3168
3214
  setMessageApi(messageApi2);
3169
3215
  }, [messageApi2]);
@@ -3405,7 +3451,7 @@ function AntDModal({ children, isOpen, width, onCancel }) {
3405
3451
 
3406
3452
  // src/Indicator/Indicator/Indicator.tsx
3407
3453
  import { IconCheck as IconCheck3, IconCirclePlus as IconCirclePlus2, IconPencil as IconPencil2, IconTrash as IconTrash4, IconX as IconX3 } from "@tabler/icons-react";
3408
- import { useState as useState13 } from "react";
3454
+ import { useState as useState14 } from "react";
3409
3455
  import { Input as Input4 } from "antd";
3410
3456
  import { Fragment as Fragment7, jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
3411
3457
  function Indicator({
@@ -3417,22 +3463,22 @@ function Indicator({
3417
3463
  arrayData,
3418
3464
  setArrayData
3419
3465
  }) {
3420
- const [valueSwitch, setValueSwitch] = useState13("TEXT");
3421
- const [cacheData, setCacheData] = useState13({
3466
+ const [valueSwitch, setValueSwitch] = useState14("TEXT");
3467
+ const [cacheData, setCacheData] = useState14({
3422
3468
  indicatorType: type,
3423
3469
  inputType: valueSwitch,
3424
3470
  textValue: "",
3425
3471
  numberValue: "",
3426
3472
  unit: ""
3427
3473
  });
3428
- const [cacheEditData, setCacheEditData] = useState13({
3474
+ const [cacheEditData, setCacheEditData] = useState14({
3429
3475
  indicatorType: type,
3430
3476
  inputType: valueSwitch,
3431
3477
  textValue: "",
3432
3478
  numberValue: "",
3433
3479
  unit: ""
3434
3480
  });
3435
- const [editIndex, setEditIndex] = useState13(null);
3481
+ const [editIndex, setEditIndex] = useState14(null);
3436
3482
  const handleAddIndicator = () => {
3437
3483
  if (cacheData.textValue.trim() === "") return;
3438
3484
  setArrayData([
@@ -3592,11 +3638,11 @@ function Indicator({
3592
3638
 
3593
3639
  // src/FilterPopUp/FilterPopUp.tsx
3594
3640
  import { IconCheck as IconCheck4, IconFilter as IconFilter2, IconTrash as IconTrash5 } from "@tabler/icons-react";
3595
- import { useState as useState14 } from "react";
3641
+ import { useState as useState15 } from "react";
3596
3642
  import { jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
3597
3643
  var FilterPopUp = (filter) => {
3598
- const [isAction, setIsAction] = useState14(true);
3599
- const [filterArray, setFilterArray] = useState14([""]);
3644
+ const [isAction, setIsAction] = useState15(true);
3645
+ const [filterArray, setFilterArray] = useState15([""]);
3600
3646
  const handleClearFilter = () => {
3601
3647
  setFilterArray([]);
3602
3648
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esic-lab/data-core-ui",
3
- "version": "0.0.41",
3
+ "version": "0.0.42",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",