@js-empire/emperor-ui 1.1.0 → 1.2.0
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/.storybook/vitest.setup.ts +3 -3
- package/.vscode/extensions.json +1 -3
- package/README.md +0 -21
- package/dist/emperor-ui.js +71 -0
- package/dist/emperor-ui.umd.cjs +49 -0
- package/dist/features-animation-D_Ss-HYx.js +1938 -0
- package/dist/globals.css +1 -0
- package/dist/icons/emperor-ui-logo.ico +0 -0
- package/dist/images/avatar-female.jpg +0 -0
- package/dist/images/avatar-male.jpg +0 -0
- package/dist/images/emperor-ui-logo.png +0 -0
- package/dist/index-C3mfrNCk.js +1630 -0
- package/dist/index-CZpTSGZs.js +5 -0
- package/dist/index-SRvFgjzo.js +26257 -0
- package/dist/index.d.ts +706 -0
- package/dist/src-UW24ZMRV-Ducut0ty.js +5 -0
- package/eslint.config.js +5 -14
- package/package.json +4 -4
- package/src/components/atoms/brand/brand.stories.tsx +3 -3
- package/src/components/atoms/brand/brand.tsx +3 -3
- package/src/components/atoms/column/column.stories.tsx +5 -4
- package/src/components/atoms/column/column.tsx +2 -2
- package/src/components/atoms/container/column.stories.tsx +5 -4
- package/src/components/atoms/container/container.tsx +2 -2
- package/src/components/atoms/portal/portal.stories.tsx +4 -4
- package/src/components/atoms/portal/portal.tsx +4 -2
- package/src/components/atoms/row/row.stories.tsx +5 -4
- package/src/components/atoms/row/row.tsx +2 -2
- package/src/components/atoms/uploader/avatar-label.tsx +2 -2
- package/src/components/atoms/uploader/stories/uploader.stories.tsx +127 -8
- package/src/components/atoms/uploader/upload-file-error-box.tsx +1 -1
- package/src/components/atoms/uploader/upload-file-input.tsx +2 -2
- package/src/components/atoms/uploader/upload-file-label.tsx +1 -1
- package/src/components/atoms/uploader/upload-file-listing.tsx +6 -4
- package/src/components/atoms/uploader/uploader.tsx +4 -4
- package/src/components/atoms/uploader/view-image-modal.tsx +6 -5
- package/src/components/molecules/filter/filter.tsx +2 -2
- package/src/components/molecules/item-card/item-card.tsx +2 -2
- package/src/components/molecules/nav-bar/nav-bar-item.tsx +3 -3
- package/src/components/molecules/nav-bar/nav-bar.tsx +4 -4
- package/src/components/molecules/nav-bar/stories/hover-effect/nav-bar-hover-effect.stories.tsx +4 -4
- package/src/components/molecules/nav-bar/stories/nav-bar.stories.tsx +4 -4
- package/src/components/molecules/nav-bar/styles/styles.ts +2 -1
- package/src/components/molecules/nav-bar/sub-items-box.tsx +2 -2
- package/src/components/molecules/scaffold/scaffold.stories.tsx +3 -3
- package/src/components/molecules/scaffold/scaffold.tsx +4 -4
- package/src/components/molecules/side-bar/compact-side-bar.tsx +5 -3
- package/src/components/molecules/side-bar/side-bar-drawer.tsx +3 -3
- package/src/components/molecules/side-bar/side-bar.stories.tsx +9 -8
- package/src/components/molecules/side-bar/side-bar.tsx +2 -2
- package/src/components/molecules/side-bar/styles/styles.ts +1 -1
- package/src/components/organisms/footer/copy-rights-box.tsx +27 -0
- package/src/components/organisms/footer/footer.tsx +69 -14
- package/src/components/organisms/footer/index.ts +4 -0
- package/src/components/organisms/footer/policies-box.tsx +26 -0
- package/src/components/organisms/footer/quick-links-box.tsx +45 -0
- package/src/components/organisms/footer/social-links-box.tsx +32 -0
- package/src/components/organisms/footer/stories/footer.stories.tsx +61 -0
- package/src/components/organisms/footer/styles/classes.ts +58 -2
- package/src/components/organisms/footer/styles/styles.ts +2 -5
- package/src/components/organisms/header/header.tsx +5 -5
- package/src/components/organisms/header/segmented-header-content.tsx +3 -3
- package/src/components/organisms/header/stories/header.stories.tsx +8 -7
- package/src/components/organisms/header/styles/styles.ts +1 -1
- package/src/components/organisms/index.ts +1 -1
- package/src/components/organisms/item-details/item-details.tsx +2 -2
- package/src/components/organisms/listings/listings.tsx +2 -2
- package/src/components/templates/landing-page/landing-page.stories.tsx +3 -3
- package/src/components/templates/landing-page/landing-page.tsx +5 -5
- package/src/constants/defaults.ts +1 -1
- package/src/constants/fake.ts +3 -0
- package/src/constants/footer.tsx +157 -0
- package/src/constants/index.ts +1 -0
- package/src/context/emperor-ui-context.ts +1 -1
- package/src/context/navigation-context.ts +1 -1
- package/src/context/uploader-context.ts +1 -1
- package/src/hooks/use-emperor-ui.ts +1 -1
- package/src/hooks/use-navigation.ts +1 -1
- package/src/hooks/use-uploader-context.ts +1 -1
- package/src/hooks/use-uploader.tsx +42 -106
- package/src/main.tsx +1 -1
- package/src/mocks/header.tsx +1 -1
- package/src/providers/config-provider.tsx +4 -4
- package/src/providers/emperor-ui-provider.tsx +2 -2
- package/src/providers/navigation-provider.tsx +3 -3
- package/src/providers/uploader-provider.tsx +2 -2
- package/src/types/components/atoms/brand.ts +1 -1
- package/src/types/components/atoms/column.ts +1 -1
- package/src/types/components/atoms/container.ts +1 -1
- package/src/types/components/atoms/portal.ts +1 -1
- package/src/types/components/atoms/row.ts +1 -1
- package/src/types/components/atoms/uploader.ts +4 -11
- package/src/types/components/molecules/filter/filter.ts +1 -1
- package/src/types/components/molecules/footer/footer.ts +60 -1
- package/src/types/components/molecules/header/header.ts +1 -1
- package/src/types/components/molecules/item-card/item-card.ts +1 -1
- package/src/types/components/molecules/item-details/item-details.ts +1 -1
- package/src/types/components/molecules/listings/listings.ts +1 -1
- package/src/types/components/molecules/nav-bar/nav-bar.ts +2 -1
- package/src/types/components/molecules/scaffold/scaffold.ts +1 -1
- package/src/types/components/molecules/side-bar/side-bar.ts +1 -1
- package/src/types/components/templates/landing-page.ts +1 -1
- package/src/types/context/navigation.ts +1 -1
- package/src/utils/compress-images.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/storybook.tsx +3 -3
- package/src/utils/uploader.ts +148 -0
- package/tsconfig.app.json +1 -10
- package/vite.config.ts +1 -10
- package/vitest.shims.d.ts +1 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CopyRights,
|
|
3
|
+
Contacts,
|
|
4
|
+
QuickLink,
|
|
5
|
+
QuickLinkCollection,
|
|
6
|
+
SocialLink,
|
|
7
|
+
} from "@/types";
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
FacebookIcon,
|
|
11
|
+
InstagramIcon,
|
|
12
|
+
LinkedinIcon,
|
|
13
|
+
TwitterIcon,
|
|
14
|
+
YoutubeIcon,
|
|
15
|
+
} from "lucide-react";
|
|
16
|
+
|
|
17
|
+
export const quickLinks: QuickLinkCollection[] = [
|
|
18
|
+
{
|
|
19
|
+
title: "Products",
|
|
20
|
+
links: [
|
|
21
|
+
{
|
|
22
|
+
label: "Product 1",
|
|
23
|
+
href: "/product-1",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: "Product 2",
|
|
27
|
+
href: "/product-2",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: "Product 3",
|
|
31
|
+
href: "/product-3",
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: "Services",
|
|
37
|
+
links: [
|
|
38
|
+
{
|
|
39
|
+
label: "Service 1",
|
|
40
|
+
href: "/service-1",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "Service 2",
|
|
44
|
+
href: "/service-2",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "Service 3",
|
|
48
|
+
href: "/service-3",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: "Service 4",
|
|
52
|
+
href: "/service-4",
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: "Resources",
|
|
58
|
+
links: [
|
|
59
|
+
{
|
|
60
|
+
label: "Resource 1",
|
|
61
|
+
href: "/resource-1",
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
title: "Company",
|
|
67
|
+
links: [
|
|
68
|
+
{
|
|
69
|
+
label: "About Us",
|
|
70
|
+
href: "/about-us",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: "Careers",
|
|
74
|
+
href: "/careers",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
label: "Blog",
|
|
78
|
+
href: "/blog",
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
title: "Support",
|
|
84
|
+
links: [
|
|
85
|
+
{
|
|
86
|
+
label: "Contact Us",
|
|
87
|
+
href: "/contact-us",
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
export const policies: QuickLink[] = [
|
|
94
|
+
{
|
|
95
|
+
label: "Privacy Policy",
|
|
96
|
+
href: "/privacy-policy",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
label: "Terms of Service",
|
|
100
|
+
href: "/terms-of-service",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
label: "Cookie Policy",
|
|
104
|
+
href: "/cookie-policy",
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
export const copyRights: CopyRights = {
|
|
109
|
+
year: 2026,
|
|
110
|
+
text: "All rights reserved - Emperor UI",
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const contacts: Contacts = {
|
|
114
|
+
mobile: "+964 770 000 0000",
|
|
115
|
+
email: "contact@emperorui.com",
|
|
116
|
+
website: "https://jsempire.com",
|
|
117
|
+
workingHours: "Monday - Friday: 9:00 AM - 5:00 PM",
|
|
118
|
+
addresses: [
|
|
119
|
+
{
|
|
120
|
+
country: "Jordan",
|
|
121
|
+
street: "Amman, Jordan",
|
|
122
|
+
city: "Amman",
|
|
123
|
+
state: "Amman",
|
|
124
|
+
zip: "11111",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
country: "Saudi Arabia",
|
|
128
|
+
street: "Riyadh, Saudi Arabia",
|
|
129
|
+
city: "Riyadh",
|
|
130
|
+
state: "Riyadh",
|
|
131
|
+
zip: "11111",
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const socialLinks: SocialLink[] = [
|
|
137
|
+
{
|
|
138
|
+
href: "https://facebook.com",
|
|
139
|
+
icon: <FacebookIcon />,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
href: "https://twitter.com",
|
|
143
|
+
icon: <TwitterIcon />,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
href: "https://instagram.com",
|
|
147
|
+
icon: <InstagramIcon />,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
href: "https://linkedin.com",
|
|
151
|
+
icon: <LinkedinIcon />,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
href: "https://youtube.com",
|
|
155
|
+
icon: <YoutubeIcon />,
|
|
156
|
+
},
|
|
157
|
+
];
|
package/src/constants/index.ts
CHANGED
|
@@ -1,31 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { addToast } from "@heroui/react";
|
|
4
|
-
import {
|
|
5
|
-
FileObject,
|
|
6
|
-
FileType,
|
|
7
|
-
UseUploadFileProps,
|
|
8
|
-
UseUploadFileReturn,
|
|
9
|
-
} from "@types";
|
|
4
|
+
import { FileObject, UseUploadFileProps, UseUploadFileReturn } from "@/types";
|
|
10
5
|
import { useState } from "react";
|
|
11
|
-
import { useEmperorUI } from "
|
|
12
|
-
import { compressImage } from "@utils";
|
|
6
|
+
import { useEmperorUI } from "@/hooks";
|
|
13
7
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} from "
|
|
8
|
+
validateUploadedFiles,
|
|
9
|
+
getAllowedTypes,
|
|
10
|
+
refineUploadedFiles,
|
|
11
|
+
} from "@/utils";
|
|
12
|
+
import { ONE_MEGABYTE } from "@/constants";
|
|
19
13
|
|
|
20
14
|
export const useUploader = ({
|
|
21
15
|
labelContent,
|
|
22
16
|
labelId,
|
|
23
17
|
fileTypes,
|
|
24
|
-
isRequired =
|
|
18
|
+
isRequired = false,
|
|
25
19
|
isDraggable = true,
|
|
26
20
|
isMulti = false,
|
|
27
21
|
preventDuplicates = true,
|
|
28
|
-
maxCount =
|
|
22
|
+
maxCount = 10,
|
|
29
23
|
maxFileSize = ONE_MEGABYTE * 10,
|
|
30
24
|
compressFiles = false,
|
|
31
25
|
onChange = () => {},
|
|
@@ -39,57 +33,37 @@ export const useUploader = ({
|
|
|
39
33
|
|
|
40
34
|
const locale = locales?.[lang || "en"];
|
|
41
35
|
|
|
42
|
-
// remove
|
|
36
|
+
// remove a specific uploaded file
|
|
43
37
|
const handleClearFile = (fileName?: string) => {
|
|
44
38
|
setFiles((prev) => prev?.filter((file) => file?.file?.name !== fileName));
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// get the corresponding FileType giving the extension of the uploaded file
|
|
48
|
-
const mapFileType = (fileType: string): FileType | null => {
|
|
49
|
-
if (ALLOWED_IMAGES_TYPES.includes(fileType)) return "image";
|
|
50
|
-
if (ALLOWED_PDF_TYPES.includes(fileType)) return "pdf";
|
|
51
|
-
if (ALLOWED_DOC_TYPES.includes(fileType)) return "doc";
|
|
52
|
-
|
|
53
|
-
return null;
|
|
54
|
-
};
|
|
55
39
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (fileType === "pdf") allowedTypes.push(...ALLOWED_PDF_TYPES);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
return allowedTypes;
|
|
40
|
+
// Reset the input value to allow re-uploading the same file
|
|
41
|
+
if (labelId) {
|
|
42
|
+
const input = document.getElementById(labelId) as HTMLInputElement;
|
|
43
|
+
if (input) {
|
|
44
|
+
input.value = "";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
67
47
|
};
|
|
68
48
|
|
|
69
|
-
// check if the file size exceeds the maxFileSize
|
|
70
|
-
const isMaxFileSizeExceeded = (fileSize: number): boolean =>
|
|
71
|
-
fileSize > maxFileSize * 1024;
|
|
72
|
-
|
|
73
|
-
const isDuplicated = (name: string): boolean =>
|
|
74
|
-
files?.filter(({ file }) => file?.name === name)?.length > 0;
|
|
75
|
-
|
|
76
49
|
// handle the uploading process including the window upload and the drag-and-drop upload
|
|
77
50
|
const onInputChange = async (
|
|
78
51
|
event: React.ChangeEvent<HTMLInputElement> &
|
|
79
52
|
React.DragEvent<HTMLLabelElement>,
|
|
80
|
-
): Promise<void> => {
|
|
53
|
+
): Promise<void | string | null> => {
|
|
54
|
+
console.log("files: ", event.target.files);
|
|
55
|
+
|
|
81
56
|
if (
|
|
82
57
|
(!event.target.files || !event.target.files?.[0]) &&
|
|
83
58
|
(!event?.dataTransfer?.files || !event?.dataTransfer?.files[0])
|
|
84
59
|
) {
|
|
85
|
-
addToast({
|
|
60
|
+
return addToast({
|
|
86
61
|
title: locale?.errorUploadingFile,
|
|
87
62
|
});
|
|
88
|
-
return;
|
|
89
63
|
}
|
|
90
64
|
|
|
91
65
|
// validate the file type according to the given allowed types
|
|
92
|
-
const allowedTypes = getAllowedTypes();
|
|
66
|
+
const allowedTypes = getAllowedTypes(fileTypes);
|
|
93
67
|
|
|
94
68
|
// verify if the files exist
|
|
95
69
|
if (!event.target.files && !event.dataTransfer.files) return;
|
|
@@ -125,70 +99,26 @@ export const useUploader = ({
|
|
|
125
99
|
|
|
126
100
|
// validate the files' sizes if none of them exceeds the maximum allowed size
|
|
127
101
|
// validate files' names to ensure there are no duplicates if specified
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
.replace(
|
|
137
|
-
"UPLOADED_FILE_SIZE",
|
|
138
|
-
(file?.size / 1024 / 1024 || 0)?.toFixed(1)?.toString(),
|
|
139
|
-
),
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
if (compressFiles) {
|
|
143
|
-
return (await compressImage({ file }))?.file;
|
|
144
|
-
} else {
|
|
145
|
-
isInValid = true;
|
|
146
|
-
return file;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (preventDuplicates && isDuplicated(file?.name)) {
|
|
151
|
-
addToast({
|
|
152
|
-
title: locale?.duplicatesDenied,
|
|
153
|
-
});
|
|
154
|
-
isInValid = true;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return file;
|
|
158
|
-
}),
|
|
159
|
-
);
|
|
102
|
+
const { compressedFiles, isInValid } = await validateUploadedFiles({
|
|
103
|
+
uploadedFiles,
|
|
104
|
+
maxFileSize,
|
|
105
|
+
compressFiles,
|
|
106
|
+
preventDuplicates,
|
|
107
|
+
files,
|
|
108
|
+
locale,
|
|
109
|
+
});
|
|
160
110
|
|
|
161
111
|
if (isInValid) return;
|
|
162
112
|
|
|
163
113
|
setIsLoading(true);
|
|
164
114
|
|
|
165
115
|
await Promise.all(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
title: `${locale?.errorUploadedTypes} ${allowedTypes.join(", ")}`,
|
|
173
|
-
});
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// set the file to be utilized, and the image to be viewed
|
|
178
|
-
const reader = new FileReader();
|
|
179
|
-
reader.onload = () => {
|
|
180
|
-
setFiles((prevFiles) => [
|
|
181
|
-
...(isMulti ? prevFiles : []),
|
|
182
|
-
{
|
|
183
|
-
file: uploadedFile,
|
|
184
|
-
view: reader.result as string,
|
|
185
|
-
type: fileType,
|
|
186
|
-
url: URL.createObjectURL(uploadedFile),
|
|
187
|
-
},
|
|
188
|
-
]);
|
|
189
|
-
};
|
|
190
|
-
reader.readAsDataURL(uploadedFile);
|
|
191
|
-
}
|
|
116
|
+
await refineUploadedFiles({
|
|
117
|
+
uploadedFiles: compressedFiles,
|
|
118
|
+
locale,
|
|
119
|
+
allowedTypes,
|
|
120
|
+
isMulti,
|
|
121
|
+
setFiles,
|
|
192
122
|
}),
|
|
193
123
|
).finally(() => {
|
|
194
124
|
setIsLoading(false);
|
|
@@ -197,6 +127,12 @@ export const useUploader = ({
|
|
|
197
127
|
setTimeout(() => {
|
|
198
128
|
onChange();
|
|
199
129
|
}, 200);
|
|
130
|
+
|
|
131
|
+
// Reset the input value to allow re-uploading the same file
|
|
132
|
+
// Only reset for input change events, not drag events
|
|
133
|
+
if (event.target && "value" in event.target && event.target.files) {
|
|
134
|
+
(event.target as HTMLInputElement).value = "";
|
|
135
|
+
}
|
|
200
136
|
};
|
|
201
137
|
|
|
202
138
|
return {
|
package/src/main.tsx
CHANGED
package/src/mocks/header.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Scaffold } from "
|
|
2
|
-
import { defaultEmperorUIConfig } from "
|
|
3
|
-
import { EmperorUIContext } from "
|
|
1
|
+
import { Scaffold } from "@/components";
|
|
2
|
+
import { defaultEmperorUIConfig } from "@/constants";
|
|
3
|
+
import { EmperorUIContext } from "@/context";
|
|
4
4
|
import type {
|
|
5
5
|
ConfigContextState,
|
|
6
6
|
ConfigProviderProps,
|
|
7
7
|
EmperorUIConfig,
|
|
8
|
-
} from "
|
|
8
|
+
} from "@/types";
|
|
9
9
|
import { useMemo } from "react";
|
|
10
10
|
|
|
11
11
|
export function ConfigProvider({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConfigProviderProps } from "
|
|
2
|
-
import { ConfigProvider, NavigationProvider } from "
|
|
1
|
+
import { ConfigProviderProps } from "@/types";
|
|
2
|
+
import { ConfigProvider, NavigationProvider } from "@/providers";
|
|
3
3
|
import { HeroUIProvider, ToastProvider } from "@heroui/react";
|
|
4
4
|
import { Fragment } from "react";
|
|
5
5
|
|
|
@@ -2,10 +2,10 @@ import type {
|
|
|
2
2
|
NavigationProviderProps,
|
|
3
3
|
NavigationContextState,
|
|
4
4
|
NavigationItem,
|
|
5
|
-
} from "
|
|
5
|
+
} from "@/types";
|
|
6
6
|
import { useMemo, useState } from "react";
|
|
7
|
-
import { NavigationContext } from "
|
|
8
|
-
import { PreservedKeys } from "
|
|
7
|
+
import { NavigationContext } from "@/context";
|
|
8
|
+
import { PreservedKeys } from "@/enums";
|
|
9
9
|
|
|
10
10
|
export function NavigationProvider({ children }: NavigationProviderProps) {
|
|
11
11
|
const [hoveredItemId, setHoveredItemId] = useState<string | null>(null);
|
|
@@ -2,9 +2,9 @@ import type {
|
|
|
2
2
|
UploaderProviderProps,
|
|
3
3
|
UploaderContextState,
|
|
4
4
|
FileObject,
|
|
5
|
-
} from "
|
|
5
|
+
} from "@/types";
|
|
6
6
|
import { useMemo, useState } from "react";
|
|
7
|
-
import { UploaderContext } from "
|
|
7
|
+
import { UploaderContext } from "@/context";
|
|
8
8
|
import { useDisclosure } from "@heroui/react";
|
|
9
9
|
|
|
10
10
|
export function UploaderProvider({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { SharedComponentProps } from "
|
|
1
|
+
import type { SharedComponentProps } from "@/types";
|
|
2
|
+
import { ModalProps } from "@heroui/react";
|
|
2
3
|
import { Dispatch, ReactNode, SetStateAction } from "react";
|
|
3
4
|
|
|
4
5
|
export type UploaderProps = SharedComponentProps &
|
|
@@ -54,15 +55,10 @@ export type UseUploadFileReturn = {
|
|
|
54
55
|
onInputChange: (
|
|
55
56
|
event: React.ChangeEvent<HTMLInputElement> &
|
|
56
57
|
React.DragEvent<HTMLLabelElement>,
|
|
57
|
-
) => Promise<void>;
|
|
58
|
+
) => Promise<void | string | null>;
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
export type UploaderContextState = {
|
|
61
|
-
isOpen?: boolean;
|
|
62
|
-
onClose?: () => void;
|
|
63
|
-
onOpen?: () => void;
|
|
64
|
-
onOpenChange?: (isOpen: boolean) => void;
|
|
65
|
-
|
|
66
62
|
selectedFile?: FileObject | null;
|
|
67
63
|
setSelectedFile?: (file: FileObject | null) => void;
|
|
68
64
|
|
|
@@ -84,11 +80,8 @@ export type UploaderContextState = {
|
|
|
84
80
|
onInputChange: SharedOnInputChangeType;
|
|
85
81
|
handleClearFile: (fileName?: string) => void;
|
|
86
82
|
|
|
87
|
-
modal?: {
|
|
88
|
-
isOpen?: boolean;
|
|
83
|
+
modal?: Omit<ModalProps, "children"> & {
|
|
89
84
|
onOpen?: () => void;
|
|
90
|
-
onClose?: () => void;
|
|
91
|
-
onOpenChange?: (isOpen: boolean) => void;
|
|
92
85
|
};
|
|
93
86
|
classNames?: {
|
|
94
87
|
label?: string;
|
|
@@ -1,9 +1,68 @@
|
|
|
1
|
-
import type { SharedComponentProps } from "
|
|
1
|
+
import type { SharedComponentProps } from "@/types";
|
|
2
|
+
import { ReactNode } from "react";
|
|
2
3
|
|
|
3
4
|
export type FooterClassnames = {
|
|
4
5
|
base?: string;
|
|
6
|
+
content?: string;
|
|
7
|
+
policiesWrapper?: string;
|
|
8
|
+
policy?: string;
|
|
9
|
+
quickLinksWrapper?: string;
|
|
10
|
+
quickLinksTitle?: string;
|
|
11
|
+
quickLinksList?: string;
|
|
12
|
+
quickLinksItem?: string;
|
|
13
|
+
quickLinksLink?: string;
|
|
14
|
+
socialLinksWrapper?: string;
|
|
15
|
+
socialLink?: string;
|
|
16
|
+
copyRightsWrapper?: string;
|
|
17
|
+
copyRightsText?: string;
|
|
18
|
+
contactsWrapper?: string;
|
|
19
|
+
contact?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type QuickLink = {
|
|
23
|
+
label: string;
|
|
24
|
+
href: string;
|
|
25
|
+
isExternal?: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type QuickLinkCollection = {
|
|
29
|
+
title?: string;
|
|
30
|
+
links: QuickLink[];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type SocialLink = {
|
|
34
|
+
label?: string;
|
|
35
|
+
href: string;
|
|
36
|
+
icon?: ReactNode;
|
|
37
|
+
isExternal?: boolean;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type Address = {
|
|
41
|
+
country?: string;
|
|
42
|
+
street?: string;
|
|
43
|
+
city?: string;
|
|
44
|
+
state?: string;
|
|
45
|
+
zip?: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type CopyRights = {
|
|
49
|
+
year: number;
|
|
50
|
+
text: string;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type Contacts = {
|
|
54
|
+
mobile?: string;
|
|
55
|
+
email?: string;
|
|
56
|
+
addresses?: Address[];
|
|
57
|
+
website?: string;
|
|
58
|
+
workingHours?: string;
|
|
5
59
|
};
|
|
6
60
|
|
|
7
61
|
export type FooterProps = SharedComponentProps & {
|
|
8
62
|
classNames?: FooterClassnames;
|
|
63
|
+
policies?: QuickLink[];
|
|
64
|
+
quickLinks?: QuickLinkCollection[];
|
|
65
|
+
socialLinks?: SocialLink[];
|
|
66
|
+
copyRights?: CopyRights;
|
|
67
|
+
contacts?: Contacts;
|
|
9
68
|
};
|
|
@@ -2,7 +2,7 @@ import type {
|
|
|
2
2
|
ComponentRadius,
|
|
3
3
|
ComponentSize,
|
|
4
4
|
SharedComponentProps,
|
|
5
|
-
} from "
|
|
5
|
+
} from "@/types";
|
|
6
6
|
import type { ElementType } from "react";
|
|
7
7
|
|
|
8
8
|
export type NavBarClassnames = {
|
|
@@ -34,6 +34,7 @@ export type NavBarStylesProps = {
|
|
|
34
34
|
variant?: NavBarVariant;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
37
38
|
export type NavBarMenuStylesProps = {};
|
|
38
39
|
|
|
39
40
|
export type NavBarItemStylesProps = {
|