@js-empire/emperor-ui 1.0.1 → 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/.husky/pre-commit +4 -0
- package/.storybook/main.ts +2 -11
- package/.storybook/preview.ts +1 -1
- package/.storybook/vitest.setup.ts +3 -3
- package/.vscode/extensions.json +1 -0
- package/README.md +47 -1
- package/dist/emperor-ui.js +69 -3169
- package/dist/emperor-ui.umd.cjs +45 -2
- 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 +552 -46
- package/dist/src-UW24ZMRV-Ducut0ty.js +5 -0
- package/eslint.config.js +5 -14
- package/package.json +19 -7
- package/public/icons/emperor-ui-logo.ico +0 -0
- package/public/images/avatar-female.jpg +0 -0
- package/public/images/avatar-male.jpg +0 -0
- package/public/images/emperor-ui-logo.png +0 -0
- package/src/components/atoms/brand/brand.stories.tsx +27 -0
- package/src/components/atoms/brand/brand.tsx +56 -0
- package/src/components/atoms/brand/index.ts +1 -0
- package/src/components/atoms/brand/styles/classes.ts +9 -0
- package/src/components/atoms/brand/styles/index.ts +2 -0
- package/src/components/atoms/brand/styles/styles.ts +0 -0
- package/src/components/atoms/column/column.stories.tsx +37 -0
- package/src/components/atoms/column/column.tsx +21 -0
- package/src/components/atoms/column/index.ts +1 -0
- package/src/components/atoms/container/column.stories.tsx +37 -0
- package/src/components/atoms/container/container.tsx +28 -0
- package/src/components/atoms/container/index.ts +1 -0
- package/src/components/atoms/index.ts +6 -0
- package/src/components/atoms/portal/index.ts +1 -0
- package/src/components/atoms/portal/portal.stories.tsx +43 -0
- package/src/components/atoms/portal/portal.tsx +25 -0
- package/src/components/atoms/row/index.ts +1 -0
- package/src/components/atoms/row/row.stories.tsx +37 -0
- package/src/components/atoms/row/row.tsx +26 -0
- package/src/components/atoms/uploader/avatar-label.tsx +83 -0
- package/src/components/atoms/uploader/index.ts +7 -0
- package/src/components/atoms/uploader/stories/uploader.stories.tsx +160 -0
- package/src/components/atoms/uploader/upload-file-error-box.tsx +29 -0
- package/src/components/atoms/uploader/upload-file-input.tsx +36 -0
- package/src/components/atoms/uploader/upload-file-label.tsx +74 -0
- package/src/components/atoms/uploader/upload-file-listing.tsx +55 -0
- package/src/components/atoms/uploader/uploader.tsx +55 -0
- package/src/components/atoms/uploader/view-image-modal.tsx +40 -0
- package/src/components/index.ts +4 -8
- package/src/components/{filter → molecules/filter}/filter.tsx +2 -2
- package/src/components/molecules/index.ts +5 -0
- package/src/components/molecules/item-card/item-card.tsx +6 -0
- package/src/components/molecules/nav-bar/index.ts +3 -0
- package/src/components/molecules/nav-bar/nav-bar-item.tsx +70 -0
- package/src/components/molecules/nav-bar/nav-bar.tsx +65 -0
- package/src/components/molecules/nav-bar/stories/hover-effect/nav-bar-hover-effect.stories.tsx +52 -0
- package/src/components/molecules/nav-bar/stories/nav-bar.stories.tsx +50 -0
- package/src/components/molecules/nav-bar/styles/classes.ts +68 -0
- package/src/components/molecules/nav-bar/styles/index.ts +2 -0
- package/src/components/molecules/nav-bar/styles/styles.ts +85 -0
- package/src/components/molecules/nav-bar/sub-items-box.tsx +57 -0
- package/src/components/molecules/scaffold/scaffold.stories.tsx +21 -0
- package/src/components/molecules/scaffold/scaffold.tsx +36 -0
- package/src/components/molecules/side-bar/compact-side-bar.tsx +75 -0
- package/src/components/molecules/side-bar/index.ts +1 -0
- package/src/components/molecules/side-bar/side-bar-drawer.tsx +124 -0
- package/src/components/molecules/side-bar/side-bar.stories.tsx +111 -0
- package/src/components/molecules/side-bar/side-bar.tsx +31 -0
- package/src/components/molecules/side-bar/styles/classes.ts +28 -0
- package/src/components/molecules/side-bar/styles/index.ts +2 -0
- package/src/components/molecules/side-bar/styles/styles.ts +13 -0
- package/src/components/organisms/footer/copy-rights-box.tsx +27 -0
- package/src/components/organisms/footer/footer.tsx +75 -0
- package/src/components/organisms/footer/index.ts +5 -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 +71 -0
- package/src/components/organisms/footer/styles/index.ts +2 -0
- package/src/components/organisms/footer/styles/styles.ts +6 -0
- package/src/components/organisms/header/header.tsx +94 -0
- package/src/components/organisms/header/segmented-header-content.tsx +37 -0
- package/src/components/organisms/header/stories/header.stories.tsx +144 -0
- package/src/components/organisms/header/styles/classes.ts +22 -0
- package/src/components/organisms/header/styles/index.ts +2 -0
- package/src/components/organisms/header/styles/styles.ts +39 -0
- package/src/components/organisms/index.ts +4 -0
- package/src/components/{item-details → organisms/item-details}/item-details.tsx +2 -2
- package/src/components/{listings → organisms/listings}/listings.tsx +2 -2
- package/src/components/templates/index.ts +1 -0
- package/src/components/templates/landing-page/index.ts +1 -0
- package/src/components/templates/landing-page/landing-page.stories.tsx +21 -0
- package/src/components/templates/landing-page/landing-page.tsx +57 -0
- package/src/components/templates/landing-page/styles/classes.ts +11 -0
- package/src/components/templates/landing-page/styles/index.ts +1 -0
- package/src/constants/defaults.ts +43 -8
- package/src/constants/fake.ts +5 -0
- package/src/constants/footer.tsx +157 -0
- package/src/constants/index.ts +3 -0
- package/src/constants/uploader.ts +27 -0
- package/src/context/emperor-ui-context.ts +4 -4
- package/src/context/index.ts +2 -0
- package/src/context/navigation-context.ts +6 -0
- package/src/context/uploader-context.ts +6 -0
- package/src/enums/index.ts +2 -0
- package/src/enums/placeholders.ts +4 -0
- package/src/enums/preserved-keys.ts +3 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/use-emperor-ui.ts +1 -1
- package/src/hooks/use-navigation.ts +12 -0
- package/src/hooks/use-uploader-context.ts +14 -0
- package/src/hooks/use-uploader.tsx +151 -0
- package/src/index.ts +9 -5
- package/src/main.tsx +3 -0
- package/src/mocks/header.tsx +118 -0
- package/src/mocks/index.ts +1 -0
- package/src/providers/config-provider.tsx +54 -0
- package/src/providers/emperor-ui-provider.tsx +17 -24
- package/src/providers/index.ts +3 -0
- package/src/providers/navigation-provider.tsx +42 -0
- package/src/providers/uploader-provider.tsx +53 -0
- package/src/styles/globals.css +13 -0
- package/src/styles/hero.ts +2 -0
- package/src/types/components/atoms/brand.ts +13 -0
- package/src/types/components/atoms/column.ts +3 -0
- package/src/types/components/atoms/container.ts +3 -0
- package/src/types/components/atoms/index.ts +6 -0
- package/src/types/components/atoms/portal.ts +6 -0
- package/src/types/components/atoms/row.ts +3 -0
- package/src/types/components/atoms/uploader.ts +97 -0
- package/src/types/components/index.ts +3 -8
- package/src/types/components/{filter → molecules/filter}/filter.ts +1 -1
- package/src/types/components/molecules/footer/footer.ts +68 -0
- package/src/types/components/molecules/header/header.ts +51 -0
- package/src/types/components/molecules/index.ts +9 -0
- package/src/types/components/{item-card → molecules/item-card}/item-card.ts +1 -1
- package/src/types/components/{item-details → molecules/item-details}/item-details.ts +1 -1
- package/src/types/components/{listings → molecules/listings}/listings.ts +1 -1
- package/src/types/components/molecules/nav-bar/nav-bar.ts +66 -0
- package/src/types/components/{scaffold → molecules/scaffold}/scaffold.ts +1 -1
- package/src/types/components/molecules/side-bar/index.ts +1 -0
- package/src/types/components/molecules/side-bar/side-bar.ts +40 -0
- package/src/types/components/templates/index.ts +1 -0
- package/src/types/components/templates/landing-page.ts +10 -0
- package/src/types/context/config.ts +54 -0
- package/src/types/context/index.ts +2 -1
- package/src/types/context/navigation.ts +17 -0
- package/src/types/shared/components.ts +4 -0
- package/src/utils/compress-images.ts +36 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/storybook.tsx +15 -0
- package/src/utils/uploader.ts +148 -0
- package/tsconfig.app.json +1 -9
- package/tsconfig.node.json +0 -1
- package/vite.config.ts +3 -8
- package/vitest.shims.d.ts +1 -1
- package/src/components/footer/footer.tsx +0 -6
- package/src/components/footer/index.ts +0 -1
- package/src/components/header/header.tsx +0 -49
- package/src/components/item-card/item-card.tsx +0 -6
- package/src/components/nav-bar/index.ts +0 -1
- package/src/components/nav-bar/nav-bar.tsx +0 -6
- package/src/components/scaffold/scaffold.tsx +0 -15
- package/src/index.css +0 -1
- package/src/types/components/footer/footer.ts +0 -9
- package/src/types/components/header/header.ts +0 -21
- package/src/types/components/nav-bar/nav-bar.ts +0 -9
- package/src/types/context/emperor-ui.ts +0 -37
- package/tailwind.config.js +0 -6
- /package/src/components/{filter → molecules/filter}/index.ts +0 -0
- /package/src/components/{item-card → molecules/item-card}/index.ts +0 -0
- /package/src/components/{scaffold → molecules/scaffold}/index.ts +0 -0
- /package/src/components/{header → organisms/header}/index.ts +0 -0
- /package/src/components/{item-details → organisms/item-details}/index.ts +0 -0
- /package/src/components/{listings → organisms/listings}/index.ts +0 -0
- /package/src/types/components/{filter → molecules/filter}/index.ts +0 -0
- /package/src/types/components/{footer → molecules/footer}/index.ts +0 -0
- /package/src/types/components/{header → molecules/header}/index.ts +0 -0
- /package/src/types/components/{item-card → molecules/item-card}/index.ts +0 -0
- /package/src/types/components/{item-details → molecules/item-details}/index.ts +0 -0
- /package/src/types/components/{listings → molecules/listings}/index.ts +0 -0
- /package/src/types/components/{nav-bar → molecules/nav-bar}/index.ts +0 -0
- /package/src/types/components/{scaffold → molecules/scaffold}/index.ts +0 -0
package/src/index.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import "./styles/globals.css";
|
|
2
|
+
|
|
1
3
|
export * from "./components";
|
|
2
|
-
export type * from "./types";
|
|
3
|
-
export * from "./utils";
|
|
4
|
-
export * from "./providers";
|
|
5
|
-
export * from "./context";
|
|
6
|
-
export * from "./hooks";
|
|
7
4
|
export * from "./constants";
|
|
5
|
+
export * from "./context";
|
|
8
6
|
export * from "./examples";
|
|
7
|
+
export * from "./hooks";
|
|
8
|
+
export * from "./providers";
|
|
9
|
+
export type * from "./types";
|
|
10
|
+
export * from "./utils";
|
|
11
|
+
export * from "./mocks";
|
|
12
|
+
export * from "./enums";
|
package/src/main.tsx
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { SideBarAction, NavigationItem } from "@/types";
|
|
2
|
+
import {
|
|
3
|
+
HelpCircleIcon,
|
|
4
|
+
HomeIcon,
|
|
5
|
+
InfoIcon,
|
|
6
|
+
LifeBuoyIcon,
|
|
7
|
+
LogOutIcon,
|
|
8
|
+
MailIcon,
|
|
9
|
+
ServerIcon,
|
|
10
|
+
SettingsIcon,
|
|
11
|
+
} from "lucide-react";
|
|
12
|
+
|
|
13
|
+
export const MOCK_HEADER_SUB_ITEMS: NavigationItem[] = [
|
|
14
|
+
{
|
|
15
|
+
id: "info",
|
|
16
|
+
label: "Info",
|
|
17
|
+
href: "#info",
|
|
18
|
+
Icon: InfoIcon,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: "contact",
|
|
22
|
+
label: "Contact",
|
|
23
|
+
href: "#contact",
|
|
24
|
+
Icon: MailIcon,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "services",
|
|
28
|
+
label: "Services",
|
|
29
|
+
href: "#services",
|
|
30
|
+
Icon: ServerIcon,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "settings",
|
|
34
|
+
label: "Settings",
|
|
35
|
+
href: "#settings",
|
|
36
|
+
Icon: SettingsIcon,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "help",
|
|
40
|
+
label: "Help",
|
|
41
|
+
href: "#help",
|
|
42
|
+
Icon: HelpCircleIcon,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "support",
|
|
46
|
+
label: "Support",
|
|
47
|
+
href: "#support",
|
|
48
|
+
Icon: LifeBuoyIcon,
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
export const MOCK_HEADER_ITEMS: NavigationItem[] = [
|
|
53
|
+
{
|
|
54
|
+
id: "home",
|
|
55
|
+
label: "Home",
|
|
56
|
+
href: "#home",
|
|
57
|
+
Icon: HomeIcon,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "about",
|
|
61
|
+
label: "About",
|
|
62
|
+
href: "#about",
|
|
63
|
+
Icon: InfoIcon,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "contact",
|
|
67
|
+
label: "Contact",
|
|
68
|
+
href: "#contact",
|
|
69
|
+
Icon: MailIcon,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "services",
|
|
73
|
+
label: "Services",
|
|
74
|
+
href: "#services",
|
|
75
|
+
Icon: ServerIcon,
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
export const MOCK_HEADER_ITEMS_WITH_SUB_ITEMS: NavigationItem[] = [
|
|
80
|
+
{
|
|
81
|
+
id: "home",
|
|
82
|
+
label: "Home",
|
|
83
|
+
href: "#home",
|
|
84
|
+
Icon: HomeIcon,
|
|
85
|
+
subItems: MOCK_HEADER_SUB_ITEMS,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "about",
|
|
89
|
+
label: "About",
|
|
90
|
+
href: "#about",
|
|
91
|
+
Icon: InfoIcon,
|
|
92
|
+
subItems: MOCK_HEADER_SUB_ITEMS,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: "contact",
|
|
96
|
+
label: "Contact",
|
|
97
|
+
href: "#contact",
|
|
98
|
+
Icon: MailIcon,
|
|
99
|
+
subItems: MOCK_HEADER_SUB_ITEMS,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "services",
|
|
103
|
+
label: "Services",
|
|
104
|
+
href: "#services",
|
|
105
|
+
Icon: ServerIcon,
|
|
106
|
+
subItems: MOCK_HEADER_SUB_ITEMS,
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
export const MOCK_HEADER_ACTIONS: SideBarAction[] = [
|
|
111
|
+
{
|
|
112
|
+
key: "logout",
|
|
113
|
+
label: "Logout",
|
|
114
|
+
color: "danger",
|
|
115
|
+
onPress: () => console.log("logout"),
|
|
116
|
+
startContent: <LogOutIcon />,
|
|
117
|
+
},
|
|
118
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./header";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Scaffold } from "@/components";
|
|
2
|
+
import { defaultEmperorUIConfig } from "@/constants";
|
|
3
|
+
import { EmperorUIContext } from "@/context";
|
|
4
|
+
import type {
|
|
5
|
+
ConfigContextState,
|
|
6
|
+
ConfigProviderProps,
|
|
7
|
+
EmperorUIConfig,
|
|
8
|
+
} from "@/types";
|
|
9
|
+
import { useMemo } from "react";
|
|
10
|
+
|
|
11
|
+
export function ConfigProvider({
|
|
12
|
+
children,
|
|
13
|
+
config = defaultEmperorUIConfig,
|
|
14
|
+
}: ConfigProviderProps) {
|
|
15
|
+
const emperorUIProviderValue: ConfigContextState = useMemo(() => {
|
|
16
|
+
const mergedConfig: EmperorUIConfig = {
|
|
17
|
+
layout: {
|
|
18
|
+
...defaultEmperorUIConfig?.layout,
|
|
19
|
+
...config?.layout,
|
|
20
|
+
},
|
|
21
|
+
theme: {
|
|
22
|
+
...defaultEmperorUIConfig?.theme,
|
|
23
|
+
...config?.theme,
|
|
24
|
+
colors: {
|
|
25
|
+
...defaultEmperorUIConfig?.theme?.colors,
|
|
26
|
+
...config?.theme?.colors,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
interLocalization: {
|
|
30
|
+
...defaultEmperorUIConfig?.interLocalization,
|
|
31
|
+
...config?.interLocalization,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
config: mergedConfig,
|
|
37
|
+
};
|
|
38
|
+
}, [config]);
|
|
39
|
+
|
|
40
|
+
const withScaffold = config.layout?.withScaffold ?? true;
|
|
41
|
+
|
|
42
|
+
if (withScaffold)
|
|
43
|
+
return (
|
|
44
|
+
<EmperorUIContext.Provider value={emperorUIProviderValue}>
|
|
45
|
+
<Scaffold>{children}</Scaffold>
|
|
46
|
+
</EmperorUIContext.Provider>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<EmperorUIContext.Provider value={emperorUIProviderValue}>
|
|
51
|
+
{children}
|
|
52
|
+
</EmperorUIContext.Provider>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -1,31 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { ConfigProviderProps } from "@/types";
|
|
2
|
+
import { ConfigProvider, NavigationProvider } from "@/providers";
|
|
3
|
+
import { HeroUIProvider, ToastProvider } from "@heroui/react";
|
|
4
|
+
import { Fragment } from "react";
|
|
5
|
+
|
|
6
|
+
type EmperorUIProviderProps = ConfigProviderProps & {};
|
|
6
7
|
|
|
7
8
|
export function EmperorUIProvider({
|
|
8
9
|
children,
|
|
9
|
-
|
|
10
|
+
...props
|
|
10
11
|
}: EmperorUIProviderProps) {
|
|
11
|
-
const emperorUIProviderValue: EmperorUIContextState = useMemo(() => {
|
|
12
|
-
return {
|
|
13
|
-
config,
|
|
14
|
-
};
|
|
15
|
-
}, [config]);
|
|
16
|
-
|
|
17
|
-
const withScaffold = config.layout?.withScaffold ?? true;
|
|
18
|
-
|
|
19
|
-
if (withScaffold)
|
|
20
|
-
return (
|
|
21
|
-
<EmperorUIContext.Provider value={emperorUIProviderValue}>
|
|
22
|
-
<Scaffold>{children}</Scaffold>
|
|
23
|
-
</EmperorUIContext.Provider>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
12
|
return (
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
<ConfigProvider {...props}>
|
|
14
|
+
<HeroUIProvider>
|
|
15
|
+
<NavigationProvider>
|
|
16
|
+
<Fragment>
|
|
17
|
+
<ToastProvider {...props?.config?.toast} />
|
|
18
|
+
{children}
|
|
19
|
+
</Fragment>
|
|
20
|
+
</NavigationProvider>
|
|
21
|
+
</HeroUIProvider>
|
|
22
|
+
</ConfigProvider>
|
|
30
23
|
);
|
|
31
24
|
}
|
package/src/providers/index.ts
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
NavigationProviderProps,
|
|
3
|
+
NavigationContextState,
|
|
4
|
+
NavigationItem,
|
|
5
|
+
} from "@/types";
|
|
6
|
+
import { useMemo, useState } from "react";
|
|
7
|
+
import { NavigationContext } from "@/context";
|
|
8
|
+
import { PreservedKeys } from "@/enums";
|
|
9
|
+
|
|
10
|
+
export function NavigationProvider({ children }: NavigationProviderProps) {
|
|
11
|
+
const [hoveredItemId, setHoveredItemId] = useState<string | null>(null);
|
|
12
|
+
const [subItems, setSubItems] = useState<NavigationItem[]>([]);
|
|
13
|
+
const [isSubItemsBoxOpen, setIsSubItemsBoxOpen] = useState(false);
|
|
14
|
+
const [subItemsBoxIsHovered, setSubItemsBoxIsHovered] = useState(false);
|
|
15
|
+
|
|
16
|
+
const navigationProviderValue: NavigationContextState = useMemo(() => {
|
|
17
|
+
return {
|
|
18
|
+
hoveredItemId,
|
|
19
|
+
subItems,
|
|
20
|
+
isSubItemsBoxOpen,
|
|
21
|
+
subItemsBoxIsHovered,
|
|
22
|
+
setHoveredItemId,
|
|
23
|
+
setSubItems,
|
|
24
|
+
setIsSubItemsBoxOpen,
|
|
25
|
+
setSubItemsBoxIsHovered,
|
|
26
|
+
};
|
|
27
|
+
}, [hoveredItemId, subItems, isSubItemsBoxOpen, subItemsBoxIsHovered]);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<NavigationContext.Provider
|
|
31
|
+
value={navigationProviderValue}
|
|
32
|
+
data-slot="emperor-navigation-provider"
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
id={PreservedKeys.COMPACT_SIDEBAR_ID}
|
|
36
|
+
data-slot="emperor-compact-sidebar"
|
|
37
|
+
/>
|
|
38
|
+
|
|
39
|
+
{children}
|
|
40
|
+
</NavigationContext.Provider>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
UploaderProviderProps,
|
|
3
|
+
UploaderContextState,
|
|
4
|
+
FileObject,
|
|
5
|
+
} from "@/types";
|
|
6
|
+
import { useMemo, useState } from "react";
|
|
7
|
+
import { UploaderContext } from "@/context";
|
|
8
|
+
import { useDisclosure } from "@heroui/react";
|
|
9
|
+
|
|
10
|
+
export function UploaderProvider({
|
|
11
|
+
children,
|
|
12
|
+
...props
|
|
13
|
+
}: UploaderProviderProps) {
|
|
14
|
+
const { isOpen, onOpen, onOpenChange } = useDisclosure();
|
|
15
|
+
const [selectedFile, setSelectedFile] = useState<FileObject | null>(null);
|
|
16
|
+
|
|
17
|
+
const isFileViewable = useMemo(
|
|
18
|
+
() =>
|
|
19
|
+
!!selectedFile?.view &&
|
|
20
|
+
!!selectedFile?.file?.name &&
|
|
21
|
+
selectedFile?.type === "image",
|
|
22
|
+
[selectedFile],
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const uploaderProviderValue: UploaderContextState = useMemo(() => {
|
|
26
|
+
return {
|
|
27
|
+
isOpen,
|
|
28
|
+
onOpen,
|
|
29
|
+
onOpenChange,
|
|
30
|
+
selectedFile,
|
|
31
|
+
setSelectedFile,
|
|
32
|
+
isFileViewable,
|
|
33
|
+
...props,
|
|
34
|
+
};
|
|
35
|
+
}, [
|
|
36
|
+
isOpen,
|
|
37
|
+
isFileViewable,
|
|
38
|
+
selectedFile,
|
|
39
|
+
onOpen,
|
|
40
|
+
onOpenChange,
|
|
41
|
+
setSelectedFile,
|
|
42
|
+
props,
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<UploaderContext.Provider
|
|
47
|
+
value={uploaderProviderValue}
|
|
48
|
+
data-slot="emperor-uploader-provider"
|
|
49
|
+
>
|
|
50
|
+
{children}
|
|
51
|
+
</UploaderContext.Provider>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@plugin './hero.ts';
|
|
3
|
+
@source '../../node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}';
|
|
4
|
+
@custom-variant dark (&:is(.dark *));
|
|
5
|
+
|
|
6
|
+
.scrollbar-hide {
|
|
7
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
8
|
+
scrollbar-width: none; /* Firefox */
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.scrollbar-hide::-webkit-scrollbar {
|
|
12
|
+
display: none; /* Chrome, Safari, Opera */
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SharedComponentProps } from "@/types";
|
|
2
|
+
|
|
3
|
+
export type BrandProps = SharedComponentProps & {
|
|
4
|
+
src?: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
isIconOnly?: boolean;
|
|
8
|
+
classNames?: {
|
|
9
|
+
base?: string;
|
|
10
|
+
logo?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { SharedComponentProps } from "@/types";
|
|
2
|
+
import { ModalProps } from "@heroui/react";
|
|
3
|
+
import { Dispatch, ReactNode, SetStateAction } from "react";
|
|
4
|
+
|
|
5
|
+
export type UploaderProps = SharedComponentProps &
|
|
6
|
+
UploaderContextState & {
|
|
7
|
+
className?: string;
|
|
8
|
+
hideListing?: boolean;
|
|
9
|
+
isAvatar?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type FileType = "image" | "doc" | "pdf" | "video" | "sheet";
|
|
13
|
+
|
|
14
|
+
export type FileObject = {
|
|
15
|
+
view?: string;
|
|
16
|
+
type?: FileType;
|
|
17
|
+
file?: File;
|
|
18
|
+
url?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type SharedFilesType = FileObject[];
|
|
22
|
+
|
|
23
|
+
export type SharedLabelIdType = string;
|
|
24
|
+
|
|
25
|
+
export type SharedOnInputChangeType = (
|
|
26
|
+
event: React.ChangeEvent<HTMLInputElement> &
|
|
27
|
+
React.DragEvent<HTMLLabelElement>,
|
|
28
|
+
) => Promise<void>;
|
|
29
|
+
|
|
30
|
+
export type UseUploadFileProps = {
|
|
31
|
+
labelId: string;
|
|
32
|
+
fileTypes: FileType[];
|
|
33
|
+
labelContent?: ReactNode;
|
|
34
|
+
isRequired?: boolean;
|
|
35
|
+
isMulti?: boolean;
|
|
36
|
+
isDraggable?: boolean;
|
|
37
|
+
maxCount?: number;
|
|
38
|
+
maxFileSize?: number; // in Kilobytes
|
|
39
|
+
compressFiles?: boolean;
|
|
40
|
+
preventDuplicates?: boolean;
|
|
41
|
+
onChange?: () => void;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type UseUploadFileReturn = {
|
|
45
|
+
files: FileObject[];
|
|
46
|
+
fileTypes: FileType[];
|
|
47
|
+
labelId: string;
|
|
48
|
+
isRequired: boolean;
|
|
49
|
+
labelContent: ReactNode;
|
|
50
|
+
isDraggable: boolean;
|
|
51
|
+
isMulti: boolean;
|
|
52
|
+
isLoading: boolean;
|
|
53
|
+
setFiles: Dispatch<SetStateAction<FileObject[]>>;
|
|
54
|
+
handleClearFile: (fileName?: string) => void;
|
|
55
|
+
onInputChange: (
|
|
56
|
+
event: React.ChangeEvent<HTMLInputElement> &
|
|
57
|
+
React.DragEvent<HTMLLabelElement>,
|
|
58
|
+
) => Promise<void | string | null>;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type UploaderContextState = {
|
|
62
|
+
selectedFile?: FileObject | null;
|
|
63
|
+
setSelectedFile?: (file: FileObject | null) => void;
|
|
64
|
+
|
|
65
|
+
labelId: SharedLabelIdType;
|
|
66
|
+
labelContent?: ReactNode;
|
|
67
|
+
avatarLabelContent?: ReactNode;
|
|
68
|
+
|
|
69
|
+
isFileViewable?: boolean;
|
|
70
|
+
isRequired?: boolean;
|
|
71
|
+
isDraggable?: boolean;
|
|
72
|
+
isLoading: boolean;
|
|
73
|
+
hideErrorMessage?: boolean;
|
|
74
|
+
isMulti: boolean;
|
|
75
|
+
|
|
76
|
+
placeholderImage?: string;
|
|
77
|
+
files: SharedFilesType;
|
|
78
|
+
fileTypes: FileType[];
|
|
79
|
+
|
|
80
|
+
onInputChange: SharedOnInputChangeType;
|
|
81
|
+
handleClearFile: (fileName?: string) => void;
|
|
82
|
+
|
|
83
|
+
modal?: Omit<ModalProps, "children"> & {
|
|
84
|
+
onOpen?: () => void;
|
|
85
|
+
};
|
|
86
|
+
classNames?: {
|
|
87
|
+
label?: string;
|
|
88
|
+
avatar?: string;
|
|
89
|
+
listing?: string;
|
|
90
|
+
error?: string;
|
|
91
|
+
input?: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export type UploaderProviderProps = UploaderContextState & {
|
|
96
|
+
children: ReactNode;
|
|
97
|
+
};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
export type * from "./
|
|
2
|
-
export type * from "./
|
|
3
|
-
export type * from "./
|
|
4
|
-
export type * from "./scaffold";
|
|
5
|
-
export type * from "./filter";
|
|
6
|
-
export type * from "./footer";
|
|
7
|
-
export type * from "./item-card";
|
|
8
|
-
export type * from "./item-details";
|
|
1
|
+
export type * from "./molecules";
|
|
2
|
+
export type * from "./atoms";
|
|
3
|
+
export type * from "./templates";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { SharedComponentProps } from "@/types";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
export type FooterClassnames = {
|
|
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;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type FooterProps = SharedComponentProps & {
|
|
62
|
+
classNames?: FooterClassnames;
|
|
63
|
+
policies?: QuickLink[];
|
|
64
|
+
quickLinks?: QuickLinkCollection[];
|
|
65
|
+
socialLinks?: SocialLink[];
|
|
66
|
+
copyRights?: CopyRights;
|
|
67
|
+
contacts?: Contacts;
|
|
68
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { SharedComponentProps } from "@/types";
|
|
2
|
+
|
|
3
|
+
export type HeaderClassnames = {
|
|
4
|
+
base?: string;
|
|
5
|
+
logo?: string;
|
|
6
|
+
navbar?: string;
|
|
7
|
+
userDropdown?: string;
|
|
8
|
+
sideMenu?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type HeaderActivations = {
|
|
12
|
+
hideLog?: boolean;
|
|
13
|
+
hideNavbar?: boolean;
|
|
14
|
+
hideUserDropdown?: boolean;
|
|
15
|
+
hideSideMenu?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type HeaderVariant =
|
|
19
|
+
| "default"
|
|
20
|
+
| "floating"
|
|
21
|
+
| "light"
|
|
22
|
+
| "segmented-floating";
|
|
23
|
+
|
|
24
|
+
export type HeaderGlassEffect = {
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
blur?: number;
|
|
27
|
+
backgroundColor?: string;
|
|
28
|
+
foregroundColor?: string;
|
|
29
|
+
opacity?: number;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type HeaderProps = SharedComponentProps & {
|
|
33
|
+
variant?: HeaderVariant;
|
|
34
|
+
classNames?: HeaderClassnames;
|
|
35
|
+
glassEffect?: HeaderGlassEffect;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type HeaderDropdownProps = SharedComponentProps & {};
|
|
39
|
+
|
|
40
|
+
export type UserDropdownProps = SharedComponentProps & {};
|
|
41
|
+
|
|
42
|
+
export type HeaderStylesProps = {
|
|
43
|
+
primaryColor?: string;
|
|
44
|
+
foregroundColor?: string;
|
|
45
|
+
variant?: HeaderVariant;
|
|
46
|
+
glassEffect?: HeaderGlassEffect;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type SegmentedHeaderContentProps = SharedComponentProps & {
|
|
50
|
+
glassEffect?: HeaderGlassEffect;
|
|
51
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type * from "./header";
|
|
2
|
+
export type * from "./listings";
|
|
3
|
+
export type * from "./nav-bar";
|
|
4
|
+
export type * from "./side-bar";
|
|
5
|
+
export type * from "./scaffold";
|
|
6
|
+
export type * from "./filter";
|
|
7
|
+
export type * from "./footer";
|
|
8
|
+
export type * from "./item-card";
|
|
9
|
+
export type * from "./item-details";
|