medusa-ui-common 2.0.0

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 (79) hide show
  1. package/package.json +93 -0
  2. package/src/common/components/breadcrumb/index.tsx +43 -0
  3. package/src/common/components/cart-totals/index.tsx +562 -0
  4. package/src/common/components/checkbox/index.tsx +98 -0
  5. package/src/common/components/delete-button/index.tsx +158 -0
  6. package/src/common/components/discount-code/index.tsx +220 -0
  7. package/src/common/components/divider/index.tsx +9 -0
  8. package/src/common/components/error-message/index.tsx +13 -0
  9. package/src/common/components/filter-checkbox-group/index.tsx +134 -0
  10. package/src/common/components/filter-radio-group/index.tsx +62 -0
  11. package/src/common/components/input/index.tsx +79 -0
  12. package/src/common/components/interactive-link/index.tsx +33 -0
  13. package/src/common/components/line-item-options/index.tsx +26 -0
  14. package/src/common/components/line-item-price/index.tsx +64 -0
  15. package/src/common/components/line-item-unit-price/index.tsx +64 -0
  16. package/src/common/components/localized-client-link/index.tsx +32 -0
  17. package/src/common/components/login-popup/index.tsx +78 -0
  18. package/src/common/components/modal/index.tsx +123 -0
  19. package/src/common/components/native-select/index.tsx +75 -0
  20. package/src/common/components/obfuscated-email/index.tsx +30 -0
  21. package/src/common/components/processing-overlay/index.tsx +83 -0
  22. package/src/common/components/radio/index.tsx +27 -0
  23. package/src/common/components/side-panel/index.tsx +65 -0
  24. package/src/common/components/submit-button/index.tsx +32 -0
  25. package/src/common/icons/arrow-left.tsx +36 -0
  26. package/src/common/icons/back.tsx +37 -0
  27. package/src/common/icons/bancontact.tsx +26 -0
  28. package/src/common/icons/chevron-down.tsx +30 -0
  29. package/src/common/icons/delivered.tsx +29 -0
  30. package/src/common/icons/envelope.tsx +27 -0
  31. package/src/common/icons/eye-off.tsx +37 -0
  32. package/src/common/icons/eye.tsx +37 -0
  33. package/src/common/icons/fast-delivery.tsx +65 -0
  34. package/src/common/icons/ideal.tsx +26 -0
  35. package/src/common/icons/lock.tsx +31 -0
  36. package/src/common/icons/map-pin.tsx +37 -0
  37. package/src/common/icons/medusa.tsx +27 -0
  38. package/src/common/icons/menu.tsx +45 -0
  39. package/src/common/icons/nextjs.tsx +27 -0
  40. package/src/common/icons/package.tsx +44 -0
  41. package/src/common/icons/paypal.tsx +30 -0
  42. package/src/common/icons/phone.tsx +30 -0
  43. package/src/common/icons/placeholder-image.tsx +44 -0
  44. package/src/common/icons/refresh.tsx +51 -0
  45. package/src/common/icons/spinner.tsx +37 -0
  46. package/src/common/icons/trash.tsx +51 -0
  47. package/src/common/icons/user.tsx +37 -0
  48. package/src/common/icons/x.tsx +37 -0
  49. package/src/constants/payments.tsx +31 -0
  50. package/src/context/modal-context.tsx +37 -0
  51. package/src/context/wishlist-context.tsx +83 -0
  52. package/src/index.ts +16 -0
  53. package/src/skeletons/components/skeleton-button/index.tsx +5 -0
  54. package/src/skeletons/components/skeleton-card-details/index.tsx +10 -0
  55. package/src/skeletons/components/skeleton-cart-item/index.tsx +35 -0
  56. package/src/skeletons/components/skeleton-cart-totals/index.tsx +30 -0
  57. package/src/skeletons/components/skeleton-code-form/index.tsx +13 -0
  58. package/src/skeletons/components/skeleton-line-item/index.tsx +35 -0
  59. package/src/skeletons/components/skeleton-order-confirmed-header/index.tsx +14 -0
  60. package/src/skeletons/components/skeleton-order-information/index.tsx +36 -0
  61. package/src/skeletons/components/skeleton-order-items/index.tsx +43 -0
  62. package/src/skeletons/components/skeleton-order-summary/index.tsx +15 -0
  63. package/src/skeletons/components/skeleton-product-preview/index.tsx +15 -0
  64. package/src/skeletons/templates/skeleton-cart-page/index.tsx +65 -0
  65. package/src/skeletons/templates/skeleton-order-confirmed/index.tsx +21 -0
  66. package/src/skeletons/templates/skeleton-product-grid/index.tsx +23 -0
  67. package/src/skeletons/templates/skeleton-related-products/index.tsx +25 -0
  68. package/src/types/global.ts +24 -0
  69. package/src/types/icon.ts +6 -0
  70. package/src/util/checkout-dom.ts +65 -0
  71. package/src/util/compare-addresses.ts +28 -0
  72. package/src/util/env.ts +3 -0
  73. package/src/util/get-percentage-diff.ts +6 -0
  74. package/src/util/get-product-price.ts +79 -0
  75. package/src/util/isEmpty.ts +11 -0
  76. package/src/util/money.ts +26 -0
  77. package/src/util/product.ts +86 -0
  78. package/src/util/repeat.ts +5 -0
  79. package/src/util/returns.ts +72 -0
