@js-empire/emperor-ui 1.2.2 → 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.
Files changed (157) hide show
  1. package/.cursor/rules/code-conventions.mdc +50 -0
  2. package/README.md +0 -15
  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 +338 -36
  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 +8 -1
  52. package/src/components/atoms/uploader/stories/uploader.stories.tsx +3 -3
  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 +8 -1
  56. package/src/components/atoms/uploader/upload-file-listing.tsx +46 -37
  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 +2 -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-uyo1KMg-.js +0 -1938
  146. package/dist/index-B3d8-vnJ.js +0 -1630
  147. package/dist/index-DOwkJus4.js +0 -26528
  148. package/dist/index-DrkA25TM.js +0 -5
  149. package/dist/src-UW24ZMRV-D6kiVea5.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,182 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { ItemCard } from "@/components";
3
+ import { getStorybookDecorators } from "@/utils";
4
+ import { getListing, MOCK_LISTINGS } from "@/mocks";
5
+ import type { MockItemType } from "@/mocks";
6
+ import { useEffect, useState } from "storybook/internal/preview-api";
7
+ import { ItemCardProps } from "@/types";
8
+ import { ITEM_CARD_ACTIONS } from "@/constants";
9
+
10
+ const meta: Meta<typeof ItemCard> = {
11
+ title: "Molecules/Item Card",
12
+ component: ItemCard,
13
+ parameters: {
14
+ layout: "centered",
15
+ },
16
+ tags: ["autodocs"],
17
+ decorators: getStorybookDecorators({
18
+ config: {
19
+ layout: {
20
+ withScaffold: false,
21
+ },
22
+ },
23
+ }),
24
+ };
25
+
26
+ export default meta;
27
+
28
+ type Story = StoryObj<typeof meta>;
29
+
30
+ export const Default: Story = {
31
+ args: {
32
+ item: {
33
+ key: String(MOCK_LISTINGS[0]?.id),
34
+ title: MOCK_LISTINGS[0]?.title,
35
+ description: MOCK_LISTINGS[0]?.description,
36
+ image: {
37
+ src: MOCK_LISTINGS[0]?.image || "",
38
+ alt: MOCK_LISTINGS[0]?.title || "",
39
+ },
40
+ },
41
+ },
42
+ };
43
+
44
+ export const WithLoading: Story = {
45
+ args: {},
46
+ render: () => {
47
+ const [item, setItem] = useState<MockItemType | null | undefined>(null);
48
+ const [isLoading, setIsLoading] = useState(true);
49
+
50
+ useEffect(() => {
51
+ (async () => {
52
+ const { item } = await getListing();
53
+
54
+ setItem(item);
55
+ setIsLoading(false);
56
+ })();
57
+ }, []);
58
+
59
+ return (
60
+ <ItemCard
61
+ isLoading={isLoading}
62
+ item={{
63
+ key: String(item?.id),
64
+ title: item?.title,
65
+ description: item?.description,
66
+ image: { src: item?.image || "", alt: item?.title || "" },
67
+ }}
68
+ />
69
+ );
70
+ },
71
+ };
72
+
73
+ export const WithHorizontalLoading: Story = {
74
+ args: {
75
+ orientation: "horizontal",
76
+ },
77
+ render: (args: ItemCardProps) => {
78
+ const [item, setItem] = useState<MockItemType | null | undefined>(null);
79
+ const [isLoading, setIsLoading] = useState(true);
80
+
81
+ useEffect(() => {
82
+ (async () => {
83
+ const { item } = await getListing();
84
+
85
+ setItem(item);
86
+ setIsLoading(false);
87
+ })();
88
+ }, []);
89
+
90
+ return (
91
+ <ItemCard
92
+ {...args}
93
+ isLoading={isLoading}
94
+ item={{
95
+ key: String(item?.id),
96
+ title: item?.title,
97
+ description: item?.description,
98
+ image: { src: item?.image || "", alt: item?.title || "" },
99
+ }}
100
+ />
101
+ );
102
+ },
103
+ };
104
+
105
+ export const WithActions: Story = {
106
+ args: {
107
+ item: {
108
+ key: String(MOCK_LISTINGS[0]?.id),
109
+ title: MOCK_LISTINGS[0]?.title,
110
+ description: MOCK_LISTINGS[0]?.description,
111
+ image: {
112
+ src: MOCK_LISTINGS[0]?.image || "",
113
+ alt: MOCK_LISTINGS[0]?.title || "",
114
+ },
115
+ },
116
+ actions: ITEM_CARD_ACTIONS,
117
+ },
118
+ };
119
+
120
+ export const WithChips: Story = {
121
+ args: {
122
+ item: {
123
+ key: String(MOCK_LISTINGS[2]?.id),
124
+ title: MOCK_LISTINGS[2]?.title,
125
+ description: MOCK_LISTINGS[2]?.description,
126
+ image: {
127
+ src: MOCK_LISTINGS[2]?.image || "",
128
+ alt: MOCK_LISTINGS[2]?.title || "",
129
+ },
130
+ chips: MOCK_LISTINGS[2]?.categories,
131
+ },
132
+ },
133
+ };
134
+
135
+ export const WithBanner: Story = {
136
+ args: {
137
+ item: {
138
+ key: String(MOCK_LISTINGS[0]?.id),
139
+ title: MOCK_LISTINGS[0]?.title,
140
+ description: MOCK_LISTINGS[0]?.description,
141
+ image: {
142
+ src: MOCK_LISTINGS[0]?.image || "",
143
+ alt: MOCK_LISTINGS[0]?.title || "",
144
+ },
145
+ banner: MOCK_LISTINGS[0]?.isBestSeller ? "Best Seller" : undefined,
146
+ },
147
+ },
148
+ };
149
+
150
+ export const WithPrice: Story = {
151
+ args: {
152
+ item: {
153
+ key: String(MOCK_LISTINGS[0]?.id),
154
+ title: MOCK_LISTINGS[0]?.title,
155
+ description: MOCK_LISTINGS[0]?.description,
156
+ price: `$ ${MOCK_LISTINGS[0]?.price}`,
157
+ image: {
158
+ src: MOCK_LISTINGS[0]?.image || "",
159
+ alt: MOCK_LISTINGS[0]?.title || "",
160
+ },
161
+ },
162
+ },
163
+ };
164
+
165
+ export const Horizontal: Story = {
166
+ args: {
167
+ orientation: "horizontal",
168
+ actions: ITEM_CARD_ACTIONS,
169
+ item: {
170
+ key: String(MOCK_LISTINGS[0]?.id),
171
+ title: MOCK_LISTINGS[0]?.title,
172
+ description: MOCK_LISTINGS[0]?.description,
173
+ image: {
174
+ src: MOCK_LISTINGS[0]?.image || "",
175
+ alt: MOCK_LISTINGS[0]?.title || "",
176
+ },
177
+ banner: MOCK_LISTINGS[0]?.isBestSeller ? "Best Seller" : undefined,
178
+ chips: MOCK_LISTINGS[0]?.categories,
179
+ price: `$ ${MOCK_LISTINGS[0]?.price}`,
180
+ },
181
+ },
182
+ };
@@ -0,0 +1,138 @@
1
+ import { cva } from "class-variance-authority";
2
+
3
+ export const itemCardMotionClasses = cva(["w-full relative"], {
4
+ variants: {
5
+ orientation: {
6
+ vertical: "max-w-80",
7
+ horizontal: "min-w-full max-w-full",
8
+ },
9
+ },
10
+ defaultVariants: {},
11
+ compoundVariants: [],
12
+ });
13
+
14
+ export const itemMainWrapperClasses = cva(["size-full"], {
15
+ variants: {
16
+ orientation: {
17
+ vertical: "flex flex-col",
18
+ horizontal: "grid grid-cols-[200px_auto]",
19
+ },
20
+ },
21
+ defaultVariants: {},
22
+ compoundVariants: [],
23
+ });
24
+
25
+ export const itemImageWrapperClasses = cva(
26
+ ["relative aspect-4/3 overflow-hidden"],
27
+ {
28
+ variants: {
29
+ orientation: {
30
+ vertical: "w-full",
31
+ horizontal: "w-fit h-full",
32
+ },
33
+ },
34
+ defaultVariants: {},
35
+ compoundVariants: [],
36
+ },
37
+ );
38
+
39
+ export const itemHeaderClasses = cva(["relative p-0"], {
40
+ variants: {
41
+ orientation: {
42
+ vertical: "",
43
+ horizontal: "row-span-2",
44
+ },
45
+ },
46
+ defaultVariants: {},
47
+ compoundVariants: [],
48
+ });
49
+
50
+ export const itemBodyClasses = cva(["relative flex flex-col gap-2 p-4"], {
51
+ variants: {
52
+ orientation: {
53
+ vertical: "",
54
+ horizontal: "",
55
+ },
56
+ },
57
+ defaultVariants: {},
58
+ compoundVariants: [],
59
+ });
60
+
61
+ export const itemFooterClasses = cva(["flex items-center p-4"], {
62
+ variants: {
63
+ orientation: {
64
+ vertical: "",
65
+ horizontal: "justify-end",
66
+ },
67
+ },
68
+ defaultVariants: {},
69
+ compoundVariants: [],
70
+ });
71
+
72
+ export const itemTitleClasses = cva(
73
+ ["line-clamp-1 font-semibold text-foreground"],
74
+ {
75
+ variants: {
76
+ orientation: {
77
+ vertical: "",
78
+ horizontal: "w-[calc(100%-30px)]",
79
+ },
80
+ },
81
+ defaultVariants: {},
82
+ compoundVariants: [],
83
+ },
84
+ );
85
+
86
+ export const itemPriceClasses = cva(["text-2xl font-bold text-foreground"], {
87
+ variants: {
88
+ orientation: {
89
+ vertical: "",
90
+ horizontal: "",
91
+ },
92
+ },
93
+ defaultVariants: {},
94
+ compoundVariants: [],
95
+ });
96
+
97
+ export const itemDescriptionClasses = cva(
98
+ ["line-clamp-2 text-sm text-default-600"],
99
+ {
100
+ variants: {
101
+ orientation: {
102
+ vertical: "",
103
+ horizontal: "",
104
+ },
105
+ },
106
+ defaultVariants: {},
107
+ compoundVariants: [],
108
+ },
109
+ );
110
+
111
+ export const itemChipsClasses = cva(["flex flex-wrap items-center gap-2 p-1"], {
112
+ variants: {
113
+ orientation: {
114
+ vertical: "",
115
+ horizontal: "",
116
+ },
117
+ },
118
+ defaultVariants: {},
119
+ compoundVariants: [],
120
+ });
121
+
122
+ export const itemBannerClasses = cva(
123
+ [
124
+ "absolute left-0 top-0 z-10 px-2 py-1 text-xs font-semibold",
125
+ "bg-primary-500/50 backdrop-blur-sm text-center flex justify-center items-center",
126
+ "-rotate-45 w-full text-white",
127
+ ],
128
+ {
129
+ variants: {
130
+ orientation: {
131
+ vertical: "-translate-x-28 translate-y-7",
132
+ horizontal: "-translate-x-14 translate-y-7",
133
+ },
134
+ },
135
+ defaultVariants: {},
136
+ compoundVariants: [],
137
+ },
138
+ );
@@ -0,0 +1 @@
1
+ export * from "./classes";
@@ -1,4 +1,5 @@
1
- import { cn, Link } from "@heroui/react";
1
+ import { cn } from "@/utils";
2
+ import { Link } from "@heroui/link";
2
3
  import { useNavigation } from "@/hooks";
