@js-empire/emperor-ui 1.3.11 → 1.3.13
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/.cursor/rules/code-conventions.mdc +50 -0
- package/.husky/pre-commit +4 -0
- package/.prettierrc +10 -0
- package/.storybook/main.ts +24 -0
- package/.storybook/preview.ts +19 -0
- package/.storybook/vitest.setup.ts +7 -0
- package/.vscode/extensions.json +1 -0
- package/dist/emperor-ui.js +158 -4236
- package/dist/emperor-ui.umd.cjs +52 -1
- 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-4OxAyqvp.js +5 -0
- package/dist/index-CHrqdTZ9.js +290 -0
- package/dist/index-DXWNWGH3.js +57021 -0
- package/dist/index.d.ts +1357 -0
- package/dist/src-UW24ZMRV-DQtCWsbT.js +5 -0
- package/eslint.config.js +34 -0
- package/index.html +13 -0
- package/package.json +10 -57
- 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 +26 -0
- package/src/animations/floating.ts +12 -0
- package/src/animations/index.ts +2 -0
- package/src/components/atoms/brand/brand.stories.tsx +29 -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/color-picker/color-picker.tsx +12 -0
- package/src/components/atoms/color-picker/free-color-picker.tsx +58 -0
- package/src/components/atoms/color-picker/index.ts +3 -0
- package/src/components/atoms/color-picker/preset-color-picker.tsx +66 -0
- package/src/components/atoms/color-picker/stories/color-picker.stories.tsx +63 -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/copy-button/copy-button.tsx +73 -0
- package/src/components/atoms/copy-button/index.ts +1 -0
- package/src/components/atoms/copy-button/stories/copy-button.stories.tsx +21 -0
- package/src/components/atoms/field/field.tsx +81 -0
- package/src/components/atoms/field/index.ts +3 -0
- package/src/components/atoms/field/styles/classes.ts +9 -0
- package/src/components/atoms/field/styles/index.ts +1 -0
- package/src/components/atoms/field/units/autocomplete-field.tsx +49 -0
- package/src/components/atoms/field/units/checkbox-field.tsx +35 -0
- package/src/components/atoms/field/units/index.ts +7 -0
- package/src/components/atoms/field/units/input-field.tsx +35 -0
- package/src/components/atoms/field/units/radio-field.tsx +43 -0
- package/src/components/atoms/field/units/select-field.tsx +50 -0
- package/src/components/atoms/field/units/switch-field.tsx +35 -0
- package/src/components/atoms/field/units/textarea-field.tsx +37 -0
- package/src/components/atoms/filter/filter.tsx +93 -0
- package/src/components/atoms/filter/index.ts +3 -0
- package/src/components/atoms/filter/stories/filter.stories.tsx +238 -0
- package/src/components/atoms/filter/styles/classes.ts +20 -0
- package/src/components/atoms/filter/styles/index.ts +1 -0
- package/src/components/atoms/filter/units/autocomplete-filter.tsx +66 -0
- package/src/components/atoms/filter/units/checkbox-filter.tsx +42 -0
- package/src/components/atoms/filter/units/checkbox-group-filter.tsx +68 -0
- package/src/components/atoms/filter/units/date-filter.tsx +46 -0
- package/src/components/atoms/filter/units/index.ts +9 -0
- package/src/components/atoms/filter/units/numeric-filter.tsx +41 -0
- package/src/components/atoms/filter/units/range-filter.tsx +65 -0
- package/src/components/atoms/filter/units/search-filter.tsx +53 -0
- package/src/components/atoms/filter/units/select-filter.tsx +57 -0
- package/src/components/atoms/filter/units/switch-filter.tsx +35 -0
- package/src/components/atoms/index.ts +11 -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/theme-switch/index.ts +1 -0
- package/src/components/atoms/theme-switch/styles/classes.ts +16 -0
- package/src/components/atoms/theme-switch/styles/index.ts +1 -0
- package/src/components/atoms/theme-switch/theme-switch.stories.tsx +26 -0
- package/src/components/atoms/theme-switch/theme-switch.tsx +54 -0
- package/src/components/atoms/uploader/components/avatar-label.tsx +102 -0
- package/src/components/atoms/uploader/components/index.ts +8 -0
- package/src/components/atoms/uploader/components/upload-file-error-box.tsx +40 -0
- package/src/components/atoms/uploader/components/upload-file-input.tsx +36 -0
- package/src/components/atoms/uploader/components/upload-file-label.tsx +92 -0
- package/src/components/atoms/uploader/components/upload-file-listing.tsx +64 -0
- package/src/components/atoms/uploader/components/uploader-title.tsx +21 -0
- package/src/components/atoms/uploader/components/uploader.tsx +89 -0
- package/src/components/atoms/uploader/components/view-image-modal.tsx +41 -0
- package/src/components/atoms/uploader/index.ts +1 -0
- package/src/components/atoms/uploader/stories/uploader.stories.tsx +202 -0
- package/src/components/index.ts +4 -0
- package/src/components/molecules/index.ts +4 -0
- package/src/components/molecules/item-card/components/actions/index.ts +3 -0
- package/src/components/molecules/item-card/components/actions/item-actions-buttons.tsx +43 -0
- package/src/components/molecules/item-card/components/actions/item-actions-dropdown.tsx +57 -0
- package/src/components/molecules/item-card/components/actions/item-actions-overlay.tsx +50 -0
- package/src/components/molecules/item-card/components/additions/index.ts +2 -0
- package/src/components/molecules/item-card/components/additions/item-banner.tsx +22 -0
- package/src/components/molecules/item-card/components/additions/loading-item.tsx +88 -0
- package/src/components/molecules/item-card/components/card/index.ts +4 -0
- package/src/components/molecules/item-card/components/card/item-card-body.tsx +74 -0
- package/src/components/molecules/item-card/components/card/item-card-footer.tsx +79 -0
- package/src/components/molecules/item-card/components/card/item-card-header.tsx +69 -0
- package/src/components/molecules/item-card/components/card/item-card.tsx +123 -0
- package/src/components/molecules/item-card/components/index.ts +3 -0
- package/src/components/molecules/item-card/index.ts +2 -0
- package/src/components/molecules/item-card/stories/item-card.stories.tsx +218 -0
- package/src/components/molecules/item-card/styles/classes.ts +141 -0
- package/src/components/molecules/item-card/styles/index.ts +1 -0
- package/src/components/molecules/nav-bar/index.ts +3 -0
- package/src/components/molecules/nav-bar/nav-bar-item.tsx +64 -0
- package/src/components/molecules/nav-bar/nav-bar.tsx +57 -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 +58 -0
- package/src/components/molecules/scaffold/index.ts +2 -0
- package/src/components/molecules/scaffold/scaffold.stories.tsx +21 -0
- package/src/components/molecules/scaffold/scaffold.tsx +23 -0
- package/src/components/molecules/scaffold/styles/index.ts +1 -0
- package/src/components/molecules/scaffold/styles/scaffold-classes.ts +10 -0
- package/src/components/molecules/side-bar/compact-side-bar.tsx +77 -0
- package/src/components/molecules/side-bar/index.ts +1 -0
- package/src/components/molecules/side-bar/side-bar-drawer.tsx +113 -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/deletion-confirmor/deletion-confirmor.tsx +110 -0
- package/src/components/organisms/deletion-confirmor/index.ts +3 -0
- package/src/components/organisms/deletion-confirmor/stories/components.tsx +25 -0
- package/src/components/organisms/deletion-confirmor/stories/deletion-confirmor.stories.tsx +78 -0
- package/src/components/organisms/deletion-confirmor/styles/classes.ts +28 -0
- package/src/components/organisms/deletion-confirmor/styles/index.ts +2 -0
- package/src/components/organisms/deletion-confirmor/styles/styles.ts +4 -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 +27 -0
- package/src/components/organisms/footer/quick-links-box.tsx +46 -0
- package/src/components/organisms/footer/social-links-box.tsx +33 -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/form-builder/form-builder.stories.tsx +144 -0
- package/src/components/organisms/form-builder/form-builder.tsx +75 -0
- package/src/components/organisms/form-builder/index.ts +1 -0
- package/src/components/organisms/header/header.tsx +87 -0
- package/src/components/organisms/header/index.ts +1 -0
- package/src/components/organisms/header/segmented-header-content.tsx +29 -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 +6 -0
- package/src/components/organisms/item-details/index.ts +1 -0
- package/src/components/organisms/item-details/item-details.tsx +6 -0
- package/src/components/organisms/listings/empty-listings.tsx +80 -0
- package/src/components/organisms/listings/index.ts +3 -0
- package/src/components/organisms/listings/listings.tsx +96 -0
- package/src/components/organisms/listings/stories/grid-listings.stories.tsx +153 -0
- package/src/components/organisms/listings/stories/list-listings.stories.tsx +171 -0
- package/src/components/organisms/listings/styles/classes.ts +49 -0
- package/src/components/organisms/listings/styles/index.ts +2 -0
- package/src/components/organisms/listings/styles/styles.ts +6 -0
- 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/animations.ts +14 -0
- package/src/constants/card.tsx +42 -0
- package/src/constants/defaults.ts +59 -0
- package/src/constants/fake.ts +5 -0
- package/src/constants/footer.tsx +157 -0
- package/src/constants/index.ts +6 -0
- package/src/constants/uploader.ts +33 -0
- package/src/context/emperor-ui-context.ts +6 -0
- package/src/context/form-builder-context.tsx +8 -0
- package/src/context/index.ts +4 -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 +5 -0
- package/src/enums/preserved-keys.ts +3 -0
- package/src/examples/index.ts +1 -0
- package/src/hooks/index.ts +8 -0
- package/src/hooks/use-emperor-ui.ts +12 -0
- package/src/hooks/use-filters.ts +20 -0
- package/src/hooks/use-form-builder-context.ts +16 -0
- package/src/hooks/use-navigation.ts +12 -0
- package/src/hooks/use-search-params-handler.tsx +186 -0
- package/src/hooks/use-uploader-context.ts +14 -0
- package/src/hooks/use-uploader.tsx +164 -0
- package/src/hooks/use-window-size.tsx +53 -0
- package/src/i18n/configs/i18n.ts +7 -0
- package/src/i18n/configs/index.ts +1 -0
- package/src/i18n/constants/index.ts +1 -0
- package/src/i18n/constants/locales.ts +4 -0
- package/src/i18n/index.ts +5 -0
- package/src/i18n/locales/ar.ts +15 -0
- package/src/i18n/locales/atoms/ar.ts +18 -0
- package/src/i18n/locales/atoms/en.ts +18 -0
- package/src/i18n/locales/atoms/index.ts +2 -0
- package/src/i18n/locales/common/ar.ts +1 -0
- package/src/i18n/locales/common/en.ts +1 -0
- package/src/i18n/locales/common/index.ts +2 -0
- package/src/i18n/locales/en.ts +15 -0
- package/src/i18n/locales/index.ts +4 -0
- package/src/i18n/locales/molecules/ar.ts +1 -0
- package/src/i18n/locales/molecules/en.ts +1 -0
- package/src/i18n/locales/molecules/index.ts +2 -0
- package/src/i18n/locales/organisms/ar.ts +11 -0
- package/src/i18n/locales/organisms/en.ts +11 -0
- package/src/i18n/locales/organisms/index.ts +2 -0
- package/src/i18n/locales/templates/ar.ts +1 -0
- package/src/i18n/locales/templates/en.ts +1 -0
- package/src/i18n/locales/templates/index.ts +2 -0
- package/src/i18n/locales/toasts/ar.ts +1 -0
- package/src/i18n/locales/toasts/en.ts +1 -0
- package/src/i18n/locales/toasts/index.ts +2 -0
- package/src/i18n/types/index.ts +2 -0
- package/{dist/src/i18n/types/locale.d.ts → src/i18n/types/locale.ts} +3 -1
- package/{dist/src/i18n/types/toasts.d.ts → src/i18n/types/toasts.ts} +2 -1
- package/src/i18n/utils/get-locales.ts +4 -0
- package/src/i18n/utils/index.ts +2 -0
- package/src/i18n/utils/localize.ts +15 -0
- package/src/index.ts +14 -0
- package/src/mocks/constants.ts +103 -0
- package/src/mocks/deletion-confirmor.ts +16 -0
- package/src/mocks/header.tsx +118 -0
- package/src/mocks/index.ts +6 -0
- package/src/mocks/listings.tsx +154 -0
- package/src/mocks/locales/index.ts +1 -0
- package/src/mocks/locales/uploader.ts +33 -0
- package/src/mocks/types.ts +64 -0
- package/src/providers/config-provider.tsx +72 -0
- package/src/providers/emperor-ui-provider.tsx +35 -0
- package/src/providers/form-builder-provider-context.tsx +18 -0
- package/src/providers/index.ts +6 -0
- package/src/providers/navigation-provider.tsx +42 -0
- package/src/providers/theme-provider.tsx +16 -0
- package/src/providers/uploader-provider.tsx +53 -0
- package/src/styles/globals.css +38 -0
- package/src/styles/hero.ts +3 -0
- package/src/styles/index.css +18 -0
- package/src/types/components/atoms/brand.ts +13 -0
- package/src/types/components/atoms/color-picker/color-picker.ts +21 -0
- package/src/types/components/atoms/color-picker/index.ts +1 -0
- package/src/types/components/atoms/column.ts +3 -0
- package/{dist/src/types/components/atoms/container.d.ts → src/types/components/atoms/container.ts} +2 -1
- package/src/types/components/atoms/field/field.ts +61 -0
- package/src/types/components/atoms/field/index.ts +1 -0
- package/src/types/components/atoms/filter/filter.ts +52 -0
- package/src/types/components/atoms/filter/index.ts +2 -0
- package/{dist/src/types/components/atoms/filter/select-filter.d.ts → src/types/components/atoms/filter/select-filter.ts} +4 -3
- package/src/types/components/atoms/index.ts +9 -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 +103 -0
- package/src/types/components/index.ts +4 -0
- package/src/types/components/molecules/footer/footer.ts +68 -0
- package/src/types/components/molecules/footer/index.ts +1 -0
- package/src/types/components/molecules/header/header.ts +51 -0
- package/src/types/components/molecules/header/index.ts +1 -0
- package/src/types/components/molecules/index.ts +9 -0
- package/src/types/components/molecules/item-card/index.ts +1 -0
- package/src/types/components/molecules/item-card/item-card.ts +69 -0
- package/src/types/components/molecules/item-details/index.ts +1 -0
- package/src/types/components/molecules/item-details/item-details.ts +9 -0
- package/src/types/components/molecules/listings/index.ts +1 -0
- package/src/types/components/molecules/listings/listings.ts +29 -0
- package/src/types/components/molecules/nav-bar/index.ts +1 -0
- package/src/types/components/molecules/nav-bar/nav-bar.ts +66 -0
- package/src/types/components/molecules/scaffold/index.ts +1 -0
- package/src/types/components/molecules/scaffold/scaffold.ts +9 -0
- 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/molecules/theme-switch/index.ts +1 -0
- package/src/types/components/molecules/theme-switch/theme-switch.ts +9 -0
- package/src/types/components/organisms/deletion-confirmor/deletion-confirmor.ts +22 -0
- package/src/types/components/organisms/deletion-confirmor/index.ts +1 -0
- package/src/types/components/organisms/filters/filters.ts +11 -0
- package/src/types/components/organisms/filters/index.ts +1 -0
- package/src/types/components/organisms/form-builder/context.ts +6 -0
- package/src/types/components/organisms/form-builder/form-builder.ts +39 -0
- package/src/types/components/organisms/form-builder/index.ts +2 -0
- package/src/types/components/organisms/index.ts +3 -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 +24 -0
- package/src/types/context/index.ts +4 -0
- package/src/types/context/localization.ts +24 -0
- package/src/types/context/navigation.ts +17 -0
- package/src/types/context/theme.ts +33 -0
- package/src/types/index.ts +3 -0
- package/{dist/src/types/shared/components.d.ts → src/types/shared/components.ts} +9 -6
- package/src/types/shared/index.ts +1 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/compress-images.ts +36 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/locales.ts +54 -0
- package/src/utils/storybook.tsx +15 -0
- package/src/utils/uploader.ts +170 -0
- package/tsconfig.app.json +37 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +25 -0
- package/vite.config.ts +44 -0
- package/vitest.shims.d.ts +1 -0
- package/dist/src/animations/blink.d.ts +0 -7
- package/dist/src/animations/floating.d.ts +0 -2
- package/dist/src/animations/index.d.ts +0 -2
- package/dist/src/components/atoms/brand/brand.d.ts +0 -14
- package/dist/src/components/atoms/brand/index.d.ts +0 -1
- package/dist/src/components/atoms/brand/styles/classes.d.ts +0 -3
- package/dist/src/components/atoms/brand/styles/index.d.ts +0 -2
- package/dist/src/components/atoms/brand/styles/styles.d.ts +0 -1
- package/dist/src/components/atoms/color-picker/color-picker.d.ts +0 -2
- package/dist/src/components/atoms/color-picker/free-color-picker.d.ts +0 -2
- package/dist/src/components/atoms/color-picker/index.d.ts +0 -3
- package/dist/src/components/atoms/color-picker/preset-color-picker.d.ts +0 -2
- package/dist/src/components/atoms/column/column.d.ts +0 -2
- package/dist/src/components/atoms/column/index.d.ts +0 -1
- package/dist/src/components/atoms/container/container.d.ts +0 -2
- package/dist/src/components/atoms/container/index.d.ts +0 -1
- package/dist/src/components/atoms/copy-button/copy-button.d.ts +0 -3
- package/dist/src/components/atoms/copy-button/index.d.ts +0 -1
- package/dist/src/components/atoms/field/field.d.ts +0 -3
- package/dist/src/components/atoms/field/index.d.ts +0 -3
- package/dist/src/components/atoms/field/styles/classes.d.ts +0 -3
- package/dist/src/components/atoms/field/styles/index.d.ts +0 -1
- package/dist/src/components/atoms/field/units/autocomplete-field.d.ts +0 -3
- package/dist/src/components/atoms/field/units/checkbox-field.d.ts +0 -3
- package/dist/src/components/atoms/field/units/index.d.ts +0 -7
- package/dist/src/components/atoms/field/units/input-field.d.ts +0 -3
- package/dist/src/components/atoms/field/units/radio-field.d.ts +0 -3
- package/dist/src/components/atoms/field/units/select-field.d.ts +0 -3
- package/dist/src/components/atoms/field/units/switch-field.d.ts +0 -3
- package/dist/src/components/atoms/field/units/textarea-field.d.ts +0 -3
- package/dist/src/components/atoms/filter/filter.d.ts +0 -2
- package/dist/src/components/atoms/filter/index.d.ts +0 -3
- package/dist/src/components/atoms/filter/styles/classes.d.ts +0 -3
- package/dist/src/components/atoms/filter/styles/index.d.ts +0 -1
- package/dist/src/components/atoms/filter/units/autocomplete-filter.d.ts +0 -2
- package/dist/src/components/atoms/filter/units/checkbox-filter.d.ts +0 -2
- package/dist/src/components/atoms/filter/units/checkbox-group-filter.d.ts +0 -2
- package/dist/src/components/atoms/filter/units/date-filter.d.ts +0 -2
- package/dist/src/components/atoms/filter/units/index.d.ts +0 -9
- package/dist/src/components/atoms/filter/units/numeric-filter.d.ts +0 -2
- package/dist/src/components/atoms/filter/units/range-filter.d.ts +0 -2
- package/dist/src/components/atoms/filter/units/search-filter.d.ts +0 -2
- package/dist/src/components/atoms/filter/units/select-filter.d.ts +0 -2
- package/dist/src/components/atoms/filter/units/switch-filter.d.ts +0 -2
- package/dist/src/components/atoms/index.d.ts +0 -11
- package/dist/src/components/atoms/portal/index.d.ts +0 -1
- package/dist/src/components/atoms/portal/portal.d.ts +0 -2
- package/dist/src/components/atoms/row/index.d.ts +0 -1
- package/dist/src/components/atoms/row/row.d.ts +0 -2
- package/dist/src/components/atoms/theme-switch/index.d.ts +0 -1
- package/dist/src/components/atoms/theme-switch/styles/classes.d.ts +0 -3
- package/dist/src/components/atoms/theme-switch/styles/index.d.ts +0 -1
- package/dist/src/components/atoms/theme-switch/theme-switch.d.ts +0 -2
- package/dist/src/components/atoms/uploader/components/avatar-label.d.ts +0 -1
- package/dist/src/components/atoms/uploader/components/index.d.ts +0 -8
- package/dist/src/components/atoms/uploader/components/upload-file-error-box.d.ts +0 -1
- package/dist/src/components/atoms/uploader/components/upload-file-input.d.ts +0 -1
- package/dist/src/components/atoms/uploader/components/upload-file-label.d.ts +0 -1
- package/dist/src/components/atoms/uploader/components/upload-file-listing.d.ts +0 -1
- package/dist/src/components/atoms/uploader/components/uploader-title.d.ts +0 -2
- package/dist/src/components/atoms/uploader/components/uploader.d.ts +0 -19
- package/dist/src/components/atoms/uploader/components/view-image-modal.d.ts +0 -1
- package/dist/src/components/atoms/uploader/index.d.ts +0 -1
- package/dist/src/components/index.d.ts +0 -4
- package/dist/src/components/molecules/index.d.ts +0 -4
- package/dist/src/components/molecules/item-card/components/actions/index.d.ts +0 -3
- package/dist/src/components/molecules/item-card/components/actions/item-actions-buttons.d.ts +0 -6
- package/dist/src/components/molecules/item-card/components/actions/item-actions-dropdown.d.ts +0 -2
- package/dist/src/components/molecules/item-card/components/actions/item-actions-overlay.d.ts +0 -4
- package/dist/src/components/molecules/item-card/components/additions/index.d.ts +0 -2
- package/dist/src/components/molecules/item-card/components/additions/item-banner.d.ts +0 -2
- package/dist/src/components/molecules/item-card/components/additions/loading-item.d.ts +0 -2
- package/dist/src/components/molecules/item-card/components/card/index.d.ts +0 -4
- package/dist/src/components/molecules/item-card/components/card/item-card-body.d.ts +0 -2
- package/dist/src/components/molecules/item-card/components/card/item-card-footer.d.ts +0 -2
- package/dist/src/components/molecules/item-card/components/card/item-card-header.d.ts +0 -2
- package/dist/src/components/molecules/item-card/components/card/item-card.d.ts +0 -2
- package/dist/src/components/molecules/item-card/components/index.d.ts +0 -3
- package/dist/src/components/molecules/item-card/index.d.ts +0 -2
- package/dist/src/components/molecules/item-card/styles/classes.d.ts +0 -33
- package/dist/src/components/molecules/item-card/styles/index.d.ts +0 -1
- package/dist/src/components/molecules/nav-bar/index.d.ts +0 -3
- package/dist/src/components/molecules/nav-bar/nav-bar-item.d.ts +0 -6
- package/dist/src/components/molecules/nav-bar/nav-bar.d.ts +0 -13
- package/dist/src/components/molecules/nav-bar/styles/classes.d.ts +0 -11
- package/dist/src/components/molecules/nav-bar/styles/index.d.ts +0 -2
- package/dist/src/components/molecules/nav-bar/styles/styles.d.ts +0 -5
- package/dist/src/components/molecules/nav-bar/sub-items-box.d.ts +0 -2
- package/dist/src/components/molecules/scaffold/index.d.ts +0 -2
- package/dist/src/components/molecules/scaffold/scaffold.d.ts +0 -3
- package/dist/src/components/molecules/scaffold/styles/index.d.ts +0 -1
- package/dist/src/components/molecules/scaffold/styles/scaffold-classes.d.ts +0 -1
- package/dist/src/components/molecules/side-bar/compact-side-bar.d.ts +0 -2
- package/dist/src/components/molecules/side-bar/index.d.ts +0 -1
- package/dist/src/components/molecules/side-bar/side-bar-drawer.d.ts +0 -2
- package/dist/src/components/molecules/side-bar/side-bar.d.ts +0 -15
- package/dist/src/components/molecules/side-bar/styles/classes.d.ts +0 -6
- package/dist/src/components/molecules/side-bar/styles/index.d.ts +0 -2
- package/dist/src/components/molecules/side-bar/styles/styles.d.ts +0 -3
- package/dist/src/components/organisms/deletion-confirmor/deletion-confirmor.d.ts +0 -2
- package/dist/src/components/organisms/deletion-confirmor/index.d.ts +0 -3
- package/dist/src/components/organisms/deletion-confirmor/stories/components.d.ts +0 -2
- package/dist/src/components/organisms/deletion-confirmor/styles/classes.d.ts +0 -4
- package/dist/src/components/organisms/deletion-confirmor/styles/index.d.ts +0 -2
- package/dist/src/components/organisms/deletion-confirmor/styles/styles.d.ts +0 -2
- package/dist/src/components/organisms/footer/copy-rights-box.d.ts +0 -2
- package/dist/src/components/organisms/footer/footer.d.ts +0 -11
- package/dist/src/components/organisms/footer/index.d.ts +0 -5
- package/dist/src/components/organisms/footer/policies-box.d.ts +0 -2
- package/dist/src/components/organisms/footer/quick-links-box.d.ts +0 -2
- package/dist/src/components/organisms/footer/social-links-box.d.ts +0 -2
- package/dist/src/components/organisms/footer/styles/classes.d.ts +0 -9
- package/dist/src/components/organisms/footer/styles/index.d.ts +0 -2
- package/dist/src/components/organisms/footer/styles/styles.d.ts +0 -2
- package/dist/src/components/organisms/form-builder/form-builder.d.ts +0 -3
- package/dist/src/components/organisms/form-builder/index.d.ts +0 -1
- package/dist/src/components/organisms/header/header.d.ts +0 -8
- package/dist/src/components/organisms/header/index.d.ts +0 -1
- package/dist/src/components/organisms/header/segmented-header-content.d.ts +0 -2
- package/dist/src/components/organisms/header/styles/classes.d.ts +0 -3
- package/dist/src/components/organisms/header/styles/index.d.ts +0 -2
- package/dist/src/components/organisms/header/styles/styles.d.ts +0 -6
- package/dist/src/components/organisms/index.d.ts +0 -6
- package/dist/src/components/organisms/item-details/index.d.ts +0 -1
- package/dist/src/components/organisms/item-details/item-details.d.ts +0 -2
- package/dist/src/components/organisms/listings/empty-listings.d.ts +0 -9
- package/dist/src/components/organisms/listings/index.d.ts +0 -3
- package/dist/src/components/organisms/listings/listings.d.ts +0 -2
- package/dist/src/components/organisms/listings/styles/classes.d.ts +0 -10
- package/dist/src/components/organisms/listings/styles/index.d.ts +0 -2
- package/dist/src/components/organisms/listings/styles/styles.d.ts +0 -2
- package/dist/src/components/templates/index.d.ts +0 -1
- package/dist/src/components/templates/landing-page/index.d.ts +0 -1
- package/dist/src/components/templates/landing-page/landing-page.d.ts +0 -10
- package/dist/src/components/templates/landing-page/styles/classes.d.ts +0 -3
- package/dist/src/components/templates/landing-page/styles/index.d.ts +0 -1
- package/dist/src/constants/animations.d.ts +0 -5
- package/dist/src/constants/card.d.ts +0 -3
- package/dist/src/constants/defaults.d.ts +0 -2
- package/dist/src/constants/fake.d.ts +0 -2
- package/dist/src/constants/footer.d.ts +0 -6
- package/dist/src/constants/index.d.ts +0 -6
- package/dist/src/constants/uploader.d.ts +0 -8
- package/dist/src/context/emperor-ui-context.d.ts +0 -2
- package/dist/src/context/form-builder-context.d.ts +0 -3
- package/dist/src/context/index.d.ts +0 -4
- package/dist/src/context/navigation-context.d.ts +0 -2
- package/dist/src/context/uploader-context.d.ts +0 -2
- package/dist/src/enums/index.d.ts +0 -2
- package/dist/src/enums/placeholders.d.ts +0 -5
- package/dist/src/enums/preserved-keys.d.ts +0 -3
- package/dist/src/examples/index.d.ts +0 -1
- package/dist/src/hooks/index.d.ts +0 -8
- package/dist/src/hooks/use-emperor-ui.d.ts +0 -1
- package/dist/src/hooks/use-filters.d.ts +0 -4
- package/dist/src/hooks/use-form-builder-context.d.ts +0 -3
- package/dist/src/hooks/use-navigation.d.ts +0 -1
- package/dist/src/hooks/use-search-params-handler.d.ts +0 -17
- package/dist/src/hooks/use-uploader-context.d.ts +0 -1
- package/dist/src/hooks/use-uploader.d.ts +0 -2
- package/dist/src/hooks/use-window-size.d.ts +0 -7
- package/dist/src/i18n/configs/i18n.d.ts +0 -6
- package/dist/src/i18n/configs/index.d.ts +0 -1
- package/dist/src/i18n/constants/index.d.ts +0 -1
- package/dist/src/i18n/constants/locales.d.ts +0 -4
- package/dist/src/i18n/index.d.ts +0 -5
- package/dist/src/i18n/locales/ar.d.ts +0 -32
- package/dist/src/i18n/locales/atoms/ar.d.ts +0 -16
- package/dist/src/i18n/locales/atoms/en.d.ts +0 -16
- package/dist/src/i18n/locales/atoms/index.d.ts +0 -2
- package/dist/src/i18n/locales/common/ar.d.ts +0 -1
- package/dist/src/i18n/locales/common/en.d.ts +0 -1
- package/dist/src/i18n/locales/common/index.d.ts +0 -2
- package/dist/src/i18n/locales/en.d.ts +0 -32
- package/dist/src/i18n/locales/index.d.ts +0 -4
- package/dist/src/i18n/locales/molecules/ar.d.ts +0 -1
- package/dist/src/i18n/locales/molecules/en.d.ts +0 -1
- package/dist/src/i18n/locales/molecules/index.d.ts +0 -2
- package/dist/src/i18n/locales/organisms/ar.d.ts +0 -10
- package/dist/src/i18n/locales/organisms/en.d.ts +0 -10
- package/dist/src/i18n/locales/organisms/index.d.ts +0 -2
- package/dist/src/i18n/locales/templates/ar.d.ts +0 -1
- package/dist/src/i18n/locales/templates/en.d.ts +0 -1
- package/dist/src/i18n/locales/templates/index.d.ts +0 -2
- package/dist/src/i18n/locales/toasts/ar.d.ts +0 -1
- package/dist/src/i18n/locales/toasts/en.d.ts +0 -1
- package/dist/src/i18n/locales/toasts/index.d.ts +0 -2
- package/dist/src/i18n/types/index.d.ts +0 -2
- package/dist/src/i18n/utils/get-locales.d.ts +0 -2
- package/dist/src/i18n/utils/index.d.ts +0 -2
- package/dist/src/i18n/utils/localize.d.ts +0 -6
- package/dist/src/index.d.ts +0 -10
- package/dist/src/mocks/constants.d.ts +0 -10
- package/dist/src/mocks/deletion-confirmor.d.ts +0 -7
- package/dist/src/mocks/header.d.ts +0 -5
- package/dist/src/mocks/index.d.ts +0 -6
- package/dist/src/mocks/listings.d.ts +0 -14
- package/dist/src/mocks/locales/index.d.ts +0 -1
- package/dist/src/mocks/locales/uploader.d.ts +0 -2
- package/dist/src/mocks/types.d.ts +0 -28
- package/dist/src/providers/config-provider.d.ts +0 -2
- package/dist/src/providers/emperor-ui-provider.d.ts +0 -4
- package/dist/src/providers/form-builder-provider-context.d.ts +0 -7
- package/dist/src/providers/index.d.ts +0 -6
- package/dist/src/providers/navigation-provider.d.ts +0 -2
- package/dist/src/providers/theme-provider.d.ts +0 -5
- package/dist/src/providers/uploader-provider.d.ts +0 -2
- package/dist/src/styles/hero.d.ts +0 -2
- package/dist/src/types/components/atoms/brand.d.ts +0 -12
- package/dist/src/types/components/atoms/color-picker/color-picker.d.ts +0 -10
- package/dist/src/types/components/atoms/color-picker/index.d.ts +0 -1
- package/dist/src/types/components/atoms/column.d.ts +0 -2
- package/dist/src/types/components/atoms/field/field.d.ts +0 -36
- package/dist/src/types/components/atoms/field/index.d.ts +0 -1
- package/dist/src/types/components/atoms/filter/filter.d.ts +0 -35
- package/dist/src/types/components/atoms/filter/index.d.ts +0 -2
- package/dist/src/types/components/atoms/index.d.ts +0 -9
- package/dist/src/types/components/atoms/portal.d.ts +0 -5
- package/dist/src/types/components/atoms/row.d.ts +0 -2
- package/dist/src/types/components/atoms/uploader.d.ts +0 -84
- package/dist/src/types/components/index.d.ts +0 -4
- package/dist/src/types/components/molecules/footer/footer.d.ts +0 -60
- package/dist/src/types/components/molecules/footer/index.d.ts +0 -1
- package/dist/src/types/components/molecules/header/header.d.ts +0 -38
- package/dist/src/types/components/molecules/header/index.d.ts +0 -1
- package/dist/src/types/components/molecules/index.d.ts +0 -9
- package/dist/src/types/components/molecules/item-card/index.d.ts +0 -1
- package/dist/src/types/components/molecules/item-card/item-card.d.ts +0 -57
- package/dist/src/types/components/molecules/item-details/index.d.ts +0 -1
- package/dist/src/types/components/molecules/item-details/item-details.d.ts +0 -7
- package/dist/src/types/components/molecules/listings/index.d.ts +0 -1
- package/dist/src/types/components/molecules/listings/listings.d.ts +0 -22
- package/dist/src/types/components/molecules/nav-bar/index.d.ts +0 -1
- package/dist/src/types/components/molecules/nav-bar/nav-bar.d.ts +0 -45
- package/dist/src/types/components/molecules/scaffold/index.d.ts +0 -1
- package/dist/src/types/components/molecules/scaffold/scaffold.d.ts +0 -7
- package/dist/src/types/components/molecules/side-bar/index.d.ts +0 -1
- package/dist/src/types/components/molecules/side-bar/side-bar.d.ts +0 -36
- package/dist/src/types/components/molecules/theme-switch/index.d.ts +0 -1
- package/dist/src/types/components/molecules/theme-switch/theme-switch.d.ts +0 -7
- package/dist/src/types/components/organisms/deletion-confirmor/deletion-confirmor.d.ts +0 -20
- package/dist/src/types/components/organisms/deletion-confirmor/index.d.ts +0 -1
- package/dist/src/types/components/organisms/filters/filters.d.ts +0 -9
- package/dist/src/types/components/organisms/filters/index.d.ts +0 -1
- package/dist/src/types/components/organisms/form-builder/context.d.ts +0 -5
- package/dist/src/types/components/organisms/form-builder/form-builder.d.ts +0 -26
- package/dist/src/types/components/organisms/form-builder/index.d.ts +0 -2
- package/dist/src/types/components/organisms/index.d.ts +0 -3
- package/dist/src/types/components/templates/index.d.ts +0 -1
- package/dist/src/types/components/templates/landing-page.d.ts +0 -8
- package/dist/src/types/context/config.d.ts +0 -19
- package/dist/src/types/context/index.d.ts +0 -4
- package/dist/src/types/context/localization.d.ts +0 -17
- package/dist/src/types/context/navigation.d.ts +0 -15
- package/dist/src/types/context/theme.d.ts +0 -32
- package/dist/src/types/index.d.ts +0 -3
- package/dist/src/types/shared/index.d.ts +0 -1
- package/dist/src/utils/cn.d.ts +0 -2
- package/dist/src/utils/compress-images.d.ts +0 -2
- package/dist/src/utils/index.d.ts +0 -5
- package/dist/src/utils/locales.d.ts +0 -10
- package/dist/src/utils/storybook.d.ts +0 -4
- package/dist/src/utils/uploader.d.ts +0 -40
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const templatesAr = {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const templatesEn = {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const toastsAr = {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const toastsEn = {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Lang } from "@/i18n";
|
|
2
|
+
|
|
3
|
+
export const localize = ({
|
|
4
|
+
object,
|
|
5
|
+
lang,
|
|
6
|
+
key,
|
|
7
|
+
}: {
|
|
8
|
+
lang: Lang;
|
|
9
|
+
key: string;
|
|
10
|
+
object?: Record<string, string> | undefined;
|
|
11
|
+
}): string | null | undefined =>
|
|
12
|
+
({
|
|
13
|
+
ar: object?.[key],
|
|
14
|
+
en: object?.[key],
|
|
15
|
+
})[lang] || null;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import "./styles/globals.css";
|
|
4
|
+
|
|
5
|
+
export * from "./components";
|
|
6
|
+
export * from "./constants";
|
|
7
|
+
export * from "./context";
|
|
8
|
+
export * from "./examples";
|
|
9
|
+
export * from "./hooks";
|
|
10
|
+
export * from "./providers";
|
|
11
|
+
export type * from "./types";
|
|
12
|
+
export * from "./utils";
|
|
13
|
+
export * from "./mocks";
|
|
14
|
+
export * from "./enums";
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { MockItemCategory, MockItemBrand, MockColor } from "@/mocks/types";
|
|
2
|
+
|
|
3
|
+
export const MOCK_ITEM_CATEGORIES: MockItemCategory[] = [
|
|
4
|
+
"laptops",
|
|
5
|
+
"desktops",
|
|
6
|
+
"monitors",
|
|
7
|
+
"keyboards",
|
|
8
|
+
"mice",
|
|
9
|
+
"headsets",
|
|
10
|
+
"printers",
|
|
11
|
+
"storage",
|
|
12
|
+
"components",
|
|
13
|
+
"networking",
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export const MOCK_ITEM_BRANDS: MockItemBrand[] = [
|
|
17
|
+
"Apple",
|
|
18
|
+
"Dell",
|
|
19
|
+
"HP",
|
|
20
|
+
"Lenovo",
|
|
21
|
+
"Asus",
|
|
22
|
+
"Acer",
|
|
23
|
+
"MSI",
|
|
24
|
+
"Razer",
|
|
25
|
+
"Samsung",
|
|
26
|
+
"Microsoft",
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
export const MOCK_COLORS: MockColor[] = [
|
|
30
|
+
"black",
|
|
31
|
+
"gray",
|
|
32
|
+
"white",
|
|
33
|
+
"silver" as MockColor,
|
|
34
|
+
"blue",
|
|
35
|
+
"red",
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
export const MOCK_BASE_DATE = new Date("2026-02-04T00:00:00.000Z");
|
|
39
|
+
|
|
40
|
+
export const MOCK_REVIEW_COMMENTS: readonly string[] = [
|
|
41
|
+
"Excellent performance for the price.",
|
|
42
|
+
"Very quiet and fast machine.",
|
|
43
|
+
"Solid build quality and screen.",
|
|
44
|
+
"Battery life could be better.",
|
|
45
|
+
"Perfect for gaming and streaming.",
|
|
46
|
+
"Great value, highly recommended.",
|
|
47
|
+
"Runs cool even under heavy load.",
|
|
48
|
+
"Keyboard and trackpad feel premium.",
|
|
49
|
+
"Display is bright and color-accurate.",
|
|
50
|
+
"Setup was easy and straightforward.",
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
export const MOCK_REVIEW_AUTHORS: string[] = [
|
|
54
|
+
"Ahmed K.",
|
|
55
|
+
"Sara M.",
|
|
56
|
+
"Omar A.",
|
|
57
|
+
"Lina H.",
|
|
58
|
+
"Mohammed S.",
|
|
59
|
+
"Nour E.",
|
|
60
|
+
"Youssef R.",
|
|
61
|
+
"Fatima D.",
|
|
62
|
+
"Hassan T.",
|
|
63
|
+
"Mona L.",
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
export const MOCK_LISTING_TITLES: string[] = [
|
|
67
|
+
'Ultrabook Pro 14" Laptop',
|
|
68
|
+
"Gaming Beast RTX Desktop",
|
|
69
|
+
"Office Essential Mini PC",
|
|
70
|
+
'Curved 27" 2K Monitor',
|
|
71
|
+
"Mechanical RGB Gaming Keyboard",
|
|
72
|
+
"Wireless Silent Mouse",
|
|
73
|
+
"Studio USB-C Headset",
|
|
74
|
+
"All-in-One Color Printer",
|
|
75
|
+
"1TB NVMe PCIe 4.0 SSD",
|
|
76
|
+
"High-Airflow ATX Case",
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
export const MOCK_LISTING_DESCRIPTIONS: string[] = [
|
|
80
|
+
"Powerful and lightweight device ideal for productivity, study, and everyday use.",
|
|
81
|
+
"High-end desktop designed for 1440p and 4K gaming with excellent cooling.",
|
|
82
|
+
"Compact form factor PC optimized for office applications and web browsing.",
|
|
83
|
+
"High refresh rate display with vivid colors and thin bezels for immersive work.",
|
|
84
|
+
"Durable keyboard with customizable RGB lighting and fast mechanical switches.",
|
|
85
|
+
"Ergonomic wireless mouse with precise sensor and long battery life.",
|
|
86
|
+
"Comfortable over-ear headset with crystal-clear microphone and rich sound.",
|
|
87
|
+
"Fast wireless printer with automatic duplex printing and mobile support.",
|
|
88
|
+
"Next-generation SSD with blazing read and write speeds for fast boot times.",
|
|
89
|
+
"Spacious case with optimized airflow, cable management, and tempered glass.",
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
export const MOCK_LISTING_IMAGES: string[] = [
|
|
93
|
+
"https://images.pexels.com/photos/18105/pexels-photo.jpg",
|
|
94
|
+
"https://images.pexels.com/photos/1714208/pexels-photo-1714208.jpeg",
|
|
95
|
+
"https://images.pexels.com/photos/1714341/pexels-photo-1714341.jpeg",
|
|
96
|
+
"https://images.pexels.com/photos/2047905/pexels-photo-2047905.jpeg",
|
|
97
|
+
"https://images.pexels.com/photos/163117/keyboard-black-notebook-input-163117.jpeg",
|
|
98
|
+
"https://images.pexels.com/photos/3829246/pexels-photo-3829246.jpeg",
|
|
99
|
+
"https://images.pexels.com/photos/3394664/pexels-photo-3394664.jpeg",
|
|
100
|
+
"https://images.pexels.com/photos/3996439/pexels-photo-3996439.jpeg",
|
|
101
|
+
"https://images.pexels.com/photos/97077/pexels-photo-97077.jpeg",
|
|
102
|
+
"https://images.pexels.com/photos/3945650/pexels-photo-3945650.jpeg",
|
|
103
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Default delay in ms for mock awaiting delete (e.g. in Storybook). */
|
|
2
|
+
export const MOCK_AWAITING_DELETE_MS = 2000;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Mocks an async delete: returns a function that resolves after a delay then calls onClose.
|
|
6
|
+
* Used for Storybook to simulate confirm-button loading state.
|
|
7
|
+
*/
|
|
8
|
+
export const mockAwaitingDelete =
|
|
9
|
+
(onClose: () => void, delayMs = MOCK_AWAITING_DELETE_MS) =>
|
|
10
|
+
(): Promise<void> =>
|
|
11
|
+
new Promise((resolve) => {
|
|
12
|
+
setTimeout(() => {
|
|
13
|
+
onClose();
|
|
14
|
+
resolve();
|
|
15
|
+
}, delayMs);
|
|
16
|
+
});
|
|
@@ -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,154 @@
|
|
|
1
|
+
/* eslint-disable react-refresh/only-export-components */
|
|
2
|
+
import { type MockReview, type MockItemType } from "@/mocks/types";
|
|
3
|
+
import {
|
|
4
|
+
MOCK_REVIEW_COMMENTS,
|
|
5
|
+
MOCK_REVIEW_AUTHORS,
|
|
6
|
+
MOCK_BASE_DATE,
|
|
7
|
+
MOCK_ITEM_CATEGORIES,
|
|
8
|
+
MOCK_ITEM_BRANDS,
|
|
9
|
+
MOCK_COLORS,
|
|
10
|
+
MOCK_LISTING_TITLES,
|
|
11
|
+
MOCK_LISTING_DESCRIPTIONS,
|
|
12
|
+
MOCK_LISTING_IMAGES,
|
|
13
|
+
} from "@/mocks/constants";
|
|
14
|
+
import { ItemChipProps } from "@/types";
|
|
15
|
+
import { Star } from "lucide-react";
|
|
16
|
+
|
|
17
|
+
const createReviewList = (count: number, offset: number): MockReview[] => {
|
|
18
|
+
return Array.from({ length: count }, (_, index) => {
|
|
19
|
+
const id = offset + index + 1;
|
|
20
|
+
const ratingBase = (index % 5) + 1 + (index % 3) * 0.1;
|
|
21
|
+
const rating = Number(Math.min(5, ratingBase).toFixed(1));
|
|
22
|
+
const comment = MOCK_REVIEW_COMMENTS[index % MOCK_REVIEW_COMMENTS?.length];
|
|
23
|
+
const author = MOCK_REVIEW_AUTHORS[index % MOCK_REVIEW_AUTHORS.length];
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
id,
|
|
27
|
+
rating,
|
|
28
|
+
comment,
|
|
29
|
+
author,
|
|
30
|
+
createdAt: MOCK_BASE_DATE,
|
|
31
|
+
updatedAt: MOCK_BASE_DATE,
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// 10 reviews
|
|
37
|
+
export const MOCK_ITEM_REVIEWS_1: MockReview[] = createReviewList(10, 0);
|
|
38
|
+
|
|
39
|
+
// 50 reviews
|
|
40
|
+
export const MOCK_ITEM_REVIEWS_2: MockReview[] = createReviewList(50, 10);
|
|
41
|
+
|
|
42
|
+
// 100 reviews
|
|
43
|
+
export const MOCK_ITEM_REVIEWS_3: MockReview[] = createReviewList(100, 60);
|
|
44
|
+
|
|
45
|
+
const getListingCategories = (index: number): ItemChipProps[] => {
|
|
46
|
+
const count = (index % 5) + 1; // from 1 to 5 categories
|
|
47
|
+
const categories: ItemChipProps[] = [];
|
|
48
|
+
|
|
49
|
+
for (let i = 0; i < count; i += 1) {
|
|
50
|
+
const category: ItemChipProps = {
|
|
51
|
+
label: MOCK_ITEM_CATEGORIES[(index + i) % MOCK_ITEM_CATEGORIES.length],
|
|
52
|
+
startContent: <Star className="size-3 fill-current" />,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
if (!categories.includes(category)) {
|
|
56
|
+
categories.push(category);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return categories;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const getListingReviews = (index: number): MockReview[] => {
|
|
64
|
+
if (index < 10) return MOCK_ITEM_REVIEWS_1;
|
|
65
|
+
if (index < 30) return MOCK_ITEM_REVIEWS_2;
|
|
66
|
+
|
|
67
|
+
const maxReviews = 100;
|
|
68
|
+
const count = index % (maxReviews + 1); // from 0 to 100
|
|
69
|
+
|
|
70
|
+
return MOCK_ITEM_REVIEWS_3.slice(0, count);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const getAverageRating = (reviews: MockReview[]): number => {
|
|
74
|
+
if (!reviews.length) return 0;
|
|
75
|
+
|
|
76
|
+
const total = reviews.reduce((sum, review) => sum + review.rating, 0);
|
|
77
|
+
const average = total / reviews.length;
|
|
78
|
+
|
|
79
|
+
return Number(average.toFixed(1));
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// 50 listings
|
|
83
|
+
export const MOCK_LISTINGS: MockItemType[] = Array.from(
|
|
84
|
+
{ length: 50 },
|
|
85
|
+
(_, index) => {
|
|
86
|
+
const id = index + 1;
|
|
87
|
+
const brand = MOCK_ITEM_BRANDS[index % MOCK_ITEM_BRANDS.length];
|
|
88
|
+
const color = MOCK_COLORS[index % MOCK_COLORS.length];
|
|
89
|
+
const title = MOCK_LISTING_TITLES[index % MOCK_LISTING_TITLES.length];
|
|
90
|
+
const description =
|
|
91
|
+
MOCK_LISTING_DESCRIPTIONS[index % MOCK_LISTING_DESCRIPTIONS.length];
|
|
92
|
+
const image = MOCK_LISTING_IMAGES[index % MOCK_LISTING_IMAGES.length];
|
|
93
|
+
const priceBase = 300 + (index % 10) * 75;
|
|
94
|
+
const priceBrandModifier = (index % 3) * 50;
|
|
95
|
+
const price = priceBase + priceBrandModifier; // always less than 10000
|
|
96
|
+
const isAvailable = index % 7 !== 0;
|
|
97
|
+
const isBestSeller = index % 6 === 0;
|
|
98
|
+
const isTopRated = index % 5 === 0;
|
|
99
|
+
const reviews = getListingReviews(index);
|
|
100
|
+
const averageRating = getAverageRating(reviews);
|
|
101
|
+
const createdAt = new Date(
|
|
102
|
+
MOCK_BASE_DATE.getTime() - index * 24 * 60 * 60 * 1000,
|
|
103
|
+
);
|
|
104
|
+
const updatedAt = createdAt;
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
id,
|
|
108
|
+
title,
|
|
109
|
+
description,
|
|
110
|
+
image,
|
|
111
|
+
price,
|
|
112
|
+
categories: getListingCategories(index),
|
|
113
|
+
isAvailable,
|
|
114
|
+
isBestSeller,
|
|
115
|
+
isTopRated,
|
|
116
|
+
averageRating,
|
|
117
|
+
reviews,
|
|
118
|
+
brand,
|
|
119
|
+
color,
|
|
120
|
+
createdAt,
|
|
121
|
+
updatedAt,
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
export const getListings = async ({
|
|
127
|
+
page = 1,
|
|
128
|
+
pageSize = 12,
|
|
129
|
+
}: {
|
|
130
|
+
page?: number;
|
|
131
|
+
pageSize?: number;
|
|
132
|
+
}): Promise<{ items: MockItemType[] }> => {
|
|
133
|
+
const items = MOCK_LISTINGS.slice((page - 1) * pageSize, page * pageSize);
|
|
134
|
+
|
|
135
|
+
await new Promise((resolve) => {
|
|
136
|
+
setTimeout(resolve, 2000);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
items,
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export const getListing = async (): Promise<{
|
|
145
|
+
item?: MockItemType | null | undefined;
|
|
146
|
+
}> => {
|
|
147
|
+
await new Promise((resolve) => {
|
|
148
|
+
setTimeout(resolve, 2000);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
item: MOCK_LISTINGS[0],
|
|
153
|
+
};
|
|
154
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./uploader";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { LangKey, Locale } from "@/i18n";
|
|
2
|
+
|
|
3
|
+
export const uploaderLocalesMock: Record<
|
|
4
|
+
LangKey,
|
|
5
|
+
Partial<Locale["atoms"]["uploader"]>
|
|
6
|
+
> = {
|
|
7
|
+
[LangKey.ENGLISH]: {
|
|
8
|
+
dropHere: "Drop your custom file here",
|
|
9
|
+
selectFile: "Choose a custom file or drag it here",
|
|
10
|
+
selectionTypes: "PNG, JPG or PDF, max size 5MB (custom localized)",
|
|
11
|
+
selectBtn: "Browse custom files",
|
|
12
|
+
errorUploadingFile: "Custom error: please upload at least one file",
|
|
13
|
+
maxNumImages: "Custom limit reached for uploaded images: ",
|
|
14
|
+
errorUploadedTypes: "Custom error: allowed file types are only: ",
|
|
15
|
+
maxSizeExceededError:
|
|
16
|
+
"Custom error: maximum allowed size is MAX_FILE_SIZE MB, but your file is UPLOADED_FILE_SIZE MB",
|
|
17
|
+
duplicatesDenied:
|
|
18
|
+
"Custom error: duplicate file names are not allowed, please rename before uploading",
|
|
19
|
+
},
|
|
20
|
+
[LangKey.ARABIC]: {
|
|
21
|
+
dropHere: "أسقط الملف المخصص هنا",
|
|
22
|
+
selectFile: "اختر ملفًا مخصصًا أو اسحبه إلى هنا",
|
|
23
|
+
selectionTypes: "PNG، JPG أو PDF، الحجم الأقصى 5MB (نص مخصص)",
|
|
24
|
+
selectBtn: "استعراض الملفات المخصصة",
|
|
25
|
+
errorUploadingFile: "خطأ مخصص: يرجى رفع ملف واحد على الأقل",
|
|
26
|
+
maxNumImages: "خطأ مخصص: تم الوصول إلى الحد الأقصى للصور المرفوعة: ",
|
|
27
|
+
errorUploadedTypes: "خطأ مخصص: يمكنك فقط رفع الملفات من الأنواع التالية: ",
|
|
28
|
+
maxSizeExceededError:
|
|
29
|
+
"خطأ مخصص: الحد الأقصى المسموح هو MAX_FILE_SIZE ميغابايت، بينما حجم ملفك هو UPLOADED_FILE_SIZE ميغابايت",
|
|
30
|
+
duplicatesDenied:
|
|
31
|
+
"خطأ مخصص: لا يمكنك رفع ملفات بأسماء مكررة، يرجى إعادة تسميتها قبل الرفع",
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ItemChipProps } from "@/types";
|
|
2
|
+
|
|
3
|
+
export type MockItemCategory =
|
|
4
|
+
| "laptops"
|
|
5
|
+
| "desktops"
|
|
6
|
+
| "monitors"
|
|
7
|
+
| "keyboards"
|
|
8
|
+
| "mice"
|
|
9
|
+
| "headsets"
|
|
10
|
+
| "printers"
|
|
11
|
+
| "storage"
|
|
12
|
+
| "components"
|
|
13
|
+
| "networking";
|
|
14
|
+
|
|
15
|
+
export type MockColor =
|
|
16
|
+
| "red"
|
|
17
|
+
| "blue"
|
|
18
|
+
| "green"
|
|
19
|
+
| "yellow"
|
|
20
|
+
| "purple"
|
|
21
|
+
| "orange"
|
|
22
|
+
| "pink"
|
|
23
|
+
| "brown"
|
|
24
|
+
| "gray"
|
|
25
|
+
| "black"
|
|
26
|
+
| "white";
|
|
27
|
+
|
|
28
|
+
export type MockItemBrand =
|
|
29
|
+
| "Apple"
|
|
30
|
+
| "Dell"
|
|
31
|
+
| "HP"
|
|
32
|
+
| "Lenovo"
|
|
33
|
+
| "Asus"
|
|
34
|
+
| "Acer"
|
|
35
|
+
| "MSI"
|
|
36
|
+
| "Razer"
|
|
37
|
+
| "Samsung"
|
|
38
|
+
| "Microsoft";
|
|
39
|
+
|
|
40
|
+
export type MockReview = {
|
|
41
|
+
id: number; // unique and random UUID
|
|
42
|
+
rating: number; // from 1 to 5 (float) rounded to 1 decimal place
|
|
43
|
+
comment: string; // less than 50 characters
|
|
44
|
+
author: string; // less than 100 characters
|
|
45
|
+
createdAt: Date; // current date
|
|
46
|
+
updatedAt: Date; // current date
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type MockItemType = {
|
|
50
|
+
id: number; // unique and random UUID
|
|
51
|
+
title: string; // less than 100 characters
|
|
52
|
+
description: string; // less than 1000 characters
|
|
53
|
+
image: string; // url (actual image url)
|
|
54
|
+
price: number; // less than 10000
|
|
55
|
+
categories: ItemChipProps[]; // from 1 to 5 categories
|
|
56
|
+
isAvailable: boolean;
|
|
57
|
+
isBestSeller: boolean;
|
|
58
|
+
averageRating: number; // from 1 to 5 (float) rounded to 1 decimal place
|
|
59
|
+
reviews: MockReview[]; // from 0 to 100
|
|
60
|
+
brand: MockItemBrand;
|
|
61
|
+
color: MockColor;
|
|
62
|
+
createdAt: Date; // current date
|
|
63
|
+
updatedAt: Date; // current date
|
|
64
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Scaffold } from "@/components";
|
|
2
|
+
import { defaultEmperorUIConfig } from "@/constants";
|
|
3
|
+
import { EmperorUIContext } from "@/context";
|
|
4
|
+
import { LangKey, Locale } from "@/i18n";
|
|
5
|
+
import type {
|
|
6
|
+
ConfigContextState,
|
|
7
|
+
ConfigProviderProps,
|
|
8
|
+
EmperorUIConfig,
|
|
9
|
+
} from "@/types";
|
|
10
|
+
import { mergeLocales } from "@/utils";
|
|
11
|
+
import { useMemo } from "react";
|
|
12
|
+
|
|
13
|
+
export function ConfigProvider({
|
|
14
|
+
children,
|
|
15
|
+
config = defaultEmperorUIConfig,
|
|
16
|
+
}: ConfigProviderProps) {
|
|
17
|
+
const emperorUIProviderValue: ConfigContextState = useMemo(() => {
|
|
18
|
+
const mergedConfig: EmperorUIConfig = {
|
|
19
|
+
layout: {
|
|
20
|
+
...defaultEmperorUIConfig?.layout,
|
|
21
|
+
...config?.layout,
|
|
22
|
+
},
|
|
23
|
+
interLocalization: {
|
|
24
|
+
...defaultEmperorUIConfig?.interLocalization,
|
|
25
|
+
...config?.interLocalization,
|
|
26
|
+
locales: {
|
|
27
|
+
[LangKey.ENGLISH]: mergeLocales({
|
|
28
|
+
defaultLocales: defaultEmperorUIConfig?.interLocalization
|
|
29
|
+
?.locales?.[LangKey.ENGLISH] as Locale,
|
|
30
|
+
configLocales: config?.interLocalization?.locales?.[
|
|
31
|
+
LangKey.ENGLISH
|
|
32
|
+
] as Locale,
|
|
33
|
+
}),
|
|
34
|
+
[LangKey.ARABIC]: mergeLocales({
|
|
35
|
+
defaultLocales: defaultEmperorUIConfig?.interLocalization
|
|
36
|
+
?.locales?.[LangKey.ARABIC] as Locale,
|
|
37
|
+
configLocales: config?.interLocalization?.locales?.[
|
|
38
|
+
LangKey.ARABIC
|
|
39
|
+
] as Locale,
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
theme: {
|
|
44
|
+
...defaultEmperorUIConfig?.theme,
|
|
45
|
+
...config?.theme,
|
|
46
|
+
components: {
|
|
47
|
+
...defaultEmperorUIConfig?.theme?.components,
|
|
48
|
+
...config?.theme?.components,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
config: mergedConfig,
|
|
55
|
+
};
|
|
56
|
+
}, [config]);
|
|
57
|
+
|
|
58
|
+
const withScaffold = config.layout?.withScaffold ?? true;
|
|
59
|
+
|
|
60
|
+
if (withScaffold)
|
|
61
|
+
return (
|
|
62
|
+
<EmperorUIContext.Provider value={emperorUIProviderValue}>
|
|
63
|
+
<Scaffold>{children}</Scaffold>
|
|
64
|
+
</EmperorUIContext.Provider>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<EmperorUIContext.Provider value={emperorUIProviderValue}>
|
|
69
|
+
{children}
|
|
70
|
+
</EmperorUIContext.Provider>
|
|
71
|
+
);
|
|
72
|
+
}
|