package/package.json ADDED
@@ -0,0 +1,93 @@
1
+ {
2
+ "name": "medusa-ui-common",
3
+ "version": "2.0.0",
4
+ "description": "Shared storefront UI primitives.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "sideEffects": false,
11
+ "files": [
12
+ "src"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc --noEmit --skipLibCheck",
16
+ "clean": "true"
17
+ },
18
+ "peerDependencies": {
19
+ "@medusajs/types": ">=2",
20
+ "@medusajs/ui": "*",
21
+ "lodash": ">=4",
22
+ "lucide-react": "*",
23
+ "medusa-contact-logic-plugin": "^2.0.0",
24
+ "medusa-reviews-logic": "^2.0.0",
25
+ "medusa-storefront-analytics": "^1.3.0",
26
+ "medusa-storefront-data": "^2.0.0",
27
+ "medusa-storefront-hooks": "^1.0.0",
28
+ "medusa-wishlist-logic": "^2.0.0",
29
+ "next": ">=14.0.0",
30
+ "react": "^18.0.0 || ^19.0.0",
31
+ "react-dom": "^18.0.0 || ^19.0.0"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "next": {
35
+ "optional": true
36
+ }
37
+ },
38
+ "exports": {
39
+ "./package.json": "./package.json",
40
+ ".": {
41
+ "types": "./src/index.ts",
42
+ "import": "./src/index.ts",
43
+ "default": "./src/index.ts"
44
+ },
45
+ "./common/*": {
46
+ "types": "./src/common/*",
47
+ "import": "./src/common/*",
48
+ "default": "./src/common/*"
49
+ },
50
+ "./context/*": {
51
+ "types": "./src/context/*",
52
+ "import": "./src/context/*",
53
+ "default": "./src/context/*"
54
+ },
55
+ "./util/*": {
56
+ "types": "./src/util/*",
57
+ "import": "./src/util/*",
58
+ "default": "./src/util/*"
59
+ },
60
+ "./skeletons/*": {
61
+ "types": "./src/skeletons/*",
62
+ "import": "./src/skeletons/*",
63
+ "default": "./src/skeletons/*"
64
+ },
65
+ "./types/*": {
66
+ "types": "./src/types/*",
67
+ "import": "./src/types/*",
68
+ "default": "./src/types/*"
69
+ },
70
+ "./constants/*": {
71
+ "types": "./src/constants/*",
72
+ "import": "./src/constants/*",
73
+ "default": "./src/constants/*"
74
+ }
75
+ },
76
+ "typesVersions": {
77
+ "*": {
78
+ "*": [
79
+ "src/*"
80
+ ]
81
+ }
82
+ },
83
+ "devDependencies": {
84
+ "@headlessui/react": "^2.2.0",
85
+ "@medusajs/icons": "^2.0.0",
86
+ "@medusajs/ui": "^4.0.0",
87
+ "@types/react": "18.3.18",
88
+ "@types/react-dom": "18.3.5",
89
+ "typescript": "^5.6.0",
90
+ "color": "^5.0.3",
91
+ "react-razorpay": "^3.0.1"
92
+ }
93
+ }
@@ -0,0 +1,43 @@
1
+ import { HttpTypes } from "@medusajs/types"
2
+ import LocalizedClientLink from "../localized-client-link"
3
+
4
+ type BreadcrumbProps = {
5
+ product: HttpTypes.StoreProduct
6
+ }
7
+
8
+ export default function Breadcrumb({ product }: BreadcrumbProps) {
9
+ const primaryCategory = product.categories?.[0]
10
+
11
+ return (
12
+ <nav className="text-xs sm:text-sm text-gray-800 mb-3 sm:mb-4 overflow-x-auto font-medium">
13
+ <div className="flex items-center whitespace-nowrap">
14
+ <LocalizedClientLink href="/" className="hover:text-gray-900 transition-colors">
15
+ Home
16
+ </LocalizedClientLink>
17
+ <span className="mx-2">/</span>
18
+ <LocalizedClientLink href="/store" className="hover:text-gray-900 transition-colors">
19
+ Shop
20
+ </LocalizedClientLink>
21
+ {primaryCategory && (
22
+ <>
23
+ <span className="mx-2">/</span>
24
+ <LocalizedClientLink
25
+ href={`/store?category=${primaryCategory.id}`}
26
+ className="hover:text-gray-900 transition-colors"
27
+ >
28
+ {primaryCategory.name}
29
+ </LocalizedClientLink>
30
+ </>
31
+ )}
32
+ <span className="mx-2">/</span>
33
+ <span className="text-gray-900 truncate max-w-[150px] sm:max-w-[300px] md:max-w-[400px] inline-block align-bottom" title={product.title ?? ""}>
34
+ {product.title}
35
+ </span>
36
+ </div>
37
+ </nav>
38
+ )
39
+ }
40
+
41
+
42
+
43
+