3
4
  import { SubItemsBoxProps } from "@/types";
4
5
 
@@ -1 +1,2 @@
1
1
  export * from "./scaffold";
2
+ export * from "./styles";
@@ -1,36 +1,23 @@
1
1
  import { useEmperorUI } from "@/hooks";
2
2
  import type { ScaffoldProps } from "@/types";
3
3
  import { cn } from "@/utils";
4
- import { cva } from "class-variance-authority";
5
4
  import { forwardRef } from "react";
6
-
7
- const scaffoldStyles = cva(["flex flex-col min-h-screen w-full max-w-screen"], {
8
- variants: {},
9
- defaultVariants: {},
10
- compoundVariants: [],
11
- });
5
+ import { scaffoldClasses } from "@/components";
12
6
 
13
7
  export const Scaffold = forwardRef<HTMLDivElement, ScaffoldProps>(
14
8
  ({ className, children, ...props }, ref) => {
15
9
  const { config } = useEmperorUI();
16
10
 
17
- const backgroundColor = config?.theme?.colors?.background;
18
- const foregroundColor = config?.theme?.colors?.foreground;
19
-
20
11
  return (
21
- <div
12
+ <main
22
13
  ref={ref}
23
14
  dir={config?.interLocalization?.dir}
24
15
  data-slot="scaffold"
25
- className={cn(scaffoldStyles({ className }), className)}
26
- style={{
27
- backgroundColor: backgroundColor,
28
- color: foregroundColor,
29
- }}
16
+ className={cn(scaffoldClasses({ className }), className)}
30
17
  {...props}
31
18
  >
32
19
  {children}
33
- </div>
20
+ </main>
34
21
  );
35
22
  },
36
23
  );
