@esic-lab/data-core-ui 0.0.52 → 0.0.54

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
@@ -433,9 +433,6 @@
433
433
  .h-\[10px\] {
434
434
  height: 10px;
435
435
  }
436
- .h-\[15px\] {
437
- height: 15px;
438
- }
439
436
  .h-\[16px\] {
440
437
  height: 16px;
441
438
  }
@@ -535,9 +532,6 @@
535
532
  .w-\[10px\] {
536
533
  width: 10px;
537
534
  }
538
- .w-\[15px\] {
539
- width: 15px;
540
- }
541
535
  .w-\[16px\] {
542
536
  width: 16px;
543
537
  }
@@ -556,9 +550,6 @@
556
550
  .w-\[40px\] {
557
551
  width: 40px;
558
552
  }
559
- .w-\[75\%\] {
560
- width: 75%;
561
- }
562
553
  .w-\[80px\] {
563
554
  width: 80px;
564
555
  }
@@ -577,6 +568,9 @@
577
568
  .w-\[250px\] {
578
569
  width: 250px;
579
570
  }
571
+ .w-\[400px\] {
572
+ width: 400px;
573
+ }
580
574
  .w-\[500px\] {
581
575
  width: 500px;
582
576
  }
@@ -595,9 +589,6 @@
595
589
  .min-w-\[261px\] {
596
590
  min-width: 261px;
597
591
  }
598
- .min-w-\[400px\] {
599
- min-width: 400px;
600
- }
601
592
  .flex-1 {
602
593
  flex: 1;
603
594
  }
@@ -809,9 +800,6 @@
809
800
  .rounded-\[2px\] {
810
801
  border-radius: 2px;
811
802
  }
812
- .rounded-\[4px\] {
813
- border-radius: 4px;
814
- }
815
803
  .rounded-\[6px\] {
816
804
  border-radius: 6px;
817
805
  }
@@ -1025,9 +1013,6 @@
1025
1013
  .px-6 {
1026
1014
  padding-inline: calc(var(--spacing) * 6);
1027
1015
  }
1028
- .px-\[8px\] {
1029
- padding-inline: 8px;
1030
- }
1031
1016
  .px-\[16px\] {
1032
1017
  padding-inline: 16px;
1033
1018
  }
@@ -1046,9 +1031,6 @@
1046
1031
  .py-\[2px\] {
1047
1032
  padding-block: 2px;
1048
1033
  }
1049
- .py-\[4px\] {
1050
- padding-block: 4px;
1051
- }
1052
1034
  .py-\[8px\] {
1053
1035
  padding-block: 8px;
1054
1036
  }
@@ -1058,9 +1040,15 @@
1058
1040
  .pt-2 {
1059
1041
  padding-top: calc(var(--spacing) * 2);
1060
1042
  }
1043
+ .pt-\[16px\] {
1044
+ padding-top: 16px;
1045
+ }
1061
1046
  .pb-2 {
1062
1047
  padding-bottom: calc(var(--spacing) * 2);
1063
1048
  }
1049
+ .pb-\[16px\] {
1050
+ padding-bottom: 16px;
1051
+ }
1064
1052
  .text-center {
1065
1053
  text-align: center;
1066
1054
  }
@@ -1396,6 +1384,13 @@
1396
1384
  }
1397
1385
  }
1398
1386
  }
1387
+ .hover\:cursor-pointer {
1388
+ &:hover {
1389
+ @media (hover: hover) {
1390
+ cursor: pointer;
1391
+ }
1392
+ }
1393
+ }
1399
1394
  .hover\:border-primary-200 {
1400
1395
  &:hover {
1401
1396
  @media (hover: hover) {
@@ -1431,6 +1426,13 @@
1431
1426
  }
1432
1427
  }
1433
1428
  }
1429
+ .hover\:bg-primary-50 {
1430
+ &:hover {
1431
+ @media (hover: hover) {
1432
+ background-color: var(--color-primary-50);
1433
+ }
1434
+ }
1435
+ }
1434
1436
  .hover\:bg-red-100 {
1435
1437
  &:hover {
1436
1438
  @media (hover: hover) {
@@ -1480,13 +1482,6 @@
1480
1482
  }
1481
1483
  }
1482
1484
  }
