@js-empire/emperor-ui 1.3.11 → 1.3.12
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,238 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { Filter } from "@/components";
|
|
3
|
+
import { useFilters } from "@/hooks";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Filter> = {
|
|
6
|
+
title: "Atoms/Filter",
|
|
7
|
+
component: Filter,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered",
|
|
10
|
+
},
|
|
11
|
+
tags: ["autodocs"],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
const filterOptions = [
|
|
19
|
+
{ key: "option-key-1", label: "Option 1" },
|
|
20
|
+
{ key: "option-key-2", label: "Option 2" },
|
|
21
|
+
{ key: "option-key-3", label: "Option 3" },
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
export const SearchFilter: Story = {
|
|
25
|
+
render: () => {
|
|
26
|
+
const { filters } = useFilters<{
|
|
27
|
+
search: string;
|
|
28
|
+
}>();
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<section className="flex flex-col gap-2">
|
|
32
|
+
<Filter
|
|
33
|
+
type="search"
|
|
34
|
+
paramKey="search"
|
|
35
|
+
searchProps={{ label: "Search" }}
|
|
36
|
+
/>
|
|
37
|
+
|
|
38
|
+
<p className="text-gray-500 text-xs">
|
|
39
|
+
{filters?.search || "No filter applied"}
|
|
40
|
+
</p>
|
|
41
|
+
</section>
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const SelectFilter: Story = {
|
|
47
|
+
render: () => {
|
|
48
|
+
const { filters } = useFilters<{
|
|
49
|
+
select: string;
|
|
50
|
+
}>();
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<section className="flex flex-col gap-2">
|
|
54
|
+
<Filter
|
|
55
|
+
type="select"
|
|
56
|
+
paramKey="select"
|
|
57
|
+
selectProps={{ label: "Select an option" }}
|
|
58
|
+
options={[
|
|
59
|
+
{ key: "option-key-1", label: "Option 1" },
|
|
60
|
+
{ key: "option-key-2", label: "Option 2" },
|
|
61
|
+
{ key: "option-key-3", label: "Option 3" },
|
|
62
|
+
]}
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
<p className="text-gray-500 text-xs">
|
|
66
|
+
{filters?.select || "No filter applied"}
|
|
67
|
+
</p>
|
|
68
|
+
</section>
|
|
69
|
+
);
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const CheckboxFilter: Story = {
|
|
74
|
+
render: () => {
|
|
75
|
+
const { filters } = useFilters<{
|
|
76
|
+
isChecked: boolean;
|
|
77
|
+
}>();
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<section className="flex flex-col gap-2">
|
|
81
|
+
<Filter
|
|
82
|
+
type="checkbox"
|
|
83
|
+
paramKey="isChecked"
|
|
84
|
+
checkboxProps={{ children: "Is Checked ?" }}
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
<p className="text-gray-500 text-xs">
|
|
88
|
+
<span>Result: </span>
|
|
89
|
+
<span className="text-gray-500">
|
|
90
|
+
{filters?.isChecked ? "Yes" : "No"}
|
|
91
|
+
</span>
|
|
92
|
+
</p>
|
|
93
|
+
</section>
|
|
94
|
+
);
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const AutocompleteFilter: Story = {
|
|
99
|
+
render: () => {
|
|
100
|
+
const { filters } = useFilters<{
|
|
101
|
+
autocomplete: string;
|
|
102
|
+
}>();
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<section className="flex flex-col gap-2">
|
|
106
|
+
<Filter
|
|
107
|
+
type="autocomplete"
|
|
108
|
+
paramKey="autocomplete"
|
|
109
|
+
autocompleteProps={{ label: "Autocomplete" }}
|
|
110
|
+
options={filterOptions}
|
|
111
|
+
/>
|
|
112
|
+
|
|
113
|
+
<p className="text-gray-500 text-xs">
|
|
114
|
+
{filters?.autocomplete || "No filter applied"}
|
|
115
|
+
</p>
|
|
116
|
+
</section>
|
|
117
|
+
);
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const DateFilter: Story = {
|
|
122
|
+
render: () => {
|
|
123
|
+
const { filters } = useFilters<{
|
|
124
|
+
date: string;
|
|
125
|
+
}>();
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<section className="flex flex-col gap-2">
|
|
129
|
+
<Filter
|
|
130
|
+
type="date"
|
|
131
|
+
paramKey="date"
|
|
132
|
+
dateProps={{ label: "Select date" }}
|
|
133
|
+
/>
|
|
134
|
+
|
|
135
|
+
<p className="text-gray-500 text-xs">
|
|
136
|
+
{filters?.date || "No filter applied"}
|
|
137
|
+
</p>
|
|
138
|
+
</section>
|
|
139
|
+
);
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const NumericFilter: Story = {
|
|
144
|
+
render: () => {
|
|
145
|
+
const { filters } = useFilters<{
|
|
146
|
+
numeric: string;
|
|
147
|
+
}>();
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<section className="flex flex-col gap-2">
|
|
151
|
+
<Filter
|
|
152
|
+
type="numeric"
|
|
153
|
+
paramKey="numeric"
|
|
154
|
+
numericProps={{ label: "Enter number", placeholder: "0" }}
|
|
155
|
+
/>
|
|
156
|
+
|
|
157
|
+
<p className="text-gray-500 text-xs">
|
|
158
|
+
{filters?.numeric || "No filter applied"}
|
|
159
|
+
</p>
|
|
160
|
+
</section>
|
|
161
|
+
);
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export const CheckboxGroupFilter: Story = {
|
|
166
|
+
render: () => {
|
|
167
|
+
const { filters } = useFilters<{
|
|
168
|
+
categories: string;
|
|
169
|
+
}>();
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<section className="flex flex-col gap-2">
|
|
173
|
+
<Filter
|
|
174
|
+
type="checkboxGroup"
|
|
175
|
+
paramKey="categories"
|
|
176
|
+
checkboxGroupProps={{ label: "Categories" }}
|
|
177
|
+
options={filterOptions}
|
|
178
|
+
/>
|
|
179
|
+
|
|
180
|
+
<p className="text-gray-500 text-xs">
|
|
181
|
+
{filters?.categories || "No filter applied"}
|
|
182
|
+
</p>
|
|
183
|
+
</section>
|
|
184
|
+
);
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const SwitchFilter: Story = {
|
|
189
|
+
render: () => {
|
|
190
|
+
const { filters } = useFilters<{
|
|
191
|
+
enabled: boolean;
|
|
192
|
+
}>();
|
|
193
|
+
|
|
194
|
+
return (
|
|
195
|
+
<section className="flex flex-col gap-2">
|
|
196
|
+
<Filter
|
|
197
|
+
type="switch"
|
|
198
|
+
paramKey="enabled"
|
|
199
|
+
switchProps={{ children: "Enabled ?" }}
|
|
200
|
+
/>
|
|
201
|
+
|
|
202
|
+
<p className="text-gray-500 text-xs">
|
|
203
|
+
<span>Result: </span>
|
|
204
|
+
<span className="text-gray-500">
|
|
205
|
+
{filters?.enabled ? "Yes" : "No"}
|
|
206
|
+
</span>
|
|
207
|
+
</p>
|
|
208
|
+
</section>
|
|
209
|
+
);
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export const RangeFilter: Story = {
|
|
214
|
+
render: () => {
|
|
215
|
+
const { filters } = useFilters<{
|
|
216
|
+
range: string;
|
|
217
|
+
}>();
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
<section className="flex flex-col gap-2">
|
|
221
|
+
<Filter
|
|
222
|
+
type="range"
|
|
223
|
+
paramKey="range"
|
|
224
|
+
rangeProps={{
|
|
225
|
+
label: "Value",
|
|
226
|
+
minValue: 0,
|
|
227
|
+
maxValue: 100,
|
|
228
|
+
step: 1,
|
|
229
|
+
}}
|
|
230
|
+
/>
|
|
231
|
+
|
|
232
|
+
<p className="text-gray-500 text-xs">
|
|
233
|
+
{filters?.range ?? "No filter applied"}
|
|
234
|
+
</p>
|
|
235
|
+
</section>
|
|
236
|
+
);
|
|
237
|
+
},
|
|
238
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
export const filterClasses = cva([""], {
|
|
4
|
+
variants: {
|
|
5
|
+
type: {
|
|
6
|
+
search: "",
|
|
7
|
+
select: "",
|
|
8
|
+
autocomplete: "",
|
|
9
|
+
date: "",
|
|
10
|
+
numeric: "",
|
|
11
|
+
checkbox: "",
|
|
12
|
+
checkboxGroup: "",
|
|
13
|
+
radio: "",
|
|
14
|
+
switch: "",
|
|
15
|
+
range: "",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {},
|
|
19
|
+
compoundVariants: [],
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./classes";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { FilterProps } from "@/types";
|
|
4
|
+
import { filterClasses } from "@/components";
|
|
5
|
+
import { Autocomplete, AutocompleteItem } from "@heroui/autocomplete";
|
|
6
|
+
import { cn } from "@/utils";
|
|
7
|
+
import { useEmperorUI, useSearchParamsHandler } from "@/hooks";
|
|
8
|
+
|
|
9
|
+
export function AutocompleteFilter({
|
|
10
|
+
classNames,
|
|
11
|
+
autocompleteProps,
|
|
12
|
+
autocompleteItemProps,
|
|
13
|
+
paramKey,
|
|
14
|
+
options,
|
|
15
|
+
}: Pick<
|
|
16
|
+
FilterProps,
|
|
17
|
+
| "classNames"
|
|
18
|
+
| "autocompleteProps"
|
|
19
|
+
| "autocompleteItemProps"
|
|
20
|
+
| "paramKey"
|
|
21
|
+
| "options"
|
|
22
|
+
>) {
|
|
23
|
+
const { config } = useEmperorUI();
|
|
24
|
+
|
|
25
|
+
const theme = config?.theme?.components?.autocomplete;
|
|
26
|
+
const themeItem = config?.theme?.components?.autocompleteItem;
|
|
27
|
+
|
|
28
|
+
const { getParam, setParams } = useSearchParamsHandler();
|
|
29
|
+
const value = getParam(paramKey);
|
|
30
|
+
|
|
31
|
+
if (!options?.length)
|
|
32
|
+
throw new Error(
|
|
33
|
+
"Filter with type 'autocomplete' must have 'options' property.",
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Autocomplete
|
|
38
|
+
{...theme}
|
|
39
|
+
{...autocompleteProps}
|
|
40
|
+
selectedKey={value || null}
|
|
41
|
+
onSelectionChange={(selectedKey) =>
|
|
42
|
+
setParams({
|
|
43
|
+
params: {
|
|
44
|
+
[paramKey]: selectedKey ? String(selectedKey) : undefined,
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
className={cn(filterClasses({ type: "autocomplete" }), classNames?.field)}
|
|
49
|
+
classNames={{
|
|
50
|
+
base: "min-w-40",
|
|
51
|
+
...theme?.classNames,
|
|
52
|
+
...autocompleteProps?.classNames,
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
{(options || [])?.map((option) => (
|
|
56
|
+
<AutocompleteItem
|
|
57
|
+
key={option.key}
|
|
58
|
+
{...themeItem}
|
|
59
|
+
{...autocompleteItemProps}
|
|
60
|
+
>
|
|
61
|
+
{option.label}
|
|
62
|
+
</AutocompleteItem>
|
|
63
|
+
))}
|
|
64
|
+
</Autocomplete>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { FilterProps } from "@/types";
|
|
4
|
+
import { filterClasses } from "@/components";
|
|
5
|
+
import { Checkbox } from "@heroui/checkbox";
|
|
6
|
+
import { cn } from "@/utils";
|
|
7
|
+
import { useEmperorUI, useSearchParamsHandler } from "@/hooks";
|
|
8
|
+
import { useMemo } from "react";
|
|
9
|
+
|
|
10
|
+
export function CheckboxFilter({
|
|
11
|
+
classNames,
|
|
12
|
+
checkboxProps,
|
|
13
|
+
paramKey,
|
|
14
|
+
}: Pick<FilterProps, "classNames" | "checkboxProps" | "paramKey">) {
|
|
15
|
+
const { config } = useEmperorUI();
|
|
16
|
+
|
|
17
|
+
const theme = config?.theme?.components?.checkbox;
|
|
18
|
+
|
|
19
|
+
const { getParam, setParams } = useSearchParamsHandler();
|
|
20
|
+
|
|
21
|
+
const { isSelected } = useMemo(() => {
|
|
22
|
+
const value = getParam(paramKey);
|
|
23
|
+
const isSelected = value === "true" || value === "1" || value === "yes";
|
|
24
|
+
|
|
25
|
+
return { value, isSelected };
|
|
26
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
|
+
}, [paramKey]);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Checkbox
|
|
31
|
+
{...theme}
|
|
32
|
+
{...checkboxProps}
|
|
33
|
+
isSelected={isSelected}
|
|
34
|
+
onValueChange={(selected) =>
|
|
35
|
+
setParams({
|
|
36
|
+
params: { [paramKey]: selected ? "true" : undefined },
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
className={cn(filterClasses({ type: "checkbox" }), classNames?.field)}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { FilterProps } from "@/types";
|
|
4
|
+
import { filterClasses } from "@/components";
|
|
5
|
+
import { Checkbox, CheckboxGroup } from "@heroui/checkbox";
|
|
6
|
+
import { cn } from "@/utils";
|
|
7
|
+
import { useEmperorUI, useSearchParamsHandler } from "@/hooks";
|
|
8
|
+
import { useMemo } from "react";
|
|
9
|
+
|
|
10
|
+
export function CheckboxGroupFilter({
|
|
11
|
+
classNames,
|
|
12
|
+
checkboxGroupProps,
|
|
13
|
+
paramKey,
|
|
14
|
+
options,
|
|
15
|
+
}: Pick<
|
|
16
|
+
FilterProps,
|
|
17
|
+
"classNames" | "checkboxGroupProps" | "paramKey" | "options"
|
|
18
|
+
>) {
|
|
19
|
+
const { config } = useEmperorUI();
|
|
20
|
+
|
|
21
|
+
const themeCheckboxGroup = config?.theme?.components?.checkboxGroup;
|
|
22
|
+
const themeCheckbox = config?.theme?.components?.checkbox;
|
|
23
|
+
|
|
24
|
+
const { getParam, setParams } = useSearchParamsHandler();
|
|
25
|
+
|
|
26
|
+
const { value } = useMemo(() => {
|
|
27
|
+
const valueStr = getParam(paramKey);
|
|
28
|
+
const value = valueStr ? valueStr.split(",").filter(Boolean) : [];
|
|
29
|
+
|
|
30
|
+
return { value };
|
|
31
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
|
+
}, [paramKey]);
|
|
33
|
+
|
|
34
|
+
if (!options?.length)
|
|
35
|
+
throw new Error(
|
|
36
|
+
"Filter with type 'checkboxGroup' must have 'options' property.",
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<CheckboxGroup
|
|
41
|
+
{...themeCheckboxGroup}
|
|
42
|
+
{...checkboxGroupProps}
|
|
43
|
+
value={value}
|
|
44
|
+
onValueChange={(values) =>
|
|
45
|
+
setParams({
|
|
46
|
+
params: {
|
|
47
|
+
[paramKey]: values.length > 0 ? values.join(",") : undefined,
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
classNames={{
|
|
52
|
+
label: "font-semibold",
|
|
53
|
+
...themeCheckboxGroup?.classNames,
|
|
54
|
+
...checkboxGroupProps?.classNames,
|
|
55
|
+
}}
|
|
56
|
+
className={cn(
|
|
57
|
+
filterClasses({ type: "checkboxGroup" }),
|
|
58
|
+
classNames?.field,
|
|
59
|
+
)}
|
|
60
|
+
>
|
|
61
|
+
{options.map((option) => (
|
|
62
|
+
<Checkbox key={option.key} {...themeCheckbox} value={option.key}>
|
|
63
|
+
{option.label}
|
|
64
|
+
</Checkbox>
|
|
65
|
+
))}
|
|
66
|
+
</CheckboxGroup>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { FilterProps } from "@/types";
|
|
4
|
+
import { filterClasses } from "@/components";
|
|
5
|
+
import { DatePicker } from "@heroui/date-picker";
|
|
6
|
+
import { cn } from "@/utils";
|
|
7
|
+
import { parseDate } from "@internationalized/date";
|
|
8
|
+
import { useEmperorUI, useSearchParamsHandler } from "@/hooks";
|
|
9
|
+
|
|
10
|
+
export function DateFilter({
|
|
11
|
+
classNames,
|
|
12
|
+
dateProps,
|
|
13
|
+
paramKey,
|
|
14
|
+
}: Pick<FilterProps, "classNames" | "dateProps" | "paramKey">) {
|
|
15
|
+
const { getParam, setParams } = useSearchParamsHandler();
|
|
16
|
+
const { config } = useEmperorUI();
|
|
17
|
+
|
|
18
|
+
const theme = config?.theme?.components?.datePicker;
|
|
19
|
+
|
|
20
|
+
const valueStr = getParam(paramKey);
|
|
21
|
+
const value =
|
|
22
|
+
valueStr && /^\d{4}-\d{2}-\d{2}$/.test(valueStr)
|
|
23
|
+
? parseDate(valueStr)
|
|
24
|
+
: null;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<DatePicker
|
|
28
|
+
{...theme}
|
|
29
|
+
{...dateProps}
|
|
30
|
+
value={value}
|
|
31
|
+
onChange={(date) =>
|
|
32
|
+
setParams({
|
|
33
|
+
params: {
|
|
34
|
+
[paramKey]: date ? String(date) : undefined,
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
className={cn(filterClasses({ type: "date" }), classNames?.field)}
|
|
39
|
+
classNames={{
|
|
40
|
+
label: "font-semibold",
|
|
41
|
+
...theme?.classNames,
|
|
42
|
+
...dateProps?.classNames,
|
|
43
|
+
}}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./search-filter";
|
|
2
|
+
export * from "./select-filter";
|
|
3
|
+
export * from "./autocomplete-filter";
|
|
4
|
+
export * from "./date-filter";
|
|
5
|
+
export * from "./numeric-filter";
|
|
6
|
+
export * from "./checkbox-filter";
|
|
7
|
+
export * from "./checkbox-group-filter";
|
|
8
|
+
export * from "./switch-filter";
|
|
9
|
+
export * from "./range-filter";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { FilterProps } from "@/types";
|
|
4
|
+
import { filterClasses } from "@/components";
|
|
5
|
+
import { Input } from "@heroui/input";
|
|
6
|
+
import { cn } from "@/utils";
|
|
7
|
+
import { useEmperorUI, useSearchParamsHandler } from "@/hooks";
|
|
8
|
+
|
|
9
|
+
export function NumericFilter({
|
|
10
|
+
classNames,
|
|
11
|
+
numericProps,
|
|
12
|
+
paramKey,
|
|
13
|
+
}: Pick<FilterProps, "classNames" | "numericProps" | "paramKey">) {
|
|
14
|
+
const { getParam, setParams } = useSearchParamsHandler();
|
|
15
|
+
const { config } = useEmperorUI();
|
|
16
|
+
|
|
17
|
+
const theme = config?.theme?.components?.input;
|
|
18
|
+
|
|
19
|
+
const value = getParam(paramKey);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Input
|
|
23
|
+
{...theme}
|
|
24
|
+
{...numericProps}
|
|
25
|
+
type="number"
|
|
26
|
+
value={value ?? ""}
|
|
27
|
+
onValueChange={(v) =>
|
|
28
|
+
setParams({
|
|
29
|
+
params: { [paramKey]: v || undefined },
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
className={cn(filterClasses({ type: "numeric" }), classNames?.field)}
|
|
33
|
+
classNames={{
|
|
34
|
+
input: "min-w-40",
|
|
35
|
+
label: "font-semibold",
|
|
36
|
+
...theme?.classNames,
|
|
37
|
+
...numericProps?.classNames,
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { FilterProps } from "@/types";
|
|
4
|
+
import { filterClasses } from "@/components";
|
|
5
|
+
import { Slider } from "@heroui/slider";
|
|
6
|
+
import { cn } from "@/utils";
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
import { useEmperorUI, useSearchParamsHandler } from "@/hooks";
|
|
9
|
+
|
|
10
|
+
export function RangeFilter({
|
|
11
|
+
classNames,
|
|
12
|
+
rangeProps,
|
|
13
|
+
paramKey,
|
|
14
|
+
}: Pick<FilterProps, "classNames" | "rangeProps" | "paramKey">) {
|
|
15
|
+
const { getParam, setParams, allParams } = useSearchParamsHandler();
|
|
16
|
+
const { config } = useEmperorUI();
|
|
17
|
+
|
|
18
|
+
const theme = config?.theme?.components?.slider;
|
|
19
|
+
|
|
20
|
+
const minVal = rangeProps?.minValue ?? 0;
|
|
21
|
+
const maxVal = rangeProps?.maxValue ?? 100;
|
|
22
|
+
|
|
23
|
+
const value = useMemo(() => {
|
|
24
|
+
const valueStr = getParam(paramKey);
|
|
25
|
+
const defaultRange: [number, number] = [minVal, maxVal];
|
|
26
|
+
|
|
27
|
+
if (valueStr == null) return defaultRange;
|
|
28
|
+
|
|
29
|
+
const [a, b] = valueStr.split(",").map(Number);
|
|
30
|
+
if (!Number.isNaN(a) && !Number.isNaN(b) && a <= b) {
|
|
31
|
+
return [a, b];
|
|
32
|
+
}
|
|
33
|
+
return defaultRange;
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}, [paramKey, minVal, maxVal, allParams]);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Slider
|
|
39
|
+
{...theme}
|
|
40
|
+
{...rangeProps}
|
|
41
|
+
value={value}
|
|
42
|
+
onChange={(value) => {
|
|
43
|
+
const range = Array.isArray(value) ? value : [value];
|
|
44
|
+
const isFullRange =
|
|
45
|
+
range.length === 2 && range[0] === minVal && range[1] === maxVal;
|
|
46
|
+
|
|
47
|
+
setParams({
|
|
48
|
+
params: {
|
|
49
|
+
[paramKey]:
|
|
50
|
+
range.length === 2 && !isFullRange
|
|
51
|
+
? `${range[0]},${range[1]}`
|
|
52
|
+
: undefined,
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}}
|
|
56
|
+
classNames={{
|
|
57
|
+
base: "min-w-40",
|
|
58
|
+
label: "font-semibold",
|
|
59
|
+
...theme?.classNames,
|
|
60
|
+
...rangeProps?.classNames,
|
|
61
|
+
}}
|
|
62
|
+
className={cn(filterClasses({ type: "range" }), classNames?.field)}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { FilterProps } from "@/types";
|
|
4
|
+
import { filterClasses } from "@/components";
|
|
5
|
+
import { Input } from "@heroui/input";
|
|
6
|
+
import { cn } from "@/utils";
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import { useDebounce } from "use-debounce";
|
|
9
|
+
import { Search } from "lucide-react";
|
|
10
|
+
import { useEmperorUI, useSearchParamsHandler } from "@/hooks";
|
|
11
|
+
|
|
12
|
+
export function SearchFilter({
|
|
13
|
+
classNames,
|
|
14
|
+
searchProps,
|
|
15
|
+
paramKey,
|
|
16
|
+
}: Pick<FilterProps, "classNames" | "searchProps" | "paramKey">) {
|
|
17
|
+
const { config } = useEmperorUI();
|
|
18
|
+
|
|
19
|
+
const theme = config?.theme?.components?.input;
|
|
20
|
+
|
|
21
|
+
const [searchValue, setSearchValue] = useState(
|
|
22
|
+
searchProps?.defaultValue || "",
|
|
23
|
+
);
|
|
24
|
+
const { setParams } = useSearchParamsHandler();
|
|
25
|
+
|
|
26
|
+
const [debouncedSearchValue] = useDebounce(searchValue, 700);
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
setParams({
|
|
30
|
+
params: {
|
|
31
|
+
[paramKey]: debouncedSearchValue,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}, [debouncedSearchValue]);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Input
|
|
39
|
+
{...theme}
|
|
40
|
+
{...searchProps}
|
|
41
|
+
endContent={<Search className="size-4" />}
|
|
42
|
+
value={searchValue}
|
|
43
|
+
onValueChange={setSearchValue}
|
|
44
|
+
className={cn(filterClasses({ type: "search" }), classNames?.field)}
|
|
45
|
+
classNames={{
|
|
46
|
+
input: "min-w-40",
|
|
47
|
+
label: "font-semibold",
|
|
48
|
+
...theme?.classNames,
|
|
49
|
+
...searchProps?.classNames,
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
}
|