@js-empire/emperor-ui 1.2.3 → 1.2.4
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/README.md +0 -15
- package/dist/emperor-ui.js +119 -71
- package/dist/emperor-ui.umd.cjs +27 -13
- package/dist/globals.css +1 -1
- package/dist/index-BXtdEByK.js +5 -0
- package/dist/index-CDB93OLO.js +55965 -0
- package/dist/index-CYORMghp.js +290 -0
- package/dist/index.d.ts +334 -33
- package/dist/src-UW24ZMRV-C1Pn8-w8.js +5 -0
- package/package.json +32 -2
- 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.tsx +1 -1
- package/src/components/atoms/color-picker/color-picker.tsx +13 -0
- package/src/components/atoms/color-picker/free-color-picker.tsx +60 -0
- package/src/components/atoms/color-picker/index.ts +3 -0
- package/src/components/atoms/color-picker/preset-color-picker.tsx +64 -0
- package/src/components/atoms/color-picker/stories/color-picker.stories.tsx +49 -0
- package/src/components/atoms/color-picker/styles/color-picker.css +23 -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.stories.tsx +27 -0
- package/src/components/atoms/field/field.tsx +11 -0
- package/src/components/atoms/field/index.ts +1 -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/filter/filter.tsx +92 -0
- package/src/components/atoms/filter/index.ts +3 -0
- package/src/components/atoms/filter/stories/filter.stories.tsx +97 -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 +39 -0
- package/src/components/atoms/filter/units/checkbox-filter.tsx +32 -0
- package/src/components/atoms/filter/units/checkbox-group-filter.tsx +37 -0
- package/src/components/atoms/filter/units/date-filter.tsx +50 -0
- package/src/components/atoms/filter/units/index.ts +9 -0
- package/src/components/atoms/filter/units/numeric-filter.tsx +36 -0
- package/src/components/atoms/filter/units/range-filter.tsx +36 -0
- package/src/components/atoms/filter/units/search-filter.tsx +52 -0
- package/src/components/atoms/filter/units/select-filter.tsx +49 -0
- package/src/components/atoms/filter/units/switch-filter.tsx +33 -0
- package/src/components/atoms/index.ts +5 -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/avatar-label.tsx +3 -1
- package/src/components/atoms/uploader/stories/uploader.stories.tsx +1 -1
- package/src/components/atoms/uploader/upload-file-error-box.tsx +1 -1
- package/src/components/atoms/uploader/upload-file-input.tsx +1 -1
- package/src/components/atoms/uploader/upload-file-label.tsx +2 -1
- package/src/components/atoms/uploader/upload-file-listing.tsx +2 -1
- package/src/components/atoms/uploader/view-image-modal.tsx +2 -1
- package/src/components/molecules/index.ts +0 -1
- package/src/components/molecules/item-card/index.ts +6 -0
- package/src/components/molecules/item-card/item-actions-dropdown.tsx +57 -0
- package/src/components/molecules/item-card/item-banner.tsx +22 -0
- package/src/components/molecules/item-card/item-card-body.tsx +68 -0
- package/src/components/molecules/item-card/item-card-footer.tsx +55 -0
- package/src/components/molecules/item-card/item-card-header.tsx +61 -0
- package/src/components/molecules/item-card/item-card.tsx +83 -3
- package/src/components/molecules/item-card/loading-item.tsx +88 -0
- package/src/components/molecules/item-card/stories/item-card.stories.tsx +182 -0
- package/src/components/molecules/item-card/styles/classes.ts +138 -0
- package/src/components/molecules/item-card/styles/index.ts +1 -0
- package/src/components/molecules/nav-bar/sub-items-box.tsx +2 -1
- package/src/components/molecules/scaffold/index.ts +1 -0
- package/src/components/molecules/scaffold/scaffold.tsx +4 -17
- 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 +3 -1
- package/src/components/molecules/side-bar/side-bar-drawer.tsx +6 -17
- package/src/components/molecules/side-bar/side-bar.stories.tsx +1 -1
- package/src/components/organisms/filters/filters.stories.tsx +32 -0
- package/src/components/organisms/filters/filters.tsx +36 -0
- package/src/components/organisms/filters/index.ts +1 -0
- package/src/components/organisms/filters/styles/classes.ts +9 -0
- package/src/components/organisms/filters/styles/index.ts +1 -0
- package/src/components/organisms/footer/copy-rights-box.tsx +1 -1
- package/src/components/organisms/footer/footer.tsx +1 -1
- package/src/components/organisms/footer/policies-box.tsx +2 -1
- package/src/components/organisms/footer/quick-links-box.tsx +2 -1
- package/src/components/organisms/footer/social-links-box.tsx +2 -1
- package/src/components/organisms/footer/stories/footer.stories.tsx +1 -1
- package/src/components/organisms/header/header.tsx +1 -8
- package/src/components/organisms/index.ts +1 -0
- package/src/components/organisms/listings/empty-listings.tsx +80 -0
- package/src/components/organisms/listings/index.ts +2 -0
- package/src/components/organisms/listings/listings.tsx +90 -9
- 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 +41 -3
- package/src/constants/animations.ts +14 -0
- package/src/constants/card.tsx +26 -0
- package/src/constants/defaults.ts +1 -16
- package/src/constants/index.ts +2 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/use-filters.ts +20 -0
- package/src/hooks/use-search-params-handler.tsx +186 -0
- package/src/hooks/use-uploader.tsx +1 -1
- package/src/hooks/use-window-size.tsx +53 -0
- package/src/i18n/locales/atoms/ar.ts +3 -0
- package/src/i18n/locales/atoms/en.ts +3 -0
- package/src/i18n/locales/organisms/ar.ts +7 -1
- package/src/i18n/locales/organisms/en.ts +7 -1
- package/src/mocks/constants.ts +103 -0
- package/src/mocks/index.ts +2 -0
- package/src/mocks/listings.tsx +154 -0
- package/src/mocks/types.ts +64 -0
- package/src/providers/config-provider.tsx +0 -8
- package/src/providers/emperor-ui-provider.tsx +16 -5
- package/src/providers/index.ts +1 -0
- package/src/providers/theme-provider.tsx +16 -0
- package/src/providers/uploader-provider.tsx +1 -1
- package/src/styles/hero.ts +1 -1
- package/src/styles/index.css +23 -0
- package/src/types/components/atoms/color-picker/color-picker.ts +12 -0
- package/src/types/components/atoms/color-picker/index.ts +1 -0
- package/src/types/components/atoms/field/field.ts +9 -0
- package/src/types/components/atoms/field/index.ts +1 -0
- package/src/types/components/atoms/filter/filter.ts +43 -0
- package/src/types/components/atoms/filter/index.ts +2 -0
- package/src/types/components/atoms/filter/select-filter.ts +8 -0
- package/src/types/components/atoms/index.ts +3 -0
- package/src/types/components/atoms/uploader.ts +1 -1
- package/src/types/components/index.ts +1 -0
- package/src/types/components/molecules/index.ts +1 -1
- package/src/types/components/molecules/item-card/item-card.ts +50 -0
- package/src/types/components/molecules/listings/listings.ts +21 -5
- package/src/types/components/molecules/side-bar/side-bar.ts +1 -1
- 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/filters/filters.ts +11 -0
- package/src/types/components/organisms/filters/index.ts +1 -0
- package/src/types/components/organisms/index.ts +1 -0
- package/src/types/context/config.ts +3 -4
- package/src/types/context/index.ts +0 -1
- package/src/types/context/localization.ts +1 -0
- package/src/types/shared/components.ts +3 -0
- package/src/utils/uploader.ts +1 -1
- package/dist/features-animation-w9dWMd15.js +0 -1938
- package/dist/index-BY47HgaP.js +0 -26533
- package/dist/index-CN4cJ1N7.js +0 -1630
- package/dist/index-Cr1mc-d4.js +0 -5
- package/dist/src-UW24ZMRV-nsR4cpiy.js +0 -5
- package/src/components/molecules/filter/filter.tsx +0 -6
- package/src/components/molecules/filter/index.ts +0 -1
- package/src/components/organisms/listings/stories/listings.stories.tsx +0 -30
- package/src/main.tsx +0 -3
- package/src/mocks/listings.ts +0 -200
- package/src/types/components/molecules/filter/filter.ts +0 -9
- package/src/types/components/molecules/filter/index.ts +0 -1
- package/src/types/context/theme.ts +0 -17
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-conventions
|
|
3
|
+
description: This rule is for Cursor to follow code conventions we have.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Overview
|
|
7
|
+
|
|
8
|
+
Whenever you write a code, follow these rules:
|
|
9
|
+
|
|
10
|
+
## Conventions
|
|
11
|
+
|
|
12
|
+
Follow all the codebase conventions like how functions and variables are written, where to place everything, ...etc. Follow the SOLID coding principles in all code.
|
|
13
|
+
|
|
14
|
+
## Imports & Exports
|
|
15
|
+
|
|
16
|
+
Every module (or directory) should have an "index.ts" file that exports all the files and sub modules inside it using ('export \* from "./file-or-dir-name";'), where every file should export all its functions and variables to be exported. Never use relative imports but rather use the absolute ones for better readability and easier importation.
|
|
17
|
+
|
|
18
|
+
## Utilities
|
|
19
|
+
|
|
20
|
+
All types, constants, enums, hooks, utility functions, and configs should be defined in their relative packages or modules. Utility functions should always have a short description (function annotation or documentation) that summarizes what is does and what it needs.
|
|
21
|
+
|
|
22
|
+
## Complexity
|
|
23
|
+
|
|
24
|
+
Try to always find the easiest, simplest, and most efficient solution with the least amount of code rather than the most complex one.
|
|
25
|
+
|
|
26
|
+
## File Size
|
|
27
|
+
|
|
28
|
+
Every file should never be more than 300 lines of code. Whenever a code exceeds 250 to 300 lines, try to optimize it or split it into multiple files following the codebase conventions.
|
|
29
|
+
|
|
30
|
+
## Single Responsibility
|
|
31
|
+
|
|
32
|
+
Each function should only have one purpose and each component file should only exports one component.
|
|
33
|
+
|
|
34
|
+
## Naming
|
|
35
|
+
|
|
36
|
+
The exported component must have the same name as its file's name. Follow these rules for naming:
|
|
37
|
+
|
|
38
|
+
- Files: kebab-case
|
|
39
|
+
- Directories: kebab-case
|
|
40
|
+
- Types & Interfaces: PascalCase
|
|
41
|
+
- Constants: PascalCase
|
|
42
|
+
- Hooks: useCamelCase
|
|
43
|
+
- Pages and Layouts' Components: PascalCase
|
|
44
|
+
- Enums:
|
|
45
|
+
- Enum name: PascalCase
|
|
46
|
+
- Enum key: UPPER_SNAKE_CASE
|
|
47
|
+
|
|
48
|
+
## Parameters
|
|
49
|
+
|
|
50
|
+
All parameters across the project should be implemented as one object that has the parameters in it so we can modify them easily in the future, like this: `({ param1, param2 = false }:{ param1: string, param2?: boolean })`. Never define them as multiple parameters like this: `(param1: string, param2?: boolean)`. That applies to functions, arrow functions, components, hooks, and anything takes parameters.
|
package/README.md
CHANGED
|
@@ -12,21 +12,6 @@ Each one of them has props to control every aspect pf the component, with enabli
|
|
|
12
12
|
|
|
13
13
|
## Components
|
|
14
14
|
|
|
15
|
-
### Item Card
|
|
16
|
-
|
|
17
|
-
- Image
|
|
18
|
-
- Title
|
|
19
|
-
- Subtitle (for description)
|
|
20
|
-
- Price
|
|
21
|
-
- Drop-down with actions and a dots-icon for opening it
|
|
22
|
-
|
|
23
|
-
### Listings
|
|
24
|
-
|
|
25
|
-
- Listing any type of components
|
|
26
|
-
- Pagination or infinite scrolling
|
|
27
|
-
- Specifying the page size
|
|
28
|
-
- View controller: list, grid, carousel (swiper)
|
|
29
|
-
|
|
30
15
|
### Details page
|
|
31
16
|
|
|
32
17
|
- Breadcrumbs
|
package/dist/emperor-ui.js
CHANGED
|
@@ -1,75 +1,123 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dB as s, dC as i, dD as o, dE as r, dF as t, dG as l, dH as d, dI as E, dJ as C, dK as I, dL as _, dM as n, dN as S, dO as f, dP as M, dQ as p, dR as T, dS as c, dT as g, dU as O, dV as m, dW as F, dX as L, dY as A, dZ as P, d_ as R, d$ as K, e0 as U, e1 as B, e2 as D, e3 as N, e4 as u, e5 as x, e6 as k, e7 as v, e8 as h, e9 as y, ea as G, eb as H, ec as W, ed as b, ee as w, ef as V, eg as Y, eh as q, ei as z, ej as Q, ek as j, el as J, em as X, en as Z, eo as $, ep as ee, eq as ae, er as se, es as ie, et as oe, eu as re, ev as te, ew as le, ex as de, ey as Ee, ez as Ce, eA as Ie, eB as _e, eC as ne, eD as Se, eE as fe, eF as Me, eG as pe, eH as Te, eI as ce, eJ as ge, eK as Oe, eL as me, eM as Fe, eN as Le, eO as Ae, eP as Pe, eQ as Re, eR as Ke, eS as Ue, eT as Be, eU as De, eV as Ne, eW as ue, eX as xe, eY as ke, eZ as ve, e_ as he, e$ as ye, f0 as Ge, f1 as He, f2 as We, f3 as be, f4 as we, f5 as Ve, f6 as Ye, f7 as qe, f8 as ze, f9 as Qe, fa as je, fb as Je, fc as Xe, fd as Ze, fe as $e, ff as ea, fg as aa, fh as sa, fi as ia, fj as oa, fk as ra, fl as ta, fm as la, fn as da, fo as Ea, fp as Ca, fq as Ia, fr as _a, fs as na } from "./index-CDB93OLO.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
s as ALLOWED_DOC_TYPES,
|
|
4
|
+
i as ALLOWED_IMAGES_TYPES,
|
|
5
5
|
o as ALLOWED_PDF_TYPES,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
l as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
r as AutocompleteFilter,
|
|
7
|
+
t as AvatarLabel,
|
|
8
|
+
l as Brand,
|
|
9
|
+
d as CheckboxFilter,
|
|
10
|
+
E as CheckboxGroupFilter,
|
|
11
|
+
C as ColorPicker,
|
|
12
|
+
I as Column,
|
|
13
|
+
_ as ConfigProvider,
|
|
14
|
+
n as Container,
|
|
15
|
+
S as CopyButton,
|
|
16
|
+
f as CopyRightsBox,
|
|
17
|
+
M as DateFilter,
|
|
12
18
|
p as EmperorUIContext,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
v as
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
19
|
+
T as EmperorUIProvider,
|
|
20
|
+
c as EmptyListings,
|
|
21
|
+
g as FAKE_PARAGRAPH,
|
|
22
|
+
O as FAKE_SENTENCE,
|
|
23
|
+
m as Field,
|
|
24
|
+
F as Filter,
|
|
25
|
+
L as Filters,
|
|
26
|
+
A as Footer,
|
|
27
|
+
P as FreeColorPicker,
|
|
28
|
+
R as Header,
|
|
29
|
+
K as ITEM_CARD_ACTIONS,
|
|
30
|
+
U as ItemActionsDropdown,
|
|
31
|
+
B as ItemBanner,
|
|
32
|
+
D as ItemCard,
|
|
33
|
+
N as ItemCardBody,
|
|
34
|
+
u as ItemCardFooter,
|
|
35
|
+
x as ItemCardHeader,
|
|
36
|
+
k as ItemDetails,
|
|
37
|
+
v as LandingPage,
|
|
38
|
+
h as Listings,
|
|
39
|
+
y as LoadingItem,
|
|
40
|
+
G as MOCK_BASE_DATE,
|
|
41
|
+
H as MOCK_COLORS,
|
|
42
|
+
W as MOCK_HEADER_ACTIONS,
|
|
43
|
+
b as MOCK_HEADER_ITEMS,
|
|
44
|
+
w as MOCK_HEADER_ITEMS_WITH_SUB_ITEMS,
|
|
45
|
+
V as MOCK_HEADER_SUB_ITEMS,
|
|
46
|
+
Y as MOCK_ITEM_BRANDS,
|
|
47
|
+
q as MOCK_ITEM_CATEGORIES,
|
|
48
|
+
z as MOCK_ITEM_REVIEWS_1,
|
|
49
|
+
Q as MOCK_ITEM_REVIEWS_2,
|
|
50
|
+
j as MOCK_ITEM_REVIEWS_3,
|
|
51
|
+
J as MOCK_LISTINGS,
|
|
52
|
+
X as MOCK_LISTING_DESCRIPTIONS,
|
|
53
|
+
Z as MOCK_LISTING_IMAGES,
|
|
54
|
+
$ as MOCK_LISTING_TITLES,
|
|
55
|
+
ee as MOCK_REVIEW_AUTHORS,
|
|
56
|
+
ae as MOCK_REVIEW_COMMENTS,
|
|
57
|
+
se as NavBar,
|
|
58
|
+
ie as NavBarItem,
|
|
59
|
+
oe as NavigationContext,
|
|
60
|
+
re as NavigationProvider,
|
|
61
|
+
te as NumericFilter,
|
|
62
|
+
le as ONE_MEGABYTE,
|
|
63
|
+
de as Placeholders,
|
|
64
|
+
Ee as PoliciesBox,
|
|
65
|
+
Ce as Portal,
|
|
66
|
+
Ie as PreservedKeys,
|
|
67
|
+
_e as PresetColorPicker,
|
|
68
|
+
ne as QuickLinksBox,
|
|
69
|
+
Se as RangeFilter,
|
|
70
|
+
fe as Row,
|
|
71
|
+
Me as Scaffold,
|
|
72
|
+
pe as SearchFilter,
|
|
73
|
+
Te as SelectFilter,
|
|
74
|
+
ce as SideBar,
|
|
75
|
+
ge as SocialLinksBox,
|
|
76
|
+
Oe as SubItemsBox,
|
|
77
|
+
me as SwitchFilter,
|
|
78
|
+
Fe as ThemeProvider,
|
|
79
|
+
Le as ThemeSwitch,
|
|
80
|
+
Ae as UploadFileErrorBox,
|
|
81
|
+
Pe as UploadFileInput,
|
|
82
|
+
Re as UploadFileLabel,
|
|
83
|
+
Ke as UploadFileListing,
|
|
84
|
+
Ue as Uploader,
|
|
85
|
+
Be as UploaderContext,
|
|
86
|
+
De as UploaderProvider,
|
|
87
|
+
Ne as UploaderTitle,
|
|
88
|
+
ue as ViewImageModal,
|
|
89
|
+
xe as cn,
|
|
90
|
+
ke as compressImage,
|
|
91
|
+
ve as contacts,
|
|
92
|
+
he as copyRights,
|
|
93
|
+
ye as defaultEmperorUIConfig,
|
|
94
|
+
Ge as emptyListingsClasses,
|
|
95
|
+
He as fileTypesMapping,
|
|
96
|
+
We as filterClasses,
|
|
97
|
+
be as getAllowedTypes,
|
|
98
|
+
we as getCardMotion,
|
|
99
|
+
Ve as getListing,
|
|
100
|
+
Ye as getListings,
|
|
101
|
+
qe as getStorybookDecorators,
|
|
102
|
+
ze as isFileDuplicated,
|
|
103
|
+
Qe as isMaxFileSizeExceeded,
|
|
104
|
+
je as listingsClasses,
|
|
105
|
+
Je as listingsItemClasses,
|
|
106
|
+
Xe as listingsPaginationClasses,
|
|
107
|
+
Ze as listingsStyles,
|
|
108
|
+
$e as mapFileType,
|
|
109
|
+
ea as mergeLocales,
|
|
110
|
+
aa as policies,
|
|
111
|
+
sa as quickLinks,
|
|
112
|
+
ia as refineUploadedFiles,
|
|
113
|
+
oa as scaffoldClasses,
|
|
114
|
+
ra as socialLinks,
|
|
115
|
+
ta as useEmperorUI,
|
|
116
|
+
la as useFilters,
|
|
117
|
+
da as useNavigation,
|
|
118
|
+
Ea as useSearchParamsHandler,
|
|
119
|
+
Ca as useUploader,
|
|
120
|
+
Ia as useUploaderContext,
|
|
121
|
+
_a as useWindowSize,
|
|
122
|
+
na as validateUploadedFiles
|
|
75
123
|
};
|