1483
- .hover\:text-red-500 {
1484
- &:hover {
1485
- @media (hover: hover) {
1486
- color: var(--color-red-500);
1487
- }
1488
- }
1489
- }
1490
1485
  .hover\:text-red-700 {
1491
1486
  &:hover {
1492
1487
  @media (hover: hover) {
package/dist/index.d.mts CHANGED
@@ -443,9 +443,10 @@ interface SortFilterProps {
443
443
  declare function SortFilter({ showYear, showQuarter, showMonth, onSortClick, onFilterClick, }: SortFilterProps): react_jsx_runtime.JSX.Element;
444
444
 
445
445
  interface FileUploaderProps {
446
- onUpload: (file: File) => Promise<void>;
446
+ onUpload: (file: any) => Promise<void>;
447
447
  onRemove?: (index: number) => Promise<void>;
448
448
  onError?: (message: string) => void;
449
+ onClickFile?: (file: any) => void;
449
450
  accept?: string[];
450
451
  maxSize?: number;
451
452
  disabled?: boolean;
@@ -454,8 +455,11 @@ interface FileUploaderProps {
454
455
  label?: string;
455
456
  value?: File[] | any[];
456
457
  uploadText?: string;
458
+ uploaderWidth?: string;
459
+ attachWidth?: string;
460
+ readOnly?: boolean;
457
461
  }
458
- declare function FileUploader({ onUpload, onError, onRemove, accept, maxSize, disabled, mode, description, label, value, uploadText, }: FileUploaderProps): react_jsx_runtime.JSX.Element;
462
+ declare function FileUploader({ onUpload, onError, onRemove, onClickFile, accept, maxSize, disabled, mode, description, label, value, uploadText, uploaderWidth, attachWidth, readOnly, }: FileUploaderProps): react_jsx_runtime.JSX.Element;
459
463
 
460
464
  declare function setMessageApi(api: MessageInstance): void;
461
465
  declare function messageSuccess(content: string): void;
package/dist/index.d.ts CHANGED
@@ -443,9 +443,10 @@ interface SortFilterProps {
443
443
  declare function SortFilter({ showYear, showQuarter, showMonth, onSortClick, onFilterClick, }: SortFilterProps): react_jsx_runtime.JSX.Element;
444
444
 
445
445
  interface FileUploaderProps {
446
- onUpload: (file: File) => Promise<void>;
446
+ onUpload: (file: any) => Promise<void>;
447
447
  onRemove?: (index: number) => Promise<void>;
448
448
  onError?: (message: string) => void;
449
+ onClickFile?: (file: any) => void;
449
450
  accept?: string[];
450
451
  maxSize?: number;
451
452
  disabled?: boolean;
@@ -454,8 +455,11 @@ interface FileUploaderProps {
454
455
  label?: string;
455
456
  value?: File[] | any[];
456
457
  uploadText?: string;
458
+ uploaderWidth?: string;
459
+ attachWidth?: string;
460
+ readOnly?: boolean;
457
461
  }
458
- declare function FileUploader({ onUpload, onError, onRemove, accept, maxSize, disabled, mode, description, label, value, uploadText, }: FileUploaderProps): react_jsx_runtime.JSX.Element;
462
+ declare function FileUploader({ onUpload, onError, onRemove, onClickFile, accept, maxSize, disabled, mode, description, label, value, uploadText, uploaderWidth, attachWidth, readOnly, }: FileUploaderProps): react_jsx_runtime.JSX.Element;
459
463
 
460
464
  declare function setMessageApi(api: MessageInstance): void;
461
465
  declare function messageSuccess(content: string): void;
package/dist/index.js CHANGED
@@ -3007,6 +3007,7 @@ function FileUploader({
3007
3007
  onUpload,
3008
3008
  onError,
3009
3009
  onRemove,
3010
+ onClickFile,
3010
3011
  accept,
3011
3012
  maxSize,
3012
3013
  disabled,
@@ -3014,7 +3015,10 @@ function FileUploader({
3014
3015
  description,
3015
3016
  label,
3016
3017
  value,
3017
- uploadText = "\u0E41\u0E19\u0E1A\u0E44\u0E1F\u0E25\u0E4C"
3018
+ uploadText = "\u0E41\u0E19\u0E1A\u0E44\u0E1F\u0E25\u0E4C",
3019
+ uploaderWidth = "w-full",
3020
+ attachWidth = "w-full",
3021
+ readOnly = false
3018
3022
  }) {
3019
3023
  const [internalFileList, setInternalFileList] = (0, import_react14.useState)([]);
3020
3024
  const [uploading, setUploading] = (0, import_react14.useState)(false);
@@ -3086,7 +3090,7 @@ function FileUploader({
3086
3090
  };
3087
3091
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "w-full", children: [
3088
3092
  label && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "body-1", children: label }),
3089
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
3093
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: uploaderWidth, children: [
3090
3094
  mode === "upload" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3091
3095
  "button",
3092
3096
  {
@@ -3107,7 +3111,7 @@ function FileUploader({
3107
3111
  ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3108
3112
  "div",
3109
3113
  {
3110
- className: `min-w-[400px] min-h-[120px] flex justify-center items-center border-2 border-dashed rounded-md p-4 transition-colors body-1
3114
+ className: `w-full min-h-[120px] flex justify-center items-center border-2 border-dashed rounded-md p-4 transition-colors body-1
3111
3115
  ${dragActive ? "border-primary-500 bg-primary-50" : "border-gray-300 bg-white"}
3112
3116
  ${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
3113
3117
  `,
@@ -3142,20 +3146,35 @@ function FileUploader({
3142
3146
  )
3143
3147
  ] }),
3144
3148
  description && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-gray-400 body-4", children: description }),
3145
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mt-[8px]", children: filesToDisplay.length !== 0 && filesToDisplay.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2 rounded-[4px] px-[8px] py-[4px] body-1", children: [
3146
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2 w-[75%] overflow-hidden", children: [
3147
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "w-[15px] h-[15px]", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons_react10.IconPaperclip, { size: 15 }) }),
3148
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "truncate", children: file.name || file.fileName })
3149
- ] }),
3150
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3151
- import_icons_react10.IconTrash,
3152
- {
3153
- size: 20,
3154
- className: "ml-auto hover:text-red-500 cursor-pointer",
3155
- onClick: () => handleRemoveFile(index)
3156
- }
3157
- )
3158
- ] }, index)) })
3149
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: `mt-[8px] ${attachWidth}`, children: filesToDisplay.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex flex-col rounded-[6px] body-1 border-[1px] border-gray-300", children: filesToDisplay.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
3150
+ "div",
3151
+ {
3152
+ className: `flex px-[16px] hover:bg-primary-50 hover:cursor-pointer
3153
+ ${index === 0 ? "pt-[16px]" : ""}
3154
+ ${filesToDisplay.length - 1 === index ? "pb-[16px]" : ""}
3155
+ ${filesToDisplay?.length - 1 !== index ? "border-b pb-[16px]" : ""}
3156
+ ${index !== 0 ? "pt-[16px]" : ""}`,
3157
+ onClick: () => onClickFile && onClickFile(file),
3158
+ children: [
3159
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-2 overflow-hidden", children: [
3160
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "w-[24px] h-[24px] flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons_react10.IconFileDescription, { size: 20 }) }),
3161
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "truncate", children: file.name || file.fileName })
3162
+ ] }),
3163
+ !readOnly && !disabled && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3164
+ import_icons_react10.IconTrash,
3165
+ {
3166
+ size: 20,
3167
+ className: "ml-auto text-red-500 cursor-pointer",
3168
+ onClick: (e) => {
3169
+ e.stopPropagation();
3170
+ handleRemoveFile(index);
3171
+ }
3172
+ }
3173
+ )
3174
+ ]
3175
+ },
3176
+ index
3177
+ )) }) })
3159
3178
  ] });
3160
3179
  }
3161
3180
 
package/dist/index.mjs CHANGED
@@ -2939,13 +2939,14 @@ function SortFilter({
2939
2939
  }
2940
2940
 
2941
2941
  // src/Upload/FileUploader/FileUploader.tsx
2942
- import { IconPaperclip, IconUpload, IconTrash as IconTrash2 } from "@tabler/icons-react";
2942
+ import { IconUpload, IconTrash as IconTrash2, IconFileDescription } from "@tabler/icons-react";
2943
2943
  import { useRef as useRef4, useState as useState12 } from "react";
2944
2944
  import { Fragment as Fragment5, jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
2945
2945
  function FileUploader({
2946
2946
  onUpload,
2947
2947
  onError,
2948
2948
  onRemove,
2949
+ onClickFile,
2949
2950
  accept,
2950
2951
  maxSize,
2951
2952
  disabled,
@@ -2953,7 +2954,10 @@ function FileUploader({
2953
2954
  description,
2954
2955
  label,
2955
2956
  value,
2956
- uploadText = "\u0E41\u0E19\u0E1A\u0E44\u0E1F\u0E25\u0E4C"
2957
+ uploadText = "\u0E41\u0E19\u0E1A\u0E44\u0E1F\u0E25\u0E4C",
2958
+ uploaderWidth = "w-full",
2959
+ attachWidth = "w-full",
2960
+ readOnly = false
2957
2961
  }) {
2958
2962
  const [internalFileList, setInternalFileList] = useState12([]);
2959
2963
  const [uploading, setUploading] = useState12(false);
@@ -3025,7 +3029,7 @@ function FileUploader({
3025
3029
  };
3026
3030
  return /* @__PURE__ */ jsxs30("div", { className: "w-full", children: [
3027
3031
  label && /* @__PURE__ */ jsx34("p", { className: "body-1", children: label }),
3028
- /* @__PURE__ */ jsxs30("div", { children: [
3032
+ !readOnly && /* @__PURE__ */ jsxs30("div", { className: uploaderWidth, children: [
3029
3033
  mode === "upload" ? /* @__PURE__ */ jsx34(
3030
3034
  "button",
3031
3035
  {
@@ -3046,7 +3050,7 @@ function FileUploader({
3046
3050
  ) : /* @__PURE__ */ jsx34(
3047
3051
  "div",
3048
3052
  {
3049
- className: `min-w-[400px] min-h-[120px] flex justify-center items-center border-2 border-dashed rounded-md p-4 transition-colors body-1
3053
+ className: `w-full min-h-[120px] flex justify-center items-center border-2 border-dashed rounded-md p-4 transition-colors body-1
3050
3054
  ${dragActive ? "border-primary-500 bg-primary-50" : "border-gray-300 bg-white"}
3051
3055
  ${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
3052
3056
  `,
@@ -3081,20 +3085,35 @@ function FileUploader({
3081
3085
  )
3082
3086
  ] }),
3083
3087
  description && /* @__PURE__ */ jsx34("p", { className: "text-gray-400 body-4", children: description }),
3084
- /* @__PURE__ */ jsx34("div", { className: "mt-[8px]", children: filesToDisplay.length !== 0 && filesToDisplay.map((file, index) => /* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2 rounded-[4px] px-[8px] py-[4px] body-1", children: [
3085
- /* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2 w-[75%] overflow-hidden", children: [
3086
- /* @__PURE__ */ jsx34("div", { className: "w-[15px] h-[15px]", children: /* @__PURE__ */ jsx34(IconPaperclip, { size: 15 }) }),
3087
- /* @__PURE__ */ jsx34("span", { className: "truncate", children: file.name || file.fileName })
3088
- ] }),
3089
- /* @__PURE__ */ jsx34(
3090
- IconTrash2,
3091
- {
3092
- size: 20,
3093
- className: "ml-auto hover:text-red-500 cursor-pointer",
3094
- onClick: () => handleRemoveFile(index)
3095
- }
3096
- )
3097
- ] }, index)) })
3088
+ /* @__PURE__ */ jsx34("div", { className: `mt-[8px] ${attachWidth}`, children: filesToDisplay.length !== 0 && /* @__PURE__ */ jsx34("div", { className: "flex flex-col rounded-[6px] body-1 border-[1px] border-gray-300", children: filesToDisplay.map((file, index) => /* @__PURE__ */ jsxs30(
3089
+ "div",
3090
+ {
3091
+ className: `flex px-[16px] hover:bg-primary-50 hover:cursor-pointer
3092
+ ${index === 0 ? "pt-[16px]" : ""}
3093
+ ${filesToDisplay.length - 1 === index ? "pb-[16px]" : ""}
3094
+ ${filesToDisplay?.length - 1 !== index ? "border-b pb-[16px]" : ""}
3095
+ ${index !== 0 ? "pt-[16px]" : ""}`,
3096
+ onClick: () => onClickFile && onClickFile(file),
3097
+ children: [
3098
+ /* @__PURE__ */ jsxs30("div", { className: "flex gap-2 overflow-hidden", children: [
3099
+ /* @__PURE__ */ jsx34("div", { className: "w-[24px] h-[24px] flex items-center justify-center", children: /* @__PURE__ */ jsx34(IconFileDescription, { size: 20 }) }),
3100
+ /* @__PURE__ */ jsx34("span", { className: "truncate", children: file.name || file.fileName })
3101
+ ] }),
3102
+ !readOnly && !disabled && /* @__PURE__ */ jsx34(
3103
+ IconTrash2,
3104
+ {
3105
+ size: 20,
3106
+ className: "ml-auto text-red-500 cursor-pointer",
3107
+ onClick: (e) => {
3108
+ e.stopPropagation();
3109
+ handleRemoveFile(index);
3110
+ }
3111
+ }
3112
+ )
3113
+ ]
3114
+ },
3115
+ index
3116
+ )) }) })
3098
3117
  ] });
3099
3118
  }
3100
3119
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esic-lab/data-core-ui",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",