@js-empire/emperor-ui 1.3.6 → 1.3.7

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 (316) hide show
  1. package/dist/emperor-ui.js +60623 -158
  2. package/package.json +7 -3
  3. package/.cursor/rules/code-conventions.mdc +0 -50
  4. package/.husky/pre-commit +0 -4
  5. package/.prettierrc +0 -10
  6. package/.storybook/main.ts +0 -24
  7. package/.storybook/preview.ts +0 -19
  8. package/.storybook/vitest.setup.ts +0 -7
  9. package/.vscode/extensions.json +0 -1
  10. package/dist/index-ABKcY4tX.js +0 -60607
  11. package/dist/index-CWu5fG3N.js +0 -6
  12. package/dist/index-DpemL3iQ.js +0 -291
  13. package/dist/src-UW24ZMRV-I8bMqcTI.js +0 -6
  14. package/eslint.config.js +0 -34
  15. package/index.html +0 -13
  16. package/public/icons/emperor-ui-logo.ico +0 -0
  17. package/public/images/avatar-female.jpg +0 -0
  18. package/public/images/avatar-male.jpg +0 -0
  19. package/public/images/emperor-ui-logo.png +0 -0
  20. package/src/animations/blink.ts +0 -26
  21. package/src/animations/floating.ts +0 -12
  22. package/src/animations/index.ts +0 -2
  23. package/src/components/atoms/brand/brand.stories.tsx +0 -27
  24. package/src/components/atoms/brand/brand.tsx +0 -56
  25. package/src/components/atoms/brand/index.ts +0 -1
  26. package/src/components/atoms/brand/styles/classes.ts +0 -9
  27. package/src/components/atoms/brand/styles/index.ts +0 -2
  28. package/src/components/atoms/brand/styles/styles.ts +0 -0
  29. package/src/components/atoms/color-picker/color-picker.tsx +0 -12
  30. package/src/components/atoms/color-picker/free-color-picker.tsx +0 -58
  31. package/src/components/atoms/color-picker/index.ts +0 -3
  32. package/src/components/atoms/color-picker/preset-color-picker.tsx +0 -66
  33. package/src/components/atoms/color-picker/stories/color-picker.stories.tsx +0 -63
  34. package/src/components/atoms/column/column.stories.tsx +0 -37
  35. package/src/components/atoms/column/column.tsx +0 -21
  36. package/src/components/atoms/column/index.ts +0 -1
  37. package/src/components/atoms/container/column.stories.tsx +0 -37
  38. package/src/components/atoms/container/container.tsx +0 -28
  39. package/src/components/atoms/container/index.ts +0 -1
  40. package/src/components/atoms/copy-button/copy-button.tsx +0 -73
  41. package/src/components/atoms/copy-button/index.ts +0 -1
  42. package/src/components/atoms/copy-button/stories/copy-button.stories.tsx +0 -21
  43. package/src/components/atoms/field/field.tsx +0 -81
  44. package/src/components/atoms/field/index.ts +0 -3
  45. package/src/components/atoms/field/styles/classes.ts +0 -9
  46. package/src/components/atoms/field/styles/index.ts +0 -1
  47. package/src/components/atoms/field/units/autocomplete-field.tsx +0 -49
  48. package/src/components/atoms/field/units/checkbox-field.tsx +0 -35
  49. package/src/components/atoms/field/units/index.ts +0 -7
  50. package/src/components/atoms/field/units/input-field.tsx +0 -35
  51. package/src/components/atoms/field/units/radio-field.tsx +0 -43
  52. package/src/components/atoms/field/units/select-field.tsx +0 -50
  53. package/src/components/atoms/field/units/switch-field.tsx +0 -35
  54. package/src/components/atoms/field/units/textarea-field.tsx +0 -37
  55. package/src/components/atoms/filter/filter.tsx +0 -93
  56. package/src/components/atoms/filter/index.ts +0 -3
  57. package/src/components/atoms/filter/stories/filter.stories.tsx +0 -238
  58. package/src/components/atoms/filter/styles/classes.ts +0 -20
  59. package/src/components/atoms/filter/styles/index.ts +0 -1
  60. package/src/components/atoms/filter/units/autocomplete-filter.tsx +0 -66
  61. package/src/components/atoms/filter/units/checkbox-filter.tsx +0 -42
  62. package/src/components/atoms/filter/units/checkbox-group-filter.tsx +0 -68
  63. package/src/components/atoms/filter/units/date-filter.tsx +0 -46
  64. package/src/components/atoms/filter/units/index.ts +0 -9
  65. package/src/components/atoms/filter/units/numeric-filter.tsx +0 -41
  66. package/src/components/atoms/filter/units/range-filter.tsx +0 -65
  67. package/src/components/atoms/filter/units/search-filter.tsx +0 -53
  68. package/src/components/atoms/filter/units/select-filter.tsx +0 -57
  69. package/src/components/atoms/filter/units/switch-filter.tsx +0 -35
  70. package/src/components/atoms/index.ts +0 -11
  71. package/src/components/atoms/portal/index.ts +0 -1
  72. package/src/components/atoms/portal/portal.stories.tsx +0 -43
  73. package/src/components/atoms/portal/portal.tsx +0 -25
  74. package/src/components/atoms/row/index.ts +0 -1
  75. package/src/components/atoms/row/row.stories.tsx +0 -37
  76. package/src/components/atoms/row/row.tsx +0 -26
  77. package/src/components/atoms/theme-switch/index.ts +0 -1
  78. package/src/components/atoms/theme-switch/styles/classes.ts +0 -16
  79. package/src/components/atoms/theme-switch/styles/index.ts +0 -1
  80. package/src/components/atoms/theme-switch/theme-switch.stories.tsx +0 -26
  81. package/src/components/atoms/theme-switch/theme-switch.tsx +0 -54
  82. package/src/components/atoms/uploader/components/avatar-label.tsx +0 -102
  83. package/src/components/atoms/uploader/components/index.ts +0 -8
  84. package/src/components/atoms/uploader/components/upload-file-error-box.tsx +0 -40
  85. package/src/components/atoms/uploader/components/upload-file-input.tsx +0 -36
  86. package/src/components/atoms/uploader/components/upload-file-label.tsx +0 -92
  87. package/src/components/atoms/uploader/components/upload-file-listing.tsx +0 -64
  88. package/src/components/atoms/uploader/components/uploader-title.tsx +0 -21
  89. package/src/components/atoms/uploader/components/uploader.tsx +0 -89
  90. package/src/components/atoms/uploader/components/view-image-modal.tsx +0 -41
  91. package/src/components/atoms/uploader/index.ts +0 -1
  92. package/src/components/atoms/uploader/stories/uploader.stories.tsx +0 -202
  93. package/src/components/index.ts +0 -4
  94. package/src/components/molecules/index.ts +0 -4
  95. package/src/components/molecules/item-card/components/actions/index.ts +0 -3
  96. package/src/components/molecules/item-card/components/actions/item-actions-buttons.tsx +0 -43
  97. package/src/components/molecules/item-card/components/actions/item-actions-dropdown.tsx +0 -57
  98. package/src/components/molecules/item-card/components/actions/item-actions-overlay.tsx +0 -50
  99. package/src/components/molecules/item-card/components/additions/index.ts +0 -2
  100. package/src/components/molecules/item-card/components/additions/item-banner.tsx +0 -22
  101. package/src/components/molecules/item-card/components/additions/loading-item.tsx +0 -88
  102. package/src/components/molecules/item-card/components/card/index.ts +0 -4
  103. package/src/components/molecules/item-card/components/card/item-card-body.tsx +0 -74
  104. package/src/components/molecules/item-card/components/card/item-card-footer.tsx +0 -79
  105. package/src/components/molecules/item-card/components/card/item-card-header.tsx +0 -69
  106. package/src/components/molecules/item-card/components/card/item-card.tsx +0 -123
  107. package/src/components/molecules/item-card/components/index.ts +0 -3
  108. package/src/components/molecules/item-card/index.ts +0 -2
  109. package/src/components/molecules/item-card/stories/item-card.stories.tsx +0 -218
  110. package/src/components/molecules/item-card/styles/classes.ts +0 -141
  111. package/src/components/molecules/item-card/styles/index.ts +0 -1
  112. package/src/components/molecules/nav-bar/index.ts +0 -3
  113. package/src/components/molecules/nav-bar/nav-bar-item.tsx +0 -64
  114. package/src/components/molecules/nav-bar/nav-bar.tsx +0 -57
  115. package/src/components/molecules/nav-bar/stories/hover-effect/nav-bar-hover-effect.stories.tsx +0 -52
  116. package/src/components/molecules/nav-bar/stories/nav-bar.stories.tsx +0 -50
  117. package/src/components/molecules/nav-bar/styles/classes.ts +0 -68
  118. package/src/components/molecules/nav-bar/styles/index.ts +0 -2
  119. package/src/components/molecules/nav-bar/styles/styles.ts +0 -85
  120. package/src/components/molecules/nav-bar/sub-items-box.tsx +0 -58
  121. package/src/components/molecules/scaffold/index.ts +0 -2
  122. package/src/components/molecules/scaffold/scaffold.stories.tsx +0 -21
  123. package/src/components/molecules/scaffold/scaffold.tsx +0 -23
  124. package/src/components/molecules/scaffold/styles/index.ts +0 -1
  125. package/src/components/molecules/scaffold/styles/scaffold-classes.ts +0 -10
  126. package/src/components/molecules/side-bar/compact-side-bar.tsx +0 -77
  127. package/src/components/molecules/side-bar/index.ts +0 -1
  128. package/src/components/molecules/side-bar/side-bar-drawer.tsx +0 -113
  129. package/src/components/molecules/side-bar/side-bar.stories.tsx +0 -111
  130. package/src/components/molecules/side-bar/side-bar.tsx +0 -31
  131. package/src/components/molecules/side-bar/styles/classes.ts +0 -28
  132. package/src/components/molecules/side-bar/styles/index.ts +0 -2
  133. package/src/components/molecules/side-bar/styles/styles.ts +0 -13
  134. package/src/components/organisms/deletion-confirmor/deletion-confirmor.tsx +0 -110
  135. package/src/components/organisms/deletion-confirmor/index.ts +0 -3
  136. package/src/components/organisms/deletion-confirmor/stories/components.tsx +0 -25
  137. package/src/components/organisms/deletion-confirmor/stories/deletion-confirmor.stories.tsx +0 -78
  138. package/src/components/organisms/deletion-confirmor/styles/classes.ts +0 -28
  139. package/src/components/organisms/deletion-confirmor/styles/index.ts +0 -2
  140. package/src/components/organisms/deletion-confirmor/styles/styles.ts +0 -4
  141. package/src/components/organisms/footer/copy-rights-box.tsx +0 -27
  142. package/src/components/organisms/footer/footer.tsx +0 -75
  143. package/src/components/organisms/footer/index.ts +0 -5
  144. package/src/components/organisms/footer/policies-box.tsx +0 -27
  145. package/src/components/organisms/footer/quick-links-box.tsx +0 -46
  146. package/src/components/organisms/footer/social-links-box.tsx +0 -33
  147. package/src/components/organisms/footer/stories/footer.stories.tsx +0 -61
  148. package/src/components/organisms/footer/styles/classes.ts +0 -71
  149. package/src/components/organisms/footer/styles/index.ts +0 -2
  150. package/src/components/organisms/footer/styles/styles.ts +0 -6
  151. package/src/components/organisms/form-builder/form-builder.stories.tsx +0 -144
  152. package/src/components/organisms/form-builder/form-builder.tsx +0 -75
  153. package/src/components/organisms/form-builder/index.ts +0 -1
  154. package/src/components/organisms/header/header.tsx +0 -87
  155. package/src/components/organisms/header/index.ts +0 -1
  156. package/src/components/organisms/header/segmented-header-content.tsx +0 -29
  157. package/src/components/organisms/header/stories/header.stories.tsx +0 -144
  158. package/src/components/organisms/header/styles/classes.ts +0 -22
  159. package/src/components/organisms/header/styles/index.ts +0 -2
  160. package/src/components/organisms/header/styles/styles.ts +0 -39
  161. package/src/components/organisms/index.ts +0 -6
  162. package/src/components/organisms/item-details/index.ts +0 -1
  163. package/src/components/organisms/item-details/item-details.tsx +0 -6
  164. package/src/components/organisms/listings/empty-listings.tsx +0 -80
  165. package/src/components/organisms/listings/index.ts +0 -3
  166. package/src/components/organisms/listings/listings.tsx +0 -96
  167. package/src/components/organisms/listings/stories/grid-listings.stories.tsx +0 -153
  168. package/src/components/organisms/listings/stories/list-listings.stories.tsx +0 -171
  169. package/src/components/organisms/listings/styles/classes.ts +0 -49
  170. package/src/components/organisms/listings/styles/index.ts +0 -2
  171. package/src/components/organisms/listings/styles/styles.ts +0 -6
  172. package/src/components/templates/index.ts +0 -1
  173. package/src/components/templates/landing-page/index.ts +0 -1
  174. package/src/components/templates/landing-page/landing-page.stories.tsx +0 -21
  175. package/src/components/templates/landing-page/landing-page.tsx +0 -57
  176. package/src/components/templates/landing-page/styles/classes.ts +0 -11
  177. package/src/components/templates/landing-page/styles/index.ts +0 -1
  178. package/src/constants/animations.ts +0 -14
  179. package/src/constants/card.tsx +0 -42
  180. package/src/constants/defaults.ts +0 -59
  181. package/src/constants/fake.ts +0 -5
  182. package/src/constants/footer.tsx +0 -157
  183. package/src/constants/index.ts +0 -6
  184. package/src/constants/uploader.ts +0 -33
  185. package/src/context/emperor-ui-context.ts +0 -6
  186. package/src/context/form-builder-context.tsx +0 -8
  187. package/src/context/index.ts +0 -4
  188. package/src/context/navigation-context.ts +0 -6
  189. package/src/context/uploader-context.ts +0 -6
  190. package/src/enums/index.ts +0 -2
  191. package/src/enums/placeholders.ts +0 -4
  192. package/src/enums/preserved-keys.ts +0 -3
  193. package/src/examples/index.ts +0 -1
  194. package/src/hooks/index.ts +0 -8
  195. package/src/hooks/use-emperor-ui.ts +0 -12
  196. package/src/hooks/use-filters.ts +0 -20
  197. package/src/hooks/use-form-builder-context.ts +0 -16
  198. package/src/hooks/use-navigation.ts +0 -12
  199. package/src/hooks/use-search-params-handler.tsx +0 -186
  200. package/src/hooks/use-uploader-context.ts +0 -14
  201. package/src/hooks/use-uploader.tsx +0 -164
  202. package/src/hooks/use-window-size.tsx +0 -53
  203. package/src/i18n/configs/i18n.ts +0 -7
  204. package/src/i18n/configs/index.ts +0 -1
  205. package/src/i18n/constants/index.ts +0 -1
  206. package/src/i18n/constants/locales.ts +0 -4
  207. package/src/i18n/index.ts +0 -5
  208. package/src/i18n/locales/ar.ts +0 -15
  209. package/src/i18n/locales/atoms/ar.ts +0 -18
  210. package/src/i18n/locales/atoms/en.ts +0 -18
  211. package/src/i18n/locales/atoms/index.ts +0 -2
  212. package/src/i18n/locales/common/ar.ts +0 -1
  213. package/src/i18n/locales/common/en.ts +0 -1
  214. package/src/i18n/locales/common/index.ts +0 -2
  215. package/src/i18n/locales/en.ts +0 -15
  216. package/src/i18n/locales/index.ts +0 -4
  217. package/src/i18n/locales/molecules/ar.ts +0 -1
  218. package/src/i18n/locales/molecules/en.ts +0 -1
  219. package/src/i18n/locales/molecules/index.ts +0 -2
  220. package/src/i18n/locales/organisms/ar.ts +0 -11
  221. package/src/i18n/locales/organisms/en.ts +0 -11
  222. package/src/i18n/locales/organisms/index.ts +0 -2
  223. package/src/i18n/locales/templates/ar.ts +0 -1
  224. package/src/i18n/locales/templates/en.ts +0 -1
  225. package/src/i18n/locales/templates/index.ts +0 -2
  226. package/src/i18n/locales/toasts/ar.ts +0 -1
  227. package/src/i18n/locales/toasts/en.ts +0 -1
  228. package/src/i18n/locales/toasts/index.ts +0 -2
  229. package/src/i18n/types/index.ts +0 -2
  230. package/src/i18n/types/locale.ts +0 -5
  231. package/src/i18n/types/toasts.ts +0 -3
  232. package/src/i18n/utils/get-locales.ts +0 -4
  233. package/src/i18n/utils/index.ts +0 -2
  234. package/src/i18n/utils/localize.ts +0 -15
  235. package/src/index.ts +0 -14
  236. package/src/mocks/constants.ts +0 -103
  237. package/src/mocks/deletion-confirmor.ts +0 -16
  238. package/src/mocks/header.tsx +0 -118
  239. package/src/mocks/index.ts +0 -6
  240. package/src/mocks/listings.tsx +0 -154
  241. package/src/mocks/locales/index.ts +0 -1
  242. package/src/mocks/locales/uploader.ts +0 -33
  243. package/src/mocks/types.ts +0 -64
  244. package/src/providers/config-provider.tsx +0 -72
  245. package/src/providers/emperor-ui-provider.tsx +0 -35
  246. package/src/providers/form-builder-provider-context.tsx +0 -18
  247. package/src/providers/index.ts +0 -6
  248. package/src/providers/navigation-provider.tsx +0 -42
  249. package/src/providers/theme-provider.tsx +0 -16
  250. package/src/providers/uploader-provider.tsx +0 -53
  251. package/src/styles/globals.css +0 -38
  252. package/src/styles/hero.ts +0 -3
  253. package/src/styles/index.css +0 -18
  254. package/src/types/components/atoms/brand.ts +0 -13
  255. package/src/types/components/atoms/color-picker/color-picker.ts +0 -21
  256. package/src/types/components/atoms/color-picker/index.ts +0 -1
  257. package/src/types/components/atoms/column.ts +0 -3
  258. package/src/types/components/atoms/container.ts +0 -3
  259. package/src/types/components/atoms/field/field.ts +0 -61
  260. package/src/types/components/atoms/field/index.ts +0 -1
  261. package/src/types/components/atoms/filter/filter.ts +0 -52
  262. package/src/types/components/atoms/filter/index.ts +0 -2
  263. package/src/types/components/atoms/filter/select-filter.ts +0 -8
  264. package/src/types/components/atoms/index.ts +0 -9
  265. package/src/types/components/atoms/portal.ts +0 -6
  266. package/src/types/components/atoms/row.ts +0 -3
  267. package/src/types/components/atoms/uploader.ts +0 -103
  268. package/src/types/components/index.ts +0 -4
  269. package/src/types/components/molecules/footer/footer.ts +0 -68
  270. package/src/types/components/molecules/footer/index.ts +0 -1
  271. package/src/types/components/molecules/header/header.ts +0 -51
  272. package/src/types/components/molecules/header/index.ts +0 -1
  273. package/src/types/components/molecules/index.ts +0 -9
  274. package/src/types/components/molecules/item-card/index.ts +0 -1
  275. package/src/types/components/molecules/item-card/item-card.ts +0 -69
  276. package/src/types/components/molecules/item-details/index.ts +0 -1
  277. package/src/types/components/molecules/item-details/item-details.ts +0 -9
  278. package/src/types/components/molecules/listings/index.ts +0 -1
  279. package/src/types/components/molecules/listings/listings.ts +0 -29
  280. package/src/types/components/molecules/nav-bar/index.ts +0 -1
  281. package/src/types/components/molecules/nav-bar/nav-bar.ts +0 -66
  282. package/src/types/components/molecules/scaffold/index.ts +0 -1
  283. package/src/types/components/molecules/scaffold/scaffold.ts +0 -9
  284. package/src/types/components/molecules/side-bar/index.ts +0 -1
  285. package/src/types/components/molecules/side-bar/side-bar.ts +0 -40
  286. package/src/types/components/molecules/theme-switch/index.ts +0 -1
  287. package/src/types/components/molecules/theme-switch/theme-switch.ts +0 -9
  288. package/src/types/components/organisms/deletion-confirmor/deletion-confirmor.ts +0 -22
  289. package/src/types/components/organisms/deletion-confirmor/index.ts +0 -1
  290. package/src/types/components/organisms/filters/filters.ts +0 -11
  291. package/src/types/components/organisms/filters/index.ts +0 -1
  292. package/src/types/components/organisms/form-builder/context.ts +0 -6
  293. package/src/types/components/organisms/form-builder/form-builder.ts +0 -39
  294. package/src/types/components/organisms/form-builder/index.ts +0 -2
  295. package/src/types/components/organisms/index.ts +0 -3
  296. package/src/types/components/templates/index.ts +0 -1
  297. package/src/types/components/templates/landing-page.ts +0 -10
  298. package/src/types/context/config.ts +0 -24
  299. package/src/types/context/index.ts +0 -4
  300. package/src/types/context/localization.ts +0 -24
  301. package/src/types/context/navigation.ts +0 -17
  302. package/src/types/context/theme.ts +0 -33
  303. package/src/types/index.ts +0 -3
  304. package/src/types/shared/components.ts +0 -13
  305. package/src/types/shared/index.ts +0 -1
  306. package/src/utils/cn.ts +0 -6
  307. package/src/utils/compress-images.ts +0 -36
  308. package/src/utils/index.ts +0 -5
  309. package/src/utils/locales.ts +0 -54
  310. package/src/utils/storybook.tsx +0 -15
  311. package/src/utils/uploader.ts +0 -170
  312. package/tsconfig.app.json +0 -37
  313. package/tsconfig.json +0 -7
  314. package/tsconfig.node.json +0 -25
  315. package/vite.config.ts +0 -47
  316. package/vitest.shims.d.ts +0 -1