@@ -0,0 +1 @@
1
+ export * from "./scaffold-classes";
@@ -0,0 +1,10 @@
1
+ import { cva } from "class-variance-authority";
2
+
3
+ export const scaffoldClasses = cva(
4
+ ["flex flex-col min-h-screen w-full max-w-screen"],
5
+ {
6
+ variants: {},
7
+ defaultVariants: {},
8
+ compoundVariants: [],
9
+ },
10
+ );
@@ -1,7 +1,9 @@
1
1
  import { createPortal } from "react-dom";
2
2
  import { useEffect, useState } from "react";
3
3
  import { cn } from "@/utils";
4
- import { Button, Divider, ScrollShadow } from "@heroui/react";
4
+ import { Button } from "@heroui/button";
5
+ import { Divider } from "@heroui/divider";
6
+ import { ScrollShadow } from "@heroui/scroll-shadow";
5
7
  import { CompactSideBarProps } from "@/types";
6
8
 
7
9
  const CompactSideBarContent = ({
@@ -1,15 +1,15 @@
1
1
  import { useEmperorUI } from "@/hooks";
2
2
  import { useState } from "react";
3
3
  import {
4
- Button,
5
4
  Drawer,
6
5
  DrawerHeader,
7
6
  DrawerBody,
8
7
  DrawerContent,
9
- ScrollShadow,
10
- Divider,
11
8
  DrawerFooter,
12
- } from "@heroui/react";
9
+ } from "@heroui/drawer";
10
+ import { Button } from "@heroui/button";
11
+ import { ScrollShadow } from "@heroui/scroll-shadow";
12
+ import { Divider } from "@heroui/divider";
13
13
  import { SideBarProps } from "@/types";
14
14
  import { cn } from "@/utils";
15
15
  import { sideBarItemClasses, sideBarItemStyles } from "./styles";
@@ -29,9 +29,6 @@ export const SideBarDrawer = ({
29
29
  const { content, ...restTriggerProps } = triggerProps || {};
30
30
 
31
31
  const dir = config?.interLocalization?.dir;
32
- const backgroundColor = config?.theme?.colors?.background;
33
- const primaryColor = config?.theme?.colors?.primary;
34
- const foregroundColor = config?.theme?.colors?.foreground;
35
32
 
36
33
  const isRTL = dir === "rtl";
37
34
 
@@ -56,10 +53,7 @@ export const SideBarDrawer = ({
56
53
  dir={dir}
57
54
  className="p-0"
58
55
  >
59
- <DrawerContent
60
- className="p-0"
61
- style={{ backgroundColor, color: foregroundColor }}
62
- >
56
+ <DrawerContent className="p-0">
63
57
  <DrawerHeader className={cn("text-xl font-bold", classNames?.title)}>
64
58
  {header}
65
59
  </DrawerHeader>
@@ -76,8 +70,6 @@ export const SideBarDrawer = ({
76
70
  key={href}
77
71
  data-slot="emperor-side-bar-item"
78
72
  style={sideBarItemStyles({
79
- foregroundColor,
80
- primaryColor,
81
73
  isHovered: hoveredItem === id,
82
74
  variant,
83
75
  })}
@@ -97,10 +89,7 @@ export const SideBarDrawer = ({
97
89
 
98
90
  {actions && actions?.length > 0 && (
99
91
  <>
100
- <Divider
101
- className="m-auto w-11/12"
102
- style={{ backgroundColor: foregroundColor + "20" }}
103
- />
92
+ <Divider className="m-auto w-11/12" />
104
93
 
105
94
  <DrawerFooter className={cn(classNames?.actionsWrapper)}>
106
95
  {actions?.map(({ key, label, ...props }) => (
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from "@storybook/react-vite";
2
2
  import { Brand, SideBar } from "@/components";
3
3
  import { getStorybookDecorators } from "@/utils";
4
4
  import { MenuIcon } from "lucide-react";
5
- import { useDisclosure } from "@heroui/react";
5
+ import { useDisclosure } from "@heroui/modal";
6
6
  import { MOCK_HEADER_ACTIONS, MOCK_HEADER_ITEMS } from "@/mocks";
7
7
  import { SideBarProps } from "@/types";
8
8
 
@@ -0,0 +1,32 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { Filter, Filters } from "@/components";
3
+ import { getStorybookDecorators } from "@/utils";
4
+
5
+ const meta: Meta<typeof Filters> = {
6
+ title: "Organisms/Filters",
7
+ component: Filters,
8
+ parameters: {
9
+ layout: "centered",
10
+ },
11
+ tags: ["autodocs"],
12
+ decorators: getStorybookDecorators({
13
+ config: {
14
+ layout: {
15
+ withScaffold: false,
16
+ },
17
+ },
18
+ }),
19
+ };
20
+
21
+ export default meta;
22
+
23
+ type Story = StoryObj<typeof meta>;
24
+
25
+ export const Default: Story = {
26
+ args: {},
27
+ render: () => (
28
+ <Filters>
29
+ <Filter type="search" paramKey="search" />
30
+ </Filters>
31
+ ),
32
+ };
@@ -0,0 +1,36 @@
1
+ import { cn } from "@/utils";
2
+ import { FilterProps, FiltersProps } from "@/types";
3
+ import { filtersClasses } from "./styles";
4
+ import { Children, isValidElement, ReactElement } from "react";
5
+ import { Filter } from "@/components";
6
+
7
+ export function Filters({
8
+ className,
9
+ classNames,
10
+ children,
11
+ ...props
12
+ }: FiltersProps) {
13
+ const childArray = Children.toArray(children).filter(
14
+ isValidElement,
15
+ ) as ReactElement<FilterProps, typeof Filter>[];
16
+
17
+ childArray.forEach((child) => {
18
+ const type = child.type;
19
+
20
+ if (type !== Filter) {
21
+ throw new Error(
22
+ `Allowed children for <Filters /> must be of type <Filter />. Got ${type} instead.`,
23
+ );
24
+ }
25
+ });
26
+
27
+ return (
28
+ <nav
29
+ data-slot="emperor-ui-filters"
30
+ className={cn(filtersClasses({}), className)}
31
+ {...props}
32
+ >
33
+ <ul className="flex items-center gap-2">{children}</ul>
34
+ </nav>
35
+ );
36
+ }
@@ -0,0 +1 @@
1
+ export * from "./filters";
@@ -0,0 +1,9 @@
1
+ import { cva } from "class-variance-authority";
2
+
3
+ export const filtersClasses = cva([""], {
4
+ variants: {
5
+ variant: {},
6
+ },
7
+ defaultVariants: {},
8
+ compoundVariants: [],
9
+ });
@@ -0,0 +1 @@
1
+ export * from "./classes";
@@ -1,4 +1,4 @@
1
- import { cn } from "@heroui/react";
1
+ import { cn } from "@/utils";
2
2
  import { FooterProps } from "@/types";
3
3
  import { copyRightsClasses } from "./styles";
4
4
 
@@ -9,7 +9,7 @@ import {
9
9
  SocialLinksBox,
10
10
  CopyRightsBox,
11
11
  } from "@/components";
12
- import { Divider } from "@heroui/react";
12
+ import { Divider } from "@heroui/divider";
13
13
 
14
14
  export const Footer = forwardRef<
15
15
  HTMLElement,
@@ -1,4 +1,5 @@
1
- import { cn, Link } from "@heroui/react";
1
+ import { cn } from "@/utils";
2
+ import { Link } from "@heroui/link";
2
3
  import { FooterProps } from "@/types";
3
4
  import { policiesClasses } from "./styles";
4
5
 
@@ -1,4 +1,5 @@
1
- import { cn, Link } from "@heroui/react";
1
+ import { cn } from "@/utils";
2
+ import { Link } from "@heroui/link";
2
3
  import { FooterProps } from "@/types";
3
4
  import { quickLinksClasses } from "./styles";
4
5
 
@@ -1,4 +1,5 @@
1
- import { cn, Link } from "@heroui/react";
1
+ import { cn } from "@/utils";
2
+ import { Link } from "@heroui/link";
2
3
  import { FooterProps } from "@/types";
3
4
  import { socialLinksClasses } from "./styles";
4
5
 
@@ -11,7 +11,7 @@ import {
11
11
  contacts,
12
12
  socialLinks,
13
13
  } from "@/constants";
14
- import { Button } from "@heroui/react";
14
+ import { Button } from "@heroui/button";
15
15
 
16
16
  const meta: Meta<typeof Footer> = {
17
17
  title: "Organisms/Footer",
@@ -1,11 +1,10 @@
1
- import { useEmperorUI } from "@/hooks";
2
1
  import type { HeaderProps, NavBarHoverEffect, NavBarVariant } from "@/types";
3
2
  import { cn } from "@/utils";
4
3
  import { VariantProps } from "class-variance-authority";
5
4
  import { ComponentProps, forwardRef } from "react";
6
5
  import { Brand, NavBar, SideBar } from "@/components";
7
6
  import { headerClasses, headerStyles } from "./styles";
8
- import { useDisclosure } from "@heroui/react";
7
+ import { useDisclosure } from "@heroui/modal";
9
8
  import { MOCK_HEADER_ITEMS, MOCK_HEADER_ACTIONS } from "@/mocks";
10
9
  import { SegmentedHeaderContent } from "./segmented-header-content";
11
10
 
@@ -17,12 +16,8 @@ export const Header = forwardRef<
17
16
  { className, variant = "default", glassEffect, children, ...props },
18
17
  ref,
19
18
  ) => {
20
- const { config } = useEmperorUI();
21
19
  const { isOpen, onOpenChange } = useDisclosure();
22
20
 
23
- const primaryColor = config?.theme?.colors?.primary;
24
- const foregroundColor = config?.theme?.colors?.foreground;
25
-
26
21
  const content = children || (
27
22
  <>
28
23
  <SideBar
@@ -74,8 +69,6 @@ export const Header = forwardRef<
74
69
  data-slot="emperor-header"
75
70
  className={cn(headerClasses({ variant, className }))}
76
71
  style={headerStyles({
77
- primaryColor,
78
- foregroundColor,
79
72
  variant,
80
73
  glassEffect,
81
74
  })}
@@ -2,3 +2,4 @@ export * from "./item-details";
2
2
  export * from "./listings";
3
3
  export * from "./footer";
4
4
  export * from "./header";
5
+ export * from "./filters";