@js-empire/emperor-ui 1.2.3 → 1.2.5

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.
Files changed (157) hide show
  1. package/.cursor/rules/code-conventions.mdc +50 -0
  2. package/README.md +222 -31
  3. package/dist/emperor-ui.js +119 -71
  4. package/dist/emperor-ui.umd.cjs +27 -13
  5. package/dist/globals.css +1 -1
  6. package/dist/index-BXtdEByK.js +5 -0
  7. package/dist/index-CDB93OLO.js +55965 -0
  8. package/dist/index-CYORMghp.js +290 -0
  9. package/dist/index.d.ts +334 -33
  10. package/dist/src-UW24ZMRV-C1Pn8-w8.js +5 -0
  11. package/package.json +32 -2
  12. package/src/animations/blink.ts +26 -0
  13. package/src/animations/floating.ts +12 -0
  14. package/src/animations/index.ts +2 -0
  15. package/src/components/atoms/brand/brand.tsx +1 -1
  16. package/src/components/atoms/color-picker/color-picker.tsx +13 -0
  17. package/src/components/atoms/color-picker/free-color-picker.tsx +60 -0
  18. package/src/components/atoms/color-picker/index.ts +3 -0
  19. package/src/components/atoms/color-picker/preset-color-picker.tsx +64 -0
  20. package/src/components/atoms/color-picker/stories/color-picker.stories.tsx +49 -0
  21. package/src/components/atoms/color-picker/styles/color-picker.css +23 -0
  22. package/src/components/atoms/copy-button/copy-button.tsx +73 -0
  23. package/src/components/atoms/copy-button/index.ts +1 -0
  24. package/src/components/atoms/copy-button/stories/copy-button.stories.tsx +21 -0
  25. package/src/components/atoms/field/field.stories.tsx +27 -0
  26. package/src/components/atoms/field/field.tsx +11 -0
  27. package/src/components/atoms/field/index.ts +1 -0
  28. package/src/components/atoms/field/styles/classes.ts +9 -0
  29. package/src/components/atoms/field/styles/index.ts +1 -0
  30. package/src/components/atoms/filter/filter.tsx +92 -0
  31. package/src/components/atoms/filter/index.ts +3 -0
  32. package/src/components/atoms/filter/stories/filter.stories.tsx +97 -0
  33. package/src/components/atoms/filter/styles/classes.ts +20 -0
  34. package/src/components/atoms/filter/styles/index.ts +1 -0
  35. package/src/components/atoms/filter/units/autocomplete-filter.tsx +39 -0
  36. package/src/components/atoms/filter/units/checkbox-filter.tsx +32 -0
  37. package/src/components/atoms/filter/units/checkbox-group-filter.tsx +37 -0
  38. package/src/components/atoms/filter/units/date-filter.tsx +50 -0
  39. package/src/components/atoms/filter/units/index.ts +9 -0
  40. package/src/components/atoms/filter/units/numeric-filter.tsx +36 -0
  41. package/src/components/atoms/filter/units/range-filter.tsx +36 -0
  42. package/src/components/atoms/filter/units/search-filter.tsx +52 -0
  43. package/src/components/atoms/filter/units/select-filter.tsx +49 -0
  44. package/src/components/atoms/filter/units/switch-filter.tsx +33 -0
  45. package/src/components/atoms/index.ts +5 -0
  46. package/src/components/atoms/theme-switch/index.ts +1 -0
  47. package/src/components/atoms/theme-switch/styles/classes.ts +16 -0
  48. package/src/components/atoms/theme-switch/styles/index.ts +1 -0
  49. package/src/components/atoms/theme-switch/theme-switch.stories.tsx +26 -0
  50. package/src/components/atoms/theme-switch/theme-switch.tsx +54 -0
  51. package/src/components/atoms/uploader/avatar-label.tsx +3 -1
  52. package/src/components/atoms/uploader/stories/uploader.stories.tsx +1 -1
  53. package/src/components/atoms/uploader/upload-file-error-box.tsx +1 -1
  54. package/src/components/atoms/uploader/upload-file-input.tsx +1 -1
  55. package/src/components/atoms/uploader/upload-file-label.tsx +2 -1
  56. package/src/components/atoms/uploader/upload-file-listing.tsx +2 -1
  57. package/src/components/atoms/uploader/view-image-modal.tsx +2 -1
  58. package/src/components/molecules/index.ts +0 -1
  59. package/src/components/molecules/item-card/index.ts +6 -0
  60. package/src/components/molecules/item-card/item-actions-dropdown.tsx +57 -0
  61. package/src/components/molecules/item-card/item-banner.tsx +22 -0
  62. package/src/components/molecules/item-card/item-card-body.tsx +68 -0
  63. package/src/components/molecules/item-card/item-card-footer.tsx +55 -0
  64. package/src/components/molecules/item-card/item-card-header.tsx +61 -0
  65. package/src/components/molecules/item-card/item-card.tsx +83 -3
  66. package/src/components/molecules/item-card/loading-item.tsx +88 -0
  67. package/src/components/molecules/item-card/stories/item-card.stories.tsx +182 -0
  68. package/src/components/molecules/item-card/styles/classes.ts +138 -0
  69. package/src/components/molecules/item-card/styles/index.ts +1 -0
  70. package/src/components/molecules/nav-bar/sub-items-box.tsx +2 -1
  71. package/src/components/molecules/scaffold/index.ts +1 -0
  72. package/src/components/molecules/scaffold/scaffold.tsx +4 -17
  73. package/src/components/molecules/scaffold/styles/index.ts +1 -0
  74. package/src/components/molecules/scaffold/styles/scaffold-classes.ts +10 -0
  75. package/src/components/molecules/side-bar/compact-side-bar.tsx +3 -1
  76. package/src/components/molecules/side-bar/side-bar-drawer.tsx +6 -17
  77. package/src/components/molecules/side-bar/side-bar.stories.tsx +1 -1
  78. package/src/components/organisms/filters/filters.stories.tsx +32 -0
  79. package/src/components/organisms/filters/filters.tsx +36 -0
  80. package/src/components/organisms/filters/index.ts +1 -0
  81. package/src/components/organisms/filters/styles/classes.ts +9 -0
  82. package/src/components/organisms/filters/styles/index.ts +1 -0
  83. package/src/components/organisms/footer/copy-rights-box.tsx +1 -1
  84. package/src/components/organisms/footer/footer.tsx +1 -1
  85. package/src/components/organisms/footer/policies-box.tsx +2 -1
  86. package/src/components/organisms/footer/quick-links-box.tsx +2 -1
  87. package/src/components/organisms/footer/social-links-box.tsx +2 -1
  88. package/src/components/organisms/footer/stories/footer.stories.tsx +1 -1
  89. package/src/components/organisms/header/header.tsx +1 -8
  90. package/src/components/organisms/index.ts +1 -0
  91. package/src/components/organisms/listings/empty-listings.tsx +80 -0
  92. package/src/components/organisms/listings/index.ts +2 -0
  93. package/src/components/organisms/listings/listings.tsx +90 -9
  94. package/src/components/organisms/listings/stories/grid-listings.stories.tsx +153 -0
  95. package/src/components/organisms/listings/stories/list-listings.stories.tsx +171 -0
  96. package/src/components/organisms/listings/styles/classes.ts +41 -3
  97. package/src/constants/animations.ts +14 -0
  98. package/src/constants/card.tsx +26 -0
  99. package/src/constants/defaults.ts +1 -16
  100. package/src/constants/index.ts +2 -0
  101. package/src/hooks/index.ts +3 -0
  102. package/src/hooks/use-filters.ts +20 -0
  103. package/src/hooks/use-search-params-handler.tsx +186 -0
  104. package/src/hooks/use-uploader.tsx +1 -1
  105. package/src/hooks/use-window-size.tsx +53 -0
  106. package/src/i18n/locales/atoms/ar.ts +3 -0
  107. package/src/i18n/locales/atoms/en.ts +3 -0
  108. package/src/i18n/locales/organisms/ar.ts +7 -1
  109. package/src/i18n/locales/organisms/en.ts +7 -1
  110. package/src/mocks/constants.ts +103 -0
  111. package/src/mocks/index.ts +2 -0
  112. package/src/mocks/listings.tsx +154 -0
  113. package/src/mocks/types.ts +64 -0
  114. package/src/providers/config-provider.tsx +0 -8
  115. package/src/providers/emperor-ui-provider.tsx +16 -5
  116. package/src/providers/index.ts +1 -0
  117. package/src/providers/theme-provider.tsx +16 -0
  118. package/src/providers/uploader-provider.tsx +1 -1
  119. package/src/styles/hero.ts +1 -1
  120. package/src/styles/index.css +23 -0
  121. package/src/types/components/atoms/color-picker/color-picker.ts +12 -0
  122. package/src/types/components/atoms/color-picker/index.ts +1 -0
  123. package/src/types/components/atoms/field/field.ts +9 -0
  124. package/src/types/components/atoms/field/index.ts +1 -0
  125. package/src/types/components/atoms/filter/filter.ts +43 -0
  126. package/src/types/components/atoms/filter/index.ts +2 -0
  127. package/src/types/components/atoms/filter/select-filter.ts +8 -0
  128. package/src/types/components/atoms/index.ts +3 -0
  129. package/src/types/components/atoms/uploader.ts +1 -1
  130. package/src/types/components/index.ts +1 -0
  131. package/src/types/components/molecules/index.ts +1 -1
  132. package/src/types/components/molecules/item-card/item-card.ts +50 -0
  133. package/src/types/components/molecules/listings/listings.ts +21 -5
  134. package/src/types/components/molecules/side-bar/side-bar.ts +1 -1
  135. package/src/types/components/molecules/theme-switch/index.ts +1 -0
  136. package/src/types/components/molecules/theme-switch/theme-switch.ts +9 -0
  137. package/src/types/components/organisms/filters/filters.ts +11 -0
  138. package/src/types/components/organisms/filters/index.ts +1 -0
  139. package/src/types/components/organisms/index.ts +1 -0
  140. package/src/types/context/config.ts +3 -4
  141. package/src/types/context/index.ts +0 -1
  142. package/src/types/context/localization.ts +1 -0
  143. package/src/types/shared/components.ts +3 -0
  144. package/src/utils/uploader.ts +1 -1
  145. package/dist/features-animation-w9dWMd15.js +0 -1938
  146. package/dist/index-BY47HgaP.js +0 -26533
  147. package/dist/index-CN4cJ1N7.js +0 -1630
  148. package/dist/index-Cr1mc-d4.js +0 -5
  149. package/dist/src-UW24ZMRV-nsR4cpiy.js +0 -5
  150. package/src/components/molecules/filter/filter.tsx +0 -6
  151. package/src/components/molecules/filter/index.ts +0 -1
  152. package/src/components/organisms/listings/stories/listings.stories.tsx +0 -30
  153. package/src/main.tsx +0 -3
  154. package/src/mocks/listings.ts +0 -200
  155. package/src/types/components/molecules/filter/filter.ts +0 -9
  156. package/src/types/components/molecules/filter/index.ts +0 -1
  157. package/src/types/context/theme.ts +0 -17
