@js-empire/emperor-ui 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/emperor-ui.js +52 -48
  2. package/dist/emperor-ui.umd.cjs +8 -8
  3. package/dist/{features-animation-D_Ss-HYx.js → features-animation-uyo1KMg-.js} +1 -1
  4. package/dist/{index-C3mfrNCk.js → index-B3d8-vnJ.js} +4 -4
  5. package/dist/{index-SRvFgjzo.js → index-DOwkJus4.js} +3871 -3600
  6. package/dist/index-DrkA25TM.js +5 -0
  7. package/dist/index.d.ts +89 -7
  8. package/dist/src-UW24ZMRV-D6kiVea5.js +5 -0
  9. package/package.json +1 -1
  10. package/src/components/atoms/uploader/avatar-label.tsx +1 -1
  11. package/src/components/atoms/uploader/index.ts +1 -0
  12. package/src/components/atoms/uploader/stories/uploader.stories.tsx +52 -18
  13. package/src/components/atoms/uploader/upload-file-error-box.tsx +2 -2
  14. package/src/components/atoms/uploader/upload-file-label.tsx +7 -3
  15. package/src/components/atoms/uploader/uploader-title.tsx +21 -0
  16. package/src/components/atoms/uploader/uploader.tsx +3 -0
  17. package/src/components/organisms/footer/footer.tsx +1 -1
  18. package/src/components/organisms/listings/listings.tsx +12 -3
  19. package/src/components/organisms/listings/stories/listings.stories.tsx +30 -0
  20. package/src/components/organisms/listings/styles/classes.ts +11 -0
  21. package/src/components/organisms/listings/styles/index.ts +2 -0
  22. package/src/components/organisms/listings/styles/styles.ts +6 -0
  23. package/src/constants/defaults.ts +3 -26
  24. package/src/hooks/use-uploader.tsx +5 -4
  25. package/src/i18n/configs/i18n.ts +7 -0
  26. package/src/i18n/configs/index.ts +1 -0
  27. package/src/i18n/constants/index.ts +1 -0
  28. package/src/i18n/constants/locales.ts +4 -0
  29. package/src/i18n/index.ts +5 -0
  30. package/src/i18n/locales/ar.ts +15 -0
  31. package/src/i18n/locales/atoms/ar.ts +15 -0
  32. package/src/i18n/locales/atoms/en.ts +15 -0
  33. package/src/i18n/locales/atoms/index.ts +2 -0
  34. package/src/i18n/locales/common/ar.ts +1 -0
  35. package/src/i18n/locales/common/en.ts +1 -0
  36. package/src/i18n/locales/common/index.ts +2 -0
  37. package/src/i18n/locales/en.ts +15 -0
  38. package/src/i18n/locales/index.ts +4 -0
  39. package/src/i18n/locales/molecules/ar.ts +1 -0
  40. package/src/i18n/locales/molecules/en.ts +1 -0
  41. package/src/i18n/locales/molecules/index.ts +2 -0
  42. package/src/i18n/locales/organisms/ar.ts +1 -0
  43. package/src/i18n/locales/organisms/en.ts +1 -0
  44. package/src/i18n/locales/organisms/index.ts +2 -0
  45. package/src/i18n/locales/templates/ar.ts +1 -0
  46. package/src/i18n/locales/templates/en.ts +1 -0
  47. package/src/i18n/locales/templates/index.ts +2 -0
  48. package/src/i18n/locales/toasts/ar.ts +1 -0
  49. package/src/i18n/locales/toasts/en.ts +1 -0
  50. package/src/i18n/locales/toasts/index.ts +2 -0
  51. package/src/i18n/types/index.ts +2 -0
  52. package/src/i18n/types/locale.ts +5 -0
  53. package/src/i18n/types/toasts.ts +3 -0
  54. package/src/i18n/utils/get-locales.ts +4 -0
  55. package/src/i18n/utils/index.ts +2 -0
  56. package/src/i18n/utils/localize.ts +15 -0
  57. package/src/mocks/index.ts +1 -0
  58. package/src/mocks/listings.ts +200 -0
  59. package/src/providers/config-provider.tsx +18 -0
  60. package/src/types/components/atoms/uploader.ts +5 -5
  61. package/src/types/components/molecules/listings/listings.ts +5 -1
  62. package/src/types/context/config.ts +1 -32
  63. package/src/types/context/index.ts +2 -0
  64. package/src/types/context/localization.ts +23 -0
  65. package/src/types/context/theme.ts +17 -0
  66. package/src/utils/index.ts +1 -0
  67. package/src/utils/locales.ts +54 -0
  68. package/src/utils/uploader.ts +6 -5
  69. package/dist/index-CZpTSGZs.js +0 -5
  70. package/dist/src-UW24ZMRV-Ducut0ty.js +0 -5
