@js-empire/emperor-ui 1.3.6 → 1.3.7
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/emperor-ui.js +60623 -158
- package/package.json +7 -3
- package/.cursor/rules/code-conventions.mdc +0 -50
- package/.husky/pre-commit +0 -4
- package/.prettierrc +0 -10
- package/.storybook/main.ts +0 -24
- package/.storybook/preview.ts +0 -19
- package/.storybook/vitest.setup.ts +0 -7
- package/.vscode/extensions.json +0 -1
- package/dist/index-ABKcY4tX.js +0 -60607
- package/dist/index-CWu5fG3N.js +0 -6
- package/dist/index-DpemL3iQ.js +0 -291
- package/dist/src-UW24ZMRV-I8bMqcTI.js +0 -6
- package/eslint.config.js +0 -34
- package/index.html +0 -13
- 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/animations/blink.ts +0 -26
- package/src/animations/floating.ts +0 -12
- package/src/animations/index.ts +0 -2
- package/src/components/atoms/brand/brand.stories.tsx +0 -27
- package/src/components/atoms/brand/brand.tsx +0 -56
- package/src/components/atoms/brand/index.ts +0 -1
- package/src/components/atoms/brand/styles/classes.ts +0 -9
- package/src/components/atoms/brand/styles/index.ts +0 -2
- package/src/components/atoms/brand/styles/styles.ts +0 -0
- package/src/components/atoms/color-picker/color-picker.tsx +0 -12
- package/src/components/atoms/color-picker/free-color-picker.tsx +0 -58
- package/src/components/atoms/color-picker/index.ts +0 -3
- package/src/components/atoms/color-picker/preset-color-picker.tsx +0 -66
- package/src/components/atoms/color-picker/stories/color-picker.stories.tsx +0 -63
- package/src/components/atoms/column/column.stories.tsx +0 -37
- package/src/components/atoms/column/column.tsx +0 -21
- package/src/components/atoms/column/index.ts +0 -1
- package/src/components/atoms/container/column.stories.tsx +0 -37
- package/src/components/atoms/container/container.tsx +0 -28
- package/src/components/atoms/container/index.ts +0 -1
- package/src/components/atoms/copy-button/copy-button.tsx +0 -73
- package/src/components/atoms/copy-button/index.ts +0 -1
- package/src/components/atoms/copy-button/stories/copy-button.stories.tsx +0 -21
- package/src/components/atoms/field/field.tsx +0 -81
- package/src/components/atoms/field/index.ts +0 -3
- package/src/components/atoms/field/styles/classes.ts +0 -9
- package/src/components/atoms/field/styles/index.ts +0 -1
- package/src/components/atoms/field/units/autocomplete-field.tsx +0 -49
- package/src/components/atoms/field/units/checkbox-field.tsx +0 -35
- package/src/components/atoms/field/units/index.ts +0 -7
- package/src/components/atoms/field/units/input-field.tsx +0 -35
- package/src/components/atoms/field/units/radio-field.tsx +0 -43
- package/src/components/atoms/field/units/select-field.tsx +0 -50
- package/src/components/atoms/field/units/switch-field.tsx +0 -35
- package/src/components/atoms/field/units/textarea-field.tsx +0 -37
- package/src/components/atoms/filter/filter.tsx +0 -93
- package/src/components/atoms/filter/index.ts +0 -3
- package/src/components/atoms/filter/stories/filter.stories.tsx +0 -238
- package/src/components/atoms/filter/styles/classes.ts +0 -20
- package/src/components/atoms/filter/styles/index.ts +0 -1
- package/src/components/atoms/filter/units/autocomplete-filter.tsx +0 -66
- package/src/components/atoms/filter/units/checkbox-filter.tsx +0 -42
- package/src/components/atoms/filter/units/checkbox-group-filter.tsx +0 -68
- package/src/components/atoms/filter/units/date-filter.tsx +0 -46
- package/src/components/atoms/filter/units/index.ts +0 -9
- package/src/components/atoms/filter/units/numeric-filter.tsx +0 -41
- package/src/components/atoms/filter/units/range-filter.tsx +0 -65
- package/src/components/atoms/filter/units/search-filter.tsx +0 -53
- package/src/components/atoms/filter/units/select-filter.tsx +0 -57
- package/src/components/atoms/filter/units/switch-filter.tsx +0 -35
- package/src/components/atoms/index.ts +0 -11
- package/src/components/atoms/portal/index.ts +0 -1
- package/src/components/atoms/portal/portal.stories.tsx +0 -43
- package/src/components/atoms/portal/portal.tsx +0 -25
- package/src/components/atoms/row/index.ts +0 -1
- package/src/components/atoms/row/row.stories.tsx +0 -37
- package/src/components/atoms/row/row.tsx +0 -26
- package/src/components/atoms/theme-switch/index.ts +0 -1
- package/src/components/atoms/theme-switch/styles/classes.ts +0 -16
- package/src/components/atoms/theme-switch/styles/index.ts +0 -1
- package/src/components/atoms/theme-switch/theme-switch.stories.tsx +0 -26
- package/src/components/atoms/theme-switch/theme-switch.tsx +0 -54
- package/src/components/atoms/uploader/components/avatar-label.tsx +0 -102
- package/src/components/atoms/uploader/components/index.ts +0 -8
- package/src/components/atoms/uploader/components/upload-file-error-box.tsx +0 -40
- package/src/components/atoms/uploader/components/upload-file-input.tsx +0 -36
- package/src/components/atoms/uploader/components/upload-file-label.tsx +0 -92
- package/src/components/atoms/uploader/components/upload-file-listing.tsx +0 -64
- package/src/components/atoms/uploader/components/uploader-title.tsx +0 -21
- package/src/components/atoms/uploader/components/uploader.tsx +0 -89
- package/src/components/atoms/uploader/components/view-image-modal.tsx +0 -41
- package/src/components/atoms/uploader/index.ts +0 -1
- package/src/components/atoms/uploader/stories/uploader.stories.tsx +0 -202
- package/src/components/index.ts +0 -4
- package/src/components/molecules/index.ts +0 -4
- package/src/components/molecules/item-card/components/actions/index.ts +0 -3
- package/src/components/molecules/item-card/components/actions/item-actions-buttons.tsx +0 -43
- package/src/components/molecules/item-card/components/actions/item-actions-dropdown.tsx +0 -57
- package/src/components/molecules/item-card/components/actions/item-actions-overlay.tsx +0 -50
- package/src/components/molecules/item-card/components/additions/index.ts +0 -2
- package/src/components/molecules/item-card/components/additions/item-banner.tsx +0 -22
- package/src/components/molecules/item-card/components/additions/loading-item.tsx +0 -88
- package/src/components/molecules/item-card/components/card/index.ts +0 -4
- package/src/components/molecules/item-card/components/card/item-card-body.tsx +0 -74
- package/src/components/molecules/item-card/components/card/item-card-footer.tsx +0 -79
- package/src/components/molecules/item-card/components/card/item-card-header.tsx +0 -69
- package/src/components/molecules/item-card/components/card/item-card.tsx +0 -123
- package/src/components/molecules/item-card/components/index.ts +0 -3
- package/src/components/molecules/item-card/index.ts +0 -2
- package/src/components/molecules/item-card/stories/item-card.stories.tsx +0 -218
- package/src/components/molecules/item-card/styles/classes.ts +0 -141
- package/src/components/molecules/item-card/styles/index.ts +0 -1
- package/src/components/molecules/nav-bar/index.ts +0 -3
- package/src/components/molecules/nav-bar/nav-bar-item.tsx +0 -64
- package/src/components/molecules/nav-bar/nav-bar.tsx +0 -57
- package/src/components/molecules/nav-bar/stories/hover-effect/nav-bar-hover-effect.stories.tsx +0 -52
- package/src/components/molecules/nav-bar/stories/nav-bar.stories.tsx +0 -50
- package/src/components/molecules/nav-bar/styles/classes.ts +0 -68
- package/src/components/molecules/nav-bar/styles/index.ts +0 -2
- package/src/components/molecules/nav-bar/styles/styles.ts +0 -85
- package/src/components/molecules/nav-bar/sub-items-box.tsx +0 -58
- package/src/components/molecules/scaffold/index.ts +0 -2
- package/src/components/molecules/scaffold/scaffold.stories.tsx +0 -21
- package/src/components/molecules/scaffold/scaffold.tsx +0 -23
- package/src/components/molecules/scaffold/styles/index.ts +0 -1
- package/src/components/molecules/scaffold/styles/scaffold-classes.ts +0 -10
- package/src/components/molecules/side-bar/compact-side-bar.tsx +0 -77
- package/src/components/molecules/side-bar/index.ts +0 -1
- package/src/components/molecules/side-bar/side-bar-drawer.tsx +0 -113
- package/src/components/molecules/side-bar/side-bar.stories.tsx +0 -111
- package/src/components/molecules/side-bar/side-bar.tsx +0 -31
- package/src/components/molecules/side-bar/styles/classes.ts +0 -28
- package/src/components/molecules/side-bar/styles/index.ts +0 -2
- package/src/components/molecules/side-bar/styles/styles.ts +0 -13
- package/src/components/organisms/deletion-confirmor/deletion-confirmor.tsx +0 -110
- package/src/components/organisms/deletion-confirmor/index.ts +0 -3
- package/src/components/organisms/deletion-confirmor/stories/components.tsx +0 -25
- package/src/components/organisms/deletion-confirmor/stories/deletion-confirmor.stories.tsx +0 -78
- package/src/components/organisms/deletion-confirmor/styles/classes.ts +0 -28
- package/src/components/organisms/deletion-confirmor/styles/index.ts +0 -2
- package/src/components/organisms/deletion-confirmor/styles/styles.ts +0 -4
- package/src/components/organisms/footer/copy-rights-box.tsx +0 -27
- package/src/components/organisms/footer/footer.tsx +0 -75
- package/src/components/organisms/footer/index.ts +0 -5
- package/src/components/organisms/footer/policies-box.tsx +0 -27
- package/src/components/organisms/footer/quick-links-box.tsx +0 -46
- package/src/components/organisms/footer/social-links-box.tsx +0 -33
- package/src/components/organisms/footer/stories/footer.stories.tsx +0 -61
- package/src/components/organisms/footer/styles/classes.ts +0 -71
- package/src/components/organisms/footer/styles/index.ts +0 -2
- package/src/components/organisms/footer/styles/styles.ts +0 -6
- package/src/components/organisms/form-builder/form-builder.stories.tsx +0 -144
- package/src/components/organisms/form-builder/form-builder.tsx +0 -75
- package/src/components/organisms/form-builder/index.ts +0 -1
- package/src/components/organisms/header/header.tsx +0 -87
- package/src/components/organisms/header/index.ts +0 -1
- package/src/components/organisms/header/segmented-header-content.tsx +0 -29
- package/src/components/organisms/header/stories/header.stories.tsx +0 -144
- package/src/components/organisms/header/styles/classes.ts +0 -22
- package/src/components/organisms/header/styles/index.ts +0 -2
- package/src/components/organisms/header/styles/styles.ts +0 -39
- package/src/components/organisms/index.ts +0 -6
- package/src/components/organisms/item-details/index.ts +0 -1
- package/src/components/organisms/item-details/item-details.tsx +0 -6
- package/src/components/organisms/listings/empty-listings.tsx +0 -80
- package/src/components/organisms/listings/index.ts +0 -3
- package/src/components/organisms/listings/listings.tsx +0 -96
- package/src/components/organisms/listings/stories/grid-listings.stories.tsx +0 -153
- package/src/components/organisms/listings/stories/list-listings.stories.tsx +0 -171
- package/src/components/organisms/listings/styles/classes.ts +0 -49
- package/src/components/organisms/listings/styles/index.ts +0 -2
- package/src/components/organisms/listings/styles/styles.ts +0 -6
- package/src/components/templates/index.ts +0 -1
- package/src/components/templates/landing-page/index.ts +0 -1
- package/src/components/templates/landing-page/landing-page.stories.tsx +0 -21
- package/src/components/templates/landing-page/landing-page.tsx +0 -57
- package/src/components/templates/landing-page/styles/classes.ts +0 -11
- package/src/components/templates/landing-page/styles/index.ts +0 -1
- package/src/constants/animations.ts +0 -14
- package/src/constants/card.tsx +0 -42
- package/src/constants/defaults.ts +0 -59
- package/src/constants/fake.ts +0 -5
- package/src/constants/footer.tsx +0 -157
- package/src/constants/index.ts +0 -6
- package/src/constants/uploader.ts +0 -33
- package/src/context/emperor-ui-context.ts +0 -6
- package/src/context/form-builder-context.tsx +0 -8
- package/src/context/index.ts +0 -4
- package/src/context/navigation-context.ts +0 -6
- package/src/context/uploader-context.ts +0 -6
- package/src/enums/index.ts +0 -2
- package/src/enums/placeholders.ts +0 -4
- package/src/enums/preserved-keys.ts +0 -3
- package/src/examples/index.ts +0 -1
- package/src/hooks/index.ts +0 -8
- package/src/hooks/use-emperor-ui.ts +0 -12
- package/src/hooks/use-filters.ts +0 -20
- package/src/hooks/use-form-builder-context.ts +0 -16
- package/src/hooks/use-navigation.ts +0 -12
- package/src/hooks/use-search-params-handler.tsx +0 -186
- package/src/hooks/use-uploader-context.ts +0 -14
- package/src/hooks/use-uploader.tsx +0 -164
- package/src/hooks/use-window-size.tsx +0 -53
- package/src/i18n/configs/i18n.ts +0 -7
- package/src/i18n/configs/index.ts +0 -1
- package/src/i18n/constants/index.ts +0 -1
- package/src/i18n/constants/locales.ts +0 -4
- package/src/i18n/index.ts +0 -5
- package/src/i18n/locales/ar.ts +0 -15
- package/src/i18n/locales/atoms/ar.ts +0 -18
- package/src/i18n/locales/atoms/en.ts +0 -18
- package/src/i18n/locales/atoms/index.ts +0 -2
- package/src/i18n/locales/common/ar.ts +0 -1
- package/src/i18n/locales/common/en.ts +0 -1
- package/src/i18n/locales/common/index.ts +0 -2
- package/src/i18n/locales/en.ts +0 -15
- package/src/i18n/locales/index.ts +0 -4
- package/src/i18n/locales/molecules/ar.ts +0 -1
- package/src/i18n/locales/molecules/en.ts +0 -1
- package/src/i18n/locales/molecules/index.ts +0 -2
- package/src/i18n/locales/organisms/ar.ts +0 -11
- package/src/i18n/locales/organisms/en.ts +0 -11
- package/src/i18n/locales/organisms/index.ts +0 -2
- package/src/i18n/locales/templates/ar.ts +0 -1
- package/src/i18n/locales/templates/en.ts +0 -1
- package/src/i18n/locales/templates/index.ts +0 -2
- package/src/i18n/locales/toasts/ar.ts +0 -1
- package/src/i18n/locales/toasts/en.ts +0 -1
- package/src/i18n/locales/toasts/index.ts +0 -2
- package/src/i18n/types/index.ts +0 -2
- package/src/i18n/types/locale.ts +0 -5
- package/src/i18n/types/toasts.ts +0 -3
- package/src/i18n/utils/get-locales.ts +0 -4
- package/src/i18n/utils/index.ts +0 -2
- package/src/i18n/utils/localize.ts +0 -15
- package/src/index.ts +0 -14
- package/src/mocks/constants.ts +0 -103
- package/src/mocks/deletion-confirmor.ts +0 -16
- package/src/mocks/header.tsx +0 -118
- package/src/mocks/index.ts +0 -6
- package/src/mocks/listings.tsx +0 -154
- package/src/mocks/locales/index.ts +0 -1
- package/src/mocks/locales/uploader.ts +0 -33
- package/src/mocks/types.ts +0 -64
- package/src/providers/config-provider.tsx +0 -72
- package/src/providers/emperor-ui-provider.tsx +0 -35
- package/src/providers/form-builder-provider-context.tsx +0 -18
- package/src/providers/index.ts +0 -6
- package/src/providers/navigation-provider.tsx +0 -42
- package/src/providers/theme-provider.tsx +0 -16
- package/src/providers/uploader-provider.tsx +0 -53
- package/src/styles/globals.css +0 -38
- package/src/styles/hero.ts +0 -3
- package/src/styles/index.css +0 -18
- package/src/types/components/atoms/brand.ts +0 -13
- package/src/types/components/atoms/color-picker/color-picker.ts +0 -21
- package/src/types/components/atoms/color-picker/index.ts +0 -1
- package/src/types/components/atoms/column.ts +0 -3
- package/src/types/components/atoms/container.ts +0 -3
- package/src/types/components/atoms/field/field.ts +0 -61
- package/src/types/components/atoms/field/index.ts +0 -1
- package/src/types/components/atoms/filter/filter.ts +0 -52
- package/src/types/components/atoms/filter/index.ts +0 -2
- package/src/types/components/atoms/filter/select-filter.ts +0 -8
- package/src/types/components/atoms/index.ts +0 -9
- package/src/types/components/atoms/portal.ts +0 -6
- package/src/types/components/atoms/row.ts +0 -3
- package/src/types/components/atoms/uploader.ts +0 -103
- package/src/types/components/index.ts +0 -4
- package/src/types/components/molecules/footer/footer.ts +0 -68
- package/src/types/components/molecules/footer/index.ts +0 -1
- package/src/types/components/molecules/header/header.ts +0 -51
- package/src/types/components/molecules/header/index.ts +0 -1
- package/src/types/components/molecules/index.ts +0 -9
- package/src/types/components/molecules/item-card/index.ts +0 -1
- package/src/types/components/molecules/item-card/item-card.ts +0 -69
- package/src/types/components/molecules/item-details/index.ts +0 -1
- package/src/types/components/molecules/item-details/item-details.ts +0 -9
- package/src/types/components/molecules/listings/index.ts +0 -1
- package/src/types/components/molecules/listings/listings.ts +0 -29
- package/src/types/components/molecules/nav-bar/index.ts +0 -1
- package/src/types/components/molecules/nav-bar/nav-bar.ts +0 -66
- package/src/types/components/molecules/scaffold/index.ts +0 -1
- package/src/types/components/molecules/scaffold/scaffold.ts +0 -9
- package/src/types/components/molecules/side-bar/index.ts +0 -1
- package/src/types/components/molecules/side-bar/side-bar.ts +0 -40
- package/src/types/components/molecules/theme-switch/index.ts +0 -1
- package/src/types/components/molecules/theme-switch/theme-switch.ts +0 -9
- package/src/types/components/organisms/deletion-confirmor/deletion-confirmor.ts +0 -22
- package/src/types/components/organisms/deletion-confirmor/index.ts +0 -1
- package/src/types/components/organisms/filters/filters.ts +0 -11
- package/src/types/components/organisms/filters/index.ts +0 -1
- package/src/types/components/organisms/form-builder/context.ts +0 -6
- package/src/types/components/organisms/form-builder/form-builder.ts +0 -39
- package/src/types/components/organisms/form-builder/index.ts +0 -2
- package/src/types/components/organisms/index.ts +0 -3
- package/src/types/components/templates/index.ts +0 -1
- package/src/types/components/templates/landing-page.ts +0 -10
- package/src/types/context/config.ts +0 -24
- package/src/types/context/index.ts +0 -4
- package/src/types/context/localization.ts +0 -24
- package/src/types/context/navigation.ts +0 -17
- package/src/types/context/theme.ts +0 -33
- package/src/types/index.ts +0 -3
- package/src/types/shared/components.ts +0 -13
- package/src/types/shared/index.ts +0 -1
- package/src/utils/cn.ts +0 -6
- package/src/utils/compress-images.ts +0 -36
- package/src/utils/index.ts +0 -5
- package/src/utils/locales.ts +0 -54
- package/src/utils/storybook.tsx +0 -15
- package/src/utils/uploader.ts +0 -170
- package/tsconfig.app.json +0 -37
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -25
- package/vite.config.ts +0 -47
- package/vitest.shims.d.ts +0 -1
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { Brand, Header, NavBar } from "@/components";
|
|
3
|
-
import { getStorybookDecorators } from "@/utils";
|
|
4
|
-
import { FAKE_PARAGRAPH } from "@/constants";
|
|
5
|
-
import { MOCK_HEADER_ITEMS } from "@/mocks";
|
|
6
|
-
import { HeaderProps } from "@/types";
|
|
7
|
-
|
|
8
|
-
const meta: Meta<typeof Header> = {
|
|
9
|
-
title: "Organisms/Header",
|
|
10
|
-
component: Header,
|
|
11
|
-
parameters: {
|
|
12
|
-
layout: "fullscreen",
|
|
13
|
-
},
|
|
14
|
-
tags: ["autodocs"],
|
|
15
|
-
decorators: getStorybookDecorators({}),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default meta;
|
|
19
|
-
|
|
20
|
-
type Story = StoryObj<typeof meta>;
|
|
21
|
-
|
|
22
|
-
const GLASS_EFFECT_CONFIG = {
|
|
23
|
-
enabled: true,
|
|
24
|
-
blur: 10,
|
|
25
|
-
backgroundColor: "#006fed",
|
|
26
|
-
foregroundColor: "#fff",
|
|
27
|
-
opacity: 40,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const Default: Story = {
|
|
31
|
-
args: {},
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const Floating: Story = {
|
|
35
|
-
args: {
|
|
36
|
-
variant: "floating",
|
|
37
|
-
},
|
|
38
|
-
render: (args: HeaderProps) => {
|
|
39
|
-
return (
|
|
40
|
-
<div>
|
|
41
|
-
<Header {...args} />
|
|
42
|
-
|
|
43
|
-
<main className="w-full container mx-auto p-5 pt-24 flex flex-col gap-6">
|
|
44
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
45
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
46
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
47
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
48
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
49
|
-
</main>
|
|
50
|
-
</div>
|
|
51
|
-
);
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const Light: Story = {
|
|
56
|
-
args: {
|
|
57
|
-
variant: "light",
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const WithGlassEffect: Story = {
|
|
62
|
-
args: {
|
|
63
|
-
variant: "floating",
|
|
64
|
-
glassEffect: GLASS_EFFECT_CONFIG,
|
|
65
|
-
},
|
|
66
|
-
render: (args) => {
|
|
67
|
-
return (
|
|
68
|
-
<div>
|
|
69
|
-
<Header {...args} />
|
|
70
|
-
|
|
71
|
-
<main className="w-full container mx-auto p-5 pt-24 flex flex-col gap-6">
|
|
72
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
73
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
74
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
75
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
76
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
77
|
-
</main>
|
|
78
|
-
</div>
|
|
79
|
-
);
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const SegmentedFloating: Story = {
|
|
84
|
-
args: {
|
|
85
|
-
variant: "segmented-floating",
|
|
86
|
-
},
|
|
87
|
-
render: (args) => {
|
|
88
|
-
return (
|
|
89
|
-
<div>
|
|
90
|
-
<Header {...args}>
|
|
91
|
-
<Brand />
|
|
92
|
-
|
|
93
|
-
<NavBar
|
|
94
|
-
items={MOCK_HEADER_ITEMS}
|
|
95
|
-
hoverEffect="none"
|
|
96
|
-
variant="default"
|
|
97
|
-
className="hidden md:flex"
|
|
98
|
-
subItemsColumns={4}
|
|
99
|
-
/>
|
|
100
|
-
</Header>
|
|
101
|
-
|
|
102
|
-
<main className="w-full container mx-auto p-5 pt-24 flex flex-col gap-6">
|
|
103
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
104
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
105
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
106
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
107
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
108
|
-
</main>
|
|
109
|
-
</div>
|
|
110
|
-
);
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export const SegmentedFloatingWithGlassEffect: Story = {
|
|
115
|
-
args: {
|
|
116
|
-
variant: "segmented-floating",
|
|
117
|
-
glassEffect: GLASS_EFFECT_CONFIG,
|
|
118
|
-
},
|
|
119
|
-
render: (args) => {
|
|
120
|
-
return (
|
|
121
|
-
<div>
|
|
122
|
-
<Header {...args}>
|
|
123
|
-
<Brand />
|
|
124
|
-
|
|
125
|
-
<NavBar
|
|
126
|
-
items={MOCK_HEADER_ITEMS}
|
|
127
|
-
hoverEffect="none"
|
|
128
|
-
variant="default"
|
|
129
|
-
className="hidden md:flex"
|
|
130
|
-
subItemsColumns={4}
|
|
131
|
-
/>
|
|
132
|
-
</Header>
|
|
133
|
-
|
|
134
|
-
<main className="w-full container mx-auto p-5 pt-24 flex flex-col gap-6">
|
|
135
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
136
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
137
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
138
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
139
|
-
<p>{FAKE_PARAGRAPH}</p>
|
|
140
|
-
</main>
|
|
141
|
-
</div>
|
|
142
|
-
);
|
|
143
|
-
},
|
|
144
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { cva } from "class-variance-authority";
|
|
2
|
-
|
|
3
|
-
export const headerClasses = cva(
|
|
4
|
-
["flex min-h-16 items-center justify-between gap-4 px-6 w-full"],
|
|
5
|
-
{
|
|
6
|
-
variants: {
|
|
7
|
-
variant: {
|
|
8
|
-
default: ["flex-nowrap w-full"],
|
|
9
|
-
floating: [
|
|
10
|
-
"fixed min-h-14 w-[90vw] rounded-full shadow-lg",
|
|
11
|
-
"top-3 left-1/2 -translate-x-1/2 z-10",
|
|
12
|
-
],
|
|
13
|
-
light: [],
|
|
14
|
-
"segmented-floating": [
|
|
15
|
-
"fixed min-h-12 w-[90vw] top-3 left-1/2 -translate-x-1/2 z-10",
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
defaultVariants: {},
|
|
20
|
-
compoundVariants: [],
|
|
21
|
-
},
|
|
22
|
-
);
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { CSSProperties } from "react";
|
|
2
|
-
import { HeaderGlassEffect, HeaderStylesProps } from "@/types";
|
|
3
|
-
|
|
4
|
-
export const getGlassEffectStyles = ({
|
|
5
|
-
glassEffect,
|
|
6
|
-
}: {
|
|
7
|
-
glassEffect: HeaderGlassEffect;
|
|
8
|
-
}): CSSProperties => ({
|
|
9
|
-
backgroundColor: glassEffect?.backgroundColor
|
|
10
|
-
? `${glassEffect?.backgroundColor}${glassEffect?.opacity ?? 30}`
|
|
11
|
-
: "transparent",
|
|
12
|
-
backdropFilter: `blur(${glassEffect?.blur ?? 0}px)`,
|
|
13
|
-
color: glassEffect?.foregroundColor,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export const headerStyles = ({
|
|
17
|
-
primaryColor,
|
|
18
|
-
foregroundColor,
|
|
19
|
-
variant,
|
|
20
|
-
glassEffect,
|
|
21
|
-
}: HeaderStylesProps): CSSProperties => {
|
|
22
|
-
if (glassEffect?.enabled && variant !== "segmented-floating") {
|
|
23
|
-
return getGlassEffectStyles({
|
|
24
|
-
glassEffect: {
|
|
25
|
-
...glassEffect,
|
|
26
|
-
foregroundColor: glassEffect?.foregroundColor ?? foregroundColor,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (["default", "floating"].includes(variant ?? "")) {
|
|
32
|
-
return {
|
|
33
|
-
backgroundColor: primaryColor,
|
|
34
|
-
color: foregroundColor,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return {};
|
|
39
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./item-details";
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { Locale } from "@/i18n";
|
|
4
|
-
import { Inbox } from "lucide-react";
|
|
5
|
-
import { motion } from "framer-motion";
|
|
6
|
-
import { cn } from "@/utils";
|
|
7
|
-
import { emptyListingsClasses } from "@/components";
|
|
8
|
-
import { useEmperorUI } from "@/hooks";
|
|
9
|
-
import { blinkContainer, blinkItem, floating } from "@/animations";
|
|
10
|
-
|
|
11
|
-
export function EmptyListings({
|
|
12
|
-
className,
|
|
13
|
-
classNames,
|
|
14
|
-
}: {
|
|
15
|
-
className?: string;
|
|
16
|
-
classNames?: {
|
|
17
|
-
wrapper?: string;
|
|
18
|
-
iconWrapper?: string;
|
|
19
|
-
title?: string;
|
|
20
|
-
description?: string;
|
|
21
|
-
};
|
|
22
|
-
}) {
|
|
23
|
-
const { config } = useEmperorUI();
|
|
24
|
-
|
|
25
|
-
const locales = config?.interLocalization?.locales;
|
|
26
|
-
const lang = config?.interLocalization?.lang;
|
|
27
|
-
|
|
28
|
-
const locale = locales?.[lang || "en"] as Locale;
|
|
29
|
-
const listingsLocale = locale?.organisms?.listings;
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<motion.div
|
|
33
|
-
data-slot="emperor-ui-empty-listings"
|
|
34
|
-
className={cn(emptyListingsClasses(), className)}
|
|
35
|
-
variants={blinkContainer}
|
|
36
|
-
initial="hidden"
|
|
37
|
-
animate="visible"
|
|
38
|
-
>
|
|
39
|
-
<motion.div
|
|
40
|
-
className={cn(
|
|
41
|
-
"flex items-center justify-center rounded-2xl bg-default-100/80 p-6 mb-5",
|
|
42
|
-
classNames?.iconWrapper,
|
|
43
|
-
)}
|
|
44
|
-
variants={blinkItem}
|
|
45
|
-
>
|
|
46
|
-
<motion.div
|
|
47
|
-
variants={floating}
|
|
48
|
-
animate="animate"
|
|
49
|
-
className="flex items-center justify-center"
|
|
50
|
-
>
|
|
51
|
-
<Inbox
|
|
52
|
-
className="size-14 text-default-400"
|
|
53
|
-
strokeWidth={1.25}
|
|
54
|
-
aria-hidden
|
|
55
|
-
/>
|
|
56
|
-
</motion.div>
|
|
57
|
-
</motion.div>
|
|
58
|
-
|
|
59
|
-
<motion.h2
|
|
60
|
-
className={cn(
|
|
61
|
-
"text-xl font-semibold text-foreground mb-2",
|
|
62
|
-
classNames?.title,
|
|
63
|
-
)}
|
|
64
|
-
variants={blinkItem}
|
|
65
|
-
>
|
|
66
|
-
{listingsLocale?.emptyTitle}
|
|
67
|
-
</motion.h2>
|
|
68
|
-
|
|
69
|
-
<motion.p
|
|
70
|
-
className={cn(
|
|
71
|
-
"text-sm text-default-500 max-w-sm",
|
|
72
|
-
classNames?.description,
|
|
73
|
-
)}
|
|
74
|
-
variants={blinkItem}
|
|
75
|
-
>
|
|
76
|
-
{listingsLocale?.emptyDescription}
|
|
77
|
-
</motion.p>
|
|
78
|
-
</motion.div>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { EmptyListings, ItemCard, LoadingItem } from "@/components";
|
|
2
|
-
import type { ItemCardOrientation, ListingsProps } from "@/types";
|
|
3
|
-
import { cn } from "@/utils";
|
|
4
|
-
import {
|
|
5
|
-
listingsClasses,
|
|
6
|
-
listingsItemClasses,
|
|
7
|
-
listingsPaginationClasses,
|
|
8
|
-
listingsStyles,
|
|
9
|
-
} from "./styles";
|
|
10
|
-
import { Pagination } from "@heroui/pagination";
|
|
11
|
-
import { motion } from "framer-motion";
|
|
12
|
-
|
|
13
|
-
export function Listings({
|
|
14
|
-
items = [],
|
|
15
|
-
isLoading = false,
|
|
16
|
-
className,
|
|
17
|
-
classNames,
|
|
18
|
-
layout = "grid",
|
|
19
|
-
actions = [],
|
|
20
|
-
onActionClick,
|
|
21
|
-
pagination,
|
|
22
|
-
}: ListingsProps) {
|
|
23
|
-
const orientation: ItemCardOrientation = {
|
|
24
|
-
grid: "vertical",
|
|
25
|
-
list: "horizontal",
|
|
26
|
-
carousel: "vertical",
|
|
27
|
-
}[layout] as ItemCardOrientation;
|
|
28
|
-
|
|
29
|
-
const isEmpty = items?.length === 0;
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<motion.section
|
|
33
|
-
data-slot="emperor-ui-listings"
|
|
34
|
-
className={cn(listingsClasses({ className, layout }))}
|
|
35
|
-
style={listingsStyles({ layout })}
|
|
36
|
-
initial="hidden"
|
|
37
|
-
animate="visible"
|
|
38
|
-
>
|
|
39
|
-
{isLoading &&
|
|
40
|
-
Array.from({ length: pagination?.pageSize || 12 }).map((_, index) => (
|
|
41
|
-
<LoadingItem
|
|
42
|
-
key={index}
|
|
43
|
-
className={className}
|
|
44
|
-
classNames={classNames}
|
|
45
|
-
orientation={orientation}
|
|
46
|
-
/>
|
|
47
|
-
))}
|
|
48
|
-
|
|
49
|
-
{!isLoading && isEmpty && <EmptyListings className="col-span-full" />}
|
|
50
|
-
|
|
51
|
-
{!isLoading &&
|
|
52
|
-
!isEmpty &&
|
|
53
|
-
items?.map(
|
|
54
|
-
({
|
|
55
|
-
item,
|
|
56
|
-
actions: itemActions,
|
|
57
|
-
onActionClick: onItemActionClick,
|
|
58
|
-
}) => (
|
|
59
|
-
<ItemCard
|
|
60
|
-
key={item?.key}
|
|
61
|
-
className={cn(listingsItemClasses({ layout }), classNames?.item)}
|
|
62
|
-
item={item}
|
|
63
|
-
isLoading={isLoading}
|
|
64
|
-
actions={itemActions || actions || []}
|
|
65
|
-
onActionClick={onItemActionClick || onActionClick}
|
|
66
|
-
orientation={orientation}
|
|
67
|
-
/>
|
|
68
|
-
),
|
|
69
|
-
)}
|
|
70
|
-
|
|
71
|
-
{!isLoading && !isEmpty && pagination && (
|
|
72
|
-
<Pagination
|
|
73
|
-
className={cn(
|
|
74
|
-
listingsPaginationClasses({ layout }),
|
|
75
|
-
classNames?.pagination,
|
|
76
|
-
)}
|
|
77
|
-
classNames={{
|
|
78
|
-
next: "rtl:rotate-180 cursor-pointer",
|
|
79
|
-
prev: "rtl:rotate-180 cursor-pointer",
|
|
80
|
-
item: "cursor-pointer",
|
|
81
|
-
chevronNext: "rtl:rotate-180 cursor-pointer",
|
|
82
|
-
forwardIcon: "rtl:rotate-180 cursor-pointer",
|
|
83
|
-
}}
|
|
84
|
-
total={pagination?.pagesCount}
|
|
85
|
-
page={pagination?.page}
|
|
86
|
-
onChange={pagination?.setPage}
|
|
87
|
-
variant="faded"
|
|
88
|
-
showControls
|
|
89
|
-
color="primary"
|
|
90
|
-
initialPage={1}
|
|
91
|
-
showShadow
|
|
92
|
-
/>
|
|
93
|
-
)}
|
|
94
|
-
</motion.section>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { Listings } from "@/components";
|
|
3
|
-
import { getStorybookDecorators } from "@/utils";
|
|
4
|
-
import { getListings, MOCK_LISTINGS } from "@/mocks";
|
|
5
|
-
import type { MockItemType } from "@/mocks";
|
|
6
|
-
import { useMemo, useState } from "react";
|
|
7
|
-
import { useEffect } from "react";
|
|
8
|
-
import { usePagination } from "@heroui/pagination";
|
|
9
|
-
|
|
10
|
-
const meta: Meta<typeof Listings> = {
|
|
11
|
-
title: "Organisms/Listings/Grid",
|
|
12
|
-
component: Listings,
|
|
13
|
-
parameters: {
|
|
14
|
-
layout: "centered",
|
|
15
|
-
},
|
|
16
|
-
tags: ["autodocs"],
|
|
17
|
-
decorators: getStorybookDecorators({
|
|
18
|
-
config: {
|
|
19
|
-
layout: {
|
|
20
|
-
withScaffold: false,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
}),
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export default meta;
|
|
27
|
-
|
|
28
|
-
type Story = StoryObj<typeof meta>;
|
|
29
|
-
|
|
30
|
-
export const Default: Story = {
|
|
31
|
-
args: {
|
|
32
|
-
items: MOCK_LISTINGS.map((item) => ({
|
|
33
|
-
item: {
|
|
34
|
-
key: String(item.id),
|
|
35
|
-
title: item?.title,
|
|
36
|
-
description: item.description,
|
|
37
|
-
image: { src: item?.image, alt: item?.title },
|
|
38
|
-
},
|
|
39
|
-
})),
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const WithLoading: Story = {
|
|
44
|
-
args: {},
|
|
45
|
-
render: () => {
|
|
46
|
-
const [items, setItems] = useState<MockItemType[]>([]);
|
|
47
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
48
|
-
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
(async () => {
|
|
51
|
-
const { items } = await getListings({});
|
|
52
|
-
|
|
53
|
-
setItems(items);
|
|
54
|
-
setIsLoading(false);
|
|
55
|
-
})();
|
|
56
|
-
}, []);
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<Listings
|
|
60
|
-
isLoading={isLoading}
|
|
61
|
-
items={items.map((item) => ({
|
|
62
|
-
item: {
|
|
63
|
-
key: String(item.id),
|
|
64
|
-
title: item?.title,
|
|
65
|
-
description: item.description,
|
|
66
|
-
image: { src: item?.image, alt: item?.title },
|
|
67
|
-
},
|
|
68
|
-
}))}
|
|
69
|
-
/>
|
|
70
|
-
);
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const WithActions: Story = {
|
|
75
|
-
args: {
|
|
76
|
-
items: MOCK_LISTINGS.map((item) => ({
|
|
77
|
-
item: {
|
|
78
|
-
key: String(item.id),
|
|
79
|
-
title: item?.title,
|
|
80
|
-
description: item.description,
|
|
81
|
-
image: { src: item?.image, alt: item?.title },
|
|
82
|
-
},
|
|
83
|
-
actions: [
|
|
84
|
-
{ key: "view", label: "View details" },
|
|
85
|
-
{ key: "edit", label: "Edit" },
|
|
86
|
-
{ key: "delete", label: "Delete" },
|
|
87
|
-
],
|
|
88
|
-
})),
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const WithPagination: Story = {
|
|
93
|
-
args: {},
|
|
94
|
-
render: () => {
|
|
95
|
-
const [items, setItems] = useState<MockItemType[]>([]);
|
|
96
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
97
|
-
|
|
98
|
-
const pageSize = 6;
|
|
99
|
-
const totalItemsCount = MOCK_LISTINGS.length;
|
|
100
|
-
const pagesCount = useMemo(
|
|
101
|
-
() => Math.ceil(totalItemsCount / pageSize),
|
|
102
|
-
[totalItemsCount, pageSize],
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
const { activePage: page, setPage } = usePagination({
|
|
106
|
-
total: pagesCount,
|
|
107
|
-
initialPage: 1,
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
(async () => {
|
|
112
|
-
setIsLoading(true);
|
|
113
|
-
|
|
114
|
-
const { items } = await getListings({
|
|
115
|
-
page,
|
|
116
|
-
pageSize,
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
setItems(items);
|
|
120
|
-
setIsLoading(false);
|
|
121
|
-
})();
|
|
122
|
-
}, [page]);
|
|
123
|
-
|
|
124
|
-
return (
|
|
125
|
-
<Listings
|
|
126
|
-
isLoading={isLoading}
|
|
127
|
-
items={items.map((item) => ({
|
|
128
|
-
item: {
|
|
129
|
-
key: String(item.id),
|
|
130
|
-
title: item?.title,
|
|
131
|
-
description: item.description,
|
|
132
|
-
image: { src: item?.image, alt: item?.title },
|
|
133
|
-
banner: item?.isBestSeller ? "Best Seller" : undefined,
|
|
134
|
-
chips: item?.categories || [],
|
|
135
|
-
},
|
|
136
|
-
}))}
|
|
137
|
-
pagination={{
|
|
138
|
-
page,
|
|
139
|
-
setPage,
|
|
140
|
-
pageSize,
|
|
141
|
-
totalItemsCount,
|
|
142
|
-
pagesCount,
|
|
143
|
-
}}
|
|
144
|
-
/>
|
|
145
|
-
);
|
|
146
|
-
},
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export const EmptyListings: Story = {
|
|
150
|
-
args: {
|
|
151
|
-
items: [],
|
|
152
|
-
},
|
|
153
|
-
};
|