@@ -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
+ ];
@@ -1,2 +1,4 @@
1
+ export * from "./constants";
1
2
  export * from "./header";
2
3
  export * from "./listings";
4
+ export * from "./types";
@@ -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,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
+ };
@@ -20,14 +20,6 @@ export function ConfigProvider({
20
20
  ...defaultEmperorUIConfig?.layout,
21
21
  ...config?.layout,
22
22
  },
23
- theme: {
24
- ...defaultEmperorUIConfig?.theme,
25
- ...config?.theme,
26
- colors: {
27
- ...defaultEmperorUIConfig?.theme?.colors,
28
- ...config?.theme?.colors,
29
- },
30
- },
31
23
  interLocalization: {
32
24
  ...defaultEmperorUIConfig?.interLocalization,
33
25
  ...config?.interLocalization,
@@ -1,7 +1,8 @@
1
1
  import { ConfigProviderProps } from "@/types";
2
2
  import { ConfigProvider, NavigationProvider } from "@/providers";
3
- import { HeroUIProvider, ToastProvider } from "@heroui/react";
4
- import { Fragment } from "react";
3
+ import { HeroUIProvider } from "@heroui/system";
4
+ import { ToastProvider } from "@heroui/toast";
5
+ import { ThemeProvider } from "next-themes";
5
6
 
6
7
  type EmperorUIProviderProps = ConfigProviderProps & {};
7
8
 
@@ -13,10 +14,20 @@ export function EmperorUIProvider({
13
14
  <ConfigProvider {...props}>
14
15
  <HeroUIProvider>
15
16
  <NavigationProvider>
16
- <Fragment>
17
- <ToastProvider {...props?.config?.toast} />
17
+ <ThemeProvider>
18
+ <ToastProvider
19
+ placement="top-center"
20
+ toastProps={{
21
+ radius: "lg",
22
+ size: "lg",
23
+ color: "primary",
24
+ variant: "flat",
25
+ timeout: 4000,
26
+ }}
27
+ {...props?.config?.toast}
28
+ />
18
29
  {children}
19
- </Fragment>
30
+ </ThemeProvider>
20
31
  </NavigationProvider>
21
32
  </HeroUIProvider>
22
33
  </ConfigProvider>
@@ -2,3 +2,4 @@ export * from "./config-provider";
2
2
  export * from "./emperor-ui-provider";
3
3
  export * from "./navigation-provider";
4
4
  export * from "./uploader-provider";
5
+ export * from "./theme-provider";
@@ -0,0 +1,16 @@
1
+ "use client";
2
+
3
+ import { ThemeProvider as NextThemesProvider } from "next-themes";
4
+ import { ReactNode } from "react";
5
+
6
+ export type ThemeProviderProps = {
7
+ children: ReactNode;
8
+ };
9
+
10
+ export function ThemeProvider({ children }: ThemeProviderProps) {
11
+ return (
12
+ <NextThemesProvider attribute="class" defaultTheme="system" enableSystem>
13
+ {children}
14
+ </NextThemesProvider>
15
+ );
16
+ }
@@ -5,7 +5,7 @@ import type {
5
5
  } from "@/types";
6
6
  import { useMemo, useState } from "react";
7
7
  import { UploaderContext } from "@/context";
8
- import { useDisclosure } from "@heroui/react";
8
+ import { useDisclosure } from "@heroui/modal";
9
9
 
10
10
  export function UploaderProvider({
11
11
  children,
@@ -1,2 +1,2 @@
1
- import { heroui } from "@heroui/react";
1
+ import { heroui } from "@heroui/theme";
2
2
  export default heroui();
@@ -0,0 +1,23 @@
1
+ @import "tailwindcss";
2
+
3
+ :root {
4
+ font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
5
+ line-height: 1.5;
6
+ font-weight: 400;
7
+
8
+ color-scheme: light dark;
9
+ color: rgba(255, 255, 255, 0.87);
10
+ background-color: #242424;
11
+
12
+ font-synthesis: none;
13
+ text-rendering: optimizeLegibility;
14
+ -webkit-font-smoothing: antialiased;
15
+ -moz-osx-font-smoothing: grayscale;
16
+ }
17
+
18
+ html,
19
+ body {
20
+ margin: 0;
21
+ padding: 0;
22
+ box-sizing: border-box;
23
+ }
@@ -0,0 +1,12 @@
1
+ import { InputProps } from "@heroui/input";
2
+ import { SelectProps } from "@heroui/select";
3
+
4
+ export type ColorPickerInputType = "free" | "preset";
5
+
6
+ export type ColorPickerProps = Omit<
7
+ InputProps & SelectProps,
8
+ "onChange" | "children"
9
+ > & {
10
+ inputType: ColorPickerInputType;
11
+ presets?: string[];
12
+ };
@@ -0,0 +1 @@
1
+ export * from "./color-picker";
@@ -0,0 +1,9 @@
1
+ import type { SharedComponentProps } from "@/types";
2
+
3
+ export type FieldClassnames = {
4
+ base?: string;
5
+ };
6
+
7
+ export type FieldProps = SharedComponentProps & {
8
+ classNames?: FieldClassnames;
9
+ };
@@ -0,0 +1 @@
1
+ export type * from "./field";
@@ -0,0 +1,43 @@
1
+ import type { SelectFilterProps, SharedComponentProps } from "@/types";
2
+ import { AutocompleteProps } from "@heroui/autocomplete";
3
+ import { CheckboxGroupProps } from "@heroui/checkbox";
4
+ import { CheckboxProps } from "@heroui/checkbox";
5
+ import { DatePickerProps } from "@heroui/date-picker";
6
+ import { InputProps } from "@heroui/input";
7
+ import { RadioProps } from "@heroui/radio";
8
+ import { SelectProps } from "@heroui/select";
9
+ import { SliderProps } from "@heroui/slider";
10
+ import { SwitchProps } from "@heroui/switch";
11
+
12
+ export type FilterClassnames = {
13
+ base?: string;
14
+ field?: string;
15
+ };
16
+
17
+ export type FilterType =
18
+ | "search"
19
+ | "select"
20
+ | "autocomplete"
21
+ | "date"
22
+ | "numeric"
23
+ | "checkbox"
24
+ | "checkboxGroup"
25
+ | "switch"
26
+ | "range";
27
+
28
+ export type FilterProps = SharedComponentProps &
29
+ SelectFilterProps & {
30
+ classNames?: FilterClassnames;
31
+ type: FilterType;
32
+ paramKey: string;
33
+ searchProps?: InputProps;
34
+ selectProps?: Omit<SelectProps, "children">;
35
+ autocompleteProps?: AutocompleteProps;
36
+ dateProps?: DatePickerProps;
37
+ numericProps?: InputProps;
38
+ checkboxProps?: CheckboxProps;
39
+ checkboxGroupProps?: CheckboxGroupProps;
40
+ radioProps?: RadioProps;
41
+ switchProps?: SwitchProps;
42
+ rangeProps?: SliderProps;
43
+ };
@@ -0,0 +1,2 @@
1
+ export type * from "./filter";
2
+ export type * from "./select-filter";
@@ -0,0 +1,8 @@
1
+ export type SelectOption = {
2
+ key: string;
3
+ label: string;
4
+ };
5
+
6
+ export type SelectFilterProps = {
7
+ options?: SelectOption[];
8
+ };
@@ -4,3 +4,6 @@ export * from "./uploader";
4
4
  export * from "./column";
5
5
  export * from "./row";
6
6
  export * from "./container";
7
+ export * from "./filter";
8
+ export * from "./field";
9
+ export * from "./color-picker";
@@ -1,5 +1,5 @@
1
1
  import type { SharedComponentProps } from "@/types";
2
- import { ModalProps } from "@heroui/react";
2
+ import { ModalProps } from "@heroui/modal";
3
3
  import { Dispatch, ReactNode, SetStateAction } from "react";
4
4
 
5
5
  export type UploaderProps = SharedComponentProps &
@@ -1,3 +1,4 @@
1
1
  export type * from "./molecules";
2
2
  export type * from "./atoms";
3
3
  export type * from "./templates";
4
+ export type * from "./organisms";
@@ -3,7 +3,7 @@ export type * from "./listings";
3
3
  export type * from "./nav-bar";
4
4
  export type * from "./side-bar";
5
5
  export type * from "./scaffold";
6
- export type * from "./filter";
7
6
  export type * from "./footer";
8
7
  export type * from "./item-card";
9
8
  export type * from "./item-details";
9
+ export type * from "./theme-switch";
@@ -1,9 +1,59 @@
1
1
  import type { SharedComponentProps } from "@/types";
2
+ import { ReactNode } from "react";
3
+ import { Variants } from "framer-motion";
4
+ import { ChipProps } from "@heroui/chip";
5
+ import { DropdownItemProps } from "@heroui/dropdown";
2
6
 
3
7
  export type ItemCardClassnames = {
4
8
  base?: string;
9
+ image?: string;
10
+ header?: string;
11
+ footer?: string;
12
+ imageWrapper?: string;
13
+ mainWrapper?: string;
14
+ banner?: string;
15
+ dropdown?: string;
16
+ body?: string;
17
+ title?: string;
18
+ price?: string;
19
+ description?: string;
20
+ chips?: string;
21
+ chip?: string;
22
+ };
23
+
24
+ export type ItemCardAction = DropdownItemProps & {
25
+ key: string;
26
+ label: string;
27
+ };
28
+
29
+ export type ItemCardHoverEffect = "none" | "zoom" | "rotate";
30
+
31
+ export type ItemCardOrientation = "horizontal" | "vertical";
32
+
33
+ export type ItemChipProps = ChipProps & {
34
+ label: string;
35
+ };
36
+
37
+ export type ItemProps = {
38
+ key: string;
39
+ title?: ReactNode;
40
+ description?: ReactNode;
41
+ image?: {
42
+ src: string;
43
+ alt: string;
44
+ };
45
+ chips?: ItemChipProps[];
46
+ banner?: ReactNode;
47
+ price?: ReactNode;
5
48
  };
6
49
 
7
50
  export type ItemCardProps = SharedComponentProps & {
51
+ variants?: Variants;
52
+ isLoading?: boolean;
53
+ hoverEffect?: ItemCardHoverEffect;
8
54
  classNames?: ItemCardClassnames;
55
+ item: ItemProps;
56
+ actions?: ItemCardAction[];
57
+ onActionClick?: (key: string) => void;
58
+ orientation?: ItemCardOrientation;
9
59
  };
@@ -1,13 +1,29 @@
1
- import type { SharedComponentProps } from "@/types";
1
+ import type {
2
+ ItemCardAction,
3
+ ItemCardProps,
4
+ SharedComponentProps,
5
+ } from "@/types";
2
6
 
3
7
  export type ListingsClassnames = {
4
8
  base?: string;
9
+ item?: string;
10
+ pagination?: string;
5
11
  };
6
12
 
7
- export type ListingsVariant = "default";
13
+ export type ListingsLayout = "grid" | "list" | "carousel";
8
14
 
9
- export type ListingsProps<ListingType> = SharedComponentProps & {
15
+ export type ListingsProps = SharedComponentProps & {
10
16
  classNames?: ListingsClassnames;
11
- variant?: ListingsVariant;
12
- items: ListingType[];
17
+ layout?: ListingsLayout;
18
+ items: ItemCardProps[];
19
+ isLoading?: boolean;
20
+ actions?: ItemCardAction[];
21
+ onActionClick?: (key: string) => void;
22
+ pagination?: {
23
+ page: number;
24
+ setPage: (page: number) => void;
25
+ pageSize: number;
26
+ totalItemsCount: number;
27
+ pagesCount: number;
28
+ };
13
29
  };
@@ -1,4 +1,4 @@
1
- import { ButtonProps } from "@heroui/react";
1
+ import { ButtonProps } from "@heroui/button";
2
2
  import type { NavigationItem, SharedComponentProps } from "@/types";
3
3
  import type { ReactNode } from "react";
4
4
 
@@ -0,0 +1 @@
1
+ export * from "./theme-switch";
@@ -0,0 +1,9 @@
1
+ import type { SharedComponentProps } from "@/types";
2
+
3
+ export type ThemeSwitchClassnames = {
4
+ base?: string;
5
+ };
6
+
7
+ export type ThemeSwitchProps = SharedComponentProps & {
8
+ classNames?: ThemeSwitchClassnames;
9
+ };