@@ -8,6 +8,7 @@ import { FileObject, FileType } from "@/types";
8
8
  import { addToast } from "@heroui/react";
9
9
  import { compressImage } from "@/utils";
10
10
  import { Dispatch, SetStateAction } from "react";
11
+ import { Locale } from "@/i18n";
11
12
 
12
13
  // get the corresponding FileType giving the extension of the uploaded file
13
14
  export const mapFileType = (fileType: string): FileType | null => {
@@ -59,7 +60,7 @@ export async function validateUploadedFiles({
59
60
  uploadedFiles: File[];
60
61
  maxFileSize?: number;
61
62
  compressFiles?: boolean;
62
- locale?: Record<string, string> | undefined;
63
+ locale?: Locale;
63
64
  preventDuplicates?: boolean;
64
65
  files: FileObject[];
65
66
  }) {
@@ -69,7 +70,7 @@ export async function validateUploadedFiles({
69
70
  uploadedFiles?.map(async (file) => {
70
71
  if (isMaxFileSizeExceeded({ fileSize: file?.size, maxFileSize })) {
71
72
  addToast({
72
- title: locale?.maxSizeExceededError
73
+ title: locale?.atoms?.uploader?.maxSizeExceededError
73
74
  .replace("MAX_FILE_SIZE", (maxFileSize / 1024 || 0)?.toString())
74
75
  .replace(
75
76
  "UPLOADED_FILE_SIZE",
@@ -90,7 +91,7 @@ export async function validateUploadedFiles({
90
91
  isFileDuplicated({ fileName: file?.name, files })
91
92
  ) {
92
93
  addToast({
93
- title: locale?.duplicatesDenied,
94
+ title: locale?.atoms?.uploader?.duplicatesDenied,
94
95
  });
95
96
  isInValid = true;
96
97
  }
@@ -113,7 +114,7 @@ export async function refineUploadedFiles({
113
114
  setFiles,
114
115
  }: {
115
116
  uploadedFiles: (File | undefined)[];
116
- locale?: Record<string, string> | undefined;
117
+ locale?: Locale;
117
118
  allowedTypes: string[];
118
119
  isMulti: boolean;
119
120
  setFiles: Dispatch<SetStateAction<FileObject[]>>;
@@ -124,7 +125,7 @@ export async function refineUploadedFiles({
124
125
  const fileType = mapFileType(uploadedFile?.type);
125
126
  if (!fileType) {
126
127
  addToast({
127
- title: `${locale?.errorUploadedTypes} ${allowedTypes.join(", ")}`,
128
+ title: `${locale?.atoms?.uploader?.errorUploadedTypes} ${allowedTypes.join(", ")}`,
128
129
  });
129
130
  return;
130
131
  }
@@ -1,5 +0,0 @@
1
- import { d as a } from "./features-animation-D_Ss-HYx.js";
2
- var o = a;
3
- export {
4
- o as default
5
- };
@@ -1,5 +0,0 @@
1
- import { d as a } from "./features-animation-D_Ss-HYx.js";
2
- var r = a;
3
- export {
4
- r as default
5
- };