@@ -1,22 +0,0 @@
1
- "use client";
2
-
3
- import { ItemCardProps } from "@/types";
4
- import { cn } from "@/utils";
5
- import { itemBannerClasses } from "@/components";
6
-
7
- export function ItemBanner({
8
- item,
9
- orientation,
10
- classNames,
11
- }: Pick<ItemCardProps, "item" | "orientation" | "classNames">) {
12
- if (!item?.banner) return null;
13
-
14
- return (
15
- <div
16
- data-slot="emperor-ui-item-card-banner"
17
- className={cn(itemBannerClasses({ orientation }), classNames?.banner)}
18
- >
19
- {item?.banner}
20
- </div>
21
- );
22
- }
@@ -1,88 +0,0 @@
1
- "use client";
2
-
3
- import { cn } from "@/utils";
4
- import { Card, CardBody, CardFooter, CardHeader } from "@heroui/card";
5
- import { Skeleton } from "@heroui/skeleton";
6
- import { motion } from "framer-motion";
7
- import {
8
- itemMainWrapperClasses,
9
- itemCardMotionClasses,
10
- itemImageWrapperClasses,
11
- itemHeaderClasses,
12
- itemBodyClasses,
13
- itemFooterClasses,
14
- itemChipsClasses,
15
- } from "@/components";
16
- import { getCardMotion } from "@/constants";
17
- import type { ItemCardProps } from "@/types";
18
-
19
- export function LoadingItem({
20
- className,
21
- classNames,
22
- hoverEffect = "none",
23
- orientation = "vertical",
24
- }: Pick<
25
- ItemCardProps,
26
- "className" | "classNames" | "hoverEffect" | "orientation"
27
- >) {
28
- return (
29
- <motion.div
30
- {...getCardMotion({ hoverEffect })}
31
- data-slot="emperor-ui-item-card"
32
- className={cn(
33
- itemCardMotionClasses({ orientation }),
34
- classNames?.base,
35
- className,
36
- )}
37
- >
38
- <Card
39
- shadow="sm"
40
- data-slot="emperor-ui-item-card-main-wrapper"
41
- className={cn(
42
- itemMainWrapperClasses({ orientation }),
43
- classNames?.mainWrapper,
44
- )}
45
- >
46
- <CardHeader
47
- data-slot="emperor-ui-item-card-header"
48
- className={cn(itemHeaderClasses({ orientation }), classNames?.header)}
49
- >
50
- <Skeleton
51
- className={cn(
52
- itemImageWrapperClasses({ orientation }),
53
- classNames?.imageWrapper,
54
- )}
55
- />
56
- </CardHeader>
57
-
58
- <CardBody
59
- data-slot="emperor-ui-item-card-body"
60
- className={cn(itemBodyClasses({ orientation }), classNames?.body)}
61
- >
62
- <div className="flex items-start justify-between gap-2">
63
- <Skeleton className="h-5 flex-1 rounded-lg" />
64
- <Skeleton className="size-8 shrink-0 rounded-lg" />
65
- </div>
66
-
67
- <Skeleton className="h-4 w-4/5 rounded-lg" />
68
- <Skeleton className="h-4 w-full rounded-lg" />
69
- </CardBody>
70
-
71
- <CardFooter
72
- data-slot="emperor-ui-item-card-footer"
73
- className={cn(itemFooterClasses({ orientation }), classNames?.footer)}
74
- >
75
- <menu
76
- data-slot="emperor-ui-item-card-chips"
77
- className={cn(itemChipsClasses({ orientation }), classNames?.chips)}
78
- >
79
- {" "}
80
- <Skeleton className="h-6 w-16 rounded-full" />
81
- <Skeleton className="h-6 w-20 rounded-full" />
82
- <Skeleton className="h-6 w-14 rounded-full" />
83
- </menu>
84
- </CardFooter>
85
- </Card>
86
- </motion.div>
87
- );
88
- }
@@ -1,4 +0,0 @@
1
- export * from "./item-card";
2
- export * from "./item-card-header";
3
- export * from "./item-card-body";
4
- export * from "./item-card-footer";
@@ -1,74 +0,0 @@
1
- "use client";
2
-
3
- import type { ItemCardProps } from "@/types";
4
- import { cn } from "@/utils";
5
- import {
6
- itemBodyClasses,
7
- itemDescriptionClasses,
8
- itemPriceClasses,
9
- itemTitleClasses,
10
- ItemActionsDropdown,
11
- } from "@/components";
12
- import { CardBody } from "@heroui/card";
13
-
14
- export function ItemCardBody({
15
- item,
16
- orientation,
17
- classNames,
18
- actions,
19
- onActionClick,
20
- actionsViewVariant = "dropdown",
21
- }: Pick<
22
- ItemCardProps,
23
- | "item"
24
- | "orientation"
25
- | "classNames"
26
- | "actions"
27
- | "onActionClick"
28
- | "actionsViewVariant"
29
- >) {
30
- return (
31
- <CardBody
32
- data-slot="emperor-ui-item-card-body"
33
- className={cn(itemBodyClasses({ orientation }), classNames?.body)}
34
- >
35
- {item?.title && (
36
- <h3
37
- data-slot="emperor-ui-item-card-title"
38
- className={cn(itemTitleClasses({ orientation }), classNames?.title)}
39
- >
40
- {item?.title}
41
- </h3>
42
- )}
43
-
44
- {item?.description && (
45
- <p
46
- data-slot="emperor-ui-item-card-description"
47
- className={cn(
48
- itemDescriptionClasses({ orientation }),
49
- classNames?.description,
50
- )}
51
- >
52
- {item?.description}
53
- </p>
54
- )}
55
-
56
- {item?.price && (
57
- <p
58
- data-slot="emperor-ui-item-card-price"
59
- className={cn(itemPriceClasses({ orientation }), classNames?.price)}
60
- >
61
- {item?.price}
62
- </p>
63
- )}
64
-
65
- {orientation === "horizontal" && actionsViewVariant === "dropdown" && (
66
- <ItemActionsDropdown
67
- actions={actions}
68
- classNames={classNames}
69
- onActionClick={onActionClick}
70
- />
71
- )}
72
- </CardBody>
73
- );
74
- }
@@ -1,79 +0,0 @@
1
- "use client";
2
-
3
- import type { ItemCardProps } from "@/types";
4
- import { cn } from "@/utils";
5
- import {
6
- ItemActionsButtons,
7
- itemFooterClasses,
8
- itemChipsClasses,
9
- } from "@/components";
10
- import { CardFooter } from "@heroui/card";
11
- import { Chip } from "@heroui/chip";
12
-
13
- export function ItemCardFooter({
14
- item,
15
- orientation,
16
- classNames,
17
- actions,
18
- onActionClick,
19
- actionsViewVariant = "dropdown",
20
- }: Pick<
21
- ItemCardProps,
22
- | "item"
23
- | "orientation"
24
- | "classNames"
25
- | "actions"
26
- | "onActionClick"
27
- | "actionsViewVariant"
28
- >) {
29
- return (
30
- <CardFooter
31
- data-slot="emperor-ui-item-card-footer"
32
- className={cn(itemFooterClasses({ orientation }), classNames?.footer)}
33
- >
34
- {item?.chips && item?.chips?.length > 0 && (
35
- <menu
36
- data-slot="emperor-ui-item-card-chips"
37
- className={cn(itemChipsClasses({ orientation }), classNames?.chips)}
38
- >
39
- {item?.chips?.map(
40
- (
41
- {
42
- label,
43
- className: chipClassName,
44
- classNames: chipClassNames,
45
- ...props
46
- },
47
- index,
48
- ) => (
49
- <Chip
50
- key={index}
51
- data-slot="emperor-ui-item-card-chip"
52
- className={cn(chipClassName, classNames?.chip)}
53
- classNames={{
54
- content: "text-xs mx-1",
55
- ...chipClassNames,
56
- }}
57
- size="sm"
58
- variant="flat"
59
- color="primary"
60
- {...props}
61
- >
62
- {label}
63
- </Chip>
64
- ),
65
- )}
66
- </menu>
67
- )}
68
-
69
- {actionsViewVariant === "buttons" && actions && actions?.length > 0 && (
70
- <ItemActionsButtons
71
- actions={actions}
72
- classNames={classNames}
73
- onActionClick={onActionClick}
74
- className="ml-auto"
75
- />
76
- )}
77
- </CardFooter>
78
- );
79
- }
@@ -1,69 +0,0 @@
1
- "use client";
2
-
3
- import { CardHeader } from "@heroui/card";
4
- import { cn } from "@/utils";
5
- import {
6
- itemHeaderClasses,
7
- ItemActionsDropdown,
8
- itemImageWrapperClasses,
9
- ItemBanner,
10
- } from "@/components";
11
- import { Image } from "@heroui/image";
12
- import type { ItemCardProps } from "@/types";
13
-
14
- export function ItemCardHeader({
15
- item,
16
- orientation,
17
- classNames,
18
- actions,
19
- onActionClick,
20
- actionsViewVariant = "dropdown",
21
- }: Pick<
22
- ItemCardProps,
23
- | "item"
24
- | "orientation"
25
- | "classNames"
26
- | "actions"
27
- | "onActionClick"
28
- | "actionsViewVariant"
29
- >) {
30
- return (
31
- <CardHeader
32
- data-slot="emperor-ui-item-card-header"
33
- className={cn(itemHeaderClasses({ orientation }), classNames?.header)}
34
- >
35
- {item?.image && (
36
- <div
37
- data-slot="emperor-ui-item-card-image-wrapper"
38
- className={cn(
39
- itemImageWrapperClasses({ orientation }),
40
- classNames?.imageWrapper,
41
- )}
42
- >
43
- <Image
44
- data-slot="emperor-ui-item-card-image"
45
- src={item?.image?.src}
46
- alt={item?.image?.alt}
47
- className={cn("size-full object-cover", classNames?.image)}
48
- radius="none"
49
- removeWrapper
50
- />
51
- </div>
52
- )}
53
-
54
- <ItemBanner
55
- item={item}
56
- orientation={orientation}
57
- classNames={classNames}
58
- />
59
-
60
- {orientation === "vertical" && actionsViewVariant === "dropdown" && (
61
- <ItemActionsDropdown
62
- actions={actions}
63
- classNames={classNames}
64
- onActionClick={onActionClick}
65
- />
66
- )}
67
- </CardHeader>
68
- );
69
- }
@@ -1,123 +0,0 @@
1
- "use client";
2
-
3
- import type {
4
- ItemCardActionsViewVariant,
5
- ItemCardOrientation,
6
- ItemCardProps,
7
- } from "@/types";
8
- import { cn } from "@/utils";
9
- import { Card } from "@heroui/card";
10
- import { motion } from "framer-motion";
11
- import {
12
- itemMainWrapperClasses,
13
- itemCardMotionClasses,
14
- ItemActionsOverlay,
15
- } from "@/components";
16
- import { getCardMotion } from "@/constants";
17
- import {
18
- LoadingItem,
19
- ItemCardHeader,
20
- ItemCardBody,
21
- ItemCardFooter,
22
- } from "@/components";
23
- import { useWindowSize } from "@/hooks";
24
-
25
- export function ItemCard({
26
- variants,
27
- isLoading = false,
28
- className,
29
- classNames,
30
- item,
31
- actions = [],
32
- hoverEffect = "none",
33
- onActionClick,
34
- orientation: defaultOrientation = "vertical",
35
- actionsViewVariant = "dropdown",
36
- }: ItemCardProps) {
37
- const { isExtraSmallDevice } = useWindowSize();
38
-
39
- const orientation: ItemCardOrientation = isExtraSmallDevice
40
- ? "vertical"
41
- : defaultOrientation;
42
-
43
- if (isLoading)
44
- return (
45
- <LoadingItem
46
- className={className}
47
- classNames={classNames}
48
- orientation={orientation}
49
- />
50
- );
51
-
52
- const hasActions = actions && actions.length > 0;
53
-
54
- const isDropdownVariant: boolean =
55
- (actionsViewVariant as ItemCardActionsViewVariant) === "dropdown";
56
-
57
- const isHoverOverlayVariant: boolean =
58
- (actionsViewVariant as ItemCardActionsViewVariant) === "hover-overlay";
59
-
60
- return (
61
- <motion.div
62
- data-slot="emperor-ui-item-card"
63
- className={cn(
64
- itemCardMotionClasses({ orientation }),
65
- "group",
66
- classNames?.base,
67
- className,
68
- )}
69
- variants={variants}
70
- {...getCardMotion({ hoverEffect })}
71
- >
72
- <Card
73
- shadow="sm"
74
- data-slot="emperor-ui-item-card-main-wrapper"
75
- className={cn(
76
- itemMainWrapperClasses({ orientation }),
77
- "relative overflow-hidden",
78
- classNames?.mainWrapper,
79
- )}
80
- >
81
- <ItemCardHeader
82
- item={item}
83
- orientation={orientation}
84
- classNames={classNames}
85
- actions={actions}
86
- onActionClick={onActionClick}
87
- actionsViewVariant={
88
- isDropdownVariant ? "dropdown" : actionsViewVariant
89
- }
90
- />
91
-
92
- <ItemCardBody
93
- item={item}
94
- orientation={orientation}
95
- classNames={classNames}
96
- actions={actions}
97
- onActionClick={onActionClick}
98
- actionsViewVariant={
99
- isDropdownVariant ? "dropdown" : actionsViewVariant
100
- }
101
- />
102
-
103
- <ItemCardFooter
104
- item={item}
105
- orientation={orientation}
106
- classNames={classNames}
107
- actions={actions}
108
- onActionClick={onActionClick}
109
- actionsViewVariant={actionsViewVariant}
110
- />
111
-
112
- {isHoverOverlayVariant && hasActions && (
113
- <ItemActionsOverlay
114
- actions={actions}
115
- classNames={classNames}
116
- onActionClick={onActionClick}
117
- orientation={orientation}
118
- />
119
- )}
120
- </Card>
121
- </motion.div>
122
- );
123
- }
@@ -1,3 +0,0 @@
1
- export * from "./additions";
2
- export * from "./card";
3
- export * from "./actions";
@@ -1,2 +0,0 @@
1
- export * from "./components";
2
- export * from "./styles";
@@ -1,218 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import type { MockItemType } from "@/mocks";
3
- import { ItemCard } from "@/components";
4
- import { getStorybookDecorators } from "@/utils";
5
- import { getListing, MOCK_LISTINGS } 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 WithDropdownActions: 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 WithButtonsActions: Story = {
121
- args: {
122
- item: {
123
- key: String(MOCK_LISTINGS[0]?.id),
124
- title: MOCK_LISTINGS[0]?.title,
125
- description: MOCK_LISTINGS[0]?.description,
126
- image: {
127
- src: MOCK_LISTINGS[0]?.image || "",
128
- alt: MOCK_LISTINGS[0]?.title || "",
129
- },
130
- },
131
- actions: ITEM_CARD_ACTIONS,
132
- actionsViewVariant: "buttons",
133
- },
134
- };
135
-
136
- export const WithHoverOverlayActions: Story = {
137
- args: {
138
- item: {
139
- key: String(MOCK_LISTINGS[0]?.id),
140
- title: MOCK_LISTINGS[0]?.title,
141
- description: MOCK_LISTINGS[0]?.description,
142
- image: {
143
- src: MOCK_LISTINGS[0]?.image || "",
144
- alt: MOCK_LISTINGS[0]?.title || "",
145
- },
146
- },
147
- actions: ITEM_CARD_ACTIONS?.map((action) => ({
148
- ...action,
149
- variant: "solid",
150
- size: "lg",
151
- })),
152
- actionsViewVariant: "hover-overlay",
153
- },
154
- };
155
-
156
- export const WithChips: Story = {
157
- args: {
158
- item: {
159
- key: String(MOCK_LISTINGS[2]?.id),
160
- title: MOCK_LISTINGS[2]?.title,
161
- description: MOCK_LISTINGS[2]?.description,
162
- image: {
163
- src: MOCK_LISTINGS[2]?.image || "",
164
- alt: MOCK_LISTINGS[2]?.title || "",
165
- },
166
- chips: MOCK_LISTINGS[2]?.categories,
167
- },
168
- },
169
- };
170
-
171
- export const WithBanner: Story = {
172
- args: {
173
- item: {
174
- key: String(MOCK_LISTINGS[0]?.id),
175
- title: MOCK_LISTINGS[0]?.title,
176
- description: MOCK_LISTINGS[0]?.description,
177
- image: {
178
- src: MOCK_LISTINGS[0]?.image || "",
179
- alt: MOCK_LISTINGS[0]?.title || "",
180
- },
181
- banner: MOCK_LISTINGS[0]?.isBestSeller ? "Best Seller" : undefined,
182
- },
183
- },
184
- };
185
-
186
- export const WithPrice: Story = {
187
- args: {
188
- item: {
189
- key: String(MOCK_LISTINGS[0]?.id),
190
- title: MOCK_LISTINGS[0]?.title,
191
- description: MOCK_LISTINGS[0]?.description,
192
- price: `$ ${MOCK_LISTINGS[0]?.price}`,
193
- image: {
194
- src: MOCK_LISTINGS[0]?.image || "",
195
- alt: MOCK_LISTINGS[0]?.title || "",
196
- },
197
- },
198
- },
199
- };
200
-
201
- export const Horizontal: Story = {
202
- args: {
203
- orientation: "horizontal",
204
- actions: ITEM_CARD_ACTIONS,
205
- item: {
206
- key: String(MOCK_LISTINGS[0]?.id),
207
- title: MOCK_LISTINGS[0]?.title,
208
- description: MOCK_LISTINGS[0]?.description,
209
- image: {
210
- src: MOCK_LISTINGS[0]?.image || "",
211
- alt: MOCK_LISTINGS[0]?.title || "",
212
- },
213
- banner: MOCK_LISTINGS[0]?.isBestSeller ? "Best Seller" : undefined,
214
- chips: MOCK_LISTINGS[0]?.categories,
215
- price: `$ ${MOCK_LISTINGS[0]?.price}`,
216
- },
217
- },
218
- };